"use strict";const s=require("react/jsx-runtime"),p=require("react"),e=require("./index-B9qnM6fn.js");var T={root:"m_8b3717df",breadcrumb:"m_f678d540",separator:"m_3b8f2208"};const N={separator:"/"},I=e.createVarsResolver((t,{separatorMargin:o})=>({root:{"--bc-separator-margin":e.getSpacing(o)}})),C=e.factory((t,o)=>{const r=e.useProps("Breadcrumbs",N,t),{classNames:l,className:c,style:i,styles:n,unstyled:a,vars:d,children:b,separator:x,separatorMargin:g,...m}=r,u=e.useStyles({name:"Breadcrumbs",classes:T,props:r,className:c,style:i,classNames:l,styles:n,unstyled:a,vars:d,varsResolver:I}),w=p.Children.toArray(b).reduce((y,f,v,L)=>{const B=e.isElement(f)?p.cloneElement(f,{...u("breadcrumb",{className:f.props?.className}),key:v}):p.createElement("div",{...u("breadcrumb"),key:v},f);return y.push(B),v!==L.length-1&&y.push(p.createElement(e.Box,{...u("separator"),key:`separator-${v}`},x)),y},[]);return s.jsx(e.Box,{ref:o,...u("root"),...m,children:w})});C.classes=T;C.displayName="@mantine/core/Breadcrumbs";var S={root:"m_b183c0a2"};const E={},G=e.createVarsResolver((t,{color:o})=>({root:{"--code-bg":o?e.getThemeColor(o,t):void 0}})),j=e.factory((t,o)=>{const r=e.useProps("Code",E,t),{classNames:l,className:c,style:i,styles:n,unstyled:a,vars:d,color:b,block:x,variant:g,mod:m,...u}=r,w=e.useStyles({name:"Code",props:r,classes:S,className:c,style:i,classNames:l,styles:n,unstyled:a,vars:d,varsResolver:G});return s.jsx(e.Box,{component:x?"pre":"code",variant:g,ref:o,mod:[{block:x},m],...w("root"),...u,dir:"ltr"})});j.classes=S;j.displayName="@mantine/core/Code";const R="_breadcrumbs_fo0zv_1",F="_separator_fo0zv_6",A="_anchor_fo0zv_10",M="_anchorClickable_fo0zv_14",$="_anchorStatic_fo0zv_18",h={breadcrumbs:R,separator:F,anchor:A,anchorClickable:M,anchorStatic:$};function O(t){return"type"in t&&t.type==="ellipsis"}const _=2,D=2,H=_+D+1,V=({items:t,size:o="lg",...r})=>{const[l,c]=p.useState(null),i=l===t.length,n=p.useMemo(()=>i||t.length<=H?t:[...t.slice(0,_),{type:"ellipsis"},...t.slice(t.length-D)],[t,i]);return s.jsx(C,{...r,classNames:{root:h.breadcrumbs,separator:h.separator},children:n.map((a,d)=>{if(O(a))return s.jsx(e.Anchor,{size:o,fw:500,c:"ldGray.6",className:`${h.anchor} ${h.anchorClickable}`,onClick:()=>c(t.length),children:"..."},"ellipsis");const b=!!(a.onClick||a.to),x=`${h.anchor} ${b?h.anchorClickable:h.anchorStatic}`,g={size:o,fw:a.active?600:500,c:a.active?"ldGray.9":"ldGray.6",onClick:a.onClick,className:x},m=a.to?s.jsx(e.Anchor,{component:e.Link,to:a.to,...g,children:a.title},a.tooltipProps?void 0:d):s.jsx(e.Anchor,{...g,children:a.title},a.tooltipProps?void 0:d);return a.tooltipProps?s.jsx(e.Tooltip$1,{...a.tooltipProps,children:m},d):m})})},q=(t,o,r)=>{t.type==="element"&&t.tagName==="a"&&r&&r.type==="element"&&/^h(1|2|3|4|5|6)/.test(r.tagName)&&(r.children=r.children.slice(1))},P=({source:t})=>{const o=e.useMantineTheme$1();return s.jsx(e.ReactMarkdownPreview,{skipHtml:!0,components:{h1:({children:r})=>s.jsx(e.Title,{order:2,children:r}),h2:({children:r})=>s.jsx(e.Title,{order:3,children:r}),h3:({children:r})=>s.jsx(e.Title,{order:4,children:r})},rehypePlugins:[[e.rehypeExternalLinks,{target:"_blank"}]],rehypeRewrite:q,source:t,disallowedElements:["img"],style:{fontSize:o.fontSizes.sm,color:o.colors.ldGray[7],backgroundColor:"transparent"}})},z=({description:t,onViewDescription:o,metricInfo:r})=>{const l=t&&t.length>180||t&&t.split(`
`).length>2,[c,i]=p.useState(!1);return s.jsxs(e.Stack,{gap:"xs",children:[r&&s.jsx(s.Fragment,{children:s.jsxs(e.Group,{gap:"xs",justify:"space-between",children:[s.jsx(e.Text,{fz:"sm",fw:500,c:"ldDark.7",children:r.name}),s.jsx(e.Badge$1,{radius:"sm",color:"indigo",p:2,style:{boxShadow:"var(--mantine-shadow-subtle)",border:"1px solid var(--mantine-color-indigo-1)"},children:e.friendlyName(r.type)})]})}),t&&s.jsx(e.Box,{mah:120,style:{overflow:"hidden",maskImage:l?"linear-gradient(180deg, white 0%, white 80%, transparent 100%)":void 0},children:s.jsxs(e.Stack,{gap:"xs",children:[r&&s.jsxs(s.Fragment,{children:[s.jsx(e.Divider,{color:"ldGray.2"}),s.jsx(e.Text,{fz:"xs",fw:500,c:"ldDark.7",children:"Description"})]}),s.jsx(P,{source:t})]})}),l&&s.jsx(e.Box,{ta:"center",children:s.jsx(e.Anchor,{size:"xs",onClick:n=>{n.preventDefault(),o()},children:"Read full description"})}),r&&s.jsxs(s.Fragment,{children:[s.jsx(e.Divider,{color:"ldGray.2"}),s.jsxs(e.Stack,{gap:"xs",children:[s.jsxs(e.Group,{gap:"xs",align:"center",justify:"space-between",children:[s.jsx(e.Text,{fz:"xs",fw:500,c:"ldDark.7",children:"SQL"}),s.jsx(e.Tooltip$1,{variant:"xs",position:"right",label:c?"Show original SQL":"Show compiled SQL",children:s.jsx(e.Button$1,{variant:"subtle",color:"gray",onClick:n=>{n.stopPropagation(),i(!c)},size:"compact-xs",leftSection:s.jsx(e.MantineIcon,{icon:e.IconCode}),children:c?"Original SQL":"Compiled SQL"})})]}),s.jsx(j,{maw:400,children:c?r.compiledSql:r.sql}),r.filters&&r.filters.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(e.Divider,{color:"ldGray.2"}),s.jsx(e.Text,{fz:"xs",fw:500,c:"ldDark.7",children:"Filters"}),r.filters.map(n=>{const a=e.filterOperatorLabel[n.operator];return s.jsxs(e.Group,{gap:4,children:[s.jsx(j,{fz:"xs",fw:500,children:n.target.fieldRef}),s.jsx(e.Text,{fz:"xs",fw:500,children:a}),s.jsxs(j,{fz:"xs",children:[e.isWithValueFilter(n.operator)?n.values?.map(d=>d).join(", "):"",e.isDateFilterRule(n)&&s.jsxs(p.Fragment,{children:[" ",n.settings?.completed?"completed":"",n.settings?.unitOfTime]})]})]},n.id)})]})]})]})]})},Q=({showPreview:t,closePreview:o,label:r,description:l,offset:c=20,children:i})=>{const n=e.useExplorerDispatch(),a=()=>{o(),n(e.explorerActions.openItemDetail({itemType:"table",label:r,description:l}))};return s.jsxs(e.Popover,{opened:t,keepMounted:!1,shadow:"sm",withinPortal:!0,disabled:!l,position:"right",withArrow:!0,offset:c,children:[s.jsx(e.Popover.Target,{children:i}),s.jsx(e.Popover.Dropdown,{maw:500,onClick:d=>d.stopPropagation(),children:s.jsx(z,{onViewDescription:a,description:l})})]})},W=({children:t})=>{const o=e.useExplorerDispatch(),r=e.useExplorerSelector(e.selectItemDetailModal),l=p.useCallback(()=>{o(e.explorerActions.closeItemDetail())},[o]),c=p.useCallback(()=>{if(!r.itemType||!r.label)return null;switch(r.itemType){case"field":return s.jsxs(e.Group,{children:[r.fieldItem&&s.jsx(e.FieldIcon,{item:r.fieldItem,color:e.getFieldColor(r.fieldItem),size:"md"}),s.jsx(e.Text,{fz:"md",children:r.label})]});case"table":return s.jsxs(e.Group,{gap:"sm",children:[s.jsx(e.MantineIcon,{icon:e.IconTable,size:"lg",color:"ldGray.7"}),s.jsx(e.Text,{fz:"md",children:r.label})]});case"group":return s.jsx(e.Group,{children:s.jsx(e.Text,{fz:"md",children:r.label})});default:return null}},[r.itemType,r.label,r.fieldItem]),i=p.useCallback(()=>r.description?s.jsx(P,{source:r.description}):s.jsx(e.Text,{c:"gray",children:"No description available."}),[r.description]);return s.jsxs(s.Fragment,{children:[r.isOpen&&s.jsx(e.Modal,{p:"xl",size:"lg",opened:r.isOpen,onClose:l,title:c(),children:i()}),t]})},J="_warningsList_1fmja_1",K="_warningBox_1fmja_5",U="_warningText_1fmja_9",k={warningsList:J,warningBox:K,warningText:U},X=({type:t,warnings:o})=>s.jsxs(s.Fragment,{children:[s.jsxs(e.Text,{fz:"sm",fw:600,mb:"xs",children:["Compilation ",t," (",o.length,")"]}),s.jsx(e.Stack,{className:k.warningsList,gap:"xs",mah:250,children:o.map((r,l)=>s.jsx(e.Box,{className:k.warningBox,p:"xs",bg:"ldGray.0",children:s.jsx(e.Text,{className:k.warningText,fz:"xs",children:r.message})},l))})]});exports.ItemDetailPreview=z;exports.ItemDetailProvider=W;exports.PageBreadcrumbs=V;exports.TableItemDetailPreview=Q;exports.WarningsHoverCardContent=X;
//# sourceMappingURL=WarningsHoverCardContent-fUBUoF6k.js.map
