@emeryld/rrroutes-openapi 2.6.5 → 2.6.7
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/public/assets/docs.js +239 -86
- package/dist/web/v2/components/flows/FlowCanvas.d.ts +2 -2
- package/dist/web/v2/components/flows/FlowRunProgress.d.ts +2 -2
- package/dist/web/v2/components/flows/FlowToolbar.d.ts +22 -0
- package/dist/web/v2/components/flows/FlowVariablePanel.d.ts +2 -2
- package/dist/web/v2/components/flows/RecordingReviewDialog.d.ts +9 -0
- package/dist/web/v2/components/flows/nodes/ConditionNode.d.ts +2 -2
- package/dist/web/v2/components/flows/nodes/DelayNode.d.ts +2 -2
- package/dist/web/v2/components/flows/nodes/ExtractNode.d.ts +2 -2
- package/dist/web/v2/components/flows/nodes/RequestNode.d.ts +4 -7
- package/dist/web/v2/hooks/useFlowKeyboardShortcuts.d.ts +17 -0
- package/dist/web/v2/hooks/useFlowRecording.d.ts +13 -0
- package/dist/web/v2/stores/flowStore.d.ts +4 -0
- package/dist/web/v2/utils/flowHelpers.d.ts +33 -0
- package/dist/web/v2/utils/flowPresets.d.ts +11 -0
- package/dist/web/v2/utils/flowRecorder.d.ts +5 -0
- package/package.json +1 -1
- package/dist/public/assets/Add.js +0 -1
- package/dist/public/assets/Autocomplete.js +0 -1
- package/dist/public/assets/BaseFilterBar.js +0 -1
- package/dist/public/assets/BentoGrid.js +0 -1
- package/dist/public/assets/CacheLogsPage.js +0 -1
- package/dist/public/assets/DeleteOutline.js +0 -1
- package/dist/public/assets/DiffPage.js +0 -7
- package/dist/public/assets/Download.js +0 -1
- package/dist/public/assets/EndpointDetailPage.js +0 -1
- package/dist/public/assets/EndpointDetailPanel.js +0 -1
- package/dist/public/assets/EndpointPlaygroundPage.js +0 -1
- package/dist/public/assets/ExpandLess.js +0 -1
- package/dist/public/assets/ExportButton.js +0 -2
- package/dist/public/assets/FlowBuilderPage.js +0 -20
- package/dist/public/assets/HistoryPage.js +0 -1
- package/dist/public/assets/LogsPage.js +0 -1
- package/dist/public/assets/PageContainer.js +0 -3
- package/dist/public/assets/PlayArrow.js +0 -1
- package/dist/public/assets/PresetsPage.js +0 -4
- package/dist/public/assets/RoutesPage.js +0 -1
- package/dist/public/assets/SchedulingPage.js +0 -1
- package/dist/public/assets/SchemaTreeView.js +0 -1
- package/dist/public/assets/SettingsPage.js +0 -1
- package/dist/public/assets/SocketsPage.js +0 -1
- package/dist/public/assets/filterTypes.js +0 -1
- package/dist/public/assets/getValidReactChildren.js +0 -1
- package/dist/public/assets/kvRowAdapters.js +0 -1
- package/dist/public/assets/schemaDefaults.js +0 -1
- package/dist/public/assets/useEndpointOptions.js +0 -1
- package/dist/public/assets/useQueryState.js +0 -1
- package/dist/public/assets/vendor-recharts.js +0 -99
- package/dist/public/assets/vendor-xyflow.js +0 -15
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{j as o,H as _,P as G,i as He,C as Le,M as We,B as Be,u as Ue,a as _e,b as Ce}from"./vendor-xyflow.js";import{A as Ge}from"./Add.js";import{R as ue,h as J,G as F,T as C,k as h,S as T,a_ as Ve,j as ne,a1 as Re,a2 as Je,g as Se,am as ce,a3 as W,a$ as Ke,a9 as Qe,b0 as Xe,b1 as Ye,b2 as Ze,b3 as et,b4 as ke,b5 as oe,b6 as tt,c as ot,al as Te,b7 as Ne,b8 as nt}from"./docs.js";import{P as st}from"./PlayArrow.js";import{h as l}from"./vendor-recharts.js";import{u as rt,a as at}from"./useEndpointOptions.js";import{d as it,b as lt,s as ct}from"./schemaDefaults.js";import{S as Ae,T as V,P as dt}from"./PageContainer.js";import{A as ut}from"./Autocomplete.js";const pt=ue(o.jsx("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"})),ft=ue(o.jsx("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"})),ht=ue(o.jsx("path",{d:"M6 6h12v12H6z"})),mt=ue(o.jsx("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z"})),je=120;function xt({data:e}){const t=J();return o.jsxs(F,{onClick:e.onSelect,sx:{width:je,height:je,transform:"rotate(45deg)",bgcolor:h(t.palette.background.paper,.85),border:`1px solid ${h("#ffffff",.12)}`,backdropFilter:"blur(12px)",borderRadius:2,display:"flex",alignItems:"center",justifyContent:"center",cursor:e.onSelect?"pointer":"default",transition:"box-shadow 160ms ease, border-color 160ms ease","&:hover":e.onSelect?{borderColor:h(t.palette.secondary.main,.5),boxShadow:`0 0 0 3px ${h(t.palette.secondary.main,.12)}`}:void 0},children:[o.jsx(_,{type:"target",position:G.Left,style:{width:16,height:16,background:t.palette.text.secondary,border:"none"}}),o.jsxs(F,{sx:{transform:"rotate(-45deg)",textAlign:"center",px:1,maxWidth:je*.85},children:[o.jsx(C,{variant:"caption",sx:{color:t.palette.text.secondary,fontWeight:600,fontSize:"0.6rem",textTransform:"uppercase",letterSpacing:.5,display:"block",mb:.25},children:"if"}),o.jsx(C,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.65rem",color:t.palette.text.primary,lineHeight:1.3,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:e.expression})]}),o.jsx(_,{id:"true",type:"source",position:G.Top,style:{width:16,height:16,background:t.palette.status.success,border:"none"}}),o.jsx(_,{id:"false",type:"source",position:G.Bottom,style:{width:16,height:16,background:t.palette.status.error,border:"none"}})]})}function yt(e){if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${parseFloat(t.toFixed(1))}s`;const n=Math.floor(t/60),s=t-n*60;return s===0?`${n}m`:`${n}m ${parseFloat(s.toFixed(1))}s`}function bt({data:e}){const t=J(),n=t.palette.primary.main;return o.jsxs(F,{onClick:e.onSelect,sx:{width:140,p:1.25,borderRadius:2,bgcolor:h(t.palette.background.paper,.85),border:`1px solid ${h(n,.4)}`,backdropFilter:"blur(12px)",cursor:e.onSelect?"pointer":"default",transition:"box-shadow 160ms ease, border-color 160ms ease","&:hover":e.onSelect?{borderColor:h(n,.65),boxShadow:`0 0 0 3px ${h(n,.12)}`}:void 0},children:[o.jsx(_,{type:"target",position:G.Left,style:{width:16,height:16,background:t.palette.text.secondary,border:"none"}}),o.jsxs(T,{direction:"row",alignItems:"center",spacing:1,justifyContent:"center",children:[o.jsxs(F,{component:"svg",viewBox:"0 0 24 24",sx:{width:18,height:18,fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",flexShrink:0},children:[o.jsx("circle",{cx:"12",cy:"13",r:"8"}),o.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),o.jsx("line",{x1:"12",y1:"13",x2:"15",y2:"13"}),o.jsx("line",{x1:"9",y1:"1",x2:"15",y2:"1"}),o.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"4"})]}),o.jsx(C,{variant:"body2",sx:{fontFamily:"monospace",fontWeight:700,fontSize:"0.85rem",color:n},children:yt(e.durationMs)})]}),o.jsx(_,{type:"source",position:G.Right,style:{width:16,height:16,background:n,border:"none"}})]})}function gt({data:e}){const t=J(),n=t.palette.secondary.main;return o.jsxs(F,{onClick:e.onSelect,sx:{width:220,borderRadius:2,bgcolor:h(t.palette.background.paper,.85),border:`1px solid ${h(n,.4)}`,backdropFilter:"blur(12px)",overflow:"hidden",cursor:e.onSelect?"pointer":"default",transition:"box-shadow 160ms ease, border-color 160ms ease","&:hover":e.onSelect?{borderColor:h(n,.65),boxShadow:`0 0 0 3px ${h(n,.12)}`}:void 0},children:[o.jsx(_,{type:"target",position:G.Left,style:{width:16,height:16,background:t.palette.text.secondary,border:"none"}}),o.jsx(F,{sx:{px:1.5,py:.5,bgcolor:h(n,.12),borderBottom:`1px solid ${h(n,.2)}`},children:o.jsx(C,{variant:"caption",sx:{fontWeight:700,fontSize:"0.65rem",textTransform:"uppercase",letterSpacing:.5,color:n},children:"Extract"})}),o.jsx(F,{sx:{px:1.5,py:1},children:o.jsxs(T,{direction:"row",alignItems:"center",spacing:.75,children:[o.jsx(C,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.72rem",fontWeight:600,color:t.palette.text.primary},children:e.variableName}),o.jsx(C,{variant:"body2",sx:{fontSize:"0.7rem",color:t.palette.text.secondary},children:"→"}),o.jsx(C,{noWrap:!0,variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.72rem",color:n,flex:1,minWidth:0},children:e.jsonPath})]})}),o.jsx(_,{type:"source",position:G.Right,style:{width:16,height:16,background:n,border:"none"}})]})}function jt({data:e}){const t=J(),n=e.method.toLowerCase(),s=Ve(n),a=e.headers?Object.keys(e.headers).length:0,c=!!e.body;return o.jsxs(F,{onClick:e.onSelect,sx:{width:220,p:1.5,borderRadius:2,bgcolor:h(t.palette.background.paper,.85),border:`1px solid ${h("#ffffff",.12)}`,backdropFilter:"blur(12px)",cursor:e.onSelect?"pointer":"default",transition:"box-shadow 160ms ease, border-color 160ms ease","&:hover":e.onSelect?{borderColor:h(s,.5),boxShadow:`0 0 0 3px ${h(s,.12)}`}:void 0},children:[o.jsx(_,{type:"target",position:G.Left,style:{width:16,height:16,background:t.palette.text.secondary,border:"none"}}),o.jsxs(T,{direction:"row",alignItems:"center",spacing:1,mb:.75,children:[o.jsx(ne,{label:e.method.toUpperCase(),size:"small",variant:"outlined",sx:{borderColor:s,color:s,bgcolor:h(s,.15),fontWeight:700,fontSize:"0.65rem",height:22}}),o.jsx(C,{variant:"body2",noWrap:!0,sx:{fontFamily:"monospace",fontSize:"0.75rem",color:t.palette.text.primary,flex:1,minWidth:0},children:e.path})]}),(a>0||c)&&o.jsxs(T,{direction:"row",spacing:1,children:[a>0&&o.jsxs(C,{variant:"caption",sx:{color:t.palette.text.secondary,fontSize:"0.65rem"},children:[a," header",a!==1?"s":""]}),c&&o.jsx(C,{variant:"caption",sx:{color:t.palette.text.secondary,fontSize:"0.65rem"},children:"body"})]}),o.jsx(_,{type:"source",position:G.Right,style:{width:16,height:16,background:s,border:"none"}})]})}function wt({nodes:e,edges:t,onNodesChange:n,onEdgesChange:s,onConnect:a,onNodeClick:c,onMouseMove:r}){const d=J(),p=l.useMemo(()=>({request:jt,condition:xt,extract:gt,delay:bt}),[]);return o.jsxs(He,{nodes:e,edges:t,onNodesChange:n,onEdgesChange:s,onConnect:a,onNodeClick:c,onMouseMove:r,nodeTypes:p,connectionRadius:30,fitView:!0,proOptions:{hideAttribution:!0},style:{backgroundColor:d.palette.background.default},children:[o.jsx(Le,{position:"bottom-left",style:{backgroundColor:h(d.palette.background.paper,.85),borderRadius:d.shape.borderRadius,border:`1px solid ${h("#ffffff",.1)}`,backdropFilter:"blur(12px)"}}),o.jsx(We,{nodeStrokeWidth:3,nodeColor:h(d.palette.primary.main,.6),maskColor:h(d.palette.background.default,.8),style:{backgroundColor:h(d.palette.background.paper,.72),borderRadius:d.shape.borderRadius,border:`1px solid ${h("#ffffff",.08)}`}}),o.jsx(Be,{color:h("#ffffff",.04),gap:24,size:1})]})}const vt=ue(o.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"})),Ct=["GET","POST","PUT","PATCH","DELETE"];function St({node:e,onUpdate:t,onClose:n}){const s=J();return e?o.jsxs(F,{sx:{width:480,flexShrink:0,borderLeft:`1px solid ${h("#ffffff",.08)}`,bgcolor:h(s.palette.background.paper,.72),backdropFilter:"blur(16px)",display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[o.jsxs(T,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{px:2,py:1.5,borderBottom:`1px solid ${h("#ffffff",.08)}`,flexShrink:0},children:[o.jsxs(C,{variant:"subtitle1",sx:{textTransform:"capitalize"},children:[e.type," Node"]}),o.jsx(Re,{size:"small",onClick:n,children:o.jsx(Je,{fontSize:"small"})})]}),o.jsxs(F,{sx:{flex:1,overflow:"auto",px:2,py:2},children:[e.type==="request"&&o.jsx(kt,{nodeId:e.id,data:e.data,onUpdate:t}),e.type==="condition"&&o.jsx(Tt,{nodeId:e.id,data:e.data,onUpdate:t}),e.type==="delay"&&o.jsx(Nt,{nodeId:e.id,data:e.data,onUpdate:t}),e.type==="extract"&&o.jsx(Et,{nodeId:e.id,data:e.data,onUpdate:t})]})]}):null}function kt({nodeId:e,data:t,onUpdate:n}){const[s,a]=l.useState(t.method),[c,r]=l.useState(t.path),[d,p]=l.useState(""),[S,w]=l.useState(()=>t.headers?Object.entries(t.headers).map(([u,f])=>({key:u,value:f})):[]),[v,y]=l.useState(()=>t.queryParams?Object.entries(t.queryParams).map(([u,f])=>({key:u,value:f})):[]),[j,E]=l.useState(t.body??""),[M,R]=l.useState(null),{options:be}=rt(d),I=s&&c&&Se(s,c).displayId||null,{data:A}=at(I);l.useEffect(()=>{var B;if(!(A!=null&&A.contract)||I===M||Se(A.method,A.path).displayId!==I)return;R(I);const f=A.contract;if(((B=f.query)==null?void 0:B.kind)==="object"&&f.query.properties){const O=f.query.properties;y(X=>{const ge=new Set(X.map(Y=>Y.key)),xe=[...X];for(const[Y,Z]of Object.entries(O))!Z||ge.has(Y)||xe.push({key:Y,value:lt(Z),typeHint:it(Z),optional:Z.optional});return xe})}const b=[];["POST","PUT","PATCH"].includes(s.toUpperCase())&&b.push({key:"Content-Type",value:"application/json"}),b.push({key:"Accept",value:"application/json"}),w(b),f.body&&["POST","PUT","PATCH"].includes(s.toUpperCase())&&E(O=>{if(O.trim().length>0&&O.trim()!==`{
|
|
2
|
-
|
|
3
|
-
}`)return O;const X=ct(f.body);try{return JSON.stringify(X,null,2)}catch{return O}})},[A,I,M,s]),l.useEffect(()=>{a(t.method),r(t.path),p(""),R(null),w(t.headers?Object.entries(t.headers).map(([u,f])=>({key:u,value:f})):[]),y(t.queryParams?Object.entries(t.queryParams).map(([u,f])=>({key:u,value:f})):[]),E(t.body??"")},[e]);const K=l.useCallback((u,f)=>{if(f){if(typeof f=="string"){r(f);return}a(f.method.toUpperCase()),r(f.path),p(""),y([]),w([]),E(""),R(null)}},[]),se=l.useCallback(()=>{const u={};for(const b of S)b.key.trim()&&(u[b.key.trim()]=b.value);const f={};for(const b of v)b.key.trim()&&(f[b.key.trim()]=b.value);n(e,{method:s,path:c,headers:Object.keys(u).length>0?u:void 0,queryParams:Object.keys(f).length>0?f:void 0,body:j.trim()||void 0})},[e,s,c,S,v,j,n]),pe=l.useCallback(()=>{w(u=>[...u,{key:"",value:""}])},[]),re=l.useCallback(u=>{w(f=>f.filter((b,D)=>D!==u))},[]),fe=l.useCallback((u,f,b)=>{w(D=>D.map((B,O)=>O===u?{...B,[f]:b}:B))},[]),ae=l.useCallback(()=>{y(u=>[...u,{key:"",value:""}])},[]),he=l.useCallback(u=>{y(f=>f.filter((b,D)=>D!==u))},[]),me=l.useCallback((u,f,b)=>{y(D=>D.map((B,O)=>O===u?{...B,[f]:b}:B))},[]),ie=["POST","PUT","PATCH"].includes(s);return o.jsxs(T,{spacing:2,children:[o.jsxs(T,{direction:"row",spacing:1,children:[o.jsx(Ae,{value:s,onChange:u=>{a(u.target.value),R(null)},size:"small",sx:{minWidth:90},children:Ct.map(u=>o.jsx(ce,{value:u,children:u},u))}),o.jsx(ut,{freeSolo:!0,options:be,getOptionLabel:u=>typeof u=="string"?u:u.display,inputValue:c,onInputChange:(u,f,b)=>{b!=="reset"&&(r(f),b==="input"&&p(f))},onChange:K,renderOption:(u,f)=>{const{key:b,...D}=u;return o.jsx("li",{...D,children:o.jsxs(T,{direction:"row",spacing:1,alignItems:"center",sx:{width:"100%"},children:[o.jsx(ne,{label:typeof f=="string"?"GET":f.method.toUpperCase(),size:"small",sx:{fontWeight:700,fontSize:"0.65rem",minWidth:48,height:20}}),o.jsx(C,{variant:"body2",noWrap:!0,sx:{fontFamily:"monospace",fontSize:"0.8rem"},children:typeof f=="string"?f:f.path})]})},b)},renderInput:u=>o.jsx(V,{...u,label:"Path",size:"small",placeholder:"/api/resource"}),sx:{flex:1}})]}),o.jsx(Ee,{label:"Query",rows:v,onAdd:ae,onRemove:he,onUpdate:me}),o.jsx(Ee,{label:"Headers",rows:S,onAdd:pe,onRemove:re,onUpdate:fe}),ie&&o.jsx(V,{label:"Body",size:"small",fullWidth:!0,multiline:!0,minRows:3,maxRows:12,value:j,onChange:u=>E(u.target.value),placeholder:'{"key": "value"}',sx:{"& textarea":{fontFamily:"monospace",fontSize:"0.8rem"}}}),o.jsx(W,{variant:"contained",size:"small",onClick:se,children:"Apply"})]})}function Ee({label:e,rows:t,onAdd:n,onRemove:s,onUpdate:a}){return o.jsxs(F,{children:[o.jsx(C,{variant:"caption",color:"text.secondary",sx:{mb:.5,display:"block"},children:e}),o.jsxs(T,{spacing:.75,children:[t.map((c,r)=>o.jsxs(F,{children:[o.jsxs(T,{direction:"row",spacing:.5,alignItems:"center",children:[o.jsx(V,{size:"small",placeholder:"Key",value:c.key,onChange:d=>a(r,"key",d.target.value),sx:{flex:1}}),o.jsx(V,{size:"small",placeholder:"Value",value:c.value,onChange:d=>a(r,"value",d.target.value),sx:{flex:1}}),o.jsx(Re,{size:"small",onClick:()=>s(r),children:o.jsx(vt,{fontSize:"small"})})]}),c.typeHint&&o.jsxs(C,{variant:"caption",color:"text.secondary",sx:{pl:.5,fontSize:"0.65rem",display:"block"},children:[c.typeHint,c.optional?"":" (required)"]})]},r)),t.length===0&&o.jsx(C,{variant:"caption",color:"text.secondary",sx:{fontSize:"0.7rem"},children:"None"}),o.jsx(W,{size:"small",variant:"outlined",onClick:n,sx:{alignSelf:"flex-start"},children:"Add"})]})]})}function Tt({nodeId:e,data:t,onUpdate:n}){const[s,a]=l.useState(t.expression);l.useEffect(()=>{a(t.expression)},[e]);const c=l.useCallback(()=>{n(e,{expression:s})},[e,s,n]);return o.jsxs(T,{spacing:2,children:[o.jsx(V,{label:"Expression",size:"small",fullWidth:!0,value:s,onChange:r=>a(r.target.value),placeholder:"{{response.status}} === 200",helperText:"Use {{variable}} syntax for template values",sx:{"& input":{fontFamily:"monospace",fontSize:"0.85rem"}}}),o.jsx(W,{variant:"contained",size:"small",onClick:c,children:"Apply"})]})}function Nt({nodeId:e,data:t,onUpdate:n}){const[s,a]=l.useState(t.durationMs);l.useEffect(()=>{a(t.durationMs)},[e]);const c=l.useCallback(()=>{n(e,{durationMs:s})},[e,s,n]);return o.jsxs(T,{spacing:2,children:[o.jsx(V,{label:"Duration (ms)",size:"small",fullWidth:!0,type:"number",value:s,onChange:r=>a(Number(r.target.value)),inputProps:{min:0,step:100},helperText:"How long to wait before proceeding to the next node"}),o.jsx(W,{variant:"contained",size:"small",onClick:c,children:"Apply"})]})}function Et({nodeId:e,data:t,onUpdate:n}){const[s,a]=l.useState(t.variableName),[c,r]=l.useState(t.jsonPath);l.useEffect(()=>{a(t.variableName),r(t.jsonPath)},[e]);const d=l.useCallback(()=>{n(e,{variableName:s,jsonPath:c})},[e,s,c,n]);return o.jsxs(T,{spacing:2,children:[o.jsx(V,{label:"Variable name",size:"small",fullWidth:!0,value:s,onChange:p=>a(p.target.value),placeholder:"userId",sx:{"& input":{fontFamily:"monospace",fontSize:"0.85rem"}}}),o.jsx(V,{label:"JSON path",size:"small",fullWidth:!0,value:c,onChange:p=>r(p.target.value),placeholder:"response.data.id",helperText:"Dot-notation path into the response object",sx:{"& input":{fontFamily:"monospace",fontSize:"0.85rem"}}}),o.jsx(W,{variant:"contained",size:"small",onClick:d,children:"Apply"})]})}const Pt=Xe`
|
|
4
|
-
0% { transform: scale(1); opacity: 1; }
|
|
5
|
-
50% { transform: scale(1.35); opacity: 0.7; }
|
|
6
|
-
100% { transform: scale(1); opacity: 1; }
|
|
7
|
-
`;function It(e){if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${parseFloat(t.toFixed(1))}s`;const n=Math.floor(t/60),s=t-n*60;return s===0?`${n}m`:`${n}m ${parseFloat(s.toFixed(1))}s`}function zt(e,t){return t.errorNodeId===e?"error":t.currentNodeId===e?"current":t.completedNodeIds.includes(e)?"completed":"pending"}function Ft({runState:e,nodes:t}){const n=J(),s=l.useMemo(()=>t.find(p=>p.id===e.currentNodeId)??null,[t,e.currentNodeId]),a=e.completedNodeIds.length,c=t.length,r=c>0?a/c*100:0,d={completed:n.palette.status.success,current:n.palette.secondary.main,error:n.palette.status.error,pending:h("#ffffff",.2)};return o.jsx(F,{sx:{px:2.5,py:1.5,bgcolor:h(n.palette.background.paper,.85),borderTop:`1px solid ${h("#ffffff",.08)}`,backdropFilter:"blur(14px)"},children:o.jsxs(T,{spacing:1.25,children:[o.jsxs(T,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[o.jsxs(T,{direction:"row",alignItems:"center",spacing:1,children:[o.jsx(C,{variant:"caption",sx:{color:n.palette.text.secondary},children:e.status==="running"?"Running":e.status==="completed"?"Completed":e.status==="error"?"Error":"Idle"}),s&&o.jsx(ne,{label:`${s.type}: ${Pe(s)}`,size:"small",variant:"outlined",sx:{height:22,fontSize:"0.7rem",borderColor:h(n.palette.secondary.main,.4),color:n.palette.text.primary}})]}),o.jsx(C,{variant:"caption",sx:{fontFamily:"monospace",fontWeight:600,color:n.palette.text.secondary},children:It(e.elapsedMs)})]}),o.jsx(Ke,{variant:e.status==="running"?"buffer":"determinate",value:r,valueBuffer:e.status==="running"?r+100/Math.max(c,1):r,sx:{height:4,borderRadius:2,bgcolor:h("#ffffff",.06),"& .MuiLinearProgress-bar":{borderRadius:2,bgcolor:e.status==="error"?n.palette.status.error:n.palette.status.success},"& .MuiLinearProgress-bar2Buffer":{bgcolor:h(n.palette.secondary.main,.3)}}}),o.jsx(T,{direction:"row",spacing:.75,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:t.map(p=>{const S=zt(p.id,e),w=d[S],v=e.variables.filter(j=>j.sourceNodeId===p.id).map(j=>`${j.name} = ${JSON.stringify(j.value)}`).join(`
|
|
8
|
-
`),y=`${p.type}: ${Pe(p)}${v?`
|
|
9
|
-
`+v:""}`;return o.jsx(Qe,{title:y,arrow:!0,children:o.jsx(F,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:w,transition:"background-color 200ms ease",...S==="current"?{animation:`${Pt} 1.2s ease-in-out infinite`}:{}}})},p.id)})})]})})}function Pe(e){switch(e.type){case"request":{const t=e.data;return`${t.method} ${t.path}`}case"condition":{const t=e.data;return t.expression.length>30?t.expression.slice(0,30)+"...":t.expression}case"delay":return`${e.data.durationMs}ms`;case"extract":{const t=e.data;return`${t.variableName} <- ${t.jsonPath}`}default:return e.id}}function Rt({variables:e,nodes:t}){const n=J(),s=l.useMemo(()=>{const a=new Map;for(const c of t)a.set(c.id,Mt(c));return a},[t]);return e.length===0?o.jsx(C,{variant:"body2",color:"text.secondary",sx:{p:2},children:"No variables have been extracted yet."}):o.jsx(Ye,{elevation:0,sx:{bgcolor:h(n.palette.background.paper,.5),border:`1px solid ${h("#ffffff",.07)}`},children:o.jsxs(Ze,{size:"small",children:[o.jsx(et,{children:o.jsxs(ke,{children:[o.jsx(oe,{children:"Name"}),o.jsx(oe,{children:"Value"}),o.jsx(oe,{children:"Source Node"})]})}),o.jsx(tt,{children:e.map(a=>o.jsxs(ke,{children:[o.jsx(oe,{children:o.jsx(C,{variant:"body2",sx:{fontFamily:"monospace",fontWeight:600,fontSize:"0.8rem",color:n.palette.primary.main},children:a.name})}),o.jsx(oe,{children:o.jsx(C,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.78rem",color:n.palette.text.primary,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:At(a.value)})}),o.jsx(oe,{children:o.jsx(C,{variant:"body2",sx:{fontSize:"0.78rem",color:n.palette.text.secondary},children:a.sourceNodeId?s.get(a.sourceNodeId)??a.sourceNodeId:"—"})})]},a.name))})]})})}function At(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return`"${e}"`;if(typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function Mt(e){switch(e.type){case"request":{const t=e.data;return`${t.method} ${t.path}`}case"condition":return`if ${e.data.expression.slice(0,20)}`;case"delay":return`delay ${e.data.durationMs}ms`;case"extract":return`extract ${e.data.variableName}`;default:return e.id}}const Me="rrroutes.flows",Ie={status:"idle",currentNodeId:null,completedNodeIds:[],errorNodeId:null,errorMessage:null,variables:[],elapsedMs:0},qe=l.createContext(null);function qt(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Me);if(!e)return[];const t=JSON.parse(e);return Dt(t)}catch(e){return console.warn("Failed to parse stored flows",e),[]}}function Dt(e){return Array.isArray(e)?e.map(t=>Ot(t)).filter(t=>!!t):[]}function Ot(e){if(!e||typeof e!="object")return null;const t=e,n=typeof t.id=="string"&&t.id.trim().length>0?t.id:void 0,s=typeof t.name=="string"?t.name:"";if(!n)return null;const a=Array.isArray(t.nodes)?t.nodes.filter(r=>!!r&&typeof r=="object"&&typeof r.id=="string"):[],c=Array.isArray(t.edges)?t.edges.filter(r=>!!r&&typeof r=="object"&&typeof r.id=="string"&&typeof r.source=="string"&&typeof r.target=="string"):[];return{id:n,name:s,nodes:a,edges:c}}function $t({children:e}){const[t,n]=l.useState(()=>qt()),[s,a]=l.useState(null),[c,r]=l.useState(Ie);l.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Me,JSON.stringify(t))},[t]);const d=l.useCallback(E=>{n(M=>[...M,E])},[]),p=l.useCallback(E=>{n(M=>M.map(R=>R.id===E.id?E:R))},[]),S=l.useCallback(E=>{n(M=>M.filter(R=>R.id!==E)),s===E&&a(null)},[s]),w=l.useCallback(E=>{a(E)},[]),v=l.useCallback(E=>{r(E)},[]),y=l.useCallback(()=>{r(Ie)},[]),j=l.useMemo(()=>({flows:t,activeFlowId:s,runState:c,addFlow:d,updateFlow:p,deleteFlow:S,setActiveFlow:w,setRunState:v,resetRunState:y}),[t,s,c,d,p,S,w,v,y]);return o.jsx(qe.Provider,{value:j,children:e})}function Ht(){const e=l.useContext(qe);if(!e)throw new Error("useFlows must be used within FlowProvider");return e}const Lt=/\{\{([^}]+)\}\}/g;function de(e,t){return e.replace(Lt,(n,s)=>{const a=Wt(t,s.trim());return a==null?n:String(a)})}function ye(e,t){if(typeof e=="string")return de(e,t);if(Array.isArray(e))return e.map(n=>ye(n,t));if(e&&typeof e=="object"){const n={};for(const[s,a]of Object.entries(e))n[s]=ye(a,t);return n}return e}function Wt(e,t){const n=t.split(".");let s=e;for(const a of n){if(s==null||typeof s!="object")return;s=s[a]}return s}async function Bt(e){const{flow:t,variables:n,fetchFn:s,onProgress:a,signal:c}=e,r={status:"running",currentNodeId:null,completedNodeIds:[],errorNodeId:null,errorMessage:null,variables:Object.entries(n).map(([v,y])=>({name:v,value:y})),elapsedMs:0},d=Date.now();a({...r});const p={...n};let S=null;const w=Ut(t.nodes,t.edges);for(const v of w){if(c!=null&&c.aborted)return r.status="error",r.errorMessage="Flow cancelled",r.elapsedMs=Date.now()-d,a({...r}),{...r};r.currentNodeId=v.id,r.elapsedMs=Date.now()-d,a({currentNodeId:r.currentNodeId,elapsedMs:r.elapsedMs});try{switch(v.type){case"request":{S=await _t(v.data,p,s),p.response=S;break}case"condition":{const y=v.data,j=Vt(y.expression,p);p["__condition_"+v.id]=j;break}case"delay":{const y=v.data;await Jt(y.durationMs,c);break}case"extract":{const y=v.data,j=Kt(S,y.jsonPath);p[y.variableName]=j,r.variables=[...r.variables.filter(E=>E.name!==y.variableName),{name:y.variableName,value:j,sourceNodeId:v.id}];break}}r.completedNodeIds=[...r.completedNodeIds,v.id],r.elapsedMs=Date.now()-d,a({completedNodeIds:[...r.completedNodeIds],variables:[...r.variables],elapsedMs:r.elapsedMs})}catch(y){return r.status="error",r.errorNodeId=v.id,r.errorMessage=y instanceof Error?y.message:String(y),r.currentNodeId=null,r.elapsedMs=Date.now()-d,a({...r}),{...r}}}return r.status="completed",r.currentNodeId=null,r.elapsedMs=Date.now()-d,a({...r}),{...r}}function Ut(e,t){const n=new Map;for(const d of e)n.set(d.id,d);const s=new Map,a=new Map;for(const d of e)s.set(d.id,0),a.set(d.id,[]);for(const d of t){const p=a.get(d.source);p&&p.push(d.target),s.set(d.target,(s.get(d.target)??0)+1)}const c=[];for(const[d,p]of s)p===0&&c.push(d);const r=[];for(;c.length>0;){const d=c.shift(),p=n.get(d);p&&r.push(p);for(const S of a.get(d)??[]){const w=(s.get(S)??1)-1;s.set(S,w),w===0&&c.push(S)}}return r}async function _t(e,t,n){const s=de(e.method,t),a=de(e.path,t),c=e.headers?ye(e.headers,t):void 0,r=e.body?de(e.body,t):void 0,d=e.queryParams?ye(e.queryParams,t):void 0;return n(s,a,{headers:c,body:r,queryParams:d})}const Gt=["===","!==",">=","<=",">","<"];function Vt(e,t){const n=de(e,t);let s=null,a=-1;for(const S of Gt){const w=n.indexOf(S);if(w!==-1){s=S,a=w;break}}if(!s||a===-1)return!!we(n.trim());const c=n.slice(0,a).trim(),r=n.slice(a+s.length).trim(),d=we(c),p=we(r);switch(s){case"===":return d===p;case"!==":return d!==p;case">":return Number(d)>Number(p);case"<":return Number(d)<Number(p);case">=":return Number(d)>=Number(p);case"<=":return Number(d)<=Number(p);default:return!1}}function we(e){if(e==="null")return null;if(e==="undefined")return;if(e==="true")return!0;if(e==="false")return!1;if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);const t=Number(e);return!Number.isNaN(t)&&e.length>0?t:e}function Jt(e,t){return new Promise((n,s)=>{if(t!=null&&t.aborted){s(new Error("Flow cancelled"));return}const a=setTimeout(()=>{r(),n()},e);function c(){clearTimeout(a),r(),s(new Error("Flow cancelled"))}function r(){t==null||t.removeEventListener("abort",c)}t==null||t.addEventListener("abort",c)})}function Kt(e,t){const n=t.split(".");let s=e;for(const a of n){if(s==null||typeof s!="object")return;s=s[a]}return s}const ze={request:()=>({method:"GET",path:"/api/"}),condition:()=>({expression:"{{response.status}} === 200"}),delay:()=>({durationMs:1e3}),extract:()=>({variableName:"value",jsonPath:"response.data"})};function Fe(e){return["POST","PUT","PATCH"].includes(e)?{method:e,path:"/api/",headers:{"Content-Type":"application/json"},body:`{
|
|
10
|
-
|
|
11
|
-
}`}:{method:e,path:"/api/"}}const Qt={q:"request",w:"condition",e:"delay",r:"extract"},Xt={request:"Q",condition:"W",delay:"E",extract:"R"};let Yt=0;function k(){return`p${++Yt}`}function N(e,t,n,s,a){return{id:e,type:t,position:{x:n,y:s},data:a}}function q(e,t,n){return{id:k(),source:e,target:t,sourceHandle:n}}const Zt=[{label:"Health Check",description:"Hit an endpoint and verify 200 status",build:()=>{const e=k(),t=k();return{name:"Health Check",nodes:[N(e,"request",100,100,{method:"GET",path:"/"}),N(t,"condition",100,280,{expression:"{{response.status}} === 200"})],edges:[q(e,t)]}}},{label:"Sequential Requests",description:"Two requests in sequence with a delay between them",build:()=>{const e=k(),t=k(),n=k();return{name:"Sequential Requests",nodes:[N(e,"request",100,80,{method:"GET",path:"/api/first"}),N(t,"delay",100,240,{durationMs:500}),N(n,"request",100,400,{method:"GET",path:"/api/second"})],edges:[q(e,t),q(t,n)]}}},{label:"Create & Verify",description:"POST to create, extract ID, GET to verify",build:()=>{const e=k(),t=k(),n=k(),s=k();return{name:"Create & Verify",nodes:[N(e,"request",100,60,{method:"POST",path:"/api/resource",body:`{
|
|
12
|
-
"name": "test"
|
|
13
|
-
}`,headers:{"Content-Type":"application/json"}}),N(t,"extract",100,230,{variableName:"resourceId",jsonPath:"response.data.id"}),N(n,"request",100,400,{method:"GET",path:"/api/resource/{{resourceId}}"}),N(s,"condition",100,570,{expression:"{{response.status}} === 200"})],edges:[q(e,t),q(t,n),q(n,s)]}}},{label:"Auth + Request",description:"Authenticate, extract token, make authorized request",build:()=>{const e=k(),t=k(),n=k();return{name:"Auth + Request",nodes:[N(e,"request",100,60,{method:"POST",path:"/api/auth/login",body:`{
|
|
14
|
-
"username": "admin",
|
|
15
|
-
"password": "password"
|
|
16
|
-
}`,headers:{"Content-Type":"application/json"}}),N(t,"extract",100,260,{variableName:"token",jsonPath:"response.data.token"}),N(n,"request",100,440,{method:"GET",path:"/api/protected/resource",headers:{Authorization:"Bearer {{token}}"}})],edges:[q(e,t),q(t,n)]}}},{label:"CRUD Flow",description:"Create, Read, Update, Delete a resource",build:()=>{const e=k(),t=k(),n=k(),s=k(),a=k();return{name:"CRUD Flow",nodes:[N(e,"request",100,40,{method:"POST",path:"/api/resource",body:`{
|
|
17
|
-
"name": "test"
|
|
18
|
-
}`,headers:{"Content-Type":"application/json"}}),N(t,"extract",100,200,{variableName:"id",jsonPath:"response.data.id"}),N(n,"request",100,360,{method:"GET",path:"/api/resource/{{id}}"}),N(s,"request",100,520,{method:"PUT",path:"/api/resource/{{id}}",body:`{
|
|
19
|
-
"name": "updated"
|
|
20
|
-
}`,headers:{"Content-Type":"application/json"}}),N(a,"request",100,680,{method:"DELETE",path:"/api/resource/{{id}}"})],edges:[q(e,t),q(t,n),q(n,s),q(s,a)]}}},{label:"Conditional Retry",description:"Request, check status, delay and retry on failure",build:()=>{const e=k(),t=k(),n=k(),s=k();return{name:"Conditional Retry",nodes:[N(e,"request",100,60,{method:"GET",path:"/api/resource"}),N(t,"condition",100,240,{expression:"{{response.status}} === 200"}),N(n,"delay",350,400,{durationMs:2e3}),N(s,"request",350,560,{method:"GET",path:"/api/resource"})],edges:[q(e,t),q(t,n,"false")]}}}];function uo(){return o.jsx($t,{children:o.jsx(eo,{})})}function eo(){const e=J(),{flows:t,activeFlowId:n,runState:s,addFlow:a,updateFlow:c,setActiveFlow:r,setRunState:d,resetRunState:p}=Ht(),{fetch:S}=ot(),[w,v]=l.useState(""),[y,j,E]=Ue([]),[M,R,be]=_e([]),[I,A]=l.useState(null),[K,se]=l.useState(null),[pe,re]=l.useState(null),[fe,ae]=l.useState(null),[he,me]=l.useState(null),ie=l.useRef({x:300,y:200}),u=l.useRef(null),f=l.useRef(null),b=l.useMemo(()=>t.find(i=>i.id===n)??null,[t,n]);l.useEffect(()=>{b?(v(b.name),j(b.nodes.map(i=>({id:i.id,type:i.type,position:i.position,data:i.data}))),R(b.edges.map(i=>({id:i.id,source:i.source,target:i.target,sourceHandle:i.sourceHandle??void 0}))),A(null)):(v(""),j([]),R([]),A(null))},[n]);const D=l.useCallback(i=>{R(m=>Ce(i,m))},[R]),B=l.useCallback((i,m)=>{const x={id:m.id,type:m.type,position:m.position,data:m.data};A(x)},[]),O=l.useCallback((i,m)=>{j(x=>x.map(P=>P.id===i?{...P,data:m}:P)),A(x=>x&&x.id===i?{...x,data:m}:x)},[j]),X=l.useCallback(i=>{const m=f.current;if(!m)return;const x=m.getBoundingClientRect();ie.current={x:i.clientX-x.left,y:i.clientY-x.top}},[]),ge=l.useCallback(()=>{A(null)},[]),xe=l.useCallback(()=>{const i=y.map(x=>({id:x.id,type:x.type,position:x.position,data:x.data})),m=M.map(x=>({id:x.id,source:x.source,target:x.target,sourceHandle:x.sourceHandle??void 0}));if(b)c({id:b.id,name:w||"Untitled Flow",nodes:i,edges:m});else{const x=Date.now().toString(36);a({id:x,name:w||"Untitled Flow",nodes:i,edges:m}),r(x)}},[b,w,y,M,a,c,r]),Y=l.useCallback(()=>{const i=Date.now().toString(36);a({id:i,name:"New Flow",nodes:[],edges:[]}),r(i)},[a,r]),Z=l.useCallback(i=>{const m=i.build(),x=Date.now().toString(36),P={id:x,...m};a(P),r(x),ae(null)},[a,r]),De=l.useCallback(i=>{const m=Date.now().toString(36),x=i==="request"?Fe("GET"):ze[i](),P={id:m,type:i,position:{x:300,y:200},data:x};j(U=>[...U,P]),re(null)},[j]);l.useEffect(()=>{const i=m=>{const x=m.target.tagName;if(x==="INPUT"||x==="TEXTAREA"||x==="SELECT"||m.target.isContentEditable)return;const P=m.key.toLowerCase(),U=Qt[P];if(U){m.preventDefault();const g=Date.now().toString(36),z=ie.current,$=U==="request"?Fe("GET"):ze[U](),H={id:g,type:U,position:{x:z.x-60,y:z.y-30},data:$};j(L=>[...L,H]);return}if(P==="tab"){m.preventDefault(),j(g=>{if(g.length===0)return g;const z=I?g.findIndex(Q=>Q.id===I.id):-1,$=m.shiftKey?-1:1,H=(z+$+g.length)%g.length,L=g[H];return A({id:L.id,type:L.type,position:L.position,data:L.data}),g});return}if(P==="enter"&&I){m.preventDefault(),K?K!==I.id&&(Date.now().toString(36),R(g=>Ce({source:K,target:I.id,sourceHandle:null,targetHandle:null},g)),se(null)):se(I.id);return}if(P==="escape"){K?se(null):A(null);return}if((P==="delete"||P==="backspace"||P==="x")&&I){m.preventDefault(),j(g=>g.filter(z=>z.id!==I.id)),R(g=>g.filter(z=>z.source!==I.id&&z.target!==I.id)),A(null);return}if(P==="f"){m.preventDefault();const g=ie.current;j(z=>{if(z.length===0)return z;let $=null,H=1/0;for(const L of z){const Q=L.position.x-g.x,ee=L.position.y-g.y,te=Q*Q+ee*ee;te<H&&(H=te,$=L)}return $&&A({id:$.id,type:$.type,position:$.position,data:$.data}),z});return}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[I,K,j,R]);const Oe=l.useCallback(async()=>{var U;if(s.status==="running"){(U=u.current)==null||U.abort();return}const i=y.map(g=>({id:g.id,type:g.type,position:g.position,data:g.data})),m=M.map(g=>({id:g.id,source:g.source,target:g.target,sourceHandle:g.sourceHandle??void 0})),x={id:(b==null?void 0:b.id)??"temp",name:w||"Untitled Flow",nodes:i,edges:m},P=new AbortController;u.current=P,p();try{const g=await Bt({flow:x,variables:{},fetchFn:async(z,$,H)=>{const L={query:H.queryParams?Object.entries(H.queryParams).map(([ee,te])=>({key:ee,value:te,enabled:!0})):[],params:[],headers:H.headers?Object.entries(H.headers).map(([ee,te])=>({key:ee,value:te,enabled:!0})):[],body:H.body??""},Q=await S(z.toLowerCase(),$,L,`flow-${Date.now().toString(36)}`);return{status:Q.log.status,data:Q.log.output,headers:Q.log.headers??{}}},onProgress:z=>{d({...s,...z})},signal:P.signal});d(g)}catch{}finally{u.current=null}},[s,y,M,b,w,S,p,d]),le=s.status==="running",$e=s.status!=="idle",ve=l.useMemo(()=>y.map(i=>({id:i.id,type:i.type,position:i.position,data:i.data})),[y]);return o.jsxs(dt,{title:"Flow Builder",children:[o.jsxs(T,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,sx:{mb:2},children:[o.jsx(V,{size:"small",placeholder:"Flow name",value:w,onChange:i=>v(i.target.value),sx:{minWidth:150,maxWidth:200}}),o.jsxs(Ae,{size:"small",value:n??"",onChange:i=>{const m=i.target.value;r(m||null)},displayEmpty:!0,sx:{minWidth:140},children:[o.jsx(ce,{value:"",children:o.jsx("em",{children:"Select a flow"})}),t.map(i=>o.jsx(ce,{value:i.id,children:i.name||i.id},i.id))]}),o.jsx(W,{size:"small",variant:"outlined",onClick:Y,children:"New"}),o.jsx(W,{size:"small",variant:"outlined",startIcon:o.jsx(mt,{fontSize:"small"}),onClick:i=>ae(i.currentTarget),children:"Presets"}),o.jsx(Te,{anchorEl:fe,open:!!fe,onClose:()=>ae(null),slotProps:{paper:{sx:{maxWidth:320}}},children:Zt.map(i=>o.jsx(ce,{onClick:()=>Z(i),children:o.jsx(Ne,{primary:i.label,secondary:i.description})},i.label))}),o.jsx(W,{size:"small",variant:"outlined",startIcon:o.jsx(ft,{fontSize:"small"}),onClick:xe,children:"Save"}),o.jsx(W,{size:"small",variant:"outlined",startIcon:o.jsx(Ge,{fontSize:"small"}),onClick:i=>re(i.currentTarget),children:"Add node"}),o.jsx(Te,{anchorEl:pe,open:!!pe,onClose:()=>re(null),children:["request","condition","delay","extract"].map(i=>o.jsx(ce,{onClick:()=>De(i),children:o.jsx(Ne,{primary:o.jsxs(T,{direction:"row",spacing:1,alignItems:"center",children:[o.jsx("span",{style:{textTransform:"capitalize"},children:i}),o.jsx(ne,{label:Xt[i],size:"small",variant:"outlined",sx:{height:18,fontSize:"0.65rem"}})]})})},i))}),o.jsx(W,{size:"small",variant:"contained",color:le?"error":"primary",startIcon:le?o.jsx(ht,{fontSize:"small"}):o.jsx(st,{fontSize:"small"}),onClick:Oe,children:le?"Stop":"Run"}),o.jsx(W,{size:"small",variant:"outlined",startIcon:o.jsx(pt,{fontSize:"small"}),onClick:i=>me(i.currentTarget),children:"Guide"}),o.jsxs(nt,{open:!!he,anchorEl:he,onClose:()=>me(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{sx:{maxWidth:380,p:2.5}}},children:[o.jsx(C,{variant:"subtitle2",gutterBottom:!0,children:"Keyboard shortcuts"}),o.jsx(T,{spacing:.5,sx:{mb:2},children:[["Q","Add Request node at cursor"],["W","Add Condition node at cursor"],["E","Add Delay node at cursor"],["R","Add Extract node at cursor"],["F","Select closest node to cursor"],["Tab / Shift+Tab","Cycle through nodes"],["Enter","Start connection from selected node"],["Enter (again)","Complete connection to selected node"],["X / Delete","Delete selected node"],["Esc","Cancel connection or deselect"]].map(([i,m])=>o.jsxs(T,{direction:"row",spacing:1.5,alignItems:"baseline",children:[o.jsx(ne,{label:i,size:"small",variant:"outlined",sx:{fontFamily:"monospace",fontSize:"0.7rem",height:20,minWidth:36}}),o.jsx(C,{variant:"body2",color:"text.secondary",sx:{fontSize:"0.8rem"},children:m})]},i))}),o.jsx(C,{variant:"subtitle2",gutterBottom:!0,children:"How to use"}),o.jsx(T,{spacing:.5,children:["Create a new flow or pick a preset template to start.","Add nodes with keyboard shortcuts or the Add node menu.","Connect nodes by dragging from a source handle to a target handle, or use Enter to connect via keyboard.","Click a node to edit its settings in the side panel.","POST/PUT/PATCH requests come prefilled with Content-Type and body template.","Use {{variable}} syntax in paths, headers, and conditions to reference extracted values.","Hit Run to execute the flow. Progress shows at the bottom."].map((i,m)=>o.jsxs(C,{variant:"body2",color:"text.secondary",sx:{fontSize:"0.8rem"},children:[m+1,". ",i]},m))})]}),K&&o.jsx(ne,{label:"Connecting... Tab to select target, Enter to link, Esc to cancel",size:"small",color:"info",variant:"outlined"})]}),o.jsxs(F,{ref:f,sx:{display:"flex",height:"calc(100vh - 260px)",minHeight:400,position:"relative",border:`1px solid ${h("#ffffff",.07)}`,borderRadius:2,overflow:"hidden"},children:[o.jsxs(F,{sx:{flex:1,position:"relative",minWidth:0},children:[o.jsx(wt,{nodes:y,edges:M,onNodesChange:E,onEdgesChange:be,onConnect:D,onNodeClick:B,onMouseMove:X}),$e&&o.jsx(F,{sx:{position:"absolute",bottom:0,left:0,right:0,zIndex:10},children:o.jsx(Ft,{runState:s,nodes:ve})})]}),I&&!le&&o.jsx(St,{node:I,onUpdate:O,onClose:ge}),le&&o.jsx(F,{sx:{width:340,flexShrink:0,borderLeft:`1px solid ${h("#ffffff",.08)}`,bgcolor:h(e.palette.background.paper,.72),backdropFilter:"blur(16px)",overflow:"auto",p:2},children:o.jsx(Rt,{variables:s.variables,nodes:ve})})]})]})}export{uo as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./vendor-xyflow.js";import{J as st,I as nt,aq as bt,U as at,M as G,N as rt,O as it,P as Ct,W as lt,X as vt,R as jt,h as Q,k as F,an as Bt,g as ct,a3 as Z,C as St,G as X,T as z,u as Mt,x as ut,S as E,B as Tt,D as J,y as W,ar as Rt,ab as kt,b as wt,e as $t,as as q,f as Lt,at as Et,a7 as It,H as Dt,Y as At,v as Ft,w as zt,a9 as Nt,a1 as Ot,au as Pt,av as Gt}from"./docs.js";import{u as Kt,R as Ut}from"./useQueryState.js";import{h as y,m as dt,p as Wt,B as pt,C as _,X as V,Y,T as O,q as gt,A as Ht,y as _t,x as Vt,P as Yt,v as Qt,L as Zt}from"./vendor-recharts.js";import{B as Xt}from"./BaseFilterBar.js";import{g as Jt}from"./getValidReactChildren.js";import{B as qt,a as te,b as tt}from"./BentoGrid.js";import{P as ee,T as oe}from"./PageContainer.js";import{E as se}from"./ExportButton.js";import{D as ne}from"./filterTypes.js";import{A as ae}from"./Autocomplete.js";import"./ExpandLess.js";import"./Download.js";function re(t){return nt("MuiToggleButton",t)}const A=st("MuiToggleButton",["root","disabled","selected","standard","primary","secondary","sizeSmall","sizeMedium","sizeLarge","fullWidth"]),ft=y.createContext({}),ht=y.createContext(void 0);function ie(t,s){return s===void 0||t===void 0?!1:Array.isArray(s)?s.includes(t):t===s}const le=t=>{const{classes:s,fullWidth:n,selected:r,disabled:i,size:l,color:u}=t,c={root:["root",r&&"selected",i&&"disabled",n&&"fullWidth",`size${G(l)}`,u]};return rt(c,re,s)},ce=it(Ct,{name:"MuiToggleButton",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,s[`size${G(n.size)}`]]}})(lt(({theme:t})=>({...t.typography.button,borderRadius:(t.vars||t).shape.borderRadius,padding:11,border:`1px solid ${(t.vars||t).palette.divider}`,color:(t.vars||t).palette.action.active,[`&.${A.disabled}`]:{color:(t.vars||t).palette.action.disabled,border:`1px solid ${(t.vars||t).palette.action.disabledBackground}`},"&:hover":{textDecoration:"none",backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[{props:{color:"standard"},style:{[`&.${A.selected}`]:{color:(t.vars||t).palette.text.primary,backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.selectedOpacity),"&:hover":{backgroundColor:t.alpha((t.vars||t).palette.text.primary,`${(t.vars||t).palette.action.selectedOpacity} + ${(t.vars||t).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.selectedOpacity)}}}}},...Object.entries(t.palette).filter(vt()).map(([s])=>({props:{color:s},style:{[`&.${A.selected}`]:{color:(t.vars||t).palette[s].main,backgroundColor:t.alpha((t.vars||t).palette[s].main,(t.vars||t).palette.action.selectedOpacity),"&:hover":{backgroundColor:t.alpha((t.vars||t).palette[s].main,`${(t.vars||t).palette.action.selectedOpacity} + ${(t.vars||t).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:t.alpha((t.vars||t).palette[s].main,(t.vars||t).palette.action.selectedOpacity)}}}}})),{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{padding:7,fontSize:t.typography.pxToRem(13)}},{props:{size:"large"},style:{padding:15,fontSize:t.typography.pxToRem(15)}}]}))),N=y.forwardRef(function(s,n){const{value:r,...i}=y.useContext(ft),l=y.useContext(ht),u=bt({...i,selected:ie(s.value,r)},s),c=at({props:u,name:"MuiToggleButton"}),{children:v,className:C,color:g="standard",disabled:j=!1,disableFocusRipple:S=!1,fullWidth:f=!1,onChange:L,onClick:R,selected:m,size:B="medium",value:k,...w}=c,$={...c,color:g,disabled:j,disableFocusRipple:S,fullWidth:f,size:B},I=le($),D=e=>{R&&(R(e,k),e.defaultPrevented)||L&&L(e,k)},M=l||"";return o.jsx(ce,{className:dt(i.className,I.root,C,M),disabled:j,focusRipple:!S,ref:n,onClick:D,onChange:L,value:k,ownerState:$,"aria-pressed":m,...w,children:v})});function ue(t){return nt("MuiToggleButtonGroup",t)}const b=st("MuiToggleButtonGroup",["root","selected","horizontal","vertical","disabled","grouped","groupedHorizontal","groupedVertical","fullWidth","firstButton","lastButton","middleButton"]),de=t=>{const{classes:s,orientation:n,fullWidth:r,disabled:i}=t,l={root:["root",n,r&&"fullWidth"],grouped:["grouped",`grouped${G(n)}`,i&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return rt(l,ue,s)},pe=it("div",{name:"MuiToggleButtonGroup",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[{[`& .${b.grouped}`]:s.grouped},{[`& .${b.grouped}`]:s[`grouped${G(n.orientation)}`]},{[`& .${b.firstButton}`]:s.firstButton},{[`& .${b.lastButton}`]:s.lastButton},{[`& .${b.middleButton}`]:s.middleButton},s.root,n.orientation==="vertical"&&s.vertical,n.fullWidth&&s.fullWidth]}})(lt(({theme:t})=>({display:"inline-flex",borderRadius:(t.vars||t).shape.borderRadius,variants:[{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${b.grouped}`]:{[`&.${b.selected} + .${b.grouped}.${b.selected}`]:{borderTop:0,marginTop:0}},[`& .${b.firstButton},& .${b.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${b.lastButton},& .${b.middleButton}`]:{marginTop:-1,borderTop:"1px solid transparent",borderTopLeftRadius:0,borderTopRightRadius:0},[`& .${b.lastButton}.${A.disabled},& .${b.middleButton}.${A.disabled}`]:{borderTop:"1px solid transparent"}}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"horizontal"},style:{[`& .${b.grouped}`]:{[`&.${b.selected} + .${b.grouped}.${b.selected}`]:{borderLeft:0,marginLeft:0}},[`& .${b.firstButton},& .${b.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${b.lastButton},& .${b.middleButton}`]:{marginLeft:-1,borderLeft:"1px solid transparent",borderTopLeftRadius:0,borderBottomLeftRadius:0},[`& .${b.lastButton}.${A.disabled},& .${b.middleButton}.${A.disabled}`]:{borderLeft:"1px solid transparent"}}}]}))),ge=y.forwardRef(function(s,n){const r=at({props:s,name:"MuiToggleButtonGroup"}),{children:i,className:l,color:u="standard",disabled:c=!1,exclusive:v=!1,fullWidth:C=!1,onChange:g,orientation:j="horizontal",size:S="medium",value:f,...L}=r,R={...r,disabled:c,fullWidth:C,orientation:j,size:S},m=de(R),B=y.useCallback((M,e)=>{if(!g)return;const a=f&&f.indexOf(e);let d;f&&a>=0?(d=f.slice(),d.splice(a,1)):d=f?f.concat(e):[e],g(M,d)},[g,f]),k=y.useCallback((M,e)=>{g&&g(M,f===e?null:e)},[g,f]),w=y.useMemo(()=>({className:m.grouped,onChange:v?k:B,value:f,size:S,fullWidth:C,color:u,disabled:c}),[m.grouped,v,k,B,f,S,C,u,c]),$=Jt(i),I=$.length,D=M=>{const e=M===0,a=M===I-1;return e&&a?"":e?m.firstButton:a?m.lastButton:m.middleButton};return o.jsx(pe,{role:"group",className:dt(m.root,l),ref:n,ownerState:R,...L,children:o.jsx(ft.Provider,{value:w,children:$.map((M,e)=>o.jsx(ht.Provider,{value:D(e),children:M},e))})})}),fe=jt(o.jsx("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"})),he=500,et=10;function me({requests:t,onSelectEndpoint:s}){var v;const n=Q(),{mostUsed:r,slowest:i}=y.useMemo(()=>ye(t),[t]),l=F(n.palette.primary.light,.9),u=((v=n.palette.status)==null?void 0:v.warning)??n.palette.secondary.light,c=F(u,.9);return o.jsxs(Bt,{container:!0,spacing:2,children:[o.jsx(ot,{title:"Most used requests",data:r,valueKey:"count",axisFormatter:C=>C.toLocaleString(),tooltipFormatter:C=>`${C.toLocaleString()} calls`,color:l,emptyLabel:"No request volume in the selected range yet.",onSelectEndpoint:s}),o.jsx(ot,{title:"Slowest requests",data:i,valueKey:"avgDuration",axisFormatter:C=>`${C.toLocaleString()} ms`,tooltipFormatter:C=>`${C.toLocaleString()} ms`,color:c,emptyLabel:"No duration data in the selected range yet.",onSelectEndpoint:s})]})}function ot({title:t,data:s,valueKey:n,axisFormatter:r,tooltipFormatter:i,color:l,emptyLabel:u,onSelectEndpoint:c}){const v=Q(),C=F("#ffffff",.12),[g,j]=y.useState(!1),S=s.length>et,f=g?s:s.slice(0,et),L=Math.max(f.length*38+60,260),R=S?o.jsx(Z,{size:"small",onClick:()=>j(m=>!m),children:g?"Collapse":`Show all (${s.length})`}):void 0;return o.jsx(St,{title:t,actions:R,flex:1,children:s.length?o.jsx(X,{sx:{height:L},children:o.jsx(Wt,{width:"100%",height:"100%",children:o.jsxs(pt,{data:f,layout:"vertical",margin:{left:0,right:16,top:8,bottom:8},children:[o.jsx(_,{stroke:"rgba(255,255,255,0.08)"}),o.jsx(V,{type:"number",tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,tickFormatter:m=>{const B=typeof m=="number"?m:Number(m);return r?r(Number.isFinite(B)?B:0):(Number.isFinite(B)?B:0).toLocaleString()}}),o.jsx(Y,{dataKey:"label",type:"category",width:220,tick:{fill:"rgba(255,255,255,0.85)",fontSize:12},tickLine:!1,axisLine:!1}),o.jsx(O,{cursor:{fill:F("#ffffff",.08)},contentStyle:{backgroundColor:v.palette.background.paper,borderColor:C},formatter:m=>[i(typeof m=="number"?m:Number(m)||0),""],labelFormatter:m=>m}),o.jsx(gt,{dataKey:n,fill:l,radius:[3,3,3,3],cursor:"pointer",onClick:m=>{const B=m==null?void 0:m.payload;B!=null&&B.endpointId&&c(B.endpointId)}})]})})}):o.jsx(xe,{label:u})})}function xe({label:t}){return o.jsx(X,{sx:{py:4},children:o.jsx(z,{color:"text.secondary",align:"center",children:t})})}function ye(t){const s=t.slice(0,he),n=new Map;s.forEach(u=>{const{displayId:c}=ct(u.method,u.path);if(!c)return;const v=n.get(c)??{label:c,count:0,totalDuration:0};v.count+=1,v.totalDuration+=u.durationMs??0,n.set(c,v)});const r=Array.from(n.entries()).map(([u,c])=>({endpointId:u,label:c.label,count:c.count,avgDuration:c.count===0?0:Math.round(c.totalDuration/Math.max(c.count,1))})),i=[...r].sort((u,c)=>c.count===u.count?u.label.localeCompare(c.label):c.count-u.count),l=[...r].sort((u,c)=>c.avgDuration===u.avgDuration?u.label.localeCompare(c.label):c.avgDuration-u.avgDuration);return{mostUsed:i,slowest:l}}const H={title:"Not enough data to display",description:"Widen the filters to see insights here."};function be({requests:t}){const s=Mt(),n=Q(),r=n.palette.background.paper,i=F("#ffffff",.08),l=n.palette.primary.main,[u,c]=y.useState("all"),[v,C]=y.useState(null),[g,j]=y.useState(null),[S,f]=y.useState(null),{openBucketRequests:L}=ut(),R=v!=null,m=u!=="all"||R,B=y.useMemo(()=>Ce(t,u),[t,u]),k=y.useMemo(()=>ve(B,v),[B,v]),w=y.useMemo(()=>je(k),[k]),$=y.useMemo(()=>mt(B),[B]),I=y.useMemo(()=>$.reduce((h,p)=>Math.max(h,p.count),0),[$]),D=I>0?[0,I]:[0,"auto"],M=y.useMemo(()=>{if(g!=null&&S!=null){const h=Math.min(g,S),p=Math.max(g,S);return h===p?null:{from:h,to:p}}return v},[g,S,v]),e=h=>{if(!h)return;const p=Rt(h,{tab:"metrics"});s(p)},a=(h,p)=>{p&&(c(p),C(null),j(null),f(null))},d=()=>{C(null),j(null),f(null)},x=h=>{if((h==null?void 0:h.activeLabel)==null)return;const p=Number(h.activeLabel);Number.isFinite(p)&&(j(p),f(p))},T=h=>{if(g==null)return;const p=Number(h==null?void 0:h.activeLabel);Number.isFinite(p)&&f(p)},K=()=>{if(g==null||S==null){j(null),f(null);return}const h=Math.min(g,S),p=Math.max(g,S);j(null),f(null),!(!Number.isFinite(h)||!Number.isFinite(p)||h===p)&&C({from:h,to:p})},xt=h=>{const p=$[h.activeIndex];!p||!p.requests.length||L(p)},yt=o.jsxs(E,{direction:"row",spacing:1,alignItems:"center",children:[o.jsxs(ge,{size:"small",exclusive:!0,value:u,onChange:a,children:[o.jsx(N,{value:"15m",children:"Last 15m"}),o.jsx(N,{value:"1h",children:"Last 1h"}),o.jsx(N,{value:"24h",children:"Last 24h"}),o.jsx(N,{value:"all",children:"All"})]}),R&&o.jsx(Z,{size:"small",onClick:d,children:"Reset range"})]});return o.jsx(o.Fragment,{children:o.jsxs(E,{spacing:3,children:[o.jsx(Tt,{stats:[{label:"Total requests",value:w.totalRequests,detail:m?"Filtered":"Overall"},{label:"Error rate",value:`${w.errorRate}%`,detail:"Statuses 4xx/5xx"},{label:"Avg duration",value:`${w.avgDuration} ms`},{label:"P95 duration",value:`${w.p95Duration} ms`}]}),o.jsx(J,{charts:[{title:"Requests over time",chart:o.jsx(W,{data:$,emptyFallback:H,children:h=>o.jsxs(Ht,{data:h,margin:{left:0,right:16,top:8,bottom:8},onMouseDown:x,onMouseMove:T,onMouseUp:K,onClick:p=>xt(p),children:[o.jsx(_,{stroke:"rgba(255,255,255,0.1)"}),o.jsx(V,{dataKey:"timestamp",type:"number",tickFormatter:p=>Te(p),tick:{fill:"rgba(255,255,255,0.6)",fontSize:12},tickLine:!1,axisLine:!1,domain:["dataMin","dataMax"]}),o.jsx(Y,{tick:{fill:"rgba(255,255,255,0.6)",fontSize:12},allowDecimals:!1,tickLine:!1,axisLine:!1,domain:D}),o.jsx(O,{wrapperStyle:{pointerEvents:"none"},content:Re,contentStyle:{backgroundColor:r,borderColor:i}}),M&&o.jsx(_t,{x1:M.from,x2:M.to,strokeOpacity:0,fill:F(l,.18)}),o.jsx(Vt,{dataKey:"count",type:"monotone",stroke:l,fill:l,fillOpacity:.25})]})}),actions:yt}]}),o.jsx(J,{charts:[{title:"Requests by method",chart:o.jsx(W,{data:w.byMethod,emptyFallback:H,children:h=>o.jsxs(pt,{data:h,children:[o.jsx(_,{stroke:"rgba(255,255,255,0.1)"}),o.jsx(V,{dataKey:"method",tick:{fill:"rgba(255,255,255,0.6)"}}),o.jsx(Y,{allowDecimals:!1,tick:{fill:"rgba(255,255,255,0.6)"}}),o.jsx(O,{contentStyle:{backgroundColor:r,borderColor:i},formatter:(p,U)=>[`${p} requests`,String(U).toUpperCase()]}),o.jsx(gt,{dataKey:"count",fill:n.palette.primary.light,radius:[3,3,0,0]})]})})},{title:"Requests by status",chart:o.jsx(W,{data:w.byStatus,emptyFallback:H,children:h=>o.jsxs(Yt,{children:[o.jsx(Qt,{data:h,dataKey:"count",nameKey:"label",outerRadius:90,fill:F(n.palette.secondary.light,.85),label:!0}),o.jsx(O,{contentStyle:{backgroundColor:r,borderColor:i},formatter:(p,U)=>[`${p} requests`,String(U)]}),o.jsx(Zt,{})]})})}]}),o.jsx(me,{requests:k,onSelectEndpoint:e})]})})}function P(t){const n=new Date(t.createdAt).getTime();return Number.isFinite(n)?n:0}function Ce(t,s){if(!t.length)return[];if(s==="all")return t;const n=t.reduce((l,u)=>{const c=P(u);return c>l?c:l},0);if(!n)return t;let r=0;if(s==="15m"?r=15*6e4:s==="1h"?r=60*6e4:s==="24h"&&(r=1440*6e4),!r)return t;const i=n-r;return t.filter(l=>P(l)>=i)}function ve(t,s){if(!s)return t;const n=Math.min(s.from,s.to),r=Math.max(s.from,s.to);return t.filter(i=>{const l=P(i);return l>=n&&l<=r})}function je(t){const s=t.length,n=t.filter(g=>g.status>=400).length,r=s===0?0:Math.round(n/s*100),i=t.map(g=>g.durationMs||0),l=i.length===0?0:Math.round(i.reduce((g,j)=>g+j,0)/i.length),u=Me(i,.95),c=mt(t),v=Be(t),C=Se(t);return{totalRequests:s,errorRate:r,avgDuration:l,p95Duration:u,byTime:c,byMethod:v,byStatus:C}}function mt(t){const s=new Map;return t.forEach(n=>{const r=P(n),i=new Date(r);i.setSeconds(0,0);const l=i.getTime(),u=s.get(l)??{count:0,requests:[]};u.count+=1,u.requests.push({id:n.id,method:n.method,path:n.path,status:n.status,durationMs:n.durationMs??0,createdAt:r,requestSize:n.requestSize,responseSize:n.responseSize}),s.set(l,u)}),Array.from(s.entries()).sort(([n],[r])=>n-r).map(([n,r])=>({timestamp:n,count:r.count,label:new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),requests:r.requests.sort((i,l)=>i.createdAt-l.createdAt)}))}function Be(t){const s=new Map;return t.forEach(n=>{s.set(n.method,(s.get(n.method)??0)+1)}),Array.from(s.entries()).map(([n,r])=>({method:n,count:r}))}function Se(t){const s={"2xx":0,"3xx":0,"4xx":0,"5xx":0};return t.forEach(n=>{n.status>=500?s["5xx"]+=1:n.status>=400?s["4xx"]+=1:n.status>=300?s["3xx"]+=1:s["2xx"]+=1}),Object.entries(s).filter(([,n])=>n>0).map(([n,r])=>({label:n,count:r}))}function Me(t,s){if(!t.length)return 0;const n=[...t].sort((i,l)=>i-l),r=Math.floor(s*(n.length-1));return n[r]}function Te(t){const s=typeof t=="number"?t:Number(t);if(!Number.isFinite(s))return"";try{return new Date(s).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function Re(t){var i;const{active:s,payload:n}=t;if(!s||!n||!n.length)return null;const r=(i=n[0])==null?void 0:i.payload;return r?o.jsx(X,{sx:{p:1.5,minWidth:160},children:o.jsxs(E,{spacing:.5,children:[o.jsx(z,{variant:"body2",fontWeight:600,children:r.label}),o.jsxs(z,{variant:"body2",color:"text.secondary",children:[r.count," requests"]})]})}):null}const ke={...ne,searchQuery:"",methodsInclude:[],methodsExclude:[],statusesInclude:[],statusesExclude:[],endpointKeysInclude:[],endpointKeysExclude:[]};function Ke(){const{openRequestDetail:t}=ut(),{openPanel:s}=kt(),[n,r]=y.useState([]),[i,l]=Kt("historyFilters",ke),u=y.useMemo(()=>({cursorParam:"cursor",getNextPageParam(e){return e.meta.nextCursor}}),[]),c=wt("GET /__rrroutes/requests",u),{data:v,refetch:C,isFetching:g}=c.useEndpoint({query:i}),j=$t(v,{reverse:!0}),S=q(j,e=>e.status,Pt),f=q(j,e=>({...ct(e.method,e.path),path:e.path,method:e.method}),Gt,e=>e.encodedId),L=Lt(j,e=>e.tags),R=Et(j,e=>{var a,d;return{timestamp:new Date(e.createdAt).toISOString(),method:((d=(a=e.method)==null?void 0:a.toUpperCase)==null?void 0:d.call(a))??e.method,path:e.path,status:e.status,durationMs:e.durationMs,tags:Array.isArray(e.tags)?e.tags.join(", "):"",groupId:e.groupId??"",endpointId:e.id,fullUrl:e.fullUrl??""}}),m=(e,a)=>{l(d=>{const x=new Set(d.methodsInclude),T=new Set(d.methodsExclude);return a==="include"?(x.has(e)?x.delete(e):x.add(e),T.delete(e)):(T.has(e)?T.delete(e):T.add(e),x.delete(e)),{...d,methodsInclude:Array.from(x),methodsExclude:Array.from(T)}})},B=(e,a)=>{l(d=>{const x=new Set(d.statusesInclude),T=new Set(d.statusesExclude);return a==="include"?(x.has(e)?x.delete(e):x.add(e),T.delete(e)):(T.has(e)?T.delete(e):T.add(e),x.delete(e)),{...d,statusesInclude:Array.from(x),statusesExclude:Array.from(T)}})},k=e=>{var a,d;return(a=i.methodsInclude)!=null&&a.includes(e)?"include":(d=i.methodsExclude)!=null&&d.includes(e)?"exclude":"none"},w=e=>{var a,d;return(a=i.statusesInclude)!=null&&a.includes(e)?"include":(d=i.statusesExclude)!=null&&d.includes(e)?"exclude":"none"},$=y.useMemo(()=>{var e;return(e=i.endpointKeysInclude)==null?void 0:e.map(a=>{var d;return((d=f.find(x=>x.encodedId==a))==null?void 0:d.displayId)??a})},[f,i.endpointKeysInclude]),I=y.useMemo(()=>{var e;return(e=i.endpointKeysExclude)==null?void 0:e.map(a=>{var d;return((d=f.find(x=>x.encodedId==a))==null?void 0:d.displayId)??a})},[f,i.endpointKeysExclude]);y.useCallback(e=>{r(a=>a.includes(e)?a.filter(d=>d!==e):a.length>=2?[a[1],e]:[...a,e])},[]);const D=y.useCallback(()=>{s("diff")},[s]),M=(e,a)=>{const d=e.map(x=>{var T;return((T=f.find(K=>K.encodedId==x))==null?void 0:T.encodedId)??x}).filter(x=>x.trim().length>0);l(x=>({...x,endpointKeysInclude:a==="include"?d:x.endpointKeysInclude,endpointKeysExclude:a==="exclude"?d:x.endpointKeysExclude}))};return o.jsx(ee,{title:"History",subtitle:"Review your recently executed requests.",children:o.jsxs(E,{spacing:3,children:[o.jsx(Xt,{value:i,onChange:e=>l(a=>({...a,...e})),tagOptions:L,onRefresh:()=>C(),refreshing:g,children:e=>o.jsxs(E,{spacing:2,children:[o.jsxs(E,{spacing:1,children:[o.jsx(z,{variant:"overline",color:"text.secondary",children:"Methods"}),o.jsx(E,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:It.map(a=>o.jsx(Dt,{method:a,state:k(a),onClick:()=>m(a,e)},a))})]}),o.jsxs(E,{spacing:1,children:[o.jsx(z,{variant:"overline",color:"text.secondary",children:"Statuses"}),o.jsx(E,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:S.map(a=>o.jsx(At,{status:a,state:w(a),onClick:()=>B(a,e)},a))})]}),o.jsxs(E,{spacing:1,children:[o.jsx(z,{variant:"overline",color:"text.secondary",children:"Endpoint"}),o.jsx(ae,{multiple:!0,freeSolo:!0,options:f.map(a=>a.displayId),value:e==="include"?$:I,onChange:(a,d)=>{M(d,e)},ListboxProps:{sx:{maxHeight:240,overflowY:"auto"}},renderInput:a=>o.jsx(oe,{...a,onChange:d=>{l(x=>({...x,searchQuery:d.target.value}))},label:`Endpoint (${e})`,placeholder:"GET /api/example",size:"small"})})]})]})}),o.jsx(qt,{children:o.jsxs(te,{sizes:[8,4],children:[o.jsx(tt,{title:"Table",actions:o.jsxs(E,{direction:"row",spacing:1,alignItems:"center",children:[o.jsx(Nt,{title:"Refresh",children:o.jsx(Ot,{size:"small",onClick:()=>C(),disabled:g,children:o.jsx(Ut,{fontSize:"small",sx:g?{animation:"spin 1s linear infinite","@keyframes spin":{"100%":{transform:"rotate(360deg)"}}}:void 0})})}),o.jsx(Z,{variant:"outlined",size:"small",startIcon:o.jsx(fe,{}),onClick:D,children:"Compare"}),o.jsx(se,{filename:"history.csv",rows:R,title:"Exports the currently filtered history results."})]}),children:o.jsx(Ft,{items:j,columns:zt,query:i,setQuery:l,onRowClick:e=>t({requestId:e.id,allowReplay:!0})})}),o.jsx(tt,{title:"Insights",children:o.jsx(be,{requests:j})})]})})]})})}export{Ke as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./vendor-xyflow.js";import{P as F}from"./PageContainer.js";import{h as S}from"./vendor-recharts.js";import{x as A,b as I,e as b,as as P,aE as C,d as R,S as u,T,aF as w,C as _,v as D,aG as M,aH as k,aD as B}from"./docs.js";import{u as G}from"./useQueryState.js";import{D as Q}from"./filterTypes.js";import{B as z}from"./BaseFilterBar.js";import{E as N}from"./ExportButton.js";import"./Autocomplete.js";import"./Download.js";const O={...Q,searchQuery:"",levelsInclude:[],levelsExclude:[]};function q(){const[t,a]=G("logsAppFilters",O),{openLogGroupDetail:m}=A(),p=I("GET /__rrroutes/logs",{cursorParam:"cursor",getNextPageParam(e){return e.meta.nextCursor},splitPageSize:500,splitPageSizeParam:"pageSize"}).useEndpoint({query:t}),{data:g,isLoading:f,error:x,refetch:d,isFetching:y}=p,l=b(g,{reverse:!1}),L=P(l,e=>({value:e.level,color:B(e.level)}),k,e=>e.value),h=S.useMemo(()=>l.map(e=>({timestamp:C(e.createdAt),level:e.level,name:e.name??"",message:H(e),meta:c(e.meta),tags:Array.isArray(e.tags)?e.tags.join(", "):"",groupId:e.groupId??""})),[l]),E=(e,r)=>{a(o=>{const n=new Set(o.levelsInclude),i=new Set(o.levelsExclude);return r==="include"?(n.has(e)?n.delete(e):n.add(e),i.delete(e)):(i.has(e)?i.delete(e):i.add(e),n.delete(e)),{...o,levelsInclude:Array.from(n),levelsExclude:Array.from(i)}})},v=e=>{var r,o;return(r=t.levelsInclude)!=null&&r.includes(e)?"include":(o=t.levelsExclude)!=null&&o.includes(e)?"exclude":"none"},j=R(x,{messageFallback:"Failed to load application logs.",refetch:d});return s.jsx(s.Fragment,{children:s.jsxs(u,{spacing:3,sx:{mt:2},children:[s.jsx(z,{value:t,onChange:e=>a(r=>({...r,...e})),onRefresh:()=>d(),refreshing:y,children:e=>s.jsxs(u,{spacing:1,children:[s.jsx(T,{variant:"overline",color:"text.secondary",children:"Levels"}),s.jsx(u,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:L.map(r=>s.jsx(w,{color:r.color,level:r.value,state:v(r.value),onClick:()=>E(r.value,e)},r.value))})]})}),s.jsx(_,{title:"Application logs",actions:s.jsx(N,{filename:"application-logs.csv",rows:h,title:"Exports the currently filtered logs."}),children:s.jsx(D,{items:l,endpoint:p,columns:M,query:t,setQuery:a,onRowClick:e=>m({groupId:e.groupId,baseQuery:t,triggerLog:e}),stateHandler:{loading:{variant:"table"},emptyFallback:{title:"No logs",description:"Adjust filters to see additional log entries."},error:j,isLoading:f}})})]})})}function H(t){if(t.description)return t.description;if(typeof t.meta=="string")return t.meta;if(t.meta&&typeof t.meta=="object"){const a=t.meta;if(typeof a.message=="string")return a.message;if(a.message)return c(a.message)}return c(t.meta)}function c(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function se(){return s.jsx(F,{title:"Logs",subtitle:"Monitor system logs and debugging output.",children:s.jsx(q,{})})}export{se as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{h as i,m as se}from"./vendor-recharts.js";import{bf as qe,bg as pt,bb as Tt,bh as Qe,bi as zt,J as Y,I as ee,U as ie,bj as ft,M as X,N as Z,O as F,W as J,bk as Bt,bl as Ft,R as Nt,bm as Ze,Q as pe,X as De,bn as Je,L as Se,K as mt,bo as At,ba as Pt,al as Et,bp as Wt,bq as jt,G as je,S as bt,T as ht}from"./docs.js";import{j as u}from"./vendor-xyflow.js";function He(e){return parseInt(e,10)||0}const Ht={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}};function Ut(e){for(const t in e)return!1;return!0}function vt(e){return Ut(e)||e.outerHeightStyle===0&&!e.overflowing}const qt=i.forwardRef(function(t,o){const{onChange:n,maxRows:s,minRows:l=1,style:r,value:d,...b}=t,{current:g}=i.useRef(d!=null),m=i.useRef(null),h=qe(o,m),v=i.useRef(null),S=i.useRef(null),y=i.useCallback(()=>{const f=m.current,p=S.current;if(!f||!p)return;const I=pt(f).getComputedStyle(f);if(I.width==="0px")return{outerHeightStyle:0,overflowing:!1};p.style.width=I.width,p.value=f.value||t.placeholder||"x",p.value.slice(-1)===`
|
|
2
|
-
`&&(p.value+=" ");const U=I.boxSizing,q=He(I.paddingBottom)+He(I.paddingTop),D=He(I.borderBottomWidth)+He(I.borderTopWidth),B=p.scrollHeight;p.value="x";const j=p.scrollHeight;let L=B;l&&(L=Math.max(Number(l)*j,L)),s&&(L=Math.min(Number(s)*j,L)),L=Math.max(L,j);const T=L+(U==="border-box"?q+D:0),V=Math.abs(L-B)<=1;return{outerHeightStyle:T,overflowing:V}},[s,l,t.placeholder]),C=Tt(()=>{const f=m.current,p=y();if(!f||!p||vt(p))return!1;const R=p.outerHeightStyle;return v.current!=null&&v.current!==R}),c=i.useCallback(()=>{const f=m.current,p=y();if(!f||!p||vt(p))return;const R=p.outerHeightStyle;v.current!==R&&(v.current=R,f.style.height=`${R}px`),f.style.overflow=p.overflowing?"hidden":""},[y]),x=i.useRef(-1);Qe(()=>{const f=zt(c),p=m==null?void 0:m.current;if(!p)return;const R=pt(p);R.addEventListener("resize",f);let I;return typeof ResizeObserver<"u"&&(I=new ResizeObserver(()=>{C()&&(I.unobserve(p),cancelAnimationFrame(x.current),c(),x.current=requestAnimationFrame(()=>{I.observe(p)}))}),I.observe(p)),()=>{f.clear(),cancelAnimationFrame(x.current),R.removeEventListener("resize",f),I&&I.disconnect()}},[y,c,C]),Qe(()=>{c()});const P=f=>{g||c();const p=f.target,R=p.value.length,I=p.value.endsWith(`
|
|
3
|
-
`),U=p.selectionStart===R;I&&U&&p.setSelectionRange(R,R),n&&n(f)};return u.jsxs(i.Fragment,{children:[u.jsx("textarea",{value:d,onChange:P,ref:h,rows:l,style:r,...b}),u.jsx("textarea",{"aria-hidden":!0,className:t.className,readOnly:!0,ref:S,tabIndex:-1,style:{...Ht.shadow,...r,paddingTop:0,paddingBottom:0}})]})});function Me({props:e,states:t,muiFormControl:o}){return t.reduce((n,s)=>(n[s]=e[s],o&&typeof e[s]>"u"&&(n[s]=o[s]),n),{})}const Ye=i.createContext(void 0);function Le(){return i.useContext(Ye)}function gt(e){return e!=null&&!(Array.isArray(e)&&e.length===0)}function Ue(e,t=!1){return e&&(gt(e.value)&&e.value!==""||t&>(e.defaultValue)&&e.defaultValue!=="")}function Dt(e){return e.startAdornment}function Vt(e){return ee("MuiInputBase",e)}const Oe=Y("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","readOnly","input","inputSizeSmall","inputMultiline","inputTypeSearch","inputAdornedStart","inputAdornedEnd","inputHiddenLabel"]);var xt;const Ve=(e,t)=>{const{ownerState:o}=e;return[t.root,o.formControl&&t.formControl,o.startAdornment&&t.adornedStart,o.endAdornment&&t.adornedEnd,o.error&&t.error,o.size==="small"&&t.sizeSmall,o.multiline&&t.multiline,o.color&&t[`color${X(o.color)}`],o.fullWidth&&t.fullWidth,o.hiddenLabel&&t.hiddenLabel]},Ke=(e,t)=>{const{ownerState:o}=e;return[t.input,o.size==="small"&&t.inputSizeSmall,o.multiline&&t.inputMultiline,o.type==="search"&&t.inputTypeSearch,o.startAdornment&&t.inputAdornedStart,o.endAdornment&&t.inputAdornedEnd,o.hiddenLabel&&t.inputHiddenLabel]},Kt=e=>{const{classes:t,color:o,disabled:n,error:s,endAdornment:l,focused:r,formControl:d,fullWidth:b,hiddenLabel:g,multiline:m,readOnly:h,size:v,startAdornment:S,type:y}=e,C={root:["root",`color${X(o)}`,n&&"disabled",s&&"error",b&&"fullWidth",r&&"focused",d&&"formControl",v&&v!=="medium"&&`size${X(v)}`,m&&"multiline",S&&"adornedStart",l&&"adornedEnd",g&&"hiddenLabel",h&&"readOnly"],input:["input",n&&"disabled",y==="search"&&"inputTypeSearch",m&&"inputMultiline",v==="small"&&"inputSizeSmall",g&&"inputHiddenLabel",S&&"inputAdornedStart",l&&"inputAdornedEnd",h&&"readOnly"]};return Z(C,Vt,t)},Xe=F("div",{name:"MuiInputBase",slot:"Root",overridesResolver:Ve})(J(({theme:e})=>({...e.typography.body1,color:(e.vars||e).palette.text.primary,lineHeight:"1.4375em",boxSizing:"border-box",position:"relative",cursor:"text",display:"inline-flex",alignItems:"center",[`&.${Oe.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:"default"},variants:[{props:({ownerState:t})=>t.multiline,style:{padding:"4px 0 5px"}},{props:({ownerState:t,size:o})=>t.multiline&&o==="small",style:{paddingTop:1}},{props:({ownerState:t})=>t.fullWidth,style:{width:"100%"}}]}))),Ge=F("input",{name:"MuiInputBase",slot:"Input",overridesResolver:Ke})(J(({theme:e})=>{const t=e.palette.mode==="light",o={color:"currentColor",...e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5},transition:e.transitions.create("opacity",{duration:e.transitions.duration.shorter})},n={opacity:"0 !important"},s=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5};return{font:"inherit",letterSpacing:"inherit",color:"currentColor",padding:"4px 0 5px",border:0,boxSizing:"content-box",background:"none",height:"1.4375em",margin:0,WebkitTapHighlightColor:"transparent",display:"block",minWidth:0,width:"100%","&::-webkit-input-placeholder":o,"&::-moz-placeholder":o,"&::-ms-input-placeholder":o,"&:focus":{outline:0},"&:invalid":{boxShadow:"none"},"&::-webkit-search-decoration":{WebkitAppearance:"none"},[`label[data-shrink=false] + .${Oe.formControl} &`]:{"&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus::-webkit-input-placeholder":s,"&:focus::-moz-placeholder":s,"&:focus::-ms-input-placeholder":s},[`&.${Oe.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},variants:[{props:({ownerState:l})=>!l.disableInjectingGlobalStyles,style:{animationName:"mui-auto-fill-cancel",animationDuration:"10ms","&:-webkit-autofill":{animationDuration:"5000s",animationName:"mui-auto-fill"}}},{props:{size:"small"},style:{paddingTop:1}},{props:({ownerState:l})=>l.multiline,style:{height:"auto",resize:"none",padding:0,paddingTop:0}},{props:{type:"search"},style:{MozAppearance:"textfield"}}]}})),yt=Bt({"@keyframes mui-auto-fill":{from:{display:"block"}},"@keyframes mui-auto-fill-cancel":{from:{display:"block"}}}),et=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiInputBase"}),{"aria-describedby":s,autoComplete:l,autoFocus:r,className:d,color:b,components:g={},componentsProps:m={},defaultValue:h,disabled:v,disableInjectingGlobalStyles:S,endAdornment:y,error:C,fullWidth:c=!1,id:x,inputComponent:P="input",inputProps:f={},inputRef:p,margin:R,maxRows:I,minRows:U,multiline:q=!1,name:D,onBlur:B,onChange:j,onClick:L,onFocus:T,onKeyDown:V,onKeyUp:N,placeholder:A,readOnly:G,renderSuffix:te,rows:oe,size:Ce,slotProps:O={},slots:fe={},startAdornment:H,type:Ie="text",value:Q,..._}=n,K=f.value!=null?f.value:Q,{current:me}=i.useRef(K!=null),E=i.useRef(),le=i.useCallback(M=>{},[]),ae=qe(E,p,f.ref,le),[be,he]=i.useState(!1),w=Le(),$=Me({props:n,muiFormControl:w,states:["color","disabled","error","hiddenLabel","size","required","filled"]});$.focused=w?w.focused:be,i.useEffect(()=>{!w&&v&&be&&(he(!1),B&&B())},[w,v,be,B]);const ne=w&&w.onFilled,ve=w&&w.onEmpty,de=i.useCallback(M=>{Ue(M)?ne&&ne():ve&&ve()},[ne,ve]);Qe(()=>{me&&de({value:K})},[K,de,me]);const we=M=>{T&&T(M),f.onFocus&&f.onFocus(M),w&&w.onFocus?w.onFocus(M):he(!0)},$e=M=>{B&&B(M),f.onBlur&&f.onBlur(M),w&&w.onBlur?w.onBlur(M):he(!1)},Te=(M,...ue)=>{if(!me){const Pe=M.target||E.current;if(Pe==null)throw new Error(Ft(1));de({value:Pe.value})}f.onChange&&f.onChange(M,...ue),j&&j(M,...ue)};i.useEffect(()=>{de(E.current)},[]);const ze=M=>{E.current&&M.currentTarget===M.target&&E.current.focus(),L&&L(M)};let ge=P,z=f;q&&ge==="input"&&(oe?z={type:void 0,minRows:oe,maxRows:oe,...z}:z={type:void 0,maxRows:I,minRows:U,...z},ge=qt);const Ee=M=>{de(M.animationName==="mui-auto-fill-cancel"?E.current:{value:"x"})};i.useEffect(()=>{w&&w.setAdornedStart(!!H)},[w,H]);const ce={...n,color:$.color||"primary",disabled:$.disabled,endAdornment:y,error:$.error,focused:$.focused,formControl:w,fullWidth:c,hiddenLabel:$.hiddenLabel,multiline:q,size:$.size,startAdornment:H,type:Ie},xe=Kt(ce),We=fe.root||g.Root||Xe,Re=O.root||m.root||{},Fe=fe.input||g.Input||Ge;return z={...z,...O.input??m.input},u.jsxs(i.Fragment,{children:[!S&&typeof yt=="function"&&(xt||(xt=u.jsx(yt,{}))),u.jsxs(We,{...Re,ref:o,onClick:ze,..._,...!ft(We)&&{ownerState:{...ce,...Re.ownerState}},className:se(xe.root,Re.className,d,G&&"MuiInputBase-readOnly"),children:[H,u.jsx(Ye.Provider,{value:null,children:u.jsx(Fe,{"aria-invalid":$.error,"aria-describedby":s,autoComplete:l,autoFocus:r,defaultValue:h,disabled:$.disabled,id:x,onAnimationStart:Ee,name:D,placeholder:A,readOnly:G,required:$.required,rows:oe,value:K,onKeyDown:V,onKeyUp:N,type:Ie,...z,...!ft(Fe)&&{as:ge,ownerState:{...ce,...z.ownerState}},ref:ae,className:se(xe.input,z.className,G&&"MuiInputBase-readOnly"),onBlur:$e,onChange:Te,onFocus:we})}),y,te?te({...$,startAdornment:H}):null]})]})});function Xt(e){return ee("MuiInput",e)}const Be={...Oe,...Y("MuiInput",["root","underline","input"])};function Gt(e){return ee("MuiOutlinedInput",e)}const re={...Oe,...Y("MuiOutlinedInput",["root","notchedOutline","input"])};function _t(e){return ee("MuiFilledInput",e)}const ye={...Oe,...Y("MuiFilledInput",["root","underline","input","adornedStart","adornedEnd","sizeSmall","multiline","hiddenLabel"])},Jt=Nt(u.jsx("path",{d:"M7 10l5 5 5-5z"})),Qt=e=>{const{classes:t,disableUnderline:o,startAdornment:n,endAdornment:s,size:l,hiddenLabel:r,multiline:d}=e,b={root:["root",!o&&"underline",n&&"adornedStart",s&&"adornedEnd",l==="small"&&`size${X(l)}`,r&&"hiddenLabel",d&&"multiline"],input:["input"]},g=Z(b,_t,t);return{...t,...g}},Zt=F(Xe,{shouldForwardProp:e=>pe(e)||e==="classes",name:"MuiFilledInput",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[...Ve(e,t),!o.disableUnderline&&t.underline]}})(J(({theme:e})=>{const t=e.palette.mode==="light",o=t?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",n=t?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",s=t?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",l=t?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return{position:"relative",backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:s,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n}},[`&.${ye.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n},[`&.${ye.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:l},variants:[{props:({ownerState:r})=>!r.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${ye.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${ye.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline):o}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${ye.disabled}, .${ye.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${ye.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(e.palette).filter(De()).map(([r])=>{var d;return{props:{disableUnderline:!1,color:r},style:{"&::after":{borderBottom:`2px solid ${(d=(e.vars||e).palette[r])==null?void 0:d.main}`}}}}),{props:({ownerState:r})=>r.startAdornment,style:{paddingLeft:12}},{props:({ownerState:r})=>r.endAdornment,style:{paddingRight:12}},{props:({ownerState:r})=>r.multiline,style:{padding:"25px 12px 8px"}},{props:({ownerState:r,size:d})=>r.multiline&&d==="small",style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:r})=>r.multiline&&r.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:r})=>r.multiline&&r.hiddenLabel&&r.size==="small",style:{paddingTop:8,paddingBottom:9}}]}})),Yt=F(Ge,{name:"MuiFilledInput",slot:"Input",overridesResolver:Ke})(J(({theme:e})=>({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode==="light"?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:e.palette.mode==="light"?null:"#fff",caretColor:e.palette.mode==="light"?null:"#fff",borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit"}},...e.vars&&{"&:-webkit-autofill":{borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit"},[e.getColorSchemeSelector("dark")]:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"}}},variants:[{props:{size:"small"},style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:t})=>t.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:t})=>t.startAdornment,style:{paddingLeft:0}},{props:({ownerState:t})=>t.endAdornment,style:{paddingRight:0}},{props:({ownerState:t})=>t.hiddenLabel&&t.size==="small",style:{paddingTop:8,paddingBottom:9}},{props:({ownerState:t})=>t.multiline,style:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}}]}))),tt=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiFilledInput"}),{disableUnderline:s=!1,components:l={},componentsProps:r,fullWidth:d=!1,hiddenLabel:b,inputComponent:g="input",multiline:m=!1,slotProps:h,slots:v={},type:S="text",...y}=n,C={...n,disableUnderline:s,fullWidth:d,inputComponent:g,multiline:m,type:S},c=Qt(n),x={root:{ownerState:C},input:{ownerState:C}},P=h??r?Ze(x,h??r):x,f=v.root??l.Root??Zt,p=v.input??l.Input??Yt;return u.jsx(et,{slots:{root:f,input:p},slotProps:P,fullWidth:d,inputComponent:g,multiline:m,ref:o,type:S,...y,classes:c})});tt.muiName="Input";function eo(e){return ee("MuiFormControl",e)}Y("MuiFormControl",["root","marginNone","marginNormal","marginDense","fullWidth","disabled"]);const to=e=>{const{classes:t,margin:o,fullWidth:n}=e,s={root:["root",o!=="none"&&`margin${X(o)}`,n&&"fullWidth"]};return Z(s,eo,t)},oo=F("div",{name:"MuiFormControl",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,t[`margin${X(o.margin)}`],o.fullWidth&&t.fullWidth]}})({display:"inline-flex",flexDirection:"column",position:"relative",minWidth:0,padding:0,margin:0,border:0,verticalAlign:"top",variants:[{props:{margin:"normal"},style:{marginTop:16,marginBottom:8}},{props:{margin:"dense"},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:"100%"}}]}),no=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiFormControl"}),{children:s,className:l,color:r="primary",component:d="div",disabled:b=!1,error:g=!1,focused:m,fullWidth:h=!1,hiddenLabel:v=!1,margin:S="none",required:y=!1,size:C="medium",variant:c="outlined",...x}=n,P={...n,color:r,component:d,disabled:b,error:g,fullWidth:h,hiddenLabel:v,margin:S,required:y,size:C,variant:c},f=to(P),[p,R]=i.useState(()=>{let N=!1;return s&&i.Children.forEach(s,A=>{if(!Je(A,["Input","Select"]))return;const G=Je(A,["Select"])?A.props.input:A;G&&Dt(G.props)&&(N=!0)}),N}),[I,U]=i.useState(()=>{let N=!1;return s&&i.Children.forEach(s,A=>{Je(A,["Input","Select"])&&(Ue(A.props,!0)||Ue(A.props.inputProps,!0))&&(N=!0)}),N}),[q,D]=i.useState(!1);b&&q&&D(!1);const B=m!==void 0&&!b?m:q;let j;i.useRef(!1);const L=i.useCallback(()=>{U(!0)},[]),T=i.useCallback(()=>{U(!1)},[]),V=i.useMemo(()=>({adornedStart:p,setAdornedStart:R,color:r,disabled:b,error:g,filled:I,focused:B,fullWidth:h,hiddenLabel:v,size:C,onBlur:()=>{D(!1)},onFocus:()=>{D(!0)},onEmpty:T,onFilled:L,registerEffect:j,required:y,variant:c}),[p,r,b,g,I,B,h,v,j,T,L,y,C,c]);return u.jsx(Ye.Provider,{value:V,children:u.jsx(oo,{as:d,ownerState:P,className:se(f.root,l),ref:o,...x,children:s})})});function ro(e){return ee("MuiFormHelperText",e)}const St=Y("MuiFormHelperText",["root","error","disabled","sizeSmall","sizeMedium","contained","focused","filled","required"]);var Ct;const so=e=>{const{classes:t,contained:o,size:n,disabled:s,error:l,filled:r,focused:d,required:b}=e,g={root:["root",s&&"disabled",l&&"error",n&&`size${X(n)}`,o&&"contained",d&&"focused",r&&"filled",b&&"required"]};return Z(g,ro,t)},io=F("p",{name:"MuiFormHelperText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,o.size&&t[`size${X(o.size)}`],o.contained&&t.contained,o.filled&&t.filled]}})(J(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.caption,textAlign:"left",marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${St.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${St.error}`]:{color:(e.vars||e).palette.error.main},variants:[{props:{size:"small"},style:{marginTop:4}},{props:({ownerState:t})=>t.contained,style:{marginLeft:14,marginRight:14}}]}))),lo=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiFormHelperText"}),{children:s,className:l,component:r="p",disabled:d,error:b,filled:g,focused:m,margin:h,required:v,variant:S,...y}=n,C=Le(),c=Me({props:n,muiFormControl:C,states:["variant","size","disabled","error","filled","focused","required"]}),x={...n,component:r,contained:c.variant==="filled"||c.variant==="outlined",variant:c.variant,size:c.size,disabled:c.disabled,error:c.error,filled:c.filled,focused:c.focused,required:c.required};delete x.ownerState;const P=so(x);return u.jsx(io,{as:r,className:se(P.root,l),ref:o,...y,ownerState:x,children:s===" "?Ct||(Ct=u.jsx("span",{className:"notranslate","aria-hidden":!0,children:""})):s})});function ao(e){return ee("MuiFormLabel",e)}const Ae=Y("MuiFormLabel",["root","colorSecondary","focused","disabled","error","filled","required","asterisk"]),uo=e=>{const{classes:t,color:o,focused:n,disabled:s,error:l,filled:r,required:d}=e,b={root:["root",`color${X(o)}`,s&&"disabled",l&&"error",r&&"filled",n&&"focused",d&&"required"],asterisk:["asterisk",l&&"error"]};return Z(b,ao,t)},co=F("label",{name:"MuiFormLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,o.color==="secondary"&&t.colorSecondary,o.filled&&t.filled]}})(J(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.body1,lineHeight:"1.4375em",padding:0,position:"relative",variants:[...Object.entries(e.palette).filter(De()).map(([t])=>({props:{color:t},style:{[`&.${Ae.focused}`]:{color:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${Ae.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${Ae.error}`]:{color:(e.vars||e).palette.error.main}}}]}))),po=F("span",{name:"MuiFormLabel",slot:"Asterisk"})(J(({theme:e})=>({[`&.${Ae.error}`]:{color:(e.vars||e).palette.error.main}}))),fo=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiFormLabel"}),{children:s,className:l,color:r,component:d="label",disabled:b,error:g,filled:m,focused:h,required:v,...S}=n,y=Le(),C=Me({props:n,muiFormControl:y,states:["color","required","focused","disabled","error","filled"]}),c={...n,color:C.color||"primary",component:d,disabled:C.disabled,error:C.error,filled:C.filled,focused:C.focused,required:C.required},x=uo(c);return u.jsxs(co,{as:d,ownerState:c,className:se(x.root,l),ref:o,...S,children:[s,C.required&&u.jsxs(po,{ownerState:c,"aria-hidden":!0,className:x.asterisk,children:[" ","*"]})]})}),mo=e=>{const{classes:t,disableUnderline:o}=e,s=Z({root:["root",!o&&"underline"],input:["input"]},Xt,t);return{...t,...s}},bo=F(Xe,{shouldForwardProp:e=>pe(e)||e==="classes",name:"MuiInput",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[...Ve(e,t),!o.disableUnderline&&t.underline]}})(J(({theme:e})=>{let o=e.palette.mode==="light"?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(o=e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline)),{position:"relative",variants:[{props:({ownerState:n})=>n.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:n})=>!n.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Be.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Be.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${o}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Be.disabled}, .${Be.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${o}`}},[`&.${Be.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(e.palette).filter(De()).map(([n])=>({props:{color:n,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[n].main}`}}}))]}})),ho=F(Ge,{name:"MuiInput",slot:"Input",overridesResolver:Ke})({}),ot=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiInput"}),{disableUnderline:s=!1,components:l={},componentsProps:r,fullWidth:d=!1,inputComponent:b="input",multiline:g=!1,slotProps:m,slots:h={},type:v="text",...S}=n,y=mo(n),c={root:{ownerState:{disableUnderline:s}}},x=m??r?Ze(m??r,c):c,P=h.root??l.Root??bo,f=h.input??l.Input??ho;return u.jsx(et,{slots:{root:P,input:f},slotProps:x,fullWidth:d,inputComponent:b,multiline:g,ref:o,type:v,...S,classes:y})});ot.muiName="Input";function vo(e){return ee("MuiInputLabel",e)}Y("MuiInputLabel",["root","focused","disabled","error","required","asterisk","formControl","sizeSmall","shrink","animated","standard","filled","outlined"]);const go=e=>{const{classes:t,formControl:o,size:n,shrink:s,disableAnimation:l,variant:r,required:d}=e,b={root:["root",o&&"formControl",!l&&"animated",s&&"shrink",n&&n!=="medium"&&`size${X(n)}`,r],asterisk:[d&&"asterisk"]},g=Z(b,vo,t);return{...t,...g}},xo=F(fo,{shouldForwardProp:e=>pe(e)||e==="classes",name:"MuiInputLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[{[`& .${Ae.asterisk}`]:t.asterisk},t.root,o.formControl&&t.formControl,o.size==="small"&&t.sizeSmall,o.shrink&&t.shrink,!o.disableAnimation&&t.animated,o.focused&&t.focused,t[o.variant]]}})(J(({theme:e})=>({display:"block",transformOrigin:"top left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",variants:[{props:({ownerState:t})=>t.formControl,style:{position:"absolute",left:0,top:0,transform:"translate(0, 20px) scale(1)"}},{props:{size:"small"},style:{transform:"translate(0, 17px) scale(1)"}},{props:({ownerState:t})=>t.shrink,style:{transform:"translate(0, -1.5px) scale(0.75)",transformOrigin:"top left",maxWidth:"133%"}},{props:({ownerState:t})=>!t.disableAnimation,style:{transition:e.transitions.create(["color","transform","max-width"],{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut})}},{props:{variant:"filled"},style:{zIndex:1,pointerEvents:"none",transform:"translate(12px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"filled",size:"small"},style:{transform:"translate(12px, 13px) scale(1)"}},{props:({variant:t,ownerState:o})=>t==="filled"&&o.shrink,style:{userSelect:"none",pointerEvents:"auto",transform:"translate(12px, 7px) scale(0.75)",maxWidth:"calc(133% - 24px)"}},{props:({variant:t,ownerState:o,size:n})=>t==="filled"&&o.shrink&&n==="small",style:{transform:"translate(12px, 4px) scale(0.75)"}},{props:{variant:"outlined"},style:{zIndex:1,pointerEvents:"none",transform:"translate(14px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"outlined",size:"small"},style:{transform:"translate(14px, 9px) scale(1)"}},{props:({variant:t,ownerState:o})=>t==="outlined"&&o.shrink,style:{userSelect:"none",pointerEvents:"auto",maxWidth:"calc(133% - 32px)",transform:"translate(14px, -9px) scale(0.75)"}}]}))),yo=i.forwardRef(function(t,o){const n=ie({name:"MuiInputLabel",props:t}),{disableAnimation:s=!1,margin:l,shrink:r,variant:d,className:b,...g}=n,m=Le();let h=r;typeof h>"u"&&m&&(h=m.filled||m.focused||m.adornedStart);const v=Me({props:n,muiFormControl:m,states:["size","variant","required","focused"]}),S={...n,disableAnimation:s,formControl:m,shrink:h,size:v.size,variant:v.variant,required:v.required,focused:v.focused},y=go(S);return u.jsx(xo,{"data-shrink":h,ref:o,className:se(y.root,b),...g,ownerState:S,classes:y})});function So(e){return ee("MuiNativeSelect",e)}const nt=Y("MuiNativeSelect",["root","select","multiple","filled","outlined","standard","disabled","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]),Co=e=>{const{classes:t,variant:o,disabled:n,multiple:s,open:l,error:r}=e,d={select:["select",o,n&&"disabled",s&&"multiple",r&&"error"],icon:["icon",`icon${X(o)}`,l&&"iconOpen",n&&"disabled"]};return Z(d,So,t)},kt=F("select",{name:"MuiNativeSelect"})(({theme:e})=>({MozAppearance:"none",WebkitAppearance:"none",userSelect:"none",borderRadius:0,cursor:"pointer","&:focus":{borderRadius:0},[`&.${nt.disabled}`]:{cursor:"default"},"&[multiple]":{height:"auto"},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(e.vars||e).palette.background.paper},variants:[{props:({ownerState:t})=>t.variant!=="filled"&&t.variant!=="outlined",style:{"&&&":{paddingRight:24,minWidth:16}}},{props:{variant:"filled"},style:{"&&&":{paddingRight:32}}},{props:{variant:"outlined"},style:{borderRadius:(e.vars||e).shape.borderRadius,"&:focus":{borderRadius:(e.vars||e).shape.borderRadius},"&&&":{paddingRight:32}}}]})),Io=F(kt,{name:"MuiNativeSelect",slot:"Select",shouldForwardProp:pe,overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.select,t[o.variant],o.error&&t.error,{[`&.${nt.multiple}`]:t.multiple}]}})({}),Ot=F("svg",{name:"MuiNativeSelect"})(({theme:e})=>({position:"absolute",right:0,top:"calc(50% - .5em)",pointerEvents:"none",color:(e.vars||e).palette.action.active,[`&.${nt.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:({ownerState:t})=>t.open,style:{transform:"rotate(180deg)"}},{props:{variant:"filled"},style:{right:7}},{props:{variant:"outlined"},style:{right:7}}]})),wo=F(Ot,{name:"MuiNativeSelect",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.icon,o.variant&&t[`icon${X(o.variant)}`],o.open&&t.iconOpen]}})({}),Ro=i.forwardRef(function(t,o){const{className:n,disabled:s,error:l,IconComponent:r,inputRef:d,variant:b="standard",...g}=t,m={...t,disabled:s,variant:b,error:l},h=Co(m);return u.jsxs(i.Fragment,{children:[u.jsx(Io,{ownerState:m,className:se(h.select,n),disabled:s,ref:d||o,...g}),t.multiple?null:u.jsx(wo,{as:r,ownerState:m,className:h.icon})]})});var It;const Fo=F("fieldset",{name:"MuiNotchedOutlined",shouldForwardProp:pe})({textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%"}),Po=F("legend",{name:"MuiNotchedOutlined",shouldForwardProp:pe})(J(({theme:e})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:({ownerState:t})=>!t.withLabel,style:{padding:0,lineHeight:"11px",transition:e.transitions.create("width",{duration:150,easing:e.transitions.easing.easeOut})}},{props:({ownerState:t})=>t.withLabel,style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:e.transitions.create("max-width",{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:({ownerState:t})=>t.withLabel&&t.notched,style:{maxWidth:"100%",transition:e.transitions.create("max-width",{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]})));function ko(e){const{children:t,classes:o,className:n,label:s,notched:l,...r}=e,d=s!=null&&s!=="",b={...e,notched:l,withLabel:d};return u.jsx(Fo,{"aria-hidden":!0,className:n,ownerState:b,...r,children:u.jsx(Po,{ownerState:b,children:d?u.jsx("span",{children:s}):It||(It=u.jsx("span",{className:"notranslate","aria-hidden":!0,children:""}))})})}const Oo=e=>{const{classes:t}=e,n=Z({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},Gt,t);return{...t,...n}},Mo=F(Xe,{shouldForwardProp:e=>pe(e)||e==="classes",name:"MuiOutlinedInput",slot:"Root",overridesResolver:Ve})(J(({theme:e})=>{const t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{position:"relative",borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${re.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${re.notchedOutline}`]:{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}},[`&.${re.focused} .${re.notchedOutline}`]:{borderWidth:2},variants:[...Object.entries(e.palette).filter(De()).map(([o])=>({props:{color:o},style:{[`&.${re.focused} .${re.notchedOutline}`]:{borderColor:(e.vars||e).palette[o].main}}})),{props:{},style:{[`&.${re.error} .${re.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},[`&.${re.disabled} .${re.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled}}},{props:({ownerState:o})=>o.startAdornment,style:{paddingLeft:14}},{props:({ownerState:o})=>o.endAdornment,style:{paddingRight:14}},{props:({ownerState:o})=>o.multiline,style:{padding:"16.5px 14px"}},{props:({ownerState:o,size:n})=>o.multiline&&n==="small",style:{padding:"8.5px 14px"}}]}})),Lo=F(ko,{name:"MuiOutlinedInput",slot:"NotchedOutline"})(J(({theme:e})=>{const t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}})),$o=F(Ge,{name:"MuiOutlinedInput",slot:"Input",overridesResolver:Ke})(J(({theme:e})=>({padding:"16.5px 14px",...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode==="light"?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:e.palette.mode==="light"?null:"#fff",caretColor:e.palette.mode==="light"?null:"#fff",borderRadius:"inherit"}},...e.vars&&{"&:-webkit-autofill":{borderRadius:"inherit"},[e.getColorSchemeSelector("dark")]:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"}}},variants:[{props:{size:"small"},style:{padding:"8.5px 14px"}},{props:({ownerState:t})=>t.multiline,style:{padding:0}},{props:({ownerState:t})=>t.startAdornment,style:{paddingLeft:0}},{props:({ownerState:t})=>t.endAdornment,style:{paddingRight:0}}]}))),rt=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiOutlinedInput"}),{components:s={},fullWidth:l=!1,inputComponent:r="input",label:d,multiline:b=!1,notched:g,slots:m={},slotProps:h={},type:v="text",...S}=n,y=Oo(n),C=Le(),c=Me({props:n,muiFormControl:C,states:["color","disabled","error","focused","hiddenLabel","size","required"]}),x={...n,color:c.color||"primary",disabled:c.disabled,error:c.error,focused:c.focused,formControl:C,fullWidth:l,hiddenLabel:c.hiddenLabel,multiline:b,size:c.size,type:v},P=m.root??s.Root??Mo,f=m.input??s.Input??$o,[p,R]=Se("notchedOutline",{elementType:Lo,className:y.notchedOutline,shouldForwardComponentProp:!0,ownerState:x,externalForwardedProps:{slots:m,slotProps:h},additionalProps:{label:d!=null&&d!==""&&c.required?u.jsxs(i.Fragment,{children:[d," ","*"]}):d}});return u.jsx(et,{slots:{root:P,input:f},slotProps:h,renderSuffix:I=>u.jsx(p,{...R,notched:typeof g<"u"?g:!!(I.startAdornment||I.filled||I.focused)}),fullWidth:l,inputComponent:r,multiline:b,ref:o,type:v,...S,classes:{...y,notchedOutline:null}})});rt.muiName="Input";function Mt(e){return ee("MuiSelect",e)}const Ne=Y("MuiSelect",["root","select","multiple","filled","outlined","standard","disabled","focused","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]);var wt;const To=F(kt,{name:"MuiSelect",slot:"Select",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[{[`&.${Ne.select}`]:t.select},{[`&.${Ne.select}`]:t[o.variant]},{[`&.${Ne.error}`]:t.error},{[`&.${Ne.multiple}`]:t.multiple}]}})({[`&.${Ne.select}`]:{height:"auto",minHeight:"1.4375em",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}}),zo=F(Ot,{name:"MuiSelect",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.icon,o.variant&&t[`icon${X(o.variant)}`],o.open&&t.iconOpen]}})({}),Bo=F("input",{shouldForwardProp:e=>Wt(e)&&e!=="classes",name:"MuiSelect",slot:"NativeInput"})({bottom:0,left:0,position:"absolute",opacity:0,pointerEvents:"none",width:"100%",boxSizing:"border-box"});function Rt(e,t){return typeof t=="object"&&t!==null?e===t:String(e)===String(t)}function No(e){return e==null||typeof e=="string"&&!e.trim()}const Ao=e=>{const{classes:t,variant:o,disabled:n,multiple:s,open:l,error:r}=e,d={select:["select",o,n&&"disabled",s&&"multiple",r&&"error"],icon:["icon",`icon${X(o)}`,l&&"iconOpen",n&&"disabled"],nativeInput:["nativeInput"]};return Z(d,Mt,t)},Eo=i.forwardRef(function(t,o){var lt,at,dt,ut;const{"aria-describedby":n,"aria-label":s,autoFocus:l,autoWidth:r,children:d,className:b,defaultOpen:g,defaultValue:m,disabled:h,displayEmpty:v,error:S=!1,IconComponent:y,inputRef:C,labelId:c,MenuProps:x={},multiple:P,name:f,onBlur:p,onChange:R,onClose:I,onFocus:U,onKeyDown:q,onMouseDown:D,onOpen:B,open:j,readOnly:L,renderValue:T,required:V,SelectDisplayProps:N={},tabIndex:A,type:G,value:te,variant:oe="standard",...Ce}=t,[O,fe]=mt({controlled:te,default:m,name:"Select"}),[H,Ie]=mt({controlled:j,default:g,name:"Select"}),Q=i.useRef(null),_=i.useRef(null),[K,me]=i.useState(null),{current:E}=i.useRef(j!=null),[le,ae]=i.useState(),be=qe(o,C),he=i.useCallback(a=>{_.current=a,a&&me(a)},[]),w=K==null?void 0:K.parentNode;i.useImperativeHandle(be,()=>({focus:()=>{_.current.focus()},node:Q.current,value:O}),[O]);const $=K!==null&&H;i.useEffect(()=>{if(!$||!w||r||typeof ResizeObserver>"u")return;const a=new ResizeObserver(()=>{ae(w.clientWidth)});return a.observe(w),()=>{a.disconnect()}},[$,w,r]),i.useEffect(()=>{g&&H&&K&&!E&&(ae(r?null:w.clientWidth),_.current.focus())},[K,r]),i.useEffect(()=>{l&&_.current.focus()},[l]),i.useEffect(()=>{if(!c)return;const a=At(_.current).getElementById(c);if(a){const k=()=>{getSelection().isCollapsed&&_.current.focus()};return a.addEventListener("click",k),()=>{a.removeEventListener("click",k)}}},[c]);const ne=(a,k)=>{a?B&&B(k):I&&I(k),E||(ae(r?null:w.clientWidth),Ie(a))},ve=a=>{D==null||D(a),a.button===0&&(a.preventDefault(),_.current.focus(),ne(!0,a))},de=a=>{ne(!1,a)},we=i.Children.toArray(d),$e=a=>{const k=we.find(W=>W.props.value===a.target.value);k!==void 0&&(fe(k.props.value),R&&R(a,k))},Te=a=>k=>{let W;if(k.currentTarget.hasAttribute("tabindex")){if(P){W=Array.isArray(O)?O.slice():[];const ke=O.indexOf(a.props.value);ke===-1?W.push(a.props.value):W.splice(ke,1)}else W=a.props.value;if(a.props.onClick&&a.props.onClick(k),O!==W&&(fe(W),R)){const ke=k.nativeEvent||k,ct=new ke.constructor(ke.type,ke);Object.defineProperty(ct,"target",{writable:!0,value:{value:W,name:f}}),R(ct,a)}P||ne(!1,k)}},ze=a=>{L||([" ","ArrowUp","ArrowDown","Enter"].includes(a.key)&&(a.preventDefault(),ne(!0,a)),q==null||q(a))},ge=a=>{!$&&p&&(Object.defineProperty(a,"target",{writable:!0,value:{value:O,name:f}}),p(a))};delete Ce["aria-invalid"];let z,Ee;const ce=[];let xe=!1;(Ue({value:O})||v)&&(T?z=T(O):xe=!0);const We=we.map(a=>{if(!i.isValidElement(a))return null;let k;if(P){if(!Array.isArray(O))throw new Error(Ft(2));k=O.some(W=>Rt(W,a.props.value)),k&&xe&&ce.push(a.props.children)}else k=Rt(O,a.props.value),k&&xe&&(Ee=a.props.children);return i.cloneElement(a,{"aria-selected":k?"true":"false",onClick:Te(a),onKeyUp:W=>{W.key===" "&&W.preventDefault(),a.props.onKeyUp&&a.props.onKeyUp(W)},role:"option",selected:k,value:void 0,"data-value":a.props.value})});xe&&(P?ce.length===0?z=null:z=ce.reduce((a,k,W)=>(a.push(k),W<ce.length-1&&a.push(", "),a),[]):z=Ee);let Re=le;!r&&E&&K&&(Re=w.clientWidth);let Fe;typeof A<"u"?Fe=A:Fe=h?null:0;const M=N.id||(f?`mui-component-select-${f}`:void 0),ue={...t,variant:oe,value:O,open:$,error:S},Pe=Ao(ue),_e={...x.PaperProps,...typeof((lt=x.slotProps)==null?void 0:lt.paper)=="function"?x.slotProps.paper(ue):(at=x.slotProps)==null?void 0:at.paper},$t={...x.MenuListProps,...typeof((dt=x.slotProps)==null?void 0:dt.list)=="function"?x.slotProps.list(ue):(ut=x.slotProps)==null?void 0:ut.list},it=Pt();return u.jsxs(i.Fragment,{children:[u.jsx(To,{as:"div",ref:he,tabIndex:Fe,role:"combobox","aria-controls":$?it:void 0,"aria-disabled":h?"true":void 0,"aria-expanded":$?"true":"false","aria-haspopup":"listbox","aria-label":s,"aria-labelledby":[c,M].filter(Boolean).join(" ")||void 0,"aria-describedby":n,"aria-required":V?"true":void 0,"aria-invalid":S?"true":void 0,onKeyDown:ze,onMouseDown:h||L?null:ve,onBlur:ge,onFocus:U,...N,ownerState:ue,className:se(N.className,Pe.select,b),id:M,children:No(z)?wt||(wt=u.jsx("span",{className:"notranslate","aria-hidden":!0,children:""})):z}),u.jsx(Bo,{"aria-invalid":S,value:Array.isArray(O)?O.join(","):O,name:f,ref:Q,"aria-hidden":!0,onChange:$e,tabIndex:-1,disabled:h,className:Pe.nativeInput,autoFocus:l,required:V,...Ce,ownerState:ue}),u.jsx(zo,{as:y,className:Pe.icon,ownerState:ue}),u.jsx(Et,{id:`menu-${f||""}`,anchorEl:w,open:$,onClose:de,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},...x,slotProps:{...x.slotProps,list:{"aria-labelledby":c,role:"listbox","aria-multiselectable":P?"true":void 0,disableListWrap:!0,id:it,...$t},paper:{..._e,style:{minWidth:Re,..._e!=null?_e.style:null}}},children:We})]})}),Wo=e=>{const{classes:t}=e,n=Z({root:["root"]},Mt,t);return{...t,...n}},st={name:"MuiSelect",slot:"Root",shouldForwardProp:e=>pe(e)&&e!=="variant"},jo=F(ot,st)(""),Ho=F(rt,st)(""),Uo=F(tt,st)(""),Lt=i.forwardRef(function(t,o){const n=ie({name:"MuiSelect",props:t}),{autoWidth:s=!1,children:l,classes:r={},className:d,defaultOpen:b=!1,displayEmpty:g=!1,IconComponent:m=Jt,id:h,input:v,inputProps:S,label:y,labelId:C,MenuProps:c,multiple:x=!1,native:P=!1,onClose:f,onOpen:p,open:R,renderValue:I,SelectDisplayProps:U,variant:q="outlined",...D}=n,B=P?Ro:Eo,j=Le(),L=Me({props:n,muiFormControl:j,states:["variant","error"]}),T=L.variant||q,V={...n,variant:T,classes:r},N=Wo(V),{root:A,...G}=N,te=v||{standard:u.jsx(jo,{ownerState:V}),outlined:u.jsx(Ho,{label:y,ownerState:V}),filled:u.jsx(Uo,{ownerState:V})}[T],oe=qe(o,jt(te));return u.jsx(i.Fragment,{children:i.cloneElement(te,{inputComponent:B,inputProps:{children:l,error:L.error,IconComponent:m,variant:T,type:void 0,multiple:x,...P?{id:h}:{autoWidth:s,defaultOpen:b,displayEmpty:g,labelId:C,MenuProps:c,onClose:f,onOpen:p,open:R,renderValue:I,SelectDisplayProps:{id:h,...U}},...S,classes:S?Ze(G,S.classes):G,...v?v.props.inputProps:{}},...(x&&P||g)&&T==="outlined"?{notched:!0}:{},ref:oe,className:se(te.props.className,d,N.root),...!v&&{variant:T},...D})})});Lt.muiName="Select";function qo(e){return ee("MuiTextField",e)}Y("MuiTextField",["root"]);const Do={standard:ot,filled:tt,outlined:rt},Vo=e=>{const{classes:t}=e;return Z({root:["root"]},qo,t)},Ko=F(no,{name:"MuiTextField",slot:"Root"})({}),Jo=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiTextField"}),{autoComplete:s,autoFocus:l=!1,children:r,className:d,color:b="primary",defaultValue:g,disabled:m=!1,error:h=!1,FormHelperTextProps:v,fullWidth:S=!1,helperText:y,id:C,InputLabelProps:c,inputProps:x,InputProps:P,inputRef:f,label:p,maxRows:R,minRows:I,multiline:U=!1,name:q,onBlur:D,onChange:B,onFocus:j,placeholder:L,required:T=!1,rows:V,select:N=!1,SelectProps:A,slots:G={},slotProps:te={},type:oe,value:Ce,variant:O="outlined",...fe}=n,H={...n,autoFocus:l,color:b,disabled:m,error:h,fullWidth:S,multiline:U,required:T,select:N,variant:O},Ie=Vo(H),Q=Pt(C),_=y&&Q?`${Q}-helper-text`:void 0,K=p&&Q?`${Q}-label`:void 0,me=Do[O],E={slots:G,slotProps:{input:P,inputLabel:c,htmlInput:x,formHelperText:v,select:A,...te}},le={},ae=E.slotProps.inputLabel;O==="outlined"&&(ae&&typeof ae.shrink<"u"&&(le.notched=ae.shrink),le.label=p),N&&((!A||!A.native)&&(le.id=void 0),le["aria-describedby"]=void 0);const[be,he]=Se("root",{elementType:Ko,shouldForwardComponentProp:!0,externalForwardedProps:{...E,...fe},ownerState:H,className:se(Ie.root,d),ref:o,additionalProps:{disabled:m,error:h,fullWidth:S,required:T,color:b,variant:O}}),[w,$]=Se("input",{elementType:me,externalForwardedProps:E,additionalProps:le,ownerState:H}),[ne,ve]=Se("inputLabel",{elementType:yo,externalForwardedProps:E,ownerState:H}),[de,we]=Se("htmlInput",{elementType:"input",externalForwardedProps:E,ownerState:H}),[$e,Te]=Se("formHelperText",{elementType:lo,externalForwardedProps:E,ownerState:H}),[ze,ge]=Se("select",{elementType:Lt,externalForwardedProps:E,ownerState:H}),z=u.jsx(w,{"aria-describedby":_,autoComplete:s,autoFocus:l,defaultValue:g,fullWidth:S,multiline:U,name:q,rows:V,maxRows:R,minRows:I,type:oe,value:Ce,id:Q,inputRef:f,onBlur:D,onChange:B,onFocus:j,placeholder:L,inputProps:we,slots:{input:G.htmlInput?de:void 0},...$});return u.jsxs(be,{...he,children:[p!=null&&p!==""&&u.jsx(ne,{htmlFor:Q,id:K,...ve,children:p}),N?u.jsx(ze,{"aria-describedby":_,id:Q,labelId:K,value:Ce,input:z,...ge,children:r}):z,y&&u.jsx($e,{id:_,...Te,children:y})]})});function Qo({title:e,subtitle:t,actions:o,children:n}){const s=!!(e||t||o);return u.jsx(je,{sx:{width:"100%"},children:u.jsxs(bt,{spacing:4,children:[s&&u.jsxs(bt,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:2,children:[u.jsxs(je,{children:[e&&u.jsx(ht,{variant:"h4",component:"h1",gutterBottom:!0,children:e}),t&&u.jsx(ht,{variant:"body1",color:"text.secondary",children:t})]}),o&&u.jsx(je,{sx:{alignSelf:{xs:"stretch",sm:"center"}},children:o})]}),u.jsx(je,{children:n})]})})}export{Jt as A,Ye as F,et as I,Qo as P,Lt as S,Jo as T,Be as a,ye as f,Oe as i,re as o,Le as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./vendor-xyflow.js";import{R as r}from"./docs.js";const a=r(o.jsx("path",{d:"M8 5v14l11-7z"}));export{a as P};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-xyflow.js";import{h,m as U}from"./vendor-recharts.js";import{I as Z,J as ee,U as te,L as B,N as se,O as W,P as re,W as K,ak as oe,S as A,T as I,j as ne,R as ie,b as L,a9 as V,a1 as H,al as ae,am as q,af as ce,ag as le,a3 as O,u as de,e as ue,C as pe,F as he,an as J}from"./docs.js";import{B as fe}from"./BaseFilterBar.js";import{T as X,P as ge}from"./PageContainer.js";import{D as me}from"./Download.js";import{p as xe,D as ye,a as Ce}from"./kvRowAdapters.js";import{u as je}from"./useQueryState.js";import{D as ve}from"./filterTypes.js";import"./Autocomplete.js";function we(t){return Z("MuiCardActionArea",t)}const $=ee("MuiCardActionArea",["root","focusVisible","focusHighlight"]),be=t=>{const{classes:a}=t;return se({root:["root"],focusHighlight:["focusHighlight"]},we,a)},Se=W(re,{name:"MuiCardActionArea",slot:"Root"})(K(({theme:t})=>({display:"block",textAlign:"inherit",borderRadius:"inherit",width:"100%",[`&:hover .${$.focusHighlight}`]:{opacity:(t.vars||t).palette.action.hoverOpacity,"@media (hover: none)":{opacity:0}},[`&.${$.focusVisible} .${$.focusHighlight}`]:{opacity:(t.vars||t).palette.action.focusOpacity}}))),Ie=W("span",{name:"MuiCardActionArea",slot:"FocusHighlight"})(K(({theme:t})=>({overflow:"hidden",pointerEvents:"none",position:"absolute",top:0,right:0,bottom:0,left:0,borderRadius:"inherit",opacity:0,backgroundColor:"currentcolor",transition:t.transitions.create("opacity",{duration:t.transitions.duration.short})}))),Ae=h.forwardRef(function(a,s){const r=te({props:a,name:"MuiCardActionArea"}),{children:u,className:o,focusVisibleClassName:f,slots:g={},slotProps:x={},...C}=r,v=r,w=be(v),d={slots:g,slotProps:x},[m,y]=B("root",{elementType:Se,externalForwardedProps:{...d,...C},shouldForwardComponentProp:!0,ownerState:v,ref:s,className:U(w.root,o),additionalProps:{focusVisibleClassName:U(f,w.focusVisible)}}),[l,c]=B("focusHighlight",{elementType:Ie,externalForwardedProps:d,ownerState:v,className:w.focusHighlight});return e.jsxs(m,{...y,children:[u,e.jsx(l,{...c})]})});function Ee({preset:t,onClick:a}){var s;return e.jsx(oe,{variant:"outlined",sx:{height:"100%"},children:e.jsx(Ae,{onClick:a,sx:{textAlign:"left",p:2,height:"100%",alignItems:"stretch"},children:e.jsxs(A,{spacing:1.5,children:[e.jsx(I,{variant:"h6",children:t.name}),t.description&&e.jsx(I,{variant:"body2",color:"text.secondary",children:t.description}),t.groupId&&e.jsxs(I,{variant:"body2",color:"text.secondary",children:["Group: ",t.groupId]}),(s=t.tags)!=null&&s.length?e.jsx(A,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:t.tags.map(r=>e.jsx(ne,{label:r,size:"small"},r))}):null,e.jsxs(I,{variant:"body2",color:"text.secondary",children:[t.operations.length," ",t.operations.length===1?"operation":"operations"]}),t.operations.slice(0,3).map((r,u)=>e.jsxs(I,{variant:"body2",color:"text.secondary",sx:{fontStyle:r.description?"italic":"normal"},children:["• ",r.name||`${r.method.toUpperCase()} ${r.path}`,r.description?` — ${r.description}`:""]},`${r.name}-${u}`))]})})})}const _=ie(e.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11z"}));function Ne(t,a,s="text/csv"){const r=new Blob([a],{type:s}),u=URL.createObjectURL(r),o=document.createElement("a");o.href=u,o.download=t,o.click(),URL.revokeObjectURL(u)}const z=["presetId","presetName","presetDescription","presetGroupId","presetTags","opStepNumber","opName","opDescription","opMethod","opPath","opEndpointId","opQueryJson","opExtraHeadersJson","opBodyJson"],Pe=["presetName","opStepNumber","opMethod","opPath"];function G(t){return t?t.split(";").map(a=>a.trim()).filter(Boolean):[]}function Q(t){const a=t.replace(/"/g,'""');return/[",\n\r]/.test(t)?`"${a}"`:t}function Re(t){const a=[];let s=[],r="",u=!1,o=0;const f=()=>{s.push(r),r=""},g=()=>{s.push(r),r="",a.push(s),s=[]};for(;o<t.length;){const x=t[o],C=t[o+1];if(x==='"'){u&&C==='"'?(r+='"',o+=1):u=!u,o+=1;continue}if(!u&&x===","){f(),o+=1;continue}if(!u&&x==="\r"){g(),C===`
|
|
2
|
-
`?o+=2:o+=1;continue}if(!u&&x===`
|
|
3
|
-
`){g(),o+=1;continue}r+=x,o+=1}return(r||s.length>0)&&g(),{rows:a}}function Fe(t){const a=z.map(Q).join(","),s=[];return t.forEach(r=>{const u=Array.isArray(r.tags)?r.tags.filter(Boolean).join(";"):"";r.operations.forEach(o=>{const f={presetId:r.id,presetName:r.name,presetDescription:r.description??"",presetGroupId:r.groupId??"",presetTags:u,opStepNumber:String(o.stepNumber??""),opName:o.name??"",opDescription:o.description??"",opMethod:o.method??"",opPath:o.path??"",opEndpointId:o.endpointId??"",opQueryJson:o.query?JSON.stringify(o.query):"",opExtraHeadersJson:o.extraHeaders?JSON.stringify(o.extraHeaders):"",opBodyJson:o.body!==void 0?JSON.stringify(o.body):""};s.push(z.map(g=>Q(f[g])).join(","))})}),s.length?[a,...s].join(`
|
|
4
|
-
`):a}function Te(t){const{rows:a}=Re(t),s=[];if(a.length===0)return s.push("CSV is empty"),{presets:[],errors:s};const r=a.findIndex(d=>d.some(m=>m.trim().length>0));if(r===-1)return s.push("CSV has no header row"),{presets:[],errors:s};const u=a[r].map(d=>d.trim()),o=new Map;u.forEach((d,m)=>{d&&o.set(d,m)});const f=Pe.filter(d=>!o.has(d));if(f.length>0)return s.push(`Missing required columns: ${f.join(", ")}`),{presets:[],errors:s};const g=a.slice(r+1),x=new Map,C=[];if(g.forEach((d,m)=>{if(d.every(b=>b.trim()===""))return;const y=r+m+2,l=b=>{var p;const i=o.get(b);return i===void 0?"":((p=d[i])==null?void 0:p.trim())??""},c=l("presetName");if(!c){s.push(`Row ${y}: presetName is required`);return}let n=x.get(c);if(!n)n={id:l("presetId")||void 0,description:l("presetDescription")||void 0,groupId:l("presetGroupId")||void 0,tags:new Set(G(l("presetTags"))),operations:[],order:C.length},x.set(c,n),C.push(c);else{const b=l("presetId");b&&!n.id&&(n.id=b);const i=l("presetDescription");i&&!n.description&&(n.description=i);const p=l("presetGroupId");p&&!n.groupId&&(n.groupId=p),G(l("presetTags")).forEach(S=>n==null?void 0:n.tags.add(S))}const j=l("opStepNumber");if(!j){s.push(`Row ${y}: opStepNumber is required`);return}const E=Number(j);if(!Number.isFinite(E)){s.push(`Row ${y}: opStepNumber must be numeric`);return}const k=l("opMethod");if(!k){s.push(`Row ${y}: opMethod is required`);return}const M=l("opPath");if(!M){s.push(`Row ${y}: opPath is required`);return}const N=b=>{const i=l(b);if(!i)return{value:void 0};const p=xe(i);return p.error?(s.push(`Row ${y}: ${b} ${p.error}`),{error:!0}):{value:p.value}},P=N("opQueryJson");if("error"in P)return;const F=N("opExtraHeadersJson");if("error"in F)return;const T=N("opBodyJson");if("error"in T)return;const R={name:l("opName"),description:l("opDescription")||void 0,stepNumber:E,method:k.toLowerCase(),path:M,endpointId:l("opEndpointId")||void 0};P.value!==void 0&&(R.query=P.value),F.value!==void 0&&(R.extraHeaders=F.value),T.value!==void 0&&(R.body=T.value),n.operations.push(R)}),s.length>0)return{presets:[],errors:s};if(C.length===0)return s.push("CSV contains no operation rows"),{presets:[],errors:s};const v=Date.now();return{presets:C.map(d=>{const m=x.get(d),y=m.operations.map((l,c)=>({op:l,index:c})).sort((l,c)=>{const n=l.op.stepNumber??0,j=c.op.stepNumber??0;return n!==j?n-j:l.index-c.index}).map(({op:l})=>l);return{id:m.id??"",name:d,description:m.description??"",groupId:m.groupId??"",tags:Array.from(m.tags),createdAt:v,updatedAt:v,operations:y}}),errors:s}}function ke({presets:t,onImportComplete:a}){const s=h.useMemo(()=>Fe(t),[t]),[r,u]=h.useState(null),[o,f]=h.useState(!1),[g,x]=h.useState(""),[C,v]=h.useState([]),[w,d]=h.useState([]),[m,y]=h.useState(!1),l=h.useRef(null),c=L("POST /__rrroutes/presets"),n=L("PUT /__rrroutes/presets"),j=h.useMemo(()=>new Set(t.map(i=>i.id).filter(i=>!!i)),[t]),E=h.useCallback(async()=>{try{await navigator.clipboard.writeText(s)}catch(i){console.error("Copy failed",i)}finally{u(null)}},[s]),k=h.useCallback(()=>{Ne("presets.csv",s),u(null)},[s]),M=h.useCallback(()=>{x(""),d([]),v([]),f(!0)},[]),N=h.useCallback(()=>{f(!1)},[]),P=h.useCallback(()=>{if(!g.trim()){v([]),d([]);return}const i=Te(g);v(i.errors),d(i.errors.length===0?i.presets:[])},[g]),F=h.useCallback(i=>{x(i.target.value)},[]),T=h.useCallback(()=>{var i;(i=l.current)==null||i.click()},[]),R=h.useCallback(i=>{var D;const p=(D=i.target.files)==null?void 0:D[0];if(!p)return;const S=new FileReader;S.onload=()=>{const Y=typeof S.result=="string"?S.result:"";x(Y)},S.readAsText(p),i.target.value=""},[]),b=h.useCallback(async()=>{if(!w.length)return;const i=w.filter(p=>p.id&&j.has(p.id)).length;if(!(i>0&&!window.confirm(`This import will replace ${i} existing preset${i>1?"s":""}. Continue?`))){y(!0);try{for(const p of w){const S={...p,updatedAt:Date.now()};p.id&&j.has(p.id)?await n.fetch(S):await c.fetch({...S,id:""})}a==null||a(),f(!1)}catch(p){const S=p instanceof Error?p.message:"Failed to import presets.";v(D=>[...D,S])}finally{y(!1)}}},[j,a,w,c,n]);return h.useEffect(()=>{P()},[g,P]),e.jsxs(e.Fragment,{children:[e.jsxs(A,{direction:"row",spacing:1,children:[e.jsx(V,{title:"Export presets CSV",children:e.jsx(H,{onClick:i=>u(i.currentTarget),"aria-label":"Export presets CSV",children:e.jsx(me,{})})}),e.jsxs(ae,{anchorEl:r,open:!!r,onClose:()=>u(null),children:[e.jsx(q,{onClick:E,children:"Copy CSV"}),e.jsx(q,{onClick:k,children:"Download CSV"})]}),e.jsx(V,{title:"Import presets CSV",children:e.jsx(H,{onClick:M,"aria-label":"Import presets CSV",children:e.jsx(_,{})})})]}),e.jsxs(ce,{open:o,onClose:N,fullWidth:!0,maxWidth:"md",children:[e.jsx(ye,{children:"Import presets CSV"}),e.jsx(le,{children:e.jsxs(A,{spacing:2,children:[e.jsxs(A,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(I,{variant:"subtitle1",children:"Paste CSV"}),e.jsx(V,{title:"From file",children:e.jsx(H,{onClick:T,"aria-label":"Upload CSV from file",size:"small",children:e.jsx(_,{fontSize:"small"})})}),e.jsx("input",{ref:l,type:"file",accept:".csv",hidden:!0,onChange:R})]}),e.jsx(X,{multiline:!0,minRows:8,placeholder:"Paste CSV here",value:g,onChange:F,autoFocus:!0,fullWidth:!0}),e.jsxs(A,{spacing:1,children:[e.jsx(I,{variant:"subtitle2",children:"Import errors"}),C.length?C.map((i,p)=>e.jsx(I,{variant:"body2",color:"error",children:i},p)):e.jsx(I,{variant:"body2",color:"text.secondary",children:"No errors detected."})]})]})}),e.jsxs(Ce,{children:[e.jsx(O,{onClick:N,children:"Cancel"}),e.jsx(O,{variant:"contained",onClick:b,disabled:m||!w.length,children:m?"Importing...":"Apply import"})]})]})]})}const Me={...ve,searchQuery:"",nameInclude:"",nameExclude:""};function _e(){const t=de(),[a,s]=je("presetsFilters",Me),r=L("GET /__rrroutes/presets",{cursorParam:"cursor",getNextPageParam(c){return c.meta.nextCursor}}),{data:u,isLoading:o,error:f,refetch:g,isFetching:x,fetchNextPage:C,hasNextPage:v,isFetchingNextPage:w}=r.useEndpoint({query:a}),d=ue(u,{reverse:!1}),m=h.useMemo(()=>{const c=new Set;return d.forEach(n=>{var j;return(j=n.tags)==null?void 0:j.forEach(E=>c.add(E))}),Array.from(c).sort()},[d]),y=h.useMemo(()=>{const c=new Set;return d.forEach(n=>{n.groupId&&c.add(n.groupId)}),Array.from(c).sort()},[d]),l=h.useMemo(()=>{if(f==null)return null;const c=f instanceof Error?f.message:"Failed to load presets.",n=f instanceof Error?f.stack:f?String(f):void 0;return{message:c,details:n,onRetry:()=>g()}},[f]);return e.jsx(ge,{title:"Presets",subtitle:"Manage saved request presets for quick access.",actions:e.jsxs(A,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(O,{variant:"contained",onClick:()=>t("/presets/new"),children:"New preset"}),e.jsx(ke,{presets:d,onImportComplete:()=>g()})]}),children:e.jsxs(A,{spacing:3,children:[e.jsx(fe,{value:a,onChange:c=>s(n=>({...n,...c})),tagOptions:m,groupOptions:y,onRefresh:()=>g(),refreshing:x,children:c=>e.jsxs(e.Fragment,{children:[e.jsx(A,{direction:{xs:"column",sm:"row"},spacing:2,children:e.jsx(X,{label:"Name",value:c==="include"?a.nameInclude:a.nameExclude,onChange:n=>s(j=>({...j,[c==="include"?"nameInclude":"nameExclude"]:n.target.value})),size:"small",fullWidth:!0})}),e.jsx(I,{variant:"body2",color:"text.secondary",sx:{mt:2},children:"Use the base search field to match names and tags locally while the additional filters narrow the server query."})]})}),e.jsx(pe,{title:"All presets",children:e.jsx(he,{stateHandler:{loading:{variant:"full"},error:l,emptyFallback:{title:"No presets found",description:"Try adjusting your search query or create a new preset."},isLoading:o},items:d,fetchNextPage:C,hasNextPage:v,isFetchingNextPage:w,pageSize:a.pageSize,children:c=>e.jsx(J,{container:!0,spacing:2,children:c.map(n=>e.jsx(J,{component:"div",children:e.jsx(Ee,{preset:n,onClick:()=>t(`/presets/${n.id}`)})},n.id))})})})]})})}export{_e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./vendor-xyflow.js";import{u as A,a as D,b as _,c as G,l as N,d as U,e as O,f as b,g as B,S as d,C as M,F as H,T as f,h as K,A as Q,i as q,H as V,j as $,k as J,E as W,m as X}from"./docs.js";import{h as p}from"./vendor-recharts.js";import{E as Y}from"./EndpointDetailPanel.js";import{B as Z}from"./BaseFilterBar.js";import{P as ee}from"./PageContainer.js";import{u as te}from"./useQueryState.js";import{D as se}from"./filterTypes.js";import"./SchemaTreeView.js";import"./ExpandLess.js";import"./getValidReactChildren.js";import"./Autocomplete.js";const re={...se,searchQuery:"",methodsInclude:[],methodsExclude:[],stabilityInclude:[],stabilityExclude:[]};function be(){const o=A(),[c,m]=te("routesFilters",re),[i,r]=D(),s=i.get("endpointId"),n=p.useRef({}),h=p.useMemo(()=>({cursorParam:"cursor",getNextPageParam(e){return e.meta.nextCursor}}),[]),y=_("GET /__rrroutes/endpoints",h),{client:E}=G();E.build(N.byKey["GET /__rrroutes/endpoints"],{});const{data:j,isLoading:C,error:I,refetch:x,isFetching:w,fetchNextPage:v,hasNextPage:P,isFetchingNextPage:k}=y.useEndpoint({query:c}),F=U(I,{messageFallback:"Failed to load endpoints.",refetch:x}),u=O(j,{reverse:!1}),R=b(u,e=>e.tags),S=b(u,e=>e.groupId),T=p.useCallback((e,a)=>{a?n.current[e]=a:delete n.current[e]},[]);p.useEffect(()=>{if(!s)return;const e=n.current[s];e&&e.scrollIntoView({behavior:"smooth",block:"start"})},[s]),p.useEffect(()=>{s&&!u.some(e=>e.id===s)&&r(e=>{const a=new URLSearchParams(e);return a.delete("endpointId"),a},{replace:!0})},[s,u,r]);const z=p.useCallback(e=>{r(a=>{const l=new URLSearchParams(a);return s===e?l.delete("endpointId"):l.set("endpointId",e),l})},[s,r]),L=p.useCallback(e=>{const{displayId:a}=B(e.method,e.path);a&&o(`/routes/${encodeURIComponent(a)}`)},[o]);return t.jsx(ee,{title:"Endpoints",subtitle:"Browse and filter every endpoint registered with this service.",children:t.jsxs(d,{spacing:3,children:[t.jsx(Z,{value:c,onChange:e=>m(a=>({...a,...e})),tagOptions:R,groupOptions:S,onRefresh:()=>x(),refreshing:w,searchOnly:!0}),t.jsx(M,{title:"Endpoints",children:t.jsx(H,{stateHandler:{loading:{variant:"full"},error:F,emptyFallback:{title:"No endpoints found"},isLoading:C},items:u,fetchNextPage:v,hasNextPage:P,isFetchingNextPage:k,pageSize:c.pageSize,children:e=>{const a=ne(e);return t.jsx(d,{spacing:4,children:a.map(l=>t.jsxs(d,{spacing:1.5,children:[t.jsxs(f,{variant:"subtitle2",color:"text.secondary",sx:{textTransform:"capitalize"},children:[l.title," (",l.endpoints.length,")"]}),t.jsx(d,{spacing:1,children:l.endpoints.map(g=>t.jsx(oe,{endpoint:g,expanded:s===g.id,onToggle:z,registerRef:T,onDoubleClick:L},g.id))})]},l.id))})}})})]})})}function oe({endpoint:o,expanded:c,onToggle:m,registerRef:i,onDoubleClick:r}){const s=K();return t.jsxs(Q,{expanded:c,onChange:()=>m(o.id),ref:n=>i(o.id,n),disableGutters:!0,sx:{border:"1px solid",borderColor:c?"primary.main":"divider",borderRadius:2,bgcolor:"background.default","&::before":{display:"none"},overflow:"hidden"},children:[t.jsx(q,{expandIcon:t.jsx(W,{}),sx:{cursor:"pointer",transition:"background-color 200ms ease, transform 200ms ease","&:hover, &:focus-visible":{backgroundColor:J(s.palette.primary.main,.08)}},onDoubleClick:n=>{n.stopPropagation(),r(o)},children:t.jsxs(d,{sx:{width:"100%",height:"100%"},direction:"row",justifyContent:"space-between",children:[t.jsxs(d,{justifyContent:"space-between",children:[t.jsxs(d,{direction:"row",spacing:1,children:[t.jsx(V,{method:o.method}),t.jsx(f,{sx:{fontFamily:"monospace",flexGrow:1},color:"text.primary",children:o.path})]}),o.summary&&t.jsx(f,{variant:"body2",color:"text.secondary",children:o.summary})]}),t.jsxs(d,{direction:"row",spacing:1,alignItems:"center",children:[t.jsx(f,{variant:"caption",color:"text.secondary",sx:{textTransform:"capitalize"},children:o.stability}),o.implemented===!1&&t.jsx($,{label:"Not implemented",size:"small",color:"warning",variant:"outlined"})]})]})}),t.jsx(X,{children:t.jsx(Y,{endpointId:o.id,showHeader:!1})})]})}function ne(o){const c=new Map;return o.forEach(i=>{var n,h;const r=((n=i.groupId)==null?void 0:n.trim())||"ungrouped",s=((h=i.groupId)==null?void 0:h.trim())||"Ungrouped";c.has(r)||c.set(r,{id:r,title:s,endpoints:[]}),c.get(r).endpoints.push(i)}),Array.from(c.values()).map(i=>({...i,endpoints:i.endpoints.sort((r,s)=>{const n=r.path.localeCompare(s.path);return n!==0?n:r.method.localeCompare(s.method)})})).sort((i,r)=>{const s=i.id==="ungrouped"?"zzzz":i.title.toLowerCase(),n=r.id==="ungrouped"?"zzzz":r.title.toLowerCase();return s.localeCompare(n)})}export{be as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-xyflow.js";import{u as ue,R as K}from"./useQueryState.js";import{h as l,m as pe}from"./vendor-recharts.js";import{I as he,J as me,aw as F,k as xe,U as ye,h as ge,M as ae,N as be,O as fe,T as r,W as je,ax as X,X as ve,x as Ce,ay as we,S as i,j as P,G as Se,az as U,aA as R,aB as re,b as _,e as Y,d as Z,aC as ke,aD as V,C as B,a3 as N,v as Ae,_ as ee}from"./docs.js";import{P as De,T as $}from"./PageContainer.js";import{B as Le,a as Me,b as te}from"./BentoGrid.js";import{D as Fe}from"./filterTypes.js";import{A as Re}from"./Autocomplete.js";import"./ExpandLess.js";function Te(t){return he("MuiLink",t)}const Ie=me("MuiLink",["root","underlineNone","underlineHover","underlineAlways","button","focusVisible"]),Ne=({theme:t,ownerState:n})=>{const s=n.color;if("colorSpace"in t&&t.colorSpace){const o=F(t,`palette.${s}.main`)||F(t,`palette.${s}`)||n.color;return t.alpha(o,.4)}const h=F(t,`palette.${s}.main`,!1)||F(t,`palette.${s}`,!1)||n.color,g=F(t,`palette.${s}.mainChannel`)||F(t,`palette.${s}Channel`);return"vars"in t&&g?`rgba(${g} / 0.4)`:xe(h,.4)},ne={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Pe=t=>{const{classes:n,component:s,focusVisible:h,underline:g}=t,o={root:["root",`underline${ae(g)}`,s==="button"&&"button",h&&"focusVisible"]};return be(o,Te,n)},Ee=fe(r,{name:"MuiLink",slot:"Root",overridesResolver:(t,n)=>{const{ownerState:s}=t;return[n.root,n[`underline${ae(s.underline)}`],s.component==="button"&&n.button]}})(je(({theme:t})=>({variants:[{props:{underline:"none"},style:{textDecoration:"none"}},{props:{underline:"hover"},style:{textDecoration:"none","&:hover":{textDecoration:"underline"}}},{props:{underline:"always"},style:{textDecoration:"underline","&:hover":{textDecorationColor:"inherit"}}},{props:({underline:n,ownerState:s})=>n==="always"&&s.color!=="inherit",style:{textDecorationColor:"var(--Link-underlineColor)"}},{props:({underline:n,ownerState:s})=>n==="always"&&s.color==="inherit",style:t.colorSpace?{textDecorationColor:t.alpha("currentColor",.4)}:null},...Object.entries(t.palette).filter(ve()).map(([n])=>({props:{underline:"always",color:n},style:{"--Link-underlineColor":t.alpha((t.vars||t).palette[n].main,.4)}})),{props:{underline:"always",color:"textPrimary"},style:{"--Link-underlineColor":t.alpha((t.vars||t).palette.text.primary,.4)}},{props:{underline:"always",color:"textSecondary"},style:{"--Link-underlineColor":t.alpha((t.vars||t).palette.text.secondary,.4)}},{props:{underline:"always",color:"textDisabled"},style:{"--Link-underlineColor":(t.vars||t).palette.text.disabled}},{props:{component:"button"},style:{position:"relative",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none","&::-moz-focus-inner":{borderStyle:"none"},[`&.${Ie.focusVisible}`]:{outline:"auto"}}}]}))),ze=l.forwardRef(function(n,s){const h=ye({props:n,name:"MuiLink"}),g=ge(),{className:o,color:p="primary",component:d="a",onBlur:x,onFocus:b,TypographyClasses:a,underline:y="always",variant:A="inherit",sx:k,...S}=h,[C,m]=l.useState(!1),j=w=>{X(w.target)||m(!1),x&&x(w)},T=w=>{X(w.target)&&m(!0),b&&b(w)},L={...h,color:p,component:d,focusVisible:C,underline:y,variant:A},I=Pe(L);return e.jsx(Ee,{color:p,className:pe(I.root,o),classes:a,component:d,onBlur:j,onFocus:T,ref:s,ownerState:L,variant:A,...S,sx:[...ne[p]===void 0?[{color:p}]:[],...Array.isArray(k)?k:[k]],style:{...S.style,...y==="always"&&p!=="inherit"&&!ne[p]&&{"--Link-underlineColor":Ne({theme:g,ownerState:L})}}})});function Be({open:t,scheduling:n,onClose:s,getStatusColor:h}){if(!n)return null;const{name:g,status:o,description:p,tags:d,groupId:x}=n,b=o??"Unknown",a=h==null?void 0:h(b),{openRequestDetail:y}=Ce(),A=l.useCallback(()=>{x&&y({requestId:x})},[x,y]),k=n.startedAt&&n.completedAt?n.completedAt-n.startedAt:n.startedAt?Math.max(0,Date.now()-n.startedAt):void 0,S=[{label:"Scheduled at",value:n.scheduledAt},{label:"Started at",value:n.startedAt},{label:"Completed at",value:n.completedAt},{label:"Created at",value:n.createdAt},{label:"Updated at",value:n.updatedAt}];return e.jsx(we,{open:t,onClose:s,title:g??n.id,scroll:"paper",children:e.jsxs(i,{spacing:2,children:[e.jsxs(i,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(r,{variant:"subtitle2",color:"text.secondary",children:"Status"}),e.jsx(P,{label:b,size:"small",variant:"outlined",sx:a?{borderColor:a,color:a}:void 0})]}),p?e.jsxs(Se,{children:[e.jsx(r,{variant:"subtitle2",color:"text.secondary",children:"Description"}),e.jsx(r,{variant:"body2",children:p})]}):null,e.jsx(U,{}),e.jsxs(i,{spacing:1,children:[e.jsx(r,{variant:"subtitle2",color:"text.secondary",children:"Timestamps"}),S.map(C=>e.jsxs(i,{direction:"row",justifyContent:"space-between",children:[e.jsx(r,{variant:"body2",color:"text.secondary",children:C.label}),e.jsx(r,{variant:"body2",children:R(C.value)})]},C.label)),k!=null?e.jsxs(i,{direction:"row",justifyContent:"space-between",children:[e.jsx(r,{variant:"body2",color:"text.secondary",children:"Estimated duration"}),e.jsx(r,{variant:"body2",children:re(k)})]}):null]}),e.jsx(U,{}),e.jsxs(i,{spacing:1,children:[e.jsx(r,{variant:"subtitle2",color:"text.secondary",children:"Identity"}),e.jsxs(i,{direction:"row",spacing:1,children:[e.jsx(r,{variant:"body2",color:"text.secondary",children:"ID:"}),e.jsx(r,{variant:"body2",sx:{fontFamily:"monospace"},children:n.id})]}),x?e.jsxs(i,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(r,{variant:"body2",color:"text.secondary",children:"Group:"}),e.jsx(ze,{component:"button",variant:"body2",onClick:A,sx:{fontFamily:"monospace",textTransform:"none",p:0,fontWeight:500},children:x})]}):null]}),d!=null&&d.length?e.jsxs(e.Fragment,{children:[e.jsx(U,{}),e.jsxs(i,{spacing:1,children:[e.jsx(r,{variant:"subtitle2",color:"text.secondary",children:"Tags"}),e.jsx(i,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:d.map(C=>e.jsx(P,{label:C,size:"small"},C))})]})]}):null]})})}const Oe={...Fe,orderBy:"scheduledAt",orderDirection:"desc",searchQuery:"",statusesInclude:[],statusesExclude:[]},Ue={name:{key:"name",label:"Name",width:2,render:(t,n)=>t??n.id},groupId:{key:"groupId",label:"Group",width:1.5,render:t=>t??"Ungrouped"},scheduledAt:{key:"scheduledAt",label:"Scheduled",width:1.5,render:t=>R(t)},startedAt:{key:"startedAt",label:"Started",width:1.5,render:t=>R(t)},completedAt:{key:"completedAt",label:"Completed",width:1.5,render:t=>R(t)},tags:{key:"tags",label:"Tags",render:t=>t!=null&&t.length?e.jsx(i,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:t.map(n=>e.jsx(P,{label:n,size:"small"},n))}):"—"}};function Ve(t){const n=new Map;let s=0,h=0,g=0,o,p;const d=[];for(const a of t){const y=a.status??"Unknown";n.set(y,(n.get(y)??0)+1),a.startedAt?a.startedAt&&!a.completedAt&&(h+=1):s+=1,a.completedAt&&(g+=1,(!p||(p.completedAt??0)<a.completedAt)&&(p=a)),(!o||(a.scheduledAt??0)>(o.scheduledAt??0))&&(o=a),a.startedAt&&a.completedAt&&d.push(a.completedAt-a.startedAt)}const x=d.length===0?void 0:d.reduce((a,y)=>a+y,0)/d.length,b=Array.from(n.entries()).sort((a,y)=>y[1]-a[1]);return{total:t.length,pending:s,running:h,completed:g,latestScheduled:o,latestCompleted:p,avgDurationMs:x,statusBreakdown:b}}function Ye(){var H,q;const[t,n]=ue("schedulingFilters",Oe),[s,h]=l.useState(null),g=l.useMemo(()=>({cursorParam:"cursor",getNextPageParam(u){var f;return(f=u.meta)==null?void 0:f.nextCursor}}),[]),o=_("GET /__rrroutes/schedulings",g),{data:p,error:d,refetch:x,isFetching:b,isLoading:a,fetchNextPage:y,hasNextPage:A,isFetchingNextPage:k}=o.useEndpoint({query:t}),S=Y(p,{reverse:!0}),C=Z(d,{messageFallback:"Failed to load scheduled runs.",refetch:x}),m=l.useMemo(()=>Ve(S),[S]),j=l.useMemo(()=>({cursorParam:"cursor",getNextPageParam(u){var f;return(f=u.meta)==null?void 0:f.nextCursor}}),[]),T=_("GET /__rrroutes/schedulings/handlers",j),{data:L,error:I,refetch:w,isFetching:c}=T.useEndpoint({query:{pageSize:100}}),v=Y(L),D=Z(I,{messageFallback:"Failed to load handler metadata.",refetch:w}),E=ke.useRegistry(),W=l.useMemo(()=>{const u=new Map;return E.forEach(f=>{var J,Q;const M=(J=f.value)==null?void 0:J.trim();if(!M)return;const z=((Q=f.color)==null?void 0:Q.trim())||V(M);u.set(M,z)}),u},[E]),O=l.useCallback(u=>{const f=(u??"Unknown").trim();return f?W.get(f)??V(f):V("status")},[W]),le=l.useMemo(()=>({...Ue,status:{key:"status",label:"Status",width:1,render:f=>{const M=f??"Unknown",z=O(M);return e.jsx(P,{label:M,size:"small",variant:"outlined",sx:{borderColor:z,color:z}})}}}),[O]),oe=l.useCallback(u=>{h(u)},[]),ie=l.useCallback(()=>{h(null)},[]),G=l.useCallback(()=>{x(),w()},[x,w]),ce=e.jsxs(i,{spacing:3,children:[e.jsx(B,{title:"Overview",children:e.jsxs(i,{spacing:2,children:[m.statusBreakdown.length?e.jsx(i,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:m.statusBreakdown.map(([u,f])=>e.jsx(P,{label:`${u} (${f})`,size:"small",variant:"outlined"},u))}):e.jsx(r,{variant:"body2",color:"text.secondary",children:"No runs have been scheduled yet."}),e.jsxs(i,{direction:{xs:"column",sm:"row"},spacing:2,flexWrap:"wrap",children:[e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Total runs: ",m.total]}),e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Pending: ",m.pending]}),e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Running: ",m.running]}),e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Completed: ",m.completed]})]}),e.jsxs(i,{direction:{xs:"column",sm:"row"},spacing:2,flexWrap:"wrap",children:[e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Last scheduled:"," ",R((H=m.latestScheduled)==null?void 0:H.scheduledAt)]}),e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Last completed:"," ",R((q=m.latestCompleted)==null?void 0:q.completedAt)]})]}),m.avgDurationMs!=null?e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Average duration: ",re(m.avgDurationMs)]}):null]})}),e.jsx(B,{title:"Handlers",actions:e.jsx(N,{component:"div",startIcon:e.jsx(K,{fontSize:"small"}),size:"small",onClick:()=>w(),children:"Refresh handlers"}),children:e.jsxs(i,{spacing:2,children:[e.jsxs(r,{variant:"body2",color:"text.secondary",children:[v.length," handler",v.length===1?"":"s"," registered",c?" • Updating...":""]}),D?e.jsxs(i,{spacing:1,children:[e.jsx(r,{variant:"body2",color:"error",children:D.message}),D.onRetry?e.jsx(N,{size:"small",variant:"outlined",onClick:D.onRetry,children:"Retry"}):null]}):null,!v.length&&!D?e.jsx(r,{variant:"body2",color:"text.secondary",children:"No handler metadata available yet."}):null,v.length?e.jsx(i,{spacing:2,children:v.map(u=>e.jsxs(i,{spacing:.5,children:[e.jsx(r,{variant:"subtitle2",children:u.name}),e.jsx(r,{variant:"body2",component:"pre",sx:{margin:0,whiteSpace:"pre-wrap",fontFamily:"monospace",color:"text.secondary"},children:u.payload})]},`${u.name}-${u.payload}`))}):null]})}),e.jsx(B,{title:"Scheduled runs",children:e.jsx(Ae,{columns:le,query:t,setQuery:n,endpoint:{data:p,fetchNextPage:y,hasNextPage:A,isFetchingNextPage:k},rowKey:u=>u.id,onRowClick:oe,size:"medium",stateHandler:{loading:{variant:"full"},isLoading:a||b,error:C,emptyFallback:{title:"No scheduled runs available",description:"Schedule a job to see it listed here."}}})})]}),de=e.jsx(i,{spacing:3,children:e.jsx(B,{title:"Manual scheduling",children:e.jsx($e,{handlers:v,isFetchingHandlers:c,onRefreshHandlers:w,onScheduled:G})})});return e.jsxs(De,{title:"Scheduling",subtitle:"Review scheduled jobs, their progress, and the handlers that can run them.",actions:e.jsx(N,{startIcon:e.jsx(K,{fontSize:"small"}),onClick:G,size:"small",children:"Refresh all"}),children:[e.jsx(Le,{children:e.jsxs(Me,{sizes:[8,4],children:[e.jsx(te,{title:"Live",children:ce}),e.jsx(te,{title:"Manual Schedule",children:de})]})}),e.jsx(Be,{open:!!s,scheduling:s,onClose:ie,getStatusColor:O})]})}function $e({handlers:t,isFetchingHandlers:n,onRefreshHandlers:s,onScheduled:h}){const g=_("POST /__rrroutes/schedulings/handlers"),[o,p]=l.useState(null),[d,x]=l.useState(""),[b,a]=l.useState(()=>se(new Date)),[y,A]=l.useState(!1),[k,S]=l.useState(null),[C,m]=l.useState(null),j=l.useMemo(()=>t.find(c=>c.name===o)??null,[t,o]),T=l.useMemo(()=>{const c=new Date(b);return b!==""&&!Number.isNaN(c.getTime())},[b]);l.useEffect(()=>{j&&x(j.payload??"")},[j==null?void 0:j.name,j==null?void 0:j.payload]),l.useEffect(()=>{o&&!t.some(c=>c.name===o)&&p(null)},[t,o]);const L=l.useCallback(async()=>{if(!o){S("Pick a handler before scheduling."),m(null);return}const c=new Date(b);if(Number.isNaN(c.getTime())){S("Enter a valid run time."),m(null);return}const v=!d.trim()||d.trim()===""?"":(()=>{try{return JSON.parse(d)}catch{return d}})();A(!0),S(null),m(null);try{await g.fetch({name:o,payload:v,runAt:c}),m("Handler scheduled successfully."),a(se(new Date)),h()}catch(D){const E=D instanceof Error?D.message:"Failed to schedule handler.";S(E)}finally{A(!1)}},[g,h,d,b,o]),I=l.useCallback(c=>{x(c.target.value)},[]),w=l.useCallback(c=>{a(c.target.value)},[]);return e.jsxs(i,{spacing:2,children:[e.jsxs(i,{direction:{xs:"column",sm:"row"},alignItems:"center",justifyContent:"space-between",spacing:2,children:[e.jsx(r,{variant:"subtitle1",children:"Schedule a handler manually"}),e.jsx(N,{size:"small",variant:"outlined",onClick:s,disabled:n,children:"Refresh handlers"})]}),e.jsx(Re,{options:t,getOptionLabel:c=>c.name,isOptionEqualToValue:(c,v)=>c.name===v.name,value:j,onChange:(c,v)=>p((v==null?void 0:v.name)??null),renderInput:c=>e.jsx($,{...c,label:"Handler",placeholder:t.length?"Pick a handler":"No handlers registered",helperText:t.length?"Select the handler you want to execute.":"No handlers currently available."})}),e.jsx($,{label:"Payload",multiline:!0,minRows:4,fullWidth:!0,value:d,onChange:I,helperText:"Valid JSON will be parsed; plain text is preserved."}),e.jsx($,{label:"Run at",type:"datetime-local",fullWidth:!0,value:b,onChange:w,InputLabelProps:{shrink:!0},helperText:"Schedule when the handler should run."}),k?e.jsx(ee,{severity:"error",children:k}):null,C?e.jsx(ee,{severity:"success",children:C}):null,e.jsx(N,{variant:"contained",onClick:L,disabled:!j||y||!T||!t.length,children:y?"Scheduling…":"Schedule handler"})]})}function se(t){const n=t.getTimezoneOffset();return new Date(t.getTime()-n*6e4).toISOString().slice(0,16)}export{Ye as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-xyflow.js";import{E}from"./ExpandLess.js";import{I as U,J as H,U as A,ai as D,aj as J,M as s,N as X,O as q,W as K,X as T,S as b,T as f,a1 as R,E as G,G as N}from"./docs.js";import{h as j,m as Q}from"./vendor-recharts.js";import{g as Y}from"./getValidReactChildren.js";function Z(t){return U("MuiButtonGroup",t)}const o=H("MuiButtonGroup",["root","contained","outlined","text","disableElevation","disabled","firstButton","fullWidth","horizontal","vertical","colorPrimary","colorSecondary","grouped","groupedHorizontal","groupedVertical","groupedText","groupedTextHorizontal","groupedTextVertical","groupedTextPrimary","groupedTextSecondary","groupedOutlined","groupedOutlinedHorizontal","groupedOutlinedVertical","groupedOutlinedPrimary","groupedOutlinedSecondary","groupedContained","groupedContainedHorizontal","groupedContainedVertical","groupedContainedPrimary","groupedContainedSecondary","lastButton","middleButton"]),_=(t,r)=>{const{ownerState:n}=t;return[{[`& .${o.grouped}`]:r.grouped},{[`& .${o.grouped}`]:r[`grouped${s(n.orientation)}`]},{[`& .${o.grouped}`]:r[`grouped${s(n.variant)}`]},{[`& .${o.grouped}`]:r[`grouped${s(n.variant)}${s(n.orientation)}`]},{[`& .${o.grouped}`]:r[`grouped${s(n.variant)}${s(n.color)}`]},{[`& .${o.firstButton}`]:r.firstButton},{[`& .${o.lastButton}`]:r.lastButton},{[`& .${o.middleButton}`]:r.middleButton},r.root,r[n.variant],n.disableElevation===!0&&r.disableElevation,n.fullWidth&&r.fullWidth,n.orientation==="vertical"&&r.vertical]},tt=t=>{const{classes:r,color:n,disabled:i,disableElevation:a,fullWidth:l,orientation:d,variant:u}=t,p={root:["root",u,d,l&&"fullWidth",a&&"disableElevation",`color${s(n)}`],grouped:["grouped",`grouped${s(d)}`,`grouped${s(u)}`,`grouped${s(u)}${s(d)}`,`grouped${s(u)}${s(n)}`,i&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return X(p,Z,r)},ot=q("div",{name:"MuiButtonGroup",slot:"Root",overridesResolver:_})(K(({theme:t})=>({display:"inline-flex",borderRadius:(t.vars||t).shape.borderRadius,variants:[{props:{variant:"contained"},style:{boxShadow:(t.vars||t).shadows[2],[`& .${o.grouped}`]:{boxShadow:"none","&:hover":{boxShadow:"none"}}}},{props:{disableElevation:!0},style:{boxShadow:"none"}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${o.lastButton},& .${o.middleButton}`]:{borderTopRightRadius:0,borderTopLeftRadius:0},[`& .${o.firstButton},& .${o.middleButton}`]:{borderBottomRightRadius:0,borderBottomLeftRadius:0}}},{props:{orientation:"horizontal"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${o.lastButton},& .${o.middleButton}`]:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}},{props:{variant:"text",orientation:"horizontal"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderRight:t.vars?`1px solid ${t.alpha(t.vars.palette.common.onBackground,.23)}`:`1px solid ${t.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${o.disabled}`]:{borderRight:`1px solid ${(t.vars||t).palette.action.disabled}`}}}},{props:{variant:"text",orientation:"vertical"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderBottom:t.vars?`1px solid ${t.alpha(t.vars.palette.common.onBackground,.23)}`:`1px solid ${t.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${o.disabled}`]:{borderBottom:`1px solid ${(t.vars||t).palette.action.disabled}`}}}},...Object.entries(t.palette).filter(T()).flatMap(([r])=>[{props:{variant:"text",color:r},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderColor:t.alpha((t.vars||t).palette[r].main,.5)}}}]),{props:{variant:"outlined",orientation:"horizontal"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderRightColor:"transparent","&:hover":{borderRightColor:"currentColor"}},[`& .${o.lastButton},& .${o.middleButton}`]:{marginLeft:-1}}},{props:{variant:"outlined",orientation:"vertical"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderBottomColor:"transparent","&:hover":{borderBottomColor:"currentColor"}},[`& .${o.lastButton},& .${o.middleButton}`]:{marginTop:-1}}},{props:{variant:"contained",orientation:"horizontal"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderRight:`1px solid ${(t.vars||t).palette.grey[400]}`,[`&.${o.disabled}`]:{borderRight:`1px solid ${(t.vars||t).palette.action.disabled}`}}}},{props:{variant:"contained",orientation:"vertical"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderBottom:`1px solid ${(t.vars||t).palette.grey[400]}`,[`&.${o.disabled}`]:{borderBottom:`1px solid ${(t.vars||t).palette.action.disabled}`}}}},...Object.entries(t.palette).filter(T(["dark"])).map(([r])=>({props:{variant:"contained",color:r},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderColor:(t.vars||t).palette[r].dark}}}))],[`& .${o.grouped}`]:{minWidth:40}}))),rt=j.forwardRef(function(r,n){const i=A({props:r,name:"MuiButtonGroup"}),{children:a,className:l,color:d="primary",component:u="div",disabled:p=!1,disableElevation:c=!1,disableFocusRipple:g=!1,disableRipple:x=!1,fullWidth:m=!1,orientation:v="horizontal",size:h="medium",variant:C="outlined",...P}=i,S={...i,color:d,component:u,disabled:p,disableElevation:c,disableFocusRipple:g,disableRipple:x,fullWidth:m,orientation:v,size:h,variant:C},B=tt(S),V=j.useMemo(()=>({className:B.grouped,color:d,disabled:p,disableElevation:c,disableFocusRipple:g,disableRipple:x,fullWidth:m,size:h,variant:C}),[d,p,c,g,x,m,h,C,B.grouped]),w=Y(a),I=w.length,F=y=>{const $=y===0,z=y===I-1;return $&&z?"":$?B.firstButton:z?B.lastButton:B.middleButton};return e.jsx(ot,{as:u,role:"group",className:Q(B.root,l),ref:n,ownerState:S,...P,children:e.jsx(D.Provider,{value:V,children:w.map((y,$)=>e.jsx(J.Provider,{value:F($),children:y},$))})})});function dt({schema:t,title:r}){const[n,i]=j.useReducer((a,l)=>{if(!t)return a;switch(l.type){case"toggle":return{...a,[l.path]:l.value!==void 0?l.value:!a[l.path]};case"setAll":{const d={},u=(p,c)=>{M(p)&&(d[c]=l.value),L(p,c).forEach(({schema:g,path:x})=>u(g,x))};return u(t,"root"),d}default:return a}},{});return t?e.jsxs(b,{spacing:1,children:[e.jsxs(b,{direction:"row",spacing:1,alignItems:"center",children:[r&&e.jsx(f,{variant:"subtitle2",color:"text.primary",children:r}),t.kind!=="unknown"&&e.jsxs(rt,{size:"small",children:[e.jsx(R,{onClick:()=>i({type:"setAll",value:!0}),title:"Collapse all",size:"small",color:"primary",children:e.jsx(E,{})}),e.jsx(R,{onClick:()=>i({type:"setAll",value:!1}),title:"Expand all",size:"small",color:"primary",children:e.jsx(G,{})})]})]}),e.jsx(et,{schema:t,collapsed:n,dispatch:i})]}):e.jsxs(b,{spacing:.5,children:[r&&e.jsx(f,{variant:"subtitle2",color:"text.primary",children:r}),e.jsx(f,{variant:"body2",color:"text.secondary",children:"No schema provided."})]})}function et({schema:t,collapsed:r,dispatch:n}){const i=(a,l)=>{n({type:"toggle",path:a,value:l})};return e.jsx(b,{spacing:1,direction:"row",children:e.jsx(W,{schema:t,path:"root",depth:0,collapsed:r,toggle:i})})}function W({schema:t,path:r,depth:n,collapsed:i,toggle:a,propertyName:l}){const d=O(t),u=t.optional||t.nullable,p=j.useMemo(()=>L(t,r),[t,r]),c=M(t),g=i[r];return e.jsx(N,{sx:{borderLeft:n?"1px solid":"none",borderColor:"rgba(255,255,255,0.08)",pl:n?2:0,ml:n?1:0,py:.75},children:e.jsxs(b,{spacing:.25,children:[e.jsxs(b,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",children:[c&&e.jsx(R,{size:"small",onClick:()=>a(r),sx:{p:.25},children:g?e.jsx(G,{fontSize:"small"}):e.jsx(E,{fontSize:"small"})}),l&&e.jsx(f,{variant:"body2",sx:{fontFamily:"monospace",color:"text.primary"},children:l}),e.jsx(f,{variant:"body2",color:"text.secondary",children:d}),u&&e.jsxs(b,{direction:"row",spacing:.5,useFlexGap:!0,flexWrap:"wrap",children:[t.optional&&e.jsx(k,{label:"optional"}),t.nullable&&e.jsx(k,{label:"nullable"})]})]}),t.description&&e.jsx(f,{variant:"caption",color:"text.secondary",children:t.description}),!g&&p.map(({schema:x,propertyName:m,path:v})=>e.jsx(W,{schema:x,propertyName:m,path:v,depth:n+1,collapsed:i,toggle:a},v))]})})}function L(t,r){var n;switch(t.kind){case"object":return t.properties?Object.entries(t.properties).map(([i,a])=>({schema:a,propertyName:i,path:`${r}.${i}`})):[];case"array":return t.element?[{schema:t.element,propertyName:"items",path:`${r}.items`}]:[];case"union":return((n=t.union)==null?void 0:n.map((i,a)=>({schema:i,propertyName:`option ${a+1}`,path:`${r}.option${a+1}`})))??[];default:return[]}}function M(t){return["object","array","union"].includes(t.kind)}function O(t){switch(t.kind){case"object":return"object";case"array":return`array<${t.element?O(t.element):"unknown"}>`;case"enum":return"enum";case"union":return"union";case"literal":return"literal";default:return t.kind}}function k({label:t}){return e.jsx(N,{component:"span",sx:{border:"1px solid",borderColor:"divider",borderRadius:1,px:.75,py:.25,fontSize:"0.7rem",textTransform:"uppercase",letterSpacing:.5,color:"text.secondary"},children:t})}export{dt as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./vendor-xyflow.js";import{S as p,T as j,a1 as z,a3 as B,au as U,av as G,aH as M,aC as W,aZ as H,A as Z,i as _,E as Q,m as X,aD as Y}from"./docs.js";import{T as L,P as $}from"./PageContainer.js";import{A as K}from"./Add.js";import{D as ee}from"./DeleteOutline.js";import{h}from"./vendor-recharts.js";function x({registry:t,formatItem:s,parseItem:o,description:i,itemPlaceholder:c="Value",addLabel:m="Add value",addPlaceholder:g="New value",emptyMessage:D="No entries yet.",getItemKey:b}){const S=t.useRegistry(),y=h.useMemo(()=>S.map(e=>s(e)),[S,s]),[F,A]=h.useState(y),[O,J]=h.useState({}),[w,R]=h.useState(""),[N,I]=h.useState(void 0),P=h.useRef(y);h.useEffect(()=>{A(e=>{const n=y.map((a,d)=>{const f=P.current[d],u=e[d];return u==null||f!==void 0&&u===f?a:u});return e.length===n.length&&e.every((a,d)=>a===n[d])?e:n}),J(e=>{const n={};Object.keys(e).forEach(f=>{const u=Number(f);Number.isNaN(u)||u<y.length&&(n[u]=e[u])});const l=Object.keys(e),a=Object.keys(n);return l.length===a.length&&l.every(f=>e[f]===n[Number(f)])?e:n}),P.current=y},[y]);const T=(e,n)=>{J(l=>{const a={...l};return n?a[e]=n:delete a[e],a})},V=(e,n)=>{A(a=>{const d=[...a];return d[e]=n,d});const l=o(n);if("error"in l){T(e,l.error);return}T(e),t.setState(a=>{if(e>=a.length)return a;const d=[...a];return d[e]=l.value,d})},q=e=>{t.setState(n=>n.filter((l,a)=>a!==e))},k=()=>{const e=o(w);if("error"in e){I(e.error);return}I(void 0),t.setState(n=>[...n,e.value]),R("")};return r.jsxs(p,{spacing:2,children:[i?r.jsx(j,{variant:"body2",color:"text.secondary",children:i}):null,r.jsxs(p,{spacing:1.5,children:[S.length===0?r.jsx(j,{variant:"body2",color:"text.secondary",children:D}):null,S.map((e,n)=>{const l=(b==null?void 0:b(e,n))??String(n);return r.jsxs(p,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:{xs:"stretch",sm:"center"},children:[r.jsx(L,{label:c,value:F[n]??"",onChange:a=>V(n,a.target.value),size:"small",error:!!O[n],helperText:O[n]??" ",fullWidth:!0}),r.jsx(z,{onClick:()=>q(n),children:r.jsx(ee,{})})]},l)})]}),r.jsxs(p,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:{xs:"stretch",sm:"center"},children:[r.jsx(L,{label:g,value:w,onChange:e=>{R(e.target.value),N&&I(void 0)},onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),k())},size:"small",error:!!N,helperText:N??" ",fullWidth:!0}),r.jsx(B,{variant:"outlined",startIcon:r.jsx(K,{}),onClick:k,children:m})]})]})}const re=t=>String(t),te=t=>t,C=t=>JSON.stringify(t),se=t=>{const s=t.trim();return s?{value:s}:{error:"Value is required."}},ne=t=>{const s=t.trim();if(!s)return{error:"Value is required."};const o=Number(s);return!Number.isFinite(o)||!Number.isInteger(o)?{error:"Enter a whole number."}:{value:o}},E=t=>{const s=t.trim();if(!s)return{error:"Value is required."};try{return{value:JSON.parse(s)}}catch{return{error:"Invalid JSON."}}},oe=t=>{const s=E(t);if("error"in s)return s;const o=s.value;if(!o||typeof o!="object"||Array.isArray(o))return{error:"Expected a JSON object."};const{encodedId:i,path:c,method:m,displayId:g}=o;return typeof i!="string"||typeof c!="string"||typeof m!="string"||typeof g!="string"?{error:"Fields required: encodedId, path, method, displayId."}:{value:{encodedId:i.trim(),path:c.trim(),method:m.trim(),displayId:g.trim()}}},ae=t=>{const s=E(t);if("error"in s)return s;const o=s.value;if(!o||typeof o!="object"||Array.isArray(o))return{error:"Expected a JSON object."};const{color:i,value:c}=o;return typeof i!="string"||typeof c!="string"?{error:"Fields required: value, color."}:{value:{color:i.trim(),value:c.trim()}}},ie=t=>JSON.stringify(t),le=t=>{const s=E(t);if("error"in s)return s;const o=s.value;if(!o||typeof o!="object"||Array.isArray(o))return{error:"Expected a JSON object."};const{value:i,color:c}=o;if(typeof i!="string"||!i.trim())return{error:"Field required: value."};const m=i.trim(),g=typeof c=="string"&&c.trim()?c.trim():Y(m);return{value:{value:m,color:g}}};function pe(){return r.jsx($,{title:"Settings",subtitle:"Manage the saved registry values used across filters and logs.",children:r.jsxs(p,{spacing:3,children:[r.jsx(v,{title:"Status codes",description:"Status codes available in history filters.",children:r.jsx(x,{registry:U,formatItem:re,parseItem:ne,itemPlaceholder:"Status code",addPlaceholder:"New status code",addLabel:"Add status"})}),r.jsx(v,{title:"Endpoints",description:'Use JSON like {"encodedId":"GET /users","path":"/users","method":"GET","displayId":"GET /users"}',children:r.jsx(x,{registry:G,formatItem:C,parseItem:oe,itemPlaceholder:"Endpoint JSON",addPlaceholder:"New endpoint JSON",addLabel:"Add endpoint"})}),r.jsx(v,{title:"Log levels",description:'Use JSON like {"value":"info","color":"#42a5f5"}',children:r.jsx(x,{registry:M,formatItem:C,parseItem:ae,itemPlaceholder:"Level JSON",addPlaceholder:"New level JSON",addLabel:"Add level"})}),r.jsx(v,{title:"Scheduling statuses",description:'Use JSON like {"value":"running","color":"#f48fb1"} (color optional)',children:r.jsx(x,{registry:W,formatItem:ie,parseItem:le,itemPlaceholder:"Status JSON",addPlaceholder:'{"value":"running"}',addLabel:"Add status"})}),r.jsx(v,{title:"Endpoint tags",description:"Tags available in history filters.",children:r.jsx(x,{registry:H,formatItem:te,parseItem:se,itemPlaceholder:"Tag",addPlaceholder:"New tag",addLabel:"Add tag"})})]})})}function v({title:t,description:s,children:o,defaultExpanded:i=!1}){return r.jsxs(Z,{defaultExpanded:i,children:[r.jsx(_,{expandIcon:r.jsx(Q,{}),children:r.jsxs(p,{spacing:.25,children:[r.jsx(j,{variant:"subtitle1",fontWeight:600,children:t}),s?r.jsx(j,{variant:"body2",color:"text.secondary",children:s}):null]})}),r.jsx(X,{children:r.jsx(p,{spacing:2,sx:{width:"100%"},children:o})})]})}export{pe as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-xyflow.js";import{b as q,e as U,x as Q,f as $,d as V,S as d,T as E,j as A,C as W,v as K,aX as X,G as I,a3 as Y,_ as D,$ as J,aY as Z}from"./docs.js";import{T as y,P as ee}from"./PageContainer.js";import{u as te}from"./useQueryState.js";import{D as se}from"./filterTypes.js";import{B as oe}from"./BaseFilterBar.js";import{A as T}from"./Autocomplete.js";import{P as ne}from"./PlayArrow.js";import{h as u}from"./vendor-recharts.js";function re(o){const n=q("GET /__rrroutes/sockets",{cursorParam:"cursor",getNextPageParam(S){return S.meta.nextCursor},splitPageSizeParam:"pageSize",splitPageSize:o.pageSize}),{data:c,isLoading:l,error:m,refetch:p,isFetching:j,fetchNextPage:x,hasNextPage:v,isFetchingNextPage:f}=n.useEndpoint({query:o});return{events:U(c,{reverse:!1}),data:c,isLoading:l,error:m,refetch:p,isFetching:j,fetchNextPage:x,hasNextPage:v,isFetchingNextPage:f}}function ae(){const o=q("POST /__rrroutes/sockets");return{emit:c=>o.fetch(c).then(l=>l.out)}}const le={...se,eventName:"",roomsInclude:[],roomsExclude:[]};function ie(){const[o,n]=te("socketEventsFilters",le),{openSocketEventDetail:c}=Q(),l=re(o),{events:m,isLoading:p,error:j,refetch:x,isFetching:v}=l,f=$(m,t=>t.name),g=$(m,t=>{var s;return(s=t.rooms)==null?void 0:s.filter(Boolean)}),S=V(j,{messageFallback:"Failed to load socket events.",refetch:x});return e.jsx(e.Fragment,{children:e.jsxs(d,{spacing:3,sx:{mt:2},children:[e.jsx(oe,{value:o,onChange:t=>n(s=>({...s,...t})),onRefresh:()=>x(),refreshing:v,children:()=>e.jsxs(d,{spacing:2,children:[e.jsxs(d,{spacing:1,children:[e.jsx(E,{variant:"overline",color:"text.secondary",children:"Event name"}),e.jsx(T,{freeSolo:!0,options:f,value:o.eventName??"",onChange:(t,s)=>n(i=>({...i,eventName:s??""})),onInputChange:(t,s)=>n(i=>({...i,eventName:s??""})),renderInput:t=>e.jsx(y,{...t,label:"Event name",placeholder:"Exact event name",size:"small"})})]}),e.jsxs(d,{spacing:1,children:[e.jsx(E,{variant:"overline",color:"text.secondary",children:"Rooms include / exclude"}),e.jsxs(d,{direction:{xs:"column",sm:"row"},spacing:2,alignItems:{xs:"stretch",sm:"flex-start"},children:[e.jsx(T,{multiple:!0,freeSolo:!0,options:g,value:o.roomsInclude??[],onChange:(t,s)=>n(i=>({...i,roomsInclude:s.map(a=>a.trim()).filter(a=>a.length>0)})),renderTags:(t,s)=>t.map((i,a)=>e.jsx(A,{size:"small",variant:"outlined",label:i,...s({index:a})})),renderInput:t=>e.jsx(y,{...t,label:"Rooms include",placeholder:"Rooms to include",size:"small"}),sx:{flex:1}}),e.jsx(T,{multiple:!0,freeSolo:!0,options:g,value:o.roomsExclude??[],onChange:(t,s)=>n(i=>({...i,roomsExclude:s.map(a=>a.trim()).filter(a=>a.length>0)})),renderTags:(t,s)=>t.map((i,a)=>e.jsx(A,{size:"small",variant:"outlined",label:i,...s({index:a})})),renderInput:t=>e.jsx(y,{...t,label:"Rooms exclude",placeholder:"Rooms to exclude",size:"small"}),sx:{flex:1}})]})]})]})}),e.jsx(W,{title:"Socket events",children:e.jsx(K,{items:m,endpoint:l,columns:X,query:o,setQuery:n,onRowClick:t=>c(t),stateHandler:{loading:{variant:"full"},emptyFallback:{title:"No socket events",description:"Emit some events from the palyground or adjust the filters."},isLoading:p,error:S}})})]})})}function ce({left:o,right:n,leftWidth:c=35}){const l=Math.min(Math.max(c,10),70);return e.jsxs(I,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:3,width:"100%"},children:[e.jsx(I,{sx:{width:{xs:"100%",md:`${l}%`},flexShrink:0},children:o}),e.jsx(I,{sx:{width:{xs:"100%",md:`${100-l}%`},flexGrow:1},children:n})]})}function ue(){const{emit:o}=ae(),[n,c]=u.useState(""),[l,m]=u.useState(""),[p,j]=u.useState(""),[x,v]=u.useState(null),[f,g]=u.useState(null),[S,t]=u.useState(!1),[s,i]=u.useState(null),[a,P]=u.useState(null),[C,F]=u.useState(null),[R,L]=u.useState(null),[_,w]=u.useState(null),G=async h=>{h.preventDefault(),i(null),P(null),v(null),g(null);const B=n.trim();if(!B){v("Event name is required");return}const H=de(l);let O;if(p.trim())try{O=JSON.parse(p)}catch{g("Invalid JSON message");return}const N={eventName:B,message:O,toRoomId:H};t(!0);try{const r=await o(N);F(N),L(r),w(200),P(r!=null&&r.success?`Event emitted successfully${r.eventId?` (eventId: ${r.eventId})`:""}.`:"Event emitted but server reported unsuccessful status.")}catch(r){let b=null,k="Failed to emit event.",z=null;if(r instanceof Z){if(b=r.status,z=r.body,r.body&&typeof r.body=="object"&&"message"in r.body){const M=r.body.message;typeof M=="string"&&(k=M)}}else r instanceof Error&&(k=r.message);F(N),L(z??r),w(b),i(b?`${k} (status ${b})`:k)}finally{t(!1)}};return e.jsxs(d,{spacing:3,component:"form",onSubmit:G,children:[e.jsxs(E,{variant:"body1",color:"text.secondary",children:["Use this playground to emit socket events via the POST"," ",e.jsx("code",{children:"/__rrroutes/sockets"})," endpoint. Provide an event name, an optional list of target rooms, and a JSON message payload."]}),e.jsxs(d,{spacing:2,children:[e.jsx(y,{label:"Event name",value:n,onChange:h=>c(h.target.value),required:!0,fullWidth:!0,error:!!x,helperText:x||"Required. Example: chat.message"}),e.jsx(y,{label:"Target rooms",value:l,onChange:h=>m(h.target.value),fullWidth:!0,helperText:"Comma-separated room IDs. Leave empty for broadcast (toRoomId = null)."}),e.jsx(y,{label:"Message (JSON)",value:p,onChange:h=>j(h.target.value),multiline:!0,minRows:8,fullWidth:!0,placeholder:'{"text": "Hello from socket playground"}',error:!!f,helperText:f||"Optional JSON payload for the event."})]}),e.jsx(I,{sx:{display:"flex",justifyContent:"flex-end"},children:e.jsx(Y,{type:"submit",variant:"contained",startIcon:e.jsx(ne,{}),disabled:S,children:S?"Emitting...":"Emit event"})}),s&&e.jsx(D,{severity:"error",variant:"outlined",children:s}),a&&e.jsx(D,{severity:"success",variant:"outlined",children:a}),!s&&!a&&e.jsx(E,{variant:"body2",color:"text.secondary",children:"Emit an event to see the last payload and server response here."}),!!(C||R)&&e.jsx(ce,{left:e.jsx(J,{title:"Last emitted payload",value:C??{info:"No payload emitted yet."},collapsedLines:16}),right:e.jsxs(d,{spacing:1,children:[e.jsxs(E,{variant:"subtitle2",color:"text.secondary",children:["Server response",_!==null?` (status ${_})`:""]}),e.jsx(J,{title:"Response body",value:R??{info:"No response recorded yet."},collapsedLines:16})]}),leftWidth:50})]})}function de(o){const n=o.trim();if(!n)return null;const c=n.split(",").map(l=>l.trim()).filter(Boolean);return c.length?c:null}function je(){return e.jsx(ee,{title:"Sockets",subtitle:"Emit socket events and browse logged socket activity.",children:e.jsxs(d,{spacing:3,children:[e.jsx(W,{title:"Socket playground",children:e.jsx(ue,{})}),e.jsx(ie,{})]})})}export{je as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const i={orderBy:"timestamp",orderDirection:"desc",tagsInclude:[],tagsExclude:[],groupsInclude:[],groupsExclude:[],pageSize:500};function s(t){const r={};return Object.entries(t).forEach(([n,e])=>{e!=null&&(typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0||(r[n]=e))}),Object.keys(r).length===0?null:encodeURIComponent(JSON.stringify(r))}function o(t,r){try{const n=JSON.parse(decodeURIComponent(t));return{...r,...n}}catch{return r}}export{i as D,o as d,s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as r}from"./vendor-recharts.js";function a(t){return r.Children.toArray(t).filter(e=>r.isValidElement(e))}export{a as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as c,m as p}from"./vendor-recharts.js";import{I as D,J as y,U as u,N as g,O as m,ao as x,ap as C,T as R}from"./docs.js";import{j as d}from"./vendor-xyflow.js";function S(s){return D("MuiDialogActions",s)}y("MuiDialogActions",["root","spacing"]);const T=s=>{const{classes:t,disableSpacing:o}=s;return g({root:["root",!o&&"spacing"]},S,t)},v=m("div",{name:"MuiDialogActions",slot:"Root",overridesResolver:(s,t)=>{const{ownerState:o}=s;return[t.root,!o.disableSpacing&&t.spacing]}})({display:"flex",alignItems:"center",padding:8,justifyContent:"flex-end",flex:"0 0 auto",variants:[{props:({ownerState:s})=>!s.disableSpacing,style:{"& > :not(style) ~ :not(style)":{marginLeft:8}}}]}),b=c.forwardRef(function(t,o){const e=u({props:t,name:"MuiDialogActions"}),{className:n,disableSpacing:i=!1,...r}=e,a={...e,disableSpacing:i},l=T(a);return d.jsx(v,{className:p(l.root,n),ownerState:a,ref:o,...r})}),A=s=>{const{classes:t}=s;return g({root:["root"]},C,t)},h=m(R,{name:"MuiDialogTitle",slot:"Root"})({padding:"16px 24px",flex:"0 0 auto"}),j=c.forwardRef(function(t,o){const e=u({props:t,name:"MuiDialogTitle"}),{className:n,id:i,...r}=e,a=e,l=A(a),{titleId:f=i}=c.useContext(x);return d.jsx(h,{component:"h2",className:p(l.root,n),ownerState:a,ref:o,variant:"h6",id:i??f,...r})});function I(s){return s.reduce((t,o)=>(o.enabled&&o.key.trim()&&(t[o.key.trim()]=o.value),t),{})}function J(s){const t=s.trim();if(!t)return{};try{return{value:JSON.parse(t)}}catch{return{error:"Invalid JSON"}}}export{j as D,b as a,J as p,I as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b9 as d,a4 as y}from"./docs.js";function s(n){if(!n)return;const r=g(n),e=n.nullable?" | null":"",t=n.optional?" (optional)":"";return`${r}${e}${t}`.trim()}function g(n){var r,e;switch(n.kind){case"array":return`array<${s(n.element)??"unknown"}>`;case"enum":return(r=n.enumValues)!=null&&r.length?`enum(${n.enumValues.join(" | ")})`:"enum";case"literal":return`literal(${JSON.stringify(n.literal)})`;case"union":return((e=n.union)==null?void 0:e.map(t=>s(t)??"unknown").join(" | "))||"union";case"record":return`record<string, ${s(n.element)??"unknown"}>`;case"tuple":return"tuple";default:return n.kind}}function a(n){var r,e;if(!n)return{};if(n.example!==void 0)return n.example;switch(n.kind){case"object":{const t=n.properties??{},o={};return Object.entries(t).forEach(([i,u])=>{if(!u)return;const l=a(u);o[i]=l??null}),o}case"array":{if(!n.element)return[];const t=a(n.element);return t===void 0?[]:[t]}case"string":return"";case"number":case"bigint":return 0;case"boolean":return!1;case"date":return d();case"enum":return((r=n.enumValues)==null?void 0:r[0])??"";case"literal":return n.literal??null;case"union":return(e=n.union)!=null&&e.length?a(n.union[0]):null;case"tuple":return n.union?n.union.map(t=>a(t)):[];case"record":return{};default:return null}}function c(n){var r;if(!n)return"";if(n.example!==void 0)return typeof n.example=="string"?n.example:JSON.stringify(n.example);switch(n.kind){case"string":return"example";case"number":case"bigint":return"0";case"boolean":return"true";case"enum":return((r=n.enumValues)==null?void 0:r[0])??"option";default:{const e=a(n);if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return""}}}}function j(n,r){if(!r||r.kind!=="object"||!r.properties)return n;const e=r.properties,t=new Set(n.map(i=>i.key)),o=n.map(i=>{const u=e[i.key];if(!u||i.value&&i.value.trim().length>0)return i;const l=c(u);return l?{...i,value:l,enabled:i.enabled||!(u!=null&&u.optional)}:i});return Object.entries(e).forEach(([i,u])=>{!u||t.has(i)||(t.add(i),o.push(y({key:i,value:c(u),enabled:!u.optional,typeHint:s(u),description:u.description})))}),o}function V(n,r){if(!r)return n;const e=a(r);return p(n,e)}function p(n,r){if(n==null)return r;if(r==null)return n;if(Array.isArray(r)){if(!Array.isArray(n)||n.length===0)return r;const e=r[0];return n.map(t=>e===void 0?t:p(t,e))}if(f(r)){if(!f(n))return r;const e={...n};return Object.entries(r).forEach(([t,o])=>{b(e[t])?e[t]=o:(f(o)||Array.isArray(o))&&(e[t]=p(e[t],o))}),e}return b(n)?r:n}function b(n){return n==null||typeof n=="string"&&n.trim().length===0}function f(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}export{V as a,c as b,s as d,j as f,a as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as a}from"./vendor-recharts.js";import{c,ac as p,r as E}from"./docs.js";function m(e){const{client:i}=c(),[u,n]=a.useState({isLoading:!1}),d=a.useMemo(()=>p(e),[e]);return a.useEffect(()=>{let o=!1;if(!e||!d){n({data:void 0,isLoading:!1,error:void 0});return}return n(t=>({...t,isLoading:!0,error:void 0})),i.fetch({method:"GET",path:"/__rrroutes/endpoints/:endpointId",params:{endpointId:d}}).then(t=>{var r;o||n({isLoading:!1,data:(r=t.data)==null?void 0:r.out,error:void 0})}).catch(t=>{o||n({isLoading:!1,data:void 0,error:t instanceof Error?t:new Error(String(t))})}),()=>{o=!0}},[i,e,d]),u}function L(e){const{client:i}=c(),[u,n]=a.useState([]),[d,o]=a.useState(!1);return a.useEffect(()=>{let t=!1;return o(!0),n([]),i.fetch({method:"GET",path:"/__rrroutes/endpoints",query:{...e?{searchQuery:e}:{},pageSize:"50"}}).then(r=>{if(t)return;const s=r.data,f=Array.isArray(s==null?void 0:s.out)?s.out:Array.isArray(s)?s:[];n(f.map(l=>E(l)))}).catch(r=>{t||(console.error("Failed to load endpoints",r),n([]))}).finally(()=>{t||o(!1)}),()=>{t=!0}},[i,e]),{options:u,isLoading:d}}export{m as a,L as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as R}from"./vendor-xyflow.js";import{R as f,a as v}from"./docs.js";import{h as z}from"./vendor-recharts.js";import{d as l,s as d}from"./filterTypes.js";const P=f(R.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}));function C(s,e){const[m,o]=v(),c=m.get(s),p=c===null?e:l(c,e),u=z.useCallback(r=>{o(n=>{const t=new URLSearchParams(n),i=n.get(s),h=i===null?e:l(i,e),S=typeof r=="function"?r(h):r,a=d(S);return a==null?t.delete(s):t.set(s,a),t},{replace:!0})},[e,s,o]);return[p,u]}export{P as R,C as u};
|