UNPKG

decocms

Version:

Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools

2 lines (1 loc) • 41.7 kB
import{r as b,fH as Mt,c as U,i as Ae,K as ne,q as Nt,b as re,j as d,B as at,e3 as He,m as nt}from"./index-DoEtSiIe.js";import{n as Ct}from"./UserCheck01-CA8kXGn8.js";import{t as Ot}from"./ChevronDown-Dm2xO7jf.js";import{S as Pt,c as Ee,C as Dt,a as It}from"./chart-BhhOak8o.js";import{B as Et}from"./badge-DONoxQO7.js";import{C as Lt}from"./calendar-BRx4DiEx.js";import{E as Tt}from"./empty-state-UX_DOq42.js";import{a as $t,b as St,P as _t}from"./popover-mrQ4T9ru.js";import{c as Rt,T as Kt,a as Wt}from"./tooltip-DhlWzeQv.js";import{o as zt,O as Ft}from"./watch-sse-pool-C0me6Edt.js";import{u as Bt}from"./useQueries-CuzZgNOl.js";import{c as Le,o as st,bI as Ut,aw as ot,ax as it,az as qt,bD as Ht,ay as Ve,aH as Vt,B as lt,D as Qt,aI as ct,R as Yt,aJ as Gt,aK as Zt,z as dt,H as Xt,aL as Jt,bf as er,aM as tr,F as rr,bz as ar,Z as nr,L as sr,h as ut,bF as Qe,ar as Ye,I as or,J as ir,M as ye,Y as lr,aQ as cr,ah as dr,C as ur,ae as fr}from"./CategoricalChart-iNQ2kTf5.js";import{g as pr,b as mr,D as hr,a as ft}from"./AreaChart-BCH9fczV.js";import{u as xr,G as yr,b as vr,C as Te,X as br,Y as gr}from"./CartesianChart-BFVvuNgw.js";import{S as jr}from"./tooltipContext-BkLzQGib.js";import{R as wr}from"./ReferenceLine-ChigmKEb.js";var pt=(t,e,r,a)=>ot(t,"xAxis",e,a),mt=(t,e,r,a)=>it(t,"xAxis",e,a),ht=(t,e,r,a)=>ot(t,"yAxis",r,a),xt=(t,e,r,a)=>it(t,"yAxis",r,a),Ar=Le([st,pt,ht,mt,xt],(t,e,r,a,n)=>Ht(t,"xAxis")?Ve(e,a,!1):Ve(r,n,!1)),kr=(t,e,r,a,n)=>n;function Mr(t){return t.type==="line"}var Nr=Le([qt,kr],(t,e)=>t.filter(Mr).find(r=>r.id===e)),Cr=Le([st,pt,ht,mt,xt,Nr,Ar,Ut],(t,e,r,a,n,s,i,o)=>{var{chartData:l,dataStartIndex:f,dataEndIndex:u}=o;if(!(s==null||e==null||r==null||a==null||n==null||a.length===0||n.length===0||i==null||t!=="horizontal"&&t!=="vertical")){var{dataKey:c,data:p}=s,m;if(p!=null&&p.length>0?m=p:m=l?.slice(f,u+1),m!=null)return Vr({layout:t,xAxis:e,yAxis:r,xAxisTicks:a,yAxisTicks:n,dataKey:c,bandSize:i,displayedData:m})}}),Or=["id"],Pr=["type","layout","connectNulls","needClip","shape"],Dr=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function be(){return be=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},be.apply(null,arguments)}function Ge(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function ee(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ge(Object(r),!0).forEach(function(a){Ir(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ge(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function Ir(t,e,r){return(e=Er(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Er(t){var e=Lr(t,"string");return typeof e=="symbol"?e:e+""}function Lr(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $e(t,e){if(t==null)return{};var r,a,n=Tr(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(a=0;a<s.length;a++)r=s[a],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Tr(t,e){if(t==null)return{};var r={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;r[a]=t[a]}return r}var $r=t=>{var{dataKey:e,name:r,stroke:a,legendType:n,hide:s}=t;return[{inactive:s,dataKey:e,type:n,color:a,value:dt(r,e),payload:t}]},Sr=b.memo(t=>{var{dataKey:e,data:r,stroke:a,strokeWidth:n,fill:s,name:i,hide:o,unit:l,tooltipType:f,id:u}=t,c={dataDefinedOnItem:r,getPosition:Jt,settings:{stroke:a,strokeWidth:n,fill:s,dataKey:e,nameKey:void 0,name:dt(i,e),hide:o,type:f,color:a,unit:l,graphicalItemId:u}};return b.createElement(Xt,{tooltipEntrySettings:c})}),yt=(t,e)=>"".concat(e,"px ").concat(t,"px");function _r(t,e){for(var r=t.length%2!==0?[...t,0]:t,a=[],n=0;n<e;++n)a.push(...r);return a}var Rr=(t,e,r)=>{var a=r.reduce((p,m)=>p+m,0);if(!a)return yt(e,t);for(var n=Math.floor(t/a),s=t%a,i=[],o=0,l=0;o<r.length;l+=(f=r[o])!==null&&f!==void 0?f:0,++o){var f,u=r[o];if(u!=null&&l+u>s){i=[...r.slice(0,o),s-l];break}}var c=i.length%2===0?[0,e]:[e];return[..._r(r,n),...i,...c].map(p=>"".concat(p,"px")).join(", ")};function Kr(t){var{clipPathId:e,points:r,props:a}=t,{dot:n,dataKey:s,needClip:i}=a,{id:o}=a,l=$e(a,Or),f=ur(l);return b.createElement(hr,{points:r,dot:n,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:s,baseProps:f,needClip:i,clipPathId:e})}function Wr(t){var{showLabels:e,children:r,points:a}=t,n=b.useMemo(()=>a?.map(s=>{var i,o,l={x:(i=s.x)!==null&&i!==void 0?i:0,y:(o=s.y)!==null&&o!==void 0?o:0,width:0,lowerWidth:0,upperWidth:0,height:0};return ee(ee({},l),{},{value:s.value,payload:s.payload,viewBox:l,parentViewBox:void 0,fill:void 0})}),[a]);return b.createElement(cr,{value:e?n:void 0},r)}function Ze(t){var{clipPathId:e,pathRef:r,points:a,strokeDasharray:n,props:s}=t,{type:i,layout:o,connectNulls:l,needClip:f,shape:u}=s,c=$e(s,Pr),p=ee(ee({},dr(c)),{},{fill:"none",className:"recharts-line-curve",clipPath:f?"url(#clipPath-".concat(e,")"):void 0,points:a,type:i,layout:o,connectNulls:l,strokeDasharray:n??s.strokeDasharray});return b.createElement(b.Fragment,null,a?.length>1&&b.createElement(jr,be({shapeType:"curve",option:u},p,{pathRef:r})),b.createElement(Kr,{points:a,clipPathId:e,props:s}))}function zr(t){try{return t&&t.getTotalLength&&t.getTotalLength()||0}catch{return 0}}function Fr(t){var{clipPathId:e,props:r,pathRef:a,previousPointsRef:n,longestAnimatedLengthRef:s}=t,{points:i,strokeDasharray:o,isAnimationActive:l,animationBegin:f,animationDuration:u,animationEasing:c,animateNewValues:p,width:m,height:x,onAnimationEnd:h,onAnimationStart:y}=r,g=n.current,v=or(i,"recharts-line-"),j=b.useRef(v),[A,C]=b.useState(!1),I=!A,E=b.useCallback(()=>{typeof h=="function"&&h(),C(!1)},[h]),_=b.useCallback(()=>{typeof y=="function"&&y(),C(!0)},[y]),O=zr(a.current),w=b.useRef(0);j.current!==v&&(w.current=s.current,j.current=v);var N=w.current;return b.createElement(Wr,{points:i,showLabels:I},r.children,b.createElement(ir,{animationId:v,begin:f,duration:u,isActive:l,easing:c,onAnimationEnd:E,onAnimationStart:_,key:v},k=>{var R=ye(N,O+N,k),M=Math.min(R,O),P;if(l)if(o){var L="".concat(o).split(/[,\s]+/gim).map(D=>parseFloat(D));P=Rr(M,O,L)}else P=yt(O,M);else P=o==null?void 0:String(o);if(k>0&&O>0&&(n.current=i,s.current=Math.max(s.current,M)),g){var S=g.length/i.length,$=k===1?i:i.map((D,z)=>{var K=Math.floor(z*S);if(g[K]){var F=g[K];return ee(ee({},D),{},{x:ye(F.x,D.x,k),y:ye(F.y,D.y,k)})}return p?ee(ee({},D),{},{x:ye(m*2,D.x,k),y:ye(x/2,D.y,k)}):ee(ee({},D),{},{x:D.x,y:D.y})});return n.current=$,b.createElement(Ze,{props:r,points:$,clipPathId:e,pathRef:a,strokeDasharray:P})}return b.createElement(Ze,{props:r,points:i,clipPathId:e,pathRef:a,strokeDasharray:P})}),b.createElement(lr,{label:r.label}))}function Br(t){var{clipPathId:e,props:r}=t,a=b.useRef(null),n=b.useRef(0),s=b.useRef(null);return b.createElement(Fr,{props:r,clipPathId:e,previousPointsRef:a,longestAnimatedLengthRef:n,pathRef:s})}var Ur=(t,e)=>{var r,a;return{x:(r=t.x)!==null&&r!==void 0?r:void 0,y:(a=t.y)!==null&&a!==void 0?a:void 0,value:t.value,errorVal:ut(t.payload,e)}};class qr extends b.Component{render(){var{hide:e,dot:r,points:a,className:n,xAxisId:s,yAxisId:i,top:o,left:l,width:f,height:u,id:c,needClip:p,zIndex:m}=this.props;if(e)return null;var x=Mt("recharts-line",n),h=c,{r:y,strokeWidth:g}=pr(r),v=ar(r),j=y*2+g,A=p?"url(#clipPath-".concat(v?"":"dots-").concat(h,")"):void 0;return b.createElement(nr,{zIndex:m},b.createElement(sr,{className:x},p&&b.createElement("defs",null,b.createElement(yr,{clipPathId:h,xAxisId:s,yAxisId:i}),!v&&b.createElement("clipPath",{id:"clipPath-dots-".concat(h)},b.createElement("rect",{x:l-j/2,y:o-j/2,width:f+j,height:u+j}))),b.createElement(Pt,{xAxisId:s,yAxisId:i,data:a,dataPointFormatter:Ur,errorBarOffset:0},b.createElement(Br,{props:this.props,clipPathId:h}))),b.createElement(mr,{activeDot:this.props.activeDot,points:a,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:A}))}}var vt={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Qt.line,type:"linear"};function Hr(t){var e=lt(t,vt),{activeDot:r,animateNewValues:a,animationBegin:n,animationDuration:s,animationEasing:i,connectNulls:o,dot:l,hide:f,isAnimationActive:u,label:c,legendType:p,xAxisId:m,yAxisId:x,id:h}=e,y=$e(e,Dr),{needClip:g}=xr(m,x),v=er(),j=tr(),A=ct(),C=rr(w=>Cr(w,m,x,A,h));if(j!=="horizontal"&&j!=="vertical"||C==null||v==null)return null;var{height:I,width:E,x:_,y:O}=v;return b.createElement(qr,be({},y,{id:h,connectNulls:o,dot:l,activeDot:r,animateNewValues:a,animationBegin:n,animationDuration:s,animationEasing:i,isAnimationActive:u,hide:f,label:c,legendType:p,xAxisId:m,yAxisId:x,points:C,layout:j,height:I,width:E,left:_,top:O,needClip:g}))}function Vr(t){var{layout:e,xAxis:r,yAxis:a,xAxisTicks:n,yAxisTicks:s,dataKey:i,bandSize:o,displayedData:l}=t;return l.map((f,u)=>{var c=ut(f,i);if(e==="horizontal"){var p=Qe({axis:r,ticks:n,bandSize:o,entry:f,index:u}),m=Ye(c)?null:a.scale.map(c);return{x:p,y:m??null,value:c,payload:f}}var x=Ye(c)?null:r.scale.map(c),h=Qe({axis:a,ticks:s,bandSize:o,entry:f,index:u});return x==null||h==null?null:{x,y:h,value:c,payload:f}}).filter(Boolean)}function Qr(t){var e=lt(t,vt),r=ct();return b.createElement(Yt,{id:e.id,type:"line"},a=>b.createElement(b.Fragment,null,b.createElement(Gt,{legendPayload:$r(e)}),b.createElement(Sr,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:a}),b.createElement(Zt,{type:"line",id:a,data:e.data,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,dataKey:e.dataKey,hide:e.hide,isPanorama:r}),b.createElement(Hr,be({},e,{id:a}))))}var H=b.memo(Qr,Vt);H.displayName="Line";var Yr=["axis"],Se=b.forwardRef((t,e)=>b.createElement(vr,{chartName:"ComposedChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Yr,tooltipPayloadSearcher:fr,categoricalChartProps:t,ref:e}));const Gr=b.createContext(void 0),ke=()=>b.useContext(Gr),Ne=5*6e4;async function he(t,e){const r=await fetch(t,{signal:e}),a=await r.json().catch(()=>({}));if(!r.ok){const n=a&&typeof a=="object"&&"error"in a?String(a.error):`request failed (${r.status})`;throw new Error(n)}return a}const Zr=1e3;function Xr(t){if(!t)return"";try{const{subject:e}=JSON.parse(t.data);return typeof e=="string"?e:""}catch{return""}}const _e=t=>`/api/${encodeURIComponent(t)}/order-monitor/stores`;function bt(t,e){return e?`${t}${t.includes("?")?"&":"?"}org=${encodeURIComponent(e)}`:t}const Re=(t,e)=>e?`${t}@${e}`:t,Xe=new Map,Pe=new Map,Jr=()=>()=>{},Je=()=>0;function ea(t,e){let r=Xe.get(t);return r||(r=()=>{let a=Pe.get(t);if(!a){let s=null;const i=()=>{const l=s;if(s=null,!l||l.has("")){e.invalidateQueries({queryKey:ne.orderMonitor(t)});return}e.invalidateQueries({queryKey:ne.orderMonitorStores(t)}),e.invalidateQueries({queryKey:ne.orderMonitor(t),predicate:f=>l.has(String(f.queryKey[3]))})},o=l=>{s||(s=new Set,setTimeout(i,Zr)),s.add(Xr(l))};a={count:0,unsubscribe:zt.subscribe(t,o,()=>o())},Pe.set(t,a)}const n=a;return n.count++,()=>{--n.count>0||(n.unsubscribe(),Pe.delete(t))}},Xe.set(t,r)),r}function Ke(t,e){const r=U.c(4),a=Nt();let n;r[0]!==e||r[1]!==t||r[2]!==a?(n=e&&t?ea(t,a):Jr,r[0]=e,r[1]=t,r[2]=a,r[3]=n):n=r[3],b.useSyncExternalStore(n,Je,Je)}function Ba(t,e){const r=U.c(10),a=ke();Ke(t,e);let n;r[0]!==t||r[1]!==a?(n=ne.orderMonitorStores(Re(t,a)),r[0]=t,r[1]=a,r[2]=n):n=r[2];let s;r[3]!==t||r[4]!==a?(s=l=>{const{signal:f}=l;return he(bt(_e(t),a),f).then(ta)},r[3]=t,r[4]=a,r[5]=s):s=r[5];const i=e&&!!t;let o;return r[6]!==n||r[7]!==s||r[8]!==i?(o={queryKey:n,queryFn:s,enabled:i,refetchInterval:Ne,retry:!1},r[6]=n,r[7]=s,r[8]=i,r[9]=o):o=r[9],Ae(o)}function ta(t){return t.stores}function gt(t,e,r,a){const n=r?`?at=${encodeURIComponent(r)}`:"";return{queryKey:ne.orderMonitorDay(Re(t,a),e,r??"now"),queryFn:({signal:s})=>he(bt(`${_e(t)}/${encodeURIComponent(e)}/day${n}`,a),s),refetchInterval:r?!1:Ne,retry:!1}}function ra(t,e,r){const a=U.c(10),n=ke();Ke(t,!0);let s;a[0]!==r||a[1]!==e||a[2]!==t||a[3]!==n?(s=gt(t,e,r,n),a[0]=r,a[1]=e,a[2]=t,a[3]=n,a[4]=s):s=a[4];let i;a[5]!==e?(i=(l,f)=>f?.queryKey[3]===e?l:void 0,a[5]=e,a[6]=i):i=a[6];let o;return a[7]!==s||a[8]!==i?(o={...s,placeholderData:i},a[7]=s,a[8]=i,a[9]=o):o=a[9],Ae(o)}function Ua(t,e){const r=U.c(9),a=ke();Ke(t,e.length>0);let n;if(r[0]!==e||r[1]!==t||r[2]!==a){let i;r[4]!==t||r[5]!==a?(i=o=>gt(t,o.connectionId,o.at,a),r[4]=t,r[5]=a,r[6]=i):i=r[6],n=e.map(i),r[0]=e,r[1]=t,r[2]=a,r[3]=n}else n=r[3];let s;return r[7]!==n?(s={queries:n},r[7]=n,r[8]=s):s=r[8],Bt(s)}function qa(t){return he(`/api/${encodeURIComponent(t)}/order-monitor/ingest`).then(e=>e.ingestUrl)}function aa(t,e,r,a){const n=U.c(18),s=ke();let i;n[0]!==r||n[1]!==s||n[2]!==a?(i=new URLSearchParams,r&&i.set("at",r),a&&i.set("virtualMcpId",a),s&&i.set("org",s),n[0]=r,n[1]=s,n[2]=a,n[3]=i):i=n[3];const o=i.size>0?`?${i}`:"";let l;n[4]!==r||n[5]!==e||n[6]!==t||n[7]!==s||n[8]!==a?(l=ne.orderMonitorPushes(Re(t,s),e,r??"now",a??""),n[4]=r,n[5]=e,n[6]=t,n[7]=s,n[8]=a,n[9]=l):l=n[9];let f;n[10]!==e||n[11]!==t||n[12]!==o?(f=p=>{const{signal:m}=p;return he(`${_e(t)}/${encodeURIComponent(e)}/pushes${o}`,m)},n[10]=e,n[11]=t,n[12]=o,n[13]=f):f=n[13];const u=r?!1:Ne;let c;return n[14]!==l||n[15]!==f||n[16]!==u?(c={queryKey:l,queryFn:f,refetchInterval:u,retry:!1},n[14]=l,n[15]=f,n[16]=u,n[17]=c):c=n[17],Ae(c)}function Ha(t,e,r){const a=U.c(16),n=ke();let s,i,o;a[0]!==e.at||a[1]!==e.site||a[2]!==e.tz||a[3]!==t||a[4]!==n?(s=new URLSearchParams({tz:e.tz}),e.at&&s.set("at",e.at),e.site&&s.set("site",e.site),n&&s.set("org",n),o=Ae,i=ne.siteTraffic(t,s.toString()),a[0]=e.at,a[1]=e.site,a[2]=e.tz,a[3]=t,a[4]=n,a[5]=s,a[6]=i,a[7]=o):(s=a[5],i=a[6],o=a[7]);let l;a[8]!==t||a[9]!==s?(l=p=>{const{signal:m}=p;return he(`/api/${encodeURIComponent(t)}/order-monitor/traffic?${s}`,m).then(na)},a[8]=t,a[9]=s,a[10]=l):l=a[10];const f=r&&!!t,u=e.at?!1:Ne;let c;return a[11]!==i||a[12]!==l||a[13]!==f||a[14]!==u?(c={queryKey:i,queryFn:l,enabled:f,refetchInterval:u,retry:!1},a[11]=i,a[12]=l,a[13]=f,a[14]=u,a[15]=c):c=a[15],o(c)}function na(t){return t.traffic}function Va(t){const e=U.c(8);let r;e[0]!==t?(r=ne.orderMonitorAdminOrgs(t),e[0]=t,e[1]=r):r=e[1];let a;e[2]!==t?(a=i=>{const{signal:o}=i;return he(`/api/${encodeURIComponent(t)}/order-monitor/admin-orgs`,o)},e[2]=t,e[3]=a):a=e[3];const n=!!t;let s;return e[4]!==r||e[5]!==a||e[6]!==n?(s={queryKey:r,queryFn:a,enabled:n,staleTime:3e5,retry:!1},e[4]=r,e[5]=a,e[6]=n,e[7]=s):s=e[7],Ae(s)}const We=Array.from({length:24},(t,e)=>e),sa=[0,3,6,9,12,15,18,21],jt=40,Ce=8,te="var(--chart-1)",ge="var(--chart-2)",je="var(--chart-3)",we="var(--chart-4)",ve="var(--chart-5)",et=["bg-chart-1","bg-chart-2","bg-chart-3","bg-chart-4","bg-chart-5"],oa={ok:"success",warning:"warning",alert:"destructive","low-volume":"muted"};function ia(t,e){switch(t){case"ok":return e("orderMonitor.status.ok");case"warning":return e("orderMonitor.status.warning");case"alert":return e("orderMonitor.status.alert");case"low-volume":return e("orderMonitor.status.lowVolume")}}function la(t,e){switch(t){case"orders_drop":return e("orderMonitor.rule.ordersDrop");case"denied_spike":return e("orderMonitor.rule.deniedSpike");case"cancel_spike":return e("orderMonitor.rule.cancelSpike")}}function wt(t){const e=U.c(6),{status:r}=t,a=re(),n=oa[r];let s;e[0]!==r||e[1]!==a?(s=ia(r,a),e[0]=r,e[1]=a,e[2]=s):s=e[2];let i;return e[3]!==n||e[4]!==s?(i=d.jsx(Et,{variant:n,children:s}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i}function me(t){const e=(t+96)%96*15;return`${String(Math.floor(e/60)).padStart(2,"0")}:${String(e%60).padStart(2,"0")}`}const se=t=>`${String(t).padStart(2,"0")}:00`;function tt(t,e){const r=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(t).map(n=>[n.type,n.value]));return Date.UTC(Number(r.year),Number(r.month)-1,Number(r.day),Number(r.hour),Number(r.minute),Number(r.second))-Math.floor(t.getTime()/1e3)*1e3}function ca(t,e,r){const a=Date.parse(`${t}T${e}Z`),n=a-tt(new Date(a),r);return new Date(a-tt(new Date(n),r)).toISOString()}const da=(t,e)=>t.toLocaleDateString("en-CA",{timeZone:e}),ua="2000-01-01",fa=t=>t.reduce((e,r)=>e+(r??0),0);function At(t,e){if(e<=0)return"—";const r=Math.round((t/e-1)*100);return`${r>0?"+":""}${r}%`}function pa(t){const e=U.c(26),{day:r}=t,a=re(),n=r.verdicts.orders_drop;let s,i,o;if(e[0]!==r.headline.d1||e[1]!==r.headline.projected||e[2]!==r.headline.w1||e[3]!==r.headline.y1||e[4]!==a){const u=[{label:a("orderMonitor.series.d1"),total:r.headline.d1},{label:a("orderMonitor.series.w1"),total:r.headline.w1},{label:a("orderMonitor.series.y1"),total:r.headline.y1}];s="flex flex-wrap items-end gap-6";let c;e[8]!==a?(c=a("orderMonitor.projected"),e[8]=a,e[9]=c):c=e[9];let p;e[10]!==c?(p=d.jsx("p",{className:"text-xs text-muted-foreground",children:c}),e[10]=c,e[11]=p):p=e[11];let m;e[12]!==r.headline.projected?(m=Math.round(r.headline.projected).toLocaleString(),e[12]=r.headline.projected,e[13]=m):m=e[13];let x;e[14]!==m?(x=d.jsx("p",{className:"text-2xl font-semibold tabular-nums text-foreground",children:m}),e[14]=m,e[15]=x):x=e[15],e[16]!==p||e[17]!==x?(i=d.jsxs("div",{children:[p,x]}),e[16]=p,e[17]=x,e[18]=i):i=e[18],o=u.map(h=>d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-muted-foreground",children:h.label}),d.jsxs("p",{className:"text-sm tabular-nums text-foreground",children:[h.total.toLocaleString()," ",d.jsx("span",{className:"text-muted-foreground",children:At(r.headline.projected,h.total)})]})]},h.label)),e[0]=r.headline.d1,e[1]=r.headline.projected,e[2]=r.headline.w1,e[3]=r.headline.y1,e[4]=a,e[5]=s,e[6]=i,e[7]=o}else s=e[5],i=e[6],o=e[7];let l;e[19]!==n.status?(l=d.jsx("div",{className:"flex items-center gap-2",children:d.jsx(wt,{status:n.status})}),e[19]=n.status,e[20]=l):l=e[20];let f;return e[21]!==s||e[22]!==i||e[23]!==o||e[24]!==l?(f=d.jsxs("div",{className:s,children:[i,o,l]}),e[21]=s,e[22]=i,e[23]=o,e[24]=l,e[25]=f):f=e[25],f}function rt(t){const e=U.c(10),{pushes:r}=t,a=re();let n,s,i;if(e[0]!==r?.repos||e[1]!==a){i=Symbol.for("react.early_return_sentinel");e:{const l=(r?.repos??[]).filter(ha);if(l.length===0){i=null;break e}n="flex flex-col gap-1";let f;e[5]!==a?(f=(u,c)=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"relative h-4 flex-1 border-b border-dashed border-border",style:{marginLeft:jt,marginRight:Ce},children:u.markers.map(p=>d.jsxs(Rt,{children:[d.jsx(Kt,{asChild:!0,children:d.jsx("button",{type:"button","aria-label":a("orderMonitor.pushAt",{repo:u.name,time:me(p.bucket)}),className:nt("absolute top-1/2 size-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full",et[c%et.length]),style:{left:`${p.bucket/96*100}%`}})}),d.jsxs(Wt,{className:"max-w-80",children:[d.jsxs("p",{className:"font-medium",children:[u.name," · ",me(p.bucket)]}),p.commits.map(ma)]})]},p.bucket))}),d.jsx("span",{className:"w-32 shrink-0 truncate text-xs text-muted-foreground",children:u.name})]},u.repositoryId),e[5]=a,e[6]=f):f=e[6],s=l.map(f)}e[0]=r?.repos,e[1]=a,e[2]=n,e[3]=s,e[4]=i}else n=e[2],s=e[3],i=e[4];if(i!==Symbol.for("react.early_return_sentinel"))return i;let o;return e[7]!==n||e[8]!==s?(o=d.jsx("div",{className:n,children:s}),e[7]=n,e[8]=s,e[9]=o):o=e[9],o}function ma(t){return d.jsxs("p",{className:"truncate",children:[t.message," ",d.jsxs("span",{className:"opacity-70",children:["— ",t.author]})]},t.sha)}function ha(t){return t.markers.length>0}function kt(t){return(t?.repos??[]).flatMap(e=>e.markers.map(r=>d.jsx(wr,{x:r.bucket/4,stroke:"var(--muted-foreground)",strokeDasharray:"2 3",strokeOpacity:.6},`${e.repositoryId}:${r.bucket}`)))}const ze=d.jsx(br,{dataKey:"x",type:"number",domain:[0,24],ticks:sa,tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:t=>se(t)}),Fe=d.jsx(gr,{tickLine:!1,axisLine:!1,width:jt,allowDecimals:!1});function xa(t){if(!Array.isArray(t))return null;const e=t[0];if(!e||typeof e!="object"||!("payload"in e))return null;const r=e.payload;return r&&typeof r=="object"&&"x"in r?Number(r.x):null}function Be(t,e){const r=e%4,a=r>0?Math.floor(e/4):null;return{full:t.map((n,s)=>s===a?null:n),pace:t.map((n,s)=>a===null||n===null?null:s===a?Math.round(n*4/r):s===a-1?n:null)}}function Ue(t){const e=t.done%4*15;return{hour:e>0?Math.floor(t.done/4):null,minutes:e}}function qe(t,e){return d.jsx(Dt,{content:({active:r,payload:a,label:n})=>d.jsx(It,{active:r,label:n,payload:a?.filter(s=>!t(s)),labelFormatter:(s,i)=>{const o=xa(i);return o===null?null:e(o)}})})}function ya(t){const e=U.c(92),{day:r,pushes:a}=t,n=re(),{orders:s}=r,i=Math.floor(r.done/4);let o,l,f,u,c,p,m,x,h,y;if(e[0]!==i||e[1]!==r||e[2]!==s.alertAt||e[3]!==s.d1||e[4]!==s.expected||e[5]!==s.today||e[6]!==s.w1||e[7]!==s.warnAt||e[8]!==s.y1||e[9]!==n){const k=Ue(r),R=r.verdicts.orders_drop;let M;if(e[20]!==i||e[21]!==r.done||e[22]!==s.alertAt||e[23]!==s.d1||e[24]!==s.expected||e[25]!==s.today||e[26]!==s.w1||e[27]!==s.warnAt||e[28]!==s.y1){const B=Be(s.today,r.done);M=We.map(W=>{const X=s.warnAt[W],J=s.alertAt[W];return{x:W,today:B.full[W],pace:B.pace[W],d1:s.d1[W],w1:s.w1[W],y1:s.y1[W],expected:W<=i?s.expected[W]:null,projection:W>=i&&i<24?s.expected[W]:null,band:X!=null&&J!==null&&J!==void 0?[J,X]:null}}),e[20]=i,e[21]=r.done,e[22]=s.alertAt,e[23]=s.d1,e[24]=s.expected,e[25]=s.today,e[26]=s.w1,e[27]=s.warnAt,e[28]=s.y1,e[29]=M}else M=e[29];const P=M;l=Ee;let L;e[30]!==n?(L=n("orderMonitor.series.today"),e[30]=n,e[31]=L):L=e[31];let S;e[32]!==L?(S={label:L,color:te},e[32]=L,e[33]=S):S=e[33];let $;e[34]!==n?($=n("orderMonitor.series.d1"),e[34]=n,e[35]=$):$=e[35];let D;e[36]!==$?(D={label:$,color:ge},e[36]=$,e[37]=D):D=e[37];let z;e[38]!==n?(z=n("orderMonitor.series.w1"),e[38]=n,e[39]=z):z=e[39];let K;e[40]!==z?(K={label:z,color:je},e[40]=z,e[41]=K):K=e[41];let F;e[42]!==n?(F=n("orderMonitor.series.y1"),e[42]=n,e[43]=F):F=e[43];let q;e[44]!==F?(q={label:F,color:we},e[44]=F,e[45]=q):q=e[45];let ae;e[46]!==n?(ae=n("orderMonitor.series.expected"),e[46]=n,e[47]=ae):ae=e[47];let V;e[48]!==ae?(V={label:ae,color:ve},e[48]=ae,e[49]=V):V=e[49];let Q;e[50]!==n?(Q=n("orderMonitor.series.projection"),e[50]=n,e[51]=Q):Q=e[51];let Y;e[52]!==Q?(Y={label:Q,color:ve},e[52]=Q,e[53]=Y):Y=e[53];let G;e[54]!==n?(G=n("orderMonitor.series.pace"),e[54]=n,e[55]=G):G=e[55];let Z;e[56]!==G?(Z={label:G,color:te},e[56]=G,e[57]=Z):Z=e[57],e[58]!==S||e[59]!==D||e[60]!==K||e[61]!==q||e[62]!==V||e[63]!==Y||e[64]!==Z?(h={today:S,d1:D,w1:K,y1:q,expected:V,projection:Y,pace:Z},e[58]=S,e[59]=D,e[60]=K,e[61]=q,e[62]=V,e[63]=Y,e[64]=Z,e[65]=h):h=e[65],y="h-72 w-full",o=Se,f=P,e[66]===Symbol.for("react.memo_cache_sentinel")?(u={top:8,right:Ce,bottom:0,left:0},c=d.jsx(Te,{vertical:!1}),e[66]=u,e[67]=c):(u=e[66],c=e[67]),p=ze,m=Fe,x=qe(B=>B.dataKey==="pace"&&B.payload?.x!==k.hour||B.dataKey==="projection"&&B.payload?.x===i,B=>B===k.hour?n("orderMonitor.partialHour",{hour:se(B),minutes:k.minutes}):B===Math.floor(R.from/4)?n("orderMonitor.verdictWindow",{hour:se(B),from:me(R.from),to:me(R.to),observed:R.observed,expected:Math.round(R.expected)}):se(B)),e[0]=i,e[1]=r,e[2]=s.alertAt,e[3]=s.d1,e[4]=s.expected,e[5]=s.today,e[6]=s.w1,e[7]=s.warnAt,e[8]=s.y1,e[9]=n,e[10]=o,e[11]=l,e[12]=f,e[13]=u,e[14]=c,e[15]=p,e[16]=m,e[17]=x,e[18]=h,e[19]=y}else o=e[10],l=e[11],f=e[12],u=e[13],c=e[14],p=e[15],m=e[16],x=e[17],h=e[18],y=e[19];let g;e[68]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx(ft,{dataKey:"band",stroke:"none",fill:"var(--warning)",fillOpacity:.15,tooltipType:"none",isAnimationActive:!1}),e[68]=g):g=e[68];let v;e[69]!==a?(v=kt(a),e[69]=a,e[70]=v):v=e[70];let j,A,C,I,E,_,O;e[71]===Symbol.for("react.memo_cache_sentinel")?(j=d.jsx(H,{dataKey:"y1",stroke:we,strokeWidth:1.5,strokeOpacity:.6,dot:!1}),A=d.jsx(H,{dataKey:"w1",stroke:je,strokeWidth:1.5,strokeOpacity:.7,dot:!1}),C=d.jsx(H,{dataKey:"d1",stroke:ge,strokeWidth:1.5,strokeOpacity:.8,dot:!1}),I=d.jsx(H,{dataKey:"expected",stroke:ve,strokeWidth:1.5,dot:!1}),E=d.jsx(H,{dataKey:"projection",stroke:ve,strokeWidth:1.5,strokeDasharray:"4 4",dot:!1}),_=d.jsx(H,{dataKey:"today",stroke:te,strokeWidth:2.5,dot:!1}),O=d.jsx(H,{dataKey:"pace",stroke:te,strokeWidth:2.5,strokeDasharray:"4 4",dot:!1}),e[71]=j,e[72]=A,e[73]=C,e[74]=I,e[75]=E,e[76]=_,e[77]=O):(j=e[71],A=e[72],C=e[73],I=e[74],E=e[75],_=e[76],O=e[77]);let w;e[78]!==o||e[79]!==f||e[80]!==v||e[81]!==u||e[82]!==c||e[83]!==p||e[84]!==m||e[85]!==x?(w=d.jsxs(o,{data:f,margin:u,children:[c,p,m,x,g,v,j,A,C,I,E,_,O]}),e[78]=o,e[79]=f,e[80]=v,e[81]=u,e[82]=c,e[83]=p,e[84]=m,e[85]=x,e[86]=w):w=e[86];let N;return e[87]!==l||e[88]!==w||e[89]!==h||e[90]!==y?(N=d.jsx(l,{config:h,className:y,children:w}),e[87]=l,e[88]=w,e[89]=h,e[90]=y,e[91]=N):N=e[91],N}function va(t){const e=U.c(111),{day:r,pushes:a}=t,n=re(),[s,i]=b.useState("canceled"),{cancellations:o}=r,l=o[s];let f,u,c,p,m,x,h,y,g,v,j,A,C;if(e[0]!==o.approximate||e[1]!==o.canceledAlertAt||e[2]!==o.canceledWarnAt||e[3]!==r||e[4]!==s||e[5]!==l.d1||e[6]!==l.today||e[7]!==l.w1||e[8]!==l.y1||e[9]!==n){const z=Be(l.today,r.done),K=Ue(r);c=o.approximate;let F;e[23]!==n?(F=(T,xe)=>xe?`${T} (${n("orderMonitor.approximate")})`:T,e[23]=n,e[24]=F):F=e[24];const q=F,ae=We.map(T=>{const xe=o.canceledWarnAt[T],Oe=o.canceledAlertAt[T];return{x:T,today:z.full[T],pace:z.pace[T],d1:l.d1[T],w1:l.w1[T],y1:l.y1[T],band:s==="canceled"&&xe!==null&&xe!==void 0&&Oe!==null&&Oe!==void 0?[xe,Oe]:null}});let V;e[25]!==n?(V=n("orderMonitor.canceled"),e[25]=n,e[26]=V):V=e[26];let Q;e[27]!==V?(Q={id:"canceled",label:V},e[27]=V,e[28]=Q):Q=e[28];let Y;e[29]!==n?(Y=n("orderMonitor.denied"),e[29]=n,e[30]=Y):Y=e[30];let G;e[31]!==Y?(G={id:"denied",label:Y},e[31]=Y,e[32]=G):G=e[32];let Z;e[33]!==Q||e[34]!==G?(Z=[Q,G],e[33]=Q,e[34]=G,e[35]=Z):Z=e[35];const B=Z;C="flex flex-col gap-2",e[36]!==s||e[37]!==B?(m=d.jsx("div",{className:"flex items-center gap-0.5 self-start rounded-lg border border-border p-0.5",children:B.map(T=>d.jsx("button",{type:"button","aria-pressed":s===T.id,onClick:()=>i(T.id),className:nt("rounded-lg px-3 py-1 text-xs font-medium transition-colors",s===T.id?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:T.label},T.id))}),e[36]=s,e[37]=B,e[38]=m):m=e[38],u=Ee;let W;e[39]!==n?(W=n("orderMonitor.series.today"),e[39]=n,e[40]=W):W=e[40];let X;e[41]!==W?(X={label:W,color:te},e[41]=W,e[42]=X):X=e[42];let J;e[43]!==n?(J=n("orderMonitor.series.pace"),e[43]=n,e[44]=J):J=e[44];let ie;e[45]!==J?(ie={label:J,color:te},e[45]=J,e[46]=ie):ie=e[46];let le;e[47]!==c.d1||e[48]!==n||e[49]!==q?(le=q(n("orderMonitor.series.d1"),c.d1),e[47]=c.d1,e[48]=n,e[49]=q,e[50]=le):le=e[50];let ce;e[51]!==le?(ce={label:le,color:ge},e[51]=le,e[52]=ce):ce=e[52];let de;e[53]!==c.w1||e[54]!==n||e[55]!==q?(de=q(n("orderMonitor.series.w1"),c.w1),e[53]=c.w1,e[54]=n,e[55]=q,e[56]=de):de=e[56];let ue;e[57]!==de?(ue={label:de,color:je},e[57]=de,e[58]=ue):ue=e[58];let fe;e[59]!==c.y1||e[60]!==n||e[61]!==q?(fe=q(n("orderMonitor.series.y1"),c.y1),e[59]=c.y1,e[60]=n,e[61]=q,e[62]=fe):fe=e[62];let pe;e[63]!==fe?(pe={label:fe,color:we},e[63]=fe,e[64]=pe):pe=e[64],e[65]!==X||e[66]!==ie||e[67]!==ce||e[68]!==ue||e[69]!==pe?(j={today:X,pace:ie,d1:ce,w1:ue,y1:pe},e[65]=X,e[66]=ie,e[67]=ce,e[68]=ue,e[69]=pe,e[70]=j):j=e[70],A="h-56 w-full",f=Se,p=ae,e[71]===Symbol.for("react.memo_cache_sentinel")?(x={top:8,right:Ce,bottom:0,left:0},h=d.jsx(Te,{vertical:!1}),e[71]=x,e[72]=h):(x=e[71],h=e[72]),y=ze,g=Fe,v=qe(T=>T.dataKey==="pace"&&T.payload?.x!==K.hour,T=>T===K.hour?n("orderMonitor.partialHour",{hour:se(T),minutes:K.minutes}):se(T)),e[0]=o.approximate,e[1]=o.canceledAlertAt,e[2]=o.canceledWarnAt,e[3]=r,e[4]=s,e[5]=l.d1,e[6]=l.today,e[7]=l.w1,e[8]=l.y1,e[9]=n,e[10]=f,e[11]=u,e[12]=c,e[13]=p,e[14]=m,e[15]=x,e[16]=h,e[17]=y,e[18]=g,e[19]=v,e[20]=j,e[21]=A,e[22]=C}else f=e[10],u=e[11],c=e[12],p=e[13],m=e[14],x=e[15],h=e[16],y=e[17],g=e[18],v=e[19],j=e[20],A=e[21],C=e[22];let I;e[73]===Symbol.for("react.memo_cache_sentinel")?(I=d.jsx(ft,{dataKey:"band",stroke:"none",fill:"var(--warning)",fillOpacity:.15,tooltipType:"none",isAnimationActive:!1}),e[73]=I):I=e[73];let E;e[74]!==a?(E=kt(a),e[74]=a,e[75]=E):E=e[75];const _=c.y1?"4 4":void 0;let O;e[76]!==_?(O=d.jsx(H,{dataKey:"y1",stroke:we,strokeWidth:1.5,strokeOpacity:.6,strokeDasharray:_,dot:!1}),e[76]=_,e[77]=O):O=e[77];const w=c.w1?"4 4":void 0;let N;e[78]!==w?(N=d.jsx(H,{dataKey:"w1",stroke:je,strokeWidth:1.5,strokeOpacity:.7,strokeDasharray:w,dot:!1}),e[78]=w,e[79]=N):N=e[79];const k=c.d1?"4 4":void 0;let R;e[80]!==k?(R=d.jsx(H,{dataKey:"d1",stroke:ge,strokeWidth:1.5,strokeOpacity:.8,strokeDasharray:k,dot:!1}),e[80]=k,e[81]=R):R=e[81];let M,P;e[82]===Symbol.for("react.memo_cache_sentinel")?(M=d.jsx(H,{dataKey:"today",stroke:te,strokeWidth:2.5,dot:!1}),P=d.jsx(H,{dataKey:"pace",stroke:te,strokeWidth:2.5,strokeDasharray:"4 4",dot:!1}),e[82]=M,e[83]=P):(M=e[82],P=e[83]);let L;e[84]!==f||e[85]!==p||e[86]!==E||e[87]!==O||e[88]!==N||e[89]!==R||e[90]!==x||e[91]!==h||e[92]!==y||e[93]!==g||e[94]!==v?(L=d.jsxs(f,{data:p,margin:x,children:[h,y,g,v,I,E,O,N,R,M,P]}),e[84]=f,e[85]=p,e[86]=E,e[87]=O,e[88]=N,e[89]=R,e[90]=x,e[91]=h,e[92]=y,e[93]=g,e[94]=v,e[95]=L):L=e[95];let S;e[96]!==u||e[97]!==L||e[98]!==j||e[99]!==A?(S=d.jsx(u,{config:j,className:A,children:L}),e[96]=u,e[97]=L,e[98]=j,e[99]=A,e[100]=S):S=e[100];let $;e[101]!==c.d1||e[102]!==c.w1||e[103]!==c.y1||e[104]!==n?($=(c.d1||c.w1||c.y1)&&d.jsx("p",{className:"text-xs text-muted-foreground",children:n("orderMonitor.approximateNote")}),e[101]=c.d1,e[102]=c.w1,e[103]=c.y1,e[104]=n,e[105]=$):$=e[105];let D;return e[106]!==m||e[107]!==S||e[108]!==$||e[109]!==C?(D=d.jsxs("div",{className:C,children:[m,S,$]}),e[106]=m,e[107]=S,e[108]=$,e[109]=C,e[110]=D):D=e[110],D}const oe=t=>`var(--chart-${t%5+1})`;function Me(t,e){return t.name??e("orderMonitor.channelFallback",{id:t.id||"—"})}function ba(t){const e=U.c(58),{day:r}=t,a=re(),{channels:n}=r;let s,i,o,l,f,u,c,p,m,x,h;if(e[0]!==n||e[1]!==r||e[2]!==a){const I=Ue(r);let E;if(e[14]!==n||e[15]!==r.done){let w;e[17]!==r.done?(w=k=>Be(k.today,r.done),e[17]=r.done,e[18]=w):w=e[18];const N=n.map(w);E=We.map(k=>({x:k,...Object.fromEntries(n.flatMap((R,M)=>[[`c${M}`,N[M].full[k]],[`p${M}`,N[M].pace[k]],[`d${M}`,R.d1[k]]]))})),e[14]=n,e[15]=r.done,e[16]=E}else E=e[16];const _=E;let O;if(e[19]!==n||e[20]!==a){let w;e[22]!==a?(w=(N,k)=>d.jsxs("div",{className:"flex flex-col gap-1 rounded-lg border border-border p-3",children:[d.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-foreground",children:[d.jsx("span",{className:"h-0.5 w-3 shrink-0 rounded-full",style:{backgroundColor:oe(k)}}),d.jsx("span",{className:"truncate",children:Me(N,a)}),N.name&&d.jsxs("span",{className:"text-muted-foreground",children:["#",N.id]})]}),d.jsxs("span",{className:"text-sm tabular-nums text-foreground",children:[N.soFar.toLocaleString()," ",d.jsx("span",{className:"text-xs text-muted-foreground",children:a("orderMonitor.vsD1SameTime",{pct:At(N.soFar,N.d1SoFar)})})]})]},N.id),e[22]=a,e[23]=w):w=e[23],O=n.map(w),e[19]=n,e[20]=a,e[21]=O}else O=e[21];if(e[24]!==O?(h=d.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3",children:O}),e[24]=O,e[25]=h):h=e[25],i=Ee,e[26]!==n||e[27]!==a){let w;e[29]!==a?(w=(N,k)=>[[`c${k}`,{label:Me(N,a),color:oe(k)}],[`p${k}`,{label:`${Me(N,a)} · ${a("orderMonitor.series.pace")}`,color:oe(k)}],[`d${k}`,{label:a("orderMonitor.channelD1",{channel:Me(N,a)}),color:oe(k)}]],e[29]=a,e[30]=w):w=e[30],m=Object.fromEntries(n.flatMap(w)),e[26]=n,e[27]=a,e[28]=m}else m=e[28];x="h-56 w-full",s=Se,o=_,e[31]===Symbol.for("react.memo_cache_sentinel")?(l={top:8,right:Ce,bottom:0,left:0},f=d.jsx(Te,{vertical:!1}),e[31]=l,e[32]=f):(l=e[31],f=e[32]),u=ze,c=Fe,p=qe(w=>String(w.dataKey).startsWith("p")&&w.payload?.x!==I.hour,w=>w===I.hour?a("orderMonitor.partialHour",{hour:se(w),minutes:I.minutes}):se(w)),e[0]=n,e[1]=r,e[2]=a,e[3]=s,e[4]=i,e[5]=o,e[6]=l,e[7]=f,e[8]=u,e[9]=c,e[10]=p,e[11]=m,e[12]=x,e[13]=h}else s=e[3],i=e[4],o=e[5],l=e[6],f=e[7],u=e[8],c=e[9],p=e[10],m=e[11],x=e[12],h=e[13];let y;e[33]!==n?(y=n.map(wa),e[33]=n,e[34]=y):y=e[34];let g;e[35]!==n?(g=n.map(ja),e[35]=n,e[36]=g):g=e[36];let v;e[37]!==n?(v=n.map(ga),e[37]=n,e[38]=v):v=e[38];let j;e[39]!==s||e[40]!==o||e[41]!==y||e[42]!==g||e[43]!==v||e[44]!==l||e[45]!==f||e[46]!==u||e[47]!==c||e[48]!==p?(j=d.jsxs(s,{data:o,margin:l,children:[f,u,c,p,y,g,v]}),e[39]=s,e[40]=o,e[41]=y,e[42]=g,e[43]=v,e[44]=l,e[45]=f,e[46]=u,e[47]=c,e[48]=p,e[49]=j):j=e[49];let A;e[50]!==i||e[51]!==j||e[52]!==m||e[53]!==x?(A=d.jsx(i,{config:m,className:x,children:j}),e[50]=i,e[51]=j,e[52]=m,e[53]=x,e[54]=A):A=e[54];let C;return e[55]!==A||e[56]!==h?(C=d.jsxs(d.Fragment,{children:[h,A]}),e[55]=A,e[56]=h,e[57]=C):C=e[57],C}function ga(t,e){return d.jsx(H,{dataKey:`p${e}`,stroke:oe(e),strokeWidth:2,strokeDasharray:"4 4",dot:!1},`p${t.id}`)}function ja(t,e){return d.jsx(H,{dataKey:`c${e}`,stroke:oe(e),strokeWidth:2,dot:!1},t.id)}function wa(t,e){return d.jsx(H,{dataKey:`d${e}`,stroke:oe(e),strokeWidth:1.5,strokeOpacity:.5,strokeDasharray:"4 4",dot:!1},`d${t.id}`)}function Aa(){const t=U.c(36),e=re();let r;t[0]!==e?(r=e("orderMonitor.series.today"),t[0]=e,t[1]=r):r=t[1];let a;t[2]!==r?(a={label:r,color:te},t[2]=r,t[3]=a):a=t[3];let n;t[4]!==e?(n=e("orderMonitor.series.d1"),t[4]=e,t[5]=n):n=t[5];let s;t[6]!==n?(s={label:n,color:ge},t[6]=n,t[7]=s):s=t[7];let i;t[8]!==e?(i=e("orderMonitor.series.w1"),t[8]=e,t[9]=i):i=t[9];let o;t[10]!==i?(o={label:i,color:je},t[10]=i,t[11]=o):o=t[11];let l;t[12]!==e?(l=e("orderMonitor.series.y1"),t[12]=e,t[13]=l):l=t[13];let f;t[14]!==l?(f={label:l,color:we},t[14]=l,t[15]=f):f=t[15];let u;t[16]!==e?(u=e("orderMonitor.series.expected"),t[16]=e,t[17]=u):u=t[17];let c;t[18]!==u?(c={label:u,color:ve},t[18]=u,t[19]=c):c=t[19];let p;t[20]!==a||t[21]!==s||t[22]!==o||t[23]!==f||t[24]!==c?(p=[a,s,o,f,c],t[20]=a,t[21]=s,t[22]=o,t[23]=f,t[24]=c,t[25]=p):p=t[25];const m=p;let x;t[26]!==m?(x=m.map(ka),t[26]=m,t[27]=x):x=t[27];let h;t[28]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx("span",{className:"h-2.5 w-3 rounded-sm bg-warning/20"}),t[28]=h):h=t[28];let y;t[29]!==e?(y=e("orderMonitor.thresholdBand"),t[29]=e,t[30]=y):y=t[30];let g;t[31]!==y?(g=d.jsxs("span",{className:"flex items-center gap-1.5",children:[h,y]}),t[31]=y,t[32]=g):g=t[32];let v;return t[33]!==x||t[34]!==g?(v=d.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[x,g]}),t[33]=x,t[34]=g,t[35]=v):v=t[35],v}function ka(t){return d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx("span",{className:"h-0.5 w-3 rounded-full",style:{backgroundColor:t.color}}),t.label]},t.label)}function De(t){const e=U.c(5),{title:r,children:a}=t;let n;e[0]!==r?(n=d.jsx("h3",{className:"text-sm font-medium text-foreground",children:r}),e[0]=r,e[1]=n):n=e[1];let s;return e[2]!==a||e[3]!==n?(s=d.jsxs("section",{className:"flex flex-col gap-3 surface p-4",children:[n,a]}),e[2]=a,e[3]=n,e[4]=s):s=e[4],s}const Ie=t=>new Date(`${t}T12:00:00`),Ma=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;function Na(t){const e=U.c(30),{value:r,max:a,onChange:n}=t,s=re(),[i,o]=b.useState(!1);let l,f;e[0]!==r?(l=Ie(r),f=l.toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}),e[0]=r,e[1]=l,e[2]=f):(l=e[1],f=e[2]);const u=f;let c;e[3]!==s?(c=s("orderMonitor.pickDay"),e[3]=s,e[4]=c):c=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=d.jsx(Ct,{size:14}),e[5]=p):p=e[5];let m;e[6]!==u||e[7]!==a||e[8]!==s||e[9]!==r?(m=r===a?`${s("orderMonitor.today")} · ${u}`:u,e[6]=u,e[7]=a,e[8]=s,e[9]=r,e[10]=m):m=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=d.jsx(Ot,{size:14,className:"text-muted-foreground"}),e[11]=x):x=e[11];let h;e[12]!==c||e[13]!==m?(h=d.jsx($t,{asChild:!0,children:d.jsxs(at,{variant:"outline",size:"sm","aria-label":c,className:"tnum gap-1 font-normal",children:[p,m,x]})}),e[12]=c,e[13]=m,e[14]=h):h=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=Ie(ua),e[15]=y):y=e[15];let g;e[16]!==a?(g=Ie(a),e[16]=a,e[17]=g):g=e[17];let v;e[18]!==g?(v={before:y,after:g},e[18]=g,e[19]=v):v=e[19];let j;e[20]!==n?(j=I=>{I&&(n(Ma(I)),o(!1))},e[20]=n,e[21]=j):j=e[21];let A;e[22]!==l||e[23]!==j||e[24]!==v?(A=d.jsx(St,{align:"end",className:"w-auto p-0",children:d.jsx(Lt,{mode:"single",selected:l,defaultMonth:l,disabled:v,onSelect:j,initialFocus:!0})}),e[22]=l,e[23]=j,e[24]=v,e[25]=A):A=e[25];let C;return e[26]!==i||e[27]!==A||e[28]!==h?(C=d.jsxs(_t,{open:i,onOpenChange:o,children:[h,A]}),e[26]=i,e[27]=A,e[28]=h,e[29]=C):C=e[29],C}function Qa(t){const e=U.c(83),{orgSlug:r,connectionId:a,at:n,onAtChange:s,virtualMcpId:i}=t,o=re(),l=ra(r,a,n),f=aa(r,a,n,i),u=l.data,c=f.data;if(l.isLoading){let M;return e[0]===Symbol.for("react.memo_cache_sentinel")?(M=d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsx(He,{className:"h-12 w-80"}),d.jsx(He,{className:"h-72 w-full"})]}),e[0]=M):M=e[0],M}if(!u){let M;e[1]!==o?(M=o("orderMonitor.dayErrorTitle"),e[1]=o,e[2]=M):M=e[2];let P;e[3]!==l.error?.message||e[4]!==o?(P=l.error?.message??o("orderMonitor.dayErrorBody"),e[3]=l.error?.message,e[4]=o,e[5]=P):P=e[5];let L;return e[6]!==M||e[7]!==P?(L=d.jsx(Tt,{title:M,description:P}),e[6]=M,e[7]=P,e[8]=L):L=e[8],L}let p,m,x,h,y,g;if(e[9]!==n||e[10]!==u||e[11]!==s||e[12]!==o){const M=fa(u.orders.today);g=u.verdicts;let P;e[19]!==u.timezone?(P=da(new Date,u.timezone),e[19]=u.timezone,e[20]=P):P=e[20];const L=P;x="flex flex-col gap-4";let S;e[21]!==u?(S=d.jsx(pa,{day:u}),e[21]=u,e[22]=S):S=e[22];let $;e[23]!==u.timezone||e[24]!==s||e[25]!==L?($=F=>s(F>=L?void 0:ca(F,"23:59:59",u.timezone)),e[23]=u.timezone,e[24]=s,e[25]=L,e[26]=$):$=e[26];let D;e[27]!==u.date||e[28]!==$||e[29]!==L?(D=d.jsx(Na,{value:u.date,max:L,onChange:$}),e[27]=u.date,e[28]=$,e[29]=L,e[30]=D):D=e[30];let z;e[31]!==n||e[32]!==s||e[33]!==o?(z=n&&d.jsx(at,{variant:"outline",size:"sm",onClick:()=>s(void 0),children:o("orderMonitor.backToNow")}),e[31]=n,e[32]=s,e[33]=o,e[34]=z):z=e[34];let K;e[35]!==D||e[36]!==z?(K=d.jsxs("div",{className:"flex items-center gap-2",children:[D,z]}),e[35]=D,e[36]=z,e[37]=K):K=e[37],e[38]!==K||e[39]!==S?(h=d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[S,K]}),e[38]=K,e[39]=S,e[40]=h):h=e[40],e[41]!==n||e[42]!==u.timezone||e[43]!==o?(y=n&&d.jsx("p",{className:"text-xs text-muted-foreground",children:o("orderMonitor.reviewingAt",{at:new Date(n).toLocaleString(void 0,{timeZone:u.timezone}),timezone:u.timezone})}),e[41]=n,e[42]=u.timezone,e[43]=o,e[44]=y):y=e[44],p=De,m=o("orderMonitor.ordersTitle",{count:M.toLocaleString()}),e[9]=n,e[10]=u,e[11]=s,e[12]=o,e[13]=p,e[14]=m,e[15]=x,e[16]=h,e[17]=y,e[18]=g}else p=e[13],m=e[14],x=e[15],h=e[16],y=e[17],g=e[18];let v;e[45]===Symbol.for("react.memo_cache_sentinel")?(v=d.jsx(Aa,{}),e[45]=v):v=e[45];let j;e[46]!==u||e[47]!==c?(j=d.jsx(ya,{day:u,pushes:c}),e[46]=u,e[47]=c,e[48]=j):j=e[48];let A;e[49]!==c?(A=d.jsx(rt,{pushes:c}),e[49]=c,e[50]=A):A=e[50];let C;e[51]!==p||e[52]!==m||e[53]!==j||e[54]!==A?(C=d.jsxs(p,{title:m,children:[v,j,A]}),e[51]=p,e[52]=m,e[53]=j,e[54]=A,e[55]=C):C=e[55];let I;e[56]!==u||e[57]!==o?(I=u.channels.length>1&&d.jsx(De,{title:o("orderMonitor.channelsTitle"),children:d.jsx(ba,{day:u})}),e[56]=u,e[57]=o,e[58]=I):I=e[58];let E;e[59]!==o?(E=o("orderMonitor.cancellationsTitle"),e[59]=o,e[60]=E):E=e[60];let _;e[61]!==u||e[62]!==c?(_=d.jsx(va,{day:u,pushes:c}),e[61]=u,e[62]=c,e[63]=_):_=e[63];let O;e[64]!==c?(O=d.jsx(rt,{pushes:c}),e[64]=c,e[65]=O):O=e[65];let w;e[66]!==E||e[67]!==_||e[68]!==O?(w=d.jsxs(De,{title:E,children:[_,O]}),e[66]=E,e[67]=_,e[68]=O,e[69]=w):w=e[69];let N;e[70]!==o||e[71]!==g?(N=Ft.map(M=>{const P=g[M];return d.jsxs("div",{className:"flex flex-col gap-1 rounded-lg border border-border p-3",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsx("span",{className:"text-xs font-medium text-foreground",children:la(M,o)}),d.jsx(wt,{status:P.status})]}),d.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:o("orderMonitor.observedVsExpected",{observed:P.observed,expected:Math.round(P.expected),from:me(P.from),to:me(P.to)})})]},M)}),e[70]=o,e[71]=g,e[72]=N):N=e[72];let k;e[73]!==N?(k=d.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3",children:N}),e[73]=N,e[74]=k):k=e[74];let R;return e[75]!==w||e[76]!==k||e[77]!==x||e[78]!==h||e[79]!==y||e[80]!==C||e[81]!==I?(R=d.jsxs("div",{className:x,children:[h,y,C,I,w,k]}),e[75]=w,e[76]=k,e[77]=x,e[78]=h,e[79]=y,e[80]=C,e[81]=I,e[82]=R):R=e[82],R}export{Se as C,Na as D,H as L,Gr as M,Qa as O,aa as a,Va as b,Ba as c,ke as d,Ua as e,qa as f,Ha as g,wt as h,ca as l,la as r,ra as u};