1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7852],{7852:(e,t,n)=>{n.r(t),n.d(t,{default:()=>O});var r=n(95155),a=n(12115),i=n(57549),s=n(42738),l=n(30761),o=n(83724);function c(e,t){let n=e.slice(0,4),r=Number(e.slice(5,7));switch(t){case"day":return e;case"week":return(0,o.vW)(e);case"month":return"".concat(e.slice(0,7),"-01");case"quarter":return"".concat(n,"-").concat(String(3*Math.floor((r-1)/3)+1).padStart(2,"0"),"-01");case"year":return"".concat(n,"-01-01")}}function d(e,t){switch(t){case"day":return e;case"week":return(0,l.fi)(e,6);case"month":return(0,l.p9)(e);case"quarter":return(0,l.p9)((0,l.fi)((0,l.p9)((0,l.fi)((0,l.p9)(e),1)),1));case"year":return"".concat(e.slice(0,4),"-12-31")}}function u(e,t,n){return t<n?"past":e>n?"future":"current"}function p(e,t){return null===e?t:null===t?e:e+t}function h(e,t,n){let r=new Map;for(let n of e){let e=c(n.start,t),a=r.get(e);if(!a){r.set(e,{...n,key:e,start:n.start,end:n.end,partial:!1,phase:"past"});continue}a.start=a.start<n.start?a.start:n.start,a.end=a.end>n.end?a.end:n.end,a.invoicedCents=p(a.invoicedCents,n.invoicedCents),a.invoicedCount+=n.invoicedCount,a.paidCents=p(a.paidCents,n.paidCents),a.paidCount+=n.paidCount,a.projectedCents=p(a.projectedCents,n.projectedCents),a.projectedVisits+=n.projectedVisits,a.unpricedVisits+=n.unpricedVisits,a.tradeVisits+=n.tradeVisits}return[...r.values()].sort((e,t)=>e.key<t.key?-1:+(e.key>t.key)).map(e=>({...e,partial:e.start!==e.key||e.end!==d(e.key,t),phase:u(e.start,e.end,n)}))}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=Number.isFinite(t)?Math.max(0,Math.min(24,Math.floor(t))):3,r=(0,l.p9)(e);for(let e=0;e<n;e++)r=(0,l.p9)((0,l.fi)(r,1));return r}var f=n(63578),x=n(25575),y=n(35161),v=n(64471),k=n(47734),j=n(73697),g=n(68202),b=n(43667),w=n(25010);let C=[{key:"12m",label:"12 months"},{key:"3m",label:"3 months"},{key:"30d",label:"30 days"},{key:"7d",label:"7 days"},{key:"all",label:"All"}];function N(e,t){return{from:e,to:t,spanDays:(0,l.YM)(e,t)+1}}function M(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3;switch(e){case"12m":{let e=c(t,"month");for(let t=0;t<8;t++)e=c((0,l.fi)(e,-1),"month");return N(e,m(t,r))}case"3m":return N(c((0,l.fi)(t,-69),"week"),d(c((0,l.fi)(t,20),"week"),"week"));case"30d":return N((0,l.fi)(t,-22),(0,l.fi)(t,7));case"7d":return N((0,l.fi)(t,-4),(0,l.fi)(t,2));case"all":return N(n<t?n:c(t,"month"),m(t,r))}}function D(e,t,n){let r=e.from,a=e.to;return a>n&&(r=(0,l.fi)(r,-(0,l.YM)(n,a)),a=n),r<t&&(a=(0,l.fi)(a,(0,l.YM)(r,t)),r=t),a>n&&(a=n),a<r&&(a=r),N(r,a)}function V(e,t,n,r,a){let i=Math.min((0,l.YM)(r,a)+1,Math.max(7,Math.round(e.spanDays*t))),s=(0,l.fi)(e.from,Math.round((e.spanDays-1)*n)),o=(0,l.fi)(s,-Math.round((i-1)*n));return D(N(o,(0,l.fi)(o,i-1)),r,a)}function S(e,t,n,r){return 0===t?e:D(N((0,l.fi)(e.from,t),(0,l.fi)(e.to,t)),n,r)}function T(e,t){if(0===t.length)return -1;let n=0,r=Math.abs(t[0]-e);for(let a=1;a<t.length;a++){let i=Math.abs(t[a]-e);i<r&&(n=a,r=i)}return n}function R(e){let t=new Date("".concat(e,"T00:00:00Z"));return{y:t.getUTCFullYear(),m:t.getUTCMonth(),d:t.getUTCDate(),dow:t.getUTCDay()}}function X(e){let t=R(e);return"".concat(t.d," ").concat((0,l.ev)(t.m+1))}function I(e){let t=R(e);return"".concat((0,l.eD)((0,l.WA)(t.dow))," ").concat(t.d," ").concat((0,l.ev)(t.m+1)," ").concat(t.y)}function A(e,t){let n,r=R(e.key);switch(t){case"day":return I(e.start);case"week":n="Week of ".concat(I(e.key));break;case"month":n="".concat((0,l.g6)(r.m+1)," ").concat(r.y);break;case"quarter":{let t=R(d(e.key,"quarter"));n="".concat((0,l.ev)(r.m+1)," to ").concat((0,l.ev)(t.m+1)," ").concat(r.y);break}case"year":n=String(r.y)}return e.partial?"".concat(n," (").concat(X(e.start)," to ").concat(X(e.end),")"):n}function z(e,t,n){let r=R(e.key),a=n?R(n.key):null;switch(t){case"day":return{top:String(r.d),bottom:a&&a.m===r.m?null:"".concat((0,l.ev)(r.m+1)).concat(a&&a.y===r.y?"":" ".concat(r.y))};case"week":return{top:X(e.key),bottom:a&&a.y===r.y?null:String(r.y)};case"month":return{top:(0,l.ev)(r.m+1),bottom:a&&a.y===r.y?null:String(r.y)};case"quarter":return{top:"Q".concat(Math.floor(r.m/3)+1),bottom:a&&a.y===r.y?null:String(r.y)};case"year":return{top:String(r.y),bottom:null}}}function W(e){if(e<=0)return 1e4;let t=10**Math.floor(Math.log10(e));for(let n of[1,1.2,1.6,2,2.4,3,4,5,6,8,10])if(n*t>=e)return Math.round(n*t);return 10*t}var P=n(31952);let E="text-label font-medium text-ink-soft",Y="rounded-xl border border-mist bg-paper p-2.5",L=[{key:"invoiced",word:"Invoiced",token:"var(--ink-soft)",dash:void 0},{key:"paid",word:"Paid",token:"var(--st-good)",dash:void 0},{key:"projected",word:"Projected",token:"var(--st-muted)",dash:"5 4"}];function B(e,t){return"invoiced"===e?t.invoicedCents:"paid"===e?t.paidCents:t.projectedCents}function O(e){var t,n,o,p,m,N,R,I,O,q,U,F,K,_,G,H;let{seed:$,currency:Q,initialHidden:Z=[],initialKey:J,onSelectMonth:ee,aside:et}=e,en=e=>(0,s.up)(e,{currency:Q}),[er,ea]=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:360,t=(0,a.useRef)(null),[n,r]=(0,a.useState)(e);return(0,a.useEffect)(()=>{let e=t.current;if(!e||"undefined"==typeof ResizeObserver)return;let n=new ResizeObserver(e=>{var t;let n=null==(t=e[0])?void 0:t.contentRect.width;n&&r(e=>Math.abs(n-e)>1?n:e)});return n.observe(e),()=>n.disconnect()},[]),[t,n]}(),ei=ea>=640,es=(0,a.useMemo)(()=>$.map(e=>({key:e.start,start:e.start,end:e.end,partial:!1,phase:e.phase,invoicedCents:e.invoicedCents,invoicedCount:e.invoicedCount,paidCents:e.paidCents,paidCount:e.paidCount,projectedCents:e.projectedCents,projectedVisits:e.projectedVisits,unpricedVisits:e.unpricedVisits,tradeVisits:e.tradeVisits})),[$]),el=null!=(O=null!=(I=null==(t=$.find(e=>"current"===e.phase))?void 0:t.start)?I:null==(n=$[$.length-1])?void 0:n.start)?O:"",[eo,ec]=(0,a.useState)(null),[ed,eu]=(0,a.useState)(el),[ep,eh]=(0,a.useState)(null),em=null!=(U=null!=(q=null==eo||null==(o=eo[0])?void 0:o.start)?q:null==(p=$[0])?void 0:p.start)?U:el,ef=null!=(K=null!=(F=null==eo||null==(m
1=eo[eo.length-1])?void 0:m.end)?F:null==(N=$[$.length-1])?void 0:N.end)?K:el,ex=function(e,t){if(!t)return e;let n=M("12m",t,e).from;return e&&e<n?e:n}(em,ed),[ey,ev]=(0,a.useState)("12m"),[ek,ej]=(0,a.useState)(()=>({from:em,to:ef,spanDays:em&&ef?(0,l.YM)(em,ef)+1:0})),[eg,eb]=(0,a.useState)(()=>new Set(Z)),[ew,eC]=(0,a.useState)(null!=J?J:null),[eN,eM]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=!0;return fetch("/api/shell/revenue-series?from=all&ahead=".concat(3),{credentials:"same-origin"}).then(async t=>{var n,r;if(!t.ok)throw Error("HTTP ".concat(t.status));let a=await t.json();if(!e)return;ec(a.series.buckets),eu(a.series.today),eh(null);let i=null!=(r=null==(n=a.series.buckets[0])?void 0:n.start)?r:a.series.today;ej(e=>"12m"===ey?M("12m",a.series.today,i,3):e)}).catch(t=>{e&&eh("Day detail unavailable (".concat(t instanceof Error?t.message:"read failed","); showing months."))}),()=>{e=!1}},[]);let eD=eo?(H=ek.spanDays)<=45?"day":H<=190?"week":H<=760?"month":H<=1500?"quarter":"year":"month",eV=(0,a.useMemo)(()=>{var e=eo?h(eo.filter(e=>e.start>=ek.from&&e.start<=ek.to),eD,ed):es.filter(e=>e.end>=ek.from&&e.start<=ek.to);if(!ek.from||!ek.to||ek.to<ek.from)return[...e];let t=new Map(e.map(e=>[e.key,e]));return(function(e,t,n,r){let a=[];if(!e||!t||t<e)return a;let i=c(e,n);for(;i<=t;){let s=d(i,n),o=i<e?e:i,c=s>t?t:s;a.push({key:i,start:o,end:c,partial:o!==i||c!==s,phase:u(o,c,r)}),i=(0,l.fi)(s,1)}return a})(ek.from,ek.to,eD,ed).map(e=>{var n;return null!=(n=t.get(e.key))?n:{...e,invoicedCents:null,invoicedCount:0,paidCents:null,paidCount:0,projectedCents:null,projectedVisits:0,unpricedVisits:0,tradeVisits:0}})},[eo,es,ek,eD,ed]),eS=eV.length,eT=eV.findIndex(e=>"current"===e.phase),eR=ew?eV.findIndex(e=>e.key===ew):-1;eR<0&&ew&&(eR=eV.findIndex(e=>e.start<=ew&&e.end>=ew)),eR<0&&(eR=eT>=0?eT:eS-1);let eX=null!=(_=eV[eR])?_:null,eI=e=>{let t=eV[e];t&&(eC(t.key),null==ee||ee(t.start.slice(0,7)))},eA=Math.max(300,ea),ez=ei?320:240,eW=eA-46-12,eP=ez-20-30,eE=eS>0?eW/eS:eW,eY=eV.map((e,t)=>46+(t+.5)*eE),eL=L.filter(e=>eV.some(t=>null!==B(e.key,t))),eB=(0,a.useMemo)(()=>(function(e){let t=0,n=0;for(let r of e)null!==r&&Number.isFinite(r)&&(t=Math.min(t,r),n=Math.max(n,r));return{min:t<0?-W(-t):0,max:n>0?W(n):t<0?0:1e4}})(eV.flatMap(e=>L.filter(e=>!eg.has(e.key)).map(t=>B(t.key,e)))),[eV,eg]),eO=eV.map(e=>{let t=B("paid",e),n=B("projected",e);return{key:e.key,invoiced:null==e.invoicedCents||0===e.invoicedCents?null:e.invoicedCents/100,paid:null===t?null:t/100,projected:null===n?null:n/100}}),eq=(()=>{let e=eV.map(e=>B("paid",e)).filter(e=>null!==e);if(e.length<2)return null;let t=e[0],n=e[e.length-1];return{high:Math.max(...e),low:Math.min(...e),change:t>0?Math.round((n-t)/t*100):0}})(),eU="week"===eD?36:"day"===eD?14:"year"===eD?28:22,eF=eS<=1||eW<=0?1:Math.max(1,Math.ceil((eU+4)/(eW/eS))),eK=e=>{ej(e),ev(null)},e_=(e,t)=>eK(V(ek,e,t,ex,ef)),eG=e=>{let t=eV[e];if(!t||"day"===eD)return;let n=(0,l.YM)(t.key,t.end)+1;eK(D(n>=7?{from:t.key,to:t.end,spanDays:n}:V({from:t.key,to:t.end,spanDays:n},7/n,.5,ex,ef),ex,ef)),eC(t.start)},eH=(e,t)=>{let n=t.getBoundingClientRect();return Math.min(1,Math.max(0,((e-n.left)/n.width*eA-46)/eW))},e$=(e,t)=>{let n=t.getBoundingClientRect(),r=T((e-n.left)/n.width*eA,eY);r>=0&&eI(r)},eQ=(0,a.useRef)(null),eZ=(0,a.useRef)(new Map),eJ=(0,a.useRef)(null),e0=(0,a.useRef)({at:0,x:0});(0,a.useEffect)(()=>{let e=eQ.current;if(!e)return;let t=t=>{if(t.preventDefault(),t.shiftKey||Math.abs(t.deltaX)>Math.abs(t.deltaY))return void eK(S(ek,Math.round((t.deltaX||t.deltaY)/eW*ek.spanDays),ex,ef));e_(t.deltaY>0?1.25:.8,eH(t.clientX,e))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)});let e1=e=>{let t=eZ.current.get(e.pointerId);if(eZ.current.delete(e.pointerId),eZ.current.size<2&&(eJ.current=null),!t||t.moved)return;e$(e.clientX,e.currentTarget);let n=Date.now();if(n-e0.current.at<350&&24>Math.abs(e.clientX-e0.current.x)){let t=e.currentTarget.getBoundingClientRect();eG(T((e.clientX-t.left)/t.width*eA,eY)),e0.current={at:0,x:0};return}e0.current={at:n,x:e.clientX}},e2=function(e,t,n){let r={invoicedCents:0,invoicedCount:0,paidCents:0,paidCount:0,projectedCents:0,projectedVisits:0,unpricedVisits:0,measuredDays:0};for(let a of e)a.end<t||a.start>n||(null!==a.invoicedCents&&(r.invoicedCents+=a.invoicedCents,r.invoicedCount+=a.invoicedCount,r.measuredDays+=1),null!==a.paidCents&&(r.paidCents+=a.paidCents,r.paidCount+=a.paidCount),null!==a.projectedCents&&(r.projectedCents+=a.projectedCents,r.projectedVisits+=a.projectedVisits,r.unpricedVisits+=a.unpricedVisits));return r}(null!=eo?eo:es,ek.from,ek.to),e5=eo?h(eo.filter(e=>e.start>=ek.from&&e.start<=ek.to),"month",ed):es.filter(e=>e.end>=ek.from&&e.start<=ek.to),e3=function(e){let t=t=>{let n=null;for(let r of e){let e=r[t];null!==e&&(n=(null!=n?n:0)+e)}return n};return{invoicedCents:t("invoicedCents"),paidCents:t("paidCents"),projectedCents:t("projectedCents")}}(e5),e4=e=>null===e?"Not yet measured":en(e),e6=(e,t,n)=>{let r=function(e,t,n){if(!t||e.partial||t.partial||"past"!==e.phase||"past"!==t.phase||t.end!==(0,l.fi)(e.ke
1y,-1))return null;let r=e[n],a=t[n];if(null===r||null===a)return null;let i=r-a;return{cents:i,percent:a>0?Math.round(i/a*1e3)/10:null}}(e,t,n);return r?"".concat(r.cents>0?"+":"").concat(en(r.cents)).concat(null===r.percent?"":" (".concat(r.percent>0?"+":"").concat(r.percent,"%)")):"Not comparable"},e7=ey?null!=(G=null==(R=C.find(e=>e.key===ey))?void 0:R.label)?G:"":"".concat(X(ek.from)," to ").concat(X(ek.to));if(0===$.length&&!eo)return null;let e8=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return eX?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"text-eyebrow font-semibold text-ink",children:[A(eX,eD),"current"===eX.phase?(0,r.jsx)("span",{className:"ml-1.5 font-normal text-ink-soft",children:"holds today"}):null]}),(0,r.jsx)("dl",{className:"mt-0.5 ".concat(ei&&!e?"grid grid-cols-3 gap-x-3":"space-y-0.5"),children:eL.map(e=>{let t,n=B(e.key,eX),a=null;if(null===n)t=(0,r.jsx)("span",{className:"font-sans font-normal text-ink-soft",children:"projected"===e.key?"history":"not yet"});else if("projected"===e.key){0===n&&0===eX.projectedVisits?t=(0,r.jsx)("span",{className:"font-sans font-normal text-ink-soft",children:"no priced work"}):(t=en(n),a=(0,i.r)(eX.projectedVisits,"visit"));let e=[eX.unpricedVisits>0?"".concat((0,i.r)(eX.unpricedVisits,"visit")," unpriceable"):null,eX.tradeVisits>0?"".concat((0,i.r)(eX.tradeVisits,"trade stop"),", never invoiced"):null].filter(Boolean);e.length&&(a=[a,...e].filter(Boolean).join(", "))}else t=en(n),a=(0,i.r)("invoiced"===e.key?eX.invoicedCount:eX.paidCount,"invoiced"===e.key?"invoice":"payment");let s="invoiced"===e.key?"".concat(A(eX,eD)," \xb7 Invoiced is the totals of invoices issued in this ").concat(eD,". ").concat("day"===eD?"Tap the chart to pick a day.":"For its days, scroll or pinch to zoom in."):"paid"===e.key?"".concat(A(eX,eD)," \xb7 Paid is payments received, dated by your calendar day."):"".concat(A(eX,eD)," \xb7 Projected is walked from your active recurring agreements - one visit per due date, priced at today's book - from today onward, not from invoices and not from jobs already on a run.");return(0,r.jsx)("div",{className:"flex min-w-0 items-baseline gap-1.5",children:(0,r.jsxs)(f.WTip,{tip:s,block:!0,children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"h-1.5 w-3 shrink-0 self-center rounded-full",style:{background:e.token,opacity:eg.has(e.key)?.3:1}}),(0,r.jsx)("dt",{className:"w-14 shrink-0 text-label text-ink-soft",children:e.word}),(0,r.jsxs)("dd",{className:"min-w-0 truncate text-eyebrow font-bold tabular-nums text-ink",children:[t,a?(0,r.jsx)("span",{className:"ml-1 font-sans text-label font-normal text-ink-soft",children:a}):null]})]})},e.key)})})]}):(0,r.jsx)("div",{className:"text-eyebrow text-ink-soft",children:"No buckets in this range."})};return(0,r.jsxs)("div",{ref:er,"data-slot":"money.revenue-chart",className:"flex flex-col gap-2",children:[(0,r.jsxs)("div",{className:Y,children:[(0,r.jsx)("div",{className:"flex items-center justify-between gap-2",children:(0,r.jsx)("div",{className:E,children:"Invoiced and paid"})}),(0,r.jsx)("div",{"data-slot":"report.tooltip",className:"mt-1 min-h-[3.75rem] rounded-xl bg-haze px-2.5 py-1.5","aria-live":"polite",children:e8()}),eq?(0,r.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-x-5 gap-y-1 px-1 text-xs text-ink-soft","data-slot":"report.stats",children:[(0,r.jsxs)("span",{children:["High: ",(0,r.jsx)("span",{className:"font-medium text-[var(--st-good-ink)]",children:en(eq.high)})]}),(0,r.jsxs)("span",{children:["Low: ",(0,r.jsx)("span",{className:"font-medium text-[var(--st-warn-ink)]",children:en(eq.low)})]}),(0,r.jsxs)("span",{children:["Change: ",(0,r.jsxs)("span",{className:"font-medium ".concat(eq.change<0?"text-[var(--st-bad-ink)]":"text-[var(--st-good-ink)]"),children:[eq.change>0?"+":"",eq.change,"%"]})]}),e2.projectedVisits>0?(0,r.jsxs)("span",{children:["Ahead: ",(0,r.jsx)("span",{className:"font-medium text-ink",children:en(e2.projectedCents)})," over ",(0,i.r)(e2.projectedVisits,"visit")]}):null]}):null,(0,r.jsxs)("div",{className:"relative mt-1 outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)] rounded-lg",tabIndex:0,role:"application","aria-label":"Revenue chart. Arrow keys move the scrubber, plus and minus zoom, Enter zooms into the bucket.",onKeyDown:e=>{let t=eS>0?(eR+.5)/eS:.5;if("ArrowLeft"===e.key)eI(Math.max(0,eR-1));else if("ArrowRight"===e.key)eI(Math.min(eS-1,eR+1));else if("Home"===e.key)eI(0);else if("End"===e.key)eI(eS-1);else if("+"===e.key||"="===e.key)e_(.8,t);else if("-"===e.key||"_"===e.key)e_(1.25,t);else{if("Enter"!==e.key)return;eG(eR)}e.preventDefault()},children:[(0,r.jsx)(x.at,{config:{invoiced:{label:"Invoiced",color:"var(--ink-soft)"},paid:{label:"Received",color:"var(--st-good)"},projected:{label:"Projected",color:"var(--st-muted)"}},className:"!aspect-auto absolute inset-0 h-full w-full",style:{height:ez},"aria-hidden":"true",children:(0,r.jsxs)(y.X,{data:eO,margin:{top:20,right:12,left:0,bottom:0},barCategoryGap:"22%",children:[(0,r.jsxs)("defs",{children:[(0,r.jsx)("pattern",{id:"waisteDotGrid",x:"0",y:"0",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:(0,r.jsx)("circle",{cx:"10",cy:"10",r:"1",fill:"var(--mist)",fillOpacity:"0.9"})}),(0,r.jsx)("filter",{id:"waisteLineShadow",x:"-100%",y:"-100%",width:"300%",height:"300%",children:(0,r.jsx)("feDropShadow",{dx:"0",dy:"6",stdDeviation:"10",floodColor:"var(--st-good)",floodOpacity:"0.35"})}),(0,r.jsx)("filter",{id:"waisteDotShadow",x:"-50%",y:"-50%",width:"200%",height:"200%",children:(0,r.jsx)("feDropShadow",{dx:"1",dy:"2",stdDeviation:"2",floodColor:"rgba(0,0,0,0.5)"})})]}),(0,r.jsx)("rect",{x:46,y:20,width:Math.max(0,eW),height:Math.max(0,eP),fill:"url(#waisteDotGrid)",style:{pointerEvents:"none"}}),(0,r.jsx)(v.d,{strokeDasharray:"4 8",stroke:"var(--mist)",horizontal:!0,vertical:!1}
1),(0,r.jsx)(k.W,{dataKey:"key",type:"category",axisLine:!1,tickLine:!1,interval:0,ticks:eO.filter((e,t)=>t%eF==0||!!z(eV[t],eD,t>0?eV[t-1]:null).bottom).map(e=>e.key),tick:e=>{var t;let n=eV.findIndex(t=>{var n;return t.key===(null==(n=e.payload)?void 0:n.value)}),a=eV[n];if(!a)return(0,r.jsx)("g",{});let i=z(a,eD,n>0?eV[n-1]:null),s=n===eR,l=null!=(t=e.x)?t:0;return(0,r.jsxs)("g",{children:[n%eF==0?(0,r.jsx)("text",{x:l,y:ez-17,textAnchor:"middle",fontSize:10,className:"fill-current tabular-nums ".concat(s?"font-bold text-ink":"text-ink-soft"),children:i.top}):null,i.bottom?(0,r.jsx)("text",{x:l,y:ez-5,textAnchor:0===n?"start":"middle",fontSize:9.5,className:"fill-current font-semibold tabular-nums text-ink-soft",children:i.bottom}):null]})},height:30}),(0,r.jsx)(j.h,{domain:[eB.min/100,eB.max/100],ticks:(ei?[0,.25,.5,.75,1]:[0,.5,1]).map(e=>(eB.min+(eB.max-eB.min)*e)/100),axisLine:!1,tickLine:!1,width:46,tick:{fontSize:10,fill:"var(--ink-soft)"},tickFormatter:e=>{var t;return(t=Math.round(100*e))>=1e6?"".concat((0,s.up)(100*Math.round(t/1e5),{currency:Q,fractionDigits:0}),"k"):t>=1e5?"".concat((0,s.up)(Math.round(t/1e3),{currency:Q,fractionDigits:1}).replace(/\.0$/,""),"k"):(0,s.up)(100*Math.round(t/100),{currency:Q,fractionDigits:0})}}),eT>=0?(0,r.jsx)(g.e_,{x:eV[eT].key,stroke:"var(--ink)",strokeOpacity:.35,strokeWidth:1,label:{value:"today",position:"top",fontSize:9.5,fill:"var(--ink-soft)"}}):null,eg.has("invoiced")?null:(0,r.jsx)(b.yP,{dataKey:"invoiced",fill:"var(--ink-soft)",fillOpacity:.3,isAnimationActive:!1}),eg.has("projected")?null:(0,r.jsx)(w.N1,{type:"monotone",dataKey:"projected",stroke:"var(--st-muted)",strokeWidth:2,strokeDasharray:"5 4",dot:{r:eE<10?1.6:eE<22?2.2:3,fill:"var(--st-muted)",strokeWidth:0},activeDot:!1,connectNulls:!1,isAnimationActive:!1}),eg.has("paid")?null:(0,r.jsx)(w.N1,{type:"monotone",dataKey:"paid",stroke:"var(--st-good)",strokeWidth:2.5,filter:"url(#waisteLineShadow)",dot:{r:eE<10?1.6:eE<22?2.2:3,fill:"var(--st-good)",strokeWidth:0},activeDot:!1,connectNulls:!1,isAnimationActive:!1})]})}),(0,r.jsxs)("svg",{ref:eQ,viewBox:"0 0 ".concat(eA," ").concat(ez),className:"relative block w-full select-none",style:{minHeight:ez,touchAction:"pan-y"},role:"img","aria-label":"Invoiced and paid by ".concat(eD,": ").concat(eL.map(e=>e.word).join(", ")),onPointerDown:e=>{if(e.currentTarget.setPointerCapture(e.pointerId),eZ.current.set(e.pointerId,{x:e.clientX,y:e.clientY,startX:e.clientX,moved:!1}),2===eZ.current.size){let[t,n]=[...eZ.current.values()];eJ.current={dist:Math.max(1,Math.abs(t.x-n.x)),range:ek,fraction:eH((t.x+n.x)/2,e.currentTarget)}}},onPointerMove:e=>{let t=eZ.current.get(e.pointerId);if(!t){if("mouse"===e.pointerType){let t=e.currentTarget.getBoundingClientRect();eM((e.clientX-t.left)/t.width*eA),e$(e.clientX,e.currentTarget)}return}let n=t.x;if(t.x=e.clientX,t.y=e.clientY,2===eZ.current.size&&eJ.current){let[e,t]=[...eZ.current.values()],n=Math.max(1,Math.abs(e.x-t.x));e.moved=t.moved=!0,eK(V(eJ.current.range,eJ.current.dist/n,eJ.current.fraction,ex,ef));return}if(!t.moved&&6>Math.abs(e.clientX-t.startX))return void e$(e.clientX,e.currentTarget);t.moved=!0;let r=e.currentTarget.getBoundingClientRect(),a=-(e.clientX-n)/r.width*(eA/eW)*ek.spanDays;Math.abs(a)>=1&&eK(S(ek,Math.round(a),ex,ef))},onPointerUp:e1,onPointerCancel:e=>{e1(e),eM(null)},onPointerLeave:()=>eM(null),onDoubleClick:e=>{let t=e.currentTarget.getBoundingClientRect();eG(T((e.clientX-t.left)/t.width*eA,eY))},children:[eX?eL.filter(e=>"invoiced"!==e.key&&!eg.has(e.key)).map(e=>{let t=B(e.key,eX);return null===t?null:(0,r.jsx)("circle",{cx:eY[eR],cy:20+eP*(1-(t-eB.min)/(eB.max-eB.min)),r:4.5,fill:e.token,stroke:"var(--paper)",strokeWidth:1.5},e.key)}):null,null!=eN?(0,r.jsx)("line",{"data-slot":"report.hairline",x1:eN,x2:eN,y1:20,y2:20+eP,stroke:"var(--ink)",strokeOpacity:.45,strokeWidth:1}):eX?(0,r.jsx)("line",{x1:eY[eR],x2:eY[eR],y1:20,y2:20+eP,stroke:"var(--ink)",strokeOpacity:.15,strokeWidth:eE>24?3:1.5}):null,eV.map((e,t)=>(0,r.jsx)("rect",{"data-slot":"report.hitband",x:46+t*eE,y:0,width:eE,height:ez,fill:"transparent","aria-hidden":"true"},e.key))]}),null!==eN&&eX?(0,r.jsx)("div",{role:"tooltip","data-slot":"report.hover-details",className:"pointer-events-none absolute top-3 z-10 rounded-lg border border-mist bg-paper px-3 py-2 shadow-lg",style:{width:Math.min(320,Math.max(0,eA-16)),left:Math.max(8,Math.min(eN+16,eA-Math.min(320,Math.max(0,eA-16))-8))},children:e8(!0)}):null]}),(0,r.jsx)("div",{className:"mt-1 flex flex-wrap gap-x-1 gap-y-0",role:"group","aria-label":"Series",children:eL.map(e=>{let t=!eg.has(e.key);return(0,r.jsxs)(f.WButton,{variant:"quiet",size:"sm",pressed:t,onClick:()=>eb(t=>{let n=new Set(t);return n.has(e.key)?n.delete(e.key):n.add(e.key),n}),className:"gap-1.5 ".concat(t?"text-ink":"text-ink-soft line-through"),children:[(0,r.jsxs)("svg",{width:"18",height:"6","aria-hidden":"true",className:"shrink-0",children:[(0,r.jsx)("line",{x1:"0",y1:"3",x2:"18",y2:"3",stroke:e.token,strokeWidth:2,strokeDasharray:e.dash,opacity:t?1:.35}),(0,r.jsx)("circle",{cx:"9",cy:"3",r:"2.5",fill:e.token,opacity:t?1:.35})]}),e.word]},e.key)})}),ep?(0,r.jsx)("p",{className:"mt-1 px-1 text-label text-[var(--st-warn-ink)]","data-slot":"report.series-status",children:ep}):null]}),(0,r.jsx)("div",{className:"".concat(Y," min-w-0 overflow-x-auto"),children:(0,r.jsxs)("table",{"data-slot":"report.monthly-table",className:"w-full text-left text-xs tabular-nums",children:[(0,r.jsx)("caption",{className:"pb-2 text-left font-semibold text-ink",children:"Monthly actuals (inc GST)"}),(0,r.jsx)("thead",{className:"text-ink-soft",children:(0,r.jsx)("tr",{children:["Month","Invoiced","Change","Paid","Change"].map((e,t)=>(0,r.jsx)("th",{scope:"col",className:"px-2 py-2 font-semibold",children:e},t))})}),(0,r.jsx)("tbody",{children:e5.map((e,t)=>(0,r.jsxs)("tr",{className:"border-t border-mist",children:[(0,r.jsxs)("th",{scope:"row",className:"px-2 py-2 font-medium text-ink",children:[A(e,"month"),"current"===e.phase?" (so far)":""]}),(0,r.jsx)("td",{className:"whitespace-nowrap px-2 py-2",children:e4(e.invoicedCents)}),(0,r.jsx)("td",{className:"px-2 py-2 text-ink-soft",children:e6(e,e5[t-1],"invoicedCents")}),(0,r.jsx)("td",{className:"whitespace-nowrap px-2 py-2",children:e4(e.paidCents)}),(0,r.jsx)("td",{className:"px-2 py-2 text-ink-soft",children:e6(e,e5[t-1],"paidCents")})]},e.key))}),(0,r.jsx)("tfoot",{className:"border-t border-mist font-semibold text-ink",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{scope:"row",className:"px-2 py-2",children:"Measured total"}),(0,r.jsx)("td",{className:"whitespace-nowrap px-2 py-2",children:e4(e3.invoicedCents)}),(0,r.jsx)("td",{}),(0,r.jsx)("td",{className:"whitespace-nowrap px-2 py-2",children:e4(e3.paidCents)}),(0,r.jsx)("td",{})]})})]})}),(0,r.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,r.jsxs)("div",{className:Y,"data-slot":"report.last12",children:[(0,r.jsx)("div",{className:E,
1children:e7}),(0,r.jsxs)("p",{className:"text-label text-ink-soft",children:[X(ek.from)," to ",X(ek.to),", inc GST"]}),(0,r.jsxs)("dl",{className:"mt-1 grid gap-1",children:[(0,r.jsxs)("div",{"data-slot":"report.range.received",children:[(0,r.jsxs)("dt",{className:"text-label text-ink-soft",children:["Received \xb7 ",(0,i.r)(e2.paidCount,"payment")]}),(0,r.jsx)("dd",{className:"text-body font-bold tabular-nums text-ink",children:e4(e3.paidCents)})]}),(0,r.jsxs)("div",{"data-slot":"report.range.invoiced",children:[(0,r.jsxs)("dt",{className:"text-label text-ink-soft",children:["Invoiced \xb7 ",(0,i.r)(e2.invoicedCount,"invoice")," issued"]}),(0,r.jsx)("dd",{className:"text-body font-bold tabular-nums text-ink",children:e4(e3.invoicedCents)})]}),null===e3.projectedCents?null:(0,r.jsxs)("div",{"data-slot":"report.range.ahead",children:[(0,r.jsxs)("dt",{className:"text-label text-ink-soft",children:["Ahead",e2.projectedVisits>0?" \xb7 ".concat((0,i.r)(e2.projectedVisits,"visit")):"",e2.unpricedVisits>0?", ".concat((0,i.r)(e2.unpricedVisits,"visit")," unpriceable"):""]}),(0,r.jsx)("dd",{className:"text-body font-bold tabular-nums text-ink",children:e2.projectedVisits>0?en(e2.projectedCents):"No priced work"})]})]}),(0,r.jsx)(P.$,{bare:!0,title:(0,r.jsx)("span",{className:"text-label font-semibold",children:"How these are counted"}),slot:"report.range.method",className:"mt-1",children:(0,r.jsx)("p",{className:"text-label text-ink-soft",children:"Received is payments dated in the range, whichever invoice they pay. Invoiced is invoices issued in the range. They are different sets, so either can be the larger. Ahead is walked from active recurring agreements at today's prices."})})]}),et]})]})}}}]);
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.