@peak-ai/canvas 1.4.20 → 1.4.21

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.
Files changed (33) hide show
  1. package/declaration.d.js +2 -0
  2. package/declaration.d.js.map +1 -0
  3. package/package.json +1 -1
  4. package/plugins/grapejs-plugin.js +3 -3
  5. package/plugins/grapejs-plugin.js.map +1 -1
  6. package/plugins/helpers/custom-modal.js +1 -1
  7. package/plugins/helpers/custom-modal.js.map +1 -1
  8. package/plugins/helpers/query-cache-context.d.ts +18 -0
  9. package/plugins/helpers/query-cache-context.js +2 -0
  10. package/plugins/helpers/query-cache-context.js.map +1 -0
  11. package/plugins/helpers/query-cache-singleton.d.ts +25 -0
  12. package/plugins/helpers/query-cache-singleton.js +4 -0
  13. package/plugins/helpers/query-cache-singleton.js.map +1 -0
  14. package/plugins/helpers/query-cache-utils.d.ts +48 -0
  15. package/plugins/helpers/query-cache-utils.js +6 -0
  16. package/plugins/helpers/query-cache-utils.js.map +1 -0
  17. package/plugins/helpers/query-details-modal.d.ts +7 -2
  18. package/plugins/helpers/query-details-modal.js +3 -3
  19. package/plugins/helpers/query-details-modal.js.map +1 -1
  20. package/plugins/helpers/query-heading-formatter.d.ts +1 -0
  21. package/plugins/helpers/query-heading-formatter.js +5 -0
  22. package/plugins/helpers/query-heading-formatter.js.map +1 -0
  23. package/plugins/helpers/query-loading-modal.d.ts +2 -1
  24. package/plugins/helpers/query-loading-modal.js +1 -1
  25. package/plugins/helpers/query-loading-modal.js.map +1 -1
  26. package/plugins/helpers/render-components.js +3 -3
  27. package/plugins/helpers/render-components.js.map +1 -1
  28. package/plugins/helpers/styled-info-button.d.ts +2 -1
  29. package/plugins/helpers/styled-info-button.js +5 -1
  30. package/plugins/helpers/styled-info-button.js.map +1 -1
  31. package/shadcn/components/icons/thinking.gif +0 -0
  32. package/types/images.d.js +2 -0
  33. package/types/images.d.js.map +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"query-details-modal.js","names":["React","useState","useEffect","CustomModal","Copy","Check","ChevronDown","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","QueryDetailsModal","_ref","isOpen","onClose","isLoading","error","sqlQuery","_ref$tableButtonExpla","tableButtonExplanations","onRetry","_useState","copied","setCopied","_useState2","expandedButtons","setExpandedButtons","copyToClipboard","_x","_x2","_copyToClipboard","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","_callee","queryToCopy","copyId","textToCopy","id","wrap","_callee$","_context","prev","next","Array","isArray","filter","q","join","abrupt","navigator","clipboard","writeText","_extends3","_extends","setTimeout","_extends4","t0","stop","toggleButtonExpansion","buttonIndex","_extends2","renderTableButtonExplanations","length","className","children","map","button","index","_button$buttonStyle","_button$buttonStyle2","_button$buttonStyle3","onClick","buttonClassName","style","backgroundColor","buttonStyle","color","border","action","explanation","renderModalContent","type","query","trim","undefined","single","title"],"sources":["../../../src/plugins/helpers/query-details-modal.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { CustomModal } from './custom-modal';\nimport { Copy, Check, ChevronDown } from 'lucide-react';\n\ntype QueryDetailsModalProps = {\n isOpen: boolean;\n onClose: () => void;\n isLoading: boolean;\n error: string;\n sqlQuery: string | string[];\n tableButtonExplanations?: Array<{action: string, explanation: string, operationName?: string, buttonClassName?: string, buttonStyle?: Record<string, unknown>}>;\n onRetry: () => void;\n};\n\nexport function QueryDetailsModal({\n isOpen,\n onClose,\n isLoading,\n error,\n sqlQuery,\n tableButtonExplanations = [],\n onRetry\n}: QueryDetailsModalProps) {\n const [copied, setCopied] = useState<{ [key: string]: boolean }>({});\n const [expandedButtons, setExpandedButtons] = useState<{ [key: string]: boolean }>({});\n\n // Reset expanded state when modal closes\n useEffect(() => {\n if (!isOpen) {\n setExpandedButtons({});\n }\n }, [isOpen]);\n\n async function copyToClipboard(queryToCopy?: string, copyId?: string) {\n let textToCopy = queryToCopy;\n \n if (!textToCopy) {\n if (Array.isArray(sqlQuery)) {\n textToCopy = sqlQuery.filter(q => q && typeof q === 'string').join('\\n\\n-- Next Query --\\n\\n');\n } else if (typeof sqlQuery === 'string') {\n textToCopy = sqlQuery;\n } else {\n textToCopy = '';\n }\n }\n \n if (!textToCopy) {\n return;\n }\n \n const id = copyId || 'main';\n \n try {\n await navigator.clipboard.writeText(textToCopy);\n setCopied(prev => ({ ...prev, [id]: true }));\n setTimeout(() => setCopied(prev => ({ ...prev, [id]: false })), 2000);\n } catch (err) {\n // Silently fail if clipboard API is not available\n }\n }\n\n function toggleButtonExpansion(buttonIndex: number) {\n setExpandedButtons(prev => ({\n ...prev,\n [buttonIndex]: !prev[buttonIndex]\n }));\n }\n\n function renderTableButtonExplanations() {\n if (!tableButtonExplanations || tableButtonExplanations.length === 0) {\n return null;\n }\n\n return (\n <div className=\"mb-6\">\n {tableButtonExplanations.map((button, index) => (\n <div key={index} className=\"mb-3 border border-gray-200 rounded-lg\">\n <div className=\"w-full px-4 py-3 flex items-center justify-between rounded-lg\">\n <span className=\"font-medium text-xs text-gray-500\">\n What does this button do?\n </span>\n <div className=\"flex items-center\">\n <button\n onClick={() => toggleButtonExpansion(index)}\n className={button.buttonClassName || \"flex items-center px-3 py-1.5 rounded text-xs font-medium\"}\n style={{\n backgroundColor: (button.buttonStyle?.backgroundColor as string) || '#f3f4f6',\n color: (button.buttonStyle?.color as string) || '#374151',\n border: (button.buttonStyle?.border as string) || '1px solid #d1d5db',\n ...(button.buttonStyle as React.CSSProperties || {})\n }}\n >\n {button.action}\n </button>\n <ChevronDown \n className={`ml-2 w-4 h-4 text-gray-500 transition-transform cursor-pointer ${\n expandedButtons[index] ? 'rotate-180' : ''\n }`}\n onClick={() => toggleButtonExpansion(index)}\n />\n </div>\n </div>\n \n {expandedButtons[index] && (\n <div className=\"px-4 pb-3 border-t border-gray-200\">\n <p className=\"text-xs text-gray-700 mt-2\">\n This button will make a request to <span className=\"font-semibold\">{button.explanation}</span> \n </p>\n </div>\n )}\n </div>\n ))}\n </div>\n );\n }\n\n function renderModalContent() {\n if (isLoading) {\n return (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-600 mb-4\"></div>\n <span className=\"text-xs text-gray-600\">Fetching query details from semantic layer...</span>\n <span className=\"text-xs text-gray-400 mt-2\">This may take a few moments</span>\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"text-red-600 p-4 bg-red-50 rounded-lg border border-red-200 m-6\">\n <p className=\"font-medium mb-2 text-xs\">Unable to fetch query details</p>\n <p className=\"text-xs mb-3\">{error}</p>\n <button \n onClick={onRetry}\n className=\"px-4 py-2 bg-red-100 hover:bg-red-200 rounded text-xs font-medium transition-colors\"\n type=\"button\"\n >\n Retry\n </button>\n </div>\n );\n }\n\n if (!sqlQuery || (Array.isArray(sqlQuery) && sqlQuery.length === 0)) {\n return (\n <div className=\"text-gray-600 p-6\">\n <p className=\"text-xs\">No query details available</p>\n </div>\n );\n }\n\n // Handle multiple queries\n if (Array.isArray(sqlQuery)) {\n return (\n <div className=\"p-6 space-y-4\">\n {sqlQuery\n .filter(query => query && typeof query === 'string' && query.trim())\n .map((query, index) => (\n <div \n key={index} \n className=\"bg-white border border-gray-200 rounded-lg p-4\"\n >\n <div className=\"flex justify-between items-start mb-3\">\n <h3 className=\"font-semibold text-xs text-gray-500 m-0\">\n Query details\n </h3>\n <button\n onClick={() => copyToClipboard(query, `query-${index}`)}\n className=\"flex items-center gap-2 px-2 py-1 text-xs bg-gray-50 border border-gray-300 rounded hover:bg-gray-100 transition-colors\"\n type=\"button\"\n >\n {copied[`query-${index}`] ? (\n <>\n <Check className=\"w-3 h-3 text-green-600\" />\n <span className=\"text-green-600\">Copied!</span>\n </>\n ) : (\n <>\n <Copy className=\"w-3 h-3 text-gray-600\" />\n <span className=\"text-gray-600\">Copy</span>\n </>\n )}\n </button>\n </div>\n <pre className=\"whitespace-pre-wrap leading-relaxed text-xs text-gray-700 m-0 p-0\">\n {query}\n </pre>\n </div>\n ))}\n {renderTableButtonExplanations()}\n </div>\n );\n }\n\n return (\n <div className=\"p-6 space-y-4\">\n <div className=\"bg-white border border-gray-200 rounded-lg p-4\">\n <div className=\"flex justify-between items-start mb-3\">\n <h3 className=\"font-semibold text-xs text-gray-500 m-0\">\n Query details\n </h3>\n <button\n onClick={() => copyToClipboard(undefined, 'single')}\n className=\"flex items-center gap-2 px-2 py-1 text-xs bg-gray-50 border border-gray-300 rounded hover:bg-gray-100 transition-colors\"\n type=\"button\"\n >\n {copied.single ? (\n <>\n <Check className=\"w-3 h-3 text-green-600\" />\n <span className=\"text-green-600\">Copied!</span>\n </>\n ) : (\n <>\n <Copy className=\"w-3 h-3 text-gray-600\" />\n <span className=\"text-gray-600\">Copy</span>\n </>\n )}\n </button>\n </div>\n <pre className=\"whitespace-pre-wrap leading-relaxed text-xs text-gray-700 m-0 p-0\">\n {sqlQuery}\n </pre>\n </div>\n {renderTableButtonExplanations()}\n </div>\n );\n }\n\n return (\n <CustomModal\n isOpen={isOpen}\n onClose={onClose}\n title=\"How was this metric calculated?\"\n >\n {renderModalContent()}\n </CustomModal>\n );\n}\n\nexport default QueryDetailsModal;\n"],"mappings":"wLAAA,MAAO,CAAAA,KAAK,EAAIC,QAAQ,CAAEC,SAAS,KAAQ,OAAO,CAClD,OAASC,WAAW,KAAQ,gBAAgB,CAC5C,OAASC,IAAI,CAAEC,KAAK,CAAEC,WAAW,KAAQ,cAAc,CAAC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,CAAAC,QAAA,IAAAC,SAAA,yBAYxD,MAAO,SAAS,CAAAC,iBAAiBA,CAAAC,IAAA,CAQN,IAPzB,CAAAC,MAAM,CAAAD,IAAA,CAANC,MAAM,CACNC,OAAO,CAAAF,IAAA,CAAPE,OAAO,CACPC,SAAS,CAAAH,IAAA,CAATG,SAAS,CACTC,KAAK,CAAAJ,IAAA,CAALI,KAAK,CACLC,QAAQ,CAAAL,IAAA,CAARK,QAAQ,CAAAC,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EA,MAAO,CACfC,OAAO,CAAEA,OAAQ,CACjB2E,KAAK,CAAC,iCAAiC,CAAAtB,QAAA,CAEtCgB,kBAAkB,CAAC,CAAC,CACV,CAEjB,CAEA,cAAe,CAAAxE,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"query-details-modal.js","names":["React","useState","useEffect","CustomModal","Copy","Check","ChevronDown","ChevronUp","formatQueryHeading","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CopyButton","_ref","onClick","isCopied","_ref$variant","variant","baseClasses","variantClasses","className","type","children","ContentText","_ref2","_ref2$hasOverflowHand","hasOverflowHandling","overflowClasses","ContentBlock","_ref3","title","copyContent","copyId","copied","onCopy","_ref3$variant","_ref3$copyButtonVaria","copyButtonVariant","containerClasses","containerStyle","border","titleClasses","style","QueryDetailsModal","_ref4","isOpen","onClose","isLoading","error","sqlQuery","_ref4$queryHeadings","queryHeadings","_ref4$tableButtonExpl","tableButtonExplanations","onRetry","_useState","setCopied","_useState2","expandedButtons","setExpandedButtons","copyToClipboard","_x","_x2","_copyToClipboard","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","_callee","queryToCopy","textToCopy","id","wrap","_callee$","_context","prev","next","Array","isArray","filter","q","join","abrupt","navigator","clipboard","writeText","_extends3","_extends","setTimeout","_extends4","t0","stop","toggleButtonExpansion","buttonIndex","_extends2","renderTableButtonExplanations","length","hasValidJsonBody","jsonBody","undefined","hasValidFormFields","formFields","Object","keys","map","button","index","_button$buttonStyle","_button$buttonStyle2","_button$buttonStyle3","buttonClassName","height","width","minWidth","backgroundColor","buttonStyle","color","display","alignItems","justifyContent","action","operationSummary","operationDescription","requestUrl","explanation","JSON","stringify","renderModalContent","query","trim","rawHeading","heading"],"sources":["../../../src/plugins/helpers/query-details-modal.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { CustomModal } from './custom-modal';\nimport { Copy, Check, ChevronDown, ChevronUp, X } from 'lucide-react';\nimport { formatQueryHeading } from './query-heading-formatter';\n\ntype CopyButtonProps = {\n onClick: () => void;\n isCopied: boolean;\n variant?: 'default' | 'light';\n};\n\nfunction CopyButton({ onClick, isCopied, variant = 'default' }: CopyButtonProps) {\n const baseClasses = \"flex items-center gap-1 px-2 py-1 text-xs border rounded transition-colors\";\n const variantClasses = variant === 'light' \n ? \"bg-gray-50 border-gray-300 hover:bg-gray-100\"\n : \"bg-gray-100 border-gray-300 hover:bg-gray-200\";\n\n return (\n <button\n onClick={onClick}\n className={`${baseClasses} ${variantClasses}`}\n type=\"button\"\n >\n {isCopied ? (\n <>\n <Check className=\"w-3 h-3 text-green-600\" />\n <span className=\"text-green-600\">Copied!</span>\n </>\n ) : (\n <>\n <Copy className=\"w-3 h-3 text-gray-600\" />\n <span className=\"text-gray-600\">Copy</span>\n </>\n )}\n </button>\n );\n}\n\ntype ContentTextProps = {\n children: React.ReactNode;\n hasOverflowHandling?: boolean;\n};\n\nfunction ContentText({ children, hasOverflowHandling = true }: ContentTextProps) {\n const overflowClasses = hasOverflowHandling ? \"overflow-hidden break-words\" : \"\";\n\n return (\n <pre className={`whitespace-pre-wrap leading-relaxed text-xs text-gray-700 m-0 p-0 ${overflowClasses}`}>\n {children}\n </pre>\n );\n}\n\ntype ContentBlockProps = {\n title: string;\n children: React.ReactNode;\n copyContent?: string;\n copyId: string;\n copied: Record<string, boolean>;\n onCopy: (content: string, id: string) => void;\n variant?: 'default' | 'bordered';\n copyButtonVariant?: 'default' | 'light';\n};\n\nfunction ContentBlock({ \n title, \n children, \n copyContent, \n copyId, \n copied, \n onCopy,\n variant = 'bordered',\n copyButtonVariant = 'default'\n}: ContentBlockProps) {\n const containerClasses = variant === 'bordered' \n ? \"rounded-lg p-3\"\n : \"bg-white border border-gray-200 rounded-lg p-4\";\n \n const containerStyle = variant === 'bordered' \n ? { border: '1px solid #E9EAF5' }\n : {};\n\n const titleClasses = variant === 'bordered'\n ? \"text-sm font-medium text-gray-600\"\n : \"font-semibold text-sm text-gray-500 m-0\";\n\n return (\n <div className={containerClasses} style={containerStyle}>\n <div className=\"flex justify-between items-start mb-2\">\n <span className={titleClasses}>{title}</span>\n {copyContent && (\n <CopyButton\n onClick={() => onCopy(copyContent, copyId)}\n isCopied={copied[copyId] || false}\n variant={copyButtonVariant}\n />\n )}\n </div>\n {children}\n </div>\n );\n}\n\ntype QueryDetailsModalProps = {\n isOpen: boolean;\n onClose: () => void;\n isLoading: boolean;\n error: string;\n sqlQuery: string | string[];\n queryHeadings?: string[];\n tableButtonExplanations?: Array<{\n action: string, \n explanation: string, \n operationSummary?: string,\n operationDescription?: string,\n buttonClassName?: string, \n buttonStyle?: Record<string, unknown>,\n formFields?: Record<string, unknown>;\n jsonBody?: unknown;\n requestUrl?: string;\n }>;\n onRetry: () => void;\n};\n\nexport function QueryDetailsModal({\n isOpen,\n onClose,\n isLoading,\n error,\n sqlQuery,\n queryHeadings = [],\n tableButtonExplanations = [],\n onRetry\n}: QueryDetailsModalProps) {\n const [copied, setCopied] = useState<{ [key: string]: boolean }>({});\n const [expandedButtons, setExpandedButtons] = useState<{ [key: string]: boolean }>({});\n\n // Reset expanded state when modal closes\n useEffect(() => {\n if (!isOpen) {\n setExpandedButtons({});\n }\n }, [isOpen]);\n\n async function copyToClipboard(queryToCopy?: string, copyId?: string) {\n let textToCopy = queryToCopy;\n \n if (!textToCopy) {\n if (Array.isArray(sqlQuery)) {\n textToCopy = sqlQuery.filter(q => q && typeof q === 'string').join('\\n\\n-- Next Query --\\n\\n');\n } else if (typeof sqlQuery === 'string') {\n textToCopy = sqlQuery;\n } else {\n textToCopy = '';\n }\n }\n \n if (!textToCopy) {\n return;\n }\n \n const id = copyId || 'main';\n \n try {\n await navigator.clipboard.writeText(textToCopy);\n setCopied(prev => ({ ...prev, [id]: true }));\n setTimeout(() => setCopied(prev => ({ ...prev, [id]: false })), 2000);\n } catch (err) {\n // Silently fail if clipboard API is not available\n }\n }\n\n function toggleButtonExpansion(buttonIndex: number) {\n setExpandedButtons(prev => ({\n ...prev,\n [buttonIndex]: !prev[buttonIndex]\n }));\n }\n\n function renderTableButtonExplanations() {\n if (!tableButtonExplanations || tableButtonExplanations.length === 0) {\n return null;\n }\n\n function hasValidJsonBody(jsonBody: unknown): boolean {\n return jsonBody !== null && jsonBody !== undefined && jsonBody !== '';\n }\n\n function hasValidFormFields(formFields: Record<string, unknown> | undefined): boolean {\n return formFields !== null && formFields !== undefined && Object.keys(formFields || {}).length > 0;\n }\n\n return (\n <div className=\"mb-6\">\n {tableButtonExplanations.map((button, index) => (\n <div key={index} className=\"mb-3 border border-gray-200 rounded-lg\">\n <div className=\"w-full px-4 py-3 flex items-center justify-between rounded-lg\">\n <div className=\"flex items-center\">\n <button\n onClick={() => toggleButtonExpansion(index)}\n className={button.buttonClassName || \"flex items-center justify-center px-3 rounded text-xs font-medium\"}\n style={{\n height: '35px',\n width: 'fit-content',\n minWidth: 'fit-content',\n backgroundColor: (button.buttonStyle?.backgroundColor as string),\n color: (button.buttonStyle?.color as string),\n border: (button.buttonStyle?.border as string),\n ...(button.buttonStyle as React.CSSProperties || {})\n , ...button.buttonStyle as React.CSSProperties || {},\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center'\n }}\n >\n {button.action}\n </button>\n <div className=\"ml-3 flex flex-col\">\n {button.operationSummary && (\n <span className=\"text-xs text-gray-700 font-medium\">\n {button.operationSummary}\n </span>\n )}\n </div>\n </div>\n {expandedButtons[index] ? (\n <ChevronUp \n className=\"w-4 h-4 text-gray-500 transition-transform cursor-pointer\"\n onClick={() => toggleButtonExpansion(index)}\n />\n ) : (\n <ChevronDown \n className=\"w-4 h-4 text-gray-500 transition-transform cursor-pointer\"\n onClick={() => toggleButtonExpansion(index)}\n />\n )}\n </div>\n \n {expandedButtons[index] && (\n <div className=\"px-4 pb-3 border-t border-gray-200\">\n <div className=\"mt-2 space-y-3\">\n {/* Description Block */}\n {button.operationDescription && (\n <ContentBlock\n title=\"Description\"\n copyId={`description-${index}`}\n copied={copied}\n onCopy={copyToClipboard}\n variant=\"bordered\"\n >\n <ContentText>\n {button.operationDescription}\n </ContentText>\n </ContentBlock>\n )}\n\n {(button.requestUrl || button.explanation) && (\n <ContentBlock\n title=\"URL\"\n copyContent={button.requestUrl || button.explanation}\n copyId={`url-${index}`}\n copied={copied}\n onCopy={copyToClipboard}\n variant=\"bordered\"\n >\n <ContentText>\n {button.requestUrl || button.explanation}\n </ContentText>\n </ContentBlock>\n )}\n \n {(hasValidJsonBody(button.jsonBody) || hasValidFormFields(button.formFields)) && (\n <ContentBlock\n title=\"Payload\"\n copyContent={JSON.stringify(\n hasValidJsonBody(button.jsonBody) ? button.jsonBody : button.formFields, \n null, \n 2\n )}\n copyId={`payload-${index}`}\n copied={copied}\n onCopy={copyToClipboard}\n variant=\"bordered\"\n >\n <ContentText>\n {hasValidJsonBody(button.jsonBody) \n ? JSON.stringify(button.jsonBody, null, 2)\n : JSON.stringify(button.formFields, null, 2)}\n </ContentText>\n </ContentBlock>\n )}\n </div>\n </div>\n )}\n </div>\n ))}\n </div>\n );\n }\n\n function renderModalContent() {\n if (isLoading) {\n return (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-600 mb-4\"></div>\n <span className=\"text-xs text-gray-600\">Fetching query details from semantic layer...</span>\n <span className=\"text-xs text-gray-400 mt-2\">This may take a few moments</span>\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"text-red-600 p-4 bg-red-50 rounded-lg border border-red-200 m-6\">\n <p className=\"font-medium mb-2 text-xs\">Unable to fetch query details</p>\n <p className=\"text-xs mb-3\">{error}</p>\n <button \n onClick={onRetry}\n className=\"px-4 py-2 bg-red-100 hover:bg-red-200 rounded text-xs font-medium transition-colors\"\n type=\"button\"\n >\n Retry\n </button>\n </div>\n );\n }\n\n if (!sqlQuery || (Array.isArray(sqlQuery) && sqlQuery.length === 0)) {\n return (\n <div className=\"text-gray-600 p-6\">\n <p className=\"text-xs\">No query details available</p>\n </div>\n );\n }\n\n // Handle multiple queries\n if (Array.isArray(sqlQuery)) {\n return (\n <div className=\"p-6 space-y-4\">\n {sqlQuery\n .filter(query => query && typeof query === 'string' && query.trim())\n .map((query, index) => {\n\n const rawHeading = queryHeadings[index] || `Query ${index + 1}`;\n const heading = formatQueryHeading(rawHeading);\n\n return (\n <ContentBlock\n key={index}\n title={heading}\n copyContent={query}\n copyId={`query-${index}`}\n copied={copied}\n onCopy={copyToClipboard}\n variant=\"default\"\n copyButtonVariant=\"light\"\n >\n <ContentText hasOverflowHandling={false}>\n {query}\n </ContentText>\n </ContentBlock>\n );\n })}\n {renderTableButtonExplanations()}\n </div>\n );\n }\n\n return (\n <div className=\"p-6 space-y-4\">\n <ContentBlock\n title={formatQueryHeading(queryHeadings[0] || \"Query details\")}\n copyContent={typeof sqlQuery === 'string' ? sqlQuery : ''}\n copyId=\"single\"\n copied={copied}\n onCopy={copyToClipboard}\n variant=\"default\"\n copyButtonVariant=\"light\"\n >\n <ContentText hasOverflowHandling={false}>\n {sqlQuery}\n </ContentText>\n </ContentBlock>\n {renderTableButtonExplanations()}\n </div>\n );\n }\n\n return (\n <CustomModal\n isOpen={isOpen}\n onClose={onClose}\n title=\"How was this metric calculated?\"\n >\n {renderModalContent()}\n </CustomModal>\n );\n}\n\nexport default QueryDetailsModal;\n"],"mappings":"wLAAA,MAAO,CAAAA,KAAK,EAAIC,QAAQ,CAAEC,SAAS,KAAQ,OAAO,CAClD,OAASC,WAAW,KAAQ,gBAAgB,CAC5C,OAASC,IAAI,CAAEC,KAAK,CAAEC,WAAW,CAAEC,SAAS,KAAW,cAAc,CACrE,OAASC,kBAAkB,KAAQ,2BAA2B,CAAC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,QAAA,IAAAC,SAAA,CAAAC,IAAA,IAAAC,KAAA,yBAQ/D,QAAS,CAAAC,UAAUA,CAAAC,IAAA,CAA8D,IAA3D,CAAAC,OAAO,CAAAD,IAAA,CAAPC,OAAO,CAAEC,QAAQ,CAAAF,IAAA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,OAAO,CAAAf,QAAA,cAEzBf,IAAA,CAACgB,WAAW,EAACG,mBAAmB,CAAE,KAAM,CAAAJ,QAAA,CACrC2B,QAAQ,CACE,CAAC,CACF,CAAC,CACd+C,6BAA6B,CAAC,CAAC,EAC7B,CAEX,CAEA,mBACEzF,IAAA,CAACP,WAAW,EACV6C,MAAM,CAAEA,MAAO,CACfC,OAAO,CAAEA,OAAQ,CACjBhB,KAAK,CAAC,iCAAiC,CAAAR,QAAA,CAEtC0G,kBAAkB,CAAC,CAAC,CACV,CAEjB,CAEA,cAAe,CAAArF,iBAAiB","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare function formatQueryHeading(heading: string): string;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Utility function to format query headings for display
3
+ * Converts technical query keys into presentable headings
4
+ */export function formatQueryHeading(heading){if(!heading){return"Query details"}var formatted=heading.replace(/_[a-z-]+-[a-z0-9]+$/i,"");formatted=formatted.replace(/_/g," ");formatted=formatted.replace(/([a-z])([A-Z])/g,"$1 $2");var componentRegex=/\b(table|chart|card|button|text|image|list|modal|dropdown|tabs|header|footer|nav|menu|pagination|search|filter|sort|pagination)\b/gi;formatted=formatted.replace(componentRegex,"").trim();formatted=formatted.replace(/\b\w/g,function(l){return l.toUpperCase()});formatted=formatted.replace(/\s+/g," ").trim();return formatted||"Query details"}
5
+ //# sourceMappingURL=query-heading-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-heading-formatter.js","names":["formatQueryHeading","heading","formatted","replace","componentRegex","trim","l","toUpperCase"],"sources":["../../../src/plugins/helpers/query-heading-formatter.ts"],"sourcesContent":["/**\n * Utility function to format query headings for display\n * Converts technical query keys into presentable headings\n */\nexport function formatQueryHeading(heading: string): string {\n if (!heading) {\n return 'Query details';\n }\n\n let formatted = heading.replace(/_[a-z-]+-[a-z0-9]+$/i, '');\n \n formatted = formatted.replace(/_/g, ' ');\n \n formatted = formatted.replace(/([a-z])([A-Z])/g, '$1 $2');\n\n const componentRegex = /\\b(table|chart|card|button|text|image|list|modal|dropdown|tabs|header|footer|nav|menu|pagination|search|filter|sort|pagination)\\b/gi;\n formatted = formatted.replace(componentRegex, '').trim();\n \n formatted = formatted.replace(/\\b\\w/g, l => l.toUpperCase());\n \n formatted = formatted.replace(/\\s+/g, ' ').trim();\n \n return formatted || 'Query details';\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,GACA,MAAO,SAAS,CAAAA,kBAAkBA,CAACC,OAAe,CAAU,CAC1D,GAAI,CAACA,OAAO,CAAE,CACZ,MAAO,eACT,CAEA,GAAI,CAAAC,SAAS,CAAGD,OAAO,CAACE,OAAO,CAAC,sBAAsB,CAAE,EAAE,CAAC,CAE3DD,SAAS,CAAGA,SAAS,CAACC,OAAO,CAAC,IAAI,CAAE,GAAG,CAAC,CAExCD,SAAS,CAAGA,SAAS,CAACC,OAAO,CAAC,iBAAiB,CAAE,OAAO,CAAC,CAEzD,GAAM,CAAAC,cAAc,CAAG,qIAAqI,CAC5JF,SAAS,CAAGA,SAAS,CAACC,OAAO,CAACC,cAAc,CAAE,EAAE,CAAC,CAACC,IAAI,CAAC,CAAC,CAExDH,SAAS,CAAGA,SAAS,CAACC,OAAO,CAAC,OAAO,CAAE,SAAAG,CAAC,QAAI,CAAAA,CAAC,CAACC,WAAW,CAAC,CAAC,EAAC,CAE5DL,SAAS,CAAGA,SAAS,CAACC,OAAO,CAAC,MAAM,CAAE,GAAG,CAAC,CAACE,IAAI,CAAC,CAAC,CAEjD,MAAO,CAAAH,SAAS,EAAI,eACtB","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  type QueryLoadingModalProps = {
2
2
  isOpen: boolean;
3
+ onClose: () => void;
3
4
  };
4
- export declare function QueryLoadingModal({ isOpen }: QueryLoadingModalProps): import("react/jsx-runtime").JSX.Element | null;
5
+ export declare function QueryLoadingModal({ isOpen, onClose }: QueryLoadingModalProps): import("react/jsx-runtime").JSX.Element | null;
5
6
  export {};
@@ -1,2 +1,2 @@
1
- import React from"react";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function QueryLoadingModal(_ref){var isOpen=_ref.isOpen;var thinkingGifBase64="data:image/gif;base64,R0lGODlhBAEEAfQAAIlD8ZFP8phb859n9KBm9Kdy9a5+9raK97yV972W+MOh98Sh+cus+dO4+trE+uLQ++nc/PDn/fDo/ff0/vjz/v///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJIwAVACwAAAAABAEEAQAI/gArCBxIsKDBgwgTFnxwQAAAAAEKNJCgsKLFixgzatzIsaPHjyBDcnzg8KHJhwIWiFzJsqXLlzBjtlxwsqbJAhNk6tzJs6dPnzRtCi3ws6jRo0iTShDKFIDKpFCjSp2qkUBToQEoUt3KtevRBleZHvBKtqxZliXD2nxwtq3btwjBqh0Kt67dshPSzq3J9q7fv0mD7rU5ALDhwzslBBjMtAHix5BFHmDMNEDOyJgzW1xKmelTzaBDC5zcGetl0aghPyjd9HPq14D1sq6pFbbtunJn073N261s3Sf79h7eNTdwm0SJK58q4fdxk8KXSzcq+LlNAdOz/+RsnSkD7eB1/pLubjq8+ZbcyQt1fb59x/HqbVp2T3/j6vhNE9Tff9E5fpO18ScgQcb9h9yACArUnIFXRZdgfQUweFVWD9Y3QYQSXiUABBW214B/Gda0QIAdLvcAhiHOJYBjJSoHAYopDrZii7xNAF+MlAngII2aTbDAYjjqdgCJPEL2Y5DWDVmkaiAiydqISwJ2opP4zRhlXRLASGV8Vl5p1gQJbBmijl565SOQYoaoZJlTMYBmmjGuyeZRJMFJZQALnDYnTy/amWaXe8rEgJ9+GqBnoDMRSugAhyIa0n2K+qmfo2hFquiOlHLkgKWKjpUpSDdyKmYAn4Jklah+clhqR6gS6sCq/qy2auersG7UpKwpYlqrQlriimSjuyo0qK9UJhcsRhS8SWyMLB6LUXXLjunsRr1G+58AEUyrEQWnWmtgAKpqq5EC3v5XQLbichRBqOXOVoCu6WIUQbXtD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+yxhiE9cEQD7zsQsBkmB8VfdGCPExadjsI0dnEEJ75girPWfjn+8kZOiz8dEnsiHlXbhJGd4fhx2ckj2C2Ips4TEQ7QyS2Z8uhVrucXdq+mXCdw9/I6ZIzhG1v6Qz7wRjN4OyVGZAAMKIAABFGCK4AsyG+vigFQ1WVBG1lqU2YKwP+dpyY0y9LfyYlG7BVqMdWlfOEFHZZd5OSpZEw74xHbWunD6LOukGJeRdWmoTFTRZUozmvS3FXipD3ijVhWc1QabNXcMs92ytfmqVmNKublbs9bPcVjdLkTPkC7oREyvi6VhQg16LQr+LPiMjSBU8yTZkOlvzLBMIWR7c77Am2iLSp0Uv5onu9pTdX9gTJZhdkiUoIs1khrNFWS2yJjQUjeK1OLKe58wVvJuUbAz1mwZxbJj0e6Orss9AFX5dlEPJtTAcUJIaj380HsCG1cqrSprj+fR7564pv605nHtUDsw5NYJt7vz7zdRYOXs1tvcNB4wcTswLLi+Wcy1pe+8haXnXjpZwHmz7JwAfUo6O/pXxpJwOYH0ZJmekMhxMnROLZxSTbfK1ZOyculMnUQgh83XqU5yx528ISXXVMETDbqwo60t51110d/EccikPClCdfjcBdVzAfNFuh1q6/pefpxn1wXw5ybv+noaGsP3pZIzzKrj4l6SkFGG8vkzM/yki1bLMF4+Adi7zhpggC4FALqNIbx5HI9CCDigAQ1YzXgi3p27sxkqxt757dni9rNofvdkWfLWgb8V1Ydm7MTvSmiGn/ytuDgAyG9+Uar+MukPxrmTtj5dhhxue+1DRdLeHwztvdL98D8lxZoxP2GcWRP3eiQgADs=";if(!isOpen){return null}return/*#__PURE__*/_jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.3)"},children:/*#__PURE__*/_jsx("div",{className:"bg-white rounded-[16px] shadow-[0px_8px_16px_-4px_rgba(0,0,0,0.1)] w-[481px] h-[258px] flex items-center justify-center p-6",children:/*#__PURE__*/_jsxs("div",{className:"flex flex-col items-center space-y-4",children:[/*#__PURE__*/_jsx("img",{src:thinkingGifBase64,alt:"Thinking...",className:"w-6 h-6"}),/*#__PURE__*/_jsx("h3",{className:"text-xl font-semibold text-[#020D21]",children:"Thinking..."}),/*#__PURE__*/_jsx("p",{className:"text-base font-medium text-[#687387]",children:"Generating query for this component"})]})})})}
1
+ import React,{useEffect}from"react";import{X}from"lucide-react";import thinking from"../../shadcn/components/icons/thinking.gif";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function QueryLoadingModal(_ref){var isOpen=_ref.isOpen,onClose=_ref.onClose;useEffect(function(){function handleEscapeKey(event){if(event.key==="Escape"&&isOpen){onClose()}}if(isOpen){document.addEventListener("keydown",handleEscapeKey);document.body.style.overflow="hidden"}return function(){document.removeEventListener("keydown",handleEscapeKey);document.body.style.overflow="unset"}},[isOpen,onClose]);function handleBackdropClick(event){if(event.target===event.currentTarget){onClose()}}if(!isOpen){return null}return/*#__PURE__*/_jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.3)"},onClick:handleBackdropClick,children:/*#__PURE__*/_jsxs("div",{className:"relative bg-white rounded-[16px] shadow-[0px_8px_16px_-4px_rgba(0,0,0,0.1)] w-[481px] h-[258px] flex items-center justify-center p-6",onClick:function onClick(e){return e.stopPropagation()},children:[/*#__PURE__*/_jsx("button",{onClick:onClose,className:"absolute top-4 right-4 transition-colors duration-200 hover:bg-gray-100 rounded p-1 flex items-center justify-center",type:"button","aria-label":"Close modal",style:{width:"24px",height:"24px"},children:/*#__PURE__*/_jsx(X,{size:12,className:"text-gray-600",style:{opacity:1,transform:"rotate(0deg)"}})}),/*#__PURE__*/_jsxs("div",{className:"flex flex-col items-center space-y-4",children:[/*#__PURE__*/_jsx("div",{className:"flex flex-col justify-center items-center",style:{margin:"16px",gap:"16px"},children:/*#__PURE__*/_jsx("img",{src:thinking,alt:"Thinking...",style:{width:"24px",height:"24px"}})}),/*#__PURE__*/_jsx("h3",{className:"text-xl font-semibold text-[#020D21]",children:"Thinking..."}),/*#__PURE__*/_jsx("p",{className:"text-base font-medium text-[#687387]",children:"Generating query for this component"})]})]})})}
2
2
  //# sourceMappingURL=query-loading-modal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-loading-modal.js","names":["React","jsx","_jsx","jsxs","_jsxs","QueryLoadingModal","_ref","isOpen","thinkingGifBase64","className","style","backgroundColor","children","src","alt"],"sources":["../../../src/plugins/helpers/query-loading-modal.tsx"],"sourcesContent":["import React from 'react';\n\ntype QueryLoadingModalProps = {\n isOpen: boolean;\n}\n\nexport function QueryLoadingModal({ isOpen }: QueryLoadingModalProps) {\n const thinkingGifBase64 = \"data:image/gif;base64,R0lGODlhBAEEAfQAAIlD8ZFP8phb859n9KBm9Kdy9a5+9raK97yV972W+MOh98Sh+cus+dO4+trE+uLQ++nc/PDn/fDo/ff0/vjz/v///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJIwAVACwAAAAABAEEAQAI/gArCBxIsKDBgwgTFnxwQAAAAAEKNJCgsKLFixgzatzIsaPHjyBDcnzg8KHJhwIWiFzJsqXLlzBjtlxwsqbJAhNk6tzJs6dPnzRtCi3ws6jRo0iTShDKFIDKpFCjSp2qkUBToQEoUt3KtevRBleZHvBKtqxZliXD2nxwtq3btwjBqh0Kt67dshPSzq3J9q7fv0mD7rU5ALDhwzslBBjMtAHix5BFHmDMNEDOyJgzW1xKmelTzaBDC5zcGetl0aghPyjd9HPq14D1sq6pFbbtunJn073N261s3Sf79h7eNTdwm0SJK58q4fdxk8KXSzcq+LlNAdOz/+RsnSkD7eB1/pLubjq8+ZbcyQt1fb59x/HqbVp2T3/j6vhNE9Tff9E5fpO18ScgQcb9h9yACArUnIFXRZdgfQUweFVWD9Y3QYQSXiUABBW214B/Gda0QIAdLvcAhiHOJYBjJSoHAYopDrZii7xNAF+MlAngII2aTbDAYjjqdgCJPEL2Y5DWDVmkaiAiyd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HwztvdL98D8lxZoxP2GcWRP3eiQgADs=\";\n\n if (!isOpen) {\n return null;\n }\n\n return (\n <div\n className=\"fixed inset-0 z-[9999] flex items-center justify-center p-4\"\n style={{ backgroundColor: 'rgba(0, 0, 0, 0.3)' }}\n >\n <div className=\"bg-white rounded-[16px] shadow-[0px_8px_16px_-4px_rgba(0,0,0,0.1)] w-[481px] h-[258px] flex items-center justify-center p-6\">\n <div className=\"flex flex-col items-center space-y-4\">\n <img \n src={thinkingGifBase64}\n alt=\"Thinking...\"\n className=\"w-6 h-6\"\n />\n <h3 className=\"text-xl font-semibold text-[#020D21]\">\n Thinking...\n </h3>\n <p className=\"text-base font-medium text-[#687387]\">\n Generating query for this component\n </p>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":"AAAA,MAAO,CAAAA,KAAK,KAAM,OAAO,CAAC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBAM1B,MAAO,SAAS,CAAAC,iBAAiBA,CAAAC,IAAA,CAAqC,IAAlC,CAAAC,MAAM,CAAAD,IAAA,CAANC,MAAM,CACxC,GAAM,CAAAC,iBAAiB,CAAG,ojMAAojM,CAE9kM,GAAI,CAACD,MAAM,CAAE,CACX,MAAO,KACT,CAEA,mBACEL,IAAA,QACEO,SAAS,CAAC,6DAA6D,CACvEC,KAAK,CAAE,CAAEC,eAAe,CAAE,oBAAqB,CAAE,CAAAC,QAAA,cAEjDV,IAAA,QAAKO,SAAS,CAAC,6HAA6H,CAAAG,QAAA,cAC1IR,KAAA,QAAKK,SAAS,CAAC,sCAAsC,CAAAG,QAAA,eACnDV,IAAA,QACEW,GAAG,CAAEL,iBAAkB,CACvBM,GAAG,CAAC,aAAa,CACjBL,SAAS,CAAC,SAAS,CACpB,CAAC,cACFP,IAAA,OAAIO,SAAS,CAAC,sCAAsC,CAAAG,QAAA,CAAC,aAErD,CAAI,CAAC,cACLV,IAAA,MAAGO,SAAS,CAAC,sCAAsC,CAAAG,QAAA,CAAC,qCAEpD,CAAG,CAAC,EACD,CAAC,CACH,CAAC,CACH,CAET","ignoreList":[]}
1
+ {"version":3,"file":"query-loading-modal.js","names":["React","useEffect","X","thinking","jsx","_jsx","jsxs","_jsxs","QueryLoadingModal","_ref","isOpen","onClose","handleEscapeKey","event","key","document","addEventListener","body","style","overflow","removeEventListener","handleBackdropClick","target","currentTarget","className","backgroundColor","onClick","children","e","stopPropagation","type","width","height","size","opacity","transform","margin","gap","src","alt"],"sources":["../../../src/plugins/helpers/query-loading-modal.tsx"],"sourcesContent":[" import React, { useEffect } from 'react';\nimport { X } from 'lucide-react';\nimport thinking from '../../shadcn/components/icons/thinking.gif';\n\ntype QueryLoadingModalProps = {\n isOpen: boolean;\n onClose: () => void;\n}\n\nexport function QueryLoadingModal({ isOpen, onClose }: QueryLoadingModalProps) {\n \n\n useEffect(() => {\n function handleEscapeKey(event: KeyboardEvent) {\n if (event.key === 'Escape' && isOpen) {\n onClose();\n }\n }\n\n if (isOpen) {\n document.addEventListener('keydown', handleEscapeKey);\n document.body.style.overflow = 'hidden';\n }\n\n return () => {\n document.removeEventListener('keydown', handleEscapeKey);\n document.body.style.overflow = 'unset';\n };\n }, [isOpen, onClose]);\n\n function handleBackdropClick(event: React.MouseEvent<HTMLDivElement>) {\n if (event.target === event.currentTarget) {\n onClose();\n }\n }\n\n if (!isOpen) {\n return null;\n }\n\n return (\n <div\n className=\"fixed inset-0 z-[9999] flex items-center justify-center p-4\"\n style={{ backgroundColor: 'rgba(0, 0, 0, 0.3)' }}\n onClick={handleBackdropClick}\n >\n <div \n className=\"relative bg-white rounded-[16px] shadow-[0px_8px_16px_-4px_rgba(0,0,0,0.1)] w-[481px] h-[258px] flex items-center justify-center p-6\"\n onClick={(e) => e.stopPropagation()}\n >\n <button\n onClick={onClose}\n className=\"absolute top-4 right-4 transition-colors duration-200 hover:bg-gray-100 rounded p-1 flex items-center justify-center\"\n type=\"button\"\n aria-label=\"Close modal\"\n style={{\n width: '24px',\n height: '24px'\n }}\n >\n <X \n size={12}\n className=\"text-gray-600\"\n style={{ \n opacity: 1,\n transform: 'rotate(0deg)'\n }}\n />\n </button>\n <div className=\"flex flex-col items-center space-y-4\">\n <div \n className=\"flex flex-col justify-center items-center\"\n style={{ margin: '16px', gap: '16px' }}\n >\n <img \n src={thinking}\n alt=\"Thinking...\"\n style={{\n width: '24px',\n height: '24px'\n }}\n />\n </div>\n <h3 className=\"text-xl font-semibold text-[#020D21]\">\n Thinking...\n </h3>\n <p className=\"text-base font-medium text-[#687387]\">\n Generating query for this component\n </p>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":"AAAC,MAAO,CAAAA,KAAK,EAAIC,SAAS,KAAQ,OAAO,CACzC,OAASC,CAAC,KAAQ,cAAc,CAChC,MAAO,CAAAC,QAAQ,KAAM,4CAA4C,CAAC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBAOlE,MAAO,SAAS,CAAAC,iBAAiBA,CAAAC,IAAA,CAA8C,IAA3C,CAAAC,MAAM,CAAAD,IAAA,CAANC,MAAM,CAAEC,OAAO,CAAAF,IAAA,CAAPE,OAAO,CAGjDV,SAAS,CAAC,UAAM,CACd,QAAS,CAAAW,eAAeA,CAACC,KAAoB,CAAE,CAC7C,GAAIA,KAAK,CAACC,GAAG,GAAK,QAAQ,EAAIJ,MAAM,CAAE,CACpCC,OAAO,CAAC,CACV,CACF,CAEA,GAAID,MAAM,CAAE,CACVK,QAAQ,CAACC,gBAAgB,CAAC,SAAS,CAAEJ,eAAe,CAAC,CACrDG,QAAQ,CAACE,IAAI,CAACC,KAAK,CAACC,QAAQ,CAAG,QACjC,CAEA,MAAO,WAAM,CACXJ,QAAQ,CAACK,mBAAmB,CAAC,SAAS,CAAER,eAAe,CAAC,CACxDG,QAAQ,CAACE,IAAI,CAACC,KAAK,CAACC,QAAQ,CAAG,OACjC,CACF,CAAC,CAAE,CAACT,MAAM,CAAEC,OAAO,CAAC,CAAC,CAErB,QAAS,CAAAU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,CAAAG,QAAA,CAAC,aAErD,CAAI,CAAC,cACLtB,IAAA,MAAGmB,SAAS,CAAC,sCAAsC,CAAAG,QAAA,CAAC,qCAEpD,CAAG,CAAC,EACD,CAAC,EACH,CAAC,CACH,CAET","ignoreList":[]}
@@ -3,8 +3,8 @@ import*as domutil from"recharts/lib/util/DOMUtils";import{TooltipButton}from"../
3
3
  // REMEMBER TO UDPATE THIS WHEN recharts IS UPGRADED
4
4
  // @ts-ignore
5
5
  import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";domutil.getOffset=function(el){var html=el.ownerDocument.documentElement;var box={top:0,left:0};if(typeof el.getBoundingClientRect!=="undefined"){box=el.getBoundingClientRect()}var iframe=document.querySelector(".gjs-frame");var iframeWindow=iframe==null?void 0:iframe.contentWindow;return{top:box.top+iframeWindow.pageYOffset-html.clientTop,left:box.left+iframeWindow.pageXOffset-html.clientLeft}};var baseColors=[[theme.colors.Blue_100,theme.colors.Blue_30],[theme.colors.Purpley_100,theme.colors.Purpley_30],[theme.colors.Light_Bluish_Green,"#06601b"],[theme.colors.Wild_Strawberry,"#4d001c"]];var iconMap={TrendingUp:/*#__PURE__*/_jsx(TrendingUp,{}),TrendingDown:/*#__PURE__*/_jsx(TrendingDown,{}),ShoppingCart:/*#__PURE__*/_jsx(ShoppingCart,{}),Equalizer:/*#__PURE__*/_jsx(ChartBarBig,{}),Style:/*#__PURE__*/_jsx(Tag,{}),Place:/*#__PURE__*/_jsx(MapPin,{})};function getIconFromString(iconString){if(!iconString){return null}if(iconMap[iconString]){return iconMap[iconString]}var lowerIconString=iconString.toLowerCase();var matchingKey=Object.keys(iconMap).find(function(key){return key.toLowerCase()===lowerIconString});if(matchingKey){return iconMap[matchingKey]}return null}function getNColors(n){var colors=[];var safeBaseColors=Array.isArray(baseColors)?baseColors:[];for(var _iterator=_createForOfIteratorHelperLoose(safeBaseColors),_step;!(_step=_iterator()).done;){var baseColor=_step.value;// eslint-disable-next-line import/no-named-as-default-member
6
- colors.push(chroma.scale(baseColor).mode("lab").colors(n))}function getOneColor(existing){var color=null;do{var base=colors[Math.floor(Math.random()*colors.length)];var selectedColorIndex=Math.floor(Math.random()*base.length);color=base[selectedColorIndex]}while(existing.includes(color));return color}var selectedColors=[];for(var i=0;i<n;i++){selectedColors.push(getOneColor(selectedColors))}return selectedColors}/* TODO: Loader remains */export function renderActionCard(props){var gjsModel=props.gjsModel,rest=_objectWithoutPropertiesLoose(props,_excluded);var _useState=useState(_extends({},filterPlaceholders(gjsModel.get("componentProps")),filterPlaceholders(props))),allData=_useState[0],setAllData=_useState[1];var _allData$headerConten=allData.headerContent,headerContent=_allData$headerConten===void 0?"Default action card title":_allData$headerConten,icon=allData.icon,_allData$bodyContent=allData.bodyContent,bodyContent=_allData$bodyContent===void 0?"Default body content. Click to edit.":_allData$bodyContent;var _useState2=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState2[0],setAttributes=_useState2[1];useEffect(function(){gjsModel.on("change:componentProps",function(){setAllData(function(prevData){return _extends({},prevData,filterPlaceholders(gjsModel.get("componentProps")))})})},[]);useEffect(function(){gjsModel.on("change:attributes",function(){setAttributes(_extends({},gjsModel.get("attributes")))})},[]);var defaultClasses="text-black p-4 rounded-lg shadow border flex flex-col h-full";return/*#__PURE__*/_jsx(Card,_extends({className:defaultClasses+" relative",style:{backgroundColor:"#f9f9fe"},isEditable:false,contentEditable:false},rest,{children:/*#__PURE__*/_jsx(CardContent,{className:"p-0",isEditable:false,contentEditable:false,children:/*#__PURE__*/_jsx("div",{className:"px-4 py-3",children:/*#__PURE__*/_jsxs("div",{className:"flex items-start flex-col",children:[/*#__PURE__*/_jsxs("div",{className:"flex items-center justify-between w-full",children:[/*#__PURE__*/_jsx("div",{className:"text-xl font-semibold",children:headerContent}),/*#__PURE__*/_jsx("div",{className:"text-5xl ml-2 flex items-center","aria-hidden":"true",children:getIconFromString(icon)})]}),/*#__PURE__*/_jsx("div",{className:"w-full mt-1",children:attributes.error||allData.error||attributes.isMissing||allData.isMissing||!bodyContent?/*#__PURE__*/_jsxs("span",{className:"flex flex-row items-center px-3 py-2",children:[/*#__PURE__*/_jsx(CircleAlert,{className:"w-3 h-3 text-gray-400 mr-1"}),/*#__PURE__*/_jsx("p",{className:"text-sm text-gray-500 max-w-md text-center",children:"No data available for given filters"})]}):/*#__PURE__*/_jsx("div",{className:"text-base leading-relaxed",children:bodyContent})})]})})})}))}export function renderCard(props){var _attributes$error,_attributes$isMissing;var _props$isEditable=props.isEditable,isEditable=_props$isEditable===void 0?false:_props$isEditable,gjsModel=props.gjsModel,_props$performInterac=props.performInteraction,performInteraction=_props$performInterac===void 0?function(){return Promise.resolve({})}:_props$performInterac,rest=_objectWithoutPropertiesLoose(props,_excluded2);var _useState3=useState(_extends({},filterPlaceholders(gjsModel.get("componentProps")),filterPlaceholders(props))),allData=_useState3[0],setAllData=_useState3[1];var headerContent=allData.headerContent,headerDescription=allData.headerDescription,bodyContent=allData.bodyContent,footerContent=allData.footerContent,footerClass=allData.footerClass,footerIcon=allData.footerIcon,contentMetadata=allData.contentMetadata,contentMetadataClass=allData.contentMetadataClass,dataClassName=allData.className,dataError=allData.error,dataIsMissing=allData.isMissing;function toSafeText(value){if(value===null){return""}return typeof value==="string"?value:JSON.stringify(value)}var safeHeaderContent=toSafeText(headerContent);var safeHeaderDescription=toSafeText(headerDescription);var safeBodyContent=toSafeText(bodyContent);var safeFooterContent=toSafeText(footerContent);var safeContentMetadata=toSafeText(contentMetadata);var _useState4=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState4[0],setAttributes=_useState4[1];useEffect(function(){gjsModel.on("change:componentProps",function(){setAllData(function(prevData){return _extends({},prevData,filterPlaceholders(gjsModel.get("componentProps")))})})},[]);useEffect(function(){gjsModel.on("change:attributes",function(){setAttributes(_extends({},gjsModel.get("attributes")))})},[]);var defaultClasses="bg-white text-black p-4 rounded-lg border flex flex-col h-full shadow-none";var defaultFooterClasses=safeFooterContent?"text-sm bg-pink-50 text-pink-900 shadow-sm":"text-sm";var defaultContentMetadataClasses="text-xs";var mergedCardClassName=dataClassName?cn(defaultClasses,dataClassName):defaultClasses;var mergedFooterClassName=footerClass?cn(defaultFooterClasses,footerClass):defaultFooterClasses;var mergedContentMetadataClassName=contentMetadataClass?cn(defaultContentMetadataClasses,contentMetadataClass):defaultContentMetadataClasses;var hasError=Boolean((_attributes$error=attributes==null?void 0:attributes.error)!=null?_attributes$error:dataError);var hasMissing=Boolean((_attributes$isMissing=attributes==null?void 0:attributes.isMissing)!=null?_attributes$isMissing:dataIsMissing);var isLoading=Boolean(((attributes==null?void 0:attributes.interactionApiInProgress)||(attributes==null?void 0:attributes.loading))&&!hasError&&!hasMissing);var footerIconText=typeof footerIcon==="string"?footerIcon:footerIcon&&typeof footerIcon==="object"&&"icon"in footerIcon?String(footerIcon.icon):"";function getCardContent(){if(isLoading){return/*#__PURE__*/_jsx(CardContent,{children:/*#__PURE__*/_jsx(CardLoader,{})})}var showEmpty=hasError||hasMissing||!safeBodyContent;return/*#__PURE__*/_jsxs(React.Fragment,{children:[/*#__PURE__*/_jsx(CardHeader,{children:/*#__PURE__*/_jsx("div",{className:"flex items-start justify-between",children:/*#__PURE__*/_jsxs("div",{className:"flex-1",children:[/*#__PURE__*/_jsx(CardTitle,{"data-slot":"headerContent",contentEditable:isEditable,className:"text-lg",children:safeHeaderContent}),/*#__PURE__*/_jsx(CardDescription,{"data-slot":"headerDescription",contentEditable:isEditable,className:"text-sm",children:safeHeaderDescription})]})})}),showEmpty?/*#__PURE__*/_jsxs("span",{className:"flex flex-row items-center px-3 py-2",children:[/*#__PURE__*/_jsx(CircleAlert,{className:"w-3 h-3 text-gray-400 mr-1"}),/*#__PURE__*/_jsx("p",{className:"text-sm text-gray-500 max-w-md text-center",children:"No data available for given filters"})]}):/*#__PURE__*/_jsxs(CardContent,{"data-slot":"bodyContent",contentEditable:false,className:"flex-grow",children:[/*#__PURE__*/_jsx("div",{className:"text-3xl font-semibold truncate",children:safeBodyContent}),safeContentMetadata&&/*#__PURE__*/_jsx("div",{className:mergedContentMetadataClassName,style:{color:"#2A44D4"},children:safeContentMetadata})]}),/*#__PURE__*/_jsxs(CardFooter,{"data-slot":"footerContent",contentEditable:isEditable,className:cn(mergedFooterClassName),children:[(footerIconText||"").trim()&&/*#__PURE__*/_jsx("span",{className:"mr-2","aria-hidden":"true",children:footerIconText}),safeFooterContent||""]})]})}return/*#__PURE__*/_jsxs(Card,_extends({},rest,{className:mergedCardClassName+" relative",children:[getCardContent(),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:performInteraction,position:"top-right",isVisible:isEditable})]}))}function renderChartComponent(chartType,data,config){var safeData=Array.isArray(data)?data:[];if(safeData.length===0){return renderNoDataFallback()}switch(chartType){case"pie":return/*#__PURE__*/_jsxs(PieChart,{children:[safeData.length>=20&&/*#__PURE__*/_jsx(ChartTooltip,{cursor:false,content:/*#__PURE__*/_jsx(ChartTooltipContent,{hideLabel:true})}),/*#__PURE__*/_jsx(Pie,{data:safeData,dataKey:config.dataKey,nameKey:config.nameKey,innerRadius:60,strokeWidth:10,label:safeData.length<20?function(_ref){var name=_ref.name,percent=_ref.percent;return name+": "+(percent*100).toFixed(0)+"%"}:undefined,labelLine:false})]});case"bar":{config.dataKeys=config.dataKeys||[];var barDataKeys=Array.isArray(config.dataKeys)?config.dataKeys:[];return/*#__PURE__*/_jsxs(BarChart,_extends({data:safeData},config.chartUi,{children:[/*#__PURE__*/_jsx(CartesianGrid,{vertical:false}),/*#__PURE__*/_jsx(XAxis,{dataKey:config.xAxis}),/*#__PURE__*/_jsx(YAxis,{}),/*#__PURE__*/_jsx(Legend,{align:"left",wrapperStyle:{marginLeft:20}}),barDataKeys.map(function(_ref2){var key=_ref2.key,name=_ref2.name,color=_ref2.color;return/*#__PURE__*/_jsx(Bar,{dataKey:key,fill:color!=null?color:"#4caf50",name:name,radius:2},key)}),/*#__PURE__*/_jsx(ChartTooltip,{cursor:false,content:/*#__PURE__*/_jsx(ChartTooltipContent,{indicator:"dashed"})})]}))}case"line":{config.dataKeys=config.dataKeys||[];var safeDataKeysLine=Array.isArray(config.dataKeys)?config.dataKeys:[];return/*#__PURE__*/_jsxs(LineChart,_extends({data:safeData},config.chartUi,{children:[/*#__PURE__*/_jsx(CartesianGrid,{vertical:false}),/*#__PURE__*/_jsx(XAxis,{dataKey:config.xAxis}),/*#__PURE__*/_jsx(YAxis,{}),/*#__PURE__*/_jsx(ChartTooltip,{cursor:false,content:/*#__PURE__*/_jsx(ChartTooltipContent,{indicator:"dashed"})}),safeDataKeysLine.map(function(_ref3){var key=_ref3.key,name=_ref3.name,color=_ref3.color;return/*#__PURE__*/_jsx(Line,{type:"monotone",dataKey:key,stroke:color!=null?color:"#4caf50",name:name},key)}),/*#__PURE__*/_jsx(Legend,{align:"left"})]}))}default:return/*#__PURE__*/_jsxs(PieChart,{children:[safeData.length>=20&&/*#__PURE__*/_jsx(ChartTooltip,{cursor:false,content:/*#__PURE__*/_jsx(ChartTooltipContent,{hideLabel:true})}),/*#__PURE__*/_jsx(Pie,{data:safeData,dataKey:config.dataKey,nameKey:config.nameKey,innerRadius:60,strokeWidth:10,label:safeData.length<20?function(_ref4){var name=_ref4.name,percent=_ref4.percent;return name+": "+(percent*100).toFixed(0)+"%"}:undefined,labelLine:false})]})}}export function renderChart(props){var _props$isEditable2=props.isEditable,isEditable=_props$isEditable2===void 0?false:_props$isEditable2,gjsModel=props.gjsModel,_props$performInterac2=props.performInteraction,performInteraction=_props$performInterac2===void 0?function(){return Promise.resolve({})}:_props$performInterac2,rest=_objectWithoutPropertiesLoose(props,_excluded3);var _useState5=useState(_extends({},filterPlaceholders(gjsModel.get("componentProps")),filterPlaceholders(props))),allData=_useState5[0],setAllData=_useState5[1];var _useState6=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState6[0],setAttributes=_useState6[1];var containerRef=useRef(null);var _useState7=useState(0),containerWidth=_useState7[0],setContainerWidth=_useState7[1];useEffect(function(){var handlePropsChange=function handlePropsChange(){var newProps=filterPlaceholders(gjsModel.get("componentProps"));setAllData(function(prevData){return _extends({},prevData,newProps)})};gjsModel.on("change:componentProps",handlePropsChange);return function(){gjsModel.off("change:componentProps",handlePropsChange)}},[gjsModel]);useEffect(function(){var handleAttributesChange=function handleAttributesChange(){var newAttributes=gjsModel.get("attributes");setAttributes(_extends({},newAttributes))};gjsModel.on("change:attributes",handleAttributesChange);return function(){gjsModel.off("change:attributes",handleAttributesChange)}},[gjsModel]);useEffect(function(){var updateContainerWidth=function updateContainerWidth(){if(containerRef.current){setContainerWidth(containerRef.current.offsetWidth)}};updateContainerWidth();window.addEventListener("resize",updateContainerWidth);return function(){return window.removeEventListener("resize",updateContainerWidth)}},[]);var _allData$config=allData.config,config=_allData$config===void 0?{}:_allData$config,_allData$chartType=allData.chartType,chartType=_allData$chartType===void 0?"pie":_allData$chartType,_allData$chartData=allData.chartData,chartData=_allData$chartData===void 0?[]:_allData$chartData,className=allData.className,_allData$title=allData.title,title=_allData$title===void 0?"Title":_allData$title,_allData$subTitle=allData.subTitle,subTitle=_allData$subTitle===void 0?"Subtitle":_allData$subTitle;var defaultClasses="aspect-auto h-[250px] w-full";var mergedClasses=className?cn(defaultClasses,className):defaultClasses;if(chartType==="pie"){var safeChartData=Array.isArray(chartData)?chartData:[];var colors=getNColors(safeChartData.length);for(var i=0;i<safeChartData.length;i++){var data=safeChartData[i];if(!data.fill){data.fill=colors[i]}}}else if(!config.color){var safeBaseColors=Array.isArray(baseColors)?baseColors:[];if(safeBaseColors.length>0){config.color=safeBaseColors[Math.floor(Math.random()*safeBaseColors.length)]}}var width=undefined;var totalDataPoints=0;// Helper function to get responsive config
6
+ colors.push(chroma.scale(baseColor).mode("lab").colors(n))}function getOneColor(existing){var color=null;do{var base=colors[Math.floor(Math.random()*colors.length)];var selectedColorIndex=Math.floor(Math.random()*base.length);color=base[selectedColorIndex]}while(existing.includes(color));return color}var selectedColors=[];for(var i=0;i<n;i++){selectedColors.push(getOneColor(selectedColors))}return selectedColors}/* TODO: Loader remains */export function renderActionCard(props){var gjsModel=props.gjsModel,rest=_objectWithoutPropertiesLoose(props,_excluded);var _useState=useState(_extends({},filterPlaceholders(gjsModel.get("componentProps")),filterPlaceholders(props))),allData=_useState[0],setAllData=_useState[1];var _allData$headerConten=allData.headerContent,headerContent=_allData$headerConten===void 0?"Default action card title":_allData$headerConten,icon=allData.icon,_allData$bodyContent=allData.bodyContent,bodyContent=_allData$bodyContent===void 0?"Default body content. Click to edit.":_allData$bodyContent;var _useState2=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState2[0],setAttributes=_useState2[1];useEffect(function(){gjsModel.on("change:componentProps",function(){setAllData(function(prevData){return _extends({},prevData,filterPlaceholders(gjsModel.get("componentProps")))})})},[]);useEffect(function(){gjsModel.on("change:attributes",function(){setAttributes(_extends({},gjsModel.get("attributes")))})},[]);var defaultClasses="text-black p-4 rounded-lg shadow border flex flex-col h-full";return/*#__PURE__*/_jsx(Card,_extends({className:defaultClasses+" relative",style:{backgroundColor:"#f9f9fe"},isEditable:false,contentEditable:false},rest,{children:/*#__PURE__*/_jsx(CardContent,{className:"p-0",isEditable:false,contentEditable:false,children:/*#__PURE__*/_jsx("div",{className:"px-4 py-3",children:/*#__PURE__*/_jsxs("div",{className:"flex items-start flex-col",children:[/*#__PURE__*/_jsxs("div",{className:"flex items-center justify-between w-full",children:[/*#__PURE__*/_jsx("div",{className:"text-xl font-semibold",children:headerContent}),/*#__PURE__*/_jsx("div",{className:"text-5xl ml-2 flex items-center","aria-hidden":"true",children:getIconFromString(icon)})]}),/*#__PURE__*/_jsx("div",{className:"w-full mt-1",children:attributes.error||allData.error||attributes.isMissing||allData.isMissing||!bodyContent?/*#__PURE__*/_jsxs("span",{className:"flex flex-row items-center px-3 py-2",children:[/*#__PURE__*/_jsx(CircleAlert,{className:"w-3 h-3 text-gray-400 mr-1"}),/*#__PURE__*/_jsx("p",{className:"text-sm text-gray-500 max-w-md text-center",children:"No data available for given filters"})]}):/*#__PURE__*/_jsx("div",{className:"text-base leading-relaxed",children:bodyContent})})]})})})}))}export function renderCard(props){var _attributes$error,_attributes$isMissing;var _props$isEditable=props.isEditable,isEditable=_props$isEditable===void 0?false:_props$isEditable,gjsModel=props.gjsModel,_props$performInterac=props.performInteraction,performInteraction=_props$performInterac===void 0?function(){return Promise.resolve({})}:_props$performInterac,rest=_objectWithoutPropertiesLoose(props,_excluded2);var _useState3=useState(_extends({},filterPlaceholders(gjsModel.get("componentProps")),filterPlaceholders(props))),allData=_useState3[0],setAllData=_useState3[1];var headerContent=allData.headerContent,headerDescription=allData.headerDescription,bodyContent=allData.bodyContent,footerContent=allData.footerContent,footerClass=allData.footerClass,footerIcon=allData.footerIcon,contentMetadata=allData.contentMetadata,contentMetadataClass=allData.contentMetadataClass,dataClassName=allData.className,dataError=allData.error,dataIsMissing=allData.isMissing;function toSafeText(value){if(value===null){return""}return typeof value==="string"?value:JSON.stringify(value)}var safeHeaderContent=toSafeText(headerContent);var safeHeaderDescription=toSafeText(headerDescription);var safeBodyContent=toSafeText(bodyContent);var safeFooterContent=toSafeText(footerContent);var safeContentMetadata=toSafeText(contentMetadata);var _useState4=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState4[0],setAttributes=_useState4[1];useEffect(function(){gjsModel.on("change:componentProps",function(){setAllData(function(prevData){return _extends({},prevData,filterPlaceholders(gjsModel.get("componentProps")))})})},[]);useEffect(function(){gjsModel.on("change:attributes",function(){setAttributes(_extends({},gjsModel.get("attributes")))})},[]);var defaultClasses="bg-white text-black p-4 rounded-lg border flex flex-col h-full shadow-none";var defaultFooterClasses=safeFooterContent?"text-sm bg-pink-50 text-pink-900 shadow-sm":"text-sm";var defaultContentMetadataClasses="text-xs";var mergedCardClassName=dataClassName?cn(defaultClasses,dataClassName):defaultClasses;var mergedFooterClassName=footerClass?cn(defaultFooterClasses,footerClass):defaultFooterClasses;var mergedContentMetadataClassName=contentMetadataClass?cn(defaultContentMetadataClasses,contentMetadataClass):defaultContentMetadataClasses;var hasError=Boolean((_attributes$error=attributes==null?void 0:attributes.error)!=null?_attributes$error:dataError);var hasMissing=Boolean((_attributes$isMissing=attributes==null?void 0:attributes.isMissing)!=null?_attributes$isMissing:dataIsMissing);var isLoading=Boolean(((attributes==null?void 0:attributes.interactionApiInProgress)||(attributes==null?void 0:attributes.loading))&&!hasError&&!hasMissing);var footerIconText=typeof footerIcon==="string"?footerIcon:footerIcon&&typeof footerIcon==="object"&&"icon"in footerIcon?String(footerIcon.icon):"";function getCardContent(){if(isLoading){return/*#__PURE__*/_jsx(CardContent,{children:/*#__PURE__*/_jsx(CardLoader,{})})}var showEmpty=hasError||hasMissing||!safeBodyContent;return/*#__PURE__*/_jsxs(React.Fragment,{children:[/*#__PURE__*/_jsx(CardHeader,{children:/*#__PURE__*/_jsx("div",{className:"flex items-start justify-between",children:/*#__PURE__*/_jsxs("div",{className:"flex-1",children:[/*#__PURE__*/_jsx(CardTitle,{"data-slot":"headerContent",contentEditable:isEditable,className:"text-lg",children:safeHeaderContent}),/*#__PURE__*/_jsx(CardDescription,{"data-slot":"headerDescription",contentEditable:isEditable,className:"text-sm",children:safeHeaderDescription})]})})}),showEmpty?/*#__PURE__*/_jsxs("span",{className:"flex flex-row items-center px-3 py-2",children:[/*#__PURE__*/_jsx(CircleAlert,{className:"w-3 h-3 text-gray-400 mr-1"}),/*#__PURE__*/_jsx("p",{className:"text-sm text-gray-500 max-w-md text-center",children:"No data available for given filters"})]}):/*#__PURE__*/_jsxs(CardContent,{"data-slot":"bodyContent",contentEditable:false,className:"flex-grow",children:[/*#__PURE__*/_jsx("div",{className:"text-3xl font-semibold truncate",children:safeBodyContent}),safeContentMetadata&&/*#__PURE__*/_jsx("div",{className:mergedContentMetadataClassName,style:{color:"#2A44D4"},children:safeContentMetadata})]}),/*#__PURE__*/_jsxs(CardFooter,{"data-slot":"footerContent",contentEditable:isEditable,className:cn(mergedFooterClassName),children:[(footerIconText||"").trim()&&/*#__PURE__*/_jsx("span",{className:"mr-2","aria-hidden":"true",children:footerIconText}),safeFooterContent||""]})]})}return/*#__PURE__*/_jsxs(Card,_extends({},rest,{className:mergedCardClassName+" relative",children:[getCardContent(),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:performInteraction,position:"top-right",isVisible:isEditable,componentProps:allData})]}))}function renderChartComponent(chartType,data,config){var safeData=Array.isArray(data)?data:[];if(safeData.length===0){return renderNoDataFallback()}switch(chartType){case"pie":return/*#__PURE__*/_jsxs(PieChart,{children:[safeData.length>=20&&/*#__PURE__*/_jsx(ChartTooltip,{cursor:false,content:/*#__PURE__*/_jsx(ChartTooltipContent,{hideLabel:true})}),/*#__PURE__*/_jsx(Pie,{data:safeData,dataKey:config.dataKey,nameKey:config.nameKey,innerRadius:60,strokeWidth:10,label:safeData.length<20?function(_ref){var name=_ref.name,percent=_ref.percent;return name+": "+(percent*100).toFixed(0)+"%"}:undefined,labelLine:false})]});case"bar":{config.dataKeys=config.dataKeys||[];var barDataKeys=Array.isArray(config.dataKeys)?config.dataKeys:[];return/*#__PURE__*/_jsxs(BarChart,_extends({data:safeData},config.chartUi,{children:[/*#__PURE__*/_jsx(CartesianGrid,{vertical:false}),/*#__PURE__*/_jsx(XAxis,{dataKey:config.xAxis}),/*#__PURE__*/_jsx(YAxis,{}),/*#__PURE__*/_jsx(Legend,{align:"left",wrapperStyle:{marginLeft:20}}),barDataKeys.map(function(_ref2){var key=_ref2.key,name=_ref2.name,color=_ref2.color;return/*#__PURE__*/_jsx(Bar,{dataKey:key,fill:color!=null?color:"#4caf50",name:name,radius:2},key)}),/*#__PURE__*/_jsx(ChartTooltip,{cursor:false,content:/*#__PURE__*/_jsx(ChartTooltipContent,{indicator:"dashed"})})]}))}case"line":{config.dataKeys=config.dataKeys||[];var safeDataKeysLine=Array.isArray(config.dataKeys)?config.dataKeys:[];return/*#__PURE__*/_jsxs(LineChart,_extends({data:safeData},config.chartUi,{children:[/*#__PURE__*/_jsx(CartesianGrid,{vertical:false}),/*#__PURE__*/_jsx(XAxis,{dataKey:config.xAxis}),/*#__PURE__*/_jsx(YAxis,{}),/*#__PURE__*/_jsx(ChartTooltip,{cursor:false,content:/*#__PURE__*/_jsx(ChartTooltipContent,{indicator:"dashed"})}),safeDataKeysLine.map(function(_ref3){var key=_ref3.key,name=_ref3.name,color=_ref3.color;return/*#__PURE__*/_jsx(Line,{type:"monotone",dataKey:key,stroke:color!=null?color:"#4caf50",name:name},key)}),/*#__PURE__*/_jsx(Legend,{align:"left"})]}))}default:return/*#__PURE__*/_jsxs(PieChart,{children:[safeData.length>=20&&/*#__PURE__*/_jsx(ChartTooltip,{cursor:false,content:/*#__PURE__*/_jsx(ChartTooltipContent,{hideLabel:true})}),/*#__PURE__*/_jsx(Pie,{data:safeData,dataKey:config.dataKey,nameKey:config.nameKey,innerRadius:60,strokeWidth:10,label:safeData.length<20?function(_ref4){var name=_ref4.name,percent=_ref4.percent;return name+": "+(percent*100).toFixed(0)+"%"}:undefined,labelLine:false})]})}}export function renderChart(props){var _props$isEditable2=props.isEditable,isEditable=_props$isEditable2===void 0?false:_props$isEditable2,gjsModel=props.gjsModel,_props$performInterac2=props.performInteraction,performInteraction=_props$performInterac2===void 0?function(){return Promise.resolve({})}:_props$performInterac2,rest=_objectWithoutPropertiesLoose(props,_excluded3);var _useState5=useState(_extends({},filterPlaceholders(gjsModel.get("componentProps")),filterPlaceholders(props))),allData=_useState5[0],setAllData=_useState5[1];var _useState6=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState6[0],setAttributes=_useState6[1];var containerRef=useRef(null);var _useState7=useState(0),containerWidth=_useState7[0],setContainerWidth=_useState7[1];useEffect(function(){var handlePropsChange=function handlePropsChange(){var newProps=filterPlaceholders(gjsModel.get("componentProps"));setAllData(function(prevData){return _extends({},prevData,newProps)})};gjsModel.on("change:componentProps",handlePropsChange);return function(){gjsModel.off("change:componentProps",handlePropsChange)}},[gjsModel]);useEffect(function(){var handleAttributesChange=function handleAttributesChange(){var newAttributes=gjsModel.get("attributes");setAttributes(_extends({},newAttributes))};gjsModel.on("change:attributes",handleAttributesChange);return function(){gjsModel.off("change:attributes",handleAttributesChange)}},[gjsModel]);useEffect(function(){var updateContainerWidth=function updateContainerWidth(){if(containerRef.current){setContainerWidth(containerRef.current.offsetWidth)}};updateContainerWidth();window.addEventListener("resize",updateContainerWidth);return function(){return window.removeEventListener("resize",updateContainerWidth)}},[]);var _allData$config=allData.config,config=_allData$config===void 0?{}:_allData$config,_allData$chartType=allData.chartType,chartType=_allData$chartType===void 0?"pie":_allData$chartType,_allData$chartData=allData.chartData,chartData=_allData$chartData===void 0?[]:_allData$chartData,className=allData.className,_allData$title=allData.title,title=_allData$title===void 0?"Title":_allData$title,_allData$subTitle=allData.subTitle,subTitle=_allData$subTitle===void 0?"Subtitle":_allData$subTitle;var defaultClasses="aspect-auto h-[250px] w-full";var mergedClasses=className?cn(defaultClasses,className):defaultClasses;if(chartType==="pie"){var safeChartData=Array.isArray(chartData)?chartData:[];var colors=getNColors(safeChartData.length);for(var i=0;i<safeChartData.length;i++){var data=safeChartData[i];if(!data.fill){data.fill=colors[i]}}}else if(!config.color){var safeBaseColors=Array.isArray(baseColors)?baseColors:[];if(safeBaseColors.length>0){config.color=safeBaseColors[Math.floor(Math.random()*safeBaseColors.length)]}}var width=undefined;var totalDataPoints=0;// Helper function to get responsive config
7
7
  var getResponsiveConfig=function getResponsiveConfig(){if(chartType==="bar"&&totalDataPoints>15&&containerWidth>0&&width&&width<=containerWidth){// If chart fits in container, use responsive behavior
8
- return _extends({},config,{chartUi:{}})}return config};if(chartType==="bar"){config.dataKeys=config.dataKeys||[];var _safeChartData=Array.isArray(chartData)?chartData:[];var safeDataKeys=Array.isArray(config.dataKeys)?config.dataKeys:[];totalDataPoints=_safeChartData.length*Math.max(1,safeDataKeys.length);if(totalDataPoints>15){width=totalDataPoints*20+safeDataKeys.length*8*_safeChartData.length+_safeChartData.length*15;config.chartUi={barCategoryGap:"10%",width:width}}else{config.chartUi={}}}else if(chartType==="line"){config.dataKeys=config.dataKeys||[];var _safeChartData2=Array.isArray(chartData)?chartData:[];totalDataPoints=_safeChartData2.length;if(totalDataPoints>15){width=Math.max(800,totalDataPoints*20);config.chartUi={width:width}}else{config.chartUi={}}}var hasError=attributes.error||allData.error;var hasMissing=attributes.isMissing||allData.isMissing;var isLoading=(attributes.interactionApiInProgress||attributes.loading)&&!hasError&&!hasMissing;var chartUi=isLoading?/*#__PURE__*/_jsx(ChartLoader,{}):hasError||hasMissing||!chartData?renderNoDataFallback():/*#__PURE__*/_jsx(React.Fragment,{children:(chartType==="bar"||chartType==="line")&&totalDataPoints>15&&width&&(containerWidth===0||width>containerWidth)?/*#__PURE__*/_jsx("div",{className:"w-full h-[250px]",children:/*#__PURE__*/_jsxs(ScrollArea,{className:"w-full h-full",children:[/*#__PURE__*/_jsx("div",{style:{minWidth:width+"px",width:"max-content",height:"250px"},children:/*#__PURE__*/_jsx(ResponsiveContainer,{width:width,height:250,children:/*#__PURE__*/_jsx(ChartContainer,_extends({},rest,{config:config,className:mergedClasses,children:renderChartComponent(chartType,chartData,config)}))})}),/*#__PURE__*/_jsx(ScrollBar,{orientation:"horizontal"})]})}):/*#__PURE__*/_jsx(ResponsiveContainer,{width:"100%",height:250,children:/*#__PURE__*/_jsx(ChartContainer,_extends({},rest,{config:getResponsiveConfig(),className:mergedClasses,children:renderChartComponent(chartType,chartData,getResponsiveConfig())}))})});return/*#__PURE__*/_jsxs(Card,{className:"shadow border mt-2 mb-2 relative",children:[/*#__PURE__*/_jsx(CardHeader,{children:/*#__PURE__*/_jsx("div",{className:"flex items-start justify-between",children:/*#__PURE__*/_jsxs("div",{className:"flex-1",children:[/*#__PURE__*/_jsx(CardTitle,{"data-slot":"title",contentEditable:isEditable,className:"text-2xl",children:title}),/*#__PURE__*/_jsx(CardDescription,{"data-slot":"subTitle",contentEditable:isEditable,className:"text-sm",children:subTitle})]})})}),/*#__PURE__*/_jsx(CardContent,{ref:containerRef,"data-slot":"bodyContent",contentEditable:false,className:"px-6",children:chartUi}),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:performInteraction,position:"top-right",isVisible:isEditable})]})}export function renderTable(props){var _props$isEditable3=props.isEditable,isEditable=_props$isEditable3===void 0?false:_props$isEditable3,gjsModel=props.gjsModel,_props$performInterac3=props.performInteraction,performInteraction=_props$performInterac3===void 0?function(){}:_props$performInterac3,rest=_objectWithoutPropertiesLoose(props,_excluded4);var _useState8=useState(_extends({},filterPlaceholders(gjsModel.get("componentProps")),filterPlaceholders(props))),allData=_useState8[0],setAllData=_useState8[1];var cardRef=useRef(null);var _useState9=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState9[0],setAttributes=_useState9[1];var rawData=allData.data,_allData$headerMapper=allData.headerMapper,rawHeaderMapper=_allData$headerMapper===void 0?{}:_allData$headerMapper,className=allData.className,_allData$title2=allData.title,title=_allData$title2===void 0?"Title":_allData$title2,_allData$subTitle2=allData.subTitle,subTitle=_allData$subTitle2===void 0?"Subtitle":_allData$subTitle2,_allData$actions=allData.actions,actions=_allData$actions===void 0?[]:_allData$actions,pagination=allData.pagination;var data=Array.isArray(rawData)?rawData:[];var headerMapper=function(){var cleaned=_extends({},rawHeaderMapper);if("id"in cleaned){delete cleaned.id}if(data.length>0){var dataKeys=Object.keys(data[0]||{});return Object.fromEntries(Object.entries(cleaned).filter(function(_ref5){var key=_ref5[0];return dataKeys.includes(key)}))}return cleaned}();var sortConfig=function(_gjsModel$get,_ref7){var _ref6=(_gjsModel$get=gjsModel.get("componentProps"))!=null?_gjsModel$get:{},sortColumn=_ref6.sortColumn,sortDirection=_ref6.sortDirection;return sortColumn&&sortDirection?(_ref7={},_ref7[sortColumn]=sortDirection,_ref7):{}}();var _useState10=useState(0),viewportWidth=_useState10[0],setViewportWidth=_useState10[1];var _useState11=useState(250),scrollAreaHeight=_useState11[0],setScrollAreaHeight=_useState11[1];var calculateTableHeight=function calculateTableHeight(tableWidth,rowCount){if(viewportWidth>0){var _gjsModel$collection;var widthRatio=tableWidth/viewportWidth;var baseTableHeight=250;var targetScrollAreaHeight=baseTableHeight;if(widthRatio>=0.8){var headerHeight=48;var rowHeight=40;var calculatedHeight=headerHeight+rowCount*rowHeight;targetScrollAreaHeight=Math.min(calculatedHeight,baseTableHeight)}var tableId=gjsModel.get("id");var editor=gjsModel.em||((_gjsModel$collection=gjsModel.collection)==null?void 0:_gjsModel$collection.em);var canvasDocument=editor.Canvas.getDocument()||document;var tableElement=canvasDocument.querySelector("[data-table-id=\""+tableId+"\"]");if(tableElement){var headerElement=tableElement.querySelector("[data-slot=\"card-header\"]");if(headerElement&&headerElement.offsetHeight>0){var actualHeaderHeight=headerElement.offsetHeight;var standardHeaderHeight=58;var heightDifference=actualHeaderHeight-standardHeaderHeight;if(heightDifference>0){targetScrollAreaHeight=targetScrollAreaHeight-heightDifference}}}setScrollAreaHeight(targetScrollAreaHeight)}};useEffect(function(){var updateViewportWidth=function updateViewportWidth(){var iframe=document.querySelector(".gjs-frame");var iframeWindow=iframe==null?void 0:iframe.contentWindow;var iframeDocument=iframeWindow==null?void 0:iframeWindow.document;if(iframeDocument){var dashboardRoot=iframeDocument.getElementById("dashboard-root");var effectiveViewportWidth=(dashboardRoot==null?void 0:dashboardRoot.clientWidth)||iframeDocument.documentElement.clientWidth;setViewportWidth(effectiveViewportWidth)}};updateViewportWidth();window.addEventListener("resize",updateViewportWidth);var iframe=document.querySelector(".gjs-frame");var iframeWindow=iframe==null?void 0:iframe.contentWindow;if(iframeWindow){iframeWindow.addEventListener("resize",updateViewportWidth)}return function(){window.removeEventListener("resize",updateViewportWidth);if(iframeWindow){iframeWindow.removeEventListener("resize",updateViewportWidth)}}},[]);useEffect(function(){var updateTableWidthAndApplyCSS=function updateTableWidthAndApplyCSS(){var _gjsModel$collection2;var tableId=gjsModel.get("id");var editor=gjsModel.em||((_gjsModel$collection2=gjsModel.collection)==null?void 0:_gjsModel$collection2.em);var canvasDocument=editor.Canvas.getDocument()||document;var tableElement=canvasDocument.querySelector("[data-table-id=\""+tableId+"\"]");if(!tableElement&&window.parent!==window){tableElement=window.parent.document.querySelector("[data-table-id=\""+tableId+"\"]")}if(!tableElement){return}var tableActualWidth=tableElement.getBoundingClientRect().width;if(tableActualWidth>0){calculateTableHeight(tableActualWidth,Array.isArray(data)?data.length:0)}};var timeoutId=setTimeout(updateTableWidthAndApplyCSS,150);window.addEventListener("resize",updateTableWidthAndApplyCSS);return function(){clearTimeout(timeoutId);window.removeEventListener("resize",updateTableWidthAndApplyCSS)}},[allData,gjsModel,viewportWidth,data,calculateTableHeight]);useEffect(function(){gjsModel.on("change:componentProps",function(){setAllData(function(prevData){return _extends({},prevData,filterPlaceholders(gjsModel.get("componentProps")))})})},[]);useEffect(function(){gjsModel.on("change:attributes",function(){setAttributes(_extends({},gjsModel.get("attributes")))})},[]);var parsedData=function(){if(typeof data==="object"&&data!==null&&!Array.isArray(data)&&data.name==="__peak_placeholder"){return[]}if(!Array.isArray(data)){return[]}return data.map(function(datum){var newData=_extends({},datum);delete newData.id;return newData})}();function onRowAction(_x,_x2){return _onRowAction.apply(this,arguments)}function _onRowAction(){_onRowAction=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(rowIndex,actionId){var id;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:id=gjsModel.get("id");_context.next=3;return performInteraction({id:actionId,interactionType:"tableButton",payload:{row:data[rowIndex],tableId:id},affectedComponents:[]});case 3:case"end":return _context.stop()}},_callee)}));return _onRowAction.apply(this,arguments)}function onPageChange(_x3,_x4){return _onPageChange.apply(this,arguments)}function _onPageChange(){_onPageChange=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(pageNumber,pageSize){var _gjsModel$get2;var id,_ref8,sortColumn,sortDirection;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:id=gjsModel.get("id");_ref8=(_gjsModel$get2=gjsModel.get("componentProps"))!=null?_gjsModel$get2:{},sortColumn=_ref8.sortColumn,sortDirection=_ref8.sortDirection;_context2.next=4;return performInteraction({id:id,interactionType:"pagination",payload:_extends({pageNumber:pageNumber,pageSize:pageSize},sortColumn&&sortDirection&&{sortColumn:sortColumn,sortDirection:sortDirection}),affectedComponents:getAffectedComponentsWithLoader([id],true)});case 4:case"end":return _context2.stop()}},_callee2)}));return _onPageChange.apply(this,arguments)}function handleSort(_x5,_x6){return _handleSort.apply(this,arguments)}function _handleSort(){_handleSort=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(column,direction){var currentProps,id;return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:currentProps=gjsModel.get("componentProps");id=gjsModel.get("id");gjsModel.set("componentProps",_extends({},currentProps,{sortColumn:direction?column:null,sortDirection:direction}));_context3.next=5;return performInteraction({id:id,interactionType:"tableSort",payload:{sortColumn:direction?column:null,sortDirection:direction,tableId:id},affectedComponents:getAffectedComponentsWithLoader([id],true)});case 5:case"end":return _context3.stop()}},_callee3)}));return _handleSort.apply(this,arguments)}return/*#__PURE__*/_jsxs(Card,{ref:cardRef,className:"shadow border relative flex flex-col h-fit overflow-hidden","data-component-type":"table","data-table-id":gjsModel.get("id"),children:[/*#__PURE__*/_jsx(CardHeader,{children:/*#__PURE__*/_jsx("div",{className:"flex items-start justify-between",children:/*#__PURE__*/_jsxs("div",{className:"flex-1",children:[/*#__PURE__*/_jsx(CardTitle,{"data-slot":"title",contentEditable:isEditable,className:"text-2xl",children:title}),/*#__PURE__*/_jsx(CardDescription,{"data-slot":"subTitle",contentEditable:isEditable,className:"text-sm",children:subTitle})]})})}),/*#__PURE__*/_jsx(CardContent,{"data-slot":"bodyContent",contentEditable:false,className:"flex-1 flex flex-col overflow-hidden",children:attributes.error||allData.error||attributes.isMissing||allData.isMissing?renderNoDataFallback():/*#__PURE__*/_jsx(DataTable,{data:parsedData,headerMapper:headerMapper,className:className,isEditable:isEditable,actions:actions,pagination:pagination,isLoading:attributes.interactionApiInProgress,onRowAction:onRowAction,onPageChange:onPageChange,onSort:handleSort,sortConfig:sortConfig,otherProps:rest,height:scrollAreaHeight})}),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:performInteraction,position:"top-right",tableActions:actions,firstRowData:Array.isArray(data)&&data.length>0?data[0]:{},isVisible:isEditable})]})}export function renderTab(props){var tabsWidth=157;var safeTabs=Array.isArray(props.tabs)?props.tabs:[];var showFallback=safeTabs.length===0;if(safeTabs.length>4){tabsWidth=157}var defaultValue=props.defaultValue||(safeTabs.length>0?safeTabs[0]:undefined);return/*#__PURE__*/_jsxs(Tabs,{defaultValue:defaultValue,children:[/*#__PURE__*/_jsx("div",{className:"text-center mb-4",children:/*#__PURE__*/_jsx(TabsList,{className:"bg-[#F9F9FE] border border-[#D4D5DE] p-1 rounded-lg h-auto",children:safeTabs.length>0?safeTabs.map(function(tab){return/*#__PURE__*/_jsx(TabsTrigger,{value:tab,className:"\n w-["+tabsWidth+"px] h-[38px] gap-1 px-3 py-[11px]\n font-medium text-sm leading-4\n border-0 bg-[#F9F9FE] text-[#687387] rounded-none\n data-[state=active]:border data-[state=active]:border-solid data-[state=active]:border-[#2A44D4] data-[state=active]:bg-[#EAECFB] data-[state=active]:text-[#263DBF] data-[state=active]:shadow-none data-[state=active]:rounded-md\n transition-all duration-200\n ",style:{fontFamily:"Helvetica Neue",fontWeight:500,fontSize:"14px",lineHeight:"16px",letterSpacing:"0%"},children:tab},tab)}):/*#__PURE__*/_jsx(TabsTrigger,{value:"no-data",className:"\n w-["+tabsWidth+"px] h-[38px] gap-1 px-3 py-[11px]\n font-medium text-sm leading-4\n border-0 bg-[#F9F9FE] text-[#687387] rounded-none\n data-[state=active]:border data-[state=active]:border-solid data-[state=active]:border-[#2A44D4] data-[state=active]:bg-[#EAECFB] data-[state=active]:text-[#263DBF] data-[state=active]:shadow-none data-[state=active]:rounded-md\n transition-all duration-200\n ",style:{fontFamily:"Helvetica Neue",fontWeight:500,fontSize:"14px",lineHeight:"16px",letterSpacing:"0%"},disabled:true,children:"No tabs"})})}),showFallback?/*#__PURE__*/_jsx(TabsContent,{value:defaultValue||"no-data",className:"tabs-content","data-fallback":"true",children:renderNoDataFallback()}):safeTabs.map(function(tab){return/*#__PURE__*/_jsx(TabsContent,{value:tab,className:"tabs-content"},tab)})]})}export function renderMarkdown(props){var _props$isEditable4=props.isEditable,isEditable=_props$isEditable4===void 0?false:_props$isEditable4,gjsModel=props.gjsModel,rest=_objectWithoutPropertiesLoose(props,_excluded5);var _useState12=useState(_extends({},filterPlaceholders(gjsModel.get("componentProps")),filterPlaceholders(props))),allData=_useState12[0],setAllData=_useState12[1];var _useState13=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState13[0],setAttributes=_useState13[1];useEffect(function(){gjsModel.on("change:componentProps",function(){setAllData(function(prevData){return _extends({},prevData,filterPlaceholders(gjsModel.get("componentProps")))})})},[]);useEffect(function(){gjsModel.on("change:attributes",function(){setAttributes(_extends({},gjsModel.get("attributes")))})},[]);var _useState14=useState(false),isEditing=_useState14[0],setIsEditing=_useState14[1];var editRef=useRef(null);var startEditing=function startEditing(){setIsEditing(true);setTimeout(function(){setupEditor()},0)};var setupEditor=function setupEditor(){if(!editRef.current){return}var editor=editRef.current;editor.innerHTML="";editor.textContent=allData.summaryText;editor.focus()};// Save changes and exit editing mode
9
- var saveChanges=function saveChanges(){if(!editRef.current){return}var content=editRef.current.innerText||"";setAllData(function(prev){return _extends({},prev,{summaryText:content})});setIsEditing(false);editRef.current.innerHTML=""};var markdownStyles={ul:{props:{className:"list-disc"}},h1:{props:{className:"text-4xl font-bold leading-[4rem]"}},h2:{props:{className:"text-3xl font-bold leading-[3rem]"}},h3:{props:{className:"text-2xl font-bold leading-[2rem]"}},h4:{props:{className:"text-xl font-bold leading-[2.5rem]"}},h5:{props:{className:"text-lg font-bold leading-[2.5rem]"}},h6:{props:{className:"text-base font-bold leading-[2rem]"}}};var hasError=attributes.error||allData.error;var hasMissing=attributes.isMissing||allData.isMissing;var isLoading=attributes.loading&&!hasError&&!hasMissing;if(isLoading){return/*#__PURE__*/_jsx(MarkdownLoader,{})}if(hasError||hasMissing){return/*#__PURE__*/_jsxs("div",_extends({className:"px-[1em] relative"},rest,{children:[/*#__PURE__*/_jsx("h3",{className:"text-xl font-semibold text-left",children:"Insights"}),/*#__PURE__*/_jsxs("div",{className:"w-full py-8 flex flex-col items-center justify-center px-6 text-center",style:{minHeight:"180px"},children:[/*#__PURE__*/_jsx(CircleAlert,{className:"w-12 h-12 text-gray-400 mb-2"}),/*#__PURE__*/_jsx("h3",{className:"text-lg font-medium text-gray-900",children:"No data available"}),/*#__PURE__*/_jsx("p",{className:"mt-2 text-sm text-gray-500 max-w-md",children:"Check your filters or try a different time range."})]}),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:props.performInteraction,position:"top-right",isVisible:isEditable})]}))}if(!allData.isEditable){return/*#__PURE__*/_jsxs("div",_extends({className:"px-[1em] relative"},rest,{children:[/*#__PURE__*/_jsx("h3",{className:"text-xl font-semibold text-left",children:"Insights"}),/*#__PURE__*/_jsx("div",{"data-slot":"summaryText",children:/*#__PURE__*/_jsx(Markdown,{options:{overrides:markdownStyles},children:allData.summaryText})}),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:props.performInteraction,position:"top-right",isVisible:isEditable})]}))}return/*#__PURE__*/_jsxs("div",_extends({className:"p-[1em] relative"},rest,{children:[/*#__PURE__*/_jsx("h3",{className:"text-xl font-semibold text-left",children:"Insights"}),isEditing?/*#__PURE__*/_jsx("div",{ref:editRef,contentEditable:true,onBlur:saveChanges,"data-slot":"summaryText",className:"p-2 min-h-[100px] whitespace-pre-wrap",suppressContentEditableWarning:true,style:{whiteSpace:"pre-wrap",wordWrap:"break-word"}}):/*#__PURE__*/_jsx("div",{onClick:startEditing,"data-slot":"summaryText",style:{whiteSpace:"pre-wrap",wordWrap:"break-word"},children:/*#__PURE__*/_jsx(Markdown,{options:{overrides:markdownStyles},children:allData.summaryText})}),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:props.performInteraction,position:"top-right",isVisible:isEditable})]}))}export function renderButton(props){var _props$isEditable5=props.isEditable,isEditable=_props$isEditable5===void 0?false:_props$isEditable5,gjsModel=props.gjsModel,_props$performInterac4=props.performInteraction,performInteraction=_props$performInterac4===void 0?function(){}:_props$performInterac4;var _useState15=useState(_extends({},props)),allData=_useState15[0],setAllData=_useState15[1];var _useState16=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState16[0],setAttributes=_useState16[1];useEffect(function(){gjsModel.on("change:componentProps",function(){setAllData(_extends({},gjsModel.get("componentProps")))})},[]);useEffect(function(){gjsModel.on("change:attributes",function(){setAttributes(_extends({},gjsModel.get("attributes")))})},[]);var text=allData.text,className=allData.className,payload=allData.payload,_allData$variant=allData.variant,variant=_allData$variant===void 0?"default":_allData$variant,_allData$size=allData.size,size=_allData$size===void 0?"sm":_allData$size,affectedComponents=allData.affectedComponents,tooltipContent=allData.tooltipContent;function interact(){var id=gjsModel.get("id");performInteraction({id:id,interactionType:"button",affectedComponents:getAffectedComponentsWithLoader([id].concat(affectedComponents),true),payload:payload})}return/*#__PURE__*/_jsx(TooltipButton,{className:className,isEditable:isEditable,interact:interact,attributes:attributes,variant:variant,size:size,text:text,tooltipContent:tooltipContent})}var renderActionCardWithWrapper=function renderActionCardWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"ActionCard"}),children:renderActionCard(props)})};var renderButtonWithWrapper=function renderButtonWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Button"}),children:renderButton(props)})};var renderCardWithWrapper=function renderCardWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Card"}),children:renderCard(props)})};var renderChartWithWrapper=function renderChartWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Chart"}),children:renderChart(props)})};var renderFilterWithWrapper=function renderFilterWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Filter"}),children:renderFilter(props)})};var renderMarkdownWithWrapper=function renderMarkdownWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Markdown"}),children:renderMarkdown(props)})};var renderSearchWithWrapper=function renderSearchWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Search"}),children:renderSearch(props)})};var renderTableWithWrapper=function renderTableWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Table"}),children:renderTable(props)})};var renderTabWithWrapper=function renderTabWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Tabs"}),children:renderTab(props)})};export function getRenderers(){return{ActionCard:renderActionCardWithWrapper,Button:renderButtonWithWrapper,Card:renderCardWithWrapper,Chart:renderChartWithWrapper,Filter:renderFilterWithWrapper,Markdown:renderMarkdownWithWrapper,Search:renderSearchWithWrapper,Table:renderTableWithWrapper,Tabs:renderTabWithWrapper}}
8
+ return _extends({},config,{chartUi:{}})}return config};if(chartType==="bar"){config.dataKeys=config.dataKeys||[];var _safeChartData=Array.isArray(chartData)?chartData:[];var safeDataKeys=Array.isArray(config.dataKeys)?config.dataKeys:[];totalDataPoints=_safeChartData.length*Math.max(1,safeDataKeys.length);if(totalDataPoints>15){width=totalDataPoints*20+safeDataKeys.length*8*_safeChartData.length+_safeChartData.length*15;config.chartUi={barCategoryGap:"10%",width:width}}else{config.chartUi={}}}else if(chartType==="line"){config.dataKeys=config.dataKeys||[];var _safeChartData2=Array.isArray(chartData)?chartData:[];totalDataPoints=_safeChartData2.length;if(totalDataPoints>15){width=Math.max(800,totalDataPoints*20);config.chartUi={width:width}}else{config.chartUi={}}}var hasError=attributes.error||allData.error;var hasMissing=attributes.isMissing||allData.isMissing;var isLoading=(attributes.interactionApiInProgress||attributes.loading)&&!hasError&&!hasMissing;var chartUi=isLoading?/*#__PURE__*/_jsx(ChartLoader,{}):hasError||hasMissing||!chartData?renderNoDataFallback():/*#__PURE__*/_jsx(React.Fragment,{children:(chartType==="bar"||chartType==="line")&&totalDataPoints>15&&width&&(containerWidth===0||width>containerWidth)?/*#__PURE__*/_jsx("div",{className:"w-full h-[250px]",children:/*#__PURE__*/_jsxs(ScrollArea,{className:"w-full h-full",children:[/*#__PURE__*/_jsx("div",{style:{minWidth:width+"px",width:"max-content",height:"250px"},children:/*#__PURE__*/_jsx(ResponsiveContainer,{width:width,height:250,children:/*#__PURE__*/_jsx(ChartContainer,_extends({},rest,{config:config,className:mergedClasses,children:renderChartComponent(chartType,chartData,config)}))})}),/*#__PURE__*/_jsx(ScrollBar,{orientation:"horizontal"})]})}):/*#__PURE__*/_jsx(ResponsiveContainer,{width:"100%",height:250,children:/*#__PURE__*/_jsx(ChartContainer,_extends({},rest,{config:getResponsiveConfig(),className:mergedClasses,children:renderChartComponent(chartType,chartData,getResponsiveConfig())}))})});return/*#__PURE__*/_jsxs(Card,{className:"shadow border mt-2 mb-2 relative",children:[/*#__PURE__*/_jsx(CardHeader,{children:/*#__PURE__*/_jsx("div",{className:"flex items-start justify-between",children:/*#__PURE__*/_jsxs("div",{className:"flex-1",children:[/*#__PURE__*/_jsx(CardTitle,{"data-slot":"title",contentEditable:isEditable,className:"text-2xl",children:title}),/*#__PURE__*/_jsx(CardDescription,{"data-slot":"subTitle",contentEditable:isEditable,className:"text-sm",children:subTitle})]})})}),/*#__PURE__*/_jsx(CardContent,{ref:containerRef,"data-slot":"bodyContent",contentEditable:false,className:"px-6",children:chartUi}),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:performInteraction,position:"top-right",isVisible:isEditable,componentProps:allData})]})}export function renderTable(props){var _props$isEditable3=props.isEditable,isEditable=_props$isEditable3===void 0?false:_props$isEditable3,gjsModel=props.gjsModel,_props$performInterac3=props.performInteraction,performInteraction=_props$performInterac3===void 0?function(){}:_props$performInterac3,rest=_objectWithoutPropertiesLoose(props,_excluded4);var _useState8=useState(_extends({},filterPlaceholders(gjsModel.get("componentProps")),filterPlaceholders(props))),allData=_useState8[0],setAllData=_useState8[1];var cardRef=useRef(null);var _useState9=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState9[0],setAttributes=_useState9[1];var rawData=allData.data,_allData$headerMapper=allData.headerMapper,rawHeaderMapper=_allData$headerMapper===void 0?{}:_allData$headerMapper,className=allData.className,_allData$title2=allData.title,title=_allData$title2===void 0?"Title":_allData$title2,_allData$subTitle2=allData.subTitle,subTitle=_allData$subTitle2===void 0?"Subtitle":_allData$subTitle2,_allData$actions=allData.actions,actions=_allData$actions===void 0?[]:_allData$actions,pagination=allData.pagination;var data=Array.isArray(rawData)?rawData:[];var headerMapper=function(){var cleaned=_extends({},rawHeaderMapper);if("id"in cleaned){delete cleaned.id}if(data.length>0){var dataKeys=Object.keys(data[0]||{});return Object.fromEntries(Object.entries(cleaned).filter(function(_ref5){var key=_ref5[0];return dataKeys.includes(key)}))}return cleaned}();var sortConfig=function(_gjsModel$get,_ref7){var _ref6=(_gjsModel$get=gjsModel.get("componentProps"))!=null?_gjsModel$get:{},sortColumn=_ref6.sortColumn,sortDirection=_ref6.sortDirection;return sortColumn&&sortDirection?(_ref7={},_ref7[sortColumn]=sortDirection,_ref7):{}}();var _useState10=useState(0),viewportWidth=_useState10[0],setViewportWidth=_useState10[1];var _useState11=useState(250),scrollAreaHeight=_useState11[0],setScrollAreaHeight=_useState11[1];var calculateTableHeight=function calculateTableHeight(tableWidth,rowCount){if(viewportWidth>0){var _gjsModel$collection;var widthRatio=tableWidth/viewportWidth;var baseTableHeight=250;var targetScrollAreaHeight=baseTableHeight;if(widthRatio>=0.8){var headerHeight=48;var rowHeight=40;var calculatedHeight=headerHeight+rowCount*rowHeight;targetScrollAreaHeight=Math.min(calculatedHeight,baseTableHeight)}var tableId=gjsModel.get("id");var editor=gjsModel.em||((_gjsModel$collection=gjsModel.collection)==null?void 0:_gjsModel$collection.em);var canvasDocument=editor.Canvas.getDocument()||document;var tableElement=canvasDocument.querySelector("[data-table-id=\""+tableId+"\"]");if(tableElement){var headerElement=tableElement.querySelector("[data-slot=\"card-header\"]");if(headerElement&&headerElement.offsetHeight>0){var actualHeaderHeight=headerElement.offsetHeight;var standardHeaderHeight=58;var heightDifference=actualHeaderHeight-standardHeaderHeight;if(heightDifference>0){targetScrollAreaHeight=targetScrollAreaHeight-heightDifference}}}setScrollAreaHeight(targetScrollAreaHeight)}};useEffect(function(){var updateViewportWidth=function updateViewportWidth(){var iframe=document.querySelector(".gjs-frame");var iframeWindow=iframe==null?void 0:iframe.contentWindow;var iframeDocument=iframeWindow==null?void 0:iframeWindow.document;if(iframeDocument){var dashboardRoot=iframeDocument.getElementById("dashboard-root");var effectiveViewportWidth=(dashboardRoot==null?void 0:dashboardRoot.clientWidth)||iframeDocument.documentElement.clientWidth;setViewportWidth(effectiveViewportWidth)}};updateViewportWidth();window.addEventListener("resize",updateViewportWidth);var iframe=document.querySelector(".gjs-frame");var iframeWindow=iframe==null?void 0:iframe.contentWindow;if(iframeWindow){iframeWindow.addEventListener("resize",updateViewportWidth)}return function(){window.removeEventListener("resize",updateViewportWidth);if(iframeWindow){iframeWindow.removeEventListener("resize",updateViewportWidth)}}},[]);useEffect(function(){var updateTableWidthAndApplyCSS=function updateTableWidthAndApplyCSS(){var _gjsModel$collection2;var tableId=gjsModel.get("id");var editor=gjsModel.em||((_gjsModel$collection2=gjsModel.collection)==null?void 0:_gjsModel$collection2.em);var canvasDocument=editor.Canvas.getDocument()||document;var tableElement=canvasDocument.querySelector("[data-table-id=\""+tableId+"\"]");if(!tableElement&&window.parent!==window){tableElement=window.parent.document.querySelector("[data-table-id=\""+tableId+"\"]")}if(!tableElement){return}var tableActualWidth=tableElement.getBoundingClientRect().width;if(tableActualWidth>0){calculateTableHeight(tableActualWidth,Array.isArray(data)?data.length:0)}};var timeoutId=setTimeout(updateTableWidthAndApplyCSS,150);window.addEventListener("resize",updateTableWidthAndApplyCSS);return function(){clearTimeout(timeoutId);window.removeEventListener("resize",updateTableWidthAndApplyCSS)}},[allData,gjsModel,viewportWidth,data,calculateTableHeight]);useEffect(function(){gjsModel.on("change:componentProps",function(){setAllData(function(prevData){return _extends({},prevData,filterPlaceholders(gjsModel.get("componentProps")))})})},[]);useEffect(function(){gjsModel.on("change:attributes",function(){setAttributes(_extends({},gjsModel.get("attributes")))})},[]);var parsedData=function(){if(typeof data==="object"&&data!==null&&!Array.isArray(data)&&data.name==="__peak_placeholder"){return[]}if(!Array.isArray(data)){return[]}return data.map(function(datum){var newData=_extends({},datum);delete newData.id;return newData})}();function onRowAction(_x,_x2){return _onRowAction.apply(this,arguments)}function _onRowAction(){_onRowAction=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(rowIndex,actionId){var id;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:id=gjsModel.get("id");_context.next=3;return performInteraction({id:actionId,interactionType:"tableButton",payload:{row:data[rowIndex],tableId:id},affectedComponents:[]});case 3:case"end":return _context.stop()}},_callee)}));return _onRowAction.apply(this,arguments)}function onPageChange(_x3,_x4){return _onPageChange.apply(this,arguments)}function _onPageChange(){_onPageChange=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(pageNumber,pageSize){var _gjsModel$get2;var id,_ref8,sortColumn,sortDirection;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:id=gjsModel.get("id");_ref8=(_gjsModel$get2=gjsModel.get("componentProps"))!=null?_gjsModel$get2:{},sortColumn=_ref8.sortColumn,sortDirection=_ref8.sortDirection;_context2.next=4;return performInteraction({id:id,interactionType:"pagination",payload:_extends({pageNumber:pageNumber,pageSize:pageSize},sortColumn&&sortDirection&&{sortColumn:sortColumn,sortDirection:sortDirection}),affectedComponents:getAffectedComponentsWithLoader([id],true)});case 4:case"end":return _context2.stop()}},_callee2)}));return _onPageChange.apply(this,arguments)}function handleSort(_x5,_x6){return _handleSort.apply(this,arguments)}function _handleSort(){_handleSort=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(column,direction){var currentProps,id;return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:currentProps=gjsModel.get("componentProps");id=gjsModel.get("id");gjsModel.set("componentProps",_extends({},currentProps,{sortColumn:direction?column:null,sortDirection:direction}));_context3.next=5;return performInteraction({id:id,interactionType:"tableSort",payload:{sortColumn:direction?column:null,sortDirection:direction,tableId:id},affectedComponents:getAffectedComponentsWithLoader([id],true)});case 5:case"end":return _context3.stop()}},_callee3)}));return _handleSort.apply(this,arguments)}return/*#__PURE__*/_jsxs(Card,{ref:cardRef,className:"shadow border relative flex flex-col h-fit overflow-hidden","data-component-type":"table","data-table-id":gjsModel.get("id"),children:[/*#__PURE__*/_jsx(CardHeader,{children:/*#__PURE__*/_jsx("div",{className:"flex items-start justify-between",children:/*#__PURE__*/_jsxs("div",{className:"flex-1",children:[/*#__PURE__*/_jsx(CardTitle,{"data-slot":"title",contentEditable:isEditable,className:"text-2xl",children:title}),/*#__PURE__*/_jsx(CardDescription,{"data-slot":"subTitle",contentEditable:isEditable,className:"text-sm",children:subTitle})]})})}),/*#__PURE__*/_jsx(CardContent,{"data-slot":"bodyContent",contentEditable:false,className:"flex-1 flex flex-col overflow-hidden",children:attributes.error||allData.error||attributes.isMissing||allData.isMissing?renderNoDataFallback():/*#__PURE__*/_jsx(DataTable,{data:parsedData,headerMapper:headerMapper,className:className,isEditable:isEditable,actions:actions,pagination:pagination,isLoading:attributes.interactionApiInProgress,onRowAction:onRowAction,onPageChange:onPageChange,onSort:handleSort,sortConfig:sortConfig,otherProps:rest,height:scrollAreaHeight})}),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:performInteraction,position:"top-right",tableActions:actions,firstRowData:Array.isArray(data)&&data.length>0?data[0]:{},isVisible:isEditable,componentProps:allData})]})}export function renderTab(props){var tabsWidth=157;var safeTabs=Array.isArray(props.tabs)?props.tabs:[];var showFallback=safeTabs.length===0;if(safeTabs.length>4){tabsWidth=157}var defaultValue=props.defaultValue||(safeTabs.length>0?safeTabs[0]:undefined);return/*#__PURE__*/_jsxs(Tabs,{defaultValue:defaultValue,children:[/*#__PURE__*/_jsx("div",{className:"text-center mb-4",children:/*#__PURE__*/_jsx(TabsList,{className:"bg-[#F9F9FE] border border-[#D4D5DE] p-1 rounded-lg h-auto",children:safeTabs.length>0?safeTabs.map(function(tab){return/*#__PURE__*/_jsx(TabsTrigger,{value:tab,className:"\n w-["+tabsWidth+"px] h-[38px] gap-1 px-3 py-[11px]\n font-medium text-sm leading-4\n border-0 bg-[#F9F9FE] text-[#687387] rounded-none\n data-[state=active]:border data-[state=active]:border-solid data-[state=active]:border-[#2A44D4] data-[state=active]:bg-[#EAECFB] data-[state=active]:text-[#263DBF] data-[state=active]:shadow-none data-[state=active]:rounded-md\n transition-all duration-200\n ",style:{fontFamily:"Helvetica Neue",fontWeight:500,fontSize:"14px",lineHeight:"16px",letterSpacing:"0%"},children:tab},tab)}):/*#__PURE__*/_jsx(TabsTrigger,{value:"no-data",className:"\n w-["+tabsWidth+"px] h-[38px] gap-1 px-3 py-[11px]\n font-medium text-sm leading-4\n border-0 bg-[#F9F9FE] text-[#687387] rounded-none\n data-[state=active]:border data-[state=active]:border-solid data-[state=active]:border-[#2A44D4] data-[state=active]:bg-[#EAECFB] data-[state=active]:text-[#263DBF] data-[state=active]:shadow-none data-[state=active]:rounded-md\n transition-all duration-200\n ",style:{fontFamily:"Helvetica Neue",fontWeight:500,fontSize:"14px",lineHeight:"16px",letterSpacing:"0%"},disabled:true,children:"No tabs"})})}),showFallback?/*#__PURE__*/_jsx(TabsContent,{value:defaultValue||"no-data",className:"tabs-content","data-fallback":"true",children:renderNoDataFallback()}):safeTabs.map(function(tab){return/*#__PURE__*/_jsx(TabsContent,{value:tab,className:"tabs-content"},tab)})]})}export function renderMarkdown(props){var _props$isEditable4=props.isEditable,isEditable=_props$isEditable4===void 0?false:_props$isEditable4,gjsModel=props.gjsModel,rest=_objectWithoutPropertiesLoose(props,_excluded5);var _useState12=useState(_extends({},filterPlaceholders(gjsModel.get("componentProps")),filterPlaceholders(props))),allData=_useState12[0],setAllData=_useState12[1];var _useState13=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState13[0],setAttributes=_useState13[1];useEffect(function(){gjsModel.on("change:componentProps",function(){setAllData(function(prevData){return _extends({},prevData,filterPlaceholders(gjsModel.get("componentProps")))})})},[]);useEffect(function(){gjsModel.on("change:attributes",function(){setAttributes(_extends({},gjsModel.get("attributes")))})},[]);var _useState14=useState(false),isEditing=_useState14[0],setIsEditing=_useState14[1];var editRef=useRef(null);var startEditing=function startEditing(){setIsEditing(true);setTimeout(function(){setupEditor()},0)};var setupEditor=function setupEditor(){if(!editRef.current){return}var editor=editRef.current;editor.innerHTML="";editor.textContent=allData.summaryText;editor.focus()};// Save changes and exit editing mode
9
+ var saveChanges=function saveChanges(){if(!editRef.current){return}var content=editRef.current.innerText||"";setAllData(function(prev){return _extends({},prev,{summaryText:content})});setIsEditing(false);editRef.current.innerHTML=""};var markdownStyles={ul:{props:{className:"list-disc"}},h1:{props:{className:"text-4xl font-bold leading-[4rem]"}},h2:{props:{className:"text-3xl font-bold leading-[3rem]"}},h3:{props:{className:"text-2xl font-bold leading-[2rem]"}},h4:{props:{className:"text-xl font-bold leading-[2.5rem]"}},h5:{props:{className:"text-lg font-bold leading-[2.5rem]"}},h6:{props:{className:"text-base font-bold leading-[2rem]"}}};var hasError=attributes.error||allData.error;var hasMissing=attributes.isMissing||allData.isMissing;var isLoading=attributes.loading&&!hasError&&!hasMissing;if(isLoading){return/*#__PURE__*/_jsx(MarkdownLoader,{})}if(hasError||hasMissing){return/*#__PURE__*/_jsxs("div",_extends({className:"px-[1em] relative"},rest,{children:[/*#__PURE__*/_jsx("h3",{className:"text-xl font-semibold text-left",children:"Insights"}),/*#__PURE__*/_jsxs("div",{className:"w-full py-8 flex flex-col items-center justify-center px-6 text-center",style:{minHeight:"180px"},children:[/*#__PURE__*/_jsx(CircleAlert,{className:"w-12 h-12 text-gray-400 mb-2"}),/*#__PURE__*/_jsx("h3",{className:"text-lg font-medium text-gray-900",children:"No data available"}),/*#__PURE__*/_jsx("p",{className:"mt-2 text-sm text-gray-500 max-w-md",children:"Check your filters or try a different time range."})]}),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:props.performInteraction,position:"top-right",isVisible:isEditable,componentProps:allData})]}))}if(!allData.isEditable){return/*#__PURE__*/_jsxs("div",_extends({className:"px-[1em] relative"},rest,{children:[/*#__PURE__*/_jsx("h3",{className:"text-xl font-semibold text-left",children:"Insights"}),/*#__PURE__*/_jsx("div",{"data-slot":"summaryText",children:/*#__PURE__*/_jsx(Markdown,{options:{overrides:markdownStyles},children:allData.summaryText})}),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:props.performInteraction,position:"top-right",isVisible:isEditable,componentProps:allData})]}))}return/*#__PURE__*/_jsxs("div",_extends({className:"p-[1em] relative"},rest,{children:[/*#__PURE__*/_jsx("h3",{className:"text-xl font-semibold text-left",children:"Insights"}),isEditing?/*#__PURE__*/_jsx("div",{ref:editRef,contentEditable:true,onBlur:saveChanges,"data-slot":"summaryText",className:"p-2 min-h-[100px] whitespace-pre-wrap",suppressContentEditableWarning:true,style:{whiteSpace:"pre-wrap",wordWrap:"break-word"}}):/*#__PURE__*/_jsx("div",{onClick:startEditing,"data-slot":"summaryText",style:{whiteSpace:"pre-wrap",wordWrap:"break-word"},children:/*#__PURE__*/_jsx(Markdown,{options:{overrides:markdownStyles},children:allData.summaryText})}),/*#__PURE__*/_jsx(StyledInfoButton,{componentId:gjsModel.get("id"),performInteraction:props.performInteraction,position:"top-right",isVisible:isEditable,componentProps:allData})]}))}export function renderButton(props){var _props$isEditable5=props.isEditable,isEditable=_props$isEditable5===void 0?false:_props$isEditable5,gjsModel=props.gjsModel,_props$performInterac4=props.performInteraction,performInteraction=_props$performInterac4===void 0?function(){}:_props$performInterac4;var _useState15=useState(_extends({},props)),allData=_useState15[0],setAllData=_useState15[1];var _useState16=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState16[0],setAttributes=_useState16[1];useEffect(function(){gjsModel.on("change:componentProps",function(){setAllData(_extends({},gjsModel.get("componentProps")))})},[]);useEffect(function(){gjsModel.on("change:attributes",function(){setAttributes(_extends({},gjsModel.get("attributes")))})},[]);var text=allData.text,className=allData.className,payload=allData.payload,_allData$variant=allData.variant,variant=_allData$variant===void 0?"default":_allData$variant,_allData$size=allData.size,size=_allData$size===void 0?"sm":_allData$size,affectedComponents=allData.affectedComponents,tooltipContent=allData.tooltipContent;function interact(){var id=gjsModel.get("id");performInteraction({id:id,interactionType:"button",affectedComponents:getAffectedComponentsWithLoader([id].concat(affectedComponents),true),payload:payload})}return/*#__PURE__*/_jsx(TooltipButton,{className:className,isEditable:isEditable,interact:interact,attributes:attributes,variant:variant,size:size,text:text,tooltipContent:tooltipContent})}var renderActionCardWithWrapper=function renderActionCardWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"ActionCard"}),children:renderActionCard(props)})};var renderButtonWithWrapper=function renderButtonWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Button"}),children:renderButton(props)})};var renderCardWithWrapper=function renderCardWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Card"}),children:renderCard(props)})};var renderChartWithWrapper=function renderChartWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Chart"}),children:renderChart(props)})};var renderFilterWithWrapper=function renderFilterWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Filter"}),children:renderFilter(props)})};var renderMarkdownWithWrapper=function renderMarkdownWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Markdown"}),children:renderMarkdown(props)})};var renderSearchWithWrapper=function renderSearchWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Search"}),children:renderSearch(props)})};var renderTableWithWrapper=function renderTableWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Table"}),children:renderTable(props)})};var renderTabWithWrapper=function renderTabWithWrapper(props){return/*#__PURE__*/_jsx(ComponentWrapper,{componentProps:_extends({},props,{componentType:"Tabs"}),children:renderTab(props)})};export function getRenderers(){return{ActionCard:renderActionCardWithWrapper,Button:renderButtonWithWrapper,Card:renderCardWithWrapper,Chart:renderChartWithWrapper,Filter:renderFilterWithWrapper,Markdown:renderMarkdownWithWrapper,Search:renderSearchWithWrapper,Table:renderTableWithWrapper,Tabs:renderTabWithWrapper}}
10
10
  //# sourceMappingURL=render-components.js.map