1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5857],{55977:(e,t,a)=>{a.d(t,{AA:()=>p,Ap:()=>C,Bc:()=>g,Dk:()=>r,ER:()=>v,Fk:()=>o,G8:()=>w,IW:()=>l,Ki:()=>h,P9:()=>y,SE:()=>c,SJ:()=>s,UI:()=>b,Wg:()=>f,Y$:()=>j,Y1:()=>A,aS:()=>x,bI:()=>m,kj:()=>i,qe:()=>u,yQ:()=>d});var n=a(61160);let i=async(e,t)=>{try{let a=[e,t?"includeHidden=true":""].filter(Boolean).join("&"),i=await n.Ay.get(a?"/dashboard-graphs/odata?".concat(a):"/dashboard-graphs/odata");return i.data.value||i.data}catch(e){throw console.error("Error fetching dashboard graphs:",e),e}},r=async e=>{try{return(await n.Ay.get("/dashboard-graphs/".concat(e))).data}catch(t){throw console.error("Error fetching dashboard graph ".concat(e,":"),t),t}},o=async()=>{try{return(await n.Ay.get("/dashboard-graphs/global-scope")).data}catch(e){throw console.error("Error fetching global scope dashboard graphs:",e),e}},l=async()=>{try{return(await n.Ay.get("/dashboard-graphs/featured")).data}catch(e){throw console.error("Error fetching featured dashboard graphs:",e),e}},s=async()=>{try{return(await n.Ay.get("/dashboard-graphs/filters")).data}catch(e){throw console.error("Error fetching dashboard graph filters:",e),e}},d=async(e,t)=>(await n.Ay.put("/dashboard-graphs/".concat(e),t)).data,c=async(e,t)=>{let a=new FormData;return a.append("file",t,"".concat(e,".png")),(await n.Ay.post("/dashboard-graphs/".concat(e,"/thumbnail"),a,{headers:{"Content-Type":"multipart/form-data"}})).data},u=async e=>{let t=new FormData;return t.append("file",e),(await n.Ay.post("/dashboard-graphs/import/preview",t,{headers:{"Content-Type":"multipart/form-data"}})).data},h=async(e,t)=>{let a=new FormData;return a.append("file",e),t.existingGraphId&&a.append("existingGraphId",t.existingGraphId),t.caption&&a.append("caption",t.caption),a.append("graphTypeId",t.graphTypeId),a.append("graphCategoryId",t.graphCategoryId),a.append("importMode",t.importMode),(await n.Ay.post("/dashboard-graphs/import",a,{headers:{"Content-Type":"multipart/form-data"}})).data},p=async e=>{await n.Ay.delete("/dashboard-graphs/".concat(e))},x=async()=>(await n.Ay.get("/dashboard-graphs/types")).data,m=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await n.Ay.get("/dashboard-graphs/categories-list",{params:e?{includeAll:!0}:void 0})).data},g=async(e,t)=>(await n.Ay.post("/dashboard-graphs/".concat(e,"/rows"),t)).data,f=async(e,t,a)=>(await n.Ay.put("/dashboard-graphs/".concat(e,"/rows/").concat(t),a)).data,b=async(e,t)=>{await n.Ay.delete("/dashboard-graphs/".concat(e,"/rows/").concat(t))},y=async(e,t)=>(await n.Ay.post("/dashboard-graphs/".concat(e,"/columns"),t)).data,A=async(e,t)=>{await n.Ay.delete("/dashboard-graphs/".concat(e,"/columns/").concat(t))},j=async()=>(await n.Ay.get("/dashboard-graphs/column-types")).data,v=async e=>{let t=new FormData;return t.append("file",e),(await n.Ay.post("/dashboard-graphs/tags/import-geo",t,{headers:{"Content-Type":"multipart/form-data"}})).data},w=async()=>{let e=new Blob([(await n.Ay.get("/dashboard-graphs/tags/geo-template",{responseType:"blob"})).data],{type:"text/csv"}),t=window.URL.createObjectURL(e),a=document.createElement("a");a.href=t,a.setAttribute("download","dashboard-geo-tags-template.csv"),document.body.appendChild(a),a.click(),a.remove(),window.URL.revokeObjectURL(t)},C=async()=>{let e=new Blob([(await n.Ay.get("/dashboard-graphs/template",{responseType:"blob"})).data],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),t=window.URL.createObjectURL(e),a=document.createElement("a");a.href=t,a.setAttribute("download","ti-dashboard-template.xlsx"),document.body.appendChild(a),a.click(),a.remove(),window.URL.revokeObjectURL(t)}},56593:(e,t,a)=>{a.d(t,{gH:()=>r,oR:()=>o});var n=a(61160);let i=e=>{let t=e;return t&&!t.startsWith("?")&&(t="?"+t),t.includes("$count=true")||(t=t?"".concat(t,"&$count=true"):"?$count=true"),t},r=async e=>{var t,a,r,o,l;let s=i(e),d=(await n.Ay.get("/inbound-definitions/odata".concat(s))).data,c=null!==(l=null!==(o=null!==(r=null!==(a=d["@odata.count"])&&void 0!==a?a:d.count)&&void 0!==r?r:d.__count)&&void 0!==o?o:null===(t=d.value)||void 0===t?void 0:t.length)&&void 0!==l?l:Array.isArray(d)?d.length:0;return{items:d.value||(Array.isArray(d)?d:[]),totalCount:c}},o={getDefinitionsOData:r,getDefinitionById:async e=>(await n.Ay.get("/inbound-definitions/".concat(e))).data,createDefinition:async e=>(await n.Ay.post("/inbound-definitions",e)).data,updateDefinition:async(e,t)=>(await n.Ay.put("/inbound-definitions/".concat(e),t)).data,deleteDefinition:async e=>{await n.Ay.delete("/inbound-definitions/".concat(e))},bulkDeleteDefinitions:async e=>(await n.Ay.delete("/inbound-definitions/bulk",{data:e})).data,executeDefinition:(e,t,a,i)=>{var r;let o=new AbortController,l=n.Ay.defaults.baseURL||"",s=null===(r=document.cookie.split("; ").find(e=>e.startsWith("token=")))||void 0===r?void 0:r.split("=")[1],d={Accept:"text/event-stream"};return s&&(d.Authorization="Bearer ".concat(s)),fetch("".concat(l,"/inbound-definitions/").concat(e,"/execute"),{method:"POST",credentials:"include",headers:d,signal:o.signal}).then(async e=>{var a;if(!e.ok)throw Error((await e.json().catch(()=>({}))).error||"HTTP ".concat(e.status,": ").concat(e.statusText));let n=null===(a=e.body)||void 0===a?void 0:a.getReader();if(!n)throw Error("No response body reader available");let r=new TextDecoder,o="",l=!1;for(;!l;){let e=await n.read();if(l=e.done,e.value){let a=(o+=r.decode(e.value,{stream:!0})).split("\n");for(let e of(o=a.pop()||"",a))if(e.startsWith("data: "))try{let a=JSON.parse(e.slice(6));t(a)}catch(e){}}}i()}).catch(e=>{"AbortError"!==e.name&&a(e instanceof Error?e:Error("Execution failed"))}),o},getDefinitionHistory:async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return(await n.Ay.get("/inbound-definitions/".concat(e,"/history?count=").concat(t))).data},getAssociatedGraphs:async e=>(await n.Ay.get("/inbound-definitions/".concat(e,"/graphs"))).data,getAssociatedGraphsDetailed:async e=>(await n.Ay.get("/inbound-definitions/".concat(e,"/graphs?detailed=true"))).data,getDataSources:async()=>(await n.Ay.get("/inbound-definitions/data-sources")).data}},93470:(e,t,a)=>{a.d(t,{ConfirmProvider:()=>x,S:()=>m});var n=a(95155),i=a(12115),r=a(58671),o=a(36417),l=a(27753),s=a(75131),d=a(68998),c=a(39905),u=a(26214),h=a(22282);let p=(0,i.createContext)(null);function x(e){var t,a,x;let{children:m}=e,[g,f]=(0,i.useState)({open:!1}),[b,y]=(0,i.useState)(""),A=(0,i.useCallback)(e=>new Promise(t=>{y(""),f({...e,open:!0,resolve:t})}),[]),j=!!g.confirmationPhrase,v=!j||b.trim()===g.confirmationPhrase,w=(0,i.useCallback)(e=>{var t;null===(t=g.resolve)||void 0===t||t.call(g,e),f(e=>({...e,open:!1,resolve:void 0}))},[g]),C=(0,i.useCallback)(()=>{v&&w(!0)},[v,w]),S=(0,i.useMemo)(()=>A,[A]);return(0,n.jsxs)(p.Provider,{value:S,children:[m,(0,n.jsxs)(r.A,{open:g.open,onClose:()=>
1w(!1),maxWidth:"xs",fullWidth:!0,"aria-labelledby":"confirm-dialog-title",children:[(0,n.jsx)(o.A,{id:"confirm-dialog-title",children:null!==(t=g.title)&&void 0!==t?t:"Please confirm"}),(g.description||j)&&(0,n.jsxs)(l.A,{children:[g.description&&(0,n.jsx)(s.A,{component:"div",children:g.description}),j&&(0,n.jsxs)(d.default,{sx:{mt:g.description?2.5:0},children:[(0,n.jsxs)(s.A,{component:"label",htmlFor:"confirm-phrase-input",sx:{display:"block",mb:1},children:["Type ",(0,n.jsx)("strong",{children:g.confirmationPhrase})," to confirm"]}),(0,n.jsx)(c.A,{id:"confirm-phrase-input",value:b,onChange:e=>y(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),C())},placeholder:g.confirmationPhrase,size:"small",fullWidth:!0,autoFocus:!0,autoComplete:"off",spellCheck:!1,inputProps:{"aria-label":"Type ".concat(g.confirmationPhrase," to confirm")}})]})]}),(0,n.jsxs)(u.A,{children:[(0,n.jsx)(h.A,{onClick:()=>w(!1),children:null!==(a=g.cancelLabel)&&void 0!==a?a:"Cancel"}),(0,n.jsx)(h.A,{onClick:C,variant:"contained",color:g.destructive?"error":"primary",disabled:!v,autoFocus:!j,children:null!==(x=g.confirmLabel)&&void 0!==x?x:g.destructive?"Delete":"Confirm"})]})]})]})}function m(){let e=(0,i.useContext)(p);if(!e)throw Error("useConfirm must be used within a ConfirmProvider");return e}},8628:(e,t,a)=>{a.d(t,{A:()=>c,p:()=>s});var n=a(95155),i=a(12115),r=a(68998),o=a(64155),l=a(55736);let s={"& table":{borderCollapse:"collapse",width:"100%",marginBottom:"1em"},"& td, & th":{border:"1px solid",borderColor:"divider",padding:"8px",minWidth:"50px"},"& th":{backgroundColor:"#EC221F",color:"#ffffff",fontWeight:"bold"},'& table[data-align="left"]':{marginLeft:0,marginRight:"auto"},'& table[data-align="center"]':{marginLeft:"auto",marginRight:"auto"},'& table[data-align="right"]':{marginLeft:"auto",marginRight:0}},d=/\[chart:([a-f0-9-]{36})\]/gi,c=e=>{let{content:t,className:a="",...c}=e,u=(0,o.PA)(t),h=(0,i.useMemo)(()=>t?function(e){let t;let a=[],n=0;for(d.lastIndex=0;null!==(t=d.exec(e));){if(t.index>n){let i=e.slice(n,t.index);i.trim()&&a.push({type:"html",content:i})}a.push({type:"chart",content:t[1]}),n=t.index+t[0].length}if(n<e.length){let t=e.slice(n);t.trim()&&a.push({type:"html",content:t})}return 0===a.length&&e.trim()&&a.push({type:"html",content:e}),a}(t):[],[t]);return t?h.some(e=>"chart"===e.type)?(0,n.jsx)(r.default,{className:"database-content ".concat(a).trim(),sx:s,...c,children:h.map((e,t)=>"chart"===e.type?(0,n.jsx)(r.default,{sx:{my:2},children:(0,n.jsx)(l.iY,{chartId:e.content,showTitle:!0,height:400})},"chart-".concat(t)):(0,n.jsx)(r.default,{ref:0===t?u:void 0,dangerouslySetInnerHTML:{__html:e.content}},"html-".concat(t)))}):(0,n.jsx)(r.default,{ref:u,className:"database-content ".concat(a).trim(),dangerouslySetInnerHTML:{__html:t},sx:s,...c}):null}},3367:(e,t,a)=>{a.d(t,{A:()=>K});var n=a(95155),i=a(12115),r=a(84429),o=a(56197),l=a(55791),s=a(82138),d=a(78332),c=a(55091),u=a(8795),h=a(64067),p=a(57165),x=a(53326),m=a(15182),g=a(68998),f=a(9561),b=a(
172926),y=a(47821),A=a(22282),j=a(17592),v=a(91888),w=a(70503),C=a(58671),S=a(36417),k=a(27753),I=a(39905),D=a(26214),R=a(22678),E=a(43038),T=a(90847),F=a(79201),P=a(83726),W=a(6327),L=a(78205),M=a(77740),z=a(79545),O=a(49678),N=a(450),U=a(6748),_=a(52035),G=a(58351),V=a(95068),B=a(60864),H=a(11414),q=a(55977),Y=a(8449),$=a(68468),Z=a(38003),J=a(7660);function K(e){let{graph:t,editMode:a,onDataChange:K}=e,{user:Q}=(0,Y.A)(),X=(0,$.Uv)(null==Q?void 0:Q.roles),[ee,et]=(0,i.useState)("compact"),[ea,en]=(0,i.useState)(!1),[ei,er]=(0,i.useState)(!1),[eo,el]=(0,i.useState)({}),[es,ed]=(0,i.useState)(!1),[ec,eu]=(0,i.useState)(!1),[eh,ep]=(0,i.useState)(null),[ex,em]=(0,i.useState)(null),[eg,ef]=(0,i.useState)(""),[eb,ey]=(0,i.useState)({}),[eA,ej]=(0,i.useState)(""),[ev,ew]=(0,i.useState)(""),[eC,eS]=(0,i.useState)(""),[ek,eI]=(0,i.useState)(0),[eD,eR]=(0,i.useState)(!1),[eE,eT]=(0,i.useState)([]),[eF,eP]=(0,i.useState)(!1),eW=X&&(void 0===a||a);(0,i.useEffect)(()=>{ec&&0===eE.length&&(0,q.Y$)().then(eT).catch(()=>{H.oR.error("Failed to load column types")})},[ec,eE.length]);let eL=(0,i.useMemo)(()=>{let e=[{field:"label",headerName:"Date/Period",minWidth:150,flex:1,editable:ei}];return[...t.columns].sort((e,t)=>e.sortOrder-t.sortOrder).forEach(t=>{e.push({field:t.id,headerName:t.unit?"".concat(t.caption," (").concat(t.unit,")"):t.caption,minWidth:180,flex:1,type:"number",editable:ei,renderHeader:e=>(0,n.jsxs)(g.default,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[(0,n.jsx)(f.A,{variant:"body2",sx:{fontWeight:600,flex:1},noWrap:!0,children:e.colDef.headerName}),ei&&(0,n.jsx)(b.A,{title:"Delete column",children:(0,n.jsx)(y.A,{size:"small",onClick:e=>{e.stopPropagation(),em(t.id)},sx:{ml:.5,p:.25},children:(0,n.jsx)(N.A,{sx:{fontSize:16,color:"error.main"}})})})]}),valueFormatter:e=>null==e?"-":"number"==typeof e?e.toLocaleString():String(e)})}),ei&&e.push({field:"actions",type:"actions",headerName:"Actions",width:100,getActions:e=>{var t;let{id:a}=e;return(null===(t=eo[a])||void 0===t?void 0:t.mode)===r.V_.Edit?[(0,n.jsx)(o.Z,{icon:(0,n.jsx)(U.A,{}),label:"Save",onClick:()=>eO(String(a)),color:"primary"},"save"),(0,n.jsx)(o.Z,{icon:(0,n.jsx)(_.A,{}),label:"Cancel",onClick:()=>eN(String(a)),color:"inherit"},"cancel")]:[(0,n.jsx)(o.Z,{icon:(0,n.jsx)(z.A,{}),label:"Edit",onClick:()=>ez(String(a)),color:"inherit"},"edit"),(0,n.jsx)(o.Z,{icon:(0,n.jsx)(N.A,{}),label:"Delete",onClick:()=>ep(String(a)),color:"inherit"},"delete")]}}),e},[t.columns,ei,eo]),eM=(0,i.useMemo)(()=>[...t.dataRows].sort((e,t)=>e.sortOrder-t.sortOrder).map(e=>{let a={id:e.id,label:e.label};return t.columns.forEach(t=>{var n;a[t.id]=null!==(n=e.values[t.id])&&void 0!==n?n:null}),a}),[t.dataRows,t.columns]),ez=e=>{el(t=>({...t,[e]:{mode:r.V_.Edit}}))},eO=e=>{el(t=>({...t,[e]:{mode:r.V_.View}}))},eN=e=>{el(t=>({...t,[e]:{mode:r.V_.View,ignoreModifications:!0}}))},eU=(e,t)=>{e.reason===l.q.rowFocusOut&&(t.defaultMuiPrevented=!0)},e_=(0,i.useCallback)(async e=>{try{eP(!0);let a={};return t.columns.forEach(t=>{let n=e[t.id];a[t.id]=""===n||null==n?null:Number(n)}),await (0,q.Wg)(t.id,String(e.id),{label:e.label,values:a}),H.oR.success("Row updated"),null==K||K(),e}catch(e){throw console.error("Failed to update row:",e),H.oR.error("Failed to update row"),e}finally{eP(!1)}},[t.id,t.columns,K]),eG=(0,i.useCallback)(async()=>{if(eh)try{eP(!0),await (0,q.UI)(t.id,eh),H.oR.success("Row deleted"),ep(null),null==K||K()}catch(e){console.error("Failed to delete row:",e),H.oR.error("Failed to delete row")}finally{eP(!1)}},[eh,t.id,K]),eV=(0,i.useCallback)(async()=>{if(ex)try{eP(!0),await (0,q.Y1)(t.id,ex),H.oR.success("Column deleted"),em(null),null==K||K()}catch(e){console.error("Failed to delete column:",e),H.oR.error("Failed to delete column")}finally{eP(!1)}},[ex,t.id,K]),eB=(0,i.useCallback)(async()=>{try{eP(!0);let e={};t.columns.forEach(t=>{let a=eb[t.id];e[t.id]=""===a||void 0===a?null:Number(a)});let a={label:eg,values:e,sortOrder:t.dataRows.length};await (0,q.Bc)(t.id,a),H.oR.success("Row added"),ed(!1),ef(""),ey({}),null==K||K()}catch(e){console.error("Failed to add row:",e),H.oR.error("Failed to add row")}finally{eP(!1)}},[eg,eb,t.id,t.columns,t.dataRows.length,K]),eH=(0,i.useCallback)(async()=>{try{eP(!0);let e={caption:eA,unit:ev||void 0,columnTypeId:eC,axis:ek,fill:eD,sortOrder:t.columns.length};await (0,q.P9)(t.id,e),H.oR.success("Column added"),eu(!1),ej(""),ew(""),eS(""),eI(0),eR(!1),null==K||K()}catch(e){console.error("Failed to add column:",e),H.oR.error("Failed to add column")}finally{eP(!1)}},[eA,ev,eC,ek,eD,t.id,t.columns.length,K]),eq=(0,i.useCallback)(()=>{let e=[...t.columns].sort((e,t)=>
1e.sortOrder-t.sortOrder),a=new Map,n=new Set(["Date/Period"]);for(let t of e){let e=t.unit?"".concat(t.caption," (").concat(t.unit,")"):t.caption,i=e,r=2;for(;n.has(i);)i="".concat(e," (").concat(r++,")");n.add(i),a.set(t.id,i)}return eM.map(t=>{let n={"Date/Period":t.label};for(let r of e){var i;n[a.get(r.id)]=null!==(i=t[r.id])&&void 0!==i?i:null}return n})},[eM,t.columns]),eY=(0,i.useCallback)(()=>{let e=J.Wp.json_to_sheet(eq()),a=new Blob(["\uFEFF",J.Wp.sheet_to_csv(e)],{type:"text/csv;charset=utf-8;"}),n=new Date().toISOString().split("T")[0];(0,Z.saveAs)(a,"".concat(t.caption,"-").concat(n,".csv"))},[eq,t.caption]),e$=(0,i.useCallback)(()=>{let e=J.Wp.json_to_sheet(eq()),a=J.Wp.book_new();J.Wp.book_append_sheet(a,e,"Data");let n=new Blob([J.M9(a,{bookType:"xlsx",type:"array"})],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),i=new Date().toISOString().split("T")[0];(0,Z.saveAs)(n,"".concat(t.caption,"-").concat(i,".xlsx"))},[eq,t.caption]);function eZ(){let[e,t]=(0,i.useState)(null),[a,r]=(0,i.useState)(null),o=!!e,l=!!a,s=()=>{t(null)},f=()=>{r(null)},b=e=>{et(e),f()};return(0,n.jsxs)(d.M,{children:[(0,n.jsx)(c.U,{render:(0,n.jsx)(u.I,{render:(0,n.jsx)(A.A,{size:"small",variant:"outlined",children:"Columns"})})}),(0,n.jsx)(h.P,{render:(0,n.jsx)(u.I,{render:(0,n.jsx)(A.A,{size:"small",variant:"outlined",children:"Filters"})})}),(0,n.jsx)(A.A,{size:"small",variant:"outlined",id:"export-button","aria-controls":o?"export-menu":void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:e=>{t(e.currentTarget)},startIcon:(0,n.jsx)(G.A,{}),children:"Export"}),(0,n.jsxs)(j.A,{id:"export-menu",anchorEl:e,open:o,onClose:s,MenuListProps:{"aria-labelledby":"export-button"},children:[(0,n.jsx)(v.A,{onClick:()=>{eY(),s()},children:"Export as CSV"}),(0,n.jsx)(v.A,{onClick:()=>{e$(),s()},children:"Export as Excel"})]}),(0,n.jsxs)(A.A,{size:"small",variant:"outlined",id:"density-button","aria-controls":l?"density-menu":void 0,"aria-haspopup":"true","aria-expanded":l?"true":void 0,onClick:e=>{r(e.currentTarget)},startIcon:(0,n.jsx)(V.A,{}),children:["Density: ",ee.charAt(0).toUpperCase()+ee.slice(1)]}),(0,n.jsxs)(j.A,{id:"density-menu",anchorEl:a,open:l,onClose:f,MenuListProps:{"aria-labelledby":"density-button"},children:[(0,n.jsx)(v.A,{onClick:()=>b("compact"),children:"Compact"}),(0,n.jsx)(v.A,{onClick:()=>b("standard"),children:"Standard"}),(0,n.jsx)(v.A,{onClick:()=>b("comfortable"),children:"Comfortable"})]}),eW&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.A,{size:"small",variant:ei?"contained":"outlined",color:ei?"warning":"primary",startIcon:ei?(0,n.jsx)(O.A,{}):(0,n.jsx)(z.A,{}),onClick:()=>er(!ei),children:ei?"Stop Editing":"Edit"}),ei&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.A,{size:"small",variant:"outlined",color:"success",startIcon:(0,n.jsx)(M.A,{}),onClick:()=>ed(!0),children:"Add Row"}),(0,n.jsx)(A.A,{size:"small",variant:"outlined",color:"success",startIcon:(0,n.jsx)(M.A,{}),onClick:()=>eu(!0),children:"Add Column"})]})]}),(0,n.jsx)(g.default,{sx:{flex:1}}),(0,n.jsx)(p.e,{expanded:!0,children:(0,n.jsx)(x.X,{size:"small",placeholder:"Searchâ¦",style:{width:240},slotProps:{htmlInput:{"aria-label":"Search"},input:{startAdornment:(0,n.jsx)(w.A,{position:"start",children:(0,n.jsx)(L.A,{fontSize:"small",color:"action"})}),endAdornment:(0,n.jsx)(w.A,{position:"end",children:(0,n.jsx)(m.x,{render:(0,n.jsx)(y.A,{size:"small","aria-label":"Clear search",children:(0,n.jsx)(W.A,{fontSize:"small"})})})})}}})}),(0,n.jsx)(A.A,{size:"small",variant:"outlined",startIcon:(0,n.jsx)(B.A,{}),onClick:()=>en(!0),children:"Fullscreen"})]})}let eJ=(0,i.useRef)(eZ);eJ.current=eZ;let eK=(0,i.useRef)(null);eK.current||(eK.current=function(){return eJ.current()});let eQ=(0,i.useMemo)(()=>({toolbar:eK.current}),[]),eX={border:"none",width:"100%","& .MuiDataGrid-cell":{borderBottom:"1px solid rgba(224, 224, 224, 1)"},"& .MuiDataGrid-columnHeaders":{backgroundColor:"rgba(248, 249, 250, 1)",borderBottom:"2px solid rgba(224, 224, 224, 1)"},"& .MuiDataGrid-columnHeader":{fontWeight:600},"& .MuiDataGrid-footerContainer":{borderTop:"2px solid rgba(224, 224, 224, 1)",backgroundColor:"rgba(248, 249, 250, 1)"}};if(0===eM.length&&!ei)return(0,n.jsxs)(g.default,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"120px",backgroundColor:"grey.50",borderRadius:1,border:"1px dashed",borderColor:"grey.300",gap:2},children:[(0,n.jsx)(f.A,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"No data available"}),eW&&(0,n.jsxs)(g.default,{sx:{display:"flex",gap:1},children:[(0,n.jsx)(A.A,{size:"small",variant:"outlined",startIcon:(0,n.jsx)(M.A,{}),onClick:()=>ed(!0),children:"Add Row"}),(0,n.jsx)(A.A,{size:"small",variant:"outlined",startIcon:(0,n.jsx)(M.A,{}),onClick:()=>eu(!0),children:"Add Column"})]}),e0()]});function e0(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(C.A,{open:es,onClose:()=>ed(!1),maxWidth:"sm",fullWidth:!0,children:[(0,n.jsx)(S.A,{children:"Add Row"}),(0,n.jsxs)(k.A,{children:[(0,n.jsx)(I.A,{autoFocus:!0,margin:"dense",label:"Label (Date/Period)",fullWidth:!0,value:eg,onChange:e=>ef(e.target.value),sx:{mb:2}}),t.columns.sort((e,t)=>
1e.sortOrder-t.sortOrder).map(e=>{var t;return(0,n.jsx)(I.A,{margin:"dense",label:e.unit?"".concat(e.caption," (").concat(e.unit,")"):e.caption,type:"number",fullWidth:!0,value:null!==(t=eb[e.id])&&void 0!==t?t:"",onChange:t=>ey(a=>({...a,[e.id]:t.target.value})),sx:{mb:1}},e.id)})]}),(0,n.jsxs)(D.A,{children:[(0,n.jsx)(A.A,{onClick:()=>ed(!1),children:"Cancel"}),(0,n.jsx)(A.A,{onClick:eB,variant:"contained",disabled:!eg.trim()||eF,children:"Add"})]})]}),(0,n.jsxs)(C.A,{open:ec,onClose:()=>eu(!1),maxWidth:"sm",fullWidth:!0,children:[(0,n.jsx)(S.A,{children:"Add Column"}),(0,n.jsxs)(k.A,{children:[(0,n.jsx)(I.A,{autoFocus:!0,margin:"dense",label:"Caption",fullWidth:!0,value:eA,onChange:e=>ej(e.target.value),sx:{mb:2}}),(0,n.jsx)(I.A,{margin:"dense",label:"Unit (optional)",fullWidth:!0,value:ev,onChange:e=>ew(e.target.value),sx:{mb:2}}),(0,n.jsxs)(R.A,{fullWidth:!0,sx:{mb:2},children:[(0,n.jsx)(E.A,{id:"col-type-label",children:"Column Type"}),(0,n.jsx)(T.A,{labelId:"col-type-label",value:eC,label:"Column Type",onChange:e=>eS(e.target.value),children:eE.map(e=>(0,n.jsx)(v.A,{value:e.id,children:e.name},e.id))})]}),(0,n.jsx)(I.A,{margin:"dense",label:"Axis",type:"number",fullWidth:!0,value:ek,onChange:e=>eI(Number(e.target.value)),sx:{mb:2}}),(0,n.jsx)(F.A,{control:(0,n.jsx)(P.A,{checked:eD,onChange:e=>eR(e.target.checked)}),label:"Fill"})]}),(0,n.jsxs)(D.A,{children:[(0,n.jsx)(A.A,{onClick:()=>eu(!1),children:"Cancel"}),(0,n.jsx)(A.A,{onClick:eH,variant:"contained",disabled:!eA.trim()||!eC||eF,children:"Add"})]})]}),(0,n.jsxs)(C.A,{open:!!eh,onClose:()=>ep(null),children:[(0,n.jsx)(S.A,{children:"Delete Row"}),(0,n.jsx)(k.A,{children:(0,n.jsx)(f.A,{children:"Are you sure you want to delete this row? This action cannot be undone."})}),(0,n.jsxs)(D.A,{children:[(0,n.jsx)(A.A,{onClick:()=>ep(null),children:"Cancel"}),(0,n.jsx)(A.A,{onClick:eG,color:"error",variant:"contained",disabled:eF,children:"Delete"})]})]}),(0,n.jsxs)(C.A,{open:!!ex,onClose:()=>em(null),children:[(0,n.jsx)(S.A,{children:"Delete Column"}),(0,n.jsx)(k.A,{children:(0,n.jsx)(f.A,{children:"Are you sure you want to delete this column? All data in this column will be permanently removed."})}),(0,n.jsxs)(D.A,{children:[(0,n.jsx)(A.A,{onClick:()=>em(null),children:"Cancel"}),(0,n.jsx)(A.A,{onClick:eV,color:"error",variant:"contained",disabled:eF,children:"Delete"})]})]})]})}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(g.default,{sx:{height:600,width:"100%",position:"relative"},children:(0,n.jsx)(s.z,{rows:eM,columns:eL,density:ee,autoHeight:!1,showToolbar:!0,editMode:"row",rowModesModel:eo,onRowModesModelChange:el,onRowEditStop:eU,processRowUpdate:e_,onProcessRowUpdateError:e=>{console.error("Row update error:",e)},loading:eF,initialState:{pagination:{paginationModel:{pageSize:25,page:0}}},pageSizeOptions:[10,25,50,100,200],disableRowSelectionOnClick:!0,slots:eQ,sx:eX})}),(0,n.jsxs)(C.A,{fullScreen:!0,open:ea,onClose:()=>en(!1),children:[(0,n.jsxs)(S.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(g.default,{component:"span",children:t.caption}),(0,n.jsx)(y.A,{edge:"end",color:"inherit",onClick:()=>en(!1),"aria-label":"close",children:(0,n.jsx)(W.A,{})})]}),(0,n.jsx)(k.A,{children:(0,n.jsx)(g.default,{sx:{height:"100%",width:"100%"},children:(0,n.jsx)(s.z,{rows:eM,columns:eL,density:ee,autoHeight:!1,editMode:"row",rowModesModel:eo,onRowModesModelChange:el,onRowEditStop:eU,processRowUpdate:e_,onProcessRowUpdateError:e=>{console.error("Row update error:",e)},loading:eF,initialState:{pagination:{paginationModel:{pageSize:50,page:0}}},pageSizeOptions:[25,50,100,200],disableRowSelectionOnClick:!0,sx:{...eX,height:"100%"}})})})]}),e0()]})}},25815:(e,t,a)=>{a.d(t,{A:()=>G});var n=a(95155),i=a(12115),r=a(78562),o=a(68998),l=a(9561),s=a(72926),d=a(47821),c=a(22282),u=a(96854),h=a(49234),p=a(39905),x=a(25158),m=a(22678),g=a(43038),f=a(90847),b=a(91888),y=a(79201),A=a(99489),j=a(79545),v=a(6748),w=a(52035),C=a(53549),S=a(81704),k=a(32556),I=a(67396),D=a(2241),R=a(66656),E=a(11414),T=a(55977),F=a(56593),P=a(8449),W=a(93470),L=a(68468),M=a(11890),z=a(33692),O=a(8628),N=a(82851);let U=e=>e?new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"}):"Never",_=(e,t)=>
1e&&t?t.charAt(0).toUpperCase()+t.slice(1):"Manual only";function G(e){var t,a,G,V,B;let{graph:H,onSave:q,onDelete:Y}=e,{user:$}=(0,P.A)(),Z=(0,W.S)(),J=(0,L.qc)(null==$?void 0:$.roles),[K,Q]=(0,i.useState)(!1),[X,ee]=(0,i.useState)(!1),[et,ea]=(0,i.useState)(!1),[en,ei]=(0,i.useState)(H.caption),[er,eo]=(0,i.useState)(null!==(a=H.description)&&void 0!==a?a:""),[el,es]=(0,i.useState)(null!==(G=H.source)&&void 0!==G?G:""),[ed,ec]=(0,i.useState)(H.graphTypeId),[eu,eh]=(0,i.useState)(H.categoryId),[ep,ex]=(0,i.useState)(H.isFeatured),[em,eg]=(0,i.useState)(H.isVisible),[ef,eb]=(0,i.useState)(H.sortOrder),[ey,eA]=(0,i.useState)(H.tags),[ej,ev]=(0,i.useState)(null!==(V=null===(t=H.apiDefinition)||void 0===t?void 0:t.id)&&void 0!==V?V:""),[ew,eC]=(0,i.useState)([]),[eS,ek]=(0,i.useState)([]),[eI,eD]=(0,i.useState)(null),[eR,eE]=(0,i.useState)([]),[eT,eF]=(0,i.useState)(!1),[eP,eW]=(0,i.useState)(!1),eL=eI?[{label:"Mode",typeId:4,options:eI.modes},{label:"Metric",typeId:2,options:eI.metrics},{label:"Geographic Scope",typeId:6,options:eI.scopes},{label:"Region",typeId:3,options:eI.regions},{label:"Country",typeId:5,options:eI.countries},{label:"City",typeId:7,options:eI.cities},{label:"Frequency",typeId:1,options:eI.frequencies}]:[],eM=(0,i.useCallback)(async()=>{eW(!0);try{let[e,t,a]=await Promise.all([(0,T.aS)(),(0,T.bI)(!0),(0,T.SJ)()]);if(eC(e),ek(t),eD(a),J)try{let e=await (0,F.gH)("$orderby=DefinitionName&$top=500");eE(e.items),eF(!0)}catch(e){console.error("Failed to load API definitions:",e),E.oR.error("Failed to load API definitions â linked definition cannot be changed")}}catch(e){console.error("Failed to load metadata options:",e),E.oR.error("Failed to load form options")}finally{eW(!1)}},[J]);(0,i.useEffect)(()=>{K&&0===ew.length&&eM()},[K,ew.length,eM]),(0,i.useEffect)(()=>{var e,t,a,n;ei(H.caption),eo(null!==(t=H.description)&&void 0!==t?t:""),es(null!==(a=H.source)&&void 0!==a?a:""),ec(H.graphTypeId),eh(H.categoryId),ex(H.isFeatured),eg(H.isVisible),eb(H.sortOrder),eA(H.tags),ev(null!==(n=null===(e=H.apiDefinition)||void 0===e?void 0:e.id)&&void 0!==n?n:"")},[H]);let ez=async()=>{if(await Z({title:"Delete this dashboard?",description:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("strong",{children:(0,N.Gr)(H.caption)})," and all of its data will be permanently removed: every data row and column, its tags, and any pins users have added. This cannot be undone.",(0,n.jsx)("br",{}),(0,n.jsx)("br",{}),"If this dashboard is embedded in page content with a ",(0,n.jsx)("code",{children:"[dashboard:...]"})," ","shortcode, that embed will stop rendering."]}),confirmLabel:"Delete dashboard",cancelLabel:"Cancel",destructive:!0,confirmationPhrase:"DELETE"})){ea(!0);try{await (0,T.AA)(H.id),E.oR.success("Dashboard deleted"),null==Y||Y()}catch(a){var e,t;E.oR.error((null==a?void 0:null===(t=a.response)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.message)||"Failed to delete dashboard")}finally{ea(!1)}}},eO=async()=>{if(!en.trim()){E.oR.error("Caption is required");return}ee(!0);try{let e={caption:en.trim(),description:er.trim()||void 0,source:el.trim()||void 0,graphTypeId:ed,categoryId:eu,isFeatured:ep,isVisible:em,sortOrder:ef,tagIds:ey.map(e=>e.id),...J&&eT?{inboundApiDefinitionId:""===ej?0:ej}:{}};await (0,T.yQ)(H.id,e),E.oR.success("Graph details updated"),Q(!1),q()}catch(e){console.error("Failed to update graph:",e),E.oR.error("Failed to update graph details")}finally{ee(!1)}},eN=e=>ey.filter(t=>t.typeId===e),eU=(e,t)=>{eA(a=>[...a.filter(t=>t.typeId!==e),...t])};return K?(0,n.jsxs)(r.A,{sx:{p:4,mb:4},children:[(0,n.jsxs)(o.default,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:[(0,n.jsx)(l.A,{variant:"h5",sx:{fontWeight:600},children:"Edit Graph Details"}),(0,n.jsxs)(o.default,{sx:{display:"flex",gap:1},children:[(0,n.jsx)(c.A,{variant:"outlined",startIcon:(0,n.jsx)(w.A,{}),onClick:()=>{var e,t,a,n;ei(H.caption),eo(null!==(t=H.description)&&void 0!==t?t:""),es(null!==(a=H.source)&&void 0!==a?a:""),ec(H.graphTypeId),eh(H.categoryId),ex(H.isFeatured),eg(H.isVisible),eb(H.sortOrder),eA(H.tags),ev(null!==(n=null===(e=H.apiDefinition)||void 0===e?void 0:e.id)&&void 0!==n?n:""),Q(!1)},disabled:X,children:"Cancel"}),(0,n.jsx)(c.A,{variant:"contained",startIcon:X?(0,n.jsx)(u.A,{size:18}):(0,n.jsx)(v.A,{}),onClick:eO,disabled:X||!en.trim(),children:X?"Saving...":"Save"})]})]}),eP?(0,n.jsx)(o.default,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,n.jsx)(u.A,{})}):(0,n.jsxs)(o.default,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,n.jsx)(p.A,{label:"Caption",value:en,onChange:e=>ei(e.target.value),required:!0,fullWidth:!0,error:!en.trim(),helperText:en.trim()?"":"Caption is required"}),(0,n.jsxs)(o.default,{children:[(0,n.jsx)(l.A,{variant:"body2",color:"text.secondary",sx:{mb:.5},children:"Description"}
1),(0,n.jsx)(z.A,{value:er,onChange:eo,height:200})]}),(0,n.jsx)(p.A,{label:"Source",value:el,onChange:e=>es(e.target.value),fullWidth:!0}),J&&eT&&(0,n.jsx)(x.A,{options:eR,value:null!==(B=eR.find(e=>e.id===ej))&&void 0!==B?B:null,onChange:(e,t)=>ev(t?t.id:""),getOptionLabel:e=>"".concat(e.inboundApiName," â ").concat(e.definitionName),isOptionEqualToValue:(e,t)=>e.id===t.id,renderInput:e=>(0,n.jsx)(p.A,{...e,label:"Linked API definition",helperText:"Sets this definition as the dashboard's data feed â its data will be refreshed from the API on the definition's next run (Upply lanes append weekly rows; other sources replace all existing data). Leave empty for manually managed dashboards."})}),(0,n.jsxs)(o.default,{sx:{display:"flex",gap:2},children:[(0,n.jsxs)(m.A,{fullWidth:!0,children:[(0,n.jsx)(g.A,{id:"graph-type-label",children:"Graph Type"}),(0,n.jsx)(f.A,{labelId:"graph-type-label",label:"Graph Type",value:ed,onChange:e=>ec(e.target.value),children:ew.map(e=>(0,n.jsx)(b.A,{value:e.id,children:e.name},e.id))})]}),(0,n.jsxs)(m.A,{fullWidth:!0,children:[(0,n.jsx)(g.A,{id:"category-label",children:"Category"}),(0,n.jsx)(f.A,{labelId:"category-label",label:"Category",value:eu,onChange:e=>eh(e.target.value),children:eS.map(e=>(0,n.jsx)(b.A,{value:e.id,children:e.name},e.id))})]})]}),(0,n.jsx)(l.A,{variant:"subtitle2",color:"text.secondary",children:"Tags"}),(0,n.jsx)(o.default,{sx:{display:"flex",flexDirection:"column",gap:2},children:eL.map(e=>(0,n.jsx)(x.A,{multiple:!0,options:e.options,value:eN(e.typeId),onChange:(t,a)=>eU(e.typeId,a),getOptionLabel:e=>e.name,isOptionEqualToValue:(e,t)=>e.id===t.id,renderInput:t=>(0,n.jsx)(p.A,{...t,label:e.label,helperText:6===e.typeId?"Automatically derived from Region, Country, and City tags. Selecting a value here will override the default.":void 0}),renderTags:(e,t)=>e.map((e,a)=>{let{key:i,...r}=t({index:a});return(0,n.jsx)(h.A,{label:e.name,size:"small",...r},i)})},e.typeId))}),(0,n.jsxs)(o.default,{sx:{display:"flex",gap:3,alignItems:"center"},children:[(0,n.jsx)(y.A,{control:(0,n.jsx)(A.A,{checked:ep,onChange:e=>ex(e.target.checked)}),label:"Featured"}),(0,n.jsx)(y.A,{control:(0,n.jsx)(A.A,{checked:em,onChange:e=>eg(e.target.checked)}),label:"Visible"}),(0,n.jsx)(p.A,{label:"Sort Order",type:"number",value:ef,onChange:e=>eb(Number(e.target.value)),sx:{width:120},slotProps:{htmlInput:{min:0}}})]}),H.modified&&(0,n.jsxs)(l.A,{variant:"body2",color:"text.secondary",children:[(0,n.jsx)("strong",{children:"Last updated:"})," ",new Date(H.modified).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]}):(0,n.jsxs)(r.A,{sx:{p:4,mb:4},children:[(0,n.jsxs)(o.default,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:1},children:[(0,n.jsx)(l.A,{variant:"h4",gutterBottom:!0,sx:{fontWeight:600},children:(0,N.Gr)(H.caption)}),(0,n.jsx)(s.A,{title:"Edit details",children:(0,n.jsx)(d.A,{onClick:()=>{Q(!0)},size:"small","aria-label":"edit graph details",children:(0,n.jsx)(j.A,{})})})]}),(0,n.jsx)(o.default,{sx:{display:"flex",flexWrap:"wrap",gap:1,mb:3},children:H.tags.map(e=>(0,n.jsx)(M.A,{tag:e},e.id))}),H.description&&(0,n.jsx)(O.A,{content:H.description,sx:{mb:2}}),(0,n.jsxs)(l.A,{variant:"body2",color:"text.secondary",children:[(0,n.jsx)("strong",{children:"Category:"})," ",(0,N.Gr)(H.category)]}),(0,n.jsxs)(l.A,{variant:"body2",color:"text.secondary",children:[(0,n.jsx)("strong",{children:"Type:"})," ",(0,N.Gr)(H.graphType)]}),H.source&&(0,n.jsxs)(l.A,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[(0,n.jsx)("strong",{children:"Source:"})," ",(0,N.Gr)(H.source)]}),H.modified&&(0,n.jsxs)(l.A,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[(0,n.jsx)("strong",{children:"Last updated:"})," ",new Date(H.modified).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"})]}),(0,n.jsx)(D.A,{sx:{mt:2,mb:1.5}}),(0,n.jsxs)(o.default,{sx:{display:"flex",alignItems:"center",gap:.75,mb:1},children:[(0,n.jsx)(S.A,{sx:{fontSize:16},color:"action"}),(0,n.jsx)(l.A,{variant:"caption",color:"text.secondary",sx:{fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:"Admin only"}),(0,n.jsx)(l.A,{variant:"caption",color:"text.secondary",children:"â not visible to regular users"})]}),(0,n.jsxs)(o.default,{sx:{display:"flex",gap:2,alignItems:"center",flexWrap:"wrap"},children:[(0,n.jsxs)(l.A,{variant:"body2",color:"text.secondary",children:[(0,n.jsx)("strong",{children:"Featured:"})," ",H.isFeatured?"Yes":"No"]}),(0,n.jsxs)(l.A,{variant:"body2",color:"text.secondary",children:[(0,n.jsx)("strong",{children:"Visible:"})," ",H.isVisible?"Yes":"No"]}),(0,n.jsxs)(l.A,{variant:"body2",color:"text.secondary",children:[(0,n.jsx)("strong",{children:"Sort Order:"})," ",H.sortOrder]}),Y&&(0,n.jsx)(c.A,{size:"small",color:"error",variant:"outlined",startIcon:et?(0,n.jsx)(u.A,{size:14,color:"inherit"}):(0,n.jsx)(k.A,{}),onClick:ez,disabled:et,sx:{ml:"auto"},children:et?"Deleting...":"Delete dashboard"})]}),H.apiDefinition&&(0,n.jsxs)(o.default,{sx:{mt:2,p:2,backgroundColor:"grey.50",borderRadius:1,border:1,borderColor:"divider"},children:[(0,n.jsxs)(o.default,{sx:{display:"flex",alignItems:"center",gap:1,mb:1},children:[(0,n.jsx)(C.A,{fontSize:"small",color:"action"}),(0,n.jsx)(l.A,{variant:"subtitle2",children:"Linked API definition"}),(0,n.jsx)(h.A,{size:"small",label:null===H.apiDefinition.lastExecutionSuccess?"Never run":H.apiDefinition.lastExecutionSuccess?"Last run succeeded":"Last run failed",color:null===H.apiDefinition.lastExecutionSuccess?"default":H.apiDefinition.lastExecutionSuccess?"success":"error"})]}),(0,n.jsxs)(l.A,{variant:"body2",color:"text.secondary",children:[(0,n.jsx)("strong",{children:H.apiDefinition.dataSourceName})," â"," ",H.apiDefinition.definitionName]}),(0,n.jsxs)(l.A,{variant:"body2",color:"text.secondary",children:[(0,n.jsx)("strong",{children:"Schedule:"})," ",_(H.apiDefinition.isPeriodic,H.apiDefinition.interval)," \xb7 ",(0,n.jsx)("strong",{children:"Last ran:"})," ",U(H.apiDefinition.lastRanDate)]}),(0,n.jsx)(R.A,{component:I.default,href:"/admin/api-definitions",variant:"body2",sx:{mt:.5,display:"inline-block"},children:"Manage in API Definitions"})]})]})}},11890:(e,t,a)=>{a.d(t,{A:()=>
1o});var n=a(95155);a(12115);var i=a(49234);let r=e=>{switch(e){case 1:return"primary";case 2:return"success";case 3:return"warning";case 4:return"secondary";case 5:case 7:return"info";default:return"default"}};function o(e){let{tag:t}=e;return(0,n.jsx)(i.A,{label:t.name,size:"small",color:r(t.typeId),variant:"outlined",sx:{fontSize:"0.75rem"}})}},50297:(e,t,a)=>{a.d(t,{A:()=>b});var n=a(95155),i=a(12115),r=a(78562),o=a(68998),l=a(9561),s=a(72926),d=a(47821),c=a(58671),u=a(36417),h=a(27753),p=a(60864),x=a(6327),m=a(23002),g=a(77505),f=a(53567);function b(e){let{graph:t}=e,[a,b]=(0,i.useState)(!1),y=(0,i.useMemo)(()=>{var e,a;let n=[...t.dataRows].sort((e,t)=>e.sortOrder-t.sortOrder),i=n.map(e=>e.label),r=[...t.columns].sort((e,t)=>e.sortOrder-t.sortOrder),o=r.map(e=>{let t=n.map(t=>{var a;return null!==(a=t.values[e.id])&&void 0!==a?a:null});return{id:e.id,label:e.unit?"".concat(e.caption," (").concat(e.unit,")"):e.caption,data:t,yAxisKey:2===e.axis?"rightAxis":"leftAxis"}});return{xLabels:i,series:o,hasRightAxis:r.some(e=>2===e.axis),leftAxisUnit:null===(e=r.find(e=>2!==e.axis))||void 0===e?void 0:e.unit,rightAxisUnit:null===(a=r.find(e=>2===e.axis))||void 0===a?void 0:a.unit}},[t.dataRows,t.columns]),A=t.graphType.toLowerCase().includes("bar");if(0===y.series.length||0===y.xLabels.length)return(0,n.jsx)(r.A,{sx:{p:4},children:(0,n.jsx)(o.default,{sx:{minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"grey.50",borderRadius:1,border:"1px dashed",borderColor:"grey.300"},children:(0,n.jsx)(l.A,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"No data available for visualization"})})});let j=y.hasRightAxis?[{id:"leftAxis",label:y.leftAxisUnit||"Value"},{id:"rightAxis",label:y.rightAxisUnit||"Value"}]:[{id:"leftAxis",label:y.leftAxisUnit||"Value"}],v={xAxis:[{scaleType:"band",data:y.xLabels,label:"Date/Period"}],yAxis:j,series:y.series.map(e=>({...e,showMark:!1,valueFormatter:e=>null!==e?e.toLocaleString():"N/A"})),grid:{vertical:!0,horizontal:!0},height:400,margin:{top:20,right:y.hasRightAxis?80:20,bottom:80,left:80},slotProps:{legend:{direction:"row",position:{vertical:"bottom",horizontal:"middle"},padding:0}}},w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:400,t={...v,height:e};return A?(0,n.jsx)(g.E,{...t}):(0,n.jsx)(m.b,{...t})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(r.A,{sx:{p:4,mb:4,position:"relative"},children:[(0,n.jsx)(o.default,{"data-thumbnail-ignore":!0,sx:{position:"absolute",top:16,right:16,zIndex:1},children:(0,n.jsx)(s.A,{title:"View fullscreen",children:(0,n.jsx)(d.A,{onClick:()=>{(0,f.u4)(f.qY.CHART_INTERACTION,{chart_id:t.id,chart_type:t.graphType,action:"fullscreen_opened"}),b(!0)},size:"small",sx:{backgroundColor:"background.paper","&:hover":{backgroundColor:"action.hover"},boxShadow:1},children:(0,n.jsx)(p.A,{})})})}),(0,n.jsx)(o.default,{"data-thumbnail-target":!0,sx:{width:"100%",overflowX:"auto"},children:w()})]}),(0,n.jsxs)(c.A,{fullScreen:!0,open:a,onClose:()=>b(!1),children:[(0,n.jsxs)(u.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(o.default,{component:"span",children:t.caption}),(0,n.jsx)(d.A,{edge:"end",color:"inherit",onClick:()=>b(!1),"aria-label":"close",children:(0,n.jsx)(x.A,{})})]}),(0,n.jsx)(h.A,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(o.default,{sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:w(window.innerHeight-200)})})]})]})}},87805:(e,t,a)=>{a.d(t,{A:()=>o});var n=a(95155);a(12115);var i=a(10897),r=a(31798);function o(){return(0,n.jsxs)(i.A,{severity:"warning",icon:(0,n.jsx)(r.A,{fontSize:"inherit"}),sx:{mb:3},children:["This dashboard is ",(0,n.jsx)("strong",{children:"hidden from customers"})," â only dashboard admins can view it. Use the ",(0,n.jsx)("strong",{children:"Visible"})," toggle in the editor to publish it."]})}},64155:(e,t,a)=>{a.d(t,{PA:()=>i});var n=a(12115);function i(e){let t=(0,n.useRef)(null);return(0,n.useEffect)(()=>{let a=t.current;if(!a||!e)return;let n=setTimeout(()=>
1{a&&a.querySelectorAll("a[href]").forEach(e=>{let t=e.getAttribute("href");if(t&&function(e){if(!e||e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||!e.match(/^https?:\/\//))return!1;try{let t=new URL(e),a=window.location.hostname;if(a&&t.hostname===a)return!1;return!0}catch(e){return!1}}(t)){if(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"),!e.getAttribute("aria-label")&&!e.getAttribute("title")){var a;let n=(null===(a=e.textContent)||void 0===a?void 0:a.trim())||t;e.setAttribute("aria-label","".concat(n," (opens in new tab)"))}e.setAttribute("data-external-link","true")}})},0);return()=>clearTimeout(n)},[e]),t}},82851:(e,t,a)=>{a.d(t,{Gr:()=>l,km:()=>o});let n=e=>new DOMParser().parseFromString(e,"text/html").documentElement.textContent||e,i=e=>new DOMParser().parseFromString(e,"text/html").body.textContent||e,r=e=>e.replace(/[\u2018\u2019\u201A\u2032]/g,"'").replace(/[\u201C\u201D\u201E\u2033]/g,'"').replace(/[\u2013]/g,"â").replace(/[\u2014]/g,"â").replace(/[\u2026]/g,"...").replace(/[\u00A0]/g," "),o=e=>e?r(n(e)):"",l=e=>e?n(i(e)):""}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.