| 1 |
- var freeaps_determineBasal;(()=>{var e={2982:(e,t,a)=>{var r=a(3531);function o(e,t){t||(t=0);var a=Math.pow(10,t);return Math.round(e*a)/a}function n(e,t){return"mmol/L"===t.out_units?o(.0555*e,1):Math.round(e)}e.exports=function(e,t,a,i,s,l,u,d,m,c,g,h,p,v,B){var f=i.min_bg,b=v.overrideTarget;0!=b&&6!=b&&v.useOverride&&!i.temptargetSet&&(f=b);v.smbIsOff;const M=v.advancedSettings,_=v.isfAndCr,y=v.isf,x=v.cr,S=v.smbIsAlwaysOff;v.start;v.end;const D=v.smbMinutes,w=v.uamMinutes;var G=h.useNewFormula,T=0,C=f,U=new Date;c&&(U=new Date(c));var O=0,A="",R="",I="",F="",j="",P="",E=0,q=0,W=0,k=0,L=0,z=0;const N=v.weightedAverage;var H=1,Z=i.sens,$=i.carb_ratio;v.useOverride&&(H=v.overridePercentage/100,_?(Z/=H,$/=H):(x&&($/=H),y&&(Z/=H)));const J=i.weightPercentage,K=v.average_total_data;function Q(e,t){var a=e.getTime();return new Date(a+36e5*t)}function V(e){var t=i.bolus_increment;.1!=t&&(t=.05);var a=e/t;return a>=1?o(Math.floor(a)*t,5):0}function X(e){function t(e){return e<10&&(e="0"+e),e}return t(e.getHours())+":"+t(e.getMinutes())+":00"}function Y(e,t){var a=new Date("1/1/1999 "+e),r=new Date("1/1/1999 "+t);return(a.getTime()-r.getTime())/36e5}const ee=Math.min(i.autosens_min,i.autosens_max),te=Math.max(i.autosens_min,i.autosens_max);function ae(e,t){var a=0,r=t,o=(e-t)/36e5,n=0,i=o,s=0;do{if(o>0){var l=X(r),u=p[0].rate;for(let e=0;e<p.length;e++){var d=p[e].start;if(l==d){if(e+1<p.length){o>=(s=Y(p[e+1].start,p[e].start))?n=s:o<s&&(n=o)}else if(e+1==p.length){let t=p[0].start;o>=(s=24-Y(p[e].start,t))?n=s:o<s&&(n=o)}a+=V((u=p[e].rate)*n),o-=n,console.log("Dynamic ratios log: scheduled insulin added: "+V(u*n)+" U. Bas duration: "+n.toPrecision(3)+" h. Base Rate: "+u+" U/h. Time :"+l),r=Q(r,n)}else if(l>d)if(e+1<p.length){var m=p[e+1].start;l<m&&(o>=(s=Y(m,l))?n=s:o<s&&(n=o),a+=V((u=p[e].rate)*n),o-=n,console.log("Dynamic ratios log: scheduled insulin added: "+V(u*n)+" U. Bas duration: "+n.toPrecision(3)+" h. Base Rate: "+u+" U/h. Time :"+l),r=Q(r,n))}else if(e==p.length-1){o>=(s=Y("23:59:59",l))?n=s:o<s&&(n=o),a+=V((u=p[e].rate)*n),o-=n,console.log("Dynamic ratios log: scheduled insulin added: "+V(u*n)+" U. Bas duration: "+n.toPrecision(3)+" h. Base Rate: "+u+" U/h. Time :"+l),r=Q(r,n)}}}}while(o>0&&o<i);return a}if((te==ee||te<1||ee>1)&&(G=!1,console.log("Dynamic ISF disabled due to current autosens settings")),g.length){if(G){let e=g.length-1;var re=new Date(g[e].timestamp),oe=new Date(g[0].timestamp);if("TempBasalDuration"==g[0]._type&&(oe=new Date),(O=(oe-re)/36e5)<23.9&&O>21)L=ae(re,(ne=24-O,ie=re.getTime(),new Date(ie-36e5*ne))),F="24 hours of data is required for an accurate tdd calculation. Currently only "+O.toPrecision(3)+" hours of pump history data are available. Using your pump scheduled basals to fill in the missing hours. Scheduled basals added: "+L.toPrecision(5)+" U. ";else O<21?(G=!1,enableDynamicCR=!1):F=""}}else console.log("Pumphistory is empty!"),G=!1,enableDynamicCR=!1;var ne,ie;if(G){for(let e=0;e<g.length;e++)"Bolus"==g[e]._type&&(k+=g[e].amount);for(let e=1;e<g.length;e++)if("TempBasal"==g[e]._type&&g[e].rate>0){E=e,z=g[e].rate;var se=g[e-1]["duration (min)"]/60,le=se,ue=new Date(g[e-1].timestamp),de=new Date(ue),me=0;do{if(e--,0==e){de=new Date;break}if("TempBasal"==g[e]._type||"PumpSuspend"==g[e]._type){de=new Date(g[e].timestamp);break}var ce=e-2;if(ce>=0&&"Rewind"==g[ce]._type){let e=g[ce].timestamp;for(;ce-1>=0&&"Prime"==g[ce-=1]._type;)me=(g[ce].timestamp-e)/36e5;me>=se&&(de=new Date(e),me=0)}}while(e>0);var ge=(de-ue)/36e5;ge<le&&(se=ge),W+=V(z*(se-me)),e=E}for(let e=0;e<g.length;e++)if(0,0==g[e]["duration (min)"]||"PumpResume"==g[e]._type){let t=new Date(g[e].timestamp),a=new Date(t),r=e;do{if(r>0&&(--r,"TempBasal"==g[r]._type)){a=new Date(g[r].timestamp);break}}while(r>0);(a-t)/36e5>0&&(L+=ae(a,t))}for(let e=g.length-1;e>0;e--)if("TempBasalDuration"==g[e]._type){let t=g[e]["duration (min)"]/60,a=new Date(g[e].timestamp);var he=new Date(a);let r=e;do{if(--r,r>=0&&("TempBasal"==g[r]._type||"PumpSuspend"==g[r]._type)){he=new Date(g[r].timestamp);break}}while(r>0);if(0==e&&"TempBasalDuration"==g[0]._type&&(he=new Date,t=g[e]["duration (min)"]/60),(he-a)/36e5-t>0){L+=ae(he,Q(a,t))}}var pe={TDD:o(q=k+W+L,5),bolus:o(k,5),temp_basal:o(W,5),scheduled_basal:o(L,5)};O>21?(R=". Bolus insulin: "+k.toPrecision(5)+" U",I=". Temporary basal insulin: "+W.toPrecision(5)+" U",A=". Insulin with scheduled basal rate: "+L.toPrecision(5)+" U",j=F+(" TDD past 24h is: "+q.toPrecision(5)+" U")+R+I+A,P=", TDD: "+o(q,2)+" U, "+o(k/q*100,0)+"% Bolus "+o((W+L)/q*100,0)+"% Basal"):P=", TDD: Not enough pumpData (< 21h)"}var ve;const Be=e.glucose,fe=h.enableDynamicCR,be=h.adjustmentFactor,Me=f;var _e=!1,ye="",xe=1,Se="";K>0&&(xe=N/K),Se=xe>1?"Basal adjustment with a 24 hour to total average (up to 14 days of data) TDD ratio (limited by Autosens max setting). Basal Ratio: "+(xe=o(xe=Math.min(xe,i.autosens_max),2))+". Upper limit = Autosens max ("+i.autosens_max+")":xe<1?"Basal adjustment with a 24 hour to to total average (up to 14 days of data) TDD ratio (limited by Autosens min setting). Basal Ratio: "+(xe=o(xe=Math.max(xe,i.autosens_min),2))+". Lower limit = Autosens min ("+i.autosens_min+")":"Basal adjusted with a 24 hour to total average (up to 14 days of data) TDD ratio: "+xe,Se=", Basal ratio: "+xe,(i.high_temptarget_raises_sensitivity||i.exercise_mode||v.isEnabled)&&(_e=!0),Me>=118&&_e&&(G=!1,ye="Dynamic ISF temporarily off due to a high temp target/exercising. Current min target: "+Me);var De=", Dynamic ratios log: ",we=", AF: "+be,Ge="BG: "+Be+" mg/dl ("+(.0555*Be).toPrecision(2)+" mmol/l)",Te="",Ce="";const Ue=h.curve,Oe=i.insulinPeakTime,Ae=h.useCustomPeakTime;var Re=55,Ie=65;switch(Ue){case"rapid-acting":Ie=65;break;case"ultra-rapid":Ie=50}Ae?(Re=120-Oe,console.log("Custom insulinpeakTime set to :"+Oe+", insulinFactor: "+Re)):(Re=120-Ie,console.log("insulinFactor set to : "+Re)),ve=q,J<1&&N>0&&(q=N,console.log("Using weighted TDD average: "+o(q,2)+" U, instead of past 24 h ("+o(ve,2)+" U), weight: "+J),Ce=", Weighted TDD: "+o(q,2)+" U");const Fe=h.sigmoid;var je="";if(G){var Pe=Z*be*q*Math.log(Be/Re+1)/1800;Te=", Logarithmic formula"}if(G&&Fe){const e=ee,t=te-e,a=.0555*(Be-f);var Ee=xe,qe=te-1;1==te&&(qe=te+.01-1);const r=Math.log10(1/qe-e/qe)/Math.log10(Math.E),o=a*be*Ee+r;Pe=t/(1+Math.exp(-o))+e,Te=", Sigmoid function"}var We=$;const ke=o($,1);var Le="",ze="";if(G&&q>0){if(Le=", Dynamic ISF/CR: On/",Pe>te?(ye=", Dynamic ISF limited by autosens_max setting: "+te+" ("+o(Pe,2)+"), ",ze=", Autosens/Dynamic Limit: "+te+" ("+o(Pe,2)+")",Pe=te):Pe<ee&&(ye=", Dynamic ISF limited by autosens_min setting: "+ee+" ("+o(Pe,2)+"). ",ze=", Autosens/Dynamic Limit: "+ee+" ("+o(Pe,2)+")",Pe=ee),fe){Le+="On";var Ne=". New Dynamic CR: "+o($/=Pe,1)+" g/U"}else Ne=" CR: "+We+" g/U",Le+="Off";const e=Z/Pe;s.ratio=Pe,je=". Using Sigmoid function, the autosens ratio has been adjusted with sigmoid factor to: "+o(s.ratio,2)+". New ISF = "+o(e,2)+" mg/dl ("+o(.0555*e,2)+" (mmol/l). CR adjusted from "+o(ke,2)+" to "+o($,2),j+=De+Ge+we+Te+(ye+=Fe?je:", Dynamic autosens.ratio set to "+o(Pe,2)+" with ISF: "+e.toPrecision(3)+" mg/dl/U ("+(.0555*e).toPrecision(3)+" mmol/l/U)")+Le+Ne+Ce}else j+=De+"Dynamic Settings disabled";console.log(j),G||fe?G&&i.tddAdjBasal?P+=Le+Te+ze+we+Se:G&&!i.tddAdjBasal&&(P+=Le+Te+ze+we):P+="",.5!==i.smb_delivery_ratio&&(P+=", SMB Ratio: "+Math.min(i.smb_delivery_ratio,1)),""!==B&&"Nothing changed"!==B&&(P+=", Middleware: "+B);var He={},Ze=new Date(U);if(void 0===i||void 0===i.current_basal)return He.error="Error: could not get current basal rate",He;var $e=r(i.current_basal,i)*H,Je=$e;v.useOverride&&(0==v.duration?console.log("Profile Override is active. Override "+o(100*H,0)+"%. Override Duration: Enabled indefinitely"):console.log("Profile Override is active. Override "+o(100*H,0)+"%. Override Expires in: "+v.duration+" min."));var Ke,Qe=new Date(e.date),Ve=o((U-Qe)/60/1e3,1),Xe=e.glucose,Ye=e.noise;Ke=e.delta>-.5?"+"+o(e.delta,0):o(e.delta,0);var et=Math.min(e.delta,e.short_avgdelta),tt=Math.min(e.short_avgdelta,e.long_avgdelta),at=Math.max(e.delta,e.short_avgdelta,e.long_avgdelta);(Xe<=10||38===Xe||Ye>=3)&&(He.reason="CGM is calibrating, in ??? state, or noise is high");if(Xe>60&&0==e.delta&&e.short_avgdelta>-1&&e.short_avgdelta<1&&e.long_avgdelta>-1&&e.long_avgdelta<1&&400!=Xe&&("fakecgm"==e.device?(console.error("CGM data is unchanged ("+n(Xe,i)+"+"+n(e.delta,i)+") for 5m w/ "+n(e.short_avgdelta,i)+" mg/dL ~15m change & "+n(e.long_avgdelta,2)+" mg/dL ~45m change"),console.error("Simulator mode detected ("+e.device+"): continuing anyway")):400!=Xe&&!0),Ve>12||Ve<-5?He.reason="If current system time "+U+" is correct, then BG data is too old. The last BG data was read "+Ve+"m ago at "+Qe:0===e.short_avgdelta&&0===e.long_avgdelta&&400!=Xe&&(e.last_cal&&e.last_cal<3?He.reason="CGM was just calibrated":He.reason="CGM data is unchanged ("+n(Xe,i)+"+"+n(e.delta,i)+") for 5m w/ "+n(e.short_avgdelta,i)+" mg/dL ~15m change & "+n(e.long_avgdelta,i)+" mg/dL ~45m change"),400!=Xe&&(Xe<=10||38===Xe||Ye>=3||Ve>12||Ve<-5||0===e.short_avgdelta&&0===e.long_avgdelta))return t.rate>=Je?(He.reason+=". Canceling high temp basal of "+t.rate,He.deliverAt=Ze,He.temp="absolute",He.duration=0,He.rate=0,He):0===t.rate&&t.duration>30?(He.reason+=". Shortening "+t.duration+"m long zero temp to 30m. ",He.deliverAt=Ze,He.temp="absolute",He.duration=30,He.rate=0,He):(He.reason+=". Temp "+t.rate+" <= current basal "+Je+"U/hr; doing nothing. ",He);var rt,ot,nt,it,st=i.max_iob;if(void 0!==f&&(ot=f),void 0!==i.max_bg&&(nt=f),void 0!==i.enableSMB_high_bg_target&&(it=i.enableSMB_high_bg_target),void 0===f)return He.error="Error: could not determine target_bg. ",He;rt=f;var lt=i.exercise_mode||i.high_temptarget_raises_sensitivity||v.isEnabled,ut=100,dt=160;if(dt=i.half_basal_exercise_target,v.isEnabled){const e=v.hbt;console.log("Half Basal Target used: "+n(e,i)+" "+i.out_units),dt=e}else console.log("Default Half Basal Target used: "+n(dt,i)+" "+i.out_units);if(lt&&i.temptargetSet&&rt>ut||i.low_temptarget_lowers_sensitivity&&i.temptargetSet&&rt<ut||v.isEnabled&&i.temptargetSet&&rt<ut){var mt=dt-ut;sensitivityRatio=mt*(mt+rt-ut)<=0?i.autosens_max:mt/(mt+rt-ut),sensitivityRatio=Math.min(sensitivityRatio,i.autosens_max),sensitivityRatio=o(sensitivityRatio,2),process.stderr.write("Sensitivity ratio set to "+sensitivityRatio+" based on temp target of "+rt+"; ")}else void 0!==s&&s&&(sensitivityRatio=s.ratio,0===b||6===b||b===i.min_bg||i.temptargetSet||(rt=b,console.log("Current Override Profile Target: "+n(b,i)+" "+i.out_units)),process.stderr.write("Autosens ratio: "+sensitivityRatio+"; "));if(i.temptargetSet&&rt<ut&&G&&Be>=rt&&sensitivityRatio<Pe&&(s.ratio=Pe*(ut/rt),s.ratio=Math.min(s.ratio,i.autosens_max),sensitivityRatio=o(s.ratio,2),console.log("Dynamic ratio increased from "+o(Pe,2)+" to "+o(s.ratio,2)+" due to a low temp target ("+rt+").")),sensitivityRatio&&!G?(Je=i.current_basal*H*sensitivityRatio,Je=r(Je,i)):G&&i.tddAdjBasal&&(Je=i.current_basal*xe*H,Je=r(Je,i),K>0&&(process.stderr.write("TDD-adjustment of basals activated, using tdd24h_14d_Ratio "+o(xe,2)+", TDD 24h = "+o(ve,2)+"U, Weighted average TDD = "+o(N,2)+"U, (Weight percentage = "+J+"), Total data of TDDs (up to 14 days) average = "+o(K,2)+"U. "),Je!==$e*H?process.stderr.write("Adjusting basal from "+$e*H+" U/h to "+Je+" U/h; "):process.stderr.write("Basal unchanged: "+Je+" U/h; "))),i.temptargetSet);else if(void 0!==s&&s&&(i.sensitivity_raises_target&&s.ratio<1||i.resistance_lowers_target&&s.ratio>1)){ot=o((ot-60)/s.ratio)+60,nt=o((nt-60)/s.ratio)+60;var ct=o((rt-60)/s.ratio)+60;rt===(ct=Math.max(80,ct))?process.stderr.write("target_bg unchanged: "+n(ct,i)+"; "):process.stderr.write("target_bg from "+n(ct,i)+" to "+n(ct,i)+"; "),rt=ct}var gt=n(rt,i);rt!=f&&(gt=0!==b&&6!==b&&b!==rt?n(f,i)+"→"+n(b,i)+"→"+n(rt,i):n(f,i)+"→"+n(rt,i));var ht=200,pt=200,vt=200;if(e.noise>=2){var Bt=Math.max(1.1,i.noisyCGMTargetMultiplier);Math.min(250,i.maxRaw);ht=o(Math.min(200,ot*Bt)),pt=o(Math.min(200,rt*Bt)),vt=o(Math.min(200,nt*Bt)),process.stderr.write("Raising target_bg for noisy / raw CGM data, from "+n(ct,i)+" to "+n(pt,i)+"; "),ot=ht,rt=pt,nt=vt}C=ot-.5*(ot-40),C=Math.min(Math.max(i.threshold_setting,C,60),120),console.error("Threshold set to ${convert_bg(threshold, profile)}");var ft="",bt=(o(Z,1),Z);if(void 0!==s&&s&&((bt=o(bt=Z/sensitivityRatio,1))!==Z?process.stderr.write("ISF from "+n(Z,i)+" to "+n(bt,i)):process.stderr.write("ISF unchanged: "+n(bt,i)),ft+="Autosens ratio: "+o(sensitivityRatio,2)+", ISF: "+n(Z,i)+"→"+n(bt,i)),console.error("CR:"+$),void 0===a)return He.error="Error: iob_data undefined. ",He;var Mt,_t=a;if(a.length,a.length>1&&(a=_t[0]),void 0===a.activity||void 0===a.iob)return He.error="Error: iob_data missing some property. ",He;var yt=((Mt=void 0!==a.lastTemp?o((new Date(U).getTime()-a.lastTemp.date)/6e4):0)+t.duration)%30;if(console.error("currenttemp:"+t.rate+" lastTempAge:"+Mt+"m, tempModulus:"+yt+"m"),He.temp="absolute",He.deliverAt=Ze,d&&t&&a.lastTemp&&t.rate!==a.lastTemp.rate&&Mt>10&&t.duration)return He.reason="Warning: currenttemp rate "+t.rate+" != lastTemp rate "+a.lastTemp.rate+" from pumphistory; canceling temp",u.setTempBasal(0,0,i,He,t);if(t&&a.lastTemp&&t.duration>0){var xt=Mt-a.lastTemp.duration;if(xt>5&&Mt>10)return He.reason="Warning: currenttemp running but lastTemp from pumphistory ended "+xt+"m ago; canceling temp",u.setTempBasal(0,0,i,He,t)}var St=o(-a.activity*bt*5,2),Dt=o(6*(et-St));Dt<0&&(Dt=o(6*(tt-St)))<0&&(Dt=o(6*(e.long_avgdelta-St)));var wt=Xe,Gt=(wt=a.iob>0?o(Xe-a.iob*bt):o(Xe-a.iob*Math.min(bt,Z)))+Dt;if(void 0===Gt||isNaN(Gt))return He.error="Error: could not calculate eventualBG. Sensitivity: "+bt+" Deviation: "+Dt,He;var Tt,Ct,Ut=function(e,t,a){return o(a+(e-t)/24,1)}(rt,Gt,St);He={temp:"absolute",bg:Xe,tick:Ke,eventualBG:Gt,insulinReq:0,reservoir:m,deliverAt:Ze,sensitivityRatio,CR:o($,1),TDD:ve,insulin:pe,current_target:rt,insulinForManualBolus:T,manualBolusErrorString:0,minDelta:et,expectedDelta:Ut,minGuardBG:Ct,minPredBG:Tt,threshold:n(C,i)};var Ot=[],At=[],Rt=[],It=[];Ot.push(Xe),At.push(Xe),It.push(Xe),Rt.push(Xe);let Ft=!1;S?(console.error("SMBs are always off."),Ft=!1):Ft=function(e,t,a,r,o,i,s,l){if(s.smbIsOff){let e=new Date(l.getHours()),t=s.start,a=s.end;if(t<a&&e>=t&&e<a)return console.error("SMB disabled: current time is in SMB disabled scheduled"),!1;if(t>a&&(e>=t||e<a))return console.error("SMB disabled: current time is in SMB disabled scheduled"),!1;if(0==t&&0==a)return console.error("SMB disabled: current time is in SMB disabled scheduled"),!1;if(t==a&&e==t)return console.error("SMB disabled: current time is in SMB disabled scheduled"),!1}return t?!e.allowSMB_with_high_temptarget&&e.temptargetSet&&o>100?(console.error("SMB disabled due to high temptarget of "+o),!1):!0===a.bwFound&&!1===e.A52_risk_enable?(console.error("SMB disabled due to Bolus Wizard activity in the last 6 hours."),!1):400==r?(console.error("Invalid CGM (HIGH). SMBs disabled."),!1):!0===e.enableSMB_always?(a.bwFound?console.error("Warning: SMB enabled within 6h of using Bolus Wizard: be sure to easy bolus 30s before using Bolus Wizard"):console.error("SMB enabled due to enableSMB_always"),!0):!0===e.enableSMB_with_COB&&a.mealCOB?(a.bwCarbs?console.error("Warning: SMB enabled with Bolus Wizard carbs: be sure to easy bolus 30s before using Bolus Wizard"):console.error("SMB enabled for COB of "+a.mealCOB),!0):!0===e.enableSMB_after_carbs&&a.carbs?(a.bwCarbs?console.error("Warning: SMB enabled with Bolus Wizard carbs: be sure to easy bolus 30s before using Bolus Wizard"):console.error("SMB enabled for 6h after carb entry"),!0):!0===e.enableSMB_with_temptarget&&e.temptargetSet&&o<100?(a.bwFound?console.error("Warning: SMB enabled within 6h of using Bolus Wizard: be sure to easy bolus 30s before using Bolus Wizard"):console.error("SMB enabled for temptarget of "+n(o,e)),!0):!0===e.enableSMB_high_bg&&null!==i&&r>=i?(console.error("Checking BG to see if High for SMB enablement."),console.error("Current BG",r," | High BG ",i),a.bwFound?console.error("Warning: High BG SMB enabled within 6h of using Bolus Wizard: be sure to easy bolus 30s before using Bolus Wizard"):console.error("High BG detected. Enabling SMB."),!0):(console.error("SMB disabled (no enableSMB preferences active or no condition satisfied)"),!1):(console.error("SMB disabled (!microBolusAllowed)"),!1)}(i,d,l,Xe,rt,it,v,U);var jt=i.enableUAM,Pt=0,Et=0;Pt=o(et-St,1);var qt=o(et-St,1);csf=bt/$,console.error("profile.sens:"+n(Z,i)+", sens:"+n(bt,i)+", CSF:"+o(csf,1));var Wt=o(30*csf*5/60,1);Pt>Wt&&(console.error("Limiting carb impact from "+Pt+" to "+Wt+"mg/dL/5m (30g/h)"),Pt=Wt);var kt=3;sensitivityRatio&&(kt/=sensitivityRatio);var Lt=kt;if(l.carbs){kt=Math.max(kt,l.mealCOB/20);var zt=o((new Date(U).getTime()-l.lastCarbTime)/6e4),Nt=(l.carbs-l.mealCOB)/l.carbs;Lt=o(Lt=kt+1.5*zt/60,1),console.error("Last carbs "+zt+" minutes ago; remainingCATime:"+Lt+"hours; "+o(100*Nt,1)+"% carbs absorbed")}var Ht=Math.max(0,Pt/5*60*Lt/2)/csf,Zt=90,$t=1;i.remainingCarbsCap&&(Zt=Math.min(90,i.remainingCarbsCap)),i.remainingCarbsFraction&&($t=Math.min(1,i.remainingCarbsFraction));var Jt=1-$t,Kt=Math.max(0,l.mealCOB-Ht-l.carbs*Jt),Qt=(Kt=Math.min(Zt,Kt))*csf*5/60/(Lt/2),Vt=o(l.slopeFromMaxDeviation,2),Xt=o(l.slopeFromMinDeviation,2),Yt=Math.min(Vt,-Xt/3);Et=0===Pt?0:Math.min(60*Lt/5/2,Math.max(0,l.mealCOB*csf/Pt)),console.error("Carb Impact:"+Pt+"mg/dL per 5m; CI Duration:"+o(5*Et/60*2,1)+"hours; remaining CI ("+Lt/2+"h peak):"+o(Qt,1)+"mg/dL per 5m");var ea,ta,aa,ra,oa=999,na=999,ia=999,sa=999,la=999,ua=999,da=999,ma=Gt,ca=Xe,ga=Xe,ha=0,pa=[],va=[];try{_t.forEach((function(e){var t=o(-e.activity*bt*5,2),a=o(-e.iobWithZeroTemp.activity*bt*5,2),r=wt,n=Pt*(1-Math.min(1,At.length/12));if(!0===(G&&!Fe))ma=At[At.length-1]+o(-e.activity*(1800/(q*be*Math.log(Math.max(At[At.length-1],39)/Re+1)))*5,2)+n,r=It[It.length-1]+o(-e.iobWithZeroTemp.activity*(1800/(q*be*Math.log(Math.max(It[It.length-1],39)/Re+1)))*5,2),console.log("Dynamic ISF (Logarithmic Formula) )adjusted predictions for IOB and ZT: IOBpredBG: "+o(ma,2)+" , ZTpredBG: "+o(r,2));else ma=At[At.length-1]+t+n,r=It[It.length-1]+a;var i=Math.max(0,Math.max(0,Pt)*(1-Ot.length/Math.max(2*Et,1))),s=Math.min(Ot.length,12*Lt-Ot.length),l=Math.max(0,s/(Lt/2*12)*Qt);i+l,pa.push(o(l,0)),va.push(o(i,0)),COBpredBG=Ot[Ot.length-1]+t+Math.min(0,n)+i+l;var u=Math.max(0,qt+Rt.length*Yt),d=Math.max(0,qt*(1-Rt.length/Math.max(36,1))),m=Math.min(u,d);if(m>0&&(ha=o(5*(Rt.length+1)/60,1)),!0===(G&&!Fe))UAMpredBG=Rt[Rt.length-1]+o(-e.activity*(1800/(q*be*Math.log(Math.max(Rt[Rt.length-1],39)/Re+1)))*5,2)+Math.min(0,n)+m,console.log("Dynamic ISF (Logarithmic Formula) adjusted prediction for UAM: UAMpredBG: "+o(UAMpredBG,2));else UAMpredBG=Rt[Rt.length-1]+t+Math.min(0,n)+m;At.length<48&&At.push(ma),Ot.length<48&&Ot.push(COBpredBG),Rt.length<48&&Rt.push(UAMpredBG),It.length<48&&It.push(r),COBpredBG<sa&&(sa=o(COBpredBG)),UAMpredBG<la&&(la=o(UAMpredBG)),ma<ua&&(ua=o(ma)),r<da&&(da=o(r));At.length>18&&ma<oa&&(oa=o(ma)),ma>ca&&(ca=ma),(Et||Qt>0)&&Ot.length>18&&COBpredBG<na&&(na=o(COBpredBG)),(Et||Qt>0)&&COBpredBG>ca&&(ga=COBpredBG),jt&&Rt.length>12&&UAMpredBG<ia&&(ia=o(UAMpredBG)),jt&&UAMpredBG>ca&&UAMpredBG}))}catch(e){console.error("Problem with iobArray. Optional feature Advanced Meal Assist disabled")}l.mealCOB&&(console.error("predCIs (mg/dL/5m):"+va.join(" ")),console.error("remainingCIs: "+pa.join(" "))),He.predBGs={},At.forEach((function(e,t,a){a[t]=o(Math.min(401,Math.max(39,e)))}));for(var Ba=At.length-1;Ba>12&&At[Ba-1]===At[Ba];Ba--)At.pop();for(He.predBGs.IOB=At,ta=o(At[At.length-1]),It.forEach((function(e,t,a){a[t]=o(Math.min(401,Math.max(39,e)))})),Ba=It.length-1;Ba>6&&!(It[Ba-1]>=It[Ba]||It[Ba]<=rt);Ba--)It.pop();if(He.predBGs.ZT=It,o(It[It.length-1]),l.mealCOB>0&&(Pt>0||Qt>0)){for(Ot.forEach((function(e,t,a){a[t]=o(Math.min(1500,Math.max(39,e)))})),Ba=Ot.length-1;Ba>12&&Ot[Ba-1]===Ot[Ba];Ba--)Ot.pop();He.predBGs.COB=Ot,aa=o(Ot[Ot.length-1]),Gt=Math.max(Gt,o(Ot[Ot.length-1])),console.error("COBpredBG: "+o(Ot[Ot.length-1]))}if(Pt>0||Qt>0){if(jt){for(Rt.forEach((function(e,t,a){a[t]=o(Math.min(401,Math.max(39,e)))})),Ba=Rt.length-1;Ba>12&&Rt[Ba-1]===Rt[Ba];Ba--)Rt.pop();He.predBGs.UAM=Rt,ra=o(Rt[Rt.length-1]),Rt[Rt.length-1]&&(Gt=Math.max(Gt,o(Rt[Rt.length-1])))}He.eventualBG=Gt}console.error("UAM Impact:"+qt+"mg/dL per 5m; UAM Duration:"+ha+"hours"),oa=Math.max(39,oa),na=Math.max(39,na),ia=Math.max(39,ia),Tt=o(oa);var fa=l.mealCOB/l.carbs;ea=o(ia<999&&na<999?(1-fa)*UAMpredBG+fa*COBpredBG:na<999?(ma+COBpredBG)/2:ia<999?(ma+UAMpredBG)/2:ma),da>ea&&(ea=da),Ct=o(Ct=Et||Qt>0?jt?fa*sa+(1-fa)*la:sa:jt?la:ua);var ba=ia;if(da<C)ba=(ia+da)/2;else if(da<rt){var Ma=(da-C)/(rt-C);ba=(ia+(ia*Ma+da*(1-Ma)))/2}else da>ia&&(ba=(ia+da)/2);if(ba=o(ba),l.carbs)if(!jt&&na<999)Tt=o(Math.max(oa,na));else if(na<999){var _a=fa*na+(1-fa)*ba;Tt=o(Math.max(oa,na,_a))}else Tt=jt?ba:Ct;else jt&&(Tt=o(Math.max(oa,ba)));Tt=Math.min(Tt,ea),process.stderr.write("minPredBG: "+Tt+" minIOBPredBG: "+oa+" minZTGuardBG: "+da),na<999&&process.stderr.write(" minCOBPredBG: "+na),ia<999&&process.stderr.write(" minUAMPredBG: "+ia),console.error(" avgPredBG:"+ea+" COB/Carbs:"+l.mealCOB+"/"+l.carbs),ga>Xe&&(Tt=Math.min(Tt,ga)),He.COB=l.mealCOB,He.IOB=a.iob,He.BGI=n(St,i),He.deviation=n(Dt,i),He.ISF=n(bt,i),He.CR=o($,1),He.target_bg=n(rt,i),He.TDD=o(ve,2),He.current_target=o(rt,0);var ya=He.CR;ke!=He.CR&&(ya=ke+"→"+He.CR),He.reason=ft+", COB: "+He.COB+", Dev: "+He.deviation+", BGI: "+He.BGI+", CR: "+ya+", Target: "+gt+", minPredBG "+n(Tt,i)+", minGuardBG "+n(Ct,i)+", IOBpredBG "+n(ta,i),aa>0&&(He.reason+=", COBpredBG "+n(aa,i)),ra>0&&(He.reason+=", UAMpredBG "+n(ra,i)),He.reason+=P,He.reason+="; ";var xa=wt;xa<40&&(xa=Math.min(Ct,xa));var Sa,Da=C-xa,wa=240,Ga=240;if(l.mealCOB>0&&(Pt>0||Qt>0)){for(Ba=0;Ba<Ot.length;Ba++)if(Ot[Ba]<ot){wa=5*Ba;break}for(Ba=0;Ba<Ot.length;Ba++)if(Ot[Ba]<C){Ga=5*Ba;break}}else{for(Ba=0;Ba<At.length;Ba++)if(At[Ba]<ot){wa=5*Ba;break}for(Ba=0;Ba<At.length;Ba++)if(At[Ba]<C){Ga=5*Ba;break}}Ft&&Ct<C&&(console.error("minGuardBG "+n(Ct,i)+" projected below "+n(C,i)+" - disabling SMB"),He.manualBolusErrorString=1,He.minGuardBG=Ct,He.insulinForManualBolus=o((He.eventualBG-He.target_bg)/bt,2),Ft=!1),void 0===i.maxDelta_bg_threshold&&(Sa=.2),void 0!==i.maxDelta_bg_threshold&&(Sa=Math.min(i.maxDelta_bg_threshold,.4)),at>Sa*Xe&&(console.error("maxDelta "+n(at,i)+" > "+100*Sa+"% of BG "+n(Xe,i)+" - disabling SMB"),He.reason+="maxDelta "+n(at,i)+" > "+100*Sa+"% of BG "+n(Xe,i)+" - SMB disabled!, ",Ft=!1),console.error("BG projected to remain above "+n(ot,i)+" for "+wa+"minutes"),(Ga<240||wa<60)&&console.error("BG projected to remain above "+n(C,i)+" for "+Ga+"minutes");var Ta=Ga,Ca=i.current_basal*H*bt*Ta/60,Ua=Math.max(0,l.mealCOB-.25*l.carbs),Oa=(Da-Ca)/csf-Ua;Ca=o(Ca),Oa=o(Oa),console.error("naive_eventualBG:",wt,"bgUndershoot:",Da,"zeroTempDuration:",Ta,"zeroTempEffect:",Ca,"carbsReq:",Oa),"Could not parse clock data"==l.reason?console.error("carbsReq unknown: Could not parse clock data"):Oa>=i.carbsReqThreshold&&Ga<=45&&(He.carbsReq=Oa,He.reason+=Oa+" add'l carbs req w/in "+Ga+"m; ");var Aa=0;if(Xe<C&&a.iob<-i.current_basal*H*20/60&&et>0&&et>Ut)He.reason+="IOB "+a.iob+" < "+o(-i.current_basal*H*20/60,2),He.reason+=" and minDelta "+n(et,i)+" > expectedDelta "+n(Ut,i)+"; ";else if(Xe<C||Ct<C)return He.reason+="minGuardBG "+n(Ct,i)+"<"+n(C,i),Da=rt-Ct,Ct<C&&(He.manualBolusErrorString=2,He.minGuardBG=Ct),He.insulinForManualBolus=o((Gt-rt)/bt,2),Aa=o(60*(Da/bt)/i.current_basal*H),Aa=30*o(Aa/30),Aa=Math.min(120,Math.max(30,Aa)),u.setTempBasal(0,Aa,i,He,t);if(i.skip_neutral_temps&&He.deliverAt.getMinutes()>=55)return He.reason+="; Canceling temp at "+He.deliverAt.getMinutes()+"m past the hour. ",u.setTempBasal(0,0,i,He,t);var Ra=0,Ia=Je,Fa=0;if(Gt<ot){if(He.reason+="Eventual BG "+n(Gt,i)+" < "+n(ot,i),et>Ut&&et>0&&!Oa)return wt<40?(He.reason+=", naive_eventualBG < 40. ",u.setTempBasal(0,30,i,He,t)):(e.delta>et?He.reason+=", but Delta "+n(Ke,i)+" > expectedDelta "+n(Ut,i):He.reason+=", but Min. Delta "+et.toFixed(2)+" > Exp. Delta "+n(Ut,i),t.duration>15&&r(Je,i)===r(t.rate,i)?(He.reason+=", temp "+t.rate+" ~ req "+Je+"U/hr. ",He):(He.reason+="; setting current basal of "+Je+" as temp. ",u.setTempBasal(Je,30,i,He,t)));Ra=o(Ra=2*Math.min(0,(Gt-rt)/bt),2);var ja=Math.min(0,(wt-rt)/bt);if(ja=o(ja,2),et<0&&et>Ut)Ra=o(Ra*(et/Ut),2);Ia=r(Ia=Je+2*Ra,i),Fa=t.duration*(t.rate-Je)/60;var Pa=Math.min(Ra,ja);if(console.log("naiveInsulinReq:"+ja),Fa<Pa-.3*Je)return He.reason+=", "+t.duration+"m@"+t.rate.toFixed(2)+" is a lot less than needed. ",u.setTempBasal(Ia,30,i,He,t);if(void 0!==t.rate&&t.duration>5&&Ia>=.8*t.rate)return He.reason+=", temp "+t.rate+" ~< req "+Ia+"U/hr. ",He;if(Ia<=0){if((Aa=o(60*((Da=rt-wt)/bt)/i.current_basal*H))<0?Aa=0:(Aa=30*o(Aa/30),Aa=Math.min(120,Math.max(0,Aa))),Aa>0)return He.reason+=", setting "+Aa+"m zero temp. ",u.setTempBasal(Ia,Aa,i,He,t)}else He.reason+=", setting "+Ia+"U/hr. ";return u.setTempBasal(Ia,30,i,He,t)}if(et<Ut&&(He.minDelta=et,He.expectedDelta=Ut,(Ut-et>=2||Ut+-1*et>=2)&&(He.manualBolusErrorString=et>=0&&Ut>0?3:et<0&&Ut<=0||et<0&&Ut>=0?4:5),He.insulinForManualBolus=o((He.eventualBG-He.target_bg)/bt,2),!d||!Ft))return e.delta<et?He.reason+="Eventual BG "+n(Gt,i)+" > "+n(ot,i)+" but Delta "+n(Ke,i)+" < Exp. Delta "+n(Ut,i):He.reason+="Eventual BG "+n(Gt,i)+" > "+n(ot,i)+" but Min. Delta "+et.toFixed(2)+" < Exp. Delta "+n(Ut,i),t.duration>15&&r(Je,i)===r(t.rate,i)?(He.reason+=", temp "+t.rate+" ~ req "+Je+"U/hr. ",He):(He.reason+="; setting current basal of "+Je+" as temp. ",u.setTempBasal(Je,30,i,He,t));if(Math.min(Gt,Tt)<nt&&(Tt<ot&&Gt>ot&&(He.manualBolusErrorString=6,He.insulinForManualBolus=o((He.eventualBG-He.target_bg)/bt,2),He.minPredBG=Tt),!d||!Ft))return He.reason+=n(Gt,i)+"-"+n(Tt,i)+" in range: no temp required",t.duration>15&&r(Je,i)===r(t.rate,i)?(He.reason+=", temp "+t.rate+" ~ req "+Je+"U/hr. ",He):(He.reason+="; setting current basal of "+Je+" as temp. ",u.setTempBasal(Je,30,i,He,t));if(Gt>=nt&&(He.reason+="Eventual BG "+n(Gt,i)+" >= "+n(nt,i)+", ",Gt>nt&&(He.insulinForManualBolus=o((Gt-rt)/bt,2))),a.iob>st)return He.reason+="IOB "+o(a.iob,2)+" > max_iob "+st,t.duration>15&&r(Je,i)===r(t.rate,i)?(He.reason+=", temp "+t.rate+" ~ req "+Je+"U/hr. ",He):(He.reason+="; setting current basal of "+Je+" as temp. ",u.setTempBasal(Je,30,i,He,t));Ra=o((Math.min(Tt,Gt)-rt)/bt,2),T=o((Gt-rt)/bt,2),Ra>st-a.iob?(console.error("SMB limited by maxIOB: "+st-a.iob+" (. insulinReq: "+Ra+" U)"),He.reason+="max_iob "+st+", ",Ra=st-a.iob):console.error("SMB not limited by maxIOB ( insulinReq: "+Ra+" U)."),T>st-a.iob?(console.error("Ev. Bolus limited by maxIOB: "+st-a.iob+" (. insulinForManualBolus: "+T+" U)"),He.reason+="max_iob "+st+", "):console.error("Ev. Bolus would not be limited by maxIOB ( insulinForManualBolus: "+T+" U)."),Ia=r(Ia=Je+2*Ra,i),Ra=o(Ra,3),He.insulinReq=Ra;var Ea=o((new Date(U).getTime()-a.lastBolusTime)/6e4,1);if(d&&Ft&&Xe>C){var qa=30;void 0!==i.maxSMBBasalMinutes&&(qa=i.maxSMBBasalMinutes);var Wa=30;void 0!==i.maxUAMSMBBasalMinutes&&(Wa=i.maxUAMSMBBasalMinutes),v.useOverride&&M&&D!==qa&&(console.error("SMB Max Minutes - setting overriden from "+qa+" to "+D),qa=D),v.useOverride&&M&&w!==Wa&&(console.error("UAM Max Minutes - setting overriden from "+Wa+" to "+w),Wa=w);var ka=o(l.mealCOB/$,3),La=0;void 0===qa?(La=o(i.current_basal*H*30/60,1),console.error("smbMinutesSetting undefined: defaulting to 30m"),Ra>La&&console.error("SMB limited by maxBolus: "+La+" ( "+Ra+" U)")):a.iob>ka&&a.iob>0?(console.error("IOB"+a.iob+"> COB"+l.mealCOB+"; mealInsulinReq ="+ka),Wa?(console.error("maxUAMSMBBasalMinutes: "+Wa+", profile.current_basal: "+i.current_basal*H),La=o(i.current_basal*H*Wa/60,1)):(console.error("maxUAMSMBBasalMinutes undefined: defaulting to 30m"),La=o(i.current_basal*H*30/60,1)),Ra>La?console.error("SMB limited by maxUAMSMBBasalMinutes [ "+Wa+"m ]: "+La+"U ( "+Ra+"U )"):console.error("SMB is not limited by maxUAMSMBBasalMinutes. ( insulinReq: "+Ra+"U )")):(console.error(".maxSMBBasalMinutes: "+qa+", profile.current_basal: "+i.current_basal*H),Ra>(La=o(i.current_basal*H*qa/60,1))?console.error("SMB limited by maxSMBBasalMinutes: "+qa+"m ]: "+La+"U ( insulinReq: "+Ra+"U )"):console.error("SMB is not limited by maxSMBBasalMinutes. ( insulinReq: "+Ra+"U )"));var za=i.bolus_increment,Na=1/za,Ha=Math.min(i.smb_delivery_ratio,1);.5!=Ha&&console.error("SMB Delivery Ratio changed from default 0.5 to "+o(Ha,2));var Za=Math.min(Ra*Ha,La);Za=Math.floor(Za*Na)/Na,Aa=o(60*((rt-(wt+oa)/2)/bt)/i.current_basal*H),Ra>0&&Za<za&&(Aa=0);var $a=0;Aa<=0?Aa=0:Aa>=30?(Aa=30*o(Aa/30),Aa=Math.min(60,Math.max(0,Aa))):($a=o(Je*Aa/30,2),Aa=30),He.reason+=" insulinReq "+Ra,Za>=La&&(He.reason+="; maxBolus "+La),Aa>0&&(He.reason+="; setting "+Aa+"m low temp of "+$a+"U/h"),He.reason+=". ";var Ja=3;i.SMBInterval&&(Ja=Math.min(10,Math.max(1,i.SMBInterval)));var Ka=o(Ja-Ea,0),Qa=o(60*(Ja-Ea),0)%60;if(console.error("naive_eventualBG "+wt+","+Aa+"m "+$a+"U/h temp needed; last bolus "+Ea+"m ago; maxBolus: "+La),Ea>Ja?Za>0&&(He.units=Za,He.reason+="Microbolusing "+Za+"U. "):He.reason+="Waiting "+Ka+"m "+Qa+"s to microbolus again. ",Aa>0)return He.rate=$a,He.duration=Aa,He}var Va=u.getMaxSafeBasal(i);return 400==Xe?u.setTempBasal(i.current_basal,30,i,He,t):(Ia>Va&&(He.reason+="adj. req. rate: "+Ia+" to maxSafeBasal: "+o(Va,2)+", ",Ia=r(Va,i)),(Fa=t.duration*(t.rate-Je)/60)>=2*Ra?(He.reason+=t.duration+"m@"+t.rate.toFixed(2)+" > 2 * insulinReq. Setting temp basal of "+Ia+"U/hr. ",u.setTempBasal(Ia,30,i,He,t)):void 0===t.duration||0===t.duration?(He.reason+="no temp, setting "+Ia+"U/hr. ",u.setTempBasal(Ia,30,i,He,t)):t.duration>5&&r(Ia,i)<=r(t.rate,i)?(He.reason+="temp "+t.rate+" >~ req "+Ia+"U/hr. ",He):(He.reason+="temp "+t.rate+"<"+Ia+"U/hr. ",u.setTempBasal(Ia,30,i,He,t)))}},3531:(e,t,a)=>{var r=a(2296);e.exports=function(e,t){var a=20;void 0!==t&&"string"==typeof t.model&&(r(t.model,"54")||r(t.model,"23"))&&(a=40);return e<1?Math.round(e*a)/a:e<10?Math.round(20*e)/20:Math.round(10*e)/10}},1873:(e,t,a)=>{var r=a(9325).Symbol;e.exports=r},4932:e=>{e.exports=function(e,t){for(var a=-1,r=null==e?0:e.length,o=Array(r);++a<r;)o[a]=t(e[a],a,e);return o}},7133:e=>{e.exports=function(e,t,a){return e==e&&(void 0!==a&&(e=e<=a?e:a),void 0!==t&&(e=e>=t?e:t)),e}},2552:(e,t,a)=>{var r=a(1873),o=a(659),n=a(9350),i=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):n(e)}},7556:(e,t,a)=>{var r=a(1873),o=a(4932),n=a(6449),i=a(4394),s=r?r.prototype:void 0,l=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(n(t))return o(t,e)+"";if(i(t))return l?l.call(t):"";var a=t+"";return"0"==a&&1/t==-1/0?"-0":a}},4128:(e,t,a)=>{var r=a(1800),o=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},4840:(e,t,a)=>{var r="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g;e.exports=r},659:(e,t,a)=>{var r=a(1873),o=Object.prototype,n=o.hasOwnProperty,i=o.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=n.call(e,s),a=e[s];try{e[s]=void 0;var r=!0}catch(e){}var o=i.call(e);return r&&(t?e[s]=a:delete e[s]),o}},9350:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9325:(e,t,a)=>{var r=a(4840),o="object"==typeof self&&self&&self.Object===Object&&self,n=r||o||Function("return this")();e.exports=n},1800:e=>{var t=/\s/;e.exports=function(e){for(var a=e.length;a--&&t.test(e.charAt(a)););return a}},2296:(e,t,a)=>{var r=a(7133),o=a(7556),n=a(1489),i=a(3222);e.exports=function(e,t,a){e=i(e),t=o(t);var s=e.length,l=a=void 0===a?s:r(n(a),0,s);return(a-=t.length)>=0&&e.slice(a,l)==t}},6449:e=>{var t=Array.isArray;e.exports=t},3805:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},4394:(e,t,a)=>{var r=a(2552),o=a(346);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},7400:(e,t,a)=>{var r=a(6993),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1489:(e,t,a)=>{var r=a(7400);e.exports=function(e){var t=r(e),a=t%1;return t==t?a?t-a:t:0}},6993:(e,t,a)=>{var r=a(4128),o=a(3805),n=a(4394),i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(n(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var a=s.test(e);return a||l.test(e)?u(e.slice(2),a?2:8):i.test(e)?NaN:+e}},3222:(e,t,a)=>{var r=a(7556);e.exports=function(e){return null==e?"":r(e)}}},t={};function a(r){var o=t[r];if(void 0!==o)return o.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,a),n.exports}a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var r=a(2982);freeaps_determineBasal=r})();
|