import{j as s,r as c,y as u}from"./vendor-tanstack-BpuysabX.js";import{B as j,g as h,h as m,bD as N,bQ as g,C as d,bP as b,dI as B,cD as y}from"./index-CREafGO4.js";import{u as k,B as _}from"./use-delete-block-document-confirmation-dialog-DV_EAvQF.js";import{B as D}from"./block-type-details-CJxHA2oB.js";import{D as S}from"./delete-confirmation-dialog-DxI68qN2.js";import{P as C}from"./python-example-snippet-DzfM6vLj.js";import{c as P}from"./vendor-recharts-C2XeLr4O.js";import"./vendor-radix-DIu41Ss_.js";import"./vendor-forms-Buh7U8Ay.js";import"./vendor-date-C1t37jsh.js";import"./dropdown-menu-DZExFL3b.js";import"./use-delete-confirmation-dialog-BgQibraR.js";import"./block-type-logo-BNO1-Opd.js";import"./lazy-markdown-rmxkK4GI.js";const L=({blockName:e})=>s.jsx(j,{className:"min-w-0",children:s.jsxs(h,{className:"flex-nowrap",children:[s.jsx(m,{children:s.jsx(N,{to:"/blocks",className:"text-xl font-semibold",children:"Blocks"})}),s.jsx(g,{}),s.jsx(m,{className:"text-xl font-semibold min-w-0",children:s.jsx("span",{className:"truncate block",title:e,children:e})})]})}),O=new Set(["__prefect_kind"]);function l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function x(e){const r={};for(const[a,n]of Object.entries(e))O.has(a)||(l(n)?r[a]=x(n):r[a]=n);return r}function w(e){return e.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function p({value:e}){const r=x(e),a=Object.entries(r);return a.length===0?s.jsx("span",{className:"text-muted-foreground text-base",children:"None"}):s.jsx(d,{className:"p-3 flex flex-col gap-2",children:a.map(([n,t])=>s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-muted-foreground text-sm",children:w(n)}),l(t)?s.jsx(p,{value:t}):s.jsx("span",{className:"text-base",children:f(t)})]},n))})}function f(e){return e==null?"None":typeof e=="string"?e:typeof e=="boolean"||typeof e=="number"?String(e):(Array.isArray(e),JSON.stringify(e))}function A({data:e,fields:r}){const a=c.useMemo(()=>{let n={};return"properties"in r&&(n=r.properties),Object.keys(n).map(t=>{let o=t;const i=n[t];return i.title&&(o=i.title),{label:o,raw:e[t]??null}})},[e,r]);return s.jsx("dl",{className:"flex flex-col gap-2 p-2 text-xs",children:a.map(({label:n,raw:t})=>s.jsxs(c.Fragment,{children:[s.jsx("dt",{className:"text-muted-foreground text-sm",children:n}),s.jsx("dd",{className:P("text-base",t==null&&"text-muted-foreground"),children:l(t)?s.jsx(p,{value:t}):f(t)})]},n))})}const E=({blockDocument:e})=>{const[r,a]=k(),n=()=>a(e,{shouldNavigate:!0}),{block_type:t}=e,o=e.name??e.block_type_name??"Block Document";return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(L,{blockName:o}),s.jsx(_,{blockDocument:e,onDelete:n})]}),s.jsx(d,{className:"p-4",children:s.jsxs("div",{className:"grid grid-cols-[minmax(0,_1fr)_250px] gap-4 ",children:[s.jsxs("div",{className:"flex flex-col gap-4",children:[(t?.code_example||t?.documentation_url)&&s.jsx(I,{hasCodeExample:!!t?.code_example,hasDocumentationUrl:!!t?.documentation_url}),t?.code_example&&s.jsx(C,{codeExample:t.code_example,name:e.name}),e.data&&e.block_schema?.fields&&s.jsx(A,{data:e.data,fields:e.block_schema?.fields})]}),t&&s.jsx(D,{blockType:t})]})})]}),s.jsx(S,{...r})]})};function I({hasCodeExample:e,hasDocumentationUrl:r}){return s.jsxs("div",{className:"flex items-center gap-1",children:[e&&s.jsxs("p",{className:"text-sm muted",children:["Paste this snippet"," ",s.jsx("span",{className:"font-semibold",children:"into your flows"})," to use this block."]}),r&&s.jsxs("p",{className:"text-sm muted",children:["Need help?"," ",s.jsx("a",{className:"underline text-link hover:text-link-hover visited:text-link",href:b["blocks-guide"],children:"View Docs"})]})]})}const W=function(){const{id:r}=B.useParams(),{data:a}=u(y(r));return s.jsx(E,{blockDocument:a})};export{W as component};
//# sourceMappingURL=block._id-dsdVfDF-.js.map
