@allurereport/web-components 3.22.0 → 3.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Attachment-D75lkuAG.js → Attachment-DFk4AiwI.js} +2 -2
- package/dist/{Attachment-D75lkuAG.js.map → Attachment-DFk4AiwI.js.map} +1 -1
- package/dist/Attachment.js +1 -1
- package/dist/{AttachmentCode-BaFv0Nkk.js → AttachmentCode-DLfL9_C7.js} +2 -2
- package/dist/{AttachmentCode-BaFv0Nkk.js.map → AttachmentCode-DLfL9_C7.js.map} +1 -1
- package/dist/AttachmentImageDiff-Bp1b_UU5.js +2 -0
- package/dist/{AttachmentImageDiff-BXiyAOHw.js.map → AttachmentImageDiff-Bp1b_UU5.js.map} +1 -1
- package/dist/{AttachmentTable-xY7Ovinb.js → AttachmentTable-B_2qN3O-.js} +2 -2
- package/dist/{AttachmentTable-xY7Ovinb.js.map → AttachmentTable-B_2qN3O-.js.map} +1 -1
- package/dist/{BarChart-DVqwZDOJ.js → BarChart-Dmhamjn_.js} +2 -2
- package/dist/{BarChart-DVqwZDOJ.js.map → BarChart-Dmhamjn_.js.map} +1 -1
- package/dist/{BarChartRenderer-DyfCJzro.js → BarChartRenderer-Ip2G__e-.js} +2 -2
- package/dist/{BarChartRenderer-DyfCJzro.js.map → BarChartRenderer-Ip2G__e-.js.map} +1 -1
- package/dist/ChartWidget.js +1 -1
- package/dist/CodeViewer.js +1 -1
- package/dist/CurrentStatusChartWidget.js +1 -1
- package/dist/DurationDynamicsChartWidget.js +1 -1
- package/dist/DurationsChartWidget.js +1 -1
- package/dist/{EmptyDataStub-BuH_D_lp.js → EmptyDataStub-CRdg61R2.js} +2 -2
- package/dist/{EmptyDataStub-BuH_D_lp.js.map → EmptyDataStub-CRdg61R2.js.map} +1 -1
- package/dist/FunnelChartRenderer-tZ8LQJEg.js +2 -0
- package/dist/{FunnelChartRenderer-CLesVf61.js.map → FunnelChartRenderer-tZ8LQJEg.js.map} +1 -1
- package/dist/Grid.js +1 -1
- package/dist/{GridItem-DNsiFecD.js → GridItem-DI1f2R1r.js} +2 -2
- package/dist/{GridItem-DNsiFecD.js.map → GridItem-DI1f2R1r.js.map} +1 -1
- package/dist/HeatMapChartRenderer-CgQ03Op3.js +2 -0
- package/dist/{HeatMapChartRenderer-BrBfW8zd.js.map → HeatMapChartRenderer-CgQ03Op3.js.map} +1 -1
- package/dist/{HeatMapWidget-CwCccKA9.js → HeatMapWidget-Dqm7-_SB.js} +2 -2
- package/dist/{HeatMapWidget-CwCccKA9.js.map → HeatMapWidget-Dqm7-_SB.js.map} +1 -1
- package/dist/HeatMapWidget.js +1 -1
- package/dist/{HtmlPreview-NgG4sciW.js → HtmlPreview-u0sa77g5.js} +2 -2
- package/dist/{HtmlPreview-NgG4sciW.js.map → HtmlPreview-u0sa77g5.js.map} +1 -1
- package/dist/{HttpAttachment-A7AWm-d9.js → HttpAttachment-CkQRcAfa.js} +2 -2
- package/dist/{HttpAttachment-A7AWm-d9.js.map → HttpAttachment-CkQRcAfa.js.map} +1 -1
- package/dist/{MarkdownPreview-C-NFR_X3.js → MarkdownPreview-BEs6LvOd.js} +2 -2
- package/dist/{MarkdownPreview-C-NFR_X3.js.map → MarkdownPreview-BEs6LvOd.js.map} +1 -1
- package/dist/{MermaidPreview-DHvqVM10.js → MermaidPreview-4EDQwdX3.js} +2 -2
- package/dist/{MermaidPreview-DHvqVM10.js.map → MermaidPreview-4EDQwdX3.js.map} +1 -1
- package/dist/PieChartRenderer-Cv4hjlRj.js +2 -0
- package/dist/{PieChartRenderer-CBEEPgfv.js.map → PieChartRenderer-Cv4hjlRj.js.map} +1 -1
- package/dist/StabilityDistributionWidget.js +1 -1
- package/dist/StatusAgePyramidChartWidget.js +1 -1
- package/dist/StatusDynamicsChartWidget.js +1 -1
- package/dist/StatusTransitionsChartWidget.js +1 -1
- package/dist/SuccessRatePieChart.js +1 -1
- package/dist/TestBaseGrowthDynamicsChartWidget.js +1 -1
- package/dist/TestingPyramidWidget.js +1 -1
- package/dist/{Timeline-BkaMlh1L.js → Timeline-BWVXDTn-.js} +2 -2
- package/dist/{Timeline-BkaMlh1L.js.map → Timeline-BWVXDTn-.js.map} +1 -1
- package/dist/Timeline.js +1 -1
- package/dist/TrSeveritiesChartWidget.js +1 -1
- package/dist/TreeMapChartRenderer-DAOzpUju.js +2 -0
- package/dist/{TreeMapChartRenderer-4eHZtCVj.js.map → TreeMapChartRenderer-DAOzpUju.js.map} +1 -1
- package/dist/{TreeMapChartWidget-CWMvuICi.js → TreeMapChartWidget-DKXJlnm9.js} +2 -2
- package/dist/{TreeMapChartWidget-CWMvuICi.js.map → TreeMapChartWidget-DKXJlnm9.js.map} +1 -1
- package/dist/TreeMapChartWidget.js +1 -1
- package/dist/{_baseSlice-DybH-rwG.js → _baseSlice-CBpWu5XB.js} +1 -1
- package/dist/{_baseSlice-DybH-rwG.js.map → _baseSlice-CBpWu5XB.js.map} +1 -1
- package/dist/{_commonjsHelpers-bbZql6IY.js → _commonjsHelpers-Doe7ti1T.js} +1 -1
- package/dist/_commonjsHelpers-Doe7ti1T.js.map +1 -0
- package/dist/{_stringToArray-99CYzIaW.js → _stringToArray-aaWSQcKo.js} +2 -2
- package/dist/{_stringToArray-99CYzIaW.js.map → _stringToArray-aaWSQcKo.js.map} +1 -1
- package/dist/{array-Z5whfZ28.js → array-B0SXO2zY.js} +1 -1
- package/dist/{array-Z5whfZ28.js.map → array-B0SXO2zY.js.map} +1 -1
- package/dist/{clipboard-CO7bSAxL.js → clipboard-BUUe2rGt.js} +1 -1
- package/dist/{clipboard-CO7bSAxL.js.map → clipboard-BUUe2rGt.js.map} +1 -1
- package/dist/{clsx-BnvTIEMY.js → clsx-D83172mf.js} +1 -1
- package/dist/{clsx-BnvTIEMY.js.map → clsx-D83172mf.js.map} +1 -1
- package/dist/{config-DZ-BTm2e.js → config-CgDglkkw.js} +1 -1
- package/dist/{config-DZ-BTm2e.js.map → config-CgDglkkw.js.map} +1 -1
- package/dist/{constants-BhEoR-GZ.js → constants-D-YBPtws.js} +1 -1
- package/dist/{constants-BhEoR-GZ.js.map → constants-D-YBPtws.js.map} +1 -1
- package/dist/core.js +1 -1
- package/dist/{floating-ui.dom-PEni3-qj.js → floating-ui.dom-B9YqEzUD.js} +1 -1
- package/dist/{floating-ui.dom-PEni3-qj.js.map → floating-ui.dom-B9YqEzUD.js.map} +1 -1
- package/dist/{identity-DzNdV8kh.js → identity-DBvQ9SaG.js} +1 -1
- package/dist/{identity-DzNdV8kh.js.map → identity-DBvQ9SaG.js.map} +1 -1
- package/dist/{index-CHmhJlCy.js → index-BLcyRUFW.js} +2 -2
- package/dist/{index-CHmhJlCy.js.map → index-BLcyRUFW.js.map} +1 -1
- package/dist/{index-CZJiaWZN.js → index-BZ-V3udE.js} +2 -2
- package/dist/{index-CZJiaWZN.js.map → index-BZ-V3udE.js.map} +1 -1
- package/dist/{index-CMG20_7S.js → index-BzcM2nAl.js} +2 -2
- package/dist/{index-CMG20_7S.js.map → index-BzcM2nAl.js.map} +1 -1
- package/dist/{index-wexsN8zu.js → index-CCQ13d2t.js} +2 -2
- package/dist/{index-wexsN8zu.js.map → index-CCQ13d2t.js.map} +1 -1
- package/dist/{index-BrOvQRuo.js → index-CbwuBF9w.js} +2 -2
- package/dist/{index-BrOvQRuo.js.map → index-CbwuBF9w.js.map} +1 -1
- package/dist/{index-BJ3L12TJ.js → index-Cf1z5wAO.js} +2 -2
- package/dist/{index-BJ3L12TJ.js.map → index-Cf1z5wAO.js.map} +1 -1
- package/dist/{index-DRO8HSfm.js → index-D2c5viX_.js} +2 -2
- package/dist/{index-DRO8HSfm.js.map → index-D2c5viX_.js.map} +1 -1
- package/dist/{index-BniCQn-f.js → index-DQIPuqU4.js} +2 -2
- package/dist/{index-BniCQn-f.js.map → index-DQIPuqU4.js.map} +1 -1
- package/dist/{index-CXgF3Yhl.js → index-DYL-tbfk.js} +2 -2
- package/dist/{index-CXgF3Yhl.js.map → index-DYL-tbfk.js.map} +1 -1
- package/dist/{index-Dj8HmckV.js → index-Dq7O-bm8.js} +2 -2
- package/dist/{index-Dj8HmckV.js.map → index-Dq7O-bm8.js.map} +1 -1
- package/dist/{index-CljGQaiY.js → index-k2XcinIa.js} +2 -2
- package/dist/{index-CljGQaiY.js.map → index-k2XcinIa.js.map} +1 -1
- package/dist/{index-D_2wjrUN.js → index-qMwNH4DY.js} +2 -2
- package/dist/{index-D_2wjrUN.js.map → index-qMwNH4DY.js.map} +1 -1
- package/dist/{index-DZlENr_C.js → index-uBEpZNBn.js} +2 -2
- package/dist/{index-DZlENr_C.js.map → index-uBEpZNBn.js.map} +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/{index.module-BKdNahiA.js → index.module-Bdu_gwCw.js} +2 -2
- package/dist/{index.module-BKdNahiA.js.map → index.module-Bdu_gwCw.js.map} +1 -1
- package/dist/{line-Dnk6WnzK.js → line-CEBDCBhb.js} +2 -2
- package/dist/{line-Dnk6WnzK.js.map → line-CEBDCBhb.js.map} +1 -1
- package/dist/{linear-CZyKfBBG.js → linear-C7uKb8Tk.js} +1 -1
- package/dist/{linear-CZyKfBBG.js.map → linear-C7uKb8Tk.js.map} +1 -1
- package/dist/{nivo-annotations-B2rsOOOb.js → nivo-annotations-OXtu3nXs.js} +2 -2
- package/dist/{nivo-annotations-B2rsOOOb.js.map → nivo-annotations-OXtu3nXs.js.map} +1 -1
- package/dist/{nivo-axes-Ce1dH5CY.js → nivo-axes-3Cy5TCy7.js} +2 -2
- package/dist/{nivo-axes-Ce1dH5CY.js.map → nivo-axes-3Cy5TCy7.js.map} +1 -1
- package/dist/{nivo-colors-DSqwed4A.js → nivo-colors-fVDn0-vW.js} +2 -2
- package/dist/{nivo-colors-DSqwed4A.js.map → nivo-colors-fVDn0-vW.js.map} +1 -1
- package/dist/{nivo-legends-0WTLJ5Sd.js → nivo-legends-BIaWaGVX.js} +2 -2
- package/dist/{nivo-legends-0WTLJ5Sd.js.map → nivo-legends-BIaWaGVX.js.map} +1 -1
- package/dist/{omit-DhTTm08t.js → omit-Cims_XVO.js} +2 -2
- package/dist/{omit-DhTTm08t.js.map → omit-Cims_XVO.js.map} +1 -1
- package/dist/{prism-global-DdhG-WkK.js → prism-global-B3qB0vXd.js} +2 -2
- package/dist/{prism-global-DdhG-WkK.js.map → prism-global-B3qB0vXd.js.map} +1 -1
- package/dist/{successRate-BKeIquyk.js → successRate-rrLYYsum.js} +2 -2
- package/dist/{successRate-BKeIquyk.js.map → successRate-rrLYYsum.js.map} +1 -1
- package/dist/{time-Dfkn_dVS.js → time-CyaymdXm.js} +1 -1
- package/dist/{time-Dfkn_dVS.js.map → time-CyaymdXm.js.map} +1 -1
- package/dist/{toNumber-DEBMlvT0.js → toNumber-Cpsf6DxM.js} +2 -2
- package/dist/{toNumber-DEBMlvT0.js.map → toNumber-Cpsf6DxM.js.map} +1 -1
- package/dist/{toString-CTcEQi-b.js → toString-Ccq3A8Sl.js} +2 -2
- package/dist/{toString-CTcEQi-b.js.map → toString-Ccq3A8Sl.js.map} +1 -1
- package/dist/{truncate-DRv_tZCJ.js → truncate-Bk-Lghrl.js} +2 -2
- package/dist/{truncate-DRv_tZCJ.js.map → truncate-Bk-Lghrl.js.map} +1 -1
- package/dist/{upperFirst-D5eOlcn2.js → upperFirst-jXpCKAQr.js} +2 -2
- package/dist/{upperFirst-D5eOlcn2.js.map → upperFirst-jXpCKAQr.js.map} +1 -1
- package/dist/{useTooltip-DhzO0u9M.js → useTooltip-VGYCawp2.js} +2 -2
- package/dist/{useTooltip-DhzO0u9M.js.map → useTooltip-VGYCawp2.js.map} +1 -1
- package/dist/{utcTime-wBDrZaMa.js → utcTime-ClVTKNFl.js} +2 -2
- package/dist/{utcTime-wBDrZaMa.js.map → utcTime-ClVTKNFl.js.map} +1 -1
- package/dist/{utils-C1Oqs14G.js → utils-DKmgmsaJ.js} +2 -2
- package/dist/{utils-C1Oqs14G.js.map → utils-DKmgmsaJ.js.map} +1 -1
- package/dist/{utils-DNKsxZkE.js → utils-DfVSL1lz.js} +2 -2
- package/dist/{utils-DNKsxZkE.js.map → utils-DfVSL1lz.js.map} +1 -1
- package/package.json +6 -6
- package/dist/AttachmentImageDiff-BXiyAOHw.js +0 -2
- package/dist/FunnelChartRenderer-CLesVf61.js +0 -2
- package/dist/HeatMapChartRenderer-BrBfW8zd.js +0 -2
- package/dist/PieChartRenderer-CBEEPgfv.js +0 -2
- package/dist/TreeMapChartRenderer-4eHZtCVj.js +0 -2
- package/dist/_commonjsHelpers-bbZql6IY.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as t}from"./clsx-BnvTIEMY.js";import"./identity-DzNdV8kh.js";import{f as e}from"./utils-C1Oqs14G.js";import"./constants-BhEoR-GZ.js";import"node:crypto";import{useErrorBoundary as a,useState as s,useMemo as n,useEffect as _,useLayoutEffect as r}from"preact/hooks";import{B as c,S as l,I as h}from"./index-CljGQaiY.js";import{E as i}from"./index-CHmhJlCy.js";import{lazy as m,Suspense as p}from"preact/compat";import{a as o}from"./index-D_2wjrUN.js";function d(t){return t?.split(";")[0].trim().toLowerCase()}const u=t=>{const e=d(t);return"application/json"===e||"text/json"===e||e.endsWith("+json")},y=t=>{const e=d(t);return"text/html"===e||"application/xhtml+xml"===e},x="application/vnd.allure.playwright-trace",g=t=>d(t)===x?"application/zip":t,w=async({id:t,ext:a,contentType:s})=>e(`data/attachments/${`${t||"-"}${a||""}`}?attachment`,s),b=async(t,e,a)=>{const s=await w({id:t,ext:e,contentType:g(a)});return await s.blob()},f=async(t,e,a)=>{if(!t&&!e)return;const s=`${t}${e}`,n=await b(t,e,a),_=URL.createObjectURL(n),r=document.createElement("a");r.href=_,r.download=s,r.click(),URL.revokeObjectURL(_)},v=async(t,e,a)=>{if(!t&&!e)return;const s=await b(t,e,a),n=URL.createObjectURL(s);globalThis.open(n,"_blank")},k="application/vnd.allure.diagrams.mermaid",j=[k,"text/html","text/csv","text/markdown","text/tab-separated-values","text/uri-list"],L=t=>!!t&&j.includes(d(t)),R=new Set(["js","mjs","cjs","jsx","ts","mts","cts","tsx","json","html","htm","xml","css","csv","tsv","md","markdown","yaml","yml","java","py","rb","go","php","sql","kt","swift","rs","c","cpp","cs","scala","dart","lua","haskell","r","perl"]),P=new Set(["text/plain","text/*","text/uri-list"]),O=new Set(["text/markdown","text/html","text/csv","text/tab-separated-values","text/xml","text/json","text/yaml","text/javascript","text/typescript","text/ruby","text/python","text/php","text/java","text/csharp","text/cpp","text/c","text/go","text/rust","text/swift","text/kotlin","text/scala","text/perl","text/r","text/dart","text/lua","text/haskell","text/sql","text/x-yaml","text/css","application/yaml","application/x-yaml","application/xml","application/json"]),C=t=>{const e=t.lastIndexOf(".");if(!(e<=0||e===t.length-1))return t.slice(e)},A=t=>{if(!t)return!1;const e=t.contentType?.toLowerCase();let a;for(const e of[t.ext,t.name,t.originalFileName]){if(!e)continue;const t=(C(e)??e.replace(/^\./,"")).toLowerCase(),s=t.includes(".")?t.split(".").pop():t;if(s){a=s;break}}return(!e||!P.has(e))&&(!(!e||!O.has(e))||!!a&&R.has(a))},F=t=>{switch(d(t)){case"image/bmp":case"image/gif":case"image/tiff":case"image/jpeg":case"image/jpg":case"image/png":case"image/webp":case"image/*":return"image";case"text/xml":case"text/json":case"text/yaml":case"text/javascript":case"text/typescript":case"text/ruby":case"text/python":case"text/php":case"text/java":case"text/csharp":case"text/cpp":case"text/c":case"text/go":case"text/rust":case"text/swift":case"text/kotlin":case"text/scala":case"text/perl":case"text/r":case"text/dart":case"text/lua":case"text/haskell":case"text/sql":case"text/x-yaml":case"text/css":case"application/yaml":case"application/x-yaml":case"application/xml":case"application/json":return"code";case"text/plain":case"text/*":return"text";case"text/markdown":return"markdown";case"text/html":return"html";case"text/csv":case"text/tab-separated-values":return"table";case"image/svg+xml":return"svg";case"video/mp4":case"video/ogg":case"video/webm":return"video";case"text/uri-list":return"uri";case"application/x-tar":case"application/x-gtar":case"application/x-bzip2":case"application/gzip":case"application/zip":case x:return"archive";case"application/vnd.allure.image.diff":return"image-diff";case"application/vnd.allure.http+json":return"http";case k:return"mermaid";default:return null}},M=({loader:e,componentProps:_,fallback:r,errorMessage:l,retryLabel:h})=>{const[o,d]=a(),[u,y]=s(0),x=n((()=>m(e)),[e,u]);return o?t(i,{description:l,size:"xs",children:t(c,{style:"flat",text:h,onClick:()=>{y((t=>t+1)),d()}})}):t(p,{fallback:r,children:t(x,{..._})})};var U={"test-result-steps":"styles_test-result-steps__sOCjB","test-result-steps-root":"styles_test-result-steps-root__sw3Gc","test-result-step":"styles_test-result-step__35uMx","test-result-step-content":"styles_test-result-step-content__ok1gg","test-result-attachment-content":"styles_test-result-attachment-content__GK-nn","attachment-code":"styles_attachment-code__qVWLm","attachment-code-actions":"styles_attachment-code-actions__U3Sym","test-result-attachment-content-wrapper":"styles_test-result-attachment-content-wrapper__-tpyD","test-result-step-root":"styles_test-result-step-root__dJBld","test-result-step-header":"styles_test-result-step-header__AdqlU","test-result-header-text":"styles_test-result-header-text__UL3Vx","test-result-step-button":"styles_test-result-step-button__wMGEX","test-result-step-number":"styles_test-result-step-number__-Kxim","item-time":"styles_item-time__B9zAy","item-info":"styles_item-info__Irg-g","item-buttons":"styles_item-buttons__hDiWx","item-info-step":"styles_item-info-step__pbKYR","item-info-step-icon":"styles_item-info-step-icon__b2X2T","test-result-step-chevron":"styles_test-result-step-chevron__jHjsv","test-result-step-chevron-open":"styles_test-result-step-chevron-open__J-kYO","test-result-attachment-header":"styles_test-result-attachment-header__rKSDD","test-result-attachment-arrow":"styles_test-result-attachment-arrow__pBXKy","test-result-attachment-arrow-opened":"styles_test-result-attachment-arrow-opened__bQwvt","test-result-attachment-icon":"styles_test-result-attachment-icon__1-cz7","test-result-attachment-text":"styles_test-result-attachment-text__GCEOM","test-result-attachment-image":"styles_test-result-attachment-image__sJpWk","test-result-attachment-table-wrapper":"styles_test-result-attachment-table-wrapper__F5Qom","mermaid-attachment-preview":"styles_mermaid-attachment-preview__e4SQw","mermaid-attachment-loading":"styles_mermaid-attachment-loading__lmkfO","test-result-attachment-table":"styles_test-result-attachment-table__cjazn","test-result-parameters":"styles_test-result-parameters__g-ocp","attachment-background":"styles_attachment-background__NFtHv","test-result-attachment-error":"styles_test-result-attachment-error__od2Zn","test-result-visibility-hidden":"styles_test-result-visibility-hidden__McZKz","item-button":"styles_item-button__RIUAE","wrong-attachment-sign":"styles_wrong-attachment-sign__j-rkc","test-result-attachment-missed":"styles_test-result-attachment-missed__lCOi2","test-result-spinner":"styles_test-result-spinner__B3aF3","test-result-strut":"styles_test-result-strut__4dCuX",attachmentViewStack:"styles_attachmentViewStack__QMID9",attachmentViewPane:"styles_attachmentViewPane__NSDfM","html-attachment-preview":"styles_html-attachment-preview__0-kmL","markdown-attachment-preview":"styles_markdown-attachment-preview__KbomT","test-result-attachment-video":"styles_test-result-attachment-video__251vv",imageDiffWrapper:"styles_imageDiffWrapper__5nf3F","http-attachment":"styles_http-attachment__MwNPR","http-attachment__summary":"styles_http-attachment__summary__j4KBC","http-attachment__method":"styles_http-attachment__method__khW0H","http-attachment__status":"styles_http-attachment__status__7YleG","http-attachment__duration":"styles_http-attachment__duration__mRA-O","http-attachment__version":"styles_http-attachment__version__RiibR","http-attachment__meta-chip":"styles_http-attachment__meta-chip__FgwKj","http-attachment__url":"styles_http-attachment__url__hC-FR","http-attachment__exchange-arrow":"styles_http-attachment__exchange-arrow__Q-T6s","http-attachment__panel":"styles_http-attachment__panel__FfHPJ","http-attachment__panel--error":"styles_http-attachment__panel--error__idRf7","http-attachment__panel-header":"styles_http-attachment__panel-header__EF9do","http-attachment__panel-title":"styles_http-attachment__panel-title__S-PvX","http-attachment__panel-line":"styles_http-attachment__panel-line__LKOl0","http-attachment__meta":"styles_http-attachment__meta__YpflO","http-attachment__meta-row":"styles_http-attachment__meta-row__FBPl5","http-attachment__label":"styles_http-attachment__label__Wi2fO","http-attachment__pair-name":"styles_http-attachment__pair-name__PkJ0C","http-attachment__table":"styles_http-attachment__table__IcWko","http-attachment__value":"styles_http-attachment__value__DNu-l","http-attachment__groups":"styles_http-attachment__groups__Upae-","http-attachment__group":"styles_http-attachment__group__5W7pg","http-attachment__group--body":"styles_http-attachment__group--body__IsEW7","http-attachment__group-summary":"styles_http-attachment__group-summary__wGEc6","http-attachment__group-title":"styles_http-attachment__group-title__4yZ03","http-attachment__group-content":"styles_http-attachment__group-content__zCrxO","http-attachment__cookie-attrs":"styles_http-attachment__cookie-attrs__YQ5-9","http-attachment__masked-value":"styles_http-attachment__masked-value__JzhET","http-attachment__part-list":"styles_http-attachment__part-list__DxTbx","http-attachment__part-card":"styles_http-attachment__part-card__J6naV","http-attachment__part-card-header":"styles_http-attachment__part-card-header__LbkDL","http-attachment__part-title":"styles_http-attachment__part-title__b3BWO","http-attachment__part-section":"styles_http-attachment__part-section__8CGF7","http-attachment__part-section-title":"styles_http-attachment__part-section-title__K1Vpw","http-attachment__part-header-list":"styles_http-attachment__part-header-list__dOGyN","http-attachment__part-header-row":"styles_http-attachment__part-header-row__W-bvy","http-attachment__part-header-name":"styles_http-attachment__part-header-name__eteMA","http-attachment__part-header-value":"styles_http-attachment__part-header-value__3pQz4","http-attachment__part-value":"styles_http-attachment__part-value__x-Sxb","http-attachment__body":"styles_http-attachment__body__v14HL","http-attachment__body-toolbar":"styles_http-attachment__body-toolbar__oefh2","http-attachment__body-heading":"styles_http-attachment__body-heading__OQx6L","http-attachment__body-title":"styles_http-attachment__body-title__ZMQSW","http-attachment__meta-chips":"styles_http-attachment__meta-chips__dvc-6","http-attachment__body-actions":"styles_http-attachment__body-actions__F-FqP","http-attachment__body-action":"styles_http-attachment__body-action__PErGj","http-attachment__body-content":"styles_http-attachment__body-content__q0CG1","http-attachment__body-content--structured":"styles_http-attachment__body-content--structured__-9Khu","http-attachment__body-message":"styles_http-attachment__body-message__cdLDG","http-attachment__empty":"styles_http-attachment__empty__87Ms5"};const D=e=>{const{attachment:a,item:n}=e,[r,c]=s(!0);return _((()=>{if(a&&"img"in a&&a.img){const t=new Image;t.onload=()=>c(!0),t.onerror=()=>c(!1),t.src=a.img}}),[a]),t("div",a&&"img"in a&&r?{"data-testid":"image-attachment-content",className:U["test-result-attachment-image"],children:t("img",{src:a.img,alt:n.link.originalFileName})}:{className:U["test-result-attachment-error"],children:"something went wrong"})},S=({attachment:e,item:a})=>e&&"src"in e?t("video",{"data-testid":"video-attachment-content",class:U["test-result-attachment-video"],controls:!0,loop:!0,muted:!0,children:t("source",{src:e.src,type:a.link.contentType})}):t(l,{}),T=()=>import(/* webpackChunkName: "attachment-code" */"./AttachmentCode-BaFv0Nkk.js").then((t=>({default:t.AttachmentCode}))),W={image:null,svg:null,video:null,archive:null,json:T,code:T,uri:T,css:T,html:T,markdown:T,text:T,mermaid:T,table:()=>import(/* webpackChunkName: "attachment-table" */"./AttachmentTable-xY7Ovinb.js").then((t=>({default:t.AttachmentTable}))),"image-diff":()=>import(/* webpackChunkName: "attachment-image-diff" */"./AttachmentImageDiff-BXiyAOHw.js").then((t=>({default:t.AttachmentImageDiff}))),http:()=>import(/* webpackChunkName: "attachment-http" */"./HttpAttachment-A7AWm-d9.js").then((t=>({default:t.HttpAttachment})))},N={html:()=>import(/* webpackChunkName: "attachment-html" */"./HtmlPreview-NgG4sciW.js").then((t=>({default:t.HtmlPreview}))),markdown:()=>import(/* webpackChunkName: "attachment-markdown" */"./MarkdownPreview-C-NFR_X3.js").then((t=>({default:t.MarkdownPreview}))),mermaid:()=>import(/* webpackChunkName: "attachment-mermaid" */"./MermaidPreview-DHvqVM10.js").then((t=>({default:t.MermaidPreview})))},z=new Set(["html","markdown","mermaid"]),E=e=>{const{item:a,previewable:n,highlightCode:_=!0,i18n:c}=e,{link:{contentType:m,id:p,ext:d}}=a,[u,y]=s(null),[x,g]=s(!0),[b,f]=s(!1),v=F(m),k=`${p}:${d}:${m}`,[j,L]=s(0);if(r((()=>{if(!v)return;let t,e=!0;const a=()=>{e=!1,t&&URL.revokeObjectURL(t)};return(async()=>{g(!0),f(!1);try{const s=await(async(t,e,a)=>{if(!t&&!e)return null;const s=await w({id:t,ext:e,contentType:a}),n=F(a);if(!s.ok)throw new Error("Failed to fetch");switch(n){case"svg":case"image":{const e=await s.blob();return{img:URL.createObjectURL(e),id:t}}case"uri":case"code":case"html":case"markdown":case"mermaid":case"table":case"text":return{text:await s.text()};case"video":{const e=await s.blob();return{src:URL.createObjectURL(e),id:t,contentType:a}}case"image-diff":return{diff:await s.json()};case"http":return{http:await s.json()};default:return null}})(p,d,m);if(t=s?"img"in s?s.img:"src"in s?s.src:void 0:void 0,!e)return void a();y(s),g(!1)}catch{e&&(f(!0),g(!1))}})(),a}),[p,d,m,v,j]),!v)return null;if(x)return t("div",{className:U["test-result-spinner"],children:t(l,{})});if(b)return t(i,{description:"Failed to load attachment",size:"xs",children:t(h,{style:"flat",icon:o.lineArrowsRefreshCcw1,onClick:()=>L((t=>t+1))})});const R=W[v],P=N[v],O=u&&"text"in u?u:void 0,C=c?.["image-diff"===v?"imageDiff":v],A=R===T,E={attachment:u,item:a,i18n:A?c?.controls:C,...A?{highlight:_}:{}},V=t("div",{className:U["test-result-spinner"],children:t(l,{})}),K=c?.controls?.("loadAttachmentViewerError")??"Failed to load attachment viewer",G=c?.controls?.("retry")??"Retry",I=R?t(M,{loader:R,componentProps:E,fallback:V,errorMessage:K,retryLabel:G},k):"video"===v?t(S,{...E}):"image"===v||"svg"===v?t(D,{...E}):null;if(z.has(v)&&P&&O){const e=!!n;return t("div",{className:U.attachmentViewStack,children:[t("div",{className:U.attachmentViewPane,hidden:e,children:I}),t("div",{className:U.attachmentViewPane,hidden:!e,children:t(M,{loader:P,componentProps:{attachment:O},fallback:V,errorMessage:K,retryLabel:G},k)})]})}return I};export{E as A,M as L,y as a,D as b,S as c,F as d,L as e,A as f,f as g,u as i,d as n,v as o,U as s};
|
|
2
|
-
//# sourceMappingURL=Attachment-
|
|
1
|
+
import{u as t}from"./clsx-D83172mf.js";import"./identity-DBvQ9SaG.js";import{f as e}from"./utils-DKmgmsaJ.js";import"./constants-D-YBPtws.js";import"node:crypto";import{useErrorBoundary as a,useState as s,useMemo as n,useEffect as _,useLayoutEffect as r}from"preact/hooks";import{B as c,S as l,I as h}from"./index-k2XcinIa.js";import{E as i}from"./index-BLcyRUFW.js";import{lazy as m,Suspense as p}from"preact/compat";import{a as o}from"./index-qMwNH4DY.js";function d(t){return t?.split(";")[0].trim().toLowerCase()}const u=t=>{const e=d(t);return"application/json"===e||"text/json"===e||e.endsWith("+json")},y=t=>{const e=d(t);return"text/html"===e||"application/xhtml+xml"===e},x="application/vnd.allure.playwright-trace",g=t=>d(t)===x?"application/zip":t,w=async({id:t,ext:a,contentType:s})=>e(`data/attachments/${`${t||"-"}${a||""}`}?attachment`,s),b=async(t,e,a)=>{const s=await w({id:t,ext:e,contentType:g(a)});return await s.blob()},f=async(t,e,a)=>{if(!t&&!e)return;const s=`${t}${e}`,n=await b(t,e,a),_=URL.createObjectURL(n),r=document.createElement("a");r.href=_,r.download=s,r.click(),URL.revokeObjectURL(_)},v=async(t,e,a)=>{if(!t&&!e)return;const s=await b(t,e,a),n=URL.createObjectURL(s);globalThis.open(n,"_blank")},k="application/vnd.allure.diagrams.mermaid",j=[k,"text/html","text/csv","text/markdown","text/tab-separated-values","text/uri-list"],L=t=>!!t&&j.includes(d(t)),R=new Set(["js","mjs","cjs","jsx","ts","mts","cts","tsx","json","html","htm","xml","css","csv","tsv","md","markdown","yaml","yml","java","py","rb","go","php","sql","kt","swift","rs","c","cpp","cs","scala","dart","lua","haskell","r","perl"]),P=new Set(["text/plain","text/*","text/uri-list"]),O=new Set(["text/markdown","text/html","text/csv","text/tab-separated-values","text/xml","text/json","text/yaml","text/javascript","text/typescript","text/ruby","text/python","text/php","text/java","text/csharp","text/cpp","text/c","text/go","text/rust","text/swift","text/kotlin","text/scala","text/perl","text/r","text/dart","text/lua","text/haskell","text/sql","text/x-yaml","text/css","application/yaml","application/x-yaml","application/xml","application/json"]),C=t=>{const e=t.lastIndexOf(".");if(!(e<=0||e===t.length-1))return t.slice(e)},A=t=>{if(!t)return!1;const e=t.contentType?.toLowerCase();let a;for(const e of[t.ext,t.name,t.originalFileName]){if(!e)continue;const t=(C(e)??e.replace(/^\./,"")).toLowerCase(),s=t.includes(".")?t.split(".").pop():t;if(s){a=s;break}}return(!e||!P.has(e))&&(!(!e||!O.has(e))||!!a&&R.has(a))},F=t=>{switch(d(t)){case"image/bmp":case"image/gif":case"image/tiff":case"image/jpeg":case"image/jpg":case"image/png":case"image/webp":case"image/*":return"image";case"text/xml":case"text/json":case"text/yaml":case"text/javascript":case"text/typescript":case"text/ruby":case"text/python":case"text/php":case"text/java":case"text/csharp":case"text/cpp":case"text/c":case"text/go":case"text/rust":case"text/swift":case"text/kotlin":case"text/scala":case"text/perl":case"text/r":case"text/dart":case"text/lua":case"text/haskell":case"text/sql":case"text/x-yaml":case"text/css":case"application/yaml":case"application/x-yaml":case"application/xml":case"application/json":return"code";case"text/plain":case"text/*":return"text";case"text/markdown":return"markdown";case"text/html":return"html";case"text/csv":case"text/tab-separated-values":return"table";case"image/svg+xml":return"svg";case"video/mp4":case"video/ogg":case"video/webm":return"video";case"text/uri-list":return"uri";case"application/x-tar":case"application/x-gtar":case"application/x-bzip2":case"application/gzip":case"application/zip":case x:return"archive";case"application/vnd.allure.image.diff":return"image-diff";case"application/vnd.allure.http+json":return"http";case k:return"mermaid";default:return null}},M=({loader:e,componentProps:_,fallback:r,errorMessage:l,retryLabel:h})=>{const[o,d]=a(),[u,y]=s(0),x=n((()=>m(e)),[e,u]);return o?t(i,{description:l,size:"xs",children:t(c,{style:"flat",text:h,onClick:()=>{y((t=>t+1)),d()}})}):t(p,{fallback:r,children:t(x,{..._})})};var U={"test-result-steps":"styles_test-result-steps__sOCjB","test-result-steps-root":"styles_test-result-steps-root__sw3Gc","test-result-step":"styles_test-result-step__35uMx","test-result-step-content":"styles_test-result-step-content__ok1gg","test-result-attachment-content":"styles_test-result-attachment-content__GK-nn","attachment-code":"styles_attachment-code__qVWLm","attachment-code-actions":"styles_attachment-code-actions__U3Sym","test-result-attachment-content-wrapper":"styles_test-result-attachment-content-wrapper__-tpyD","test-result-step-root":"styles_test-result-step-root__dJBld","test-result-step-header":"styles_test-result-step-header__AdqlU","test-result-header-text":"styles_test-result-header-text__UL3Vx","test-result-step-button":"styles_test-result-step-button__wMGEX","test-result-step-number":"styles_test-result-step-number__-Kxim","item-time":"styles_item-time__B9zAy","item-info":"styles_item-info__Irg-g","item-buttons":"styles_item-buttons__hDiWx","item-info-step":"styles_item-info-step__pbKYR","item-info-step-icon":"styles_item-info-step-icon__b2X2T","test-result-step-chevron":"styles_test-result-step-chevron__jHjsv","test-result-step-chevron-open":"styles_test-result-step-chevron-open__J-kYO","test-result-attachment-header":"styles_test-result-attachment-header__rKSDD","test-result-attachment-arrow":"styles_test-result-attachment-arrow__pBXKy","test-result-attachment-arrow-opened":"styles_test-result-attachment-arrow-opened__bQwvt","test-result-attachment-icon":"styles_test-result-attachment-icon__1-cz7","test-result-attachment-text":"styles_test-result-attachment-text__GCEOM","test-result-attachment-image":"styles_test-result-attachment-image__sJpWk","test-result-attachment-table-wrapper":"styles_test-result-attachment-table-wrapper__F5Qom","mermaid-attachment-preview":"styles_mermaid-attachment-preview__e4SQw","mermaid-attachment-loading":"styles_mermaid-attachment-loading__lmkfO","test-result-attachment-table":"styles_test-result-attachment-table__cjazn","test-result-parameters":"styles_test-result-parameters__g-ocp","attachment-background":"styles_attachment-background__NFtHv","test-result-attachment-error":"styles_test-result-attachment-error__od2Zn","test-result-visibility-hidden":"styles_test-result-visibility-hidden__McZKz","item-button":"styles_item-button__RIUAE","wrong-attachment-sign":"styles_wrong-attachment-sign__j-rkc","test-result-attachment-missed":"styles_test-result-attachment-missed__lCOi2","test-result-spinner":"styles_test-result-spinner__B3aF3","test-result-strut":"styles_test-result-strut__4dCuX",attachmentViewStack:"styles_attachmentViewStack__QMID9",attachmentViewPane:"styles_attachmentViewPane__NSDfM","html-attachment-preview":"styles_html-attachment-preview__0-kmL","markdown-attachment-preview":"styles_markdown-attachment-preview__KbomT","test-result-attachment-video":"styles_test-result-attachment-video__251vv",imageDiffWrapper:"styles_imageDiffWrapper__5nf3F","http-attachment":"styles_http-attachment__MwNPR","http-attachment__summary":"styles_http-attachment__summary__j4KBC","http-attachment__method":"styles_http-attachment__method__khW0H","http-attachment__status":"styles_http-attachment__status__7YleG","http-attachment__duration":"styles_http-attachment__duration__mRA-O","http-attachment__version":"styles_http-attachment__version__RiibR","http-attachment__meta-chip":"styles_http-attachment__meta-chip__FgwKj","http-attachment__url":"styles_http-attachment__url__hC-FR","http-attachment__exchange-arrow":"styles_http-attachment__exchange-arrow__Q-T6s","http-attachment__panel":"styles_http-attachment__panel__FfHPJ","http-attachment__panel--error":"styles_http-attachment__panel--error__idRf7","http-attachment__panel-header":"styles_http-attachment__panel-header__EF9do","http-attachment__panel-title":"styles_http-attachment__panel-title__S-PvX","http-attachment__panel-line":"styles_http-attachment__panel-line__LKOl0","http-attachment__meta":"styles_http-attachment__meta__YpflO","http-attachment__meta-row":"styles_http-attachment__meta-row__FBPl5","http-attachment__label":"styles_http-attachment__label__Wi2fO","http-attachment__pair-name":"styles_http-attachment__pair-name__PkJ0C","http-attachment__table":"styles_http-attachment__table__IcWko","http-attachment__value":"styles_http-attachment__value__DNu-l","http-attachment__groups":"styles_http-attachment__groups__Upae-","http-attachment__group":"styles_http-attachment__group__5W7pg","http-attachment__group--body":"styles_http-attachment__group--body__IsEW7","http-attachment__group-summary":"styles_http-attachment__group-summary__wGEc6","http-attachment__group-title":"styles_http-attachment__group-title__4yZ03","http-attachment__group-content":"styles_http-attachment__group-content__zCrxO","http-attachment__cookie-attrs":"styles_http-attachment__cookie-attrs__YQ5-9","http-attachment__masked-value":"styles_http-attachment__masked-value__JzhET","http-attachment__part-list":"styles_http-attachment__part-list__DxTbx","http-attachment__part-card":"styles_http-attachment__part-card__J6naV","http-attachment__part-card-header":"styles_http-attachment__part-card-header__LbkDL","http-attachment__part-title":"styles_http-attachment__part-title__b3BWO","http-attachment__part-section":"styles_http-attachment__part-section__8CGF7","http-attachment__part-section-title":"styles_http-attachment__part-section-title__K1Vpw","http-attachment__part-header-list":"styles_http-attachment__part-header-list__dOGyN","http-attachment__part-header-row":"styles_http-attachment__part-header-row__W-bvy","http-attachment__part-header-name":"styles_http-attachment__part-header-name__eteMA","http-attachment__part-header-value":"styles_http-attachment__part-header-value__3pQz4","http-attachment__part-value":"styles_http-attachment__part-value__x-Sxb","http-attachment__body":"styles_http-attachment__body__v14HL","http-attachment__body-toolbar":"styles_http-attachment__body-toolbar__oefh2","http-attachment__body-heading":"styles_http-attachment__body-heading__OQx6L","http-attachment__body-title":"styles_http-attachment__body-title__ZMQSW","http-attachment__meta-chips":"styles_http-attachment__meta-chips__dvc-6","http-attachment__body-actions":"styles_http-attachment__body-actions__F-FqP","http-attachment__body-action":"styles_http-attachment__body-action__PErGj","http-attachment__body-content":"styles_http-attachment__body-content__q0CG1","http-attachment__body-content--structured":"styles_http-attachment__body-content--structured__-9Khu","http-attachment__body-message":"styles_http-attachment__body-message__cdLDG","http-attachment__empty":"styles_http-attachment__empty__87Ms5"};const D=e=>{const{attachment:a,item:n}=e,[r,c]=s(!0);return _((()=>{if(a&&"img"in a&&a.img){const t=new Image;t.onload=()=>c(!0),t.onerror=()=>c(!1),t.src=a.img}}),[a]),t("div",a&&"img"in a&&r?{"data-testid":"image-attachment-content",className:U["test-result-attachment-image"],children:t("img",{src:a.img,alt:n.link.originalFileName})}:{className:U["test-result-attachment-error"],children:"something went wrong"})},S=({attachment:e,item:a})=>e&&"src"in e?t("video",{"data-testid":"video-attachment-content",class:U["test-result-attachment-video"],controls:!0,loop:!0,muted:!0,children:t("source",{src:e.src,type:a.link.contentType})}):t(l,{}),T=()=>import(/* webpackChunkName: "attachment-code" */"./AttachmentCode-DLfL9_C7.js").then((t=>({default:t.AttachmentCode}))),W={image:null,svg:null,video:null,archive:null,json:T,code:T,uri:T,css:T,html:T,markdown:T,text:T,mermaid:T,table:()=>import(/* webpackChunkName: "attachment-table" */"./AttachmentTable-B_2qN3O-.js").then((t=>({default:t.AttachmentTable}))),"image-diff":()=>import(/* webpackChunkName: "attachment-image-diff" */"./AttachmentImageDiff-Bp1b_UU5.js").then((t=>({default:t.AttachmentImageDiff}))),http:()=>import(/* webpackChunkName: "attachment-http" */"./HttpAttachment-CkQRcAfa.js").then((t=>({default:t.HttpAttachment})))},N={html:()=>import(/* webpackChunkName: "attachment-html" */"./HtmlPreview-u0sa77g5.js").then((t=>({default:t.HtmlPreview}))),markdown:()=>import(/* webpackChunkName: "attachment-markdown" */"./MarkdownPreview-BEs6LvOd.js").then((t=>({default:t.MarkdownPreview}))),mermaid:()=>import(/* webpackChunkName: "attachment-mermaid" */"./MermaidPreview-4EDQwdX3.js").then((t=>({default:t.MermaidPreview})))},z=new Set(["html","markdown","mermaid"]),E=e=>{const{item:a,previewable:n,highlightCode:_=!0,i18n:c}=e,{link:{contentType:m,id:p,ext:d}}=a,[u,y]=s(null),[x,g]=s(!0),[b,f]=s(!1),v=F(m),k=`${p}:${d}:${m}`,[j,L]=s(0);if(r((()=>{if(!v)return;let t,e=!0;const a=()=>{e=!1,t&&URL.revokeObjectURL(t)};return(async()=>{g(!0),f(!1);try{const s=await(async(t,e,a)=>{if(!t&&!e)return null;const s=await w({id:t,ext:e,contentType:a}),n=F(a);if(!s.ok)throw new Error("Failed to fetch");switch(n){case"svg":case"image":{const e=await s.blob();return{img:URL.createObjectURL(e),id:t}}case"uri":case"code":case"html":case"markdown":case"mermaid":case"table":case"text":return{text:await s.text()};case"video":{const e=await s.blob();return{src:URL.createObjectURL(e),id:t,contentType:a}}case"image-diff":return{diff:await s.json()};case"http":return{http:await s.json()};default:return null}})(p,d,m);if(t=s?"img"in s?s.img:"src"in s?s.src:void 0:void 0,!e)return void a();y(s),g(!1)}catch{e&&(f(!0),g(!1))}})(),a}),[p,d,m,v,j]),!v)return null;if(x)return t("div",{className:U["test-result-spinner"],children:t(l,{})});if(b)return t(i,{description:"Failed to load attachment",size:"xs",children:t(h,{style:"flat",icon:o.lineArrowsRefreshCcw1,onClick:()=>L((t=>t+1))})});const R=W[v],P=N[v],O=u&&"text"in u?u:void 0,C=c?.["image-diff"===v?"imageDiff":v],A=R===T,E={attachment:u,item:a,i18n:A?c?.controls:C,...A?{highlight:_}:{}},V=t("div",{className:U["test-result-spinner"],children:t(l,{})}),K=c?.controls?.("loadAttachmentViewerError")??"Failed to load attachment viewer",G=c?.controls?.("retry")??"Retry",I=R?t(M,{loader:R,componentProps:E,fallback:V,errorMessage:K,retryLabel:G},k):"video"===v?t(S,{...E}):"image"===v||"svg"===v?t(D,{...E}):null;if(z.has(v)&&P&&O){const e=!!n;return t("div",{className:U.attachmentViewStack,children:[t("div",{className:U.attachmentViewPane,hidden:e,children:I}),t("div",{className:U.attachmentViewPane,hidden:!e,children:t(M,{loader:P,componentProps:{attachment:O},fallback:V,errorMessage:K,retryLabel:G},k)})]})}return I};export{E as A,M as L,y as a,D as b,S as c,F as d,L as e,A as f,f as g,u as i,d as n,v as o,U as s};
|
|
2
|
+
//# sourceMappingURL=Attachment-DFk4AiwI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Attachment-D75lkuAG.js","sources":["../../web-commons/dist/contentTypes.js","../../web-commons/dist/attachments.js","../src/components/LazyComponent/index.tsx","../src/components/Attachment/AttachmentImage.tsx","../src/components/Attachment/AttachmentVideo.tsx","../src/components/Attachment/Attachment.tsx"],"sourcesContent":["export function normalizeAttachmentContentType(type) {\n return type?.split(\";\")[0].trim().toLowerCase();\n}\nexport const isJsonAttachmentContentType = (type) => {\n const normalized = normalizeAttachmentContentType(type);\n return normalized === \"application/json\" || normalized === \"text/json\" || normalized.endsWith(\"+json\");\n};\nexport const isHtmlAttachmentContentType = (type) => {\n const normalized = normalizeAttachmentContentType(type);\n return normalized === \"text/html\" || normalized === \"application/xhtml+xml\";\n};\n","import { normalizeAttachmentContentType } from \"./contentTypes.js\";\nimport { fetchReportAttachment } from \"./data.js\";\nconst PLAYWRIGHT_TRACE_CONTENT_TYPE = \"application/vnd.allure.playwright-trace\";\nconst PLAYWRIGHT_TRACE_DOWNLOAD_CONTENT_TYPE = \"application/zip\";\nconst downloadContentType = (contentType) => {\n return normalizeAttachmentContentType(contentType) === PLAYWRIGHT_TRACE_CONTENT_TYPE\n ? PLAYWRIGHT_TRACE_DOWNLOAD_CONTENT_TYPE\n : contentType;\n};\nexport const fetchFromUrl = async ({ id, ext, contentType }) => {\n const fileName = `${id || \"-\"}${ext || \"\"}`;\n return fetchReportAttachment(`data/attachments/${fileName}?attachment`, contentType);\n};\nexport const fetchAttachment = async (id, ext, contentType) => {\n if (!id && !ext) {\n return null;\n }\n const response = await fetchFromUrl({ id, ext, contentType });\n const fileType = attachmentType(contentType);\n if (!response.ok) {\n throw new Error(\"Failed to fetch\");\n }\n switch (fileType) {\n case \"svg\":\n case \"image\": {\n const blob = await response.blob();\n const img = URL.createObjectURL(blob);\n return { img, id };\n }\n case \"uri\":\n case \"code\":\n case \"html\":\n case \"markdown\":\n case \"mermaid\":\n case \"table\":\n case \"text\": {\n const text = await response.text();\n return { text };\n }\n case \"video\": {\n const blob = await response.blob();\n const src = URL.createObjectURL(blob);\n return { src, id, contentType };\n }\n case \"image-diff\": {\n const json = await response.json();\n return { diff: json };\n }\n case \"http\": {\n const json = await response.json();\n return { http: json };\n }\n default:\n return null;\n }\n};\nexport const blobAttachment = async (id, ext, contentType) => {\n const response = await fetchFromUrl({ id, ext, contentType: downloadContentType(contentType) });\n return await response.blob();\n};\nexport const downloadAttachment = async (id, ext, contentType) => {\n if (!id && !ext) {\n return;\n }\n const fileName = `${id}${ext}`;\n const blob = await blobAttachment(id, ext, contentType);\n const linkUrl = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.href = linkUrl;\n link.download = fileName;\n link.click();\n URL.revokeObjectURL(linkUrl);\n};\nexport const openAttachmentInNewTab = async (id, ext, contentType) => {\n if (!id && !ext) {\n return;\n }\n const blob = await blobAttachment(id, ext, contentType);\n const linkUrl = URL.createObjectURL(blob);\n globalThis.open(linkUrl, \"_blank\");\n};\nexport const MERMAID_CONTENT_TYPE = \"application/vnd.allure.diagrams.mermaid\";\nexport const PREVIEWABLE_CONTENT_TYPES = [\n MERMAID_CONTENT_TYPE,\n \"text/html\",\n \"text/csv\",\n \"text/markdown\",\n \"text/tab-separated-values\",\n \"text/uri-list\",\n];\nexport const isPreviewableContentType = (type) => !!type && PREVIEWABLE_CONTENT_TYPES.includes(normalizeAttachmentContentType(type));\nconst HIGHLIGHT_EXTS = new Set([\n \"js\",\n \"mjs\",\n \"cjs\",\n \"jsx\",\n \"ts\",\n \"mts\",\n \"cts\",\n \"tsx\",\n \"json\",\n \"html\",\n \"htm\",\n \"xml\",\n \"css\",\n \"csv\",\n \"tsv\",\n \"md\",\n \"markdown\",\n \"yaml\",\n \"yml\",\n \"java\",\n \"py\",\n \"rb\",\n \"go\",\n \"php\",\n \"sql\",\n \"kt\",\n \"swift\",\n \"rs\",\n \"c\",\n \"cpp\",\n \"cs\",\n \"scala\",\n \"dart\",\n \"lua\",\n \"haskell\",\n \"r\",\n \"perl\",\n]);\nconst NO_HIGHLIGHT_TYPES = new Set([\"text/plain\", \"text/*\", \"text/uri-list\"]);\nconst HIGHLIGHT_TYPES = new Set([\n \"text/markdown\",\n \"text/html\",\n \"text/csv\",\n \"text/tab-separated-values\",\n \"text/xml\",\n \"text/json\",\n \"text/yaml\",\n \"text/javascript\",\n \"text/typescript\",\n \"text/ruby\",\n \"text/python\",\n \"text/php\",\n \"text/java\",\n \"text/csharp\",\n \"text/cpp\",\n \"text/c\",\n \"text/go\",\n \"text/rust\",\n \"text/swift\",\n \"text/kotlin\",\n \"text/scala\",\n \"text/perl\",\n \"text/r\",\n \"text/dart\",\n \"text/lua\",\n \"text/haskell\",\n \"text/sql\",\n \"text/x-yaml\",\n \"text/css\",\n \"application/yaml\",\n \"application/x-yaml\",\n \"application/xml\",\n \"application/json\",\n]);\nexport const extname = (str) => {\n const i = str.lastIndexOf(\".\");\n if (i <= 0 || i === str.length - 1)\n return undefined;\n return str.slice(i);\n};\nexport const isSyntaxHighlightSupported = (payload) => {\n if (!payload) {\n return false;\n }\n const contentType = payload.contentType?.toLowerCase();\n let ext;\n for (const part of [payload.ext, payload.name, payload.originalFileName]) {\n if (!part) {\n continue;\n }\n const withDot = extname(part);\n const normalized = (withDot ?? part.replace(/^\\./, \"\")).toLowerCase();\n const single = normalized.includes(\".\") ? normalized.split(\".\").pop() : normalized;\n if (single) {\n ext = single;\n break;\n }\n }\n if (contentType && NO_HIGHLIGHT_TYPES.has(contentType)) {\n return false;\n }\n if (contentType && HIGHLIGHT_TYPES.has(contentType)) {\n return true;\n }\n return !!ext && HIGHLIGHT_EXTS.has(ext);\n};\nexport const attachmentType = (type) => {\n const normalizedType = normalizeAttachmentContentType(type);\n switch (normalizedType) {\n case \"image/bmp\":\n case \"image/gif\":\n case \"image/tiff\":\n case \"image/jpeg\":\n case \"image/jpg\":\n case \"image/png\":\n case \"image/webp\":\n case \"image/*\":\n return \"image\";\n case \"text/xml\":\n case \"text/json\":\n case \"text/yaml\":\n case \"text/javascript\":\n case \"text/typescript\":\n case \"text/ruby\":\n case \"text/python\":\n case \"text/php\":\n case \"text/java\":\n case \"text/csharp\":\n case \"text/cpp\":\n case \"text/c\":\n case \"text/go\":\n case \"text/rust\":\n case \"text/swift\":\n case \"text/kotlin\":\n case \"text/scala\":\n case \"text/perl\":\n case \"text/r\":\n case \"text/dart\":\n case \"text/lua\":\n case \"text/haskell\":\n case \"text/sql\":\n case \"text/x-yaml\":\n case \"text/css\":\n case \"application/yaml\":\n case \"application/x-yaml\":\n case \"application/xml\":\n case \"application/json\":\n return \"code\";\n case \"text/plain\":\n case \"text/*\":\n return \"text\";\n case \"text/markdown\":\n return \"markdown\";\n case \"text/html\":\n return \"html\";\n case \"text/csv\":\n case \"text/tab-separated-values\":\n return \"table\";\n case \"image/svg+xml\":\n return \"svg\";\n case \"video/mp4\":\n case \"video/ogg\":\n case \"video/webm\":\n return \"video\";\n case \"text/uri-list\":\n return \"uri\";\n case \"application/x-tar\":\n case \"application/x-gtar\":\n case \"application/x-bzip2\":\n case \"application/gzip\":\n case \"application/zip\":\n case PLAYWRIGHT_TRACE_CONTENT_TYPE:\n return \"archive\";\n case \"application/vnd.allure.image.diff\":\n return \"image-diff\";\n case \"application/vnd.allure.http+json\":\n return \"http\";\n case MERMAID_CONTENT_TYPE:\n return \"mermaid\";\n default:\n return null;\n }\n};\nexport const restrictedContentTypes = [\"application/gzip\"];\n",null,null,null,null],"names":["normalizeAttachmentContentType","type","split","trim","toLowerCase","isJsonAttachmentContentType","normalized","endsWith","isHtmlAttachmentContentType","PLAYWRIGHT_TRACE_CONTENT_TYPE","downloadContentType","contentType","fetchFromUrl","async","id","ext","fetchReportAttachment","blobAttachment","response","blob","downloadAttachment","fileName","linkUrl","URL","createObjectURL","link","document","createElement","href","download","click","revokeObjectURL","openAttachmentInNewTab","globalThis","open","MERMAID_CONTENT_TYPE","PREVIEWABLE_CONTENT_TYPES","isPreviewableContentType","includes","HIGHLIGHT_EXTS","Set","NO_HIGHLIGHT_TYPES","HIGHLIGHT_TYPES","extname","str","i","lastIndexOf","length","slice","isSyntaxHighlightSupported","payload","part","name","originalFileName","replace","single","pop","has","attachmentType","LazyComponent","loader","componentProps","fallback","errorMessage","retryLabel","error","resetError","useErrorBoundary","attempt","setAttempt","useState","Component","useMemo","lazy","_jsx","EmptyView","description","size","children","Button","style","text","onClick","value","Suspense","AttachmentImage","props","attachment","item","isValidImage","setIsValidImage","useEffect","img","Image","onload","onerror","src","className","styles","alt","AttachmentVideo","class","controls","loop","muted","Spinner","loadCode","import","then","module","default","AttachmentCode","loadersByAttachmentType","image","svg","video","archive","json","code","uri","css","html","markdown","mermaid","table","loadTable","AttachmentTable","loadImageDiff","AttachmentImageDiff","http","loadHttp","HttpAttachment","previewLoaders","loadHtml","HtmlPreview","loadMarkdown","MarkdownPreview","loadMermaid","MermaidPreview","DUAL_VIEW_ATTACHMENT_TYPES","Attachment","previewable","highlightCode","i18n","setAttachment","isLoading","setLoading","isError","setError","componentType","viewerKey","retry","setRetry","useLayoutEffect","objectUrl","active","dispose","result","fileType","ok","Error","diff","fetchAttachment","undefined","fetchData","IconButton","icon","allureIcons","lineArrowsRefreshCcw1","previewLoader","previewAttachment","typeI18n","isCode","highlight","source","showPreview","_jsxs","attachmentViewStack","attachmentViewPane","hidden"],"mappings":"0cAAO,SAASA,EAA+BC,GAC3C,OAAOA,GAAMC,MAAM,KAAK,GAAGC,OAAOC,aACtC,CACO,MAAMC,EAA+BJ,IACxC,MAAMK,EAAaN,EAA+BC,GAClD,MAAsB,qBAAfK,GAAoD,cAAfA,GAA8BA,EAAWC,SAAS,QAAQ,EAE7FC,EAA+BP,IACxC,MAAMK,EAAaN,EAA+BC,GAClD,MAAsB,cAAfK,GAA6C,0BAAfA,CAAsC,ECPzEG,EAAgC,0CAEhCC,EAAuBC,GAClBX,EAA+BW,KAAiBF,EAFZ,kBAIrCE,EAEGC,EAAeC,OAASC,KAAIC,MAAKJ,iBAEnCK,EAAsB,oBADZ,GAAGF,GAAM,MAAMC,GAAO,kBACiCJ,GA6C/DM,EAAiBJ,MAAOC,EAAIC,EAAKJ,KAC1C,MAAMO,QAAiBN,EAAa,CAAEE,KAAIC,MAAKJ,YAAaD,EAAoBC,KAChF,aAAaO,EAASC,MAAM,EAEnBC,EAAqBP,MAAOC,EAAIC,EAAKJ,KAC9C,IAAKG,IAAOC,EACR,OAEJ,MAAMM,EAAW,GAAGP,IAAKC,IACnBI,QAAaF,EAAeH,EAAIC,EAAKJ,GACrCW,EAAUC,IAAIC,gBAAgBL,GAC9BM,EAAOC,SAASC,cAAc,KACpCF,EAAKG,KAAON,EACZG,EAAKI,SAAWR,EAChBI,EAAKK,QACLP,IAAIQ,gBAAgBT,EAAQ,EAEnBU,EAAyBnB,MAAOC,EAAIC,EAAK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,EACZC,OACAuD,KAAM6B,EAAS7B,GAAMzC,SAAWqE,KAC5BC,EAAS,CAAEC,UAAW/B,GAAkB,CAAA,GAExChF,EACJY,EAAA,MAAA,CAAKuB,UAAWC,EAAO,gCACrBxB,EAAC+B,EAAO,CAAA,KAGN1C,EAAegF,GAAMzC,WAAW,8BAAgC,mCAChEtC,EAAa+E,GAAMzC,WAAW,UAAY,QAC1CwE,EAASlH,EACbc,EAACf,GAECC,OAAQA,EACRC,eAAgBA,EAChBC,SAAUA,EACVC,aAAcA,EACdC,WAAYA,GALPsF,GAOa,UAAlBD,EACF3E,EAAC0B,EAAe,IAAKvC,IACD,UAAlBwF,GAA+C,QAAlBA,EAC/B3E,EAACW,EAAe,IAAKxB,IACnB,KAEJ,GAAI8E,EAA2BlF,IAAI4F,IAAkBoB,GAAiBC,EAAmB,CACvF,MAAMK,IAAgBlC,EACtB,OACEmC,EAAA,MAAA,CAAK/E,UAAWC,EAAO+E,oBAAmBnG,SAAA,CACxCJ,EAAA,MAAA,CAAKuB,UAAWC,EAAOgF,mBAAoBC,OAAQJ,EAAWjG,SAC3DgG,IAEHpG,EAAA,MAAA,CAAKuB,UAAWC,EAAOgF,mBAAoBC,QAASJ,EAAWjG,SAC7DJ,EAACf,EAAa,CAEZC,OAAQ6G,EACR5G,eAAgB,CAAE0B,WAAYmF,GAC9B5G,SAAUA,EACVC,aAAcA,EACdC,WAAYA,GALPsF,OAUf,CACA,OAAOwB,CAAM"}
|
|
1
|
+
{"version":3,"file":"Attachment-DFk4AiwI.js","sources":["../../web-commons/dist/contentTypes.js","../../web-commons/dist/attachments.js","../src/components/LazyComponent/index.tsx","../src/components/Attachment/AttachmentImage.tsx","../src/components/Attachment/AttachmentVideo.tsx","../src/components/Attachment/Attachment.tsx"],"sourcesContent":["export function normalizeAttachmentContentType(type) {\n return type?.split(\";\")[0].trim().toLowerCase();\n}\nexport const isJsonAttachmentContentType = (type) => {\n const normalized = normalizeAttachmentContentType(type);\n return normalized === \"application/json\" || normalized === \"text/json\" || normalized.endsWith(\"+json\");\n};\nexport const isHtmlAttachmentContentType = (type) => {\n const normalized = normalizeAttachmentContentType(type);\n return normalized === \"text/html\" || normalized === \"application/xhtml+xml\";\n};\n","import { normalizeAttachmentContentType } from \"./contentTypes.js\";\nimport { fetchReportAttachment } from \"./data.js\";\nconst PLAYWRIGHT_TRACE_CONTENT_TYPE = \"application/vnd.allure.playwright-trace\";\nconst PLAYWRIGHT_TRACE_DOWNLOAD_CONTENT_TYPE = \"application/zip\";\nconst downloadContentType = (contentType) => {\n return normalizeAttachmentContentType(contentType) === PLAYWRIGHT_TRACE_CONTENT_TYPE\n ? PLAYWRIGHT_TRACE_DOWNLOAD_CONTENT_TYPE\n : contentType;\n};\nexport const fetchFromUrl = async ({ id, ext, contentType }) => {\n const fileName = `${id || \"-\"}${ext || \"\"}`;\n return fetchReportAttachment(`data/attachments/${fileName}?attachment`, contentType);\n};\nexport const fetchAttachment = async (id, ext, contentType) => {\n if (!id && !ext) {\n return null;\n }\n const response = await fetchFromUrl({ id, ext, contentType });\n const fileType = attachmentType(contentType);\n if (!response.ok) {\n throw new Error(\"Failed to fetch\");\n }\n switch (fileType) {\n case \"svg\":\n case \"image\": {\n const blob = await response.blob();\n const img = URL.createObjectURL(blob);\n return { img, id };\n }\n case \"uri\":\n case \"code\":\n case \"html\":\n case \"markdown\":\n case \"mermaid\":\n case \"table\":\n case \"text\": {\n const text = await response.text();\n return { text };\n }\n case \"video\": {\n const blob = await response.blob();\n const src = URL.createObjectURL(blob);\n return { src, id, contentType };\n }\n case \"image-diff\": {\n const json = await response.json();\n return { diff: json };\n }\n case \"http\": {\n const json = await response.json();\n return { http: json };\n }\n default:\n return null;\n }\n};\nexport const blobAttachment = async (id, ext, contentType) => {\n const response = await fetchFromUrl({ id, ext, contentType: downloadContentType(contentType) });\n return await response.blob();\n};\nexport const downloadAttachment = async (id, ext, contentType) => {\n if (!id && !ext) {\n return;\n }\n const fileName = `${id}${ext}`;\n const blob = await blobAttachment(id, ext, contentType);\n const linkUrl = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.href = linkUrl;\n link.download = fileName;\n link.click();\n URL.revokeObjectURL(linkUrl);\n};\nexport const openAttachmentInNewTab = async (id, ext, contentType) => {\n if (!id && !ext) {\n return;\n }\n const blob = await blobAttachment(id, ext, contentType);\n const linkUrl = URL.createObjectURL(blob);\n globalThis.open(linkUrl, \"_blank\");\n};\nexport const MERMAID_CONTENT_TYPE = \"application/vnd.allure.diagrams.mermaid\";\nexport const PREVIEWABLE_CONTENT_TYPES = [\n MERMAID_CONTENT_TYPE,\n \"text/html\",\n \"text/csv\",\n \"text/markdown\",\n \"text/tab-separated-values\",\n \"text/uri-list\",\n];\nexport const isPreviewableContentType = (type) => !!type && PREVIEWABLE_CONTENT_TYPES.includes(normalizeAttachmentContentType(type));\nconst HIGHLIGHT_EXTS = new Set([\n \"js\",\n \"mjs\",\n \"cjs\",\n \"jsx\",\n \"ts\",\n \"mts\",\n \"cts\",\n \"tsx\",\n \"json\",\n \"html\",\n \"htm\",\n \"xml\",\n \"css\",\n \"csv\",\n \"tsv\",\n \"md\",\n \"markdown\",\n \"yaml\",\n \"yml\",\n \"java\",\n \"py\",\n \"rb\",\n \"go\",\n \"php\",\n \"sql\",\n \"kt\",\n \"swift\",\n \"rs\",\n \"c\",\n \"cpp\",\n \"cs\",\n \"scala\",\n \"dart\",\n \"lua\",\n \"haskell\",\n \"r\",\n \"perl\",\n]);\nconst NO_HIGHLIGHT_TYPES = new Set([\"text/plain\", \"text/*\", \"text/uri-list\"]);\nconst HIGHLIGHT_TYPES = new Set([\n \"text/markdown\",\n \"text/html\",\n \"text/csv\",\n \"text/tab-separated-values\",\n \"text/xml\",\n \"text/json\",\n \"text/yaml\",\n \"text/javascript\",\n \"text/typescript\",\n \"text/ruby\",\n \"text/python\",\n \"text/php\",\n \"text/java\",\n \"text/csharp\",\n \"text/cpp\",\n \"text/c\",\n \"text/go\",\n \"text/rust\",\n \"text/swift\",\n \"text/kotlin\",\n \"text/scala\",\n \"text/perl\",\n \"text/r\",\n \"text/dart\",\n \"text/lua\",\n \"text/haskell\",\n \"text/sql\",\n \"text/x-yaml\",\n \"text/css\",\n \"application/yaml\",\n \"application/x-yaml\",\n \"application/xml\",\n \"application/json\",\n]);\nexport const extname = (str) => {\n const i = str.lastIndexOf(\".\");\n if (i <= 0 || i === str.length - 1)\n return undefined;\n return str.slice(i);\n};\nexport const isSyntaxHighlightSupported = (payload) => {\n if (!payload) {\n return false;\n }\n const contentType = payload.contentType?.toLowerCase();\n let ext;\n for (const part of [payload.ext, payload.name, payload.originalFileName]) {\n if (!part) {\n continue;\n }\n const withDot = extname(part);\n const normalized = (withDot ?? part.replace(/^\\./, \"\")).toLowerCase();\n const single = normalized.includes(\".\") ? normalized.split(\".\").pop() : normalized;\n if (single) {\n ext = single;\n break;\n }\n }\n if (contentType && NO_HIGHLIGHT_TYPES.has(contentType)) {\n return false;\n }\n if (contentType && HIGHLIGHT_TYPES.has(contentType)) {\n return true;\n }\n return !!ext && HIGHLIGHT_EXTS.has(ext);\n};\nexport const attachmentType = (type) => {\n const normalizedType = normalizeAttachmentContentType(type);\n switch (normalizedType) {\n case \"image/bmp\":\n case \"image/gif\":\n case \"image/tiff\":\n case \"image/jpeg\":\n case \"image/jpg\":\n case \"image/png\":\n case \"image/webp\":\n case \"image/*\":\n return \"image\";\n case \"text/xml\":\n case \"text/json\":\n case \"text/yaml\":\n case \"text/javascript\":\n case \"text/typescript\":\n case \"text/ruby\":\n case \"text/python\":\n case \"text/php\":\n case \"text/java\":\n case \"text/csharp\":\n case \"text/cpp\":\n case \"text/c\":\n case \"text/go\":\n case \"text/rust\":\n case \"text/swift\":\n case \"text/kotlin\":\n case \"text/scala\":\n case \"text/perl\":\n case \"text/r\":\n case \"text/dart\":\n case \"text/lua\":\n case \"text/haskell\":\n case \"text/sql\":\n case \"text/x-yaml\":\n case \"text/css\":\n case \"application/yaml\":\n case \"application/x-yaml\":\n case \"application/xml\":\n case \"application/json\":\n return \"code\";\n case \"text/plain\":\n case \"text/*\":\n return \"text\";\n case \"text/markdown\":\n return \"markdown\";\n case \"text/html\":\n return \"html\";\n case \"text/csv\":\n case \"text/tab-separated-values\":\n return \"table\";\n case \"image/svg+xml\":\n return \"svg\";\n case \"video/mp4\":\n case \"video/ogg\":\n case \"video/webm\":\n return \"video\";\n case \"text/uri-list\":\n return \"uri\";\n case \"application/x-tar\":\n case \"application/x-gtar\":\n case \"application/x-bzip2\":\n case \"application/gzip\":\n case \"application/zip\":\n case PLAYWRIGHT_TRACE_CONTENT_TYPE:\n return \"archive\";\n case \"application/vnd.allure.image.diff\":\n return \"image-diff\";\n case \"application/vnd.allure.http+json\":\n return \"http\";\n case MERMAID_CONTENT_TYPE:\n return \"mermaid\";\n default:\n return null;\n }\n};\nexport const restrictedContentTypes = [\"application/gzip\"];\n",null,null,null,null],"names":["normalizeAttachmentContentType","type","split","trim","toLowerCase","isJsonAttachmentContentType","normalized","endsWith","isHtmlAttachmentContentType","PLAYWRIGHT_TRACE_CONTENT_TYPE","downloadContentType","contentType","fetchFromUrl","async","id","ext","fetchReportAttachment","blobAttachment","response","blob","downloadAttachment","fileName","linkUrl","URL","createObjectURL","link","document","createElement","href","download","click","revokeObjectURL","openAttachmentInNewTab","globalThis","open","MERMAID_CONTENT_TYPE","PREVIEWABLE_CONTENT_TYPES","isPreviewableContentType","includes","HIGHLIGHT_EXTS","Set","NO_HIGHLIGHT_TYPES","HIGHLIGHT_TYPES","extname","str","i","lastIndexOf","length","slice","isSyntaxHighlightSupported","payload","part","name","originalFileName","replace","single","pop","has","attachmentType","LazyComponent","loader","componentProps","fallback","errorMessage","retryLabel","error","resetError","useErrorBoundary","attempt","setAttempt","useState","Component","useMemo","lazy","_jsx","EmptyView","description","size","children","Button","style","text","onClick","value","Suspense","AttachmentImage","props","attachment","item","isValidImage","setIsValidImage","useEffect","img","Image","onload","onerror","src","className","styles","alt","AttachmentVideo","class","controls","loop","muted","Spinner","loadCode","import","then","module","default","AttachmentCode","loadersByAttachmentType","image","svg","video","archive","json","code","uri","css","html","markdown","mermaid","table","loadTable","AttachmentTable","loadImageDiff","AttachmentImageDiff","http","loadHttp","HttpAttachment","previewLoaders","loadHtml","HtmlPreview","loadMarkdown","MarkdownPreview","loadMermaid","MermaidPreview","DUAL_VIEW_ATTACHMENT_TYPES","Attachment","previewable","highlightCode","i18n","setAttachment","isLoading","setLoading","isError","setError","componentType","viewerKey","retry","setRetry","useLayoutEffect","objectUrl","active","dispose","result","fileType","ok","Error","diff","fetchAttachment","undefined","fetchData","IconButton","icon","allureIcons","lineArrowsRefreshCcw1","previewLoader","previewAttachment","typeI18n","isCode","highlight","source","showPreview","_jsxs","attachmentViewStack","attachmentViewPane","hidden"],"mappings":"0cAAO,SAASA,EAA+BC,GAC3C,OAAOA,GAAMC,MAAM,KAAK,GAAGC,OAAOC,aACtC,CACO,MAAMC,EAA+BJ,IACxC,MAAMK,EAAaN,EAA+BC,GAClD,MAAsB,qBAAfK,GAAoD,cAAfA,GAA8BA,EAAWC,SAAS,QAAQ,EAE7FC,EAA+BP,IACxC,MAAMK,EAAaN,EAA+BC,GAClD,MAAsB,cAAfK,GAA6C,0BAAfA,CAAsC,ECPzEG,EAAgC,0CAEhCC,EAAuBC,GAClBX,EAA+BW,KAAiBF,EAFZ,kBAIrCE,EAEGC,EAAeC,OAASC,KAAIC,MAAKJ,iBAEnCK,EAAsB,oBADZ,GAAGF,GAAM,MAAMC,GAAO,kBACiCJ,GA6C/DM,EAAiBJ,MAAOC,EAAIC,EAAKJ,KAC1C,MAAMO,QAAiBN,EAAa,CAAEE,KAAIC,MAAKJ,YAAaD,EAAoBC,KAChF,aAAaO,EAASC,MAAM,EAEnBC,EAAqBP,MAAOC,EAAIC,EAAKJ,KAC9C,IAAKG,IAAOC,EACR,OAEJ,MAAMM,EAAW,GAAGP,IAAKC,IACnBI,QAAaF,EAAeH,EAAIC,EAAKJ,GACrCW,EAAUC,IAAIC,g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,EAAeiB,GAC/BqB,EAAoBnF,GAAc,SAAUA,EAAaA,OAAa4E,EAEtEQ,EAAW5B,IAAyB,eAAlBM,EAAiC,YAAcA,GACjEuB,EAAShH,IAAW8C,EACpB7C,EAAiB,CACrB0B,WAAYA,EACZC,OACAuD,KAAM6B,EAAS7B,GAAMzC,SAAWqE,KAC5BC,EAAS,CAAEC,UAAW/B,GAAkB,CAAA,GAExChF,EACJY,EAAA,MAAA,CAAKuB,UAAWC,EAAO,gCACrBxB,EAAC+B,EAAO,CAAA,KAGN1C,EAAegF,GAAMzC,WAAW,8BAAgC,mCAChEtC,EAAa+E,GAAMzC,WAAW,UAAY,QAC1CwE,EAASlH,EACbc,EAACf,GAECC,OAAQA,EACRC,eAAgBA,EAChBC,SAAUA,EACVC,aAAcA,EACdC,WAAYA,GALPsF,GAOa,UAAlBD,EACF3E,EAAC0B,EAAe,IAAKvC,IACD,UAAlBwF,GAA+C,QAAlBA,EAC/B3E,EAACW,EAAe,IAAKxB,IACnB,KAEJ,GAAI8E,EAA2BlF,IAAI4F,IAAkBoB,GAAiBC,EAAmB,CACvF,MAAMK,IAAgBlC,EACtB,OACEmC,EAAA,MAAA,CAAK/E,UAAWC,EAAO+E,oBAAmBnG,SAAA,CACxCJ,EAAA,MAAA,CAAKuB,UAAWC,EAAOgF,mBAAoBC,OAAQJ,EAAWjG,SAC3DgG,IAEHpG,EAAA,MAAA,CAAKuB,UAAWC,EAAOgF,mBAAoBC,QAASJ,EAAWjG,SAC7DJ,EAACf,EAAa,CAEZC,OAAQ6G,EACR5G,eAAgB,CAAE0B,WAAYmF,GAC9B5G,SAAUA,EACVC,aAAcA,EACdC,WAAYA,GALPsF,OAUf,CACA,OAAOwB,CAAM"}
|
package/dist/Attachment.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./clsx-
|
|
1
|
+
import"./clsx-D83172mf.js";import"./identity-DBvQ9SaG.js";export{A as Attachment}from"./Attachment-DFk4AiwI.js";import"./constants-D-YBPtws.js";import"./utils-DKmgmsaJ.js";import"node:crypto";import"preact/hooks";import"./index-k2XcinIa.js";import"./index-BLcyRUFW.js";import"./index-qMwNH4DY.js";import"preact";import"preact/compat";import"./array-B0SXO2zY.js";import"./_commonjsHelpers-Doe7ti1T.js";import"./index-Dq7O-bm8.js";import"react";
|
|
2
2
|
//# sourceMappingURL=Attachment.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as t}from"./clsx-
|
|
2
|
-
//# sourceMappingURL=AttachmentCode-
|
|
1
|
+
import{u as t}from"./clsx-D83172mf.js";import"./identity-DBvQ9SaG.js";import{c as e}from"./clipboard-BUUe2rGt.js";import"./constants-D-YBPtws.js";import{A as r}from"./utils-DKmgmsaJ.js";import"node:crypto";import{useMemo as o,useState as a,useEffect as n}from"preact/hooks";import{I as s}from"./index-k2XcinIa.js";import{a as i}from"./index-qMwNH4DY.js";import{a as c}from"./index-BZ-V3udE.js";import{P as p}from"./prism-global-B3qB0vXd.js";import{s as l}from"./Attachment-DFk4AiwI.js";import"preact";import"./array-B0SXO2zY.js";import"./_commonjsHelpers-Doe7ti1T.js";import"./index-Dq7O-bm8.js";import"react";import"./floating-ui.dom-B9YqEzUD.js";import"./index-BLcyRUFW.js";import"preact/compat";const m=/\x1B\[[0-9;?]*[ -/]*[@-~]/g,x=new RegExp("\\[([0-9;]*)m","g"),u=256,d=257,v=258,g=259,h=260,j=261,y=262,f=263,k={0:"var(--color-text-primary)",1:"var(--color-intent-danger-text)",2:"var(--color-intent-success-text)",3:"var(--color-intent-warning-text)",4:"var(--color-intent-info-text)",5:"var(--color-status-unknown-text)",6:"var(--color-decorative-5-text)",7:"var(--color-text-primary)",8:"var(--color-text-muted)",9:"var(--color-intent-danger-text)",10:"var(--color-intent-success-text)",11:"var(--color-intent-warning-text)",12:"var(--color-intent-info-text)",13:"var(--color-status-unknown-text)",14:"var(--color-decorative-5-text)",15:"var(--color-text-primary)",[u]:"var(--color-text-primary)",[d]:"var(--color-text-muted)",[v]:"var(--color-intent-danger-text)",[g]:"var(--color-intent-success-text)",[h]:"var(--color-intent-warning-text)",[j]:"var(--color-intent-info-text)",[y]:"var(--color-status-unknown-text)",[f]:"var(--color-decorative-5-text)"},w=[0,95,135,175,215,255],b=(t,e,r)=>{const o=.299*t+.587*e+.114*r,a=Math.max(t,e,r),n=Math.min(t,e,r);return t>=150&&e>=120&&r<=210&&t+e>=2.2*r?h:e>=t+20&&e>=r+20?g:t>=e+30&&t>=r+30?v:r>=t+20&&r>=e-10?j:t>=120&&r>=120&&e<=a-20?y:a-n<=32?o>=150||o<=80?u:d:u},N=t=>{if(t>=16&&t<=231){const e=t-16;return{red:w[Math.floor(e/36)],green:w[Math.floor(e%36/6)],blue:w[e%6]}}if(t>=232&&t<=255){const e=10*(t-232)+8;return{red:e,green:e,blue:e}}},C=t=>Number.isInteger(t)&&t>=0&&t<=255,M={js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript",cts:"typescript",tsx:"typescript",jsx:"javascript",json:"json",html:"markup",htm:"markup",xml:"markup",css:"css",csv:"csv",md:"markdown"},L={"text/javascript":"javascript","application/javascript":"javascript","text/x-javascript":"javascript","application/x-javascript":"javascript","text/ecmascript":"javascript","application/ecmascript":"javascript","text/typescript":"typescript","application/typescript":"typescript","text/x-typescript":"typescript","application/x-typescript":"typescript","application/json":"json","text/json":"json","text/html":"markup","application/xml":"markup","text/xml":"markup","text/css":"css","text/csv":"csv","text/markdown":"markdown"},I=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),S=t=>{if(!t)return;const e=/\.([a-z0-9]+)$/i.exec(t);if(!e)return;const r=e[1].toLowerCase();return M[r]??r},$=d=>{const{attachment:v,item:g,highlight:h=!0,i18n:j}=d;if(!v||!("text"in v))return null;const y=g?.link?.ext?.replace(".","").toLowerCase(),f=g?.link?.contentType?.toLowerCase(),w=(S(g?.link?.name)??S(g?.link?.originalFileName))||y&&(M[y]??y)||f&&L[f]||"plaintext",$=v.text??"",_=((t,e)=>"markdown"!==t&&e.split("\n").length>=5)(w,$),E=o((()=>["attachment-code-block",h?`language-${w}`:"",h&&_?"line-numbers":""].filter(Boolean).join(" ")),[h,w,_]),H=o((()=>h?((t,e)=>{const r=p.languages[e];if(!r)return I(t);try{return p.highlight(t,r,e)}catch{return I(t)}})($,w):null),[h,$,w]),T=$.length>0,z=j?.("clipboard")??"Copy to clipboard",A=j?.("clipboardSuccess")??"Successfully copied",P=j?.("clipboardError")??"Can not copy value to clipboard. Seems like this feature is not supported for your browser",[B,F]=a(z);n((()=>{F(z)}),[z,$]);const R=T&&t("div",{className:l["attachment-code-actions"],role:"presentation",onClick:t=>t.stopPropagation(),onKeyDown:t=>t.stopPropagation(),onMouseLeave:()=>F(z),children:t(c,{tooltipText:B,children:t(s,{style:"ghost",size:"s",iconSize:"s",icon:i.lineGeneralCopy3,onClick:async()=>{F(await e($)?A:P)}})})});if("string"==typeof(q=$)&&new RegExp(m).test(q)&&$.length>0&&h){const e=((t,e)=>new r({escapeXML:!0,...e}).toHtml(t))((t=>t.replace(x,((t,e)=>{const r=0===e.length?[0]:e.split(";").map(Number);if(r.some((t=>!Number.isInteger(t))))return t;const o=[];let a=[];const n=()=>{a.length>0&&(o.push(`[${a.join(";")}m`),a=[])};for(let t=0;t<r.length;){const e=r[t];if(38===e&&5===r[t+1]&&C(r[t+2])){const e=N(r[t+2]);n(),o.push(`[38;5;${e?b(e.red,e.green,e.blue):u}m`),t+=3}else 38===e&&2===r[t+1]&&C(r[t+2])&&C(r[t+3])&&C(r[t+4])?(n(),o.push(`[38;5;${b(r[t+2],r[t+3],r[t+4])}m`),t+=5):48===e&&5===r[t+1]&&C(r[t+2])?t+=3:48===e&&2===r[t+1]&&C(r[t+2])&&C(r[t+3])&&C(r[t+4])?t+=5:(e>=40&&e<=47||49===e||e>=100&&e<=107||a.push(e),t+=1)}return n(),o.join("")})))($),{fg:"var(--color-text-primary)",bg:"none",colors:k});return t("div",{className:l["attachment-code"],children:[R,t("pre",{"data-testid":"code-attachment-content",className:E,dangerouslySetInnerHTML:{__html:e}})]})}var q;return t("div",{className:l["attachment-code"],children:[R,t("pre",{"data-testid":"code-attachment-content",className:E,children:t("code",h&&null!==H?{className:`language-${w}`,dangerouslySetInnerHTML:{__html:H}}:{children:$})})]})};export{$ as AttachmentCode};
|
|
2
|
+
//# sourceMappingURL=AttachmentCode-DLfL9_C7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCode-BaFv0Nkk.js","sources":["../../web-commons/dist/strings.js","../src/components/Attachment/AttachmentCode.tsx"],"sourcesContent":["import AnsiToHtml from \"ansi-to-html\";\nconst ansiRegex = /\\x1B\\[[0-9;?]*[ -/]*[@-~]/g;\nconst ansiEscape = \"\\u001B\";\nconst ansiControlSequencePattern = new RegExp(`${ansiEscape}\\\\[([0-9;]*)m`, \"g\");\nexport const isAnsi = (text) => typeof text === \"string\" && new RegExp(ansiRegex).test(text);\nconst semanticAnsiColor = {\n primary: 256,\n muted: 257,\n danger: 258,\n success: 259,\n warning: 260,\n info: 261,\n unknown: 262,\n decorative: 263,\n};\nexport const ansiSemanticColors = {\n 0: \"var(--color-text-primary)\",\n 1: \"var(--color-intent-danger-text)\",\n 2: \"var(--color-intent-success-text)\",\n 3: \"var(--color-intent-warning-text)\",\n 4: \"var(--color-intent-info-text)\",\n 5: \"var(--color-status-unknown-text)\",\n 6: \"var(--color-decorative-5-text)\",\n 7: \"var(--color-text-primary)\",\n 8: \"var(--color-text-muted)\",\n 9: \"var(--color-intent-danger-text)\",\n 10: \"var(--color-intent-success-text)\",\n 11: \"var(--color-intent-warning-text)\",\n 12: \"var(--color-intent-info-text)\",\n 13: \"var(--color-status-unknown-text)\",\n 14: \"var(--color-decorative-5-text)\",\n 15: \"var(--color-text-primary)\",\n [semanticAnsiColor.primary]: \"var(--color-text-primary)\",\n [semanticAnsiColor.muted]: \"var(--color-text-muted)\",\n [semanticAnsiColor.danger]: \"var(--color-intent-danger-text)\",\n [semanticAnsiColor.success]: \"var(--color-intent-success-text)\",\n [semanticAnsiColor.warning]: \"var(--color-intent-warning-text)\",\n [semanticAnsiColor.info]: \"var(--color-intent-info-text)\",\n [semanticAnsiColor.unknown]: \"var(--color-status-unknown-text)\",\n [semanticAnsiColor.decorative]: \"var(--color-decorative-5-text)\",\n};\nconst xtermColorLevels = [0, 95, 135, 175, 215, 255];\nconst getReadableAnsiColor = (red, green, blue) => {\n const brightness = red * 0.299 + green * 0.587 + blue * 0.114;\n const max = Math.max(red, green, blue);\n const min = Math.min(red, green, blue);\n if (red >= 150 && green >= 120 && blue <= 210 && red + green >= blue * 2.2) {\n return semanticAnsiColor.warning;\n }\n if (green >= red + 20 && green >= blue + 20) {\n return semanticAnsiColor.success;\n }\n if (red >= green + 30 && red >= blue + 30) {\n return semanticAnsiColor.danger;\n }\n if (blue >= red + 20 && blue >= green - 10) {\n return semanticAnsiColor.info;\n }\n if (red >= 120 && blue >= 120 && green <= max - 20) {\n return semanticAnsiColor.unknown;\n }\n if (max - min <= 32) {\n return brightness >= 150 || brightness <= 80 ? semanticAnsiColor.primary : semanticAnsiColor.muted;\n }\n return semanticAnsiColor.primary;\n};\nconst getXtermColorRgb = (colorIndex) => {\n if (colorIndex >= 16 && colorIndex <= 231) {\n const cubeIndex = colorIndex - 16;\n return {\n red: xtermColorLevels[Math.floor(cubeIndex / 36)],\n green: xtermColorLevels[Math.floor((cubeIndex % 36) / 6)],\n blue: xtermColorLevels[cubeIndex % 6],\n };\n }\n if (colorIndex >= 232 && colorIndex <= 255) {\n const level = (colorIndex - 232) * 10 + 8;\n return {\n red: level,\n green: level,\n blue: level,\n };\n }\n};\nconst isValidColorPart = (value) => Number.isInteger(value) && value >= 0 && value <= 255;\nexport const normalizeEscapedAnsiSequences = (text) => text.replace(/\\\\u001b(?=\\[)/giu, ansiEscape).replace(/\\\\x1b(?=\\[)/giu, ansiEscape);\nexport const normalizeAnsiForegroundColors = (text) => text.replace(ansiControlSequencePattern, (match, sequence) => {\n const codes = sequence.length === 0 ? [0] : sequence.split(\";\").map(Number);\n if (codes.some((code) => !Number.isInteger(code))) {\n return match;\n }\n const fragments = [];\n let displayCodes = [];\n const flushDisplayCodes = () => {\n if (displayCodes.length > 0) {\n fragments.push(`\\x1b[${displayCodes.join(\";\")}m`);\n displayCodes = [];\n }\n };\n for (let index = 0; index < codes.length;) {\n const code = codes[index];\n if (code === 38 && codes[index + 1] === 5 && isValidColorPart(codes[index + 2])) {\n const rgb = getXtermColorRgb(codes[index + 2]);\n flushDisplayCodes();\n fragments.push(`\\x1b[38;5;${rgb ? getReadableAnsiColor(rgb.red, rgb.green, rgb.blue) : semanticAnsiColor.primary}m`);\n index += 3;\n continue;\n }\n if (code === 38 &&\n codes[index + 1] === 2 &&\n isValidColorPart(codes[index + 2]) &&\n isValidColorPart(codes[index + 3]) &&\n isValidColorPart(codes[index + 4])) {\n flushDisplayCodes();\n fragments.push(`\\x1b[38;5;${getReadableAnsiColor(codes[index + 2], codes[index + 3], codes[index + 4])}m`);\n index += 5;\n continue;\n }\n if (code === 48 && codes[index + 1] === 5 && isValidColorPart(codes[index + 2])) {\n index += 3;\n continue;\n }\n if (code === 48 &&\n codes[index + 1] === 2 &&\n isValidColorPart(codes[index + 2]) &&\n isValidColorPart(codes[index + 3]) &&\n isValidColorPart(codes[index + 4])) {\n index += 5;\n continue;\n }\n if ((code >= 40 && code <= 47) || code === 49 || (code >= 100 && code <= 107)) {\n index += 1;\n continue;\n }\n displayCodes.push(code);\n index += 1;\n }\n flushDisplayCodes();\n return fragments.join(\"\");\n});\nexport const ansiToHTML = (text, config) => new AnsiToHtml({\n escapeXML: true,\n ...config,\n}).toHtml(text);\n",null],"names":["ansiRegex","ansiControlSequencePattern","RegExp","semanticAnsiColor","ansiSemanticColors","semanticAnsiColor_primary","semanticAnsiColor_muted","semanticAnsiColor_danger","semanticAnsiColor_success","semanticAnsiColor_warning","semanticAnsiColor_info","semanticAnsiColor_unknown","semanticAnsiColor_decorative","xtermColorLevels","getReadableAnsiColor","red","green","blue","brightness","max","Math","min","getXtermColorRgb","colorIndex","cubeIndex","floor","level","isValidColorPart","value","Number","isInteger","extToPrismLanguage","js","mjs","cjs","ts","mts","cts","tsx","jsx","json","html","htm","xml","css","csv","md","contentTypeToPrismLanguage","escapeHtml","text","replace","languageFromName","name","match","exec","nameExt","toLowerCase","AttachmentCode","props","attachment","item","highlight","i18n","ext","link","contentType","prismLang","originalFileName","rawText","showLineNumbers","shouldShowLineNumbers","split","length","preClass","useMemo","filter","Boolean","join","highlightedHtml","highlightCode","language","grammar","Prism","languages","canCopy","copyLabel","copiedLabel","copyErrorLabel","copyTooltip","setCopyTooltip","useState","useEffect","copyAction","_jsx","className","styles","role","onClick","e","stopPropagation","onKeyDown","onMouseLeave","children","TooltipWrapper","tooltipText","IconButton","style","size","iconSize","icon","allureIcons","lineGeneralCopy3","async","copyToClipboard","test","sanitizedHtml","ansiToHTML","config","AnsiToHtml","escapeXML","toHtml","sequence","codes","map","some","code","fragments","displayCodes","flushDisplayCodes","push","index","rgb","normalizeAnsiForegroundColors","fg","bg","colors","_jsxs","dangerouslySetInnerHTML","__html"],"mappings":"0rBACA,MAAMA,EAAY,6BAEZC,EAA6B,IAAIC,OAAO,iBAA8B,KAEtEC,EACO,IADPA,EAEK,IAFLA,EAGM,IAHNA,EAIO,IAJPA,EAKO,IALPA,EAMI,IANJA,EAOO,IAPPA,EAQU,IAEHC,EAAqB,CAC9B,EAAG,4BACH,EAAG,kCACH,EAAG,mCACH,EAAG,mCACH,EAAG,gCACH,EAAG,mCACH,EAAG,iCACH,EAAG,4BACH,EAAG,0BACH,EAAG,kCACH,GAAI,mCACJ,GAAI,mCACJ,GAAI,gCACJ,GAAI,mCACJ,GAAI,iCACJ,GAAI,4BACJC,CAACF,GAA4B,4BAC7BG,CAACH,GAA0B,0BAC3BI,CAACJ,GAA2B,kCAC5BK,CAACL,GAA4B,mCAC7BM,CAACN,GAA4B,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OACEoI,EAAA,MAAA,CAAK1C,UAAWC,EAAO,mBAAkBO,SAAA,CACtCV,EACDC,EAAA,MAAA,CAAA,cACc,0BACZC,UAAWrB,EAEXgE,wBAAyB,CAAEC,OAAQvB,OAI3C,CDtKqBlE,MCwKrB,OACEuF,EAAA,MAAA,CAAK1C,UAAWC,EAAO,mBAAkBO,SAAA,CACtCV,EACDC,EAAA,MAAA,CAAA,cAAiB,0BAA0BC,UAAWrB,EAAQ6B,SAE1DT,EAAA,OADDhC,GAAiC,OAApBiB,EACZ,CACEgB,UAAW,YAAY5B,IAEvBuE,wBAAyB,CAAEC,OAAQ5D,cAG9BV,QAGP"}
|
|
1
|
+
{"version":3,"file":"AttachmentCode-DLfL9_C7.js","sources":["../../web-commons/dist/strings.js","../src/components/Attachment/AttachmentCode.tsx"],"sourcesContent":["import AnsiToHtml from \"ansi-to-html\";\nconst ansiRegex = /\\x1B\\[[0-9;?]*[ -/]*[@-~]/g;\nconst ansiEscape = \"\\u001B\";\nconst ansiControlSequencePattern = new RegExp(`${ansiEscape}\\\\[([0-9;]*)m`, \"g\");\nexport const isAnsi = (text) => typeof text === \"string\" && new RegExp(ansiRegex).test(text);\nconst semanticAnsiColor = {\n primary: 256,\n muted: 257,\n danger: 258,\n success: 259,\n warning: 260,\n info: 261,\n unknown: 262,\n decorative: 263,\n};\nexport const ansiSemanticColors = {\n 0: \"var(--color-text-primary)\",\n 1: \"var(--color-intent-danger-text)\",\n 2: \"var(--color-intent-success-text)\",\n 3: \"var(--color-intent-warning-text)\",\n 4: \"var(--color-intent-info-text)\",\n 5: \"var(--color-status-unknown-text)\",\n 6: \"var(--color-decorative-5-text)\",\n 7: \"var(--color-text-primary)\",\n 8: \"var(--color-text-muted)\",\n 9: \"var(--color-intent-danger-text)\",\n 10: \"var(--color-intent-success-text)\",\n 11: \"var(--color-intent-warning-text)\",\n 12: \"var(--color-intent-info-text)\",\n 13: \"var(--color-status-unknown-text)\",\n 14: \"var(--color-decorative-5-text)\",\n 15: \"var(--color-text-primary)\",\n [semanticAnsiColor.primary]: \"var(--color-text-primary)\",\n [semanticAnsiColor.muted]: \"var(--color-text-muted)\",\n [semanticAnsiColor.danger]: \"var(--color-intent-danger-text)\",\n [semanticAnsiColor.success]: \"var(--color-intent-success-text)\",\n [semanticAnsiColor.warning]: \"var(--color-intent-warning-text)\",\n [semanticAnsiColor.info]: \"var(--color-intent-info-text)\",\n [semanticAnsiColor.unknown]: \"var(--color-status-unknown-text)\",\n [semanticAnsiColor.decorative]: \"var(--color-decorative-5-text)\",\n};\nconst xtermColorLevels = [0, 95, 135, 175, 215, 255];\nconst getReadableAnsiColor = (red, green, blue) => {\n const brightness = red * 0.299 + green * 0.587 + blue * 0.114;\n const max = Math.max(red, green, blue);\n const min = Math.min(red, green, blue);\n if (red >= 150 && green >= 120 && blue <= 210 && red + green >= blue * 2.2) {\n return semanticAnsiColor.warning;\n }\n if (green >= red + 20 && green >= blue + 20) {\n return semanticAnsiColor.success;\n }\n if (red >= green + 30 && red >= blue + 30) {\n return semanticAnsiColor.danger;\n }\n if (blue >= red + 20 && blue >= green - 10) {\n return semanticAnsiColor.info;\n }\n if (red >= 120 && blue >= 120 && green <= max - 20) {\n return semanticAnsiColor.unknown;\n }\n if (max - min <= 32) {\n return brightness >= 150 || brightness <= 80 ? semanticAnsiColor.primary : semanticAnsiColor.muted;\n }\n return semanticAnsiColor.primary;\n};\nconst getXtermColorRgb = (colorIndex) => {\n if (colorIndex >= 16 && colorIndex <= 231) {\n const cubeIndex = colorIndex - 16;\n return {\n red: xtermColorLevels[Math.floor(cubeIndex / 36)],\n green: xtermColorLevels[Math.floor((cubeIndex % 36) / 6)],\n blue: xtermColorLevels[cubeIndex % 6],\n };\n }\n if (colorIndex >= 232 && colorIndex <= 255) {\n const level = (colorIndex - 232) * 10 + 8;\n return {\n red: level,\n green: level,\n blue: level,\n };\n }\n};\nconst isValidColorPart = (value) => Number.isInteger(value) && value >= 0 && value <= 255;\nexport const normalizeEscapedAnsiSequences = (text) => text.replace(/\\\\u001b(?=\\[)/giu, ansiEscape).replace(/\\\\x1b(?=\\[)/giu, ansiEscape);\nexport const normalizeAnsiForegroundColors = (text) => text.replace(ansiControlSequencePattern, (match, sequence) => {\n const codes = sequence.length === 0 ? [0] : sequence.split(\";\").map(Number);\n if (codes.some((code) => !Number.isInteger(code))) {\n return match;\n }\n const fragments = [];\n let displayCodes = [];\n const flushDisplayCodes = () => {\n if (displayCodes.length > 0) {\n fragments.push(`\\x1b[${displayCodes.join(\";\")}m`);\n displayCodes = [];\n }\n };\n for (let index = 0; index < codes.length;) {\n const code = codes[index];\n if (code === 38 && codes[index + 1] === 5 && isValidColorPart(codes[index + 2])) {\n const rgb = getXtermColorRgb(codes[index + 2]);\n flushDisplayCodes();\n fragments.push(`\\x1b[38;5;${rgb ? getReadableAnsiColor(rgb.red, rgb.green, rgb.blue) : semanticAnsiColor.primary}m`);\n index += 3;\n continue;\n }\n if (code === 38 &&\n codes[index + 1] === 2 &&\n isValidColorPart(codes[index + 2]) &&\n isValidColorPart(codes[index + 3]) &&\n isValidColorPart(codes[index + 4])) {\n flushDisplayCodes();\n fragments.push(`\\x1b[38;5;${getReadableAnsiColor(codes[index + 2], codes[index + 3], codes[index + 4])}m`);\n index += 5;\n continue;\n }\n if (code === 48 && codes[index + 1] === 5 && isValidColorPart(codes[index + 2])) {\n index += 3;\n continue;\n }\n if (code === 48 &&\n codes[index + 1] === 2 &&\n isValidColorPart(codes[index + 2]) &&\n isValidColorPart(codes[index + 3]) &&\n isValidColorPart(codes[index + 4])) {\n index += 5;\n continue;\n }\n if ((code >= 40 && code <= 47) || code === 49 || (code >= 100 && code <= 107)) {\n index += 1;\n continue;\n }\n displayCodes.push(code);\n index += 1;\n }\n flushDisplayCodes();\n return fragments.join(\"\");\n});\nexport const ansiToHTML = (text, config) => new AnsiToHtml({\n escapeXML: true,\n ...config,\n}).toHtml(text);\n",null],"names":["ansiRegex","ansiControlSequencePattern","RegExp","semanticAnsiColor","ansiSemanticColors","semanticAnsiColor_primary","semanticAnsiColor_muted","semanticAnsiColor_danger","semanticAnsiColor_success","semanticAnsiColor_warning","semanticAnsiColor_info","semanticAnsiColor_unknown","semanticAnsiColor_decorative","xtermColorLevels","getReadableAnsiColor","red","green","blue","brightness","max","Math","min","getXtermColorRgb","colorIndex","cubeIndex","floor","level","isValidColorPart","value","Number","isInteger","extToPrismLanguage","js","mjs","cjs","ts","mts","cts","tsx","jsx","json","html","htm","xml","css","csv","md","contentTypeToPrismLanguage","escapeHtml","text","replace","languageFromName","name","match","exec","nameExt","toLowerCase","AttachmentCode","props","attachment","item","highlight","i18n","ext","link","contentType","prismLang","originalFileName","rawText","showLineNumbers","shouldShowLineNumbers","split","length","preClass","useMemo","filter","Boolean","join","highlightedHtml","highlightCode","language","grammar","Prism","languages","canCopy","copyLabel","copiedLabel","copyErrorLabel","copyTooltip","setCopyTooltip","useState","useEffect","copyAction","_jsx","className","styles","role","onClick","e","stopPropagation","onKeyDown","onMouseLeave","children","TooltipWrapper","tooltipText","IconButton","style","size","iconSize","icon","allureIcons","lineGeneralCopy3","async","copyToClipboard","test","sanitizedHtml","ansiToHTML","config","AnsiToHtml","escapeXML","toHtml","sequence","codes","map","some","code","fragments","displayCodes","flushDisplayCodes","push","index","rgb","normalizeAnsiForegroundColors","fg","bg","colors","_jsxs","dangerouslySetInnerHTML","__html"],"mappings":"0rBACA,MAAMA,EAAY,6BAEZC,EAA6B,IAAIC,OAAO,iBAA8B,KAEtEC,EACO,IADPA,EAEK,IAFLA,EAGM,IAHNA,EAIO,IAJPA,EAKO,IALPA,EAMI,IANJA,EAOO,IAPPA,EAQU,IAEHC,EAAqB,CAC9B,EAAG,4BACH,EAAG,kCACH,EAAG,mCACH,EAAG,mCACH,EAAG,gCACH,EAAG,mCACH,EAAG,iCACH,EAAG,4BACH,EAAG,0BACH,EAAG,kCACH,GAAI,mCACJ,GAAI,mCACJ,GAAI,gCACJ,GAAI,mCACJ,GAAI,iCACJ,GAAI,4B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CAEA,OADAF,IACOF,EAAUjD,KAAK,GAAG,ICeQuD,CAA8BhE,GAAU,CACvEiE,GAAI,4BACJC,GAAI,OACJC,OAAQnI,IAGV,OACEoI,EAAA,MAAA,CAAK1C,UAAWC,EAAO,mBAAkBO,SAAA,CACtCV,EACDC,EAAA,MAAA,CAAA,cACc,0BACZC,UAAWrB,EAEXgE,wBAAyB,CAAEC,OAAQvB,OAI3C,CDtKqBlE,MCwKrB,OACEuF,EAAA,MAAA,CAAK1C,UAAWC,EAAO,mBAAkBO,SAAA,CACtCV,EACDC,EAAA,MAAA,CAAA,cAAiB,0BAA0BC,UAAWrB,EAAQ6B,SAE1DT,EAAA,OADDhC,GAAiC,OAApBiB,EACZ,CACEgB,UAAW,YAAY5B,IAEvBuE,wBAAyB,CAAEC,OAAQ5D,cAG9BV,QAGP"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{u as t}from"./clsx-D83172mf.js";import{I as i}from"./index-Cf1z5wAO.js";import{S as r}from"./index-k2XcinIa.js";import{s as o}from"./Attachment-DFk4AiwI.js";import"preact";import"./index-BLcyRUFW.js";import"./index-qMwNH4DY.js";import"react";import"./index-Dq7O-bm8.js";import"@preact/signals/utils";import"@preact/signals";import"preact/hooks";import"./index-DYL-tbfk.js";import"./_commonjsHelpers-Doe7ti1T.js";import"./toString-Ccq3A8Sl.js";import"./toNumber-Cpsf6DxM.js";import"./upperFirst-jXpCKAQr.js";import"./_stringToArray-aaWSQcKo.js";import"./_baseSlice-CBpWu5XB.js";import"./identity-DBvQ9SaG.js";import"node:crypto";import"./clipboard-BUUe2rGt.js";import"./constants-D-YBPtws.js";import"./utils-DKmgmsaJ.js";import"./array-B0SXO2zY.js";import"./floating-ui.dom-B9YqEzUD.js";import"preact/compat";const s=s=>{const{attachment:m,i18n:p}=s;return m&&"diff"in m?t("div",{className:o.imageDiffWrapper,children:t(i,{diff:m.diff,i18n:p})}):t(r,{})};export{s as AttachmentImageDiff};
|
|
2
|
+
//# sourceMappingURL=AttachmentImageDiff-Bp1b_UU5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentImageDiff-
|
|
1
|
+
{"version":3,"file":"AttachmentImageDiff-Bp1b_UU5.js","sources":["../src/components/Attachment/AttachmentImageDiff.tsx"],"sourcesContent":[null],"names":["AttachmentImageDiff","props","attachment","i18n","_jsx","className","styles","imageDiffWrapper","children","ImageDiff","diff","Spinner"],"mappings":"+yBAOO,MAAMA,EAAuBC,IAClC,MAAMC,WAAEA,EAAUC,KAAEA,GAASF,EAE7B,OAAKC,GAAgB,SAAUA,EAK7BE,SAAKC,UAAWC,EAAOC,iBAAgBC,SACrCJ,EAACK,EAAS,CAACC,KAAMR,EAAWQ,KAAMP,KAAMA,MALnCC,EAACO,EAAO,GAMT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as t}from"./clsx-
|
|
2
|
-
//# sourceMappingURL=AttachmentTable-
|
|
1
|
+
import{u as t}from"./clsx-D83172mf.js";import"./identity-DBvQ9SaG.js";import{s as e,n as r}from"./Attachment-DFk4AiwI.js";import"./constants-D-YBPtws.js";import"./utils-DKmgmsaJ.js";import"node:crypto";import{useMemo as n}from"preact/hooks";import{E as a}from"./index-BLcyRUFW.js";import"preact";import"./index-k2XcinIa.js";import"./index-qMwNH4DY.js";import"react";import"./index-Dq7O-bm8.js";import"preact/compat";import"./array-B0SXO2zY.js";import"./_commonjsHelpers-Doe7ti1T.js";const o=(t,e)=>Array.from({length:e},((e,r)=>t[r]??"")),s=({attachment:s,item:i})=>{const l=s&&"text"in s?s.text??"":"",m=n((()=>{return t=l,e=i.link.contentType,((t,e)=>{if(0===t.length)return[];const r=[];let n=[],a="",o=!1,s=!1;const i=()=>{n.push(a),a=""},l=()=>{i(),r.push(n),n=[],s=!1};for(let r=0;r<t.length;r++){const m=t[r];o?'"'===m?'"'===t[r+1]?(a+='"',r++):o=!1:a+=m:'"'===m&&0===a.length?(o=!0,s=!0):m===e?(i(),s=!0):"\n"===m||"\r"===m?("\r"===m&&"\n"===t[r+1]&&r++,(s||a.length>0||n.length>0)&&l()):(a+=m,s=!0)}return(s||a.length>0||n.length>0)&&l(),r})(t,"text/tab-separated-values"===r(e)?"\t":",");var t,e}),[l,i.link.contentType]);if(0===m.length)return t(a,{description:"No table data",size:"xs",fullHeight:!1});const c=Math.max(...m.map((t=>t.length))),[p,...h]=m,d=o(p,c);return t("div",{className:e["test-result-attachment-table-wrapper"],"data-testid":"table-attachment-content",children:t("table",{className:e["test-result-attachment-table"],children:[t("thead",{children:t("tr",{children:d.map(((e,r)=>t("th",{scope:"col",children:e},r)))})}),t("tbody",{children:h.map(((e,r)=>t("tr",{children:o(e,c).map(((e,r)=>t("td",{children:e},r)))},r)))})]})})};export{s as AttachmentTable};
|
|
2
|
+
//# sourceMappingURL=AttachmentTable-B_2qN3O-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentTable-
|
|
1
|
+
{"version":3,"file":"AttachmentTable-B_2qN3O-.js","sources":["../src/components/Attachment/AttachmentTable.tsx"],"sourcesContent":[null],"names":["normalizeRow","row","columnCount","Array","from","length","_","index","AttachmentTable","attachment","item","rawText","text","rows","useMemo","parseDelimitedRows","contentType","link","parseDelimitedText","delimiter","field","inQuotes","hasPendingRow","appendField","push","appendRow","char","normalizeAttachmentContentType","_jsx","EmptyView","description","size","fullHeight","Math","max","map","headerRow","bodyRows","headerCells","className","styles","_jsxs","children","cell","scope","rowIndex","cellIndex"],"mappings":"meASA,MA0EMA,EAAeA,CAACC,EAAeC,IACnCC,MAAMC,KAAK,CAAEC,OAAQH,IAAe,CAACI,EAAGC,IAAUN,EAAIM,IAAU,KAErDC,EAAkBA,EAAGC,aAAYC,WAC5C,MAAMC,EAAUF,GAAc,SAAUA,EAAcA,EAAWG,MAAQ,GAAM,GACzEC,EAAOC,GAAQ,KAAMC,OAXDH,EAWoBD,EAXNK,EAWeN,EAAKO,KAAKD,YA/ExCE,EAACN,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SAAA,CACtDd,oBACEA,EAAA,KAAA,CAAAc,SACGJ,EAAYH,KAAI,CAACQ,EAAMpC,IACtBqB,EAAA,KAAA,CAAgBgB,MAAM,eACnBD,GADMpC,SAMfqB,oBACGS,EAASF,KAAI,CAAClC,EAAK4C,IAClBjB,EAAA,KAAA,CAAAc,SACG1C,EAAaC,EAAKC,GAAaiC,KAAI,CAACQ,EAAMG,IACzClB,EAAA,KAAA,CAAAc,SAAqBC,GAAZG,MAFJD,WAQX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as e}from"./clsx-BnvTIEMY.js";import{forwardRef as t,useMemo as i,createElement as a,useCallback as n,Fragment as r,useRef as o,useEffect as l,useState as d}from"react";import{V as u,j as s,q as c,W as h,p as f,J as g,h as v}from"./nivo-axes-Ce1dH5CY.js";import{d as b,F as m,$ as y,T as p,M as x,z as k,k as S,t as w,b as L,D as C,c as M,o as B,C as T,P as W,R as V,g as R,a as H,l as I,n as O,q as P,h as z,e as E,w as F,a8 as A,j as D}from"./nivo-colors-DSqwed4A.js";import{j,O as X,J as Y,R as N}from"./nivo-annotations-B2rsOOOb.js";import{L as _,E as G}from"./nivo-legends-0WTLJ5Sd.js";import{c as q,a as $}from"./array-Z5whfZ28.js";import{Fragment as K,createContext as J,createElement as Z}from"preact";import{useState as U,useContext as Q,useMemo as ee,useId as te,useCallback as ie}from"preact/hooks";import{a as ae,C as ne,R as re}from"./config-DZ-BTm2e.js";import{L as oe,i as le,C as de,f as ue}from"./index-BniCQn-f.js";import{g as se}from"./_commonjsHelpers-bbZql6IY.js";import{r as ce}from"./toNumber-DEBMlvT0.js";import{createPortal as he}from"preact/compat";import{u as fe}from"./useTooltip-DhzO0u9M.js";import{P as ge}from"./line-Dnk6WnzK.js";function ve(e,t){if((n=e.length)>1)for(var i,a,n,r=1,o=e[t[0]],l=o.length;r<n;++r)for(a=o,o=e[t[r]],i=0;i<l;++i)o[i][1]+=o[i][0]=isNaN(a[i][1])?a[i][0]:a[i][1]}function be(e){for(var t=e.length,i=new Array(t);--t>=0;)i[t]=t;return i}function me(e,t){return e[t]}function ye(e){const t=[];return t.key=e,t}function pe(e,t){if((l=e.length)>0)for(var i,a,n,r,o,l,d=0,u=e[t[0]].length;d<u;++d)for(r=o=0,i=0;i<l;++i)(n=(a=e[t[i]][d])[1]-a[0])>0?(a[0]=r,a[1]=r+=n):n<0?(a[1]=o,a[0]=o+=n):(a[0]=0,a[1]=n)}function xe(){return xe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var a in i)({}).hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},xe.apply(null,arguments)}function ke(e,t){if(null==e)return{};var i={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;i[a]=e[a]}return i}var Se,we=function(t){var i=t.bars,a=t.annotations,n=X({data:i,annotations:a,getPosition:function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},getDimensions:function(e){var t=e.height,i=e.width;return{width:i,height:t,size:Math.max(i,t)}}});return e(K,{children:n.map((function(t,i){return e(N,xe({},t),i)}))})},Le=function(t){var i=t.width,a=t.height,n=t.legends,r=t.toggleSerie;return e(K,{children:n.map((function(t,n){var o,l=t[0],d=t[1];return e(G,xe({},l,{containerWidth:i,containerHeight:a,data:null!=(o=l.data)?o:d,toggleSerie:l.toggleSerie&&"keys"===l.dataFrom?r:void 0}),n)}))})},Ce=["data"],Me=["color","label"],Be={indexBy:"id",keys:["value"],groupMode:"stacked",layout:"vertical",valueScale:{type:"linear",nice:!0,round:!1},indexScale:{type:"band",round:!1},padding:.1,innerPadding:0,enableGridX:!1,enableGridY:!0,enableLabel:!0,label:"formattedValue",labelPosition:"middle",labelOffset:0,labelSkipWidth:0,labelSkipHeight:0,labelTextColor:{theme:"labels.text.fill"},colorBy:"id",colors:{scheme:"nivo"},borderRadius:0,borderWidth:0,borderColor:{from:"color"},isInteractive:!0,tooltip:function(t){var i=t.color,a=t.label,n=ke(t,Me);return e(p,{id:a,value:n.formattedValue,enableChip:!0,color:i})},tooltipLabel:function(e){return e.id+" - "+e.indexValue},legends:[],initialHiddenIds:[],annotations:[],enableTotals:!1,totalsOffset:10},Te=xe({},Be,{layers:["grid","axes","bars","totals","markers","legends","annotations"],axisTop:null,axisRight:null,axisBottom:{},axisLeft:{},barComponent:function(t){var r,o=t.bar,l=o.data,d=ke(o,Ce),u=t.style,s=u.borderColor,c=u.color,h=u.height,f=u.labelColor,g=u.labelOpacity,v=u.labelX,b=u.labelY,m=u.transform,y=u.width,p=u.textAnchor,C=t.borderRadius,M=t.borderWidth,B=t.label,T=t.shouldRenderLabel,W=t.isInteractive,V=t.onClick,R=t.onMouseEnter,H=t.onMouseLeave,I=t.tooltip,O=t.isFocusable,P=t.ariaLabel,z=t.ariaLabelledBy,E=t.ariaDescribedBy,F=t.ariaDisabled,A=t.ariaHidden,D=x(),j=k(),X=j.showTooltipFromEvent,Y=j.showTooltipAt,N=j.hideTooltip,_=i((function(){return function(){return a(I,xe({},d,l))}}),[I,d,l]),G=n((function(e){null==V||V(xe({color:d.color},l),e)}),[d,l,V]),q=n((function(e){return X(_(),e)}),[X,_]),$=n((function(e){null==R||R(l,e),X(_(),e)}),[l,R,X,_]),K=n((function(e){null==H||H(l,e),N()}),[l,N,H]),J=n((function(){Y(_(),[d.absX+d.width/2,d.absY])}),[Y,_,d]),Z=n((function(){N()}),[N]);return e(S.g,{transform:m,children:[e(S.rect,{width:w(y,(function(e){return Math.max(e,0)})),height:w(h,(function(e){return Math.max(e,0)})),rx:C,ry:C,fill:null!=(r=l.fill)?r:c,strokeWidth:M,stroke:s,focusable:O,tabIndex:O?0:void 0,"aria-label":P?P(l):void 0,"aria-labelledby":z?z(l):void 0,"aria-describedby":E?E(l):void 0,"aria-disabled":F?F(l):void 0,"aria-hidden":A?A(l):void 0,onMouseEnter:W?$:void 0,onMouseMove:W?q:void 0,onMouseLeave:W?K:void 0,onClick:W?G:void 0,onFocus:W&&O?J:void 0,onBlur:W&&O?Z:void 0,"data-testid":"bar.item."+l.id+"."+l.index}),T&&e(L,{x:v,y:b,textAnchor:p,dominantBaseline:"central",fillOpacity:g,style:xe({},D.labels.text,{pointerEvents:"none",fill:f}),children:B})]})},defs:[],fill:[],markers:[],animate:!0,animateOnMount:!1,motionConfig:"default",role:"img",isFocusable:!1}),We=xe({},Be,{layers:["grid","axes","bars","totals","legends","annotations"],axisTop:null,axisRight:null,axisBottom:{},axisLeft:{},renderBar:function(e,t){var i=t.bar,a=i.color,n=i.height,r=i.width,o=i.x,l=i.y,d=t.borderColor,u=t.borderRadius,s=t.borderWidth,c=t.label,h=t.shouldRenderLabel,f=t.labelStyle,g=t.labelX,v=t.labelY,m=t.textAnchor;e.fillStyle=a,s>0&&(e.strokeStyle=d,e.lineWidth=s),e.beginPath(),function(e,t,i,a,n,r){r>0?(e.moveTo(t+r,i),e.lineTo(t+a-r,i),e.quadraticCurveTo(t+a,i,t+a,i+r),e.lineTo(t+a,i+n-r),e.quadraticCurveTo(t+a,i+n,t+a-r,i+n),e.lineTo(t+r,i+n),e.quadraticCurveTo(t,i+n,t,i+n-r),e.lineTo(t,i+r),e.quadraticCurveTo(t,i,t+r,i),e.closePath()):e.rect(t,i,a,n)}(e,o,l,r,n,Math.min(u,n)),e.fill(),s>0&&e.stroke(),h&&(e.textBaseline="middle",e.textAlign="middle"===m?"center":m,b(e,f,c,o+g,l+v))},pixelRatio:"undefined"!=typeof window&&null!=(Se=window.devicePixelRatio)?Se:1}),Ve=function(e,t,i,a,n,r){return f(a,{all:e.map(t),min:0,max:0},n,r).padding(i)},Re=function(e,t){return e.map((function(e){return xe({},t.reduce((function(e,t){return e[t]=null,e}),{}),e)}))},He=function(e){return Object.keys(e).reduce((function(t,i){return e[i]&&(t[i]=e[i]),t}),{})},Ie=function(e){return[e,Number(e)]};function Oe(e,t,i,a){return void 0===e&&(e=Be.layout),void 0===i&&(i=Be.labelPosition),void 0===a&&(a=Be.labelOffset),function(n,r){var o=a*(t?-1:1);if("horizontal"===e){var l=n/2;return"start"===i?l=t?n:0:"end"===i&&(l=t?0:n),{labelX:l+o,labelY:r/2,textAnchor:"middle"===i?"middle":t?"end":"start"}}var d=r/2;return"start"===i?d=t?0:r:"end"===i&&(d=t?r:0),{labelX:n/2,labelY:d-o,textAnchor:"middle"}}}var Pe=["layout","width","height","padding","innerPadding","valueScale","indexScale","hiddenIds"],ze=function(e,t){return e>t},Ee=function(e,t){return e<t},Fe=function(e,t){return Array.from(" ".repeat(t-e),(function(t,i){return e+i}))},Ae=function(e){return ze(e,0)?0:e},De=function(e,t,i,a){var n=e.data,r=e.formatValue,o=e.getColor,l=e.getIndex,d=e.getTooltipLabel,u=e.innerPadding,s=void 0===u?0:u,c=e.keys,h=e.xScale,f=e.yScale,g=e.margin,v=i?Ee:ze,b=n.map(He),m=[];return c.forEach((function(e,i){return Fe(0,h.domain().length).forEach((function(u){var c,y,p,x=Ie(n[u][e]),k=x[0],S=x[1],w=l(n[u]),L=(null!=(c=h(w))?c:0)+t*i+s*i,C=v(y=S,0)?null!=(p=f(y))?p:0:a,M=function(e,t){var i;return v(e,0)?a-t:(null!=(i=f(e))?i:0)-a}(S,C),B={id:e,value:null===k?k:S,formattedValue:r(S),hidden:!1,index:u,indexValue:w,data:b[u]};m.push({key:e+"."+B.indexValue,index:m.length,data:B,x:L,y:C,absX:g.left+L,absY:g.top+C,width:t,height:M,color:o(B),label:d(B)})}))})),m},je=function(e,t,i,a){var n=e.data,r=e.formatValue,o=e.getIndex,l=e.getColor,d=e.getTooltipLabel,u=e.keys,s=e.innerPadding,c=void 0===s?0:s,h=e.xScale,f=e.yScale,g=e.margin,v=i?Ee:ze,b=n.map(He),m=[];return u.forEach((function(e,i){return Fe(0,f.domain().length).forEach((function(u){var s,y,p,x=Ie(n[u][e]),k=x[0],S=x[1],w=o(n[u]),L=v(y=S,0)?a:null!=(p=h(y))?p:0,C=(null!=(s=f(w))?s:0)+t*i+c*i,M=function(e,t){var i;return v(e,0)?(null!=(i=h(e))?i:0)-a:a-t}(S,L),B={id:e,value:null===k?k:S,formattedValue:r(S),hidden:!1,index:u,indexValue:w,data:b[u]};m.push({key:e+"."+B.indexValue,index:m.length,data:B,x:L,y:C,absX:g.left+L,absY:g.top+C,width:M,height:t,color:l(B),label:d(B)})}))})),m},Xe=function(e){var t,i,a,n=e.layout,r=e.width,o=e.height,l=e.padding,d=void 0===l?0:l,u=e.innerPadding,s=void 0===u?0:u,c=e.valueScale,h=e.indexScale,g=e.hiddenIds,v=void 0===g?[]:g,b=ke(e,Pe),m=b.keys.filter((function(e){return!v.includes(e)})),y=Re(b.data,m),p="vertical"===n?["y","x",r]:["x","y",o],x=p[0],k=p[1],S=p[2],w=Ve(y,b.getIndex,d,h,S,k),L="auto"===c.min?Ae:function(e){return e},C=y.reduce((function(e,t){return[].concat(e,m.map((function(e){return t[e]})))}),[]).filter(Boolean),M=L(Math.min.apply(Math,C)),B=(a=Math.max.apply(Math,C),isFinite(a)?a:0),T=f(c,{all:C,min:M,max:B},"x"===x?r:o,x),W="vertical"===n?[w,T]:[T,w],V=W[0],R=W[1],H=(w.bandwidth()-s*(m.length-1))/m.length,I=[xe({},b,{data:y,keys:m,innerPadding:s,xScale:V,yScale:R}),H,null!=(t=c.reverse)&&t,null!=(i=T(0))?i:0];return{xScale:V,yScale:R,bars:H>0?"vertical"===n?De.apply(void 0,I):je.apply(void 0,I):[]}},Ye=["data","layout","width","height","padding","valueScale","indexScale","hiddenIds"],Ne=function(e){var t;return e.some(Array.isArray)?Ne((t=[]).concat.apply(t,e)):e},_e=function(e,t,i){var a=e.formatValue,n=e.getColor,r=e.getIndex,o=e.getTooltipLabel,l=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return u.domain().forEach((function(d,f){var g,v,b=e[f],m=null!=(g=u(r(b.data)))?g:0,y=(null!=(v=function(e){return s(e[i?0:1])}(b))?v:0)+.5*l,p=function(e,t){var a;return(null!=(a=s(e[i?1:0]))?a:0)-t}(b,y)-l,x=Ie(b.data[e.key]),k=x[0],S=x[1],w={id:e.key,value:null===k?k:S,formattedValue:a(S),hidden:!1,index:f,indexValue:d,data:He(b.data)};h.push({key:e.key+"."+d,index:h.length,data:w,x:m,y:y,absX:c.left+m,absY:c.top+y,width:t,height:p,color:n(w),label:o(w)})}))})),h},Ge=function(e,t,i){var a=e.formatValue,n=e.getColor,r=e.getIndex,o=e.getTooltipLabel,l=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return s.domain().forEach((function(d,f){var g,v,b=e[f],m=null!=(g=s(r(b.data)))?g:0,y=(null!=(v=function(e){return u(e[i?1:0])}(b))?v:0)+.5*l,p=function(e,t){var a;return(null!=(a=u(e[i?0:1]))?a:0)-t}(b,y)-l,x=Ie(b.data[e.key]),k=x[0],S=x[1],w={id:e.key,value:null===k?k:S,formattedValue:a(S),hidden:!1,index:f,indexValue:d,data:He(b.data)};h.push({key:e.key+"."+d,index:h.length,data:w,x:y,y:m,absX:c.left+y,absY:c.top+m,width:p,height:t,color:n(w),label:o(w)})}))})),h},qe=function(e){var t,i,a=e.data,n=e.layout,r=e.width,o=e.height,l=e.padding,d=void 0===l?0:l,u=e.valueScale,s=e.indexScale,c=e.hiddenIds,h=void 0===c?[]:c,g=ke(e,Ye),v=g.keys.filter((function(e){return!h.includes(e)})),b=function(){var e=q([]),t=be,i=ve,a=me;function n(n){var r,o,l=Array.from(e.apply(this,arguments),ye),d=l.length,u=-1;for(const e of n)for(r=0,++u;r<d;++r)(l[r][u]=[0,+a(e,l[r].key,u,n)]).data=e;for(r=0,o=$(t(l));r<d;++r)l[o[r]].index=r;return i(l,o),l}return n.keys=function(t){return arguments.length?(e="function"==typeof t?t:q(Array.from(t)),n):e},n.value=function(e){return arguments.length?(a="function"==typeof e?e:q(+e),n):a},n.order=function(e){return arguments.length?(t=null==e?be:"function"==typeof e?e:q(Array.from(e)),n):t},n.offset=function(e){return arguments.length?(i=null==e?ve:e,n):i},n}().keys(v).offset(pe)(Re(a,v)),m="vertical"===n?["y","x",r]:["x","y",o],y=m[0],p=m[1],x=m[2],k=Ve(a,g.getIndex,d,s,x,p),S=(i=Ne(b),"log"===u.type?i.filter((function(e){return 0!==e})):i),w=Math.min.apply(Math,S),L=Math.max.apply(Math,S),C=f(u,{all:S,min:w,max:L},"x"===y?r:o,y),M="vertical"===n?[k,C]:[C,k],B=M[0],T=M[1],W=g.innerPadding>0?g.innerPadding:0,V=k.bandwidth(),R=[xe({},g,{innerPadding:W,stackedData:b,xScale:B,yScale:T}),V,null!=(t=u.reverse)&&t];return{xScale:B,yScale:T,bars:V>0?"vertical"===n?_e.apply(void 0,R):Ge.apply(void 0,R):[]}},$e=function(e){var t=e.bars,i=e.direction,a=e.from,n=e.groupMode,r=e.layout,o=e.legendLabel,l=e.reverse,d=A(null!=o?o:"indexes"===a?"indexValue":"id");return"indexes"===a?function(e,t,i){var a=g(e.map((function(e){var t,a;return{id:null!=(t=e.data.indexValue)?t:"",label:i(e.data),hidden:e.data.hidden,color:null!=(a=e.color)?a:"#000"}})),(function(e){return e.id}));return"horizontal"===t&&a.reverse(),a}(t,r,d):function(e,t,i,a,n,r){var o=g(e.map((function(e){var t;return{id:e.data.id,label:r(e.data),hidden:e.data.hidden,color:null!=(t=e.color)?t:"#000"}})),(function(e){return e.id}));return("vertical"===t&&"stacked"===a&&"column"===i&&!0!==n||"horizontal"===t&&"stacked"===a&&!0===n)&&o.reverse(),o}(t,r,i,n,l,d)},Ke=function(e,t,i){var a=e.get(t)||0;e.set(t,a+i)},Je=function(e){var t,a=e.indexBy,r=void 0===a?Be.indexBy:a,o=e.keys,l=void 0===o?Be.keys:o,u=e.label,s=void 0===u?Be.label:u,c=e.tooltipLabel,h=void 0===c?Be.tooltipLabel:c,f=e.valueFormat,g=e.colors,v=void 0===g?Be.colors:g,b=e.colorBy,m=void 0===b?Be.colorBy:b,y=e.borderColor,p=void 0===y?Be.borderColor:y,k=e.labelTextColor,S=void 0===k?Be.labelTextColor:k,w=e.groupMode,L=void 0===w?Be.groupMode:w,C=e.layout,M=void 0===C?Be.layout:C,B=e.data,T=e.margin,W=e.width,V=e.height,H=e.padding,I=void 0===H?Be.padding:H,O=e.innerPadding,F=void 0===O?Be.innerPadding:O,A=e.valueScale,D=void 0===A?Be.valueScale:A,j=e.indexScale,X=void 0===j?Be.indexScale:j,Y=e.initialHiddenIds,N=void 0===Y?Be.initialHiddenIds:Y,_=e.enableLabel,G=void 0===_?Be.enableLabel:_,q=e.labelSkipWidth,$=void 0===q?Be.labelSkipWidth:q,K=e.labelSkipHeight,J=void 0===K?Be.labelSkipHeight:K,Z=e.legends,U=void 0===Z?Be.legends:Z,Q=e.legendLabel,ee=e.totalsOffset,te=void 0===ee?Be.totalsOffset:ee,ie=d(null!=N?N:[]),ae=ie[0],ne=ie[1],re=n((function(e){ne((function(t){return t.indexOf(e)>-1?t.filter((function(t){return t!==e})):[].concat(t,[e])}))}),[]),oe=P(r),le=P(s),de=P(h),ue=R(f),se=x(),ce=z(v,m),he=E(p,se),fe=E(S,se),ge=("grouped"===L?Xe:qe)({layout:M,data:B,getIndex:oe,keys:l,width:W,height:V,getColor:ce,padding:I,innerPadding:F,valueScale:D,indexScale:X,hiddenIds:ae,formatValue:ue,getTooltipLabel:de,margin:T}),ve=ge.bars,be=ge.xScale,me=ge.yScale,ye=i((function(){return ve.filter((function(e){return null!==e.data.value})).map((function(e,t){return xe({},e,{index:t})}))}),[ve]),pe=n((function(e){var t=e.width,i=e.height;return!(!G||$>0&&t<$||J>0&&i<J)}),[G,$,J]),ke=i((function(){return l.map((function(e){var t=ve.find((function(t){return t.data.id===e}));return xe({},t,{data:xe({id:e},null==t?void 0:t.data,{hidden:ae.includes(e)})})}))}),[ae,l,ve]),Se=null!=(t=D.reverse)&&t,we=i((function(){return U.map((function(e){return[e,$e({bars:"keys"===e.dataFrom?ke:ve,direction:e.direction,from:e.dataFrom,groupMode:L,layout:M,legendLabel:Q,reverse:Se})]}))}),[U,ke,ve,L,M,Q,Se]),Le=i((function(){return function(e,t,i,a,n,r,o){void 0===a&&(a=Be.layout),void 0===n&&(n=Be.groupMode);var l=[];if(0===e.length)return l;var d=new Map,u=e[0].width,s=e[0].height;if("stacked"===n){var c=new Map;e.forEach((function(e){var t=e.data,i=t.indexValue,a=t.value;Ke(d,i,Number(a)),function(e,t,i){var a=e.get(t)||0;e.set(t,a+(i>0?i:0))}(c,i,Number(a))})),c.forEach((function(e,n){var c,h,f,g=d.get(n)||0;"vertical"===a?(c=t(n),h=i(e),f=i(e/2)):(c=t(e),h=i(n),f=t(e/2)),c+="vertical"===a?u/2:r,h+="vertical"===a?-r:s/2,l.push({key:"total_"+n,x:c,y:h,value:g,formattedValue:o(g),animationOffset:f})}))}else if("grouped"===n){var h=new Map,f=new Map;e.forEach((function(e){var t=e.data,i=t.indexValue,a=t.value;Ke(d,i,Number(a)),function(e,t,i){var a=e.get(t)||0;e.set(t,Math.max(a,Number(i)))}(h,i,Number(a)),function(e,t){var i=e.get(t)||0;e.set(t,i+1)}(f,i)})),h.forEach((function(e,n){var c,h,g,v=d.get(n)||0,b=f.get(n);"vertical"===a?(c=t(n),h=i(e),g=i(e/2)):(c=t(e),h=i(n),g=t(e/2)),c+="vertical"===a?b*u/2:r,h+="vertical"===a?-r:b*s/2,l.push({key:"total_"+n,x:c,y:h,value:v,formattedValue:o(v),animationOffset:g})}))}return l}(ve,be,me,M,L,te,ue)}),[ve,be,me,M,L,te,ue]);return{bars:ve,barsWithValue:ye,xScale:be,yScale:me,getIndex:oe,getLabel:le,getTooltipLabel:de,formatValue:ue,getColor:ce,getBorderColor:he,getLabelColor:fe,shouldRenderBarLabel:pe,hiddenIds:ae,toggleSerie:re,legendsWithData:we,barTotals:Le}},Ze=function(t){var i=t.data,a=t.springConfig,n=t.animate,r=t.layout,o=void 0===r?Te.layout:r,l=x();return B(i,{keys:function(e){return e.key},from:function(e){return{x:"vertical"===o?e.x:e.animationOffset,y:"vertical"===o?e.animationOffset:e.y,labelOpacity:0}},enter:function(e){return{x:e.x,y:e.y,labelOpacity:1}},update:function(e){return{x:e.x,y:e.y,labelOpacity:1}},leave:function(e){return{x:"vertical"===o?e.x:e.animationOffset,y:"vertical"===o?e.animationOffset:e.y,labelOpacity:0}},config:a,immediate:!n,initial:n?void 0:null})((function(t,i){return e(S.text,{x:t.x,y:t.y,fillOpacity:t.labelOpacity,style:xe({},l.labels.text,{pointerEvents:"none"}),fontWeight:"bold",fontSize:l.labels.text.fontSize,fontFamily:l.labels.text.fontFamily,textAnchor:"vertical"===o?"middle":"start",alignmentBaseline:"vertical"===o?"alphabetic":"middle",children:i.formattedValue},i.key)}))},Ue=["isInteractive","animate","motionConfig","theme","renderWrapper"],Qe=function(t){var n,o=t.data,l=t.indexBy,d=t.keys,c=t.margin,h=t.width,f=t.height,g=t.groupMode,v=t.layout,b=t.valueScale,m=t.indexScale,y=t.padding,p=t.innerPadding,x=t.axisTop,k=t.axisRight,S=t.axisBottom,w=void 0===S?Te.axisBottom:S,L=t.axisLeft,R=void 0===L?Te.axisLeft:L,H=t.enableGridX,I=void 0===H?Te.enableGridX:H,O=t.enableGridY,P=void 0===O?Te.enableGridY:O,z=t.gridXValues,E=t.gridYValues,F=t.layers,A=void 0===F?Te.layers:F,D=t.barComponent,j=void 0===D?Te.barComponent:D,X=t.enableLabel,Y=void 0===X?Te.enableLabel:X,N=t.label,_=t.labelSkipWidth,G=void 0===_?Te.labelSkipWidth:_,q=t.labelSkipHeight,$=void 0===q?Te.labelSkipHeight:q,K=t.labelTextColor,J=t.labelPosition,Z=void 0===J?Te.labelPosition:J,U=t.labelOffset,Q=void 0===U?Te.labelOffset:U,ee=t.markers,te=void 0===ee?Te.markers:ee,ie=t.colorBy,ae=t.colors,ne=t.defs,re=void 0===ne?Te.defs:ne,oe=t.fill,le=void 0===oe?Te.fill:oe,de=t.borderRadius,ue=void 0===de?Te.borderRadius:de,se=t.borderWidth,ce=void 0===se?Te.borderWidth:se,he=t.borderColor,fe=t.annotations,ge=void 0===fe?Te.annotations:fe,ve=t.legendLabel,be=t.tooltipLabel,me=t.valueFormat,ye=t.isInteractive,pe=void 0===ye?Te.isInteractive:ye,ke=t.tooltip,Se=void 0===ke?Te.tooltip:ke,Ce=t.onClick,Me=t.onMouseEnter,Be=t.onMouseLeave,We=t.legends,Ve=t.role,Re=void 0===Ve?Te.role:Ve,He=t.ariaLabel,Ie=t.ariaLabelledBy,Pe=t.ariaDescribedBy,ze=t.isFocusable,Ee=void 0===ze?Te.isFocusable:ze,Fe=t.barAriaLabel,Ae=t.barAriaLabelledBy,De=t.barAriaDescribedBy,je=t.barAriaHidden,Xe=t.barAriaDisabled,Ye=t.initialHiddenIds,Ne=t.enableTotals,_e=void 0===Ne?Te.enableTotals:Ne,Ge=t.totalsOffset,qe=void 0===Ge?Te.totalsOffset:Ge,$e=t.forwardedRef,Ke=C(),Ue=Ke.animate,Qe=Ke.config,et=M(h,f,c),tt=et.outerWidth,it=et.outerHeight,at=et.margin,nt=et.innerWidth,rt=et.innerHeight,ot=Je({indexBy:l,label:N,tooltipLabel:be,valueFormat:me,colors:ae,colorBy:ie,borderColor:he,labelTextColor:K,groupMode:g,layout:v,data:o,keys:d,margin:at,width:nt,height:rt,padding:y,innerPadding:p,valueScale:b,indexScale:m,enableLabel:Y,labelSkipWidth:G,labelSkipHeight:$,legends:We,legendLabel:ve,initialHiddenIds:Ye,totalsOffset:qe}),lt=ot.bars,dt=ot.barsWithValue,ut=ot.xScale,st=ot.yScale,ct=ot.getLabel,ht=ot.getTooltipLabel,ft=ot.getBorderColor,gt=ot.getLabelColor,vt=ot.shouldRenderBarLabel,bt=ot.toggleSerie,mt=ot.legendsWithData,yt=ot.barTotals,pt=ot.getColor,xt=Oe(v,null!=(n=null==b?void 0:b.reverse)&&n,Z,Q),kt=B(dt,{keys:function(e){return e.key},from:function(e){return xe({borderColor:ft(e),color:e.color,height:0,labelColor:gt(e),labelOpacity:0},xt(e.width,e.height),{transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===v?{}:{height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},enter:function(e){return xe({borderColor:ft(e),color:e.color,height:e.height,labelColor:gt(e),labelOpacity:1},xt(e.width,e.height),{transform:"translate("+e.x+", "+e.y+")",width:e.width})},update:function(e){return xe({borderColor:ft(e),color:e.color,height:e.height,labelColor:gt(e),labelOpacity:1},xt(e.width,e.height),{transform:"translate("+e.x+", "+e.y+")",width:e.width})},leave:function(e){return xe({borderColor:ft(e),color:e.color,height:0,labelColor:gt(e),labelOpacity:0},xt(e.width,e.height),{labelY:0,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===v?{}:xe({},xt(e.width,e.height),{labelX:0,height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0}))},config:Qe,immediate:!Ue,initial:Ue?void 0:null}),St=i((function(){return{borderRadius:ue,borderWidth:ce,enableLabel:Y,isInteractive:pe,labelSkipWidth:G,labelSkipHeight:$,onClick:Ce,onMouseEnter:Me,onMouseLeave:Be,getTooltipLabel:ht,tooltip:Se,isFocusable:Ee,ariaLabel:Fe,ariaLabelledBy:Ae,ariaDescribedBy:De,ariaHidden:je,ariaDisabled:Xe}}),[ue,ce,Y,ht,pe,$,G,Ce,Me,Be,Se,Ee,Fe,Ae,De,je,Xe]),wt=T(re,lt,le,{dataKey:"data",targetKey:"data.fill"}),Lt={annotations:null,axes:null,bars:null,grid:null,legends:null,markers:null,totals:null};A.includes("annotations")&&(Lt.annotations=e(we,{bars:lt,annotations:ge},"annotations")),A.includes("axes")&&(Lt.axes=e(u,{xScale:ut,yScale:st,width:nt,height:rt,top:x,right:k,bottom:w,left:R},"axes")),A.includes("bars")&&(Lt.bars=e(r,{children:kt((function(e,t){return a(j,xe({},St,{bar:t,style:e,shouldRenderLabel:vt(t),label:ct(t.data)}))}))},"bars")),A.includes("grid")&&(Lt.grid=e(s,{width:nt,height:rt,xScale:I?ut:null,yScale:P?st:null,xValues:z,yValues:E},"grid")),A.includes("legends")&&(Lt.legends=e(Le,{width:nt,height:rt,legends:mt,toggleSerie:bt},"legends")),A.includes("markers")&&(Lt.markers=e(W,{markers:te,width:nt,height:rt,xScale:ut,yScale:st},"markers")),A.includes("totals")&&_e&&(Lt.totals=e(Ze,{data:yt,springConfig:Qe,animate:Ue,layout:v},"totals"));var Ct=xe({},St,{margin:at,width:h,height:f,innerWidth:nt,innerHeight:rt,bars:lt,legendData:mt,enableLabel:Y,xScale:ut,yScale:st,tooltip:Se,getTooltipLabel:ht,onClick:Ce,onMouseEnter:Me,onMouseLeave:Be,getColor:pt});return e(V,{width:tt,height:it,margin:at,defs:wt,role:Re,ariaLabel:He,ariaLabelledBy:Ie,ariaDescribedBy:Pe,isFocusable:Ee,ref:$e,children:A.map((function(t,i){var n;return"function"==typeof t?e(r,{children:a(t,Ct)},i):null!=(n=null==Lt?void 0:Lt[t])?n:null}))})},et=t((function(t,i){var a=t.isInteractive,n=void 0===a?Te.isInteractive:a,r=t.animate,o=void 0===r?Te.animate:r,l=t.motionConfig,d=void 0===l?Te.motionConfig:l,u=t.theme,s=t.renderWrapper,c=ke(t,Ue);return e(m,{animate:o,isInteractive:n,motionConfig:d,renderWrapper:s,theme:u,children:e(Qe,xe({},c,{isInteractive:n,forwardedRef:i}))})})),tt=["isInteractive","renderWrapper","theme"],it=function(e,t,i,a){return e.find((function(e){return F(e.x+t.left,e.y+t.top,e.width,e.height,i,a)}))},at=function(t){var r,d=t.data,u=t.indexBy,s=t.keys,f=t.margin,g=t.width,v=t.height,m=t.groupMode,y=t.layout,p=t.valueScale,S=t.indexScale,w=t.padding,L=t.innerPadding,C=t.axisTop,B=t.axisRight,T=t.axisBottom,W=void 0===T?We.axisBottom:T,V=t.axisLeft,P=void 0===V?We.axisLeft:V,z=t.enableGridX,E=void 0===z?We.enableGridX:z,F=t.enableGridY,A=void 0===F?We.enableGridY:F,D=t.gridXValues,N=t.gridYValues,G=t.labelPosition,q=void 0===G?We.labelPosition:G,$=t.labelOffset,K=void 0===$?We.labelOffset:$,J=t.layers,Z=void 0===J?We.layers:J,U=t.renderBar,Q=void 0===U?We.renderBar:U,ee=t.enableLabel,te=void 0===ee?We.enableLabel:ee,ie=t.label,ae=t.labelSkipWidth,ne=void 0===ae?We.labelSkipWidth:ae,re=t.labelSkipHeight,oe=void 0===re?We.labelSkipHeight:re,le=t.labelTextColor,de=t.colorBy,ue=t.colors,se=t.borderRadius,ce=void 0===se?We.borderRadius:se,he=t.borderWidth,fe=void 0===he?We.borderWidth:he,ge=t.borderColor,ve=t.annotations,be=void 0===ve?We.annotations:ve,me=t.legendLabel,ye=t.tooltipLabel,pe=t.valueFormat,ke=t.isInteractive,Se=void 0===ke?We.isInteractive:ke,we=t.tooltip,Le=void 0===we?We.tooltip:we,Ce=t.onClick,Me=t.onMouseEnter,Be=t.onMouseLeave,Te=t.legends,Ve=t.pixelRatio,Re=void 0===Ve?We.pixelRatio:Ve,He=t.role,Ie=t.forwardedRef,Pe=t.enableTotals,ze=void 0===Pe?We.enableTotals:Pe,Ee=t.totalsOffset,Fe=void 0===Ee?We.totalsOffset:Ee,Ae=o(null),De=x(),je=M(g,v,f),Xe=je.margin,Ye=je.innerWidth,Ne=je.innerHeight,_e=je.outerWidth,Ge=je.outerHeight,qe=Je({indexBy:u,label:ie,tooltipLabel:ye,valueFormat:pe,colors:ue,colorBy:de,borderColor:ge,labelTextColor:le,groupMode:m,layout:y,data:d,keys:s,margin:Xe,width:Ye,height:Ne,padding:w,innerPadding:L,valueScale:p,indexScale:S,enableLabel:te,labelSkipWidth:ne,labelSkipHeight:oe,legends:Te,legendLabel:me,totalsOffset:Fe}),$e=qe.bars,Ke=qe.barsWithValue,Ze=qe.xScale,Ue=qe.yScale,Qe=qe.getLabel,et=qe.getTooltipLabel,tt=qe.getBorderColor,at=qe.getLabelColor,nt=qe.shouldRenderBarLabel,rt=qe.legendsWithData,ot=qe.barTotals,lt=qe.getColor,dt=k(),ut=dt.showTooltipFromEvent,st=dt.hideTooltip,ct=j({annotations:X({data:$e,annotations:be,getPosition:function(e){return{x:e.x,y:e.y}},getDimensions:function(e){var t=e.width,i=e.height;return{width:t,height:i,size:Math.max(t,i)}}})}),ht=i((function(){return{borderRadius:ce,borderWidth:fe,isInteractive:Se,isFocusable:!1,labelSkipWidth:ne,labelSkipHeight:oe,margin:Xe,width:g,height:v,innerWidth:Ye,innerHeight:Ne,bars:$e,legendData:rt,enableLabel:te,xScale:Ze,yScale:Ue,tooltip:Le,getTooltipLabel:et,onClick:Ce,onMouseEnter:Me,onMouseLeave:Be,getColor:lt}}),[ce,fe,Se,ne,oe,Xe,g,v,Ye,Ne,$e,rt,te,Ze,Ue,Le,et,Ce,Me,Be,lt]),ft=R(pe),gt=Oe(y,null!=(r=null==p?void 0:p.reverse)&&r,q,K);l((function(){if(Ae.current){Ae.current.width=_e*Re,Ae.current.height=Ge*Re;var e=Ae.current.getContext("2d");e.scale(Re,Re),e.fillStyle=De.background,e.fillRect(0,0,_e,Ge),e.translate(Xe.left,Xe.top),Z.forEach((function(t){"grid"===t?"number"==typeof De.grid.line.strokeWidth&&De.grid.line.strokeWidth>0&&(e.lineWidth=De.grid.line.strokeWidth,e.strokeStyle=De.grid.line.stroke,E&&c(e,{width:Ye,height:Ne,scale:Ze,axis:"x",values:D}),A&&c(e,{width:Ye,height:Ne,scale:Ue,axis:"y",values:N})):"axes"===t?h(e,{xScale:Ze,yScale:Ue,width:Ye,height:Ne,top:C,right:B,bottom:W,left:P,theme:De}):"bars"===t?(H(e,De.text),Ke.forEach((function(t){Q(e,xe({bar:t,borderColor:tt(t),borderRadius:ce,borderWidth:fe,label:Qe(t.data),shouldRenderLabel:nt(t),labelStyle:xe({},De.labels.text,{fill:at(t)})},gt(t.width,t.height)))}))):"legends"===t?rt.forEach((function(t){var i=t[0],a=t[1];_(e,xe({},i,{data:a,containerWidth:Ye,containerHeight:Ne,theme:De}))})):"annotations"===t?Y(e,{annotations:ct,theme:De}):"totals"===t&&ze?function(e,t,i,a){void 0===a&&(a=We.layout),H(e,i.labels.text),e.textBaseline="vertical"===a?"alphabetic":"middle",e.textAlign="vertical"===a?"center":"start",t.forEach((function(t){b(e,i.labels.text,t.formattedValue,t.x,t.y)}))}(e,ot,De,y):"function"==typeof t&&t(e,ht)})),e.save()}}),[W,P,B,C,Ke,ce,fe,ct,E,A,tt,Qe,at,D,N,m,v,Ne,Ye,ht,Z,y,rt,Xe.left,Xe.top,Ge,_e,Re,Q,Ze,Ue,nt,De,g,ot,ze,ft,gt]);var vt=n((function(e){if($e&&Ae.current){var t=I(Ae.current,e),i=t[0],n=t[1],r=it($e,Xe,i,n);void 0!==r?(ut(a(Le,xe({},r.data,{color:r.color,label:r.label,value:Number(r.data.value)})),e),"mouseenter"===e.type&&(null==Me||Me(r.data,e))):st()}}),[st,Xe,Me,$e,ut,Le]),bt=n((function(e){if($e&&Ae.current){st();var t=I(Ae.current,e),i=t[0],a=t[1],n=it($e,Xe,i,a);n&&(null==Be||Be(n.data,e))}}),[st,Xe,Be,$e]),mt=n((function(e){if($e&&Ae.current){var t=I(Ae.current,e),i=t[0],a=t[1],n=it($e,Xe,i,a);void 0!==n&&(null==Ce||Ce(xe({},n.data,{color:n.color}),e))}}),[Xe,Ce,$e]);return e("canvas",{ref:O(Ae,Ie),width:_e*Re,height:Ge*Re,style:{width:_e,height:Ge,cursor:Se?"auto":"normal"},onMouseEnter:Se?vt:void 0,onMouseMove:Se?vt:void 0,onMouseLeave:Se?bt:void 0,onClick:Se?mt:void 0,role:He})},nt=t((function(t,i){var a=t.isInteractive,n=t.renderWrapper,r=t.theme,o=ke(t,tt);return e(m,{isInteractive:a,renderWrapper:n,theme:r,animate:!1,children:e(at,xe({},o,{isInteractive:a,forwardedRef:i}))})})),rt=["defaultWidth","defaultHeight","onResize","debounceResize"],ot=t((function(t,i){var a=t.defaultWidth,n=t.defaultHeight,r=t.onResize,o=t.debounceResize,l=ke(t,rt);return e(y,{defaultWidth:a,defaultHeight:n,onResize:r,debounceResize:o,children:function(t){var a=t.width,n=t.height;return e(et,xe({},l,{width:a,height:n,ref:i}))}})})),lt=["defaultWidth","defaultHeight","onResize","debounceResize"];t((function(t,i){var a=t.defaultWidth,n=t.defaultHeight,r=t.onResize,o=t.debounceResize,l=ke(t,lt);return e(y,{defaultWidth:a,defaultHeight:n,onResize:r,debounceResize:o,children:function(t){var a=t.width,n=t.height;return e(nt,xe({},l,{width:a,height:n,ref:i}))}})}));var dt="styles_legends__LAO35";const ut=t=>{const{data:i,onLegendClick:a}=t;return e("div",{className:dt,children:i.map((t=>e(oe,{legend:t,onClick:a},t.id)))})},st=({value:t,indexBy:i,legend:a,formatIndexBy:n=(e,t)=>e[t]?.toString()??"",formatLegendValue:r=e=>(e.value??0).toString()??"",allowZeroValues:o=!1})=>{const l=o?a:a.filter((e=>le(t[e.id])&&0!==Number(t[e.id])));return e(de,{label:n(t,i),children:l.map((i=>e(oe,{mode:"menu",legend:{...i,value:r({...i,value:t[i.id]})}},i.id)))})},ct=t=>{const{background:i,grid:a}=x();return e("g",{children:[e("line",{opacity:"1",x1:"0",x2:t.innerWidth,y1:t.innerHeight,y2:t.innerHeight,stroke:i,strokeWidth:"1"}),e("line",{opacity:"1",x1:"0",x2:t.innerWidth,y1:t.innerHeight,y2:t.innerHeight,stroke:a.line.stroke,strokeWidth:"1"})]})},ht=J(null),ft=t=>{const{children:i}=t,[a,n]=U(void 0);return e(ht.Provider,{value:[a,n],children:i})};var gt=/*@__PURE__*/se(ce());const vt={s:16,m:24,l:32},bt=(e,t)=>Math.min(e,vt[t]),mt=t=>{const{isInteractive:i,isFocusable:a,innerHeight:n,innerWidth:r,tooltip:o,indexBy:l,layout:d="vertical",onBarClick:u,bars:s,hasValueFn:c=e=>Object.entries(e).filter((([e])=>e!==t.indexBy)).reduce(((e,[,t])=>e+gt(t??0)),0)>0}=t,h="horizontal"===d,{handleShowTooltip:f,isVisible:g,handleHideTooltip:v,tooltipRef:b,data:m}=fe(h?"bottom":"left"),{animate:y,config:p}=C(),{opacity:x}=D({opacity:g?1:0,config:{...p,duration:75},immediate:!y});if(!i)return null;const k=Math.max(...s.map((e=>e.data.index+1))),w=s.slice(0,k);if(w.length<=0)return null;const[L,M]=w;if(!L)return null;const B=M?.x?M.x-L.x:L.width,T=B-L.width,W=M?.y?L.y-M.y:L.height,V=W-L.height;return e(S.g,{"data-testid":"hover-layer",children:[w.map(((t,o)=>{const d=t.x-T/2,s=t.y-V/2;return c(t.data.data)?e(yt,{x:h?0:d,y:h?s:0,width:h?r:B,height:h?W:n,value:t.data.data,indexBy:l,isInteractive:i,isFocusable:a,onTooltipShow:f,onTooltipHide:v,onClick:u},o):null})),he(e(S.div,{ref:b,style:{display:x?"block":"none",opacity:x},children:g&&m&&Z(o,{value:m})}),document.body)]})},yt=({x:t,y:i,width:a,height:n,value:r,isInteractive:o=!0,isFocusable:l=!0,indexBy:d,onTooltipShow:u,onTooltipHide:s,onClick:c})=>{const[h,f]=(()=>{const e=Q(ht);if(!e)throw new Error("useBarChartState must be used within a BarChartStateProvider");return e})(),{animate:g,config:v}=C(),b=r[d],m=h===String(b),{fill:y}=D({from:{fill:"#ffffff00"},to:{fill:"var(--color-control-bg-ghost-hover)"},config:{...v,duration:150},reverse:!m,immediate:!g}),p=ie((e=>{u(e.target,r)}),[u,r]),x=ie((e=>{u(e.target,r),f(String(b))}),[u,r,f,b]),k=ie((e=>{s(e.target),f(void 0)}),[s,f]),w=ie((e=>{u(e.target,r),f(String(b))}),[u,r,f,b]),L=ie((e=>{s(e.target),f(void 0)}),[s,f]),M=ie((()=>{c?.({data:r})}),[c,r]);return e(S.rect,{x:t,y:i,"data-testid":"hover-rect",width:a,height:n,fill:y,style:c?{cursor:"pointer"}:void 0,onMouseMove:o?p:void 0,onMouseEnter:o?x:void 0,onMouseLeave:o?k:void 0,onClick:o&&c?M:void 0,onFocus:o&&l?w:void 0,onBlur:o&&l?L:void 0})},pt=J(null),xt=()=>{const e=Q(pt);if(!e)throw new Error("useBarContext must be used within a BarContext");return e},kt=t=>{const{bars:i,indexBy:a,layout:n="vertical",barSize:r,groupMode:o="stacked"}=t,l=ee((()=>(e=>{const{bars:t,indexBy:i,layout:a,groupMode:n}=e,r=new Map;for(const e of t){const t=e.data.data[i];r.has(t)||r.set(t,{id:t,bars:[],x:1/0,y:1/0,width:0,height:0});const o=r.get(t);o.bars.push(e),o.x=Math.min(o.x,e.x),o.y=Math.min(o.y,e.y);let l=o.width+e.width,d=o.height+e.height;"vertical"===a&&(l=Math.max(o.width,e.width),"grouped"===n&&(d=Math.max(o.height,e.height))),"horizontal"===a&&(d=Math.max(o.height,e.height),"grouped"===n&&(l=Math.max(o.width,e.width))),o.width=l,o.height=d}return Array.from(r.values())})({bars:i,indexBy:a,layout:n,groupMode:o})),[i,a,n,o]),d=Math.min(...l.map((e=>e.y))),u=Math.min(...l.map((e=>e.x)));return e(pt.Provider,{value:{barSize:r,layout:n,groupMode:o},children:e(S.g,{"data-testid":"bars",pointerEvents:"none",children:l.map((t=>e(St,{group:t,offsetY:d,offsetX:u},t.id)))})})},St=t=>{const{group:i}=t,{barSize:a,layout:n}=xt(),{animate:r,config:o}=C(),l=te(),d="horizontal"===n,u=bt(i.height,a),s=bt(i.width,a),c=i.width-s,h=i.height-u,f=d?i.x:i.x+c/2,g=d?i.y+h/2:i.y,v=d?i.width:s,b=d?u:i.height,m=(y=d?u:s)<=4?0:y<=vt.s/3?1:y<=vt.s/2?1.5:y<vt.s?2:y>=vt.s&&y<vt.m?4:y>=vt.m?6:0;var y;const{transform:p}=D({transform:`translate(${f}, ${g})`,config:o,immediate:!r}),x=ee((()=>{const e=i.bars.filter((e=>e.width>0&&e.height>0));return"horizontal"===n?e.sort(((e,t)=>e.x-t.x)):e.sort(((e,t)=>e.y-t.y))}),[i.bars,n]),k="horizontal"===n?v<2*m:b<2*m;return e(S.g,{clipPath:k?void 0:`url(#clip-${l})`,transform:p,"data-testid":"group","data-id":i.id,children:[!k&&e("defs",{children:e("clipPath",{id:`clip-${l}`,children:e(S.rect,{x:0,y:0,width:v,height:b,rx:m,ry:m})})}),x.map(((t,i)=>e(wt,{id:t.data.id,x:d?t.x-f:0,y:d?0:t.y-g,width:d?t.width:v,height:d?b:t.height,fill:t.color,isFirst:0===i,isLast:i===x.length-1},t.data.id)))]})},wt=t=>{const{isFirst:i,isLast:a,id:n,...r}=t,{layout:o}=xt(),{animate:l,config:d}=C(),u="horizontal"===o?r.width:r.height,s=!i&&u>2,c=!a&&u>2;let h=r.width,f=r.height,g=r.x,v=r.y;"horizontal"===o&&(s&&c&&(g+=.5,h-=.5),c&&(h-=.5)),"vertical"===o&&(s&&(v+=.5,f-=.5),c&&(f-=.5));const b=D({x:g,y:v,width:h,height:f,config:d,immediate:!l});return e(S.rect,{...b,fill:r.fill,"data-testid":"bar","data-id":n})};function Lt(e,t,i,a){let n=0;for(let r=0,o=(e=function(e){return Array.isArray(e)?e:Array.from(e)}(e)).length;r<o;r++){const o=e[r],l=t(o,r,e),d=i(o,r,e);null!=l&&isFinite(l)&&null!=d&&isFinite(d)&&a(+l,+d,n++)}}const Ct=function(){let e,t=e=>e[0],i=e=>e[1];function a(a){let n=0,r=0,o=0,l=0,d=0,u=e?+e[0]:1/0,s=e?+e[1]:-1/0;Lt(a,t,i,((t,i)=>{++n,r+=(t-r)/n,o+=(i-o)/n,l+=(t*i-l)/n,d+=(t*t-d)/n,e||(t<u&&(u=t),t>s&&(s=t))}));const[c,h]=function(e,t,i,a){const n=a-e*e,r=Math.abs(n)<1e-24?0:(i-e*t)/n;return[t-r*e,r]}(r,o,l,d),f=e=>h*e+c,g=[[u,f(u)],[s,f(s)]];return g.a=h,g.b=c,g.predict=f,g.rSquared=function(e,t,i,a,n){let r=0,o=0;return Lt(e,t,i,((e,t)=>{const i=t-n(e),l=t-a;r+=i*i,o+=l*l})),1-r/o}(a,t,i,o,f),g}return a.domain=function(t){return arguments.length?(e=t,a):e},a.x=function(e){return arguments.length?(t=e,a):t},a.y=function(e){return arguments.length?(i=e,a):i},a}().x((e=>e.x)).y((e=>e.y)),Mt=ge().x((e=>e[0])).y((e=>e[1])),Bt=t=>{const{legend:i,indexBy:a,bars:n,innerHeight:r,innerWidth:o,formatValue:l=e=>gt(e)}=t,d=ee((()=>i.filter((e=>"point"===e.type)).map((e=>e.id))),[i]),u=te(),s=ee((()=>i.filter((e=>"point"===e.type)).reduce(((e,t)=>(e[t.id]=t.color,e)),{})),[i]),c=ee((()=>(e=>{const t=Math.max(...e.map((e=>e.data.index+1)));return e.slice(0,t)})(n)),[n]),h=ee((()=>v(d.map((e=>({id:e,data:c.map((t=>{const i=l(gt(t.data.data[e]??0),e);return void 0===i?null:{x:gt(t.data.data[a]??0),y:i}})).filter((e=>null!==e))}))),{type:"linear"},{type:"linear",nice:!0,min:0,max:100},o,r)),[d,c,a,l,o,r]),f=ee((()=>d.map((e=>{if(c.length<2)return null;const t=s[e]??"",i=c.map((t=>{const i=l(gt(t.data.data[e]??0),e);return void 0===i?null:{x:gt(t.x+t.width/2),y:gt(h.yScale(i)??0),id:t.key,value:i}})).filter((e=>null!==e));if(c.length===i.length)return{trendKey:e,color:t,points:i};if(i.length<2)return null;const a=Ct(i),n=c.map((t=>{const i=l(gt(t.data.data[e]??0),e),n=gt(t.x+t.width/2);let r=a.predict(n);return void 0!==i&&(r=gt(h.yScale(i)??0)),{x:n,y:r,id:t.key,value:i}}));return{trendKey:e,color:t,points:n}})).filter((e=>null!==e))),[d,c,l,h,s]);if(0===d.length)return null;if(0===f.length)return null;return e(S.g,{"data-testid":"trend-lines-layer",pointerEvents:"none",clipPath:`url(#${u})`,children:[e("defs",{children:e("clipPath",{id:u,children:e("rect",{x:-5,y:-5,width:o+5,height:r+5})})}),f.map((({trendKey:t,points:i,color:a})=>e(S.g,{"data-testid":"trend-line-group","data-trend-key":t,children:[e(Tt,{points:i,color:a},t),i.filter((e=>void 0!==e.value&&e.value>=0&&e.value<=100)).map((({x:t,y:i,id:n})=>e(Wt,{x:t,y:i,color:a},n)))]},t)))]})},Tt=t=>{const{points:i,color:a}=t,{animate:n,config:r}=C(),o=ee((()=>0===i.length||i.length<2?[]:Ct(i)),[i]),{d:l}=D({d:Mt(o)??void 0,config:r,immediate:!n});return 0===i.length||i.length<2||0===o.length?null:e(S.path,{d:l,"data-testid":"trend-line",fill:"none",stroke:a,strokeWidth:2,strokeLinecap:"round",pointerEvents:"none",strokeDasharray:"4"})},Wt=t=>{const{x:i,y:a,color:n}=t,{animate:r,config:o}=C(),{cx:l,cy:d}=D({cx:i,cy:a,config:o,immediate:!r});return e(S.circle,{"data-testid":"trend-line-point",cx:l,cy:d,r:3,strokeWidth:2,fill:"white",stroke:n,pointerEvents:"none"})},Vt=({data:e,layout:t="vertical",indexBy:i,keys:a,stacked:n,position:r,formatLeftTick:o,formatBottomTick:l})=>{if("horizontal"===t){const t=6,a=e.map((e=>l(e[i],e).toString().length));return Math.max(...a)*t+8}const d=o(Math.floor(Math.max(...e.map((e=>a.map((t=>gt(e[t]??0))).reduce(((e,t)=>e+t),0)))))).toString().length+1;return 8+8*d+10*Math.max(Math.floor((d-1)/3),0)+1};var Rt="styles_container__nVJhv",Ht="styles_barContainer__DTIpd";const It=t=>{const{data:i,legend:a,indexBy:n,renderBottomTick:r,onBarClick:o,padding:l=.5,formatLegendValue:d,formatIndexBy:u,hasValueFn:s,currentLocale:c="en-US",formatBottomTick:h=e=>e,formatLeftTick:f=e=>ue(e,c),bottomTickRotation:g=0,noLegend:v=!1,minValue:b,maxValue:m,groupMode:y="stacked",bottomTickSize:p=12,markers:x=[],colors:k,leftAxisTickValues:S,layout:w="vertical",formatTrendValue:L}=t,C=ee((()=>new Map(a.map((e=>[e.id,e])))),[a]),M=ee((()=>a.filter((e=>"point"!==e.type&&"tree"!==e.type)).map((e=>e.id))),[a]),B=ee((()=>((e,t)=>e.every((e=>Object.keys(e).filter((e=>e!==t)).every((t=>0===e[t])))))(i,n)),[i,n]),T=ee((()=>i.length>=8?"s":i.length>=6?"m":"l"),[i]),W="horizontal"===w;return e("div",{className:Rt,children:[e("div",{className:Ht,children:e(ft,{children:e(ot,{data:i,theme:ne,groupMode:y,layout:w,defaultHeight:275,keys:M,indexBy:n,margin:{top:10,right:20,bottom:g>0?60:40,left:Vt({data:i,layout:w,keys:M,indexBy:n,stacked:!0,position:"left",formatLeftTick:f,formatBottomTick:h})},padding:l,innerPadding:0,valueScale:{type:"linear",nice:!0,min:b,max:m},indexScale:{type:"band",round:!0},layers:["grid","axes",ct,t=>e(kt,{...t,indexBy:n,layout:w,legend:a,barSize:T,groupMode:y}),t=>e(Bt,{...t,legend:a,indexBy:n,formatValue:L}),"markers",t=>e(mt,{...t,hasValueFn:s,indexBy:n,layout:w,onBarClick:o,tooltip:({value:t})=>e(st,{allowZeroValues:!0,value:t,indexBy:n,legend:a,formatLegendValue:d,formatIndexBy:u})})],markers:x,colors:"function"==typeof k?k:e=>C.get(e.id)?.color??"var(--color-bg-secondary)",enableLabel:!1,enableTotals:!1,axisTop:null,axisRight:null,axisBottom:{tickSize:0,tickPadding:5,tickRotation:g,truncateTickAt:0,renderTick:r,style:{ticks:{text:{fontSize:p}}},format:W?f:e=>h(e,i.find((t=>t[n]===e))),tickValues:i.length>30?i.filter(((e,t)=>!(t%2))).map((e=>e[n])):void 0},axisLeft:{tickSize:0,tickPadding:8,tickRotation:0,truncateTickAt:0,format:W?h?e=>h(e,i.find((t=>t[n]===e))):void 0:f,tickValues:S},animate:!re,motionConfig:ae,onClick:o})})}),!B&&!v&&e(ut,{data:a})]})};export{It as B};
|
|
2
|
-
//# sourceMappingURL=BarChart-
|
|
1
|
+
import{u as e}from"./clsx-D83172mf.js";import{forwardRef as t,useMemo as i,createElement as a,useCallback as n,Fragment as r,useRef as o,useEffect as l,useState as d}from"react";import{V as u,j as s,q as c,W as h,p as f,J as g,h as v}from"./nivo-axes-3Cy5TCy7.js";import{d as b,F as m,$ as y,T as p,M as x,z as k,k as S,t as w,b as L,D as C,c as M,o as B,C as T,P as W,R as V,g as R,a as H,l as I,n as O,q as P,h as z,e as E,w as F,a8 as A,j as D}from"./nivo-colors-fVDn0-vW.js";import{j,O as X,J as Y,R as N}from"./nivo-annotations-OXtu3nXs.js";import{L as _,E as G}from"./nivo-legends-BIaWaGVX.js";import{c as q,a as $}from"./array-B0SXO2zY.js";import{Fragment as K,createContext as J,createElement as Z}from"preact";import{useState as U,useContext as Q,useMemo as ee,useId as te,useCallback as ie}from"preact/hooks";import{a as ae,C as ne,R as re}from"./config-CgDglkkw.js";import{L as oe,i as le,C as de,f as ue}from"./index-DQIPuqU4.js";import{g as se}from"./_commonjsHelpers-Doe7ti1T.js";import{r as ce}from"./toNumber-Cpsf6DxM.js";import{createPortal as he}from"preact/compat";import{u as fe}from"./useTooltip-VGYCawp2.js";import{P as ge}from"./line-CEBDCBhb.js";function ve(e,t){if((n=e.length)>1)for(var i,a,n,r=1,o=e[t[0]],l=o.length;r<n;++r)for(a=o,o=e[t[r]],i=0;i<l;++i)o[i][1]+=o[i][0]=isNaN(a[i][1])?a[i][0]:a[i][1]}function be(e){for(var t=e.length,i=new Array(t);--t>=0;)i[t]=t;return i}function me(e,t){return e[t]}function ye(e){const t=[];return t.key=e,t}function pe(e,t){if((l=e.length)>0)for(var i,a,n,r,o,l,d=0,u=e[t[0]].length;d<u;++d)for(r=o=0,i=0;i<l;++i)(n=(a=e[t[i]][d])[1]-a[0])>0?(a[0]=r,a[1]=r+=n):n<0?(a[1]=o,a[0]=o+=n):(a[0]=0,a[1]=n)}function xe(){return xe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var a in i)({}).hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},xe.apply(null,arguments)}function ke(e,t){if(null==e)return{};var i={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;i[a]=e[a]}return i}var Se,we=function(t){var i=t.bars,a=t.annotations,n=X({data:i,annotations:a,getPosition:function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},getDimensions:function(e){var t=e.height,i=e.width;return{width:i,height:t,size:Math.max(i,t)}}});return e(K,{children:n.map((function(t,i){return e(N,xe({},t),i)}))})},Le=function(t){var i=t.width,a=t.height,n=t.legends,r=t.toggleSerie;return e(K,{children:n.map((function(t,n){var o,l=t[0],d=t[1];return e(G,xe({},l,{containerWidth:i,containerHeight:a,data:null!=(o=l.data)?o:d,toggleSerie:l.toggleSerie&&"keys"===l.dataFrom?r:void 0}),n)}))})},Ce=["data"],Me=["color","label"],Be={indexBy:"id",keys:["value"],groupMode:"stacked",layout:"vertical",valueScale:{type:"linear",nice:!0,round:!1},indexScale:{type:"band",round:!1},padding:.1,innerPadding:0,enableGridX:!1,enableGridY:!0,enableLabel:!0,label:"formattedValue",labelPosition:"middle",labelOffset:0,labelSkipWidth:0,labelSkipHeight:0,labelTextColor:{theme:"labels.text.fill"},colorBy:"id",colors:{scheme:"nivo"},borderRadius:0,borderWidth:0,borderColor:{from:"color"},isInteractive:!0,tooltip:function(t){var i=t.color,a=t.label,n=ke(t,Me);return e(p,{id:a,value:n.formattedValue,enableChip:!0,color:i})},tooltipLabel:function(e){return e.id+" - "+e.indexValue},legends:[],initialHiddenIds:[],annotations:[],enableTotals:!1,totalsOffset:10},Te=xe({},Be,{layers:["grid","axes","bars","totals","markers","legends","annotations"],axisTop:null,axisRight:null,axisBottom:{},axisLeft:{},barComponent:function(t){var r,o=t.bar,l=o.data,d=ke(o,Ce),u=t.style,s=u.borderColor,c=u.color,h=u.height,f=u.labelColor,g=u.labelOpacity,v=u.labelX,b=u.labelY,m=u.transform,y=u.width,p=u.textAnchor,C=t.borderRadius,M=t.borderWidth,B=t.label,T=t.shouldRenderLabel,W=t.isInteractive,V=t.onClick,R=t.onMouseEnter,H=t.onMouseLeave,I=t.tooltip,O=t.isFocusable,P=t.ariaLabel,z=t.ariaLabelledBy,E=t.ariaDescribedBy,F=t.ariaDisabled,A=t.ariaHidden,D=x(),j=k(),X=j.showTooltipFromEvent,Y=j.showTooltipAt,N=j.hideTooltip,_=i((function(){return function(){return a(I,xe({},d,l))}}),[I,d,l]),G=n((function(e){null==V||V(xe({color:d.color},l),e)}),[d,l,V]),q=n((function(e){return X(_(),e)}),[X,_]),$=n((function(e){null==R||R(l,e),X(_(),e)}),[l,R,X,_]),K=n((function(e){null==H||H(l,e),N()}),[l,N,H]),J=n((function(){Y(_(),[d.absX+d.width/2,d.absY])}),[Y,_,d]),Z=n((function(){N()}),[N]);return e(S.g,{transform:m,children:[e(S.rect,{width:w(y,(function(e){return Math.max(e,0)})),height:w(h,(function(e){return Math.max(e,0)})),rx:C,ry:C,fill:null!=(r=l.fill)?r:c,strokeWidth:M,stroke:s,focusable:O,tabIndex:O?0:void 0,"aria-label":P?P(l):void 0,"aria-labelledby":z?z(l):void 0,"aria-describedby":E?E(l):void 0,"aria-disabled":F?F(l):void 0,"aria-hidden":A?A(l):void 0,onMouseEnter:W?$:void 0,onMouseMove:W?q:void 0,onMouseLeave:W?K:void 0,onClick:W?G:void 0,onFocus:W&&O?J:void 0,onBlur:W&&O?Z:void 0,"data-testid":"bar.item."+l.id+"."+l.index}),T&&e(L,{x:v,y:b,textAnchor:p,dominantBaseline:"central",fillOpacity:g,style:xe({},D.labels.text,{pointerEvents:"none",fill:f}),children:B})]})},defs:[],fill:[],markers:[],animate:!0,animateOnMount:!1,motionConfig:"default",role:"img",isFocusable:!1}),We=xe({},Be,{layers:["grid","axes","bars","totals","legends","annotations"],axisTop:null,axisRight:null,axisBottom:{},axisLeft:{},renderBar:function(e,t){var i=t.bar,a=i.color,n=i.height,r=i.width,o=i.x,l=i.y,d=t.borderColor,u=t.borderRadius,s=t.borderWidth,c=t.label,h=t.shouldRenderLabel,f=t.labelStyle,g=t.labelX,v=t.labelY,m=t.textAnchor;e.fillStyle=a,s>0&&(e.strokeStyle=d,e.lineWidth=s),e.beginPath(),function(e,t,i,a,n,r){r>0?(e.moveTo(t+r,i),e.lineTo(t+a-r,i),e.quadraticCurveTo(t+a,i,t+a,i+r),e.lineTo(t+a,i+n-r),e.quadraticCurveTo(t+a,i+n,t+a-r,i+n),e.lineTo(t+r,i+n),e.quadraticCurveTo(t,i+n,t,i+n-r),e.lineTo(t,i+r),e.quadraticCurveTo(t,i,t+r,i),e.closePath()):e.rect(t,i,a,n)}(e,o,l,r,n,Math.min(u,n)),e.fill(),s>0&&e.stroke(),h&&(e.textBaseline="middle",e.textAlign="middle"===m?"center":m,b(e,f,c,o+g,l+v))},pixelRatio:"undefined"!=typeof window&&null!=(Se=window.devicePixelRatio)?Se:1}),Ve=function(e,t,i,a,n,r){return f(a,{all:e.map(t),min:0,max:0},n,r).padding(i)},Re=function(e,t){return e.map((function(e){return xe({},t.reduce((function(e,t){return e[t]=null,e}),{}),e)}))},He=function(e){return Object.keys(e).reduce((function(t,i){return e[i]&&(t[i]=e[i]),t}),{})},Ie=function(e){return[e,Number(e)]};function Oe(e,t,i,a){return void 0===e&&(e=Be.layout),void 0===i&&(i=Be.labelPosition),void 0===a&&(a=Be.labelOffset),function(n,r){var o=a*(t?-1:1);if("horizontal"===e){var l=n/2;return"start"===i?l=t?n:0:"end"===i&&(l=t?0:n),{labelX:l+o,labelY:r/2,textAnchor:"middle"===i?"middle":t?"end":"start"}}var d=r/2;return"start"===i?d=t?0:r:"end"===i&&(d=t?r:0),{labelX:n/2,labelY:d-o,textAnchor:"middle"}}}var Pe=["layout","width","height","padding","innerPadding","valueScale","indexScale","hiddenIds"],ze=function(e,t){return e>t},Ee=function(e,t){return e<t},Fe=function(e,t){return Array.from(" ".repeat(t-e),(function(t,i){return e+i}))},Ae=function(e){return ze(e,0)?0:e},De=function(e,t,i,a){var n=e.data,r=e.formatValue,o=e.getColor,l=e.getIndex,d=e.getTooltipLabel,u=e.innerPadding,s=void 0===u?0:u,c=e.keys,h=e.xScale,f=e.yScale,g=e.margin,v=i?Ee:ze,b=n.map(He),m=[];return c.forEach((function(e,i){return Fe(0,h.domain().length).forEach((function(u){var c,y,p,x=Ie(n[u][e]),k=x[0],S=x[1],w=l(n[u]),L=(null!=(c=h(w))?c:0)+t*i+s*i,C=v(y=S,0)?null!=(p=f(y))?p:0:a,M=function(e,t){var i;return v(e,0)?a-t:(null!=(i=f(e))?i:0)-a}(S,C),B={id:e,value:null===k?k:S,formattedValue:r(S),hidden:!1,index:u,indexValue:w,data:b[u]};m.push({key:e+"."+B.indexValue,index:m.length,data:B,x:L,y:C,absX:g.left+L,absY:g.top+C,width:t,height:M,color:o(B),label:d(B)})}))})),m},je=function(e,t,i,a){var n=e.data,r=e.formatValue,o=e.getIndex,l=e.getColor,d=e.getTooltipLabel,u=e.keys,s=e.innerPadding,c=void 0===s?0:s,h=e.xScale,f=e.yScale,g=e.margin,v=i?Ee:ze,b=n.map(He),m=[];return u.forEach((function(e,i){return Fe(0,f.domain().length).forEach((function(u){var s,y,p,x=Ie(n[u][e]),k=x[0],S=x[1],w=o(n[u]),L=v(y=S,0)?a:null!=(p=h(y))?p:0,C=(null!=(s=f(w))?s:0)+t*i+c*i,M=function(e,t){var i;return v(e,0)?(null!=(i=h(e))?i:0)-a:a-t}(S,L),B={id:e,value:null===k?k:S,formattedValue:r(S),hidden:!1,index:u,indexValue:w,data:b[u]};m.push({key:e+"."+B.indexValue,index:m.length,data:B,x:L,y:C,absX:g.left+L,absY:g.top+C,width:M,height:t,color:l(B),label:d(B)})}))})),m},Xe=function(e){var t,i,a,n=e.layout,r=e.width,o=e.height,l=e.padding,d=void 0===l?0:l,u=e.innerPadding,s=void 0===u?0:u,c=e.valueScale,h=e.indexScale,g=e.hiddenIds,v=void 0===g?[]:g,b=ke(e,Pe),m=b.keys.filter((function(e){return!v.includes(e)})),y=Re(b.data,m),p="vertical"===n?["y","x",r]:["x","y",o],x=p[0],k=p[1],S=p[2],w=Ve(y,b.getIndex,d,h,S,k),L="auto"===c.min?Ae:function(e){return e},C=y.reduce((function(e,t){return[].concat(e,m.map((function(e){return t[e]})))}),[]).filter(Boolean),M=L(Math.min.apply(Math,C)),B=(a=Math.max.apply(Math,C),isFinite(a)?a:0),T=f(c,{all:C,min:M,max:B},"x"===x?r:o,x),W="vertical"===n?[w,T]:[T,w],V=W[0],R=W[1],H=(w.bandwidth()-s*(m.length-1))/m.length,I=[xe({},b,{data:y,keys:m,innerPadding:s,xScale:V,yScale:R}),H,null!=(t=c.reverse)&&t,null!=(i=T(0))?i:0];return{xScale:V,yScale:R,bars:H>0?"vertical"===n?De.apply(void 0,I):je.apply(void 0,I):[]}},Ye=["data","layout","width","height","padding","valueScale","indexScale","hiddenIds"],Ne=function(e){var t;return e.some(Array.isArray)?Ne((t=[]).concat.apply(t,e)):e},_e=function(e,t,i){var a=e.formatValue,n=e.getColor,r=e.getIndex,o=e.getTooltipLabel,l=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return u.domain().forEach((function(d,f){var g,v,b=e[f],m=null!=(g=u(r(b.data)))?g:0,y=(null!=(v=function(e){return s(e[i?0:1])}(b))?v:0)+.5*l,p=function(e,t){var a;return(null!=(a=s(e[i?1:0]))?a:0)-t}(b,y)-l,x=Ie(b.data[e.key]),k=x[0],S=x[1],w={id:e.key,value:null===k?k:S,formattedValue:a(S),hidden:!1,index:f,indexValue:d,data:He(b.data)};h.push({key:e.key+"."+d,index:h.length,data:w,x:m,y:y,absX:c.left+m,absY:c.top+y,width:t,height:p,color:n(w),label:o(w)})}))})),h},Ge=function(e,t,i){var a=e.formatValue,n=e.getColor,r=e.getIndex,o=e.getTooltipLabel,l=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return s.domain().forEach((function(d,f){var g,v,b=e[f],m=null!=(g=s(r(b.data)))?g:0,y=(null!=(v=function(e){return u(e[i?1:0])}(b))?v:0)+.5*l,p=function(e,t){var a;return(null!=(a=u(e[i?0:1]))?a:0)-t}(b,y)-l,x=Ie(b.data[e.key]),k=x[0],S=x[1],w={id:e.key,value:null===k?k:S,formattedValue:a(S),hidden:!1,index:f,indexValue:d,data:He(b.data)};h.push({key:e.key+"."+d,index:h.length,data:w,x:y,y:m,absX:c.left+y,absY:c.top+m,width:p,height:t,color:n(w),label:o(w)})}))})),h},qe=function(e){var t,i,a=e.data,n=e.layout,r=e.width,o=e.height,l=e.padding,d=void 0===l?0:l,u=e.valueScale,s=e.indexScale,c=e.hiddenIds,h=void 0===c?[]:c,g=ke(e,Ye),v=g.keys.filter((function(e){return!h.includes(e)})),b=function(){var e=q([]),t=be,i=ve,a=me;function n(n){var r,o,l=Array.from(e.apply(this,arguments),ye),d=l.length,u=-1;for(const e of n)for(r=0,++u;r<d;++r)(l[r][u]=[0,+a(e,l[r].key,u,n)]).data=e;for(r=0,o=$(t(l));r<d;++r)l[o[r]].index=r;return i(l,o),l}return n.keys=function(t){return arguments.length?(e="function"==typeof t?t:q(Array.from(t)),n):e},n.value=function(e){return arguments.length?(a="function"==typeof e?e:q(+e),n):a},n.order=function(e){return arguments.length?(t=null==e?be:"function"==typeof e?e:q(Array.from(e)),n):t},n.offset=function(e){return arguments.length?(i=null==e?ve:e,n):i},n}().keys(v).offset(pe)(Re(a,v)),m="vertical"===n?["y","x",r]:["x","y",o],y=m[0],p=m[1],x=m[2],k=Ve(a,g.getIndex,d,s,x,p),S=(i=Ne(b),"log"===u.type?i.filter((function(e){return 0!==e})):i),w=Math.min.apply(Math,S),L=Math.max.apply(Math,S),C=f(u,{all:S,min:w,max:L},"x"===y?r:o,y),M="vertical"===n?[k,C]:[C,k],B=M[0],T=M[1],W=g.innerPadding>0?g.innerPadding:0,V=k.bandwidth(),R=[xe({},g,{innerPadding:W,stackedData:b,xScale:B,yScale:T}),V,null!=(t=u.reverse)&&t];return{xScale:B,yScale:T,bars:V>0?"vertical"===n?_e.apply(void 0,R):Ge.apply(void 0,R):[]}},$e=function(e){var t=e.bars,i=e.direction,a=e.from,n=e.groupMode,r=e.layout,o=e.legendLabel,l=e.reverse,d=A(null!=o?o:"indexes"===a?"indexValue":"id");return"indexes"===a?function(e,t,i){var a=g(e.map((function(e){var t,a;return{id:null!=(t=e.data.indexValue)?t:"",label:i(e.data),hidden:e.data.hidden,color:null!=(a=e.color)?a:"#000"}})),(function(e){return e.id}));return"horizontal"===t&&a.reverse(),a}(t,r,d):function(e,t,i,a,n,r){var o=g(e.map((function(e){var t;return{id:e.data.id,label:r(e.data),hidden:e.data.hidden,color:null!=(t=e.color)?t:"#000"}})),(function(e){return e.id}));return("vertical"===t&&"stacked"===a&&"column"===i&&!0!==n||"horizontal"===t&&"stacked"===a&&!0===n)&&o.reverse(),o}(t,r,i,n,l,d)},Ke=function(e,t,i){var a=e.get(t)||0;e.set(t,a+i)},Je=function(e){var t,a=e.indexBy,r=void 0===a?Be.indexBy:a,o=e.keys,l=void 0===o?Be.keys:o,u=e.label,s=void 0===u?Be.label:u,c=e.tooltipLabel,h=void 0===c?Be.tooltipLabel:c,f=e.valueFormat,g=e.colors,v=void 0===g?Be.colors:g,b=e.colorBy,m=void 0===b?Be.colorBy:b,y=e.borderColor,p=void 0===y?Be.borderColor:y,k=e.labelTextColor,S=void 0===k?Be.labelTextColor:k,w=e.groupMode,L=void 0===w?Be.groupMode:w,C=e.layout,M=void 0===C?Be.layout:C,B=e.data,T=e.margin,W=e.width,V=e.height,H=e.padding,I=void 0===H?Be.padding:H,O=e.innerPadding,F=void 0===O?Be.innerPadding:O,A=e.valueScale,D=void 0===A?Be.valueScale:A,j=e.indexScale,X=void 0===j?Be.indexScale:j,Y=e.initialHiddenIds,N=void 0===Y?Be.initialHiddenIds:Y,_=e.enableLabel,G=void 0===_?Be.enableLabel:_,q=e.labelSkipWidth,$=void 0===q?Be.labelSkipWidth:q,K=e.labelSkipHeight,J=void 0===K?Be.labelSkipHeight:K,Z=e.legends,U=void 0===Z?Be.legends:Z,Q=e.legendLabel,ee=e.totalsOffset,te=void 0===ee?Be.totalsOffset:ee,ie=d(null!=N?N:[]),ae=ie[0],ne=ie[1],re=n((function(e){ne((function(t){return t.indexOf(e)>-1?t.filter((function(t){return t!==e})):[].concat(t,[e])}))}),[]),oe=P(r),le=P(s),de=P(h),ue=R(f),se=x(),ce=z(v,m),he=E(p,se),fe=E(S,se),ge=("grouped"===L?Xe:qe)({layout:M,data:B,getIndex:oe,keys:l,width:W,height:V,getColor:ce,padding:I,innerPadding:F,valueScale:D,indexScale:X,hiddenIds:ae,formatValue:ue,getTooltipLabel:de,margin:T}),ve=ge.bars,be=ge.xScale,me=ge.yScale,ye=i((function(){return ve.filter((function(e){return null!==e.data.value})).map((function(e,t){return xe({},e,{index:t})}))}),[ve]),pe=n((function(e){var t=e.width,i=e.height;return!(!G||$>0&&t<$||J>0&&i<J)}),[G,$,J]),ke=i((function(){return l.map((function(e){var t=ve.find((function(t){return t.data.id===e}));return xe({},t,{data:xe({id:e},null==t?void 0:t.data,{hidden:ae.includes(e)})})}))}),[ae,l,ve]),Se=null!=(t=D.reverse)&&t,we=i((function(){return U.map((function(e){return[e,$e({bars:"keys"===e.dataFrom?ke:ve,direction:e.direction,from:e.dataFrom,groupMode:L,layout:M,legendLabel:Q,reverse:Se})]}))}),[U,ke,ve,L,M,Q,Se]),Le=i((function(){return function(e,t,i,a,n,r,o){void 0===a&&(a=Be.layout),void 0===n&&(n=Be.groupMode);var l=[];if(0===e.length)return l;var d=new Map,u=e[0].width,s=e[0].height;if("stacked"===n){var c=new Map;e.forEach((function(e){var t=e.data,i=t.indexValue,a=t.value;Ke(d,i,Number(a)),function(e,t,i){var a=e.get(t)||0;e.set(t,a+(i>0?i:0))}(c,i,Number(a))})),c.forEach((function(e,n){var c,h,f,g=d.get(n)||0;"vertical"===a?(c=t(n),h=i(e),f=i(e/2)):(c=t(e),h=i(n),f=t(e/2)),c+="vertical"===a?u/2:r,h+="vertical"===a?-r:s/2,l.push({key:"total_"+n,x:c,y:h,value:g,formattedValue:o(g),animationOffset:f})}))}else if("grouped"===n){var h=new Map,f=new Map;e.forEach((function(e){var t=e.data,i=t.indexValue,a=t.value;Ke(d,i,Number(a)),function(e,t,i){var a=e.get(t)||0;e.set(t,Math.max(a,Number(i)))}(h,i,Number(a)),function(e,t){var i=e.get(t)||0;e.set(t,i+1)}(f,i)})),h.forEach((function(e,n){var c,h,g,v=d.get(n)||0,b=f.get(n);"vertical"===a?(c=t(n),h=i(e),g=i(e/2)):(c=t(e),h=i(n),g=t(e/2)),c+="vertical"===a?b*u/2:r,h+="vertical"===a?-r:b*s/2,l.push({key:"total_"+n,x:c,y:h,value:v,formattedValue:o(v),animationOffset:g})}))}return l}(ve,be,me,M,L,te,ue)}),[ve,be,me,M,L,te,ue]);return{bars:ve,barsWithValue:ye,xScale:be,yScale:me,getIndex:oe,getLabel:le,getTooltipLabel:de,formatValue:ue,getColor:ce,getBorderColor:he,getLabelColor:fe,shouldRenderBarLabel:pe,hiddenIds:ae,toggleSerie:re,legendsWithData:we,barTotals:Le}},Ze=function(t){var i=t.data,a=t.springConfig,n=t.animate,r=t.layout,o=void 0===r?Te.layout:r,l=x();return B(i,{keys:function(e){return e.key},from:function(e){return{x:"vertical"===o?e.x:e.animationOffset,y:"vertical"===o?e.animationOffset:e.y,labelOpacity:0}},enter:function(e){return{x:e.x,y:e.y,labelOpacity:1}},update:function(e){return{x:e.x,y:e.y,labelOpacity:1}},leave:function(e){return{x:"vertical"===o?e.x:e.animationOffset,y:"vertical"===o?e.animationOffset:e.y,labelOpacity:0}},config:a,immediate:!n,initial:n?void 0:null})((function(t,i){return e(S.text,{x:t.x,y:t.y,fillOpacity:t.labelOpacity,style:xe({},l.labels.text,{pointerEvents:"none"}),fontWeight:"bold",fontSize:l.labels.text.fontSize,fontFamily:l.labels.text.fontFamily,textAnchor:"vertical"===o?"middle":"start",alignmentBaseline:"vertical"===o?"alphabetic":"middle",children:i.formattedValue},i.key)}))},Ue=["isInteractive","animate","motionConfig","theme","renderWrapper"],Qe=function(t){var n,o=t.data,l=t.indexBy,d=t.keys,c=t.margin,h=t.width,f=t.height,g=t.groupMode,v=t.layout,b=t.valueScale,m=t.indexScale,y=t.padding,p=t.innerPadding,x=t.axisTop,k=t.axisRight,S=t.axisBottom,w=void 0===S?Te.axisBottom:S,L=t.axisLeft,R=void 0===L?Te.axisLeft:L,H=t.enableGridX,I=void 0===H?Te.enableGridX:H,O=t.enableGridY,P=void 0===O?Te.enableGridY:O,z=t.gridXValues,E=t.gridYValues,F=t.layers,A=void 0===F?Te.layers:F,D=t.barComponent,j=void 0===D?Te.barComponent:D,X=t.enableLabel,Y=void 0===X?Te.enableLabel:X,N=t.label,_=t.labelSkipWidth,G=void 0===_?Te.labelSkipWidth:_,q=t.labelSkipHeight,$=void 0===q?Te.labelSkipHeight:q,K=t.labelTextColor,J=t.labelPosition,Z=void 0===J?Te.labelPosition:J,U=t.labelOffset,Q=void 0===U?Te.labelOffset:U,ee=t.markers,te=void 0===ee?Te.markers:ee,ie=t.colorBy,ae=t.colors,ne=t.defs,re=void 0===ne?Te.defs:ne,oe=t.fill,le=void 0===oe?Te.fill:oe,de=t.borderRadius,ue=void 0===de?Te.borderRadius:de,se=t.borderWidth,ce=void 0===se?Te.borderWidth:se,he=t.borderColor,fe=t.annotations,ge=void 0===fe?Te.annotations:fe,ve=t.legendLabel,be=t.tooltipLabel,me=t.valueFormat,ye=t.isInteractive,pe=void 0===ye?Te.isInteractive:ye,ke=t.tooltip,Se=void 0===ke?Te.tooltip:ke,Ce=t.onClick,Me=t.onMouseEnter,Be=t.onMouseLeave,We=t.legends,Ve=t.role,Re=void 0===Ve?Te.role:Ve,He=t.ariaLabel,Ie=t.ariaLabelledBy,Pe=t.ariaDescribedBy,ze=t.isFocusable,Ee=void 0===ze?Te.isFocusable:ze,Fe=t.barAriaLabel,Ae=t.barAriaLabelledBy,De=t.barAriaDescribedBy,je=t.barAriaHidden,Xe=t.barAriaDisabled,Ye=t.initialHiddenIds,Ne=t.enableTotals,_e=void 0===Ne?Te.enableTotals:Ne,Ge=t.totalsOffset,qe=void 0===Ge?Te.totalsOffset:Ge,$e=t.forwardedRef,Ke=C(),Ue=Ke.animate,Qe=Ke.config,et=M(h,f,c),tt=et.outerWidth,it=et.outerHeight,at=et.margin,nt=et.innerWidth,rt=et.innerHeight,ot=Je({indexBy:l,label:N,tooltipLabel:be,valueFormat:me,colors:ae,colorBy:ie,borderColor:he,labelTextColor:K,groupMode:g,layout:v,data:o,keys:d,margin:at,width:nt,height:rt,padding:y,innerPadding:p,valueScale:b,indexScale:m,enableLabel:Y,labelSkipWidth:G,labelSkipHeight:$,legends:We,legendLabel:ve,initialHiddenIds:Ye,totalsOffset:qe}),lt=ot.bars,dt=ot.barsWithValue,ut=ot.xScale,st=ot.yScale,ct=ot.getLabel,ht=ot.getTooltipLabel,ft=ot.getBorderColor,gt=ot.getLabelColor,vt=ot.shouldRenderBarLabel,bt=ot.toggleSerie,mt=ot.legendsWithData,yt=ot.barTotals,pt=ot.getColor,xt=Oe(v,null!=(n=null==b?void 0:b.reverse)&&n,Z,Q),kt=B(dt,{keys:function(e){return e.key},from:function(e){return xe({borderColor:ft(e),color:e.color,height:0,labelColor:gt(e),labelOpacity:0},xt(e.width,e.height),{transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===v?{}:{height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},enter:function(e){return xe({borderColor:ft(e),color:e.color,height:e.height,labelColor:gt(e),labelOpacity:1},xt(e.width,e.height),{transform:"translate("+e.x+", "+e.y+")",width:e.width})},update:function(e){return xe({borderColor:ft(e),color:e.color,height:e.height,labelColor:gt(e),labelOpacity:1},xt(e.width,e.height),{transform:"translate("+e.x+", "+e.y+")",width:e.width})},leave:function(e){return xe({borderColor:ft(e),color:e.color,height:0,labelColor:gt(e),labelOpacity:0},xt(e.width,e.height),{labelY:0,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===v?{}:xe({},xt(e.width,e.height),{labelX:0,height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0}))},config:Qe,immediate:!Ue,initial:Ue?void 0:null}),St=i((function(){return{borderRadius:ue,borderWidth:ce,enableLabel:Y,isInteractive:pe,labelSkipWidth:G,labelSkipHeight:$,onClick:Ce,onMouseEnter:Me,onMouseLeave:Be,getTooltipLabel:ht,tooltip:Se,isFocusable:Ee,ariaLabel:Fe,ariaLabelledBy:Ae,ariaDescribedBy:De,ariaHidden:je,ariaDisabled:Xe}}),[ue,ce,Y,ht,pe,$,G,Ce,Me,Be,Se,Ee,Fe,Ae,De,je,Xe]),wt=T(re,lt,le,{dataKey:"data",targetKey:"data.fill"}),Lt={annotations:null,axes:null,bars:null,grid:null,legends:null,markers:null,totals:null};A.includes("annotations")&&(Lt.annotations=e(we,{bars:lt,annotations:ge},"annotations")),A.includes("axes")&&(Lt.axes=e(u,{xScale:ut,yScale:st,width:nt,height:rt,top:x,right:k,bottom:w,left:R},"axes")),A.includes("bars")&&(Lt.bars=e(r,{children:kt((function(e,t){return a(j,xe({},St,{bar:t,style:e,shouldRenderLabel:vt(t),label:ct(t.data)}))}))},"bars")),A.includes("grid")&&(Lt.grid=e(s,{width:nt,height:rt,xScale:I?ut:null,yScale:P?st:null,xValues:z,yValues:E},"grid")),A.includes("legends")&&(Lt.legends=e(Le,{width:nt,height:rt,legends:mt,toggleSerie:bt},"legends")),A.includes("markers")&&(Lt.markers=e(W,{markers:te,width:nt,height:rt,xScale:ut,yScale:st},"markers")),A.includes("totals")&&_e&&(Lt.totals=e(Ze,{data:yt,springConfig:Qe,animate:Ue,layout:v},"totals"));var Ct=xe({},St,{margin:at,width:h,height:f,innerWidth:nt,innerHeight:rt,bars:lt,legendData:mt,enableLabel:Y,xScale:ut,yScale:st,tooltip:Se,getTooltipLabel:ht,onClick:Ce,onMouseEnter:Me,onMouseLeave:Be,getColor:pt});return e(V,{width:tt,height:it,margin:at,defs:wt,role:Re,ariaLabel:He,ariaLabelledBy:Ie,ariaDescribedBy:Pe,isFocusable:Ee,ref:$e,children:A.map((function(t,i){var n;return"function"==typeof t?e(r,{children:a(t,Ct)},i):null!=(n=null==Lt?void 0:Lt[t])?n:null}))})},et=t((function(t,i){var a=t.isInteractive,n=void 0===a?Te.isInteractive:a,r=t.animate,o=void 0===r?Te.animate:r,l=t.motionConfig,d=void 0===l?Te.motionConfig:l,u=t.theme,s=t.renderWrapper,c=ke(t,Ue);return e(m,{animate:o,isInteractive:n,motionConfig:d,renderWrapper:s,theme:u,children:e(Qe,xe({},c,{isInteractive:n,forwardedRef:i}))})})),tt=["isInteractive","renderWrapper","theme"],it=function(e,t,i,a){return e.find((function(e){return F(e.x+t.left,e.y+t.top,e.width,e.height,i,a)}))},at=function(t){var r,d=t.data,u=t.indexBy,s=t.keys,f=t.margin,g=t.width,v=t.height,m=t.groupMode,y=t.layout,p=t.valueScale,S=t.indexScale,w=t.padding,L=t.innerPadding,C=t.axisTop,B=t.axisRight,T=t.axisBottom,W=void 0===T?We.axisBottom:T,V=t.axisLeft,P=void 0===V?We.axisLeft:V,z=t.enableGridX,E=void 0===z?We.enableGridX:z,F=t.enableGridY,A=void 0===F?We.enableGridY:F,D=t.gridXValues,N=t.gridYValues,G=t.labelPosition,q=void 0===G?We.labelPosition:G,$=t.labelOffset,K=void 0===$?We.labelOffset:$,J=t.layers,Z=void 0===J?We.layers:J,U=t.renderBar,Q=void 0===U?We.renderBar:U,ee=t.enableLabel,te=void 0===ee?We.enableLabel:ee,ie=t.label,ae=t.labelSkipWidth,ne=void 0===ae?We.labelSkipWidth:ae,re=t.labelSkipHeight,oe=void 0===re?We.labelSkipHeight:re,le=t.labelTextColor,de=t.colorBy,ue=t.colors,se=t.borderRadius,ce=void 0===se?We.borderRadius:se,he=t.borderWidth,fe=void 0===he?We.borderWidth:he,ge=t.borderColor,ve=t.annotations,be=void 0===ve?We.annotations:ve,me=t.legendLabel,ye=t.tooltipLabel,pe=t.valueFormat,ke=t.isInteractive,Se=void 0===ke?We.isInteractive:ke,we=t.tooltip,Le=void 0===we?We.tooltip:we,Ce=t.onClick,Me=t.onMouseEnter,Be=t.onMouseLeave,Te=t.legends,Ve=t.pixelRatio,Re=void 0===Ve?We.pixelRatio:Ve,He=t.role,Ie=t.forwardedRef,Pe=t.enableTotals,ze=void 0===Pe?We.enableTotals:Pe,Ee=t.totalsOffset,Fe=void 0===Ee?We.totalsOffset:Ee,Ae=o(null),De=x(),je=M(g,v,f),Xe=je.margin,Ye=je.innerWidth,Ne=je.innerHeight,_e=je.outerWidth,Ge=je.outerHeight,qe=Je({indexBy:u,label:ie,tooltipLabel:ye,valueFormat:pe,colors:ue,colorBy:de,borderColor:ge,labelTextColor:le,groupMode:m,layout:y,data:d,keys:s,margin:Xe,width:Ye,height:Ne,padding:w,innerPadding:L,valueScale:p,indexScale:S,enableLabel:te,labelSkipWidth:ne,labelSkipHeight:oe,legends:Te,legendLabel:me,totalsOffset:Fe}),$e=qe.bars,Ke=qe.barsWithValue,Ze=qe.xScale,Ue=qe.yScale,Qe=qe.getLabel,et=qe.getTooltipLabel,tt=qe.getBorderColor,at=qe.getLabelColor,nt=qe.shouldRenderBarLabel,rt=qe.legendsWithData,ot=qe.barTotals,lt=qe.getColor,dt=k(),ut=dt.showTooltipFromEvent,st=dt.hideTooltip,ct=j({annotations:X({data:$e,annotations:be,getPosition:function(e){return{x:e.x,y:e.y}},getDimensions:function(e){var t=e.width,i=e.height;return{width:t,height:i,size:Math.max(t,i)}}})}),ht=i((function(){return{borderRadius:ce,borderWidth:fe,isInteractive:Se,isFocusable:!1,labelSkipWidth:ne,labelSkipHeight:oe,margin:Xe,width:g,height:v,innerWidth:Ye,innerHeight:Ne,bars:$e,legendData:rt,enableLabel:te,xScale:Ze,yScale:Ue,tooltip:Le,getTooltipLabel:et,onClick:Ce,onMouseEnter:Me,onMouseLeave:Be,getColor:lt}}),[ce,fe,Se,ne,oe,Xe,g,v,Ye,Ne,$e,rt,te,Ze,Ue,Le,et,Ce,Me,Be,lt]),ft=R(pe),gt=Oe(y,null!=(r=null==p?void 0:p.reverse)&&r,q,K);l((function(){if(Ae.current){Ae.current.width=_e*Re,Ae.current.height=Ge*Re;var e=Ae.current.getContext("2d");e.scale(Re,Re),e.fillStyle=De.background,e.fillRect(0,0,_e,Ge),e.translate(Xe.left,Xe.top),Z.forEach((function(t){"grid"===t?"number"==typeof De.grid.line.strokeWidth&&De.grid.line.strokeWidth>0&&(e.lineWidth=De.grid.line.strokeWidth,e.strokeStyle=De.grid.line.stroke,E&&c(e,{width:Ye,height:Ne,scale:Ze,axis:"x",values:D}),A&&c(e,{width:Ye,height:Ne,scale:Ue,axis:"y",values:N})):"axes"===t?h(e,{xScale:Ze,yScale:Ue,width:Ye,height:Ne,top:C,right:B,bottom:W,left:P,theme:De}):"bars"===t?(H(e,De.text),Ke.forEach((function(t){Q(e,xe({bar:t,borderColor:tt(t),borderRadius:ce,borderWidth:fe,label:Qe(t.data),shouldRenderLabel:nt(t),labelStyle:xe({},De.labels.text,{fill:at(t)})},gt(t.width,t.height)))}))):"legends"===t?rt.forEach((function(t){var i=t[0],a=t[1];_(e,xe({},i,{data:a,containerWidth:Ye,containerHeight:Ne,theme:De}))})):"annotations"===t?Y(e,{annotations:ct,theme:De}):"totals"===t&&ze?function(e,t,i,a){void 0===a&&(a=We.layout),H(e,i.labels.text),e.textBaseline="vertical"===a?"alphabetic":"middle",e.textAlign="vertical"===a?"center":"start",t.forEach((function(t){b(e,i.labels.text,t.formattedValue,t.x,t.y)}))}(e,ot,De,y):"function"==typeof t&&t(e,ht)})),e.save()}}),[W,P,B,C,Ke,ce,fe,ct,E,A,tt,Qe,at,D,N,m,v,Ne,Ye,ht,Z,y,rt,Xe.left,Xe.top,Ge,_e,Re,Q,Ze,Ue,nt,De,g,ot,ze,ft,gt]);var vt=n((function(e){if($e&&Ae.current){var t=I(Ae.current,e),i=t[0],n=t[1],r=it($e,Xe,i,n);void 0!==r?(ut(a(Le,xe({},r.data,{color:r.color,label:r.label,value:Number(r.data.value)})),e),"mouseenter"===e.type&&(null==Me||Me(r.data,e))):st()}}),[st,Xe,Me,$e,ut,Le]),bt=n((function(e){if($e&&Ae.current){st();var t=I(Ae.current,e),i=t[0],a=t[1],n=it($e,Xe,i,a);n&&(null==Be||Be(n.data,e))}}),[st,Xe,Be,$e]),mt=n((function(e){if($e&&Ae.current){var t=I(Ae.current,e),i=t[0],a=t[1],n=it($e,Xe,i,a);void 0!==n&&(null==Ce||Ce(xe({},n.data,{color:n.color}),e))}}),[Xe,Ce,$e]);return e("canvas",{ref:O(Ae,Ie),width:_e*Re,height:Ge*Re,style:{width:_e,height:Ge,cursor:Se?"auto":"normal"},onMouseEnter:Se?vt:void 0,onMouseMove:Se?vt:void 0,onMouseLeave:Se?bt:void 0,onClick:Se?mt:void 0,role:He})},nt=t((function(t,i){var a=t.isInteractive,n=t.renderWrapper,r=t.theme,o=ke(t,tt);return e(m,{isInteractive:a,renderWrapper:n,theme:r,animate:!1,children:e(at,xe({},o,{isInteractive:a,forwardedRef:i}))})})),rt=["defaultWidth","defaultHeight","onResize","debounceResize"],ot=t((function(t,i){var a=t.defaultWidth,n=t.defaultHeight,r=t.onResize,o=t.debounceResize,l=ke(t,rt);return e(y,{defaultWidth:a,defaultHeight:n,onResize:r,debounceResize:o,children:function(t){var a=t.width,n=t.height;return e(et,xe({},l,{width:a,height:n,ref:i}))}})})),lt=["defaultWidth","defaultHeight","onResize","debounceResize"];t((function(t,i){var a=t.defaultWidth,n=t.defaultHeight,r=t.onResize,o=t.debounceResize,l=ke(t,lt);return e(y,{defaultWidth:a,defaultHeight:n,onResize:r,debounceResize:o,children:function(t){var a=t.width,n=t.height;return e(nt,xe({},l,{width:a,height:n,ref:i}))}})}));var dt="styles_legends__LAO35";const ut=t=>{const{data:i,onLegendClick:a}=t;return e("div",{className:dt,children:i.map((t=>e(oe,{legend:t,onClick:a},t.id)))})},st=({value:t,indexBy:i,legend:a,formatIndexBy:n=(e,t)=>e[t]?.toString()??"",formatLegendValue:r=e=>(e.value??0).toString()??"",allowZeroValues:o=!1})=>{const l=o?a:a.filter((e=>le(t[e.id])&&0!==Number(t[e.id])));return e(de,{label:n(t,i),children:l.map((i=>e(oe,{mode:"menu",legend:{...i,value:r({...i,value:t[i.id]})}},i.id)))})},ct=t=>{const{background:i,grid:a}=x();return e("g",{children:[e("line",{opacity:"1",x1:"0",x2:t.innerWidth,y1:t.innerHeight,y2:t.innerHeight,stroke:i,strokeWidth:"1"}),e("line",{opacity:"1",x1:"0",x2:t.innerWidth,y1:t.innerHeight,y2:t.innerHeight,stroke:a.line.stroke,strokeWidth:"1"})]})},ht=J(null),ft=t=>{const{children:i}=t,[a,n]=U(void 0);return e(ht.Provider,{value:[a,n],children:i})};var gt=/*@__PURE__*/se(ce());const vt={s:16,m:24,l:32},bt=(e,t)=>Math.min(e,vt[t]),mt=t=>{const{isInteractive:i,isFocusable:a,innerHeight:n,innerWidth:r,tooltip:o,indexBy:l,layout:d="vertical",onBarClick:u,bars:s,hasValueFn:c=e=>Object.entries(e).filter((([e])=>e!==t.indexBy)).reduce(((e,[,t])=>e+gt(t??0)),0)>0}=t,h="horizontal"===d,{handleShowTooltip:f,isVisible:g,handleHideTooltip:v,tooltipRef:b,data:m}=fe(h?"bottom":"left"),{animate:y,config:p}=C(),{opacity:x}=D({opacity:g?1:0,config:{...p,duration:75},immediate:!y});if(!i)return null;const k=Math.max(...s.map((e=>e.data.index+1))),w=s.slice(0,k);if(w.length<=0)return null;const[L,M]=w;if(!L)return null;const B=M?.x?M.x-L.x:L.width,T=B-L.width,W=M?.y?L.y-M.y:L.height,V=W-L.height;return e(S.g,{"data-testid":"hover-layer",children:[w.map(((t,o)=>{const d=t.x-T/2,s=t.y-V/2;return c(t.data.data)?e(yt,{x:h?0:d,y:h?s:0,width:h?r:B,height:h?W:n,value:t.data.data,indexBy:l,isInteractive:i,isFocusable:a,onTooltipShow:f,onTooltipHide:v,onClick:u},o):null})),he(e(S.div,{ref:b,style:{display:x?"block":"none",opacity:x},children:g&&m&&Z(o,{value:m})}),document.body)]})},yt=({x:t,y:i,width:a,height:n,value:r,isInteractive:o=!0,isFocusable:l=!0,indexBy:d,onTooltipShow:u,onTooltipHide:s,onClick:c})=>{const[h,f]=(()=>{const e=Q(ht);if(!e)throw new Error("useBarChartState must be used within a BarChartStateProvider");return e})(),{animate:g,config:v}=C(),b=r[d],m=h===String(b),{fill:y}=D({from:{fill:"#ffffff00"},to:{fill:"var(--color-control-bg-ghost-hover)"},config:{...v,duration:150},reverse:!m,immediate:!g}),p=ie((e=>{u(e.target,r)}),[u,r]),x=ie((e=>{u(e.target,r),f(String(b))}),[u,r,f,b]),k=ie((e=>{s(e.target),f(void 0)}),[s,f]),w=ie((e=>{u(e.target,r),f(String(b))}),[u,r,f,b]),L=ie((e=>{s(e.target),f(void 0)}),[s,f]),M=ie((()=>{c?.({data:r})}),[c,r]);return e(S.rect,{x:t,y:i,"data-testid":"hover-rect",width:a,height:n,fill:y,style:c?{cursor:"pointer"}:void 0,onMouseMove:o?p:void 0,onMouseEnter:o?x:void 0,onMouseLeave:o?k:void 0,onClick:o&&c?M:void 0,onFocus:o&&l?w:void 0,onBlur:o&&l?L:void 0})},pt=J(null),xt=()=>{const e=Q(pt);if(!e)throw new Error("useBarContext must be used within a BarContext");return e},kt=t=>{const{bars:i,indexBy:a,layout:n="vertical",barSize:r,groupMode:o="stacked"}=t,l=ee((()=>(e=>{const{bars:t,indexBy:i,layout:a,groupMode:n}=e,r=new Map;for(const e of t){const t=e.data.data[i];r.has(t)||r.set(t,{id:t,bars:[],x:1/0,y:1/0,width:0,height:0});const o=r.get(t);o.bars.push(e),o.x=Math.min(o.x,e.x),o.y=Math.min(o.y,e.y);let l=o.width+e.width,d=o.height+e.height;"vertical"===a&&(l=Math.max(o.width,e.width),"grouped"===n&&(d=Math.max(o.height,e.height))),"horizontal"===a&&(d=Math.max(o.height,e.height),"grouped"===n&&(l=Math.max(o.width,e.width))),o.width=l,o.height=d}return Array.from(r.values())})({bars:i,indexBy:a,layout:n,groupMode:o})),[i,a,n,o]),d=Math.min(...l.map((e=>e.y))),u=Math.min(...l.map((e=>e.x)));return e(pt.Provider,{value:{barSize:r,layout:n,groupMode:o},children:e(S.g,{"data-testid":"bars",pointerEvents:"none",children:l.map((t=>e(St,{group:t,offsetY:d,offsetX:u},t.id)))})})},St=t=>{const{group:i}=t,{barSize:a,layout:n}=xt(),{animate:r,config:o}=C(),l=te(),d="horizontal"===n,u=bt(i.height,a),s=bt(i.width,a),c=i.width-s,h=i.height-u,f=d?i.x:i.x+c/2,g=d?i.y+h/2:i.y,v=d?i.width:s,b=d?u:i.height,m=(y=d?u:s)<=4?0:y<=vt.s/3?1:y<=vt.s/2?1.5:y<vt.s?2:y>=vt.s&&y<vt.m?4:y>=vt.m?6:0;var y;const{transform:p}=D({transform:`translate(${f}, ${g})`,config:o,immediate:!r}),x=ee((()=>{const e=i.bars.filter((e=>e.width>0&&e.height>0));return"horizontal"===n?e.sort(((e,t)=>e.x-t.x)):e.sort(((e,t)=>e.y-t.y))}),[i.bars,n]),k="horizontal"===n?v<2*m:b<2*m;return e(S.g,{clipPath:k?void 0:`url(#clip-${l})`,transform:p,"data-testid":"group","data-id":i.id,children:[!k&&e("defs",{children:e("clipPath",{id:`clip-${l}`,children:e(S.rect,{x:0,y:0,width:v,height:b,rx:m,ry:m})})}),x.map(((t,i)=>e(wt,{id:t.data.id,x:d?t.x-f:0,y:d?0:t.y-g,width:d?t.width:v,height:d?b:t.height,fill:t.color,isFirst:0===i,isLast:i===x.length-1},t.data.id)))]})},wt=t=>{const{isFirst:i,isLast:a,id:n,...r}=t,{layout:o}=xt(),{animate:l,config:d}=C(),u="horizontal"===o?r.width:r.height,s=!i&&u>2,c=!a&&u>2;let h=r.width,f=r.height,g=r.x,v=r.y;"horizontal"===o&&(s&&c&&(g+=.5,h-=.5),c&&(h-=.5)),"vertical"===o&&(s&&(v+=.5,f-=.5),c&&(f-=.5));const b=D({x:g,y:v,width:h,height:f,config:d,immediate:!l});return e(S.rect,{...b,fill:r.fill,"data-testid":"bar","data-id":n})};function Lt(e,t,i,a){let n=0;for(let r=0,o=(e=function(e){return Array.isArray(e)?e:Array.from(e)}(e)).length;r<o;r++){const o=e[r],l=t(o,r,e),d=i(o,r,e);null!=l&&isFinite(l)&&null!=d&&isFinite(d)&&a(+l,+d,n++)}}const Ct=function(){let e,t=e=>e[0],i=e=>e[1];function a(a){let n=0,r=0,o=0,l=0,d=0,u=e?+e[0]:1/0,s=e?+e[1]:-1/0;Lt(a,t,i,((t,i)=>{++n,r+=(t-r)/n,o+=(i-o)/n,l+=(t*i-l)/n,d+=(t*t-d)/n,e||(t<u&&(u=t),t>s&&(s=t))}));const[c,h]=function(e,t,i,a){const n=a-e*e,r=Math.abs(n)<1e-24?0:(i-e*t)/n;return[t-r*e,r]}(r,o,l,d),f=e=>h*e+c,g=[[u,f(u)],[s,f(s)]];return g.a=h,g.b=c,g.predict=f,g.rSquared=function(e,t,i,a,n){let r=0,o=0;return Lt(e,t,i,((e,t)=>{const i=t-n(e),l=t-a;r+=i*i,o+=l*l})),1-r/o}(a,t,i,o,f),g}return a.domain=function(t){return arguments.length?(e=t,a):e},a.x=function(e){return arguments.length?(t=e,a):t},a.y=function(e){return arguments.length?(i=e,a):i},a}().x((e=>e.x)).y((e=>e.y)),Mt=ge().x((e=>e[0])).y((e=>e[1])),Bt=t=>{const{legend:i,indexBy:a,bars:n,innerHeight:r,innerWidth:o,formatValue:l=e=>gt(e)}=t,d=ee((()=>i.filter((e=>"point"===e.type)).map((e=>e.id))),[i]),u=te(),s=ee((()=>i.filter((e=>"point"===e.type)).reduce(((e,t)=>(e[t.id]=t.color,e)),{})),[i]),c=ee((()=>(e=>{const t=Math.max(...e.map((e=>e.data.index+1)));return e.slice(0,t)})(n)),[n]),h=ee((()=>v(d.map((e=>({id:e,data:c.map((t=>{const i=l(gt(t.data.data[e]??0),e);return void 0===i?null:{x:gt(t.data.data[a]??0),y:i}})).filter((e=>null!==e))}))),{type:"linear"},{type:"linear",nice:!0,min:0,max:100},o,r)),[d,c,a,l,o,r]),f=ee((()=>d.map((e=>{if(c.length<2)return null;const t=s[e]??"",i=c.map((t=>{const i=l(gt(t.data.data[e]??0),e);return void 0===i?null:{x:gt(t.x+t.width/2),y:gt(h.yScale(i)??0),id:t.key,value:i}})).filter((e=>null!==e));if(c.length===i.length)return{trendKey:e,color:t,points:i};if(i.length<2)return null;const a=Ct(i),n=c.map((t=>{const i=l(gt(t.data.data[e]??0),e),n=gt(t.x+t.width/2);let r=a.predict(n);return void 0!==i&&(r=gt(h.yScale(i)??0)),{x:n,y:r,id:t.key,value:i}}));return{trendKey:e,color:t,points:n}})).filter((e=>null!==e))),[d,c,l,h,s]);if(0===d.length)return null;if(0===f.length)return null;return e(S.g,{"data-testid":"trend-lines-layer",pointerEvents:"none",clipPath:`url(#${u})`,children:[e("defs",{children:e("clipPath",{id:u,children:e("rect",{x:-5,y:-5,width:o+5,height:r+5})})}),f.map((({trendKey:t,points:i,color:a})=>e(S.g,{"data-testid":"trend-line-group","data-trend-key":t,children:[e(Tt,{points:i,color:a},t),i.filter((e=>void 0!==e.value&&e.value>=0&&e.value<=100)).map((({x:t,y:i,id:n})=>e(Wt,{x:t,y:i,color:a},n)))]},t)))]})},Tt=t=>{const{points:i,color:a}=t,{animate:n,config:r}=C(),o=ee((()=>0===i.length||i.length<2?[]:Ct(i)),[i]),{d:l}=D({d:Mt(o)??void 0,config:r,immediate:!n});return 0===i.length||i.length<2||0===o.length?null:e(S.path,{d:l,"data-testid":"trend-line",fill:"none",stroke:a,strokeWidth:2,strokeLinecap:"round",pointerEvents:"none",strokeDasharray:"4"})},Wt=t=>{const{x:i,y:a,color:n}=t,{animate:r,config:o}=C(),{cx:l,cy:d}=D({cx:i,cy:a,config:o,immediate:!r});return e(S.circle,{"data-testid":"trend-line-point",cx:l,cy:d,r:3,strokeWidth:2,fill:"white",stroke:n,pointerEvents:"none"})},Vt=({data:e,layout:t="vertical",indexBy:i,keys:a,stacked:n,position:r,formatLeftTick:o,formatBottomTick:l})=>{if("horizontal"===t){const t=6,a=e.map((e=>l(e[i],e).toString().length));return Math.max(...a)*t+8}const d=o(Math.floor(Math.max(...e.map((e=>a.map((t=>gt(e[t]??0))).reduce(((e,t)=>e+t),0)))))).toString().length+1;return 8+8*d+10*Math.max(Math.floor((d-1)/3),0)+1};var Rt="styles_container__nVJhv",Ht="styles_barContainer__DTIpd";const It=t=>{const{data:i,legend:a,indexBy:n,renderBottomTick:r,onBarClick:o,padding:l=.5,formatLegendValue:d,formatIndexBy:u,hasValueFn:s,currentLocale:c="en-US",formatBottomTick:h=e=>e,formatLeftTick:f=e=>ue(e,c),bottomTickRotation:g=0,noLegend:v=!1,minValue:b,maxValue:m,groupMode:y="stacked",bottomTickSize:p=12,markers:x=[],colors:k,leftAxisTickValues:S,layout:w="vertical",formatTrendValue:L}=t,C=ee((()=>new Map(a.map((e=>[e.id,e])))),[a]),M=ee((()=>a.filter((e=>"point"!==e.type&&"tree"!==e.type)).map((e=>e.id))),[a]),B=ee((()=>((e,t)=>e.every((e=>Object.keys(e).filter((e=>e!==t)).every((t=>0===e[t])))))(i,n)),[i,n]),T=ee((()=>i.length>=8?"s":i.length>=6?"m":"l"),[i]),W="horizontal"===w;return e("div",{className:Rt,children:[e("div",{className:Ht,children:e(ft,{children:e(ot,{data:i,theme:ne,groupMode:y,layout:w,defaultHeight:275,keys:M,indexBy:n,margin:{top:10,right:20,bottom:g>0?60:40,left:Vt({data:i,layout:w,keys:M,indexBy:n,stacked:!0,position:"left",formatLeftTick:f,formatBottomTick:h})},padding:l,innerPadding:0,valueScale:{type:"linear",nice:!0,min:b,max:m},indexScale:{type:"band",round:!0},layers:["grid","axes",ct,t=>e(kt,{...t,indexBy:n,layout:w,legend:a,barSize:T,groupMode:y}),t=>e(Bt,{...t,legend:a,indexBy:n,formatValue:L}),"markers",t=>e(mt,{...t,hasValueFn:s,indexBy:n,layout:w,onBarClick:o,tooltip:({value:t})=>e(st,{allowZeroValues:!0,value:t,indexBy:n,legend:a,formatLegendValue:d,formatIndexBy:u})})],markers:x,colors:"function"==typeof k?k:e=>C.get(e.id)?.color??"var(--color-bg-secondary)",enableLabel:!1,enableTotals:!1,axisTop:null,axisRight:null,axisBottom:{tickSize:0,tickPadding:5,tickRotation:g,truncateTickAt:0,renderTick:r,style:{ticks:{text:{fontSize:p}}},format:W?f:e=>h(e,i.find((t=>t[n]===e))),tickValues:i.length>30?i.filter(((e,t)=>!(t%2))).map((e=>e[n])):void 0},axisLeft:{tickSize:0,tickPadding:8,tickRotation:0,truncateTickAt:0,format:W?h?e=>h(e,i.find((t=>t[n]===e))):void 0:f,tickValues:S},animate:!re,motionConfig:ae,onClick:o})})}),!B&&!v&&e(ut,{data:a})]})};export{It as B};
|
|
2
|
+
//# sourceMappingURL=BarChart-Dmhamjn_.js.map
|