forge-openclaw-plugin 0.2.99 → 0.2.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/activity-copy-Bj4h9OcF.js +1 -0
- package/dist/assets/activity-page-5oyCFOns.js +1 -0
- package/dist/assets/ai-surface-workspace-qgk_B57-.js +1 -0
- package/dist/assets/atlas-panel-rfH2qOez.js +1 -0
- package/dist/assets/{board-Ju0h0SeG.js → board-BkDRaMp6.js} +1 -1
- package/dist/assets/calendar-display-preferences-Cid-2RnL.js +1 -0
- package/dist/assets/calendar-page-Bo2iua-a.js +1 -0
- package/dist/assets/calendar-rules-DA1g3QUk.js +1 -0
- package/dist/assets/calendar-ui-Cy1XRwzV.js +1 -0
- package/dist/assets/calendar-week-toolbar-DU1Q4RYj.js +1 -0
- package/dist/assets/charts-P7EVhIog.js +36 -0
- package/dist/assets/companion-sync-lab-page-CosNknOK.js +1 -0
- package/dist/assets/daily-metrics-dashboard-LjuGAB3f.js +1 -0
- package/dist/assets/date-keys-Cj1G3TOn.js +1 -0
- package/dist/assets/entity-links-DwpxhW2H.js +1 -0
- package/dist/assets/entity-note-count-link-BmGDB572.js +1 -0
- package/dist/assets/entity-notes-surface-DgEgicaE.js +1 -0
- package/dist/assets/execution-board-CDRXQB85.js +1 -0
- package/dist/assets/faceted-token-search-CE1YauRd.js +1 -0
- package/dist/assets/flagship-signal-deck-DDds90Gl.js +1 -0
- package/dist/assets/floating-action-menu-CJkI2iFy.js +1 -0
- package/dist/assets/forms-BFlTgZ3W.js +1 -0
- package/dist/assets/goal-detail-page-cJvHaLMQ.js +1 -0
- package/dist/assets/goals-page-f_39hvUV.js +1 -0
- package/dist/assets/graph-BZV40eAE.css +1 -0
- package/dist/assets/graph-D6JLqDbD.js +318 -0
- package/dist/assets/habits-page-DKb96_mj.js +1 -0
- package/dist/assets/health-link-options-Cpx8w7uM.js +1 -0
- package/dist/assets/index-BHTUu_4M.js +19 -0
- package/dist/assets/index-CZbuZQjw.css +1 -0
- package/dist/assets/insight-flow-dialog-pzAzyayN.js +1 -0
- package/dist/assets/insights-page-Dc9oFltJ.js +8 -0
- package/dist/assets/kanban-page-JAxerYh6.js +1 -0
- package/dist/assets/knowledge-graph-page-UQ3skqEi.js +1 -0
- package/dist/assets/life-force-page-BGDbQuVh.js +1 -0
- package/dist/assets/life-force-workspace-B1fYSXRC.js +1 -0
- package/dist/assets/maps-B-YMMjus.css +1 -0
- package/dist/assets/maps-ClgJoCjz.js +803 -0
- package/dist/assets/metric-tile-DX6TclqM.js +1 -0
- package/dist/assets/{motion-DRPJkN3a.js → motion-BeD44FeG.js} +1 -1
- package/dist/assets/movement-page-6HP6nGJx.js +1 -0
- package/dist/assets/note-markdown-DiW2-5d3.js +3 -0
- package/dist/assets/note-tags-input-DDLXf54U.js +1 -0
- package/dist/assets/notes-page-BuguDjhz.js +1 -0
- package/dist/assets/open-in-graph-button-Cg5VrKsC.js +1 -0
- package/dist/assets/orbit-map-GD05-0oS.js +1 -0
- package/dist/assets/overview-page-DuOs2OCB.js +1 -0
- package/dist/assets/page-hero-CQWo1Mm_.js +1 -0
- package/dist/assets/pill-cluster-BJogDRDJ.js +1 -0
- package/dist/assets/preference-entity-handoff-button-D4WAs9pC.js +1 -0
- package/dist/assets/preferences-page-BaJTMU1I.js +1 -0
- package/dist/assets/project-collections-DvaX20q_.js +1 -0
- package/dist/assets/project-detail-page-drPIFZGb.js +1 -0
- package/dist/assets/project-management-hierarchy-page-BUbRXvny.js +1 -0
- package/dist/assets/project-management-section-nav-C2Ud8Zdd.js +1 -0
- package/dist/assets/projects-page-BGzEZUtg.js +1 -0
- package/dist/assets/psyche-behaviors-page-Dmm_Io9D.js +5 -0
- package/dist/assets/psyche-flashcards-page-BgNKJ6QJ.js +1 -0
- package/dist/assets/psyche-goal-map-page-DXJs98Vr.js +1 -0
- package/dist/assets/psyche-graph-CFgs_Bqc.js +1 -0
- package/dist/assets/psyche-metrics-page-zYTJDbyZ.js +1 -0
- package/dist/assets/psyche-mode-guide-page-XPgRfCOf.js +1 -0
- package/dist/assets/psyche-modes-page-B-GA8oRF.js +1 -0
- package/dist/assets/psyche-page--r6a3e1t.js +1 -0
- package/dist/assets/psyche-patterns-page-BM5-3bMm.js +5 -0
- package/dist/assets/psyche-questionnaire-builder-page-CJshQ-mg.js +1 -0
- package/dist/assets/psyche-questionnaire-detail-page-USmR5G5A.js +1 -0
- package/dist/assets/psyche-questionnaire-run-detail-page-D7iBCmTi.js +1 -0
- package/dist/assets/psyche-questionnaire-run-page-Cpil-kDh.js +1 -0
- package/dist/assets/psyche-questionnaires-page-C-_y3VwS.js +1 -0
- package/dist/assets/psyche-report-detail-page--dkSPRaj.js +3 -0
- package/dist/assets/psyche-reports-page-CUaOXmIN.js +1 -0
- package/dist/assets/psyche-schemas-HFmg37Wj.js +1 -0
- package/dist/assets/psyche-schemas-beliefs-page-BX6xaap3.js +9 -0
- package/dist/assets/psyche-screen-time-page-CAAI4mD7.js +1 -0
- package/dist/assets/psyche-self-observation-page-BZ6FLuwa.js +1 -0
- package/dist/assets/psyche-values-page-yEV6MGt8.js +5 -0
- package/dist/assets/query-cache-IQ8W-LNC.js +1 -0
- package/dist/assets/report-chain-fields-fZ8Xd4H6.js +1 -0
- package/dist/assets/rewards-page-C2HQjIAf.js +1 -0
- package/dist/assets/scheduling-rules-editor-BHOpHOrV.js +1 -0
- package/dist/assets/schema-badge-DyKbxb51.js +1 -0
- package/dist/assets/schema-visuals-D6nxjbYC.js +1 -0
- package/dist/assets/select-menu-BX-pZNqL.js +1 -0
- package/dist/assets/settings-agents-page-VuYXTiyc.js +6 -0
- package/dist/assets/settings-bin-page-BNzvYaOk.js +1 -0
- package/dist/assets/settings-calendar-page-CjSFB53S.js +5 -0
- package/dist/assets/settings-data-page-CGSlryuI.js +1 -0
- package/dist/assets/settings-logs-page-BTK5fine.js +1 -0
- package/dist/assets/settings-mobile-page-CRaObOGo.js +1 -0
- package/dist/assets/settings-models-page-DFshpYF8.js +1 -0
- package/dist/assets/settings-page-BP81Mb5R.js +1 -0
- package/dist/assets/settings-rewards-page-CDJ1PH2G.js +1 -0
- package/dist/assets/settings-section-nav-CCFm27r2.js +1 -0
- package/dist/assets/settings-users-page-TdUocFPa.js +1 -0
- package/dist/assets/settings-wiki-page-B2zX0QQG.js +1 -0
- package/dist/assets/sleep-page-cI1GMVzk.js +1 -0
- package/dist/assets/sports-page-06LTqp0V.js +1 -0
- package/dist/assets/state-B-4sS1xO.js +1 -0
- package/dist/assets/strategies-page-DXP9Kx8s.js +1 -0
- package/dist/assets/strategy-detail-page-D6mx_Mik.js +1 -0
- package/dist/assets/strategy-dialog-BvzomTaF.js +1 -0
- package/dist/assets/{table-DewbFlTh.js → table-WfAPUppN.js} +1 -1
- package/dist/assets/task-detail-page-BIWIggdp.js +1 -0
- package/dist/assets/timebox-planning-dialog-CaCnoslG.js +1 -0
- package/dist/assets/today-page-DO2mRPT2.js +1 -0
- package/dist/assets/training-load-page-CyZ0mlEr.js +1 -0
- package/dist/assets/{ui-C2IvSrAz.js → ui-C13Nbgas.js} +4 -4
- package/dist/assets/use-psyche-focus-target-C1C_XjYG.js +1 -0
- package/dist/assets/vendor-CRS-psbw.css +1 -0
- package/dist/assets/vendor-DHkYh85p.js +1052 -0
- package/dist/assets/vitals-page-BQvEjTc6.js +1 -0
- package/dist/assets/weekly-review-page-Tp6Q9CRj.js +1 -0
- package/dist/assets/weight-loss-page-BBzlhLVV.js +1 -0
- package/dist/assets/wiki-article-markdown-DQYohmW2.js +4 -0
- package/dist/assets/wiki-editor-page-Dem_3eZv.js +26 -0
- package/dist/assets/wiki-ingest-history-page-BxoOcCoJ.js +1 -0
- package/dist/assets/wiki-ingest-modal-DhguKk3J.js +1 -0
- package/dist/assets/wiki-page-BLRxVXkl.js +1 -0
- package/dist/assets/workbench-flow-page-DqMkCCTy.js +5 -0
- package/dist/assets/workbench-page-BWd02wPw.js +1 -0
- package/dist/assets/workout-detail-page-BD8u7GyL.js +2 -0
- package/dist/index.html +148 -9
- package/dist/openclaw/tools.js +340 -0
- package/dist/server/server/migrations/065_weight_loss_nutrition_insights.sql +236 -0
- package/dist/server/server/migrations/066_watch_action_receipts.sql +20 -0
- package/dist/server/server/src/app.js +266 -13
- package/dist/server/server/src/health-weight-loss.js +1378 -0
- package/dist/server/server/src/health.js +188 -35
- package/dist/server/server/src/openapi.js +449 -0
- package/dist/server/server/src/services/context.js +6 -7
- package/dist/server/server/src/services/doctor.js +39 -4
- package/dist/server/server/src/services/gamification.js +146 -34
- package/dist/server/server/src/watch-mobile.js +564 -4
- package/dist/server/server/src/web.js +18 -5
- package/dist/server/src/components/ui/info-tooltip.js +48 -3
- package/dist/server/src/lib/api.js +131 -0
- package/dist/server/src/lib/weight-loss-types.js +1 -0
- package/openclaw.plugin.json +14 -1
- package/package.json +1 -1
- package/server/migrations/065_weight_loss_nutrition_insights.sql +236 -0
- package/server/migrations/066_watch_action_receipts.sql +20 -0
- package/skills/forge-openclaw/SKILL.md +26 -5
- package/skills/forge-openclaw/entity_conversation_playbooks.md +134 -5
- package/skills/forge-openclaw/psyche_entity_playbooks.md +45 -0
- package/dist/assets/index-Cn5Wpwau.css +0 -1
- package/dist/assets/index-CwvGs8n4.js +0 -91
- package/dist/assets/vendor-B-Lq_OG3.css +0 -1
- package/dist/assets/vendor-DL2K5ayT.js +0 -2186
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./vendor-DHkYh85p.js";import{C as g,c as s}from"./index-BHTUu_4M.js";import{P as y}from"./page-hero-CQWo1Mm_.js";import"./state-B-4sS1xO.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const N=[{id:"health-ready",title:"Health ready",desiredEnabled:!0,appliedEnabled:!0,authorizationStatus:"approved",syncEligible:!0,lastObservedAt:"2026-04-12T09:00:00.000Z"},{id:"movement-pending-phone",title:"Movement pending on phone",desiredEnabled:!0,appliedEnabled:!1,authorizationStatus:"pending",syncEligible:!1,lastObservedAt:"2026-04-12T09:04:00.000Z"},{id:"screen-time-denied",title:"Screen Time denied",desiredEnabled:!0,appliedEnabled:!0,authorizationStatus:"denied",syncEligible:!1,lastObservedAt:"2026-04-12T08:54:00.000Z"},{id:"health-off",title:"Health off",desiredEnabled:!1,appliedEnabled:!1,authorizationStatus:"disabled",syncEligible:!1,lastObservedAt:null}],f=[{id:"gap-stay",title:"Quiet short gap",gapSeconds:1080,displacementMeters:42,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-short-jump",title:"Suppressed short jump",gapSeconds:240,displacementMeters:260,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-trip",title:"Repaired move",gapSeconds:1320,displacementMeters:1850,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-missing-long",title:"Long missing gap",gapSeconds:7200,displacementMeters:320,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-missing-boundary",title:"Missing boundary anchor",gapSeconds:960,displacementMeters:null,hasStartBoundary:!1,hasEndBoundary:!0}],k=[{id:"overnight-gap-before-move",title:"Exact overnight stay-gap-move bug",rangeStart:"2026-04-05T21:15:00.000Z",rangeEnd:"2026-04-06T02:40:00.000Z",segments:[{id:"stay-home-evening",kind:"stay",startedAt:"2026-04-05T21:15:00.000Z",endedAt:"2026-04-05T21:30:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.5191,longitude:6.6323},endCoordinate:{latitude:46.5191,longitude:6.6323}},{id:"trip-night-move",kind:"trip",startedAt:"2026-04-06T02:34:00.000Z",endedAt:"2026-04-06T02:40:00.000Z",placeLabel:"Night move",placeExternalUid:null,startCoordinate:{latitude:46.5216,longitude:6.6404},endCoordinate:{latitude:46.5226,longitude:6.6424}}]},{id:"repeated-home-stays",title:"Repeated home stays coalesce",rangeStart:"2026-04-05T07:00:00.000Z",rangeEnd:"2026-04-05T08:44:00.000Z",segments:[{id:"stay-home-1",kind:"stay",startedAt:"2026-04-05T07:00:00.000Z",endedAt:"2026-04-05T08:00:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.5191,longitude:6.6323},endCoordinate:{latitude:46.5191,longitude:6.6323}},{id:"stay-home-2",kind:"stay",startedAt:"2026-04-05T08:20:00.000Z",endedAt:"2026-04-05T08:40:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.51912,longitude:6.63231},endCoordinate:{latitude:46.51912,longitude:6.63231}},{id:"trip-start-anchor",kind:"trip",startedAt:"2026-04-05T08:44:00.000Z",endedAt:"2026-04-05T08:49:00.000Z",placeLabel:"Walk out",placeExternalUid:null,startCoordinate:{latitude:46.5217,longitude:6.6405},endCoordinate:{latitude:46.5221,longitude:6.6412}}]}],E=[{id:"user-override-home-window",title:"User-defined missing box overrides one automatic home stay",rawMeasurements:[{id:"raw-stay-home",label:"Raw stay · Home",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z"}],automaticBoxes:[{id:"auto-stay-home",kind:"stay",origin:"recorded",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z",title:"Home"}],userBoxes:[{id:"user-missing-home-window",kind:"missing",origin:"user_invalidated",startedAt:"2026-04-05T08:30:00.000Z",endedAt:"2026-04-05T09:00:00.000Z",title:"User invalidated automatic movement",overrideCount:1}],projectedBoxes:[{id:"projected-home-early",kind:"stay",sourceKind:"automatic",origin:"recorded",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T08:30:00.000Z",title:"Home",overrideCount:0},{id:"projected-home-user-missing",kind:"missing",sourceKind:"user_defined",origin:"user_invalidated",startedAt:"2026-04-05T08:30:00.000Z",endedAt:"2026-04-05T09:00:00.000Z",title:"User invalidated automatic movement",overrideCount:1},{id:"projected-home-late",kind:"stay",sourceKind:"automatic",origin:"recorded",startedAt:"2026-04-05T09:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z",title:"Home",overrideCount:0}]}],w=3600,T=300,_=100;function x(t,i){return Math.max(0,Math.round((Date.parse(i)-Date.parse(t))/1e3))}function S(t,i){if(!t||!i)return null;const a=6371e3,m=(i.latitude-t.latitude)*Math.PI/180,l=(i.longitude-t.longitude)*Math.PI/180,h=t.latitude*Math.PI/180,c=i.latitude*Math.PI/180,p=Math.sin(m/2)**2+Math.cos(h)*Math.cos(c)*Math.sin(l/2)**2,r=2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p));return a*r}function M(t,i){if(t.placeExternalUid&&i.placeExternalUid&&t.placeExternalUid===i.placeExternalUid)return!0;const a=S(t.endCoordinate,i.startCoordinate);return a!==null&&a<=_}function C(t){return t.gapSeconds>3600?{kind:"missing",origin:"missing",reason:"Gap exceeded one hour, so Forge keeps it as explicit missing data.",suppressedShortJump:!1}:!t.hasStartBoundary||!t.hasEndBoundary||t.displacementMeters===null?{kind:"missing",origin:"missing",reason:"One or both boundary anchors were missing, so the gap stays missing instead of inventing movement.",suppressedShortJump:!1}:t.displacementMeters<=100?{kind:"stay",origin:"repaired_gap",reason:"Boundary displacement stayed within 100 m, so the gap repairs into one stay.",suppressedShortJump:!1}:t.gapSeconds<300?{kind:"stay",origin:"repaired_gap",reason:"The jump crossed 100 m but stayed under five minutes, so Forge suppresses it into stay continuity.",suppressedShortJump:!0}:{kind:"trip",origin:"repaired_gap",reason:"The gap stayed under one hour, crossed 100 m, and lasted at least five minutes, so Forge repairs it into a move.",suppressedShortJump:!1}}function L(t){var b,v,j,A;const i=[...t.segments].sort((d,o)=>d.startedAt.localeCompare(o.startedAt)),a=[];if(i.length===0)return{segments:[],uncoveredIntervals:[]};const m=i[0];x(t.rangeStart,m.startedAt)>0&&a.push({id:`missing_${t.rangeStart}_${m.startedAt}`,kind:"missing",origin:"missing",startedAt:t.rangeStart,endedAt:m.startedAt,title:"Missing data"}),i.forEach((d,o)=>{if(o>0){const n=i[o-1],u=x(n.endedAt,d.startedAt);u>0&&(u>w?a.push({id:`missing_${n.id}_${d.id}`,kind:"missing",origin:"missing",startedAt:n.endedAt,endedAt:d.startedAt,title:"Missing data"}):M(n,d)?a.push({id:`repaired_stay_${n.id}_${d.id}`,kind:"stay",origin:"repaired_gap",startedAt:n.endedAt,endedAt:d.startedAt,title:n.placeLabel??d.placeLabel??"Repaired stay"}):S(n.endCoordinate,d.startCoordinate)===null?a.push({id:`missing_${n.id}_${d.id}`,kind:"missing",origin:"missing",startedAt:n.endedAt,endedAt:d.startedAt,title:"Missing data"}):u<T?a.push({id:`repaired_short_jump_${n.id}_${d.id}`,kind:"stay",origin:"repaired_gap",startedAt:n.endedAt,endedAt:d.startedAt,title:n.placeLabel??d.placeLabel??"Repaired stay"}):a.push({id:`repaired_trip_${n.id}_${d.id}`,kind:"trip",origin:"repaired_gap",startedAt:n.endedAt,endedAt:d.startedAt,title:"Repaired move"}))}a.push({id:d.id,kind:d.kind,origin:"recorded",startedAt:d.startedAt,endedAt:d.endedAt,title:d.placeLabel??d.kind})});const l=i[i.length-1],h=x(l.endedAt,t.rangeEnd);h>0&&(l.kind==="stay"&&h<=w?a.push({id:`continued_${l.id}_${t.rangeEnd}`,kind:"stay",origin:"continued_stay",startedAt:l.endedAt,endedAt:t.rangeEnd,title:l.placeLabel??"Continued stay"}):a.push({id:`missing_${l.endedAt}_${t.rangeEnd}`,kind:"missing",origin:"missing",startedAt:l.endedAt,endedAt:t.rangeEnd,title:"Missing data"}));const c=[];for(const d of a){const o=c[c.length-1];if(o&&o.kind==="stay"&&d.kind==="stay"&&(o.origin!=="recorded"||d.origin!=="recorded")&&o.endedAt===d.startedAt){c[c.length-1]={...o,id:`${o.id}_${d.id}`,origin:o.origin==="continued_stay"||d.origin==="continued_stay"?"continued_stay":"repaired_gap",endedAt:d.endedAt};continue}c.push(d)}const p=[],r=[...c].sort((d,o)=>d.startedAt.localeCompare(o.startedAt));((b=r[0])==null?void 0:b.startedAt)!==t.rangeStart&&p.push({startedAt:t.rangeStart,endedAt:((v=r[0])==null?void 0:v.startedAt)??t.rangeEnd});for(let d=1;d<r.length;d+=1)r[d-1].endedAt!==r[d].startedAt&&p.push({startedAt:r[d-1].endedAt,endedAt:r[d].startedAt});return((j=r[r.length-1])==null?void 0:j.endedAt)!==t.rangeEnd&&p.push({startedAt:((A=r[r.length-1])==null?void 0:A.endedAt)??t.rangeStart,endedAt:t.rangeEnd}),{segments:r,uncoveredIntervals:p}}function Z(t){return t?new Date(t).toLocaleString():"Waiting for device update"}function F(){return e.jsxs("div",{className:"mx-auto grid w-full max-w-[1180px] gap-5",children:[e.jsx(y,{title:"Companion Sync Lab",description:"Deterministic fixtures for source-state reconciliation and movement gap repair. This route is dev-only and exists to make QA faster than recreating every phone state by hand.",badge:"Dev only"}),e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[1.05fr_0.95fr]",children:[e.jsxs(g,{className:"grid gap-4 rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(10,17,31,0.96),rgba(8,13,24,0.92))] p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Source matrix"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"These rows mirror the pairing source-state contract that the web and phone now share."})]}),e.jsx("div",{className:"grid gap-3",children:N.map(t=>e.jsxs("div",{className:"grid gap-2 rounded-[20px] border border-white/8 bg-white/[0.03] px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsx(s,{tone:t.desiredEnabled?"signal":"meta",children:t.desiredEnabled?"Enabled":"Off"}),e.jsx(s,{tone:"meta",children:t.desiredEnabled===t.appliedEnabled?"Applied":"Pending on phone"})]}),e.jsxs("div",{className:"grid gap-1 text-xs text-white/56 sm:grid-cols-2",children:[e.jsxs("div",{children:["Authorization: ",t.authorizationStatus]}),e.jsxs("div",{children:["Sync eligible: ",t.syncEligible?"Yes":"No"]}),e.jsxs("div",{children:["Desired: ",t.desiredEnabled?"On":"Off"]}),e.jsxs("div",{children:["Applied: ",t.appliedEnabled?"On":"Off"]}),e.jsxs("div",{className:"sm:col-span-2",children:["Last observed: ",Z(t.lastObservedAt)]})]})]},t.id))})]}),e.jsxs(g,{className:"grid gap-4 rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(10,17,31,0.96),rgba(8,13,24,0.92))] p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Gap classifier"}),e.jsxs("div",{className:"mt-2 text-sm leading-6 text-white/58",children:["Every gap resolves to exactly one of ",e.jsx("code",{children:"stay"}),","," ",e.jsx("code",{children:"trip"}),", or ",e.jsx("code",{children:"missing"}),"."]})]}),e.jsx("div",{className:"grid gap-3",children:f.map(t=>{const i=C(t);return e.jsxs("div",{className:"grid gap-2 rounded-[20px] border border-white/8 bg-white/[0.03] px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsx(s,{tone:i.kind==="missing"?"meta":i.kind==="trip"?"signal":"default",children:i.kind}),e.jsx(s,{tone:"meta",children:i.origin}),i.suppressedShortJump?e.jsx(s,{className:"bg-amber-400/10 text-amber-100",children:"Suppressed short jump"}):null]}),e.jsxs("div",{className:"grid gap-1 text-xs text-white/56 sm:grid-cols-2",children:[e.jsxs("div",{children:["Gap: ",Math.round(t.gapSeconds/60)," min"]}),e.jsxs("div",{children:["Displacement:"," ",t.displacementMeters===null?"unknown":`${Math.round(t.displacementMeters)} m`]}),e.jsxs("div",{children:["Start boundary: ",t.hasStartBoundary?"present":"missing"]}),e.jsxs("div",{children:["End boundary: ",t.hasEndBoundary?"present":"missing"]})]}),e.jsx("div",{className:"text-sm leading-6 text-white/72",children:i.reason})]},t.id)})})]})]}),e.jsxs(g,{className:"grid gap-4 rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(10,17,31,0.96),rgba(8,13,24,0.92))] p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Coverage preview"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"These fixtures normalize a full window and highlight whether any interval would still be left uncovered."})]}),e.jsx("div",{className:"grid gap-3",children:k.map(t=>{const i=L(t);return e.jsxs("div",{className:"grid gap-3 rounded-[20px] border border-white/8 bg-white/[0.03] px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsx(s,{className:i.uncoveredIntervals.length===0?"bg-emerald-400/10 text-emerald-100":"bg-rose-400/10 text-rose-100",children:i.uncoveredIntervals.length===0?"Coverage locked":"Coverage broken"}),e.jsxs(s,{tone:"meta",children:[i.segments.length," normalized segment",i.segments.length===1?"":"s"]})]}),e.jsx("div",{className:"grid gap-2",children:i.segments.map(a=>e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-[16px] border border-white/6 bg-white/[0.02] px-3 py-2 text-xs text-white/68",children:[e.jsx(s,{tone:a.kind==="trip"?"signal":a.kind==="missing"?"meta":"default",children:a.kind}),e.jsx(s,{tone:"meta",children:a.origin}),e.jsxs("span",{children:[new Date(a.startedAt).toLocaleTimeString()," → ",new Date(a.endedAt).toLocaleTimeString()]}),e.jsx("span",{className:"text-white/48",children:a.title})]},a.id))}),i.uncoveredIntervals.length>0?e.jsx("div",{className:"grid gap-2",children:i.uncoveredIntervals.map(a=>e.jsxs("div",{className:"rounded-[14px] border border-rose-400/18 bg-rose-500/10 px-3 py-2 text-xs text-rose-100",children:["Uncovered: ",new Date(a.startedAt).toLocaleTimeString()," →"," ",new Date(a.endedAt).toLocaleTimeString()]},`${a.startedAt}-${a.endedAt}`))}):null]},t.id)})})]}),e.jsxs(g,{className:"grid gap-4 rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(10,17,31,0.96),rgba(8,13,24,0.92))] p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Canonical box layers"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"Raw phone measurements stay immutable. Forge generates automatic boxes from them, user-defined boxes override them, and the final projected boxes are what both the web and iPhone should render."})]}),e.jsx("div",{className:"grid gap-4",children:E.map(t=>e.jsxs("div",{className:"grid gap-4 rounded-[20px] border border-white/8 bg-white/[0.03] px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsxs(s,{tone:"meta",children:["Raw: ",t.rawMeasurements.length]}),e.jsxs(s,{tone:"meta",children:["Automatic: ",t.automaticBoxes.length]}),e.jsxs(s,{tone:"meta",children:["User: ",t.userBoxes.length]}),e.jsxs(s,{tone:"signal",children:["Projected: ",t.projectedBoxes.length]})]}),e.jsxs("div",{className:"grid gap-3 xl:grid-cols-4",children:[e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/6 bg-black/10 p-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Raw measurements"}),t.rawMeasurements.map(i=>e.jsxs("div",{className:"rounded-[14px] border border-white/6 bg-white/[0.03] px-3 py-2 text-xs text-white/68",children:[e.jsx("div",{className:"font-medium text-white",children:i.label}),e.jsxs("div",{children:[new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]})]},i.id))]}),e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/6 bg-black/10 p-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Automatic boxes"}),t.automaticBoxes.map(i=>e.jsxs("div",{className:"rounded-[14px] border border-white/6 bg-white/[0.03] px-3 py-2 text-xs text-white/68",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s,{tone:i.kind==="trip"?"signal":i.kind==="missing"?"meta":"default",children:i.kind}),e.jsx(s,{tone:"meta",children:i.origin})]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:i.title}),e.jsxs("div",{children:[new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]})]},i.id))]}),e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/6 bg-black/10 p-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"User-defined boxes"}),t.userBoxes.map(i=>e.jsxs("div",{className:"rounded-[14px] border border-white/6 bg-white/[0.03] px-3 py-2 text-xs text-white/68",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s,{tone:i.kind==="missing"?"meta":"default",children:i.kind}),e.jsx(s,{className:"bg-pink-400/10 text-pink-100",children:i.origin})]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:i.title}),e.jsxs("div",{children:[new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]}),e.jsxs("div",{className:"mt-1 text-white/52",children:["Overrides ",i.overrideCount," automatic box",i.overrideCount===1?"":"es"]})]},i.id))]}),e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/6 bg-black/10 p-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Projected visible boxes"}),t.projectedBoxes.map(i=>e.jsxs("div",{className:"rounded-[14px] border border-white/6 bg-white/[0.03] px-3 py-2 text-xs text-white/68",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s,{tone:i.kind==="trip"?"signal":i.kind==="missing"?"meta":"default",children:i.kind}),e.jsx(s,{tone:"meta",children:i.sourceKind})]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:i.title}),e.jsxs("div",{children:[new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]}),e.jsxs("div",{className:"mt-1 text-white/52",children:[i.origin,i.overrideCount>0?` · overrides ${i.overrideCount}`:""]})]},i.id))]})]})]},t.id))})]})]})}export{F as CompanionSyncLabPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bU as j,j as e,d1 as M,d2 as V,aI as _,d3 as S,d4 as P,d5 as L,aG as T,aX as z,r as u,cX as R,aK as $}from"./vendor-DHkYh85p.js";import{R as K,P as F,O as B,C as O,T as A,D as W,a as I}from"./ui-C13Nbgas.js";import{C as v,Z as x,c}from"./index-BHTUu_4M.js";import{R as X,e as E,C as G,X as H,Y,d as U,T as Z,B as q,a as J}from"./charts-P7EVhIog.js";function m(a){return a?new Date(`${a}T12:00:00`).toLocaleDateString(void 0,{month:"short",day:"numeric"}):"No date yet"}function Q(a,s){return s==="cumulative"?a.total??a.latest??a.maximum??a.average:a.latest??a.average??a.maximum??a.minimum}function d(a,s){if(s==null)return"No reading";const t=a.unit==="steps"||a.unit==="flights"||a.unit==="kcal"||a.unit==="min"||a.unit==="swears"||a.unit==="conversations"||a.unit==="messages"?0:(a.unit==="%",1);return`${s.toLocaleString(void 0,{maximumFractionDigits:t,minimumFractionDigits:t===0||s>=100?0:1})} ${a.unit}`}function w(a){return a.deltaValue==null?"No baseline yet":`${a.deltaValue>0?"+":""}${d(a,a.deltaValue)}`}function ee(a){return Math.round(a*10)/10}function N(a,s){return Q(a,s)}function b(a){const s=a.days.map(t=>N(t,a.aggregation)).filter(t=>t!=null);return s.length===0?{minimum:null,average:null,maximum:null,count:0}:{minimum:Math.min(...s),average:s.reduce((t,i)=>t+i,0)/s.length,maximum:Math.max(...s),count:s.length}}function y(a){return new Date(`${a}T12:00:00`).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ae({active:a,payload:s,label:t,metric:i}){var r;if(!a||!(s!=null&&s.length)||typeof t!="string")return null;const l=((r=s.find(n=>typeof n.value=="number"))==null?void 0:r.value)??null;return e.jsxs("div",{className:"rounded-[18px] border border-white/10 bg-[rgba(9,13,24,0.94)] px-3 py-2 shadow-[0_18px_48px_rgba(0,0,0,0.38)] backdrop-blur-xl",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/40",children:y(t)}),e.jsx("div",{className:"mt-1 text-sm font-semibold text-white",children:d(i,l)})]})}function k({metric:a,height:s=180,detailed:t=!1}){const i=u.useMemo(()=>b(a),[a]),l=u.useMemo(()=>a.days.map(o=>({dateKey:o.dateKey,value:N(o,a.aggregation),sampleCount:o.sampleCount})),[a]),r=l.map(o=>o.value).filter(o=>o!=null),n=r.length>0?Math.min(...r):0,p=r.length>0?Math.max(...r):1,f=Math.max((p-n)*.12,a.unit==="%"?2:1),C=g(a.category),h=`metric-gradient-${a.metric.replace(/[^a-z0-9]/gi,"-")}`;return r.length===0?e.jsx("div",{className:"flex items-center justify-center rounded-[22px] border border-dashed border-white/8 bg-white/[0.025] text-sm text-white/40",style:{height:s},children:"Waiting for chart data"}):e.jsx("div",{className:x("overflow-hidden rounded-[22px] border bg-[radial-gradient(circle_at_top_left,rgba(171,232,255,0.08),transparent_34%),rgba(255,255,255,0.025)] p-3",C.ring),style:{height:s},children:e.jsx(X,{width:"100%",height:"100%",children:e.jsxs(E,{data:l,margin:{top:t?18:8,right:t?18:4,bottom:t?12:0,left:t?8:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:h,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgba(171,232,255,0.55)"}),e.jsx("stop",{offset:"56%",stopColor:"rgba(251,191,36,0.22)"}),e.jsx("stop",{offset:"100%",stopColor:"rgba(251,191,36,0.02)"})]})}),e.jsx(G,{stroke:"rgba(255,255,255,0.07)",vertical:t}),e.jsx(H,{dataKey:"dateKey",tickFormatter:y,minTickGap:t?22:34,tick:{fill:"rgba(255,255,255,0.46)",fontSize:11},axisLine:{stroke:"rgba(255,255,255,0.1)"},tickLine:!1}),e.jsx(Y,{width:t?62:36,domain:[Math.max(0,n-f),p+f],tickFormatter:o=>d(a,Number(o)).replace(` ${a.unit}`,""),tick:{fill:"rgba(255,255,255,0.46)",fontSize:11},axisLine:!1,tickLine:!1}),i.average!=null?e.jsx(U,{y:ee(i.average),stroke:"rgba(255,255,255,0.34)",strokeDasharray:"5 5",ifOverflow:"extendDomain"}):null,e.jsx(Z,{cursor:{stroke:"rgba(255,255,255,0.22)",strokeWidth:1},content:e.jsx(ae,{metric:a})}),a.aggregation==="cumulative"?e.jsx(q,{dataKey:"value",radius:[8,8,2,2],fill:`url(#${h})`,maxBarSize:t?34:20}):e.jsx(J,{type:"monotone",dataKey:"value",stroke:"rgba(171,232,255,0.92)",strokeWidth:t?3:2,fill:`url(#${h})`,dot:t?{r:3,fill:"rgba(251,191,36,0.9)"}:!1,activeDot:{r:5,fill:"rgba(251,191,36,0.95)"}})]})})})}function te({metric:a,open:s,onOpenChange:t}){const i=b(a),l=g(a.category);return e.jsx(K,{open:s,onOpenChange:t,children:e.jsxs(F,{children:[e.jsx(B,{className:"fixed inset-0 z-50 bg-[rgba(3,7,18,0.82)] backdrop-blur-xl"}),e.jsxs(O,{className:"fixed inset-3 z-[51] grid min-h-0 overflow-hidden rounded-[32px] border border-white/10 bg-[radial-gradient(circle_at_top_left,rgba(171,232,255,0.12),transparent_34%),linear-gradient(180deg,rgba(12,18,32,0.98),rgba(7,10,20,0.99))] shadow-[0_34px_110px_rgba(0,0,0,0.58)] sm:inset-5",children:[e.jsxs(A,{className:"sr-only",children:[a.label," chart"]}),e.jsx(W,{className:"sr-only",children:"Full-screen time-series chart for the selected daily metric."}),e.jsxs("div",{className:"grid min-h-0 grid-rows-[auto_minmax(0,1fr)]",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-white/8 px-5 py-4 sm:px-6",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:[a.category," time series"]}),e.jsx("div",{className:"mt-1 text-2xl font-semibold text-white sm:text-3xl",children:a.label}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-white/54",children:[e.jsx(c,{className:l.badge,children:a.aggregation}),e.jsxs(c,{tone:"meta",children:[a.coverageDays," tracked days"]}),e.jsxs(c,{tone:"meta",children:["latest ",m(a.latestDateKey)]})]})]}),e.jsx(I,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex size-11 items-center justify-center rounded-full border border-white/10 bg-white/[0.06] text-white/72 transition hover:bg-white/[0.1] hover:text-white","aria-label":"Close metric chart",children:e.jsx($,{className:"size-5"})})})]}),e.jsxs("div",{className:"grid min-h-0 gap-4 overflow-y-auto p-4 sm:p-6 lg:grid-cols-[minmax(0,1fr)_18rem]",children:[e.jsx(k,{metric:a,height:560,detailed:!0}),e.jsx("div",{className:"grid content-start gap-3",children:[["Latest",a.latestValue],["Period min",i.minimum],["Period average",i.average],["Period max",i.maximum],["Baseline",a.baselineValue],["Delta",a.deltaValue]].map(([r,n])=>e.jsxs("div",{className:"rounded-[22px] border border-white/8 bg-white/[0.035] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:r}),e.jsx("div",{className:"mt-1 text-xl font-semibold text-white",children:d(a,typeof n=="number"?n:null)})]},String(r)))})]})]})]})]})})}function se(a){return a.deltaValue==null||a.deltaValue===0?"steady":a.deltaValue>0?"up":"down"}function g(a){switch(a){case"recovery":return{ring:"border-[rgba(255,122,167,0.18)]",badge:"bg-[rgba(255,122,167,0.16)] text-[rgb(255,179,205)]",glow:"from-[rgba(255,122,167,0.2)] via-[rgba(109,76,255,0.06)] to-transparent"};case"cardio":return{ring:"border-[rgba(109,173,255,0.22)]",badge:"bg-[rgba(109,173,255,0.16)] text-[rgb(186,220,255)]",glow:"from-[rgba(109,173,255,0.22)] via-[rgba(64,108,255,0.08)] to-transparent"};case"breathing":return{ring:"border-[rgba(111,232,195,0.2)]",badge:"bg-[rgba(111,232,195,0.15)] text-[rgb(195,255,237)]",glow:"from-[rgba(111,232,195,0.2)] via-[rgba(29,154,123,0.08)] to-transparent"};case"composition":return{ring:"border-[rgba(247,211,110,0.18)]",badge:"bg-[rgba(247,211,110,0.15)] text-[rgb(255,235,176)]",glow:"from-[rgba(247,211,110,0.18)] via-[rgba(184,128,24,0.08)] to-transparent"};case"temperature":return{ring:"border-[rgba(255,153,102,0.18)]",badge:"bg-[rgba(255,153,102,0.16)] text-[rgb(255,214,190)]",glow:"from-[rgba(255,153,102,0.2)] via-[rgba(255,91,46,0.06)] to-transparent"};case"conversationTone":return{ring:"border-[rgba(251,191,36,0.2)]",badge:"bg-[rgba(251,191,36,0.16)] text-[rgb(255,232,166)]",glow:"from-[rgba(251,191,36,0.18)] via-[rgba(244,114,182,0.08)] to-transparent"};default:return{ring:"border-[rgba(163,174,208,0.16)]",badge:"bg-[rgba(163,174,208,0.14)] text-[rgb(220,228,255)]",glow:"from-[rgba(163,174,208,0.14)] via-[rgba(112,120,167,0.06)] to-transparent"}}}function D(a){switch(a){case"restingHeartRate":case"walkingHeartRateAverage":case"heartRateRecoveryOneMinute":return z;case"heartRateVariabilitySDNN":case"vo2Max":return T;case"oxygenSaturation":case"respiratoryRate":return L;case"bodyMass":case"bodyFatPercentage":case"leanBodyMass":return P;case"stepCount":case"flightsClimbed":case"appleExerciseTime":return S;case"basalEnergyBurned":return _;case"swearingMessagePercent":return V;case"devrageSwearCount":return M;default:return j}}function oe({title:a,description:s,metric:t,emptyDescription:i}){const l=t?D(t.metric):j,r=g(t?t.category:"default"),n=t?se(t):"steady";return e.jsxs(v,{className:x("relative overflow-hidden rounded-[28px] border bg-[rgba(12,18,36,0.82)] p-5 shadow-[0_18px_60px_rgba(4,8,18,0.3)]",r.ring),children:[e.jsx("div",{className:x("pointer-events-none absolute inset-0 bg-gradient-to-br opacity-90",r.glow)}),e.jsxs("div",{className:"relative grid gap-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"grid gap-1",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/38",children:a}),e.jsx("div",{className:"text-sm leading-6 text-white/56",children:s})]}),e.jsx("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.05] p-3 text-white/80",children:e.jsx(l,{className:"size-5"})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-xl font-semibold text-white",children:t?d(t,t.latestValue):"No signal yet"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-white/56",children:[t?e.jsx(c,{className:r.badge,children:t.label}):null,t?e.jsx(c,{className:x("border-none",n==="up"?"bg-[rgba(111,232,195,0.14)] text-[rgb(190,255,231)]":n==="down"?"bg-[rgba(255,122,167,0.14)] text-[rgb(255,193,215)]":"bg-white/[0.08] text-white/72"),children:w(t)}):null,t?e.jsxs(c,{tone:"meta",children:[t.coverageDays," days tracked"]}):null]}),e.jsx("div",{className:"text-xs text-white/48",children:t?`Latest reading on ${m(t.latestDateKey)}`:i??"Forge will populate this card as soon as daily readings are available."})]})]})]})}function re({metric:a}){const[s,t]=u.useState(!1),i=D(a.metric),l=g(a.category),r=a.days.at(-1),n=b(a);return e.jsxs(v,{className:x("overflow-hidden rounded-[28px] border bg-[linear-gradient(180deg,rgba(12,18,36,0.94),rgba(8,12,24,0.98))] p-5",l.ring),children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.04] p-3 text-white/84",children:e.jsx(i,{className:"size-5"})}),e.jsxs("div",{className:"grid gap-1",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:a.category}),e.jsx("div",{className:"text-xl font-semibold text-white",children:a.label}),e.jsxs("div",{className:"text-sm text-white/52",children:[a.coverageDays," tracked day",a.coverageDays===1?"":"s"]})]})]}),e.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:[e.jsx(c,{className:l.badge,children:a.aggregation}),e.jsxs("button",{type:"button",className:"inline-flex min-h-9 items-center gap-2 rounded-full border border-white/10 bg-white/[0.055] px-3 py-1.5 text-xs font-medium text-white/72 transition hover:bg-white/[0.09] hover:text-white",onClick:()=>t(!0),children:[e.jsx(R,{className:"size-3.5"}),"Full screen"]})]})]}),e.jsxs("div",{className:"mt-5 grid gap-4 md:grid-cols-[minmax(0,0.95fr)_minmax(220px,1.05fr)]",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Latest"}),e.jsx("div",{className:"mt-1 text-3xl font-semibold text-white",children:d(a,a.latestValue)}),e.jsx("div",{className:"mt-1 text-sm text-white/52",children:a.latestDateKey?`Latest reading on ${m(a.latestDateKey)}`:"Waiting for the first successful reading"})]}),e.jsxs("div",{className:"grid gap-2 rounded-[22px] border border-white/8 bg-white/[0.03] p-4 text-sm text-white/70",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Baseline"}),e.jsx("span",{className:"font-medium text-white",children:d(a,a.baselineValue)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Delta"}),e.jsx("span",{className:x("font-medium",a.deltaValue==null?"text-white/58":a.deltaValue>0?"text-[rgb(190,255,231)]":a.deltaValue<0?"text-[rgb(255,198,219)]":"text-white"),children:w(a)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Latest samples"}),e.jsx("span",{className:"font-medium text-white",children:(r==null?void 0:r.sampleCount)??0})]})]})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(k,{metric:a}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs text-white/48",children:[e.jsxs("div",{className:"rounded-[16px] border border-white/8 bg-white/[0.025] px-3 py-2",children:[e.jsx("div",{children:"Period min"}),e.jsx("div",{className:"mt-1 font-medium text-white/78",children:d(a,n.minimum)})]}),e.jsxs("div",{className:"rounded-[16px] border border-white/8 bg-white/[0.025] px-3 py-2",children:[e.jsx("div",{children:"Period avg"}),e.jsx("div",{className:"mt-1 font-medium text-white/78",children:d(a,n.average)})]}),e.jsxs("div",{className:"rounded-[16px] border border-white/8 bg-white/[0.025] px-3 py-2",children:[e.jsx("div",{children:"Period max"}),e.jsx("div",{className:"mt-1 font-medium text-white/78",children:d(a,n.maximum)})]})]})]})]}),e.jsx(te,{metric:a,open:s,onOpenChange:t})]})}function ce({groups:a}){return e.jsx("section",{className:"grid gap-5",children:a.map(s=>e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/38",children:s.category}),e.jsxs("div",{className:"mt-1 text-2xl font-semibold text-white",children:[s.metrics.length," signals in this lane"]})]}),e.jsxs(c,{className:g(s.category).badge,children:[s.coverageDays," days of coverage"]})]}),e.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:s.metrics.map(t=>e.jsx(re,{metric:t},t.metric))})]},s.category))})}export{ce as M,oe as S,m as f,g as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a(e,n){var t;return((t=e.find(o=>o.type===n))==null?void 0:t.value)??""}function m(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}function u(e,n){const t=new Intl.DateTimeFormat("en-CA",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(e),o=a(t,"year"),r=a(t,"month"),i=a(t,"day");return`${o}-${r}-${i}`}function c(e=new Date){return u(e,m())}export{c as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function i(t){return t.entityType==="goal"?`/goals/${t.entityId}`:t.entityType==="project"?`/projects/${t.entityId}`:t.entityType==="task"?`/tasks/${t.entityId}`:t.entityType==="strategy"?`/strategies/${t.entityId}`:t.entityType==="habit"?"/habits":t.entityType==="task_run"&&typeof t.metadata.taskId=="string"?`/tasks/${t.metadata.taskId}`:null}function r(t){return t.entityType==="goal"?"Open goal":t.entityType==="project"?"Open project":t.entityType==="strategy"?"Open strategy":t.entityType==="habit"?"Open habits":t.entityType==="task"||t.entityType==="task_run"?"Open task":null}export{r as a,i as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b5 as l,j as i,aS as x}from"./vendor-DHkYh85p.js";import{ap as f,cQ as h}from"./index-BHTUu_4M.js";function g({entityType:s,entityId:a,count:r,compact:o=!1,className:p=""}){const n=l(),e=f(s,a);return e?i.jsxs("span",{role:"link",tabIndex:0,className:`inline-flex items-center rounded-full border border-white/10 bg-white/[0.05] text-white/72 transition hover:bg-white/[0.09] hover:text-white ${o?"min-h-5 gap-1 px-2 py-0.5 text-[10px]":"min-h-10 gap-2 px-3 py-2 text-xs"} ${p}`,onClick:t=>{t.stopPropagation(),n(e)},onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),t.stopPropagation(),n(e))},children:[i.jsx(x,{className:o?"size-3":"size-3.5"}),h(r)]}):null}export{g as E};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,j as e,b4 as $e,b3 as We,cR as Ke,ce as Xe,c7 as Pe}from"./vendor-DHkYh85p.js";import{j as Ye,i as x,k as X}from"./state-B-4sS1xO.js";import{u as Ze,bv as Y,cP as et,cq as m,ao as tt,bm as st,bn as at,C as it,aq as nt,c as j,cQ as rt,B as y,I as w,T as ze,bu as f,i as lt,bD as ot,bw as dt,bx as ct,by as mt,bz as ut,bA as pt,bB as ht,bC as xt}from"./index-BHTUu_4M.js";import{N as Z}from"./note-markdown-DiW2-5d3.js";import{n as ee,N as Fe,f as yt,p as gt,b as vt}from"./note-tags-input-DDLXf54U.js";function bt(o,d,c){return o.links.filter(p=>!(p.entityType===d&&p.entityId===c))}function jt(o,d){return o.entityType===d.entityType&&o.entityId===d.entityId&&(o.anchorKey??null)===(d.anchorKey??null)}function te(o){const d=new Set;return o.filter(c=>{const p=`${c.entityType}:${c.entityId}:${c.anchorKey??""}`;return d.has(p)?!1:(d.add(p),!0)})}function Me(o,d,c){return gt(o)??vt(d,c)}function St({entityType:o,entityId:d,anchorKey:c,includeAnchorlessWhenAnchored:p=!1,title:Qe="Notes",description:Be="Markdown notes linked to this entity stay searchable, editable, and visible alongside the work.",invalidateQueryKeys:Ve=[],compact:se=!1}){var Se,De,_e,Te,Le,Ie,Ee,qe,Ae;const u=Ze(),L=Ye(),[I,Oe]=l.useState(""),[ae,E]=l.useState(!1),[v,q]=l.useState(""),[ie,A]=l.useState(!1),[Ue,$]=l.useState({entityType:"goal",entityId:""}),[ne,K]=l.useState([]),[re,P]=l.useState([]),[le,z]=l.useState(""),[oe,F]=l.useState(""),[de,M]=l.useState("days"),[He,Q]=l.useState(null),[b,B]=l.useState(""),[ce,N]=l.useState(!1),[V,O]=l.useState([]),[Re,U]=l.useState({entityType:"goal",entityId:""}),[me,k]=l.useState([]),[ue,C]=l.useState(""),[pe,S]=l.useState(""),[he,D]=l.useState("days"),H=Y(c),xe=et(o,c),g=x({queryKey:["notes",o,d],queryFn:()=>ot({linkedEntityType:o,linkedEntityId:d,limit:100})}),ye=x({queryKey:["forge-psyche-values"],queryFn:dt}),ge=x({queryKey:["forge-psyche-patterns"],queryFn:ct}),ve=x({queryKey:["forge-psyche-behaviors"],queryFn:mt}),be=x({queryKey:["forge-psyche-beliefs"],queryFn:ut}),je=x({queryKey:["forge-psyche-modes"],queryFn:pt}),we=x({queryKey:["forge-psyche-flashcards"],queryFn:ht}),fe=x({queryKey:["forge-psyche-reports"],queryFn:xt}),R=l.useMemo(()=>{var t,r,i,a,h,n,_,T;return{goal:u.snapshot.goals.map(s=>({id:s.id,label:m(s.title,s.user)})),project:u.snapshot.dashboard.projects.map(s=>({id:s.id,label:m(s.title,s.user)})),task:u.snapshot.tasks.map(s=>({id:s.id,label:m(s.title,s.user)})),strategy:u.snapshot.strategies.map(s=>({id:s.id,label:m(s.title,s.user)})),habit:u.snapshot.habits.map(s=>({id:s.id,label:m(s.title,s.user)})),tag:u.snapshot.tags.map(s=>({id:s.id,label:m(s.name,s.user)})),note:(((t=g.data)==null?void 0:t.notes)??[]).map(s=>({id:s.id,label:s.contentPlain||s.contentMarkdown})),insight:[],psyche_value:(((r=ye.data)==null?void 0:r.values)??[]).map(s=>({id:s.id,label:m(s.title,s.user)})),behavior_pattern:(((i=ge.data)==null?void 0:i.patterns)??[]).map(s=>({id:s.id,label:m(s.title,s.user)})),behavior:(((a=ve.data)==null?void 0:a.behaviors)??[]).map(s=>({id:s.id,label:m(s.title,s.user)})),belief_entry:(((h=be.data)==null?void 0:h.beliefs)??[]).map(s=>({id:s.id,label:m(s.statement,s.user)})),mode_profile:(((n=je.data)==null?void 0:n.modes)??[]).map(s=>({id:s.id,label:m(s.title,s.user)})),flashcard:(((_=we.data)==null?void 0:_.flashcards)??[]).map(s=>({id:s.id,label:m(s.title||s.message,s.user)})),mode_guide_session:[],event_type:[],emotion_definition:[],trigger_report:(((T=fe.data)==null?void 0:T.reports)??[]).map(s=>({id:s.id,label:m(s.title,s.user)})),calendar_event:[],work_block_template:[],task_timebox:[],preference_catalog:[],preference_catalog_item:[],preference_context:[],preference_item:[],questionnaire_instrument:[],sleep_session:[],workout_session:[]}},[(Se=ve.data)==null?void 0:Se.behaviors,(De=be.data)==null?void 0:De.beliefs,(_e=we.data)==null?void 0:_e.flashcards,(Te=je.data)==null?void 0:Te.modes,(Le=g.data)==null?void 0:Le.notes,(Ie=ge.data)==null?void 0:Ie.patterns,(Ee=fe.data)==null?void 0:Ee.reports,u.snapshot.dashboard.projects,u.snapshot.goals,u.snapshot.habits,u.snapshot.strategies,u.snapshot.tags,u.snapshot.tasks,(qe=ye.data)==null?void 0:qe.values]),G=async()=>{await Promise.all([L.invalidateQueries({queryKey:["notes",o,d]}),lt(L),...Ve.map(t=>L.invalidateQueries({queryKey:t}))])},Ne=X({mutationFn:async t=>tt({contentMarkdown:t,tags:ee(re),destroyAt:Me(le,oe,de),links:te([{entityType:o,entityId:d,anchorKey:c??null},...ne])}),onSuccess:async()=>{q(""),A(!1),K([]),$({entityType:"goal",entityId:""}),P([]),z(""),F(""),M("days"),await G()}}),ke=X({mutationFn:async({noteId:t,contentMarkdown:r,links:i,tags:a,destroyAt:h})=>st(t,{contentMarkdown:r,links:i,tags:a,destroyAt:h}),onSuccess:async()=>{Q(null),B(""),N(!1),O([]),U({entityType:"goal",entityId:""}),k([]),C(""),S(""),D("days"),await G()}}),Ge=X({mutationFn:async t=>at(t),onSuccess:G}),J=l.useMemo(()=>{var r;return(((r=g.data)==null?void 0:r.notes)??[]).filter(i=>c===void 0?!0:i.links.some(a=>a.entityType===o&&a.entityId===d&&((a.anchorKey??null)===c||p&&(a.anchorKey??null)===null))).filter(i=>{const a=I.trim().toLowerCase();return a?`${i.contentPlain} ${i.author??""} ${(i.tags??[]).join(" ")}`.toLowerCase().includes(a):!0})},[c,d,o,p,(Ae=g.data)==null?void 0:Ae.notes,I]),Je=(t,r,i)=>{const a=t.entityId.trim();return a?(r(te([...i,{entityType:t.entityType,entityId:a,anchorKey:null}])),!0):!1},W=t=>{var i,a;const r=(i=R[t.entityType])==null?void 0:i.find(h=>h.id===t.entityId);return(a=r==null?void 0:r.label)!=null&&a.trim()?r.label.trim():`Deleted ${f(t.entityType)}`},Ce=(t,r,i,a,h)=>e.jsxs("div",{className:"rounded-[20px] bg-white/[0.03] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Linked entities"}),e.jsxs(j,{className:"bg-white/[0.08] text-white/68",children:[t.length," linked"]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:t.map(n=>{const _=t.length>1;return e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full bg-white/[0.08] px-3 py-2 text-sm text-white/72",children:[e.jsxs("span",{children:[f(n.entityType)," · ",W(n)]}),n.anchorKey?e.jsx("span",{className:"rounded-full bg-white/[0.08] px-2 py-0.5 text-[11px] text-white/54",children:Y(n.anchorKey)}):null,e.jsx("button",{type:"button",disabled:!_,className:"text-white/44 transition hover:text-white disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>r(t.filter(T=>!jt(T,n))),"aria-label":`Remove ${f(n.entityType)} link to ${W(n)}`,children:e.jsx(Pe,{className:"size-3.5"})})]},`${h}-${n.entityType}-${n.entityId}-${n.anchorKey??""}`)})}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-[minmax(0,11rem)_minmax(0,1fr)_auto]",children:[e.jsx("select",{className:"rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.entityType,onChange:n=>a({...i,entityType:n.target.value,entityId:""}),children:["goal","project","task","strategy","habit","tag","note","psyche_value","behavior_pattern","behavior","belief_entry","mode_profile","mode_guide_session","flashcard","event_type","emotion_definition","trigger_report"].map(n=>e.jsx("option",{value:n,children:f(n)},n))}),e.jsxs("select",{className:"min-w-0 rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.entityId,onChange:n=>a({...i,entityId:n.target.value}),children:[e.jsx("option",{value:"",children:(R[i.entityType]??[]).length>0?"Choose linked item":"No linked items available"}),(R[i.entityType]??[]).map(n=>e.jsx("option",{value:n.id,children:n.label},n.id))]}),e.jsx(y,{variant:"secondary",disabled:!i.entityId,onClick:()=>{Je(i,r,t)&&a({...i,entityId:""})},children:"Add link"})]})]});return e.jsx(it,{id:"notes",className:se?"min-w-0 overflow-hidden p-0":"min-w-0 overflow-hidden",children:e.jsxs("div",{className:se?"p-4":void 0,children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:Qe}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/60",children:Be}),H?e.jsxs("div",{className:"mt-3 inline-flex items-center gap-2 rounded-full bg-white/[0.05] px-3 py-2 text-xs text-white/64",children:[e.jsxs("span",{children:["Pinned to ",H]}),xe?e.jsx(nt,{content:xe,label:`Explain ${H}`}):null]}):null]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(j,{className:"bg-white/[0.08] text-white/72",children:rt(J.length)}),ae?null:e.jsxs(y,{type:"button",size:"sm",onClick:()=>E(!0),children:[e.jsx($e,{className:"size-4"}),"Add note"]})]})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-2 rounded-[22px] border border-white/8 bg-white/[0.04] px-3 py-3",children:[e.jsx(We,{className:"size-4 text-white/34"}),e.jsx(w,{value:I,onChange:t=>Oe(t.target.value),placeholder:"Search notes by content, author, or note tag",className:"border-0 bg-transparent px-0 py-0"})]}),ae?e.jsxs("div",{className:"mt-4 rounded-[24px] border border-white/8 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/70",children:[e.jsx($e,{className:"size-4 text-[var(--secondary)]"}),"Add note"]}),e.jsxs(y,{type:"button",variant:"secondary",size:"sm",className:"gap-2",onClick:()=>A(t=>!t),children:[e.jsx(Ke,{className:"size-4"}),ie?"Back to editor":"Preview"]})]}),e.jsx("div",{className:"mt-3",children:ie?e.jsxs("div",{className:"rounded-[20px] bg-[rgba(9,14,25,0.78)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Preview"}),e.jsx("div",{className:"mt-3",children:v.trim()?e.jsx(Z,{markdown:v}):e.jsx("div",{className:"text-sm leading-6 text-white/42",children:"Markdown preview appears here once you have note content."})})]}):e.jsx(ze,{value:v,onChange:t=>q(t.target.value),placeholder:"Write in Markdown. Summaries, blockers, what changed, and why all work well here.",className:"min-h-[12rem]"})}),e.jsx("div",{className:"mt-3",children:Ce(te([{entityType:o,entityId:d,anchorKey:c??null},...ne]),t=>K(t.filter(r=>!(r.entityType===o&&r.entityId===d&&(r.anchorKey??null)===(c??null)))),Ue,$,"composer-note-links")}),e.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(Fe,{value:re,onChange:P}),e.jsxs("div",{className:"grid gap-3 rounded-[20px] bg-white/[0.03] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-white/46",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(w,{type:"datetime-local",value:le,onChange:t=>z(t.target.value)}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(w,{type:"number",min:"1",value:oe,onChange:t=>F(t.target.value),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-white/10 bg-white/[0.04] px-3 py-3 text-sm text-white",value:de,onChange:t=>M(t.target.value),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap justify-end gap-2",children:[e.jsx(y,{type:"button",variant:"secondary",onClick:()=>{E(!1),A(!1),q(""),K([]),$({entityType:"goal",entityId:""}),P([]),z(""),F(""),M("days")},children:"Cancel"}),e.jsx(y,{pending:Ne.isPending,pendingLabel:"Saving",disabled:v.trim().length===0,onClick:async()=>{await Ne.mutateAsync(v.trim()),E(!1)},children:"Save note"})]})]}):null,e.jsxs("div",{className:"mt-4 grid gap-3",children:[g.isLoading?e.jsx("div",{className:"rounded-[20px] bg-white/[0.04] p-4 text-sm text-white/56",children:"Loading notes…"}):null,!g.isLoading&&J.length===0?e.jsx("div",{className:"rounded-[20px] bg-white/[0.04] p-4 text-sm text-white/56",children:"No notes are linked here yet."}):null,J.map(t=>{const r=He===t.id,i=bt(t,o,d);return e.jsxs("article",{className:"rounded-[24px] border border-white/8 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-xs uppercase tracking-[0.16em] text-white/38",children:[(t.author??"Unknown author").toString()," •"," ",new Date(t.updatedAt).toLocaleString()]}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[i.map(a=>e.jsxs(j,{className:"bg-white/[0.08] text-white/68",wrap:!0,children:[f(a.entityType)," ·"," ",W(a),a.anchorKey?` · ${Y(a.anchorKey)}`:""]},`${t.id}-${a.entityType}-${a.entityId}-${a.anchorKey??""}`)),(t.tags??[]).map(a=>e.jsx(j,{className:"bg-cyan-400/10 text-cyan-50",wrap:!0,children:a},`${t.id}-tag-${a}`)),t.destroyAt?e.jsxs(j,{className:"bg-amber-400/10 text-amber-100",wrap:!0,children:["Ephemeral · deletes"," ",new Date(t.destroyAt).toLocaleString()]}):null]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",className:"inline-flex size-9 items-center justify-center rounded-full bg-white/[0.06] text-white/60 transition hover:bg-white/[0.1] hover:text-white",onClick:()=>{Q(t.id),B(t.contentMarkdown),N(!1),O(t.links),U({entityType:"goal",entityId:""}),k(ee(t.tags??[])),C(yt(t.destroyAt??null)),S(""),D("days")},children:e.jsx(Xe,{className:"size-4"})}),e.jsx("button",{type:"button",className:"inline-flex size-9 items-center justify-center rounded-full bg-rose-500/10 text-rose-200 transition hover:bg-rose-500/16",onClick:()=>{Ge.mutateAsync(t.id)},children:e.jsx(Pe,{className:"size-4"})})]})]}),r?e.jsxs("div",{className:"mt-4",children:[e.jsx("div",{className:"flex flex-wrap items-center justify-end gap-2",children:e.jsxs(y,{type:"button",variant:"secondary",size:"sm",className:"gap-2",onClick:()=>N(a=>!a),children:[e.jsx(Ke,{className:"size-4"}),ce?"Back to editor":"Preview"]})}),e.jsx("div",{className:"mt-3",children:ce?e.jsxs("div",{className:"rounded-[20px] bg-[rgba(9,14,25,0.78)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Preview"}),e.jsx("div",{className:"mt-3",children:b.trim()?e.jsx(Z,{markdown:b}):e.jsx("div",{className:"text-sm text-white/42",children:"No content yet."})})]}):e.jsx(ze,{value:b,onChange:a=>B(a.target.value),className:"min-h-[12rem]"})}),e.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(Fe,{value:me,onChange:k}),e.jsxs("div",{className:"grid gap-3 rounded-[20px] bg-white/[0.03] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-white/46",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(w,{type:"datetime-local",value:ue,onChange:a=>C(a.target.value)}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(w,{type:"number",min:"1",value:pe,onChange:a=>S(a.target.value),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-white/10 bg-white/[0.04] px-3 py-3 text-sm text-white",value:he,onChange:a=>D(a.target.value),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsx("div",{className:"mt-3",children:Ce(V,O,Re,U,`edit-note-links-${t.id}`)}),e.jsxs("div",{className:"mt-3 flex flex-wrap justify-end gap-2",children:[e.jsx(y,{variant:"secondary",onClick:()=>{Q(null),N(!1),k([]),C(""),S(""),D("days")},children:"Cancel"}),e.jsx(y,{pending:ke.isPending,pendingLabel:"Saving",disabled:b.trim().length===0||V.length===0,onClick:async()=>{await ke.mutateAsync({noteId:t.id,contentMarkdown:b.trim(),links:V,tags:ee(me),destroyAt:Me(ue,pe,he)})},children:"Save changes"})]})]}):e.jsx("div",{className:"mt-4",children:e.jsx(Z,{markdown:t.contentMarkdown})})]},t.id)})]})]})})}export{St as E};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as N,bg as Ke,ce as Qe,cb as Xe,cv as be,j as t,c7 as ve,b2 as pt,ca as Ze,cw as Fe,cx as Ye,bC as ht,bB as ft,c9 as gt,aO as bt,aP as we,bo as Ue,cy as wt}from"./vendor-DHkYh85p.js";import{u as jt,a as vt,D as yt,S as Pe,v as Ve,e as Nt,p as kt,f as St,P as _t,g as Te,b as et,C as tt}from"./board-BkDRaMp6.js";import{P as ye,C as it,B as qe,Z as W,_ as It,aR as at,b as le,c as S,V as nt,U as je}from"./index-BHTUu_4M.js";import{E as Ct}from"./entity-note-count-link-BmGDB572.js";import{F as zt}from"./floating-action-menu-CJkI2iFy.js";function Dt(e){if(typeof e=="number"&&Number.isInteger(e)&&e>0)return e;if(typeof e=="string"){const a=e.match(/(\d+)/);if(a){const l=Number.parseInt(a[1]??"",10);return Number.isInteger(l)&&l>0?l:null}}return null}function Ge(e){return e.split(/\r?\n/).map(a=>a.trim()).reduce((a,l)=>{const o=l.match(/^[-*+]\s+\[([ xX])\]\s+(.+)$/);if(o)return a.push({label:o[2].trim(),completed:o[1].toLowerCase()==="x"}),a;const c=l.match(/^(?:[-*+]|\d+\.)\s+(.+)$/);return c&&a.push({label:c[1].trim(),completed:null}),a},[]).filter(a=>a.label.length>0)}function $t(e){if(e.acceptanceCriteria.length>0)return{total:e.acceptanceCriteria.length,completed:e.status==="done"?e.acceptanceCriteria.length:0,source:"acceptance_criteria",items:e.acceptanceCriteria};const a=Ge(e.aiInstructions);if(a.length>0){const o=e.status==="done"?a.length:a.filter(c=>c.completed===!0).length;return{total:a.length,completed:o,source:"ai_instructions",items:a.map(c=>c.label)}}const l=Ge(e.description);if(l.length>0){const o=e.status==="done"?l.length:l.filter(c=>c.completed===!0).length;return{total:l.length,completed:o,source:"description",items:l.map(c=>c.label)}}return null}function He(e,a){return e.find(l=>l.refType===a)??null}function st(e,a=null){var x,h,j,D,k,I,$,U,B,M,E;const l=new Set(((x=e.completionReport)==null?void 0:x.linkedGitRefIds)??[]),o=He(e.gitRefs,"branch"),c=He(e.gitRefs,"pull_request"),u=(a==null?void 0:a.gitContext)??null,m=(u==null?void 0:u.pullRequestNumber)??Dt((c==null?void 0:c.refValue)??(c==null?void 0:c.displayTitle)??null);return{actor:(a==null?void 0:a.actor)??null,activeRun:a,stepSummary:$t(e),changedFileCount:((h=e.completionReport)==null?void 0:h.modifiedFiles.length)??0,changedFilesPreview:(((j=e.completionReport)==null?void 0:j.modifiedFiles)??[]).slice(0,2),git:{provider:((D=u==null?void 0:u.provider)==null?void 0:D.trim())||((k=o==null?void 0:o.provider)==null?void 0:k.trim())||((I=c==null?void 0:c.provider)==null?void 0:I.trim())||null,repository:(($=u==null?void 0:u.repository)==null?void 0:$.trim())||((U=o==null?void 0:o.repository)==null?void 0:U.trim())||((B=c==null?void 0:c.repository)==null?void 0:B.trim())||null,branch:((M=u==null?void 0:u.branch)==null?void 0:M.trim())||((E=o==null?void 0:o.refValue)==null?void 0:E.trim())||null,branchUrl:(u==null?void 0:u.branchUrl)??(o==null?void 0:o.url)??null,pullRequestNumber:m,pullRequestUrl:(u==null?void 0:u.pullRequestUrl)??(c==null?void 0:c.url)??null,compareUrl:(u==null?void 0:u.compareUrl)??null,linkedRefCount:l.size}}}const _=["backlog","focus","in_progress","blocked","done"];function Bt({task:e,onOpenTask:a,onEditTask:l,onLinkTask:o,onCreateTaskForIssue:c,onCreateSubtaskForTask:u,onMove:m,onDeleteTask:x,deletePendingTaskId:h,onRequestDelete:j}){const D=e.level==="issue"?{id:"create-task",label:"Create task",description:"Add a focused execution task under this issue.",icon:be,onSelect:()=>c==null?void 0:c(e.id)}:e.level==="task"?{id:"create-subtask",label:"Create subtask",description:"Add a granular child step under this task.",icon:be,onSelect:()=>u==null?void 0:u(e.id)}:null;return[{id:"open-task",label:"Open",description:"Jump to the work-item detail view.",icon:Ke,onSelect:()=>a==null?void 0:a(e.id)},{id:"edit-task",label:"Edit",description:"Open the guided work-item editor.",icon:Qe,onSelect:()=>l==null?void 0:l(e.id)},{id:"link-task",label:"Link",description:"Open the placement step to relink this work item.",icon:Xe,onSelect:()=>o==null?void 0:o(e.id)},...D?[D]:[],{id:"delete-task",label:e.level==="issue"?"Delete issue":e.level==="subtask"?"Delete subtask":"Delete task",description:"Remove this work item directly from the board menu.",icon:ve,tone:"danger",disabled:!x||h===e.id,onSelect:()=>j(e)},..._.filter(k=>k!==e.status).map(k=>({id:`move-task-${k}`,label:`Move to ${k.replaceAll("_"," ")}`,description:"Update the workflow lane for this work item.",onSelect:()=>void m(e.id,k)}))]}function rt(e){return e.startsWith("lane:")||e.includes(":lane:")}function Mt(e){var a,l;return((l=(a=e.data)==null?void 0:a.current)==null?void 0:l.type)==="lane"||rt(String(e.id))}function At(e){var a,l;return((l=(a=e.data)==null?void 0:a.current)==null?void 0:l.type)==="trash"}function Lt(e,a){const l=Math.max(0,Math.min(e.right,a.right)-Math.max(e.left,a.left)),o=Math.max(0,Math.min(e.bottom,a.bottom)-Math.max(e.top,a.top));return l*o}const Rt=e=>{const a=kt(e),l=a.find(m=>{const x=e.droppableContainers.find(h=>h.id===m.id);return x?At(x):!1});if(l)return[l];const o=a.find(m=>rt(String(m.id)));if(o)return[o];const u=e.droppableContainers.filter(m=>Mt(m)).map(m=>{const x=e.droppableRects.get(m.id);if(!x)return null;const h=Lt(e.collisionRect,x);return h<=0?null:{id:m.id,data:{droppableContainer:m,value:h}}}).filter(Boolean).sort((m,x)=>{var h,j;return(((h=x==null?void 0:x.data)==null?void 0:h.value)??0)-(((j=m==null?void 0:m.data)==null?void 0:j.value)??0)});return u.length>0?u:a.length>0?a:St(e)};function Et(e,a){return a&&a.trim().length>0?a:e!=null&&e.actor?`${e.actor} session`:"Active work"}function Ot(e,a){return[(e==null?void 0:e.actor)??null,a].filter(Boolean).join(" · ")}function We(e){e.preventDefault(),e.stopPropagation()}function lt({task:e,goal:a,tags:l,activeRun:o,isSelected:c,isDragging:u=!1,isOverlay:m=!1,style:x,setNodeRef:h,dragAttributes:j,dragListeners:D,isMobile:k=!1,onSelect:I,onStartTask:$,onStopTask:U,onQuickReopen:B,onStepTask:M,onSplitTask:E,onOpenMenu:G,notesSummaryByEntity:C}){var X;const{t:ee,formatDate:ne}=ye(),v=st(e,o??null),z=v.stepSummary,b=_[_.indexOf(e.status)-1]??null,A=_[_.indexOf(e.status)+1]??null,oe=It(C,"task",e.id).count,L=e.level==="issue"?"issue":"task",ce=at(L),te=e.level==="subtask"?"136,146,255":ce.colorToken.rgb.join(", "),P=e.dueDate&&!Number.isNaN(Date.parse(e.dueDate))?ne(e.dueDate):"No due date",J=z&&z.total>0?Math.max(8,Math.round(z.completed/z.total*100)):null,g=v.git.branch,K=v.git.branchUrl,V=v.git.pullRequestNumber?`PR #${v.git.pullRequestNumber}`:null,Q=v.git.pullRequestUrl;return t.jsxs("article",{ref:h,style:{...x,"--board-card-accent":te},className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[18px] p-3 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.12)] transition cursor-grab active:cursor-grabbing",k&&"touch-none select-none",m&&"rotate-[0.5deg] bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.22),rgba(var(--board-card-accent),0.08))] shadow-[0_28px_80px_rgba(8,12,24,0.42),inset_0_0_0_1px_rgba(var(--board-card-accent),0.28)]",u&&!m&&"opacity-35 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.08)]",c?"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.18),rgba(var(--board-card-accent),0.06))] shadow-[0_16px_40px_rgba(8,12,24,0.32),inset_0_0_0_1px_rgba(var(--board-card-accent),0.26)]":"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.08),rgba(255,255,255,0.03))]"),"data-dragging":u?"true":"false","data-testid":`task-card-${e.id}`,onClick:()=>I(e.id),...j,...D,children:[t.jsx("div",{className:"mb-3 h-px w-full rounded-full",style:{background:`linear-gradient(90deg, rgba(${te}, 0.96), rgba(${te}, 0.18))`}}),t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[t.jsx(le,{kind:L,label:e.level,compact:!0,size:"xs",gradient:!1,className:"shrink-0"}),t.jsx(S,{size:"xs",className:"shrink-0 text-[10px] text-[var(--tertiary)]",children:e.priority}),v.actor?t.jsxs(S,{size:"xs",className:"shrink-0 bg-cyan-400/12 text-cyan-100",children:[t.jsx(pt,{className:"mr-1 size-3"}),v.actor]}):null]}),t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[G?t.jsx("button",{type:"button","aria-label":`Open ${e.title} actions`,className:"inline-flex size-8 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white",onClick:f=>{f.preventDefault(),f.stopPropagation(),G(f,e)},children:t.jsx(Ze,{className:"size-3.5"})}):null,k?t.jsxs("div",{className:"flex items-center gap-1",onClick:f=>f.stopPropagation(),children:[t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the previous lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white disabled:opacity-35",disabled:!b,onClick:()=>{b&&(M==null||M(e.id,"previous"))},children:t.jsx(Fe,{className:"size-3.5"})}),t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the next lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white disabled:opacity-35",disabled:!A,onClick:()=>{A&&(M==null||M(e.id,"next"))},children:t.jsx(Ye,{className:"size-3.5"})})]}):null,o?t.jsx("button",{type:"button","aria-label":`Stop work on ${e.title}`,className:"inline-flex size-8 items-center justify-center rounded-full bg-rose-500/16 text-rose-200 transition hover:bg-rose-500/24",onClick:f=>{f.preventDefault(),f.stopPropagation(),U==null||U(o)},children:t.jsx(ht,{className:"size-3.5 fill-current"})}):e.status!=="done"?t.jsx("button",{type:"button","aria-label":`Start work on ${e.title}`,className:"inline-flex size-8 items-center justify-center rounded-full bg-[var(--primary)]/16 text-[var(--primary)] transition hover:bg-[var(--primary)]/24",onClick:f=>{f.preventDefault(),f.stopPropagation(),$==null||$(e.id)},children:t.jsx(ft,{className:"size-4 fill-current"})}):null,(X=e.splitSuggestion)!=null&&X.shouldSplit&&E?t.jsxs("button",{type:"button","aria-label":`Split ${e.title}`,className:"inline-flex items-center gap-1 rounded-full bg-amber-400/12 px-2.5 py-1 text-[10px] font-medium tracking-[0.14em] text-amber-100 transition hover:bg-amber-400/18",onClick:f=>{f.preventDefault(),f.stopPropagation(),E(e.id)},children:[t.jsx(gt,{className:"size-3.5"}),"Split it"]}):null,t.jsxs("span",{className:"shrink-0 text-[11px] text-white/44",children:[e.points," xp"]})]})]}),t.jsx(nt,{kind:L,label:e.title,className:"max-w-full",lines:3,labelClassName:"[overflow-wrap:anywhere]"}),t.jsx("p",{className:"mt-1.5 line-clamp-3 [overflow-wrap:anywhere] text-[12px] leading-5 text-white/62",children:e.description||ee("common.executionBoard.noExecutionNote")}),z?t.jsxs("div",{className:"mt-3 rounded-[16px] border border-white/8 bg-white/[0.045] p-3",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] text-white/58",children:[t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(bt,{className:"size-3.5 text-sky-200"}),z.total," step",z.total===1?"":"s"]}),t.jsxs("span",{className:"tabular-nums text-white/72",children:[z.completed,"/",z.total]})]}),t.jsx("div",{className:"mt-2 h-1.5 overflow-hidden rounded-full bg-white/8",children:t.jsx("div",{className:"h-full rounded-full bg-[linear-gradient(90deg,rgba(56,189,248,0.96),rgba(125,211,252,0.62))]",style:{width:`${J??0}%`}})}),t.jsx("div",{className:"mt-2 grid gap-1.5",children:z.items.slice(0,2).map(f=>t.jsx("div",{className:"truncate text-[11px] text-white/55",children:f},`${e.id}-${f}`))})]}):null,t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[g?K?t.jsxs("a",{href:K,target:"_blank",rel:"noreferrer",className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-sky-300/18 bg-sky-400/12 px-2.5 py-1 text-[11px] text-sky-50 transition hover:bg-sky-400/18",onClick:We,children:[t.jsx(we,{className:"size-3.5 shrink-0"}),t.jsx("span",{className:"truncate",children:g})]}):t.jsxs(S,{size:"xs",className:"min-w-0 max-w-full bg-sky-400/12 text-sky-50",children:[t.jsx(we,{className:"mr-1 size-3"}),t.jsx("span",{className:"truncate",children:g})]}):null,V?Q?t.jsxs("a",{href:Q,target:"_blank",rel:"noreferrer",className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-fuchsia-300/18 bg-fuchsia-400/12 px-2.5 py-1 text-[11px] text-fuchsia-50 transition hover:bg-fuchsia-400/18",onClick:We,children:[t.jsx(Ue,{className:"size-3.5 shrink-0"}),t.jsx("span",{className:"truncate",children:V})]}):t.jsxs(S,{size:"xs",className:"bg-fuchsia-400/12 text-fuchsia-50",children:[t.jsx(Ue,{className:"mr-1 size-3"}),V]}):null,v.changedFileCount>0?t.jsxs(S,{size:"xs",className:"bg-amber-400/12 text-amber-50",children:[t.jsx(wt,{className:"mr-1 size-3"}),v.changedFileCount," file",v.changedFileCount===1?"":"s"]}):null,v.git.repository?t.jsx(S,{size:"xs",className:"bg-white/8 text-white/70",children:v.git.repository}):null]}),v.changedFilesPreview.length>0?t.jsx("div",{className:"mt-2 flex min-w-0 flex-wrap gap-1.5",children:v.changedFilesPreview.map(f=>t.jsx(S,{size:"xs",wrap:!0,className:"min-w-0 max-w-full bg-white/[0.06] font-mono text-[10px] text-white/65",children:f},f))}):null,t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[a?t.jsx(le,{kind:"goal",label:a.title,compact:!0,size:"xs",wrap:!0,className:"min-w-0 max-w-full"}):null,t.jsx(je,{user:e.user,compact:!0,size:"xs"}),t.jsx(Ct,{entityType:"task",entityId:e.id,count:oe,compact:!0}),e.actionPointSummary?t.jsxs(S,{size:"xs",className:"bg-[var(--primary)]/12 text-[var(--primary)]",children:[Math.round(e.actionPointSummary.totalCostAp)," AP"]}):null,e.actionPointSummary?t.jsx(S,{size:"xs",className:"bg-white/8 text-white/72",children:e.actionPointSummary.costBand}):null,e.actionPointSummary?t.jsxs(S,{size:"xs",className:"bg-white/8 text-white/72",children:[Math.round(e.actionPointSummary.expectedDurationSeconds/3600)," h target"]}):null,e.time.totalCreditedSeconds>0?t.jsxs(S,{size:"xs",className:"bg-white/8 text-white/72",children:[Math.floor(e.time.totalCreditedSeconds/60)," min"]}):null,e.time.activeRunCount>0?t.jsxs(S,{size:"xs",className:"bg-emerald-500/12 text-emerald-200",children:[e.time.activeRunCount," live"]}):null,l.slice(0,2).map(f=>t.jsx(S,{size:"xs",className:"bg-white/8",style:{color:f.color},children:f.name},f.id))]}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 items-center justify-between gap-2 text-[11px] text-white/45",children:[t.jsxs("span",{className:"min-w-0 truncate",children:[e.effort," / ",e.energy]}),t.jsxs("div",{className:"flex min-w-0 shrink-0 items-center gap-2 text-right",children:[e.status==="done"&&B?t.jsx("button",{type:"button",className:"rounded-full bg-white/8 px-3 py-1 text-[10px] tracking-[0.16em] text-white transition hover:bg-white/12",onClick:f=>{f.preventDefault(),f.stopPropagation(),B(e.id)},children:ee("common.executionBoard.reopen")}):null,t.jsx("span",{children:P})]})]})]})}function fe(e){const{task:a,sortableId:l}=e,{attributes:o,listeners:c,setNodeRef:u,transform:m,transition:x,isDragging:h}=et({id:l,data:{type:"task",taskId:a.id,status:a.status}});return t.jsx(lt,{...e,setNodeRef:u,dragAttributes:o,dragListeners:c,isDragging:h,isMobile:e.isMobile,onStartTask:e.onStartTask,onStopTask:e.onStopTask,onStepTask:e.onStepTask,onSplitTask:e.onSplitTask,notesSummaryByEntity:e.notesSummaryByEntity,style:{transform:tt.Transform.toString(m),transition:x}})}function ot({project:e,goal:a,isDragging:l=!1,isOverlay:o=!1,style:c,setNodeRef:u,dragAttributes:m,dragListeners:x,isMobile:h=!1,onStepProject:j,onOpenMenu:D}){const{formatDate:k}=ye(),I=_[_.indexOf(e.workflowStatus)-1]??null,$=_[_.indexOf(e.workflowStatus)+1]??null,B=at("project").colorToken.rgb.join(", "),M=e.workflowStatus.replaceAll("_"," "),E=e.status.replaceAll("_"," "),G=e.updatedAt&&!Number.isNaN(Date.parse(e.updatedAt))?k(e.updatedAt):"No recent update";return t.jsxs("article",{ref:u,style:{...c,"--board-card-accent":B},className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[18px] p-3 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.12)] transition cursor-grab active:cursor-grabbing",h&&"touch-none select-none",o&&"rotate-[0.5deg] bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.22),rgba(var(--board-card-accent),0.08))] shadow-[0_28px_80px_rgba(8,12,24,0.42),inset_0_0_0_1px_rgba(var(--board-card-accent),0.28)]",l&&!o&&"opacity-35 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.08)]",!l&&!o&&"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.08),rgba(255,255,255,0.03))]"),"data-testid":`project-card-${e.id}`,...m,...x,children:[t.jsx("div",{className:"mb-3 h-px w-full rounded-full",style:{background:`linear-gradient(90deg, rgba(${B}, 0.96), rgba(${B}, 0.18))`}}),t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[t.jsx(le,{kind:"project",label:"project",compact:!0,size:"xs",gradient:!1,className:"shrink-0"}),t.jsx(S,{size:"xs",className:"shrink-0 bg-[var(--primary)]/12 text-[var(--primary)]",children:M}),t.jsx(S,{size:"xs",className:"shrink-0 bg-white/8 text-white/72",children:E})]}),t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[D?t.jsx("button",{type:"button","aria-label":`Open ${e.title} actions`,className:"inline-flex size-8 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white",onClick:C=>{C.preventDefault(),C.stopPropagation(),D(C,e)},children:t.jsx(Ze,{className:"size-3.5"})}):null,h?t.jsxs("div",{className:"flex items-center gap-1",onClick:C=>C.stopPropagation(),children:[t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the previous lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white disabled:opacity-35",disabled:!I,onClick:()=>{I&&(j==null||j(e.id,"previous"))},children:t.jsx(Fe,{className:"size-3.5"})}),t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the next lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white disabled:opacity-35",disabled:!$,onClick:()=>{$&&(j==null||j(e.id,"next"))},children:t.jsx(Ye,{className:"size-3.5"})})]}):null]})]}),t.jsx(nt,{kind:"project",label:e.title,className:"max-w-full",lines:3,labelClassName:"[overflow-wrap:anywhere]"}),t.jsx("p",{className:"mt-1.5 line-clamp-3 [overflow-wrap:anywhere] text-[12px] leading-5 text-white/62",children:e.description||"PRD-backed initiative spanning multiple work items."}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[a?t.jsx(le,{kind:"goal",label:a.title,compact:!0,size:"xs",wrap:!0,className:"min-w-0 max-w-full"}):null,t.jsx(je,{user:e.user,compact:!0,size:"xs"}),(e.assignees??[]).slice(0,2).map(C=>t.jsx(je,{user:C,compact:!0,size:"xs"},C.id)),t.jsxs(S,{size:"xs",className:"bg-[var(--primary)]/12 text-[var(--primary)]",children:[e.progress,"% progress"]}),t.jsxs(S,{size:"xs",className:"bg-white/8 text-white/72",children:[e.totalTasks," linked tasks"]})]}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 items-center justify-between gap-2 text-[11px] text-white/45",children:[t.jsx("span",{className:"min-w-0 truncate",children:e.goalTitle}),t.jsx("span",{children:G})]})]})}function ge(e){const{project:a,sortableId:l}=e,{attributes:o,listeners:c,setNodeRef:u,transform:m,transition:x,isDragging:h}=et({id:l,data:{type:"project",projectId:a.id,status:a.workflowStatus}});return t.jsx(ot,{...e,setNodeRef:u,dragAttributes:o,dragListeners:c,isDragging:h,style:{transform:tt.Transform.toString(m),transition:x}})}function Je({droppableId:e,status:a,title:l,detail:o,count:c,dragging:u,children:m}){const{setNodeRef:x,isOver:h}=Te({id:e,data:{type:"lane",status:a}});return t.jsx("div",{ref:x,className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[24px] transition",h&&"scale-[1.005]"),"data-lane-id":a,"data-testid":`kanban-lane-${a}`,"data-lane-hover":h?"true":"false",children:t.jsxs(it,{className:W("h-full w-full max-w-full min-w-0 overflow-hidden p-3 transition-[background-color,box-shadow,border-color,transform]",u&&"border border-white/8",h?"border border-[rgba(125,211,252,0.38)] bg-[linear-gradient(180deg,rgba(125,211,252,0.12),rgba(125,211,252,0.05))] shadow-[0_18px_54px_rgba(14,165,233,0.12)]":"border border-transparent"),children:[t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"type-label text-white/45",children:o}),t.jsx("h3",{className:"mt-1 break-words text-[1.45rem] leading-[1] text-white",children:l})]}),t.jsx("div",{className:"shrink-0 font-display text-[1.45rem] text-[var(--primary)]",children:c})]}),t.jsx("div",{className:W("grid w-full max-w-full min-w-0 min-h-48 content-start gap-2 rounded-[18px] p-2 transition",h?"bg-[rgba(125,211,252,0.08)]":"bg-white/[0.02]"),children:m})]})})}function Ut({title:e,detail:a,children:l}){return t.jsxs("div",{className:"rounded-[20px] border border-cyan-300/20 bg-[linear-gradient(180deg,rgba(34,211,238,0.11),rgba(11,23,34,0.34))] p-2.5 shadow-[inset_0_0_0_1px_rgba(34,211,238,0.08)]",children:[t.jsx("div",{className:"mb-2 flex items-start justify-between gap-3 px-1",children:t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.16em] text-cyan-100/86",children:[t.jsx(we,{className:"size-3.5"}),t.jsx("span",{className:"truncate",children:e})]}),a?t.jsx("div",{className:"mt-1 text-[11px] text-white/45",children:a}):null]})}),t.jsx("div",{className:"grid gap-2",children:l})]})}function Pt({droppableId:e,title:a,detail:l}){const{setNodeRef:o,isOver:c}=Te({id:e,data:{type:"trash"}});return t.jsx("div",{ref:o,className:W("pointer-events-auto fixed right-4 top-4 z-50 w-[min(18rem,calc(100vw-2rem))] rounded-[28px] border px-5 py-4 shadow-[0_24px_80px_rgba(6,10,20,0.48)] backdrop-blur-2xl transition lg:right-6 lg:top-6",c?"border-rose-300/38 bg-[linear-gradient(180deg,rgba(244,63,94,0.28),rgba(120,24,42,0.46))] text-white scale-[1.02]":"border-white/10 bg-[linear-gradient(180deg,rgba(18,24,38,0.96),rgba(10,14,24,0.94))] text-white/84"),"data-testid":"kanban-trash-dropzone","data-trash-hover":c?"true":"false",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:W("flex size-12 items-center justify-center rounded-full border transition",c?"border-white/28 bg-white/12":"border-white/12 bg-white/6"),children:t.jsx(ve,{className:"size-5"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-white/55",children:"Bin"}),t.jsx("div",{className:"mt-1 text-base font-medium text-white",children:a}),t.jsx("div",{className:"mt-1 text-sm leading-5 text-white/62",children:l})]})]})})}function Jt({tasks:e,projects:a=[],activeRuns:l=[],goals:o,tags:c,selectedTaskId:u,onMove:m,onMoveProject:x,onSelectTask:h,onStartTask:j,onStopTask:D,onQuickReopenTask:k,onDeleteTask:I,onOpenProject:$,onOpenTask:U,onEditProject:B,onEditTask:M,onLinkProject:E,onLinkTask:G,onCreateIssueForProject:C,onCreateTaskForIssue:ee,onCreateSubtaskForTask:ne,onSplitTask:v,notesSummaryByEntity:z}){var $e,Be;const{t:b}=ye(),A=N.useId(),oe=`${A}:trash`,[L,ce]=N.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(max-width: 1023px)").matches),te=jt(vt(_t,{activationConstraint:{distance:6}})),[P,J]=N.useState(null),[g,K]=N.useState(null),[V,Q]=N.useState(null),[X,f]=N.useState(null),[Ne,ct]=N.useState(()=>typeof window>"u"?!1:window.localStorage.getItem("forge.kanban-skip-delete-confirmation")==="true"),[ke,se]=N.useState(!1),[Se,Z]=N.useState({}),[_e,ie]=N.useState({}),re={backlog:{title:b("common.executionBoard.laneBacklogTitle"),detail:b("common.executionBoard.laneBacklogDetail")},focus:{title:b("common.executionBoard.laneFocusTitle"),detail:b("common.executionBoard.laneFocusDetail")},in_progress:{title:b("common.executionBoard.laneProgressTitle"),detail:b("common.executionBoard.laneProgressDetail")},blocked:{title:b("common.executionBoard.laneBlockedTitle"),detail:b("common.executionBoard.laneBlockedDetail")},done:{title:b("common.executionBoard.laneDoneTitle"),detail:b("common.executionBoard.laneDoneDetail")}},F=N.useMemo(()=>e.map(i=>{const n=Se[i.id];return n?{...i,status:n}:i}),[Se,e]),Y=N.useMemo(()=>a.map(i=>{const n=_e[i.id];return n?{...i,workflowStatus:n}:i}),[_e,a]),Ie=N.useMemo(()=>{const i=new Map;for(const n of l){if(n.status!=="active")continue;const s=i.get(n.taskId);(!s||n.isCurrent||n.updatedAt>s.updatedAt)&&i.set(n.taskId,n)}return i},[l]),H=N.useMemo(()=>[...Y.map(i=>({kind:"project",id:i.id,status:i.workflowStatus,project:i,goal:o.find(n=>n.id===i.goalId)})),...F.map(i=>({kind:"task",id:i.id,status:i.status,task:i,goal:o.find(n=>n.id===i.goalId),tags:i.tagIds.map(n=>c.find(s=>s.id===n)).filter(Boolean),activeRun:Ie.get(i.id)??null}))],[Ie,Y,F,o,c]),O=P?H.find(i=>i.id===P)??null:null,dt=N.useMemo(()=>{if(!g)return[];if(g.kind==="project"){const n=Y.find(s=>s.id===g.entityId);return n?[{id:"open-project",label:"Open",description:"Jump to the project detail view.",icon:Ke,onSelect:()=>$==null?void 0:$(n.id)},{id:"edit-project",label:"Edit",description:"Open the guided project editor.",icon:Qe,onSelect:()=>B==null?void 0:B(n.id)},{id:"link-project",label:"Link",description:"Open the anchor step to relink the project to its goal.",icon:Xe,onSelect:()=>E==null?void 0:E(n.id)},{id:"create-issue",label:"Create issue",description:"Break this project into a new vertical slice issue.",icon:be,onSelect:()=>C==null?void 0:C(n.id)},..._.filter(s=>s!==n.workflowStatus).map(s=>({id:`move-project-${s}`,label:`Move to ${s.replaceAll("_"," ")}`,description:"Update the project workflow lane without leaving the board.",onSelect:()=>void(x==null?void 0:x(n.id,s))}))]:[]}const i=F.find(n=>n.id===g.entityId);return i?Bt({task:i,onOpenTask:U,onEditTask:M,onLinkTask:G,onCreateTaskForIssue:ee,onCreateSubtaskForTask:ne,onMove:m,onDeleteTask:I,deletePendingTaskId:X,onRequestDelete:De}):[]},[Y,F,g,C,ne,ee,B,M,E,G,m,x,I,$,U,X,Ne]);function Ce(i){var s;if(i.length===0)return t.jsx("div",{className:"w-full max-w-full rounded-[18px] border border-dashed border-white/8 px-4 py-8 text-center text-sm text-white/35",children:b("common.executionBoard.emptyLane")});if(((s=i[0])==null?void 0:s.status)!=="in_progress")return i.map(d=>d.kind==="task"?t.jsx(fe,{sortableId:`${A}:task:${d.task.id}`,task:d.task,goal:d.goal,tags:d.tags,activeRun:d.activeRun,isSelected:u===d.task.id,isMobile:L,onSelect:h,onStartTask:j,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:v,notesSummaryByEntity:z},d.task.id):t.jsx(ge,{sortableId:`${A}:project:${d.project.id}`,project:d.project,goal:d.goal,isMobile:L,onStepProject:ue,onOpenMenu:xe},d.project.id));const n=new Map;for(const d of i){if(d.kind!=="task"||!d.activeRun){const R=n.get("ungrouped");R?R.items.push(d):n.set("ungrouped",{title:"Active work",detail:"Tasks in progress without a tracked branch",items:[d]});continue}const p=st(d.task,d.activeRun),r=[d.activeRun.actor,p.git.repository??"",p.git.branch??""].join("::"),w=n.get(r);if(w){w.items.push(d);continue}n.set(r,{title:Et(d.activeRun,p.git.branch),detail:Ot(d.activeRun,p.git.repository),items:[d]})}return Array.from(n.entries()).map(([d,p])=>d==="ungrouped"?p.items.map(r=>r.kind==="task"?t.jsx(fe,{sortableId:`${A}:task:${r.task.id}`,task:r.task,goal:r.goal,tags:r.tags,activeRun:r.activeRun,isSelected:u===r.task.id,isMobile:L,onSelect:h,onStartTask:j,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:v,notesSummaryByEntity:z},r.task.id):t.jsx(ge,{sortableId:`${A}:project:${r.project.id}`,project:r.project,goal:r.goal,isMobile:L,onStepProject:ue,onOpenMenu:xe},r.project.id)):t.jsx(Ut,{title:p.title,detail:p.detail,children:p.items.map(r=>r.kind==="task"?t.jsx(fe,{sortableId:`${A}:task:${r.task.id}`,task:r.task,goal:r.goal,tags:r.tags,activeRun:r.activeRun,isSelected:u===r.task.id,isMobile:L,onSelect:h,onStartTask:j,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:v,notesSummaryByEntity:z},r.task.id):t.jsx(ge,{sortableId:`${A}:project:${r.project.id}`,project:r.project,goal:r.goal,isMobile:L,onStepProject:ue,onOpenMenu:xe},r.project.id))},d))}N.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 1023px)"),n=s=>{ce(s?s.matches:i.matches)};return n(),typeof i.addEventListener=="function"?(i.addEventListener("change",n),()=>i.removeEventListener("change",n)):(i.addListener(n),()=>i.removeListener(n))},[]),N.useEffect(()=>{if(!P){document.body.style.cursor="";return}return document.body.style.cursor="grabbing",()=>{document.body.style.cursor=""}},[P]),N.useEffect(()=>{Z(i=>{const n=new Set(e.map(p=>p.id));let s=!1;const d={};for(const[p,r]of Object.entries(i)){const w=e.find(R=>R.id===p);if(!n.has(p)||!w||w.status===r){s=!0;continue}d[p]=r}return s?d:i})},[e]),N.useEffect(()=>{ie(i=>{const n=new Set(a.map(p=>p.id));let s=!1;const d={};for(const[p,r]of Object.entries(i)){const w=a.find(R=>R.id===p);if(!n.has(p)||!w||w.workflowStatus===r){s=!0;continue}d[p]=r}return s?d:i})},[a]);function ut(i){var d,p;const n=(d=i.active.data.current)==null?void 0:d.taskId,s=(p=i.active.data.current)==null?void 0:p.projectId;typeof n=="string"?J(n):typeof s=="string"&&J(s)}const mt=i=>{ct(i),typeof window<"u"&&window.localStorage.setItem("forge.kanban-skip-delete-confirmation","true")},ze=async(i,n)=>{if(I){f(i.id);try{n&&mt(!0),await I(i.id),Q(null),se(!1),Z(s=>{const d={...s};return delete d[i.id],d})}finally{f(null)}}};function De(i){if(I){if(Ne){ze(i,!1);return}se(!1),Q(i)}}async function xt(i){var Me,Ae,Le,Re,Ee,Oe;const{active:n,over:s}=i;if(J(null),!s||n.id===s.id)return;const d=typeof((Me=n.data.current)==null?void 0:Me.taskId)=="string"?n.data.current.taskId:null,p=typeof((Ae=n.data.current)==null?void 0:Ae.projectId)=="string"?n.data.current.projectId:null,r=(d?H.find(y=>y.kind==="task"&&y.id===d):null)??(p?H.find(y=>y.kind==="project"&&y.id===p):null);if(!r)return;if(((Le=s.data.current)==null?void 0:Le.type)==="trash"){if(r.kind!=="task"||!I)return;De(r.task);return}const w=typeof((Re=s.data.current)==null?void 0:Re.status)=="string"?s.data.current.status:null,R=typeof((Ee=s.data.current)==null?void 0:Ee.taskId)=="string"?s.data.current.taskId:null,q=typeof((Oe=s.data.current)==null?void 0:Oe.projectId)=="string"?s.data.current.projectId:null,pe=(R?H.find(y=>y.kind==="task"&&y.id===R):null)??(q?H.find(y=>y.kind==="project"&&y.id===q):null),T=w??(pe==null?void 0:pe.status)??r.status;if(!(T===r.status||!_.includes(T))){if(r.kind==="task"){Z(y=>({...y,[r.task.id]:T}));try{await m(r.task.id,T)}catch(y){throw Z(he=>{const ae={...he};return delete ae[r.task.id],ae}),y}return}if(x){ie(y=>({...y,[r.project.id]:T}));try{await x(r.project.id,T)}catch(y){throw ie(he=>{const ae={...he};return delete ae[r.project.id],ae}),y}}}}async function de(i,n){const s=F.find(w=>w.id===i);if(!s)return;const d=_.indexOf(s.status),p=n==="previous"?d-1:d+1,r=_[p]??null;if(!(!r||r===s.status)){Z(w=>({...w,[s.id]:r}));try{await m(s.id,r)}catch(w){throw Z(R=>{const q={...R};return delete q[s.id],q}),w}}}async function ue(i,n){const s=Y.find(w=>w.id===i);if(!s||!x)return;const d=_.indexOf(s.workflowStatus),p=n==="previous"?d-1:d+1,r=_[p]??null;if(!(!r||r===s.workflowStatus)){ie(w=>({...w,[s.id]:r}));try{await x(s.id,r)}catch(w){throw ie(R=>{const q={...R};return delete q[s.id],q}),w}}}function me(i,n){const s=i.currentTarget.getBoundingClientRect();K({kind:"task",entityId:n.id,position:{x:s.right-8,y:s.bottom+8}})}function xe(i,n){const s=i.currentTarget.getBoundingClientRect();K({kind:"project",entityId:n.id,position:{x:s.right-8,y:s.bottom+8}})}return t.jsxs(yt,{sensors:te,collisionDetection:Rt,onDragStart:ut,onDragCancel:()=>J(null),onDragEnd:i=>void xt(i),children:[(O==null?void 0:O.kind)==="task"&&I?t.jsx(Pt,{droppableId:oe,title:b("common.executionBoard.deleteDropTitle"),detail:b("common.executionBoard.deleteDropDetail")}):null,t.jsx("div",{className:"w-full max-w-full min-w-0 pb-2",children:L?t.jsx("div",{className:"grid w-full max-w-full min-w-0 gap-2",children:_.map(i=>{const n=H.filter(s=>s.status===i);return t.jsx(Pe,{items:n.map(s=>`${A}:${s.kind}:${s.id}`),strategy:Ve,children:t.jsx(Je,{droppableId:`${A}:lane:${i}`,status:i,title:re[i].title,detail:re[i].detail,count:n.length,dragging:P!==null,children:Ce(n)})},i)})}):t.jsx("div",{className:"grid w-full min-w-0 gap-0.5 xl:grid-cols-[repeat(5,minmax(0,1fr))]",children:_.map(i=>{const n=H.filter(s=>s.status===i);return t.jsx(Pe,{items:n.map(s=>`${A}:${s.kind}:${s.id}`),strategy:Ve,children:t.jsx(Je,{droppableId:`${A}:lane:${i}`,status:i,title:re[i].title,detail:re[i].detail,count:n.length,dragging:P!==null,children:Ce(n)})},i)})})}),t.jsx(Nt,{adjustScale:!1,dropAnimation:null,children:O?t.jsx("div",{className:"w-[20rem] max-w-[calc(100vw-2rem)]",children:O.kind==="task"?t.jsx(lt,{task:O.task,goal:O.goal,tags:O.tags,activeRun:O.activeRun,isSelected:u===O.task.id,isDragging:!0,isOverlay:!0,isMobile:L,onSelect:()=>{},onStartTask:j,onSplitTask:v,notesSummaryByEntity:z}):t.jsx(ot,{project:O.project,goal:O.goal,isDragging:!0,isOverlay:!0,isMobile:L})}):null}),t.jsx(zt,{open:g!==null,title:(g==null?void 0:g.kind)==="project"?(($e=Y.find(i=>i.id===g.entityId))==null?void 0:$e.title)??"Project actions":((Be=F.find(i=>i.id===(g==null?void 0:g.entityId)))==null?void 0:Be.title)??"Work item actions",subtitle:(g==null?void 0:g.kind)==="project"?"Edit, relink, move, or break this project into issues.":"Edit, relink, move, or create the next child work item.",items:dt,position:(g==null?void 0:g.position)??null,onClose:()=>K(null)}),V?t.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-[rgba(5,8,18,0.74)] p-4 backdrop-blur-xl",children:t.jsxs(it,{className:"w-full max-w-md border border-white/10 bg-[linear-gradient(180deg,rgba(16,22,36,0.96),rgba(9,13,22,0.98))] shadow-[0_32px_90px_rgba(5,8,18,0.58)]",children:[t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"mt-1 flex size-11 shrink-0 items-center justify-center rounded-full bg-rose-500/14 text-rose-100",children:t.jsx(ve,{className:"size-5"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-display text-[1.35rem] leading-tight text-white",children:b("common.executionBoard.deleteConfirmTitle")}),t.jsx("div",{className:"mt-2 text-sm leading-6 text-white/64",children:b("common.executionBoard.deleteConfirmDescription",{title:V.title})})]})]}),t.jsxs("label",{className:"mt-5 flex items-center gap-3 rounded-[18px] bg-white/[0.05] px-4 py-3 text-sm text-white/76",children:[t.jsx("input",{type:"checkbox",checked:ke,onChange:i=>se(i.target.checked),className:"size-4 rounded border-white/20 bg-transparent text-[var(--primary)]"}),t.jsx("span",{children:b("common.executionBoard.deleteConfirmCheckbox")})]}),t.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-3",children:[t.jsx(qe,{variant:"secondary",onClick:()=>{Q(null),se(!1)},children:b("common.executionBoard.deleteConfirmCancel")}),t.jsx(qe,{className:"bg-[linear-gradient(135deg,rgba(251,113,133,0.3),rgba(190,24,93,0.26))] text-white shadow-[0_16px_36px_rgba(190,24,93,0.18)]",pending:X===V.id,pendingLabel:b("common.executionBoard.deletingTask"),onClick:()=>void ze(V,ke),children:b("common.executionBoard.deleteConfirmSubmit")})]})]})}):null]})}export{Jt as E};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as w,j as t,aK as D,b3 as _}from"./vendor-DHkYh85p.js";import{Z as r}from"./index-BHTUu_4M.js";function B(o){return o.trim().toLowerCase()}function A({title:o,description:m,query:x,onQueryChange:b,onQuerySubmit:f,options:p,selectedOptionIds:i,onSelectedOptionIdsChange:c,resultSummary:M,clearLabel:j="Clear filters",submitLabel:v="Search",placeholder:E="Search title, alias, domain, source, or filter chip",emptyStateMessage:C="Keep typing to search the library or pick one of the suggested filter chips.",compact:l=!1,minimal:a=!1,hideSummary:F=!1}){const[$,n]=w.useState(!1),[g,d]=w.useState(0),N=w.useMemo(()=>i.map(e=>p.find(s=>s.id===e)).filter(Boolean),[p,i]),u=w.useMemo(()=>{const e=B(x),s=p.filter(h=>!i.includes(h.id));return e?s.filter(h=>`${h.label} ${h.description??""} ${h.searchText??""}`.toLowerCase().includes(e)).slice(0,12):s.slice(0,12)},[p,x,i]),y=e=>{i.includes(e)||(c([...i,e]),b(""),n(!1),d(0))},k=e=>{c(i.filter(s=>s!==e))},z=()=>{b(""),c([]),d(0),n(!1)};return t.jsxs("div",{className:r("rounded-[28px] border border-white/8 bg-[linear-gradient(135deg,rgba(19,30,42,0.92),rgba(9,15,24,0.98))] shadow-[0_30px_80px_rgba(3,8,18,0.28)]",a?"overflow-hidden rounded-full border-white/10 bg-[rgba(8,12,20,0.82)] px-3 py-1.5 shadow-[0_18px_50px_rgba(0,0,0,0.26)] backdrop-blur":l?"rounded-[24px] p-2.5":"p-4 sm:p-5"),children:[t.jsxs("div",{className:r("flex flex-wrap items-start justify-between gap-3",a&&"hidden"),children:[t.jsxs("div",{children:[o.trim().length>0?t.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-white/42",children:o}):null,m.trim().length>0?t.jsx("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/62",children:m}):null]}),i.length>0||x.trim().length>0?t.jsx("button",{type:"button",onClick:z,className:r("rounded-full border border-white/8 bg-white/[0.04] text-white/62 transition hover:bg-white/[0.08] hover:text-white",l?"px-2.5 py-1.5 text-[11px]":"px-3 py-2 text-sm"),children:j}):null]}),t.jsxs("div",{className:r("rounded-[24px] border border-white/8 bg-white/[0.04]",a?"rounded-full border-0 bg-transparent px-0 py-0":l?"mt-1.5 rounded-[18px] px-2.5 py-2":"mt-4 px-4 py-3"),children:[N.length>0?t.jsx("div",{className:r("flex flex-wrap gap-2",a?"mb-0 mr-2 inline-flex max-w-[38%] flex-nowrap items-center gap-1 overflow-hidden":l?"mb-2":"mb-3"),children:N.map(e=>t.jsxs("span",{className:r("inline-flex items-center gap-2 rounded-full border border-white/8 bg-white/[0.06]",a?"max-w-full shrink-0 border-white/10 bg-white/[0.08] px-2 py-0.5":l?"px-2 py-0.5":"px-2.5 py-1.5"),children:[e.badge??t.jsx("span",{className:"text-sm text-white/78",children:e.label}),t.jsx("button",{type:"button",className:"rounded-full text-white/52 transition hover:text-white",onClick:()=>k(e.id),"aria-label":`Remove ${e.label}`,children:t.jsx(D,{className:"size-3.5"})})]},e.id))}):null,t.jsxs("div",{className:"relative",children:[t.jsxs("div",{className:r("flex items-center",a?"gap-2 whitespace-nowrap":l?"gap-2":"gap-3"),children:[t.jsx(_,{className:r("text-white/36",l?"size-3.5":"size-4")}),t.jsx("input",{value:x,onChange:e=>{b(e.target.value),n(!0),d(0)},onFocus:()=>n(!0),onBlur:()=>window.setTimeout(()=>n(!1),120),onKeyDown:e=>{if(e.key==="Backspace"&&!x&&i.length>0){k(i[i.length-1]);return}if(e.key==="ArrowDown"){e.preventDefault(),n(!0),d(s=>u.length===0?0:Math.min(u.length-1,s+1));return}if(e.key==="ArrowUp"){e.preventDefault(),d(s=>Math.max(0,s-1));return}if(e.key==="Escape"){n(!1);return}if(e.key==="Enter"&&f){e.preventDefault(),f(x),n(!1);return}e.key==="Enter"&&u[g]&&(e.preventDefault(),y(u[g].id))},placeholder:E,className:r("min-w-0 flex-1 bg-transparent text-white placeholder:text-white/34 focus:outline-none",a||l?"text-[12px]":"text-sm")}),a&&(i.length>0||x.trim().length>0)?t.jsx("button",{type:"button",onClick:z,className:"inline-flex size-6 items-center justify-center rounded-full border border-white/10 bg-white/[0.06] text-white/62 transition hover:text-white","aria-label":j,children:t.jsx(D,{className:"size-3.5"})}):null,f?t.jsx("button",{type:"button",onMouseDown:e=>e.preventDefault(),onClick:()=>{f(x),n(!1)},className:r("inline-flex items-center justify-center rounded-full border border-white/10 bg-white/[0.08] text-white/72 transition hover:bg-white/[0.14] hover:text-white",a?"size-6":l?"size-7":"size-8"),"aria-label":v,title:v,children:t.jsx(_,{className:r(l?"size-3.5":"size-4")})}):null]}),$?t.jsx("div",{className:r("absolute top-full z-20 w-full border border-white/8 bg-[rgba(8,13,24,0.96)] shadow-[0_26px_60px_rgba(4,8,18,0.32)] backdrop-blur-xl",l?"mt-1.5 rounded-[18px] p-1.5":"mt-2 rounded-[22px] p-2"),children:u.length>0?u.map((e,s)=>t.jsx("button",{type:"button",className:r("flex w-full items-start justify-between gap-3 text-left transition",l?"rounded-[14px] px-2.5 py-2":"rounded-[18px] px-3 py-2.5",s===g?"bg-white/[0.1] text-white":"text-white/70 hover:bg-white/[0.06] hover:text-white"),onMouseEnter:()=>d(s),onMouseDown:h=>h.preventDefault(),onClick:()=>y(e.id),children:t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:r("truncate font-medium",l?"text-[12px]":"text-sm"),children:e.badge??e.label}),e.description?t.jsx("div",{className:r("mt-1 text-white/46",l?"text-[11px] leading-[1.125rem]":"text-xs leading-5"),children:e.description}):null]})},e.id)):t.jsx("div",{className:r("text-white/42",l?"px-2.5 py-2 text-[12px]":"px-3 py-2.5 text-sm"),children:C})}):null]})]}),F?null:t.jsx("div",{className:r("text-white/52",l?"mt-2 text-xs":"mt-3 text-sm"),children:M})]})}export{A as F};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,aC as l,b8 as b}from"./vendor-DHkYh85p.js";import{Z as i,c as m}from"./index-BHTUu_4M.js";import{m as h}from"./motion-BeD44FeG.js";function f({eyebrow:n,title:g,description:c,items:t,tone:a="core",className:x}){return e.jsxs("section",{className:i("min-w-0 overflow-hidden rounded-[28px] border border-white/6 shadow-[0_20px_54px_rgba(4,8,18,0.24)]",a==="core"?"bg-[linear-gradient(180deg,rgba(22,28,46,0.98),rgba(12,17,30,0.95))]":"bg-[linear-gradient(180deg,rgba(16,29,33,0.98),rgba(12,22,27,0.95))]",x),children:[e.jsxs("div",{className:i("grid min-w-0 gap-3 px-4 py-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,26rem)] lg:px-5",a==="core"?"bg-[radial-gradient(circle_at_top_right,rgba(192,193,255,0.12),transparent_36%),linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0))]":"bg-[radial-gradient(circle_at_top_right,rgba(110,231,183,0.1),transparent_36%),linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0))]"),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:i("font-label text-[11px] uppercase tracking-[0.2em]",a==="core"?"text-[var(--secondary)]":"text-[rgba(110,231,183,0.82)]"),children:n}),e.jsx("h2",{className:"mt-2 max-w-3xl font-display text-[clamp(1.35rem,2vw,1.9rem)] leading-none text-white",children:g}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/60",children:c})]}),e.jsx("div",{className:"grid min-w-0 gap-2 sm:grid-cols-3",children:t.slice(0,3).map(r=>r.href?e.jsxs(l,{to:r.href,className:i("min-w-0 rounded-[20px] border border-white/6 px-3 py-3 backdrop-blur-sm transition hover:bg-white/[0.08]",a==="core"?"bg-[linear-gradient(180deg,rgba(255,255,255,0.05),rgba(255,255,255,0.025))]":"bg-[linear-gradient(180deg,rgba(110,231,183,0.08),rgba(255,255,255,0.02))]"),children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:r.label}),e.jsx("div",{className:"mt-1.5 min-w-0 font-medium text-white",children:r.title})]},r.id):e.jsxs("div",{className:i("min-w-0 rounded-[20px] border border-white/6 px-3 py-3 backdrop-blur-sm",a==="core"?"bg-[linear-gradient(180deg,rgba(255,255,255,0.05),rgba(255,255,255,0.025))]":"bg-[linear-gradient(180deg,rgba(110,231,183,0.08),rgba(255,255,255,0.02))]"),children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:r.label}),e.jsx("div",{className:"mt-1.5 min-w-0 font-medium text-white",children:r.title})]},r.id))})]}),e.jsx("div",{className:"grid min-w-0 gap-3 px-4 py-4 lg:grid-cols-2 lg:px-5",children:t.map((r,o)=>{const s=i("group flex min-h-[13.5rem] min-w-0 flex-col overflow-hidden rounded-[24px] border border-white/7 p-0 transition hover:-translate-y-0.5 hover:shadow-[0_22px_46px_rgba(3,8,18,0.28)] sm:min-h-[15.5rem]",a==="core"?"bg-[linear-gradient(180deg,rgba(19,26,42,0.98),rgba(11,16,28,0.96))] hover:border-white/12 hover:bg-[linear-gradient(180deg,rgba(24,31,50,0.98),rgba(13,19,33,0.97))]":"bg-[linear-gradient(180deg,rgba(17,29,32,0.98),rgba(9,18,22,0.97))] hover:border-white/12 hover:bg-[linear-gradient(180deg,rgba(21,36,40,0.98),rgba(11,22,27,0.97))]"),d=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:i("flex min-w-0 flex-1 flex-col p-4",a==="core"?"bg-[radial-gradient(circle_at_top_left,rgba(192,193,255,0.1),transparent_28%),linear-gradient(180deg,rgba(255,255,255,0.025),rgba(255,255,255,0))]":"bg-[radial-gradient(circle_at_top_left,rgba(110,231,183,0.08),transparent_28%),linear-gradient(180deg,rgba(255,255,255,0.025),rgba(255,255,255,0))]"),children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:r.label}),e.jsx("div",{className:"mt-2.5 min-w-0 font-display text-[1.25rem] leading-tight text-white sm:text-[1.4rem]",children:r.title})]}),r.badge?e.jsx(m,{wrap:!0,className:"max-w-[10rem] shrink-0 self-start bg-white/[0.08] text-white/72",children:r.badge}):null]}),e.jsx("div",{className:"mt-2.5 text-sm leading-6 text-white/60",children:r.detail}),e.jsx("div",{className:"flex-1"})]}),r.href?e.jsx("div",{className:"border-t border-white/6 bg-[linear-gradient(180deg,rgba(255,255,255,0.02),rgba(255,255,255,0.01))] px-4 py-3",children:e.jsxs("div",{className:"inline-flex min-h-10 min-w-0 max-w-full items-center gap-2 rounded-full border border-white/8 bg-white/[0.05] px-4 text-sm text-white/68 transition group-hover:border-white/14 group-hover:bg-white/[0.08] group-hover:text-white",children:[r.actionLabel??"Open",e.jsx(b,{className:"size-3.5"})]})}):null]});return e.jsx(h.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.22,delay:.04*o,ease:"easeOut"},children:r.href?e.jsx(l,{to:r.href,className:s,children:d}):e.jsx("div",{className:s,children:d})},r.id)})})]})}export{f as F};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as h,o as m,j as t,aK as p}from"./vendor-DHkYh85p.js";import{Z as l}from"./index-BHTUu_4M.js";function f({open:s,title:c,subtitle:a,items:x,position:i,onClose:n}){return h.useEffect(()=>{if(!s)return;let e=!1;const r=window.setTimeout(()=>{e=!0},0),o=w=>{w.key==="Escape"&&n()},d=()=>{e&&n()};return window.addEventListener("keydown",o),window.addEventListener("pointerdown",d),()=>{window.clearTimeout(r),window.removeEventListener("keydown",o),window.removeEventListener("pointerdown",d)}},[n,s]),!s||!i||typeof document>"u"?null:m.createPortal(t.jsx("div",{className:"fixed inset-0 z-[70]","aria-hidden":"true",children:t.jsxs("div",{className:"fixed z-[71] flex max-h-[min(34rem,calc(100dvh-1.5rem))] w-[min(22rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-[26px] border border-white/10 bg-[rgba(10,15,27,0.97)] p-2 shadow-[0_28px_80px_rgba(4,8,18,0.4)] backdrop-blur-xl",style:{left:Math.min(i.x,window.innerWidth-24-352),top:Math.min(i.y,window.innerHeight-24-544)},onPointerDown:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[20px] bg-white/[0.03] px-4 py-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-white",children:c}),a?t.jsx("div",{className:"mt-1 text-xs leading-5 text-white/50",children:a}):null]}),t.jsx("button",{type:"button",className:"rounded-full bg-white/[0.04] p-2 text-white/55 transition hover:bg-white/[0.08] hover:text-white",onClick:n,children:t.jsx(p,{className:"size-4"})})]}),t.jsx("div",{className:"mt-2 min-h-0 overflow-y-auto overscroll-contain pr-1",children:t.jsx("div",{className:"grid gap-1",children:x.map(e=>{const r=e.icon;return t.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>{e.disabled||(e.onSelect(),n())},className:l("flex w-full items-start gap-3 rounded-[20px] px-4 py-3 text-left transition",e.disabled?"cursor-not-allowed bg-white/[0.02] text-white/28":e.tone==="danger"?"bg-rose-400/[0.05] text-rose-100 hover:bg-rose-400/[0.12]":"bg-white/[0.03] text-white/76 hover:bg-white/[0.08] hover:text-white"),children:[r?t.jsx("span",{className:l("mt-0.5 rounded-[14px] p-2",e.disabled?"bg-white/[0.03] text-white/28":e.tone==="danger"?"bg-rose-400/[0.12] text-rose-100":"bg-[var(--primary)]/12 text-[var(--primary)]"),children:t.jsx(r,{className:"size-4"})}):null,t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-medium",children:e.label}),e.description?t.jsx("span",{className:"mt-1 block text-xs leading-5 text-white/48",children:e.description}):null]})]},e.id)})})})]})}),document.body)}export{f as F};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as z}from"./vendor-DHkYh85p.js";var E;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{const a={};for(const o of i)a[o]=o;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(d=>typeof i[i[d]]!="number"),o={};for(const d of a)o[d]=i[d];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(const o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function s(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=s,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(E||(E={}));var jt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(jt||(jt={}));const p=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_e=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}},c=E.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ye extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(a){return a.message},s={_errors:[]},i=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)s._errors.push(r(o));else{let d=s,g=0;for(;g<o.path.length;){const v=o.path[g];g===o.path.length-1?(d[v]=d[v]||{_errors:[]},d[v]._errors.push(r(o))):d[v]=d[v]||{_errors:[]},d=d[v],g++}}};return i(this),s}static assert(e){if(!(e instanceof ye))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},s=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];r[a]=r[a]||[],r[a].push(e(i))}else s.push(e(i));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}}ye.create=t=>new ye(t);const ft=(t,e)=>{let r;switch(t.code){case c.invalid_type:t.received===p.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,E.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:r=`Unrecognized key(s) in object: ${E.joinValues(t.keys,", ")}`;break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${E.joinValues(t.options)}`;break;case c.invalid_enum_value:r=`Invalid enum value. Expected ${E.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:r="Invalid function arguments";break;case c.invalid_return_type:r="Invalid function return type";break;case c.invalid_date:r="Invalid date";break;case c.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:E.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case c.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case c.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case c.custom:r="Invalid input";break;case c.invalid_intersection_types:r="Intersection results could not be merged";break;case c.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:r="Number must be finite";break;default:r=e.defaultError,E.assertNever(t)}return{message:r}};let Or=ft;function Er(){return Or}const Rr=t=>{const{data:e,path:r,errorMaps:s,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let d="";const g=s.filter(v=>!!v).slice().reverse();for(const v of g)d=v(o,{data:e,defaultError:d}).message;return{...i,path:a,message:d}};function y(t,e){const r=Er(),s=Rr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ft?void 0:ft].filter(i=>!!i)});t.common.issues.push(s)}class X{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const s=[];for(const i of r){if(i.status==="aborted")return k;i.status==="dirty"&&e.dirty(),s.push(i.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){const s=[];for(const i of r){const a=await i.key,o=await i.value;s.push({key:a,value:o})}return X.mergeObjectSync(e,s)}static mergeObjectSync(e,r){const s={};for(const i of r){const{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return k;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}}const k=Object.freeze({status:"aborted"}),Pe=t=>({status:"dirty",value:t}),te=t=>({status:"valid",value:t}),Lt=t=>t.status==="aborted",Mt=t=>t.status==="dirty",Fe=t=>t.status==="valid",Ye=t=>typeof Promise<"u"&&t instanceof Promise;var x;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(x||(x={}));class be{constructor(e,r,s,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const $t=(t,e)=>{if(Fe(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new ye(t.common.issues);return this._error=r,this._error}}};function T(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:s,description:i}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,d)=>{const{message:g}=t;return o.code==="invalid_enum_value"?{message:g??d.defaultError}:typeof d.data>"u"?{message:g??s??d.defaultError}:o.code!=="invalid_type"?{message:d.defaultError}:{message:g??r??d.defaultError}},description:i}}class O{get description(){return this._def.description}_getType(e){return _e(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:_e(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:_e(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Ye(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){const s={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_e(e)},i=this._parseSync({data:e,path:s.path,parent:s});return $t(s,i)}"~validate"(e){var s,i;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_e(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return Fe(a)?{value:a.value}:{issues:r.common.issues}}catch(a){(i=(s=a==null?void 0:a.message)==null?void 0:s.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>Fe(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(e,r){const s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){const s={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_e(e)},i=this._parse({data:e,path:s.path,parent:s}),a=await(Ye(i)?i:Promise.resolve(i));return $t(s,a)}refine(e,r){const s=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{const o=e(i),d=()=>a.addIssue({code:c.custom,...s(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(g=>g?!0:(d(),!1)):o?!0:(d(),!1)})}refinement(e,r){return this._refinement((s,i)=>e(s)?!0:(i.addIssue(typeof r=="function"?r(s,i):r),!1))}_refinement(e){return new Ze({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return xe.create(this,this._def)}nullable(){return je.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ue.create(this)}promise(){return Ke.create(this,this._def)}or(e){return Qe.create([this,e],this._def)}and(e){return Xe.create(this,e,this._def)}transform(e){return new Ze({...T(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new yt({...T(this._def),innerType:this,defaultValue:r,typeName:w.ZodDefault})}brand(){return new es({typeName:w.ZodBranded,type:this,...T(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new gt({...T(this._def),innerType:this,catchValue:r,typeName:w.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return xt.create(this,e)}readonly(){return vt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Nr=/^c[^\s-]{8,}$/i,Fr=/^[0-9a-z]+$/,Ir=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Dr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Zr=/^[a-z0-9_-]{21}$/i,jr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Lr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Mr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$r="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ut;const Pr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ur=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Br=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,zr=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Wr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Hr=new RegExp(`^${dr}$`);function ur(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Gr(t){return new RegExp(`^${ur(t)}$`)}function Yr(t){let e=`${dr}T${ur(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Jr(t,e){return!!((e==="v4"||!e)&&Pr.test(t)||(e==="v6"||!e)&&Br.test(t))}function Qr(t,e){if(!jr.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(s));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Xr(t,e){return!!((e==="v4"||!e)&&Ur.test(t)||(e==="v6"||!e)&&zr.test(t))}class me extends O{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const a=this._getOrReturnCtx(e);return y(a,{code:c.invalid_type,expected:p.string,received:a.parsedType}),k}const s=new X;let i;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),y(i,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),y(i,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,d=e.data.length<a.value;(o||d)&&(i=this._getOrReturnCtx(e,i),o?y(i,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):d&&y(i,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Mr.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")ut||(ut=new RegExp($r,"u")),ut.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Dr.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Zr.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Nr.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Fr.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Ir.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),y(i,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),y(i,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),y(i,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),y(i,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?Yr(a).test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Hr.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Gr(a).test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Lr.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Jr(e.data,a.version)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Qr(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Xr(e.data,a.version)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Wr.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?qr.test(e.data)||(i=this._getOrReturnCtx(e,i),y(i,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):E.assertNever(a);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(i=>e.test(i),{validation:r,code:c.invalid_string,...x.errToObj(s)})}_addCheck(e){return new me({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...x.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...x.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...x.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...x.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...x.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...x.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...x.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...x.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...x.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...x.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...x.errToObj(r)})}nonempty(e){return this.min(1,x.errToObj(e))}trim(){return new me({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new me({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new me({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}me.create=t=>new me({checks:[],typeName:w.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...T(t)});function Kr(t,e){const r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,i=r>s?r:s,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}class Te extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){const a=this._getOrReturnCtx(e);return y(a,{code:c.invalid_type,expected:p.number,received:a.parsedType}),k}let s;const i=new X;for(const a of this._def.checks)a.kind==="int"?E.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?Kr(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),y(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:c.not_finite,message:a.message}),i.dirty()):E.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,x.toString(r))}gt(e,r){return this.setLimit("min",e,!1,x.toString(r))}lte(e,r){return this.setLimit("max",e,!0,x.toString(r))}lt(e,r){return this.setLimit("max",e,!1,x.toString(r))}setLimit(e,r,s,i){return new Te({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:x.toString(i)}]})}_addCheck(e){return new Te({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&E.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}}Te.create=t=>new Te({checks:[],typeName:w.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...T(t)});class Ce extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let s;const i=new X;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),y(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):E.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return y(r,{code:c.invalid_type,expected:p.bigint,received:r.parsedType}),k}gte(e,r){return this.setLimit("min",e,!0,x.toString(r))}gt(e,r){return this.setLimit("min",e,!1,x.toString(r))}lte(e,r){return this.setLimit("max",e,!0,x.toString(r))}lt(e,r){return this.setLimit("max",e,!1,x.toString(r))}setLimit(e,r,s,i){return new Ce({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:x.toString(i)}]})}_addCheck(e){return new Ce({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Ce.create=t=>new Ce({checks:[],typeName:w.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...T(t)});class Je extends O{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const s=this._getOrReturnCtx(e);return y(s,{code:c.invalid_type,expected:p.boolean,received:s.parsedType}),k}return te(e.data)}}Je.create=t=>new Je({typeName:w.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...T(t)});class Ie extends O{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const a=this._getOrReturnCtx(e);return y(a,{code:c.invalid_type,expected:p.date,received:a.parsedType}),k}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return y(a,{code:c.invalid_date}),k}const s=new X;let i;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),y(i,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),y(i,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):E.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:x.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:x.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Ie.create=t=>new Ie({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:w.ZodDate,...T(t)});class Pt extends O{_parse(e){if(this._getType(e)!==p.symbol){const s=this._getOrReturnCtx(e);return y(s,{code:c.invalid_type,expected:p.symbol,received:s.parsedType}),k}return te(e.data)}}Pt.create=t=>new Pt({typeName:w.ZodSymbol,...T(t)});class Ut extends O{_parse(e){if(this._getType(e)!==p.undefined){const s=this._getOrReturnCtx(e);return y(s,{code:c.invalid_type,expected:p.undefined,received:s.parsedType}),k}return te(e.data)}}Ut.create=t=>new Ut({typeName:w.ZodUndefined,...T(t)});class Bt extends O{_parse(e){if(this._getType(e)!==p.null){const s=this._getOrReturnCtx(e);return y(s,{code:c.invalid_type,expected:p.null,received:s.parsedType}),k}return te(e.data)}}Bt.create=t=>new Bt({typeName:w.ZodNull,...T(t)});class zt extends O{constructor(){super(...arguments),this._any=!0}_parse(e){return te(e.data)}}zt.create=t=>new zt({typeName:w.ZodAny,...T(t)});class Wt extends O{constructor(){super(...arguments),this._unknown=!0}_parse(e){return te(e.data)}}Wt.create=t=>new Wt({typeName:w.ZodUnknown,...T(t)});class ke extends O{_parse(e){const r=this._getOrReturnCtx(e);return y(r,{code:c.invalid_type,expected:p.never,received:r.parsedType}),k}}ke.create=t=>new ke({typeName:w.ZodNever,...T(t)});class qt extends O{_parse(e){if(this._getType(e)!==p.undefined){const s=this._getOrReturnCtx(e);return y(s,{code:c.invalid_type,expected:p.void,received:s.parsedType}),k}return te(e.data)}}qt.create=t=>new qt({typeName:w.ZodVoid,...T(t)});class ue extends O{_parse(e){const{ctx:r,status:s}=this._processInputParams(e),i=this._def;if(r.parsedType!==p.array)return y(r,{code:c.invalid_type,expected:p.array,received:r.parsedType}),k;if(i.exactLength!==null){const o=r.data.length>i.exactLength.value,d=r.data.length<i.exactLength.value;(o||d)&&(y(r,{code:o?c.too_big:c.too_small,minimum:d?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),s.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(y(r,{code:c.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),s.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(y(r,{code:c.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((o,d)=>i.type._parseAsync(new be(r,o,r.path,d)))).then(o=>X.mergeArray(s,o));const a=[...r.data].map((o,d)=>i.type._parseSync(new be(r,o,r.path,d)));return X.mergeArray(s,a)}get element(){return this._def.type}min(e,r){return new ue({...this._def,minLength:{value:e,message:x.toString(r)}})}max(e,r){return new ue({...this._def,maxLength:{value:e,message:x.toString(r)}})}length(e,r){return new ue({...this._def,exactLength:{value:e,message:x.toString(r)}})}nonempty(e){return this.min(1,e)}}ue.create=(t,e)=>new ue({type:t,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...T(e)});function Re(t){if(t instanceof P){const e={};for(const r in t.shape){const s=t.shape[r];e[r]=xe.create(Re(s))}return new P({...t._def,shape:()=>e})}else return t instanceof ue?new ue({...t._def,type:Re(t.element)}):t instanceof xe?xe.create(Re(t.unwrap())):t instanceof je?je.create(Re(t.unwrap())):t instanceof Se?Se.create(t.items.map(e=>Re(e))):t}class P extends O{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=E.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==p.object){const v=this._getOrReturnCtx(e);return y(v,{code:c.invalid_type,expected:p.object,received:v.parsedType}),k}const{status:s,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),d=[];if(!(this._def.catchall instanceof ke&&this._def.unknownKeys==="strip"))for(const v in i.data)o.includes(v)||d.push(v);const g=[];for(const v of o){const C=a[v],N=i.data[v];g.push({key:{status:"valid",value:v},value:C._parse(new be(i,N,i.path,v)),alwaysSet:v in i.data})}if(this._def.catchall instanceof ke){const v=this._def.unknownKeys;if(v==="passthrough")for(const C of d)g.push({key:{status:"valid",value:C},value:{status:"valid",value:i.data[C]}});else if(v==="strict")d.length>0&&(y(i,{code:c.unrecognized_keys,keys:d}),s.dirty());else if(v!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const v=this._def.catchall;for(const C of d){const N=i.data[C];g.push({key:{status:"valid",value:C},value:v._parse(new be(i,N,i.path,C)),alwaysSet:C in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const v=[];for(const C of g){const N=await C.key,j=await C.value;v.push({key:N,value:j,alwaysSet:C.alwaysSet})}return v}).then(v=>X.mergeObjectSync(s,v)):X.mergeObjectSync(s,g)}get shape(){return this._def.shape()}strict(e){return x.errToObj,new P({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{var a,o;const i=((o=(a=this._def).errorMap)==null?void 0:o.call(a,r,s).message)??s.defaultError;return r.code==="unrecognized_keys"?{message:x.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new P({...this._def,unknownKeys:"strip"})}passthrough(){return new P({...this._def,unknownKeys:"passthrough"})}extend(e){return new P({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new P({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new P({...this._def,catchall:e})}pick(e){const r={};for(const s of E.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new P({...this._def,shape:()=>r})}omit(e){const r={};for(const s of E.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new P({...this._def,shape:()=>r})}deepPartial(){return Re(this)}partial(e){const r={};for(const s of E.objectKeys(this.shape)){const i=this.shape[s];e&&!e[s]?r[s]=i:r[s]=i.optional()}return new P({...this._def,shape:()=>r})}required(e){const r={};for(const s of E.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof xe;)a=a._def.innerType;r[s]=a}return new P({...this._def,shape:()=>r})}keyof(){return lr(E.objectKeys(this.shape))}}P.create=(t,e)=>new P({shape:()=>t,unknownKeys:"strip",catchall:ke.create(),typeName:w.ZodObject,...T(e)});P.strictCreate=(t,e)=>new P({shape:()=>t,unknownKeys:"strict",catchall:ke.create(),typeName:w.ZodObject,...T(e)});P.lazycreate=(t,e)=>new P({shape:t,unknownKeys:"strip",catchall:ke.create(),typeName:w.ZodObject,...T(e)});class Qe extends O{_parse(e){const{ctx:r}=this._processInputParams(e),s=this._def.options;function i(a){for(const d of a)if(d.result.status==="valid")return d.result;for(const d of a)if(d.result.status==="dirty")return r.common.issues.push(...d.ctx.common.issues),d.result;const o=a.map(d=>new ye(d.ctx.common.issues));return y(r,{code:c.invalid_union,unionErrors:o}),k}if(r.common.async)return Promise.all(s.map(async a=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a;const o=[];for(const g of s){const v={...r,common:{...r.common,issues:[]},parent:null},C=g._parseSync({data:r.data,path:r.path,parent:v});if(C.status==="valid")return C;C.status==="dirty"&&!a&&(a={result:C,ctx:v}),v.common.issues.length&&o.push(v.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const d=o.map(g=>new ye(g));return y(r,{code:c.invalid_union,unionErrors:d}),k}}get options(){return this._def.options}}Qe.create=(t,e)=>new Qe({options:t,typeName:w.ZodUnion,...T(e)});function ht(t,e){const r=_e(t),s=_e(e);if(t===e)return{valid:!0,data:t};if(r===p.object&&s===p.object){const i=E.objectKeys(e),a=E.objectKeys(t).filter(d=>i.indexOf(d)!==-1),o={...t,...e};for(const d of a){const g=ht(t[d],e[d]);if(!g.valid)return{valid:!1};o[d]=g.data}return{valid:!0,data:o}}else if(r===p.array&&s===p.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let a=0;a<t.length;a++){const o=t[a],d=e[a],g=ht(o,d);if(!g.valid)return{valid:!1};i.push(g.data)}return{valid:!0,data:i}}else return r===p.date&&s===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Xe extends O{_parse(e){const{status:r,ctx:s}=this._processInputParams(e),i=(a,o)=>{if(Lt(a)||Lt(o))return k;const d=ht(a.value,o.value);return d.valid?((Mt(a)||Mt(o))&&r.dirty(),{status:r.value,value:d.data}):(y(s,{code:c.invalid_intersection_types}),k)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Xe.create=(t,e,r)=>new Xe({left:t,right:e,typeName:w.ZodIntersection,...T(r)});class Se extends O{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.array)return y(s,{code:c.invalid_type,expected:p.array,received:s.parsedType}),k;if(s.data.length<this._def.items.length)return y(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),k;!this._def.rest&&s.data.length>this._def.items.length&&(y(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...s.data].map((o,d)=>{const g=this._def.items[d]||this._def.rest;return g?g._parse(new be(s,o,s.path,d)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>X.mergeArray(r,o)):X.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new Se({...this._def,rest:e})}}Se.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Se({items:t,typeName:w.ZodTuple,rest:null,...T(e)})};class Ht extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.map)return y(s,{code:c.invalid_type,expected:p.map,received:s.parsedType}),k;const i=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([d,g],v)=>({key:i._parse(new be(s,d,s.path,[v,"key"])),value:a._parse(new be(s,g,s.path,[v,"value"]))}));if(s.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const g of o){const v=await g.key,C=await g.value;if(v.status==="aborted"||C.status==="aborted")return k;(v.status==="dirty"||C.status==="dirty")&&r.dirty(),d.set(v.value,C.value)}return{status:r.value,value:d}})}else{const d=new Map;for(const g of o){const v=g.key,C=g.value;if(v.status==="aborted"||C.status==="aborted")return k;(v.status==="dirty"||C.status==="dirty")&&r.dirty(),d.set(v.value,C.value)}return{status:r.value,value:d}}}}Ht.create=(t,e,r)=>new Ht({valueType:e,keyType:t,typeName:w.ZodMap,...T(r)});class ze extends O{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.set)return y(s,{code:c.invalid_type,expected:p.set,received:s.parsedType}),k;const i=this._def;i.minSize!==null&&s.data.size<i.minSize.value&&(y(s,{code:c.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&s.data.size>i.maxSize.value&&(y(s,{code:c.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());const a=this._def.valueType;function o(g){const v=new Set;for(const C of g){if(C.status==="aborted")return k;C.status==="dirty"&&r.dirty(),v.add(C.value)}return{status:r.value,value:v}}const d=[...s.data.values()].map((g,v)=>a._parse(new be(s,g,s.path,v)));return s.common.async?Promise.all(d).then(g=>o(g)):o(d)}min(e,r){return new ze({...this._def,minSize:{value:e,message:x.toString(r)}})}max(e,r){return new ze({...this._def,maxSize:{value:e,message:x.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}ze.create=(t,e)=>new ze({valueType:t,minSize:null,maxSize:null,typeName:w.ZodSet,...T(e)});class Gt extends O{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Gt.create=(t,e)=>new Gt({getter:t,typeName:w.ZodLazy,...T(e)});class mt extends O{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return y(r,{received:r.data,code:c.invalid_literal,expected:this._def.value}),k}return{status:"valid",value:e.data}}get value(){return this._def.value}}mt.create=(t,e)=>new mt({value:t,typeName:w.ZodLiteral,...T(e)});function lr(t,e){return new De({values:t,typeName:w.ZodEnum,...T(e)})}class De extends O{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),s=this._def.values;return y(r,{expected:E.joinValues(s),received:r.parsedType,code:c.invalid_type}),k}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),s=this._def.values;return y(r,{received:r.data,code:c.invalid_enum_value,options:s}),k}return te(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return De.create(e,{...this._def,...r})}exclude(e,r=this._def){return De.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}}De.create=lr;class Yt extends O{_parse(e){const r=E.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==p.string&&s.parsedType!==p.number){const i=E.objectValues(r);return y(s,{expected:E.joinValues(i),received:s.parsedType,code:c.invalid_type}),k}if(this._cache||(this._cache=new Set(E.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=E.objectValues(r);return y(s,{received:s.data,code:c.invalid_enum_value,options:i}),k}return te(e.data)}get enum(){return this._def.values}}Yt.create=(t,e)=>new Yt({values:t,typeName:w.ZodNativeEnum,...T(e)});class Ke extends O{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.promise&&r.common.async===!1)return y(r,{code:c.invalid_type,expected:p.promise,received:r.parsedType}),k;const s=r.parsedType===p.promise?r.data:Promise.resolve(r.data);return te(s.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Ke.create=(t,e)=>new Ke({type:t,typeName:w.ZodPromise,...T(e)});class Ze extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:s}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{y(s,o),o.fatal?r.abort():r.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){const o=i.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async d=>{if(r.value==="aborted")return k;const g=await this._def.schema._parseAsync({data:d,path:s.path,parent:s});return g.status==="aborted"?k:g.status==="dirty"||r.value==="dirty"?Pe(g.value):g});{if(r.value==="aborted")return k;const d=this._def.schema._parseSync({data:o,path:s.path,parent:s});return d.status==="aborted"?k:d.status==="dirty"||r.value==="dirty"?Pe(d.value):d}}if(i.type==="refinement"){const o=d=>{const g=i.refinement(d,a);if(s.common.async)return Promise.resolve(g);if(g instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(s.common.async===!1){const d=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return d.status==="aborted"?k:(d.status==="dirty"&&r.dirty(),o(d.value),{status:r.value,value:d.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(d=>d.status==="aborted"?k:(d.status==="dirty"&&r.dirty(),o(d.value).then(()=>({status:r.value,value:d.value}))))}if(i.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Fe(o))return k;const d=i.transform(o.value,a);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:d}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>Fe(o)?Promise.resolve(i.transform(o.value,a)).then(d=>({status:r.value,value:d})):k);E.assertNever(i)}}Ze.create=(t,e,r)=>new Ze({schema:t,typeName:w.ZodEffects,effect:e,...T(r)});Ze.createWithPreprocess=(t,e,r)=>new Ze({schema:e,effect:{type:"preprocess",transform:t},typeName:w.ZodEffects,...T(r)});class xe extends O{_parse(e){return this._getType(e)===p.undefined?te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}xe.create=(t,e)=>new xe({innerType:t,typeName:w.ZodOptional,...T(e)});class je extends O{_parse(e){return this._getType(e)===p.null?te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}je.create=(t,e)=>new je({innerType:t,typeName:w.ZodNullable,...T(e)});class yt extends O{_parse(e){const{ctx:r}=this._processInputParams(e);let s=r.data;return r.parsedType===p.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}yt.create=(t,e)=>new yt({innerType:t,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});class gt extends O{_parse(e){const{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Ye(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ye(s.common.issues)},input:s.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ye(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}gt.create=(t,e)=>new gt({innerType:t,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});class Jt extends O{_parse(e){if(this._getType(e)!==p.nan){const s=this._getOrReturnCtx(e);return y(s,{code:c.invalid_type,expected:p.nan,received:s.parsedType}),k}return{status:"valid",value:e.data}}}Jt.create=t=>new Jt({typeName:w.ZodNaN,...T(t)});class es extends O{_parse(e){const{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}}class xt extends O{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?k:a.status==="dirty"?(r.dirty(),Pe(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const i=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?k:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:s.path,parent:s})}}static create(e,r){return new xt({in:e,out:r,typeName:w.ZodPipeline})}}class vt extends O{_parse(e){const r=this._def.innerType._parse(e),s=i=>(Fe(i)&&(i.value=Object.freeze(i.value)),i);return Ye(r)?r.then(i=>s(i)):s(r)}unwrap(){return this._def.innerType}}vt.create=(t,e)=>new vt({innerType:t,typeName:w.ZodReadonly,...T(e)});var w;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(w||(w={}));const Cs=me.create,Ss=Te.create;Ce.create;const Vs=Je.create;Ie.create;ke.create;const Os=ue.create,Es=P.create;Qe.create;Xe.create;Se.create;const Rs=mt.create,Ns=De.create;Ke.create;xe.create;je.create;const Fs={string:(t=>me.create({...t,coerce:!0})),number:(t=>Te.create({...t,coerce:!0})),boolean:(t=>Je.create({...t,coerce:!0})),bigint:(t=>Ce.create({...t,coerce:!0})),date:(t=>Ie.create({...t,coerce:!0}))};var We=t=>t.type==="checkbox",Ae=t=>t instanceof Date,Y=t=>t==null;const cr=t=>typeof t=="object";var M=t=>!Y(t)&&!Array.isArray(t)&&cr(t)&&!Ae(t),ts=t=>M(t)&&t.target?We(t.target)?t.target.checked:t.target.value:t,fr=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,rs=(t,e)=>t.has(fr(e)),ss=t=>{const e=t.constructor&&t.constructor.prototype;return M(e)&&e.hasOwnProperty("isPrototypeOf")},bt=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function B(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(bt&&(t instanceof Blob||e))return t;const r=Array.isArray(t);if(!r&&!(M(t)&&ss(t)))return t;const s=r?[]:Object.create(Object.getPrototypeOf(t));for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=B(t[i]));return s}var rt=t=>/^\w*$/.test(t),Z=t=>t===void 0,kt=t=>Array.isArray(t)?t.filter(Boolean):[],wt=t=>kt(t.replace(/["|']|\]/g,"").split(/\.|\[/)),_=(t,e,r)=>{if(!e||!M(t))return r;const s=(rt(e)?[e]:wt(e)).reduce((i,a)=>Y(i)?i:i[a],t);return Z(s)||s===t?Z(t[e])?r:t[e]:s},de=t=>typeof t=="boolean",se=t=>typeof t=="function",D=(t,e,r)=>{let s=-1;const i=rt(e)?[e]:wt(e),a=i.length,o=a-1;for(;++s<a;){const d=i[s];let g=r;if(s!==o){const v=t[d];g=M(v)||Array.isArray(v)?v:isNaN(+i[s+1])?{}:[]}if(d==="__proto__"||d==="constructor"||d==="prototype")return;t[d]=g,t=t[d]}};const Oe={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},ae={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},re={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},lt="form",hr="root",as=z.createContext(null);as.displayName="HookFormControlContext";var is=(t,e,r,s=!0)=>{const i={defaultValues:e._defaultValues};for(const a in t)Object.defineProperty(i,a,{get:()=>{const o=a;return e._proxyFormState[o]!==ae.all&&(e._proxyFormState[o]=!s||ae.all),t[o]}});return i};const ns=typeof window<"u"?z.useLayoutEffect:z.useEffect;var q=t=>typeof t=="string",os=(t,e,r,s,i)=>q(t)?(s&&e.watch.add(t),_(r,t,i)):Array.isArray(t)?t.map(a=>(s&&e.watch.add(a),_(r,a))):(s&&(e.watchAll=!0),r),_t=t=>Y(t)||!cr(t);function pe(t,e,r=new WeakSet){if(_t(t)||_t(e))return Object.is(t,e);if(Ae(t)&&Ae(e))return Object.is(t.getTime(),e.getTime());const s=Object.keys(t),i=Object.keys(e);if(s.length!==i.length)return!1;if(r.has(t)||r.has(e))return!0;r.add(t),r.add(e);for(const a of s){const o=t[a];if(!i.includes(a))return!1;if(a!=="ref"){const d=e[a];if(Ae(o)&&Ae(d)||M(o)&&M(d)||Array.isArray(o)&&Array.isArray(d)?!pe(o,d,r):!Object.is(o,d))return!1}}return!0}const ds=z.createContext(null);ds.displayName="HookFormContext";var us=(t,e,r,s,i)=>e?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[s]:i||!0}}:{},Ue=t=>Array.isArray(t)?t:[t],Qt=()=>{let t=[];return{get observers(){return t},next:i=>{for(const a of t)a.next&&a.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(a=>a!==i)}}),unsubscribe:()=>{t=[]}}};function mr(t,e){const r={};for(const s in t)if(t.hasOwnProperty(s)){const i=t[s],a=e[s];if(i&&M(i)&&a){const o=mr(i,a);M(o)&&(r[s]=o)}else t[s]&&(r[s]=a)}return r}var W=t=>M(t)&&!Object.keys(t).length,At=t=>t.type==="file",et=t=>{if(!bt)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},yr=t=>t.type==="select-multiple",Tt=t=>t.type==="radio",ls=t=>Tt(t)||We(t),ct=t=>et(t)&&t.isConnected;function cs(t,e){const r=e.slice(0,-1).length;let s=0;for(;s<r;)t=Z(t)?s++:t[e[s++]];return t}function fs(t){for(const e in t)if(t.hasOwnProperty(e)&&!Z(t[e]))return!1;return!0}function $(t,e){const r=Array.isArray(e)?e:rt(e)?[e]:wt(e),s=r.length===1?t:cs(t,r),i=r.length-1,a=r[i];return s&&delete s[a],i!==0&&(M(s)&&W(s)||Array.isArray(s)&&fs(s))&&$(t,r.slice(0,-1)),t}var hs=t=>{for(const e in t)if(se(t[e]))return!0;return!1};function gr(t){return Array.isArray(t)||M(t)&&!hs(t)}function pt(t,e={}){for(const r in t){const s=t[r];gr(s)?(e[r]=Array.isArray(s)?[]:{},pt(s,e[r])):Z(s)||(e[r]=!0)}return e}function Ne(t,e,r){r||(r=pt(e));for(const s in t){const i=t[s];if(gr(i))Z(e)||_t(r[s])?r[s]=pt(i,Array.isArray(i)?[]:{}):Ne(i,Y(e)?{}:e[s],r[s]);else{const a=e[s];r[s]=!pe(i,a)}}return r}const Xt={value:!1,isValid:!1},Kt={value:!0,isValid:!0};var vr=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Z(t[0].attributes.value)?Z(t[0].value)||t[0].value===""?Kt:{value:t[0].value,isValid:!0}:Kt:Xt}return Xt},_r=(t,{valueAsNumber:e,valueAsDate:r,setValueAs:s})=>Z(t)?t:e?t===""?NaN:t&&+t:r&&q(t)?new Date(t):s?s(t):t;const er={isValid:!1,value:null};var pr=t=>Array.isArray(t)?t.reduce((e,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:e,er):er;function tr(t){const e=t.ref;return At(e)?e.files:Tt(e)?pr(t.refs).value:yr(e)?[...e.selectedOptions].map(({value:r})=>r):We(e)?vr(t.refs).value:_r(Z(e.value)?t.ref.value:e.value,t)}var ms=(t,e,r,s)=>{const i={};for(const a of t){const o=_(e,a);o&&D(i,a,o._f)}return{criteriaMode:r,names:[...t],fields:i,shouldUseNativeValidation:s}},tt=t=>t instanceof RegExp,$e=t=>Z(t)?t:tt(t)?t.source:M(t)?tt(t.value)?t.value.source:t.value:t,rr=t=>({isOnSubmit:!t||t===ae.onSubmit,isOnBlur:t===ae.onBlur,isOnChange:t===ae.onChange,isOnAll:t===ae.all,isOnTouch:t===ae.onTouched});const sr="AsyncFunction";var ys=t=>!!t&&!!t.validate&&!!(se(t.validate)&&t.validate.constructor.name===sr||M(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===sr)),gs=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),ar=(t,e,r)=>!r&&(e.watchAll||e.watch.has(t)||[...e.watch].some(s=>t.startsWith(s)&&/^\.\w+/.test(t.slice(s.length))));const Be=(t,e,r,s)=>{for(const i of r||Object.keys(t)){const a=_(t,i);if(a){const{_f:o,...d}=a;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],i)&&!s)return!0;if(o.ref&&e(o.ref,o.name)&&!s)return!0;if(Be(d,e))break}else if(M(d)&&Be(d,e))break}}};function ir(t,e,r){const s=_(t,r);if(s||rt(r))return{error:s,name:r};const i=r.split(".");for(;i.length;){const a=i.join("."),o=_(e,a),d=_(t,a);if(o&&!Array.isArray(o)&&r!==a)return{name:r};if(d&&d.type)return{name:a,error:d};if(d&&d.root&&d.root.type)return{name:`${a}.root`,error:d.root};i.pop()}return{name:r}}var vs=(t,e,r,s)=>{r(t);const{name:i,...a}=t;return W(a)||Object.keys(a).length>=Object.keys(e).length||Object.keys(a).find(o=>e[o]===(!s||ae.all))},_s=(t,e,r)=>!t||!e||t===e||Ue(t).some(s=>s&&(r?s===e:s.startsWith(e)||e.startsWith(s))),ps=(t,e,r,s,i)=>i.isOnAll?!1:!r&&i.isOnTouch?!(e||t):(r?s.isOnBlur:i.isOnBlur)?!t:(r?s.isOnChange:i.isOnChange)?t:!0,xs=(t,e)=>!kt(_(t,e)).length&&$(t,e),bs=(t,e,r)=>{const s=Ue(_(t,r));return D(s,hr,e[r]),D(t,r,s),t};function nr(t,e,r="validate"){if(q(t)||Array.isArray(t)&&t.every(q)||de(t)&&!t)return{type:r,message:q(t)?t:"",ref:e}}var Ee=t=>M(t)&&!tt(t)?t:{value:t,message:""},or=async(t,e,r,s,i,a)=>{const{ref:o,refs:d,required:g,maxLength:v,minLength:C,min:N,max:j,pattern:S,validate:le,name:J,valueAsNumber:ie,mount:K}=t._f,R=_(r,J);if(!K||e.has(J))return{};const ce=d?d[0]:o,fe=F=>{i&&ce.reportValidity&&(ce.setCustomValidity(de(F)?"":F||""),ce.reportValidity())},U={},Le=Tt(o),qe=We(o),we=Le||qe,Ve=(ie||At(o))&&Z(o.value)&&Z(R)||et(o)&&o.value===""||R===""||Array.isArray(R)&&!R.length,ge=us.bind(null,J,s,U),he=(F,V,L,H=re.maxLength,ee=re.minLength)=>{const ne=F?V:L;U[J]={type:F?H:ee,message:ne,ref:o,...ge(F?H:ee,ne)}};if(a?!Array.isArray(R)||!R.length:g&&(!we&&(Ve||Y(R))||de(R)&&!R||qe&&!vr(d).isValid||Le&&!pr(d).isValid)){const{value:F,message:V}=q(g)?{value:!!g,message:g}:Ee(g);if(F&&(U[J]={type:re.required,message:V,ref:ce,...ge(re.required,V)},!s))return fe(V),U}if(!Ve&&(!Y(N)||!Y(j))){let F,V;const L=Ee(j),H=Ee(N);if(!Y(R)&&!isNaN(R)){const ee=o.valueAsNumber||R&&+R;Y(L.value)||(F=ee>L.value),Y(H.value)||(V=ee<H.value)}else{const ee=o.valueAsDate||new Date(R),ne=He=>new Date(new Date().toDateString()+" "+He),ve=o.type=="time",Me=o.type=="week";q(L.value)&&R&&(F=ve?ne(R)>ne(L.value):Me?R>L.value:ee>new Date(L.value)),q(H.value)&&R&&(V=ve?ne(R)<ne(H.value):Me?R<H.value:ee<new Date(H.value))}if((F||V)&&(he(!!F,L.message,H.message,re.max,re.min),!s))return fe(U[J].message),U}if((v||C)&&!Ve&&(q(R)||a&&Array.isArray(R))){const F=Ee(v),V=Ee(C),L=!Y(F.value)&&R.length>+F.value,H=!Y(V.value)&&R.length<+V.value;if((L||H)&&(he(L,F.message,V.message),!s))return fe(U[J].message),U}if(S&&!Ve&&q(R)){const{value:F,message:V}=Ee(S);if(tt(F)&&!R.match(F)&&(U[J]={type:re.pattern,message:V,ref:o,...ge(re.pattern,V)},!s))return fe(V),U}if(le){if(se(le)){const F=await le(R,r),V=nr(F,ce);if(V&&(U[J]={...V,...ge(re.validate,V.message)},!s))return fe(V.message),U}else if(M(le)){let F={};for(const V in le){if(!W(F)&&!s)break;const L=nr(await le[V](R,r),ce,V);L&&(F={...L,...ge(V,L.message)},fe(L.message),s&&(U[J]=F))}if(!W(F)&&(U[J]={ref:ce,...F},!s))return U}}return fe(!0),U};const ks={mode:ae.onSubmit,reValidateMode:ae.onChange,shouldFocusError:!0};function ws(t={}){let e={...ks,...t},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:se(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},s={},i=M(e.defaultValues)||M(e.values)?B(e.defaultValues||e.values)||{}:{},a=e.shouldUnregister?{}:B(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},g,v=0;const C={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},N={...C};let j={...N};const S={array:Qt(),state:Qt()},le=e.criteriaMode===ae.all,J=n=>u=>{clearTimeout(v),v=setTimeout(n,u)},ie=async n=>{if(!o.keepIsValid&&!e.disabled&&(N.isValid||j.isValid||n)){let u;e.resolver?(u=W((await we()).errors),K()):u=await he({fields:s,onlyCheckValid:!0,eventType:Oe.VALID}),u!==r.isValid&&S.state.next({isValid:u})}},K=(n,u)=>{!e.disabled&&(N.isValidating||N.validatingFields||j.isValidating||j.validatingFields)&&((n||Array.from(d.mount)).forEach(l=>{l&&(u?D(r.validatingFields,l,u):$(r.validatingFields,l))}),S.state.next({validatingFields:r.validatingFields,isValidating:!W(r.validatingFields)}))},R=(n,u=[],l,m,f=!0,h=!0)=>{if(m&&l&&!e.disabled){if(o.action=!0,h&&Array.isArray(_(s,n))){const b=l(_(s,n),m.argA,m.argB);f&&D(s,n,b)}if(h&&Array.isArray(_(r.errors,n))){const b=l(_(r.errors,n),m.argA,m.argB);f&&D(r.errors,n,b),xs(r.errors,n)}if((N.touchedFields||j.touchedFields)&&h&&Array.isArray(_(r.touchedFields,n))){const b=l(_(r.touchedFields,n),m.argA,m.argB);f&&D(r.touchedFields,n,b)}if(N.dirtyFields||j.dirtyFields){const b=Ne(i,a),A=fr(n);D(r.dirtyFields,A,_(b,A))}S.state.next({name:n,isDirty:V(n,u),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else D(a,n,u)},ce=(n,u)=>{D(r.errors,n,u),S.state.next({errors:r.errors})},fe=n=>{r.errors=n,S.state.next({errors:r.errors,isValid:!1})},U=(n,u,l,m)=>{const f=_(s,n);if(f){const h=_(a,n,Z(l)?_(i,n):l);Z(h)||m&&m.defaultChecked||u?D(a,n,u?h:tr(f._f)):ee(n,h),o.mount&&!o.action&&ie()}},Le=(n,u,l,m,f)=>{let h=!1,b=!1;const A={name:n};if(!e.disabled){if(!l||m){(N.isDirty||j.isDirty)&&(b=r.isDirty,r.isDirty=A.isDirty=V(),h=b!==A.isDirty);const I=pe(_(i,n),u);b=!!_(r.dirtyFields,n),I?$(r.dirtyFields,n):D(r.dirtyFields,n,!0),A.dirtyFields=r.dirtyFields,h=h||(N.dirtyFields||j.dirtyFields)&&b!==!I}if(l){const I=_(r.touchedFields,n);I||(D(r.touchedFields,n,l),A.touchedFields=r.touchedFields,h=h||(N.touchedFields||j.touchedFields)&&I!==l)}h&&f&&S.state.next(A)}return h?A:{}},qe=(n,u,l,m)=>{const f=_(r.errors,n),h=(N.isValid||j.isValid)&&de(u)&&r.isValid!==u;if(e.delayError&&l?(g=J(()=>ce(n,l)),g(e.delayError)):(clearTimeout(v),g=null,l?D(r.errors,n,l):$(r.errors,n)),(l?!pe(f,l):f)||!W(m)||h){const b={...m,...h&&de(u)?{isValid:u}:{},errors:r.errors,name:n};r={...r,...b},S.state.next(b)}},we=async n=>(K(n,!0),await e.resolver(a,e.context,ms(n||d.mount,s,e.criteriaMode,e.shouldUseNativeValidation))),Ve=async n=>{const{errors:u}=await we(n);if(K(n),n)for(const l of n){const m=_(u,l);m?D(r.errors,l,m):$(r.errors,l)}else r.errors=u;return u},ge=async({name:n,eventType:u})=>{if(t.validate){const l=await t.validate({formValues:a,formState:r,name:n,eventType:u});if(M(l))for(const m in l)l[m]&&Ge(`${lt}.${m}`,{message:q(l.message)?l.message:"",type:re.validate});else q(l)||!l?Ge(lt,{message:l||"",type:re.validate}):Vt(lt);return l}return!0},he=async({fields:n,onlyCheckValid:u,name:l,eventType:m,context:f={valid:!0,runRootValidation:!1}})=>{if(t.validate&&(f.runRootValidation=!0,!await ge({name:l,eventType:m})&&(f.valid=!1,u)))return f.valid;for(const h in n){const b=n[h];if(b){const{_f:A,...I}=b;if(A){const Q=d.array.has(A.name),oe=b._f&&ys(b._f);oe&&N.validatingFields&&K([A.name],!0);const G=await or(b,d.disabled,a,le,e.shouldUseNativeValidation&&!u,Q);if(oe&&N.validatingFields&&K([A.name]),G[A.name]&&(f.valid=!1,u)||(!u&&(_(G,A.name)?Q?bs(r.errors,G,A.name):D(r.errors,A.name,G[A.name]):$(r.errors,A.name)),t.shouldUseNativeValidation&&G[A.name]))break}!W(I)&&await he({context:f,onlyCheckValid:u,fields:I,name:h,eventType:m})}}return f.valid},F=()=>{for(const n of d.unMount){const u=_(s,n);u&&(u._f.refs?u._f.refs.every(l=>!ct(l)):!ct(u._f.ref))&&at(n)}d.unMount=new Set},V=(n,u)=>!e.disabled&&(n&&u&&D(a,n,u),!pe(Ct(),i)),L=(n,u,l)=>os(n,d,{...o.mount?a:Z(u)?i:q(n)?{[n]:u}:u},l,u),H=n=>kt(_(o.mount?a:i,n,e.shouldUnregister?_(i,n,[]):[])),ee=(n,u,l={})=>{const m=_(s,n);let f=u;if(m){const h=m._f;h&&(!h.disabled&&D(a,n,_r(u,h)),f=et(h.ref)&&Y(u)?"":u,yr(h.ref)?[...h.ref.options].forEach(b=>b.selected=f.includes(b.value)):h.refs?We(h.ref)?h.refs.forEach(b=>{(!b.defaultChecked||!b.disabled)&&(Array.isArray(f)?b.checked=!!f.find(A=>A===b.value):b.checked=f===b.value||!!f)}):h.refs.forEach(b=>b.checked=b.value===f):At(h.ref)?h.ref.value="":(h.ref.value=f,h.ref.type||S.state.next({name:n,values:B(a)})))}(l.shouldDirty||l.shouldTouch)&&Le(n,f,l.shouldTouch,l.shouldDirty,!0),l.shouldValidate&&st(n)},ne=(n,u,l)=>{for(const m in u){if(!u.hasOwnProperty(m))return;const f=u[m],h=n+"."+m,b=_(s,h);(d.array.has(n)||M(f)||b&&!b._f)&&!Ae(f)?ne(h,f,l):ee(h,f,l)}},ve=(n,u,l={})=>{const m=_(s,n),f=d.array.has(n),h=B(u);D(a,n,h),f?(S.array.next({name:n,values:B(a)}),(N.isDirty||N.dirtyFields||j.isDirty||j.dirtyFields)&&l.shouldDirty&&S.state.next({name:n,dirtyFields:Ne(i,a),isDirty:V(n,h)})):m&&!m._f&&!Y(h)?ne(n,h,l):ee(n,h,l),ar(n,d)?S.state.next({...r,name:n,values:B(a)}):S.state.next({name:o.mount?n:void 0,values:B(a)})},Me=async n=>{o.mount=!0;const u=n.target;let l=u.name,m=!0;const f=_(s,l),h=I=>{m=Number.isNaN(I)||Ae(I)&&isNaN(I.getTime())||pe(I,_(a,l,I))},b=rr(e.mode),A=rr(e.reValidateMode);if(f){let I,Q;const oe=u.type?tr(f._f):ts(n),G=n.type===Oe.BLUR||n.type===Oe.FOCUS_OUT,Cr=!gs(f._f)&&!t.validate&&!e.resolver&&!_(r.errors,l)&&!f._f.deps||ps(G,_(r.touchedFields,l),r.isSubmitted,A,b),ot=ar(l,d,G);D(a,l,oe),G?(!u||!u.readOnly)&&(f._f.onBlur&&f._f.onBlur(n),g&&g(0)):f._f.onChange&&f._f.onChange(n);const dt=Le(l,oe,G),Sr=!W(dt)||ot;if(!G&&S.state.next({name:l,type:n.type,values:B(a)}),Cr)return(N.isValid||j.isValid)&&(e.mode==="onBlur"?G&&ie():G||ie()),Sr&&S.state.next({name:l,...ot?{}:dt});if(!e.resolver&&t.validate&&await ge({name:l,eventType:n.type}),!G&&ot&&S.state.next({...r}),e.resolver){const{errors:Dt}=await we([l]);if(K([l]),h(oe),m){const Vr=ir(r.errors,s,l),Zt=ir(Dt,s,Vr.name||l);I=Zt.error,l=Zt.name,Q=W(Dt)}}else K([l],!0),I=(await or(f,d.disabled,a,le,e.shouldUseNativeValidation))[l],K([l]),h(oe),m&&(I?Q=!1:(N.isValid||j.isValid)&&(Q=await he({fields:s,onlyCheckValid:!0,name:l,eventType:n.type})));m&&(f._f.deps&&(!Array.isArray(f._f.deps)||f._f.deps.length>0)&&st(f._f.deps),qe(l,Q,I,dt))}},He=(n,u)=>{if(_(r.errors,u)&&n.focus)return n.focus(),1},st=async(n,u={})=>{let l,m;const f=Ue(n);if(e.resolver){const h=await Ve(Z(n)?n:f);l=W(h),m=n?!f.some(b=>_(h,b)):l}else n?(m=(await Promise.all(f.map(async h=>{const b=_(s,h);return await he({fields:b&&b._f?{[h]:b}:b,eventType:Oe.TRIGGER})}))).every(Boolean),!(!m&&!r.isValid)&&ie()):m=l=await he({fields:s,name:n,eventType:Oe.TRIGGER});return S.state.next({...!q(n)||(N.isValid||j.isValid)&&l!==r.isValid?{}:{name:n},...e.resolver||!n?{isValid:l}:{},errors:r.errors}),u.shouldFocus&&!m&&Be(s,He,n?f:d.mount),m},Ct=(n,u)=>{let l={...o.mount?a:i};return u&&(l=mr(u.dirtyFields?r.dirtyFields:r.touchedFields,l)),Z(n)?l:q(n)?_(l,n):n.map(m=>_(l,m))},St=(n,u)=>({invalid:!!_((u||r).errors,n),isDirty:!!_((u||r).dirtyFields,n),error:_((u||r).errors,n),isValidating:!!_(r.validatingFields,n),isTouched:!!_((u||r).touchedFields,n)}),Vt=n=>{const u=n?Ue(n):void 0;u==null||u.forEach(l=>$(r.errors,l)),u?u.forEach(l=>{S.state.next({name:l,errors:r.errors})}):S.state.next({errors:{}})},Ge=(n,u,l)=>{const m=(_(s,n,{_f:{}})._f||{}).ref,f=_(r.errors,n)||{},{ref:h,message:b,type:A,...I}=f;D(r.errors,n,{...I,...u,ref:m}),S.state.next({name:n,errors:r.errors,isValid:!1}),l&&l.shouldFocus&&m&&m.focus&&m.focus()},xr=(n,u)=>se(n)?S.state.subscribe({next:l=>"values"in l&&n(L(void 0,u),l)}):L(n,u,!0),Ot=n=>S.state.subscribe({next:u=>{_s(n.name,u.name,n.exact)&&vs(u,n.formState||N,Tr,n.reRenderRoot)&&n.callback({values:{...a},...r,...u,defaultValues:i})}}).unsubscribe,br=n=>(o.mount=!0,j={...j,...n.formState},Ot({...n,formState:{...C,...n.formState}})),at=(n,u={})=>{for(const l of n?Ue(n):d.mount)d.mount.delete(l),d.array.delete(l),u.keepValue||($(s,l),$(a,l)),!u.keepError&&$(r.errors,l),!u.keepDirty&&$(r.dirtyFields,l),!u.keepTouched&&$(r.touchedFields,l),!u.keepIsValidating&&$(r.validatingFields,l),!e.shouldUnregister&&!u.keepDefaultValue&&$(i,l);S.state.next({values:B(a)}),S.state.next({...r,...u.keepDirty?{isDirty:V()}:{}}),!u.keepIsValid&&ie()},Et=({disabled:n,name:u})=>{if(de(n)&&o.mount||n||d.disabled.has(u)){const f=d.disabled.has(u)!==!!n;n?d.disabled.add(u):d.disabled.delete(u),f&&o.mount&&!o.action&&ie()}},it=(n,u={})=>{let l=_(s,n);const m=de(u.disabled)||de(e.disabled);return D(s,n,{...l||{},_f:{...l&&l._f?l._f:{ref:{name:n}},name:n,mount:!0,...u}}),d.mount.add(n),l?Et({disabled:de(u.disabled)?u.disabled:e.disabled,name:n}):U(n,!0,u.value),{...m?{disabled:u.disabled||e.disabled}:{},...e.progressive?{required:!!u.required,min:$e(u.min),max:$e(u.max),minLength:$e(u.minLength),maxLength:$e(u.maxLength),pattern:$e(u.pattern)}:{},name:n,onChange:Me,onBlur:Me,ref:f=>{if(f){it(n,u),l=_(s,n);const h=Z(f.value)&&f.querySelectorAll&&f.querySelectorAll("input,select,textarea")[0]||f,b=ls(h),A=l._f.refs||[];if(b?A.find(I=>I===h):h===l._f.ref)return;D(s,n,{_f:{...l._f,...b?{refs:[...A.filter(ct),h,...Array.isArray(_(i,n))?[{}]:[]],ref:{type:h.type,name:n}}:{ref:h}}}),U(n,!1,void 0,h)}else l=_(s,n,{}),l._f&&(l._f.mount=!1),(e.shouldUnregister||u.shouldUnregister)&&!(rs(d.array,n)&&o.action)&&d.unMount.add(n)}}},nt=()=>e.shouldFocusError&&Be(s,He,d.mount),kr=n=>{de(n)&&(S.state.next({disabled:n}),Be(s,(u,l)=>{const m=_(s,l);m&&(u.disabled=m._f.disabled||n,Array.isArray(m._f.refs)&&m._f.refs.forEach(f=>{f.disabled=m._f.disabled||n}))},0,!1))},Rt=(n,u)=>async l=>{let m;l&&(l.preventDefault&&l.preventDefault(),l.persist&&l.persist());let f=B(a);if(S.state.next({isSubmitting:!0}),e.resolver){const{errors:h,values:b}=await we();K(),r.errors=h,f=B(b)}else await he({fields:s,eventType:Oe.SUBMIT});if(d.disabled.size)for(const h of d.disabled)$(f,h);if($(r.errors,hr),W(r.errors)){S.state.next({errors:{}});try{await n(f,l)}catch(h){m=h}}else u&&await u({...r.errors},l),nt(),setTimeout(nt);if(S.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:W(r.errors)&&!m,submitCount:r.submitCount+1,errors:r.errors}),m)throw m},wr=(n,u={})=>{_(s,n)&&(Z(u.defaultValue)?ve(n,B(_(i,n))):(ve(n,u.defaultValue),D(i,n,B(u.defaultValue))),u.keepTouched||$(r.touchedFields,n),u.keepDirty||($(r.dirtyFields,n),r.isDirty=u.defaultValue?V(n,B(_(i,n))):V()),u.keepError||($(r.errors,n),N.isValid&&ie()),S.state.next({...r}))},Nt=(n,u={})=>{const l=n?B(n):i,m=B(l),f=W(n),h=f?i:m;if(u.keepDefaultValues||(i=l),!u.keepValues){if(u.keepDirtyValues){const b=new Set([...d.mount,...Object.keys(Ne(i,a))]);for(const A of Array.from(b)){const I=_(r.dirtyFields,A),Q=_(a,A),oe=_(h,A);I&&!Z(Q)?D(h,A,Q):!I&&!Z(oe)&&ve(A,oe)}}else{if(bt&&Z(n))for(const b of d.mount){const A=_(s,b);if(A&&A._f){const I=Array.isArray(A._f.refs)?A._f.refs[0]:A._f.ref;if(et(I)){const Q=I.closest("form");if(Q){Q.reset();break}}}}if(u.keepFieldsRef)for(const b of d.mount)ve(b,_(h,b));else s={}}a=e.shouldUnregister?u.keepDefaultValues?B(i):{}:B(h),S.array.next({values:{...h}}),S.state.next({values:{...h}})}d={mount:u.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!N.isValid||!!u.keepIsValid||!!u.keepDirtyValues||!e.shouldUnregister&&!W(h),o.watch=!!e.shouldUnregister,o.keepIsValid=!!u.keepIsValid,o.action=!1,u.keepErrors||(r.errors={}),S.state.next({submitCount:u.keepSubmitCount?r.submitCount:0,isDirty:f?!1:u.keepDirty?r.isDirty:!!(u.keepDefaultValues&&!pe(n,i)),isSubmitted:u.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:f?{}:u.keepDirtyValues?u.keepDefaultValues&&a?Ne(i,a):r.dirtyFields:u.keepDefaultValues&&n?Ne(i,n):u.keepDirty?r.dirtyFields:{},touchedFields:u.keepTouched?r.touchedFields:{},errors:u.keepErrors?r.errors:{},isSubmitSuccessful:u.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},Ft=(n,u)=>Nt(se(n)?n(a):n,{...e.resetOptions,...u}),Ar=(n,u={})=>{const l=_(s,n),m=l&&l._f;if(m){const f=m.refs?m.refs[0]:m.ref;f.focus&&setTimeout(()=>{f.focus(),u.shouldSelect&&se(f.select)&&f.select()})}},Tr=n=>{r={...r,...n}},It={control:{register:it,unregister:at,getFieldState:St,handleSubmit:Rt,setError:Ge,_subscribe:Ot,_runSchema:we,_updateIsValidating:K,_focusError:nt,_getWatch:L,_getDirty:V,_setValid:ie,_setFieldArray:R,_setDisabledField:Et,_setErrors:fe,_getFieldArray:H,_reset:Nt,_resetDefaultValues:()=>se(e.defaultValues)&&e.defaultValues().then(n=>{Ft(n,e.resetOptions),S.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:kr,_subjects:S,_proxyFormState:N,get _fields(){return s},get _formValues(){return a},get _state(){return o},set _state(n){o=n},get _defaultValues(){return i},get _names(){return d},set _names(n){d=n},get _formState(){return r},get _options(){return e},set _options(n){e={...e,...n}}},subscribe:br,trigger:st,register:it,handleSubmit:Rt,watch:xr,setValue:ve,getValues:Ct,reset:Ft,resetField:wr,clearErrors:Vt,unregister:at,setError:Ge,setFocus:Ar,getFieldState:St};return{...It,formControl:It}}function Is(t={}){const e=z.useRef(void 0),r=z.useRef(void 0),[s,i]=z.useState({isDirty:!1,isValidating:!1,isLoading:se(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:se(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:s},t.defaultValues&&!se(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:o,...d}=ws(t);e.current={...d,formState:s}}const a=e.current.control;return a._options=t,ns(()=>{const o=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(d=>({...d,isReady:!0})),a._formState.isReady=!0,o},[a]),z.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),z.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode)},[a,t.mode,t.reValidateMode]),z.useEffect(()=>{t.errors&&(a._setErrors(t.errors),a._focusError())},[a,t.errors]),z.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),z.useEffect(()=>{if(a._proxyFormState.isDirty){const o=a._getDirty();o!==s.isDirty&&a._subjects.state.next({isDirty:o})}},[a,s.isDirty]),z.useEffect(()=>{var o;t.values&&!pe(t.values,r.current)?(a._reset(t.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((o=a._options.resetOptions)===null||o===void 0)&&o.keepIsValid||a._setValid(),r.current=t.values,i(d=>({...d}))):a._resetDefaultValues()},[a,t.values]),z.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),e.current.formState=z.useMemo(()=>is(s,a),[a,s]),e.current}export{c as Z,Os as a,Vs as b,Fs as c,Ns as e,Rs as l,Ss as n,Es as o,Cs as s,Is as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cc as F,b5 as q,r as o,j as e,aC as p}from"./vendor-DHkYh85p.js";import{j as A,k as H}from"./state-B-4sS1xO.js";import{P as L,u as z,s as K,i as Q,R as $,a as X,V as T,U as C,B as g,C as v,b as w,c as h,W as _,X as V,Y as W}from"./index-BHTUu_4M.js";import{O as Y}from"./open-in-graph-button-Cg5VrKsC.js";import{N as J}from"./note-markdown-DiW2-5d3.js";import{E as Z}from"./entity-notes-surface-DgEgicaE.js";import{P as ee}from"./preference-entity-handoff-button-D4WAs9pC.js";import{b as te,f as se,P as ae}from"./project-collections-DvaX20q_.js";import{P as ie}from"./page-hero-CQWo1Mm_.js";import{g as le,a as ne}from"./activity-copy-Bj4h9OcF.js";import{g as oe}from"./entity-links-DwpxhW2H.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";import"./note-tags-input-DDLXf54U.js";function ke(){const{t:s}=L(),i=z(),d=F(),G=q(),u=A(),[O,N]=o.useState(!1),[S,y]=o.useState(!1),[m,B]=o.useState("active"),j=K(i.selectedUserIds),[E,b]=o.useState(null),D=H({mutationFn:()=>$(d.goalId),onSuccess:async()=>{await Promise.all([Q(u),u.invalidateQueries({queryKey:["project-board"]}),u.invalidateQueries({queryKey:["task-context"]})]),G("/goals")}}),a=i.snapshot.dashboard.goals.find(t=>t.id===d.goalId)??null,x=o.useMemo(()=>i.snapshot.dashboard.projects.filter(t=>t.goalId===d.goalId),[d.goalId,i.snapshot.dashboard.projects]),R=o.useMemo(()=>te(x),[x]),n=o.useMemo(()=>se(x,m),[x,m]),k=new Set(x.map(t=>t.id)),I=new Set(i.snapshot.tasks.filter(t=>k.has(t.projectId??"")).map(t=>t.id)),f=i.snapshot.activity.filter(t=>t.entityId===d.goalId||k.has(t.entityId)||I.has(t.entityId)||t.entityType==="task_run"&&typeof t.metadata.taskId=="string"&&I.has(t.metadata.taskId));if(!a)return e.jsx(X,{eyebrow:s("common.goalDetail.eyebrow"),title:s("common.goalDetail.missingTitle"),description:s("common.goalDetail.missingDescription"),action:e.jsx(p,{to:"/goals",className:"inline-flex min-h-10 min-w-0 max-w-full items-center justify-center whitespace-nowrap rounded-full bg-[var(--primary)] px-4 py-2 text-sm font-medium text-slate-950 transition hover:opacity-90",children:s("common.goalDetail.backToGoals")})});const l=n.find(t=>t.nextTaskTitle)??n[0]??null,r=i.snapshot.overview.neglectedGoals.find(t=>t.goalId===a.id)??null,c=f[0]??null,M=async t=>{b(t);try{await i.patchProject(t,{status:"active"})}finally{b(null)}},U=async()=>{window.confirm(s("common.goalDetail.deleteGoalConfirm",{title:a.title}))&&await D.mutateAsync()};return e.jsxs("div",{className:"grid min-w-0 gap-5",children:[e.jsx(ie,{entityKind:"goal",title:e.jsx(T,{kind:"goal",label:a.title,variant:"heading",size:"lg"}),titleText:a.title,description:a.description?e.jsx(J,{markdown:a.description,className:"[&>p]:text-[13px] [&>p]:leading-6 [&>blockquote]:text-[13px] [&>ul]:text-[13px] [&>ol]:text-[13px]"}):"No strategic description yet.",badge:s(n.length===1?"common.goalDetail.heroBadgeOne":"common.goalDetail.heroBadgeOther",{count:n.length}),actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(ee,{userId:j,domain:"projects",entityType:"goal",entityId:a.id,label:a.title,description:a.description}),e.jsx(Y,{entityType:"goal",entityId:a.id})]})}),a.user?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-white/62",children:[e.jsx("span",{className:"text-white/42",children:"Owned by"}),e.jsx(C,{user:a.user})]}):null,e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(g,{onClick:()=>N(!0),children:s("common.goalDetail.edit")}),e.jsx(g,{variant:"secondary",onClick:()=>y(!0),children:s("common.goalDetail.addProject")}),e.jsx(g,{variant:"ghost",className:"text-rose-200 hover:bg-rose-500/10",pending:D.isPending,pendingLabel:s("common.goalDetail.deleting"),onClick:()=>void U(),children:s("common.goalDetail.deleteGoal")})]}),e.jsxs("section",{className:"grid min-w-0 gap-5 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsxs(v,{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:s("common.goalDetail.sectionProjects")}),e.jsx(ae,{value:m,counts:R,onChange:B,className:"justify-end"})]}),n.length===0?e.jsx("div",{className:"mt-4 rounded-[20px] bg-white/[0.04] p-4 text-sm text-white/58",children:m==="active"?s("common.goalDetail.noProjects"):"No projects match this lifecycle filter yet. Switch filters or restart one to make it active again."}):e.jsx("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:n.map(t=>e.jsxs("div",{className:"rounded-[22px] bg-white/[0.04] p-5 transition hover:bg-white/[0.08]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(w,{kind:"project",compact:!0,gradient:!1}),t.user?e.jsx(C,{user:t.user,compact:!0}):null]}),e.jsx(h,{children:t.status})]}),e.jsx("div",{className:"mt-4",children:e.jsx(p,{to:`/projects/${t.id}`,className:"transition hover:opacity-90",children:e.jsx(T,{kind:"project",label:t.title,variant:"heading",size:"lg"})})}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-white/58",children:t.description}),e.jsx("div",{className:"mt-4",children:e.jsx(_,{value:t.progress})}),e.jsx("div",{className:"mt-4 text-[11px] uppercase tracking-[0.16em] text-white/40",children:t.nextTaskTitle?s("common.goalDetail.nextMove",{value:t.nextTaskTitle}):s("common.goalDetail.addNextTask")}),e.jsxs("div",{className:"mt-4 flex flex-wrap justify-between gap-3",children:[e.jsx(p,{to:`/projects/${t.id}`,children:e.jsx(g,{variant:"ghost",children:"Open project"})}),m!=="active"&&t.status!=="active"?e.jsx(g,{variant:"secondary",size:"sm",pending:E===t.id,pendingLabel:"Restarting…",onClick:()=>void M(t.id),children:"Restart"}):null]})]},t.id))})]}),e.jsx("div",{className:"grid min-w-0 gap-5",children:e.jsxs(v,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:s("common.goalDetail.sectionHealth")}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.jsx(w,{kind:"goal",compact:!0,gradient:!1}),e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:s("common.goalDetail.progressTitle",{progress:a.progress,count:a.completedTasks})}),e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:s("common.goalDetail.progressDetail",{xp:a.earnedPoints})}),e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:s(n.length===1?"common.goalDetail.heroBadgeOne":"common.goalDetail.heroBadgeOther",{count:n.length})})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:s("common.goalDetail.fieldProgress")}),e.jsxs("div",{className:"mt-2 font-display text-xl text-white",children:[a.progress,"%"]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:s("common.goalDetail.fieldCompletedTasks")}),e.jsx("div",{className:"mt-2 font-display text-xl text-white",children:a.completedTasks})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:s("common.goalDetail.fieldXpBanked")}),e.jsx("div",{className:"mt-2 font-display text-xl text-white",children:a.earnedPoints})]})]}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:s("common.goalDetail.signalNext")}),l?e.jsx(w,{kind:"project",compact:!0,gradient:!1}):null]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:(l==null?void 0:l.title)??s("common.goalDetail.noProject")}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:l!=null&&l.nextTaskTitle?s("common.goalDetail.nextMove",{value:l.nextTaskTitle}):(l==null?void 0:l.description)||s("common.goalDetail.noProjectDetail")})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:s("common.goalDetail.signalRisk")}),e.jsx("div",{className:"mt-2 font-medium text-white",children:(r==null?void 0:r.title)??s("common.goalDetail.noRisk")}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:(r==null?void 0:r.summary)||s("common.goalDetail.noRiskDetail")})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:s("common.goalDetail.signalEvidence")}),e.jsx("div",{className:"mt-2 font-medium text-white",children:(c==null?void 0:c.title)??s("common.goalDetail.noEvidence")}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:(c==null?void 0:c.description)||s("common.goalDetail.noEvidenceDetail")})]})]})]})]})})]}),e.jsx(Z,{entityType:"goal",entityId:a.id,title:"Goal notes",description:"Use notes to capture strategy changes, meaning shifts, and progress context that belongs at the goal level."}),e.jsxs(v,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:s("common.goalDetail.sectionEvidence")}),f.length===0?e.jsx("div",{className:"mt-4 rounded-[20px] bg-white/[0.04] p-4 text-sm text-white/58",children:s("common.goalDetail.noEvidenceLogged")}):e.jsx("div",{className:"mt-4 grid gap-3 lg:grid-cols-2",children:f.slice(0,6).map(t=>e.jsxs(p,{to:oe(t)??`/activity?eventId=${t.id}`,className:"rounded-[18px] bg-white/[0.04] p-4 transition hover:bg-white/[0.08]",children:[e.jsx("div",{className:"font-medium text-white",children:le(t)}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:ne(t)})]},t.id))})]}),e.jsx(V,{open:O,editingGoal:a,tags:i.snapshot.tags,users:i.snapshot.users,defaultUserId:a.userId??j,onOpenChange:N,onSubmit:async(t,P)=>{P&&await i.patchGoal(P,t)}}),e.jsx(W,{open:S,goals:i.snapshot.goals,users:i.snapshot.users,editingProject:null,initialGoalId:a.id,defaultUserId:a.userId??j,onOpenChange:y,onSubmit:async t=>{await i.createProject(t)}})]})}export{ke as GoalDetailPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as g,j as e,aC as b,c4 as P,b8 as C}from"./vendor-DHkYh85p.js";import{P as S}from"./page-hero-CQWo1Mm_.js";import{E as G}from"./entity-note-count-link-BmGDB572.js";import{C as N,B as y,b as k,V as p,c as l,X as E,Z as v,u as z,s as L,a as T,_ as B,U as I,W as R}from"./index-BHTUu_4M.js";import{P as D}from"./pill-cluster-BJogDRDJ.js";import{b as F,f as U,P as M}from"./project-collections-DvaX20q_.js";import"./state-B-4sS1xO.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";function O({goals:s,tags:n,users:c,defaultUserId:o=null,pending:d=!1,onCreate:r,onUpdate:j}){const[u,x]=g.useState(!1),[w,m]=g.useState(null),a=s.find(t=>t.id===w)??null;return e.jsxs(e.Fragment,{children:[e.jsxs(N,{children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Goal arcs"}),e.jsx("h3",{className:"mt-2 font-display text-3xl text-white",children:"Strategic arcs before tickets"}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-7 text-white/60",children:"This is the long-horizon map. Each arc shows why it matters, how much ground has been covered, and which project should move next."})]}),e.jsx(y,{onClick:()=>{m(null),x(!0)},children:"Create goal"})]}),e.jsxs("div",{className:"mt-5 grid gap-3 xl:grid-cols-2",children:[s.length===0?e.jsx("div",{className:"rounded-[24px] bg-white/[0.04] p-5 text-sm leading-7 text-white/60 xl:col-span-2",children:"Start with a life goal. Once the destination is clear, you can attach projects and then fill those projects with tasks."}):null,s.map(t=>{const h=`${Math.max(6,Math.min(100,t.progress))}%`;return e.jsxs(b,{to:`/goals/${t.id}`,className:"rounded-[24px] border border-white/6 bg-[linear-gradient(180deg,rgba(255,255,255,0.06),rgba(255,255,255,0.03))] p-4 transition hover:bg-[linear-gradient(180deg,rgba(255,255,255,0.09),rgba(255,255,255,0.04))]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(k,{kind:"goal",compact:!0,gradient:!1}),e.jsx("div",{className:"mt-2",children:e.jsx(p,{kind:"goal",label:t.title,variant:"heading",size:"lg",showKind:!1,lines:2})}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-white/58",children:t.description||"No strategic note attached yet."})]}),e.jsx("button",{className:"rounded-full bg-white/6 p-2 text-white/60 transition hover:bg-white/10 hover:text-white",type:"button",onClick:i=>{i.preventDefault(),i.stopPropagation(),m(t.id),x(!0)},children:e.jsx(P,{className:"size-4"})})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(l,{className:"bg-white/[0.08] text-white/70",children:t.horizon}),e.jsx(l,{className:t.status==="active"?"text-emerald-300":t.status==="paused"?"text-amber-300":"text-[var(--tertiary)]",children:t.status}),e.jsxs(l,{className:"bg-white/[0.08] text-white/70",children:[t.earnedPoints," / ",t.targetPoints," xp"]}),e.jsxs(l,{className:"bg-white/[0.08] text-white/70",children:[t.totalTasks," tasks"]})]}),e.jsx("div",{className:"mt-4 h-1.5 rounded-full bg-white/[0.08]",children:e.jsx("div",{className:"h-full rounded-full bg-[linear-gradient(90deg,var(--primary)_0%,var(--secondary)_100%)]",style:{width:h}})}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:t.tags.map(i=>e.jsx(l,{className:"bg-white/[0.06] text-white/58",children:i.name},i.id))}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.16em] text-white/42",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.momentumLabel}),e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-2",style:{color:t.themeColor},children:["Open arc",e.jsx(C,{className:"size-3.5"})]})]})]},t.id)})]})]}),e.jsx(E,{open:u,pending:d,editingGoal:a,tags:n,users:c,defaultUserId:o,onOpenChange:t=>{x(t),t||m(null)},onSubmit:async(t,h)=>{if(h){await j(h,t);return}await r(t)}})]})}function _({eyebrow:s,title:n,description:c,meta:o,actions:d,className:r}){return e.jsxs("div",{className:v("flex flex-wrap items-start justify-between gap-3",r),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[s?e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:s}):null,e.jsxs("div",{className:v("min-w-0",s&&"mt-2"),children:[e.jsx("div",{className:"min-w-0 text-lg text-white",children:n}),c?e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:c}):null]})]}),o||d?e.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:[o,d]}):null]})}function ee(){const s=z(),[n,c]=g.useState("active"),[o,d]=g.useState(null),r=s.snapshot.dashboard.goals.length>0,j=F(s.snapshot.dashboard.projects),u=U(s.snapshot.dashboard.projects,n),x=L(s.selectedUserIds),w=new Map(s.snapshot.dashboard.goals.map(a=>[a.id,u.filter(t=>t.goalId===a.id)])),m=async a=>{d(a);try{await s.patchProject(a,{status:"active"})}finally{d(null)}};return e.jsxs("div",{className:"grid gap-5",children:[e.jsx(S,{entityKind:"goal",title:e.jsx(p,{kind:"goal",label:"Life Goals",variant:"heading",size:"lg"}),titleText:"Life Goals",description:"Life goals are the destinations you care about over the long run. Each one can hold several projects, and those projects turn direction into real work.",badge:`${s.snapshot.dashboard.goals.length} active goals`,actions:r?e.jsxs("div",{className:"inline-flex min-h-10 items-center rounded-full border border-white/8 bg-white/[0.04] px-4 py-2 text-sm whitespace-nowrap text-white/68",children:[s.snapshot.dashboard.projects.length," live project",s.snapshot.dashboard.projects.length===1?"":"s"," ","attached"]}):null}),e.jsx(O,{goals:s.snapshot.dashboard.goals,tags:s.snapshot.tags,users:s.snapshot.users,defaultUserId:x,onCreate:s.createGoal,onUpdate:s.patchGoal}),r?e.jsx(M,{value:n,counts:j,onChange:c}):null,r?null:e.jsx(T,{eyebrow:"Life goals",title:"No life goals yet",description:"Define the first long-horizon direction above so Forge can attach projects, tasks, momentum, and evidence to something meaningful."}),r?e.jsx("div",{className:"grid gap-4",children:s.snapshot.dashboard.goals.map(a=>{const t=w.get(a.id)??[],h=B(s.snapshot.dashboard.notesSummaryByEntity,"goal",a.id);return e.jsx(b,{to:`/goals/${a.id}`,className:"min-w-0 overflow-hidden rounded-[28px] border border-white/6 bg-[linear-gradient(180deg,rgba(255,255,255,0.05),rgba(255,255,255,0.03))] p-4 transition hover:bg-[linear-gradient(180deg,rgba(255,255,255,0.08),rgba(255,255,255,0.04))] sm:p-5",children:e.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)] xl:gap-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs(D,{children:[a.tags.slice(0,3).map(i=>e.jsx(l,{className:"bg-white/[0.08]",style:{color:i.color},children:i.name},i.id)),e.jsx(l,{className:"bg-white/[0.08] text-white/72",children:a.horizon}),e.jsx(I,{user:a.user,compact:!0})]}),e.jsx("div",{className:"mt-4",children:e.jsx(p,{kind:"goal",label:a.title,variant:"heading",size:"xl",lines:2})}),e.jsx("p",{className:"mt-3 max-w-2xl text-sm leading-7 text-white/58",children:a.description}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-3.5 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/40",children:"Progress"}),e.jsxs("div",{className:"mt-2 text-xl text-white",children:[a.progress,"%"]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-3.5 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/40",children:"Tasks done"}),e.jsxs("div",{className:"mt-2 text-xl text-white",children:[a.completedTasks,"/",Math.max(a.totalTasks,1)]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-3.5 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/40",children:"XP banked"}),e.jsx("div",{className:"mt-2 text-xl text-white",children:a.earnedPoints})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx(R,{value:a.progress})}),e.jsx("div",{className:"mt-4",children:e.jsx(G,{entityType:"goal",entityId:a.id,count:h.count})})]}),e.jsxs("div",{className:"min-w-0 rounded-[24px] bg-white/[0.04] p-4",children:[e.jsx(_,{title:"Projects carrying this direction",meta:e.jsx("div",{className:"shrink-0 text-sm text-white/48",children:t.length}),className:"gap-2"}),t.length===0?e.jsx("div",{className:"mt-4 text-sm leading-6 text-white/56",children:n==="active"?"No active project is attached yet. Create one so this direction starts producing visible work.":"No projects in this lifecycle view are attached yet. Switch filters or restart one to bring it back into active motion."}):e.jsx("div",{className:"mt-4 grid gap-3",children:t.slice(0,3).map(i=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.05] px-4 py-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx(k,{kind:"project",compact:!0,gradient:!1}),e.jsx(p,{kind:"project",label:i.title,className:"min-w-0",showIcon:!1,lines:2})]}),e.jsx(l,{className:"shrink-0",children:i.status})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:i.description}),e.jsxs("div",{className:"mt-3 text-sm text-white/42",children:["Next move:"," ",i.nextTaskTitle??"Define the first attached task"]}),n!=="active"&&i.status!=="active"?e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx(y,{variant:"secondary",size:"sm",pending:o===i.id,pendingLabel:"Restarting…",onClick:f=>{f.preventDefault(),f.stopPropagation(),m(i.id)},children:"Restart"})}):null]},i.id))})]})]})},a.id)})}):e.jsx(N,{children:e.jsx("div",{className:"rounded-[20px] bg-white/[0.04] p-4 text-sm text-white/58",children:"Goal cards will appear here once the first long-horizon direction is created."})})]})}export{ee as GoalsPage};
|