kennel 0.2.2 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -13
- package/dist/cli/dispatch.js +16 -3
- package/dist/cli/src/cli/dispatch.js +16 -3
- package/dist/cli/src/cli/usage.js +1 -1
- package/dist/cli/src/core/command.js +1 -0
- package/dist/cli/src/core/init.js +5 -5
- package/dist/cli/src/plugins/external.d.ts +29 -3
- package/dist/cli/src/plugins/external.js +78 -24
- package/dist/cli/src/site/server-plugins.d.ts +2 -7
- package/dist/cli/src/site/viewer.js +1 -0
- package/dist/cli/usage.js +1 -1
- package/dist/core/command.js +1 -0
- package/dist/core/init.js +5 -5
- package/dist/core/runtime.js +357 -3207
- package/dist/package/preview.js +1232 -5113
- package/dist/plugins/external.d.ts +29 -3
- package/dist/plugins/external.js +78 -24
- package/dist/site/server-plugins.d.ts +2 -7
- package/dist/site/server-plugins.js +552 -10447
- package/dist/site/viewer.js +1 -0
- package/kernel/apps/web/package.json +1 -5
- package/kernel/apps/web/scripts/dev.mjs +53 -0
- package/kernel/apps/web/src/app.css +0 -3
- package/kernel/apps/web/src/main.tsx +0 -1
- package/kernel/apps/web/src/plugins.ts +0 -30
- package/kernel/apps/web/tsconfig.json +1 -2
- package/kernel/apps/web/vite.config.ts +31 -13
- package/kernel/packages/api/package.json +0 -4
- package/kernel/packages/api/src/server/folder-metadata-plugin.ts +13 -38
- package/kernel/packages/api/src/server/index.ts +0 -1
- package/kernel/packages/api/src/server/plugins.ts +49 -16
- package/kernel/packages/api/test/core.test.ts +13 -25
- package/kernel/packages/markdown/README.md +1 -1
- package/package.json +1 -1
- package/web/assets/{abnfDiagram-VRR7QNED-Bgfb1nEB.js → abnfDiagram-VRR7QNED-xd_g1uK3.js} +1 -1
- package/web/assets/app-CX20nNIa.js +2 -0
- package/web/assets/{app-options-D-RJiQ-X.js → app-options-CkPJE5ep.js} +1 -1
- package/web/assets/{app-view-header-BLvLq02T.js → app-view-header-CNk5KnA-.js} +1 -1
- package/web/assets/{arc-Dk_KI36B.js → arc-B0u5yBJA.js} +1 -1
- package/web/assets/{architectureDiagram-ZJ3FMSHR-NR_KhRCf.js → architectureDiagram-ZJ3FMSHR-DfxOAo8P.js} +1 -1
- package/web/assets/{ask-tray-TzeTcO6-.js → ask-tray-SscJecDY.js} +1 -1
- package/web/assets/{blockDiagram-677ZJIJ3-CkLkwx9C.js → blockDiagram-677ZJIJ3-Ci3Usxh6.js} +1 -1
- package/web/assets/{c4Diagram-LMCZKHZV-CFCUH8e_.js → c4Diagram-LMCZKHZV-BqgwIVgh.js} +1 -1
- package/web/assets/channel-X7WHyxxT.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-B_BPLWsW.js → chunk-2Q5K7J3B-CfX69l2U.js} +1 -1
- package/web/assets/{chunk-32BRIVSS-B1VB1hOy.js → chunk-32BRIVSS-CuFlzZkl.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-KFcYr8Co.js → chunk-5VM5RSS4-DidCMlJa.js} +1 -1
- package/web/assets/{chunk-EX3LRPZG-CpBX3kuK.js → chunk-EX3LRPZG-B5CDm1dS.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-BPSl40wG.js → chunk-JWPE2WC7-D5fGV_sH.js} +1 -1
- package/web/assets/{chunk-MOJQB5TN-D2RcYmoU.js → chunk-MOJQB5TN-ayhH5Q-H.js} +1 -1
- package/web/assets/{chunk-RYQCIY6F-m7Gyn-t3.js → chunk-RYQCIY6F-C4BfOOZn.js} +1 -1
- package/web/assets/{chunk-V7JOEXUC-TDvdopxS.js → chunk-V7JOEXUC-DpUEIM9V.js} +1 -1
- package/web/assets/{chunk-VR4S4FIN-DZTsG51a.js → chunk-VR4S4FIN-DoQuFFRh.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-Dp0--RE2.js → chunk-XXDRQBXY-CI9eiLwn.js} +1 -1
- package/web/assets/classDiagram-OUVF2IWQ-BjsLQ3dz.js +1 -0
- package/web/assets/classDiagram-v2-EOCWNBFH-BjsLQ3dz.js +1 -0
- package/web/assets/client-7OWw5kW2.js +6 -0
- package/web/assets/client-DYj_td4Q.js +17 -0
- package/web/assets/{client-j2kQmxsO.js → client-Dk-NBvJR.js} +4 -4
- package/web/assets/command-zkzH4hVz.js +38 -0
- package/web/assets/{copy-context-C0Uqsp-3.js → copy-context-D5oiWrYC.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-CPu3PI8h.js → cose-bilkent-JH36ORCC-BHRk1mO3.js} +1 -1
- package/web/assets/{cynefin-VYW2F7L2-DWxftYAm.js → cynefin-VYW2F7L2-C1B09TRE.js} +1 -1
- package/web/assets/{cynefinDiagram-TSTJHNR4-DsmN2V-p.js → cynefinDiagram-TSTJHNR4-B27qXQbv.js} +1 -1
- package/web/assets/{dagre-VKFMJZFB-COEbApyY.js → dagre-VKFMJZFB-B1qEi32g.js} +1 -1
- package/web/assets/{diagram-FQU43EPY-0O9WGWKB.js → diagram-FQU43EPY-BMkkgADD.js} +1 -1
- package/web/assets/{diagram-G47NLZAW-CutEdMVh.js → diagram-G47NLZAW-Cb8_g1A5.js} +1 -1
- package/web/assets/{diagram-NH7WQ7WH-C9KZc3B2.js → diagram-NH7WQ7WH-B51wuc5m.js} +1 -1
- package/web/assets/{diagram-OA4YK3LP-D8kkPXbY.js → diagram-OA4YK3LP-xnsecbbI.js} +1 -1
- package/web/assets/{diagram-WEI45ONY-_YqiTaGP.js → diagram-WEI45ONY-DSZdyaAV.js} +1 -1
- package/web/assets/{document-Dgt5eZFj.js → document-Dc2dftTW.js} +3 -3
- package/web/assets/{ebnfDiagram-CCIWWBDH-JO-zQh6g.js → ebnfDiagram-CCIWWBDH-aTHmcUGy.js} +1 -1
- package/web/assets/{entities-C3wz7FCx.js → entities-CCUtpskY.js} +1 -1
- package/web/assets/{erDiagram-Q63AITRT-9UjQwJ4P.js → erDiagram-Q63AITRT-CUUPBcvo.js} +1 -1
- package/web/assets/{file-viewer-DZJ8nYnl.js → file-viewer-DJ3rsmef.js} +1 -1
- package/web/assets/{flowDiagram-23GEKE2U-Ca08tnYM.js → flowDiagram-23GEKE2U-aTQXx2Mh.js} +1 -1
- package/web/assets/{folder-image-BfGgxo7i.js → folder-image-Bnv43tzP.js} +1 -1
- package/web/assets/{folder-landing-qUKBCnG-.js → folder-landing-DCnzYXXY.js} +1 -1
- package/web/assets/{folder-list-BfFjv7rR.js → folder-list-DvVkVjiR.js} +1 -1
- package/web/assets/{folder-metadata-DCw8xzHk.js → folder-metadata-C9hMMzIH.js} +1 -1
- package/web/assets/{folder-mobile-bar-Ubz4babf.js → folder-mobile-bar-VoTL1GS0.js} +1 -1
- package/web/assets/folder-plugin-view-Cvd804ZU.js +6 -0
- package/web/assets/{ganttDiagram-NO4QXBWP-KnHzX5W3.js → ganttDiagram-NO4QXBWP-DiwdUp7u.js} +1 -1
- package/web/assets/{gitGraphDiagram-IHSO6WYX-Cm8woNtK.js → gitGraphDiagram-IHSO6WYX-BL2gG_IS.js} +1 -1
- package/web/assets/{index-CNyy98F8.js → index-CUTtMSyJ.js} +2 -2
- package/web/assets/index-CegvVQ1C.js +1 -0
- package/web/assets/index-Dwhf8F_U.css +1 -0
- package/web/assets/{infoDiagram-FWYZ7A6U-yyqmUtIb.js → infoDiagram-FWYZ7A6U-B3n0zZpt.js} +1 -1
- package/web/assets/{ishikawaDiagram-FXEZZL3T-BfvR_Zy4.js → ishikawaDiagram-FXEZZL3T-D7YytbEv.js} +1 -1
- package/web/assets/{journeyDiagram-5HDEW3XC-BKuw06HM.js → journeyDiagram-5HDEW3XC-BYwqEl3C.js} +1 -1
- package/web/assets/{kanban-definition-HUTT4EX6-n0010rmQ.js → kanban-definition-HUTT4EX6-BQHNJgXZ.js} +1 -1
- package/web/assets/{linear-C0d0lT8O.js → linear-BPiQCLNk.js} +1 -1
- package/web/assets/{mermaid.core-BDVbShyO.js → mermaid.core-CD-KvBjV.js} +4 -4
- package/web/assets/{metadata-KV0dpp4G.js → metadata-COJ7fZul.js} +1 -1
- package/web/assets/{mindmap-definition-LN4V7U3C--_0ks3GF.js → mindmap-definition-LN4V7U3C-C1L_gyoj.js} +1 -1
- package/web/assets/{pegDiagram-2B236MQR-CBoNIpKR.js → pegDiagram-2B236MQR-BDAfItqS.js} +1 -1
- package/web/assets/{pieDiagram-ENE6RG2P-MA5tkYh5.js → pieDiagram-ENE6RG2P-CkZYH3Vz.js} +1 -1
- package/web/assets/{popover-DBD7FF-W.js → popover-0oA2lLUV.js} +2 -2
- package/web/assets/{project-search-dialog-DM1IkSZu.js → project-search-dialog-B2oqMT6h.js} +1 -1
- package/web/assets/{quadrantDiagram-ABIIQ3AL-CWT1ryqF.js → quadrantDiagram-ABIIQ3AL-Dy8Al3YZ.js} +1 -1
- package/web/assets/{railroadDiagram-RFXS5EU6-ZiLB5FGi.js → railroadDiagram-RFXS5EU6-Dd9_yo7B.js} +1 -1
- package/web/assets/{requirementDiagram-TGXJPOKE-CQq9uneq.js → requirementDiagram-TGXJPOKE-DPhIUsbs.js} +1 -1
- package/web/assets/{sankeyDiagram-HTMAVEWB-qDG-0JqI.js → sankeyDiagram-HTMAVEWB-B2QkYtub.js} +1 -1
- package/web/assets/{search-DNrQA5fF.js → search-C1J0-xiB.js} +1 -1
- package/web/assets/select-CtXC_PLC.js +30 -0
- package/web/assets/{selection-popup-DmtTeRs2.js → selection-popup-qhlUFzGq.js} +1 -1
- package/web/assets/{sequenceDiagram-DBY2YBRQ-CiApurLO.js → sequenceDiagram-DBY2YBRQ-Bx7fcZDx.js} +1 -1
- package/web/assets/{sizeCapture-X5ZJPWSS-DZSR5QXm.js → sizeCapture-X5ZJPWSS-CIXIhl_A.js} +1 -1
- package/web/assets/{stateDiagram-2N3HPSRC-CjJJR9_z.js → stateDiagram-2N3HPSRC-DCrdAflB.js} +1 -1
- package/web/assets/stateDiagram-v2-6OUMAXLB-0KCFLYeQ.js +1 -0
- package/web/assets/{swimlanes-5IMT3BWC-CKmo1sg6.js → swimlanes-5IMT3BWC-DA2vc7iZ.js} +2 -2
- package/web/assets/swimlanesDiagram-G3AALYLV-CAw3AV84.js +8 -0
- package/web/assets/{timeline-definition-FHXFAJF6-D-NMwS3y.js → timeline-definition-FHXFAJF6-lKfJiV9V.js} +1 -1
- package/web/assets/{vennDiagram-L72KCM5P-CfL6LBWw.js → vennDiagram-L72KCM5P-DO1q2KzG.js} +1 -1
- package/web/assets/{view-context-gyDl_p2V.js → view-context-DXKM3-l1.js} +4 -4
- package/web/assets/{viewer-capabilities-Bpp8Uvcg.js → viewer-capabilities-Cig_xM9u.js} +1 -1
- package/web/assets/{wardleyDiagram-EHGQE667-DgldMxaj.js → wardleyDiagram-EHGQE667-Dal9LkuZ.js} +1 -1
- package/web/assets/{xychartDiagram-FW5EYKEG-CIoAIFX8.js → xychartDiagram-FW5EYKEG-B3dPLPII.js} +1 -1
- package/web/index.html +2 -2
- package/kernel/packages/api/test/partial-loading.test.ts +0 -43
- package/kernel/plugins/calendar/SKILL.md +0 -173
- package/kernel/plugins/calendar/eslint.config.js +0 -10
- package/kernel/plugins/calendar/package.json +0 -73
- package/kernel/plugins/calendar/schema.json +0 -137
- package/kernel/plugins/calendar/src/calendar.tsx +0 -328
- package/kernel/plugins/calendar/src/client.tsx +0 -139
- package/kernel/plugins/calendar/src/context.ts +0 -48
- package/kernel/plugins/calendar/src/copy-button.tsx +0 -66
- package/kernel/plugins/calendar/src/event-dialog.tsx +0 -270
- package/kernel/plugins/calendar/src/index.ts +0 -4
- package/kernel/plugins/calendar/src/manifest.ts +0 -7
- package/kernel/plugins/calendar/src/parse.ts +0 -610
- package/kernel/plugins/calendar/src/server.ts +0 -160
- package/kernel/plugins/calendar/src/utils.ts +0 -80
- package/kernel/plugins/calendar/src/views.tsx +0 -418
- package/kernel/plugins/calendar/test/context.test.mjs +0 -60
- package/kernel/plugins/calendar/test/package.test.mjs +0 -43
- package/kernel/plugins/calendar/test/parse.test.mjs +0 -392
- package/kernel/plugins/calendar/test/server.test.mjs +0 -126
- package/kernel/plugins/calendar/tsconfig.json +0 -17
- package/kernel/plugins/mail/SKILL.md +0 -97
- package/kernel/plugins/mail/eslint.config.js +0 -10
- package/kernel/plugins/mail/package.json +0 -79
- package/kernel/plugins/mail/src/api.ts +0 -359
- package/kernel/plugins/mail/src/bun-ffi.d.ts +0 -14
- package/kernel/plugins/mail/src/client.tsx +0 -14
- package/kernel/plugins/mail/src/flock.ts +0 -137
- package/kernel/plugins/mail/src/folders.ts +0 -37
- package/kernel/plugins/mail/src/history.ts +0 -485
- package/kernel/plugins/mail/src/index.ts +0 -3
- package/kernel/plugins/mail/src/mail-card.tsx +0 -123
- package/kernel/plugins/mail/src/mail-conversation.tsx +0 -153
- package/kernel/plugins/mail/src/mail-detail-page.tsx +0 -467
- package/kernel/plugins/mail/src/mail-hooks.ts +0 -252
- package/kernel/plugins/mail/src/mail-page.tsx +0 -109
- package/kernel/plugins/mail/src/mail-request.ts +0 -78
- package/kernel/plugins/mail/src/mail-send-box.tsx +0 -175
- package/kernel/plugins/mail/src/mailos.ts +0 -723
- package/kernel/plugins/mail/src/manifest.ts +0 -7
- package/kernel/plugins/mail/src/node.ts +0 -171
- package/kernel/plugins/mail/src/parse.ts +0 -139
- package/kernel/plugins/mail/src/server.ts +0 -125
- package/kernel/plugins/mail/src/types.ts +0 -10
- package/kernel/plugins/mail/src/viewer.tsx +0 -147
- package/kernel/plugins/mail/test/flock.test.mjs +0 -156
- package/kernel/plugins/mail/test/folders.test.mjs +0 -138
- package/kernel/plugins/mail/test/history.test.mjs +0 -460
- package/kernel/plugins/mail/test/mailos.test.mjs +0 -752
- package/kernel/plugins/mail/test/node.test.mjs +0 -207
- package/kernel/plugins/mail/test/package.test.mjs +0 -54
- package/kernel/plugins/mail/test/parse.test.mjs +0 -32
- package/kernel/plugins/mail/test/server.test.mjs +0 -116
- package/kernel/plugins/mail/test/viewer.test.mjs +0 -192
- package/kernel/plugins/mail/tsconfig.json +0 -17
- package/kernel/plugins/projects/SKILL.md +0 -73
- package/kernel/plugins/projects/eslint.config.js +0 -10
- package/kernel/plugins/projects/package.json +0 -70
- package/kernel/plugins/projects/src/client.tsx +0 -17
- package/kernel/plugins/projects/src/data/model.ts +0 -129
- package/kernel/plugins/projects/src/index.ts +0 -17
- package/kernel/plugins/projects/src/manifest.ts +0 -7
- package/kernel/plugins/projects/src/project-context.ts +0 -41
- package/kernel/plugins/projects/src/server.ts +0 -276
- package/kernel/plugins/projects/src/ui/project-card.tsx +0 -61
- package/kernel/plugins/projects/src/ui/projects-page.tsx +0 -102
- package/kernel/plugins/projects/test/package.test.mjs +0 -51
- package/kernel/plugins/projects/tsconfig.json +0 -17
- package/kernel/plugins/tasks/SKILL.md +0 -341
- package/kernel/plugins/tasks/eslint.config.js +0 -10
- package/kernel/plugins/tasks/package.json +0 -74
- package/kernel/plugins/tasks/schema.json +0 -939
- package/kernel/plugins/tasks/src/api.ts +0 -212
- package/kernel/plugins/tasks/src/client.tsx +0 -23
- package/kernel/plugins/tasks/src/data/parse.ts +0 -544
- package/kernel/plugins/tasks/src/data/task-id.ts +0 -56
- package/kernel/plugins/tasks/src/data/todo-model.ts +0 -795
- package/kernel/plugins/tasks/src/index.ts +0 -34
- package/kernel/plugins/tasks/src/manifest.ts +0 -7
- package/kernel/plugins/tasks/src/pages/task-detail.tsx +0 -48
- package/kernel/plugins/tasks/src/pages/task-list.tsx +0 -88
- package/kernel/plugins/tasks/src/server.ts +0 -447
- package/kernel/plugins/tasks/src/styles.css +0 -9
- package/kernel/plugins/tasks/src/ui/compact-todo-list.tsx +0 -372
- package/kernel/plugins/tasks/src/ui/error-details.tsx +0 -78
- package/kernel/plugins/tasks/src/ui/task-page.tsx +0 -392
- package/kernel/plugins/tasks/src/ui/todo-agent-filter.tsx +0 -36
- package/kernel/plugins/tasks/src/ui/todo-filter-bar.tsx +0 -66
- package/kernel/plugins/tasks/src/ui/todo-item.tsx +0 -494
- package/kernel/plugins/tasks/src/ui/todo-status-filter.tsx +0 -60
- package/kernel/plugins/tasks/src/ui/todo-tag-filter.tsx +0 -48
- package/kernel/plugins/tasks/src/ui/todo-warnings.tsx +0 -106
- package/kernel/plugins/tasks/test/api.test.mjs +0 -99
- package/kernel/plugins/tasks/test/folder-sources.test.mjs +0 -46
- package/kernel/plugins/tasks/test/package.test.mjs +0 -54
- package/kernel/plugins/tasks/test/parse.test.mjs +0 -225
- package/kernel/plugins/tasks/test/server.test.mjs +0 -386
- package/kernel/plugins/tasks/tsconfig.json +0 -17
- package/web/assets/app-DoGr2Zi7.js +0 -2
- package/web/assets/channel-uMEjV8qc.js +0 -1
- package/web/assets/classDiagram-OUVF2IWQ-fbZocVor.js +0 -1
- package/web/assets/classDiagram-v2-EOCWNBFH-fbZocVor.js +0 -1
- package/web/assets/client-C6Nxdfif.js +0 -2
- package/web/assets/client-CXYfBko5.js +0 -17
- package/web/assets/client-CoKtOq-X.js +0 -7
- package/web/assets/client-DyRQz5RU.js +0 -53
- package/web/assets/client-OY6HUzuD.js +0 -98
- package/web/assets/client-YOYWZIFi.js +0 -34
- package/web/assets/command-BugZBGXE.js +0 -38
- package/web/assets/folder-plugin-view-DsWR1zmQ.js +0 -6
- package/web/assets/index-BaRnbYRw.js +0 -1
- package/web/assets/index-BexmLxIP.css +0 -1
- package/web/assets/index-DDirZMgx.js +0 -1
- package/web/assets/note-card-DBfX6gW1.js +0 -6
- package/web/assets/select-D8cqNgcp.js +0 -30
- package/web/assets/stateDiagram-v2-6OUMAXLB-BpeGSCu9.js +0 -1
- package/web/assets/swimlanesDiagram-G3AALYLV-D9RjLKb9.js +0 -8
- package/web/assets/use-folder-filter-LQyXns5Q.js +0 -1
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import{j as l,c as ge}from"./react-B9jn2M18.js";import{B as ir,a as Rp,t as Cp}from"./folder-plugin-view-DsWR1zmQ.js";import{m as ci}from"./tanstack-YzX_Mi37.js";import{B as xr}from"./button-C6arH7zt.js";import{l as me,t as jp}from"./view-context-gyDl_p2V.js";import{a as Dt}from"./utils-DCaHk0Gm.js";import{C as zs}from"./copy-context-C0Uqsp-3.js";import{N as Mp,n as Ap}from"./note-card-DBfX6gW1.js";import{D as Fp,g as Pp,h as Lp,i as Dp,j as Kp,k as Up}from"./command-BugZBGXE.js";import{u as qp}from"./use-folder-filter-LQyXns5Q.js";import{a as Bp}from"./index-CNyy98F8.js";import{R as Jp,T as Vp,c as zp,C as Hp}from"./popover-DBD7FF-W.js";import{S as Wp,a as Gp,c as Yp,b as Qp,d as Xp,e as Zp,f as em,g as tm,i as nm,h as rm}from"./index-BaRnbYRw.js";import"./markdown-Bw9RgUGR.js";import"./folder-image-BfGgxo7i.js";import"./index-CCXE8zc9.js";import"./viewer-capabilities-Bpp8Uvcg.js";import"./folder-activity-Cv1X2ezj.js";import"./index-DDirZMgx.js";import"./index-CXhBn-ar.js";import"./index-Bp9DidgD.js";function sm({file:e,issues:t,variant:n="error"}){return n==="warning"?l.jsxs("div",{className:"rounded-md border border-amber-500/40 p-4",children:[l.jsxs("p",{className:"m-0 text-sm font-semibold text-amber-700",children:[e," warnings."]}),l.jsx("ul",{className:"m-0 mt-2 list-disc space-y-1 pl-5 text-sm text-amber-700",children:t.map((r,s)=>l.jsxs("li",{children:[l.jsx("code",{className:"text-[13px]",children:r.path||e}),r.path?": ":" — ",r.message]},s))})]}):l.jsxs("div",{className:"rounded-md border border-[#9c3a3a]/40 p-4",children:[l.jsxs("p",{className:"m-0 text-sm font-semibold text-[#9c3a3a]",children:[e," is not valid."]}),l.jsx("ul",{className:"m-0 mt-2 list-disc space-y-1 pl-5 text-sm text-[#9c3a3a]",children:t.map((r,s)=>l.jsxs("li",{children:[l.jsx("code",{className:"text-[13px]",children:r.path||e}),r.path?": ":" — ",r.message]},s))})]})}const el="text-muted-foreground m-0 text-sm";function tl({header:e,extra:t,children:n}){return l.jsxs("div",{className:`mx-auto grid w-full max-w-3xl min-w-0 grid-cols-1 gap-4 px-4
|
|
2
|
-
py-5`,children:[e,t,n]})}function ys({children:e}){return typeof e=="string"?l.jsx("p",{className:el,children:e}):e}function nl({error:e,onRetry:t}){return typeof e!="string"?e:l.jsxs("div",{className:"grid justify-items-start gap-2",role:"alert",children:[l.jsx("p",{className:Dt(el,"text-destructive"),children:e}),t?l.jsx(xr,{onClick:t,size:"sm",type:"button",variant:"outline",children:"Retry"}):null]})}function om({href:e,name:t}){return l.jsxs("a",{className:`inline-flex w-fit items-center gap-2 rounded-md border
|
|
3
|
-
border-[#dde1dc] bg-white px-3 py-1.5 text-sm text-[#4a554b]
|
|
4
|
-
no-underline hover:bg-[#f3f5f2]`,href:e,children:[l.jsx(me.ArrowLeft,{"aria-hidden":"true",className:"size-4"}),"Back to ",t]})}function im({listHref:e,listName:t,noun:n,header:r,extra:s,loading:o=!1,error:i,onRetry:a,missing:c,children:u}){return l.jsxs(tl,{header:l.jsxs(l.Fragment,{children:[l.jsx(om,{href:e,name:t}),r]}),extra:s,children:[o?l.jsxs(ys,{children:["Loading ",n,"…"]}):null,i?l.jsx(nl,{error:i,onRetry:a}):null,!o&&!i&&c!=null?l.jsx(ys,{children:c}):null,u]})}function am({noun:e,header:t,extra:n,loading:r=!1,error:s,onRetry:o,empty:i,children:a}){return l.jsxs(tl,{header:t,extra:n,children:[r?l.jsxs(ys,{children:["Loading ",e,"…"]}):null,s?l.jsx(nl,{error:s,onRetry:o}):null,!r&&!s&&i!=null?l.jsx(ys,{children:i}):null,!r&&!s&&i==null?a:null]})}const cm=e=>typeof e=="function",d=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):n=>t(n,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(n,r){return arguments.length>=2?t(n,r):function(s){return t(s,n)}};case 3:return function(n,r,s){return arguments.length>=3?t(n,r,s):function(o){return t(o,n,r)}};case 4:return function(n,r,s,o){return arguments.length>=4?t(n,r,s,o):function(i){return t(i,n,r,s)}};case 5:return function(n,r,s,o,i){return arguments.length>=5?t(n,r,s,o,i):function(a){return t(a,n,r,s,o)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);const n=arguments;return function(r){return t(r,...n)}}}},Y=e=>e,Hs=e=>()=>e,Tc=Hs(!0),ui=Hs(!1),rl=Hs(void 0),um=rl;function g(e,t,n,r,s,o,i,a,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 s(r(n(t(e))));case 6:return o(s(r(n(t(e)))));case 7:return i(o(s(r(n(t(e))))));case 8:return a(i(o(s(r(n(t(e)))))));case 9:return c(a(i(o(s(r(n(t(e))))))));default:{let u=arguments[0];for(let f=1;f<arguments.length;f++)u=arguments[f](u);return u}}}const Ws=e=>(t,n)=>t===n||e(t,n),lm=d(2,(e,t)=>Ws((n,r)=>e(t(n),t(r)))),fm=e=>Ws((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}),Oc="effect/GlobalValue";let Qn;const B=(e,t)=>(Qn||(globalThis[Oc]??=new Map,Qn=globalThis[Oc]),Qn.has(e)||Qn.set(e,t()),Qn.get(e)),lt=e=>typeof e=="string",zt=e=>typeof e=="number",na=e=>typeof e=="boolean",Gs=e=>typeof e=="bigint",li=e=>typeof e=="symbol",vr=cm,dm=e=>e===void 0,hm=e=>e!==void 0,Po=e=>e!==null,pm=e=>!1,ra=e=>typeof e=="object"&&e!==null,kt=e=>ra(e)||vr(e),A=d(2,(e,t)=>kt(e)&&t in e),sl=d(2,(e,t)=>A(e,"_tag")&&e._tag===t),ln=e=>e==null,mm=e=>e!=null,gm=e=>e instanceof Date,ym=e=>typeof e=="string"||A(e,Symbol.iterator),bm=e=>ra(e)&&!Array.isArray(e),_m=e=>A(e,"then")&&vr(e.then),Ys=e=>`BUG: ${e} - please report an issue at https://github.com/Effect-TS/effect/issues`;let ol=class il{self;called=!1;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new il(this.self)}};const Sm=335903614,wm=4150755663,km=1481765933,xm=1284865837,vm=9007199254740992,Tm=134217728;class Om{_state;constructor(t,n,r,s){return ln(n)&&ln(t)?(n=Math.random()*4294967295>>>0,t=0):ln(n)&&(n=t,t=0),ln(s)&&ln(r)?(s=this._state?this._state[3]:wm,r=this._state?this._state[2]:Sm):ln(s)&&(s=r,r=0),this._state=new Int32Array([0,0,r>>>0,((s||0)|1)>>>0]),this._next(),Nc(this._state,this._state[0],this._state[1],t>>>0,n>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(t){this._state[0]=t[0],this._state[1]=t[1],this._state[2]=t[2],this._state[3]=t[3]|1}integer(t){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%t}number(){const t=(this._next()&67108863)*1,n=(this._next()&134217727)*1;return(t*Tm+n)/vm}_next(){const t=this._state[0]>>>0,n=this._state[1]>>>0;Nm(this._state,t,n,km,xm),Nc(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let r=t>>>18,s=(n>>>18|t<<14)>>>0;r=(r^t)>>>0,s=(s^n)>>>0;const o=(s>>>27|r<<5)>>>0,i=t>>>27,a=(-i>>>0&31)>>>0;return(o>>>i|o<<a)>>>0}}function Nm(e,t,n,r,s){let o=(n>>>16)*(s&65535)>>>0,i=(n&65535)*(s>>>16)>>>0,a=(n&65535)*(s&65535)>>>0,c=(n>>>16)*(s>>>16)+((i>>>16)+(o>>>16))>>>0;i=i<<16>>>0,a=a+i>>>0,a>>>0<i>>>0&&(c=c+1>>>0),o=o<<16>>>0,a=a+o>>>0,a>>>0<o>>>0&&(c=c+1>>>0),c=c+Math.imul(n,r)>>>0,c=c+Math.imul(t,s)>>>0,e[0]=c,e[1]=a}function Nc(e,t,n,r,s){let o=t+r>>>0;const i=n+s>>>0;i>>>0<n>>>0&&(o=o+1|0),e[0]=o,e[1]=i}const fi=Symbol.for("effect/Utils/YieldWrap");class Tr{#e;constructor(t){this.#e=t}[fi](){return this.#e}}function Em(e){if(typeof e=="object"&&e!==null&&fi in e)return e[fi]();throw new Error(Ys("yieldWrapGet"))}const Be=B("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0})),al={effect_internal_function:e=>e()},$m={effect_internal_function:e=>e()},Im=al.effect_internal_function(()=>new Error().stack)?.includes("effect_internal_function")===!0,Re=Im?al.effect_internal_function:$m.effect_internal_function,Lo=B(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),K=Symbol.for("effect/Hash"),k=e=>{if(Be.enabled===!0)return 0;switch(typeof e){case"number":return oa(e);case"bigint":return se(e.toString(10));case"boolean":return se(String(e));case"symbol":return se(String(e));case"string":return se(e);case"undefined":return se("undefined");case"function":case"object":return e===null?se("null"):e instanceof Date?Number.isNaN(e.getTime())?se("Invalid Date"):k(e.toISOString()):e instanceof URL?k(e.href):Rm(e)?e[K]():sa(e);default:throw new Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},sa=e=>(Lo.has(e)||Lo.set(e,oa(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),Lo.get(e)),J=e=>t=>t*53^e,Qs=e=>e&3221225471|e>>>1&1073741824,Rm=e=>A(e,K),oa=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 Qs(t)},se=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Qs(t)},Cm=(e,t)=>{let n=12289;for(let r=0;r<t.length;r++)n^=g(se(t[r]),J(k(e[t[r]])));return Qs(n)},cl=e=>Cm(e,Object.keys(e)),Or=e=>{let t=6151;for(let n=0;n<e.length;n++)t=g(t,J(k(e[n])));return Qs(t)},ne=function(){if(arguments.length===1){const n=arguments[0];return function(r){return Object.defineProperty(n,K,{value(){return r},enumerable:!1}),r}}const e=arguments[0],t=arguments[1];return Object.defineProperty(e,K,{value(){return t},enumerable:!1}),t},L=Symbol.for("effect/Equal");function D(){return arguments.length===1?e=>bs(e,arguments[0]):bs(arguments[0],arguments[1])}function bs(e,t){if(e===t)return!0;const n=typeof e;if(n!==typeof t)return!1;if(n==="object"||n==="function"){if(e!==null&&t!==null){if(_s(e)&&_s(t))return k(e)===k(t)&&e[L](t)?!0:Be.enabled&&Be.tester?Be.tester(e,t):!1;if(e instanceof Date&&t instanceof Date){const r=e.getTime(),s=t.getTime();return r===s||Number.isNaN(r)&&Number.isNaN(s)}else if(e instanceof URL&&t instanceof URL)return e.href===t.href}if(Be.enabled){if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((r,s)=>bs(r,t[s]));if(Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype){const r=Object.keys(e),s=Object.keys(t);if(r.length===s.length){for(const o of r)if(!(o in t&&bs(e[o],t[o])))return Be.tester?Be.tester(e,t):!1;return!0}}return Be.tester?Be.tester(e,t):!1}}return Be.enabled&&Be.tester?Be.tester(e,t):!1}const _s=e=>A(e,L),ia=()=>D,ee=Symbol.for("nodejs.util.inspect.custom"),le=e=>{try{if(A(e,"toJSON")&&vr(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(le)}catch{return{}}return Fm(e)},Do="[Circular]";function jm(e){try{return e.toISOString()}catch{return"Invalid Date"}}function Mm(e){try{const t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function ul(e){return lt(e)?JSON.stringify(e):String(e)}function tn(e,t){const n=new WeakSet,r=(i,a)=>{const c=i?.constructor;return c&&c!==Object.prototype.constructor&&c.name?`${c.name}(${a})`:a},s=i=>{try{return Reflect.ownKeys(i)}catch{return["[ownKeys threw]"]}};function o(i,a=0){if(Array.isArray(i))return n.has(i)?Do:(n.add(i),`[${i.map(c=>o(c,a)).join(",")}]`);if(gm(i))return jm(i);if(A(i,"toString")&&vr(i.toString)&&i.toString!==Object.prototype.toString&&i.toString!==Array.prototype.toString){const c=Mm(i);return i instanceof Error&&i.cause?`${c} (cause: ${o(i.cause,a)})`:c}if(lt(i))return JSON.stringify(i);if(zt(i)||i==null||na(i)||li(i))return String(i);if(Gs(i))return String(i)+"n";if(i instanceof Set||i instanceof Map)return n.has(i)?Do:(n.add(i),`${i.constructor.name}(${o(Array.from(i),a)})`);if(kt(i)){if(n.has(i))return Do;n.add(i);const c=s(i);{const u=`{${c.map(f=>`${ul(f)}:${o(i[f],a)}`).join(",")}}`;return r(i,u)}}return String(i)}return o(e,0)}const ye=e=>JSON.stringify(e,null,2),bn=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?ll(e,t):String(e)}catch{return String(e)}},ll=(e,t)=>{let n=[];const r=JSON.stringify(e,(s,o)=>typeof o=="object"&&o!==null?n.includes(o)?void 0:n.push(o)&&(Kt.fiberRefs!==void 0&&fl(o)?o[aa](Kt.fiberRefs):o):o,t);return n=void 0,r},aa=Symbol.for("effect/Inspectable/Redactable"),fl=e=>typeof e=="object"&&e!==null&&aa in e,Kt=B("effect/Inspectable/redactableState",()=>({fiberRefs:void 0})),Am=(e,t)=>{const n=Kt.fiberRefs;Kt.fiberRefs=e;try{return t()}finally{Kt.fiberRefs=n}},Fm=e=>fl(e)&&Kt.fiberRefs!==void 0?e[aa](Kt.fiberRefs):e,R=(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 r=0,s=t.length;r<s;r++)n=t[r](n);return n}}},lr="Async",Xs="Commit",He="Failure",Ko="OnFailure",Ss="OnSuccess",ws="OnSuccessAndFailure",We="Success",dl="Sync",Pm="Tag",Nr="UpdateRuntimeFlags",ks="While",os="Iterator",hl="WithRuntime",is="Yield",ca="RevertFlags";let Lm="3.19.15";const ua=()=>Lm,Dm=Symbol.for("effect/Effect"),Km=Symbol.for("effect/Stream"),Um=Symbol.for("effect/Sink"),qm=Symbol.for("effect/Channel"),_n={_R:e=>e,_E:e=>e,_A:e=>e,_V:ua()},Bm={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e},Jm={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},Er={[Dm]:_n,[Km]:_n,[Um]:Bm,[qm]:Jm,[L](e){return this===e},[K](){return ne(this,sa(this))},[Symbol.iterator](){return new ol(new Tr(this))},pipe(){return R(this,arguments)}},la={[K](){return ne(this,cl(this))},[L](e){const t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(const r of t)if(!(r in e&&D(this[r],e[r])))return!1;return!0}},$r={...Er,_op:Xs},Vm={...$r,...la},zm=(function(){function e(){}return e.prototype=$r,e})(),pl=Symbol.for("effect/Option"),ml={...Er,[pl]:{_A:e=>e},[ee](){return this.toJSON()},toString(){return ye(this.toJSON())}},Hm=Object.assign(Object.create(ml),{_tag:"Some",_op:"Some",[L](e){return fa(e)&&yl(e)&&D(this.value,e.value)},[K](){return ne(this,J(k(this._tag))(k(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:le(this.value)}}}),Wm=k("None"),Gm=Object.assign(Object.create(ml),{_tag:"None",_op:"None",[L](e){return fa(e)&&gl(e)},[K](){return Wm},toJSON(){return{_id:"Option",_tag:this._tag}}}),fa=e=>A(e,pl),gl=e=>e._tag==="None",yl=e=>e._tag==="Some",da=Object.create(Gm),xs=e=>{const t=Object.create(Hm);return t.value=e,t},bl=Symbol.for("effect/Either"),_l={...Er,[bl]:{_R:e=>e},[ee](){return this.toJSON()},toString(){return ye(this.toJSON())}},Ym=Object.assign(Object.create(_l),{_tag:"Right",_op:"Right",[L](e){return ha(e)&&wl(e)&&D(this.right,e.right)},[K](){return J(k(this._tag))(k(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:le(this.right)}}}),Qm=Object.assign(Object.create(_l),{_tag:"Left",_op:"Left",[L](e){return ha(e)&&Sl(e)&&D(this.left,e.left)},[K](){return J(k(this._tag))(k(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:le(this.left)}}}),ha=e=>A(e,bl),Sl=e=>e._tag==="Left",wl=e=>e._tag==="Right",Xm=e=>{const t=Object.create(Qm);return t.left=e,t},Zm=e=>{const t=Object.create(Ym);return t.right=e,t},V=Zm,P=Xm,eg=ha,he=Sl,yt=wl,tg=d(2,(e,{onLeft:t,onRight:n})=>he(e)?P(t(e.left)):V(n(e.right))),ng=d(2,(e,t)=>he(e)?P(t(e.left)):V(e.right)),rg=d(2,(e,t)=>yt(e)?V(t(e.right)):P(e.left)),pa=d(2,(e,{onLeft:t,onRight:n})=>he(e)?t(e.left):n(e.right)),sg=pa({onLeft:Y,onRight:Y}),kl=d(2,(e,t)=>{if(yt(e))return e.right;throw t(e.left)}),og=kl(()=>new Error("getOrThrow called on a Left")),xl=e=>e.length>0,Ir=e=>(t,n)=>t===n?0:e(t,n),ma=Ir((e,t)=>e<t?-1:1),vl=Ir((e,t)=>e<t?-1:1),ig=Ir((e,t)=>e<t?-1:1),ag=d(2,(e,t)=>Ir((n,r)=>{let s=e(n,r);if(s!==0)return s;for(const o of t)if(s=o(n,r),s!==0)return s;return s})),nn=d(2,(e,t)=>Ir((n,r)=>e(t(n),t(r)))),cg=e=>d(2,(t,n)=>e(t,n)===1),N=()=>da,I=xs,ug=fa,te=gl,ke=yl,we=d(2,(e,{onNone:t,onSome:n})=>te(e)?t():n(e.value)),be=d(2,(e,t)=>te(e)?t():e.value),bt=d(2,(e,t)=>te(e)?t():e),lg=d(2,(e,t)=>te(e)?I(t()):e),Zs=e=>e==null?N():I(e),ot=be(rl),fg=e=>(...t)=>{try{return I(e(...t))}catch{return N()}},Tl=d(2,(e,t)=>te(e)?N():I(t(e.value))),Kn=d(2,(e,t)=>te(e)?N():t(e.value)),dg=d(2,(e,t)=>te(e)?N():Zs(t(e.value))),hg=Kn,Xn=d(2,(e,t)=>hg(e,n=>t(n)?xs(n):da)),pg=e=>Ws((t,n)=>te(t)?te(n):te(n)?!1:e(t.value,n.value)),mg=e=>d(2,(t,n)=>te(t)?!1:e(t.value,n)),gg=ia(),yg=mg(gg),bg=d(2,(e,t)=>te(e)?!1:t(e.value)),_g=(...e)=>e,eo=e=>new Array(e),Sg=d(2,(e,t)=>{const n=Math.max(1,Math.floor(e)),r=new Array(n);for(let s=0;s<n;s++)r[s]=t(s);return r}),oe=e=>Array.isArray(e)?e:Array.from(e),wg=e=>Array.isArray(e)?e:[e],kg=d(2,(e,{onEmpty:t,onNonEmpty:n})=>_e(e)?n(Ce(e),Ht(e)):t()),vs=d(2,(e,t)=>[t,...e]),xg=d(2,(e,t)=>[...e,t]),Ol=d(2,(e,t)=>oe(e).concat(oe(t))),vg=Array.isArray,Tg=e=>e.length===0,Og=Tg,as=xl,_e=xl,Nl=(e,t)=>e<0||e>=t.length,Ng=(e,t)=>Math.floor(Math.min(Math.max(0,e),t.length)),Eg=d(2,(e,t)=>{const n=Math.floor(t);return Nl(n,e)?N():I(e[n])}),El=d(2,(e,t)=>{const n=Math.floor(t);if(Nl(n,e))throw new Error(`Index ${n} out of bounds`);return e[n]}),fr=Eg(0),Ce=El(0),$g=e=>_e(e)?I($l(e)):N(),$l=e=>e[e.length-1],Ht=e=>e.slice(1),Ig=(e,t)=>{let n=0;for(const r of e){if(!t(r,n))break;n++}return n},Rg=d(2,(e,t)=>Ag(e,Ig(e,t))),Cg=d(2,(e,t)=>{const n=oe(e);return n.slice(Ng(t,n),n.length)}),Ec=e=>Array.from(e).reverse(),Sn=d(2,(e,t)=>{const n=Array.from(e);return n.sort(t),n}),$c=d(2,(e,t)=>jg(e,t,_g)),jg=d(3,(e,t,n)=>{const r=oe(e),s=oe(t);if(_e(r)&&_e(s)){const o=[n(Ce(r),Ce(s))],i=Math.min(r.length,s.length);for(let a=1;a<i;a++)o[a]=n(r[a],s[a]);return o}return[]}),Mg=ia(),Ag=d(2,(e,t)=>{const n=Array.from(e),r=Math.floor(t);return _e(n)?r>=1?Fg(n,r):[[],n]:[n,[]]}),Fg=d(2,(e,t)=>{const n=Math.max(1,Math.floor(t));return n>=e.length?[ar(e),[]]:[vs(e.slice(1,n),Ce(e)),e.slice(n)]}),ar=e=>e.slice(),Pg=d(3,(e,t,n)=>{const r=oe(e),s=oe(t);return _e(r)?_e(s)?Cl(n)(Ol(r,s)):r:s}),cs=d(2,(e,t)=>Pg(e,t,Mg)),wn=()=>[],Ye=e=>[e],Ut=d(2,(e,t)=>e.map(t)),Il=d(2,(e,t)=>{if(Og(e))return[];const n=[];for(let r=0;r<e.length;r++){const s=t(e[r],r);for(let o=0;o<s.length;o++)n.push(s[o])}return n}),Lg=Il(Y),Zn=d(2,(e,t)=>{const n=oe(e),r=[];for(let s=0;s<n.length;s++)t(n[s],s)&&r.push(n[s]);return r}),Rl=d(3,(e,t,n)=>oe(e).reduce((r,s,o)=>n(r,s,o),t)),Ic=(e,t)=>{const n=[];let r=e,s;for(;ke(s=t(r));){const[o,i]=s.value;n.push(o),r=i}return n},ga=fm,Cl=d(2,(e,t)=>{const n=oe(e);if(_e(n)){const r=[Ce(n)],s=Ht(n);for(const o of s)r.every(i=>!t(o,i))&&r.push(o);return r}return[]}),Dg=e=>Cl(e,ia()),Un=d(2,(e,t)=>oe(e).join(t)),jl=(e,t)=>{switch(t._tag){case"StringKeyword":case"TemplateLiteral":return Object.keys(e);case"SymbolKeyword":return Object.getOwnPropertySymbols(e);case"Refinement":return jl(e,t.from)}},Ml=e=>{let t=!1,n;return()=>(t||(n=e(),t=!0),n)},Al=e=>Array.isArray(e),Rc=e=>`[${ul(e)}]`,Kg=e=>Al(e)?e.map(Rc).join(""):Rc(e),rn=(e,t,n,r)=>{let s=e;return t!==void 0&&(s+=`
|
|
5
|
-
details: ${t}`),r&&(s+=`
|
|
6
|
-
schema (${r._tag}): ${r}`),s},Ug=e=>rn("Unsupported key schema",void 0,void 0,e),qg=e=>rn("Unsupported literal",`literal value: ${tn(e)}`),Cc=e=>rn("Duplicate index signature",`${e} index signature`),Bg=rn("Unsupported index signature parameter","An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),Jg=rn("Invalid element","A required element cannot follow an optional element. ts(1257)"),jc=e=>rn("Duplicate property signature transformation",`Duplicate key ${tn(e)}`),Vg=e=>rn("Duplicate property signature",`Duplicate key ${tn(e)}`),kn=vl,Ts=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"),zg=Symbol.for("effect/annotation/TypeConstructor"),Hg=Symbol.for("effect/annotation/Brand"),Wg=Symbol.for("effect/annotation/SchemaId"),Fl=Symbol.for("effect/annotation/Message"),ya=Symbol.for("effect/annotation/MissingMessage"),ba=Symbol.for("effect/annotation/Identifier"),xt=Symbol.for("effect/annotation/Title"),di=Symbol.for("effect/annotation/AutoTitle"),Rr=Symbol.for("effect/annotation/Description"),Pl=Symbol.for("effect/annotation/Examples"),Ll=Symbol.for("effect/annotation/Default"),Dl=Symbol.for("effect/annotation/JSONSchema"),Kl=Symbol.for("effect/annotation/Arbitrary"),Ul=Symbol.for("effect/annotation/Pretty"),ql=Symbol.for("effect/annotation/Equivalence"),Gg=Symbol.for("effect/annotation/Documentation"),Bl=Symbol.for("effect/annotation/Concurrency"),Jl=Symbol.for("effect/annotation/Batching"),Vl=Symbol.for("effect/annotation/ParseIssueTitle"),zl=Symbol.for("effect/annotation/ParseOptions"),Hl=Symbol.for("effect/annotation/DecodingFallback"),Wl=Symbol.for("effect/annotation/Surrogate"),Yg=Symbol.for("effect/annotation/StableFilter"),je=d(2,(e,t)=>Object.prototype.hasOwnProperty.call(e.annotations,t)?I(e.annotations[t]):N()),Qg=je(Hg),Xg=je(Fl),Zg=je(ya),Gl=je(xt),Yl=je(di),to=je(ba),Ql=je(Rr),ey=je(Bl),ty=je(Jl),ny=je(Vl),ry=je(zl),sy=je(Hl),Xl=je(Wl),oy=je(Yg),iy=e=>bg(oy(e),t=>t===!0),Zl=Symbol.for("effect/annotation/JSONIdentifier"),ay=je(Zl),cy=e=>bt(ay(e),()=>to(e));class no{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag="Declaration";constructor(t,n,r,s={}){this.typeParameters=t,this.decodeUnknown=n,this.encodeUnknown=r,this.annotations=s}toString(){return be(ft(this),()=>"<declaration schema>")}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map(t=>t.toJSON()),annotations:fe(this.annotations)}}}const Cr=e=>t=>t._tag===e;let Os=class{literal;annotations;_tag="Literal";constructor(t,n={}){this.literal=t,this.annotations=n}toString(){return be(ft(this),()=>tn(this.literal))}toJSON(){return{_tag:this._tag,literal:Gs(this.literal)?String(this.literal):this.literal,annotations:fe(this.annotations)}}};const Mc=Cr("Literal"),uy=new Os(null);class ly{symbol;annotations;_tag="UniqueSymbol";constructor(t,n={}){this.symbol=t,this.annotations=n}toString(){return be(ft(this),()=>tn(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:fe(this.annotations)}}}class fy{annotations;_tag="UndefinedKeyword";constructor(t={}){this.annotations=t}toString(){return on(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const dy=new fy({[xt]:"undefined"});class hy{annotations;_tag="NeverKeyword";constructor(t={}){this.annotations=t}toString(){return on(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const ef=new hy({[xt]:"never"});class py{annotations;_tag="UnknownKeyword";constructor(t={}){this.annotations=t}toString(){return on(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const tf=new py({[xt]:"unknown"});class my{annotations;_tag="AnyKeyword";constructor(t={}){this.annotations=t}toString(){return on(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const gy=new my({[xt]:"any"});class yy{annotations;_tag="StringKeyword";constructor(t={}){this.annotations=t}toString(){return on(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const by=new yy({[xt]:"string",[Rr]:"a string"}),_y=Cr("StringKeyword");class Sy{annotations;_tag="NumberKeyword";constructor(t={}){this.annotations=t}toString(){return on(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const wy=new Sy({[xt]:"number",[Rr]:"a number"});class ky{annotations;_tag="BooleanKeyword";constructor(t={}){this.annotations=t}toString(){return on(this)}toJSON(){return{_tag:this._tag,annotations:fe(this.annotations)}}}const xy=new ky({[xt]:"boolean",[Rr]:"a boolean"}),vy=Cr("SymbolKeyword");let ro=class{type;annotations;constructor(t,n={}){this.type=t,this.annotations=n}toJSON(){return{type:this.type.toJSON(),annotations:fe(this.annotations)}}toString(){return String(this.type)}};class sn extends ro{isOptional;constructor(t,n,r={}){super(t,r),this.isOptional=n}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:fe(this.annotations)}}toString(){return String(this.type)+(this.isOptional?"?":"")}}const nf=e=>e.map(t=>t.type);class _a{elements;rest;isReadonly;annotations;_tag="TupleType";constructor(t,n,r,s={}){this.elements=t,this.rest=n,this.isReadonly=r,this.annotations=s;let o=!1,i=!1;for(const a of t)if(a.isOptional)o=!0;else if(o){i=!0;break}if(i||o&&n.length>1)throw new Error(Jg)}toString(){return be(ft(this),()=>Ty(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map(t=>t.toJSON()),rest:this.rest.map(t=>t.toJSON()),isReadonly:this.isReadonly,annotations:fe(this.annotations)}}}const Ty=e=>{const t=e.elements.map(String).join(", ");return kg(e.rest,{onEmpty:()=>`readonly [${t}]`,onNonEmpty:(n,r)=>{const s=String(n),o=s.includes(" | ")?`(${s})`:s;if(r.length>0){const i=r.map(String).join(", ");return e.elements.length>0?`readonly [${t}, ...${o}[], ${i}]`:`readonly [...${o}[], ${i}]`}else return e.elements.length>0?`readonly [${t}, ...${o}[]]`:`ReadonlyArray<${s}>`}})};class Oe extends sn{name;isReadonly;constructor(t,n,r,s,o){super(n,r,o),this.name=t,this.isReadonly=s}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:fe(this.annotations)}}}const rf=e=>{switch(e._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return!0;case"Refinement":return rf(e.from)}return!1};class so{type;isReadonly;parameter;constructor(t,n,r){if(this.type=n,this.isReadonly=r,rf(t))this.parameter=t;else throw new Error(Bg)}toString(){return(this.isReadonly?"readonly ":"")+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}}class qt{annotations;_tag="TypeLiteral";propertySignatures;indexSignatures;constructor(t,n,r={}){this.annotations=r;const s={};for(let i=0;i<t.length;i++){const a=t[i].name;if(Object.prototype.hasOwnProperty.call(s,a))throw new Error(Vg(a));s[a]=null}const o={string:!1,symbol:!1};for(let i=0;i<n.length;i++){const a=ff(n[i].parameter);if(_y(a)){if(o.string)throw new Error(Cc("string"));o.string=!0}else if(vy(a)){if(o.symbol)throw new Error(Cc("symbol"));o.symbol=!0}}this.propertySignatures=t,this.indexSignatures=n}toString(){return be(ft(this),()=>Oy(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map(t=>t.toJSON()),indexSignatures:this.indexSignatures.map(t=>t.toJSON()),annotations:fe(this.annotations)}}}const Ac=e=>e.map(String).join("; "),Oy=e=>{if(e.propertySignatures.length>0){const t=e.propertySignatures.map(String).join("; ");return e.indexSignatures.length>0?`{ ${t}; ${Ac(e.indexSignatures)} }`:`{ ${t} }`}else return e.indexSignatures.length>0?`{ ${Ac(e.indexSignatures)} }`:"{}"},Ny=Sn(nn(kn,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})),Ey={string:"StringKeyword",number:"NumberKeyword",boolean:"BooleanKeyword",bigint:"BigIntKeyword"},sf=e=>Il(e,t=>of(t)?sf(t.types):[t]),$y=e=>{const t=Ny(e),n=[],r={},s=[];for(const o of t)switch(o._tag){case"NeverKeyword":break;case"AnyKeyword":return[gy];case"UnknownKeyword":return[tf];case"ObjectKeyword":case"UndefinedKeyword":case"VoidKeyword":case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":{r[o._tag]||(r[o._tag]=o,n.push(o));break}case"Literal":{const i=typeof o.literal;switch(i){case"string":case"number":case"bigint":case"boolean":{const a=Ey[i];!r[a]&&!s.includes(o.literal)&&(s.push(o.literal),n.push(o));break}case"object":{s.includes(o.literal)||(s.push(o.literal),n.push(o));break}}break}case"UniqueSymbol":{!r.SymbolKeyword&&!s.includes(o.symbol)&&(s.push(o.symbol),n.push(o));break}case"TupleType":{r.ObjectKeyword||n.push(o);break}case"TypeLiteral":{o.propertySignatures.length===0&&o.indexSignatures.length===0?r["{}"]||(r["{}"]=o,n.push(o)):r.ObjectKeyword||n.push(o);break}default:n.push(o)}return n};let it=class hi{types;annotations;static make=(t,n)=>Sa(t)?new hi(t,n):t.length===1?t[0]:ef;static unify=(t,n)=>hi.make($y(sf(t)),n);_tag="Union";constructor(t,n={}){this.types=t,this.annotations=n}toString(){return be(ft(this),()=>this.types.map(String).join(" | "))}toJSON(){return{_tag:this._tag,types:this.types.map(t=>t.toJSON()),annotations:fe(this.annotations)}}};const Iy=(e,t)=>e.map(t),Sa=e=>e.length>1,of=Cr("Union"),Uo=B(Symbol.for("effect/Schema/AST/toJSONMemoMap"),()=>new WeakMap);class af{f;annotations;_tag="Suspend";constructor(t,n={}){this.f=t,this.annotations=n,this.f=Ml(t)}toString(){return ft(this).pipe(bt(()=>Kn(fg(this.f)(),t=>ft(t))),be(()=>"<suspended schema>"))}toJSON(){const t=this.f();let n=Uo.get(t);return n||(Uo.set(t,{_tag:this._tag}),n={_tag:this._tag,ast:t.toJSON(),annotations:fe(this.annotations)},Uo.set(t,n),n)}}let Ry=class{from;filter;annotations;_tag="Refinement";constructor(t,n,r={}){this.from=t,this.filter=n,this.annotations=r}toString(){return to(this).pipe(be(()=>we(df(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:t=>wa(this.from)?String(this.from)+" & "+t:t})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:fe(this.annotations)}}};const wa=Cr("Refinement"),qo={};let Cy=class{from;to;transformation;annotations;_tag="Transformation";constructor(t,n,r,s={}){this.from=t,this.to=n,this.transformation=r,this.annotations=s}toString(){return be(ft(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:fe(this.annotations)}}},jy=class{from;to;decode;encode;constructor(t,n,r,s){this.from=t,this.to=n,this.decode=r,this.encode=s}};class My{propertySignatureTransformations;_tag="TypeLiteralTransformation";constructor(t){this.propertySignatureTransformations=t;const n={},r={};for(const s of t){const o=s.from;if(n[o])throw new Error(jc(o));n[o]=!0;const i=s.to;if(r[i])throw new Error(jc(i));r[i]=!0}}}const ka=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={...e.annotations};delete r[ba];const s={...r,...t},o=Xl(e);return ke(o)&&(s[Wl]=ka(o.value,t)),n.annotations.value=s,Object.create(Object.getPrototypeOf(e),n)},Ay="[\\s\\S]*?",Fy="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",cf=(e,t)=>{switch(e._tag){case"Literal":return Ts(String(e.literal));case"StringKeyword":return Ay;case"NumberKeyword":return Fy;case"TemplateLiteral":return uf(e);case"Union":return e.types.map(n=>cf(n)).join("|")}},Py=(e,t,n,r)=>of(e)?`(${t})`:t,uf=(e,t,n)=>{let r="";if(e.head!==""){const s=Ts(e.head);r+=s}for(const s of e.spans){const o=cf(s.type);if(r+=Py(s.type,o),s.literal!==""){const i=Ts(s.literal);r+=i}}return r},Ly=e=>new RegExp(`^${uf(e)}$`),Fc=(e,t)=>{const n=[],r=[],s=o=>{switch(o._tag){case"NeverKeyword":break;case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":case"Refinement":r.push(new so(o,t,!0));break;case"Literal":if(lt(o.literal)||zt(o.literal))n.push(new Oe(o.literal,t,!1,!0));else throw new Error(qg(o.literal));break;case"Enums":{for(const[i,a]of o.enums)n.push(new Oe(a,t,!1,!0));break}case"UniqueSymbol":n.push(new Oe(o.symbol,t,!1,!0));break;case"Union":o.types.forEach(s);break;default:throw new Error(Ug(o))}};return s(e),{propertySignatures:n,indexSignatures:r}},lf=e=>t=>{let n;for(const r of e)Object.prototype.hasOwnProperty.call(t.annotations,r)&&(n===void 0&&(n={}),n[r]=t.annotations[r]);return n},Dy=lf([Pl,Ll,Dl,Kl,Ul,ql]),pe=e=>{switch(e._tag){case"Declaration":{const t=Ve(e.typeParameters,pe);return t===e.typeParameters?e:new no(t,e.decodeUnknown,e.encodeUnknown,e.annotations)}case"TupleType":{const t=Ve(e.elements,s=>{const o=pe(s.type);return o===s.type?s:new sn(o,s.isOptional)}),n=nf(e.rest),r=Ve(n,pe);return t===e.elements&&r===n?e:new _a(t,r.map(s=>new ro(s)),e.isReadonly,e.annotations)}case"TypeLiteral":{const t=Ve(e.propertySignatures,r=>{const s=pe(r.type);return s===r.type?r:new Oe(r.name,s,r.isOptional,r.isReadonly)}),n=Ve(e.indexSignatures,r=>{const s=pe(r.type);return s===r.type?r:new so(r.parameter,s,r.isReadonly)});return t===e.propertySignatures&&n===e.indexSignatures?e:new qt(t,n,e.annotations)}case"Union":{const t=Ve(e.types,pe);return t===e.types?e:it.make(t,e.annotations)}case"Suspend":return new af(()=>pe(e.f()),e.annotations);case"Refinement":{const t=pe(e.from);return t===e.from?e:new Ry(t,e.filter,e.annotations)}case"Transformation":{const t=Dy(e);return pe(t!==void 0?ka(e.to,t):e.to)}}return e};function Ve(e,t){let n=!1;const r=eo(e.length);for(let s=0;s<e.length;s++){const o=e[s],i=t(o);i!==o&&(n=!0),r[s]=i}return n?r:e}const nt=(e,t)=>{switch(e._tag){case"Declaration":{const n=Ve(e.typeParameters,r=>nt(r));return n===e.typeParameters?e:new no(n,e.decodeUnknown,e.encodeUnknown)}case"TupleType":{const n=Ve(e.elements,o=>{const i=nt(o.type);return i===o.type?o:new sn(i,o.isOptional)}),r=nf(e.rest),s=Ve(r,o=>nt(o));return n===e.elements&&s===r?e:new _a(n,s.map(o=>new ro(o)),e.isReadonly)}case"TypeLiteral":{const n=Ve(e.propertySignatures,s=>{const o=nt(s.type);return o===s.type?s:new Oe(s.name,o,s.isOptional,s.isReadonly)}),r=Ve(e.indexSignatures,s=>{const o=nt(s.type);return o===s.type?s:new so(s.parameter,o,s.isReadonly)});return n===e.propertySignatures&&r===e.indexSignatures?e:new qt(n,r)}case"Union":{const n=Ve(e.types,r=>nt(r));return n===e.types?e:it.make(n)}case"Suspend":{let n;const r=cy(e);return ke(r)&&(n={[Zl]:`${r.value}Encoded`}),new af(()=>nt(e.f()),n)}case"Refinement":return nt(e.from);case"Transformation":return nt(e.from)}return e},Pc=e=>nt(e),fe=e=>{const t={};for(const n of Object.getOwnPropertySymbols(e))t[String(n)]=e[n];return t},ff=e=>{switch(e._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return e;case"Refinement":return ff(e.from)}},on=e=>be(ft(e),()=>e._tag);function Ky(e){return we(Qg(e),{onNone:()=>"",onSome:t=>t.map(n=>` & Brand<${tn(n)}>`).join("")})}const df=e=>Gl(e).pipe(bt(()=>Ql(e)),bt(()=>Yl(e)),Tl(t=>t+Ky(e))),ft=e=>bt(to(e),()=>df(e)),Uy=Symbol.for("effect/Context/Tag"),Ns=Symbol.for("effect/Context/Reference"),qy="effect/STM",By=Symbol.for(qy),hf={...Er,_op:"Tag",[By]:_n,[Uy]:{_Service:e=>e,_Identifier:e=>e},toString(){return ye(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[ee](){return this.toJSON()},of(e){return e},context(e){return mf(this,e)}},Jy={...hf,[Ns]:Ns},Vy=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=2;const n=new Error;Error.stackTraceLimit=t;const r=Object.create(hf);return Object.defineProperty(r,"stack",{get(){return n.stack}}),r.key=e,r},zy=()=>(e,t)=>{const n=Error.stackTraceLimit;Error.stackTraceLimit=2;const r=new Error;Error.stackTraceLimit=n;function s(){}return Object.setPrototypeOf(s,Jy),s.key=e,s.defaultValue=t.defaultValue,Object.defineProperty(s,"stack",{get(){return r.stack}}),s},pf=Symbol.for("effect/Context"),Hy={[pf]:{_Services:e=>e},[L](e){if(Gy(e)&&this.unsafeMap.size===e.unsafeMap.size){for(const t of this.unsafeMap.keys())if(!e.unsafeMap.has(t)||!D(this.unsafeMap.get(t),e.unsafeMap.get(t)))return!1;return!0}return!1},[K](){return ne(this,oa(this.unsafeMap.size))},pipe(){return R(this,arguments)},toString(){return ye(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(le)}},[ee](){return this.toJSON()}},xn=e=>{const t=Object.create(Hy);return t.unsafeMap=e,t},Wy=e=>{const t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(e.stack){const n=e.stack.split(`
|
|
7
|
-
`);if(n.length>2){const r=n[2].match(/at (.*)/);r&&(t.message=t.message+` (defined at ${r[1]})`)}}if(t.stack){const n=t.stack.split(`
|
|
8
|
-
`);n.splice(1,3),t.stack=n.join(`
|
|
9
|
-
`)}return t},Gy=e=>A(e,pf),Yy=e=>A(e,Ns),Qy=xn(new Map),Xy=()=>Qy,mf=(e,t)=>xn(new Map([[e.key,t]])),Zy=d(3,(e,t,n)=>{const r=new Map(e.unsafeMap);return r.set(t.key,n),xn(r)}),Bo=B("effect/Context/defaultValueCache",()=>new Map),xa=e=>{if(Bo.has(e.key))return Bo.get(e.key);const t=e.defaultValue();return Bo.set(e.key,t),t},eb=(e,t)=>e.unsafeMap.has(t.key)?e.unsafeMap.get(t.key):xa(t),gf=d(2,(e,t)=>{if(!e.unsafeMap.has(t.key)){if(Ns in t)return xa(t);throw Wy(t)}return e.unsafeMap.get(t.key)}),tb=gf,nb=d(2,(e,t)=>e.unsafeMap.has(t.key)?xs(e.unsafeMap.get(t.key)):Yy(t)?xs(xa(t)):da),rb=d(2,(e,t)=>{const n=new Map(e.unsafeMap);for(const[r,s]of t.unsafeMap)n.set(r,s);return xn(n)}),an=Vy,va=Xy,sb=mf,er=Zy,yf=tb,bf=gf,jr=nb,_f=rb,Sf=zy,wf=Symbol.for("effect/Chunk");function ob(e,t,n,r,s){for(let o=t;o<Math.min(e.length,t+s);o++)n[r+o-t]=e[o];return n}const kf=[],ib=e=>Ws((t,n)=>t.length===n.length&&Bt(t).every((r,s)=>e(r,mn(n,s)))),ab=ib(D),cb={[wf]:{_A:e=>e},toString(){return ye(this.toJSON())},toJSON(){return{_id:"Chunk",values:Bt(this).map(le)}},[ee](){return this.toJSON()},[L](e){return xf(e)&&ab(this,e)},[K](){return ne(this,Or(Bt(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return kf[Symbol.iterator]();default:return Bt(this)[Symbol.iterator]()}},pipe(){return R(this,arguments)}},ae=e=>{const t=Object.create(cb);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=at,t.right=at;break}case"ISingleton":{t.length=1,t.depth=0,t.left=at,t.right=at;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=at,t.right=at;break}}return t},xf=e=>A(e,wf),at=ae({_tag:"IEmpty"}),St=()=>at,Jo=(...e)=>fb(e),De=e=>ae({_tag:"ISingleton",a:e}),vf=e=>xf(e)?e:oo(oe(e)),pi=(e,t,n)=>{switch(e.backing._tag){case"IArray":{ob(e.backing.array,0,t,n,e.length);break}case"IConcat":{pi(e.left,t,n),pi(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,s=n;for(;r<e.length;)t[s]=mn(e,r),r+=1,s+=1;break}}},ub=e=>{switch(e.backing._tag){case"IEmpty":return kf;case"IArray":return e.backing.array;default:{const t=new Array(e.length);return pi(e,t,0),e.backing={_tag:"IArray",array:t},e.left=at,e.right=at,e.depth=0,t}}},Bt=ub,lb=e=>{switch(e.backing._tag){case"IEmpty":case"ISingleton":return e;case"IArray":return ae({_tag:"IArray",array:Ec(e.backing.array)});case"IConcat":return ae({_tag:"IConcat",left:vn(e.backing.right),right:vn(e.backing.left)});case"ISlice":return oo(Ec(Bt(e)))}},vn=lb,oo=e=>e.length===0?St():e.length===1?De(e[0]):ae({_tag:"IArray",array:e}),fb=e=>oo(e),mn=d(2,(e,t)=>{switch(e.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":{if(t!==0)throw new Error("Index out of bounds");return e.backing.a}case"IArray":{if(t>=e.length||t<0)throw new Error("Index out of bounds");return e.backing.array[t]}case"IConcat":return t<e.left.length?mn(e.left,t):mn(e.right,t-e.left.length);case"ISlice":return mn(e.backing.chunk,t+e.backing.offset)}}),db=d(2,(e,t)=>Qe(e,De(t))),Ze=d(2,(e,t)=>Qe(De(t),e)),mi=d(2,(e,t)=>{if(t<=0)return e;if(t>=e.length)return at;switch(e.backing._tag){case"ISlice":return ae({_tag:"ISlice",chunk:e.backing.chunk,offset:e.backing.offset+t,length:e.backing.length-t});case"IConcat":return t>e.left.length?mi(e.right,t-e.left.length):ae({_tag:"IConcat",left:mi(e.left,t),right:e.right});default:return ae({_tag:"ISlice",chunk:e,offset:t,length:e.length-t})}}),Qe=d(2,(e,t)=>{if(e.backing._tag==="IEmpty")return t;if(t.backing._tag==="IEmpty")return e;const n=t.depth-e.depth;if(Math.abs(n)<=1)return ae({_tag:"IConcat",left:e,right:t});if(n<-1)if(e.left.depth>=e.right.depth){const r=Qe(e.right,t);return ae({_tag:"IConcat",left:e.left,right:r})}else{const r=Qe(e.right.right,t);if(r.depth===e.depth-3){const s=ae({_tag:"IConcat",left:e.right.left,right:r});return ae({_tag:"IConcat",left:e.left,right:s})}else{const s=ae({_tag:"IConcat",left:e.left,right:e.right.left});return ae({_tag:"IConcat",left:s,right:r})}}else if(t.right.depth>=t.left.depth){const r=Qe(e,t.left);return ae({_tag:"IConcat",left:r,right:t.right})}else{const r=Qe(e,t.left.left);if(r.depth===t.depth-3){const s=ae({_tag:"IConcat",left:r,right:t.left.right});return ae({_tag:"IConcat",left:s,right:t.right})}else{const s=ae({_tag:"IConcat",left:t.left.right,right:t.right});return ae({_tag:"IConcat",left:r,right:s})}}}),hb=e=>e.length===0,Tn=e=>e.length>0,Tf=e=>mn(e,0),On=Tf,Ft=e=>mi(e,1),gi=Symbol.for("effect/Duration"),Of=BigInt(0),Lc=BigInt(24),Gr=BigInt(60),yi=BigInt(1e3),Dc=BigInt(1e6),Kc=BigInt(1e9),pb=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,wt=e=>{if(Nf(e))return e;if(zt(e))return bi(e);if(Gs(e))return Vo(e);if(Array.isArray(e)&&e.length===2&&e.every(zt))return e[0]===-1/0||e[1]===-1/0||Number.isNaN(e[0])||Number.isNaN(e[1])?Ef:e[0]===1/0||e[1]===1/0?bb:Vo(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));if(lt(e)){const t=pb.exec(e);if(t){const[n,r,s]=t,o=Number(r);switch(s){case"nano":case"nanos":return Vo(BigInt(r));case"micro":case"micros":return _b(BigInt(r));case"milli":case"millis":return bi(o);case"second":case"seconds":return Sb(o);case"minute":case"minutes":return wb(o);case"hour":case"hours":return kb(o);case"day":case"days":return xb(o);case"week":case"weeks":return vb(o)}}}throw new Error("Invalid DurationInput")},Uc={_tag:"Millis",millis:0},mb={_tag:"Infinity"},gb={[gi]:gi,[K](){return ne(this,cl(this.value))},[L](e){return Nf(e)&&Rb(this,e)},toString(){return`Duration(${jb(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:Ob(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[ee](){return this.toJSON()},pipe(){return R(this,arguments)}},dt=e=>{const t=Object.create(gb);return zt(e)?isNaN(e)||e<=0?t.value=Uc:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:BigInt(Math.round(e*1e6))}:t.value=mb:e<=Of?t.value=Uc:t.value={_tag:"Nanos",nanos:e},t},Nf=e=>A(e,gi),yb=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===Of;case"Infinity":return!1}},Ef=dt(0),bb=dt(1/0),Vo=e=>dt(e),_b=e=>dt(e*yi),bi=e=>dt(e),Sb=e=>dt(e*1e3),wb=e=>dt(e*6e4),kb=e=>dt(e*36e5),xb=e=>dt(e*864e5),vb=e=>dt(e*6048e5),_i=e=>Nb(e,{onMillis:t=>t,onNanos:t=>Number(t)/1e6}),Tb=e=>{const t=wt(e);switch(t.value._tag){case"Infinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return BigInt(Math.round(t.value.millis*1e6))}},Ob=e=>{const t=wt(e);switch(t.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(t.value.nanos/Kc),Number(t.value.nanos%Kc)];case"Millis":return[Math.floor(t.value.millis/1e3),Math.round(t.value.millis%1e3*1e6)]}},Nb=d(2,(e,t)=>{const n=wt(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)}}),Ta=d(3,(e,t,n)=>{const r=wt(e),s=wt(t);if(r.value._tag==="Infinity"||s.value._tag==="Infinity")return n.onMillis(_i(r),_i(s));if(r.value._tag==="Nanos"||s.value._tag==="Nanos"){const o=r.value._tag==="Nanos"?r.value.nanos:BigInt(Math.round(r.value.millis*1e6)),i=s.value._tag==="Nanos"?s.value.nanos:BigInt(Math.round(s.value.millis*1e6));return n.onNanos(o,i)}return n.onMillis(r.value.millis,s.value.millis)}),Eb=(e,t)=>Ta(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r}),$b=d(2,(e,t)=>Ta(e,t,{onMillis:(n,r)=>n<=r,onNanos:(n,r)=>n<=r})),Ib=d(2,(e,t)=>Ta(e,t,{onMillis:(n,r)=>n>=r,onNanos:(n,r)=>n>=r})),Rb=d(2,(e,t)=>Eb(wt(e),wt(t))),Cb=e=>{const t=wt(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};const n=Tb(t),r=n/Dc,s=r/yi,o=s/Gr,i=o/Gr,a=i/Lc;return{days:Number(a),hours:Number(i%Lc),minutes:Number(o%Gr),seconds:Number(s%Gr),millis:Number(r%yi),nanos:Number(n%Dc)}},jb=e=>{const t=wt(e);if(t.value._tag==="Infinity")return"Infinity";if(yb(t))return"0";const n=Cb(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(" ")},Wt=5,Oa=Math.pow(2,Wt),Mb=Oa-1,Ab=Oa/2,Fb=Oa/4;function Pb(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 Nn(e,t){return t>>>e&Mb}function pn(e){return 1<<e}function $f(e,t){return Pb(e&t-1)}const Lb=(e,t)=>({value:e,previous:t});function gn(e,t,n,r){let s=r;if(!e){const o=r.length;s=new Array(o);for(let i=0;i<o;++i)s[i]=r[i]}return s[t]=n,s}function If(e,t,n){const r=n.length-1;let s=0,o=0,i=n;if(e)s=o=t;else for(i=new Array(r);s<t;)i[o++]=n[s++];for(++s;s<=r;)i[o++]=n[s++];return e&&(i.length=r),i}function Db(e,t,n,r){const s=r.length;if(e){let c=s;for(;c>=t;)r[c--]=r[c];return r[t]=n,r}let o=0,i=0;const a=new Array(s+1);for(;o<t;)a[i++]=r[o++];for(a[t]=n;o<s;)a[++i]=r[o++];return a}class Rt{_tag="EmptyNode";modify(t,n,r,s,o,i){const a=r(N());return te(a)?new Rt:(++i.value,new Jt(t,s,o,a))}}function Xe(e){return sl(e,"EmptyNode")}function Kb(e){return Xe(e)||e._tag==="LeafNode"||e._tag==="CollisionNode"}function io(e,t){return Xe(e)?!1:t===e.edit}class Jt{edit;hash;key;value;_tag="LeafNode";constructor(t,n,r,s){this.edit=t,this.hash=n,this.key=r,this.value=s}modify(t,n,r,s,o,i){if(D(o,this.key)){const c=r(this.value);return c===this.value?this:te(c)?(--i.value,new Rt):io(this,t)?(this.value=c,this):new Jt(t,s,o,c)}const a=r(N());return te(a)?this:(++i.value,Rf(t,n,this.hash,this,s,new Jt(t,s,o,a)))}}class Na{edit;hash;children;_tag="CollisionNode";constructor(t,n,r){this.edit=t,this.hash=n,this.children=r}modify(t,n,r,s,o,i){if(s===this.hash){const c=io(this,t),u=this.updateCollisionList(c,t,this.hash,this.children,r,o,i);return u===this.children?this:u.length>1?new Na(t,this.hash,u):u[0]}const a=r(N());return te(a)?this:(++i.value,Rf(t,n,this.hash,this,s,new Jt(t,s,o,a)))}updateCollisionList(t,n,r,s,o,i,a){const c=s.length;for(let f=0;f<c;++f){const h=s[f];if("key"in h&&D(i,h.key)){const p=h.value,m=o(p);return m===p?s:te(m)?(--a.value,If(t,f,s)):gn(t,f,new Jt(n,r,i,m),s)}}const u=o(N());return te(u)?s:(++a.value,gn(t,c,new Jt(n,r,i,u),s))}}class En{edit;mask;children;_tag="IndexedNode";constructor(t,n,r){this.edit=t,this.mask=n,this.children=r}modify(t,n,r,s,o,i){const a=this.mask,c=this.children,u=Nn(n,s),f=pn(u),h=$f(a,f),p=a&f,m=io(this,t);if(!p){const F=new Rt().modify(t,n+Wt,r,s,o,i);return F?c.length>=Ab?qb(t,u,F,a,c):new En(t,a|f,Db(m,h,F,c)):this}const y=c[h],v=y.modify(t,n+Wt,r,s,o,i);if(y===v)return this;let S=a,w;if(Xe(v)){if(S&=~f,!S)return new Rt;if(c.length<=2&&Kb(c[h^1]))return c[h^1];w=If(m,h,c)}else w=gn(m,h,v,c);return m?(this.mask=S,this.children=w,this):new En(t,S,w)}}class Ea{edit;size;children;_tag="ArrayNode";constructor(t,n,r){this.edit=t,this.size=n,this.children=r}modify(t,n,r,s,o,i){let a=this.size;const c=this.children,u=Nn(n,s),f=c[u],h=(f||new Rt).modify(t,n+Wt,r,s,o,i);if(f===h)return this;const p=io(this,t);let m;if(Xe(f)&&!Xe(h))++a,m=gn(p,u,h,c);else if(!Xe(f)&&Xe(h)){if(--a,a<=Fb)return Ub(t,a,u,c);m=gn(p,u,new Rt,c)}else m=gn(p,u,h,c);return p?(this.size=a,this.children=m,this):new Ea(t,a,m)}}function Ub(e,t,n,r){const s=new Array(t-1);let o=0,i=0;for(let a=0,c=r.length;a<c;++a)if(a!==n){const u=r[a];u&&!Xe(u)&&(s[o++]=u,i|=1<<a)}return new En(e,i,s)}function qb(e,t,n,r,s){const o=[];let i=r,a=0;for(let c=0;i;++c)i&1&&(o[c]=s[a++]),i>>>=1;return o[t]=n,new Ea(e,a+1,o)}function Bb(e,t,n,r,s,o){if(n===s)return new Na(e,n,[o,r]);const i=Nn(t,n),a=Nn(t,s);if(i===a)return c=>new En(e,pn(i)|pn(a),[c]);{const c=i<a?[r,o]:[o,r];return new En(e,pn(i)|pn(a),c)}}function Rf(e,t,n,r,s,o){let i,a=t;for(;;){const c=Bb(e,a,n,r,s,o);if(typeof c=="function")i=Lb(c,i),a=a+Wt;else{let u=c;for(;i!=null;)u=i.value(u),i=i.previous;return u}}}const Cf="effect/HashMap",Si=Symbol.for(Cf),Jb={[Si]:Si,[Symbol.iterator](){return new ao(this,(e,t)=>[e,t])},[K](){let e=k(Cf);for(const t of this)e^=g(k(t[0]),J(k(t[1])));return ne(this,e)},[L](e){if(Hb(e)){if(e._size!==this._size)return!1;for(const t of this){const n=g(e,Ia(t[0],k(t[0])));if(te(n))return!1;if(!D(t[1],n.value))return!1}return!0}return!1},toString(){return ye(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(le)}},[ee](){return this.toJSON()},pipe(){return R(this,arguments)}},$a=(e,t,n,r)=>{const s=Object.create(Jb);return s._editable=e,s._edit=t,s._root=n,s._size=r,s};class ao{map;f;v;constructor(t,n){this.map=t,this.f=n,this.v=jf(this.map._root,this.f,void 0)}next(){if(te(this.v))return{done:!0,value:void 0};const t=this.v.value;return this.v=Es(t.cont),{done:!1,value:t.value}}[Symbol.iterator](){return new ao(this.map,this.f)}}const Es=e=>e?Mf(e[0],e[1],e[2],e[3],e[4]):N(),jf=(e,t,n=void 0)=>{switch(e._tag){case"LeafNode":return ke(e.value)?I({value:t(e.key,e.value.value),cont:n}):Es(n);case"CollisionNode":case"ArrayNode":case"IndexedNode":{const r=e.children;return Mf(r.length,r,0,t,n)}default:return Es(n)}},Mf=(e,t,n,r,s)=>{for(;n<e;){const o=t[n++];if(o&&!Xe(o))return jf(o,r,[e,t,n,r,s])}return Es(s)},Vb=$a(!1,0,new Rt,0),co=()=>Vb,zb=e=>{const t=Ff(co());for(const n of e)mr(t,n[0],n[1]);return Xb(t)},Hb=e=>A(e,Si),Wb=e=>e&&Xe(e._root),Gb=d(2,(e,t)=>Ia(e,t,k(t))),Ia=d(3,(e,t,n)=>{let r=e._root,s=0;for(;;)switch(r._tag){case"LeafNode":return D(t,r.key)?r.value:N();case"CollisionNode":{if(n===r.hash){const o=r.children;for(let i=0,a=o.length;i<a;++i){const c=o[i];if("key"in c&&D(t,c.key))return c.value}}return N()}case"IndexedNode":{const o=Nn(s,n),i=pn(o);if(r.mask&i){r=r.children[$f(r.mask,i)],s+=Wt;break}return N()}case"ArrayNode":{if(r=r.children[Nn(s,n)],r){s+=Wt;break}return N()}default:return N()}}),Yb=d(2,(e,t)=>ke(Ia(e,t,k(t)))),mr=d(3,(e,t,n)=>Ra(e,t,()=>I(n))),Qb=d(3,(e,t,n)=>e._editable?(e._root=t,e._size=n,e):t===e._root?e:$a(e._editable,e._edit,t,n)),Af=e=>new ao(e,t=>t),wi=e=>e._size,Ff=e=>$a(!0,e._edit+1,e._root,e._size),Xb=e=>(e._editable=!1,e),Ra=d(3,(e,t,n)=>Zb(e,t,k(t),n)),Zb=d(4,(e,t,n,r)=>{const s={value:e._size},o=e._root.modify(e._editable?e._edit:NaN,0,r,n,t,s);return g(e,Qb(o,s.value))}),qc=d(2,(e,t)=>Ra(e,t,N)),e_=d(2,(e,t)=>uo(e,co(),(n,r,s)=>mr(n,s,t(r,s)))),t_=d(2,(e,t)=>uo(e,void 0,(n,r,s)=>t(r,s))),uo=d(3,(e,t,n)=>{const r=e._root;if(r._tag==="LeafNode")return ke(r.value)?n(t,r.value.value,r.key):t;if(r._tag==="EmptyNode")return t;const s=[r.children];let o;for(;o=s.pop();)for(let i=0,a=o.length;i<a;){const c=o[i++];c&&!Xe(c)&&(c._tag==="LeafNode"?ke(c.value)&&(t=n(t,c.value.value,c.key)):s.push(c.children))}return t}),Pf="effect/HashSet",ki=Symbol.for(Pf),n_={[ki]:ki,[Symbol.iterator](){return Af(this._keyMap)},[K](){return ne(this,J(k(this._keyMap))(k(Pf)))},[L](e){return r_(e)?wi(this._keyMap)===wi(e._keyMap)&&D(this._keyMap,e._keyMap):!1},toString(){return ye(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(le)}},[ee](){return this.toJSON()},pipe(){return R(this,arguments)}},lo=e=>{const t=Object.create(n_);return t._keyMap=e,t},r_=e=>A(e,ki),s_=lo(co()),fo=()=>s_,o_=e=>{const t=Ca(fo());for(const n of e)gr(t,n);return ja(t)},i_=(...e)=>{const t=Ca(fo());for(const n of e)gr(t,n);return ja(t)},a_=d(2,(e,t)=>Yb(e._keyMap,t)),c_=e=>wi(e._keyMap),Ca=e=>lo(Ff(e._keyMap)),ja=e=>(e._keyMap._editable=!1,e),Lf=d(2,(e,t)=>{const n=Ca(e);return t(n),ja(n)}),gr=d(2,(e,t)=>e._keyMap._editable?(mr(t,!0)(e._keyMap),e):lo(mr(t,!0)(e._keyMap))),Df=d(2,(e,t)=>e._keyMap._editable?(qc(t)(e._keyMap),e):lo(qc(t)(e._keyMap))),u_=d(2,(e,t)=>Lf(e,n=>{for(const r of t)Df(n,r)})),l_=d(2,(e,t)=>Lf(fo(),n=>{f_(e,r=>gr(n,r));for(const r of t)gr(n,r)})),f_=d(2,(e,t)=>t_(e._keyMap,(n,r)=>t(r))),d_=d(3,(e,t,n)=>uo(e._keyMap,t,(r,s,o)=>n(r,o))),Gt=fo,h_=o_,Ma=i_,p_=a_,Kf=c_,dr=gr,Uf=Df,Bc=u_,yr=l_,$s=d_,Jc=Symbol.for("effect/MutableRef"),m_={[Jc]:Jc,toString(){return ye(this.toJSON())},toJSON(){return{_id:"MutableRef",current:le(this.current)}},[ee](){return this.toJSON()},pipe(){return R(this,arguments)}},qf=e=>{const t=Object.create(m_);return t.current=e,t},ho=e=>e.current,Bf=d(2,(e,t)=>(e.current=t,e)),Aa="effect/FiberId",br=Symbol.for(Aa),Is="None",xi="Runtime",g_="Composite",y_=se(`${Aa}-${Is}`);let b_=class{[br]=br;_tag=Is;id=-1;startTimeMillis=-1;[K](){return y_}[L](t){return Jf(t)&&t._tag===Is}toString(){return ye(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[ee](){return this.toJSON()}};class __{id;startTimeMillis;[br]=br;_tag=xi;constructor(t,n){this.id=t,this.startTimeMillis=n}[K](){return ne(this,se(`${Aa}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[L](t){return Jf(t)&&t._tag===xi&&this.id===t.id&&this.startTimeMillis===t.startTimeMillis}toString(){return ye(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[ee](){return this.toJSON()}}const S_=new b_,Jf=e=>A(e,br),vi=e=>{switch(e._tag){case Is:return Gt();case xi:return Ma(e.id);case g_:return g(vi(e.left),yr(vi(e.right)))}},Vc=B(Symbol.for("effect/Fiber/Id/_fiberCounter"),()=>qf(0)),Vf=e=>Array.from(vi(e)).map(n=>`#${n}`).join(","),w_=()=>{const e=ho(Vc);return g(Vc,Bf(e+1)),new __(e,Date.now())},$n=S_,k_=Vf,zf=w_,Fa=co,x_=zb,v_=Wb,Hf=Gb,Wf=mr,Gf=Af,T_=Ra,O_=e_,Yf=uo,_r=Symbol.for("effect/List"),Ti=e=>oe(e),N_=e=>lm(ga(e),Ti),E_=N_(D),$_={[_r]:_r,_tag:"Cons",toString(){return ye(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:Ti(this).map(le)}},[ee](){return this.toJSON()},[L](e){return Xf(e)&&this._tag===e._tag&&E_(this,e)},[K](){return ne(this,Or(Ti(this)))},[Symbol.iterator](){let e=!1,t=this;return{next(){if(e)return this.return();if(t._tag==="Nil")return e=!0,this.return();const n=t.head;return t=t.tail,{done:e,value:n}},return(n){return e||(e=!0),{done:!0,value:n}}}},pipe(){return R(this,arguments)}},Rs=(e,t)=>{const n=Object.create($_);return n.head=e,n.tail=t,n},I_=se("Nil"),R_={[_r]:_r,_tag:"Nil",toString(){return ye(this.toJSON())},toJSON(){return{_id:"List",_tag:"Nil"}},[ee](){return this.toJSON()},[K](){return I_},[L](e){return Xf(e)&&this._tag===e._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return R(this,arguments)}},Qf=Object.create(R_),Xf=e=>A(e,_r),_t=e=>e._tag==="Nil",C_=e=>e._tag==="Cons",j_=()=>Qf,Yt=(e,t)=>Rs(e,t),In=j_,Pa=e=>Rs(e,Qf),M_=d(2,(e,t)=>F_(t,e)),A_=d(2,(e,t)=>Yt(t,e)),F_=d(2,(e,t)=>{if(_t(e))return t;if(_t(t))return e;{const n=Rs(t.head,e);let r=n,s=t.tail;for(;!_t(s);){const o=Rs(s.head,e);r.tail=o,r=o,s=s.tail}return n}}),P_=d(3,(e,t,n)=>{let r=t,s=e;for(;!_t(s);)r=n(r,s.head),s=s.tail;return r}),L_=e=>{let t=In(),n=e;for(;!_t(n);)t=A_(t,n.head),n=n.tail;return t},La=(function(){function e(t){t&&Object.assign(this,t)}return e.prototype=la,e})(),D_=Symbol.for("effect/DifferContextPatch");function zc(e){return e}const Mr={...La.prototype,[D_]:{_Value:zc,_Patch:zc}},K_=Object.assign(Object.create(Mr),{_tag:"Empty"}),U_=Object.create(K_),Zf=()=>U_,q_=Object.assign(Object.create(Mr),{_tag:"AndThen"}),B_=(e,t)=>{const n=Object.create(q_);return n.first=e,n.second=t,n},J_=Object.assign(Object.create(Mr),{_tag:"AddService"}),V_=(e,t)=>{const n=Object.create(J_);return n.key=e,n.service=t,n},z_=Object.assign(Object.create(Mr),{_tag:"RemoveService"}),H_=e=>{const t=Object.create(z_);return t.key=e,t},W_=Object.assign(Object.create(Mr),{_tag:"UpdateService"}),G_=(e,t)=>{const n=Object.create(W_);return n.key=e,n.update=t,n},Y_=(e,t)=>{const n=new Map(e.unsafeMap);let r=Zf();for(const[s,o]of t.unsafeMap.entries())if(n.has(s)){const i=n.get(s);n.delete(s),D(i,o)||(r=us(G_(s,()=>o))(r))}else n.delete(s),r=us(V_(s,o))(r);for(const[s]of n.entries())r=us(H_(s))(r);return r},us=d(2,(e,t)=>B_(e,t)),Q_=d(2,(e,t)=>{if(e._tag==="Empty")return t;let n=!1,r=De(e);const s=new Map(t.unsafeMap);for(;Tn(r);){const i=On(r),a=Ft(r);switch(i._tag){case"Empty":{r=a;break}case"AddService":{s.set(i.key,i.service),r=a;break}case"AndThen":{r=Ze(Ze(a,i.second),i.first);break}case"RemoveService":{s.delete(i.key),r=a;break}case"UpdateService":{s.set(i.key,i.update(s.get(i.key))),n=!0,r=a;break}}}if(!n)return xn(s);const o=new Map;for(const[i]of t.unsafeMap)s.has(i)&&(o.set(i,s.get(i)),s.delete(i));for(const[i,a]of s)o.set(i,a);return xn(o)}),X_=Symbol.for("effect/DifferHashSetPatch");function zo(e){return e}const po={...La.prototype,[X_]:{_Value:zo,_Key:zo,_Patch:zo}},Z_=Object.assign(Object.create(po),{_tag:"Empty"}),eS=Object.create(Z_),ed=()=>eS,tS=Object.assign(Object.create(po),{_tag:"AndThen"}),nS=(e,t)=>{const n=Object.create(tS);return n.first=e,n.second=t,n},rS=Object.assign(Object.create(po),{_tag:"Add"}),sS=e=>{const t=Object.create(rS);return t.value=e,t},oS=Object.assign(Object.create(po),{_tag:"Remove"}),iS=e=>{const t=Object.create(oS);return t.value=e,t},aS=(e,t)=>{const[n,r]=$s([e,ed()],([s,o],i)=>p_(i)(s)?[Uf(i)(s),o]:[s,Oi(sS(i))(o)])(t);return $s(r,(s,o)=>Oi(iS(o))(s))(n)},Oi=d(2,(e,t)=>nS(e,t)),cS=d(2,(e,t)=>{if(e._tag==="Empty")return t;let n=t,r=De(e);for(;Tn(r);){const s=On(r),o=Ft(r);switch(s._tag){case"Empty":{r=o;break}case"AndThen":{r=Ze(s.first)(Ze(s.second)(o));break}case"Add":{n=dr(s.value)(n),r=o;break}case"Remove":n=Uf(s.value)(n),r=o}}return n}),uS=Symbol.for("effect/DifferReadonlyArrayPatch");function Hc(e){return e}const Ar={...La.prototype,[uS]:{_Value:Hc,_Patch:Hc}},lS=Object.assign(Object.create(Ar),{_tag:"Empty"}),fS=Object.create(lS),td=()=>fS,dS=Object.assign(Object.create(Ar),{_tag:"AndThen"}),hS=(e,t)=>{const n=Object.create(dS);return n.first=e,n.second=t,n},pS=Object.assign(Object.create(Ar),{_tag:"Append"}),mS=e=>{const t=Object.create(pS);return t.values=e,t},gS=Object.assign(Object.create(Ar),{_tag:"Slice"}),yS=(e,t)=>{const n=Object.create(gS);return n.from=e,n.until=t,n},bS=Object.assign(Object.create(Ar),{_tag:"Update"}),_S=(e,t)=>{const n=Object.create(bS);return n.index=e,n.patch=t,n},SS=e=>{let t=0,n=td();for(;t<e.oldValue.length&&t<e.newValue.length;){const r=e.oldValue[t],s=e.newValue[t],o=e.differ.diff(r,s);D(o,e.differ.empty)||(n=ls(n,_S(t,o))),t=t+1}return t<e.oldValue.length&&(n=ls(n,yS(0,t))),t<e.newValue.length&&(n=ls(n,mS(Cg(t)(e.newValue)))),n},ls=d(2,(e,t)=>hS(e,t)),wS=d(3,(e,t,n)=>{if(e._tag==="Empty")return t;let r=t.slice(),s=Ye(e);for(;as(s);){const o=Ce(s),i=Ht(s);switch(o._tag){case"Empty":{s=i;break}case"AndThen":{i.unshift(o.first,o.second),s=i;break}case"Append":{for(const a of o.values)r.push(a);s=i;break}case"Slice":{r=r.slice(o.from,o.until),s=i;break}case"Update":{r[o.index]=n.patch(o.patch,r[o.index]),s=i;break}}}return r}),kS=Symbol.for("effect/Differ"),xS={[kS]:{_P:Y,_V:Y},pipe(){return R(this,arguments)}},qn=e=>{const t=Object.create(xS);return t.empty=e.empty,t.diff=e.diff,t.combine=e.combine,t.patch=e.patch,t},vS=()=>qn({empty:Zf(),combine:(e,t)=>us(t)(e),diff:(e,t)=>Y_(e,t),patch:(e,t)=>Q_(t)(e)}),TS=()=>qn({empty:ed(),combine:(e,t)=>Oi(t)(e),diff:(e,t)=>aS(e,t),patch:(e,t)=>cS(t)(e)}),OS=e=>qn({empty:td(),combine:(t,n)=>ls(t,n),diff:(t,n)=>SS({oldValue:t,newValue:n,differ:e}),patch:(t,n)=>wS(t,n,e)}),nd=()=>NS((e,t)=>t),NS=e=>qn({empty:Y,combine:(t,n)=>t===Y?n:n===Y?t:r=>n(t(r)),diff:(t,n)=>D(t,n)?Y:Hs(n),patch:(t,n)=>e(n,t(n))}),Sr=255,rd=8,Ni=e=>e&Sr,Ei=e=>e>>rd&Sr,Fr=(e,t)=>(e&Sr)+((t&e&Sr)<<rd),ES=Fr(0,0),$S=e=>Fr(e,e),IS=e=>Fr(e,0),RS=d(2,(e,t)=>Fr(Ni(e)&~t,Ei(e))),CS=d(2,(e,t)=>e|t),jS=e=>~e>>>0&Sr,MS=0,Bn=1,AS=2,sd=4,$i=16,od=32,FS=e=>mo(e,od),PS=d(2,(e,t)=>e|t),Ot=e=>id(e)&&!DS(e),id=e=>mo(e,Bn),mo=d(2,(e,t)=>(e&t)!==0),ad=(...e)=>e.reduce((t,n)=>t|n,0),LS=ad(MS),Wc=e=>mo(e,sd),DS=e=>mo(e,$i),fs=d(2,(e,t)=>Fr(e^t,t)),ds=d(2,(e,t)=>e&(jS(Ni(t))|Ei(t))|Ni(t)&Ei(t)),Gc=qn({empty:ES,diff:(e,t)=>fs(e,t),combine:(e,t)=>CS(t)(e),patch:(e,t)=>ds(t,e)}),KS=$S,cd=IS,Yc=RS,ud=(e,t)=>({_tag:"Par",left:e,right:t}),Yr=(e,t)=>({_tag:"Seq",left:e,right:t}),US=e=>{let t=Pa(e),n=In();for(;;){const[r,s]=P_(t,[ld(),In()],([o,i],a)=>{const[c,u]=qS(a);return[HS(o,c),M_(i,u)]});if(n=BS(n,r),_t(s))return L_(n);t=s}throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")},qS=e=>{let t=e,n=ld(),r=In(),s=In();for(;;)switch(t._tag){case"Empty":{if(_t(r))return[n,s];t=r.head,r=r.tail;break}case"Par":{r=Yt(t.right,r),t=t.left;break}case"Seq":{const o=t.left,i=t.right;switch(o._tag){case"Empty":{t=i;break}case"Par":{const a=o.left,c=o.right;t=ud(Yr(a,i),Yr(c,i));break}case"Seq":{const a=o.left,c=o.right;t=Yr(a,Yr(c,i));break}case"Single":{t=o,s=Yt(i,s);break}}break}case"Single":{if(n=zS(n,t),_t(r))return[n,s];t=r.head,r=r.tail;break}}throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},BS=(e,t)=>{if(_t(e))return Pa(Ho(t));if(WS(t))return e;const n=e0(e.head),r=GS(t);return n.length===1&&r.length===1&&D(n[0],r[0])?Yt(ZS(e.head,Ho(t)),e.tail):Yt(Ho(t),e)},JS=Symbol.for("effect/RequestBlock/RequestBlockParallel"),VS={_R:e=>e};class Da{map;[JS]=VS;constructor(t){this.map=t}}const ld=()=>new Da(Fa()),zS=(e,t)=>new Da(T_(e.map,t.dataSource,n=>lg(Tl(n,db(t.blockedRequest)),()=>De(t.blockedRequest)))),HS=(e,t)=>new Da(Yf(e.map,t.map,(n,r,s)=>Wf(n,s,we(Hf(n,s),{onNone:()=>r,onSome:o=>Qe(r,o)})))),WS=e=>v_(e.map),GS=e=>Array.from(Gf(e.map)),Ho=e=>XS(O_(e.map,t=>De(t))),YS=Symbol.for("effect/RequestBlock/RequestBlockSequential"),QS={_R:e=>e};class fd{map;[YS]=QS;constructor(t){this.map=t}}const XS=e=>new fd(e),ZS=(e,t)=>new fd(Yf(t.map,e.map,(n,r,s)=>Wf(n,s,we(Hf(n,s),{onNone:()=>St(),onSome:o=>Qe(o,r)})))),e0=e=>Array.from(Gf(e.map)),t0=e=>Array.from(e.map),Pr="Die",Qt="Empty",cn="Fail",Jn="Interrupt",Rn="Parallel",Cn="Sequential",dd="effect/Cause",hd=Symbol.for(dd),n0={_E:e=>e},Vn={[hd]:n0,[K](){return g(k(dd),J(k(g0(this))),ne(this))},[L](e){return r0(e)&&m0(this,e)},pipe(){return R(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:le(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:le(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:le(this.left),right:le(this.right)}}},toString(){return zn(this)},[ee](){return this.toJSON()}},jn=(()=>{const e=Object.create(Vn);return e._tag=Qt,e})(),Cs=e=>{const t=Object.create(Vn);return t._tag=cn,t.error=e,t},ct=e=>{const t=Object.create(Vn);return t._tag=Pr,t.defect=e,t},Nt=e=>{const t=Object.create(Vn);return t._tag=Jn,t.fiberId=e,t},go=(e,t)=>{const n=Object.create(Vn);return n._tag=Rn,n.left=e,n.right=t,n},ze=(e,t)=>{const n=Object.create(Vn);return n._tag=Cn,n.left=e,n.right=t,n},r0=e=>A(e,hd),s0=e=>e._tag===Qt,o0=e=>e._tag===cn,i0=e=>e._tag===Qt?!0:Mn(e,!0,(t,n)=>{switch(n._tag){case Qt:return I(t);case Pr:case cn:case Jn:return I(!1);default:return N()}}),a0=e=>ke(h0(e)),Ka=e=>Ua(void 0,b0)(e),c0=e=>vn(Mn(e,St(),(t,n)=>n._tag===cn?I(g(t,Ze(n.error))):N())),u0=e=>vn(Mn(e,St(),(t,n)=>n._tag===Pr?I(g(t,Ze(n.defect))):N())),l0=e=>Mn(e,Gt(),(t,n)=>n._tag===Jn?I(g(t,dr(n.fiberId))):N()),f0=e=>pd(e,t=>t._tag===cn?I(t.error):N()),d0=e=>{const t=f0(e);switch(t._tag){case"None":return V(e);case"Some":return P(t.value)}},h0=e=>pd(e,t=>t._tag===Jn?I(t.fiberId):N()),Qc=e=>md(e,{onEmpty:jn,onFail:()=>jn,onDie:ct,onInterrupt:Nt,onSequential:ze,onParallel:go}),p0=e=>md(e,{onEmpty:jn,onFail:ct,onDie:ct,onInterrupt:Nt,onSequential:ze,onParallel:go}),m0=(e,t)=>{let n=De(e),r=De(t);for(;Tn(n)&&Tn(r);){const[s,o]=g(On(n),Mn([Gt(),St()],([c,u],f)=>{const[h,p]=Ii(f);return I([g(c,yr(h)),g(u,Qe(p))])})),[i,a]=g(On(r),Mn([Gt(),St()],([c,u],f)=>{const[h,p]=Ii(f);return I([g(c,yr(h)),g(u,Qe(p))])}));if(!D(s,i))return!1;n=o,r=a}return!0},g0=e=>y0(De(e),St()),y0=(e,t)=>{for(;;){const[n,r]=g(e,Rl([Gt(),St()],([o,i],a)=>{const[c,u]=Ii(a);return[g(o,yr(c)),g(i,Qe(u))]})),s=Kf(n)>0?g(t,Ze(n)):t;if(hb(r))return vn(s);e=r,t=s}throw new Error(Ys("Cause.flattenCauseLoop"))},pd=d(2,(e,t)=>{const n=[e];for(;n.length>0;){const r=n.pop(),s=t(r);switch(s._tag){case"None":{switch(r._tag){case Cn:case Rn:{n.push(r.right),n.push(r.left);break}}break}case"Some":return s}}return N()}),Ii=e=>{let t=e;const n=[];let r=Gt(),s=St();for(;t!==void 0;)switch(t._tag){case Qt:{if(n.length===0)return[r,s];t=n.pop();break}case cn:{if(r=dr(r,Jo(t._tag,t.error)),n.length===0)return[r,s];t=n.pop();break}case Pr:{if(r=dr(r,Jo(t._tag,t.defect)),n.length===0)return[r,s];t=n.pop();break}case Jn:{if(r=dr(r,Jo(t._tag,t.fiberId)),n.length===0)return[r,s];t=n.pop();break}case Cn:{switch(t.left._tag){case Qt:{t=t.right;break}case Cn:{t=ze(t.left.left,ze(t.left.right,t.right));break}case Rn:{t=go(ze(t.left.left,t.right),ze(t.left.right,t.right));break}default:{s=Ze(s,t.right),t=t.left;break}}break}case Rn:{n.push(t.right),t=t.left;break}}throw new Error(Ys("Cause.evaluateCauseLoop"))},b0={emptyCase:Tc,failCase:ui,dieCase:ui,interruptCase:Tc,sequentialCase:(e,t,n)=>t&&n,parallelCase:(e,t,n)=>t&&n},Xc="SequentialCase",Zc="ParallelCase",md=d(2,(e,{onDie:t,onEmpty:n,onFail:r,onInterrupt:s,onParallel:o,onSequential:i})=>Ua(e,void 0,{emptyCase:()=>n,failCase:(a,c)=>r(c),dieCase:(a,c)=>t(c),interruptCase:(a,c)=>s(c),sequentialCase:(a,c,u)=>i(c,u),parallelCase:(a,c,u)=>o(c,u)})),Mn=d(3,(e,t,n)=>{let r=t,s=e;const o=[];for(;s!==void 0;){const i=n(r,s);switch(r=ke(i)?i.value:r,s._tag){case Cn:{o.push(s.right),s=s.left;break}case Rn:{o.push(s.right),s=s.left;break}default:{s=void 0;break}}s===void 0&&o.length>0&&(s=o.pop())}return r}),Ua=d(3,(e,t,n)=>{const r=[e],s=[];for(;r.length>0;){const i=r.pop();switch(i._tag){case Qt:{s.push(V(n.emptyCase(t)));break}case cn:{s.push(V(n.failCase(t,i.error)));break}case Pr:{s.push(V(n.dieCase(t,i.defect)));break}case Jn:{s.push(V(n.interruptCase(t,i.fiberId)));break}case Cn:{r.push(i.right),r.push(i.left),s.push(P({_tag:Xc}));break}case Rn:{r.push(i.right),r.push(i.left),s.push(P({_tag:Zc}));break}}}const o=[];for(;s.length>0;){const i=s.pop();switch(i._tag){case"Left":{switch(i.left._tag){case Xc:{const a=o.pop(),c=o.pop(),u=n.sequentialCase(t,a,c);o.push(u);break}case Zc:{const a=o.pop(),c=o.pop(),u=n.parallelCase(t,a,c);o.push(u);break}}break}case"Right":{o.push(i.right);break}}}if(o.length===0)throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return o.pop()}),zn=(e,t)=>Ka(e)?"All fibers interrupted without errors.":yd(e).map(function(n){return t?.renderErrorCause!==!0||n.cause===void 0?n.stack:`${n.stack} {
|
|
10
|
-
${gd(n.cause," ")}
|
|
11
|
-
}`}).join(`
|
|
12
|
-
`),gd=(e,t)=>{const n=e.stack.split(`
|
|
13
|
-
`);let r=`${t}[cause]: ${n[0]}`;for(let s=1,o=n.length;s<o;s++)r+=`
|
|
14
|
-
${t}${n[s]}`;return e.cause&&(r+=` {
|
|
15
|
-
${gd(e.cause,`${t} `)}
|
|
16
|
-
${t}}`),r};class js extends globalThis.Error{span=void 0;constructor(t){const n=typeof t=="object"&&t!==null,r=Error.stackTraceLimit;Error.stackTraceLimit=1,super(_0(t),n&&"cause"in t&&typeof t.cause<"u"?{cause:new js(t.cause)}:void 0),this.message===""&&(this.message="An error has occurred"),Error.stackTraceLimit=r,this.name=t instanceof Error?t.name:"Error",n&&(An in t&&(this.span=t[An]),Object.keys(t).forEach(s=>{s in this||(this[s]=t[s])})),this.stack=k0(`${this.name}: ${this.message}`,t instanceof Error&&t.stack?t.stack:"",this.span)}}const _0=e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null&&e instanceof Error)return e.message;try{if(A(e,"toString")&&vr(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==globalThis.Array.prototype.toString)return e.toString()}catch{}return ll(e)},S0=/\((.*)\)/g,w0=B("effect/Tracer/spanToTrace",()=>new WeakMap),k0=(e,t,n)=>{const r=[e],s=t.startsWith(e)?t.slice(e.length).split(`
|
|
17
|
-
`):t.split(`
|
|
18
|
-
`);for(let o=1;o<s.length;o++){if(s[o].includes(" at new BaseEffectError")||s[o].includes(" at new YieldableError")){o++;continue}if(s[o].includes("Generator.next")||s[o].includes("effect_internal_function"))break;r.push(s[o].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(n){let o=n,i=0;for(;o&&o._tag==="Span"&&i<10;){const a=w0.get(o);if(typeof a=="function"){const c=a();if(typeof c=="string"){const u=c.matchAll(S0);let f=!1;for(const[,h]of u)f=!0,r.push(` at ${o.name} (${h})`);f||r.push(` at ${o.name} (${c.replace(/^at /,"")})`)}else r.push(` at ${o.name}`)}else r.push(` at ${o.name}`);o=ot(o.parent),i++}}return r.join(`
|
|
19
|
-
`)},An=Symbol.for("effect/SpanAnnotation"),yd=e=>Ua(e,void 0,{emptyCase:()=>[],dieCase:(t,n)=>[new js(n)],failCase:(t,n)=>[new js(n)],interruptCase:()=>[],parallelCase:(t,n,r)=>[...n,...r],sequentialCase:(t,n,r)=>[...n,...r]}),yo="Pending",bd="Done",x0="effect/Deferred",v0=Symbol.for(x0),T0={_E:e=>e,_A:e=>e},O0=e=>({_tag:yo,joiners:e}),N0=e=>({_tag:bd,effect:e});class Lr{self;called=!1;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new Lr(this.self)}}const _d=(e,t)=>{const n=new xe("Blocked");return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n},E0=e=>{const t=new xe("RunBlocked");return t.effect_instruction_i0=e,t},Fn=Symbol.for("effect/Effect");class $0{patch;op;_op=ca;constructor(t,n){this.patch=t,this.op=n}}class xe{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Fn]=_n;constructor(t){this._op=t}[L](t){return this===t}[K](){return ne(this,sa(this))}pipe(){return R(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:le(this.effect_instruction_i0),effect_instruction_i1:le(this.effect_instruction_i1),effect_instruction_i2:le(this.effect_instruction_i2)}}toString(){return ye(this.toJSON())}[ee](){return this.toJSON()}[Symbol.iterator](){return new Lr(new Tr(this))}}class Sd{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Fn]=_n;constructor(t){this._op=t,this._tag=t}[L](t){return Oo(t)&&t._op==="Failure"&&D(this.effect_instruction_i0,t.effect_instruction_i0)}[K](){return g(se(this._tag),J(k(this.effect_instruction_i0)),ne(this))}get cause(){return this.effect_instruction_i0}pipe(){return R(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return ye(this.toJSON())}[ee](){return this.toJSON()}[Symbol.iterator](){return new Lr(new Tr(this))}}class wd{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Fn]=_n;constructor(t){this._op=t,this._tag=t}[L](t){return Oo(t)&&t._op==="Success"&&D(this.effect_instruction_i0,t.effect_instruction_i0)}[K](){return g(se(this._tag),J(k(this.effect_instruction_i0)),ne(this))}get value(){return this.effect_instruction_i0}pipe(){return R(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:le(this.value)}}toString(){return ye(this.toJSON())}[ee](){return this.toJSON()}[Symbol.iterator](){return new Lr(new Tr(this))}}const bo=e=>A(e,Fn),Ke=e=>{const t=new xe(hl);return t.effect_instruction_i0=e,t},I0=d(3,(e,t,n)=>wo(r=>C(e,s=>C(xd(ce(()=>r(t(s)))),o=>ce(()=>n(s,o)).pipe(Pn({onFailure:i=>{switch(o._tag){case He:return et(ze(o.effect_instruction_i0,i));case We:return et(i)}},onSuccess:()=>o})))))),Dr=d(2,(e,t)=>C(e,()=>Q(t))),Kr=e=>Dr(e,void 0),kd=function(){const e=new xe(Xs);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 new Error(Ys("you're not supposed to end up here"))}return e},Ms=(e,t=$n)=>{const n=new xe(lr);let r;return n.effect_instruction_i0=s=>{r=e(s)},n.effect_instruction_i1=t,Nd(n,s=>bo(r)?r:tt)},R0=(e,t=$n)=>ce(()=>Ms(e,t)),Xt=(e,t=$n)=>kd(e,function(){let n,r;function s(c){n?n(c):r===void 0&&(r=c)}const o=new xe(lr);o.effect_instruction_i0=c=>{n=c,r&&c(r)},o.effect_instruction_i1=t;let i,a;return this.effect_instruction_i0.length!==1?(a=new AbortController,i=Re(()=>this.effect_instruction_i0(s,a.signal))):i=Re(()=>this.effect_instruction_i0(s)),i||a?Nd(o,c=>(a&&a.abort(),i??tt)):o}),Ri=d(2,(e,t)=>Ja(e,{onFailure:t,onSuccess:Q})),eu=Symbol.for("effect/OriginalAnnotation"),qa=(e,t)=>ke(t)?new Proxy(e,{has(n,r){return r===An||r===eu||r in n},get(n,r){return r===An?t.value:r===eu?e:n[r]}}):e,tu=e=>kt(e)&&!(An in e)?Ke(t=>et(ct(qa(e,Xa(t))))):et(ct(e)),C0=e=>j0(()=>ct(new uw(e))),As=e=>Ja(e,{onFailure:t=>Q(P(t)),onSuccess:t=>Q(V(t))}),xd=e=>F0(e,{onFailure:X,onSuccess:ie}),Ie=e=>kt(e)&&!(An in e)?Ke(t=>et(Cs(qa(e,Xa(t))))):et(Cs(e)),Ba=e=>C(j(e),Ie),et=e=>{const t=new Sd(He);return t.effect_instruction_i0=e,t},j0=e=>C(j(e),et),M0=Ke(e=>Q(e.id())),vd=e=>Ke(t=>e(t.id())),C=d(2,(e,t)=>{const n=new xe(Ss);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n}),A0=e=>{const t=new xe("OnStep");return t.effect_instruction_i0=e,t},Td=e=>C(e,Y),F0=d(2,(e,t)=>Pn(e,{onFailure:n=>Q(t.onFailure(n)),onSuccess:n=>Q(t.onSuccess(n))})),Pn=d(2,(e,t)=>{const n=new xe(ws);return n.effect_instruction_i0=e,n.effect_instruction_i1=t.onFailure,n.effect_instruction_i2=t.onSuccess,n}),Ja=d(2,(e,t)=>Pn(e,{onFailure:n=>{if(u0(n).length>0)return et(p0(n));const s=c0(n);return s.length>0?t.onFailure(Tf(s)):et(n)},onSuccess:t.onSuccess})),$t=d(2,(e,t)=>ce(()=>{const n=oe(e),r=eo(n.length);let s=0;return Dr(Ha({while:()=>s<n.length,body:()=>t(n[s],s),step:o=>{r[s++]=o}}),r)})),_o=d(2,(e,t)=>ce(()=>{const n=oe(e);let r=0;return Ha({while:()=>r<n.length,body:()=>t(n[r],r),step:()=>{r++}})})),Od=e=>{const t=new xe(Nr);return t.effect_instruction_i0=KS(Bn),t.effect_instruction_i1=()=>e,t},Ae=d(2,(e,t)=>C(e,n=>j(()=>t(n)))),Va=d(2,(e,t)=>Ja(e,{onFailure:n=>Ba(()=>t.onFailure(n)),onSuccess:n=>j(()=>t.onSuccess(n))})),So=d(2,(e,t)=>Pn(e,{onFailure:n=>{const r=d0(n);switch(r._tag){case"Left":return Ba(()=>t(r.left));case"Right":return et(r.right)}},onSuccess:Q})),za=d(2,(e,t)=>wo(n=>Pn(n(e),{onFailure:r=>{const s=X(r);return Pn(t(s),{onFailure:o=>X(ze(r,o)),onSuccess:()=>s})},onSuccess:r=>{const s=ie(r);return ko(t(s),s)}}))),Nd=d(2,(e,t)=>za(e,Kd({onFailure:n=>Ka(n)?Kr(t(l0(n))):tt,onSuccess:()=>tt}))),Q=e=>{const t=new wd(We);return t.effect_instruction_i0=e,t},ce=e=>{const t=new xe(Xs);return t.commit=e,t},j=e=>{const t=new xe(dl);return t.effect_instruction_i0=e,t},P0=d(e=>e.length===3||e.length===2&&!(kt(e[1])&&"onlyEffect"in e[1]),(e,t)=>C(e,n=>{const r=typeof t=="function"?t(n):t;return bo(r)?Dr(r,n):_m(r)?Ms(s=>{r.then(o=>s(Q(n)),o=>s(Ie(new Dd(o,"An unknown error occurred in Effect.tap"))))}):Q(n)})),L0=e=>Ke(t=>{const n=t.getFiberRef(ji),r=g(n,be(()=>t.scope()));return e(xo(ji,I(r)))}),Ed=e=>{const t=new xe(Nr);return t.effect_instruction_i0=cd(Bn),t.effect_instruction_i1=()=>e,t},wo=e=>kd(e,function(){const t=new xe(Nr);return t.effect_instruction_i0=cd(Bn),t.effect_instruction_i1=n=>id(n)?Re(()=>this.effect_instruction_i0(Od)):Re(()=>this.effect_instruction_i0(Ed)),t}),tt=Q(void 0),D0=e=>{const t=new xe(Nr);return t.effect_instruction_i0=e,t.effect_instruction_i1=void 0,t},Ha=e=>{const t=new xe(ks);return t.effect_instruction_i0=e.while,t.effect_instruction_i1=e.body,t.effect_instruction_i2=e.step,t},Wa=e=>{const t=new xe(is);return typeof e?.priority<"u"?nw(t,e.priority):t},$d=d(2,(e,t)=>C(e,n=>Ae(t,r=>[n,r]))),Id=d(2,(e,t)=>C(e,n=>Dr(t,n))),ko=d(2,(e,t)=>C(e,()=>t)),K0=e=>C(M0,t=>g(e,Rd(t))),Rd=d(2,(e,t)=>C(e.interruptAsFork(t),()=>e.await)),U0={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return R(this,arguments)}},q0={_tag:"Fatal",syslog:2,label:"FATAL",ordinal:5e4,pipe(){return R(this,arguments)}},B0={_tag:"Error",syslog:3,label:"ERROR",ordinal:4e4,pipe(){return R(this,arguments)}},Cd={_tag:"Warning",syslog:4,label:"WARN",ordinal:3e4,pipe(){return R(this,arguments)}},jd={_tag:"Info",syslog:6,label:"INFO",ordinal:2e4,pipe(){return R(this,arguments)}},Md={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return R(this,arguments)}},J0={_tag:"Trace",syslog:7,label:"TRACE",ordinal:0,pipe(){return R(this,arguments)}},V0={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return R(this,arguments)}},z0="effect/FiberRef",H0=Symbol.for(z0),W0={_A:e=>e},Ga=e=>Ke(t=>ie(t.getFiberRef(e))),Ya=d(2,(e,t)=>C(Ga(e),t)),nu=d(2,(e,t)=>G0(e,()=>[void 0,t])),G0=d(2,(e,t)=>Ke(n=>{const[r,s]=t(n.getFiberRef(e));return n.setFiberRef(e,s),Q(r)})),xo=d(3,(e,t,n)=>I0(Id(Ga(t),nu(t,n)),()=>e,r=>nu(t,r))),Fe=(e,t)=>Hn(e,{differ:nd(),fork:t?.fork??Y,join:t?.join}),Y0=e=>{const t=TS();return Hn(e,{differ:t,fork:t.empty})},Q0=e=>{const t=OS(nd());return Hn(e,{differ:t,fork:t.empty})},Ad=e=>{const t=vS();return Hn(e,{differ:t,fork:t.empty})},Hn=(e,t)=>({...$r,[H0]:W0,initial:e,commit(){return Ga(this)},diff:(r,s)=>t.differ.diff(r,s),combine:(r,s)=>t.differ.combine(r,s),patch:r=>s=>t.differ.patch(r,s),fork:t.fork,join:t.join??((r,s)=>s)}),X0=e=>Hn(e,{differ:Gc,fork:Gc.empty}),Ur=B(Symbol.for("effect/FiberRef/currentContext"),()=>Ad(va())),vo=B(Symbol.for("effect/FiberRef/currentSchedulingPriority"),()=>Fe(0)),Fd=B(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),()=>Fe(2048)),Z0=B(Symbol.for("effect/FiberRef/currentLogAnnotation"),()=>Fe(Fa())),ew=B(Symbol.for("effect/FiberRef/currentLogLevel"),()=>Fe(jd)),tw=B(Symbol.for("effect/FiberRef/currentLogSpan"),()=>Fe(In())),nw=d(2,(e,t)=>xo(e,vo,t)),rw=B(Symbol.for("effect/FiberRef/currentConcurrency"),()=>Fe("unbounded")),sw=B(Symbol.for("effect/FiberRef/currentRequestBatching"),()=>Fe(!0)),ow=B(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),()=>Fe(I(Md))),iw=B(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),()=>Fe(I(Cd))),Ci=B(Symbol.for("effect/FiberRef/currentMetricLabels"),()=>Q0(wn())),ji=B(Symbol.for("effect/FiberRef/currentForkScopeOverride"),()=>Fe(N(),{fork:()=>N(),join:(e,t)=>e})),Qr=B(Symbol.for("effect/FiberRef/currentInterruptedCause"),()=>Fe(jn,{fork:()=>jn,join:(e,t)=>e})),aw=(e,t)=>e.addFinalizer(()=>Kr(t)),cw=(e,t)=>e.close(t),To=(e,t)=>e.fork(t),Qa=(function(){class e extends globalThis.Error{commit(){return Ie(this)}toJSON(){const n={...this};return this.message&&(n.message=this.message),this.cause&&(n.cause=this.cause),n}[ee](){return this.toString!==globalThis.Error.prototype.toString?this.stack?`${this.toString()}
|
|
20
|
-
${this.stack.split(`
|
|
21
|
-
`).slice(1).join(`
|
|
22
|
-
`)}`:this.toString():"Bun"in globalThis?zn(Cs(this),{renderErrorCause:!0}):this}}return Object.assign(e.prototype,Vm),e})(),Pd=(e,t)=>{class n extends Qa{_tag=t}return Object.assign(n.prototype,e),n.prototype.name=t,n},ru=Symbol.for("effect/Cause/errors/RuntimeException"),uw=Pd({[ru]:ru},"RuntimeException"),lw=Symbol.for("effect/Cause/errors/InterruptedException"),fw=e=>A(e,lw),su=Symbol.for("effect/Cause/errors/NoSuchElement"),Ld=Pd({[su]:su},"NoSuchElementException"),ou=Symbol.for("effect/Cause/errors/UnknownException"),Dd=(function(){class e extends Qa{_tag="UnknownException";error;constructor(n,r){super(r??"An unknown error occurred",{cause:n}),this.error=n}}return Object.assign(e.prototype,{[ou]:ou,name:"UnknownException"}),e})(),Oo=e=>bo(e)&&"_tag"in e&&(e._tag==="Success"||e._tag==="Failure"),dw=e=>e._tag==="Success",iu=(e,t)=>gw(e,t?.parallel?go:ze),hw=e=>X(ct(e)),au=e=>X(Cs(e)),X=e=>{const t=new Sd(He);return t.effect_instruction_i0=e,t},pw=e=>X(Nt(e)),Wo=d(2,(e,t)=>{switch(e._tag){case He:return X(e.effect_instruction_i0);case We:return ie(t(e.effect_instruction_i0))}}),Kd=d(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case He:return t(e.effect_instruction_i0);case We:return n(e.effect_instruction_i0)}}),ie=e=>{const t=new wd(We);return t.effect_instruction_i0=e,t},Pt=ie(void 0),mw=d(3,(e,t,{onFailure:n,onSuccess:r})=>{switch(e._tag){case He:switch(t._tag){case We:return X(e.effect_instruction_i0);case He:return X(n(e.effect_instruction_i0,t.effect_instruction_i0))}case We:switch(t._tag){case We:return ie(r(e.effect_instruction_i0,t.effect_instruction_i0));case He:return X(t.effect_instruction_i0)}}}),gw=(e,t)=>{const n=vf(e);return Tn(n)?g(Ft(n),Rl(g(On(n),Wo(De)),(r,s)=>g(r,mw(s,{onSuccess:(o,i)=>g(o,Ze(i)),onFailure:t}))),Wo(vn),Wo(r=>Bt(r)),I):N()},yw=e=>({...$r,[v0]:T0,state:qf(O0([])),commit(){return Ud(this)},blockingOn:e}),Ud=e=>R0(t=>{const n=ho(e.state);switch(n._tag){case bd:return t(n.effect);case yo:return n.joiners.push(t),bw(e,t)}},e.blockingOn),qd=(e,t)=>{const n=ho(e.state);if(n._tag===yo){Bf(e.state,N0(t));for(let r=0,s=n.joiners.length;r<s;r++)n.joiners[r](t)}},bw=(e,t)=>j(()=>{const n=ho(e.state);if(n._tag===yo){const r=n.joiners.indexOf(t);r>=0&&n.joiners.splice(r,1)}}),_w=Ke(e=>ie(e.currentContext)),Sw=()=>_w,qr=e=>C(Sw(),e),ww=d(2,(e,t)=>xo(Ur,t)(e)),kw=d(2,(e,t)=>qr(n=>ww(e,t(n)))),Xa=e=>{const t=e.currentSpan;return t!==void 0&&t._tag==="Span"?I(t):N()},xw=dw,cu=Symbol.for("effect/MutableHashMap"),vw={[cu]:cu,[Symbol.iterator](){return new Za(this)},toString(){return ye(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(le)}},[ee](){return this.toJSON()},pipe(){return R(this,arguments)}};class Za{self;referentialIterator;bucketIterator;constructor(t){this.self=t,this.referentialIterator=t.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();const t=this.referentialIterator.next();return t.done?(this.bucketIterator=new Tw(this.self.buckets.values()),this.next()):t}[Symbol.iterator](){return new Za(this.self)}}class Tw{backing;constructor(t){this.backing=t}currentBucket;next(){if(this.currentBucket===void 0){const n=this.backing.next();if(n.done)return n;this.currentBucket=n.value[Symbol.iterator]()}const t=this.currentBucket.next();return t.done?(this.currentBucket=void 0,this.next()):t}}const Ow=()=>{const e=Object.create(vw);return e.referential=new Map,e.buckets=new Map,e.bucketsSize=0,e},Mt=d(2,(e,t)=>{if(_s(t)===!1)return e.referential.has(t)?I(e.referential.get(t)):N();const n=t[K](),r=e.buckets.get(n);return r===void 0?N():Nw(e,r,t)}),Nw=(e,t,n,r=!1)=>{for(let s=0,o=t.length;s<o;s++)if(n[L](t[s][0])){const i=t[s][1];return r&&(t.splice(s,1),e.bucketsSize--),I(i)}return N()},tr=d(2,(e,t)=>ke(Mt(e,t))),nr=d(3,(e,t,n)=>{if(_s(t)===!1)return e.referential.set(t,n),e;const r=t[K](),s=e.buckets.get(r);return s===void 0?(e.buckets.set(r,[[t,n]]),e.bucketsSize++,e):(Ew(e,s,t),s.push([t,n]),e.bucketsSize++,e)}),Ew=(e,t,n)=>{for(let r=0,s=t.length;r<s;r++)if(n[L](t[r][0])){t.splice(r,1),e.bucketsSize--;return}},$w="effect/Clock",uu=Symbol.for($w),ec=an("effect/Clock"),Iw=2**31-1,lu={unsafeSchedule(e,t){const n=_i(t);if(n>Iw)return ui;let r=!1;const s=setTimeout(()=>{r=!0,e()},n);return()=>(clearTimeout(s),!r)}},fu=(function(){const 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)))})(),Rw=(function(){const e=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!e)return fu;const t=fu()-e.bigint();return()=>t+e.bigint()})();class Cw{[uu]=uu;unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return Rw()}currentTimeMillis=j(()=>this.unsafeCurrentTimeMillis());currentTimeNanos=j(()=>this.unsafeCurrentTimeNanos());scheduler(){return Q(lu)}sleep(t){return Xt(n=>{const r=lu.unsafeSchedule(()=>n(tt),t);return Kr(j(r))})}}const jw=()=>new Cw,Bd="And",Jd="Or",Vd="InvalidData",zd="MissingData",Hd="SourceUnavailable",Wd="Unsupported",Mw="effect/ConfigError",du=Symbol.for(Mw),Wn={_tag:"ConfigError",[du]:du},Gd=(e,t)=>{const n=Object.create(Wn);return n._op=Bd,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},Yd=(e,t)=>{const n=Object.create(Wn);return n._op=Jd,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},Aw=(e,t,n={pathDelim:"."})=>{const r=Object.create(Wn);return r._op=Vd,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Invalid data at ${g(this.path,Un(n.pathDelim))}: "${this.message}")`}}),r},Zt=(e,t,n={pathDelim:"."})=>{const r=Object.create(Wn);return r._op=zd,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Missing data at ${g(this.path,Un(n.pathDelim))}: "${this.message}")`}}),r},Fw=(e,t,n,r={pathDelim:"."})=>{const s=Object.create(Wn);return s._op=Hd,s.path=e,s.message=t,s.cause=n,Object.defineProperty(s,"toString",{enumerable:!1,value(){return`(Source unavailable at ${g(this.path,Un(r.pathDelim))}: "${this.message}")`}}),s},Pw=(e,t,n={pathDelim:"."})=>{const r=Object.create(Wn);return r._op=Wd,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${g(this.path,Un(n.pathDelim))}: "${this.message}")`}}),r},Lt=d(2,(e,t)=>{switch(e._op){case Bd:return Gd(Lt(e.left,t),Lt(e.right,t));case Jd:return Yd(Lt(e.left,t),Lt(e.right,t));case Vd:return Aw([...t,...e.path],e.message);case zd:return Zt([...t,...e.path],e.message);case Hd:return Fw([...t,...e.path],e.message,e.cause);case Wd:return Pw([...t,...e.path],e.message)}}),Lw={_tag:"Empty"},Go=d(2,(e,t)=>{let n=Pa(t),r=e;for(;C_(n);){const s=n.head;switch(s._tag){case"Empty":{n=n.tail;break}case"AndThen":{n=Yt(s.first,Yt(s.second,n.tail));break}case"MapName":{r=Ut(r,s.f),n=n.tail;break}case"Nested":{r=vs(r,s.name),n=n.tail;break}case"Unnested":{if(g(fr(r),yg(s.name)))r=Ht(r),n=n.tail;else return P(Zt(r,`Expected ${s.name} to be in path in ConfigProvider#unnested`));break}}}return V(r)}),Dw="Constant",Kw="Fail",Uw="Fallback",qw="Described",Bw="Lazy",Jw="MapOrFail",Vw="Nested",zw="Primitive",Hw="Sequence",Ww="HashMap",Gw="ZipWith";var hu={};const Fs=(e,t)=>[...e,...t],Yw="effect/ConfigProvider",pu=Symbol.for(Yw),Qw=an("effect/ConfigProvider"),Xw="effect/ConfigProviderFlat",mu=Symbol.for(Xw),Zw=e=>({[pu]:pu,pipe(){return R(this,arguments)},...e}),ek=e=>({[mu]:mu,patch:e.patch,load:(t,n,r=!0)=>e.load(t,n,r),enumerateChildren:e.enumerateChildren}),tk=e=>Zw({load:t=>C(Je(e,wn(),t,!1),n=>we(fr(n),{onNone:()=>Ie(Zt(wn(),`Expected a single value having structure: ${t}`)),onSome:Q})),flattened:e}),nk=e=>{const{pathDelim:t,seqDelim:n}=Object.assign({},{pathDelim:"_",seqDelim:","},e),r=c=>g(c,Un(t)),s=c=>c.split(t),o=()=>typeof process<"u"&&"env"in process&&typeof hu=="object"?hu:{};return tk(ek({load:(c,u,f=!0)=>{const h=r(c),p=o(),m=h in p?I(p[h]):N();return g(m,So(()=>Zt(c,`Expected ${h} to exist in the process context`)),C(y=>ak(y,c,u,n,f)))},enumerateChildren:c=>j(()=>{const u=o(),p=Object.keys(u).map(m=>s(m.toUpperCase())).filter(m=>{for(let y=0;y<c.length;y++){const v=g(c,El(y)),S=m[y];if(S===void 0||v!==S)return!1}return!0}).flatMap(m=>m.slice(c.length,c.length+1));return h_(p)}),patch:Lw}))},rk=(e,t,n,r)=>{const s=Ic(n.length,c=>c>=r.length?N():I([e(c),c+1])),o=Ic(r.length,c=>c>=n.length?N():I([t(c),c+1])),i=Fs(n,s),a=Fs(r,o);return[i,a]},sk=(e,t)=>{let n=t;if(n._tag==="Nested"){const r=e.slice();for(;n._tag==="Nested";)r.push(n.name),n=n.config;return r}return e},Je=(e,t,n,r)=>{const s=n;switch(s._tag){case Dw:return Q(Ye(s.value));case qw:return ce(()=>Je(e,t,s.config,r));case Kw:return Ie(Zt(t,s.message));case Uw:return g(ce(()=>Je(e,t,s.first,r)),Ri(o=>s.condition(o)?g(Je(e,t,s.second,r),Ri(i=>Ie(Yd(o,i)))):Ie(o)));case Bw:return ce(()=>Je(e,t,s.config(),r));case Jw:return ce(()=>g(Je(e,t,s.original,r),C($t(o=>g(s.mapOrFail(o),So(Lt(sk(t,s.original))))))));case Vw:return ce(()=>Je(e,Fs(t,Ye(s.name)),s.config,r));case zw:return g(Go(t,e.patch),C(o=>g(e.load(o,s,r),C(i=>{if(i.length===0){const a=g($g(o),be(()=>"<n/a>"));return Ie(Zt([],`Expected ${s.description} with name ${a}`))}return Q(i)}))));case Hw:return g(Go(t,e.patch),C(o=>g(e.enumerateChildren(o),C(uk),C(i=>i.length===0?ce(()=>Ae(Je(e,t,s.config,!0),Ye)):g($t(i,a=>Je(e,xg(t,`[${a}]`),s.config,!0)),Ae(a=>{const c=Lg(a);return c.length===0?Ye(wn()):Ye(c)}))))));case Ww:return ce(()=>g(Go(t,e.patch),C(o=>g(e.enumerateChildren(o),C(i=>g(i,$t(a=>Je(e,Fs(o,Ye(a)),s.valueConfig,r)),Ae(a=>a.length===0?Ye(Fa()):g(ck(a),Ut(c=>x_($c(oe(i),c)))))))))));case Gw:return ce(()=>g(Je(e,t,s.left,r),As,C(o=>g(Je(e,t,s.right,r),As,C(i=>{if(he(o)&&he(i))return Ie(Gd(o.left,i.left));if(he(o)&&yt(i))return Ie(o.left);if(yt(o)&&he(i))return Ie(i.left);if(yt(o)&&yt(i)){const a=g(t,Un(".")),c=ok(t,a),[u,f]=rk(c,c,g(o.right,Ut(V)),g(i.right,Ut(V)));return g(u,$c(f),$t(([h,p])=>g($d(h,p),Ae(([m,y])=>s.zip(m,y)))))}throw new Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")})))))}},ok=(e,t)=>n=>P(Zt(e,`The element at index ${n} in a sequence at path "${t}" was missing`)),ik=(e,t)=>e.split(new RegExp(`\\s*${Ts(t)}\\s*`)),ak=(e,t,n,r,s)=>s?g(ik(e,r),$t(o=>n.parse(o.trim())),So(Lt(t))):g(n.parse(e),Va({onFailure:Lt(t),onSuccess:Ye})),ck=e=>Object.keys(e[0]).map(t=>e.map(n=>n[t])),uk=e=>g($t(e,fk),Va({onFailure:()=>wn(),onSuccess:Sn(kn)}),As,Ae(sg)),lk=/^(\[(\d+)\])$/,fk=e=>{const t=e.match(lk);if(t!==null){const n=t[2];return g(n!==void 0&&n.length>0?I(n):N(),Kn(dk))}return N()},dk=e=>{const t=Number.parseInt(e);return Number.isNaN(t)?N():I(t)},gu=Symbol.for("effect/Console"),Qd=an("effect/Console"),hk={[gu]:gu,assert(e,...t){return j(()=>{console.assert(e,...t)})},clear:j(()=>{console.clear()}),count(e){return j(()=>{console.count(e)})},countReset(e){return j(()=>{console.countReset(e)})},debug(...e){return j(()=>{console.debug(...e)})},dir(e,t){return j(()=>{console.dir(e,t)})},dirxml(...e){return j(()=>{console.dirxml(...e)})},error(...e){return j(()=>{console.error(...e)})},group(e){return e?.collapsed?j(()=>console.groupCollapsed(e?.label)):j(()=>console.group(e?.label))},groupEnd:j(()=>{console.groupEnd()}),info(...e){return j(()=>{console.info(...e)})},log(...e){return j(()=>{console.log(...e)})},table(e,t){return j(()=>{console.table(e,t)})},time(e){return j(()=>console.time(e))},timeEnd(e){return j(()=>console.timeEnd(e))},timeLog(e,...t){return j(()=>{console.timeLog(e,...t)})},trace(...e){return j(()=>{console.trace(...e)})},warn(...e){return j(()=>{console.warn(...e)})},unsafe:console},pk="effect/Random",yu=Symbol.for(pk),mk=an("effect/Random");class gk{seed;[yu]=yu;PRNG;constructor(t){this.seed=t,this.PRNG=new Om(t)}get next(){return j(()=>this.PRNG.number())}get nextBoolean(){return Ae(this.next,t=>t>.5)}get nextInt(){return j(()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER))}nextRange(t,n){return Ae(this.next,r=>(n-t)*r+t)}nextIntBetween(t,n){return j(()=>this.PRNG.integer(n-t)+t)}shuffle(t){return yk(t,n=>this.nextIntBetween(0,n))}}const yk=(e,t)=>ce(()=>g(j(()=>Array.from(e)),C(n=>{const r=[];for(let s=n.length;s>=2;s=s-1)r.push(s);return g(r,_o(s=>g(t(s),Ae(o=>bk(n,s-1,o)))),Dr(vf(n)))}))),bk=(e,t,n)=>{const r=e[t];return e[t]=e[n],e[n]=r,e},_k=e=>new gk(k(e)),bu=Symbol.for("effect/Tracer"),Sk=e=>({[bu]:bu,...e}),Xd=an("effect/Tracer"),Zd=an("effect/ParentSpan"),_u=(function(){const e="abcdef0123456789",t=e.length;return function(n){let r="";for(let s=0;s<n;s++)r+=e.charAt(Math.floor(Math.random()*t));return r}})();class wk{name;parent;context;startTime;kind;_tag="Span";spanId;traceId="native";sampled=!0;status;attributes;events=[];links;constructor(t,n,r,s,o,i){this.name=t,this.parent=n,this.context=r,this.startTime=o,this.kind=i,this.status={_tag:"Started",startTime:o},this.attributes=new Map,this.traceId=n._tag==="Some"?n.value.traceId:_u(32),this.spanId=_u(16),this.links=Array.from(s)}end(t,n){this.status={_tag:"Ended",endTime:t,exit:n,startTime:this.status.startTime}}attribute(t,n){this.attributes.set(t,n)}event(t,n,r){this.events.push([t,n,r??{}])}addLinks(t){this.links.push(...t)}}const kk=Sk({span:(e,t,n,r,s,o)=>new wk(e,t,n,r,s,o),context:e=>e()}),xk=g(va(),er(ec,jw()),er(Qd,hk),er(mk,_k(Math.random())),er(Qw,nk()),er(Xd,kk)),Ps=B(Symbol.for("effect/DefaultServices/currentServices"),()=>Ad(xk));function vk(e){return new Ct(e)}function Tk(){return vk(new Map)}const Su=Symbol.for("effect/FiberRefs");class Ct{locals;[Su]=Su;constructor(t){this.locals=t}pipe(){return R(this,arguments)}}const Ok=(e,t,n,r=!1)=>{const s=e;let o=t,i=n,a=r,c;for(;c===void 0;)if(_e(o)&&_e(i)){const u=Ce(o)[0],f=Ht(o),h=Ce(i)[0],p=Ce(i)[1],m=Ht(i);u.startTimeMillis<h.startTimeMillis?(i=m,a=!0):u.startTimeMillis>h.startTimeMillis?o=f:u.id<h.id?(i=m,a=!0):u.id>h.id?o=f:c=[p,a]}else c=[s.initial,!0];return c},Nk=d(3,(e,t,n)=>{const r=new Map(e.locals);return n.locals.forEach((s,o)=>{const i=s[0][1];if(!s[0][0][L](t)){if(!r.has(o)){if(D(i,o.initial))return;r.set(o,[[t,o.join(o.initial,i)]]);return}const a=r.get(o),[c,u]=Ok(o,a,s);if(u){const f=o.diff(c,i),h=a[0][1],p=o.join(h,o.patch(f)(h));if(!D(h,p)){let m;const y=a[0][0];y[L](t)?m=[[y,p],...a.slice(1)]:m=[[t,p],...a],r.set(o,m)}}}}),new Ct(r)}),Ek=d(2,(e,t)=>{const n=new Map;return eh(e,n,t),new Ct(n)}),eh=(e,t,n)=>{e.locals.forEach((r,s)=>{const o=r[0][1],i=s.patch(s.fork)(o);D(o,i)?t.set(s,r):t.set(s,[[n,i],...r])})},th=d(2,(e,t)=>{const n=new Map(e.locals);return n.delete(t),new Ct(n)}),$k=d(2,(e,t)=>e.locals.has(t)?I(Ce(e.locals.get(t))[1]):N()),wr=d(2,(e,t)=>g($k(e,t),be(()=>t.initial))),Mi=d(2,(e,{fiberId:t,fiberRef:n,value:r})=>{if(e.locals.size===0)return new Ct(new Map([[n,[[t,r]]]]));const s=new Map(e.locals);return Ai(s,t,n,r),new Ct(s)}),Ai=(e,t,n,r)=>{const s=e.get(n)??[];let o;if(_e(s)){const[i,a]=Ce(s);if(i[L](t)){if(D(a,r))return;o=[[t,r],...s.slice(1)]}else o=[[t,r],...s]}else o=[[t,r]];e.set(n,o)},Ik=d(2,(e,{entries:t,forkAs:n})=>{if(e.locals.size===0)return new Ct(new Map(t));const r=new Map(e.locals);return n!==void 0&&eh(e,r,n),t.forEach(([s,o])=>{o.length===1?Ai(r,o[0][0],s,o[0][1]):o.forEach(([i,a])=>{Ai(r,i,s,a)})}),new Ct(r)}),Rk=wr,Ck=Ik,jk=Tk,Mk=U0,Ak=q0,Fk=B0,Pk=Cd,Lk=jd,Dk=Md,Kk=J0,Uk=V0,qk=g(kn,nn(e=>e.ordinal)),Bk=cg(qk),Jk=e=>{switch(e){case"All":return Mk;case"Debug":return Dk;case"Error":return Fk;case"Fatal":return Ak;case"Info":return Lk;case"Trace":return Kk;case"None":return Uk;case"Warning":return Pk}},nh=e=>e.replace(/[\s="]/g,"_"),Vk=e=>t=>`${nh(t.label)}=${e-t.startTime}ms`,zk=Er,Hk=zm;class Wk extends Hk{}const rh="Empty",sh="Add",oh="Remove",ih="Update",ah="AndThen",Gk={_tag:rh},Yk=(e,t)=>{const n=new Map(e.locals);let r=Gk;for(const[s,o]of t.locals.entries()){const i=Ce(o)[1],a=n.get(s);if(a!==void 0){const c=Ce(a)[1];D(c,i)||(r=Yo({_tag:ih,fiberRef:s,patch:s.diff(c,i)})(r))}else r=Yo({_tag:sh,fiberRef:s,value:i})(r);n.delete(s)}for(const[s]of n.entries())r=Yo({_tag:oh,fiberRef:s})(r);return r},Yo=d(2,(e,t)=>({_tag:ah,first:e,second:t})),Qk=d(3,(e,t,n)=>{let r=n,s=Ye(e);for(;_e(s);){const o=Ce(s),i=Ht(s);switch(o._tag){case rh:{s=i;break}case sh:{r=Mi(r,{fiberId:t,fiberRef:o.fiberRef,value:o.value}),s=i;break}case oh:{r=th(r,o.fiberRef),s=i;break}case ih:{const a=wr(r,o.fiberRef);r=Mi(r,{fiberId:t,fiberRef:o.fiberRef,value:o.fiberRef.patch(o.patch)(a)}),s=i;break}case ah:{s=vs(o.first)(vs(o.second)(i));break}}}return r}),ch="effect/MetricLabel",Fi=Symbol.for(ch);class Xk{key;value;[Fi]=Fi;_hash;constructor(t,n){this.key=t,this.value=n,this._hash=se(ch+this.key+this.value)}[K](){return this._hash}[L](t){return ex(t)&&this.key===t.key&&this.value===t.value}pipe(){return R(this,arguments)}}const Zk=(e,t)=>new Xk(e,t),ex=e=>A(e,Fi),tx=e=>{let t,n;typeof e=="function"?t=e:(t=e.try,n=e.catch);const r=s=>n?Ba(()=>n(s)):Ie(new Dd(s,"An unknown error occurred in Effect.tryPromise"));return t.length>=1?Xt((s,o)=>{try{t(o).then(i=>s(Q(i)),i=>s(r(i)))}catch(i){s(r(i))}}):Xt(s=>{try{t().then(o=>s(Q(o)),o=>s(r(o)))}catch(o){s(r(o))}})},nx="Sequential",rx="Parallel",sx="ParallelN",uh={_tag:nx},ox={_tag:rx},ix=e=>({_tag:sx,parallelism:e}),Pi=uh,Li=ox,Di=ix,ax=Yk,cx=Qk,No="effect/FiberStatus",en=Symbol.for(No),Ls="Done",wu="Running",ku="Suspended",ux=se(`${No}-${Ls}`);class lx{[en]=en;_tag=Ls;[K](){return ux}[L](t){return tc(t)&&t._tag===Ls}}class fx{runtimeFlags;[en]=en;_tag=wu;constructor(t){this.runtimeFlags=t}[K](){return g(k(No),J(k(this._tag)),J(k(this.runtimeFlags)),ne(this))}[L](t){return tc(t)&&t._tag===wu&&this.runtimeFlags===t.runtimeFlags}}class dx{runtimeFlags;blockingOn;[en]=en;_tag=ku;constructor(t,n){this.runtimeFlags=t,this.blockingOn=n}[K](){return g(k(No),J(k(this._tag)),J(k(this.runtimeFlags)),J(k(this.blockingOn)),ne(this))}[L](t){return tc(t)&&t._tag===ku&&this.runtimeFlags===t.runtimeFlags&&D(this.blockingOn,t.blockingOn)}}const hx=new lx,px=e=>new fx(e),mx=(e,t)=>new dx(e,t),tc=e=>A(e,en),gx=e=>e._tag===Ls,yx=hx,lh=px,bx=mx,_x=gx,Sx=Symbol.for("effect/Micro"),Ds=Symbol.for("effect/Micro/MicroExit"),xu=Symbol.for("effect/Micro/MicroCause"),wx={_E:Y};class fh extends globalThis.Error{_tag;traces;[xu];constructor(t,n,r){const s=`MicroCause.${t}`;let o,i,a;if(n instanceof globalThis.Error){o=`(${s}) ${n.name}`,i=n.message;const c=i.split(`
|
|
23
|
-
`).length;a=n.stack?`(${s}) ${n.stack.split(`
|
|
24
|
-
`).slice(0,c+3).join(`
|
|
25
|
-
`)}`:`${o}: ${i}`}else o=s,i=bn(n,0),a=`${o}: ${i}`;r.length>0&&(a+=`
|
|
26
|
-
${r.join(`
|
|
27
|
-
`)}`),super(i),this._tag=t,this.traces=r,this[xu]=wx,this.name=o,this.stack=a}pipe(){return R(this,arguments)}toString(){return this.stack}[ee](){return this.stack}}class kx extends fh{defect;constructor(t,n=[]){super("Die",t,n),this.defect=t}}const xx=(e,t=[])=>new kx(e,t);class vx extends fh{constructor(t=[]){super("Interrupt","interrupted",t)}}const Tx=(e=[])=>new vx(e),Ox=e=>e._tag==="Interrupt",vu=Symbol.for("effect/Micro/MicroFiber"),Nx={_A:Y,_E:Y};class Ex{context;interruptible;[vu];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(t,n=!0){this.context=t,this.interruptible=n,this[vu]=Nx}getRef(t){return eb(this.context,t)}addObserver(t){return this._exit?(t(this._exit),um):(this._observers.push(t),()=>{const n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}_interrupted=!1;unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(ic))}unsafePoll(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){const s=this._yielded;this._yielded=void 0,s()}const n=this.runLoop(t);if(n===Xr)return;const r=Tu.interruptChildren&&Tu.interruptChildren(this);if(r!==void 0)return this.evaluate(Us(r,()=>n));this._exit=n;for(let s=0;s<this._observers.length;s++)this._observers[s](n);this._observers.length=0}runLoop(t){let n=!1,r=t;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!n&&this.getRef(ac).shouldYield(this)){n=!0;const s=r;r=Us(jx,()=>s)}if(r=r[Ki](this),r===Xr){const s=this._yielded;return Ds in s?(this._yielded=void 0,s):Xr}}}catch(s){return A(r,Ki)?Ui(s):Ui(`MicroFiber.runLoop: Not a valid effect: ${String(r)}`)}}getCont(t){for(;;){const n=this._stack.pop();if(!n)return;const r=n[Ks]&&n[Ks](this);if(r)return{[t]:r};if(n[t])return n}}_yielded=void 0;yieldWith(t){return this._yielded=t,Xr}children(){return this._children??=new Set}}const Tu=B("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0})),dh=Symbol.for("effect/Micro/identifier"),ue=Symbol.for("effect/Micro/args"),Ki=Symbol.for("effect/Micro/evaluate"),Ln=Symbol.for("effect/Micro/successCont"),yn=Symbol.for("effect/Micro/failureCont"),Ks=Symbol.for("effect/Micro/ensureCont"),Xr=Symbol.for("effect/Micro/Yield"),$x={_A:Y,_E:Y,_R:Y},Ix={...zk,_op:"Micro",[Sx]:$x,pipe(){return R(this,arguments)},[Symbol.iterator](){return new ol(new Tr(this))},toJSON(){return{_id:"Micro",op:this[dh],...ue in this?{args:this[ue]}:void 0}},toString(){return ye(this)},[ee](){return ye(this)}};function Rx(e){return Ui("Micro.evaluate: Not implemented")}const Eo=e=>({...Ix,[dh]:e.op,[Ki]:e.eval??Rx,[Ln]:e.contA,[yn]:e.contE,[Ks]:e.ensure}),nc=e=>{const t=Eo(e);return function(){const n=Object.create(t);return n[ue]=e.single===!1?arguments:arguments[0],n}},hh=e=>{const t={...Eo(e),[Ds]:Ds,_tag:e.op,get[e.prop](){return this[ue]},toJSON(){return{_id:"MicroExit",_tag:e.op,[e.prop]:this[ue]}},[L](n){return Fx(n)&&n._tag===e.op&&D(this[ue],n[ue])},[K](){return ne(this,J(se(e.op))(k(this[ue])))}};return function(n){const r=Object.create(t);return r[ue]=n,r[Ln]=void 0,r[yn]=void 0,r[Ks]=void 0,r}},rc=hh({op:"Success",prop:"value",eval(e){const t=e.getCont(Ln);return t?t[Ln](this[ue],e):e.yieldWith(this)}}),ph=hh({op:"Failure",prop:"cause",eval(e){let t=e.getCont(yn);for(;Ox(this[ue])&&t&&e.interruptible;)t=e.getCont(yn);return t?t[yn](this[ue],e):e.yieldWith(this)}}),Cx=nc({op:"Yield",eval(e){let t=!1;return e.getRef(ac).scheduleTask(()=>{t||e.evaluate(Px)},this[ue]??0),e.yieldWith(()=>{t=!0})}}),jx=Cx(0),Mx=rc(void 0),sc=nc({op:"WithMicroFiber",eval(e){return this[ue](e)}}),Us=d(2,(e,t)=>{const n=Object.create(Ax);return n[ue]=e,n[Ln]=t,n}),Ax=Eo({op:"OnSuccess",eval(e){return e._stack.push(this),this[ue]}}),Fx=e=>A(e,Ds),mh=rc,oc=ph,ic=oc(Tx()),Ui=e=>oc(xx(e)),Px=mh(void 0),Lx="setImmediate"in globalThis?globalThis.setImmediate:e=>setTimeout(e,0);class gh{tasks=[];running=!1;scheduleTask(t,n){this.tasks.push(t),this.running||(this.running=!0,Lx(this.afterScheduled))}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){const t=this.tasks;this.tasks=[];for(let n=0,r=t.length;n<r;n++)t[n]()}shouldYield(t){return t.currentOpCount>=t.getRef(Ux)}flush(){for(;this.tasks.length>0;)this.runTasks()}}const Dx=d(2,(e,t)=>sc(n=>{const r=n.context;return n.context=t(r),Jx(e,()=>(n.context=r,Mx))})),Kx=d(2,(e,t)=>Dx(e,_f(t)));class Ux extends Sf()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class ac extends Sf()("effect/Micro/currentScheduler",{defaultValue:()=>new gh}){}const qx=d(2,(e,t)=>{const n=Object.create(Bx);return n[ue]=e,n[Ln]=t.onSuccess,n[yn]=t.onFailure,n}),Bx=Eo({op:"OnSuccessAndFailure",eval(e){return e._stack.push(this),this[ue]}}),Jx=d(2,(e,t)=>zx(n=>qx(n(e),{onFailure:r=>Us(t(oc(r)),()=>ph(r)),onSuccess:r=>Us(t(mh(r)),()=>rc(r))}))),yh=nc({op:"SetInterruptible",ensure(e){if(e.interruptible=this[ue],e._interrupted&&e.interruptible)return()=>ic}}),Vx=e=>sc(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(yh(!1)),t._interrupted?ic:e)),zx=e=>sc(t=>t.interruptible?(t.interruptible=!1,t._stack.push(yh(!0)),e(Vx)):e(Y)),Hx=(e,t)=>{const n=new Ex(ac.context(new gh));return n.evaluate(e),n};class bh{buckets=[];scheduleTask(t,n){const r=this.buckets.length;let s,o=0;for(;o<r&&this.buckets[o][0]<=n;o++)s=this.buckets[o];s&&s[0]===n?s[1].push(t):o===r?this.buckets.push([n,[t]]):this.buckets.splice(o,0,[n,[t]])}}class Wx{maxNextTickBeforeTimer;running=!1;tasks=new bh;constructor(t){this.maxNextTickBeforeTimer=t}starveInternal(t){const n=this.tasks.buckets;this.tasks.buckets=[];for(const[r,s]of n)for(let o=0;o<s.length;o++)s[o]();this.tasks.buckets.length===0?this.running=!1:this.starve(t)}starve(t=0){t>=this.maxNextTickBeforeTimer?setTimeout(()=>this.starveInternal(0),0):Promise.resolve(void 0).then(()=>this.starveInternal(t+1))}shouldYield(t){return t.currentOpCount>t.getFiberRef(Fd)?t.getFiberRef(vo):!1}scheduleTask(t,n){this.tasks.scheduleTask(t,n),this.running||(this.running=!0,this.starve())}}const _h=B(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new Wx(2048));class Sh{tasks=new bh;deferred=!1;scheduleTask(t,n){this.deferred?_h.scheduleTask(t,n):this.tasks.scheduleTask(t,n)}shouldYield(t){return t.currentOpCount>t.getFiberRef(Fd)?t.getFiberRef(vo):!1}flush(){for(;this.tasks.buckets.length>0;){const t=this.tasks.buckets;this.tasks.buckets=[];for(const[n,r]of t)for(let s=0;s<r.length;s++)r[s]()}this.deferred=!0}}const wh=B(Symbol.for("effect/FiberRef/currentScheduler"),()=>Fe(_h)),kh=B(Symbol.for("effect/FiberRef/currentRequestMap"),()=>Fe(new Map)),Ou=(e,t,n,r)=>{switch(e){case void 0:return t();case"unbounded":return n();case"inherit":return Ya(rw,s=>s==="unbounded"?n():s>1?r(s):t());default:return e>1?r(e):t()}},cc="InterruptSignal",uc="Stateful",lc="Resume",fc="YieldNow",Qo=e=>({_tag:cc,cause:e}),hs=e=>({_tag:uc,onFiber:e}),fn=e=>({_tag:lc,effect:e}),Gx=()=>({_tag:fc}),Yx="effect/FiberScope",qs=Symbol.for(Yx);class Qx{[qs]=qs;fiberId=$n;roots=new Set;add(t,n){this.roots.add(n),n.addObserver(()=>{this.roots.delete(n)})}}class Xx{fiberId;parent;[qs]=qs;constructor(t,n){this.fiberId=t,this.parent=n}add(t,n){this.parent.tell(hs(r=>{r.addChild(n),n.addObserver(()=>{r.removeChild(n)})}))}}const Zx=e=>new Xx(e.id(),e),dc=B(Symbol.for("effect/FiberScope/Global"),()=>new Qx),ev="effect/Fiber",tv=Symbol.for(ev),nv={_E:e=>e,_A:e=>e},rv="effect/Fiber",sv=Symbol.for(rv),xh=e=>Id(Td(e.await),e.inheritAll);({...$r});const jt="effect/FiberCurrent",ov="effect/Logger",iv=Symbol.for(ov),av={_Message:e=>e,_Output:e=>e},hc=e=>({[iv]:av,log:e,pipe(){return R(this,arguments)}}),cv=/^[^\s"=]*$/,uv=(e,t)=>({annotations:n,cause:r,date:s,fiberId:o,logLevel:i,message:a,spans:c})=>{const u=y=>y.match(cv)?y:e(y),f=(y,v)=>`${nh(y)}=${u(v)}`,h=(y,v)=>" "+f(y,v);let p=f("timestamp",s.toISOString());p+=h("level",i.label),p+=h("fiber",Vf(o));const m=wg(a);for(let y=0;y<m.length;y++)p+=h("message",bn(m[y],t));s0(r)||(p+=h("cause",zn(r,{renderErrorCause:!0})));for(const y of c)p+=" "+Vk(s.getTime())(y);for(const[y,v]of n)p+=h(y,bn(v,t));return p},lv=e=>`"${e.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,fv=hc(uv(lv)),dv=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null;dv&&process.stdout.isTTY;const vh="effect/MetricBoundaries",qi=Symbol.for(vh);class hv{values;[qi]=qi;constructor(t){this.values=t,this._hash=g(se(vh),J(Or(this.values)))}_hash;[K](){return this._hash}[L](t){return pv(t)&&D(this.values,t.values)}pipe(){return R(this,arguments)}}const pv=e=>A(e,qi),mv=e=>{const t=g(e,Ol(De(Number.POSITIVE_INFINITY)),Dg);return new hv(t)},gv=e=>g(Sg(e.count-1,t=>e.start*Math.pow(e.factor,t)),oo,mv),yv="effect/MetricKeyType",Th=Symbol.for(yv),Oh="effect/MetricKeyType/Counter",Bi=Symbol.for(Oh),bv="effect/MetricKeyType/Frequency",_v=Symbol.for(bv),Sv="effect/MetricKeyType/Gauge",wv=Symbol.for(Sv),Nh="effect/MetricKeyType/Histogram",Ji=Symbol.for(Nh),kv="effect/MetricKeyType/Summary",xv=Symbol.for(kv),Eh={_In:e=>e,_Out:e=>e};class vv{incremental;bigint;[Th]=Eh;[Bi]=Bi;constructor(t,n){this.incremental=t,this.bigint=n,this._hash=se(Oh)}_hash;[K](){return this._hash}[L](t){return $h(t)}pipe(){return R(this,arguments)}}class Tv{boundaries;[Th]=Eh;[Ji]=Ji;constructor(t){this.boundaries=t,this._hash=g(se(Nh),J(k(this.boundaries)))}_hash;[K](){return this._hash}[L](t){return Ih(t)&&D(this.boundaries,t.boundaries)}pipe(){return R(this,arguments)}}const Ov=e=>new vv(e?.incremental??!1,e?.bigint??!1),Nv=e=>new Tv(e),$h=e=>A(e,Bi),Ev=e=>A(e,_v),$v=e=>A(e,wv),Ih=e=>A(e,Ji),Iv=e=>A(e,xv),Rv="effect/MetricKey",Rh=Symbol.for(Rv),Cv={_Type:e=>e},jv=ga(D);class pc{name;keyType;description;tags;[Rh]=Cv;constructor(t,n,r,s=[]){this.name=t,this.keyType=n,this.description=r,this.tags=s,this._hash=g(se(this.name+this.description),J(k(this.keyType)),J(Or(this.tags)))}_hash;[K](){return this._hash}[L](t){return Mv(t)&&this.name===t.name&&D(this.keyType,t.keyType)&&D(this.description,t.description)&&jv(this.tags,t.tags)}pipe(){return R(this,arguments)}}const Mv=e=>A(e,Rh),Av=(e,t)=>new pc(e,Ov(t),Zs(t?.description)),Fv=(e,t,n)=>new pc(e,Nv(t),Zs(n)),Pv=d(2,(e,t)=>t.length===0?e:new pc(e.name,e.keyType,e.description,cs(e.tags,t))),Lv="effect/MetricState",Br=Symbol.for(Lv),Ch="effect/MetricState/Counter",Vi=Symbol.for(Ch),jh="effect/MetricState/Frequency",zi=Symbol.for(jh),Mh="effect/MetricState/Gauge",Hi=Symbol.for(Mh),Ah="effect/MetricState/Histogram",Wi=Symbol.for(Ah),Fh="effect/MetricState/Summary",Gi=Symbol.for(Fh),Jr={_A:e=>e};class Dv{count;[Br]=Jr;[Vi]=Vi;constructor(t){this.count=t}[K](){return g(k(Ch),J(k(this.count)),ne(this))}[L](t){return Yv(t)&&this.count===t.count}pipe(){return R(this,arguments)}}const Kv=ga(D);class Uv{occurrences;[Br]=Jr;[zi]=zi;constructor(t){this.occurrences=t}_hash;[K](){return g(se(jh),J(Or(oe(this.occurrences.entries()))),ne(this))}[L](t){return Qv(t)&&Kv(oe(this.occurrences.entries()),oe(t.occurrences.entries()))}pipe(){return R(this,arguments)}}class qv{value;[Br]=Jr;[Hi]=Hi;constructor(t){this.value=t}[K](){return g(k(Mh),J(k(this.value)),ne(this))}[L](t){return Xv(t)&&this.value===t.value}pipe(){return R(this,arguments)}}class Bv{buckets;count;min;max;sum;[Br]=Jr;[Wi]=Wi;constructor(t,n,r,s,o){this.buckets=t,this.count=n,this.min=r,this.max=s,this.sum=o}[K](){return g(k(Ah),J(k(this.buckets)),J(k(this.count)),J(k(this.min)),J(k(this.max)),J(k(this.sum)),ne(this))}[L](t){return Zv(t)&&D(this.buckets,t.buckets)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return R(this,arguments)}}class Jv{error;quantiles;count;min;max;sum;[Br]=Jr;[Gi]=Gi;constructor(t,n,r,s,o,i){this.error=t,this.quantiles=n,this.count=r,this.min=s,this.max=o,this.sum=i}[K](){return g(k(Fh),J(k(this.error)),J(k(this.quantiles)),J(k(this.count)),J(k(this.min)),J(k(this.max)),J(k(this.sum)),ne(this))}[L](t){return eT(t)&&this.error===t.error&&D(this.quantiles,t.quantiles)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return R(this,arguments)}}const Vv=e=>new Dv(e),zv=e=>new Uv(e),Hv=e=>new qv(e),Wv=e=>new Bv(e.buckets,e.count,e.min,e.max,e.sum),Gv=e=>new Jv(e.error,e.quantiles,e.count,e.min,e.max,e.sum),Yv=e=>A(e,Vi),Qv=e=>A(e,zi),Xv=e=>A(e,Hi),Zv=e=>A(e,Wi),eT=e=>A(e,Gi),tT="effect/MetricHook",nT=Symbol.for(tT),rT={_In:e=>e,_Out:e=>e},Vr=e=>({[nT]:rT,pipe(){return R(this,arguments)},...e}),Nu=BigInt(0),sT=e=>{let t=e.keyType.bigint?Nu:0;const n=e.keyType.incremental?e.keyType.bigint?s=>s>=Nu:s=>s>=0:s=>!0,r=s=>{n(s)&&(t=t+s)};return Vr({get:()=>Vv(t),update:r,modify:r})},oT=e=>{const t=new Map;for(const r of e.keyType.preregisteredWords)t.set(r,0);const n=r=>{const s=t.get(r)??0;t.set(r,s+1)};return Vr({get:()=>zv(t),update:n,modify:n})},iT=(e,t)=>{let n=t;return Vr({get:()=>Hv(n),update:r=>{n=r},modify:r=>{n=n+r}})},aT=e=>{const t=e.keyType.boundaries.values,n=t.length,r=new Uint32Array(n+1),s=new Float64Array(n);let o=0,i=0,a=Number.MAX_VALUE,c=Number.MIN_VALUE;g(t,Sn(kn),Ut((h,p)=>{s[p]=h}));const u=h=>{let p=0,m=n;for(;p!==m;){const y=Math.floor(p+(m-p)/2),v=s[y];h<=v?m=y:p=y,m===p+1&&(h<=s[p]?m=p:p=m)}r[p]=r[p]+1,o=o+1,i=i+h,h<a&&(a=h),h>c&&(c=h)},f=()=>{const h=eo(n);let p=0;for(let m=0;m<n;m++){const y=s[m],v=r[m];p=p+v,h[m]=[y,p]}return h};return Vr({get:()=>Wv({buckets:f(),count:o,min:a,max:c,sum:i}),update:u,modify:u})},cT=e=>{const{error:t,maxAge:n,maxSize:r,quantiles:s}=e.keyType,o=g(s,Sn(kn)),i=eo(r);let a=0,c=0,u=0,f=0,h=0;const p=y=>{const v=[];let S=0;for(;S!==r-1;){const w=i[S];if(w!=null){const[F,T]=w,O=bi(y-F);Ib(O,Ef)&&$b(O,n)&&v.push(T)}S=S+1}return uT(t,o,Sn(v,kn))},m=(y,v)=>{if(r>0){a=a+1;const S=a%r;i[S]=[v,y]}f=c===0?y:Math.min(f,y),h=c===0?y:Math.max(h,y),c=c+1,u=u+y};return Vr({get:()=>Gv({error:t,quantiles:p(Date.now()),count:c,min:f,max:h,sum:u}),update:([y,v])=>m(y,v),modify:([y,v])=>m(y,v)})},uT=(e,t,n)=>{const r=n.length;if(!_e(t))return wn();const s=t[0],o=t.slice(1),i=Eu(e,r,N(),0,s,n),a=Ye(i);return o.forEach(c=>{a.push(Eu(e,r,i.value,i.consumed,c,i.rest))}),Ut(a,c=>[c.quantile,c.value])},Eu=(e,t,n,r,s,o)=>{let i=e,a=t,c=n,u=r,f=s,h=o,p=e,m=t,y=n,v=r,S=s,w=o;for(;;){if(!_e(h))return{quantile:f,value:N(),consumed:u,rest:[]};if(f===1)return{quantile:f,value:I($l(h)),consumed:u+h.length,rest:[]};const F=Ce(h),T=Rg(h,$=>$===F),O=f*a,E=i/2*O,x=u+T[0].length,q=Math.abs(x-O);if(x<O-E){p=i,m=a,y=fr(h),v=x,S=f,w=T[1],i=p,a=m,c=y,u=v,f=S,h=w;continue}if(x>O+E){const $=te(c)?I(F):c;return{quantile:f,value:$,consumed:u,rest:h}}switch(c._tag){case"None":{p=i,m=a,y=fr(h),v=x,S=f,w=T[1],i=p,a=m,c=y,u=v,f=S,h=w;continue}case"Some":{const $=Math.abs(O-c.value);if(q<$){p=i,m=a,y=fr(h),v=x,S=f,w=T[1],i=p,a=m,c=y,u=v,f=S,h=w;continue}return{quantile:f,value:I(c.value),consumed:u,rest:h}}}}throw new Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")},lT="effect/MetricPair",fT=Symbol.for(lT),dT={_Type:e=>e},hT=(e,t)=>({[fT]:dT,metricKey:e,metricState:t,pipe(){return R(this,arguments)}}),pT="effect/MetricRegistry",$u=Symbol.for(pT);class mT{[$u]=$u;map=Ow();snapshot(){const t=[];for(const[n,r]of this.map)t.push(hT(n,r.get()));return t}get(t){const n=g(this.map,Mt(t),ot);if(n==null){if($h(t.keyType))return this.getCounter(t);if($v(t.keyType))return this.getGauge(t);if(Ev(t.keyType))return this.getFrequency(t);if(Ih(t.keyType))return this.getHistogram(t);if(Iv(t.keyType))return this.getSummary(t);throw new Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return n}getCounter(t){let n=g(this.map,Mt(t),ot);if(n==null){const r=sT(t);g(this.map,tr(t))||g(this.map,nr(t,r)),n=r}return n}getFrequency(t){let n=g(this.map,Mt(t),ot);if(n==null){const r=oT(t);g(this.map,tr(t))||g(this.map,nr(t,r)),n=r}return n}getGauge(t){let n=g(this.map,Mt(t),ot);if(n==null){const r=iT(t,t.keyType.bigint?BigInt(0):0);g(this.map,tr(t))||g(this.map,nr(t,r)),n=r}return n}getHistogram(t){let n=g(this.map,Mt(t),ot);if(n==null){const r=aT(t);g(this.map,tr(t))||g(this.map,nr(t,r)),n=r}return n}getSummary(t){let n=g(this.map,Mt(t),ot);if(n==null){const r=cT(t);g(this.map,tr(t))||g(this.map,nr(t,r)),n=r}return n}}const gT=()=>new mT,yT="effect/Metric",bT=Symbol.for(yT),_T={_Type:e=>e,_In:e=>e,_Out:e=>e},Iu=B(Symbol.for("effect/Metric/globalMetricRegistry"),()=>gT()),Ph=function(e,t,n,r){const s=Object.assign(o=>P0(o,i=>xT(s,i)),{[bT]:_T,keyType:e,unsafeUpdate:t,unsafeValue:n,unsafeModify:r,register(){return this.unsafeValue([]),this},pipe(){return R(this,arguments)}});return s},$o=(e,t)=>Lh(Av(e,t)),Lh=e=>{let t;const n=new WeakMap,r=s=>{if(s.length===0)return t!==void 0||(t=Iu.get(e)),t;let o=n.get(s);return o!==void 0||(o=Iu.get(Pv(e,s)),n.set(s,o)),o};return Ph(e.keyType,(s,o)=>r(o).update(s),s=>r(s).get(),(s,o)=>r(o).modify(s))},ST=(e,t,n)=>Lh(Fv(e,t,n)),wT=d(3,(e,t,n)=>kT(e,[Zk(t,n)])),kT=d(2,(e,t)=>Ph(e.keyType,(n,r)=>e.unsafeUpdate(n,cs(t,r)),n=>e.unsafeValue(cs(t,n)),(n,r)=>e.unsafeModify(n,cs(t,r)))),xT=d(2,(e,t)=>Ya(Ci,n=>j(()=>e.unsafeUpdate(t,n))));({...la});const vT=d(2,(e,t)=>Ya(kh,n=>j(()=>{if(n.has(e)){const r=n.get(e);r.state.completed||(r.state.completed=!0,qd(r.result,t))}}))),TT="effect/Supervisor",Io=Symbol.for(TT),mc={_T:e=>e};class Ro{underlying;value0;[Io]=mc;constructor(t,n){this.underlying=t,this.value0=n}get value(){return this.value0}onStart(t,n,r,s){this.underlying.onStart(t,n,r,s)}onEnd(t,n){this.underlying.onEnd(t,n)}onEffect(t,n){this.underlying.onEffect(t,n)}onSuspend(t){this.underlying.onSuspend(t)}onResume(t){this.underlying.onResume(t)}map(t){return new Ro(this,g(this.value,Ae(t)))}zip(t){return new Co(this,t)}}class Co{left;right;_tag="Zip";[Io]=mc;constructor(t,n){this.left=t,this.right=n}get value(){return $d(this.left.value,this.right.value)}onStart(t,n,r,s){this.left.onStart(t,n,r,s),this.right.onStart(t,n,r,s)}onEnd(t,n){this.left.onEnd(t,n),this.right.onEnd(t,n)}onEffect(t,n){this.left.onEffect(t,n),this.right.onEffect(t,n)}onSuspend(t){this.left.onSuspend(t),this.right.onSuspend(t)}onResume(t){this.left.onResume(t),this.right.onResume(t)}map(t){return new Ro(this,g(this.value,Ae(t)))}zip(t){return new Co(this,t)}}const Dh=e=>A(e,Io)&&sl(e,"Zip");class OT{effect;[Io]=mc;constructor(t){this.effect=t}get value(){return this.effect}onStart(t,n,r,s){}onEnd(t,n){}onEffect(t,n){}onSuspend(t){}onResume(t){}map(t){return new Ro(this,g(this.value,Ae(t)))}zip(t){return new Co(this,t)}onRun(t,n){return t()}}const NT=e=>new OT(e),jo=B("effect/Supervisor/none",()=>NT(tt)),ET=qn,Kh="Empty",Uh="AddSupervisor",qh="RemoveSupervisor",Bh="AndThen",hr={_tag:Kh},ps=(e,t)=>({_tag:Bh,first:e,second:t}),$T=(e,t)=>IT(t,De(e)),IT=(e,t)=>{let n=e,r=t;for(;Tn(r);){const s=On(r);switch(s._tag){case Kh:{r=Ft(r);break}case Uh:{n=n.zip(s.supervisor),r=Ft(r);break}case qh:{n=Yi(n,s.supervisor),r=Ft(r);break}case Bh:{r=Ze(s.first)(Ze(s.second)(Ft(r)));break}}}return n},Yi=(e,t)=>D(e,t)?jo:Dh(e)?Yi(e.left,t).zip(Yi(e.right,t)):e,Bs=e=>D(e,jo)?Gt():Dh(e)?g(Bs(e.left),yr(Bs(e.right))):Ma(e),RT=(e,t)=>{if(D(e,t))return hr;const n=Bs(e),r=Bs(t),s=g(r,Bc(n),$s(hr,(i,a)=>ps(i,{_tag:Uh,supervisor:a}))),o=g(n,Bc(r),$s(hr,(i,a)=>ps(i,{_tag:qh,supervisor:a})));return ps(s,o)},CT=ET({empty:hr,patch:$T,combine:ps,diff:RT}),jT=$o("effect_fiber_started",{incremental:!0}),Ru=$o("effect_fiber_active"),MT=$o("effect_fiber_successes",{incremental:!0}),AT=$o("effect_fiber_failures",{incremental:!0}),FT=wT(ST("effect_fiber_lifetimes",gv({start:.5,factor:2,count:35})),"time_unit","milliseconds"),rr="Continue",PT="Done",Cu="Yield",LT={_E:e=>e,_A:e=>e},Zr=e=>{throw new Error(`BUG: FiberRuntime - ${bn(e)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},mt=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),gt=B("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),sr={[Ss]:(e,t,n)=>Re(()=>t.effect_instruction_i1(n)),OnStep:(e,t,n)=>ie(ie(n)),[ws]:(e,t,n)=>Re(()=>t.effect_instruction_i2(n)),[ca]:(e,t,n)=>(e.patchRuntimeFlags(e.currentRuntimeFlags,t.patch),Ot(e.currentRuntimeFlags)&&e.isInterrupted()?X(e.getInterruptedCause()):ie(n)),[ks]:(e,t,n)=>(Re(()=>t.effect_instruction_i2(n)),Re(()=>t.effect_instruction_i0())?(e.pushStack(t),Re(()=>t.effect_instruction_i1())):tt),[os]:(e,t,n)=>{for(;;){const r=Re(()=>t.effect_instruction_i0.next(n));if(r.done)return ie(r.value);const s=Em(r.value);if(Oo(s)){if(s._tag==="Failure")return s}else return e.pushStack(t),s;n=s.value}}},DT={[cc]:(e,t,n,r)=>(e.processNewInterruptSignal(r.cause),Ot(t)?X(r.cause):n),[lc]:(e,t,n,r)=>{throw new Error("It is illegal to have multiple concurrent run loops in a single fiber")},[uc]:(e,t,n,r)=>(r.onFiber(e,lh(t)),n),[fc]:(e,t,n,r)=>C(Wa(),()=>n)},KT=e=>_o(US(e),t=>Vt(t0(t),([n,r])=>{const s=new Map,o=[];for(const a of r){o.push(Bt(a));for(const c of a)s.set(c.request,c)}const i=o.flat();return xo(eO(n.runAll(o),i,()=>i.forEach(a=>{a.listeners.interrupted=!0})),kh,s)},!1,!1)),UT=ua();class Jh extends Wk{[tv]=nv;[sv]=LT;_fiberRefs;_fiberId;_queue=new Array;_children=null;_observers=new Array;_running=!1;_stack=[];_asyncInterruptor=null;_asyncBlockingOn=null;_exitValue=null;_steps=[];_isYielding=!1;currentRuntimeFlags;currentOpCount=0;currentSupervisor;currentScheduler;currentTracer;currentSpan;currentContext;currentDefaultServices;constructor(t,n,r){if(super(),this.currentRuntimeFlags=r,this._fiberId=t,this._fiberRefs=n,Wc(r)){const s=this.getFiberRef(Ci);jT.unsafeUpdate(1,s),Ru.unsafeUpdate(1,s)}this.refreshRefCache()}commit(){return xh(this)}id(){return this._fiberId}resume(t){this.tell(fn(t))}get status(){return this.ask((t,n)=>n)}get runtimeFlags(){return this.ask((t,n)=>_x(n)?t.currentRuntimeFlags:n.runtimeFlags)}scope(){return Zx(this)}get children(){return this.ask(t=>Array.from(t.getChildren()))}getChildren(){return this._children===null&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(Qr)}fiberRefs(){return this.ask(t=>t.getFiberRefs())}ask(t){return ce(()=>{const n=yw(this._fiberId);return this.tell(hs((r,s)=>{qd(n,j(()=>t(r,s)))})),Ud(n)})}tell(t){this._queue.push(t),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return Xt(t=>{const n=r=>t(Q(r));return this.tell(hs((r,s)=>{r._exitValue!==null?n(this._exitValue):r.addObserver(n)})),j(()=>this.tell(hs((r,s)=>{r.removeObserver(n)})))},this.id())}get inheritAll(){return Ke((t,n)=>{const r=t.id(),s=t.getFiberRefs(),o=n.runtimeFlags,i=this.getFiberRefs(),a=Nk(s,r,i);t.setFiberRefs(a);const c=t.getFiberRef(Pu),u=g(fs(o,c),Yc(Bn),Yc($i));return D0(u)})}get poll(){return j(()=>Zs(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(t){return j(()=>this.tell(Qo(Nt(t))))}unsafeInterruptAsFork(t){this.tell(Qo(Nt(t)))}addObserver(t){this._exitValue!==null?t(this._exitValue):this._observers.push(t)}removeObserver(t){this._observers=this._observers.filter(n=>n!==t)}getFiberRefs(){return this.setFiberRef(Pu,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(t){this._fiberRefs=th(this._fiberRefs,t)}getFiberRef(t){return this._fiberRefs.locals.has(t)?this._fiberRefs.locals.get(t)[0][1]:t.initial}setFiberRef(t,n){this._fiberRefs=Mi(this._fiberRefs,{fiberId:this._fiberId,fiberRef:t,value:n}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(Ps),this.currentTracer=this.currentDefaultServices.unsafeMap.get(Xd.key),this.currentSupervisor=this.getFiberRef(ZT),this.currentScheduler=this.getFiberRef(wh),this.currentContext=this.getFiberRef(Ur),this.currentSpan=this.currentContext.unsafeMap.get(Zd.key)}setFiberRefs(t){this._fiberRefs=t,this.refreshRefCache()}addChild(t){this.getChildren().add(t)}removeChild(t){this.getChildren().delete(t)}transferChildren(t){const n=this._children;if(this._children=null,n!==null&&n.size>0)for(const r of n)r._exitValue===null&&t.add(this.currentRuntimeFlags,r)}drainQueueOnCurrentThread(){let t=!0;for(;t;){let n=rr;const r=globalThis[jt];globalThis[jt]=this;try{for(;n===rr;)n=this._queue.length===0?PT:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[jt]=r}this._queue.length>0&&!this._running?(this._running=!0,n===Cu?(this.drainQueueLaterOnExecutor(),t=!1):t=!0):t=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(vo))}drainQueueWhileRunning(t,n){let r=n;for(;this._queue.length>0;){const s=this._queue.splice(0,1)[0];r=DT[s._tag](this,t,r,s)}return r}isInterrupted(){return!i0(this.getFiberRef(Qr))}addInterruptedCause(t){const n=this.getFiberRef(Qr);this.setFiberRef(Qr,ze(n,t))}processNewInterruptSignal(t){this.addInterruptedCause(t),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let t=!1;for(const n of this._children)n.tell(Qo(Nt(this.id()))),t=!0;return t}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){const t=this._children.values();this._children=null;let n=!1;return Ha({while:()=>!n,body:()=>{const s=t.next();return s.done?j(()=>{n=!0}):Kr(s.value.await)},step:()=>{}})}return null}reportExitValue(t){if(Wc(this.currentRuntimeFlags)){const n=this.getFiberRef(Ci),r=this.id().startTimeMillis,s=Date.now();switch(FT.unsafeUpdate(s-r,n),Ru.unsafeUpdate(-1,n),t._tag){case We:{MT.unsafeUpdate(1,n);break}case He:{AT.unsafeUpdate(1,n);break}}}if(t._tag==="Failure"){const n=this.getFiberRef(ow);!Ka(t.cause)&&n._tag==="Some"&&this.log("Fiber terminated with an unhandled error",t.cause,n)}}setExitValue(t){this._exitValue=t,this.reportExitValue(t);for(let n=this._observers.length-1;n>=0;n--)this._observers[n](t);this._observers=[]}getLoggers(){return this.getFiberRef(zT)}log(t,n,r){const s=ke(r)?r.value:this.getFiberRef(ew),o=this.getFiberRef(qT);if(Bk(o,s))return;const i=this.getFiberRef(tw),a=this.getFiberRef(Z0),c=this.getLoggers(),u=this.getFiberRefs();if(Kf(c)>0){const f=yf(this.getFiberRef(Ps),ec),h=new Date(f.unsafeCurrentTimeMillis());Am(u,()=>{for(const p of c)p.log({fiberId:this.id(),logLevel:s,message:t,cause:n,context:u,spans:i,annotations:a,date:h})})}}evaluateMessageWhileSuspended(t){switch(t._tag){case fc:return Cu;case cc:return this.processNewInterruptSignal(t.cause),this._asyncInterruptor!==null&&(this._asyncInterruptor(X(t.cause)),this._asyncInterruptor=null),rr;case lc:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(t.effect),rr;case uc:return t.onFiber(this,this._exitValue!==null?yx:bx(this.currentRuntimeFlags,this._asyncBlockingOn)),rr;default:return Zr(t)}}evaluateEffect(t){this.currentSupervisor.onResume(this);try{let n=Ot(this.currentRuntimeFlags)&&this.isInterrupted()?X(this.getInterruptedCause()):t;for(;n!==null;){const r=n,s=this.runLoop(r);if(s===mt){const o=gt.currentOp;gt.currentOp=null,o._op===is?FS(this.currentRuntimeFlags)?(this.tell(Gx()),this.tell(fn(Pt)),n=null):n=Pt:o._op===lr&&(n=null)}else{this.currentRuntimeFlags=g(this.currentRuntimeFlags,PS($i));const o=this.interruptAllChildren();o!==null?n=C(o,()=>s):(this._queue.length===0?this.setExitValue(s):this.tell(fn(s)),n=null)}}}finally{this.currentSupervisor.onSuspend(this)}}start(t){if(this._running)this.tell(fn(t));else{this._running=!0;const n=globalThis[jt];globalThis[jt]=this;try{this.evaluateEffect(t)}finally{this._running=!1,globalThis[jt]=n,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(t){this.tell(fn(t))}patchRuntimeFlags(t,n){const r=ds(t,n);return globalThis[jt]=this,this.currentRuntimeFlags=r,r}initiateAsync(t,n){let r=!1;const s=o=>{r||(r=!0,this.tell(fn(o)))};Ot(t)&&(this._asyncInterruptor=s);try{n(s)}catch(o){s(et(ct(o)))}}pushStack(t){this._stack.push(t),t._op==="OnStep"&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){const t=this._stack.pop();if(t)return t._op==="OnStep"&&this._steps.pop(),t}getNextSuccessCont(){let t=this.popStack();for(;t;){if(t._op!==Ko)return t;t=this.popStack()}}getNextFailCont(){let t=this.popStack();for(;t;){if(t._op!==Ss&&t._op!==ks&&t._op!==os)return t;t=this.popStack()}}[Pm](t){return j(()=>bf(this.currentContext,t))}Left(t){return Ie(t.left)}None(t){return Ie(new Ld)}Right(t){return ie(t.right)}Some(t){return ie(t.value)}Micro(t){return Ms(n=>{let r=n;const s=Hx(Kx(t,this.currentContext));return s.addObserver(o=>{if(o._tag==="Success")return r(ie(o.value));switch(o.cause._tag){case"Interrupt":return r(X(Nt($n)));case"Fail":return r(Ie(o.cause.error));case"Die":return r(tu(o.cause.defect))}}),Ms(o=>{r=i=>{o(tt)},s.unsafeInterrupt()})})}[dl](t){const n=Re(()=>t.effect_instruction_i0()),r=this.getNextSuccessCont();return r!==void 0?(r._op in sr||Zr(r),sr[r._op](this,r,n)):(gt.currentOp=ie(n),mt)}[We](t){const n=t,r=this.getNextSuccessCont();return r!==void 0?(r._op in sr||Zr(r),sr[r._op](this,r,n.effect_instruction_i0)):(gt.currentOp=n,mt)}[He](t){const n=t.effect_instruction_i0,r=this.getNextFailCont();if(r!==void 0)switch(r._op){case Ko:case ws:return Ot(this.currentRuntimeFlags)&&this.isInterrupted()?X(Qc(n)):Re(()=>r.effect_instruction_i1(n));case"OnStep":return Ot(this.currentRuntimeFlags)&&this.isInterrupted()?X(Qc(n)):ie(X(n));case ca:return this.patchRuntimeFlags(this.currentRuntimeFlags,r.patch),Ot(this.currentRuntimeFlags)&&this.isInterrupted()?X(ze(n,this.getInterruptedCause())):X(n);default:Zr(r)}else return gt.currentOp=X(n),mt}[hl](t){return Re(()=>t.effect_instruction_i0(this,lh(this.currentRuntimeFlags)))}Blocked(t){const n=this.getFiberRefs(),r=this.currentRuntimeFlags;if(this._steps.length>0){const s=[],o=this._steps[this._steps.length-1];let i=this.popStack();for(;i&&i._op!=="OnStep";)s.push(i),i=this.popStack();this.setFiberRefs(o.refs),this.currentRuntimeFlags=o.flags;const a=ax(o.refs,n),c=fs(o.flags,r);return ie(_d(t.effect_instruction_i0,Ke(u=>{for(;s.length>0;)u.pushStack(s.pop());return u.setFiberRefs(cx(u.id(),u.getFiberRefs())(a)),u.currentRuntimeFlags=ds(c)(u.currentRuntimeFlags),t.effect_instruction_i1})))}return wo(s=>C(Vh(E0(t.effect_instruction_i0)),()=>s(t.effect_instruction_i1)))}RunBlocked(t){return KT(t.effect_instruction_i0)}[Nr](t){const n=t.effect_instruction_i0,r=this.currentRuntimeFlags,s=ds(r,n);if(Ot(s)&&this.isInterrupted())return X(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,n),t.effect_instruction_i1){const o=fs(s,r);return this.pushStack(new $0(o,t)),Re(()=>t.effect_instruction_i1(r))}else return Pt}[Ss](t){return this.pushStack(t),t.effect_instruction_i0}OnStep(t){return this.pushStack(t),t.effect_instruction_i0}[Ko](t){return this.pushStack(t),t.effect_instruction_i0}[ws](t){return this.pushStack(t),t.effect_instruction_i0}[lr](t){return this._asyncBlockingOn=t.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,t.effect_instruction_i0),gt.currentOp=t,mt}[is](t){return this._isYielding=!1,gt.currentOp=t,mt}[ks](t){const n=t.effect_instruction_i0,r=t.effect_instruction_i1;return n()?(this.pushStack(t),r()):Pt}[os](t){return sr[os](this,t,void 0)}[Xs](t){return Re(()=>t.commit())}runLoop(t){let n=t;for(this.currentOpCount=0;;){if((this.currentRuntimeFlags&AS)!==0&&this.currentSupervisor.onEffect(this,n),this._queue.length>0&&(n=this.drainQueueWhileRunning(this.currentRuntimeFlags,n)),!this._isYielding){this.currentOpCount+=1;const r=this.currentScheduler.shouldYield(this);if(r!==!1){this._isYielding=!0,this.currentOpCount=0;const s=n;n=C(Wa({priority:r}),()=>s)}}try{if(n=this.currentTracer.context(()=>{if(UT!==n[Fn]._V){const r=this.getFiberRef(iw);if(r._tag==="Some"){const s=n[Fn]._V;this.log(`Executing an Effect versioned ${s} with a Runtime of version ${ua()}, 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`,jn,r)}}return this[n._op](n)},this),n===mt){const r=gt.currentOp;return r._op===is||r._op===lr?mt:(gt.currentOp=null,r._op===We||r._op===He?r:X(ct(r)))}}catch(r){n!==mt&&!A(n,"_op")||!(n._op in this)?n=C0(`Not a valid effect: ${bn(n)}`):fw(r)?n=X(ze(ct(r),Nt($n))):n=tu(r)}}}run=()=>{this.drainQueueOnCurrentThread()}}const qT=B("effect/FiberRef/currentMinimumLogLevel",()=>Fe(Jk("Info"))),BT=e=>hc(t=>{const n=Rk(t.context,Ps);yf(n,Qd).unsafe.log(e.log(t))}),JT=B(Symbol.for("effect/Logger/defaultLogger"),()=>BT(fv)),VT=B(Symbol.for("effect/Logger/tracerLogger"),()=>hc(({annotations:e,cause:t,context:n,fiberId:r,logLevel:s,message:o})=>{const i=jr(wr(n,Ur),Zd);if(i._tag==="None"||i.value._tag==="ExternalSpan")return;const a=bf(wr(n,Ps),ec),c={};for(const[u,f]of e)c[u]=f;c["effect.fiberId"]=k_(r),c["effect.logLevel"]=s.label,t!==null&&t._tag!=="Empty"&&(c["effect.cause"]=zn(t,{renderErrorCause:!0})),i.value.event(bn(Array.isArray(o)&&o.length===1?o[0]:o),a.unsafeCurrentTimeNanos(),c)})),zT=B(Symbol.for("effect/FiberRef/currentLoggers"),()=>Y0(Ma(JT,VT))),HT=d(e=>ym(e[0]),(e,t,n)=>Ke(r=>{const s=n?.batching===!0||n?.batching==="inherit"&&r.getFiberRef(sw);return n?.discard?Ou(n.concurrency,()=>dn(Pi,n?.concurrentFinalizers)(o=>s?Vt(e,(i,a)=>o(t(i,a)),!0,!1,1):_o(e,(i,a)=>o(t(i,a)))),()=>dn(Li,n?.concurrentFinalizers)(o=>Vt(e,(i,a)=>o(t(i,a)),s,!1)),o=>dn(Di(o),n?.concurrentFinalizers)(i=>Vt(e,(a,c)=>i(t(a,c)),s,!1,o))):Ou(n?.concurrency,()=>dn(Pi,n?.concurrentFinalizers)(o=>s?ju(e,1,(i,a)=>o(t(i,a)),!0):$t(e,(i,a)=>o(t(i,a)))),()=>dn(Li,n?.concurrentFinalizers)(o=>WT(e,(i,a)=>o(t(i,a)),s)),o=>dn(Di(o),n?.concurrentFinalizers)(i=>ju(e,o,(a,c)=>i(t(a,c)),s)))})),WT=(e,t,n)=>ce(()=>{const r=oe(e),s=new Array(r.length);return ko(Vt(r,(i,a)=>C(t(i,a),c=>j(()=>s[a]=c)),n,!1),Q(s))}),Vt=(e,t,n,r,s)=>wo(o=>L0(i=>Ke(a=>{let c=Array.from(e).reverse(),u=c.length;if(u===0)return tt;let f=0,h=!1;const p=s?Math.min(c.length,s):c.length,m=new Set,y=new Array,v=()=>m.forEach($=>{$.currentScheduler.scheduleTask(()=>{$.unsafeInterruptAsFork(a.id())},0)}),S=new Array,w=new Array,F=new Array,T=()=>{const $=y.filter(({exit:z})=>z._tag==="Failure").sort((z,H)=>z.index<H.index?-1:z.index===H.index?0:1).map(({exit:z})=>z);return $.length===0&&$.push(Pt),$},O=($,z=!1)=>{const H=Ed(i($)),U=YT(H,a,a.currentRuntimeFlags,dc);return a.currentScheduler.scheduleTask(()=>{z&&U.unsafeInterruptAsFork(a.id()),U.resume(H)},0),U},E=()=>{r||(u-=c.length,c=[]),h=!0,v()},x=n?A0:xd,q=O(Xt($=>{const z=(U,Z)=>{U._op==="Blocked"?F.push(U):(y.push({index:Z,exit:U}),U._op==="Failure"&&!h&&E())},H=()=>{if(c.length>0){const U=c.pop();let Z=f++;const Pe=()=>{const de=c.pop();return Z=f++,C(Wa(),()=>C(x(o(t(de,Z))),Me))},Me=de=>c.length>0&&(z(de,Z),c.length>0)?Pe():Q(de),ht=C(x(o(t(U,Z))),Me),ve=O(ht);S.push(ve),m.add(ve),h&&ve.currentScheduler.scheduleTask(()=>{ve.unsafeInterruptAsFork(a.id())},0),ve.addObserver(de=>{let pt;if(de._op==="Failure"?pt=de:pt=de.effect_instruction_i0,w.push(ve),m.delete(ve),z(pt,Z),y.length===u)$(Q(be(iu(T(),{parallel:!0}),()=>Pt)));else if(F.length+y.length===u){const Gn=T(),Ip=F.map(Yn=>Yn.effect_instruction_i0).reduce(ud);$(Q(_d(Ip,Vt([be(iu(Gn,{parallel:!0}),()=>Pt),...F.map(Yn=>Yn.effect_instruction_i1)],Yn=>Yn,n,!0,s))))}else H()})}};for(let U=0;U<p;U++)H()}));return Kr(za(Td(o(xh(q))),Kd({onFailure:$=>{E();const z=F.length+1,H=Math.min(typeof s=="number"?s:F.length,F.length),U=Array.from(F);return Xt(Z=>{let Pe=0,Me=0;const ht=(de,pt)=>Gn=>{Pe++,Pe===z&&Z(ie(X($))),U.length>0&&pt&&ve()},ve=()=>{O(U.pop(),!0).addObserver(ht(Me,!0)),Me++};q.addObserver(ht(Me,!1)),Me++;for(let de=0;de<H;de++)ve()})},onSuccess:()=>$t(w,$=>$.inheritAll)})))}))),ju=(e,t,n,r)=>ce(()=>{const s=oe(e),o=new Array(s.length);return ko(Vt(s,(a,c)=>Ae(n(a,c),u=>o[c]=u),r,!1,t),Q(o))}),Vh=e=>QT(e,dc),GT=(e,t,n,r=null)=>{const s=zh(e,t,n,r);return s.resume(e),s},YT=(e,t,n,r=null)=>zh(e,t,n,r),zh=(e,t,n,r=null)=>{const s=zf(),o=t.getFiberRefs(),i=Ek(o,s),a=new Jh(s,i,n),c=wr(i,Ur),u=a.currentSupervisor;return u.onStart(c,e,I(t),a),a.addObserver(h=>u.onEnd(h,a)),(r!==null?r:g(t.getFiberRef(ji),be(()=>t.scope()))).add(n,a),a},QT=(e,t)=>Ke((n,r)=>Q(GT(e,n,r.runtimeFlags,t))),Mu=e=>qr(t=>we(jr(t,zr),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Parallel":return e;case"Sequential":case"ParallelN":return C(To(n,Li),r=>gc(e,r))}}})),Au=e=>t=>qr(n=>we(jr(n,zr),{onNone:()=>t,onSome:r=>r.strategy._tag==="ParallelN"&&r.strategy.parallelism===e?t:C(To(r,Di(e)),s=>gc(t,s))})),dn=(e,t)=>n=>qr(r=>we(jr(r,zr),{onNone:()=>n(Y),onSome:s=>{if(t===!0){const o=e._tag==="Parallel"?Mu:e._tag==="Sequential"?Fu:Au(e.parallelism);switch(s.strategy._tag){case"Parallel":return o(n(Mu));case"Sequential":return o(n(Fu));case"ParallelN":return o(n(Au(s.strategy.parallelism)))}}else return n(Y)}})),Fu=e=>qr(t=>we(jr(t,zr),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Sequential":return e;case"Parallel":case"ParallelN":return C(To(n,Pi),r=>gc(e,r))}}})),zr=an("effect/Scope"),gc=d(2,(e,t)=>kw(e,_f(sb(zr,t)))),XT=e=>Hn(e,{differ:CT,fork:hr}),Pu=X0(LS),ZT=XT(jo),eO=(e,t,n)=>vd(r=>C(C(Vh(Od(e)),s=>Xt(o=>{const i=t.map(u=>u.listeners.count),a=()=>{i.every(u=>u===0)&&t.every(u=>u.result.state.current._tag==="Pending"?!0:!!(u.result.state.current._tag==="Done"&&Oo(u.result.state.current.effect)&&u.result.state.current.effect._tag==="Failure"&&a0(u.result.state.current.effect.cause)))&&(c.forEach(u=>u()),n?.(),o(K0(s)))};s.addObserver(u=>{c.forEach(f=>f()),o(u)});const c=t.map((u,f)=>{const h=p=>{i[f]=p,a()};return u.listeners.addObserver(h),()=>u.listeners.removeObserver(h)});return a(),j(()=>{c.forEach(u=>u())})})),()=>ce(()=>{const s=t.flatMap(o=>o.state.completed?[]:[o]);return _o(s,o=>vT(o.request,pw(r)))}))),tO=o0,nO=zn,rO=cw,sO=To,Hr=e=>function(){if(arguments.length===1){const t=arguments[0];return(n,...r)=>e(t,n,...r)}return e.apply(this,arguments)},yc=Hr((e,t,n)=>{const r=zf(),s=[[Ur,[[r,e.context]]]];n?.scheduler&&s.push([wh,[[r,n.scheduler]]]);let o=Ck(e.fiberRefs,{entries:s,forkAs:r});n?.updateRefs&&(o=n.updateRefs(o,r));const i=new Jh(r,o,e.runtimeFlags);let a=t;n?.scope&&(a=C(sO(n.scope,uh),u=>ko(aw(u,vd(f=>D(f,i.id())?tt:Rd(i,f))),za(t,f=>rO(u,f)))));const c=i.currentSupervisor;return c!==jo&&(c.onStart(e.context,a,N(),i),i.addObserver(u=>c.onEnd(u,i))),dc.add(e.runtimeFlags,i),n?.immediate===!1?i.resume(a):i.start(a),i}),oO=Hr((e,t)=>{const n=uO(e)(t);if(n._tag==="Failure")throw Hh(n.effect_instruction_i0);return n.effect_instruction_i0});class iO extends Error{fiber;_tag="AsyncFiberException";constructor(t){super(`Fiber #${t.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`),this.fiber=t,this.name=this._tag,this.stack=this.message}}const aO=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=0;const n=new iO(e);return Error.stackTraceLimit=t,n},Xo=Symbol.for("effect/Runtime/FiberFailure"),es=Symbol.for("effect/Runtime/FiberFailure/Cause");class cO extends Error{[Xo];[es];constructor(t){const n=yd(t)[0];super(n?.message||"An error has occurred"),this[Xo]=Xo,this[es]=t,this.name=n?`(FiberFailure) ${n.name}`:"FiberFailure",n?.stack&&(this.stack=n.stack)}toJSON(){return{_id:"FiberFailure",cause:this[es].toJSON()}}toString(){return"(FiberFailure) "+zn(this[es],{renderErrorCause:!0})}[ee](){return this.toString()}}const Hh=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=0;const n=new cO(e);return Error.stackTraceLimit=t,n},Wh=e=>{const t=e;switch(t._op){case"Failure":case"Success":return t;case"Left":return au(t.left);case"Right":return ie(t.right);case"Some":return ie(t.value);case"None":return au(new Ld)}},uO=Hr((e,t)=>{const n=Wh(t);if(n)return n;const r=new Sh,s=yc(e)(t,{scheduler:r});r.flush();const o=s.unsafePoll();return o||hw(qa(aO(s),Xa(s)))}),lO=Hr((e,t,n)=>fO(e,t,n).then(r=>{switch(r._tag){case We:return r.effect_instruction_i0;case He:throw Hh(r.effect_instruction_i0)}})),fO=Hr((e,t,n)=>new Promise(r=>{const s=Wh(t);s&&r(s);const o=yc(e)(t);o.addObserver(i=>{r(i)}),n?.signal!==void 0&&(n.signal.aborted?o.unsafeInterruptAsFork(o.id()):n.signal.addEventListener("abort",()=>{o.unsafeInterruptAsFork(o.id())},{once:!0}))}));class dO{context;runtimeFlags;fiberRefs;constructor(t,n,r){this.context=t,this.runtimeFlags=n,this.fiberRefs=r}pipe(){return R(this,arguments)}}const hO=e=>new dO(e.context,e.runtimeFlags,e.fiberRefs),pO=ad(Bn,od,sd),bc=hO({context:va(),runtimeFlags:pO,fiberRefs:jk()}),mO=yc(bc),gO=lO(bc),yO=oO(bc),bO=(function(){const e=Symbol.for("effect/Data/Error/plainArgs");return{BaseEffectError:class extends Qa{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0),n&&(Object.assign(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}.BaseEffectError})(),_O=e=>{const t={BaseEffectError:class extends bO{_tag=e}};return t.BaseEffectError.prototype.name=e,t.BaseEffectError},SO=bo,ms=HT,wO=Q,ts=ce,qe=tt,kO=Ri,xO=tx,Qi=Ae,vO=Va,TO=So,At=As,rt=C,OO=mO,NO=gO,Gh=yO;class Te{path;actual;issue;_tag="Pointer";constructor(t,n,r){this.path=t,this.actual=n,this.issue=r}}class Lu{actual;message;_tag="Unexpected";constructor(t,n){this.actual=t,this.message=n}}class or{ast;message;_tag="Missing";actual=void 0;constructor(t,n){this.ast=t,this.message=n}}class re{ast;actual;issues;output;_tag="Composite";constructor(t,n,r,s){this.ast=t,this.actual=n,this.issues=r,this.output=s}}class Zo{ast;actual;kind;issue;_tag="Refinement";constructor(t,n,r,s){this.ast=t,this.actual=n,this.kind=r,this.issue=s}}class ei{ast;actual;kind;issue;_tag="Transformation";constructor(t,n,r,s){this.ast=t,this.actual=n,this.kind=r,this.issue=s}}class Et{ast;actual;message;_tag="Type";constructor(t,n,r){this.ast=t,this.actual=n,this.message=r}}class Du{ast;actual;message;_tag="Forbidden";constructor(t,n,r){this.ast=t,this.actual=n,this.message=r}}const Ku=Symbol.for("effect/Schema/ParseErrorTypeId");class EO extends _O("ParseError"){[Ku]=Ku;get message(){return this.toString()}toString(){return gs.formatIssueSync(this.issue)}toJSON(){return{_id:"ParseError",message:this.toString()}}[ee](){return this.toJSON()}}const $O=e=>new EO({issue:e}),Yh=V,Qh=P,$e=eg,It=d(2,(e,t)=>$e(e)?pa(e,{onLeft:P,onRight:t}):rt(e,t)),st=d(2,(e,t)=>$e(e)?rg(e,t):Qi(e,t)),ti=d(2,(e,t)=>$e(e)?ng(e,t):TO(e,t)),IO=d(2,(e,t)=>$e(e)?tg(e,{onLeft:t.onFailure,onRight:t.onSuccess}):vO(e,t)),Xh=d(2,(e,t)=>$e(e)?pa(e,{onLeft:t,onRight:V}):kO(e,t)),_c=(e,t)=>t===void 0||zt(t)?e:e===void 0?t:{...e,...t},RO=(e,t,n)=>{const r=Se(e,t);return(s,o)=>r(s,_c(n,o))},Zh=(e,t,n)=>{const r=RO(e,t,n);return(s,o)=>kl(r(s,o),$O)},ep=(e,t,n)=>{const r=Se(e,t);return(s,o)=>r(s,{..._c(n,o),isEffectAllowed:!0})},tp=(e,t)=>Zh(e.ast,!0,t),CO=(e,t)=>ep(e.ast,!0,t),jO=(e,t)=>ep(e.ast,!1,t),MO=(e,t)=>Zh(pe(e.ast),!0,t),AO=B(Symbol.for("effect/ParseResult/decodeMemoMap"),()=>new WeakMap),FO=B(Symbol.for("effect/ParseResult/encodeMemoMap"),()=>new WeakMap),Se=(e,t)=>{const n=t?AO:FO,r=n.get(e);if(r)return r;const s=PO(e,t),o=ry(e),i=ke(o)?(u,f)=>s(u,_c(f,o.value)):s,a=sy(e),c=t&&ke(a)?(u,f)=>ur(Xh(i(u,f),a.value),e,u,f):i;return n.set(e,c),c},ni=e=>ot(ey(e)),ri=e=>ot(ty(e)),PO=(e,t)=>{switch(e._tag){case"Refinement":if(t){const n=Se(e.from,!0);return(r,s)=>{s=s??qo;const o=s?.errors==="all",i=It(Xh(n(r,s),a=>{const c=new Zo(e,r,"From",a);return o&&iy(e)&&op(a)?we(e.filter(r,s,e),{onNone:()=>P(c),onSome:u=>P(new re(e,r,[c,new Zo(e,r,"Predicate",u)]))}):P(c)}),a=>we(e.filter(a,s,e),{onNone:()=>V(a),onSome:c=>P(new Zo(e,r,"Predicate",c))}));return ur(i,e,r,s)}}else{const n=Se(pe(e),!0),r=Se(np(e.from),!1);return(s,o)=>ur(It(n(s,o),i=>r(i,o)),e,s,o)}case"Transformation":{const n=KO(e.transformation,t),r=t?Se(e.from,!0):Se(e.to,!1),s=t?Se(e.to,!0):Se(e.from,!1);return(o,i)=>ur(It(ti(r(o,i),a=>new ei(e,o,t?"Encoded":"Type",a)),a=>It(ti(n(a,i??qo,e,o),c=>new ei(e,o,"Transformation",c)),c=>ti(s(c,i),u=>new ei(e,o,t?"Type":"Encoded",u)))),e,o,i)}case"Declaration":{const n=t?e.decodeUnknown(...e.typeParameters):e.encodeUnknown(...e.typeParameters);return(r,s)=>ur(n(r,s??qo,e),e,r,s)}case"Literal":return Le(e,n=>n===e.literal);case"UniqueSymbol":return Le(e,n=>n===e.symbol);case"UndefinedKeyword":return Le(e,dm);case"NeverKeyword":return Le(e,pm);case"UnknownKeyword":case"AnyKeyword":case"VoidKeyword":return V;case"StringKeyword":return Le(e,lt);case"NumberKeyword":return Le(e,zt);case"BooleanKeyword":return Le(e,na);case"BigIntKeyword":return Le(e,Gs);case"SymbolKeyword":return Le(e,li);case"ObjectKeyword":return Le(e,kt);case"Enums":return Le(e,n=>e.enums.some(([r,s])=>s===n));case"TemplateLiteral":{const n=Ly(e);return Le(e,r=>lt(r)&&n.test(r))}case"TupleType":{const n=e.elements.map(u=>Se(u.type,t)),r=e.rest.map(u=>Se(u.type,t));let s=e.elements.filter(u=>!u.isOptional);e.rest.length>0&&(s=s.concat(e.rest.slice(1)));const o=s.length,i=e.elements.length>0?e.elements.map((u,f)=>f).join(" | "):"never",a=ni(e),c=ri(e);return(u,f)=>{if(!vg(u))return P(new Et(e,u));const h=f?.errors==="all",p=[];let m=0;const y=[],v=u.length;for(let T=v;T<=o-1;T++){const O=new Te(T,u,new or(s[T-v]));if(h){p.push([m++,O]);continue}else return P(new re(e,u,O,y))}if(e.rest.length===0)for(let T=e.elements.length;T<=v-1;T++){const O=new Te(T,u,new Lu(u[T],`is unexpected, expected: ${i}`));if(h){p.push([m++,O]);continue}else return P(new re(e,u,O,y))}let S=0,w;for(;S<n.length;S++)if(v<S+1){if(e.elements[S].isOptional)continue}else{const T=n[S],O=T(u[S],f);if($e(O)){if(he(O)){const E=new Te(S,u,O.left);if(h){p.push([m++,E]);continue}else return P(new re(e,u,E,Ge(y)))}y.push([m++,O.right])}else{const E=m++,x=S;w||(w=[]),w.push(({es:q,output:$})=>rt(At(O),z=>{if(he(z)){const H=new Te(x,u,z.left);return h?(q.push([E,H]),qe):P(new re(e,u,H,Ge($)))}return $.push([E,z.right]),qe}))}}if(_e(r)){const[T,...O]=r;for(;S<v-O.length;S++){const E=T(u[S],f);if($e(E))if(he(E)){const x=new Te(S,u,E.left);if(h){p.push([m++,x]);continue}else return P(new re(e,u,x,Ge(y)))}else y.push([m++,E.right]);else{const x=m++,q=S;w||(w=[]),w.push(({es:$,output:z})=>rt(At(E),H=>{if(he(H)){const U=new Te(q,u,H.left);return h?($.push([x,U]),qe):P(new re(e,u,U,Ge(z)))}else return z.push([x,H.right]),qe}))}}for(let E=0;E<O.length;E++)if(S+=E,!(v<S+1)){const x=O[E](u[S],f);if($e(x)){if(he(x)){const q=new Te(S,u,x.left);if(h){p.push([m++,q]);continue}else return P(new re(e,u,q,Ge(y)))}y.push([m++,x.right])}else{const q=m++,$=S;w||(w=[]),w.push(({es:z,output:H})=>rt(At(x),U=>{if(he(U)){const Z=new Te($,u,U.left);return h?(z.push([q,Z]),qe):P(new re(e,u,Z,Ge(H)))}return H.push([q,U.right]),qe}))}}}const F=({es:T,output:O})=>as(T)?P(new re(e,u,Ge(T),Ge(O))):V(Ge(O));if(w&&w.length>0){const T=w;return ts(()=>{const O={es:ar(p),output:ar(y)};return rt(ms(T,E=>E(O),{concurrency:a,batching:c,discard:!0}),()=>F(O))})}return F({output:y,es:p})}}case"TypeLiteral":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return Le(e,mm);const n=[],r={},s=[];for(const f of e.propertySignatures)n.push([Se(f.type,t),f]),r[f.name]=null,s.push(f.name);const o=e.indexSignatures.map(f=>[Se(f.parameter,t),Se(f.type,t),f.parameter]),i=it.make(e.indexSignatures.map(f=>f.parameter).concat(s.map(f=>li(f)?new ly(f):new Os(f)))),a=Se(i,t),c=ni(e),u=ri(e);return(f,h)=>{if(!bm(f))return P(new Et(e,f));const p=h?.errors==="all",m=[];let y=0;const v=h?.onExcessProperty==="error",S=h?.onExcessProperty==="preserve",w={};let F;if(v||S){F=Reflect.ownKeys(f);for(const x of F){const q=a(x,h);if($e(q)&&he(q))if(v){const $=new Te(x,f,new Lu(f[x],`is unexpected, expected: ${String(i)}`));if(p){m.push([y++,$]);continue}else return P(new re(e,f,$,w))}else w[x]=f[x]}}let T;const O=h?.exact===!0;for(let x=0;x<n.length;x++){const q=n[x][1],$=q.name,z=Object.prototype.hasOwnProperty.call(f,$);if(!z){if(q.isOptional)continue;if(O){const Z=new Te($,f,new or(q));if(p){m.push([y++,Z]);continue}else return P(new re(e,f,Z,w))}}const H=n[x][0],U=H(f[$],h);if($e(U)){if(he(U)){const Z=new Te($,f,z?U.left:new or(q));if(p){m.push([y++,Z]);continue}else return P(new re(e,f,Z,w))}w[$]=U.right}else{const Z=y++,Pe=$;T||(T=[]),T.push(({es:Me,output:ht})=>rt(At(U),ve=>{if(he(ve)){const de=new Te(Pe,f,z?ve.left:new or(q));return p?(Me.push([Z,de]),qe):P(new re(e,f,de,ht))}return ht[Pe]=ve.right,qe}))}}for(let x=0;x<o.length;x++){const q=o[x],$=q[0],z=q[1],H=jl(f,q[2]);for(const U of H){const Z=$(U,h);if($e(Z)&&yt(Z)){const Pe=z(f[U],h);if($e(Pe))if(he(Pe)){const Me=new Te(U,f,Pe.left);if(p){m.push([y++,Me]);continue}else return P(new re(e,f,Me,w))}else Object.prototype.hasOwnProperty.call(r,U)||(w[U]=Pe.right);else{const Me=y++,ht=U;T||(T=[]),T.push(({es:ve,output:de})=>rt(At(Pe),pt=>{if(he(pt)){const Gn=new Te(ht,f,pt.left);return p?(ve.push([Me,Gn]),qe):P(new re(e,f,Gn,de))}else return Object.prototype.hasOwnProperty.call(r,U)||(de[U]=pt.right),qe}))}}}}const E=({es:x,output:q})=>{if(as(x))return P(new re(e,f,Ge(x),q));if(h?.propertyOrder==="original"){const $=F||Reflect.ownKeys(f);for(const H of s)$.indexOf(H)===-1&&$.push(H);const z={};for(const H of $)Object.prototype.hasOwnProperty.call(q,H)&&(z[H]=q[H]);return V(z)}return V(q)};if(T&&T.length>0){const x=T;return ts(()=>{const q={es:ar(m),output:Object.assign({},w)};return rt(ms(x,$=>$(q),{concurrency:c,batching:u,discard:!0}),()=>E(q))})}return E({es:m,output:w})}}case"Union":{const n=LO(e.types,t),r=Reflect.ownKeys(n.keys),s=r.length,o=e.types.length,i=new Map;for(let u=0;u<o;u++)i.set(e.types[u],Se(e.types[u],t));const a=ni(e)??1,c=ri(e);return(u,f)=>{const h=[];let p=0,m=[];if(s>0)if(ra(u))for(let S=0;S<s;S++){const w=r[S],F=n.keys[w].buckets;if(Object.prototype.hasOwnProperty.call(u,w)){const T=String(u[w]);if(Object.prototype.hasOwnProperty.call(F,T))m=m.concat(F[T]);else{const{candidates:O,literals:E}=n.keys[w],x=it.make(E),q=O.length===o?new qt([new Oe(w,x,!1,!0)],[]):it.make(O);h.push([p++,new re(q,u,new Te(w,u,new Et(x,u[w])))])}}else{const{candidates:T,literals:O}=n.keys[w],E=new Oe(w,it.make(O),!1,!0),x=T.length===o?new qt([E],[]):it.make(T);h.push([p++,new re(x,u,new Te(w,u,new or(E)))])}}else{const S=n.candidates.length===o?e:it.make(n.candidates);h.push([p++,new Et(S,u)])}n.otherwise.length>0&&(m=m.concat(n.otherwise));let y;for(let S=0;S<m.length;S++){const w=m[S],F=i.get(w)(u,f);if($e(F)&&(!y||y.length===0)){if(yt(F))return F;h.push([p++,F.left])}else{const T=p++;y||(y=[]),y.push(O=>ts(()=>"finalResult"in O?qe:rt(At(F),E=>(yt(E)?O.finalResult=E:O.es.push([T,E.left]),qe))))}}const v=S=>as(S)?S.length===1&&S[0][1]._tag==="Type"?P(S[0][1]):P(new re(e,u,Ge(S))):P(new Et(e,u));if(y&&y.length>0){const S=y;return ts(()=>{const w={es:ar(h)};return rt(ms(S,F=>F(w),{concurrency:a,batching:c,discard:!0}),()=>"finalResult"in w?w.finalResult:v(w.es))})}return v(h)}}case"Suspend":{const n=Ml(()=>Se(e.f(),t));return(r,s)=>n()(r,s)}}},Le=(e,t)=>n=>t(n)?V(n):P(new Et(e,n)),cr=(e,t)=>{switch(e._tag){case"Declaration":{const n=Xl(e);if(ke(n))return cr(n.value,t);break}case"TypeLiteral":{const n=[];for(let r=0;r<e.propertySignatures.length;r++){const s=e.propertySignatures[r],o=t?Pc(s.type):pe(s.type);Mc(o)&&!s.isOptional&&n.push([s.name,o])}return n}case"TupleType":{const n=[];for(let r=0;r<e.elements.length;r++){const s=e.elements[r],o=t?Pc(s.type):pe(s.type);Mc(o)&&!s.isOptional&&n.push([r,o])}return n}case"Refinement":return cr(e.from,t);case"Suspend":return cr(e.f(),t);case"Transformation":return cr(t?e.from:e.to,t)}return[]},LO=(e,t)=>{const n={},r=[],s=[];for(let o=0;o<e.length;o++){const i=e[o],a=cr(i,t);if(a.length>0){s.push(i);for(let c=0;c<a.length;c++){const[u,f]=a[c],h=String(f.literal);n[u]=n[u]||{buckets:{},literals:[],candidates:[]};const p=n[u].buckets;if(Object.prototype.hasOwnProperty.call(p,h)){if(c<a.length-1)continue;p[h].push(i),n[u].literals.push(f),n[u].candidates.push(i)}else{p[h]=[i],n[u].literals.push(f),n[u].candidates.push(i);break}}}else r.push(i)}return{keys:n,otherwise:r,candidates:s}},np=e=>wa(e)?np(e.from):e,ur=(e,t,n,r)=>{if(r?.isEffectAllowed===!0||$e(e))return e;const s=new Sh,o=OO(e,{scheduler:s});s.flush();const i=o.unsafePoll();if(i){if(xw(i))return V(i.value);const a=i.cause;return tO(a)?P(a.error):P(new Du(t,n,nO(a)))}return P(new Du(t,n,"cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work"))},DO=([e],[t])=>e>t?1:e<t?-1:0;function Ge(e){return e.sort(DO).map(t=>t[1])}const KO=(e,t)=>{switch(e._tag){case"FinalTransformation":return t?e.decode:e.encode;case"ComposeTransformation":return V;case"TypeLiteralTransformation":return n=>{let r=V(n);for(const s of e.propertySignatureTransformations){const[o,i]=t?[s.from,s.to]:[s.to,s.from],a=t?s.decode:s.encode;r=st(r,u=>{const f=a(Object.prototype.hasOwnProperty.call(u,o)?I(u[o]):N());return delete u[o],ke(f)&&(u[i]=f.value),u})}return r}}},Ee=(e,t=[])=>({value:e,forest:t}),gs={formatIssue:e=>st(hn(e),UO),formatIssueSync:e=>{const t=gs.formatIssue(e);return $e(t)?og(t):Gh(t)},formatError:e=>gs.formatIssue(e.issue),formatErrorSync:e=>gs.formatIssueSync(e.issue)},UO=e=>e.value+rp(`
|
|
28
|
-
`,e.forest),rp=(e,t)=>{let n="";const r=t.length;let s;for(let o=0;o<r;o++){s=t[o];const i=o===r-1;n+=e+(i?"└":"├")+"─ "+s.value,n+=rp(e+(r>1&&!i?"│ ":" "),s.forest)}return n},qO=e=>{switch(e){case"Encoded":return"Encoded side transformation failure";case"Transformation":return"Transformation process failure";case"Type":return"Type side transformation failure"}},BO=e=>{switch(e){case"From":return"From side refinement failure";case"Predicate":return"Predicate refinement failure"}},sp=e=>"ast"in e?I(e.ast):N(),Xi=V(void 0),JO=e=>sp(e).pipe(Kn(Xg),we({onNone:()=>Xi,onSome:t=>{const n=t(e);return lt(n)?V({message:n,override:!1}):SO(n)?Qi(n,r=>({message:r,override:!1})):lt(n.message)?V({message:n.message,override:n.override}):Qi(n.message,r=>({message:r,override:n.override}))}})),Sc=e=>t=>t._tag===e,op=Sc("Composite"),Uu=Sc("Refinement"),qu=Sc("Transformation"),pr=e=>It(JO(e),t=>t!==void 0?!t.override&&(op(e)||Uu(e)&&e.kind==="From"||qu(e)&&e.kind!=="Transformation")?qu(e)||Uu(e)?pr(e.issue):Xi:V(t.message):Xi),ip=e=>sp(e).pipe(Kn(ny),dg(t=>t(e)),ot);function VO(e){return Ql(e).pipe(bt(()=>Gl(e)),bt(()=>Yl(e)),bt(()=>to(e)),be(()=>`{ ${e.from} | filter }`))}function zO(e){return e.message!==void 0?e.message:`Expected ${wa(e.ast)?VO(e.ast):String(e.ast)}, actual ${tn(e.actual)}`}const HO=e=>st(pr(e),t=>t??ip(e)??zO(e)),ns=e=>ip(e)??String(e.ast),WO=e=>e.message??"is forbidden",GO=e=>e.message??"is unexpected",YO=e=>{const t=Zg(e.ast);if(ke(t)){const n=t.value();return lt(n)?V(n):n}return V(e.message??"is missing")},hn=e=>{switch(e._tag){case"Type":return st(HO(e),Ee);case"Forbidden":return V(Ee(ns(e),[Ee(WO(e))]));case"Unexpected":return V(Ee(GO(e)));case"Missing":return st(YO(e),Ee);case"Transformation":return It(pr(e),t=>t!==void 0?V(Ee(t)):st(hn(e.issue),n=>Ee(ns(e),[Ee(qO(e.kind),[n])])));case"Refinement":return It(pr(e),t=>t!==void 0?V(Ee(t)):st(hn(e.issue),n=>Ee(ns(e),[Ee(BO(e.kind),[n])])));case"Pointer":return st(hn(e.issue),t=>Ee(Kg(e.path),[t]));case"Composite":return It(pr(e),t=>{if(t!==void 0)return V(Ee(t));const n=ns(e);return Al(e.issues)?st(ms(e.issues,hn),r=>Ee(n,r)):st(hn(e.issues),r=>Ee(n,[r]))})}},QO=d(e=>kt(e[0]),(e,...t)=>{const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}),XO=d(e=>kt(e[0]),(e,...t)=>{const n={...e};for(const r of t)delete n[r];return n}),kr=Symbol.for("effect/Schema");function Ne(e){return class{[kr]=Bu;static ast=e;static annotations(n){return Ne(un(this.ast,n))}static pipe(){return R(this,arguments)}static toString(){return String(e)}static Type;static Encoded;static Context;static[kr]=Bu}}const Bu={_A:e=>e,_I:e=>e,_R:e=>e},Ju={typeConstructor:zg,schemaId:Wg,message:Fl,missingMessage:ya,identifier:ba,title:xt,description:Rr,examples:Pl,default:Ll,documentation:Gg,jsonSchema:Dl,arbitrary:Kl,pretty:Ul,equivalence:ql,concurrency:Bl,batching:Jl,parseIssueTitle:Vl,parseOptions:zl,decodingFallback:Hl},Wr=e=>{if(!e)return{};const t={...e};for(const n in Ju)if(n in e){const r=Ju[n];t[r]=e[n],delete t[n]}return t},un=(e,t)=>ka(e,Wr(t)),vt=e=>Ne(pe(e.ast)),Zi=e=>A(e,kr)&&kt(e[kr]);function ZO(e){return Sa(e)?it.make(Iy(e,t=>new Os(t))):new Os(e[0])}function ap(e,t=ZO(e)){return class extends Ne(t){static annotations(r){return ap(this.literals,un(this.ast,r))}static literals=[...e]}}function Ue(...e){return _e(e)?ap(e):lp}const eN=(e,t,n)=>wc(e,new no(e.map(r=>r.ast),(...r)=>t.decode(...r.map(Ne)),(...r)=>t.encode(...r.map(Ne)),Wr(n))),tN=(e,t)=>{const n=()=>(s,o,i)=>e(s)?Yh(s):Qh(new Et(i,s)),r=n;return wc([],new no([],n,r,Wr(t)))};function wc(e,t){return class extends Ne(t){static annotations(r){return wc(this.typeParameters,un(this.ast,r))}static typeParameters=[...e]}}const nN=function(){if(Array.isArray(arguments[0])){const n=arguments[0],r=arguments[1],s=arguments[2];return eN(n,r,s)}const e=arguments[0],t=arguments[1];return tN(e,t)};class cp extends Ne(dy){}class up extends Ne(uy){}class lp extends Ne(ef){}class fp extends Ne(tf){}class b extends Ne(by){}class ut extends Ne(wy){}class Dn extends Ne(xy){}const rN=e=>it.make(e.map(t=>t.ast));function dp(e,t=rN(e)){return class extends Ne(t){static annotations(r){return dp(this.members,un(this.ast,r))}static members=[...e]}}function kc(...e){return Sa(e)?dp(e):_e(e)?e[0]:lp}const M=e=>kc(e,up),rs=e=>kc(e,cp),si=e=>kc(e,up,cp),sN=(e,t)=>new _a(e.map(n=>Zi(n)?new sn(n.ast,!1):n.ast),t.map(n=>Zi(n)?new ro(n.ast):n.ast),!0);function hp(e,t,n=sN(e,t)){return class extends Ne(n){static annotations(s){return hp(this.elements,this.rest,un(this.ast,s))}static elements=[...e];static rest=[...t]}}function pp(e,t){return class extends hp([],[e],t){static annotations(r){return pp(this.value,un(this.ast,r))}static value=e}}const G=e=>pp(e),ea=e=>e?'"?:"':'":"';class Js extends sn{isReadonly;defaultValue;_tag="PropertySignatureDeclaration";constructor(t,n,r,s,o){super(t,n,s),this.isReadonly=r,this.defaultValue=o}toString(){const t=ea(this.isOptional),n=String(this.type);return`PropertySignature<${t}, ${n}, never, ${t}, ${n}>`}}class mp extends sn{isReadonly;fromKey;constructor(t,n,r,s,o){super(t,n,s),this.isReadonly=r,this.fromKey=o}}class Mo extends sn{isReadonly;defaultValue;constructor(t,n,r,s,o){super(t,n,s),this.isReadonly=r,this.defaultValue=o}}const oN=e=>e===void 0?"never":lt(e)?JSON.stringify(e):String(e);class Ao{from;to;decode;encode;_tag="PropertySignatureTransformation";constructor(t,n,r,s){this.from=t,this.to=n,this.decode=r,this.encode=s}toString(){return`PropertySignature<${ea(this.to.isOptional)}, ${this.to.type}, ${oN(this.from.fromKey)}, ${ea(this.from.isOptional)}, ${this.from.type}>`}}const gp=(e,t)=>{switch(e._tag){case"PropertySignatureDeclaration":return new Js(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case"PropertySignatureTransformation":return new Ao(e.from,new Mo(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},yp=Symbol.for("effect/PropertySignature"),bp=e=>A(e,yp);class Fo{ast;[kr];[yp]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(t){this.ast=t}pipe(){return R(this,arguments)}annotations(t){return new Fo(gp(this.ast,Wr(t)))}toString(){return String(this.ast)}}const Vs=e=>new Fo(e);class xc extends Fo{from;constructor(t,n){super(t),this.from=n}annotations(t){return new xc(gp(this.ast,Wr(t)),this.from)}}const ss=d(2,(e,t)=>{const n=e.ast;switch(n._tag){case"PropertySignatureDeclaration":return Vs(new Js(n.type,n.isOptional,n.isReadonly,n.annotations,t));case"PropertySignatureTransformation":return Vs(new Ao(n.from,new Mo(n.to.type,n.to.isOptional,n.to.isReadonly,n.to.annotations,t),n.decode,n.encode))}}),Tt=(e,t,n)=>Vs(new Ao(new mp(e.ast,!0,!0,{},void 0),new Mo(t.ast,!1,!0,{},void 0),r=>I(n.decode(r)),Kn(n.encode))),Vu=(e,t,n)=>Vs(new Ao(new mp(e.ast,!0,!0,{},void 0),new Mo(t.ast,!0,!0,{},void 0),n.decode,n.encode)),iN=(e,t)=>{const n=t?.exact,r=t?.default,s=t?.nullable,o=t?.as=="Option",i=t?.onNoneEncoding?bt(t.onNoneEncoding):Y;if(n){if(r)return s?ss(Tt(M(e),vt(e),{decode:we({onNone:r,onSome:a=>a===null?r():a}),encode:I}),r).ast:ss(Tt(e,vt(e),{decode:we({onNone:r,onSome:Y}),encode:I}),r).ast;if(o){const a=Hu(vt(e));return s?Tt(M(e),a,{decode:Xn(Po),encode:i}).ast:Tt(e,a,{decode:Y,encode:Y}).ast}else return s?Vu(M(e),vt(e),{decode:Xn(Po),encode:Y}).ast:new Js(e.ast,!0,!0,{},void 0)}else{if(r)return s?ss(Tt(si(e),vt(e),{decode:we({onNone:r,onSome:a=>a??r()}),encode:I}),r).ast:ss(Tt(rs(e),vt(e),{decode:we({onNone:r,onSome:a=>a===void 0?r():a}),encode:I}),r).ast;if(o){const a=Hu(vt(e));return s?Tt(si(e),a,{decode:Xn(c=>c!=null),encode:i}).ast:Tt(rs(e),a,{decode:Xn(hm),encode:i}).ast}else return s?Vu(si(e),rs(vt(e)),{decode:Xn(Po),encode:Y}).ast:new Js(rs(e).ast,!0,!0,{},void 0)}},_=d(e=>Zi(e[0]),(e,t)=>new xc(iN(e,t),e)),aN=lf([ya]),cN=(e,t)=>{const n=Reflect.ownKeys(e),r=[];if(n.length>0){const o=[],i=[],a=[];for(let c=0;c<n.length;c++){const u=n[c],f=e[u];if(bp(f)){const h=f.ast;switch(h._tag){case"PropertySignatureDeclaration":{const p=h.type,m=h.isOptional,y=h.annotations;o.push(new Oe(u,p,m,!0,aN(h))),i.push(new Oe(u,pe(p),m,!0,y)),r.push(new Oe(u,p,m,!0,y));break}case"PropertySignatureTransformation":{const p=h.from.fromKey??u;o.push(new Oe(p,h.from.type,h.from.isOptional,!0,h.from.annotations)),i.push(new Oe(u,h.to.type,h.to.isOptional,!0,h.to.annotations)),a.push(new jy(p,u,h.decode,h.encode));break}}}else o.push(new Oe(u,f.ast,!1,!0)),i.push(new Oe(u,pe(f.ast),!1,!0)),r.push(new Oe(u,f.ast,!1,!0))}if(_e(a)){const c=[],u=[];for(const f of t){const{indexSignatures:h,propertySignatures:p}=Fc(f.key.ast,f.value.ast);p.forEach(m=>{o.push(m),i.push(new Oe(m.name,pe(m.type),m.isOptional,m.isReadonly,m.annotations))}),h.forEach(m=>{c.push(m),u.push(new so(m.parameter,pe(m.type),m.isReadonly))})}return new Cy(new qt(o,c,{[di]:"Struct (Encoded side)"}),new qt(i,u,{[di]:"Struct (Type side)"}),new My(a))}}const s=[];for(const o of t){const{indexSignatures:i,propertySignatures:a}=Fc(o.key.ast,o.value.ast);a.forEach(c=>r.push(c)),i.forEach(c=>s.push(c))}return new qt(r,s)},uN=(e,t)=>{const n=Reflect.ownKeys(e);for(const r of n){const s=e[r];if(t[r]===void 0&&bp(s)){const o=s.ast,i=o._tag==="PropertySignatureDeclaration"?o.defaultValue:o.to.defaultValue;i!==void 0&&(t[r]=i())}}return t};function _p(e,t,n=cN(e,t)){return class extends Ne(n){static annotations(s){return _p(this.fields,this.records,un(this.ast,s))}static fields={...e};static records=[...t];static make=(s,o)=>{const i=uN(e,{...s});return pN(o)?i:MO(this)(i)};static pick(...s){return W(QO(e,...s))}static omit(...s){return W(XO(e,...s))}}}function W(e,...t){return _p(e,t)}const lN=(e,t,n,r)=>IO(e,{onFailure:s=>new re(n,r,s),onSuccess:t}),fN=e=>e._tag==="None"?N():I(e.value),dN=(e,t)=>n=>n.oneof(t,n.record({_tag:n.constant("None")}),n.record({_tag:n.constant("Some"),value:e(n)})).map(fN),hN=e=>we({onNone:()=>"none()",onSome:t=>`some(${e(t)})`}),zu=e=>(t,n,r)=>ug(t)?te(t)?Yh(N()):lN(e(t.value,n),I,r,t):Qh(new Et(r,t)),Hu=e=>nN([e],{decode:t=>zu(CO(t)),encode:t=>zu(jO(t))},{typeConstructor:{_tag:"effect/Option"},pretty:hN,arbitrary:dN,equivalence:pg});function pN(e){return na(e)?e:e?.disableValidation??!1}const mN="/data/todos.json",gN="https://raggle.co/schemas/tasks.json",yN=Ue("task","bug","feature","chore","spike","epic","milestone"),bN=Ue("todo","in_progress","blocked","review","done","canceled"),_N=Ue("completed","duplicate","wont_do","not_reproducible","moved"),SN=Ue("blocks","blocked_by","related_to","duplicates","duplicated_by","parent_of","child_of"),Sp=Ue("github","linear","jira","web"),wN=Ue("issue","pull_request","commit","repository","project","document","design","discussion","external"),kN=Ue("references","implemented_by","fixes","reported_by","spec","design","review","deployment","blocked_by"),xN=W({id:b,title:b}),vN=W({id:b,text:b,done:Dn}),TN=W({id:b,text:b,done:_(Dn,{default:()=>!1})}),ON=W({points:_(M(ut),{default:()=>null}),minutes:_(M(ut),{default:()=>null}),confidence:_(M(Ue("low","medium","high")),{default:()=>null})}),NN=W({type:SN,targetTaskId:b,description:_(M(b),{default:()=>null})}),EN=W({state:_(M(b),{default:()=>null}),draft:_(M(Dn),{default:()=>null}),checks:_(M(b),{default:()=>null}),updatedAt:_(M(b),{default:()=>null})}),$N=W({mode:_(Ue("manual","read","write"),{default:()=>"manual"}),checkedAt:_(M(b),{default:()=>null})}),IN=W({id:b,provider:Sp,kind:wN,relation:kN,url:b,repository:_(M(b),{default:()=>null}),number:_(M(ut),{default:()=>null}),title:_(M(b),{default:()=>null}),snapshot:_(M(EN),{default:()=>null}),sync:_(M($N),{default:()=>null})}),RN=W({id:b,authorId:_(M(b),{default:()=>null}),body:b,createdAt:b}),CN=W({id:b,title:b,outcome:b,decidedAt:_(M(b),{default:()=>null})}),jN=W({id:b,value:fp}),MN=W({id:b,title:b,total:ut,open:ut}),AN=W({id:_(b,{default:()=>""}),key:_(b,{default:()=>""}),index:_(ut,{default:()=>0}),rank:_(b,{default:()=>""}),name:b,description:_(M(b),{default:()=>""}),type:_(yN,{default:()=>"task"}),status:_(bN,{default:()=>"todo"}),resolution:_(M(_N),{default:()=>null}),done:_(Dn,{default:()=>!1}),priority:_(M(ut),{default:()=>5}),deadline:_(M(b),{default:()=>null}),overdue:_(Dn,{default:()=>!1}),reporterId:_(M(b),{default:()=>null}),assigneeIds:_(G(b),{default:()=>[]}),estimate:_(M(ON),{default:()=>null}),projectIds:_(G(b),{default:()=>[]}),cycleId:_(M(b),{default:()=>null}),milestoneIds:_(G(b),{default:()=>[]}),componentIds:_(G(b),{default:()=>[]}),areaIds:_(G(b),{default:()=>[]}),parentId:_(M(b),{default:()=>null}),relations:_(G(NN),{default:()=>[]}),links:_(G(IN),{default:()=>[]}),notes:_(G(b),{default:()=>[]}),acceptanceCriteria:_(G(TN),{default:()=>[]}),steps:_(G(vN),{default:()=>[]}),comments:_(G(RN),{default:()=>[]}),decisions:_(G(CN),{default:()=>[]}),createdAt:_(M(b),{default:()=>null}),updatedAt:_(M(b),{default:()=>null}),startedAt:_(M(b),{default:()=>null}),completedAt:_(M(b),{default:()=>null}),canceledAt:_(M(b),{default:()=>null}),tags:_(G(b),{default:()=>[]}),customFields:_(G(jN),{default:()=>[]}),reminder:_(fp,{default:()=>null}),source:_(xN,{default:()=>({id:"todos",title:"Todos"})})}),FN=W({id:b,name:b,email:_(M(b),{default:()=>null}),url:_(M(b),{default:()=>null})}),PN=W({id:b,name:b,description:_(M(b),{default:()=>null})}),LN=W({id:b,name:b,startsAt:_(M(b),{default:()=>null}),endsAt:_(M(b),{default:()=>null})}),DN=W({id:b,name:b}),KN=W({id:b,name:b,dueAt:_(M(b),{default:()=>null})}),UN=W({id:b,name:b,ownerId:_(M(b),{default:()=>null})}),qN=W({id:b,provider:Sp,name:b,repository:_(M(b),{default:()=>null}),baseUrl:_(M(b),{default:()=>null}),syncMode:_(Ue("manual","read","write"),{default:()=>"manual"})}),BN=W({id:b,name:b,type:Ue("text","number","date","select","multi_select","boolean","url"),options:_(G(b),{default:()=>[]})}),JN=W({id:b,name:b,trigger:Ue("status_changed","link_changed","deadline_overdue","task_created","task_updated"),enabled:_(Dn,{default:()=>!0}),description:_(M(b),{default:()=>null})}),wp=W({$schema:b,version:Ue(1,2),project:W({name:b}),sources:G(MN),people:_(G(FN),{default:()=>[]}),projects:_(G(PN),{default:()=>[]}),cycles:_(G(LN),{default:()=>[]}),milestones:_(G(KN),{default:()=>[]}),components:_(G(UN),{default:()=>[]}),areas:_(G(DN),{default:()=>[]}),integrations:_(G(qN),{default:()=>[]}),customFields:_(G(BN),{default:()=>[]}),automations:_(G(JN),{default:()=>[]}),tasks:G(AN),summary:W({open:ut,completed:ut,sources:ut})}),VN=nn(ig,e=>!e.overdue),zN=nn(vl,e=>e.priority),HN=nn(ma,e=>e.jsonTodo.rank||"9999"),WN=nn(ma,e=>e.dueDate??"9999"),GN=nn(ma,e=>e.title.toLowerCase()),Wu={dataset:null,selectedSource:"*",filter:"open",tag:[],assignee:[],query:""},YN=e=>tp(wp)(e),QN=(e={})=>xO({try:async()=>{const t=XN(e),n=await fetch(t);if(!n.ok)throw new Error(`Could not load ${t}.`);const r=await n.json(),s=tp(wp)(r);iE(s);const o=e.schemaUrl??s.$schema??gN,i=await fetch(o);if(!i.ok)throw new Error(`Could not load todo schema at ${o}.`);const a=await i.json();if(a.$id&&rE(o)&&a.$id!==o)throw new Error(`Todo schema id mismatch: expected ${o}, got ${a.$id}.`);return s},catch:t=>t instanceof Error?t:new Error(String(t))}),XN=e=>{const t=new URL(e.dataUrl??mN,window.location.origin);return e.path&&t.searchParams.set("path",e.path),`${t.pathname}${t.search}`},ZN=e=>wO(g(kp(e.dataset),Zn(t=>e.selectedSource==="*"||t.jsonTodo.source.id===e.selectedSource),Zn(t=>e.filter==="all"?!0:e.filter==="overdue"?t.overdue&&t.status!=="done":t.status===e.filter),Zn(t=>e.tag.length?t.tags.some(n=>e.tag.includes(n)):!0),Zn(t=>e.assignee.length?t.jsonTodo.assigneeIds.some(n=>e.assignee.includes(n)):!0),Zn(t=>{const n=e.query.trim().toLowerCase();return n?[t.key,t.title,t.description,t.source,t.type,t.status,...t.tags,...(t.steps??[]).map(r=>r.text),...(t.acceptanceCriteria??[]).map(r=>r.text),...(t.links??[]).flatMap(r=>[r.title,r.url,r.repository].filter(Boolean)),...t.notes??[]].filter(Boolean).join(" ").toLowerCase().includes(n):!0}),Sn(ag(VN,[zN,HN,WN,GN])))),eE=e=>{const t=e?.tasks??[],n=s=>t.some(o=>o.assigneeIds.includes(s)),r=new Map;for(const s of e?.people??[])n(s.id)&&r.set(s.id,s.name);for(const s of t)for(const o of s.assigneeIds)r.has(o)||r.set(o,o);return[...r].map(([s,o])=>({id:s,name:o})).sort((s,o)=>s.name.localeCompare(o.name))},vc=e=>kp(e),tE=e=>{const t=Gu(e)?"done":nE(e)?"blocked":"open";return{id:e.id,key:e.key||e.id,title:e.name,description:e.description??void 0,type:e.type,steps:[...e.steps??[]],acceptanceCriteria:[...e.acceptanceCriteria??[]],links:[...e.links??[]],notes:[...e.notes??[]],relations:[...e.relations??[]],status:t,priority:sE(e.priority),dueDate:e.deadline??void 0,source:e.source.id,tags:[...e.tags],jsonTodo:e,overdue:!Gu(e)&&(e.overdue||oE(e.deadline))}},kp=e=>g(e?.tasks??[],Ut(tE)),Gu=e=>e.status==="done",nE=e=>e.status==="blocked"||e.relations.some(t=>t.type==="blocked_by"),rE=e=>/^https?:\/\//i.test(e),sE=e=>e===1||e===2||e===3||e===4||e===5?e:5,oE=e=>{if(!e)return!1;const t=new Date(`${e}T12:00:00`);if(Number.isNaN(t.valueOf()))return!1;const n=new Date;return n.setHours(0,0,0,0),t.setHours(0,0,0,0),t<n},iE=e=>{const t=[];for(const n of e.tasks)for(const r of n.links){const s=aE(r);s&&t.push(`${n.key||n.id} ${r.id}: ${s}`)}if(t.length)throw new Error(`Invalid todo links:
|
|
29
|
-
${t.map(n=>`- ${n}`).join(`
|
|
30
|
-
`)}`)},aE=e=>{let t;try{t=new URL(e.url)}catch{return"url is not a valid absolute URL"}const n=t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1";return t.username||t.password?"url must not contain embedded credentials":t.protocol!=="https:"&&!(t.protocol==="http:"&&n)?"url must use https, except localhost development links":e.provider==="github"&&t.hostname!=="github.com"?"github links must use github.com":e.provider==="linear"&&t.hostname!=="linear.app"&&!t.hostname.endsWith(".linear.app")?"linear links must use linear.app":e.provider==="jira"&&!t.hostname.endsWith(".atlassian.net")&&t.hostname!=="jira.atlassian.com"?"jira links must use an Atlassian Jira host":null};function oi({title:e,error:t,context:n,copyLabel:r="Copy error context",action:s}){const[o,i]=ge.useState(!1),a=t.length>200||t.includes(`
|
|
31
|
-
`);return l.jsxs("div",{className:"rounded-md border border-[#9c3a3a]/40 p-4",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsx("p",{className:"m-0 text-sm font-semibold text-[#9c3a3a]",children:e}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s,l.jsx(zs,{className:"text-[#9c3a3a] hover:text-[#6f2020]",context:n??t,label:r})]})]}),l.jsx("p",{className:`m-0 mt-1 text-[13px] text-[#9c3a3a] ${o||!a?"break-words whitespace-pre-wrap":"line-clamp-2"}`,children:t}),a?l.jsxs(xr,{className:"mt-1 -ml-2 text-[#9c3a3a] hover:text-[#6f2020]",onClick:()=>i(c=>!c),size:"sm",type:"button",variant:"ghost",children:[o?"Show less":"Show more",l.jsx(me.ChevronDown,{className:`size-3.5 transition-transform ${o?"rotate-180":""}`})]}):null]})}const ii=(e,t)=>["The Kennel Tasks view for this folder failed. Use the context below to","diagnose the cause, fix the data, then re-check the Tasks tab.","",`Folder: ${e}`,"","What failed:","The viewer decodes the merged tasks dataset against a strict schema","(https://raggle.co/schemas/tasks.json). todo.json passed file-level","validation, but at least one field violates the schema, so the decode","threw and the view renders nothing until that field is fixed.","","How to read the failure tree:",'- Bracketed keys are a JSON path into todo.json: ["tasks"] -> [7] ->',' ["resolution"] means tasks[7].resolution in the source file. The'," number is the task's position in the tasks array (tasks from linked"," folders come after the local file's). Leaves list every accepted",' value, and "Expected X, actual Y" shows what the field holds now.',"","Common causes:","- An enum field holds free text. resolution accepts only completed,"," duplicate, wont_do, not_reproducible, moved, or null; status and"," type are enums too. Move the sentence into a comments entry"," (id + body + createdAt) or into description, then set the field to",' an allowed value (finished work uses resolution: "completed").',"- A required field is missing. Each comments entry needs id, body,"," and createdAt (ISO date-time). Each task needs name.","- Shape mismatches: null where a string is required (or the reverse),"," dates not in YYYY-MM-DD, timestamps not ISO.","","How to fix and verify:","1. Edit todo.json in the folder above. Fix the exact field named in"," the failure tree; do not delete the task.","2. Confirm the fix by re-opening the Tasks tab, or decode the same"," payload the viewer uses:",` curl -fsS "<kennel-url>/api/plugins/tasks?path=${encodeURIComponent(e)}"`," then run decodeTodoDataset from @raggle-ai/tasks/todo-model on the"," returned .dataset value. Success = no throw.","3. A healthy Tasks tab shows no red error panel and open/completed"," counts that match todo.json.","","Failure:",t].join(`
|
|
32
|
-
`),cE=e=>e instanceof Error&&e.message?e.message:void 0;function uE({issues:e}){return l.jsx(sm,{file:"todo.json",issues:e})}function lE({status:e,retry:t}){return e==="pending"?l.jsx("p",{role:"status",children:"Loading linked tasks… Local tasks remain available."}):e==="error"?l.jsxs("p",{role:"alert",children:["Linked tasks could not load."," ",l.jsx("button",{onClick:t,children:"Retry linked tasks"})]}):null}function fE(e){let t,n;if(e?.status==="available"&&e?.dataset)try{t=YN(e.dataset)}catch(r){n=r instanceof Error&&r.message?r.message:"Could not parse the task file."}return{dataset:t,decodeError:n}}async function dE(e,t){const n=await fetch("/api/tasks/toggle",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,id:t})});if(!n.ok){let s="Could not update task.";try{const o=await n.json();o.error?.message&&(s=o.error.message)}catch{}throw new Error(s)}return(await n.json()).done??!1}function hE(e,t){const n=ci.useQueryClient();return ci.useMutation({mutationFn:r=>dE(e,r),onError:r=>{jp.error(r instanceof Error?r.message:"Could not update task.")},onSuccess:()=>{n.invalidateQueries({queryKey:["folder",t,"tasks"]})}})}function xp({folder:e,folderId:t,request:n,subpath:r,noun:s}){const o=ge.useRef(!1),i=ci.useQuery({enabled:!!e,gcTime:5*6e4,queryFn:({signal:p})=>{const m=o.current?{"x-kennel-retry-linked":"1"}:void 0;return o.current=!1,n(r,{signal:p,headers:m})},queryKey:["folder",t,"tasks",r],staleTime:15e3,refetchInterval:p=>p.state.data?.linkedStatus==="pending"?1e3:!1}),a=i.data,{dataset:c,decodeError:u}=ge.useMemo(()=>fE(a),[a]),f=ge.useMemo(()=>vc(c??null),[c]),h=hE(e,t);return{noun:s,folder:e,query:{...i,retryLinked:()=>{o.current=!0,i.refetch()}},data:a,dataset:c,decodeError:u,tasks:f,item:f[0]??null,toggle:p=>h.mutate(p),busy:h.isPending}}function pE(e,t){return l.jsx(xr,{className:"h-7 px-2 text-[13px] text-[#9c3a3a] hover:text-[#6f2020]",onClick:()=>{e.query.refetch()},size:"sm",type:"button",variant:"ghost",children:t})}function mE(e,t){const{data:n,decodeError:r,query:s}=e;if(s.error)return l.jsx(oi,{action:pE(e,`Retry ${e.noun}`),context:()=>ii(e.folder,t),error:t,title:`Could not load ${e.noun}.`});if(n?.status==="error"){if(n.issues?.length)return l.jsx(uE,{issues:n.issues});const o=n.message??"todo.json could not be validated.";return l.jsx(oi,{context:()=>ii(e.folder,o),error:o,title:"todo.json could not be validated."})}if(r)return l.jsx(oi,{context:()=>ii(e.folder,r??""),error:r,title:"Task data is not valid."})}function gE(e,t,n){const{data:r,decodeError:s,item:o,query:i}=e;if(!r||i.isPending||i.error)return;const a=r.status==="available",c=r.status==="error";if(a&&!c&&!o&&r.linkedStatus!=="pending"&&!s&&n)return n;if(!a&&!c)return t??`No ${e.noun} in this folder.`}function vp({page:e,list:t,header:n,extra:r,unavailableMessage:s,missingMessage:o,body:i}){const{data:a,dataset:c,decodeError:u,query:f}=e,h=cE(f.error)??`Could not load ${e.noun}.`,p=a?.status==="available",m=l.jsxs(l.Fragment,{children:[l.jsx(lE,{retry:f.retryLinked,status:a?.linkedStatus}),n]}),y=mE(e,h),v=gE(e,s,o),S=p&&c&&!u?i:null;return t?l.jsx(im,{error:y,extra:r,header:m,listHref:t.href,listName:t.name,loading:f.isPending,missing:v,noun:e.noun,children:S}):l.jsx(am,{empty:v,error:y,extra:r,header:m,loading:f.isPending,noun:e.noun,children:S})}const yE={1:"border-red-300 bg-red-100 text-red-800",2:"border-orange-300 bg-orange-100 text-orange-800",3:"border-amber-300 bg-amber-100 text-amber-800",4:"border-sky-300 bg-sky-100 text-sky-800",5:"border-slate-300 bg-slate-100 text-slate-700"},bE={open:"Open",blocked:"Blocked",done:"Done"};function _E({item:e,canToggle:t=!0,onToggle:n,documentHref:r}){const s=e.status==="done",o=e.status==="blocked",i=!!(e.overdue&&!s),a=e.description&&!e.steps?.length?SE(e.description):null,c=e.description&&a?.kind!=="steps"?e.description:void 0,u=e.dueDate?new Date(`${e.dueDate}T12:00:00`):null,f=u&&!Number.isNaN(u.valueOf())?new Intl.DateTimeFormat(void 0,{day:"numeric",month:"short"}).format(u):e.dueDate,h=Tp(e,f);return l.jsxs("article",{className:`min-w-0 overflow-hidden rounded-lg border border-slate-200
|
|
33
|
-
bg-white shadow-sm`,children:[l.jsxs("header",{className:["border-b px-4 py-4 sm:px-5",i?"border-red-200 bg-red-50/80":o?"border-violet-200 bg-violet-50/60":"border-slate-100 bg-slate-50/70"].join(" "),children:[l.jsxs("div",{className:`flex min-w-0 flex-wrap items-start justify-between gap-3
|
|
34
|
-
sm:flex-nowrap`,children:[l.jsxs("div",{className:"min-w-0",children:[e.key?l.jsx("p",{className:"m-0 pb-1 font-mono text-xs text-slate-500",children:e.key}):null,l.jsx("h2",{className:["m-0 text-lg leading-tight font-semibold text-slate-950",s?"text-slate-400 line-through":""].join(" "),children:e.title}),c?l.jsx("p",{className:`mt-1.5 mb-0 max-w-3xl text-sm leading-6
|
|
35
|
-
whitespace-pre-wrap text-slate-600`,children:c}):null]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[l.jsxs(xr,{type:"button",className:s?"":`border-emerald-500 bg-emerald-500 text-white
|
|
36
|
-
hover:bg-emerald-600`,size:"sm",variant:s?"outline":"default",disabled:!t,onClick:()=>n(e.id),children:[o?l.jsx(me.CirclePause,{className:"h-3.5 w-3.5"}):"✓",s?"Reopen":o?"Complete anyway":"Complete"]}),l.jsx(zs,{className:"text-slate-500 hover:text-slate-900",context:h,label:`Copy full context for ${e.title}`})]})]}),l.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1.5 text-xs",children:[e.type?l.jsx(ir,{variant:"secondary",className:"font-normal capitalize",children:e.type}):null,l.jsxs(ir,{variant:"outline",className:yE[e.priority],children:["P",e.priority]}),f?l.jsxs(ir,{variant:"outline",className:[i?"border-red-300 bg-red-100 font-medium text-red-800":"border-amber-200 bg-amber-50 text-amber-700"].join(" "),children:["Due ",f]}):null,e.source?l.jsx("span",{className:"text-slate-400",title:`${e.source}/todo.json`,children:e.source.split("/").pop()}):null,e.tags.map(p=>l.jsxs(ir,{variant:"outline",className:"border-indigo-100 bg-indigo-50 text-indigo-700",children:["#",p]},p))]})]}),e.links?.length?l.jsx("div",{className:`flex flex-wrap items-center gap-1.5 border-b
|
|
37
|
-
border-slate-100 px-4 py-2.5 sm:px-5`,children:e.links.map(p=>l.jsxs("a",{className:`inline-flex items-center gap-1.5 rounded-md border
|
|
38
|
-
border-slate-200 bg-white px-2 py-1 text-xs text-slate-600
|
|
39
|
-
no-underline transition-colors hover:bg-slate-50
|
|
40
|
-
hover:text-slate-900`,href:p.url,rel:"noreferrer",target:"_blank",title:Qu(p),children:[l.jsx(xE,{link:p}),p.title??p.repository??Qu(p)]},p.id))}):null,l.jsxs("div",{className:"grid grid-cols-1 divide-y divide-slate-100",children:[e.acceptanceCriteria?.length?l.jsx(ai,{label:"Acceptance criteria",steps:e.acceptanceCriteria}):null,e.steps?.length?l.jsx(ai,{label:"Steps",steps:e.steps}):null,a?.kind==="steps"?l.jsx(ai,{label:a.intro??"Steps",steps:a.steps}):null,e.relations?.length?l.jsx(wE,{relations:e.relations}):null,e.notes?.length?l.jsx(kE,{notes:e.notes,source:e.source,documentHref:r}):null]})]})}const Yu=/^[-*]\s+\[(x|X| )\]\s+(.+)$/,SE=e=>{const t=e.split(/\r?\n/).map(s=>s.trim()).filter(Boolean),n=t.map((s,o)=>{const i=Yu.exec(s),a=i?.[1],c=i?.[2];return a&&c?{id:`description-step-${o}`,done:a.toLowerCase()==="x",text:c}:null}).filter(s=>s!=null);return n.length===0?{kind:"plain",text:e}:{kind:"steps",intro:(t.find(s=>!Yu.test(s))??"Steps").replace(/:$/,""),steps:n}};function ai({label:e,steps:t}){const n=t.filter(r=>r.done).length;return l.jsxs("section",{className:"px-4 py-3 sm:px-5",children:[l.jsxs("div",{className:"mb-2 flex items-baseline gap-2",children:[l.jsx("span",{className:`text-xs font-semibold tracking-wide text-slate-500
|
|
41
|
-
uppercase`,children:e}),l.jsxs("span",{className:"text-xs text-slate-400",children:[n," of ",t.length]})]}),l.jsx("ul",{className:"m-0 list-none grid-cols-1 space-y-1.5 pl-0",children:t.map(r=>l.jsxs("li",{className:`grid grid-cols-[1.25rem_minmax(0,1fr)] items-start gap-2
|
|
42
|
-
text-sm text-slate-600`,children:[l.jsx("span",{className:["mt-0.5 grid h-4 w-4 place-items-center rounded-full border",r.done?"border-emerald-500 bg-emerald-500 text-[10px] text-white":"border-slate-300 bg-white text-transparent"].join(" "),"aria-hidden":"true",children:"✓"}),l.jsx("span",{className:r.done?"text-slate-400 line-through":"",children:r.text})]},r.id))})]})}function wE({relations:e}){return l.jsxs("section",{className:"px-4 py-3 sm:px-5",children:[l.jsx("span",{className:"text-xs font-semibold tracking-wide text-slate-500 uppercase",children:"Related tasks"}),l.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.map((t,n)=>l.jsxs(ir,{className:"max-w-full gap-1 font-normal outline-none",variant:"outline",children:[t.type,l.jsx("span",{className:"font-mono text-[11px] text-slate-700",children:t.targetTaskId}),t.description?l.jsxs("span",{className:"truncate text-slate-400",children:["— ",t.description]}):null]},`${t.type}-${t.targetTaskId}-${n}`))})]})}function kE({notes:e,source:t,documentHref:n}){return l.jsxs("section",{className:"px-4 py-3 sm:px-5",children:[l.jsx("span",{className:"text-xs font-semibold tracking-wide text-slate-500 uppercase",children:"Notes"}),l.jsx("div",{className:"mt-2 grid gap-1.5",children:e.map(r=>{const s=/^https?:\/\//i.test(r),o=s?r:(r.split("#",1)[0]??"").trim(),i=s?r:o&&n?n(t,o):void 0;return l.jsx(Mp,{context:()=>Ap(r,t),href:i,path:s?void 0:r,title:s?r.replace(/^https?:\/\//,""):r},r)})})]})}function xE({link:e}){return e.provider==="github"&&e.kind==="pull_request"?l.jsx(me.GitPullRequest,{className:"h-3.5 w-3.5"}):e.provider==="github"&&e.kind==="commit"?l.jsx(me.GitCommitHorizontal,{className:"h-3.5 w-3.5"}):e.provider==="github"&&e.kind==="issue"?l.jsx(me.CircleDot,{className:"h-3.5 w-3.5"}):e.provider==="github"?l.jsx(me.GitBranch,{className:"h-3.5 w-3.5"}):e.kind==="document"||e.kind==="design"?l.jsx(me.FileText,{className:"h-3.5 w-3.5"}):e.kind==="discussion"?l.jsx(me.MessageSquare,{className:"h-3.5 w-3.5"}):e.provider==="web"?l.jsx(me.ExternalLink,{className:"h-3.5 w-3.5"}):l.jsx(me.Link2,{className:"h-3.5 w-3.5"})}const Qu=e=>{const t=e.provider==="web"?"external":e.provider,n=e.title??e.repository??e.url;return`${t} ${e.kind.replace(/_/g," ")}: ${n}`},Tp=(e,t)=>["You are helping complete a todo item. Use the context below to identify the next concrete action, gather or update any required evidence, and produce a concise fix plan.","","Instructions for the LLM:","- Treat the todo title as the objective.","- Use the description and steps as the authoritative task context.","- Do not mark the task complete unless every unfinished step is resolved.","- If information is missing, state the exact missing input or file needed.","- Return: 1) current status, 2) next action, 3) commands/files to inspect or update, 4) completion criteria.","","Todo context:",e.key?`- Key: ${e.key}`:null,`- Title: ${e.title}`,e.type?`- Type: ${e.type}`:null,e.description?`- Description: ${e.description}`:null,`- Status: ${bE[e.status]}`,`- Priority: P${e.priority}`,t?`- Due: ${t}`:null,`- Source JSON: ${e.source}`,e.acceptanceCriteria?.length?"":null,e.acceptanceCriteria?.length?"Acceptance criteria:":null,e.acceptanceCriteria?.length?e.acceptanceCriteria.map(n=>`- [${n.done?"x":" "}] ${n.text}`).join(`
|
|
43
|
-
`):null,e.steps?.length?"":null,e.steps?.length?"Steps:":null,e.steps?.length?e.steps.map(n=>`- [${n.done?"x":" "}] ${n.text}`).join(`
|
|
44
|
-
`):null,e.relations?.length?"":null,e.relations?.length?"Task relations:":null,e.relations?.length?e.relations.map(n=>`- ${n.type}: ${n.targetTaskId}${n.description?` - ${n.description}`:""}`).join(`
|
|
45
|
-
`):null,e.links?.length?"":null,e.links?.length?"External links:":null,e.links?.length?e.links.map(n=>`- ${n.provider}/${n.kind}/${n.relation}: ${n.title??n.repository??n.id} (${n.url})`).join(`
|
|
46
|
-
`):null,e.notes?.length?"":null,e.notes?.length?"Accompanying notes and file references:":null,e.notes?.length?e.notes.map(n=>`- ${n}`).join(`
|
|
47
|
-
`):null].filter(n=>n!=null).join(`
|
|
48
|
-
`);function Op({warnings:e,folder:t}){return e?.length?l.jsxs(Fp,{children:[l.jsx(Pp,{asChild:!0,children:l.jsxs(xr,{className:`h-7 shrink-0 gap-1.5 border-amber-300 bg-amber-50 px-2
|
|
49
|
-
text-[13px] text-amber-700 hover:bg-amber-100`,size:"sm",variant:"outline","aria-label":`${e.length} todo.json warnings; open details`,children:[l.jsx(me.TriangleAlert,{"aria-hidden":"true",className:"size-3.5"}),"Warnings (",e.length,")"]})}),l.jsxs(Lp,{children:[l.jsx(Dp,{children:l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx(Kp,{children:"todo.json warnings"}),l.jsx(Up,{children:"Advisory only — the task file is still valid and the counts are unaffected. Link notes to these tasks to clear the warnings."})]}),l.jsx(zs,{context:()=>vE(e,t),label:"Copy fix instructions for an agent",variant:"outline",className:"mt-0.5 shrink-0 text-slate-500 hover:text-slate-900"})]})}),l.jsx("ul",{className:`m-0 max-h-72 list-disc space-y-1.5 overflow-y-auto pl-5
|
|
50
|
-
text-sm text-amber-700`,children:e.map((n,r)=>l.jsxs("li",{children:[l.jsx("code",{className:"text-[13px]",children:n.path||"todo.json"}),n.path?": ":" — ",n.message]},r))})]})]}):null}const vE=(e,t)=>["You are fixing advisory warnings in a Kennel Tasks workspace.",t?`The viewed folder is: ${t}`:"Work inside the viewed folder.","","The todo.json task files are still valid — these warnings are advisory.","Fix every warning; the context below lists each one.","","Warnings:",...e.map(n=>`- ${n.path||"todo.json"}: ${n.message}`),"","Instructions for the LLM:",`- Read every todo.json under the folder: the root todo.json, plus the file
|
|
51
|
-
named before the ': ' separator in each warning path. Do not invent tasks
|
|
52
|
-
and do not change statuses, priorities, or deadlines.`,`- For "no notes; link the accompanying note file or https reference":
|
|
53
|
-
create or update one accompanying markdown note next to that todo.json,
|
|
54
|
-
then add a notes array entry to the task — a note path relative to the
|
|
55
|
-
folder that owns the todo.json (optionally with a #Section heading) or an
|
|
56
|
-
https URL.`,`- Connect things where possible: put the related file references (specs,
|
|
57
|
-
evidence, other notes, and the task key such as 'Tracked as
|
|
58
|
-
office/todo.json TODO-7') into the note's linked sections so task and
|
|
59
|
-
note point at each other, and link existing workspace notes instead of
|
|
60
|
-
creating duplicates.`,`- For "references a missing note file": point the entry at an existing
|
|
61
|
-
file, or create the referenced note when it is clearly the intended
|
|
62
|
-
companion for that task.`,`- Keep todo.json valid: notes entries must be non-empty strings holding
|
|
63
|
-
a folder-relative path (never absolute or containing '..') or an https URL.`,`- Verify afterwards: re-open the Tasks tab and confirm the Warnings
|
|
64
|
-
button is gone, or GET /api/plugins/tasks?path=<folder> and confirm the
|
|
65
|
-
warnings array is empty.`].filter(n=>n!=null).join(`
|
|
66
|
-
`);function TE({documentHref:e,folder:t,folderId:n,listHref:r,request:s,subpath:o}){const i=xp({folder:t,folderId:n,noun:"task",request:s,subpath:o});return l.jsx(vp,{body:i.item?l.jsx(_E,{item:i.item,documentHref:e,canToggle:!i.busy,onToggle:()=>{o&&i.toggle(o)}}):void 0,extra:l.jsx("div",{className:"flex justify-end",children:l.jsx(Op,{warnings:i.data?.warnings,folder:t})}),list:{href:r,name:"Tasks"},missingMessage:"Task not found.",page:i})}const OE="@";function Np(e,t){if(typeof e!="string"||!e)return;const n=typeof t.id=="string"&&t.id.trim()?t.id.trim():typeof t.key=="string"&&t.key.trim()?t.key.trim():void 0;if(n)return`${Bp(e)}${OE}${n}`}function Ep({ariaLabel:e,className:t,label:n,selected:r,onChange:s,options:o,total:i}){const[a,c]=ge.useState(!1),u=p=>r.includes(p),f=p=>s(u(p)?r.filter(m=>m!==p):[...r,p]),h=i??o.reduce((p,m)=>p+(m.count??0),0);return l.jsxs(Jp,{open:a,onOpenChange:c,children:[l.jsxs(Vp,{"aria-label":e??n,className:Dt(`flex h-8 items-center gap-1.5 rounded-md border border-slate-200
|
|
67
|
-
bg-white px-3 text-sm font-medium text-slate-900 shadow-xs
|
|
68
|
-
transition-colors outline-none hover:bg-slate-50
|
|
69
|
-
focus-visible:border-slate-400 focus-visible:ring-[3px]
|
|
70
|
-
focus-visible:ring-slate-200/60 disabled:cursor-not-allowed
|
|
71
|
-
disabled:opacity-50`,t),children:[n,r.length?l.jsx("span",{className:`rounded-full bg-slate-900 px-1.5 text-[0.75rem]
|
|
72
|
-
font-semibold text-white`,children:r.length}):null,l.jsx(me.ChevronDown,{"aria-hidden":"true",className:Dt("size-4 text-slate-400 transition-transform",a&&"rotate-180")})]}),l.jsx(zp,{children:l.jsx(Hp,{className:Dt(`z-50 max-h-72 max-w-[calc(100vw-2rem)] min-w-[12rem]
|
|
73
|
-
overflow-y-auto rounded-lg border border-slate-200 bg-white p-2
|
|
74
|
-
text-slate-950 shadow-lg`,`data-[state=open]:animate-in data-[state=closed]:animate-out
|
|
75
|
-
data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0
|
|
76
|
-
data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95
|
|
77
|
-
data-[side=bottom]:slide-in-from-top-2
|
|
78
|
-
data-[side=top]:slide-in-from-bottom-2`),align:"start",sideOffset:4,children:l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsxs("button",{"aria-pressed":r.length===0,onClick:()=>s([]),type:"button",className:Xu(r.length===0),children:["All",l.jsx("span",{className:Zu(r.length===0),children:h})]}),o.map(p=>{const m=u(p.value);return l.jsxs("button",{"aria-pressed":m,onClick:()=>f(p.value),type:"button",className:Xu(m),children:[m?l.jsx(me.Check,{"aria-hidden":"true",className:"size-3.5"}):null,p.label,typeof p.count=="number"?l.jsx("span",{className:Zu(m),children:p.count}):null]},p.value)})]})})})]})}const Xu=e=>`inline-flex items-center gap-1 rounded-full border px-2.5 py-1 text-xs
|
|
79
|
-
font-medium transition-colors focus-visible:outline-2
|
|
80
|
-
focus-visible:outline-slate-500 focus-visible:outline-offset-1 ${e?"border-slate-900 bg-slate-900 text-white":"border-slate-200 bg-white text-slate-600 hover:bg-slate-100"}`,Zu=e=>`rounded-full px-1.5 ${e?"bg-slate-700 text-slate-200":"bg-slate-100 text-slate-400"}`;function NE({dataset:e,value:t,onChange:n,className:r=""}){const s=ge.useMemo(()=>eE(e),[e]);return s.length?l.jsx(Ep,{ariaLabel:"Filter tasks by agent",className:r,label:"Agent",onChange:n,options:s.map(o=>({value:o.id,label:o.name})),selected:t}):null}function EE({ariaLabel:e,className:t,label:n,value:r,onChange:s,options:o,triggerClassName:i=""}){return l.jsxs("label",{className:["flex items-center gap-2",t].filter(Boolean).join(" "),children:[n?l.jsx("span",{className:`text-[0.78rem] font-medium tracking-wide text-slate-500
|
|
81
|
-
uppercase`,children:n}):null,l.jsxs(Wp,{value:r,onValueChange:s,children:[l.jsxs(Gp,{"aria-label":e??n,className:Dt(`flex h-8 items-center justify-between gap-2 rounded-md border
|
|
82
|
-
border-slate-200 bg-white px-3 text-sm font-medium text-slate-900
|
|
83
|
-
shadow-xs transition-[color,box-shadow] outline-none
|
|
84
|
-
hover:bg-slate-50 focus-visible:border-slate-400
|
|
85
|
-
focus-visible:ring-[3px] focus-visible:ring-slate-200/60
|
|
86
|
-
disabled:cursor-not-allowed disabled:opacity-50`,i),children:[l.jsx(Yp,{}),l.jsx(Qp,{asChild:!0,children:l.jsx(me.ChevronDownIcon,{className:"size-4 text-slate-400"})})]}),l.jsx(Xp,{children:l.jsx(Zp,{className:Dt(`z-50 max-h-(--radix-select-content-available-height) min-w-[9rem]
|
|
87
|
-
overflow-x-hidden overflow-y-auto rounded-lg border
|
|
88
|
-
border-slate-200 bg-white p-1 text-slate-950 shadow-lg`,`data-[state=open]:animate-in data-[state=closed]:animate-out
|
|
89
|
-
data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0
|
|
90
|
-
data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95
|
|
91
|
-
data-[side=bottom]:slide-in-from-top-2
|
|
92
|
-
data-[side=top]:slide-in-from-bottom-2`),position:"popper",sideOffset:4,children:l.jsx(em,{className:"w-full min-w-(--radix-select-trigger-width)",children:o.map(a=>l.jsxs(tm,{className:Dt(`relative flex w-full cursor-default items-center gap-2
|
|
93
|
-
rounded-md py-1.5 pr-8 pl-2 text-sm outline-none select-none
|
|
94
|
-
data-[highlighted]:bg-slate-100
|
|
95
|
-
data-[state=checked]:font-medium`),value:a.value,children:[l.jsx(nm,{children:a.label}),typeof a.count=="number"?l.jsx("span",{className:"ml-auto text-xs font-normal text-slate-400",children:a.count}):null,l.jsx(rm,{className:"absolute right-2 flex items-center",children:l.jsx(me.CheckIcon,{className:"size-4 text-slate-700"})})]},a.value))})})})]})]})}const $E=[{value:"all",label:"All"},{value:"open",label:"Open"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"overdue",label:"Late"}];function IE({dataset:e,value:t,onChange:n,className:r=""}){const s=ge.useMemo(()=>vc(e),[e]),o=ge.useMemo(()=>({all:s.length,open:s.filter(i=>i.status==="open").length,done:s.filter(i=>i.status==="done").length,blocked:s.filter(i=>i.status==="blocked").length,overdue:s.filter(i=>i.overdue&&i.status!=="done").length}),[s]);return l.jsx(EE,{ariaLabel:"Filter tasks by status",className:r,onChange:i=>n(i),options:$E.map(i=>({...i,count:o[i.value]})),triggerClassName:"w-28",value:t})}function RE({dataset:e,value:t,onChange:n,className:r=""}){const s=ge.useMemo(()=>{const o=vc(e);return[...new Set(o.flatMap(i=>i.tags).filter(Boolean))].sort((i,a)=>i.localeCompare(a)).map(i=>({tag:i,count:o.filter(a=>a.tags.includes(i)).length}))},[e]);return s.length?l.jsx(Ep,{ariaLabel:"Filter tasks by tag",className:r,label:"Tag",onChange:n,options:s.map(o=>({value:o.tag,label:o.tag,count:o.count})),selected:t}):null}function CE({dataset:e,filter:t,onFilterChange:n,tag:r,onTagChange:s,assignee:o,onAssigneeChange:i,leading:a,trailing:c,className:u=""}){return l.jsxs("div",{className:["flex flex-wrap items-center gap-x-3 gap-y-2",u].filter(Boolean).join(" "),children:[a,l.jsx(IE,{dataset:e,onChange:n,value:t}),l.jsx(NE,{dataset:e,onChange:i,value:o}),l.jsx(RE,{dataset:e,onChange:s,value:r}),c?l.jsx("div",{className:"ml-auto flex shrink-0",children:c}):null]})}function jE({dataset:e=null,className:t="",filters:n=!1,leadingFilters:r,trailingFilters:s,itemHref:o,onToggle:i,...a}){const[c,u]=ge.useState(Wu.filter),[f,h]=ge.useState([]),[p,m]=ge.useState([]),[y,v]=ge.useState(null),[S,w]=ge.useState(null),F=e??y;ge.useEffect(()=>{if(e)return;let E=!1;return NO(At(QN({dataUrl:a.dataUrl,path:a.path,schemaUrl:a.schemaUrl}))).then(x=>{E||(x._tag==="Left"?w(x.left.message):(w(null),v(x.right)))}),()=>{E=!0}},[e,a.dataUrl,a.path,a.schemaUrl]);const T=ge.useMemo(()=>{const E={...Wu,dataset:F,filter:c,tag:f,assignee:p};return Gh(ZN(E))},[F,c,f,p]),O=!F&&!S;return l.jsx("main",{className:["min-h-full bg-transparent text-slate-950",t].filter(Boolean).join(" "),children:l.jsxs("section",{className:"mx-auto w-full max-w-3xl px-3 py-4 sm:px-5 sm:py-5",children:[S?l.jsx("p",{className:`mb-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2
|
|
96
|
-
text-sm text-red-700`,children:S}):null,n?l.jsx(CE,{assignee:p,className:"mb-3",dataset:F,filter:c,leading:r,trailing:s,onAssigneeChange:m,onFilterChange:u,onTagChange:h,tag:f}):null,O?l.jsx("p",{className:"py-8 text-center text-sm text-slate-500",children:"Loading tasks…"}):T.length===0?l.jsx("p",{className:"py-8 text-center text-sm text-slate-500",children:AE(c,f)}):l.jsx("ol",{className:"space-y-2",children:T.map(E=>l.jsx(ME,{item:E,folderPath:a.path,itemHref:o,onToggle:i},Np(E.jsonTodo.source?.id,E.jsonTodo)??E.id))})]})})}function ME({item:e,folderPath:t,itemHref:n,onToggle:r}){const s=FE(e),o=n?.(e),i=ge.useCallback(()=>PE(e,t),[e,t]);return l.jsx("li",{className:["rounded-md border px-3 py-2",e.overdue?"border-red-400 bg-red-50":e.status==="blocked"?"border-rose-300 bg-rose-50/60":"border-slate-200 bg-white"].filter(Boolean).join(" "),children:l.jsxs("div",{className:"flex items-start gap-3",children:[r?l.jsx("button",{type:"button","aria-pressed":e.status==="done","aria-label":e.status==="done"?`Reopen ${e.title}`:`Complete ${e.title}`,title:e.status==="done"?"Reopen task":"Complete task",onClick:()=>r(e),className:["mt-0.5 grid h-5 w-5 shrink-0 place-items-center rounded-full","border transition-colors",e.status==="done"?"border-emerald-500 bg-emerald-500 text-white hover:bg-emerald-600":e.status==="blocked"?"border-rose-300 bg-rose-100 text-rose-600":"border-slate-300 bg-white text-transparent hover:border-emerald-500 hover:bg-emerald-50 hover:text-emerald-600"].join(" "),children:l.jsx(me.Check,{className:"h-3 w-3"})}):null,l.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[o?l.jsxs("a",{href:o,className:["inline-flex items-center gap-1 text-sm leading-5 font-medium","text-slate-900 no-underline hover:text-indigo-700",e.status==="done"?"text-slate-500 line-through":""].filter(Boolean).join(" "),children:[l.jsx("span",{children:e.title}),l.jsx(me.ChevronRight,{"aria-hidden":"true",className:"h-3.5 w-3.5 text-slate-400"})]}):l.jsx("p",{className:["text-sm leading-5 font-medium text-slate-900",e.status==="done"?"text-slate-500 line-through":""].join(" "),children:e.title}),s.status||s.folder?l.jsxs("p",{className:"text-xs leading-4 text-slate-500",children:[s.status?l.jsx("span",{className:e.overdue?"font-medium text-red-600":"",children:s.status}):null,s.folder?l.jsxs("span",{children:[s.status?" • ":"",s.folder]}):null]}):null]}),l.jsx(zs,{className:"shrink-0 text-slate-500 hover:text-slate-900",context:i,label:`Copy prompt for ${e.title}`})]})})}const AE=(e,t)=>{const n=e==="done"?"done":e==="blocked"?"blocked":e==="overdue"?"late":e==="all"?"":"open";if(t.length)return`No ${n?`${n} `:""}tasks with the selected tags`;switch(e){case"done":return"No done tasks";case"blocked":return"No blocked tasks";case"overdue":return"No late tasks";case"all":return"No tasks";default:return"No open tasks"}},FE=e=>({status:e.status==="blocked"?"Blocked":e.overdue?"Late":e.status==="done"?"Done":"",folder:e.jsonTodo.source.title.replace(/ tasks$/,"")}),PE=(e,t)=>{const n=t?`${t}/todo.json`:"todo.json",r=LE(e.jsonTodo);return[`The model is instructed to complete this specific todo: ${e.title}`,"",Tp(e),"",`Todo JSON: ${n}`,r.length?"Read these relative files before you start:":null,r.length?r.map(s=>`- ${s}`).join(`
|
|
97
|
-
`):null].filter(s=>!!s).join(`
|
|
98
|
-
`)},LE=e=>UE(DE(e.customFields)),DE=e=>e.flatMap(t=>$p(t.id)?ta(t.value):[]),$p=e=>/(file|path|read|context|source|doc)/i.test(e),ta=e=>typeof e=="string"?KE(e)?[e]:[]:Array.isArray(e)?e.flatMap(t=>ta(t)):e&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>$p(t)?ta(n):[]):[],KE=e=>!!e&&!e.startsWith("/")&&!/^[a-z]+:\/\//i.test(e)&&/[./\\]/.test(e),UE=e=>[...new Set(e)];function qE({folder:e,folderId:t,href:n,request:r}){const s=xp({folder:e,folderId:t,noun:"tasks",request:r,subpath:""}),o=qp(s.tasks,{getFolder:c=>c.jsonTodo.source.id,rootFolder:e}),i=ge.useMemo(()=>{if(s.dataset)return{...s.dataset,tasks:o.visibleItems.map(c=>c.jsonTodo)}},[s.dataset,o.visibleItems]),a=c=>Np(c.jsonTodo.source?.id,c.jsonTodo)??[c.id,c.key].find(u=>u);return l.jsx(vp,{body:i?l.jsx(jE,{dataset:i,trailingFilters:l.jsx(Op,{warnings:s.data?.warnings,folder:e}),filters:!0,leadingFilters:o.choices.length>1?l.jsx(Rp,{ariaLabel:"Filter tasks by folder",choices:o.choices,onSelect:o.setSelected,selected:o.effectiveSelected,total:o.total}):void 0,itemHref:c=>{const u=a(c);return u?n(u):void 0},onToggle:c=>{const u=a(c);u&&s.toggle(u)}}):void 0,page:s,unavailableMessage:"No local task file in this folder."})}function BE(e){return e.subpath?l.jsx(TE,{...e}):l.jsx(qE,{...e})}const v$={...Cp,component:BE};export{BE as TasksPlugin,v$ as tasksClient};
|