@opentrons/step-generation 0.3.26-alpha.0 → 0.3.27-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/index.cjs +28 -28
- package/lib/index.mjs +18 -18
- package/package.json +3 -3
package/lib/index.cjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@opentrons/shared-data");function nI(){return{type:"INSUFFICIENT_TIPS",message:"Not enough tips to complete action"}}function oI(){return{type:"MISSING_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips fully without an adapter"}}function aI(){return{type:"REMOVE_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips partially with an adapter"}}function Yt(e){const{actionName:t,pipette:r,labware:n,well:o}=e;return{message:n==null||o==null?`Attempted to ${t} with no tip on pipette: ${r} in place`:`Attempted to ${t} with no tip on pipette: ${r} from ${n}'s well ${o}`,type:"NO_TIP_ON_PIPETTE"}}function sI(){return{message:"One or more of the pipettes has a tip",type:"PIPETTE_HAS_TIP"}}function ht(e){const{pipette:t}=e;return{message:`This step tries to use the ${t}. Add the pipette to your protocol or change the step to use a different pipette.`,type:"PIPETTE_DOES_NOT_EXIST"}}function _t(e){const{actionName:t,labware:r}=e;return console.warn(`Attempted to ${t} with labware id "${r}", this labware was not found under "labware"`),{message:`This step tries to use ${r}. Add the labware to your protocol or change the step to use a different labware.`,type:"LABWARE_DOES_NOT_EXIST"}}function de(){return{message:"This step requires a module, but none is selected",type:"MISSING_MODULE"}}function iI(){return{message:"This module is not changing temperature because it has either been deactivated or is already holding a temperature. In order to pause the protocol and wait for your module to reach a temperature, you must first use a Temperature step to tell the module to start changing to a new temperature",type:"MISSING_TEMPERATURE_STEP"}}function Ep(){return{message:"This module is not currently running a profile.",type:"MISSING_PROFILE_STEP"}}function lI(e){const{volume:t,maxVolume:r,actionName:n}=e;return{message:`This step tries to ${n} ${t}µL, but the tip can only hold ${r}µL.`,type:"TIP_VOLUME_EXCEEDED"}}function C(e){const{parameterName:t}=e;return{message:`Runtime parameter "${t}" is missing`,type:"INVALID_RUNTIME_PARAMETER"}}function ba(e){const{actionName:t,volume:r,maxVolume:n,disposalVolume:o}=e;return{message:o!=null?`Attemped to ${t} volume + disposal volume greater than pipette max volume (${r} + ${o} > ${n})`:`This step tries to ${t} ${r}µL, but the tip can only hold ${n}µL.`,type:"PIPETTE_VOLUME_EXCEEDED"}}const uI=()=>({type:"MOVE_LOCATION_NOT_SPECIFIED",message:"This step is missing a move location."}),Ro=()=>({type:"MODULE_PIPETTE_COLLISION_DANGER",message:"Gen 1 8-Channel pipettes cannot access labware or tip racks in slot 4 or 6 because they are adjacent to modules."}),cI=()=>({type:"THERMOCYCLER_BUSY_WITH_PROFILE",message:"This step cannot run while the Thermocycler is running a profile. Move the step outside the profile."}),vn=()=>({type:"THERMOCYCLER_LID_CLOSED",message:"Attempted to interact with contents of a thermocycler with the lid closed."}),Ea=()=>({type:"HEATER_SHAKER_LATCH_OPEN",message:"Attempted to interact with contents of a heater-shaker with the latch open."}),Ap=()=>({type:"HEATER_SHAKER_LATCH_CLOSED",message:"Attempted to move the contents of a heater-shaker with the latch closed."}),xr=()=>({type:"ABSORBANCE_READER_LID_CLOSED",message:"Attempted to interact with contents of an absorbance plate reader with the lid closed."}),pI=()=>({type:"ABSORBANCE_READER_NO_INITIALIZATION",message:"This step tries to read labware without initializing the Plate Reader first. Initialize the Plate Reader module or remove this step in order to proceed."}),Vh=()=>({type:"ABSORBANCE_READER_NO_GRIPPER",message:"This step involves opening or closing the Absorbance Plate Reader lid with a gripper. Add a gripper or remove step to proceed."}),dI=()=>({type:"HOPPER_EMPTY",message:"Cannot retrieve labware from empty stacker"}),fI=()=>({type:"SHUTTLE_FULL",message:"Shuttle must be empty in order to retrieve labware from the stacker"}),mI=()=>({type:"SHUTTLE_EMPTY",message:"Shuttle must have labware in order to store it in the stacker"}),Bh=()=>({type:"MISMATCHED_STACKER_LABWARE_TYPE",message:"The stacker can only store a single type of labware at a time"}),hI=()=>({type:"MISSING_STACKER_LABWARE_TYPE",message:"Add labware to the stacker in the starting deck so that you can refill it later"}),xh=()=>({type:"HOPPER_FULL",message:"The hopper has reached capacity"}),Pn=()=>({type:"HEATER_SHAKER_IS_SHAKING",message:"Attempted to interact with the contents of a heater-shaker when it is shaking."}),_I=e=>({type:"TALL_LABWARE_EAST_WEST_OF_HEATER_SHAKER",message:`Labware over 53 mm is ${e} of this Heater-Shaker module.`}),jt=e=>{const{unsafePipetteMovementReason:t}=e;switch(t.type){case"thermocyclerLidCollision":return{type:"POSSIBLE_PIPETTE_COLLISION_THERMOCYCLER_LID",message:"There is a possibility that the Pipette will collide with the Thermocycler lid"};case"outsidePipetteExtents":return{type:"POSSIBLE_PIPETTE_COLLISION_OUTSIDE_DECK_EXTENTS",message:"There is a possibility that the pipette will move outside the deck extents."};case"adjacentAdressableAreaCollision":return{type:"POSSIBLE_PIPETTE_COLLISION_ADJACENT_ADDRESSABLE_AREA",message:`There is a possibility that the pipette will collide with adjacent items in ${t.addressableAreaCausingCollision.displayName}`,translationParams:{addressableAreaCausingCollisionDisplayName:t.addressableAreaCausingCollision.displayName}}}},No=()=>({type:"HEATER_SHAKER_EAST_WEST_LATCH_OPEN",message:"The Heater-Shaker labware latch is open"}),ko=()=>({type:"HEATER_SHAKER_NORTH_SOUTH_EAST_WEST_SHAKING",message:"The Heater-Shaker is shaking"}),Co=()=>({type:"HEATER_SHAKER_EAST_WEST_MULTI_CHANNEL",message:"The Heater-Shaker is shaking"}),Aa=()=>({type:"HEATER_SHAKER_NORTH_SOUTH__OF_NON_TIPRACK_WITH_MULTI_CHANNEL",message:"8-Channel pipette cannot access labware"}),Rn=()=>({type:"LABWARE_OFF_DECK",message:"Attempted to interact with labware off deck"}),yI=()=>({type:"LABWARE_ON_ANOTHER_ENTITY",message:"Attempted to move labware onto another entity with the same slotName"}),Fn=()=>({type:"DROP_TIP_LOCATION_DOES_NOT_EXIST",message:"The destination for dropping tip does not exist"}),zh=()=>({type:"EQUIPMENT_DOES_NOT_EXIST",message:"Equipment does not exist."}),bI=()=>({type:"GRIPPER_REQUIRED",message:"The gripper is required to fulfill this action"}),Wt=e=>({type:"PIPETTING_INTO_COLUMN_4",message:`Cannot ${e.typeOfStep} into a column 4 slot.`}),II=()=>({type:"CANNOT_MOVE_WITH_GRIPPER",message:"The gripper cannot move aluminum blocks"}),TI=()=>({type:"NO_TIP_SELECTED",message:"No tips were selected for this step"}),Do=()=>({type:"LABWARE_DISCARDED_IN_TRASH",message:"The labware was discarded in trash in a previous step."}),Hh=()=>({type:"SUBMERGE_BELOW_ASPIRATE",message:"The submerge position must be above the aspirate position"}),jh=()=>({type:"RETRACT_BELOW_ASPIRATE",message:"The retract position must be above the aspirate position"}),wI=()=>({type:"SUBMERGE_BELOW_DISPENSE",message:"The submerge position must be above the dispense position"}),SI=()=>({type:"RETRACT_BELOW_DISPENSE",message:"The retract position must be above the dispense position"}),gI=()=>({type:"MULTI_ASPIRATE_VOLUME_TOO_HIGH",message:"Consolidate pipette path was selected but cannot fit volume for more than 1 well in the tip"}),EI=()=>({type:"MULTI_DISPENSE_VOLUME_TOO_HIGH",message:"Distribute pipette path was selected but cannot fit volume for more than 1 well in the tip"}),AI=e=>({type:"CLOSING_THERMOCYCLER_WITH_INVALID_LABWARE_LID",message:`Closing the Thermocycler lid with ${e.lidDisplayName} in place will cause damage`}),Lp=()=>({type:"RETURN_TIP_UNAVAILABLE",message:"Current tip does not have a known location to return to"}),LI=()=>({type:"TIPRACK_LID_NOT_ALLOWED_ON_DECK",message:"The tip rack lid is not supported directly on the deck"}),OI=()=>({type:"NEXT_TIPRACK_HAS_LID",message:"A pipette cannot pick up tips from a tip rack with a lid"}),vI=e=>({type:"STACK_TOO_HIGH",message:`The stack on slot ${e.slot} is too high`}),PI=()=>({type:"TOO_MANY_TIPS",message:"Action will pick up too many tips"}),RI=()=>({type:"INCOMPLETE_PICKUP",message:"At least one of the selected tips is empty"}),NI=()=>({type:"LABWARE_ON_HOPPER",message:"Labware cannot be moved from the Flex Stacker Hopper"}),kI=()=>({type:"MISSING_PUMP_ACTIVITY",message:"This module is not currently running a pump activity."}),CI=e=>({type:"INVALID_WAIT_CONDITION",message:`Invalid wait condition: ${e}`}),Mo=()=>({type:"LIVE_TASK_ERROR",message:"This module is currently running a live task. Please wait for it to complete before performing this action."}),Op=()=>({type:"VACUUM_UNDER_PRESSURE",message:"The vacuum module is under pressure. Deactivate the pump to move labware to or from it."});function Ye(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rs,vp;function Wh(){if(vp)return rs;vp=1;var e=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;return rs=e,rs}var ns,Pp;function Kt(){if(Pp)return ns;Pp=1;var e=Wh(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return ns=r,ns}var os,Rp;function Un(){if(Rp)return os;Rp=1;var e=Kt(),t=e.Symbol;return os=t,os}var as,Np;function DI(){if(Np)return as;Np=1;var e=Un(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,o=e?e.toStringTag:void 0;function a(s){var i=r.call(s,o),l=s[o];try{s[o]=void 0;var u=!0}catch{}var p=n.call(s);return u&&(i?s[o]=l:delete s[o]),p}return as=a,as}var ss,kp;function MI(){if(kp)return ss;kp=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return ss=r,ss}var is,Cp;function $n(){if(Cp)return is;Cp=1;var e=Un(),t=DI(),r=MI(),n="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function s(i){return i==null?i===void 0?o:n:a&&a in Object(i)?t(i):r(i)}return is=s,is}var ls,Dp;function cr(){if(Dp)return ls;Dp=1;function e(t){return t!=null&&typeof t=="object"}return ls=e,ls}var us,Mp;function Fo(){if(Mp)return us;Mp=1;var e=$n(),t=cr(),r="[object Symbol]";function n(o){return typeof o=="symbol"||t(o)&&e(o)==r}return us=n,us}var cs,Fp;function Gh(){if(Fp)return cs;Fp=1;var e=Fo();function t(r,n,o){for(var a=-1,s=r.length;++a<s;){var i=r[a],l=n(i);if(l!=null&&(u===void 0?l===l&&!e(l):o(l,u)))var u=l,p=i}return p}return cs=t,cs}var ps,Up;function FI(){if(Up)return ps;Up=1;function e(t,r){return t<r}return ps=e,ps}var ds,$p;function Uo(){if($p)return ds;$p=1;function e(t){return t}return ds=e,ds}var fs,qp;function UI(){if(qp)return fs;qp=1;var e=Gh(),t=FI(),r=Uo();function n(o){return o&&o.length?e(o,r,t):void 0}return fs=n,fs}var $I=UI();const qI=Ye($I),$o="TEMPERATURE_DEACTIVATED",gc="TEMPERATURE_AT_TARGET",Ec="TEMPERATURE_APPROACHING_TARGET",nc=1,Yh=[c.MAGNETIC_MODULE_V1,c.TEMPERATURE_MODULE_V1],oc="fixedTrash",Kh={type:c.MAGNETIC_MODULE_TYPE,engaged:!1},Zh={type:c.TEMPERATURE_MODULE_TYPE,status:$o,targetTemperature:null},Xh={type:c.THERMOCYCLER_MODULE_TYPE,currentBlockActivity:{type:"blockDeactivated"},lidTargetTemp:null,lidOpen:null,numProfilesStarted:0},Qh={type:c.HEATERSHAKER_MODULE_TYPE,targetTemp:null,targetSpeed:null,latchOpen:null},Jh={type:"absorbanceReaderType",lidOpen:null,initialization:null},e_={type:"magneticBlockType"},t_={type:c.FLEX_STACKER_MODULE_TYPE,storedLabwareDetails:null,labwareInHopper:null,labwareOnShuttle:null,setStoredLabwareCount:1,fillCount:1},r_={type:c.VACUUM_MODULE_TYPE,ventStatus:null,numPumpActivitiesStarted:0,currentPumpActivity:{type:"pumpDeactivated"}},n_={[c.MAGNETIC_MODULE_TYPE]:Kh,[c.TEMPERATURE_MODULE_TYPE]:Zh,[c.THERMOCYCLER_MODULE_TYPE]:Xh,[c.HEATERSHAKER_MODULE_TYPE]:Qh,[c.ABSORBANCE_READER_TYPE]:Jh,[c.MAGNETIC_BLOCK_TYPE]:e_,[c.FLEX_STACKER_MODULE_TYPE]:t_,[c.VACUUM_MODULE_TYPE]:r_},VI="opentrons/opentrons_1_trash_1100ml_fixed/1",BI="opentrons/opentrons_1_trash_3200ml_fixed/1",De=["A4","B4","C4","D4"],vt={x:0,y:0,z:0},o_="mounted",qo="CLEAN",or="DIRTY",_e="EMPTY",Ia="automatic",yt="manual",a_=["A4","B4","C4","D4"],xI=["7","8","10","11"],rt="hopper",s_=["hopperA4","hopperB4","hopperC4","hopperD4"],i_={hopperA4:"A4",hopperB4:"B4",hopperC4:"C4",hopperD4:"D4"},ar=["adapterLabwareId","primaryLabwareId","lidLabwareId"],zI=["adapterLabwareURI","primaryLabwareURI","lidLabwareURI"],HI={A4:"hopperA4",B4:"hopperB4",C4:"hopperC4",D4:"hopperD4"},Ac="vacuumDock",l_=c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA,Lc="opened",Vo="closed",ac="power",sc="pressure",jI="state",WI="profile",GI="pumpOff",YI="pumpOn",KI="vent",ZI="open",XI="closed",QI="VACUUM_DEACTIVATED",JI="VACUUM_AT_TARGET",u_=["opentrons_vacuum_manifold_spacer_short","opentrons_vacuum_manifold_spacer_tall","opentrons_vacuum_manifold_spacer_3.2mm","opentrons_vacuum_manifold_spacer_5.2mm","opentrons_vacuum_manifold_spacer_7.25mm","opentrons_vacuum_manifold_spacer_12.8mm"],c_=3,p_="A4",La=[c.ALL,c.COLUMN,c.SINGLE,c.ROW,c.QUADRANT,c.PARTIAL_COLUMN],Oa=[c.A1_NOZZLE,c.A12_NOZZLE,c.B1_NOZZLE,c.C1_NOZZLE,c.D1_NOZZLE,c.E1_NOZZLE,c.F1_NOZZLE,c.G1_NOZZLE,c.H1_NOZZLE,c.H12_NOZZLE],d_=[c.B1_NOZZLE,c.C1_NOZZLE,c.D1_NOZZLE,c.E1_NOZZLE,c.F1_NOZZLE,c.G1_NOZZLE],He=[];for(let e=0;e<256;++e)He.push((e+256).toString(16).slice(1));function eT(e,t=0){return(He[e[t+0]]+He[e[t+1]]+He[e[t+2]]+He[e[t+3]]+"-"+He[e[t+4]]+He[e[t+5]]+"-"+He[e[t+6]]+He[e[t+7]]+"-"+He[e[t+8]]+He[e[t+9]]+"-"+He[e[t+10]]+He[e[t+11]]+He[e[t+12]]+He[e[t+13]]+He[e[t+14]]+He[e[t+15]]).toLowerCase()}const tT=new Uint8Array(16);function rT(){return crypto.getRandomValues(tT)}function nT(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():oT(e,t,r)}function oT(e,t,r){e=e||{};const n=e.random??e.rng?.()??rT();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return eT(n)}var ms,Vp;function Oc(){if(Vp)return ms;Vp=1;function e(t,r){for(var n=-1,o=r.length,a=t.length;++n<o;)t[a+n]=r[n];return t}return ms=e,ms}var hs,Bp;function aT(){if(Bp)return hs;Bp=1;var e=$n(),t=cr(),r="[object Arguments]";function n(o){return t(o)&&e(o)==r}return hs=n,hs}var _s,xp;function va(){if(xp)return _s;xp=1;var e=aT(),t=cr(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(s){return t(s)&&n.call(s,"callee")&&!o.call(s,"callee")};return _s=a,_s}var ys,zp;function nt(){if(zp)return ys;zp=1;var e=Array.isArray;return ys=e,ys}var bs,Hp;function sT(){if(Hp)return bs;Hp=1;var e=Un(),t=va(),r=nt(),n=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(n&&a&&a[n])}return bs=o,bs}var Is,jp;function f_(){if(jp)return Is;jp=1;var e=Oc(),t=sT();function r(n,o,a,s,i){var l=-1,u=n.length;for(a||(a=t),i||(i=[]);++l<u;){var p=n[l];o>0&&a(p)?o>1?r(p,o-1,a,s,i):e(i,p):s||(i[i.length]=p)}return i}return Is=r,Is}var Ts,Wp;function Bo(){if(Wp)return Ts;Wp=1;function e(t,r){for(var n=-1,o=t==null?0:t.length,a=Array(o);++n<o;)a[n]=r(t[n],n,t);return a}return Ts=e,Ts}var ws,Gp;function iT(){if(Gp)return ws;Gp=1;function e(){this.__data__=[],this.size=0}return ws=e,ws}var Ss,Yp;function Pa(){if(Yp)return Ss;Yp=1;function e(t,r){return t===r||t!==t&&r!==r}return Ss=e,Ss}var gs,Kp;function Ra(){if(Kp)return gs;Kp=1;var e=Pa();function t(r,n){for(var o=r.length;o--;)if(e(r[o][0],n))return o;return-1}return gs=t,gs}var Es,Zp;function lT(){if(Zp)return Es;Zp=1;var e=Ra(),t=Array.prototype,r=t.splice;function n(o){var a=this.__data__,s=e(a,o);if(s<0)return!1;var i=a.length-1;return s==i?a.pop():r.call(a,s,1),--this.size,!0}return Es=n,Es}var As,Xp;function uT(){if(Xp)return As;Xp=1;var e=Ra();function t(r){var n=this.__data__,o=e(n,r);return o<0?void 0:n[o][1]}return As=t,As}var Ls,Qp;function cT(){if(Qp)return Ls;Qp=1;var e=Ra();function t(r){return e(this.__data__,r)>-1}return Ls=t,Ls}var Os,Jp;function pT(){if(Jp)return Os;Jp=1;var e=Ra();function t(r,n){var o=this.__data__,a=e(o,r);return a<0?(++this.size,o.push([r,n])):o[a][1]=n,this}return Os=t,Os}var vs,ed;function Na(){if(ed)return vs;ed=1;var e=iT(),t=lT(),r=uT(),n=cT(),o=pT();function a(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,vs=a,vs}var Ps,td;function dT(){if(td)return Ps;td=1;var e=Na();function t(){this.__data__=new e,this.size=0}return Ps=t,Ps}var Rs,rd;function fT(){if(rd)return Rs;rd=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return Rs=e,Rs}var Ns,nd;function mT(){if(nd)return Ns;nd=1;function e(t){return this.__data__.get(t)}return Ns=e,Ns}var ks,od;function hT(){if(od)return ks;od=1;function e(t){return this.__data__.has(t)}return ks=e,ks}var Cs,ad;function pr(){if(ad)return Cs;ad=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Cs=e,Cs}var Ds,sd;function m_(){if(sd)return Ds;sd=1;var e=$n(),t=pr(),r="[object AsyncFunction]",n="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function s(i){if(!t(i))return!1;var l=e(i);return l==n||l==o||l==r||l==a}return Ds=s,Ds}var Ms,id;function _T(){if(id)return Ms;id=1;var e=Kt(),t=e["__core-js_shared__"];return Ms=t,Ms}var Fs,ld;function yT(){if(ld)return Fs;ld=1;var e=_T(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return Fs=r,Fs}var Us,ud;function h_(){if(ud)return Us;ud=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Us=r,Us}var $s,cd;function bT(){if(cd)return $s;cd=1;var e=m_(),t=yT(),r=pr(),n=h_(),o=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,i=Object.prototype,l=s.toString,u=i.hasOwnProperty,p=RegExp("^"+l.call(u).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(f){if(!r(f)||t(f))return!1;var m=e(f)?p:a;return m.test(n(f))}return $s=d,$s}var qs,pd;function IT(){if(pd)return qs;pd=1;function e(t,r){return t?.[r]}return qs=e,qs}var Vs,dd;function Yr(){if(dd)return Vs;dd=1;var e=bT(),t=IT();function r(n,o){var a=t(n,o);return e(a)?a:void 0}return Vs=r,Vs}var Bs,fd;function vc(){if(fd)return Bs;fd=1;var e=Yr(),t=Kt(),r=e(t,"Map");return Bs=r,Bs}var xs,md;function ka(){if(md)return xs;md=1;var e=Yr(),t=e(Object,"create");return xs=t,xs}var zs,hd;function TT(){if(hd)return zs;hd=1;var e=ka();function t(){this.__data__=e?e(null):{},this.size=0}return zs=t,zs}var Hs,_d;function wT(){if(_d)return Hs;_d=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Hs=e,Hs}var js,yd;function ST(){if(yd)return js;yd=1;var e=ka(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function o(a){var s=this.__data__;if(e){var i=s[a];return i===t?void 0:i}return n.call(s,a)?s[a]:void 0}return js=o,js}var Ws,bd;function gT(){if(bd)return Ws;bd=1;var e=ka(),t=Object.prototype,r=t.hasOwnProperty;function n(o){var a=this.__data__;return e?a[o]!==void 0:r.call(a,o)}return Ws=n,Ws}var Gs,Id;function ET(){if(Id)return Gs;Id=1;var e=ka(),t="__lodash_hash_undefined__";function r(n,o){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&o===void 0?t:o,this}return Gs=r,Gs}var Ys,Td;function AT(){if(Td)return Ys;Td=1;var e=TT(),t=wT(),r=ST(),n=gT(),o=ET();function a(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,Ys=a,Ys}var Ks,wd;function LT(){if(wd)return Ks;wd=1;var e=AT(),t=Na(),r=vc();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Ks=n,Ks}var Zs,Sd;function OT(){if(Sd)return Zs;Sd=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Zs=e,Zs}var Xs,gd;function Ca(){if(gd)return Xs;gd=1;var e=OT();function t(r,n){var o=r.__data__;return e(n)?o[typeof n=="string"?"string":"hash"]:o.map}return Xs=t,Xs}var Qs,Ed;function vT(){if(Ed)return Qs;Ed=1;var e=Ca();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Qs=t,Qs}var Js,Ad;function PT(){if(Ad)return Js;Ad=1;var e=Ca();function t(r){return e(this,r).get(r)}return Js=t,Js}var ei,Ld;function RT(){if(Ld)return ei;Ld=1;var e=Ca();function t(r){return e(this,r).has(r)}return ei=t,ei}var ti,Od;function NT(){if(Od)return ti;Od=1;var e=Ca();function t(r,n){var o=e(this,r),a=o.size;return o.set(r,n),this.size+=o.size==a?0:1,this}return ti=t,ti}var ri,vd;function Pc(){if(vd)return ri;vd=1;var e=LT(),t=vT(),r=PT(),n=RT(),o=NT();function a(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,ri=a,ri}var ni,Pd;function kT(){if(Pd)return ni;Pd=1;var e=Na(),t=vc(),r=Pc(),n=200;function o(a,s){var i=this.__data__;if(i instanceof e){var l=i.__data__;if(!t||l.length<n-1)return l.push([a,s]),this.size=++i.size,this;i=this.__data__=new r(l)}return i.set(a,s),this.size=i.size,this}return ni=o,ni}var oi,Rd;function Rc(){if(Rd)return oi;Rd=1;var e=Na(),t=dT(),r=fT(),n=mT(),o=hT(),a=kT();function s(i){var l=this.__data__=new e(i);this.size=l.size}return s.prototype.clear=t,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=o,s.prototype.set=a,oi=s,oi}var ai,Nd;function CT(){if(Nd)return ai;Nd=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return ai=t,ai}var si,kd;function DT(){if(kd)return si;kd=1;function e(t){return this.__data__.has(t)}return si=e,si}var ii,Cd;function __(){if(Cd)return ii;Cd=1;var e=Pc(),t=CT(),r=DT();function n(o){var a=-1,s=o==null?0:o.length;for(this.__data__=new e;++a<s;)this.add(o[a])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,ii=n,ii}var li,Dd;function y_(){if(Dd)return li;Dd=1;function e(t,r){for(var n=-1,o=t==null?0:t.length;++n<o;)if(r(t[n],n,t))return!0;return!1}return li=e,li}var ui,Md;function b_(){if(Md)return ui;Md=1;function e(t,r){return t.has(r)}return ui=e,ui}var ci,Fd;function I_(){if(Fd)return ci;Fd=1;var e=__(),t=y_(),r=b_(),n=1,o=2;function a(s,i,l,u,p,d){var f=l&n,m=s.length,h=i.length;if(m!=h&&!(f&&h>m))return!1;var _=d.get(s),y=d.get(i);if(_&&y)return _==i&&y==s;var I=-1,b=!0,w=l&o?new e:void 0;for(d.set(s,i),d.set(i,s);++I<m;){var S=s[I],L=i[I];if(u)var g=f?u(L,S,I,i,s,d):u(S,L,I,s,i,d);if(g!==void 0){if(g)continue;b=!1;break}if(w){if(!t(i,function(T,A){if(!r(w,A)&&(S===T||p(S,T,l,u,d)))return w.push(A)})){b=!1;break}}else if(!(S===L||p(S,L,l,u,d))){b=!1;break}}return d.delete(s),d.delete(i),b}return ci=a,ci}var pi,Ud;function T_(){if(Ud)return pi;Ud=1;var e=Kt(),t=e.Uint8Array;return pi=t,pi}var di,$d;function MT(){if($d)return di;$d=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(o,a){n[++r]=[a,o]}),n}return di=e,di}var fi,qd;function Nc(){if(qd)return fi;qd=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(o){n[++r]=o}),n}return fi=e,fi}var mi,Vd;function FT(){if(Vd)return mi;Vd=1;var e=Un(),t=T_(),r=Pa(),n=I_(),o=MT(),a=Nc(),s=1,i=2,l="[object Boolean]",u="[object Date]",p="[object Error]",d="[object Map]",f="[object Number]",m="[object RegExp]",h="[object Set]",_="[object String]",y="[object Symbol]",I="[object ArrayBuffer]",b="[object DataView]",w=e?e.prototype:void 0,S=w?w.valueOf:void 0;function L(g,T,A,E,v,R,M){switch(A){case b:if(g.byteLength!=T.byteLength||g.byteOffset!=T.byteOffset)return!1;g=g.buffer,T=T.buffer;case I:return!(g.byteLength!=T.byteLength||!R(new t(g),new t(T)));case l:case u:case f:return r(+g,+T);case p:return g.name==T.name&&g.message==T.message;case m:case _:return g==T+"";case d:var F=o;case h:var G=E&s;if(F||(F=a),g.size!=T.size&&!G)return!1;var Y=M.get(g);if(Y)return Y==T;E|=i,M.set(g,T);var oe=n(F(g),F(T),E,v,R,M);return M.delete(g),oe;case y:if(S)return S.call(g)==S.call(T)}return!1}return mi=L,mi}var hi,Bd;function w_(){if(Bd)return hi;Bd=1;var e=Oc(),t=nt();function r(n,o,a){var s=o(n);return t(n)?s:e(s,a(n))}return hi=r,hi}var _i,xd;function S_(){if(xd)return _i;xd=1;function e(t,r){for(var n=-1,o=t==null?0:t.length,a=0,s=[];++n<o;){var i=t[n];r(i,n,t)&&(s[a++]=i)}return s}return _i=e,_i}var yi,zd;function g_(){if(zd)return yi;zd=1;function e(){return[]}return yi=e,yi}var bi,Hd;function kc(){if(Hd)return bi;Hd=1;var e=S_(),t=g_(),r=Object.prototype,n=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(s){return s==null?[]:(s=Object(s),e(o(s),function(i){return n.call(s,i)}))}:t;return bi=a,bi}var Ii,jd;function E_(){if(jd)return Ii;jd=1;function e(t,r){for(var n=-1,o=Array(t);++n<t;)o[n]=r(n);return o}return Ii=e,Ii}var Io={exports:{}},Ti,Wd;function UT(){if(Wd)return Ti;Wd=1;function e(){return!1}return Ti=e,Ti}Io.exports;var Gd;function Da(){return Gd||(Gd=1,(function(e,t){var r=Kt(),n=UT(),o=t&&!t.nodeType&&t,a=o&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===o,i=s?r.Buffer:void 0,l=i?i.isBuffer:void 0,u=l||n;e.exports=u})(Io,Io.exports)),Io.exports}var wi,Yd;function Ma(){if(Yd)return wi;Yd=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,o){var a=typeof n;return o=o??e,!!o&&(a=="number"||a!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<o}return wi=r,wi}var Si,Kd;function Cc(){if(Kd)return Si;Kd=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Si=t,Si}var gi,Zd;function $T(){if(Zd)return gi;Zd=1;var e=$n(),t=Cc(),r=cr(),n="[object Arguments]",o="[object Array]",a="[object Boolean]",s="[object Date]",i="[object Error]",l="[object Function]",u="[object Map]",p="[object Number]",d="[object Object]",f="[object RegExp]",m="[object Set]",h="[object String]",_="[object WeakMap]",y="[object ArrayBuffer]",I="[object DataView]",b="[object Float32Array]",w="[object Float64Array]",S="[object Int8Array]",L="[object Int16Array]",g="[object Int32Array]",T="[object Uint8Array]",A="[object Uint8ClampedArray]",E="[object Uint16Array]",v="[object Uint32Array]",R={};R[b]=R[w]=R[S]=R[L]=R[g]=R[T]=R[A]=R[E]=R[v]=!0,R[n]=R[o]=R[y]=R[a]=R[I]=R[s]=R[i]=R[l]=R[u]=R[p]=R[d]=R[f]=R[m]=R[h]=R[_]=!1;function M(F){return r(F)&&t(F.length)&&!!R[e(F)]}return gi=M,gi}var Ei,Xd;function Dc(){if(Xd)return Ei;Xd=1;function e(t){return function(r){return t(r)}}return Ei=e,Ei}var To={exports:{}};To.exports;var Qd;function Mc(){return Qd||(Qd=1,(function(e,t){var r=Wh(),n=t&&!t.nodeType&&t,o=n&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===n,s=a&&r.process,i=(function(){try{var l=o&&o.require&&o.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}})();e.exports=i})(To,To.exports)),To.exports}var Ai,Jd;function Fc(){if(Jd)return Ai;Jd=1;var e=$T(),t=Dc(),r=Mc(),n=r&&r.isTypedArray,o=n?t(n):e;return Ai=o,Ai}var Li,ef;function A_(){if(ef)return Li;ef=1;var e=E_(),t=va(),r=nt(),n=Da(),o=Ma(),a=Fc(),s=Object.prototype,i=s.hasOwnProperty;function l(u,p){var d=r(u),f=!d&&t(u),m=!d&&!f&&n(u),h=!d&&!f&&!m&&a(u),_=d||f||m||h,y=_?e(u.length,String):[],I=y.length;for(var b in u)(p||i.call(u,b))&&!(_&&(b=="length"||m&&(b=="offset"||b=="parent")||h&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||o(b,I)))&&y.push(b);return y}return Li=l,Li}var Oi,tf;function Fa(){if(tf)return Oi;tf=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,o=typeof n=="function"&&n.prototype||e;return r===o}return Oi=t,Oi}var vi,rf;function L_(){if(rf)return vi;rf=1;function e(t,r){return function(n){return t(r(n))}}return vi=e,vi}var Pi,nf;function qT(){if(nf)return Pi;nf=1;var e=L_(),t=e(Object.keys,Object);return Pi=t,Pi}var Ri,of;function O_(){if(of)return Ri;of=1;var e=Fa(),t=qT(),r=Object.prototype,n=r.hasOwnProperty;function o(a){if(!e(a))return t(a);var s=[];for(var i in Object(a))n.call(a,i)&&i!="constructor"&&s.push(i);return s}return Ri=o,Ri}var Ni,af;function Kr(){if(af)return Ni;af=1;var e=m_(),t=Cc();function r(n){return n!=null&&t(n.length)&&!e(n)}return Ni=r,Ni}var ki,sf;function xo(){if(sf)return ki;sf=1;var e=A_(),t=O_(),r=Kr();function n(o){return r(o)?e(o):t(o)}return ki=n,ki}var Ci,lf;function v_(){if(lf)return Ci;lf=1;var e=w_(),t=kc(),r=xo();function n(o){return e(o,r,t)}return Ci=n,Ci}var Di,uf;function VT(){if(uf)return Di;uf=1;var e=v_(),t=1,r=Object.prototype,n=r.hasOwnProperty;function o(a,s,i,l,u,p){var d=i&t,f=e(a),m=f.length,h=e(s),_=h.length;if(m!=_&&!d)return!1;for(var y=m;y--;){var I=f[y];if(!(d?I in s:n.call(s,I)))return!1}var b=p.get(a),w=p.get(s);if(b&&w)return b==s&&w==a;var S=!0;p.set(a,s),p.set(s,a);for(var L=d;++y<m;){I=f[y];var g=a[I],T=s[I];if(l)var A=d?l(T,g,I,s,a,p):l(g,T,I,a,s,p);if(!(A===void 0?g===T||u(g,T,i,l,p):A)){S=!1;break}L||(L=I=="constructor")}if(S&&!L){var E=a.constructor,v=s.constructor;E!=v&&"constructor"in a&&"constructor"in s&&!(typeof E=="function"&&E instanceof E&&typeof v=="function"&&v instanceof v)&&(S=!1)}return p.delete(a),p.delete(s),S}return Di=o,Di}var Mi,cf;function BT(){if(cf)return Mi;cf=1;var e=Yr(),t=Kt(),r=e(t,"DataView");return Mi=r,Mi}var Fi,pf;function xT(){if(pf)return Fi;pf=1;var e=Yr(),t=Kt(),r=e(t,"Promise");return Fi=r,Fi}var Ui,df;function P_(){if(df)return Ui;df=1;var e=Yr(),t=Kt(),r=e(t,"Set");return Ui=r,Ui}var $i,ff;function zT(){if(ff)return $i;ff=1;var e=Yr(),t=Kt(),r=e(t,"WeakMap");return $i=r,$i}var qi,mf;function zo(){if(mf)return qi;mf=1;var e=BT(),t=vc(),r=xT(),n=P_(),o=zT(),a=$n(),s=h_(),i="[object Map]",l="[object Object]",u="[object Promise]",p="[object Set]",d="[object WeakMap]",f="[object DataView]",m=s(e),h=s(t),_=s(r),y=s(n),I=s(o),b=a;return(e&&b(new e(new ArrayBuffer(1)))!=f||t&&b(new t)!=i||r&&b(r.resolve())!=u||n&&b(new n)!=p||o&&b(new o)!=d)&&(b=function(w){var S=a(w),L=S==l?w.constructor:void 0,g=L?s(L):"";if(g)switch(g){case m:return f;case h:return i;case _:return u;case y:return p;case I:return d}return S}),qi=b,qi}var Vi,hf;function HT(){if(hf)return Vi;hf=1;var e=Rc(),t=I_(),r=FT(),n=VT(),o=zo(),a=nt(),s=Da(),i=Fc(),l=1,u="[object Arguments]",p="[object Array]",d="[object Object]",f=Object.prototype,m=f.hasOwnProperty;function h(_,y,I,b,w,S){var L=a(_),g=a(y),T=L?p:o(_),A=g?p:o(y);T=T==u?d:T,A=A==u?d:A;var E=T==d,v=A==d,R=T==A;if(R&&s(_)){if(!s(y))return!1;L=!0,E=!1}if(R&&!E)return S||(S=new e),L||i(_)?t(_,y,I,b,w,S):r(_,y,T,I,b,w,S);if(!(I&l)){var M=E&&m.call(_,"__wrapped__"),F=v&&m.call(y,"__wrapped__");if(M||F){var G=M?_.value():_,Y=F?y.value():y;return S||(S=new e),w(G,Y,I,b,S)}}return R?(S||(S=new e),n(_,y,I,b,w,S)):!1}return Vi=h,Vi}var Bi,_f;function Uc(){if(_f)return Bi;_f=1;var e=HT(),t=cr();function r(n,o,a,s,i){return n===o?!0:n==null||o==null||!t(n)&&!t(o)?n!==n&&o!==o:e(n,o,a,s,r,i)}return Bi=r,Bi}var xi,yf;function jT(){if(yf)return xi;yf=1;var e=Rc(),t=Uc(),r=1,n=2;function o(a,s,i,l){var u=i.length,p=u,d=!l;if(a==null)return!p;for(a=Object(a);u--;){var f=i[u];if(d&&f[2]?f[1]!==a[f[0]]:!(f[0]in a))return!1}for(;++u<p;){f=i[u];var m=f[0],h=a[m],_=f[1];if(d&&f[2]){if(h===void 0&&!(m in a))return!1}else{var y=new e;if(l)var I=l(h,_,m,a,s,y);if(!(I===void 0?t(_,h,r|n,l,y):I))return!1}}return!0}return xi=o,xi}var zi,bf;function R_(){if(bf)return zi;bf=1;var e=pr();function t(r){return r===r&&!e(r)}return zi=t,zi}var Hi,If;function WT(){if(If)return Hi;If=1;var e=R_(),t=xo();function r(n){for(var o=t(n),a=o.length;a--;){var s=o[a],i=n[s];o[a]=[s,i,e(i)]}return o}return Hi=r,Hi}var ji,Tf;function N_(){if(Tf)return ji;Tf=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return ji=e,ji}var Wi,wf;function GT(){if(wf)return Wi;wf=1;var e=jT(),t=WT(),r=N_();function n(o){var a=t(o);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(s){return s===o||e(s,o,a)}}return Wi=n,Wi}var Gi,Sf;function $c(){if(Sf)return Gi;Sf=1;var e=nt(),t=Fo(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function o(a,s){if(e(a))return!1;var i=typeof a;return i=="number"||i=="symbol"||i=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||s!=null&&a in Object(s)}return Gi=o,Gi}var Yi,gf;function YT(){if(gf)return Yi;gf=1;var e=Pc(),t="Expected a function";function r(n,o){if(typeof n!="function"||o!=null&&typeof o!="function")throw new TypeError(t);var a=function(){var s=arguments,i=o?o.apply(this,s):s[0],l=a.cache;if(l.has(i))return l.get(i);var u=n.apply(this,s);return a.cache=l.set(i,u)||l,u};return a.cache=new(r.Cache||e),a}return r.Cache=e,Yi=r,Yi}var Ki,Ef;function KT(){if(Ef)return Ki;Ef=1;var e=YT(),t=500;function r(n){var o=e(n,function(s){return a.size===t&&a.clear(),s}),a=o.cache;return o}return Ki=r,Ki}var Zi,Af;function ZT(){if(Af)return Zi;Af=1;var e=KT(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(o){var a=[];return o.charCodeAt(0)===46&&a.push(""),o.replace(t,function(s,i,l,u){a.push(l?u.replace(r,"$1"):i||s)}),a});return Zi=n,Zi}var Xi,Lf;function XT(){if(Lf)return Xi;Lf=1;var e=Un(),t=Bo(),r=nt(),n=Fo(),o=e?e.prototype:void 0,a=o?o.toString:void 0;function s(i){if(typeof i=="string")return i;if(r(i))return t(i,s)+"";if(n(i))return a?a.call(i):"";var l=i+"";return l=="0"&&1/i==-1/0?"-0":l}return Xi=s,Xi}var Qi,Of;function QT(){if(Of)return Qi;Of=1;var e=XT();function t(r){return r==null?"":e(r)}return Qi=t,Qi}var Ji,vf;function qn(){if(vf)return Ji;vf=1;var e=nt(),t=$c(),r=ZT(),n=QT();function o(a,s){return e(a)?a:t(a,s)?[a]:r(n(a))}return Ji=o,Ji}var el,Pf;function Vn(){if(Pf)return el;Pf=1;var e=Fo();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return el=t,el}var tl,Rf;function Ua(){if(Rf)return tl;Rf=1;var e=qn(),t=Vn();function r(n,o){o=e(o,n);for(var a=0,s=o.length;n!=null&&a<s;)n=n[t(o[a++])];return a&&a==s?n:void 0}return tl=r,tl}var rl,Nf;function JT(){if(Nf)return rl;Nf=1;var e=Ua();function t(r,n,o){var a=r==null?void 0:e(r,n);return a===void 0?o:a}return rl=t,rl}var nl,kf;function ew(){if(kf)return nl;kf=1;function e(t,r){return t!=null&&r in Object(t)}return nl=e,nl}var ol,Cf;function tw(){if(Cf)return ol;Cf=1;var e=qn(),t=va(),r=nt(),n=Ma(),o=Cc(),a=Vn();function s(i,l,u){l=e(l,i);for(var p=-1,d=l.length,f=!1;++p<d;){var m=a(l[p]);if(!(f=i!=null&&u(i,m)))break;i=i[m]}return f||++p!=d?f:(d=i==null?0:i.length,!!d&&o(d)&&n(m,d)&&(r(i)||t(i)))}return ol=s,ol}var al,Df;function rw(){if(Df)return al;Df=1;var e=ew(),t=tw();function r(n,o){return n!=null&&t(n,o,e)}return al=r,al}var sl,Mf;function nw(){if(Mf)return sl;Mf=1;var e=Uc(),t=JT(),r=rw(),n=$c(),o=R_(),a=N_(),s=Vn(),i=1,l=2;function u(p,d){return n(p)&&o(d)?a(s(p),d):function(f){var m=t(f,p);return m===void 0&&m===d?r(f,p):e(d,m,i|l)}}return sl=u,sl}var il,Ff;function k_(){if(Ff)return il;Ff=1;function e(t){return function(r){return r?.[t]}}return il=e,il}var ll,Uf;function ow(){if(Uf)return ll;Uf=1;var e=Ua();function t(r){return function(n){return e(n,r)}}return ll=t,ll}var ul,$f;function aw(){if($f)return ul;$f=1;var e=k_(),t=ow(),r=$c(),n=Vn();function o(a){return r(a)?e(n(a)):t(a)}return ul=o,ul}var cl,qf;function Bn(){if(qf)return cl;qf=1;var e=GT(),t=nw(),r=Uo(),n=nt(),o=aw();function a(s){return typeof s=="function"?s:s==null?r:typeof s=="object"?n(s)?t(s[0],s[1]):e(s):o(s)}return cl=a,cl}var pl,Vf;function sw(){if(Vf)return pl;Vf=1;function e(t){return function(r,n,o){for(var a=-1,s=Object(r),i=o(r),l=i.length;l--;){var u=i[t?l:++a];if(n(s[u],u,s)===!1)break}return r}}return pl=e,pl}var dl,Bf;function iw(){if(Bf)return dl;Bf=1;var e=sw(),t=e();return dl=t,dl}var fl,xf;function C_(){if(xf)return fl;xf=1;var e=iw(),t=xo();function r(n,o){return n&&e(n,o,t)}return fl=r,fl}var ml,zf;function lw(){if(zf)return ml;zf=1;var e=Kr();function t(r,n){return function(o,a){if(o==null)return o;if(!e(o))return r(o,a);for(var s=o.length,i=n?s:-1,l=Object(o);(n?i--:++i<s)&&a(l[i],i,l)!==!1;);return o}}return ml=t,ml}var hl,Hf;function qc(){if(Hf)return hl;Hf=1;var e=C_(),t=lw(),r=t(e);return hl=r,hl}var _l,jf;function uw(){if(jf)return _l;jf=1;var e=qc(),t=Kr();function r(n,o){var a=-1,s=t(n)?Array(n.length):[];return e(n,function(i,l,u){s[++a]=o(i,l,u)}),s}return _l=r,_l}var yl,Wf;function cw(){if(Wf)return yl;Wf=1;var e=Bo(),t=Bn(),r=uw(),n=nt();function o(a,s){var i=n(a)?e:r;return i(a,t(s,3))}return yl=o,yl}var bl,Gf;function pw(){if(Gf)return bl;Gf=1;var e=f_(),t=cw();function r(n,o){return e(t(n,o),1)}return bl=r,bl}var dw=pw();const Nn=Ye(dw);var Il,Yf;function D_(){if(Yf)return Il;Yf=1;var e=Yr(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Il=t,Il}var Tl,Kf;function Vc(){if(Kf)return Tl;Kf=1;var e=D_();function t(r,n,o){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[n]=o}return Tl=t,Tl}var wl,Zf;function fw(){if(Zf)return wl;Zf=1;var e=Vc(),t=C_(),r=Bn();function n(o,a){var s={};return a=r(a,3),t(o,function(i,l,u){e(s,l,a(i,l,u))}),s}return wl=n,wl}var mw=fw();const lr=Ye(mw);var Sl,Xf;function hw(){if(Xf)return Sl;Xf=1;var e=Math.ceil,t=Math.max;function r(n,o,a,s){for(var i=-1,l=t(e((o-n)/(a||1)),0),u=Array(l);l--;)u[s?l:++i]=n,n+=a;return u}return Sl=r,Sl}var gl,Qf;function Bc(){if(Qf)return gl;Qf=1;var e=Pa(),t=Kr(),r=Ma(),n=pr();function o(a,s,i){if(!n(i))return!1;var l=typeof s;return(l=="number"?t(i)&&r(s,i.length):l=="string"&&s in i)?e(i[s],a):!1}return gl=o,gl}var El,Jf;function _w(){if(Jf)return El;Jf=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return El=t,El}var Al,em;function yw(){if(em)return Al;em=1;var e=_w(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Al=r,Al}var Ll,tm;function bw(){if(tm)return Ll;tm=1;var e=yw(),t=pr(),r=Fo(),n=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,i=parseInt;function l(u){if(typeof u=="number")return u;if(r(u))return n;if(t(u)){var p=typeof u.valueOf=="function"?u.valueOf():u;u=t(p)?p+"":p}if(typeof u!="string")return u===0?u:+u;u=e(u);var d=a.test(u);return d||s.test(u)?i(u.slice(2),d?2:8):o.test(u)?n:+u}return Ll=l,Ll}var Ol,rm;function M_(){if(rm)return Ol;rm=1;var e=bw(),t=1/0,r=17976931348623157e292;function n(o){if(!o)return o===0?o:0;if(o=e(o),o===t||o===-t){var a=o<0?-1:1;return a*r}return o===o?o:0}return Ol=n,Ol}var vl,nm;function Iw(){if(nm)return vl;nm=1;var e=hw(),t=Bc(),r=M_();function n(o){return function(a,s,i){return i&&typeof i!="number"&&t(a,s,i)&&(s=i=void 0),a=r(a),s===void 0?(s=a,a=0):s=r(s),i=i===void 0?a<s?1:-1:r(i),e(a,s,i,o)}}return vl=n,vl}var Pl,om;function Tw(){if(om)return Pl;om=1;var e=Iw(),t=e();return Pl=t,Pl}var ww=Tw();const An=Ye(ww);var Rl,am;function Sw(){if(am)return Rl;am=1;function e(t,r,n,o){var a=-1,s=t==null?0:t.length;for(o&&s&&(n=t[++a]);++a<s;)n=r(n,t[a],a,t);return n}return Rl=e,Rl}var Nl,sm;function gw(){if(sm)return Nl;sm=1;function e(t,r,n,o,a){return a(t,function(s,i,l){n=o?(o=!1,s):r(n,s,i,l)}),n}return Nl=e,Nl}var kl,im;function Ew(){if(im)return kl;im=1;var e=Sw(),t=qc(),r=Bn(),n=gw(),o=nt();function a(s,i,l){var u=o(s)?e:n,p=arguments.length<3;return u(s,r(i,4),l,p,t)}return kl=a,kl}var Aw=Ew();const mt=Ye(Aw),$a=(e,t,r)=>{const{gripperEntities:n,moduleEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a);if(s==null)return{errors:[C({parameterName:e.moduleId})]};const i=Qn(r,s),l=Object.keys(n).length>0,u=[];if(i==null&&u.push(de()),l||u.push(Vh()),u.length>0)return{errors:u};const p=o[s].pythonName;return{commands:[{commandType:"absorbanceReader/closeLid",key:U(),params:{moduleId:s}}],python:`${p}.close_lid()`}},F_=(e,t,r)=>{const{sampleWavelengths:n,measureMode:o,referenceWavelength:a}=e,{runtimeParameters:s}=t,i=O(e.moduleId,s),l=O(o,s),u=l==="single"||l==="multi"?l:null,p=n.map(b=>D(b,s)),d=a==null?void 0:D(a,s),f=[e.moduleId,o,...n,a],m=[i,u,...p,d],h=f.flatMap((b,w)=>typeof b=="string"&&m[w]===null?[C({parameterName:b})]:[]);if(h.length>0||i==null||u==null)return{errors:h};const _=t.moduleEntities[i].pythonName,y=s[o]!=null?o:q(o),I=a!=null?`, reference_wavelength=${a}`:"";return{commands:[{commandType:"absorbanceReader/initialize",key:U(),params:{moduleId:i,measureMode:u,sampleWavelengths:p,...d!=null?{referenceWavelength:d}:{}}}],python:`${_}.initialize(${y}, [${n.join(", ")}]${I})`}},U_=(e,t,r)=>{const{gripperEntities:n,moduleEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a);if(s==null)return{errors:[C({parameterName:e.moduleId})]};const i=Qn(r,s),l=Object.keys(n).length>0,u=[];if(i==null&&u.push(de()),l||u.push(Vh()),u.length>0)return{errors:u};const p=o[s].pythonName;return{commands:[{commandType:"absorbanceReader/openLid",key:U(),params:{moduleId:s}}],python:`${p}.open_lid()`}},$_=(e,t,r)=>{const{fileName:n}=e,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=n==null?void 0:O(n,o),i=[];if(a==null&&i.push(C({parameterName:e.moduleId})),n!=null&&s==null&&i.push(C({parameterName:n})),a==null||i.length>0)return{errors:i};const l=Qn(r,a);if(l==null)return{errors:[de()]};l.initialization===null&&i.push(xr());const u=t.moduleEntities[a].pythonName,p=n==null||o[n]!=null?n:q(n),d=p!=null?`export_filename=${p}`:"";return i.length>0?{errors:i}:{commands:[{commandType:"absorbanceReader/read",key:U(),params:{moduleId:a,...s!=null?{fileName:s}:{}}}],python:`${u}.read(${d})`}},Pt=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=D(e.volume,n),s=D(e.flowRate,n),i=e.correctionVolume==null?void 0:D(e.correctionVolume,n),l=[e.pipetteId,e.volume,e.flowRate,e.correctionVolume],u=[o,a,s,i],p=l.flatMap((h,_)=>typeof h=="string"&&u[_]==null?[C({parameterName:h})]:[]);if(p.length>0||o==null||a==null||s==null)return{errors:p};if(!t.pipetteEntities[o]?.spec)return{errors:[ht({pipette:o})]};const f=t.pipetteEntities[o].pythonName;return{commands:[{commandType:"airGapInPlace",key:U(),params:{flowRate:s,pipetteId:o,volume:a,...i!=null?{correctionVolume:i}:{}}}],python:`${f}.air_gap(${[`volume=${e.volume}`,"in_place=True",`flow_rate=${e.flowRate}`].join(", ")})`}},Lw=(e,t,r)=>{const{pipetteId:n,volume:o,labwareId:a,wellName:s,flowRate:i,isAirGap:l,tipRack:u,wellLocation:p,primaryNozzle:d,nozzles:f}=e,m="aspirate",h=r.labware,_=[],y=t.pipetteEntities[n]?.spec,I=(y?.displayCategory==="FLEX"||y?.channels===96)??!1,b=Wn(a,r.labware);if(y||_.push(ht({pipette:n})),!a||!r.labware[a]?_.push(_t({actionName:m,labware:a})):ee(r.labware[a].stack)==="offDeck"&&_.push(Rn()),De.includes(b))_.push(Wt({typeOfStep:m}));else if(h[b]!=null){const v=ee(h[b].stack);De.includes(v)&&_.push(Wt({typeOfStep:m}))}Yn({pipette:n,labware:a,invariantContext:t,prevRobotState:r})&&_.push(Ro()),r.tipState.pipettes[n]?.hasTip||_.push(Yt({actionName:m,pipette:n,labware:a,well:s}));const w=t.pipetteEntities[n]?.spec.channels!==1,S=bt({robotState:r,invariantContext:t,pipetteId:n,labwareId:a,wellLocationOffset:p?.offset??{x:0,y:0,z:0},wellTargetName:s,primaryNozzle:d,nozzleConfiguration:f});if(w&&y&&!S.isSafe&&_.push(jt({unsafePipetteMovementReason:S.reason})),Xo(r.modules,r.labware,a)&&_.push(vn()),Yo(r.modules,r.labware,a)&&_.push(xr()),ea(r.modules,r.labware,a)&&_.push(Ea()),ta(r.modules,r.labware,a)&&_.push(Pn()),Xn(r.modules,b,I?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&_.push(ko()),I||(Kn(r.modules,b)&&_.push(No()),Zn(r.modules,b,y)&&_.push(Co()),Jo(r.modules,b,y,t.labwareEntities[a])&&_.push(Aa())),_.length===0&&y&&y.liquids.default.maxVolume<o&&_.push(ba({actionName:m,volume:o,maxVolume:y.liquids.default.maxVolume})),_.length===0&&y){const v=Ja(n,t,u);v<o&&_.push(lI({actionName:m,volume:o,maxVolume:v}))}if(_.length>0)return{errors:_};const L=[{commandType:"aspirate",key:U(),params:{pipetteId:n,volume:o,labwareId:a,wellName:s,wellLocation:p,flowRate:i},...l&&{meta:{isAirGap:l}}}],g=t.pipetteEntities[n].pythonName,T=t.labwareEntities[a].pythonName,A=[`volume=${o}`,`location=${T}[${q(s)}]${Gt(p)}`,`flow_rate=${i}`],E=`${g}.aspirate(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@opentrons/shared-data");function nI(){return{type:"INSUFFICIENT_TIPS",message:"Not enough tips to complete action"}}function oI(){return{type:"MISSING_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips fully without an adapter"}}function aI(){return{type:"REMOVE_96_CHANNEL_TIPRACK_ADAPTER",message:"A 96-channel cannot pick up tips partially with an adapter"}}function Yt(e){const{actionName:t,pipette:r,labware:n,well:o}=e;return{message:n==null||o==null?`Attempted to ${t} with no tip on pipette: ${r} in place`:`Attempted to ${t} with no tip on pipette: ${r} from ${n}'s well ${o}`,type:"NO_TIP_ON_PIPETTE"}}function sI(){return{message:"One or more of the pipettes has a tip",type:"PIPETTE_HAS_TIP"}}function ht(e){const{pipette:t}=e;return{message:`This step tries to use the ${t}. Add the pipette to your protocol or change the step to use a different pipette.`,type:"PIPETTE_DOES_NOT_EXIST"}}function _t(e){const{actionName:t,labware:r}=e;return console.warn(`Attempted to ${t} with labware id "${r}", this labware was not found under "labware"`),{message:`This step tries to use ${r}. Add the labware to your protocol or change the step to use a different labware.`,type:"LABWARE_DOES_NOT_EXIST"}}function de(){return{message:"This step requires a module, but none is selected",type:"MISSING_MODULE"}}function iI(){return{message:"This module is not changing temperature because it has either been deactivated or is already holding a temperature. In order to pause the protocol and wait for your module to reach a temperature, you must first use a Temperature step to tell the module to start changing to a new temperature",type:"MISSING_TEMPERATURE_STEP"}}function Ep(){return{message:"This module is not currently running a profile.",type:"MISSING_PROFILE_STEP"}}function lI(e){const{volume:t,maxVolume:r,actionName:n}=e;return{message:`This step tries to ${n} ${t}µL, but the tip can only hold ${r}µL.`,type:"TIP_VOLUME_EXCEEDED"}}function C(e){const{parameterName:t}=e;return{message:`Runtime parameter "${t}" is missing`,type:"INVALID_RUNTIME_PARAMETER"}}function ba(e){const{actionName:t,volume:r,maxVolume:n,disposalVolume:o}=e;return{message:o!=null?`Attemped to ${t} volume + disposal volume greater than pipette max volume (${r} + ${o} > ${n})`:`This step tries to ${t} ${r}µL, but the tip can only hold ${n}µL.`,type:"PIPETTE_VOLUME_EXCEEDED"}}const uI=()=>({type:"MOVE_LOCATION_NOT_SPECIFIED",message:"This step is missing a move location."}),Ro=()=>({type:"MODULE_PIPETTE_COLLISION_DANGER",message:"Gen 1 8-Channel pipettes cannot access labware or tip racks in slot 4 or 6 because they are adjacent to modules."}),cI=()=>({type:"THERMOCYCLER_BUSY_WITH_PROFILE",message:"This step cannot run while the Thermocycler is running a profile. Move the step outside the profile."}),vn=()=>({type:"THERMOCYCLER_LID_CLOSED",message:"Attempted to interact with contents of a thermocycler with the lid closed."}),Ea=()=>({type:"HEATER_SHAKER_LATCH_OPEN",message:"Attempted to interact with contents of a heater-shaker with the latch open."}),Ap=()=>({type:"HEATER_SHAKER_LATCH_CLOSED",message:"Attempted to move the contents of a heater-shaker with the latch closed."}),xr=()=>({type:"ABSORBANCE_READER_LID_CLOSED",message:"Attempted to interact with contents of an absorbance plate reader with the lid closed."}),pI=()=>({type:"ABSORBANCE_READER_NO_INITIALIZATION",message:"This step tries to read labware without initializing the Plate Reader first. Initialize the Plate Reader module or remove this step in order to proceed."}),Vh=()=>({type:"ABSORBANCE_READER_NO_GRIPPER",message:"This step involves opening or closing the Absorbance Plate Reader lid with a gripper. Add a gripper or remove step to proceed."}),dI=()=>({type:"HOPPER_EMPTY",message:"Cannot retrieve labware from empty stacker"}),fI=()=>({type:"SHUTTLE_FULL",message:"Shuttle must be empty in order to retrieve labware from the stacker"}),mI=()=>({type:"SHUTTLE_EMPTY",message:"Shuttle must have labware in order to store it in the stacker"}),Bh=()=>({type:"MISMATCHED_STACKER_LABWARE_TYPE",message:"The stacker can only store a single type of labware at a time"}),hI=()=>({type:"MISSING_STACKER_LABWARE_TYPE",message:"Add labware to the stacker in the starting deck so that you can refill it later"}),xh=()=>({type:"HOPPER_FULL",message:"The hopper has reached capacity"}),Pn=()=>({type:"HEATER_SHAKER_IS_SHAKING",message:"Attempted to interact with the contents of a heater-shaker when it is shaking."}),_I=e=>({type:"TALL_LABWARE_EAST_WEST_OF_HEATER_SHAKER",message:`Labware over 53 mm is ${e} of this Heater-Shaker module.`}),jt=e=>{const{unsafePipetteMovementReason:t}=e;switch(t.type){case"thermocyclerLidCollision":return{type:"POSSIBLE_PIPETTE_COLLISION_THERMOCYCLER_LID",message:"There is a possibility that the Pipette will collide with the Thermocycler lid"};case"outsidePipetteExtents":return{type:"POSSIBLE_PIPETTE_COLLISION_OUTSIDE_DECK_EXTENTS",message:"There is a possibility that the pipette will move outside the deck extents."};case"adjacentAdressableAreaCollision":return{type:"POSSIBLE_PIPETTE_COLLISION_ADJACENT_ADDRESSABLE_AREA",message:`There is a possibility that the pipette will collide with adjacent items in ${t.addressableAreaCausingCollision.displayName}`,translationParams:{addressableAreaCausingCollisionDisplayName:t.addressableAreaCausingCollision.displayName}}}},No=()=>({type:"HEATER_SHAKER_EAST_WEST_LATCH_OPEN",message:"The Heater-Shaker labware latch is open"}),ko=()=>({type:"HEATER_SHAKER_NORTH_SOUTH_EAST_WEST_SHAKING",message:"The Heater-Shaker is shaking"}),Co=()=>({type:"HEATER_SHAKER_EAST_WEST_MULTI_CHANNEL",message:"The Heater-Shaker is shaking"}),Aa=()=>({type:"HEATER_SHAKER_NORTH_SOUTH__OF_NON_TIPRACK_WITH_MULTI_CHANNEL",message:"8-Channel pipette cannot access labware"}),Rn=()=>({type:"LABWARE_OFF_DECK",message:"Attempted to interact with labware off deck"}),yI=()=>({type:"LABWARE_ON_ANOTHER_ENTITY",message:"Attempted to move labware onto another entity with the same slotName"}),Fn=()=>({type:"DROP_TIP_LOCATION_DOES_NOT_EXIST",message:"The destination for dropping tip does not exist"}),zh=()=>({type:"EQUIPMENT_DOES_NOT_EXIST",message:"Equipment does not exist."}),bI=()=>({type:"GRIPPER_REQUIRED",message:"The gripper is required to fulfill this action"}),Wt=e=>({type:"PIPETTING_INTO_COLUMN_4",message:`Cannot ${e.typeOfStep} into a column 4 slot.`}),II=()=>({type:"CANNOT_MOVE_WITH_GRIPPER",message:"The gripper cannot move aluminum blocks"}),TI=()=>({type:"NO_TIP_SELECTED",message:"No tips were selected for this step"}),Do=()=>({type:"LABWARE_DISCARDED_IN_TRASH",message:"The labware was discarded in trash in a previous step."}),Hh=()=>({type:"SUBMERGE_BELOW_ASPIRATE",message:"The submerge position must be above the aspirate position"}),jh=()=>({type:"RETRACT_BELOW_ASPIRATE",message:"The retract position must be above the aspirate position"}),wI=()=>({type:"SUBMERGE_BELOW_DISPENSE",message:"The submerge position must be above the dispense position"}),SI=()=>({type:"RETRACT_BELOW_DISPENSE",message:"The retract position must be above the dispense position"}),gI=()=>({type:"MULTI_ASPIRATE_VOLUME_TOO_HIGH",message:"Consolidate pipette path was selected but cannot fit volume for more than 1 well in the tip"}),EI=()=>({type:"MULTI_DISPENSE_VOLUME_TOO_HIGH",message:"Distribute pipette path was selected but cannot fit volume for more than 1 well in the tip"}),AI=e=>({type:"CLOSING_THERMOCYCLER_WITH_INVALID_LABWARE_LID",message:`Closing the Thermocycler lid with ${e.lidDisplayName} in place will cause damage`}),Lp=()=>({type:"RETURN_TIP_UNAVAILABLE",message:"Current tip does not have a known location to return to"}),LI=()=>({type:"TIPRACK_LID_NOT_ALLOWED_ON_DECK",message:"The tip rack lid is not supported directly on the deck"}),OI=()=>({type:"NEXT_TIPRACK_HAS_LID",message:"A pipette cannot pick up tips from a tip rack with a lid"}),vI=e=>({type:"STACK_TOO_HIGH",message:`The stack on slot ${e.slot} is too high`}),PI=()=>({type:"TOO_MANY_TIPS",message:"Action will pick up too many tips"}),RI=()=>({type:"INCOMPLETE_PICKUP",message:"At least one of the selected tips is empty"}),NI=()=>({type:"LABWARE_ON_HOPPER",message:"Labware cannot be moved from the Flex Stacker Hopper"}),kI=()=>({type:"MISSING_PUMP_ACTIVITY",message:"This module is not currently running a pump activity."}),CI=e=>({type:"INVALID_WAIT_CONDITION",message:`Invalid wait condition: ${e}`}),Mo=()=>({type:"LIVE_TASK_ERROR",message:"This module is currently running a live task. Please wait for it to complete before performing this action."}),Op=()=>({type:"VACUUM_UNDER_PRESSURE",message:"The vacuum module is under pressure. Deactivate the pump to move labware to or from it."});function Ye(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rs,vp;function Wh(){if(vp)return rs;vp=1;var e=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;return rs=e,rs}var ns,Pp;function Kt(){if(Pp)return ns;Pp=1;var e=Wh(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return ns=r,ns}var os,Rp;function $n(){if(Rp)return os;Rp=1;var e=Kt(),t=e.Symbol;return os=t,os}var as,Np;function DI(){if(Np)return as;Np=1;var e=$n(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,o=e?e.toStringTag:void 0;function a(s){var i=r.call(s,o),l=s[o];try{s[o]=void 0;var u=!0}catch{}var p=n.call(s);return u&&(i?s[o]=l:delete s[o]),p}return as=a,as}var ss,kp;function MI(){if(kp)return ss;kp=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return ss=r,ss}var is,Cp;function Un(){if(Cp)return is;Cp=1;var e=$n(),t=DI(),r=MI(),n="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function s(i){return i==null?i===void 0?o:n:a&&a in Object(i)?t(i):r(i)}return is=s,is}var ls,Dp;function cr(){if(Dp)return ls;Dp=1;function e(t){return t!=null&&typeof t=="object"}return ls=e,ls}var us,Mp;function Fo(){if(Mp)return us;Mp=1;var e=Un(),t=cr(),r="[object Symbol]";function n(o){return typeof o=="symbol"||t(o)&&e(o)==r}return us=n,us}var cs,Fp;function Gh(){if(Fp)return cs;Fp=1;var e=Fo();function t(r,n,o){for(var a=-1,s=r.length;++a<s;){var i=r[a],l=n(i);if(l!=null&&(u===void 0?l===l&&!e(l):o(l,u)))var u=l,p=i}return p}return cs=t,cs}var ps,$p;function FI(){if($p)return ps;$p=1;function e(t,r){return t<r}return ps=e,ps}var ds,Up;function $o(){if(Up)return ds;Up=1;function e(t){return t}return ds=e,ds}var fs,qp;function $I(){if(qp)return fs;qp=1;var e=Gh(),t=FI(),r=$o();function n(o){return o&&o.length?e(o,r,t):void 0}return fs=n,fs}var UI=$I();const qI=Ye(UI),Uo="TEMPERATURE_DEACTIVATED",gc="TEMPERATURE_AT_TARGET",Ec="TEMPERATURE_APPROACHING_TARGET",nc=1,Yh=[c.MAGNETIC_MODULE_V1,c.TEMPERATURE_MODULE_V1],oc="fixedTrash",Kh={type:c.MAGNETIC_MODULE_TYPE,engaged:!1},Zh={type:c.TEMPERATURE_MODULE_TYPE,status:Uo,targetTemperature:null},Xh={type:c.THERMOCYCLER_MODULE_TYPE,currentBlockActivity:{type:"blockDeactivated"},lidTargetTemp:null,lidOpen:null,numProfilesStarted:0},Qh={type:c.HEATERSHAKER_MODULE_TYPE,targetTemp:null,targetSpeed:null,latchOpen:null},Jh={type:"absorbanceReaderType",lidOpen:null,initialization:null},e_={type:"magneticBlockType"},t_={type:c.FLEX_STACKER_MODULE_TYPE,storedLabwareDetails:null,labwareInHopper:null,labwareOnShuttle:null,setStoredLabwareCount:1,fillCount:1},r_={type:c.VACUUM_MODULE_TYPE,ventStatus:null,numPumpActivitiesStarted:0,currentPumpActivity:{type:"pumpDeactivated"}},n_={[c.MAGNETIC_MODULE_TYPE]:Kh,[c.TEMPERATURE_MODULE_TYPE]:Zh,[c.THERMOCYCLER_MODULE_TYPE]:Xh,[c.HEATERSHAKER_MODULE_TYPE]:Qh,[c.ABSORBANCE_READER_TYPE]:Jh,[c.MAGNETIC_BLOCK_TYPE]:e_,[c.FLEX_STACKER_MODULE_TYPE]:t_,[c.VACUUM_MODULE_TYPE]:r_},VI="opentrons/opentrons_1_trash_1100ml_fixed/1",BI="opentrons/opentrons_1_trash_3200ml_fixed/1",De=["A4","B4","C4","D4"],vt={x:0,y:0,z:0},o_="mounted",qo="CLEAN",or="DIRTY",_e="EMPTY",Ia="automatic",yt="manual",a_=["A4","B4","C4","D4"],xI=["7","8","10","11"],rt="hopper",s_=["hopperA4","hopperB4","hopperC4","hopperD4"],i_={hopperA4:"A4",hopperB4:"B4",hopperC4:"C4",hopperD4:"D4"},ar=["adapterLabwareId","primaryLabwareId","lidLabwareId"],zI=["adapterLabwareURI","primaryLabwareURI","lidLabwareURI"],HI={A4:"hopperA4",B4:"hopperB4",C4:"hopperC4",D4:"hopperD4"},Ac="vacuumDock",l_=c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA,Lc="opened",Vo="closed",ac="power",sc="pressure",jI="state",WI="profile",GI="pumpOff",YI="pumpOn",KI="vent",ZI="open",XI="closed",QI="VACUUM_DEACTIVATED",JI="VACUUM_AT_TARGET",u_=["opentrons_vacuum_manifold_spacer_short","opentrons_vacuum_manifold_spacer_tall","opentrons_vacuum_manifold_spacer_3.2mm","opentrons_vacuum_manifold_spacer_5.2mm","opentrons_vacuum_manifold_spacer_7.25mm","opentrons_vacuum_manifold_spacer_12.8mm"],c_=3,p_="A4",La=[c.ALL,c.COLUMN,c.SINGLE,c.ROW,c.QUADRANT,c.PARTIAL_COLUMN],Oa=[c.A1_NOZZLE,c.A12_NOZZLE,c.B1_NOZZLE,c.C1_NOZZLE,c.D1_NOZZLE,c.E1_NOZZLE,c.F1_NOZZLE,c.G1_NOZZLE,c.H1_NOZZLE,c.H12_NOZZLE],d_=[c.B1_NOZZLE,c.C1_NOZZLE,c.D1_NOZZLE,c.E1_NOZZLE,c.F1_NOZZLE,c.G1_NOZZLE],He=[];for(let e=0;e<256;++e)He.push((e+256).toString(16).slice(1));function eT(e,t=0){return(He[e[t+0]]+He[e[t+1]]+He[e[t+2]]+He[e[t+3]]+"-"+He[e[t+4]]+He[e[t+5]]+"-"+He[e[t+6]]+He[e[t+7]]+"-"+He[e[t+8]]+He[e[t+9]]+"-"+He[e[t+10]]+He[e[t+11]]+He[e[t+12]]+He[e[t+13]]+He[e[t+14]]+He[e[t+15]]).toLowerCase()}const tT=new Uint8Array(16);function rT(){return crypto.getRandomValues(tT)}function nT(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():oT(e,t,r)}function oT(e,t,r){e=e||{};const n=e.random??e.rng?.()??rT();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return eT(n)}var ms,Vp;function Oc(){if(Vp)return ms;Vp=1;function e(t,r){for(var n=-1,o=r.length,a=t.length;++n<o;)t[a+n]=r[n];return t}return ms=e,ms}var hs,Bp;function aT(){if(Bp)return hs;Bp=1;var e=Un(),t=cr(),r="[object Arguments]";function n(o){return t(o)&&e(o)==r}return hs=n,hs}var _s,xp;function va(){if(xp)return _s;xp=1;var e=aT(),t=cr(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(s){return t(s)&&n.call(s,"callee")&&!o.call(s,"callee")};return _s=a,_s}var ys,zp;function nt(){if(zp)return ys;zp=1;var e=Array.isArray;return ys=e,ys}var bs,Hp;function sT(){if(Hp)return bs;Hp=1;var e=$n(),t=va(),r=nt(),n=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(n&&a&&a[n])}return bs=o,bs}var Is,jp;function f_(){if(jp)return Is;jp=1;var e=Oc(),t=sT();function r(n,o,a,s,i){var l=-1,u=n.length;for(a||(a=t),i||(i=[]);++l<u;){var p=n[l];o>0&&a(p)?o>1?r(p,o-1,a,s,i):e(i,p):s||(i[i.length]=p)}return i}return Is=r,Is}var Ts,Wp;function Bo(){if(Wp)return Ts;Wp=1;function e(t,r){for(var n=-1,o=t==null?0:t.length,a=Array(o);++n<o;)a[n]=r(t[n],n,t);return a}return Ts=e,Ts}var ws,Gp;function iT(){if(Gp)return ws;Gp=1;function e(){this.__data__=[],this.size=0}return ws=e,ws}var Ss,Yp;function Pa(){if(Yp)return Ss;Yp=1;function e(t,r){return t===r||t!==t&&r!==r}return Ss=e,Ss}var gs,Kp;function Ra(){if(Kp)return gs;Kp=1;var e=Pa();function t(r,n){for(var o=r.length;o--;)if(e(r[o][0],n))return o;return-1}return gs=t,gs}var Es,Zp;function lT(){if(Zp)return Es;Zp=1;var e=Ra(),t=Array.prototype,r=t.splice;function n(o){var a=this.__data__,s=e(a,o);if(s<0)return!1;var i=a.length-1;return s==i?a.pop():r.call(a,s,1),--this.size,!0}return Es=n,Es}var As,Xp;function uT(){if(Xp)return As;Xp=1;var e=Ra();function t(r){var n=this.__data__,o=e(n,r);return o<0?void 0:n[o][1]}return As=t,As}var Ls,Qp;function cT(){if(Qp)return Ls;Qp=1;var e=Ra();function t(r){return e(this.__data__,r)>-1}return Ls=t,Ls}var Os,Jp;function pT(){if(Jp)return Os;Jp=1;var e=Ra();function t(r,n){var o=this.__data__,a=e(o,r);return a<0?(++this.size,o.push([r,n])):o[a][1]=n,this}return Os=t,Os}var vs,ed;function Na(){if(ed)return vs;ed=1;var e=iT(),t=lT(),r=uT(),n=cT(),o=pT();function a(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,vs=a,vs}var Ps,td;function dT(){if(td)return Ps;td=1;var e=Na();function t(){this.__data__=new e,this.size=0}return Ps=t,Ps}var Rs,rd;function fT(){if(rd)return Rs;rd=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return Rs=e,Rs}var Ns,nd;function mT(){if(nd)return Ns;nd=1;function e(t){return this.__data__.get(t)}return Ns=e,Ns}var ks,od;function hT(){if(od)return ks;od=1;function e(t){return this.__data__.has(t)}return ks=e,ks}var Cs,ad;function pr(){if(ad)return Cs;ad=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Cs=e,Cs}var Ds,sd;function m_(){if(sd)return Ds;sd=1;var e=Un(),t=pr(),r="[object AsyncFunction]",n="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function s(i){if(!t(i))return!1;var l=e(i);return l==n||l==o||l==r||l==a}return Ds=s,Ds}var Ms,id;function _T(){if(id)return Ms;id=1;var e=Kt(),t=e["__core-js_shared__"];return Ms=t,Ms}var Fs,ld;function yT(){if(ld)return Fs;ld=1;var e=_T(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return Fs=r,Fs}var $s,ud;function h_(){if(ud)return $s;ud=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return $s=r,$s}var Us,cd;function bT(){if(cd)return Us;cd=1;var e=m_(),t=yT(),r=pr(),n=h_(),o=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,i=Object.prototype,l=s.toString,u=i.hasOwnProperty,p=RegExp("^"+l.call(u).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(f){if(!r(f)||t(f))return!1;var m=e(f)?p:a;return m.test(n(f))}return Us=d,Us}var qs,pd;function IT(){if(pd)return qs;pd=1;function e(t,r){return t?.[r]}return qs=e,qs}var Vs,dd;function Yr(){if(dd)return Vs;dd=1;var e=bT(),t=IT();function r(n,o){var a=t(n,o);return e(a)?a:void 0}return Vs=r,Vs}var Bs,fd;function vc(){if(fd)return Bs;fd=1;var e=Yr(),t=Kt(),r=e(t,"Map");return Bs=r,Bs}var xs,md;function ka(){if(md)return xs;md=1;var e=Yr(),t=e(Object,"create");return xs=t,xs}var zs,hd;function TT(){if(hd)return zs;hd=1;var e=ka();function t(){this.__data__=e?e(null):{},this.size=0}return zs=t,zs}var Hs,_d;function wT(){if(_d)return Hs;_d=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Hs=e,Hs}var js,yd;function ST(){if(yd)return js;yd=1;var e=ka(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function o(a){var s=this.__data__;if(e){var i=s[a];return i===t?void 0:i}return n.call(s,a)?s[a]:void 0}return js=o,js}var Ws,bd;function gT(){if(bd)return Ws;bd=1;var e=ka(),t=Object.prototype,r=t.hasOwnProperty;function n(o){var a=this.__data__;return e?a[o]!==void 0:r.call(a,o)}return Ws=n,Ws}var Gs,Id;function ET(){if(Id)return Gs;Id=1;var e=ka(),t="__lodash_hash_undefined__";function r(n,o){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&o===void 0?t:o,this}return Gs=r,Gs}var Ys,Td;function AT(){if(Td)return Ys;Td=1;var e=TT(),t=wT(),r=ST(),n=gT(),o=ET();function a(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,Ys=a,Ys}var Ks,wd;function LT(){if(wd)return Ks;wd=1;var e=AT(),t=Na(),r=vc();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Ks=n,Ks}var Zs,Sd;function OT(){if(Sd)return Zs;Sd=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Zs=e,Zs}var Xs,gd;function Ca(){if(gd)return Xs;gd=1;var e=OT();function t(r,n){var o=r.__data__;return e(n)?o[typeof n=="string"?"string":"hash"]:o.map}return Xs=t,Xs}var Qs,Ed;function vT(){if(Ed)return Qs;Ed=1;var e=Ca();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Qs=t,Qs}var Js,Ad;function PT(){if(Ad)return Js;Ad=1;var e=Ca();function t(r){return e(this,r).get(r)}return Js=t,Js}var ei,Ld;function RT(){if(Ld)return ei;Ld=1;var e=Ca();function t(r){return e(this,r).has(r)}return ei=t,ei}var ti,Od;function NT(){if(Od)return ti;Od=1;var e=Ca();function t(r,n){var o=e(this,r),a=o.size;return o.set(r,n),this.size+=o.size==a?0:1,this}return ti=t,ti}var ri,vd;function Pc(){if(vd)return ri;vd=1;var e=LT(),t=vT(),r=PT(),n=RT(),o=NT();function a(s){var i=-1,l=s==null?0:s.length;for(this.clear();++i<l;){var u=s[i];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,ri=a,ri}var ni,Pd;function kT(){if(Pd)return ni;Pd=1;var e=Na(),t=vc(),r=Pc(),n=200;function o(a,s){var i=this.__data__;if(i instanceof e){var l=i.__data__;if(!t||l.length<n-1)return l.push([a,s]),this.size=++i.size,this;i=this.__data__=new r(l)}return i.set(a,s),this.size=i.size,this}return ni=o,ni}var oi,Rd;function Rc(){if(Rd)return oi;Rd=1;var e=Na(),t=dT(),r=fT(),n=mT(),o=hT(),a=kT();function s(i){var l=this.__data__=new e(i);this.size=l.size}return s.prototype.clear=t,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=o,s.prototype.set=a,oi=s,oi}var ai,Nd;function CT(){if(Nd)return ai;Nd=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return ai=t,ai}var si,kd;function DT(){if(kd)return si;kd=1;function e(t){return this.__data__.has(t)}return si=e,si}var ii,Cd;function __(){if(Cd)return ii;Cd=1;var e=Pc(),t=CT(),r=DT();function n(o){var a=-1,s=o==null?0:o.length;for(this.__data__=new e;++a<s;)this.add(o[a])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,ii=n,ii}var li,Dd;function y_(){if(Dd)return li;Dd=1;function e(t,r){for(var n=-1,o=t==null?0:t.length;++n<o;)if(r(t[n],n,t))return!0;return!1}return li=e,li}var ui,Md;function b_(){if(Md)return ui;Md=1;function e(t,r){return t.has(r)}return ui=e,ui}var ci,Fd;function I_(){if(Fd)return ci;Fd=1;var e=__(),t=y_(),r=b_(),n=1,o=2;function a(s,i,l,u,p,d){var f=l&n,m=s.length,h=i.length;if(m!=h&&!(f&&h>m))return!1;var _=d.get(s),y=d.get(i);if(_&&y)return _==i&&y==s;var I=-1,b=!0,w=l&o?new e:void 0;for(d.set(s,i),d.set(i,s);++I<m;){var S=s[I],L=i[I];if(u)var g=f?u(L,S,I,i,s,d):u(S,L,I,s,i,d);if(g!==void 0){if(g)continue;b=!1;break}if(w){if(!t(i,function(T,A){if(!r(w,A)&&(S===T||p(S,T,l,u,d)))return w.push(A)})){b=!1;break}}else if(!(S===L||p(S,L,l,u,d))){b=!1;break}}return d.delete(s),d.delete(i),b}return ci=a,ci}var pi,$d;function T_(){if($d)return pi;$d=1;var e=Kt(),t=e.Uint8Array;return pi=t,pi}var di,Ud;function MT(){if(Ud)return di;Ud=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(o,a){n[++r]=[a,o]}),n}return di=e,di}var fi,qd;function Nc(){if(qd)return fi;qd=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(o){n[++r]=o}),n}return fi=e,fi}var mi,Vd;function FT(){if(Vd)return mi;Vd=1;var e=$n(),t=T_(),r=Pa(),n=I_(),o=MT(),a=Nc(),s=1,i=2,l="[object Boolean]",u="[object Date]",p="[object Error]",d="[object Map]",f="[object Number]",m="[object RegExp]",h="[object Set]",_="[object String]",y="[object Symbol]",I="[object ArrayBuffer]",b="[object DataView]",w=e?e.prototype:void 0,S=w?w.valueOf:void 0;function L(g,T,A,E,v,R,M){switch(A){case b:if(g.byteLength!=T.byteLength||g.byteOffset!=T.byteOffset)return!1;g=g.buffer,T=T.buffer;case I:return!(g.byteLength!=T.byteLength||!R(new t(g),new t(T)));case l:case u:case f:return r(+g,+T);case p:return g.name==T.name&&g.message==T.message;case m:case _:return g==T+"";case d:var F=o;case h:var G=E&s;if(F||(F=a),g.size!=T.size&&!G)return!1;var Y=M.get(g);if(Y)return Y==T;E|=i,M.set(g,T);var oe=n(F(g),F(T),E,v,R,M);return M.delete(g),oe;case y:if(S)return S.call(g)==S.call(T)}return!1}return mi=L,mi}var hi,Bd;function w_(){if(Bd)return hi;Bd=1;var e=Oc(),t=nt();function r(n,o,a){var s=o(n);return t(n)?s:e(s,a(n))}return hi=r,hi}var _i,xd;function S_(){if(xd)return _i;xd=1;function e(t,r){for(var n=-1,o=t==null?0:t.length,a=0,s=[];++n<o;){var i=t[n];r(i,n,t)&&(s[a++]=i)}return s}return _i=e,_i}var yi,zd;function g_(){if(zd)return yi;zd=1;function e(){return[]}return yi=e,yi}var bi,Hd;function kc(){if(Hd)return bi;Hd=1;var e=S_(),t=g_(),r=Object.prototype,n=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(s){return s==null?[]:(s=Object(s),e(o(s),function(i){return n.call(s,i)}))}:t;return bi=a,bi}var Ii,jd;function E_(){if(jd)return Ii;jd=1;function e(t,r){for(var n=-1,o=Array(t);++n<t;)o[n]=r(n);return o}return Ii=e,Ii}var Io={exports:{}},Ti,Wd;function $T(){if(Wd)return Ti;Wd=1;function e(){return!1}return Ti=e,Ti}Io.exports;var Gd;function Da(){return Gd||(Gd=1,(function(e,t){var r=Kt(),n=$T(),o=t&&!t.nodeType&&t,a=o&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===o,i=s?r.Buffer:void 0,l=i?i.isBuffer:void 0,u=l||n;e.exports=u})(Io,Io.exports)),Io.exports}var wi,Yd;function Ma(){if(Yd)return wi;Yd=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,o){var a=typeof n;return o=o??e,!!o&&(a=="number"||a!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<o}return wi=r,wi}var Si,Kd;function Cc(){if(Kd)return Si;Kd=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Si=t,Si}var gi,Zd;function UT(){if(Zd)return gi;Zd=1;var e=Un(),t=Cc(),r=cr(),n="[object Arguments]",o="[object Array]",a="[object Boolean]",s="[object Date]",i="[object Error]",l="[object Function]",u="[object Map]",p="[object Number]",d="[object Object]",f="[object RegExp]",m="[object Set]",h="[object String]",_="[object WeakMap]",y="[object ArrayBuffer]",I="[object DataView]",b="[object Float32Array]",w="[object Float64Array]",S="[object Int8Array]",L="[object Int16Array]",g="[object Int32Array]",T="[object Uint8Array]",A="[object Uint8ClampedArray]",E="[object Uint16Array]",v="[object Uint32Array]",R={};R[b]=R[w]=R[S]=R[L]=R[g]=R[T]=R[A]=R[E]=R[v]=!0,R[n]=R[o]=R[y]=R[a]=R[I]=R[s]=R[i]=R[l]=R[u]=R[p]=R[d]=R[f]=R[m]=R[h]=R[_]=!1;function M(F){return r(F)&&t(F.length)&&!!R[e(F)]}return gi=M,gi}var Ei,Xd;function Dc(){if(Xd)return Ei;Xd=1;function e(t){return function(r){return t(r)}}return Ei=e,Ei}var To={exports:{}};To.exports;var Qd;function Mc(){return Qd||(Qd=1,(function(e,t){var r=Wh(),n=t&&!t.nodeType&&t,o=n&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===n,s=a&&r.process,i=(function(){try{var l=o&&o.require&&o.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}})();e.exports=i})(To,To.exports)),To.exports}var Ai,Jd;function Fc(){if(Jd)return Ai;Jd=1;var e=UT(),t=Dc(),r=Mc(),n=r&&r.isTypedArray,o=n?t(n):e;return Ai=o,Ai}var Li,ef;function A_(){if(ef)return Li;ef=1;var e=E_(),t=va(),r=nt(),n=Da(),o=Ma(),a=Fc(),s=Object.prototype,i=s.hasOwnProperty;function l(u,p){var d=r(u),f=!d&&t(u),m=!d&&!f&&n(u),h=!d&&!f&&!m&&a(u),_=d||f||m||h,y=_?e(u.length,String):[],I=y.length;for(var b in u)(p||i.call(u,b))&&!(_&&(b=="length"||m&&(b=="offset"||b=="parent")||h&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||o(b,I)))&&y.push(b);return y}return Li=l,Li}var Oi,tf;function Fa(){if(tf)return Oi;tf=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,o=typeof n=="function"&&n.prototype||e;return r===o}return Oi=t,Oi}var vi,rf;function L_(){if(rf)return vi;rf=1;function e(t,r){return function(n){return t(r(n))}}return vi=e,vi}var Pi,nf;function qT(){if(nf)return Pi;nf=1;var e=L_(),t=e(Object.keys,Object);return Pi=t,Pi}var Ri,of;function O_(){if(of)return Ri;of=1;var e=Fa(),t=qT(),r=Object.prototype,n=r.hasOwnProperty;function o(a){if(!e(a))return t(a);var s=[];for(var i in Object(a))n.call(a,i)&&i!="constructor"&&s.push(i);return s}return Ri=o,Ri}var Ni,af;function Kr(){if(af)return Ni;af=1;var e=m_(),t=Cc();function r(n){return n!=null&&t(n.length)&&!e(n)}return Ni=r,Ni}var ki,sf;function xo(){if(sf)return ki;sf=1;var e=A_(),t=O_(),r=Kr();function n(o){return r(o)?e(o):t(o)}return ki=n,ki}var Ci,lf;function v_(){if(lf)return Ci;lf=1;var e=w_(),t=kc(),r=xo();function n(o){return e(o,r,t)}return Ci=n,Ci}var Di,uf;function VT(){if(uf)return Di;uf=1;var e=v_(),t=1,r=Object.prototype,n=r.hasOwnProperty;function o(a,s,i,l,u,p){var d=i&t,f=e(a),m=f.length,h=e(s),_=h.length;if(m!=_&&!d)return!1;for(var y=m;y--;){var I=f[y];if(!(d?I in s:n.call(s,I)))return!1}var b=p.get(a),w=p.get(s);if(b&&w)return b==s&&w==a;var S=!0;p.set(a,s),p.set(s,a);for(var L=d;++y<m;){I=f[y];var g=a[I],T=s[I];if(l)var A=d?l(T,g,I,s,a,p):l(g,T,I,a,s,p);if(!(A===void 0?g===T||u(g,T,i,l,p):A)){S=!1;break}L||(L=I=="constructor")}if(S&&!L){var E=a.constructor,v=s.constructor;E!=v&&"constructor"in a&&"constructor"in s&&!(typeof E=="function"&&E instanceof E&&typeof v=="function"&&v instanceof v)&&(S=!1)}return p.delete(a),p.delete(s),S}return Di=o,Di}var Mi,cf;function BT(){if(cf)return Mi;cf=1;var e=Yr(),t=Kt(),r=e(t,"DataView");return Mi=r,Mi}var Fi,pf;function xT(){if(pf)return Fi;pf=1;var e=Yr(),t=Kt(),r=e(t,"Promise");return Fi=r,Fi}var $i,df;function P_(){if(df)return $i;df=1;var e=Yr(),t=Kt(),r=e(t,"Set");return $i=r,$i}var Ui,ff;function zT(){if(ff)return Ui;ff=1;var e=Yr(),t=Kt(),r=e(t,"WeakMap");return Ui=r,Ui}var qi,mf;function zo(){if(mf)return qi;mf=1;var e=BT(),t=vc(),r=xT(),n=P_(),o=zT(),a=Un(),s=h_(),i="[object Map]",l="[object Object]",u="[object Promise]",p="[object Set]",d="[object WeakMap]",f="[object DataView]",m=s(e),h=s(t),_=s(r),y=s(n),I=s(o),b=a;return(e&&b(new e(new ArrayBuffer(1)))!=f||t&&b(new t)!=i||r&&b(r.resolve())!=u||n&&b(new n)!=p||o&&b(new o)!=d)&&(b=function(w){var S=a(w),L=S==l?w.constructor:void 0,g=L?s(L):"";if(g)switch(g){case m:return f;case h:return i;case _:return u;case y:return p;case I:return d}return S}),qi=b,qi}var Vi,hf;function HT(){if(hf)return Vi;hf=1;var e=Rc(),t=I_(),r=FT(),n=VT(),o=zo(),a=nt(),s=Da(),i=Fc(),l=1,u="[object Arguments]",p="[object Array]",d="[object Object]",f=Object.prototype,m=f.hasOwnProperty;function h(_,y,I,b,w,S){var L=a(_),g=a(y),T=L?p:o(_),A=g?p:o(y);T=T==u?d:T,A=A==u?d:A;var E=T==d,v=A==d,R=T==A;if(R&&s(_)){if(!s(y))return!1;L=!0,E=!1}if(R&&!E)return S||(S=new e),L||i(_)?t(_,y,I,b,w,S):r(_,y,T,I,b,w,S);if(!(I&l)){var M=E&&m.call(_,"__wrapped__"),F=v&&m.call(y,"__wrapped__");if(M||F){var G=M?_.value():_,Y=F?y.value():y;return S||(S=new e),w(G,Y,I,b,S)}}return R?(S||(S=new e),n(_,y,I,b,w,S)):!1}return Vi=h,Vi}var Bi,_f;function $c(){if(_f)return Bi;_f=1;var e=HT(),t=cr();function r(n,o,a,s,i){return n===o?!0:n==null||o==null||!t(n)&&!t(o)?n!==n&&o!==o:e(n,o,a,s,r,i)}return Bi=r,Bi}var xi,yf;function jT(){if(yf)return xi;yf=1;var e=Rc(),t=$c(),r=1,n=2;function o(a,s,i,l){var u=i.length,p=u,d=!l;if(a==null)return!p;for(a=Object(a);u--;){var f=i[u];if(d&&f[2]?f[1]!==a[f[0]]:!(f[0]in a))return!1}for(;++u<p;){f=i[u];var m=f[0],h=a[m],_=f[1];if(d&&f[2]){if(h===void 0&&!(m in a))return!1}else{var y=new e;if(l)var I=l(h,_,m,a,s,y);if(!(I===void 0?t(_,h,r|n,l,y):I))return!1}}return!0}return xi=o,xi}var zi,bf;function R_(){if(bf)return zi;bf=1;var e=pr();function t(r){return r===r&&!e(r)}return zi=t,zi}var Hi,If;function WT(){if(If)return Hi;If=1;var e=R_(),t=xo();function r(n){for(var o=t(n),a=o.length;a--;){var s=o[a],i=n[s];o[a]=[s,i,e(i)]}return o}return Hi=r,Hi}var ji,Tf;function N_(){if(Tf)return ji;Tf=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return ji=e,ji}var Wi,wf;function GT(){if(wf)return Wi;wf=1;var e=jT(),t=WT(),r=N_();function n(o){var a=t(o);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(s){return s===o||e(s,o,a)}}return Wi=n,Wi}var Gi,Sf;function Uc(){if(Sf)return Gi;Sf=1;var e=nt(),t=Fo(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function o(a,s){if(e(a))return!1;var i=typeof a;return i=="number"||i=="symbol"||i=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||s!=null&&a in Object(s)}return Gi=o,Gi}var Yi,gf;function YT(){if(gf)return Yi;gf=1;var e=Pc(),t="Expected a function";function r(n,o){if(typeof n!="function"||o!=null&&typeof o!="function")throw new TypeError(t);var a=function(){var s=arguments,i=o?o.apply(this,s):s[0],l=a.cache;if(l.has(i))return l.get(i);var u=n.apply(this,s);return a.cache=l.set(i,u)||l,u};return a.cache=new(r.Cache||e),a}return r.Cache=e,Yi=r,Yi}var Ki,Ef;function KT(){if(Ef)return Ki;Ef=1;var e=YT(),t=500;function r(n){var o=e(n,function(s){return a.size===t&&a.clear(),s}),a=o.cache;return o}return Ki=r,Ki}var Zi,Af;function ZT(){if(Af)return Zi;Af=1;var e=KT(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(o){var a=[];return o.charCodeAt(0)===46&&a.push(""),o.replace(t,function(s,i,l,u){a.push(l?u.replace(r,"$1"):i||s)}),a});return Zi=n,Zi}var Xi,Lf;function XT(){if(Lf)return Xi;Lf=1;var e=$n(),t=Bo(),r=nt(),n=Fo(),o=e?e.prototype:void 0,a=o?o.toString:void 0;function s(i){if(typeof i=="string")return i;if(r(i))return t(i,s)+"";if(n(i))return a?a.call(i):"";var l=i+"";return l=="0"&&1/i==-1/0?"-0":l}return Xi=s,Xi}var Qi,Of;function QT(){if(Of)return Qi;Of=1;var e=XT();function t(r){return r==null?"":e(r)}return Qi=t,Qi}var Ji,vf;function qn(){if(vf)return Ji;vf=1;var e=nt(),t=Uc(),r=ZT(),n=QT();function o(a,s){return e(a)?a:t(a,s)?[a]:r(n(a))}return Ji=o,Ji}var el,Pf;function Vn(){if(Pf)return el;Pf=1;var e=Fo();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return el=t,el}var tl,Rf;function $a(){if(Rf)return tl;Rf=1;var e=qn(),t=Vn();function r(n,o){o=e(o,n);for(var a=0,s=o.length;n!=null&&a<s;)n=n[t(o[a++])];return a&&a==s?n:void 0}return tl=r,tl}var rl,Nf;function JT(){if(Nf)return rl;Nf=1;var e=$a();function t(r,n,o){var a=r==null?void 0:e(r,n);return a===void 0?o:a}return rl=t,rl}var nl,kf;function ew(){if(kf)return nl;kf=1;function e(t,r){return t!=null&&r in Object(t)}return nl=e,nl}var ol,Cf;function tw(){if(Cf)return ol;Cf=1;var e=qn(),t=va(),r=nt(),n=Ma(),o=Cc(),a=Vn();function s(i,l,u){l=e(l,i);for(var p=-1,d=l.length,f=!1;++p<d;){var m=a(l[p]);if(!(f=i!=null&&u(i,m)))break;i=i[m]}return f||++p!=d?f:(d=i==null?0:i.length,!!d&&o(d)&&n(m,d)&&(r(i)||t(i)))}return ol=s,ol}var al,Df;function rw(){if(Df)return al;Df=1;var e=ew(),t=tw();function r(n,o){return n!=null&&t(n,o,e)}return al=r,al}var sl,Mf;function nw(){if(Mf)return sl;Mf=1;var e=$c(),t=JT(),r=rw(),n=Uc(),o=R_(),a=N_(),s=Vn(),i=1,l=2;function u(p,d){return n(p)&&o(d)?a(s(p),d):function(f){var m=t(f,p);return m===void 0&&m===d?r(f,p):e(d,m,i|l)}}return sl=u,sl}var il,Ff;function k_(){if(Ff)return il;Ff=1;function e(t){return function(r){return r?.[t]}}return il=e,il}var ll,$f;function ow(){if($f)return ll;$f=1;var e=$a();function t(r){return function(n){return e(n,r)}}return ll=t,ll}var ul,Uf;function aw(){if(Uf)return ul;Uf=1;var e=k_(),t=ow(),r=Uc(),n=Vn();function o(a){return r(a)?e(n(a)):t(a)}return ul=o,ul}var cl,qf;function Bn(){if(qf)return cl;qf=1;var e=GT(),t=nw(),r=$o(),n=nt(),o=aw();function a(s){return typeof s=="function"?s:s==null?r:typeof s=="object"?n(s)?t(s[0],s[1]):e(s):o(s)}return cl=a,cl}var pl,Vf;function sw(){if(Vf)return pl;Vf=1;function e(t){return function(r,n,o){for(var a=-1,s=Object(r),i=o(r),l=i.length;l--;){var u=i[t?l:++a];if(n(s[u],u,s)===!1)break}return r}}return pl=e,pl}var dl,Bf;function iw(){if(Bf)return dl;Bf=1;var e=sw(),t=e();return dl=t,dl}var fl,xf;function C_(){if(xf)return fl;xf=1;var e=iw(),t=xo();function r(n,o){return n&&e(n,o,t)}return fl=r,fl}var ml,zf;function lw(){if(zf)return ml;zf=1;var e=Kr();function t(r,n){return function(o,a){if(o==null)return o;if(!e(o))return r(o,a);for(var s=o.length,i=n?s:-1,l=Object(o);(n?i--:++i<s)&&a(l[i],i,l)!==!1;);return o}}return ml=t,ml}var hl,Hf;function qc(){if(Hf)return hl;Hf=1;var e=C_(),t=lw(),r=t(e);return hl=r,hl}var _l,jf;function uw(){if(jf)return _l;jf=1;var e=qc(),t=Kr();function r(n,o){var a=-1,s=t(n)?Array(n.length):[];return e(n,function(i,l,u){s[++a]=o(i,l,u)}),s}return _l=r,_l}var yl,Wf;function cw(){if(Wf)return yl;Wf=1;var e=Bo(),t=Bn(),r=uw(),n=nt();function o(a,s){var i=n(a)?e:r;return i(a,t(s,3))}return yl=o,yl}var bl,Gf;function pw(){if(Gf)return bl;Gf=1;var e=f_(),t=cw();function r(n,o){return e(t(n,o),1)}return bl=r,bl}var dw=pw();const Nn=Ye(dw);var Il,Yf;function D_(){if(Yf)return Il;Yf=1;var e=Yr(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Il=t,Il}var Tl,Kf;function Vc(){if(Kf)return Tl;Kf=1;var e=D_();function t(r,n,o){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[n]=o}return Tl=t,Tl}var wl,Zf;function fw(){if(Zf)return wl;Zf=1;var e=Vc(),t=C_(),r=Bn();function n(o,a){var s={};return a=r(a,3),t(o,function(i,l,u){e(s,l,a(i,l,u))}),s}return wl=n,wl}var mw=fw();const lr=Ye(mw);var Sl,Xf;function hw(){if(Xf)return Sl;Xf=1;var e=Math.ceil,t=Math.max;function r(n,o,a,s){for(var i=-1,l=t(e((o-n)/(a||1)),0),u=Array(l);l--;)u[s?l:++i]=n,n+=a;return u}return Sl=r,Sl}var gl,Qf;function Bc(){if(Qf)return gl;Qf=1;var e=Pa(),t=Kr(),r=Ma(),n=pr();function o(a,s,i){if(!n(i))return!1;var l=typeof s;return(l=="number"?t(i)&&r(s,i.length):l=="string"&&s in i)?e(i[s],a):!1}return gl=o,gl}var El,Jf;function _w(){if(Jf)return El;Jf=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return El=t,El}var Al,em;function yw(){if(em)return Al;em=1;var e=_w(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Al=r,Al}var Ll,tm;function bw(){if(tm)return Ll;tm=1;var e=yw(),t=pr(),r=Fo(),n=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,i=parseInt;function l(u){if(typeof u=="number")return u;if(r(u))return n;if(t(u)){var p=typeof u.valueOf=="function"?u.valueOf():u;u=t(p)?p+"":p}if(typeof u!="string")return u===0?u:+u;u=e(u);var d=a.test(u);return d||s.test(u)?i(u.slice(2),d?2:8):o.test(u)?n:+u}return Ll=l,Ll}var Ol,rm;function M_(){if(rm)return Ol;rm=1;var e=bw(),t=1/0,r=17976931348623157e292;function n(o){if(!o)return o===0?o:0;if(o=e(o),o===t||o===-t){var a=o<0?-1:1;return a*r}return o===o?o:0}return Ol=n,Ol}var vl,nm;function Iw(){if(nm)return vl;nm=1;var e=hw(),t=Bc(),r=M_();function n(o){return function(a,s,i){return i&&typeof i!="number"&&t(a,s,i)&&(s=i=void 0),a=r(a),s===void 0?(s=a,a=0):s=r(s),i=i===void 0?a<s?1:-1:r(i),e(a,s,i,o)}}return vl=n,vl}var Pl,om;function Tw(){if(om)return Pl;om=1;var e=Iw(),t=e();return Pl=t,Pl}var ww=Tw();const An=Ye(ww);var Rl,am;function Sw(){if(am)return Rl;am=1;function e(t,r,n,o){var a=-1,s=t==null?0:t.length;for(o&&s&&(n=t[++a]);++a<s;)n=r(n,t[a],a,t);return n}return Rl=e,Rl}var Nl,sm;function gw(){if(sm)return Nl;sm=1;function e(t,r,n,o,a){return a(t,function(s,i,l){n=o?(o=!1,s):r(n,s,i,l)}),n}return Nl=e,Nl}var kl,im;function Ew(){if(im)return kl;im=1;var e=Sw(),t=qc(),r=Bn(),n=gw(),o=nt();function a(s,i,l){var u=o(s)?e:n,p=arguments.length<3;return u(s,r(i,4),l,p,t)}return kl=a,kl}var Aw=Ew();const mt=Ye(Aw),Ua=(e,t,r)=>{const{gripperEntities:n,moduleEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a);if(s==null)return{errors:[C({parameterName:e.moduleId})]};const i=Qn(r,s),l=Object.keys(n).length>0,u=[];if(i==null&&u.push(de()),l||u.push(Vh()),u.length>0)return{errors:u};const p=o[s].pythonName;return{commands:[{commandType:"absorbanceReader/closeLid",key:$(),params:{moduleId:s}}],python:`${p}.close_lid()`}},F_=(e,t,r)=>{const{sampleWavelengths:n,measureMode:o,referenceWavelength:a}=e,{runtimeParameters:s}=t,i=O(e.moduleId,s),l=O(o,s),u=l==="single"||l==="multi"?l:null,p=n.map(b=>D(b,s)),d=a==null?void 0:D(a,s),f=[e.moduleId,o,...n,a],m=[i,u,...p,d],h=f.flatMap((b,w)=>typeof b=="string"&&m[w]===null?[C({parameterName:b})]:[]);if(h.length>0||i==null||u==null)return{errors:h};const _=t.moduleEntities[i].pythonName,y=s[o]!=null?o:q(o),I=a!=null?`, reference_wavelength=${a}`:"";return{commands:[{commandType:"absorbanceReader/initialize",key:$(),params:{moduleId:i,measureMode:u,sampleWavelengths:p,...d!=null?{referenceWavelength:d}:{}}}],python:`${_}.initialize(${y}, [${n.join(", ")}]${I})`}},$_=(e,t,r)=>{const{gripperEntities:n,moduleEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a);if(s==null)return{errors:[C({parameterName:e.moduleId})]};const i=Qn(r,s),l=Object.keys(n).length>0,u=[];if(i==null&&u.push(de()),l||u.push(Vh()),u.length>0)return{errors:u};const p=o[s].pythonName;return{commands:[{commandType:"absorbanceReader/openLid",key:$(),params:{moduleId:s}}],python:`${p}.open_lid()`}},U_=(e,t,r)=>{const{fileName:n}=e,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=n==null?void 0:O(n,o),i=[];if(a==null&&i.push(C({parameterName:e.moduleId})),n!=null&&s==null&&i.push(C({parameterName:n})),a==null||i.length>0)return{errors:i};const l=Qn(r,a);if(l==null)return{errors:[de()]};l.initialization===null&&i.push(xr());const u=t.moduleEntities[a].pythonName,p=n==null||o[n]!=null?n:q(n),d=p!=null?`export_filename=${p}`:"";return i.length>0?{errors:i}:{commands:[{commandType:"absorbanceReader/read",key:$(),params:{moduleId:a,...s!=null?{fileName:s}:{}}}],python:`${u}.read(${d})`}},Pt=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=D(e.volume,n),s=D(e.flowRate,n),i=e.correctionVolume==null?void 0:D(e.correctionVolume,n),l=[e.pipetteId,e.volume,e.flowRate,e.correctionVolume],u=[o,a,s,i],p=l.flatMap((h,_)=>typeof h=="string"&&u[_]==null?[C({parameterName:h})]:[]);if(p.length>0||o==null||a==null||s==null)return{errors:p};if(!t.pipetteEntities[o]?.spec)return{errors:[ht({pipette:o})]};const f=t.pipetteEntities[o].pythonName;return{commands:[{commandType:"airGapInPlace",key:$(),params:{flowRate:s,pipetteId:o,volume:a,...i!=null?{correctionVolume:i}:{}}}],python:`${f}.air_gap(${[`volume=${e.volume}`,"in_place=True",`flow_rate=${e.flowRate}`].join(", ")})`}},Lw=(e,t,r)=>{const{pipetteId:n,volume:o,labwareId:a,wellName:s,flowRate:i,isAirGap:l,tipRack:u,wellLocation:p,primaryNozzle:d,nozzles:f}=e,m="aspirate",h=r.labware,_=[],y=t.pipetteEntities[n]?.spec,I=(y?.displayCategory==="FLEX"||y?.channels===96)??!1,b=Wn(a,r.labware);if(y||_.push(ht({pipette:n})),!a||!r.labware[a]?_.push(_t({actionName:m,labware:a})):ee(r.labware[a].stack)==="offDeck"&&_.push(Rn()),De.includes(b))_.push(Wt({typeOfStep:m}));else if(h[b]!=null){const v=ee(h[b].stack);De.includes(v)&&_.push(Wt({typeOfStep:m}))}Yn({pipette:n,labware:a,invariantContext:t,prevRobotState:r})&&_.push(Ro()),r.tipState.pipettes[n]?.hasTip||_.push(Yt({actionName:m,pipette:n,labware:a,well:s}));const w=t.pipetteEntities[n]?.spec.channels!==1,S=bt({robotState:r,invariantContext:t,pipetteId:n,labwareId:a,wellLocationOffset:p?.offset??{x:0,y:0,z:0},wellTargetName:s,primaryNozzle:d,nozzleConfiguration:f});if(w&&y&&!S.isSafe&&_.push(jt({unsafePipetteMovementReason:S.reason})),Xo(r.modules,r.labware,a)&&_.push(vn()),Yo(r.modules,r.labware,a)&&_.push(xr()),ea(r.modules,r.labware,a)&&_.push(Ea()),ta(r.modules,r.labware,a)&&_.push(Pn()),Xn(r.modules,b,I?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&_.push(ko()),I||(Kn(r.modules,b)&&_.push(No()),Zn(r.modules,b,y)&&_.push(Co()),Jo(r.modules,b,y,t.labwareEntities[a])&&_.push(Aa())),_.length===0&&y&&y.liquids.default.maxVolume<o&&_.push(ba({actionName:m,volume:o,maxVolume:y.liquids.default.maxVolume})),_.length===0&&y){const v=Ja(n,t,u);v<o&&_.push(lI({actionName:m,volume:o,maxVolume:v}))}if(_.length>0)return{errors:_};const L=[{commandType:"aspirate",key:$(),params:{pipetteId:n,volume:o,labwareId:a,wellName:s,wellLocation:p,flowRate:i},...l&&{meta:{isAirGap:l}}}],g=t.pipetteEntities[n].pythonName,T=t.labwareEntities[a].pythonName,A=[`volume=${o}`,`location=${T}[${q(s)}]${Gt(p)}`,`flow_rate=${i}`],E=`${g}.aspirate(
|
|
2
2
|
${Q(A.join(`,
|
|
3
3
|
`))},
|
|
4
|
-
)`;return{commands:L,python:E}},Ho=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=D(e.volume,n),s=D(e.flowRate,n),i=e.correctionVolume==null?void 0:D(e.correctionVolume,n),l=[e.pipetteId,e.volume,e.flowRate,e.correctionVolume],u=[o,a,s,i],p=l.flatMap((m,h)=>typeof m=="string"&&u[h]==null?[C({parameterName:m})]:[]);if(p.length>0||o==null||a==null||s==null)return{errors:p};if(r.tipState.pipettes[o]?.hasTip||p.push(Yt({actionName:"aspirate",pipette:o})),p.length>0)return{errors:p};const d=t.pipetteEntities[o].pythonName,f=[`volume=${e.volume}`,`flow_rate=${e.flowRate}`];return{commands:[{commandType:"aspirateInPlace",key
|
|
5
|
-
${u}.blow_out()`}},xc=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:o,runtimeParameters:a}=t,s=O(e.pipetteId,a),i=O(e.labwareId,a),l=O(e.wellName,a),u=D(e.flowRate,a),p=Dn(e.wellLocation,a),d=[e.pipetteId,e.labwareId,e.wellName,e.flowRate],f=[s,i,l,u],m=[...d.flatMap((M,F)=>typeof M=="string"&&f[F]==null?[C({parameterName:M})]:[]),...p.invalidParameterNames.map(M=>C({parameterName:M}))];if(m.length>0||s==null||i==null||l==null||u==null)return{errors:m};const h=p.location,_=n[s],y="blowout",I=[],b=_?.spec,w=(b?.displayCategory==="FLEX"||b?.channels===96)??!1,S=r.pipettes[s],L=r.labware,g=Wn(i,r.labware);if(S||I.push(ht({pipette:s})),b==null&&I.push(ht({pipette:s})),r.tipState.pipettes[s]?.hasTip||I.push(Yt({actionName:y,pipette:s,labware:i,well:l})),!i||!r.labware[i]?I.push(_t({actionName:y,labware:i})):ee(r.labware[i].stack)==="offDeck"&&I.push(Rn()),De.includes(g))I.push(Wt({typeOfStep:y}));else if(L[g]!=null){const M=ee(L[g].stack);De.includes(M)&&I.push(Wt({typeOfStep:y}))}if(Yn({pipette:s,labware:i,invariantContext:t,prevRobotState:r})&&I.push(Ro()),Xo(r.modules,r.labware,i)&&I.push(vn()),Yo(r.modules,r.labware,i)&&I.push(xr()),ea(r.modules,r.labware,i)&&I.push(Ea()),ta(r.modules,r.labware,i)&&I.push(Pn()),Xn(r.modules,g,w?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&I.push(ko()),!w&&b!=null&&(Kn(r.modules,g)&&I.push(No()),Zn(r.modules,g,b)&&I.push(Co()),Jo(r.modules,g,b,t.labwareEntities[i])&&I.push(Aa())),I.length>0)return{errors:I};const T=_.pythonName,A=o[i].pythonName,E=a[e.wellName]!=null?e.wellName:q(l),v=Gt(e.wellLocation==null?void 0:{origin:h?.origin,offset:e.wellLocation.offset});return{commands:[{commandType:"blowout",key
|
|
6
|
-
${T}.blow_out(${A}[${E}]${v})`}},q_=(e,t,r)=>{const{runtimeParameters:n}=t,{resolution:o}=e,a=je(e.homeBefore,n),s=O(e.fileName,n),i=D(o[0],n),l=D(o[1],n),u=D(e.zoom,n),p=D(e.contrast,n),d=D(e.brightness,n),f=D(e.saturation,n),m=[e.homeBefore,e.fileName,o[0],o[1],e.zoom,e.contrast,e.brightness,e.saturation],h=[a,s,i,l,u,p,d,f],_=m.flatMap((w,S)=>typeof w=="string"&&h[S]==null?[C({parameterName:w})]:[]);if(_.length>0||a==null||s==null||i==null||l==null||u==null||p==null||d==null||f==null)return{errors:_};const y={commandType:"captureImage",key
|
|
4
|
+
)`;return{commands:L,python:E}},Ho=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=D(e.volume,n),s=D(e.flowRate,n),i=e.correctionVolume==null?void 0:D(e.correctionVolume,n),l=[e.pipetteId,e.volume,e.flowRate,e.correctionVolume],u=[o,a,s,i],p=l.flatMap((m,h)=>typeof m=="string"&&u[h]==null?[C({parameterName:m})]:[]);if(p.length>0||o==null||a==null||s==null)return{errors:p};if(r.tipState.pipettes[o]?.hasTip||p.push(Yt({actionName:"aspirate",pipette:o})),p.length>0)return{errors:p};const d=t.pipetteEntities[o].pythonName,f=[`volume=${e.volume}`,`flow_rate=${e.flowRate}`];return{commands:[{commandType:"aspirateInPlace",key:$(),params:{pipetteId:o,volume:a,flowRate:s,...i!=null?{correctionVolume:i}:{}}}],python:`${d}.aspirate(${f.join(", ")})`}},xn=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=D(e.flowRate,n),s=[e.pipetteId,e.flowRate],i=[o,a],l=s.flatMap((p,d)=>typeof p=="string"&&i[d]==null?[C({parameterName:p})]:[]);if(l.length>0||o==null||a==null)return{errors:l};if(r.tipState.pipettes[o]?.hasTip||l.push(Yt({actionName:"blowout",pipette:o})),l.length>0)return{errors:l};const u=t.pipetteEntities[o].pythonName;return{commands:[{commandType:"blowOutInPlace",key:$(),params:{pipetteId:o,flowRate:a}}],python:`${u}.flow_rate.blow_out = ${e.flowRate}
|
|
5
|
+
${u}.blow_out()`}},xc=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:o,runtimeParameters:a}=t,s=O(e.pipetteId,a),i=O(e.labwareId,a),l=O(e.wellName,a),u=D(e.flowRate,a),p=Dn(e.wellLocation,a),d=[e.pipetteId,e.labwareId,e.wellName,e.flowRate],f=[s,i,l,u],m=[...d.flatMap((M,F)=>typeof M=="string"&&f[F]==null?[C({parameterName:M})]:[]),...p.invalidParameterNames.map(M=>C({parameterName:M}))];if(m.length>0||s==null||i==null||l==null||u==null)return{errors:m};const h=p.location,_=n[s],y="blowout",I=[],b=_?.spec,w=(b?.displayCategory==="FLEX"||b?.channels===96)??!1,S=r.pipettes[s],L=r.labware,g=Wn(i,r.labware);if(S||I.push(ht({pipette:s})),b==null&&I.push(ht({pipette:s})),r.tipState.pipettes[s]?.hasTip||I.push(Yt({actionName:y,pipette:s,labware:i,well:l})),!i||!r.labware[i]?I.push(_t({actionName:y,labware:i})):ee(r.labware[i].stack)==="offDeck"&&I.push(Rn()),De.includes(g))I.push(Wt({typeOfStep:y}));else if(L[g]!=null){const M=ee(L[g].stack);De.includes(M)&&I.push(Wt({typeOfStep:y}))}if(Yn({pipette:s,labware:i,invariantContext:t,prevRobotState:r})&&I.push(Ro()),Xo(r.modules,r.labware,i)&&I.push(vn()),Yo(r.modules,r.labware,i)&&I.push(xr()),ea(r.modules,r.labware,i)&&I.push(Ea()),ta(r.modules,r.labware,i)&&I.push(Pn()),Xn(r.modules,g,w?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&I.push(ko()),!w&&b!=null&&(Kn(r.modules,g)&&I.push(No()),Zn(r.modules,g,b)&&I.push(Co()),Jo(r.modules,g,b,t.labwareEntities[i])&&I.push(Aa())),I.length>0)return{errors:I};const T=_.pythonName,A=o[i].pythonName,E=a[e.wellName]!=null?e.wellName:q(l),v=Gt(e.wellLocation==null?void 0:{origin:h?.origin,offset:e.wellLocation.offset});return{commands:[{commandType:"blowout",key:$(),params:{pipetteId:s,labwareId:i,wellName:l,flowRate:u,wellLocation:h}}],python:`${T}.flow_rate.blow_out = ${e.flowRate}
|
|
6
|
+
${T}.blow_out(${A}[${E}]${v})`}},q_=(e,t,r)=>{const{runtimeParameters:n}=t,{resolution:o}=e,a=je(e.homeBefore,n),s=O(e.fileName,n),i=D(o[0],n),l=D(o[1],n),u=D(e.zoom,n),p=D(e.contrast,n),d=D(e.brightness,n),f=D(e.saturation,n),m=[e.homeBefore,e.fileName,o[0],o[1],e.zoom,e.contrast,e.brightness,e.saturation],h=[a,s,i,l,u,p,d,f],_=m.flatMap((w,S)=>typeof w=="string"&&h[S]==null?[C({parameterName:w})]:[]);if(_.length>0||a==null||s==null||i==null||l==null||u==null||p==null||d==null||f==null)return{errors:_};const y={commandType:"captureImage",key:$(),params:{homeBefore:a,fileName:s,resolution:[i,l],zoom:u,contrast:p,brightness:d,saturation:f}},I=[`home_before=${Je(e.homeBefore)}`,`filename=${Nt(e.fileName,s,n)}`,`resolution=(${Je(o[0])}, ${Je(o[1])})`,`zoom=${Je(e.zoom)}`,`contrast=${Je(e.contrast)}`,`brightness=${Je(e.brightness)}`,`saturation=${Je(e.saturation)}`],b=`${ge}.capture_image(${I.join(", ")})`;return{commands:[y],python:b}},V_=(e,t,r)=>{const{message:n}=e,o=t.runtimeParameters??{},a=O(n,o);if(a==null)return{errors:[C({parameterName:n})]};const s=[{commandType:"comment",key:$(),params:{message:a}}],i=`${ge}.comment(${Nt(n,a,o)})`;return{commands:s,python:i}},kn=(e,t,r)=>{const{pipetteId:n,volume:o}=e,{runtimeParameters:a}=t,s=O(n,a),i=D(o,a),l=[];if(s==null&&l.push(C({parameterName:n})),typeof o=="string"&&i==null&&l.push(C({parameterName:o})),s==null||i==null)return{errors:l};const u=t.pipetteEntities[s];return u==null?{commands:[]}:{commands:[{commandType:"configureForVolume",key:$(),params:{pipetteId:s,volume:i}}],python:`${u.pythonName}.configure_for_volume(${o})`}},B_=(e,t,r)=>{const{pipetteId:n,configurationParams:o}=e,{style:a,primaryNozzle:s,backLeftNozzle:i}=o,{runtimeParameters:l}=t,u=O(n,l),p=Ht(a,La,l),d=s==null?void 0:Ht(s,Oa,l),f=i==null?void 0:Ht(i,d_,l),m=[];if(u==null&&m.push(C({parameterName:n})),p==null&&m.push(C({parameterName:a})),s!=null&&d==null&&m.push(C({parameterName:s})),i!=null&&f==null&&m.push(C({parameterName:i})),u==null||p==null||s!=null&&d==null||i!=null&&f==null)return{errors:m};const h=t.pipetteEntities[u].pythonName;let _=`protocol_api.${p}`;l[a]!=null&&(_=a);const y=[_];if(s!=null&&d!=null){const b=Nt(s,d,l);p===c.PARTIAL_COLUMN?y.push(`start=${q(c.H1_NOZZLE)}, end=${b}`):y.push(`start=${b}`)}i!=null&&f!=null&&y.push(`back_left=${Nt(i,f,l)}`);const I={style:p,...d!=null?{primaryNozzle:d}:{},...f!=null?{backLeftNozzle:f}:{}};return{commands:[{commandType:"configureNozzleLayout",key:$(),params:{pipetteId:u,configurationParams:I}}],python:`${h}.configure_nozzle_layout(
|
|
7
7
|
${Q(y.join(`,
|
|
8
8
|
`))},
|
|
9
|
-
)`}},x_=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(e.moduleId!=null&&o==null)return{errors:[C({parameterName:e.moduleId})]};if(o===null)return{errors:[de()]};const a=t.moduleEntities[o],s=a?.type,i=a?.pythonName,l={moduleId:o};return s===c.TEMPERATURE_MODULE_TYPE?{commands:[{commandType:"temperatureModule/deactivate",key
|
|
10
|
-
${i}.deactivate_block()`}:s===c.HEATERSHAKER_MODULE_TYPE?{commands:[{commandType:"heaterShaker/deactivateHeater",key
|
|
9
|
+
)`}},x_=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(e.moduleId!=null&&o==null)return{errors:[C({parameterName:e.moduleId})]};if(o===null)return{errors:[de()]};const a=t.moduleEntities[o],s=a?.type,i=a?.pythonName,l={moduleId:o};return s===c.TEMPERATURE_MODULE_TYPE?{commands:[{commandType:"temperatureModule/deactivate",key:$(),params:l}],python:`${i}.deactivate()`}:s===c.THERMOCYCLER_MODULE_TYPE?{commands:[{commandType:"thermocycler/deactivateLid",key:$(),params:l},{commandType:"thermocycler/deactivateBlock",key:$(),params:l}],python:`${i}.deactivate_lid()
|
|
10
|
+
${i}.deactivate_block()`}:s===c.HEATERSHAKER_MODULE_TYPE?{commands:[{commandType:"heaterShaker/deactivateHeater",key:$(),params:l}],python:`${i}.deactivate_heater()`}:(console.error(`setTemperature expected module ${o} to be ${c.TEMPERATURE_MODULE_TYPE}, ${c.THERMOCYCLER_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${s}`),{errors:[de()]})},Ie=(e,t,r)=>{const{message:n}=e,o=t.runtimeParameters??{},a=n==null?void 0:O(n,o),s=[];n!=null&&a==null&&s.push(C({parameterName:n}));let i,l;if("seconds"in e){const u=D(e.seconds,o);if(typeof e.seconds=="string"&&u==null&&s.push(C({parameterName:e.seconds})),s.length>0||u==null)return{errors:s};i={commandType:"waitForDuration",key:$(),params:{seconds:u,message:a??void 0}};const p=[`seconds=${e.seconds}`,...n&&a!=null?[`msg=${Nt(n,a,o)}`]:[]];l=`${ge}.delay(${p.join(", ")})`}else{if(s.length>0)return{errors:s};i={commandType:"waitForResume",key:$(),params:{message:a??void 0}};const u=n&&a!=null?Nt(n,a,o):"";l=`${ge}.pause(${u})`}return{commands:[i],python:l}},z_=(e,t,r)=>{const{moduleEntities:n,runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null)return console.error(`disengageMagnet: arg resolved to null (moduleId=${String(a)})`),{errors:[C({parameterName:e.moduleId})]};if(n[a]?.type!==c.MAGNETIC_MODULE_TYPE)throw new Error(`expected module ${a} to be magdeck, got ${n[a]?.type}`);const s=n[a].pythonName;return{commands:[{commandType:"magneticModule/disengage",key:$(),params:{moduleId:a}}],python:`${s}.disengage()`}},zc=(e,t,r)=>{const{pipetteId:n,volume:o,labwareId:a,wellName:s,flowRate:i,isAirGap:l,wellLocation:u,pushOut:p,primaryNozzle:d,nozzles:f}=e,m="dispense",h=r.labware,_=[],y=t.pipetteEntities[n]?.spec,I=(y?.displayCategory==="FLEX"||y?.channels===96)??!1,b=Wn(a,r.labware);if(y||_.push(ht({pipette:n})),Yn({pipette:n,labware:a,invariantContext:t,prevRobotState:r})&&_.push(Ro()),r.tipState.pipettes[n]?.hasTip||_.push(Yt({actionName:m,pipette:n,labware:a,well:s})),!a||!r.labware[a]?_.push(_t({actionName:m,labware:a})):ee(r.labware[a].stack)==="offDeck"&&_.push(Rn()),De.includes(b))_.push(Wt({typeOfStep:m}));else if(h[b]!=null){const v=ee(h[b].stack);De.includes(v)&&_.push(Wt({typeOfStep:m}))}const w=t.pipetteEntities[n]?.spec.channels!==1,S=bt({robotState:r,invariantContext:t,pipetteId:n,labwareId:a,wellLocationOffset:u?.offset??{x:0,y:0,z:0},wellTargetName:s,primaryNozzle:d,nozzleConfiguration:f});if(w&&!S.isSafe&&_.push(jt({unsafePipetteMovementReason:S.reason})),Xo(r.modules,r.labware,a)&&_.push(vn()),Yo(r.modules,r.labware,a)&&_.push(xr()),ea(r.modules,r.labware,a)&&_.push(Ea()),ta(r.modules,r.labware,a)&&_.push(Pn()),Xn(r.modules,b,I?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&_.push(ko()),I||(Kn(r.modules,b)&&_.push(No()),Zn(r.modules,b,y)&&_.push(Co()),Jo(r.modules,b,y,t.labwareEntities[a])&&_.push(Aa())),_.length>0)return{errors:_};const L=[{commandType:"dispense",key:$(),params:{pipetteId:n,volume:o,labwareId:a,wellName:s,wellLocation:u,flowRate:i,...p!=null?{pushOut:p}:{}},...l&&{meta:{isAirGap:l}}}],g=t.pipetteEntities[n].pythonName,T=t.labwareEntities[a].pythonName,A=[`volume=${o}`,`location=${T}[${q(s)}]${Gt(u)}`,`flow_rate=${i}`,...p!=null?[`push_out=${p}`]:[]],E=`${g}.dispense(
|
|
11
11
|
${Q(A.join(`,
|
|
12
12
|
`))},
|
|
13
|
-
)`;return{commands:L,python:E}},tt=(e,t,r)=>{const{runtimeParameters:n}=t,o=e.isAirGap==null?void 0:je(e.isAirGap,n),a=O(e.pipetteId,n),s=D(e.volume,n),i=D(e.flowRate,n),l=e.pushOut==null?void 0:D(e.pushOut,n),u=e.correctionVolume==null?void 0:D(e.correctionVolume,n),p=[e.pipetteId,e.volume,e.flowRate,e.pushOut,e.correctionVolume,e.isAirGap],d=[a,s,i,l,u,o],f=p.flatMap((_,y)=>typeof _=="string"&&d[y]==null?[C({parameterName:_})]:[]);if(f.length>0||a==null||s==null||i==null)return{errors:f};if(r.tipState.pipettes[a]?.hasTip||f.push(Yt({actionName:"dispense",pipette:a})),f.length>0)return{errors:f};const m=t.pipetteEntities[a].pythonName,h=[`volume=${e.volume}`,`flow_rate=${e.flowRate}`,...e.pushOut!=null?[`push_out=${e.pushOut}`]:[]];return{commands:[{commandType:"dispenseInPlace",key
|
|
13
|
+
)`;return{commands:L,python:E}},tt=(e,t,r)=>{const{runtimeParameters:n}=t,o=e.isAirGap==null?void 0:je(e.isAirGap,n),a=O(e.pipetteId,n),s=D(e.volume,n),i=D(e.flowRate,n),l=e.pushOut==null?void 0:D(e.pushOut,n),u=e.correctionVolume==null?void 0:D(e.correctionVolume,n),p=[e.pipetteId,e.volume,e.flowRate,e.pushOut,e.correctionVolume,e.isAirGap],d=[a,s,i,l,u,o],f=p.flatMap((_,y)=>typeof _=="string"&&d[y]==null?[C({parameterName:_})]:[]);if(f.length>0||a==null||s==null||i==null)return{errors:f};if(r.tipState.pipettes[a]?.hasTip||f.push(Yt({actionName:"dispense",pipette:a})),f.length>0)return{errors:f};const m=t.pipetteEntities[a].pythonName,h=[`volume=${e.volume}`,`flow_rate=${e.flowRate}`,...e.pushOut!=null?[`push_out=${e.pushOut}`]:[]];return{commands:[{commandType:"dispenseInPlace",key:$(),params:{pipetteId:a,volume:s,flowRate:i,...l!=null?{pushOut:l}:{},...u!=null?{correctionVolume:u}:{}},...o?{meta:{isAirGap:o}}:{}}],python:`${m}.dispense(${h.join(", ")})`}},Zr=(e,t,r)=>{const{runtimeParameters:n}=t,o=e.isReturnTip==null?void 0:je(e.isReturnTip,n),a=O(e.pipette,n),s=e.dropTipLocation==null?void 0:O(e.dropTipLocation,n),i=e.wellName==null?void 0:O(e.wellName,n),l=[e.pipette,e.dropTipLocation,e.wellName,e.isReturnTip],u=[a,s,i,o],p=l.flatMap((I,b)=>typeof I=="string"&&u[b]==null?[C({parameterName:I})]:[]);if(p.length>0||a==null)return{errors:p};if(!r.tipState.pipettes[a]?.hasTip)return{commands:[]};const d=r.pipettes[a].tiprackId,f=r.pipettes[a].tipWell,m=Object.values(t.labwareEntities).find(({id:I})=>I===d),h=m!=null&&f!=null;if(o&&!h)return{errors:[Lp()]};let _=null;if(o&&h){const I=t.pipetteEntities[a].pythonName,w=`${m.pythonName}["${f}"]`;_=`${I}.drop_tip(location=${w})`}let y=[];if(o){if(d==null||f==null)return{errors:[Lp()]};y=[{commandType:"dropTip",key:$(),params:{pipetteId:a,labwareId:d,wellName:f}}]}else{if(s==null||i==null)return{errors:[Fn()]};y=[{commandType:"dropTip",key:$(),params:{pipetteId:a,labwareId:s,wellName:i}}]}return{commands:y,..._!=null?{python:_}:{}}},qa=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=e.homeAfter==null?void 0:je(e.homeAfter,n),s=[e.pipetteId,e.homeAfter],i=[o,a],l=s.flatMap((b,w)=>typeof b=="string"&&i[w]==null?[C({parameterName:b})]:[]);if(l.length>0||o==null)return{errors:l};if(!r.tipState.pipettes[o]?.hasTip)return{commands:[]};const{pipetteEntities:u,trashBinEntities:p,wasteChuteEntities:d}=t,f=u[o].pythonName,m=r.pipettes[o]?.entityId??"",h=p[m],_=d[m],y=[h!=null?`${h.pythonName}, alternate_drop_location=True`:_?.pythonName,...e.homeAfter!=null?[`home_after=${Je(e.homeAfter)}`]:[]].filter(Boolean).join(", ");return{commands:[{commandType:"dropTipInPlace",key:$(),params:{pipetteId:o,...a!=null?{homeAfter:a}:{}}}],python:`${f}.drop_tip(${y})`}},H_=(e,t,r)=>{const{moduleEntities:n,runtimeParameters:o}=t,a=O(e.moduleId,o),s=D(e.height,o),i=[];if(a==null&&i.push(C({parameterName:e.moduleId})),typeof e.height=="string"&&s==null&&i.push(C({parameterName:e.height})),i.length>0||a==null||s==null)return console.error(`engageMagnet: arg resolved to null (moduleId=${String(a)}, height=${String(s)})`),{errors:i};if(n[a]?.type!==c.MAGNETIC_MODULE_TYPE)throw new Error(`expected module ${a} to be magdeck, got ${n[a]?.type}`);const l=n[a].pythonName;return{commands:[{commandType:"magneticModule/engage",key:$(),params:{moduleId:a,height:s}}],python:`${l}.engage(height_from_base=${e.height})`}},Ow=["manualWithPause","logical"],j_=(e,t,r)=>{const{strategy:n,message:o,count:a}=e,{moduleEntities:s,runtimeParameters:i}=t,l=O(e.moduleId,i),u=Ht(n,Ow,i),p=o==null?void 0:O(o,i),d=a==null?void 0:D(a,i),f=[e.moduleId,n,o,a],m=[l,u,p,d],h=f.flatMap((b,w)=>typeof b=="string"&&m[w]==null?[C({parameterName:b})]:[]);if(h.length>0||l==null||u==null||p===null||d===null)return{errors:h};const _=It(r,l);if(s[l]==null||_==null)return{errors:[de()]};const y=s[l].pythonName,I=o&&p!=null?`message=${Nt(o,p,i)}`:"";return{commands:[{commandType:"flexStacker/empty",key:$(),params:{moduleId:l,strategy:u,message:p,count:d}}],python:`${y}.empty(${I})`}},W_=(e,t,r)=>{const{interventionMessage:n,fillLabwareIds:o}=e,{labwareEntities:a,moduleEntities:s,runtimeParameters:i}=t,l=O(e.moduleId,i),u=o.map(g=>O(g,i)),p=n==null?null:O(n,i),d=[];if(l==null&&d.push(C({parameterName:e.moduleId})),o.forEach((g,T)=>{u[T]==null&&d.push(C({parameterName:g}))}),n!=null&&p==null&&d.push(C({parameterName:n})),d.length>0||l==null)return{errors:d};const f=u.filter(g=>g!=null);if(s[l]==null)return{errors:[de()]};const m=It(r,l),h=ap(m,t.labwareEntities),_=s[l].pythonName,y=f.filter(g=>!c.getIsLid(a[g].def)).map(g=>a[g]?.pythonName),b=Ba(y,4).map(g=>Wo+g.join(", ")).join(`,
|
|
14
14
|
`),w=y.length<4?y.join(", "):`
|
|
15
15
|
${b}
|
|
16
16
|
`;if(m!=null&&m.storedLabwareDetails===null&&m.labwareInHopper==null)return{errors:[hI()]};if(h){if(f.length>0&&!f.every(T=>op(T,t,m)))return{errors:[Bh()]}}else return{errors:[xh()]};const L=[...f.filter(g=>!c.getIsLid(a[g].def)).length>0?`labware=[${w}],
|
|
17
17
|
`:[],...n!=null&&p!=null?[`message=${Nt(n,p,i)},
|
|
18
|
-
`]:[]].join("");return{commands:[{commandType:"flexStacker/fillItems",key
|
|
19
|
-
${Q(L)})`}},G_=(e,t,r)=>{const{moduleEntities:n,runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null)return{errors:[C({parameterName:e.moduleId})]};if(n[a]==null)return{errors:[de()]};const s=n[a].pythonName,i=It(r,a),l=i?.labwareInHopper!=null&&i.labwareInHopper.length>0;return i!==null&&np(i)?{errors:[fI()]}:l?{commands:[{commandType:"flexStacker/retrieve",key:U(),params:{moduleId:a}}],python:`${s}.retrieve()`}:{errors:[dI()]}},Y_=(e,t,r)=>{const{labwareEntities:n,moduleEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a);if(s==null)return{errors:[C({parameterName:e.moduleId})]};if(o[s]==null)return{errors:[de()]};const i=o[s].pythonName,l=It(r,s),u=l?.labwareOnShuttle?.primaryLabwareId??null,p=ap(l,n);return l!==null&&!np(l)?{errors:[mI()]}:u!==null&&!op(u,t,l)?{errors:[Bh()]}:p?{commands:[{commandType:"flexStacker/store",key:U(),params:{moduleId:s,strategy:"automatic"}}],python:`${i}.store()`}:{errors:[xh()]}};function Cl(){return{type:"ASPIRATE_MORE_THAN_WELL_CONTENTS",message:"Not enough liquid"}}function Dl(){return{type:"ASPIRATE_FROM_PRISTINE_WELL",message:"This step tries to aspirate from an empty well."}}function vw(){return{type:"LABWARE_IN_WASTE_CHUTE_HAS_LIQUID",message:"Disposing of a labware with liquid"}}function Pw(){return{type:"TIPRACK_IN_WASTE_CHUTE_HAS_TIPS",message:"Disposing unused tips"}}function Rw(){return{type:"TEMPERATURE_IS_POTENTIALLY_UNREACHABLE",message:"The module set temperature is potentially unreachable."}}function Nw(){return{type:"WAITING_FOR_NONEXISTENT_TASK",message:"This step is waiting for a task that was never started."}}const kw="opentrons_flex_tiprack_lid",K_=(e,t,r)=>{const{gripperEntities:n,trashBinEntities:o,wasteChuteEntities:a,labwareEntities:s,moduleEntities:i,runtimeParameters:l}=t,u=O(e.labwareId,l),p=O(e.strategy,l),d=[];let f=null;if(u==null&&d.push(C({parameterName:e.labwareId})),p==null&&d.push(C({parameterName:e.strategy})),typeof e.newLocation=="string"){const k=O(e.newLocation,l);k==null?d.push(C({parameterName:e.newLocation})):f=k}else if("labwareId"in e.newLocation){const k=O(e.newLocation.labwareId,l);k==null?d.push(C({parameterName:e.newLocation.labwareId})):f={labwareId:k}}else if("moduleId"in e.newLocation){const k=O(e.newLocation.moduleId,l);k==null?d.push(C({parameterName:e.newLocation.moduleId})):f={moduleId:k}}else if("slotName"in e.newLocation){const k=O(e.newLocation.slotName,l);k==null?d.push(C({parameterName:e.newLocation.slotName})):f={slotName:k}}else{const k=O(e.newLocation.addressableAreaName,l);k==null?d.push(C({parameterName:e.newLocation.addressableAreaName})):f={addressableAreaName:k}}if(d.length>0||u==null||p==null||f==null)return{errors:d};const m=p==="usingGripper",h=Object.keys(n).length>0,_=Object.values(a).length>0,y=r.tipState!=null?gy(r.tipState,u):!1,I=r.liquidState!=null?Ey(r.liquidState,u):!1,b=Object.values(r.tipState.pipettes).some(({hasTip:k})=>k),w="moveToLabware",S=[],L=c.locationIsOnAddressableArea(f)&&f.addressableAreaName==="gripperWasteChute";!u||!r.labware[u]?d.push(_t({actionName:w,labware:u})):ee(r.labware[u].stack)==="offDeck"&&m?d.push(Rn()):r.labware[u].stack.includes(rt)&&d.push(NI());const g=s[u]?.def.metadata.displayCategory==="aluminumBlock";m&&g&&d.push(II()),(L&&h&&!m||!h&&m)&&d.push(bI()),b&&m&&d.push(sI());const T=r.labware[u]!=null?ee(r.labware[u].stack):null;(_&&T==="gripperWasteChute"||c.MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(T)||T==="fixedTrash")&&d.push(Do());const A=T!=null&&r.labware[T]!=null?ee(r.labware[T].stack):null,E=A??T,v=k=>k==null?null:k in r.modules?r.modules[k].moduleState:Object.values(r.modules).find(({slot:B})=>B===k)?.moduleState??null,R=Object.entries(r.labware).filter(([k,B])=>B.stack.includes("offDeck")).map(([k])=>k),M=Object.values(f);R.some(k=>M.includes(k))&&m&&d.push(uI());const F=v(E);F!=null&&(F.type===c.THERMOCYCLER_MODULE_TYPE&&F.lidOpen!==!0?d.push(vn()):F.type===c.HEATERSHAKER_MODULE_TYPE?F.latchOpen!==!0?d.push(Ap()):F.targetSpeed!==null&&d.push(Pn()):F.type===c.ABSORBANCE_READER_TYPE&&F.lidOpen!==!0?d.push(xr()):F.type===c.VACUUM_MODULE_TYPE&&F.currentPumpActivity.type!=="pumpDeactivated"&&d.push(Op()));const G=c.locationIsOnModule(f)&&"moduleId"in f?f.moduleId:null,Y=c.locationIsOnLabware(f)?f.labwareId:null,oe=Y!=null?r.labware[Y].stack[1]:null,fe=oe??G;f==="offDeck"&&m&&d.push(Rn()),y&&L&&_?S.push(Pw()):I&&L&&_&&S.push(vw());const J=v(fe);J!=null&&(J.type===c.THERMOCYCLER_MODULE_TYPE&&J.lidOpen!==!0?d.push(vn()):J.type===c.HEATERSHAKER_MODULE_TYPE?(J.latchOpen!==!0&&d.push(Ap()),J.targetSpeed!==null&&d.push(Pn())):J.type===c.ABSORBANCE_READER_TYPE?J.lidOpen!==!0&&d.push(xr()):J.type===c.VACUUM_MODULE_TYPE&&J.currentPumpActivity.type!=="pumpDeactivated"&&d.push(Op())),s[u]?.def.parameters.loadName===kw&&f!=null&&c.locationIsOnDeck(f)&&("slotName"in f||"addressableAreaName"in f&&c.FLEX_STAGING_AREA_SLOT_ADDRESSABLE_AREAS.includes(f.addressableAreaName))&&d.push(LI());const Ve={labwareId:u,strategy:p,newLocation:f},Me=[{commandType:"moveLabware",key:U(),params:Ve}],We=s[u]?.pythonName;let ie="",Ne=null;if(f==="offDeck")ie=Cn;else if(f==="systemLocation")ie="system_location";else if(f==="wasteChuteLocation")ie=Cn;else if("labwareId"in f){ie=s[f.labwareId].pythonName;const k=r.labware[f.labwareId].stack;Ne=k[k.length-1]}else if("moduleId"in f)Ne=r.modules[f.moduleId].slot,ie=i[f.moduleId].pythonName;else if("slotName"in f){const{slotName:k}=f;if(k in s){const B=ee(r.labware[k].stack);ie=c.getIsLid(s[k].def)?q(B):s[k].pythonName;const re=r.labware[k].stack;Ne=re[re.length-1]}else{const B=typeof e.newLocation=="object"&&"slotName"in e.newLocation?e.newLocation.slotName:k;ie=l[B]!=null?B:q(k),Ne=k}}else if("addressableAreaName"in f){const k=De.includes(f.addressableAreaName),B=c.WASTE_CHUTE_ADDRESSABLE_AREAS.includes(f.addressableAreaName),$=f.addressableAreaName==="fixedTrash",V=c.MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(f.addressableAreaName)||$?Object.values(o)?.map(z=>z.location):[],Z=!B&&!k&&!Ao(f.addressableAreaName)?hy(f.addressableAreaName,$?"fixedTrashSlot":"trashBinAdapter",$?c.OT2_ROBOT_TYPE:c.FLEX_ROBOT_TYPE):null,W=V.find(z=>z===Z),x=W!=null?Object.values(o).find(z=>z.location===W)?.id:null;if(k){const z=typeof e.newLocation=="object"&&"addressableAreaName"in e.newLocation?e.newLocation.addressableAreaName:f.addressableAreaName;ie=l[z]!=null?z:q(f.addressableAreaName)}else if(x!=null&&!B)ie=o[x]?.pythonName??"";else if(x==null&&B)ie=Object.values(a)[0]?.pythonName??"";else if(Ao(f.addressableAreaName)){const[z]=Object.entries(r.modules).find(([,le])=>le.moduleState.type===c.VACUUM_MODULE_TYPE)??[];if(z!=null&&i[z]!=null){const{pythonName:le}=i[z];ie=`${le}.manifold_dock`}}else ie=""}if(Ne!=null){const k=go({slot:Ne,labwareState:r.labware,modulesState:r.modules}),B=ee(k),{isCompatible:$,isAboveStackLimit:re}=vy(u,k,s,i);$||d.push(yI()),re&&d.push(vI({slot:B}))}if(d.length>0)return{errors:d};ie===""&&console.error("expected to find a python new location but could not");const Be=m?", use_gripper=True":"",Ae=c.getIsLid(s[u].def),ae=r.labware[u].stack;let K="";if(Ae){const k=Ay(ae);if(k==null)console.error("expected to find a parent for labware to move but could not");else{const B=s[k]!=null,$=B&&c.getIsLid(s[k].def);ae.length===2||B&&$?K=q(ee(ae)):(B||!c.getIsLid(s[k].def))&&(K=s[k].pythonName)}}Ae&&K===""&&console.error("expected to find a valid lid move location but could not");const j=Ae?`${ge}.move_lid(${K}, ${ie}${Be})`:`${ge}.move_labware(${We}, ${ie}${Be})`;return{commands:Me,...S.length>0?{warnings:S}:{},python:j}},qe=(e,t,r)=>{const{offset:n}=e,{pipetteEntities:o,trashBinEntities:a,wasteChuteEntities:s,runtimeParameters:i}=t,l=O(e.pipetteId,i),u=O(e.fixtureId,i),p=D(n.x,i),d=D(n.y,i),f=D(n.z,i),m=[];if(l==null&&m.push(C({parameterName:e.pipetteId})),u==null&&m.push(C({parameterName:e.fixtureId})),typeof n.x=="string"&&p==null&&m.push(C({parameterName:n.x})),typeof n.y=="string"&&d==null&&m.push(C({parameterName:n.y})),typeof n.z=="string"&&f==null&&m.push(C({parameterName:n.z})),m.length>0||l==null||u==null||p==null||d==null||f==null)return{errors:m};const h=o[l],_=h.spec.channels,y=h.pythonName,I=a[u]??s[u],b=I.pythonName;let w=_y(_);return a[u]!=null&&(w=Qc(I.location)),{commands:[{commandType:"moveToAddressableArea",key:U(),params:{pipetteId:l,addressableAreaName:w,offset:{x:p,y:d,z:f}}}],python:`${y}.move_to(${b})`}},Hc=(e,t,r)=>{const{runtimeParameters:n}=t,o=e.offset??{x:0,y:0,z:0},a=O(e.pipetteId,n),s=O(e.addressableAreaName,n),i=D(o.x,n),l=D(o.y,n),u=D(o.z,n),p=je(e.alternateDropLocation??!0,n),d=e.speed==null?void 0:D(e.speed,n),f=e.minimumZHeight==null?void 0:D(e.minimumZHeight,n),m=e.forceDirect==null?void 0:je(e.forceDirect,n),h=e.ignoreTipConfiguration==null?void 0:je(e.ignoreTipConfiguration,n),_=[e.pipetteId,e.addressableAreaName,e.offset?.x,e.offset?.y,e.offset?.z,e.alternateDropLocation,e.speed,e.minimumZHeight,e.forceDirect,e.ignoreTipConfiguration],y=[a,s,i,l,u,p,d,f,m,h],I=_.flatMap((b,w)=>typeof b=="string"&&y[w]==null?[C({parameterName:b})]:[]);return I.length>0||a==null||s==null||i==null||l==null||u==null||p==null?{errors:I}:{commands:[{commandType:"moveToAddressableAreaForDropTip",key:U(),params:{pipetteId:a,addressableAreaName:s,offset:{x:i,y:l,z:u},alternateDropLocation:p,...d!=null?{speed:d}:{},...f!=null?{minimumZHeight:f}:{},...m!=null?{forceDirect:m}:{},...h!=null?{ignoreTipConfiguration:h}:{}}}]}},H=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:o,runtimeParameters:a}=t,s=O(e.pipetteId,a),i=O(e.labwareId,a),l=O(e.wellName,a),u=e.wellLocation?.origin==null?void 0:O(e.wellLocation.origin,a),p=e.wellLocation?.offset?.x==null?void 0:D(e.wellLocation.offset.x,a),d=e.wellLocation?.offset?.y==null?void 0:D(e.wellLocation.offset.y,a),f=e.wellLocation?.offset?.z==null?void 0:D(e.wellLocation.offset.z,a),m=e.minimumZHeight==null?void 0:D(e.minimumZHeight,a),h=e.forceDirect==null?void 0:je(e.forceDirect,a),_=e.speed==null?void 0:D(e.speed,a),y=[];if(s==null&&y.push(C({parameterName:e.pipetteId})),i==null&&y.push(C({parameterName:e.labwareId})),l==null&&y.push(C({parameterName:e.wellName})),e.wellLocation?.origin!=null&&u==null&&y.push(C({parameterName:e.wellLocation.origin})),typeof e.wellLocation?.offset?.x=="string"&&p==null&&y.push(C({parameterName:e.wellLocation.offset.x})),typeof e.wellLocation?.offset?.y=="string"&&d==null&&y.push(C({parameterName:e.wellLocation.offset.y})),typeof e.wellLocation?.offset?.z=="string"&&f==null&&y.push(C({parameterName:e.wellLocation.offset.z})),typeof e.minimumZHeight=="string"&&m==null&&y.push(C({parameterName:e.minimumZHeight})),typeof e.forceDirect=="string"&&h==null&&y.push(C({parameterName:e.forceDirect})),typeof e.speed=="string"&&_==null&&y.push(C({parameterName:e.speed})),y.length>0||s==null||i==null||l==null)return{errors:y};const I=e.wellLocation==null?void 0:{...u!=null?{origin:u}:{},...e.wellLocation.offset!=null?{offset:{...typeof p=="number"?{x:p}:{},...typeof d=="number"?{y:d}:{},...typeof f=="number"?{z:f}:{}}}:{}},b="moveToWell",w=r.labware,S=n[s]?.spec,L=r.pipettes[s]?.nozzles??c.ALL,g=r.pipettes[s]?.primaryNozzle??ga({nozzles:L,channels:S?.channels}),T=(S?.displayCategory==="FLEX"||S?.channels===96)??!1,A=Wn(i,r.labware);if(S||y.push(ht({pipette:s})),!i||!r.labware[i]?y.push(_t({actionName:b,labware:i})):ee(r.labware[i].stack)==="offDeck"&&y.push(Rn()),De.includes(A))y.push(Wt({typeOfStep:"move to well"}));else if(w[A]!=null){const J=ee(w[A].stack);De.includes(J)&&y.push(Wt({typeOfStep:b}))}Yn({pipette:s,labware:i,invariantContext:t,prevRobotState:r})&&y.push(Ro()),Xo(r.modules,r.labware,i)&&y.push(vn()),ea(r.modules,r.labware,i)&&y.push(Ea()),Yo(r.modules,r.labware,i)&&y.push(xr()),ta(r.modules,r.labware,i)&&y.push(Pn()),Xn(r.modules,A,T?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&y.push(ko()),T||(Kn(r.modules,A)&&y.push(No()),Zn(r.modules,A,S)&&y.push(Co()),Jo(r.modules,A,S,o[i])&&y.push(Aa()));const E=t.pipetteEntities[s]?.spec.channels!==1,v=t.pipetteEntities[s]?.spec,R=bt({robotState:r,invariantContext:t,pipetteId:s,labwareId:i,wellLocationOffset:I?.offset??{x:0,y:0,z:0},wellTargetName:l,nozzleConfiguration:L,primaryNozzle:g});if(E&&v&&!R.isSafe&&y.push(jt({unsafePipetteMovementReason:R.reason})),y.length>0)return{errors:y};const M=n[s].pythonName,F=o[i].pythonName,G=a[e.wellName]!=null?e.wellName:q(l),Y=Gt({...u!=null?{origin:u}:{},...e.wellLocation?.offset!=null?{offset:e.wellLocation.offset}:{}}),oe=[{commandType:"moveToWell",key:U(),params:{pipetteId:s,labwareId:i,wellName:l,wellLocation:I,...h!=null?{forceDirect:h}:{},...m!=null?{minimumZHeight:m}:{},..._!=null?{speed:_}:{}}}],fe=[`${F}[${G}]${Y}`];return typeof e.forceDirect=="string"?fe.push(`force_direct=${e.forceDirect}`):e.forceDirect&&fe.push("force_direct=True"),e.minimumZHeight&&fe.push(`minimum_z_height=${e.minimumZHeight}`),e.speed&&fe.push(`speed=${e.speed}`),{commands:oe,python:`${M}.move_to(${fe.join(", ")})`}},ya=(e,t,r)=>{const{tipTrackingOption:n=Ia,nozzles:o,primaryNozzle:a}=e,{runtimeParameters:s}=t,i=O(e.pipetteId,s),l=O(e.labwareId,s),u=O(e.wellName,s),p=o==null?void 0:Ht(o,La,s),d=a==null?void 0:Ht(a,Oa,s),f=Ht(n,[Ia,yt],s),m=[e.pipetteId,e.labwareId,e.wellName],h=[i,l,u],_=m.flatMap((M,F)=>typeof M=="string"&&h[F]==null?[C({parameterName:M})]:[]);if(o!=null&&p==null&&_.push(C({parameterName:o})),a!=null&&d==null&&_.push(C({parameterName:a})),f==null&&_.push(C({parameterName:n})),_.length>0||i==null||l==null||u==null||f==null)return{errors:_};const y=p,I=d,b=[],w=t.pipetteEntities[i].spec.channels,S=bt({robotState:r,invariantContext:t,pipetteId:i,labwareId:l,wellLocationOffset:{x:0,y:0},wellTargetName:u,nozzleConfiguration:y,primaryNozzle:I}),L=wp({tipState:r.tipState.tipracks[l],primaryNozzle:I,channels:w,nozzleConfiguration:y,wellName:u,tiprackDef:t.labwareEntities[l].def});S.isSafe||b.push(jt({unsafePipetteMovementReason:S.reason})),L.isSafe||b.push(PI()),L.isComplete!==!0&&b.push(RI());const g=ee(r.labware[l].stack);if(De.includes(g))b.push(Wt({typeOfStep:"pick up tip"}));else if(r.labware[g]!=null){const M=ee(r.labware[g].stack);De.includes(M)&&b.push(Wt({typeOfStep:"pick up tip"}))}const T=t.pipetteEntities[i].pythonName,A=t.labwareEntities[l].pythonName,E=s[e.wellName]!=null?e.wellName:q(u),v=f===yt?`[${E}]`:"",R=`${T}.pick_up_tip(location=${A}${v})`;return b.length>0?{errors:b}:{commands:[{commandType:"pickUpTip",key:U(),params:{pipetteId:i,labwareId:l,wellName:u}}],python:R}},Z_=(e,t,r)=>{const{taskId:n,profileElements:o,blockMaxVolumeUl:a}=e,{runtimeParameters:s}=t,i=O(e.moduleId,s),l=n==null?n:O(n,s),u=[];i==null&&u.push(C({parameterName:e.moduleId})),n!=null&&l==null&&u.push(C({parameterName:n}));const p=g=>{const T=D(g,s);return typeof g=="string"&&T==null&&u.push(C({parameterName:g})),T},d=g=>({celsius:p(g.celsius),holdSeconds:p(g.holdSeconds)}),f=o.map(g=>"steps"in g?{steps:g.steps.map(d),repetitions:p(g.repetitions)}:d(g)),m=a==null?void 0:p(a);if(i==null||u.length>0)return{errors:u};const h=t.moduleEntities[i].pythonName,_=o.map(g=>"steps"in g&&o.length>1?{...g,repetitions:D(g.repetitions,s)}:g),y=vb(_),I=y.repeatingProfileSteps.map(g=>`{${q("temperature")}: ${g.celsius}, ${q("hold_time_seconds")}: ${g.holdSeconds}},`).join(`
|
|
18
|
+
`]:[]].join("");return{commands:[{commandType:"flexStacker/fillItems",key:$(),params:{moduleId:l,labware:f,message:p??void 0}}],python:`${_}.fill_items(
|
|
19
|
+
${Q(L)})`}},G_=(e,t,r)=>{const{moduleEntities:n,runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null)return{errors:[C({parameterName:e.moduleId})]};if(n[a]==null)return{errors:[de()]};const s=n[a].pythonName,i=It(r,a),l=i?.labwareInHopper!=null&&i.labwareInHopper.length>0;return i!==null&&np(i)?{errors:[fI()]}:l?{commands:[{commandType:"flexStacker/retrieve",key:$(),params:{moduleId:a}}],python:`${s}.retrieve()`}:{errors:[dI()]}},Y_=(e,t,r)=>{const{labwareEntities:n,moduleEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a);if(s==null)return{errors:[C({parameterName:e.moduleId})]};if(o[s]==null)return{errors:[de()]};const i=o[s].pythonName,l=It(r,s),u=l?.labwareOnShuttle?.primaryLabwareId??null,p=ap(l,n);return l!==null&&!np(l)?{errors:[mI()]}:u!==null&&!op(u,t,l)?{errors:[Bh()]}:p?{commands:[{commandType:"flexStacker/store",key:$(),params:{moduleId:s,strategy:"automatic"}}],python:`${i}.store()`}:{errors:[xh()]}};function Cl(){return{type:"ASPIRATE_MORE_THAN_WELL_CONTENTS",message:"Not enough liquid"}}function Dl(){return{type:"ASPIRATE_FROM_PRISTINE_WELL",message:"This step tries to aspirate from an empty well."}}function vw(){return{type:"LABWARE_IN_WASTE_CHUTE_HAS_LIQUID",message:"Disposing of a labware with liquid"}}function Pw(){return{type:"TIPRACK_IN_WASTE_CHUTE_HAS_TIPS",message:"Disposing unused tips"}}function Rw(){return{type:"TEMPERATURE_IS_POTENTIALLY_UNREACHABLE",message:"The module set temperature is potentially unreachable."}}function Nw(){return{type:"WAITING_FOR_NONEXISTENT_TASK",message:"This step is waiting for a task that was never started."}}const kw="opentrons_flex_tiprack_lid",K_=(e,t,r)=>{const{gripperEntities:n,trashBinEntities:o,wasteChuteEntities:a,labwareEntities:s,moduleEntities:i,runtimeParameters:l}=t,u=O(e.labwareId,l),p=O(e.strategy,l),d=[];let f=null;if(u==null&&d.push(C({parameterName:e.labwareId})),p==null&&d.push(C({parameterName:e.strategy})),typeof e.newLocation=="string"){const k=O(e.newLocation,l);k==null?d.push(C({parameterName:e.newLocation})):f=k}else if("labwareId"in e.newLocation){const k=O(e.newLocation.labwareId,l);k==null?d.push(C({parameterName:e.newLocation.labwareId})):f={labwareId:k}}else if("moduleId"in e.newLocation){const k=O(e.newLocation.moduleId,l);k==null?d.push(C({parameterName:e.newLocation.moduleId})):f={moduleId:k}}else if("slotName"in e.newLocation){const k=O(e.newLocation.slotName,l);k==null?d.push(C({parameterName:e.newLocation.slotName})):f={slotName:k}}else{const k=O(e.newLocation.addressableAreaName,l);k==null?d.push(C({parameterName:e.newLocation.addressableAreaName})):f={addressableAreaName:k}}if(d.length>0||u==null||p==null||f==null)return{errors:d};const m=p==="usingGripper",h=Object.keys(n).length>0,_=Object.values(a).length>0,y=r.tipState!=null?gy(r.tipState,u):!1,I=r.liquidState!=null?Ey(r.liquidState,u):!1,b=Object.values(r.tipState.pipettes).some(({hasTip:k})=>k),w="moveToLabware",S=[],L=c.locationIsOnAddressableArea(f)&&f.addressableAreaName==="gripperWasteChute";!u||!r.labware[u]?d.push(_t({actionName:w,labware:u})):ee(r.labware[u].stack)==="offDeck"&&m?d.push(Rn()):r.labware[u].stack.includes(rt)&&d.push(NI());const g=s[u]?.def.metadata.displayCategory==="aluminumBlock";m&&g&&d.push(II()),(L&&h&&!m||!h&&m)&&d.push(bI()),b&&m&&d.push(sI());const T=r.labware[u]!=null?ee(r.labware[u].stack):null;(_&&T==="gripperWasteChute"||c.MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(T)||T==="fixedTrash")&&d.push(Do());const A=T!=null&&r.labware[T]!=null?ee(r.labware[T].stack):null,E=A??T,v=k=>k==null?null:k in r.modules?r.modules[k].moduleState:Object.values(r.modules).find(({slot:B})=>B===k)?.moduleState??null,R=Object.entries(r.labware).filter(([k,B])=>B.stack.includes("offDeck")).map(([k])=>k),M=Object.values(f);R.some(k=>M.includes(k))&&m&&d.push(uI());const F=v(E);F!=null&&(F.type===c.THERMOCYCLER_MODULE_TYPE&&F.lidOpen!==!0?d.push(vn()):F.type===c.HEATERSHAKER_MODULE_TYPE?F.latchOpen!==!0?d.push(Ap()):F.targetSpeed!==null&&d.push(Pn()):F.type===c.ABSORBANCE_READER_TYPE&&F.lidOpen!==!0?d.push(xr()):F.type===c.VACUUM_MODULE_TYPE&&F.currentPumpActivity.type!=="pumpDeactivated"&&d.push(Op()));const G=c.locationIsOnModule(f)&&"moduleId"in f?f.moduleId:null,Y=c.locationIsOnLabware(f)?f.labwareId:null,oe=Y!=null?r.labware[Y].stack[1]:null,fe=oe??G;f==="offDeck"&&m&&d.push(Rn()),y&&L&&_?S.push(Pw()):I&&L&&_&&S.push(vw());const J=v(fe);J!=null&&(J.type===c.THERMOCYCLER_MODULE_TYPE&&J.lidOpen!==!0?d.push(vn()):J.type===c.HEATERSHAKER_MODULE_TYPE?(J.latchOpen!==!0&&d.push(Ap()),J.targetSpeed!==null&&d.push(Pn())):J.type===c.ABSORBANCE_READER_TYPE?J.lidOpen!==!0&&d.push(xr()):J.type===c.VACUUM_MODULE_TYPE&&J.currentPumpActivity.type!=="pumpDeactivated"&&d.push(Op())),s[u]?.def.parameters.loadName===kw&&f!=null&&c.locationIsOnDeck(f)&&("slotName"in f||"addressableAreaName"in f&&c.FLEX_STAGING_AREA_SLOT_ADDRESSABLE_AREAS.includes(f.addressableAreaName))&&d.push(LI());const Ve={labwareId:u,strategy:p,newLocation:f},Me=[{commandType:"moveLabware",key:$(),params:Ve}],We=s[u]?.pythonName;let ie="",Ne=null;if(f==="offDeck")ie=Cn;else if(f==="systemLocation")ie="system_location";else if(f==="wasteChuteLocation")ie=Cn;else if("labwareId"in f){ie=s[f.labwareId].pythonName;const k=r.labware[f.labwareId].stack;Ne=k[k.length-1]}else if("moduleId"in f)Ne=r.modules[f.moduleId].slot,ie=i[f.moduleId].pythonName;else if("slotName"in f){const{slotName:k}=f;if(k in s){const B=ee(r.labware[k].stack);ie=c.getIsLid(s[k].def)?q(B):s[k].pythonName;const re=r.labware[k].stack;Ne=re[re.length-1]}else{const B=typeof e.newLocation=="object"&&"slotName"in e.newLocation?e.newLocation.slotName:k;ie=l[B]!=null?B:q(k),Ne=k}}else if("addressableAreaName"in f){const k=De.includes(f.addressableAreaName),B=c.WASTE_CHUTE_ADDRESSABLE_AREAS.includes(f.addressableAreaName),U=f.addressableAreaName==="fixedTrash",V=c.MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(f.addressableAreaName)||U?Object.values(o)?.map(z=>z.location):[],Z=!B&&!k&&!Ao(f.addressableAreaName)?hy(f.addressableAreaName,U?"fixedTrashSlot":"trashBinAdapter",U?c.OT2_ROBOT_TYPE:c.FLEX_ROBOT_TYPE):null,W=V.find(z=>z===Z),x=W!=null?Object.values(o).find(z=>z.location===W)?.id:null;if(k){const z=typeof e.newLocation=="object"&&"addressableAreaName"in e.newLocation?e.newLocation.addressableAreaName:f.addressableAreaName;ie=l[z]!=null?z:q(f.addressableAreaName)}else if(x!=null&&!B)ie=o[x]?.pythonName??"";else if(x==null&&B)ie=Object.values(a)[0]?.pythonName??"";else if(Ao(f.addressableAreaName)){const[z]=Object.entries(r.modules).find(([,le])=>le.moduleState.type===c.VACUUM_MODULE_TYPE)??[];if(z!=null&&i[z]!=null){const{pythonName:le}=i[z];ie=`${le}.manifold_dock`}}else ie=""}if(Ne!=null){const k=go({slot:Ne,labwareState:r.labware,modulesState:r.modules}),B=ee(k),{isCompatible:U,isAboveStackLimit:re}=vy(u,k,s,i);U||d.push(yI()),re&&d.push(vI({slot:B}))}if(d.length>0)return{errors:d};ie===""&&console.error("expected to find a python new location but could not");const Be=m?", use_gripper=True":"",Ae=c.getIsLid(s[u].def),ae=r.labware[u].stack;let K="";if(Ae){const k=Ay(ae);if(k==null)console.error("expected to find a parent for labware to move but could not");else{const B=s[k]!=null,U=B&&c.getIsLid(s[k].def);ae.length===2||B&&U?K=q(ee(ae)):(B||!c.getIsLid(s[k].def))&&(K=s[k].pythonName)}}Ae&&K===""&&console.error("expected to find a valid lid move location but could not");const j=Ae?`${ge}.move_lid(${K}, ${ie}${Be})`:`${ge}.move_labware(${We}, ${ie}${Be})`;return{commands:Me,...S.length>0?{warnings:S}:{},python:j}},qe=(e,t,r)=>{const{offset:n}=e,{pipetteEntities:o,trashBinEntities:a,wasteChuteEntities:s,runtimeParameters:i}=t,l=O(e.pipetteId,i),u=O(e.fixtureId,i),p=D(n.x,i),d=D(n.y,i),f=D(n.z,i),m=[];if(l==null&&m.push(C({parameterName:e.pipetteId})),u==null&&m.push(C({parameterName:e.fixtureId})),typeof n.x=="string"&&p==null&&m.push(C({parameterName:n.x})),typeof n.y=="string"&&d==null&&m.push(C({parameterName:n.y})),typeof n.z=="string"&&f==null&&m.push(C({parameterName:n.z})),m.length>0||l==null||u==null||p==null||d==null||f==null)return{errors:m};const h=o[l],_=h.spec.channels,y=h.pythonName,I=a[u]??s[u],b=I.pythonName;let w=_y(_);return a[u]!=null&&(w=Qc(I.location)),{commands:[{commandType:"moveToAddressableArea",key:$(),params:{pipetteId:l,addressableAreaName:w,offset:{x:p,y:d,z:f}}}],python:`${y}.move_to(${b})`}},Hc=(e,t,r)=>{const{runtimeParameters:n}=t,o=e.offset??{x:0,y:0,z:0},a=O(e.pipetteId,n),s=O(e.addressableAreaName,n),i=D(o.x,n),l=D(o.y,n),u=D(o.z,n),p=je(e.alternateDropLocation??!0,n),d=e.speed==null?void 0:D(e.speed,n),f=e.minimumZHeight==null?void 0:D(e.minimumZHeight,n),m=e.forceDirect==null?void 0:je(e.forceDirect,n),h=e.ignoreTipConfiguration==null?void 0:je(e.ignoreTipConfiguration,n),_=[e.pipetteId,e.addressableAreaName,e.offset?.x,e.offset?.y,e.offset?.z,e.alternateDropLocation,e.speed,e.minimumZHeight,e.forceDirect,e.ignoreTipConfiguration],y=[a,s,i,l,u,p,d,f,m,h],I=_.flatMap((b,w)=>typeof b=="string"&&y[w]==null?[C({parameterName:b})]:[]);return I.length>0||a==null||s==null||i==null||l==null||u==null||p==null?{errors:I}:{commands:[{commandType:"moveToAddressableAreaForDropTip",key:$(),params:{pipetteId:a,addressableAreaName:s,offset:{x:i,y:l,z:u},alternateDropLocation:p,...d!=null?{speed:d}:{},...f!=null?{minimumZHeight:f}:{},...m!=null?{forceDirect:m}:{},...h!=null?{ignoreTipConfiguration:h}:{}}}]}},H=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:o,runtimeParameters:a}=t,s=O(e.pipetteId,a),i=O(e.labwareId,a),l=O(e.wellName,a),u=e.wellLocation?.origin==null?void 0:O(e.wellLocation.origin,a),p=e.wellLocation?.offset?.x==null?void 0:D(e.wellLocation.offset.x,a),d=e.wellLocation?.offset?.y==null?void 0:D(e.wellLocation.offset.y,a),f=e.wellLocation?.offset?.z==null?void 0:D(e.wellLocation.offset.z,a),m=e.minimumZHeight==null?void 0:D(e.minimumZHeight,a),h=e.forceDirect==null?void 0:je(e.forceDirect,a),_=e.speed==null?void 0:D(e.speed,a),y=[];if(s==null&&y.push(C({parameterName:e.pipetteId})),i==null&&y.push(C({parameterName:e.labwareId})),l==null&&y.push(C({parameterName:e.wellName})),e.wellLocation?.origin!=null&&u==null&&y.push(C({parameterName:e.wellLocation.origin})),typeof e.wellLocation?.offset?.x=="string"&&p==null&&y.push(C({parameterName:e.wellLocation.offset.x})),typeof e.wellLocation?.offset?.y=="string"&&d==null&&y.push(C({parameterName:e.wellLocation.offset.y})),typeof e.wellLocation?.offset?.z=="string"&&f==null&&y.push(C({parameterName:e.wellLocation.offset.z})),typeof e.minimumZHeight=="string"&&m==null&&y.push(C({parameterName:e.minimumZHeight})),typeof e.forceDirect=="string"&&h==null&&y.push(C({parameterName:e.forceDirect})),typeof e.speed=="string"&&_==null&&y.push(C({parameterName:e.speed})),y.length>0||s==null||i==null||l==null)return{errors:y};const I=e.wellLocation==null?void 0:{...u!=null?{origin:u}:{},...e.wellLocation.offset!=null?{offset:{...typeof p=="number"?{x:p}:{},...typeof d=="number"?{y:d}:{},...typeof f=="number"?{z:f}:{}}}:{}},b="moveToWell",w=r.labware,S=n[s]?.spec,L=r.pipettes[s]?.nozzles??c.ALL,g=r.pipettes[s]?.primaryNozzle??ga({nozzles:L,channels:S?.channels}),T=(S?.displayCategory==="FLEX"||S?.channels===96)??!1,A=Wn(i,r.labware);if(S||y.push(ht({pipette:s})),!i||!r.labware[i]?y.push(_t({actionName:b,labware:i})):ee(r.labware[i].stack)==="offDeck"&&y.push(Rn()),De.includes(A))y.push(Wt({typeOfStep:"move to well"}));else if(w[A]!=null){const J=ee(w[A].stack);De.includes(J)&&y.push(Wt({typeOfStep:b}))}Yn({pipette:s,labware:i,invariantContext:t,prevRobotState:r})&&y.push(Ro()),Xo(r.modules,r.labware,i)&&y.push(vn()),ea(r.modules,r.labware,i)&&y.push(Ea()),Yo(r.modules,r.labware,i)&&y.push(xr()),ta(r.modules,r.labware,i)&&y.push(Pn()),Xn(r.modules,A,T?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE)&&y.push(ko()),T||(Kn(r.modules,A)&&y.push(No()),Zn(r.modules,A,S)&&y.push(Co()),Jo(r.modules,A,S,o[i])&&y.push(Aa()));const E=t.pipetteEntities[s]?.spec.channels!==1,v=t.pipetteEntities[s]?.spec,R=bt({robotState:r,invariantContext:t,pipetteId:s,labwareId:i,wellLocationOffset:I?.offset??{x:0,y:0,z:0},wellTargetName:l,nozzleConfiguration:L,primaryNozzle:g});if(E&&v&&!R.isSafe&&y.push(jt({unsafePipetteMovementReason:R.reason})),y.length>0)return{errors:y};const M=n[s].pythonName,F=o[i].pythonName,G=a[e.wellName]!=null?e.wellName:q(l),Y=Gt({...u!=null?{origin:u}:{},...e.wellLocation?.offset!=null?{offset:e.wellLocation.offset}:{}}),oe=[{commandType:"moveToWell",key:$(),params:{pipetteId:s,labwareId:i,wellName:l,wellLocation:I,...h!=null?{forceDirect:h}:{},...m!=null?{minimumZHeight:m}:{},..._!=null?{speed:_}:{}}}],fe=[`${F}[${G}]${Y}`];return typeof e.forceDirect=="string"?fe.push(`force_direct=${e.forceDirect}`):e.forceDirect&&fe.push("force_direct=True"),e.minimumZHeight&&fe.push(`minimum_z_height=${e.minimumZHeight}`),e.speed&&fe.push(`speed=${e.speed}`),{commands:oe,python:`${M}.move_to(${fe.join(", ")})`}},ya=(e,t,r)=>{const{tipTrackingOption:n=Ia,nozzles:o,primaryNozzle:a}=e,{runtimeParameters:s}=t,i=O(e.pipetteId,s),l=O(e.labwareId,s),u=O(e.wellName,s),p=o==null?void 0:Ht(o,La,s),d=a==null?void 0:Ht(a,Oa,s),f=Ht(n,[Ia,yt],s),m=[e.pipetteId,e.labwareId,e.wellName],h=[i,l,u],_=m.flatMap((M,F)=>typeof M=="string"&&h[F]==null?[C({parameterName:M})]:[]);if(o!=null&&p==null&&_.push(C({parameterName:o})),a!=null&&d==null&&_.push(C({parameterName:a})),f==null&&_.push(C({parameterName:n})),_.length>0||i==null||l==null||u==null||f==null)return{errors:_};const y=p,I=d,b=[],w=t.pipetteEntities[i].spec.channels,S=bt({robotState:r,invariantContext:t,pipetteId:i,labwareId:l,wellLocationOffset:{x:0,y:0},wellTargetName:u,nozzleConfiguration:y,primaryNozzle:I}),L=wp({tipState:r.tipState.tipracks[l],primaryNozzle:I,channels:w,nozzleConfiguration:y,wellName:u,tiprackDef:t.labwareEntities[l].def});S.isSafe||b.push(jt({unsafePipetteMovementReason:S.reason})),L.isSafe||b.push(PI()),L.isComplete!==!0&&b.push(RI());const g=ee(r.labware[l].stack);if(De.includes(g))b.push(Wt({typeOfStep:"pick up tip"}));else if(r.labware[g]!=null){const M=ee(r.labware[g].stack);De.includes(M)&&b.push(Wt({typeOfStep:"pick up tip"}))}const T=t.pipetteEntities[i].pythonName,A=t.labwareEntities[l].pythonName,E=s[e.wellName]!=null?e.wellName:q(u),v=f===yt?`[${E}]`:"",R=`${T}.pick_up_tip(location=${A}${v})`;return b.length>0?{errors:b}:{commands:[{commandType:"pickUpTip",key:$(),params:{pipetteId:i,labwareId:l,wellName:u}}],python:R}},Z_=(e,t,r)=>{const{taskId:n,profileElements:o,blockMaxVolumeUl:a}=e,{runtimeParameters:s}=t,i=O(e.moduleId,s),l=n==null?n:O(n,s),u=[];i==null&&u.push(C({parameterName:e.moduleId})),n!=null&&l==null&&u.push(C({parameterName:n}));const p=g=>{const T=D(g,s);return typeof g=="string"&&T==null&&u.push(C({parameterName:g})),T},d=g=>({celsius:p(g.celsius),holdSeconds:p(g.holdSeconds)}),f=o.map(g=>"steps"in g?{steps:g.steps.map(d),repetitions:p(g.repetitions)}:d(g)),m=a==null?void 0:p(a);if(i==null||u.length>0)return{errors:u};const h=t.moduleEntities[i].pythonName,_=o.map(g=>"steps"in g&&o.length>1?{...g,repetitions:D(g.repetitions,s)}:g),y=vb(_),I=y.repeatingProfileSteps.map(g=>`{${q("temperature")}: ${g.celsius}, ${q("hold_time_seconds")}: ${g.holdSeconds}},`).join(`
|
|
20
20
|
`),w=`${`[
|
|
21
21
|
${Q(I)}
|
|
22
22
|
],`}
|
|
23
23
|
${y.numRepetitions},
|
|
24
24
|
`+(e.blockMaxVolumeUl!==void 0?`block_max_volume=${e.blockMaxVolumeUl},`:""),L=(n!=null?`${n} = `:"")+`${h}.start_execute_profile(
|
|
25
25
|
${Q(w)}
|
|
26
|
-
)`;return{commands:[{commandType:"thermocycler/startRunExtendedProfile",key
|
|
26
|
+
)`;return{commands:[{commandType:"thermocycler/startRunExtendedProfile",key:$(),params:{moduleId:i,taskId:l,profileElements:f,blockMaxVolumeUl:m??void 0}}],python:L}},Rt=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n);if(o==null)return{errors:[C({parameterName:e.pipetteId})]};const a=t.pipetteEntities[o].pythonName;return{commands:[{commandType:"prepareToAspirate",key:$(),params:{pipetteId:o}}],python:`${a}.prepare_to_aspirate()`}},jc=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=D(e.celsius,n),s=[];if(e.moduleId!=null&&o==null&&s.push(C({parameterName:e.moduleId})),typeof e.celsius=="string"&&a==null&&s.push(C({parameterName:e.celsius})),s.length>0||a==null)return{errors:s};if(o===null)return{errors:[de()]};const i=t.moduleEntities[o],l=i?.type;return l===c.TEMPERATURE_MODULE_TYPE?{commands:[{commandType:"temperatureModule/setTargetTemperature",key:$(),params:{moduleId:o,celsius:a}}],python:`${i?.pythonName}.start_set_temperature(${e.celsius})`}:l===c.THERMOCYCLER_MODULE_TYPE?(console.error("Thermocycler set temp not implemented!"),{commands:[]}):l===c.HEATERSHAKER_MODULE_TYPE?{commands:[{commandType:"heaterShaker/setTargetTemperature",key:$(),params:{moduleId:o,celsius:a}}],python:`${i?.pythonName}.set_target_temperature(${e.celsius})`}:(console.error(`setTemperature expected module ${o} to be ${c.TEMPERATURE_MODULE_TYPE}, ${c.THERMOCYCLER_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${l}`),{errors:[de()]})},Ot=(e,t,r)=>{const n="touchTip",{runtimeParameters:o}=t,a=O(e.pipetteId,o),s=O(e.labwareId,o),i=O(e.wellName,o),l=D(e.zOffsetFromTop,o),u=e.speed==null?void 0:D(e.speed,o),p=e.mmFromEdge==null?void 0:D(e.mmFromEdge,o),d=[e.pipetteId,e.labwareId,e.wellName,e.zOffsetFromTop,e.speed,e.mmFromEdge],f=[a,s,i,l,u,p],m=d.flatMap((L,g)=>typeof L=="string"&&f[g]==null?[C({parameterName:L})]:[]);if(m.length>0||a==null||s==null||i==null||l==null)return{errors:m};if(r.pipettes[a]||m.push(ht({pipette:a})),r.tipState.pipettes[a]?.hasTip||m.push(Yt({actionName:n,pipette:a,labware:s,well:i})),m.length>0)return{errors:m};const _=t.pipetteEntities[a].pythonName,y=t.labwareEntities[s].pythonName,I=o[e.wellName]!=null?e.wellName:q(i),b=[`${y}[${I}]`,`v_offset=${e.zOffsetFromTop}`,...e.speed!=null?[`speed=${e.speed}`]:[],...e.mmFromEdge!=null?[`mm_from_edge=${e.mmFromEdge}`]:[]],w=`${_}.touch_tip(${b.join(", ")})`;return e.speed!=null&&u==null&&console.error(`touchTip: expected speed to resolve but got undefined (raw: ${String(e.speed)})`),e.mmFromEdge!=null&&p==null&&console.error(`touchTip: expected mmFromEdge to resolve but got undefined (raw: ${String(e.mmFromEdge)})`),{commands:[{commandType:"touchTip",key:$(),params:{pipetteId:a,labwareId:s,wellName:i,wellLocation:{origin:c.WELL_ORIGIN_TOP,offset:{z:l}},speed:u??void 0,mmFromEdge:p??void 0}}],python:w}},jo=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[n],a=pt(r,n);if(o==null||a==null)return{errors:[de()]};if(Gn(a))return{errors:[Mo()]};const i=`${o.pythonName}.close_vent()`;return{commands:[{commandType:"vacuumModule/closeVent",key:$(),params:{moduleId:n}}],python:i}},X_=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[n],a=pt(r,n);if(o==null||a==null)return{errors:[de()]};if(Gn(a))return{errors:[Mo()]};const i=`${o.pythonName}.open_vent()`;return{commands:[{commandType:"vacuumModule/openVent",key:$(),params:{moduleId:n}}],python:i}},ge="protocol",Cn="protocol_api.OFF_DECK",Va="CUSTOM_LABWARE",Wo=" ";function Q(e){return e.split(`
|
|
27
27
|
`).map(t=>t&&Wo+t).join(`
|
|
28
28
|
`)}function ur(e){switch(typeof e){case"undefined":return"None";case"boolean":return e?"True":"False";case"number":return Number.isFinite(e)?`${e}`:`float("${e}")`;case"string":return q(e);case"object":return e===null?"None":Array.isArray(e)?J_(e):zr(e);default:throw Error("Cannot render value as Python",{cause:e})}}function Je(e){return typeof e=="string"?e:ur(e)}function q(e){return JSON.stringify(e)}function Q_(e){return`(${e.map(t=>ur(t)).join(", ")})`}function J_(e){return e.every(t=>Array.isArray(t)&&t.length===2&&t.every(r=>typeof r=="number"))?`[${e.map(t=>Q_(t)).join(", ")}]`:`[${e.map(t=>ur(t)).join(", ")}]`}function Cw(e){return["undefined","boolean","number","string"].includes(typeof e)||e===null}function zr(e){const t=Object.entries(e),r=t.every(([n,o])=>Cw(o));if(t.length<=1||r){const n=`{${t.map(([o,a])=>`${q(o)}: ${ur(a)}`).join(", ")}}`;if(t.length<=1||n.length<64)return n}return`{
|
|
29
29
|
${Q(t.map(([n,o])=>`${q(n)}: ${ur(o)}`).join(`,
|
|
@@ -31,28 +31,28 @@ ${Q(t.map(([n,o])=>`${q(n)}: ${ur(o)}`).join(`,
|
|
|
31
31
|
}`}function Gt(e){const{x:t,y:r,z:n}=e?.offset||{};let o=!!n,a=e?.origin;!a&&(t||r||n)&&(a="top");let s="";if(a&&(s+=(()=>{switch(a){case"top":return o=!1,`.top(${n?`z=${n}`:""})`;case"bottom":return o=!1,`.bottom(${n?`z=${n}`:""})`;case"center":return".center()";case"meniscus":return o=!1,`.meniscus(${n?`z=${n}`:""})`;default:return""}})()),t||r||o){const i=[...t?[`x=${t}`]:[],...r?[`y=${r}`]:[],...o?[`z=${n}`]:[]];s+=`.move(types.Point(${i.join(", ")}))`}return s}function Ba(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}const ey=(e,t)=>[`duration_s=${Je(e)}`,...t!=null?[`vent_after=${Je(t)}`]:[]],Wc=(e,t,r)=>{const{percentPower:n,duration:o,ventAfter:a}=e,{runtimeParameters:s}=t,i=O(e.moduleId,s),l=D(n,s),u=o==null?void 0:D(o,s),p=a==null?void 0:je(a,s),d=[e.moduleId,n,o,a],f=[i,l,u,p],m=d.flatMap((E,v)=>typeof E=="string"&&f[v]===null?[C({parameterName:E})]:[]);if(m.length>0||i==null||l==null||u===null||p===null)return{errors:m};const h=t.moduleEntities[i],_=pt(r,i);if(_==null||h==null)return{errors:[de()]};if(Gn(_))return{errors:[Mo()]};const I=o!=null,b=I?`${h.pythonName}_task_${_.numPumpActivitiesStarted+1}`:null,w=I?{duration:u,ventAfter:p,taskId:b}:null,S=`percent_power=${Je(n)}`,L=I?ey(o,a):[],g=[S,...L],A=`${I?`${b} = `:""}${h.pythonName}.start_set_vacuum_power(
|
|
32
32
|
${Q(g.join(`,
|
|
33
33
|
`))}
|
|
34
|
-
)`;return{commands:[{commandType:"vacuumModule/startSetVacuumPower",key
|
|
34
|
+
)`;return{commands:[{commandType:"vacuumModule/startSetVacuumPower",key:$(),params:{moduleId:i,percentPower:l,...w??{}}}],python:A}},Gc=(e,t,r)=>{const{gaugePressure:n,duration:o,ventAfter:a}=e,{runtimeParameters:s}=t,i=O(e.moduleId,s),l=D(n,s),u=o==null?void 0:D(o,s),p=a==null?void 0:je(a,s),d=[e.moduleId,n,o,a],f=[i,l,u,p],m=d.flatMap((E,v)=>typeof E=="string"&&f[v]===null?[C({parameterName:E})]:[]);if(m.length>0||i==null||l==null||u===null||p===null)return{errors:m};const h=t.moduleEntities[i],_=pt(r,i);if(_==null||h==null)return{errors:[de()]};if(Gn(_))return{errors:[Mo()]};const I=o!=null,b=I?`${h.pythonName}_task_${_.numPumpActivitiesStarted+1}`:null,w=I?{duration:u,ventAfter:p,taskId:b}:null,S=`gauge_pressure_mbar=${Je(n)}`,L=I?ey(o,a):[],g=[S,...L],A=`${I?`${b} = `:""}${h.pythonName}.start_set_vacuum_pressure(
|
|
35
35
|
${Q(g.join(`,
|
|
36
36
|
`))}
|
|
37
|
-
)`;return{commands:[{commandType:"vacuumModule/startSetVacuumPressure",key
|
|
37
|
+
)`;return{commands:[{commandType:"vacuumModule/startSetVacuumPressure",key:$(),params:{moduleId:i,gaugePressure:l,...w??{}}}],python:A}},Dw=e=>{const{steps:t,repetitions:r}=e;return Array.from({length:r}).flatMap(()=>t)},Mw=e=>e.reduce((t,r)=>{if("repetitions"in r){const n=Dw(r);return[...t,...n]}return[...t,r]},[]),pa=e=>{const{holdSeconds:t,ventAfter:r}=e,n={enable_pump:!0,hold_time_seconds:t,...r!=null?{vent_after:r}:{}};if("gaugePressureMbar"in e){const{gaugePressureMbar:a}=e;return zr({gauge_pressure_mbar:a,...n,vent_after:r})}const{percentPower:o}=e;return zr({percent_power:Number(o),...n})},Fw=e=>{let t,r;if(e.length===1&&"repetitions"in e[0]){const{steps:o,repetitions:a}=e[0];return t=`steps=[
|
|
38
38
|
${Q(o.map((s,i)=>(i===o.length-1,pa(s))).join(`,
|
|
39
39
|
`))}
|
|
40
40
|
]`,r=`repetitions=${ur(a)}`,[t,r]}const n=Mw(e);return t=`steps=[
|
|
41
41
|
${Q(n.map((o,a)=>(a===n.length-1,pa(o))).join(`,
|
|
42
42
|
`))}
|
|
43
|
-
]`,r=`repetitions=${ur(1)}`,[t,r]},So=(e,t,r)=>{const n=D(e,t);return typeof e=="string"&&n==null&&r.push(C({parameterName:e})),n},ty=(e,t,r)=>{const n=je(e,t);return typeof e=="string"&&n==null&&r.push(C({parameterName:e})),n},da=(e,t,r)=>e===void 0?void 0:So(e,t,r),ry=(e,t,r)=>e===void 0?void 0:ty(e,t,r),lm=(e,t,r)=>{const n=So(e.holdSeconds,t,r),o=ty(e.enablePump,t,r),a=da(e.holdTimeSeconds,t,r),s=da(e.holdTimeMinutes,t,r),i=da(e.rampRate,t,r),l=da(e.timeoutSeconds,t,r),u=ry(e.ventAfter,t,r);if(n==null||o==null||a===null||s===null||i===null||l===null||u===null)return null;const p={holdSeconds:n,enablePump:o,...a!==void 0?{holdTimeSeconds:a}:{},...s!==void 0?{holdTimeMinutes:s}:{},...i!==void 0?{rampRate:i}:{},...l!==void 0?{timeoutSeconds:l}:{},...u!==void 0?{ventAfter:u}:{}};if("gaugePressureMbar"in e){const f=So(e.gaugePressureMbar,t,r);return f==null?null:{...p,gaugePressureMbar:f}}const d=So(e.percentPower,t,r);return d==null?null:{...p,percentPower:d}}
|
|
43
|
+
]`,r=`repetitions=${ur(1)}`,[t,r]},So=(e,t,r)=>{const n=D(e,t);return typeof e=="string"&&n==null&&r.push(C({parameterName:e})),n},ty=(e,t,r)=>{const n=je(e,t);return typeof e=="string"&&n==null&&r.push(C({parameterName:e})),n},da=(e,t,r)=>e===void 0?void 0:So(e,t,r),ry=(e,t,r)=>e===void 0?void 0:ty(e,t,r),lm=(e,t,r)=>{const n=So(e.holdSeconds,t,r),o=ty(e.enablePump,t,r),a=da(e.holdTimeSeconds,t,r),s=da(e.holdTimeMinutes,t,r),i=da(e.rampRate,t,r),l=da(e.timeoutSeconds,t,r),u=ry(e.ventAfter,t,r);if(n==null||o==null||a===null||s===null||i===null||l===null||u===null)return null;const p={holdSeconds:n,enablePump:o,...a!==void 0?{holdTimeSeconds:a}:{},...s!==void 0?{holdTimeMinutes:s}:{},...i!==void 0?{rampRate:i}:{},...l!==void 0?{timeoutSeconds:l}:{},...u!==void 0?{ventAfter:u}:{}};if("gaugePressureMbar"in e){const f=So(e.gaugePressureMbar,t,r);return f==null?null:{...p,gaugePressureMbar:f}}const d=So(e.percentPower,t,r);return d==null?null:{...p,percentPower:d}},$w=(e,t,r)=>{const n=[];for(const o of e){if("repetitions"in o){const s=So(o.repetitions,t,r),i=ry(o.ventAfter,t,r),l=[];for(const p of o.steps){const d=lm(p,t,r);if(d==null)return null;l.push(d)}if(s==null||i===null)return null;const u={repetitions:s,steps:l,...i!==void 0?{ventAfter:i}:{}};n.push(u);continue}const a=lm(o,t,r);if(a==null)return null;n.push(a)}return n},Yc=(e,t,r)=>{const{profile:n,ventAfter:o}=e,{runtimeParameters:a}=t,s=O(e.moduleId,a),i=je(o,a),l=[e.moduleId,o],u=[s,i],p=l.flatMap((S,L)=>typeof S=="string"&&u[L]===null?[C({parameterName:S})]:[]),d=$w(n,a,p);if(p.length>0||s==null||i==null||d==null)return{errors:p};const f=pt(r,s);if(f===null)return{errors:[de()]};if(Gn(f))return{errors:[Mo()]};const h=t.moduleEntities[s].pythonName,_=`${h}_task_${f.numPumpActivitiesStarted+1}`,y=Fw(d),I=`vent_after=${Je(o)}`,b=d.map((S,L)=>L===d.length-1?{...S,ventAfter:i}:S),w=`${_} = ${h}.start_execute_profile(
|
|
44
44
|
${Q([...y,I].join(`,
|
|
45
45
|
`))}
|
|
46
|
-
)`;return{commands:[{commandType:"vacuumModule/startRunProfile",key
|
|
46
|
+
)`;return{commands:[{commandType:"vacuumModule/startRunProfile",key:$(),params:{moduleId:s,steps:b,ventAfter:i,taskId:_}}],python:w}},ny=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[n];if(o==null)return{errors:[de()]};const a=`${o.pythonName}.stop_vacuum_pump()`;return{commands:[{commandType:"vacuumModule/stopVacuum",key:$(),params:{moduleId:n}}],python:a}},Kc=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=D(e.celsius,n),s=[];if(e.moduleId!=null&&o==null&&s.push(C({parameterName:e.moduleId})),typeof e.celsius=="string"&&a==null&&s.push(C({parameterName:e.celsius})),s.length>0||a==null)return{errors:s};const i=o?kt(r,o):null,l=[];if(o===null||!i)return{errors:[de()]};if(i.type!==c.TEMPERATURE_MODULE_TYPE&&i.type!==c.HEATERSHAKER_MODULE_TYPE)return console.error(`expected module to be ${c.TEMPERATURE_MODULE_TYPE} but got ${i.type}`),{errors:[de()]};const u="status"in i&&i.status===gc&&i.targetTemperature!==a,p="status"in i&&i.status===Ec&&i.targetTemperature!==a;if(u||"status"in i&&i.status===Uo||"targetTemp"in i&&i.targetTemp==null)return{errors:[iI()]};p&&l.push(Rw());const d=t.moduleEntities[o],f=d?.type;switch(f){case c.TEMPERATURE_MODULE_TYPE:return{commands:[{commandType:"temperatureModule/waitForTemperature",key:$(),params:{moduleId:o,celsius:a}}],warnings:l.length>0?l:void 0,python:`${d?.pythonName}.await_temperature(${e.celsius})`};case c.HEATERSHAKER_MODULE_TYPE:return{commands:[{commandType:"heaterShaker/waitForTemperature",key:$(),params:{moduleId:o,celsius:a}}],warnings:l.length>0?l:void 0,python:`${d?.pythonName}.wait_for_temperature()`};default:return console.error(`awaitTemperature expected module ${o} to be ${c.TEMPERATURE_MODULE_TYPE} or ${c.HEATERSHAKER_MODULE_TYPE}, got ${f}`),{errors:[de()]}}},Uw=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=O(e.labwareId,n),s=O(e.wellName,n),i=D(e.volume,n),l=D(e.flowRate,n),u=Dn(e.trackFromLocation,n),p=Dn(e.trackToLocation,n),d=[e.pipetteId,e.labwareId,e.wellName,e.volume,e.flowRate],f=[o,a,s,i,l],m=[...d.flatMap((w,S)=>typeof w=="string"&&f[S]==null?[C({parameterName:w})]:[]),...[...u.invalidParameterNames,...p.invalidParameterNames].map(w=>C({parameterName:w}))];if(m.length>0||o==null||a==null||s==null||i==null||l==null||u.location==null||p.location==null)return{errors:m};const h=t.pipetteEntities[o].pythonName,_=t.labwareEntities[a].pythonName,y=n[e.wellName]!=null?e.wellName:q(s),I=`${_}[${y}]`,b=[`volume=${e.volume}`,`location=${I}${Gt({origin:u.location.origin,offset:e.trackFromLocation.offset})}`,`flow_rate=${e.flowRate}`,`end_location=${I}${Gt({origin:p.location.origin,offset:e.trackToLocation.offset})}`];return{commands:[{commandType:"aspirateWhileTracking",key:$(),params:{pipetteId:o,volume:i,flowRate:l,labwareId:a,wellName:s,trackFromLocation:u.location,trackToLocation:p.location}}],python:`${h}.aspirate(
|
|
47
47
|
${Q(b.join(`,
|
|
48
48
|
`))},
|
|
49
|
-
)`}},qw=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=O(e.labwareId,n),s=O(e.wellName,n),i=D(e.volume,n),l=D(e.flowRate,n),u=e.pushOut==null?void 0:D(e.pushOut,n),p=Dn(e.trackFromLocation,n),d=Dn(e.trackToLocation,n),f=[e.pipetteId,e.labwareId,e.wellName,e.volume,e.flowRate,e.pushOut],m=[o,a,s,i,l,u],h=[...f.flatMap((S,L)=>typeof S=="string"&&m[L]==null?[C({parameterName:S})]:[]),...[...p.invalidParameterNames,...d.invalidParameterNames].map(S=>C({parameterName:S}))];if(h.length>0||o==null||a==null||s==null||i==null||l==null||p.location==null||d.location==null)return{errors:h};const _=t.pipetteEntities[o].pythonName,y=t.labwareEntities[a].pythonName,I=n[e.wellName]!=null?e.wellName:q(s),b=`${y}[${I}]`,w=[`volume=${e.volume}`,`location=${b}${Gt({origin:p.location.origin,offset:e.trackFromLocation.offset})}`,`flow_rate=${e.flowRate}`,`end_location=${b}${Gt({origin:d.location.origin,offset:e.trackToLocation.offset})}`,...e.pushOut!=null?[`push_out=${e.pushOut}`]:[]];return{commands:[{commandType:"dispenseWhileTracking",key
|
|
49
|
+
)`}},qw=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=O(e.labwareId,n),s=O(e.wellName,n),i=D(e.volume,n),l=D(e.flowRate,n),u=e.pushOut==null?void 0:D(e.pushOut,n),p=Dn(e.trackFromLocation,n),d=Dn(e.trackToLocation,n),f=[e.pipetteId,e.labwareId,e.wellName,e.volume,e.flowRate,e.pushOut],m=[o,a,s,i,l,u],h=[...f.flatMap((S,L)=>typeof S=="string"&&m[L]==null?[C({parameterName:S})]:[]),...[...p.invalidParameterNames,...d.invalidParameterNames].map(S=>C({parameterName:S}))];if(h.length>0||o==null||a==null||s==null||i==null||l==null||p.location==null||d.location==null)return{errors:h};const _=t.pipetteEntities[o].pythonName,y=t.labwareEntities[a].pythonName,I=n[e.wellName]!=null?e.wellName:q(s),b=`${y}[${I}]`,w=[`volume=${e.volume}`,`location=${b}${Gt({origin:p.location.origin,offset:e.trackFromLocation.offset})}`,`flow_rate=${e.flowRate}`,`end_location=${b}${Gt({origin:d.location.origin,offset:e.trackToLocation.offset})}`,...e.pushOut!=null?[`push_out=${e.pushOut}`]:[]];return{commands:[{commandType:"dispenseWhileTracking",key:$(),params:{pipetteId:o,volume:i,flowRate:l,labwareId:a,wellName:s,trackFromLocation:p.location,trackToLocation:d.location,...u!=null?{pushOut:u}:{}}}],python:`${_}.dispense(
|
|
50
50
|
${Q(w.join(`,
|
|
51
51
|
`))},
|
|
52
|
-
)`}},Vw=(e,t,r)=>{const{axes:n,skipIfMountPositionOk:o}=e,a=t.runtimeParameters??{},s=n?.map(m=>O(m,a)),i=o==null?void 0:O(o,a),l=[];if(n?.forEach((m,h)=>{s?.[h]==null&&l.push(C({parameterName:m}))}),o!=null&&i==null&&l.push(C({parameterName:o})),l.length>0)return{errors:l};const u={commandType:"home",key
|
|
52
|
+
)`}},Vw=(e,t,r)=>{const{axes:n,skipIfMountPositionOk:o}=e,a=t.runtimeParameters??{},s=n?.map(m=>O(m,a)),i=o==null?void 0:O(o,a),l=[];if(n?.forEach((m,h)=>{s?.[h]==null&&l.push(C({parameterName:m}))}),o!=null&&i==null&&l.push(C({parameterName:o})),l.length>0)return{errors:l};const u={commandType:"home",key:$(),params:{axes:s?.filter(m=>m!=null),skipIfMountPositionOk:i}},p=n==null?void 0:`[${n.map((m,h)=>Nt(m,s?.[h]??m,a)).join(", ")}]`,d=[...p!=null?[`axes=${p},
|
|
53
53
|
`]:[],...o!=null&&i!=null?[`skipIfMountPositionOk=${Nt(o,i,a)},
|
|
54
|
-
`]:[]],f=`${ge}.home(${d.join(", ")})`;return{commands:[u],python:f}},Bw=(e,t,r)=>{const{pipetteEntities:n,runtimeParameters:o}=t,a=O(e.pipetteId,o),s=O(e.axis,o),i=D(e.distance,o),l=[];if(a==null&&l.push(C({parameterName:e.pipetteId})),s==null&&l.push(C({parameterName:e.axis})),typeof e.distance=="string"&&i==null&&l.push(C({parameterName:e.distance})),l.length>0||a==null||s==null||i==null)return{errors:l};const u=n[a].pythonName,p=o[e.axis]!=null?e.axis:q(s),d=[{commandType:"moveRelative",key:U(),params:{pipetteId:a,axis:s,distance:i}}],f=[`axis=${p}`,`distance=${e.distance}`];return{commands:d,python:`${u}.move_axes_relative(${f.join(", ")})`}},xw=(e,t,r)=>{const{pipetteEntities:n,runtimeParameters:o}=t,{coordinates:a}=e,s=O(e.pipetteId,o),i=D(a.x,o),l=D(a.y,o),u=D(a.z,o),p=e.minimumZHeight==null?void 0:D(e.minimumZHeight,o),d=e.forceDirect==null?void 0:je(e.forceDirect,o),f=[];if(s==null&&f.push(C({parameterName:e.pipetteId})),typeof a.x=="string"&&i==null&&f.push(C({parameterName:a.x})),typeof a.y=="string"&&l==null&&f.push(C({parameterName:a.y})),typeof a.z=="string"&&u==null&&f.push(C({parameterName:a.z})),typeof e.minimumZHeight=="string"&&p==null&&f.push(C({parameterName:e.minimumZHeight})),typeof e.forceDirect=="string"&&d==null&&f.push(C({parameterName:e.forceDirect})),f.length>0||s==null||i==null||l==null||u==null)return{errors:f};const m=n[s].pythonName,h=[`coordinates=(${a.x}, ${a.y}, ${a.z})`];return typeof e.forceDirect=="string"?h.push(`force_direct=${e.forceDirect}`):e.forceDirect&&h.push("force_direct=True"),e.minimumZHeight&&h.push(`minimum_z_height=${e.minimumZHeight}`),{commands:[{commandType:"moveToCoordinates",key:U(),params:{pipetteId:s,coordinates:{x:i,y:l,z:u},minimumZHeight:p??void 0,forceDirect:d??void 0}}],python:`${m}.move_axes_to(${h.join(", ")})`}},zw=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=O(e.labwareId,n),s=O(e.wellName,n),i=e.wellLocation?.origin,l=i==null?void 0:O(i,n),u=e.wellLocation?.offset,p=u?.x==null?void 0:D(u.x,n),d=u?.y==null?void 0:D(u.y,n),f=u?.z==null?void 0:D(u.z,n),m=[];for(const[b,w]of[[e.pipetteId,o],[e.labwareId,a],[e.wellName,s]])w==null&&m.push(C({parameterName:b}));i!=null&&l==null&&m.push(C({parameterName:i}));for(const[b,w]of[[u?.x,p],[u?.y,d],[u?.z,f]])typeof b=="string"&&w==null&&m.push(C({parameterName:b}));if(m.length>0||o==null||a==null||s==null)return{errors:m};const h=t.pipetteEntities[o].pythonName,_=t.labwareEntities[a].pythonName;let y;e.wellLocation!=null&&(y={},l!=null&&(y.origin=l),u!=null&&(y.offset={},p!=null&&(y.offset.x=p),d!=null&&(y.offset.y=d),f!=null&&(y.offset.z=f)));const I=n[e.wellName]!=null?e.wellName:q(s);return{commands:[{commandType:"tryLiquidProbe",key:U(),params:{pipetteId:o,labwareId:a,wellName:s,wellLocation:y}}],python:`${h}.detect_liquid_presence(${_}[${I}])`}},oy=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[o].pythonName;return{commands:[{commandType:"heaterShaker/closeLabwareLatch",key:U(),params:{moduleId:o}}],python:`${a}.close_labware_latch()`}},ic=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[o].pythonName;return{commands:[{commandType:"heaterShaker/deactivateHeater",key:U(),params:{moduleId:o}}],python:`${a}.deactivate_heater()`}},Hw=["1","4","7","10"],ay=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:o,moduleEntities:a,runtimeParameters:s}=t,i=O(e.moduleId,s);if(i==null)return{errors:[C({parameterName:e.moduleId})]};const l=r.modules[i].slot,u=Object.keys(n)[0],p=n[u]?.spec;if(!((p?.displayCategory==="FLEX"||p?.channels===96)??!1)&&sb(r.labware,o,l)){const m=Hw.includes(l)?"right":"left";return{errors:[_I(m)]}}const f=a[i].pythonName;return{commands:[{commandType:"heaterShaker/openLabwareLatch",key:U(),params:{moduleId:i}}],python:`${f}.open_labware_latch()`}},sy=(e,t,r)=>{const{moduleEntities:n,runtimeParameters:o}=t,a=O(e.moduleId,o),s=D(e.rpm,o),i=[];if(a==null&&i.push(C({parameterName:e.moduleId})),typeof e.rpm=="string"&&s==null&&i.push(C({parameterName:e.rpm})),i.length>0||a==null||s==null)return{errors:i};if(n[a]?.type!==c.HEATERSHAKER_MODULE_TYPE)throw new Error(`expected module ${a} to be heaterShaker, got ${n[a]?.type}`);const l=n[a].pythonName;return{commands:[{commandType:"heaterShaker/setAndWaitForShakeSpeed",key:U(),params:{moduleId:a,rpm:s}}],python:`${l}.set_and_wait_for_shake_speed(${e.rpm})`}},lc=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[o].pythonName;return{commands:[{commandType:"heaterShaker/deactivateShaker",key:U(),params:{moduleId:o}}],python:`${a}.deactivate_shaker()`}},Zc=(e,t,r)=>{const{moduleEntities:n,labwareEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a);if(s==null)return{errors:[C({parameterName:e.moduleId})]};const i=[],l=n[s].pythonName,p=Object.values(r.labware).filter(m=>m.stack.includes(s)).find(m=>m.stack.find(h=>o[h]?.def.allowedRoles?.includes("lid")&&o[h]?.def.parameters.loadName!=="opentrons_tough_pcr_auto_sealing_lid")),d=p!=null?xa(p.stack):null,f=d!=null?o[d].def.metadata.displayName:null;return f!=null&&i.push(AI({lidDisplayName:f})),i.length>0?{errors:i}:{commands:[{commandType:"thermocycler/closeLid",key:U(),params:{moduleId:s}}],python:`${l}.close_lid()`}},iy=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/deactivateBlock",key:U(),params:{moduleId:n}}],python:`${o}.deactivate_block()`}},ly=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/deactivateLid",key:U(),params:{moduleId:n}}],python:`${o}.deactivate_lid()`}},uy=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/openLid",key:U(),params:{moduleId:n}}],python:`${o}.open_lid()`}},cy=(e,t,r)=>{e.celsius!==void 0&&console.warn("'volume' param not implemented for thermocycler/setTargetBlockTemperature, should not be set!");const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=D(e.celsius,n),s=[];if(o==null&&s.push(C({parameterName:e.moduleId})),typeof e.celsius=="string"&&a==null&&s.push(C({parameterName:e.celsius})),o==null||a==null)return{errors:s};const i=t.moduleEntities[o].pythonName;return{commands:[{commandType:"thermocycler/setTargetBlockTemperature",key:U(),params:{moduleId:o,celsius:a}}],python:`${i}.set_block_temperature(${e.celsius})`}},Xc=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=D(e.celsius,n),s=[];if(o==null&&s.push(C({parameterName:e.moduleId})),typeof e.celsius=="string"&&a==null&&s.push(C({parameterName:e.celsius})),o==null||a==null)return{errors:s};const i=t.moduleEntities[o].pythonName;return{commands:[{commandType:"thermocycler/setTargetLidTemperature",key:U(),params:{moduleId:o,celsius:a}}],python:`${i}.set_lid_temperature(${e.celsius})`}};function P(e,t){return(r,n)=>e(t,r,n)}function N(e,t){return(r,n)=>{const o=e(t,r,n);if("python"in o){const{python:a,...s}=o;return s}return o}}const Ke="__air__",Xr="source_well",zn="dest_well";function py(e){return u_.includes(e.parameters.loadName)}function Eo(e){return(e.parameters.quirks??[]).includes("vacuumSpacer")}function dy(e){return(e.parameters.quirks??[]).includes("vacuumSpacerSeat")}const fy=(e,t)=>e.filter(r=>r in t&&Eo(t[r].def)).map(r=>t[r].def.parameters.loadName),my=(e,t,r)=>{if(!Eo(e))return{isCompatible:!1,isAboveStackLimit:!1};if(t.length===0)return{isCompatible:!0,isAboveStackLimit:!1};const n=fy(t,r),o=xa(t);if(!(o in r))return{isCompatible:!0,isAboveStackLimit:!1};const a=r[o].def;if(!Eo(a)||dy(a))return{isCompatible:!1,isAboveStackLimit:!1};const s=e.parameters.loadName,i=a.parameters.loadName,l=n.includes(s),u=n.length>=c_,p=e.compatibleParentLabware?.includes(i)??!1,d=i in(e.stackingOffsetWithLabware??{}),f=p||d,m=l||u;return{isCompatible:f&&!m,isAboveStackLimit:m}},jw=e=>(e.parameters.quirks??[]).includes("vacuumModuleDock"),hy=(e,t,r)=>{const a=c.getDeckDefFromRobotType(r).cutoutFixtures.find(l=>l.id.includes(t))?.providesAddressableAreas,i=(l=>{if(a!=null){for(const u in a)if(a[u].includes(l))return u}return null})(e);if(i==null)throw Error(`expected to find cutoutId from addressableAreaName ${e} but could not`);return i};function _y(e){switch(e){case 1:return c.ONE_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA;case 8:return c.EIGHT_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA;case 96:return c.NINETY_SIX_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA}}function Qc(e){const t=c.getDeckDefFromRobotType(e==="cutout12"?c.OT2_ROBOT_TYPE:c.FLEX_ROBOT_TYPE);let r=null;return t.robot.model===c.FLEX_ROBOT_TYPE&&(r=t.cutoutFixtures.find(n=>n.id==="trashBinAdapter")?.providesAddressableAreas??null),t.robot.model===c.FLEX_ROBOT_TYPE&&r==null&&console.error(`expected to find a list of cutouts for the Flex but could not with trashLocation ${e}`),r!=null?r[e]?.[0]:"fixedTrash"}function yy(e){if(e==="fixedTrash")return"cutout12";const r=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE).cutoutFixtures.find(n=>n.id==="trashBinAdapter")?.providesAddressableAreas??null;if(r==null)return console.error("Could not find trashBinAdapter cutouts for Flex"),null;for(const[n,o]of Object.entries(r))if(o.includes(e))return n;return console.error(`Could not find trashLocation for addressableAreaName ${e}`),null}function Hn(e,t,r,n){return e[n]!=null?"labware":t[n]!=null?"wasteChute":r[n]!=null?"trashBin":(console.error(`expected to determine if dest labware is a labware or waste chute with destLabware ${n} but could not`),null)}function by(e,t){return Nn(An(t),r=>e)}function wr(e){return mt(e,(t,r,n)=>n===Ke?t:t+r.volume,0)}function sr(e,t){const r=wr(t);if(r===0)return{source:t,dest:{[Ke]:{volume:e}}};if(e>r)return{source:lr(t,()=>({volume:0})),dest:{...t,[Ke]:{volume:e-r}}};const n=mt(t,(o,a,s)=>({...o,[s]:a.volume/r}),{});return Object.keys(t).reduce((o,a)=>{const s=n[a]*e;return{source:{...o.source,[a]:{volume:t[a].volume-s}},dest:{...o.dest,[a]:{volume:s}}}},{source:{},dest:{}})}function Sr(e,t){return{...t,...mt(e,(r,n,o)=>{const s=o in t?n.volume+t[o].volume:n.volume;return{...r,[o]:{volume:s}}},{})}}function Jc(e,t,r){const n=e===1?[r]:c.getWellNamePerMultiTip(t,r,e);if(!n)return console.warn(e===1?`Invalid well: ${r}`:`For labware def (URI ${c.getLabwareDefURI(t)}), with primary well ${r}, no wells are accessible by 8-channel's 1st tip`),{wellsForTips:[],allWellsShared:!1};const o=n.every(a=>a&&a===n[0]);return{wellsForTips:n,allWellsShared:o}}const Iy=e=>{const{pipette:t,sourceLabwareId:r,sourceWell:n,destLabwareId:o,destWell:a,blowoutLocation:s,flowRate:i,offsetFromTopMm:l,invariantContext:u}=e;if(!s)return[];const{trashBinEntities:p,wasteChuteEntities:d}=u;let f=null,m=null;return s===Xr?(f=r,m=n):s===zn&&(f=o,m=a),m!=null&&f!=null?[P(xc,{pipetteId:t,labwareId:f,wellName:m,flowRate:i,wellLocation:{origin:"top",offset:{z:l}}})]:d[s]!=null?[P(Db,{pipetteId:t,flowRate:i,wasteChuteId:Object.keys(d)[0]})]:[P(Cb,{pipetteId:t,trashId:Object.keys(p)[0],flowRate:i})]};function Ty(e){const{labwareEntities:t,pipetteEntities:r,wasteChuteEntities:n,trashBinEntities:o}=e;return{pipettes:mt(r,(a,s,i)=>{const l=s.spec;return{...a,[i]:wy(l.channels,{})}},{}),labware:mt(t,(a,s,i)=>({...a,[i]:lr(s.def.wells,()=>({}))}),{}),trashBins:mt(o,(a,s,i)=>({...a,[i]:{}}),{}),wasteChute:mt(n,(a,s,i)=>({...a,[i]:{}}),{})}}function wy(e,t){return An(e).reduce((r,n)=>({...r,[n]:t}),{})}const Sy=e=>{const{blowoutLocation:t,sourceLabware:r,destLabware:n,sourceWell:o,destWell:a}=e;return t===Xr&&r!=null&&o!=null?{dispenseAirGapLabware:r,dispenseAirGapWell:o}:{dispenseAirGapLabware:n,dispenseAirGapWell:a}};function ep(e){const{invariantContext:t,labwareLocations:r,moduleLocations:n={},pipetteLocations:o}=e;return{labware:r,modules:n,pipettes:o,liquidState:Ty(t),tipState:{pipettes:mt(o,(a,s,i)=>s.mount?{...a,[i]:{hasTip:!1,tiprackURI:null}}:a,{}),tipracks:mt(r,(a,s,i)=>{const l=t.labwareEntities[i].def;if(!c.getIsTiprack(l))return a;const u=lr(l.wells,()=>qo);return{...a,[i]:u}},{})}}}const gy=(e,t)=>e.tipracks[t]!=null?Object.values(e.tipracks[t]).some(r=>r!==_e):!1,Ey=(e,t)=>e.labware[t]!=null?Object.values(e.labware[t]).some(r=>Object.values(r).some(n=>n.volume>0)):!1,Ww=(e,t,r)=>{const{destinationId:n,pipetteId:o,volume:a,flowRate:s,offsetFromBottomMm:i,well:l,xOffset:u,yOffset:p,tipRack:d,primaryNozzle:f,nozzles:m}=e,{labwareEntities:h,trashBinEntities:_,wasteChuteEntities:y}=t,I=Hn(h,y,_,n);let b=[];return I==="labware"&&i!=null&&l!=null?b=[P(zc,{pipetteId:o,volume:a,labwareId:n,wellName:l,flowRate:s,wellLocation:{origin:"bottom",offset:{z:i,x:u,y:p}},tipRack:d,primaryNozzle:f,nozzles:m})]:I==="wasteChute"?b=[P($A,{pipetteId:o,volume:a,flowRate:s,wasteChuteId:y[n].id})]:b=[P(UA,{pipetteId:o,volume:a,flowRate:s,trashId:_[n].id})],pe(b,t,r)},Gw=(e,t,r)=>{const{destinationId:n,pipetteId:o,zOffset:a,well:s}=e,{labwareEntities:i,wasteChuteEntities:l,trashBinEntities:u}=t,p=Hn(i,l,u,n);let d=[];return p==="labware"&&s!=null?d=[P(H,{pipetteId:o,labwareId:n,wellName:s,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:a}}})]:p==="wasteChute"?d=[P(qe,{pipetteId:o,fixtureId:l[n].id,offset:{x:0,y:0,z:0}})]:d=[P(qe,{pipetteId:o,fixtureId:u[n].id,offset:vt})],pe(d,t,r)},Yw=(e,t,r)=>{const{blowOutLocation:n,destinationId:o,destWell:a,flowRate:s,pipetteId:i,sourceId:l,sourceWell:u,volume:p}=e,{labwareEntities:d,trashBinEntities:f,wasteChuteEntities:m}=t,h=Hn(d,m,f,o);let _=[];if(h==="labware"&&a!=null){const{dispenseAirGapLabware:y,dispenseAirGapWell:I}=Sy({blowoutLocation:n,sourceLabware:l,destLabware:o,sourceWell:u,destWell:a});_=[P(kA,{flowRate:s,pipetteId:i,labwareId:y,wellName:I,volume:p,type:"dispense"})]}else h==="wasteChute"?_=[P(NA,{pipetteId:i,volume:p,flowRate:s,wasteChuteId:m[o].id})]:_=[P(RA,{pipetteId:i,volume:p,flowRate:s,trashId:f[o].id})];return pe(_,t,r)},Kw=(e,t,r)=>{const{pipetteId:n,destinationId:o,well:a,zOffset:s,seconds:i}=e,{labwareEntities:l,trashBinEntities:u,wasteChuteEntities:p}=t,d=Hn(l,p,u,o);let f=[];return a!=null&&d==="labware"?f=[P(H,{pipetteId:n,labwareId:o,wellName:a,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:s}}}),P(Ie,{seconds:i})]:d==="wasteChute"?f=[P(qe,{pipetteId:n,fixtureId:o,offset:vt}),P(Ie,{seconds:i})]:f=[P(qe,{pipetteId:n,fixtureId:o,offset:vt}),P(Ie,{seconds:i})],pe(f,t,r)},ee=(e,t=!1)=>{if(e==null)return console.error("expected to find stack but could not"),"unknown slot";{const r=e[e.length-1];return t?`STACKER ${r.slice(-2,-1)}`:r}},Zw=e=>e===c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA?p_:e,xa=e=>e==null?(console.error("expected to find stack but could not"),"unknown top location"):e[0],Ay=e=>e.length>=2?e[1]:null,go=e=>{const{slot:t,labwareState:r,modulesState:n}=e,o=Object.values(n).find(({slot:a,moduleState:s})=>a===t&&s.type===c.FLEX_STACKER_MODULE_TYPE);if(o!=null){const a=o.moduleState.labwareOnShuttle;return a==null?[]:[a.lidLabwareId,a.primaryLabwareId,a.adapterLabwareId].filter(i=>i!=null)}return Object.values(r).reduce((a,{stack:s})=>(s[s.length-1]===t&&s.length>a.length&&(a=s),a),[])},tp=e=>c.FLEX_SINGLE_SLOT_BY_CUTOUT_ID[c.FLEX_CUTOUT_BY_SLOT_ID[e]],Ly=e=>{const t=c.FLEX_STACKER_ADDRESSABLE_AREAS.indexOf(e);return t===-1?null:De[t]},Xw=e=>{const t=Ly(e);return t!=null?tp(t):null},Oy=(e,t,r)=>{if(e==null)return null;if(De.includes(e)){const n=tp(e);return Object.entries(t).some(([a,s])=>r[a]?.type===c.FLEX_STACKER_MODULE_TYPE&&s.slot===n)?n:e}return e},za=e=>{const t=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE),r=`${e[0]}3`,n=c.FLEX_CUTOUT_BY_SLOT_ID[r],o=t.cutoutFixtures.find(({id:a})=>a===c.FLEX_STACKER_V1_FIXTURE)?.providesAddressableAreas[n];return c.FLEX_STACKER_ADDRESSABLE_AREAS.find(a=>o?.includes(a))??null},vy=(e,t,r,n)=>{if(t.length===0)return{isCompatible:!0,isAboveStackLimit:!1};let o=!1;const a=t.find(u=>u in n);a!=null&&(o=n[a].type===c.FLEX_STACKER_MODULE_TYPE&&t.includes(rt));const s=xa(t);let i=!0,l=!1;if(s in r){const u=r[e],p=r[s],d=t.filter(R=>r[R]!=null),f=d.filter(R=>r[R]?.def?.allowedRoles?.includes("lid"))[0],m=d.filter(R=>r[R]?.def?.allowedRoles?.includes("adapter"))[0],h=p.def.parameters.loadName,_=d.filter(R=>!r[R]?.def?.allowedRoles?.includes("adapter")&&!r[R]?.def?.allowedRoles?.includes("lid"))[0];if(o){const R=c.getMaxPoolCount({labwareDefinitions:{primary:r[_]?.def??null,adapter:r[m]?.def??null,lid:r[f]?.def??null},model:c.FLEX_STACKER_MODULE_V1});l=t.length>R}else{const R=p.def.stackLimit??1,M=h===u.def.parameters.loadName,F=t.filter(G=>r[G]?.def.parameters.loadName===h)?.length;l=M&&F>=R}const y=u.def.parameters.loadName==="opentrons_tough_universal_lid",I=p.def.metadata.displayCategory==="tubeRack",b=p.def.metadata.displayCategory==="aluminumBlock",w=p.def.parameters.isTiprack,L=(p.def.allowedRoles??[]).includes("lid"),g=py(p.def),T=t.some(R=>R in r&&jw(r[R].def)),A=u.def.parameters.quirks?.includes("vacuumModuleDock")??!1,v=Eo(u.def)?my(u.def,t,r):null;if(v!=null)l=v.isAboveStackLimit,i=v.isCompatible;else{const R=u.def,M=p.def,F=R.parameters.quirks?.includes("filterPlate")??!1,G=M.parameters.quirks?.includes("filterPlate")??!1,Y=M.parameters.quirks?.includes("providesStackingDefault")??!1,oe=F&&!L&&!w&&!G,fe=!T&&A,J=Y&&!g,Re=R.compatibleParentLabware?.includes(h)??!1,Ve=h in(R.stackingOffsetWithLabware??{}),Me=M.parameters.loadName==="opentrons_tough_universal_lid";i=oe||fe||J||Re||Ve||y&&!I&&!b&&!w&&(Me||!L)}}else if(s in n){const u=n[s],{model:p}=u;i=Object.keys(r[e].def.stackingOffsetWithModule??{}).some(d=>p===d)}return{isCompatible:i,isAboveStackLimit:l}},Go=(e,t)=>t?.find(r=>e[r]!=null)??null,Qw=(e,t,r)=>t?e:r?i_[e]:e,Ha=(e,t,r)=>{if(t==="offDeck"&&r==null)return console.error("offDeck slot is not allowed to be used without an offDeckOverrideId"),[];const n=Ao(t),o=Py(t),a=Qw(t,n,o),s=Object.values(e).filter(i=>i.stack.includes(a)&&(r==null||i.stack.includes(r))&&i.stack.includes(rt)===o&&i.stack.includes(Ac)===n);return s.length===0?[]:o?s.at(-1)?.stack??[]:n?s.at(-1)?.stack??[]:s.toSorted((i,l)=>l.stack.length-i.stack.length)[0]?.stack??[]},Jw=(e,t)=>Object.values(t).filter(r=>r.stack.includes(e)).sort((r,n)=>n.stack.length-r.stack.length)[0]?.stack[0],bo=(e,t,r,n=!0)=>{const o=c.linearInterpolate(e,t)??0,a=c.linearInterpolate(e,r)??0;return e+(n?o:0)+a},rp=e=>{const{path:t,volume:r,pipetteSpecs:n,tiprackDefinition:o,conditioningByVolume:a,disposalByVolume:s,numDispenseWells:i,numAspirateWells:l,aspirateAirGapByVolume:u}=e,{liquids:p}=n,f=r<p.default.minVolume&&"lowVolumeDefault"in p?p.lowVolumeDefault.maxVolume:p.default.maxVolume,m=o?.wells.A1.totalLiquidVolume,h=m==null?f:Math.min(f,m),_=r*2,y=a!=null?c.linearInterpolate(_,a)??0:0,b=o?.namespace!=="opentrons"||a!=null&&s!=null&&h>=_+y+(c.linearInterpolate(_,s)??0)+(y===0?c.linearInterpolate(_,u)??0:0),w=h>=_;if(t==="multiAspirate"&&l<=i?console.warn("Invalid combination of source and destination wells for multiAspirate path"):t==="multiDispense"&&l>=i?console.warn("Invalid combination of source and destination wells for multiDispense path"):t==="single"&&l!==i&&console.warn("Invalid combination of source and destination wells for single path"),t==="single"||t==="multiDispense"&&!b||t==="multiAspirate"&&!w){const T=c.linearInterpolate(r,u)??0,A=Math.ceil((r+T)/h),E=r/A;return{referenceVolumes:{airGap:{aspirate:E,dispense:0},correction:{aspirate:E,dispense:E},pushOut:E,flowRate:{aspirate:E,dispense:E}},multiWellHandling:{isSupported:!1}}}if(t==="multiDispense"){let T=0,A=0;for(let E=0;E<i&&!(bo((E+1)*r,a??[],s??[])>h);E++)T=(E+1)*r,A+=1;return{referenceVolumes:{airGap:{aspirate:bo(T,a??[],s??[],!1),dispense:bo((A-1)*r,a??[],s??[],!1)},correction:{aspirate:bo(T,a??[],s??[]),dispense:r},flowRate:{aspirate:bo(T,a??[],s??[]),dispense:r},pushOut:r,conditioning:T,disposal:T},multiWellHandling:{isSupported:!0,numWellsToFitInTip:A}}}const S=Math.floor(h/r),L=Math.min(S,l),g=L*r;return{referenceVolumes:{airGap:{aspirate:g,dispense:0},pushOut:g,correction:{aspirate:g,dispense:g},flowRate:{aspirate:r,dispense:g}},multiWellHandling:{isSupported:!0,numWellsToFitInTip:L}}},Hr=e=>{const{retractZOffset:t,retractPositionReference:r,labwareId:n,labwareEntities:o,well:a}=e;if(a==null)return!1;const s=o[n]?.def.wells[a]?.depth;if(s==null)return!1;const i=c.getMmFromBottom(t,r,s);return i==null?!1:i-s>=c.SAFE_MOVE_TO_WELL_OFFSET_FROM_TOP_MM},uc=e=>e.reduce((t,r)=>{const{kind:n}=r;return n==="onCutoutFixture"?t:n==="onLabware"?[...t,r.labwareId]:n==="onModule"||n==="inStackerHopper"?[...t,r.moduleId]:n==="onAddressableArea"?[...t,r.addressableAreaName]:[...t,r.logicalLocationName]},[]),eS={A4:"cutoutA3",B4:"cutoutB3",C4:"cutoutC3",D4:"cutoutD3"};function cc(e){if(e.location!=="offDeck"&&e.location!=="systemLocation"&&e.location!=="wasteChuteLocation"&&"addressableAreaName"in e.location&&a_.includes(e.location.addressableAreaName)){const t=U(),r=e.location.addressableAreaName,n=eS[r]??r;return{[t]:{id:t,location:n}}}return{}}const Py=e=>s_.includes(e),Ao=e=>e===c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA,np=e=>e.labwareOnShuttle?.primaryLabwareId??null,op=(e,t,r)=>{if(r?.storedLabwareDetails==null)return!0;const n=Object.values(r?.storedLabwareDetails??{}).reduce((a,s)=>s!=null?[...a,s]:a,[]),o=t.labwareEntities[e];return n.some(a=>o?.labwareDefURI===a)},ap=(e,t)=>{const{storedLabwareDetails:r}=e??{};if(r==null)return!0;const{primaryLabwareURI:n,adapterLabwareURI:o,lidLabwareURI:a}=r,s=Object.values(t).find(({labwareDefURI:f})=>f===n),i=Object.values(t).find(({labwareDefURI:f})=>f===o),l=Object.values(t).find(({labwareDefURI:f})=>f===a);if(s==null)return console.error("Primary labware entity not found"),!1;const u=c.getMaxPoolCount({labwareDefinitions:{primary:s.def,adapter:i?.def??null,lid:l?.def??null},model:c.FLEX_STACKER_MODULE_V1}),d=e?.labwareInHopper?.length??0;return u>d},Ry=e=>{const{labwareId:t,labwareRobotState:r,labwareEntities:n}=e;return Object.entries(r).some(([o,{stackedOnNode:a}])=>typeof a=="object"&&"labwareId"in a&&a.labwareId===t&&c.getIsLid(n[o].def))},Ny=e=>![Cn,c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA,...De].some(t=>e===t);function D(e,t){if(typeof e=="number")return e;const r=t[e];return r!=null&&(r.type==="float"||r.type==="int")?r.default:null}function O(e,t){const r=t[e];return r==null?e:r.type==="string"?r.default:null}function je(e,t){if(typeof e=="boolean")return e;const r=t[e];return r!=null&&r.type==="boolean"?r.default:null}function Ht(e,t,r){const n=O(e,r);return n==null||!t.includes(n)?null:n}function Nt(e,t,r){return r[e]!=null?e:q(t)}function Dn(e,t){if(e==null)return{location:void 0,invalidParameterNames:[]};const r=[],n=e.origin==null?void 0:O(e.origin,t);e.origin!=null&&n==null&&r.push(e.origin);const o={};if(e.offset!=null)for(const a of["x","y","z"]){const s=e.offset[a];if(s==null)continue;const i=D(s,t);i==null?r.push(String(s)):o[a]=i}return{location:{...n!=null?{origin:n}:{},...e.offset!=null?{offset:o}:{}},invalidParameterNames:r}}const Yo=(e,t,r)=>{const n=t[r]?.stack,o=Go(e,n),a=o!=null?e[o].moduleState:null;return!!(a&&a.type===c.ABSORBANCE_READER_TYPE&&a.lidOpen!==!0)};var Ml,um;function ky(){if(um)return Ml;um=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Ml=e,Ml}var tS=ky();const sp=Ye(tS);var Cy=Symbol.for("immer-nothing"),cm=Symbol.for("immer-draftable"),ct=Symbol.for("immer-state"),rS=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function et(e,...t){if(process.env.NODE_ENV!=="production"){const r=rS[e],n=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Lo=Object.getPrototypeOf;function Mn(e){return!!e&&!!e[ct]}function jr(e){return e?Dy(e)||Array.isArray(e)||!!e[cm]||!!e.constructor?.[cm]||Ko(e)||Wa(e):!1}var nS=Object.prototype.constructor.toString(),pm=new WeakMap;function Dy(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=pm.get(r);return n===void 0&&(n=Function.toString.call(r),pm.set(r,n)),n===nS}function Ta(e,t,r=!0){ja(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function ja(e){const t=e[ct];return t?t.type_:Array.isArray(e)?1:Ko(e)?2:Wa(e)?3:0}function pc(e,t){return ja(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function My(e,t,r){const n=ja(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function oS(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ko(e){return e instanceof Map}function Wa(e){return e instanceof Set}function Vr(e){return e.copy_||e.base_}function dc(e,t){if(Ko(e))return new Map(e);if(Wa(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Dy(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[ct];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){const s=o[a],i=n[s];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[s]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[s]})}return Object.create(Lo(e),n)}else{const n=Lo(e);if(n!==null&&r)return{...e};const o=Object.create(n);return Object.assign(o,e)}}function ip(e,t=!1){return Ga(e)||Mn(e)||!jr(e)||(ja(e)>1&&Object.defineProperties(e,{set:fa,add:fa,clear:fa,delete:fa}),Object.freeze(e),t&&Object.values(e).forEach(r=>ip(r,!0))),e}function aS(){et(2)}var fa={value:aS};function Ga(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var sS={};function Wr(e){const t=sS[e];return t||et(0,e),t}var Oo;function Fy(){return Oo}function iS(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function dm(e,t){t&&(Wr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fc(e){mc(e),e.drafts_.forEach(lS),e.drafts_=null}function mc(e){e===Oo&&(Oo=e.parent_)}function fm(e){return Oo=iS(Oo,e)}function lS(e){const t=e[ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function mm(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[ct].modified_&&(fc(t),et(4)),jr(e)&&(e=wa(t,e),t.parent_||Sa(t,e)),t.patches_&&Wr("Patches").generateReplacementPatches_(r[ct].base_,e,t.patches_,t.inversePatches_)):e=wa(t,r,[]),fc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Cy?e:void 0}function wa(e,t,r){if(Ga(t))return t;const n=e.immer_.shouldUseStrictIteration(),o=t[ct];if(!o)return Ta(t,(a,s)=>hm(e,o,t,a,s,r),n),t;if(o.scope_!==e)return t;if(!o.modified_)return Sa(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const a=o.copy_;let s=a,i=!1;o.type_===3&&(s=new Set(a),a.clear(),i=!0),Ta(s,(l,u)=>hm(e,o,a,l,u,r,i),n),Sa(e,a,!1),r&&e.patches_&&Wr("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function hm(e,t,r,n,o,a,s){if(o==null||typeof o!="object"&&!s)return;const i=Ga(o);if(!(i&&!s)){if(process.env.NODE_ENV!=="production"&&o===r&&et(5),Mn(o)){const l=a&&t&&t.type_!==3&&!pc(t.assigned_,n)?a.concat(n):void 0,u=wa(e,o,l);if(My(r,n,u),Mn(u))e.canAutoFreeze_=!1;else return}else s&&r.add(o);if(jr(o)&&!i){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===o&&i)return;wa(e,o),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Ko(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&Sa(e,o)}}}function Sa(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ip(t,r)}function uS(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Fy(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,a=lp;r&&(o=[n],a=vo);const{revoke:s,proxy:i}=Proxy.revocable(o,a);return n.draft_=i,n.revoke_=s,i}var lp={get(e,t){if(t===ct)return e;const r=Vr(e);if(!pc(r,t))return cS(e,r,t);const n=r[t];return e.finalized_||!jr(n)?n:n===Fl(e.base_,t)?(Ul(e),e.copy_[t]=_c(n,e)):n},has(e,t){return t in Vr(e)},ownKeys(e){return Reflect.ownKeys(Vr(e))},set(e,t,r){const n=Uy(Vr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const o=Fl(Vr(e),t),a=o?.[ct];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(oS(r,o)&&(r!==void 0||pc(e.base_,t)))return!0;Ul(e),hc(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Fl(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ul(e),hc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Vr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){et(11)},getPrototypeOf(e){return Lo(e.base_)},setPrototypeOf(){et(12)}},vo={};Ta(lp,(e,t)=>{vo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});vo.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&et(13),vo.set.call(this,e,t,void 0)};vo.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&et(14),lp.set.call(this,e[0],t,r,e[0])};function Fl(e,t){const r=e[ct];return(r?Vr(r):e)[t]}function cS(e,t,r){const n=Uy(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function Uy(e,t){if(!(t in e))return;let r=Lo(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Lo(r)}}function hc(e){e.modified_||(e.modified_=!0,e.parent_&&hc(e.parent_))}function Ul(e){e.copy_||(e.copy_=dc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var pS=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const s=this;return function(l=a,...u){return s.produce(l,p=>r.call(this,p,...u))}}typeof r!="function"&&et(6),n!==void 0&&typeof n!="function"&&et(7);let o;if(jr(t)){const a=fm(this),s=_c(t,void 0);let i=!0;try{o=r(s),i=!1}finally{i?fc(a):mc(a)}return dm(a,n),mm(o,a)}else if(!t||typeof t!="object"){if(o=r(t),o===void 0&&(o=t),o===Cy&&(o=void 0),this.autoFreeze_&&ip(o,!0),n){const a=[],s=[];Wr("Patches").generateReplacementPatches_(t,o,a,s),n(a,s)}return o}else et(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(s,...i)=>this.produceWithPatches(s,l=>t(l,...i));let n,o;return[this.produce(t,r,(s,i)=>{n=s,o=i}),n,o]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){jr(e)||et(8),Mn(e)&&(e=dS(e));const t=fm(this),r=_c(e,void 0);return r[ct].isManual_=!0,mc(t),r}finishDraft(e,t){const r=e&&e[ct];(!r||!r.isManual_)&&et(9);const{scope_:n}=r;return dm(n,t),mm(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));const n=Wr("Patches").applyPatches_;return Mn(e)?n(e,t):this.produce(e,o=>n(o,t))}};function _c(e,t){const r=Ko(e)?Wr("MapSet").proxyMap_(e,t):Wa(e)?Wr("MapSet").proxySet_(e,t):uS(e,t);return(t?t.scope_:Fy()).drafts_.push(r),r}function dS(e){return Mn(e)||et(10,e),$y(e)}function $y(e){if(!jr(e)||Ga(e))return e;const t=e[ct];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=dc(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=dc(e,!0);return Ta(r,(o,a)=>{My(r,o,$y(a))},n),t&&(t.finalized_=!1),r}var fS=new pS,qy=fS.produce;function mS(e,t){let n=0;const o=[];for(;n+1<e.length;){const a=e[n],s=e[n+1];if(t(a,s)){n+=2;continue}else o.push(a),n+=1}return n+1===e.length&&o.push(e[n]),o}const hS=(e,t)=>["pipetteId","volume","labwareId","wellName"].every(n=>e[n]===t[n]),_S=e=>mS(e,(t,r)=>t.commandType==="aspirate"&&r.commandType==="dispense"&&hS(t.params,r.params)),Vy=e=>_S(e),up=(e,t)=>{const r=kt(e,t);return r.type===c.ABSORBANCE_READER_TYPE?r:(console.error(`Absorbance reader state updater expected ${t} moduleState to be absorbanceReader, but it was ${r.type}`),null)},yS=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forAbsorbanceReaderOpenLid: arg resolved to null (moduleId=${String(a)})`);return}const s=up(n,a);s!=null&&(s.lidOpen=!0)},bS=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forAbsorbanceReaderCloseLid: arg resolved to null (moduleId=${String(a)})`);return}const s=up(n,a);s!=null&&(s.lidOpen=!1)},IS=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,{measureMode:a,sampleWavelengths:s,referenceWavelength:i}=e,l=O(e.moduleId,o),u=O(a,o),p=u==="single"||u==="multi"?u:null,d=s.map(h=>D(h,o)),f=i==null?void 0:D(i,o);if(l==null||p==null||d.some(h=>h==null)||f===null){console.error(`forAbsorbanceReaderInitialize: arg resolved to null (moduleId=${String(l)}, measureMode=${String(p)}, sampleWavelengths=${String(d)}, referenceWavelength=${String(f)})`);return}const m=up(n,l);m!=null&&(m.initialization={mode:p,wavelengths:d,referenceWavelength:f},m.lidOpen=!1)};function TS(e,t,r){const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=D(e.volume,n);if(o==null||a==null){console.error(`forAirGapInPlace: arg resolved to null (pipetteId=${String(o)}, volume=${String(a)})`);return}const{robotState:s}=r,i=s.pipettes[o].nozzles;let u=t.pipetteEntities[o].spec.channels;i===c.COLUMN?u=8:i===c.SINGLE&&(u=1),An(u).forEach(p=>{const d=s.liquidState.pipettes[o][p]??{},f=d[Ke]?.volume??0;s.liquidState.pipettes[o][p]={...d,[Ke]:{volume:f+a}}})}var $l,_m;function wS(){if(_m)return $l;_m=1;var e=O_(),t=zo(),r=va(),n=nt(),o=Kr(),a=Da(),s=Fa(),i=Fc(),l="[object Map]",u="[object Set]",p=Object.prototype,d=p.hasOwnProperty;function f(m){if(m==null)return!0;if(o(m)&&(n(m)||typeof m=="string"||typeof m.splice=="function"||a(m)||i(m)||r(m)))return!m.length;var h=t(m);if(h==l||h==u)return!m.size;if(s(m))return!e(m).length;for(var _ in m)if(d.call(m,_))return!1;return!0}return $l=f,$l}var SS=wS();const ql=Ye(SS);var Vl,ym;function gS(){if(ym)return Vl;ym=1;function e(t,r,n,o){for(var a=t.length,s=n+(o?1:-1);o?s--:++s<a;)if(r(t[s],s,t))return s;return-1}return Vl=e,Vl}var Bl,bm;function ES(){if(bm)return Bl;bm=1;function e(t){return t!==t}return Bl=e,Bl}var xl,Im;function AS(){if(Im)return xl;Im=1;function e(t,r,n){for(var o=n-1,a=t.length;++o<a;)if(t[o]===r)return o;return-1}return xl=e,xl}var zl,Tm;function LS(){if(Tm)return zl;Tm=1;var e=gS(),t=ES(),r=AS();function n(o,a,s){return a===a?r(o,a,s):e(o,t,s)}return zl=n,zl}var Hl,wm;function OS(){if(wm)return Hl;wm=1;var e=LS();function t(r,n){var o=r==null?0:r.length;return!!o&&e(r,n,0)>-1}return Hl=t,Hl}var jl,Sm;function vS(){if(Sm)return jl;Sm=1;function e(t,r,n){for(var o=-1,a=t==null?0:t.length;++o<a;)if(n(r,t[o]))return!0;return!1}return jl=e,jl}var Wl,gm;function PS(){if(gm)return Wl;gm=1;function e(){}return Wl=e,Wl}var Gl,Em;function RS(){if(Em)return Gl;Em=1;var e=P_(),t=PS(),r=Nc(),n=1/0,o=e&&1/r(new e([,-0]))[1]==n?function(a){return new e(a)}:t;return Gl=o,Gl}var Yl,Am;function NS(){if(Am)return Yl;Am=1;var e=__(),t=OS(),r=vS(),n=b_(),o=RS(),a=Nc(),s=200;function i(l,u,p){var d=-1,f=t,m=l.length,h=!0,_=[],y=_;if(p)h=!1,f=r;else if(m>=s){var I=u?null:o(l);if(I)return a(I);h=!1,f=n,y=new e}else y=u?[]:_;e:for(;++d<m;){var b=l[d],w=u?u(b):b;if(b=p||b!==0?b:0,h&&w===w){for(var S=y.length;S--;)if(y[S]===w)continue e;u&&y.push(w),_.push(b)}else f(y,w,p)||(y!==_&&y.push(w),_.push(b))}return _}return Yl=i,Yl}var Kl,Lm;function kS(){if(Lm)return Kl;Lm=1;var e=NS();function t(r){return r&&r.length?e(r):[]}return Kl=t,Kl}var CS=kS();const DS=Ye(CS),cp=e=>{const{nozzles:t,pipetteSpec:r,primaryNozzle:n}=e,o=r.channels;if(t==null)return o;switch(t){case c.ROW:return 12;case c.COLUMN:return 8;case c.SINGLE:return 1;case c.ALL:return o;case c.PARTIAL_COLUMN:return c.PARTIAL_NOZZLE_MAP[n];default:return o}};function MS(e,t,r){const{pipetteId:n,volume:o}=e,{robotState:a,warnings:s}=r,i="labwareId"in e?e.labwareId:a.pipettes[n].entityId??"",l="wellName"in e?e.wellName:a.pipettes[n].wellName??"",{liquidState:u}=a,p=a.pipettes[n].nozzles,d=r.robotState.pipettes[n].primaryNozzle,f=t.pipetteEntities[n].spec,m=t.labwareEntities[i].def,h=m.metadata.displayCategory==="reservoir",_=cp({pipetteSpec:f,nozzles:p,primaryNozzle:d}),{allWellsShared:y,wellsForTips:I}=Jc(_,m,l);if(console.assert(DS(I).length===y?1:I.length,`expected all wells to be shared, or no wells to be shared. Got: ${JSON.stringify(I)}`),_>1&&y){const w=I[0],S=u.labware[i][w],L=o*_>wr(S);ql(S)?s.push(Dl()):L&&s.push(Cl());const g=L?wr(S)/_:o,T=sr(g,S).dest;An(_).forEach(A=>{const E=u.pipettes[n],v=A.toString(),R=E[v],M=L?Sr(R,{...T,[Ke]:{volume:o-g}}):Sr(R,T);E[v]=M}),u.labware[i][w]=sr(o*_,u.labware[i][w]).source;return}if(_===96&&h){I.forEach(w=>{const S=u.labware[i][w],L=o*8>wr(S);ql(S)?s.push(Dl()):L&&s.push(Cl());const g=L?wr(S)/8:o,T=sr(g,S).dest;An(_).forEach(A=>{const E=u.pipettes[n],v=A.toString(),R=E[v],M=L?Sr(R,{...T,[Ke]:{volume:o-g}}):Sr(R,T);E[v]=M}),u.labware[i][w]=sr(g*8,u.labware[i][w]).source});return}An(_).forEach(w=>{const S=w.toString(),L=u.pipettes[n],g=L[S],T=u.labware[i][I[w]],A=sr(o,T).dest;ql(T)?s.push(Dl()):o>wr(T)&&s.push(Cl()),L[S]=Sr(g,A)});const b=u.labware[i];I.forEach(w=>{b[w]=sr(o,b[w]).source}),"labwareId"in e&&(a.pipettes[n]={...a.pipettes[n],entityId:e.labwareId,wellName:l})}function Ya(e){const{robotStateAndWarnings:t,invariantContext:r,entityId:n,pipetteId:o,prevLiquidState:a,useFullVolume:s,volume:i,wellName:l}=e,u=r.pipetteEntities[o].spec,p=t.robotState.pipettes[o].nozzles,d=t.robotState.pipettes[o].primaryNozzle,f=cp({pipetteSpec:u,nozzles:p,primaryNozzle:d}),m=l??null,h=r.labwareEntities[n]!=null?r.labwareEntities[n].def:null;console.assert(!(s&&typeof i=="number"),"dispenseUpdateLiquidState takes either `volume` or `useFullVolume`, but got both"),console.assert(typeof i=="number"||s,"in dispenseUpdateLiquidState, either volume or useFullVolume are required");const{wellsForTips:_,allWellsShared:y}=h!=null&&l!=null?Jc(f,h,l):{wellsForTips:null,allWellsShared:!0},I=a.labware[n]!=null?a.labware[n]:null;let b=null;a.trashBins[n]!=null?b=a.trashBins[n]:a.wasteChute[n]!=null&&(b=a.wasteChute[n]);const w=lr(a.pipettes[o],T=>{const{...A}=T;if(s){const E=wr(A);return E>0?sr(E,A):{source:{},dest:{}}}return sr(i||0,A)});let S=null;if(m!=null&&I!=null)S={[m]:mt(w,(T,A)=>Sr(T,A.dest),I[m])};else if(b!=null){const T=Object.values(a.pipettes[o]).reduce((A,E)=>A+(E[0]?.volume??0),0);b[0]={volume:T}}S==null&&b==null&&console.assert(!1,`expected to merge liquid to a single well with sourceId ${n}`);const L=m!=null&&I!=null&&_!=null?_.reduce((T,A,E)=>({...T,[A]:Sr(w[`${E}`].dest,I[A]||{})}),{}):{},g=y?S:L;a.pipettes[o]=lr(w,"source"),a.trashBins[n]!=null&&b!=null?Object.assign(a.trashBins[n],b):a.wasteChute[n]!=null&&b!=null?Object.assign(a.wasteChute[n],b):a.labware[n]!=null&&g!=null&&(a.labware[n]=Object.assign(I??{},g))}function FS(e,t,r){const{pipetteId:n,labwareId:o,wellName:a}=e,{robotState:s}=r;Ya({pipetteId:n,entityId:o,useFullVolume:!0,wellName:a,prevLiquidState:s.liquidState,invariantContext:t,robotStateAndWarnings:r})}function US(e,t,r){const{pipetteId:n,configurationParams:o}=e,{style:a,primaryNozzle:s}=o,{runtimeParameters:i}=t,l=O(n,i),u=Ht(a,La,i),p=s==null?void 0:Ht(s,Oa,i);if(l==null||u==null||s!=null&&p==null){console.error(`forConfigureNozzleLayout: arg resolved to null (pipetteId=${String(l)}, style=${String(u)}, primaryNozzle=${String(p)})`);return}const{robotState:d}=r;d.pipettes[l].nozzles=u,d.pipettes[l].primaryNozzle=p??void 0}function $S(e,t,r){const{pipetteId:n,volume:o}=e,{robotState:a}=r,s="labwareId"in e?e.labwareId:a.pipettes[n].entityId??"",i="wellName"in e?e.wellName:a.pipettes[n].wellName??"",l=a.liquidState.pipettes[n],p=Object.values(l)[0]?.[Ke]?.volume??0,d=r.robotState.pipettes[n].primaryNozzle;if(Ya({invariantContext:t,entityId:s,pipetteId:n,prevLiquidState:a.liquidState,useFullVolume:!1,volume:o,wellName:i,robotStateAndWarnings:r}),p>0){const f=r.robotState.pipettes[n].nozzles,m=t.pipetteEntities[n].spec,h=cp({pipetteSpec:m,nozzles:f,primaryNozzle:d});Object.keys(l).slice(0,h).forEach(y=>{const I=l[y]??{};l[y]={...I,[Ke]:{volume:0}}})}"labwareId"in e&&(a.pipettes[n]={...a.pipettes[n],entityId:e.labwareId})}function qS(e,t,r){const{runtimeParameters:n}=t,o=O(e.pipette,n),a=e.dropTipLocation==null?void 0:O(e.dropTipLocation,n),s=e.wellName==null?void 0:O(e.wellName,n);if(o==null||e.dropTipLocation!=null&&a==null||e.wellName!=null&&s==null){console.error(`forDropTip: arg resolved to null (pipetteId=${String(o)}, labwareId=${String(a)}, wellName=${String(s)})`);return}const{robotState:i}=r;i.tipState.pipettes[o].hasTip=!1,i.tipState.pipettes[o].tiprackURI=null,i.pipettes[o].tiprackId=void 0;const l=i.tipState,u=t.pipetteEntities[o].spec,p=i.pipettes[o].nozzles,d=Tp(p,u),f=(h,_)=>h.find(y=>y.includes(_)),m=a==null?void 0:t.labwareEntities[a]?.def;a==null||s==null||m==null||!c.getIsTiprack(m)?console.warn(`forDropTip expected ${a} to have definition and to be a tiprack`):(d===c.SINGLE?l.tipracks[a][s]=or:d===c.COLUMN?(f(m.ordering,s)??[]).forEach(_=>l.tipracks[a][_]=or):d===c.ALL?u.channels===96?m.ordering.reduce((_,y)=>_.concat(y),[]).forEach(function(_){l.tipracks[a][_]=or}):(f(m.ordering,s)??[]).forEach(_=>l.tipracks[a][_]=or):u.channels===1?l.tipracks[a][s]=or:u.channels===96?m.ordering.reduce((_,y)=>_.concat(y),[]).forEach(function(_){l.tipracks[a][_]=or}):(f(m.ordering,s)??[]).forEach(_=>l.tipracks[a][_]=or),i.pipettes[o].entityId=a,i.pipettes[o].wellName=s)}function VS(e,t,r){const{labwareId:n,liquidId:o,volumeByWell:a}=e;Object.entries(a).forEach(([s,i])=>{r.robotState.liquidState.labware[n][s][o]={volume:i}})}var Zl,Om;function BS(){if(Om)return Zl;Om=1;function e(t,r){for(var n=-1,o=t==null?0:t.length;++n<o&&r(t[n],n,t)!==!1;);return t}return Zl=e,Zl}var Xl,vm;function pp(){if(vm)return Xl;vm=1;var e=Vc(),t=Pa(),r=Object.prototype,n=r.hasOwnProperty;function o(a,s,i){var l=a[s];(!(n.call(a,s)&&t(l,i))||i===void 0&&!(s in a))&&e(a,s,i)}return Xl=o,Xl}var Ql,Pm;function Zo(){if(Pm)return Ql;Pm=1;var e=pp(),t=Vc();function r(n,o,a,s){var i=!a;a||(a={});for(var l=-1,u=o.length;++l<u;){var p=o[l],d=s?s(a[p],n[p],p,a,n):void 0;d===void 0&&(d=n[p]),i?t(a,p,d):e(a,p,d)}return a}return Ql=r,Ql}var Jl,Rm;function xS(){if(Rm)return Jl;Rm=1;var e=Zo(),t=xo();function r(n,o){return n&&e(o,t(o),n)}return Jl=r,Jl}var eu,Nm;function zS(){if(Nm)return eu;Nm=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return eu=e,eu}var tu,km;function HS(){if(km)return tu;km=1;var e=pr(),t=Fa(),r=zS(),n=Object.prototype,o=n.hasOwnProperty;function a(s){if(!e(s))return r(s);var i=t(s),l=[];for(var u in s)u=="constructor"&&(i||!o.call(s,u))||l.push(u);return l}return tu=a,tu}var ru,Cm;function dp(){if(Cm)return ru;Cm=1;var e=A_(),t=HS(),r=Kr();function n(o){return r(o)?e(o,!0):t(o)}return ru=n,ru}var nu,Dm;function jS(){if(Dm)return nu;Dm=1;var e=Zo(),t=dp();function r(n,o){return n&&e(o,t(o),n)}return nu=r,nu}var wo={exports:{}};wo.exports;var Mm;function WS(){return Mm||(Mm=1,(function(e,t){var r=Kt(),n=t&&!t.nodeType&&t,o=n&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===n,s=a?r.Buffer:void 0,i=s?s.allocUnsafe:void 0;function l(u,p){if(p)return u.slice();var d=u.length,f=i?i(d):new u.constructor(d);return u.copy(f),f}e.exports=l})(wo,wo.exports)),wo.exports}var ou,Fm;function GS(){if(Fm)return ou;Fm=1;function e(t,r){var n=-1,o=t.length;for(r||(r=Array(o));++n<o;)r[n]=t[n];return r}return ou=e,ou}var au,Um;function YS(){if(Um)return au;Um=1;var e=Zo(),t=kc();function r(n,o){return e(n,t(n),o)}return au=r,au}var su,$m;function fp(){if($m)return su;$m=1;var e=L_(),t=e(Object.getPrototypeOf,Object);return su=t,su}var iu,qm;function By(){if(qm)return iu;qm=1;var e=Oc(),t=fp(),r=kc(),n=g_(),o=Object.getOwnPropertySymbols,a=o?function(s){for(var i=[];s;)e(i,r(s)),s=t(s);return i}:n;return iu=a,iu}var lu,Vm;function KS(){if(Vm)return lu;Vm=1;var e=Zo(),t=By();function r(n,o){return e(n,t(n),o)}return lu=r,lu}var uu,Bm;function mp(){if(Bm)return uu;Bm=1;var e=w_(),t=By(),r=dp();function n(o){return e(o,r,t)}return uu=n,uu}var cu,xm;function ZS(){if(xm)return cu;xm=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n){var o=n.length,a=new n.constructor(o);return o&&typeof n[0]=="string"&&t.call(n,"index")&&(a.index=n.index,a.input=n.input),a}return cu=r,cu}var pu,zm;function hp(){if(zm)return pu;zm=1;var e=T_();function t(r){var n=new r.constructor(r.byteLength);return new e(n).set(new e(r)),n}return pu=t,pu}var du,Hm;function XS(){if(Hm)return du;Hm=1;var e=hp();function t(r,n){var o=n?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return du=t,du}var fu,jm;function QS(){if(jm)return fu;jm=1;var e=/\w*$/;function t(r){var n=new r.constructor(r.source,e.exec(r));return n.lastIndex=r.lastIndex,n}return fu=t,fu}var mu,Wm;function JS(){if(Wm)return mu;Wm=1;var e=Un(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function n(o){return r?Object(r.call(o)):{}}return mu=n,mu}var hu,Gm;function eg(){if(Gm)return hu;Gm=1;var e=hp();function t(r,n){var o=n?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return hu=t,hu}var _u,Ym;function tg(){if(Ym)return _u;Ym=1;var e=hp(),t=XS(),r=QS(),n=JS(),o=eg(),a="[object Boolean]",s="[object Date]",i="[object Map]",l="[object Number]",u="[object RegExp]",p="[object Set]",d="[object String]",f="[object Symbol]",m="[object ArrayBuffer]",h="[object DataView]",_="[object Float32Array]",y="[object Float64Array]",I="[object Int8Array]",b="[object Int16Array]",w="[object Int32Array]",S="[object Uint8Array]",L="[object Uint8ClampedArray]",g="[object Uint16Array]",T="[object Uint32Array]";function A(E,v,R){var M=E.constructor;switch(v){case m:return e(E);case a:case s:return new M(+E);case h:return t(E,R);case _:case y:case I:case b:case w:case S:case L:case g:case T:return o(E,R);case i:return new M;case l:case d:return new M(E);case u:return r(E);case p:return new M;case f:return n(E)}}return _u=A,_u}var yu,Km;function rg(){if(Km)return yu;Km=1;var e=pr(),t=Object.create,r=(function(){function n(){}return function(o){if(!e(o))return{};if(t)return t(o);n.prototype=o;var a=new n;return n.prototype=void 0,a}})();return yu=r,yu}var bu,Zm;function ng(){if(Zm)return bu;Zm=1;var e=rg(),t=fp(),r=Fa();function n(o){return typeof o.constructor=="function"&&!r(o)?e(t(o)):{}}return bu=n,bu}var Iu,Xm;function og(){if(Xm)return Iu;Xm=1;var e=zo(),t=cr(),r="[object Map]";function n(o){return t(o)&&e(o)==r}return Iu=n,Iu}var Tu,Qm;function ag(){if(Qm)return Tu;Qm=1;var e=og(),t=Dc(),r=Mc(),n=r&&r.isMap,o=n?t(n):e;return Tu=o,Tu}var wu,Jm;function sg(){if(Jm)return wu;Jm=1;var e=zo(),t=cr(),r="[object Set]";function n(o){return t(o)&&e(o)==r}return wu=n,wu}var Su,eh;function ig(){if(eh)return Su;eh=1;var e=sg(),t=Dc(),r=Mc(),n=r&&r.isSet,o=n?t(n):e;return Su=o,Su}var gu,th;function xy(){if(th)return gu;th=1;var e=Rc(),t=BS(),r=pp(),n=xS(),o=jS(),a=WS(),s=GS(),i=YS(),l=KS(),u=v_(),p=mp(),d=zo(),f=ZS(),m=tg(),h=ng(),_=nt(),y=Da(),I=ag(),b=pr(),w=ig(),S=xo(),L=dp(),g=1,T=2,A=4,E="[object Arguments]",v="[object Array]",R="[object Boolean]",M="[object Date]",F="[object Error]",G="[object Function]",Y="[object GeneratorFunction]",oe="[object Map]",fe="[object Number]",J="[object Object]",Re="[object RegExp]",Ve="[object Set]",Me="[object String]",We="[object Symbol]",ie="[object WeakMap]",Ne="[object ArrayBuffer]",Be="[object DataView]",Ae="[object Float32Array]",ae="[object Float64Array]",K="[object Int8Array]",j="[object Int16Array]",k="[object Int32Array]",B="[object Uint8Array]",$="[object Uint8ClampedArray]",re="[object Uint16Array]",V="[object Uint32Array]",Z={};Z[E]=Z[v]=Z[Ne]=Z[Be]=Z[R]=Z[M]=Z[Ae]=Z[ae]=Z[K]=Z[j]=Z[k]=Z[oe]=Z[fe]=Z[J]=Z[Re]=Z[Ve]=Z[Me]=Z[We]=Z[B]=Z[$]=Z[re]=Z[V]=!0,Z[F]=Z[G]=Z[ie]=!1;function W(x,z,le,xe,ot,Ge){var ye,at=z&g,Tt=z&T,Ct=z&A;if(le&&(ye=ot?le(x,xe,ot,Ge):le(x)),ye!==void 0)return ye;if(!b(x))return x;var wt=_(x);if(wt){if(ye=f(x),!at)return s(x,ye)}else{var ke=d(x),st=ke==G||ke==Y;if(y(x))return a(x,at);if(ke==J||ke==E||st&&!ot){if(ye=Tt||st?{}:h(x),!at)return Tt?l(x,o(ye,x)):i(x,n(ye,x))}else{if(!Z[ke])return ot?x:{};ye=m(x,ke,at)}}Ge||(Ge=new e);var Ee=Ge.get(x);if(Ee)return Ee;Ge.set(x,ye),w(x)?x.forEach(function(ue){ye.add(W(ue,z,le,ue,x,Ge))}):I(x)&&x.forEach(function(ue,ce){ye.set(ce,W(ue,z,le,ce,x,Ge))});var Ce=Ct?Tt?p:u:Tt?L:S,Fe=wt?void 0:Ce(x);return t(Fe||x,function(ue,ce){Fe&&(ce=ue,ue=x[ce]),r(ye,ce,W(ue,z,le,ce,x,Ge))}),ye}return gu=W,gu}var Eu,rh;function zy(){if(rh)return Eu;rh=1;function e(t,r,n){var o=-1,a=t.length;r<0&&(r=-r>a?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var s=Array(a);++o<a;)s[o]=t[o+r];return s}return Eu=e,Eu}var Au,nh;function lg(){if(nh)return Au;nh=1;var e=Ua(),t=zy();function r(n,o){return o.length<2?n:e(n,t(o,0,-1))}return Au=r,Au}var Lu,oh;function ug(){if(oh)return Lu;oh=1;var e=qn(),t=ky(),r=lg(),n=Vn(),o=Object.prototype,a=o.hasOwnProperty;function s(i,l){l=e(l,i);var u=-1,p=l.length;if(!p)return!0;for(;++u<p;){var d=n(l[u]);if(d==="__proto__"&&!a.call(i,"__proto__")||(d==="constructor"||d==="prototype")&&u<p-1)return!1}var f=r(i,l);return f==null||delete f[n(t(l))]}return Lu=s,Lu}var Ou,ah;function cg(){if(ah)return Ou;ah=1;var e=$n(),t=fp(),r=cr(),n="[object Object]",o=Function.prototype,a=Object.prototype,s=o.toString,i=a.hasOwnProperty,l=s.call(Object);function u(p){if(!r(p)||e(p)!=n)return!1;var d=t(p);if(d===null)return!0;var f=i.call(d,"constructor")&&d.constructor;return typeof f=="function"&&f instanceof f&&s.call(f)==l}return Ou=u,Ou}var vu,sh;function pg(){if(sh)return vu;sh=1;var e=cg();function t(r){return e(r)?void 0:r}return vu=t,vu}var Pu,ih;function dg(){if(ih)return Pu;ih=1;var e=f_();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return Pu=t,Pu}var Ru,lh;function fg(){if(lh)return Ru;lh=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return Ru=e,Ru}var Nu,uh;function Hy(){if(uh)return Nu;uh=1;var e=fg(),t=Math.max;function r(n,o,a){return o=t(o===void 0?n.length-1:o,0),function(){for(var s=arguments,i=-1,l=t(s.length-o,0),u=Array(l);++i<l;)u[i]=s[o+i];i=-1;for(var p=Array(o+1);++i<o;)p[i]=s[i];return p[o]=a(u),e(n,this,p)}}return Nu=r,Nu}var ku,ch;function mg(){if(ch)return ku;ch=1;function e(t){return function(){return t}}return ku=e,ku}var Cu,ph;function hg(){if(ph)return Cu;ph=1;var e=mg(),t=D_(),r=Uo(),n=t?function(o,a){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return Cu=n,Cu}var Du,dh;function _g(){if(dh)return Du;dh=1;var e=800,t=16,r=Date.now;function n(o){var a=0,s=0;return function(){var i=r(),l=t-(i-s);if(s=i,l>0){if(++a>=e)return arguments[0]}else a=0;return o.apply(void 0,arguments)}}return Du=n,Du}var Mu,fh;function jy(){if(fh)return Mu;fh=1;var e=hg(),t=_g(),r=t(e);return Mu=r,Mu}var Fu,mh;function yg(){if(mh)return Fu;mh=1;var e=dg(),t=Hy(),r=jy();function n(o){return r(t(o,void 0,e),o+"")}return Fu=n,Fu}var Uu,hh;function bg(){if(hh)return Uu;hh=1;var e=Bo(),t=xy(),r=ug(),n=qn(),o=Zo(),a=pg(),s=yg(),i=mp(),l=1,u=2,p=4,d=s(function(f,m){var h={};if(f==null)return h;var _=!1;m=e(m,function(I){return I=n(I,f),_||(_=I.length>1),I}),o(f,i(f),h),_&&(h=t(h,l|u|p,a));for(var y=m.length;y--;)r(h,m[y]);return h});return Uu=d,Uu}var Ig=bg();const Tg=Ye(Ig),yc="TOUCHED_PIPETTABLE_LABWARE";var $u,_h;function wg(){if(_h)return $u;_h=1;var e=Uc();function t(r,n){return e(r,n)}return $u=t,$u}var Sg=wg();const gg=Ye(Sg),Ka=e=>{const{node:t,stack:r=[],robotState:n,memo:o=new Map}=e;let a=r;if(!(typeof t=="object"&&"labwareId"in t))return a=[...r,t],o.set(t,a),{stack:a,memo:o};const{labwareId:s}=t,i=n.labware[s];if(i!=null&&i.stackedOnNode!=null){const{stack:l,memo:u}=Ka({node:i.stackedOnNode,stack:[...r,t],robotState:n,memo:o});Wy(o,u),a=l,o.set(t,a)}return{stack:a,memo:o}},Eg=e=>{const{node:t,robotState:r,deckDef:n,deckConfiguration:o}=e,{stack:a}=Ka({node:t,robotState:r}),{cutoutFixtures:s}=n,i=a.find(l=>typeof l=="object"&&"addressableAreaName"in l);if(i!=null&&typeof i=="object"&&"addressableAreaName"in i){const{addressableAreaName:l}=i;for(const{id:u,providesAddressableAreas:p}of s){const[d]=Object.entries(p).find(([f,m])=>m.includes(l))??[];if(d!=null){const f=o.find(({cutoutId:I})=>I===d),{cutoutFixtureId:m,cutoutId:h}=f,_=m===u&&h===d,y=Object.entries(r.modules).find(([I,{slot:b}])=>c.FLEX_CUTOUT_BY_SLOT_ID[b]===h);if(_&&y!=null)return y[0]}}}return null},Wy=(e,t)=>{t.forEach((r,n)=>{e.set(n,r)})},Ag=(e,t)=>e.some(r=>gg(r,t)),Gy=e=>{const{labwareId:t,robotState:r}=e,n=new Map,o={labwareId:t};let a=[];for(const[s,{stackedOnNode:i}]of Object.entries(r.labware)){const l={labwareId:s};if(i==null)continue;let u;const p=n.get(l);if(p!=null)u=p;else{const{stack:d,memo:f}=Ka({node:l,robotState:r,memo:n});if(Wy(n,f),!Ag(d,o))continue;n.set(l,d),u=d}u.length>a.length&&(a=u)}return a},Yy=e=>{const t=[],r=new Set;for(const n of Object.keys(e.labware)){if(r.has(n))continue;const o=Gy({labwareId:n,robotState:e});o.forEach(a=>{typeof a=="object"&&"labwareId"in a&&r.add(a.labwareId)}),t.push(o)}return t},_p=e=>{const{moduleId:t,robotState:r,moduleEntities:n,deckDef:o}=e,a=r.modules[t],s=n[t];if(a==null||s==null)return null;const{slot:i}=a,{model:l}=s,u=c.getAddressableAreaNamesFromLoadedModule(l,i,o);return u.length===0?null:u[0]},Lg=e=>{const{location:t,robotState:r,moduleEntities:n,deckDef:o}=e;if(t==="offDeck"||t==="systemLocation"||t==="wasteChuteLocation")return null;if("slotName"in t)return t.slotName;if("addressableAreaName"in t)return t.addressableAreaName;if("moduleId"in t){const{moduleId:a}=t;return _p({moduleId:a,robotState:r,moduleEntities:n,deckDef:o})}return null},Ky=e=>{const{deckConfiguration:t,deckDefinition:r}=e;return t.reduce((n,{cutoutFixtureId:o,cutoutId:a})=>((r.cutoutFixtures.find(({id:i})=>o===i)?.providesAddressableAreas[a]??[]).forEach(i=>{n.add(i)}),n),new Set)},Og=e=>{const{robotState:t,deckConfiguration:r,deckDefinition:n,moduleEntities:o}=e,a=Ky({deckConfiguration:r,deckDefinition:n}),s=new Set(a),i=Yy(t);for(const l of i){const u=sp(l);if(typeof u=="object"&&"addressableAreaName"in u){const{addressableAreaName:p}=u;s.delete(p)}if(typeof u=="object"&&"slotName"in u){const{slotName:p}=u;s.delete(p)}if(typeof u=="object"&&"moduleId"in u){const{moduleId:p}=u,d=_p({moduleId:p,robotState:t,moduleEntities:o,deckDef:n});d!=null&&s.delete(d)}}return s},vg=e=>{const t=e.toLowerCase();return t.includes("chute")||t.includes("waste")||t.startsWith("gripper")||t==="96channelwastechute"},Zy=e=>{const{stack:t,subjectLabwareId:r,moduleEntities:n,labwareEntityIds:o,modules:a}=e;if(t.length===0||t[0]!==r||t.length<2)return;const s=t[1];if(s===rt){const u=t[2];return u==null?void 0:{kind:"inStackerHopper",moduleId:u}}if(n[s]!=null)return{moduleId:s};if(o.has(s))return{labwareId:s};if(s==="offDeck")return"offDeck";if(s==="systemLocation")return"systemLocation";if(s==="wasteChuteLocation")return"wasteChuteLocation";if(vg(s))return{addressableAreaName:s};const i=Oy(s,a,n)??s;if(Object.entries(a).some(([u,p])=>n[u]?.type===c.FLEX_STACKER_MODULE_TYPE&&p.slot===i)){const u=za(i);if(u!=null)return{addressableAreaName:u}}return{slotName:s}},Pg=e=>typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="inStackerHopper",Rg=e=>typeof e!="object"||e===null?!1:!Pg(e),Ng=(e,t)=>{const{id:r,def:n}=e,{id:o,def:a}=t,s=n.dimensions.xDimension,i=n.dimensions.yDimension,l=a.dimensions.xDimension,u=a.dimensions.yDimension;return s>l&&i>u?{containerLabwareId:r,containedLabwareId:o}:l>s&&u>i?{containerLabwareId:o,containedLabwareId:r}:null},yp=(e,t)=>{const r=new Map;for(const o of Object.keys(e)){const a=e[o].stackedOnNode;if(a==null||!Rg(a))continue;const s=JSON.stringify(a),i=r.get(s)??[];i.push(o),r.set(s,i)}const n={};for(const o of r.values()){if(o.length!==2)continue;const[a,s]=o,i=t[a],l=t[s];if(i==null||l==null)continue;const u=Ng(i,l);if(u==null)continue;const{containerLabwareId:p,containedLabwareId:d}=u;n[p]=d}return Object.keys(n).length===0?e:lr(e,(o,a)=>n[a]!=null?{...o,contains:n[a]}:o)},kg=(e,t,r)=>{const n=Object.keys(e.labware),o=new Set(n);let a=lr(e.labware,(s,i)=>{const l=s.stackedOnNode??Zy({stack:s.stack,subjectLabwareId:i,moduleEntities:t,labwareEntityIds:o,modules:e.modules});return l!=null?{...s,stackedOnNode:l}:{...s}});return a=yp(a,r),{...e,labware:a}};function Cg(e,t,r){const{runtimeParameters:n,labwareEntities:o}=t,a=O(e.labwareId,n);let s=null;if(typeof e.newLocation=="string"){const v=O(e.newLocation,n);v!=null&&(s=v)}else if("labwareId"in e.newLocation){const v=O(e.newLocation.labwareId,n);v!=null&&(s=v===e.newLocation.labwareId?e.newLocation:{labwareId:v})}else if("moduleId"in e.newLocation){const v=O(e.newLocation.moduleId,n);v!=null&&(s=v===e.newLocation.moduleId?e.newLocation:{moduleId:v})}else if("slotName"in e.newLocation){const v=O(e.newLocation.slotName,n);v!=null&&(s=v===e.newLocation.slotName?e.newLocation:{slotName:v})}else{const v=O(e.newLocation.addressableAreaName,n);v!=null&&(s=v===e.newLocation.addressableAreaName?e.newLocation:{addressableAreaName:v})}if(a==null||s==null){console.error(`forMoveLabware: arg resolved to null (labwareId=${String(a)}, newLocation=${String(s)})`);return}const{robotState:i}=r,{modules:l,labware:u}=i;if(u[a]==null)return;const p=ee(u[a].stack),d=Ha(u,p,a),f=d.indexOf(a),m=d.slice(0,f+1),h=c.getIsLid(o[a].def);let _=!1;const y=Object.entries(l).find(([v,{slot:R}])=>{const{type:M}=t.moduleEntities[v]??{};return M===c.FLEX_STACKER_MODULE_TYPE&&R===p})??null,I=y!=null&&y[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE?ar.map(v=>y[1].moduleState.labwareOnShuttle?.[v]).filter(v=>v!=null):[],b=I.includes(a)?I.slice(0,I.indexOf(a)+1):[];if(y!=null&&y[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE){const v=y[1].moduleState,R=ar.findIndex(M=>v.labwareOnShuttle?.[M]===a);if(R!==-1&&v.labwareOnShuttle!=null)for(const M of ar.slice(R,ar.length))if(M==="primaryLabwareId"){v.labwareOnShuttle=null;break}else v.labwareOnShuttle[M]=null}const w=s,S=Object.entries(l).find(([v,{slot:R}])=>{const{type:M}=t.moduleEntities[v]??{};return M===c.FLEX_STACKER_MODULE_TYPE&&typeof w=="object"&&("moduleId"in w&&w.moduleId===v||"slotName"in w&&R===w.slotName)})??null,[L,g]=S??[];if(L!=null&&g!=null){const v=b.length>0?b:go({slot:p,labwareState:u,modulesState:l}),R=v.indexOf(a),M=g.moduleState;if(R!==-1){const F=v.slice(0,R+1).toReversed();if(M.labwareOnShuttle==null&&(M.labwareOnShuttle={primaryLabwareId:"",adapterLabwareId:null,lidLabwareId:null}),F.length===3)for(let G=0;G<ar.length;G++){const Y=ar[G];M.labwareOnShuttle[Y]=F[G]}else if(F.length===2){const G=F.some(Y=>t.labwareEntities[Y].def.allowedRoles?.some(oe=>oe==="lid"))?["primaryLabwareId","lidLabwareId"]:["adapterLabwareId","primaryLabwareId"];for(let Y=0;Y<G.length;Y++){const oe=G[Y];M.labwareOnShuttle[oe]=F[Y]}}else F.length===1&&(M.labwareOnShuttle.primaryLabwareId=F[0])}}const T=[];if(c.locationIsOffDeck(s))T.push(s);else if("moduleId"in s)if(l[s.moduleId].moduleState.type===c.FLEX_STACKER_MODULE_TYPE)T.push(l[s.moduleId].slot);else if(t.moduleEntities[s.moduleId]?.type===c.VACUUM_MODULE_TYPE){const v=l[s.moduleId].slot,R=go({slot:v,labwareState:u,modulesState:l});R.length>0?T.push(...R):T.push(s.moduleId,v)}else T.push(s.moduleId,l[s.moduleId].slot);else if("slotName"in s){const{slotName:v}=s;v in u?(_=c.getIsPipettableLabware(o[v].def),T.push(...u[v].stack)):T.push(v)}else if("labwareId"in s){const v=s.labwareId;_=c.getIsPipettableLabware(o[v].def);const R=u[v].stack;T.push(...R)}else if("addressableAreaName"in s)if(Ao(s.addressableAreaName)){const v=Object.entries(l).find(([R])=>t.moduleEntities[R]?.type===c.VACUUM_MODULE_TYPE)?.[0];T.push(Ac),v!=null&&T.push(v),T.push(s.addressableAreaName)}else T.push(s.addressableAreaName);m.forEach((v,R)=>{if(u[v]!=null){const M=m.slice(R+1);i.labware[v]={...i.labware[v],stack:[v,...M,...T],...h&&_?{sterility:yc}:{}}}});const A=typeof s=="object"&&"labwareId"in s&&c.getIsPipettableLabware(o[s.labwareId].def);let E=s;if(typeof s=="object"&&s!==null&&"moduleId"in s&&l[s.moduleId].moduleState.type===c.FLEX_STACKER_MODULE_TYPE){const v=za(l[s.moduleId].slot);v!=null&&(E={addressableAreaName:v})}else if(typeof s=="object"&&s!==null&&"moduleId"in s&&t.moduleEntities[s.moduleId]?.type===c.VACUUM_MODULE_TYPE){const v=l[s.moduleId].slot,R=go({slot:v,labwareState:u,modulesState:l}),M=R.length>0?R[0]:null;M!=null&&M in o&&(E={labwareId:M})}i.labware[a].stackedOnNode=E,A&&(i.labware[a].sterility=yc),i.labware=yp(lr(i.labware,v=>Tg(v,"contains")),o)}function Dg(e,t,r){const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=O(e.addressableAreaName,n);if(o==null||a==null){console.error(`forMoveToAddressableArea: arg resolved to null (pipetteId=${String(o)}, addressableAreaName=${String(a)})`);return}const{wasteChuteEntities:s,trashBinEntities:i}=t,l=a,u=c.WASTE_CHUTE_ADDRESSABLE_AREAS.includes(l),p=Object.values(i).find(m=>m.location===yy(l))?.id,d=u?Object.values(s)[0].id:p,{robotState:f}=r;f.pipettes[o]={...f.pipettes[o],entityId:d}}function Mg(e,t,r){const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=O(e.labwareId,n),s=O(e.wellName,n);if(o==null||a==null||s==null){console.error(`forMoveToWell: arg resolved to null (pipetteId=${String(o)}, labwareId=${String(a)}, wellName=${String(s)})`);return}const{robotState:i}=r;i.pipettes[o]={...i.pipettes[o],entityId:a,wellName:s}}function Fg(e,t,r){const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=O(e.labwareId,n),s=O(e.wellName,n);if(o==null||a==null||s==null){console.error(`forPickUpTip: arg resolved to null (pipetteId=${String(o)}, labwareId=${String(a)}, wellName=${String(s)})`);return}const i=t.pipetteEntities[o].spec,l=t.labwareEntities[a].def;if(!c.getIsTiprack(l))throw new Error(`forPickUpTip expected ${a} to be a tiprack`);const u=r.robotState.tipState,p=r.robotState.pipettes[o].nozzles,d=r.robotState.pipettes[o].primaryNozzle,f=Tp(p,i),m=(y,I)=>y.find(b=>b.includes(I)),h=(y,I)=>{const b=y.findIndex(S=>S.includes(I));if(b===-1)return null;const w=y[b].indexOf(I);return y.map(S=>S[w])},_=(y,I)=>{const b=c.PARTIAL_NOZZLE_MAP[d],w=y.findIndex(A=>A.includes(I)),S=y[w].indexOf(I),L=y[w];if(L.length-S<b){const A=L.length-b;return L.slice(A,L.length)}const T=S+b;return L.slice(S,Math.min(T,L.length))};if(u.pipettes[o].hasTip=!0,u.pipettes[o].tiprackURI=a,f===c.SINGLE)u.tipracks[a][s]=_e;else if(f===c.PARTIAL_COLUMN&&d){const y=_(l.ordering,s);y==null?console.error(`Invalid primary well for tip pick up for partial config: ${s}`):y.forEach(function(I){u.tipracks[a][I]=_e})}else if(f===c.COLUMN){const y=m(l.ordering,s);y==null&&console.error(`Invalid primary well for tip pickup: ${s}`),y?.forEach(function(I){u.tipracks[a][I]=_e})}else if(f===c.ROW){const y=h(l.ordering,s);y==null&&console.error("Invalid primary well for tip pickup: "+s),y?.forEach(function(I){u.tipracks[a][I]=_e})}else if(f===c.ALL)if(i.channels===96)l.ordering.reduce((I,b)=>I.concat(b),[]).forEach(function(I){u.tipracks[a][I]=_e});else{const y=m(l.ordering,s);y==null&&console.error(`Invalid primary well for tip pickup: ${s}`),y?.forEach(function(I){u.tipracks[a][I]=_e})}else if(i.channels===1)u.tipracks[a][s]=_e;else if(i.channels===96)l.ordering.reduce((I,b)=>I.concat(b),[]).forEach(function(I){u.tipracks[a][I]=_e});else{const y=m(l.ordering,s);y==null&&console.error(`Invalid primary well for tip pickup: ${s}`),y?.forEach(function(I){u.tipracks[a][I]=_e})}r.robotState.pipettes[o].tiprackId=a,r.robotState.pipettes[o].tipWell=s}const Ug={clean:qo,empty:_e,used:or};function $g(e,t,r){const{labwareId:n,wellNames:o,tipWellState:a="clean"}=e,s=Ug[a],i=r.robotState.tipState.tipracks[n];i!=null&&o.forEach(l=>{i[l]=s})}const Qr=(e,t)=>{const r=kt(e,t);return r.type===c.THERMOCYCLER_MODULE_TYPE?r:(console.error(`Thermocycler state updater expected ${t} moduleState to be thermocycler, but it was ${r.type}`),{})},qg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=D(e.celsius,n);if(o==null||a==null){console.error(`forThermocyclerSetTargetBlockTemperature: arg resolved to null (moduleId=${String(o)}, celsius=${String(a)})`);return}const{robotState:s}=r,i=Qr(s,o);i.currentBlockActivity={type:"blockTargetTemp",blockTargetTemp:a}},Vg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=D(e.celsius,n);if(o==null||a==null){console.error(`forThermocyclerSetTargetLidTemperature: arg resolved to null (moduleId=${String(o)}, celsius=${String(a)})`);return}const{robotState:s}=r,i=Qr(s,o);i.lidTargetTemp=a},Bg=(e,t,r)=>{},xg=(e,t,r)=>{},zg=(e,t,r)=>{},Hg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null){console.error(`forThermocyclerDeactivateBlock: arg resolved to null (moduleId=${String(o)})`);return}const{robotState:a}=r,s=Qr(a,o);s.currentBlockActivity={type:"blockDeactivated"}},jg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null){console.error(`forThermocyclerDeactivateLid: arg resolved to null (moduleId=${String(o)})`);return}const{robotState:a}=r,s=Qr(a,o);s.lidTargetTemp=null},Wg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null){console.error(`forThermocyclerCloseLid: arg resolved to null (moduleId=${String(o)})`);return}const{robotState:a}=r,s=Qr(a,o);s.lidOpen=!1},Gg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null){console.error(`forThermocyclerOpenLid: arg resolved to null (moduleId=${String(o)})`);return}const{robotState:a}=r,s=Qr(a,o);s.lidOpen=!0};function yh(e,t){const r=D(e.celsius,t),n=D(e.holdSeconds,t);return r==null||n==null?(console.error(`resolveProfileStep: arg resolved to null (celsius=${String(r)}, holdSeconds=${String(n)})`),null):{celsius:r,holdSeconds:n}}function Yg(e,t){const r=[];for(const n of e)if("steps"in n){const o=D(n.repetitions,t);if(o==null)return console.error(`resolveProfileElements: arg resolved to null (repetitions=${String(o)})`),null;const a=[];for(const s of n.steps){const i=yh(s,t);if(i==null)return console.error("resolveProfileElements: arg resolved to null (step=null)"),null;a.push(i)}r.push({steps:a,repetitions:o})}else{const o=yh(n,t);if(o==null)return console.error("resolveProfileElements: arg resolved to null (step=null)"),null;r.push(o)}return r}const Kg=(e,t,r)=>{const{profile:n,...o}=e;Xy({profileElements:n,...o},t,r)},Xy=(e,t,r)=>{const n=NaN+U();Qy({...e,taskId:n},t,r)&&Jy(n,r,c.THERMOCYCLER_MODULE_TYPE)},Qy=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=Yg(e.profileElements,n);if(o==null||a==null)return console.error(`forThermocyclerStartRunExtendedProfile: arg resolved to null (moduleId=${String(o)}, profileElements=${String(a)})`),!1;let s=null;if(e.taskId!=null){const u=O(e.taskId,n);if(u==null)return console.error(`forThermocyclerStartRunExtendedProfile: arg resolved to null (taskId=${String(u)})`),!1;s=u}const{robotState:i}=r,l=Qr(i,o);return l.currentBlockActivity={type:"profile",profileElements:a,taskId:s},l.numProfilesStarted++,!0},Zg=e=>{if(e.currentBlockActivity.type==="profile"){const t=Xg(e.currentBlockActivity.profileElements);return e.currentBlockActivity=t!=null?{type:"blockTargetTemp",blockTargetTemp:t}:{type:"blockDeactivated"},!0}else return!1};function Xg(e){const t=sp(gp(e));return t!=null?t.celsius:null}const Qg=(e,t)=>{const[r,n]=[e.ordering,t.ordering];if(r.length!==n.length)return!1;for(let o=0;o<r.length;o++){const[a,s]=[r[o],n[o]];if(a.length!==s.length)return!1}return!0},bp=(e,t,r)=>{const{labware:n,liquidState:o}=t,s=Ha(n,e).filter(i=>i in r&&c.getIsPipettableLabware(r[i].def));if(s.length===1){const i=o.labware[s[0]];Object.entries(i).forEach(([l,u])=>{i[l]={}});return}if(s.length===2){const i=s[0],l=s[1];if(!Qg(r[i].def,r[l].def))return;const u=o.labware[i],p=o.labware[l];Object.entries(p).forEach(([d,f])=>{const m=u[d];Object.entries(m).forEach(([h,{volume:_}])=>{f[h]={volume:h in f?f[h].volume+_:_}}),u[d]={}})}},Jg=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null){console.error(`forVacuumOpenVent: arg resolved to null (moduleId=${String(n)})`);return}const{robotState:o}=r,a=pt(o,n);a!=null&&(a.ventStatus=Lc)},eE=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null){console.error(`forVacuumCloseVent: arg resolved to null (moduleId=${String(n)})`);return}const{robotState:o}=r,a=pt(o,n);a!=null&&(a.ventStatus=Vo)},tE=(e,t,r)=>{const{runtimeParameters:n,labwareEntities:o}=t,a=O(e.moduleId,n),s=D(e.gaugePressure,n),i=e.duration==null?void 0:D(e.duration,n),l=e.ventAfter==null?!0:je(e.ventAfter,n);if(a==null||s==null||i===null||l==null){console.error(`forVacuumSetPumpPressure: arg resolved to null (moduleId=${String(a)}, gaugePressure=${String(s)}, duration=${String(i)}, ventAfter=${String(l)})`);return}const{taskId:u}=e,{robotState:p}=r,d=pt(p,a);d!=null&&(bp(a,p,o),i==null||u==null?d.currentPumpActivity={type:"indefiniteHold",mode:sc,targetPressure:s}:(d.currentPumpActivity={type:"timedHold",mode:sc,targetPressure:s,durationSeconds:i,taskId:u,ventAfter:l},d.numPumpActivitiesStarted++),d.ventStatus=Vo)},rE=(e,t,r)=>{const{runtimeParameters:n,labwareEntities:o}=t,a=O(e.moduleId,n),s=D(e.percentPower,n),i=e.duration==null?void 0:D(e.duration,n),l=e.ventAfter==null?!0:je(e.ventAfter,n);if(a==null||s==null||i===null||l==null){console.error(`forVacuumSetPumpPower: arg resolved to null (moduleId=${String(a)}, percentPower=${String(s)}, duration=${String(i)}, ventAfter=${String(l)})`);return}const{taskId:u}=e,{robotState:p}=r,d=pt(p,a);d!=null&&(bp(a,p,o),i==null||u==null?d.currentPumpActivity={type:"indefiniteHold",mode:ac,targetPower:s}:(d.currentPumpActivity={type:"timedHold",mode:ac,targetPower:s,durationSeconds:i,taskId:u,ventAfter:l},d.numPumpActivitiesStarted++),d.ventStatus=Vo)},nE=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null){console.error(`forVacuumStopPump: arg resolved to null (moduleId=${String(n)})`);return}const{robotState:o}=r,a=pt(o,n);a!=null&&(a.currentPumpActivity={type:"pumpDeactivated"})},oE=(e,t,r)=>{const{runtimeParameters:n,labwareEntities:o}=t,a=O(e.moduleId,n),s=je(e.ventAfter,n);if(a==null||s==null){console.error(`forVacuumStartRunProfile: arg resolved to null (moduleId=${String(a)}, ventAfter=${String(s)})`);return}const{robotState:i}=r,l=pt(i,a),{taskId:u,profile:p}=e;l==null||u==null||(bp(a,i,o),l.currentPumpActivity={type:"profile",profileElements:p,taskId:u,ventAfter:s},l.numPumpActivitiesStarted++)},aE=e=>{if(e.currentPumpActivity.type==="timedHold"||e.currentPumpActivity.type==="profile"){const t=e.currentPumpActivity.ventAfter;return e.currentPumpActivity={type:"pumpDeactivated"},e.ventStatus=t?Lc:Vo,!0}return!1};function sE(e,t,r){const{runtimeParameters:n}=t;for(const o of e.task_ids){const a=O(o,n);a==null&&console.error(`forWaitForTasks: arg resolved to null (taskId=${String(a)})`),a!=null&&Jy(a,r)||r.warnings.push(Nw())}}const Jy=(e,t,r)=>{const{robotState:n}=t,o=Object.values(n.modules).find(a=>{if(r&&a.moduleState.type!==r)return!1;const s=a.moduleState.type==="thermocyclerModuleType"&&a.moduleState.currentBlockActivity.type==="profile"&&a.moduleState.currentBlockActivity.taskId===e,i=a.moduleState.type==="vacuumModuleType"&&(a.moduleState.currentPumpActivity.type==="timedHold"||a.moduleState.currentPumpActivity.type==="profile")&&a.moduleState.currentPumpActivity.taskId===e;return s||i});return o==null?!1:o.moduleState.type==="thermocyclerModuleType"?Zg(o.moduleState):o.moduleState.type==="vacuumModuleType"?aE(o.moduleState):(console.log(`unexpected module type with task: ${o.moduleState.type}`),!1)},jn=(e,t)=>{const r=kt(e,t);return r.type===c.HEATERSHAKER_MODULE_TYPE?r:(console.error(`Heater-Shaker state updater expected ${t} moduleState to be heaterShaker, but it was ${r.type}`),{})},iE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=D(e.celsius,o);if(a==null||s==null){console.error(`forHeaterShakerSetTargetTemperature: arg resolved to null (moduleId=${String(a)}, celsius=${String(s)})`);return}const i=jn(n,a);i.targetTemp=s},lE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forHeaterShakerDeactivateHeater: arg resolved to null (moduleId=${String(a)})`);return}const s=jn(n,a);s.targetTemp=null},uE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=D(e.rpm,o);if(a==null||s==null){console.error(`forHeaterShakerSetTargetShakeSpeed: arg resolved to null (moduleId=${String(a)}, rpm=${String(s)})`);return}const i=jn(n,a);i.targetSpeed=s},cE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forHeaterShakerStopShake: arg resolved to null (moduleId=${String(a)})`);return}const s=jn(n,a);s.targetSpeed=null},pE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forHeaterShakerOpenLatch: arg resolved to null (moduleId=${String(a)})`);return}const s=jn(n,a);s.latchOpen=!0},dE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forHeaterShakerCloseLatch: arg resolved to null (moduleId=${String(a)})`);return}const s=jn(n,a);s.latchOpen=!1},fE=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n);if(o==null){console.error(`forBlowOutInPlace: arg resolved to null (pipetteId=${String(o)})`);return}const{robotState:a}=r,s=a.pipettes[o].entityId??"";Ya({invariantContext:t,pipetteId:o,prevLiquidState:a.liquidState,useFullVolume:!0,robotStateAndWarnings:r,entityId:s})},mE=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n);if(o==null){console.error(`forDropTipInPlace: arg resolved to null (pipetteId=${String(o)})`);return}const{robotState:a}=r,s=a.pipettes[o].entityId??"";a.tipState.pipettes[o]={hasTip:!1,tiprackURI:null},Ya({invariantContext:t,prevLiquidState:a.liquidState,pipetteId:o,useFullVolume:!0,robotStateAndWarnings:r,entityId:s}),a.pipettes[o].tiprackId=void 0};function eb(e,t){e.type===c.MAGNETIC_MODULE_TYPE&&(e.engaged=t)}function hE(e,t,r){const{robotState:n}=r,o=O(e.moduleId,t.runtimeParameters);if(o==null){console.error(`forEngageMagnet: arg resolved to null (moduleId=${String(o)})`);return}const a=kt(n,o);eb(a,!0)}function _E(e,t,r){const{robotState:n}=r,o=O(e.moduleId,t.runtimeParameters);if(o==null){console.error(`forDisengageMagnet: arg resolved to null (moduleId=${String(o)})`);return}const a=kt(n,o);eb(a,!1)}const qu=(e,t)=>{if(t==null)return console.error("expected to find defURI but could not in getLabwareByDefURI"),null;const r=e.findIndex(o=>o.labwareDefURI===t);if(r===-1)return null;const[n]=e.splice(r,1);return n.id},tb=(e,t,r,n)=>{const o=e.labwareInHopper??[];t.forEach(a=>{const{primaryLabwareId:s,adapterLabwareId:i,lidLabwareId:l}=a;r.labware[s]={stack:[s,...l!=null?[l]:[],...n]},i!=null&&(r.labware[i]={stack:[i,s,...l!=null?[l]:[],...n]}),l!=null&&(r.labware[l]={stack:[l,...n]}),o.push({primaryLabwareId:s,adapterLabwareId:i??null,lidLabwareId:l??null})}),e.labwareInHopper=o},rb=(e,t,r,n,o,a,s,i)=>{const u=Object.entries(e.labware).filter(([d,f])=>f[a]===t[a]).map(([d])=>d).map(d=>r[d]),p=[];for(let d=0;d<n;d++){const f=qu(u,t.storedLabwareDetails?.primaryLabwareURI),m=s!=null?qu(u,t.storedLabwareDetails?.adapterLabwareURI):null,h=i!=null?qu(u,t.storedLabwareDetails?.lidLabwareURI):null;f!=null&&(e.labware[f]={stack:[f,...h!=null?[h]:[],...o]},m!=null&&(e.labware[m]={stack:[m,f,...h!=null?[h]:[],...o]}),h!=null&&(e.labware[h]={stack:[h,...o]}),p.push({primaryLabwareId:f,adapterLabwareId:m,lidLabwareId:h})),t.labwareInHopper=p}},yE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=e.count==null?void 0:D(e.count,o);if(a==null||s===null){console.error(`forFlexStackerEmpty: arg resolved to null (moduleId=${String(a)}, count=${String(s)})`);return}const i=Object.entries(n.labware).filter(([,u])=>u.stack.includes(rt)&&u.stack.includes(a)),l=It(n,a);l!=null&&l.labwareInHopper!=null&&(s!=null?l.labwareInHopper=l.labwareInHopper.slice(0,s):l.labwareInHopper=[]),i.forEach(([u])=>{n.labware[u]={...n.labware[u],stack:[u,c.SYSTEM_LOCATION]}})},bE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a),i=e.labware.map(b=>O(b,a));if(s==null||i.some(b=>b==null)){console.error(`forFlexStackerFillItems: arg resolved to null (moduleId=${String(s)}, labware=${String(i)})`);return}const l=i,u=n.modules[s].slot,p=It(n,s);if(p==null||p.storedLabwareDetails==null)return;const{primaryLabwareURI:d,adapterLabwareURI:f,lidLabwareURI:m}=p.storedLabwareDetails,h=[];for(const b of l){const w=o[b].labwareDefURI;if(w===d)h.push({primaryLabwareId:b,adapterLabwareId:null,lidLabwareId:null});else if(w===f){const S=h[h.length-1];S&&(S.adapterLabwareId=b)}else if(w===m){const S=h[h.length-1];S&&(S.lidLabwareId=b)}}const _=[rt,s,u];for(const b of h){const w=[b.adapterLabwareId,b.primaryLabwareId,b.lidLabwareId,..._].filter(L=>L!=null);n.labware[b.primaryLabwareId]={...n.labware[b.primaryLabwareId],stack:w.slice(w.indexOf(b.primaryLabwareId))},b.adapterLabwareId!=null&&(n.labware[b.adapterLabwareId]={...n.labware[b.adapterLabwareId],stack:w.slice(w.indexOf(b.adapterLabwareId))}),b.lidLabwareId!=null&&(n.labware[b.lidLabwareId]={...n.labware[b.lidLabwareId],stack:w.slice(w.indexOf(b.lidLabwareId))});let S=null;for(const L of w)o[L]!=null&&(S==null?n.labware[L].stackedOnNode={kind:"inStackerHopper",moduleId:s}:n.labware[L].stackedOnNode={labwareId:S},S=L)}const y=p.labwareInHopper??[],I=h.map(({primaryLabwareId:b,adapterLabwareId:w,lidLabwareId:S})=>({primaryLabwareId:b,adapterLabwareId:w,lidLabwareId:S}));p.labwareInHopper=[...y,...I]},Vu=(e,t)=>{const r=O(e.loadName,t),n=O(e.namespace,t),o=D(e.version,t);return r==null||n==null||o==null?null:{loadName:r,namespace:n,version:o}},IE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a),i=Vu(e.primaryLabware,a),l=e.adapterLabware==null?null:Vu(e.adapterLabware,a),u=e.lidLabware==null?null:Vu(e.lidLabware,a),p=e.initialCount==null?void 0:D(e.initialCount,a);if(s==null||i==null||e.adapterLabware!=null&&l==null||e.lidLabware!=null&&u==null||p===null){console.error(`forFlexStackerSetStoredLabware: arg resolved to null (moduleId=${String(s)}, primaryLabware=${String(i)}, adapterLabware=${String(l)}, lidLabware=${String(u)}, initialCount=${String(p)})`);return}let d;if(p==null&&e.initialStoredLabware!=null){d=[];for(const _ of e.initialStoredLabware){const y=O(_.primaryLabwareId,a),I=_.adapterLabwareId==null?null:O(_.adapterLabwareId,a),b=_.lidLabwareId==null?null:O(_.lidLabwareId,a);if(y==null||_.adapterLabwareId!=null&&I==null||_.lidLabwareId!=null&&b==null){console.error(`forFlexStackerSetStoredLabware: arg resolved to null (primaryLabwareId=${String(y)}, adapterLabwareId=${String(I)}, lidLabwareId=${String(b)})`);return}d.push({primaryLabwareId:y,adapterLabwareId:I,lidLabwareId:b})}}const f=n.modules[s].slot,m=It(n,s),h=[rt,s,f];m!=null&&(m.storedLabwareDetails={primaryLabwareURI:`${i.namespace}/${i.loadName}/${i.version}`,adapterLabwareURI:l!=null?`${l.namespace}/${l.loadName}/${l.version}`:null,lidLabwareURI:u!=null?`${u.namespace}/${u.loadName}/${u.version}`:null},p!=null?rb(n,m,o,p,h,"setStoredLabwareCount",l?.loadName,u?.loadName):d!=null&&tb(m,d,n,h),m.setStoredLabwareCount=(m?.setStoredLabwareCount??0)+1)},TE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a),i=e.labware.map(T=>O(T,a));if(s==null||i.some(T=>T==null)){console.error(`forFlexStackerSetStoredLabwareItems: arg resolved to null (moduleId=${String(s)}, labware=${String(i)})`);return}const l=i,u=n.modules[s].slot,p=It(n,s);if(p==null)return;const d=l.map(T=>T.split(":")[1]),f=new Set(d),m=Array.from(f),h=m.find(T=>Object.values(o).find(A=>A.labwareDefURI===T&&!A.def.allowedRoles?.includes("lid")&&!A.def.allowedRoles?.includes("adapter"))),_=m.find(T=>Object.values(o).find(A=>A.labwareDefURI===T&&A.def.allowedRoles?.includes("adapter"))),y=m.find(T=>Object.values(o).find(A=>A.labwareDefURI===T&&A.def.allowedRoles?.includes("lid")));if(h==null)throw new Error(`expected to find primaryLabwareURI for storedLabwareDetails but could not with labware ${l}`);p.storedLabwareDetails={primaryLabwareURI:h,adapterLabwareURI:_??null,lidLabwareURI:y??null};const I=[];for(const T of l){const A=o[T].labwareDefURI;if(A===h)I.push({primary:T,adapter:null,lid:null});else if(A===_){const E=I[I.length-1];E&&(E.adapter=T)}else if(A===y){const E=I[I.length-1];E&&(E.lid=T)}}const b=[rt,s,u];for(const T of I){const A=[T.adapter,T.primary,T.lid,...b].filter(E=>E!=null);n.labware[T.primary]={...n.labware[T.primary],stack:A.slice(A.indexOf(T.primary))},T.adapter!=null&&(n.labware[T.adapter]={...n.labware[T.adapter],stack:A.slice(A.indexOf(T.adapter))}),T.lid!=null&&(n.labware[T.lid]={...n.labware[T.lid],stack:A.slice(A.indexOf(T.lid))})}const w=p.labwareInHopper??[],S=I.map(T=>({primaryLabwareId:T.primary,adapterLabwareId:T.adapter,lidLabwareId:T.lid})),L=new Map(w.map(T=>[T.primaryLabwareId,T])),g=[];for(const T of S)g.push(T),L.delete(T.primaryLabwareId);for(const T of w)L.has(T.primaryLabwareId)&&g.push(T);p.labwareInHopper=g},wE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a),i=e.count==null?void 0:D(e.count,a);if(s==null||i===null){console.error(`forFlexStackerFill: arg resolved to null (moduleId=${String(s)}, count=${String(i)})`);return}const l=n.modules[s].slot,u=It(n,s),p=[rt,s,l];if(u!=null){const d=u.storedLabwareDetails?.adapterLabwareURI,f=u.storedLabwareDetails?.lidLabwareURI;if(i!=null)rb(n,u,o,i,p,"fillCount",d,f);else if(e.labwareToStore!=null){const m=[];for(const h of e.labwareToStore){const _=O(h.primaryLabwareId,a),y=h.adapterLabwareId==null?null:O(h.adapterLabwareId,a),I=h.lidLabwareId==null?null:O(h.lidLabwareId,a);if(_==null||h.adapterLabwareId!=null&&y==null||h.lidLabwareId!=null&&I==null){console.error(`forFlexStackerFill: arg resolved to null (primaryLabwareId=${String(_)}, adapterLabwareId=${String(y)}, lidLabwareId=${String(I)})`);return}m.push({primaryLabwareId:_,adapterLabwareId:y,lidLabwareId:I})}tb(u,m,n,p)}u.fillCount=(u?.fillCount??0)+1}},SE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forFlexStackerRetrieve: arg resolved to null (moduleId=${String(a)})`);return}const s=It(n,a),i=n.modules[a].slot;if(s!=null){const{labwareInHopper:l,labwareOnShuttle:u}=s;if(l!=null&&l.length>0&&u==null){const p=l[0];s.labwareOnShuttle=p,l.shift();const d=[i];let f=null;for(const m of ar){const h=p[m];if(h!=null){if(d.unshift(h),n.labware[h].stack=[...d],f==null){const _=za(i);_!=null?n.labware[h].stackedOnNode={addressableAreaName:_}:console.warn(`Could not find an addressable area for retrieved labware in stacker module ${a} at slot ${i}`)}else n.labware[h].stackedOnNode={labwareId:f};f=h}}}}},gE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forFlexStackerStore: arg resolved to null (moduleId=${String(a)})`);return}const s=It(n,a),i=n.modules[a].slot;if(s!=null){const{labwareOnShuttle:l}=s;if(l!=null){s.labwareInHopper=[l,...s.labwareInHopper??[]],s.labwareOnShuttle=null;let u=null;for(const p of ar){const d=l[p];d!=null&&(n.labware[d].stack=[d,rt,a,i],u==null?(n.labware[d].stackedOnNode={kind:"inStackerHopper",moduleId:a},u=d):n.labware[d].stackedOnNode={labwareId:u})}s.storedLabwareDetails==null&&(s.storedLabwareDetails={primaryLabwareURI:t.labwareEntities[l.primaryLabwareId].labwareDefURI,adapterLabwareURI:l.adapterLabwareId!=null?t.labwareEntities[l.adapterLabwareId].labwareDefURI:null,lidLabwareURI:l.lidLabwareId!=null?t.labwareEntities[l.lidLabwareId].labwareDefURI:null})}}};function nb(e,t,r){e.type===c.TEMPERATURE_MODULE_TYPE&&(e.targetTemperature=t,e.status=r)}function EE(e,t,r){const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=D(e.celsius,o);if(a==null||s==null){console.error(`forSetTemperature: arg resolved to null (moduleId=${String(a)}, celsius=${String(s)})`);return}const i=kt(n,a);nb(i,s,Ec)}function AE(e,t,r){const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=D(e.celsius,o);if(a==null||s==null){console.error(`forAwaitTemperature: arg resolved to null (moduleId=${String(a)}, celsius=${String(s)})`);return}const i=kt(n,a);i.type===c.TEMPERATURE_MODULE_TYPE&&s===i.targetTemperature&&(i.status=gc)}function LE(e,t,r){const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forDeactivateTemperature: arg resolved to null (moduleId=${String(a)})`);return}const s=kt(n,a);nb(s,null,$o)}function ob(e,t,r){if(!e)throw new Error("undefined command passed to getNextRobotStateAndWarning");switch(e.commandType){case"aspirateWhileTracking":case"aspirate":case"aspirateInPlace":if(e.meta?.isAirGap===!0)break;MS(e.params,t,r);break;case"airGapInPlace":TS(e.params,t,r);break;case"dispenseWhileTracking":case"dispense":case"dispenseInPlace":if(e.meta?.isAirGap===!0)break;$S(e.params,t,r);break;case"blowout":FS(e.params,t,r);break;case"dropTip":{const{pipetteId:n,labwareId:o,wellName:a}=e.params;qS({pipette:n,dropTipLocation:o,wellName:a},t,r);break}case"pickUpTip":Fg(e.params,t,r);break;case"setTipState":$g(e.params,t,r);break;case"magneticModule/engage":hE(e.params,t,r);break;case"magneticModule/disengage":_E(e.params,t,r);break;case"moveLabware":Cg(e.params,t,r);break;case"waitForTasks":sE(e.params,t,r);break;case"flexStacker/setStoredLabware":IE(e.params,t,r);break;case"flexStacker/setStoredLabwareItems":TE(e.params,t,r);break;case"flexStacker/prepareShuttle":case"flexStacker/closeLatch":case"flexStacker/openLatch":break;case"flexStacker/empty":yE(e.params,t,r);break;case"flexStacker/fill":wE(e.params,t,r);break;case"flexStacker/fillItems":bE(e.params,t,r);break;case"flexStacker/retrieve":SE(e.params,t,r);break;case"flexStacker/store":gE(e.params,t,r);break;case"setRailLights":case"touchTip":case"configureForVolume":case"loadPipette":case"loadLabware":case"loadModule":case"home":case"moveRelative":case"moveToSlot":case"moveToCoordinates":case"savePosition":case"waitForResume":case"waitForDuration":case"pause":case"delay":case"custom":case"comment":case"captureImage":case"prepareToAspirate":case"liquidProbe":case"loadLiquidClass":case"loadLidStack":case"loadLid":case"getTipPresence":case"identifyModule":case"getNextTip":case"retractAxis":case"sealPipetteToTip":case"tryLiquidProbe":case"unsealPipetteFromTip":case"verifyTipPresence":case"pressureDispense":case"createTimer":break;case"moveToAddressableArea":case"moveToAddressableAreaForDropTip":Dg(e.params,t,r);break;case"moveToWell":Mg(e.params,t,r);break;case"loadLiquid":VS(e.params,t,r);break;case"dropTipInPlace":mE(e.params,t,r);break;case"blowOutInPlace":fE(e.params,t,r);break;case"configureNozzleLayout":US(e.params,t,r);break;case"temperatureModule/setTargetTemperature":EE(e.params,t,r);break;case"temperatureModule/deactivate":LE(e.params,t,r);break;case"temperatureModule/waitForTemperature":{const{moduleId:n,celsius:o}=e.params;o!=null&&AE({moduleId:n,celsius:o},t,r);break}case"thermocycler/setTargetBlockTemperature":qg(e.params,t,r);break;case"thermocycler/setTargetLidTemperature":Vg(e.params,t,r);break;case"thermocycler/waitForBlockTemperature":Bg(e.params);break;case"thermocycler/waitForLidTemperature":xg(e.params);break;case"thermocycler/deactivateBlock":Hg(e.params,t,r);break;case"thermocycler/deactivateLid":jg(e.params,t,r);break;case"thermocycler/closeLid":Wg(e.params,t,r);break;case"thermocycler/openLid":Gg(e.params,t,r);break;case"thermocycler/runProfile":Kg(e.params,t,r);break;case"thermocycler/runExtendedProfile":Xy(e.params,t,r);break;case"thermocycler/startRunExtendedProfile":Qy(e.params,t,r);break;case"thermocycler/awaitProfileComplete":zg(e.params);break;case"heaterShaker/deactivateHeater":lE(e.params,t,r);break;case"heaterShaker/setTargetTemperature":iE(e.params,t,r);break;case"heaterShaker/setAndWaitForShakeSpeed":case"heaterShaker/setShakeSpeed":uE(e.params,t,r);break;case"heaterShaker/deactivateShaker":cE(e.params,t,r);break;case"heaterShaker/openLabwareLatch":pE(e.params,t,r);break;case"heaterShaker/closeLabwareLatch":dE(e.params,t,r);break;case"heaterShaker/waitForTemperature":break;case"absorbanceReader/openLid":yS(e.params,t,r);break;case"absorbanceReader/closeLid":bS(e.params,t,r);break;case"absorbanceReader/initialize":IS(e.params,t,r);break;case"absorbanceReader/read":break;case"vacuumModule/startSetVacuumPressure":tE(e.params,t,r);break;case"vacuumModule/startSetVacuumPower":rE(e.params,t,r);break;case"vacuumModule/openVent":Jg(e.params,t,r);break;case"vacuumModule/closeVent":eE(e.params,t,r);break;case"vacuumModule/stopVacuum":nE(e.params,t,r);break;case"vacuumModule/startRunProfile":oE({moduleId:e.params.moduleId,profile:e.params.steps,ventAfter:e.params.ventAfter??!0,taskId:e.params.taskId},t,r);break;default:console.error(`unknown command: ${e.commandType} passed to getNextRobotStateAndWarning`)}}function ab(e,t,r){return qy({warnings:[],robotState:r},o=>{ob(e,t,o)})}function Ip(e,t,r){const n=Vy(e);return qy({warnings:[],robotState:r},a=>{n.forEach(s=>{ob(s,t,a)})})}const OE=(e,t,r)=>{const n=e.reduce((o,a,s)=>{const i=o.timeline.length===0?r:sp(o.timeline).robotState;if(o.errors!=null)return o;const l=a(t,i);if("errors"in l)return{timeline:o.timeline,errors:l.errors};const p=Vy(l.commands).reduce((f,m)=>ab(m,t,f.robotState),{robotState:i,warnings:[]}),d={commands:l.commands,robotState:p.robotState,warnings:l.warnings,stepInfo:{stepNumber:l.stepNumber,name:l.name,description:l.description},python:l.python};return{timeline:[...o.timeline,d],errors:null}},{timeline:[],errors:null});return{timeline:n.timeline,errors:n.errors}},Wn=(e,t)=>{const r=t[e]?.stack;return r!=null?ee(r):""},Gn=e=>{if(e.type===c.VACUUM_MODULE_TYPE){const t=e;return t.currentPumpActivity.type==="timedHold"||t.currentPumpActivity.type==="profile"}if(e.type===c.THERMOCYCLER_MODULE_TYPE){const t=e;return t.currentBlockActivity.type==="profile"||t.currentBlockActivity.type==="blockTargetTemp"}return!1},Yn=e=>{const{pipette:t,labware:r,invariantContext:n,prevRobotState:o}=e;if(n.config.OT_PD_DISABLE_MODULE_RESTRICTIONS)return!1;const a=t?n.pipetteEntities[t]:null,s=r?ee(o.labware[r]?.stack):null;if(!t||!r||!a||!s)return!1;const i=Object.keys(n.moduleEntities).some(l=>{const u=n.moduleEntities[l].model;if(Yh.includes(u)){const p=o.modules[l]?.slot;return p==="1"&&s==="4"||p==="3"&&s==="6"}else return!1});return c.GEN_ONE_MULTI_PIPETTES.includes(a.name)&&i},pe=(e,t,r)=>{const n=e.reduce((o,a)=>{if(o.errors.length>0)return o;const s=a(t,o.robotState);if("errors"in s)return{robotState:o.robotState,commands:o.commands,errors:s.errors,warnings:o.warnings};const i=[...o.commands,...s.commands],l=[...o.python?[o.python]:[],...s.python?[s.python]:[]].join(`
|
|
55
|
-
`),u=Ip(s.commands,t,o.robotState);return{...o,robotState:u.robotState,commands:i,warnings:[...o.warnings||[],...s.warnings||[],...u.warnings],...l&&{python:l}}},{robotState:r,commands:[],errors:[],warnings:[]});return n.errors.length>0?{errors:n.errors}:{commands:n.commands,warnings:n.warnings,...n.python&&{python:n.python}}},Xo=(e,t,r)=>{const n=Go(e,t[r]?.stack),o=n&&e[n].moduleState;return!!(o&&o.type===c.THERMOCYCLER_MODULE_TYPE&&o.lidOpen!==!0)},vE=e=>e.commandCreatorFnName!=="delay"&&e.commandCreatorFnName!=="engageMagnet"&&e.commandCreatorFnName!=="disengageMagnet"&&e.commandCreatorFnName!=="setTemperature"&&e.commandCreatorFnName!=="deactivateTemperature"&&"pipette"in e?e.pipette:null,PE=e=>e.commandCreatorFnName==="delay"||e.commandCreatorFnName==="engageMagnet"||e.commandCreatorFnName==="disengageMagnet"||e.commandCreatorFnName==="setTemperature"||e.commandCreatorFnName==="deactivateTemperature",RE=new Date("2025-03-19T00:00:00Z"),NE=2,kE=22;function CE(e,t,r){const{labware:n,modules:o,pipettes:a,commands:s,liquids:i}=e,l=t.protocolType==="python"?t.apiVersion:null,u=l!=null&&l[0]>=NE&&l[1]>=kE,p=t.protocolType==="json"&&r>=RE,d=c.getLabwareDefinitionsByURIForProtocol(s),f=i.reduce((b,w)=>{const{id:S,description:L,displayName:g,displayColor:T}=w;return{...b,[S]:{description:L,displayName:g??"Unknown Liquid",pythonName:"n/a",displayColor:T??"#B7B8B9",liquidGroupId:S}}},{}),m=o.reduce((b,w)=>{const{id:S,model:L}=w;return{...b,[S]:{id:S,type:c.getModuleType(L),model:L,pythonName:"n/a"}}},{}),h=n.reduce((b,w)=>{const{id:S,definitionUri:L}=w,g=d[L];return g==null||g.schemaVersion===3?b:{...b,[S]:{id:S,labwareDefURI:L,def:g,pythonName:"n/a"}}},{}),_=s.reduce((b,w)=>{if(w.commandType==="loadLidStack"&&w.result!=null){const{stackLabwareId:S,lidStackDefinition:L}=w.result;if(S!=null&&L!=null&&b[S]==null&&L.schemaVersion!==3)return{...b,[S]:{id:S,labwareDefURI:c.getLabwareDefURI(L),def:L,pythonName:"n/a"}}}return b},h),y=a.reduce((b,w)=>{const{id:S,pipetteName:L}=w,g=c.getPipetteSpecsV2(L),A=s.filter(R=>R.commandType==="pickUpTip"&&R.params.pipetteId===S).map(R=>_[R.params.labwareId]),E=Array.from(new Set(A.map(R=>R.labwareDefURI))),v=Array.from(new Set(A.map(R=>R.def)));return g==null||(b[S]={name:L,id:S,tiprackLabwareDef:v,tiprackDefURI:E,spec:g,pythonName:"n/a"}),b},{}),I=s.reduce((b,w)=>{if(w.commandType==="loadLidStack"&&w.result!=null){const{params:S}=w,L=cc(S);return{...b,stagingAreaEntities:{...b.stagingAreaEntities,...L}}}else if((w.commandType==="loadLabware"||w.commandType==="loadLid")&&w.result!=null){const{params:S}=w,L=cc(S);return{...b,stagingAreaEntities:{...b.stagingAreaEntities,...L}}}else if(w.commandType==="moveToAddressableArea"||w.commandType==="moveToAddressableAreaForDropTip"){const S=w.params.addressableAreaName,L=`${U()}:${S}`;let g=o_;S==="fixedTrash"?g="cutout12":S.includes("WasteChute")?g="cutoutD3":S.includes("movableTrash")&&(g=`cutout${S.split("movableTrash")[1]}`);let T=b.trashBinEntities;Object.values(b.trashBinEntities).some(E=>E.location===g)||(S.includes("movableTrash")?T={...b.trashBinEntities,[L]:{pythonName:"trash_bin_1",id:L,location:g}}:S==="fixedTrash"&&(T={...b.trashBinEntities,[L]:{pythonName:"trash_bin_1",id:L,location:g}}));let A=b.wasteChuteEntities;return S.includes("WasteChute")&&(A={[L]:{pythonName:"waste_chute",id:L,location:g}}),{...b,trashBinEntities:T,wasteChuteEntities:A}}return b},{wasteChuteEntities:{},trashBinEntities:{},stagingAreaEntities:{},runtimeParameters:{},gripperEntities:{},config:{OT_PD_DISABLE_MODULE_RESTRICTIONS:!0}});return{labwareEntities:_,pipetteEntities:y,moduleEntities:m,liquidEntities:u||p?f:{},...I}}const DE={A3:"A4",B3:"B4",C3:"C4",D3:"D4"};function ME(e,t){const r=e.reduce((s,i)=>i.commandType==="loadPipette"&&i.result!=null?{...s,[i.result.pipetteId]:{mount:i.params.mount}}:s,{}),n=e.reduce((s,i)=>{if(i.commandType==="loadModule"&&i.result!=null){const l=c.getModuleDef(i.params.model).moduleType;return{...s,[i.result.moduleId]:{slot:l===c.FLEX_STACKER_MODULE_TYPE?DE[i.params.location.slotName]:i.params.location.slotName,moduleState:n_[l]}}}return s},{}),o=e.reduce((s,i)=>{if(i.commandType==="loadLidStack"&&i.result!=null){const{result:l}=i,u=l.locationSequences,p=l.labwareIds,d=l.stackLabwareId,f=l.stackLocationSequence,m=h=>{if(c.locationIsOffDeck(h))return[h];if("slotName"in h)return[h.slotName];if("moduleId"in h){const _=n[h.moduleId]?.slot??"offDeck";return[h.moduleId,_]}else if("addressableAreaName"in h)return[h.addressableAreaName];return["offDeck"]};if(u!=null){const h=u.reduce((I,b)=>{const w=b.find(S=>S.kind==="onLabware");return w!=null&&(I[w.labwareId]=b),I},{}),_=p.reduce((I,b,w)=>{const S=h[b]??u[w];if(S!=null){const L=uc(S);I[b]={stack:L[0]===b?L:[b,...L]}}else{const L=i.params.location;c.locationIsOffDeck(L)?I[b]={stack:[b,L]}:"slotName"in L?I[b]={stack:[b,L.slotName]}:I[b]={stack:[b,"offDeck"]}}return I},{}),y=d!=null&&f!=null?[d,...uc(f)]:null;return{...s,..._,...d!=null&&y!=null?{[d]:{stack:y}}:{}}}else{const h=i.params.location,_=p.reduce((I,b)=>{if(c.locationIsOffDeck(h))I[b]={stack:[b,h]};else if("slotName"in h)I[b]={stack:[b,h.slotName]};else if("moduleId"in h){const w=h.moduleId;I[b]={stack:[b,w,n[w].slot]}}else I[b]={stack:[b,"offDeck"]};return I},{}),y=d!=null?[d,...m(h)]:null;return{...s,..._,...d!=null&&y!=null?{[d]:{stack:y}}:{}}}}else if((i.commandType==="loadLabware"||i.commandType==="loadLid")&&i.result!=null){const l=[i.result.labwareId];if(c.locationIsOffDeck(i.params.location))l.push(i.params.location);else if("slotName"in i.params.location)l.push(i.params.location.slotName);else if("moduleId"in i.params.location){const u=i.params.location.moduleId;if(n[u]==null)return console.warn(`Module ${u} not found when processing loadLabware/loadLid command. `),s;l.push(i.params.location.moduleId,n[i.params.location.moduleId].slot)}else if("labwareId"in i.params.location){const u=i.params.location.labwareId;s[u]==null&&(console.warn(`Parent labware ${u} not found when processing loadLabware/loadLid command. `),s[u]={stack:[u,"offDeck"]});const p=s[u].stack;l.push(u,...p)}else l.push(i.params.location.addressableAreaName);return{...s,[i.result.labwareId]:{stack:l}}}else{if(i.commandType==="flexStacker/setStoredLabware")return Ih(i).forEach(u=>{bh(s,u,"setStoredLabwareCount")}),s;if(i.commandType==="flexStacker/fill")return Ih(i).forEach(u=>{bh(s,u,"fillCount")}),s}return s},{}),a=ep({invariantContext:t,labwareLocations:o,moduleLocations:n,pipetteLocations:r});return{frame:{...Ip(e,t,a),command:e[e.length-1]},invariantContext:t}}const bh=(e,t,r)=>{const n=e[t]??{stack:[t,"offDeck"]};e[t]={...n,[r]:(n[r]??0)+1}},Ih=e=>e.result?.storedLabware?.flatMap(r=>[r.primaryLabwareId,r.adapterLabwareId,r.lidLabwareId].filter(n=>n!=null))??[],Tp=(e,t)=>e??(t.channels===1?c.SINGLE:t.channels===96?c.ALL:c.COLUMN);var Bu,Th;function FE(){if(Th)return Bu;Th=1;var e=qc();function t(r,n){var o;return e(r,function(a,s,i){return o=n(a,s,i),!o}),!!o}return Bu=t,Bu}var xu,wh;function UE(){if(wh)return xu;wh=1;var e=y_(),t=Bn(),r=FE(),n=nt(),o=Bc();function a(s,i,l){var u=n(s)?e:r;return l&&o(s,i,l)&&(i=void 0),u(s,t(i,3))}return xu=a,xu}var $E=UE();const Qo=Ye($E),Kn=(e,t)=>Qo(e,r=>r.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&r.moduleState.latchOpen!==!1&&c.getAreSlotsHorizontallyAdjacent(r.slot,t)),Zn=(e,t,r)=>r.channels!==1&&Qo(e,n=>n.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsHorizontallyAdjacent(n.slot,t)),Jo=(e,t,r,n)=>r.channels!==1&&!n.def.parameters.isTiprack&&Qo(e,o=>o.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsVerticallyAdjacent(o.slot,t)),sb=(e,t,r)=>Qo(e,(o,a)=>c.getAreSlotsHorizontallyAdjacent(r,ee(o.stack))&&c.getIsLabwareAboveHeight(t[a].def,c.MAX_LABWARE_HEIGHT_EAST_WEST_HEATER_SHAKER_MM)),ea=(e,t,r)=>{const n=Go(e,t[r]?.stack),o=n!=null?e[n].moduleState:null;return!!(o&&o.type===c.HEATERSHAKER_MODULE_TYPE&&o.latchOpen!==!1)},Xn=(e,t,r)=>Qo(e,n=>n.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&n.moduleState.targetSpeed!=null&&n.moduleState.targetSpeed>0&&(r===c.OT2_ROBOT_TYPE?c.getAreSlotsAdjacent(n.slot,t):c.getAreFlexSlotsAdjacent(n.slot,t))),ta=(e,t,r)=>{const n=Go(e,t[r]?.stack),o=n!=null?e[n].moduleState:null;return!!(o&&o.type===c.HEATERSHAKER_MODULE_TYPE&&o.targetSpeed!==null)},Za=e=>{const{args:t,pipetteName:r,tiprackUri:n,liquidClassValuesForTip:o}=e;let a=null;"mixBeforeAspirate"in t?a=t.mixBeforeAspirate:"mixFirstAspirate"in t&&(a=t.mixFirstAspirate);const s=qE(t),i={dispense_position:{offset:{x:t.dispenseXOffset,y:t.dispenseYOffset,z:t.dispenseZOffset},position_reference:t.dispensePositionReference},flow_rate_by_volume:[[0,t.dispenseFlowRateUlSec??0]],delay:{enabled:!!t.dispenseDelay?.seconds,...t.dispenseDelay?.seconds?{duration:t.dispenseDelay?.seconds}:{}},submerge:{delay:{enabled:!!t.dispenseSubmergeDelay?.seconds,...t.dispenseSubmergeDelay?.seconds?{duration:t.dispenseSubmergeDelay?.seconds}:{}},speed:t.dispenseSubmergeSpeed??void 0,start_position:{offset:{x:t.dispenseSubmergeXOffset,y:t.dispenseSubmergeYOffset,z:t.dispenseSubmergeZOffset},position_reference:t.dispenseSubmergePositionReference}},retract:{air_gap_by_volume:[[0,t.dispenseAirGapVolume??0]],delay:{enabled:!!t.dispenseRetractDelay?.seconds,...t.dispenseRetractDelay?.seconds?{duration:t.dispenseRetractDelay?.seconds}:{}},end_position:{offset:{x:t.dispenseRetractXOffset,y:t.dispenseRetractYOffset,z:t.dispenseRetractZOffset},position_reference:t.dispenseRetractPositionReference},speed:t.dispenseRetractSpeed??void 0,touch_tip:{enabled:t.touchTipAfterDispense,z_offset:t.touchTipAfterDispense?t.touchTipAfterDispenseOffsetMmFromTop:void 0,mm_from_edge:t.touchTipAfterDispense&&t.touchTipAfterDispenseMmFromEdge!=null?t.touchTipAfterDispenseMmFromEdge:void 0,speed:t.touchTipAfterDispense?t.touchTipAfterDispenseSpeed:void 0},blowout:{enabled:t.blowoutLocation!=null,location:ib(t.blowoutLocation),flow_rate:t.blowoutLocation!=null?t.blowoutFlowRateUlSec:void 0,...s!=null?{blowout_position:s}:{}}}},l={[r]:{[n]:{aspirate:{aspirate_position:{offset:{x:t.aspirateXOffset,y:t.aspirateYOffset,z:t.aspirateZOffset},position_reference:t.aspiratePositionReference},flow_rate_by_volume:[[0,t.aspirateFlowRateUlSec]],pre_wet:t.preWetTip,correction_by_volume:o?.aspirate.correctionByVolume??[[0,0]],delay:{enabled:!!t.aspirateDelay?.seconds,...t.aspirateDelay?.seconds?{duration:t.aspirateDelay?.seconds}:{}},mix:{enabled:!!a?.volume,...a?.times?{repetitions:a.times}:{},...a?.volume?{volume:a.volume}:{}},submerge:{delay:{enabled:!!t.aspirateSubmergeDelay?.seconds,...t.aspirateSubmergeDelay?.seconds?{duration:t.aspirateSubmergeDelay?.seconds}:{}},speed:t.aspirateSubmergeSpeed??void 0,start_position:{offset:{x:t.aspirateSubmergeXOffset,y:t.aspirateSubmergeYOffset,z:t.aspirateSubmergeZOffset},position_reference:t.aspirateSubmergePositionReference}},retract:{air_gap_by_volume:[[0,t.aspirateAirGapVolume??0]],delay:{enabled:!!t.aspirateRetractDelay?.seconds,...t.aspirateRetractDelay?.seconds?{duration:t.aspirateRetractDelay?.seconds}:{}},end_position:{offset:{x:t.aspirateRetractXOffset,y:t.aspirateRetractYOffset,z:t.aspirateRetractZOffset},position_reference:t.aspirateRetractPositionReference},speed:t.aspirateRetractSpeed??void 0,touch_tip:{enabled:t.touchTipAfterAspirate,z_offset:t.touchTipAfterAspirate?t.touchTipAfterAspirateOffsetMmFromTop:void 0,mm_from_edge:t.touchTipAfterAspirate&&t.touchTipAfterAspirateMmFromEdge!=null?t.touchTipAfterAspirateMmFromEdge:void 0,speed:t.touchTipAfterAspirate?t.touchTipAfterAspirateSpeed:void 0}}},dispense:{...i,correction_by_volume:o?.singleDispense.correctionByVolume??[[0,0]],push_out_by_volume:[[0,t.pushOut??0]],mix:{enabled:"mixInDestination"in t?t.mixInDestination!=null:!1,repetitions:"mixInDestination"in t?t.mixInDestination?.times??void 0:void 0,volume:"mixInDestination"in t?t.mixInDestination?.volume??void 0:void 0}},...t.commandCreatorFnName==="distribute"?{multi_dispense:{...i,correction_by_volume:o?.multiDispense?.correctionByVolume??[[0,0]],..."conditioningVolume"in t?{conditioning_by_volume:[[0,t.conditioningVolume??0]]}:{},..."disposalVolume"in t?{disposal_by_volume:[[0,t.disposalVolume??0]]}:{}}}:{}}}},u=JSON.parse(JSON.stringify(l));return zr(u)},ra=(e,t)=>`${c.getAllLiquidClassDefs()[e].liquidClassName}${t?"_base_class":""}`,ib=e=>{if(e!=null)return e===Xr?"source":e===zn?"destination":"trash"},qE=e=>{const t=ib(e.blowoutLocation);return!t||t==="trash"?null:{offset:{x:e.blowoutXPosition??0,y:e.blowoutYPosition??0,z:e.blowoutOffsetFromTopMm??1},position_reference:e.blowoutPositionReference??c.POSITION_REFERENCE_TOP}},Xa=e=>{const{labwareEntities:t,tiprackIds:r}=e;return`tip_racks=[${r.map(o=>t[o].pythonName).join(", ")}]`};var zu,Sh;function VE(){if(Sh)return zu;Sh=1;var e="Expected a function";function t(r){if(typeof r!="function")throw new TypeError(e);return function(){var n=arguments;switch(n.length){case 0:return!r.call(this);case 1:return!r.call(this,n[0]);case 2:return!r.call(this,n[0],n[1]);case 3:return!r.call(this,n[0],n[1],n[2])}return!r.apply(this,n)}}return zu=t,zu}var Hu,gh;function BE(){if(gh)return Hu;gh=1;var e=pp(),t=qn(),r=Ma(),n=pr(),o=Vn();function a(s,i,l,u){if(!n(s))return s;i=t(i,s);for(var p=-1,d=i.length,f=d-1,m=s;m!=null&&++p<d;){var h=o(i[p]),_=l;if(h==="__proto__"||h==="constructor"||h==="prototype")return s;if(p!=f){var y=m[h];_=u?u(y,h,m):void 0,_===void 0&&(_=n(y)?y:r(i[p+1])?[]:{})}e(m,h,_),m=m[h]}return s}return Hu=a,Hu}var ju,Eh;function xE(){if(Eh)return ju;Eh=1;var e=Ua(),t=BE(),r=qn();function n(o,a,s){for(var i=-1,l=a.length,u={};++i<l;){var p=a[i],d=e(o,p);s(d,p)&&t(u,r(p,o),d)}return u}return ju=n,ju}var Wu,Ah;function zE(){if(Ah)return Wu;Ah=1;var e=Bo(),t=Bn(),r=xE(),n=mp();function o(a,s){if(a==null)return{};var i=e(n(a),function(l){return[l]});return s=t(s),r(a,i,function(l,u){return s(l,u[0])})}return Wu=o,Wu}var Gu,Lh;function HE(){if(Lh)return Gu;Lh=1;var e=Bn(),t=VE(),r=zE();function n(o,a){return r(o,t(e(a)))}return Gu=n,Gu}var jE=HE();const WE=Ye(jE);function lb(e){return Object.keys(e.wells)}const GE=(e,t)=>{const r=Object.keys(e||{}).filter(n=>e[n]&&e[n].volume>0);return{wellName:t,groupIds:r,ingreds:WE(e,n=>!n||n.volume<=0)}},YE=(e,t)=>{const r=lb(t);return mt(r,(n,o)=>{const a=e&&e[o];return{...n,[o]:a?GE(e[o],o):{}}},{})},KE=(e,t)=>{const r={};return t.forEach(n=>{const o=e!=null?Object.values(e).reduce((a,s)=>{if(s.groupIds.indexOf(n)!==-1){const l=s.ingreds[n];l?.volume!=null&&(a[s.wellName??"A1"]=l.volume)}return a},{}):{};r[n]=o}),r},ZE=e=>{const t=e.flatMap(r=>r==null?[]:Object.values(r).flatMap(n=>n.groupIds.filter(o=>o!==Ke)));return Array.from(new Set(t))},XE=e=>{const t=e!=null?Object.values(e).flatMap(r=>r.groupIds)?.filter(r=>r!==Ke):[];return Array.from(new Set(t))},ub="#737578",cb=e=>{const t=Number(e);return Number.isInteger(t)?c.DEFAULT_LIQUID_COLORS[t%c.DEFAULT_LIQUID_COLORS.length]:(e!==Ke&&console.warn(`swatchColors expected an integer or ${Ke}, got ${e}`),"transparent")},QE=(e,t)=>{const r=e.filter(n=>n!==Ke);return r.length===0?null:r.length===1?t[r[0]]??cb(r[0]):ub},JE=(e,t)=>mt(e,(r,n,o)=>{const a=QE(n.groupIds,t);return a?{...r,[o]:a}:r},{});var Yu,Oh;function eA(){if(Oh)return Yu;Oh=1;function e(t,r){return t>r}return Yu=e,Yu}var Ku,vh;function tA(){if(vh)return Ku;vh=1;var e=Gh(),t=eA(),r=Uo();function n(o){return o&&o.length?e(o,r,t):void 0}return Ku=n,Ku}var rA=tA();const nA=Ye(rA),pb="2.31",oA="9.0.1";function aA(){return["import json","from opentrons import protocol_api, types"].join(`
|
|
54
|
+
`]:[]],f=`${ge}.home(${d.join(", ")})`;return{commands:[u],python:f}},Bw=(e,t,r)=>{const{pipetteEntities:n,runtimeParameters:o}=t,a=O(e.pipetteId,o),s=O(e.axis,o),i=D(e.distance,o),l=[];if(a==null&&l.push(C({parameterName:e.pipetteId})),s==null&&l.push(C({parameterName:e.axis})),typeof e.distance=="string"&&i==null&&l.push(C({parameterName:e.distance})),l.length>0||a==null||s==null||i==null)return{errors:l};const u=n[a].pythonName,p=o[e.axis]!=null?e.axis:q(s),d=[{commandType:"moveRelative",key:$(),params:{pipetteId:a,axis:s,distance:i}}],f=[`axis=${p}`,`distance=${e.distance}`];return{commands:d,python:`${u}.move_axes_relative(${f.join(", ")})`}},xw=(e,t,r)=>{const{pipetteEntities:n,runtimeParameters:o}=t,{coordinates:a}=e,s=O(e.pipetteId,o),i=D(a.x,o),l=D(a.y,o),u=D(a.z,o),p=e.minimumZHeight==null?void 0:D(e.minimumZHeight,o),d=e.forceDirect==null?void 0:je(e.forceDirect,o),f=[];if(s==null&&f.push(C({parameterName:e.pipetteId})),typeof a.x=="string"&&i==null&&f.push(C({parameterName:a.x})),typeof a.y=="string"&&l==null&&f.push(C({parameterName:a.y})),typeof a.z=="string"&&u==null&&f.push(C({parameterName:a.z})),typeof e.minimumZHeight=="string"&&p==null&&f.push(C({parameterName:e.minimumZHeight})),typeof e.forceDirect=="string"&&d==null&&f.push(C({parameterName:e.forceDirect})),f.length>0||s==null||i==null||l==null||u==null)return{errors:f};const m=n[s].pythonName,h=[`coordinates=(${a.x}, ${a.y}, ${a.z})`];return typeof e.forceDirect=="string"?h.push(`force_direct=${e.forceDirect}`):e.forceDirect&&h.push("force_direct=True"),e.minimumZHeight&&h.push(`minimum_z_height=${e.minimumZHeight}`),{commands:[{commandType:"moveToCoordinates",key:$(),params:{pipetteId:s,coordinates:{x:i,y:l,z:u},minimumZHeight:p??void 0,forceDirect:d??void 0}}],python:`${m}.move_axes_to(${h.join(", ")})`}},zw=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=O(e.labwareId,n),s=O(e.wellName,n),i=e.wellLocation?.origin,l=i==null?void 0:O(i,n),u=e.wellLocation?.offset,p=u?.x==null?void 0:D(u.x,n),d=u?.y==null?void 0:D(u.y,n),f=u?.z==null?void 0:D(u.z,n),m=[];for(const[b,w]of[[e.pipetteId,o],[e.labwareId,a],[e.wellName,s]])w==null&&m.push(C({parameterName:b}));i!=null&&l==null&&m.push(C({parameterName:i}));for(const[b,w]of[[u?.x,p],[u?.y,d],[u?.z,f]])typeof b=="string"&&w==null&&m.push(C({parameterName:b}));if(m.length>0||o==null||a==null||s==null)return{errors:m};const h=t.pipetteEntities[o].pythonName,_=t.labwareEntities[a].pythonName;let y;e.wellLocation!=null&&(y={},l!=null&&(y.origin=l),u!=null&&(y.offset={},p!=null&&(y.offset.x=p),d!=null&&(y.offset.y=d),f!=null&&(y.offset.z=f)));const I=n[e.wellName]!=null?e.wellName:q(s);return{commands:[{commandType:"tryLiquidProbe",key:$(),params:{pipetteId:o,labwareId:a,wellName:s,wellLocation:y}}],python:`${h}.detect_liquid_presence(${_}[${I}])`}},oy=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[o].pythonName;return{commands:[{commandType:"heaterShaker/closeLabwareLatch",key:$(),params:{moduleId:o}}],python:`${a}.close_labware_latch()`}},ic=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[o].pythonName;return{commands:[{commandType:"heaterShaker/deactivateHeater",key:$(),params:{moduleId:o}}],python:`${a}.deactivate_heater()`}},Hw=["1","4","7","10"],ay=(e,t,r)=>{const{pipetteEntities:n,labwareEntities:o,moduleEntities:a,runtimeParameters:s}=t,i=O(e.moduleId,s);if(i==null)return{errors:[C({parameterName:e.moduleId})]};const l=r.modules[i].slot,u=Object.keys(n)[0],p=n[u]?.spec;if(!((p?.displayCategory==="FLEX"||p?.channels===96)??!1)&&sb(r.labware,o,l)){const m=Hw.includes(l)?"right":"left";return{errors:[_I(m)]}}const f=a[i].pythonName;return{commands:[{commandType:"heaterShaker/openLabwareLatch",key:$(),params:{moduleId:i}}],python:`${f}.open_labware_latch()`}},sy=(e,t,r)=>{const{moduleEntities:n,runtimeParameters:o}=t,a=O(e.moduleId,o),s=D(e.rpm,o),i=[];if(a==null&&i.push(C({parameterName:e.moduleId})),typeof e.rpm=="string"&&s==null&&i.push(C({parameterName:e.rpm})),i.length>0||a==null||s==null)return{errors:i};if(n[a]?.type!==c.HEATERSHAKER_MODULE_TYPE)throw new Error(`expected module ${a} to be heaterShaker, got ${n[a]?.type}`);const l=n[a].pythonName;return{commands:[{commandType:"heaterShaker/setAndWaitForShakeSpeed",key:$(),params:{moduleId:a,rpm:s}}],python:`${l}.set_and_wait_for_shake_speed(${e.rpm})`}},lc=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null)return{errors:[C({parameterName:e.moduleId})]};const a=t.moduleEntities[o].pythonName;return{commands:[{commandType:"heaterShaker/deactivateShaker",key:$(),params:{moduleId:o}}],python:`${a}.deactivate_shaker()`}},Zc=(e,t,r)=>{const{moduleEntities:n,labwareEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a);if(s==null)return{errors:[C({parameterName:e.moduleId})]};const i=[],l=n[s].pythonName,p=Object.values(r.labware).filter(m=>m.stack.includes(s)).find(m=>m.stack.find(h=>o[h]?.def.allowedRoles?.includes("lid")&&o[h]?.def.parameters.loadName!=="opentrons_tough_pcr_auto_sealing_lid")),d=p!=null?xa(p.stack):null,f=d!=null?o[d].def.metadata.displayName:null;return f!=null&&i.push(AI({lidDisplayName:f})),i.length>0?{errors:i}:{commands:[{commandType:"thermocycler/closeLid",key:$(),params:{moduleId:s}}],python:`${l}.close_lid()`}},iy=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/deactivateBlock",key:$(),params:{moduleId:n}}],python:`${o}.deactivate_block()`}},ly=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/deactivateLid",key:$(),params:{moduleId:n}}],python:`${o}.deactivate_lid()`}},uy=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null)return{errors:[C({parameterName:e.moduleId})]};const o=t.moduleEntities[n].pythonName;return{commands:[{commandType:"thermocycler/openLid",key:$(),params:{moduleId:n}}],python:`${o}.open_lid()`}},cy=(e,t,r)=>{e.celsius!==void 0&&console.warn("'volume' param not implemented for thermocycler/setTargetBlockTemperature, should not be set!");const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=D(e.celsius,n),s=[];if(o==null&&s.push(C({parameterName:e.moduleId})),typeof e.celsius=="string"&&a==null&&s.push(C({parameterName:e.celsius})),o==null||a==null)return{errors:s};const i=t.moduleEntities[o].pythonName;return{commands:[{commandType:"thermocycler/setTargetBlockTemperature",key:$(),params:{moduleId:o,celsius:a}}],python:`${i}.set_block_temperature(${e.celsius})`}},Xc=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=D(e.celsius,n),s=[];if(o==null&&s.push(C({parameterName:e.moduleId})),typeof e.celsius=="string"&&a==null&&s.push(C({parameterName:e.celsius})),o==null||a==null)return{errors:s};const i=t.moduleEntities[o].pythonName;return{commands:[{commandType:"thermocycler/setTargetLidTemperature",key:$(),params:{moduleId:o,celsius:a}}],python:`${i}.set_lid_temperature(${e.celsius})`}};function P(e,t){return(r,n)=>e(t,r,n)}function N(e,t){return(r,n)=>{const o=e(t,r,n);if("python"in o){const{python:a,...s}=o;return s}return o}}const Ke="__air__",Xr="source_well",zn="dest_well";function py(e){return u_.includes(e.parameters.loadName)}function Eo(e){return(e.parameters.quirks??[]).includes("vacuumSpacer")}function dy(e){return(e.parameters.quirks??[]).includes("vacuumSpacerSeat")}const fy=(e,t)=>e.filter(r=>r in t&&Eo(t[r].def)).map(r=>t[r].def.parameters.loadName),my=(e,t,r)=>{if(!Eo(e))return{isCompatible:!1,isAboveStackLimit:!1};if(t.length===0)return{isCompatible:!0,isAboveStackLimit:!1};const n=fy(t,r),o=xa(t);if(!(o in r))return{isCompatible:!0,isAboveStackLimit:!1};const a=r[o].def;if(!Eo(a)||dy(a))return{isCompatible:!1,isAboveStackLimit:!1};const s=e.parameters.loadName,i=a.parameters.loadName,l=n.includes(s),u=n.length>=c_,p=e.compatibleParentLabware?.includes(i)??!1,d=i in(e.stackingOffsetWithLabware??{}),f=p||d,m=l||u;return{isCompatible:f&&!m,isAboveStackLimit:m}},jw=e=>(e.parameters.quirks??[]).includes("vacuumModuleDock"),hy=(e,t,r)=>{const a=c.getDeckDefFromRobotType(r).cutoutFixtures.find(l=>l.id.includes(t))?.providesAddressableAreas,i=(l=>{if(a!=null){for(const u in a)if(a[u].includes(l))return u}return null})(e);if(i==null)throw Error(`expected to find cutoutId from addressableAreaName ${e} but could not`);return i};function _y(e){switch(e){case 1:return c.ONE_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA;case 8:return c.EIGHT_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA;case 96:return c.NINETY_SIX_CHANNEL_WASTE_CHUTE_ADDRESSABLE_AREA}}function Qc(e){const t=c.getDeckDefFromRobotType(e==="cutout12"?c.OT2_ROBOT_TYPE:c.FLEX_ROBOT_TYPE);let r=null;return t.robot.model===c.FLEX_ROBOT_TYPE&&(r=t.cutoutFixtures.find(n=>n.id==="trashBinAdapter")?.providesAddressableAreas??null),t.robot.model===c.FLEX_ROBOT_TYPE&&r==null&&console.error(`expected to find a list of cutouts for the Flex but could not with trashLocation ${e}`),r!=null?r[e]?.[0]:"fixedTrash"}function yy(e){if(e==="fixedTrash")return"cutout12";const r=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE).cutoutFixtures.find(n=>n.id==="trashBinAdapter")?.providesAddressableAreas??null;if(r==null)return console.error("Could not find trashBinAdapter cutouts for Flex"),null;for(const[n,o]of Object.entries(r))if(o.includes(e))return n;return console.error(`Could not find trashLocation for addressableAreaName ${e}`),null}function Hn(e,t,r,n){return e[n]!=null?"labware":t[n]!=null?"wasteChute":r[n]!=null?"trashBin":(console.error(`expected to determine if dest labware is a labware or waste chute with destLabware ${n} but could not`),null)}function by(e,t){return Nn(An(t),r=>e)}function wr(e){return mt(e,(t,r,n)=>n===Ke?t:t+r.volume,0)}function sr(e,t){const r=wr(t);if(r===0)return{source:t,dest:{[Ke]:{volume:e}}};if(e>r)return{source:lr(t,()=>({volume:0})),dest:{...t,[Ke]:{volume:e-r}}};const n=mt(t,(o,a,s)=>({...o,[s]:a.volume/r}),{});return Object.keys(t).reduce((o,a)=>{const s=n[a]*e;return{source:{...o.source,[a]:{volume:t[a].volume-s}},dest:{...o.dest,[a]:{volume:s}}}},{source:{},dest:{}})}function Sr(e,t){return{...t,...mt(e,(r,n,o)=>{const s=o in t?n.volume+t[o].volume:n.volume;return{...r,[o]:{volume:s}}},{})}}function Jc(e,t,r){const n=e===1?[r]:c.getWellNamePerMultiTip(t,r,e);if(!n)return console.warn(e===1?`Invalid well: ${r}`:`For labware def (URI ${c.getLabwareDefURI(t)}), with primary well ${r}, no wells are accessible by 8-channel's 1st tip`),{wellsForTips:[],allWellsShared:!1};const o=n.every(a=>a&&a===n[0]);return{wellsForTips:n,allWellsShared:o}}const Iy=e=>{const{pipette:t,sourceLabwareId:r,sourceWell:n,destLabwareId:o,destWell:a,blowoutLocation:s,flowRate:i,offsetFromTopMm:l,invariantContext:u}=e;if(!s)return[];const{trashBinEntities:p,wasteChuteEntities:d}=u;let f=null,m=null;return s===Xr?(f=r,m=n):s===zn&&(f=o,m=a),m!=null&&f!=null?[P(xc,{pipetteId:t,labwareId:f,wellName:m,flowRate:i,wellLocation:{origin:"top",offset:{z:l}}})]:d[s]!=null?[P(Db,{pipetteId:t,flowRate:i,wasteChuteId:Object.keys(d)[0]})]:[P(Cb,{pipetteId:t,trashId:Object.keys(p)[0],flowRate:i})]};function Ty(e){const{labwareEntities:t,pipetteEntities:r,wasteChuteEntities:n,trashBinEntities:o}=e;return{pipettes:mt(r,(a,s,i)=>{const l=s.spec;return{...a,[i]:wy(l.channels,{})}},{}),labware:mt(t,(a,s,i)=>({...a,[i]:lr(s.def.wells,()=>({}))}),{}),trashBins:mt(o,(a,s,i)=>({...a,[i]:{}}),{}),wasteChute:mt(n,(a,s,i)=>({...a,[i]:{}}),{})}}function wy(e,t){return An(e).reduce((r,n)=>({...r,[n]:t}),{})}const Sy=e=>{const{blowoutLocation:t,sourceLabware:r,destLabware:n,sourceWell:o,destWell:a}=e;return t===Xr&&r!=null&&o!=null?{dispenseAirGapLabware:r,dispenseAirGapWell:o}:{dispenseAirGapLabware:n,dispenseAirGapWell:a}};function ep(e){const{invariantContext:t,labwareLocations:r,moduleLocations:n={},pipetteLocations:o}=e;return{labware:r,modules:n,pipettes:o,liquidState:Ty(t),tipState:{pipettes:mt(o,(a,s,i)=>s.mount?{...a,[i]:{hasTip:!1,tiprackURI:null}}:a,{}),tipracks:mt(r,(a,s,i)=>{const l=t.labwareEntities[i].def;if(!c.getIsTiprack(l))return a;const u=lr(l.wells,()=>qo);return{...a,[i]:u}},{})}}}const gy=(e,t)=>e.tipracks[t]!=null?Object.values(e.tipracks[t]).some(r=>r!==_e):!1,Ey=(e,t)=>e.labware[t]!=null?Object.values(e.labware[t]).some(r=>Object.values(r).some(n=>n.volume>0)):!1,Ww=(e,t,r)=>{const{destinationId:n,pipetteId:o,volume:a,flowRate:s,offsetFromBottomMm:i,well:l,xOffset:u,yOffset:p,tipRack:d,primaryNozzle:f,nozzles:m}=e,{labwareEntities:h,trashBinEntities:_,wasteChuteEntities:y}=t,I=Hn(h,y,_,n);let b=[];return I==="labware"&&i!=null&&l!=null?b=[P(zc,{pipetteId:o,volume:a,labwareId:n,wellName:l,flowRate:s,wellLocation:{origin:"bottom",offset:{z:i,x:u,y:p}},tipRack:d,primaryNozzle:f,nozzles:m})]:I==="wasteChute"?b=[P(UA,{pipetteId:o,volume:a,flowRate:s,wasteChuteId:y[n].id})]:b=[P($A,{pipetteId:o,volume:a,flowRate:s,trashId:_[n].id})],pe(b,t,r)},Gw=(e,t,r)=>{const{destinationId:n,pipetteId:o,zOffset:a,well:s}=e,{labwareEntities:i,wasteChuteEntities:l,trashBinEntities:u}=t,p=Hn(i,l,u,n);let d=[];return p==="labware"&&s!=null?d=[P(H,{pipetteId:o,labwareId:n,wellName:s,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:a}}})]:p==="wasteChute"?d=[P(qe,{pipetteId:o,fixtureId:l[n].id,offset:{x:0,y:0,z:0}})]:d=[P(qe,{pipetteId:o,fixtureId:u[n].id,offset:vt})],pe(d,t,r)},Yw=(e,t,r)=>{const{blowOutLocation:n,destinationId:o,destWell:a,flowRate:s,pipetteId:i,sourceId:l,sourceWell:u,volume:p}=e,{labwareEntities:d,trashBinEntities:f,wasteChuteEntities:m}=t,h=Hn(d,m,f,o);let _=[];if(h==="labware"&&a!=null){const{dispenseAirGapLabware:y,dispenseAirGapWell:I}=Sy({blowoutLocation:n,sourceLabware:l,destLabware:o,sourceWell:u,destWell:a});_=[P(kA,{flowRate:s,pipetteId:i,labwareId:y,wellName:I,volume:p,type:"dispense"})]}else h==="wasteChute"?_=[P(NA,{pipetteId:i,volume:p,flowRate:s,wasteChuteId:m[o].id})]:_=[P(RA,{pipetteId:i,volume:p,flowRate:s,trashId:f[o].id})];return pe(_,t,r)},Kw=(e,t,r)=>{const{pipetteId:n,destinationId:o,well:a,zOffset:s,seconds:i}=e,{labwareEntities:l,trashBinEntities:u,wasteChuteEntities:p}=t,d=Hn(l,p,u,o);let f=[];return a!=null&&d==="labware"?f=[P(H,{pipetteId:n,labwareId:o,wellName:a,wellLocation:{origin:"bottom",offset:{x:0,y:0,z:s}}}),P(Ie,{seconds:i})]:d==="wasteChute"?f=[P(qe,{pipetteId:n,fixtureId:o,offset:vt}),P(Ie,{seconds:i})]:f=[P(qe,{pipetteId:n,fixtureId:o,offset:vt}),P(Ie,{seconds:i})],pe(f,t,r)},ee=(e,t=!1)=>{if(e==null)return console.error("expected to find stack but could not"),"unknown slot";{const r=e[e.length-1];return t?`STACKER ${r.slice(-2,-1)}`:r}},Zw=e=>e===c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA?p_:e,xa=e=>e==null?(console.error("expected to find stack but could not"),"unknown top location"):e[0],Ay=e=>e.length>=2?e[1]:null,go=e=>{const{slot:t,labwareState:r,modulesState:n}=e,o=Object.values(n).find(({slot:a,moduleState:s})=>a===t&&s.type===c.FLEX_STACKER_MODULE_TYPE);if(o!=null){const a=o.moduleState.labwareOnShuttle;return a==null?[]:[a.lidLabwareId,a.primaryLabwareId,a.adapterLabwareId].filter(i=>i!=null)}return Object.values(r).reduce((a,{stack:s})=>(s[s.length-1]===t&&s.length>a.length&&(a=s),a),[])},tp=e=>c.FLEX_SINGLE_SLOT_BY_CUTOUT_ID[c.FLEX_CUTOUT_BY_SLOT_ID[e]],Ly=e=>{const t=c.FLEX_STACKER_ADDRESSABLE_AREAS.indexOf(e);return t===-1?null:De[t]},Xw=e=>{const t=Ly(e);return t!=null?tp(t):null},Oy=(e,t,r)=>{if(e==null)return null;if(De.includes(e)){const n=tp(e);return Object.entries(t).some(([a,s])=>r[a]?.type===c.FLEX_STACKER_MODULE_TYPE&&s.slot===n)?n:e}return e},za=e=>{const t=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE),r=`${e[0]}3`,n=c.FLEX_CUTOUT_BY_SLOT_ID[r],o=t.cutoutFixtures.find(({id:a})=>a===c.FLEX_STACKER_V1_FIXTURE)?.providesAddressableAreas[n];return c.FLEX_STACKER_ADDRESSABLE_AREAS.find(a=>o?.includes(a))??null},vy=(e,t,r,n)=>{if(t.length===0)return{isCompatible:!0,isAboveStackLimit:!1};let o=!1;const a=t.find(u=>u in n);a!=null&&(o=n[a].type===c.FLEX_STACKER_MODULE_TYPE&&t.includes(rt));const s=xa(t);let i=!0,l=!1;if(s in r){const u=r[e],p=r[s],d=t.filter(R=>r[R]!=null),f=d.filter(R=>r[R]?.def?.allowedRoles?.includes("lid"))[0],m=d.filter(R=>r[R]?.def?.allowedRoles?.includes("adapter"))[0],h=p.def.parameters.loadName,_=d.filter(R=>!r[R]?.def?.allowedRoles?.includes("adapter")&&!r[R]?.def?.allowedRoles?.includes("lid"))[0];if(o){const R=c.getMaxPoolCount({labwareDefinitions:{primary:r[_]?.def??null,adapter:r[m]?.def??null,lid:r[f]?.def??null},model:c.FLEX_STACKER_MODULE_V1});l=t.length>R}else{const R=p.def.stackLimit??1,M=h===u.def.parameters.loadName,F=t.filter(G=>r[G]?.def.parameters.loadName===h)?.length;l=M&&F>=R}const y=u.def.parameters.loadName==="opentrons_tough_universal_lid",I=p.def.metadata.displayCategory==="tubeRack",b=p.def.metadata.displayCategory==="aluminumBlock",w=p.def.parameters.isTiprack,L=(p.def.allowedRoles??[]).includes("lid"),g=py(p.def),T=t.some(R=>R in r&&jw(r[R].def)),A=u.def.parameters.quirks?.includes("vacuumModuleDock")??!1,v=Eo(u.def)?my(u.def,t,r):null;if(v!=null)l=v.isAboveStackLimit,i=v.isCompatible;else{const R=u.def,M=p.def,F=R.parameters.quirks?.includes("filterPlate")??!1,G=M.parameters.quirks?.includes("filterPlate")??!1,Y=M.parameters.quirks?.includes("providesStackingDefault")??!1,oe=F&&!L&&!w&&!G,fe=!T&&A,J=Y&&!g,Re=R.compatibleParentLabware?.includes(h)??!1,Ve=h in(R.stackingOffsetWithLabware??{}),Me=M.parameters.loadName==="opentrons_tough_universal_lid";i=oe||fe||J||Re||Ve||y&&!I&&!b&&!w&&(Me||!L)}}else if(s in n){const u=n[s],{model:p}=u;i=Object.keys(r[e].def.stackingOffsetWithModule??{}).some(d=>p===d)}return{isCompatible:i,isAboveStackLimit:l}},Go=(e,t)=>t?.find(r=>e[r]!=null)??null,Qw=(e,t,r)=>t?e:r?i_[e]:e,Ha=(e,t,r)=>{if(t==="offDeck"&&r==null)return console.error("offDeck slot is not allowed to be used without an offDeckOverrideId"),[];const n=Ao(t),o=Py(t),a=Qw(t,n,o),s=Object.values(e).filter(i=>i.stack.includes(a)&&(r==null||i.stack.includes(r))&&i.stack.includes(rt)===o&&i.stack.includes(Ac)===n);return s.length===0?[]:o?s.at(-1)?.stack??[]:n?s.at(-1)?.stack??[]:s.toSorted((i,l)=>l.stack.length-i.stack.length)[0]?.stack??[]},Jw=(e,t)=>Object.values(t).filter(r=>r.stack.includes(e)).sort((r,n)=>n.stack.length-r.stack.length)[0]?.stack[0],bo=(e,t,r,n=!0)=>{const o=c.linearInterpolate(e,t)??0,a=c.linearInterpolate(e,r)??0;return e+(n?o:0)+a},rp=e=>{const{path:t,volume:r,pipetteSpecs:n,tiprackDefinition:o,conditioningByVolume:a,disposalByVolume:s,numDispenseWells:i,numAspirateWells:l,aspirateAirGapByVolume:u}=e,{liquids:p}=n,f=r<p.default.minVolume&&"lowVolumeDefault"in p?p.lowVolumeDefault.maxVolume:p.default.maxVolume,m=o?.wells.A1.totalLiquidVolume,h=m==null?f:Math.min(f,m),_=r*2,y=a!=null?c.linearInterpolate(_,a)??0:0,b=o?.namespace!=="opentrons"||a!=null&&s!=null&&h>=_+y+(c.linearInterpolate(_,s)??0)+(y===0?c.linearInterpolate(_,u)??0:0),w=h>=_;if(t==="multiAspirate"&&l<=i?console.warn("Invalid combination of source and destination wells for multiAspirate path"):t==="multiDispense"&&l>=i?console.warn("Invalid combination of source and destination wells for multiDispense path"):t==="single"&&l!==i&&console.warn("Invalid combination of source and destination wells for single path"),t==="single"||t==="multiDispense"&&!b||t==="multiAspirate"&&!w){const T=c.linearInterpolate(r,u)??0,A=Math.ceil((r+T)/h),E=r/A;return{referenceVolumes:{airGap:{aspirate:E,dispense:0},correction:{aspirate:E,dispense:E},pushOut:E,flowRate:{aspirate:E,dispense:E}},multiWellHandling:{isSupported:!1}}}if(t==="multiDispense"){let T=0,A=0;for(let E=0;E<i&&!(bo((E+1)*r,a??[],s??[])>h);E++)T=(E+1)*r,A+=1;return{referenceVolumes:{airGap:{aspirate:bo(T,a??[],s??[],!1),dispense:bo((A-1)*r,a??[],s??[],!1)},correction:{aspirate:bo(T,a??[],s??[]),dispense:r},flowRate:{aspirate:bo(T,a??[],s??[]),dispense:r},pushOut:r,conditioning:T,disposal:T},multiWellHandling:{isSupported:!0,numWellsToFitInTip:A}}}const S=Math.floor(h/r),L=Math.min(S,l),g=L*r;return{referenceVolumes:{airGap:{aspirate:g,dispense:0},pushOut:g,correction:{aspirate:g,dispense:g},flowRate:{aspirate:r,dispense:g}},multiWellHandling:{isSupported:!0,numWellsToFitInTip:L}}},Hr=e=>{const{retractZOffset:t,retractPositionReference:r,labwareId:n,labwareEntities:o,well:a}=e;if(a==null)return!1;const s=o[n]?.def.wells[a]?.depth;if(s==null)return!1;const i=c.getMmFromBottom(t,r,s);return i==null?!1:i-s>=c.SAFE_MOVE_TO_WELL_OFFSET_FROM_TOP_MM},uc=e=>e.reduce((t,r)=>{const{kind:n}=r;return n==="onCutoutFixture"?t:n==="onLabware"?[...t,r.labwareId]:n==="onModule"||n==="inStackerHopper"?[...t,r.moduleId]:n==="onAddressableArea"?[...t,r.addressableAreaName]:[...t,r.logicalLocationName]},[]),eS={A4:"cutoutA3",B4:"cutoutB3",C4:"cutoutC3",D4:"cutoutD3"};function cc(e){if(e.location!=="offDeck"&&e.location!=="systemLocation"&&e.location!=="wasteChuteLocation"&&"addressableAreaName"in e.location&&a_.includes(e.location.addressableAreaName)){const t=$(),r=e.location.addressableAreaName,n=eS[r]??r;return{[t]:{id:t,location:n}}}return{}}const Py=e=>s_.includes(e),Ao=e=>e===c.VACUUM_MODULE_DOCK_A4_ADDRESSABLE_AREA,np=e=>e.labwareOnShuttle?.primaryLabwareId??null,op=(e,t,r)=>{if(r?.storedLabwareDetails==null)return!0;const n=Object.values(r?.storedLabwareDetails??{}).reduce((a,s)=>s!=null?[...a,s]:a,[]),o=t.labwareEntities[e];return n.some(a=>o?.labwareDefURI===a)},ap=(e,t)=>{const{storedLabwareDetails:r}=e??{};if(r==null)return!0;const{primaryLabwareURI:n,adapterLabwareURI:o,lidLabwareURI:a}=r,s=Object.values(t).find(({labwareDefURI:f})=>f===n),i=Object.values(t).find(({labwareDefURI:f})=>f===o),l=Object.values(t).find(({labwareDefURI:f})=>f===a);if(s==null)return console.error("Primary labware entity not found"),!1;const u=c.getMaxPoolCount({labwareDefinitions:{primary:s.def,adapter:i?.def??null,lid:l?.def??null},model:c.FLEX_STACKER_MODULE_V1}),d=e?.labwareInHopper?.length??0;return u>d},Ry=e=>{const{labwareId:t,labwareRobotState:r,labwareEntities:n}=e;return Object.entries(r).some(([o,{stackedOnNode:a}])=>typeof a=="object"&&"labwareId"in a&&a.labwareId===t&&c.getIsLid(n[o].def))},Ny=e=>![Cn,c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA,...De].some(t=>e===t);function D(e,t){if(typeof e=="number")return e;const r=t[e];return r!=null&&(r.type==="float"||r.type==="int")?r.default:null}function O(e,t){const r=t[e];return r==null?e:r.type==="string"?r.default:null}function je(e,t){if(typeof e=="boolean")return e;const r=t[e];return r!=null&&r.type==="boolean"?r.default:null}function Ht(e,t,r){const n=O(e,r);return n==null||!t.includes(n)?null:n}function Nt(e,t,r){return r[e]!=null?e:q(t)}function Dn(e,t){if(e==null)return{location:void 0,invalidParameterNames:[]};const r=[],n=e.origin==null?void 0:O(e.origin,t);e.origin!=null&&n==null&&r.push(e.origin);const o={};if(e.offset!=null)for(const a of["x","y","z"]){const s=e.offset[a];if(s==null)continue;const i=D(s,t);i==null?r.push(String(s)):o[a]=i}return{location:{...n!=null?{origin:n}:{},...e.offset!=null?{offset:o}:{}},invalidParameterNames:r}}const Yo=(e,t,r)=>{const n=t[r]?.stack,o=Go(e,n),a=o!=null?e[o].moduleState:null;return!!(a&&a.type===c.ABSORBANCE_READER_TYPE&&a.lidOpen!==!0)};var Ml,um;function ky(){if(um)return Ml;um=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Ml=e,Ml}var tS=ky();const sp=Ye(tS);var Cy=Symbol.for("immer-nothing"),cm=Symbol.for("immer-draftable"),ct=Symbol.for("immer-state"),rS=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function et(e,...t){if(process.env.NODE_ENV!=="production"){const r=rS[e],n=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Lo=Object.getPrototypeOf;function Mn(e){return!!e&&!!e[ct]}function jr(e){return e?Dy(e)||Array.isArray(e)||!!e[cm]||!!e.constructor?.[cm]||Ko(e)||Wa(e):!1}var nS=Object.prototype.constructor.toString(),pm=new WeakMap;function Dy(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=pm.get(r);return n===void 0&&(n=Function.toString.call(r),pm.set(r,n)),n===nS}function Ta(e,t,r=!0){ja(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function ja(e){const t=e[ct];return t?t.type_:Array.isArray(e)?1:Ko(e)?2:Wa(e)?3:0}function pc(e,t){return ja(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function My(e,t,r){const n=ja(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function oS(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ko(e){return e instanceof Map}function Wa(e){return e instanceof Set}function Vr(e){return e.copy_||e.base_}function dc(e,t){if(Ko(e))return new Map(e);if(Wa(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Dy(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[ct];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){const s=o[a],i=n[s];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[s]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[s]})}return Object.create(Lo(e),n)}else{const n=Lo(e);if(n!==null&&r)return{...e};const o=Object.create(n);return Object.assign(o,e)}}function ip(e,t=!1){return Ga(e)||Mn(e)||!jr(e)||(ja(e)>1&&Object.defineProperties(e,{set:fa,add:fa,clear:fa,delete:fa}),Object.freeze(e),t&&Object.values(e).forEach(r=>ip(r,!0))),e}function aS(){et(2)}var fa={value:aS};function Ga(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var sS={};function Wr(e){const t=sS[e];return t||et(0,e),t}var Oo;function Fy(){return Oo}function iS(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function dm(e,t){t&&(Wr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fc(e){mc(e),e.drafts_.forEach(lS),e.drafts_=null}function mc(e){e===Oo&&(Oo=e.parent_)}function fm(e){return Oo=iS(Oo,e)}function lS(e){const t=e[ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function mm(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[ct].modified_&&(fc(t),et(4)),jr(e)&&(e=wa(t,e),t.parent_||Sa(t,e)),t.patches_&&Wr("Patches").generateReplacementPatches_(r[ct].base_,e,t.patches_,t.inversePatches_)):e=wa(t,r,[]),fc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Cy?e:void 0}function wa(e,t,r){if(Ga(t))return t;const n=e.immer_.shouldUseStrictIteration(),o=t[ct];if(!o)return Ta(t,(a,s)=>hm(e,o,t,a,s,r),n),t;if(o.scope_!==e)return t;if(!o.modified_)return Sa(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const a=o.copy_;let s=a,i=!1;o.type_===3&&(s=new Set(a),a.clear(),i=!0),Ta(s,(l,u)=>hm(e,o,a,l,u,r,i),n),Sa(e,a,!1),r&&e.patches_&&Wr("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function hm(e,t,r,n,o,a,s){if(o==null||typeof o!="object"&&!s)return;const i=Ga(o);if(!(i&&!s)){if(process.env.NODE_ENV!=="production"&&o===r&&et(5),Mn(o)){const l=a&&t&&t.type_!==3&&!pc(t.assigned_,n)?a.concat(n):void 0,u=wa(e,o,l);if(My(r,n,u),Mn(u))e.canAutoFreeze_=!1;else return}else s&&r.add(o);if(jr(o)&&!i){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===o&&i)return;wa(e,o),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Ko(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&Sa(e,o)}}}function Sa(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ip(t,r)}function uS(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Fy(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,a=lp;r&&(o=[n],a=vo);const{revoke:s,proxy:i}=Proxy.revocable(o,a);return n.draft_=i,n.revoke_=s,i}var lp={get(e,t){if(t===ct)return e;const r=Vr(e);if(!pc(r,t))return cS(e,r,t);const n=r[t];return e.finalized_||!jr(n)?n:n===Fl(e.base_,t)?($l(e),e.copy_[t]=_c(n,e)):n},has(e,t){return t in Vr(e)},ownKeys(e){return Reflect.ownKeys(Vr(e))},set(e,t,r){const n=$y(Vr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const o=Fl(Vr(e),t),a=o?.[ct];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(oS(r,o)&&(r!==void 0||pc(e.base_,t)))return!0;$l(e),hc(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Fl(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,$l(e),hc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Vr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){et(11)},getPrototypeOf(e){return Lo(e.base_)},setPrototypeOf(){et(12)}},vo={};Ta(lp,(e,t)=>{vo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});vo.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&et(13),vo.set.call(this,e,t,void 0)};vo.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&et(14),lp.set.call(this,e[0],t,r,e[0])};function Fl(e,t){const r=e[ct];return(r?Vr(r):e)[t]}function cS(e,t,r){const n=$y(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function $y(e,t){if(!(t in e))return;let r=Lo(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Lo(r)}}function hc(e){e.modified_||(e.modified_=!0,e.parent_&&hc(e.parent_))}function $l(e){e.copy_||(e.copy_=dc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var pS=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const s=this;return function(l=a,...u){return s.produce(l,p=>r.call(this,p,...u))}}typeof r!="function"&&et(6),n!==void 0&&typeof n!="function"&&et(7);let o;if(jr(t)){const a=fm(this),s=_c(t,void 0);let i=!0;try{o=r(s),i=!1}finally{i?fc(a):mc(a)}return dm(a,n),mm(o,a)}else if(!t||typeof t!="object"){if(o=r(t),o===void 0&&(o=t),o===Cy&&(o=void 0),this.autoFreeze_&&ip(o,!0),n){const a=[],s=[];Wr("Patches").generateReplacementPatches_(t,o,a,s),n(a,s)}return o}else et(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(s,...i)=>this.produceWithPatches(s,l=>t(l,...i));let n,o;return[this.produce(t,r,(s,i)=>{n=s,o=i}),n,o]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){jr(e)||et(8),Mn(e)&&(e=dS(e));const t=fm(this),r=_c(e,void 0);return r[ct].isManual_=!0,mc(t),r}finishDraft(e,t){const r=e&&e[ct];(!r||!r.isManual_)&&et(9);const{scope_:n}=r;return dm(n,t),mm(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));const n=Wr("Patches").applyPatches_;return Mn(e)?n(e,t):this.produce(e,o=>n(o,t))}};function _c(e,t){const r=Ko(e)?Wr("MapSet").proxyMap_(e,t):Wa(e)?Wr("MapSet").proxySet_(e,t):uS(e,t);return(t?t.scope_:Fy()).drafts_.push(r),r}function dS(e){return Mn(e)||et(10,e),Uy(e)}function Uy(e){if(!jr(e)||Ga(e))return e;const t=e[ct];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=dc(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=dc(e,!0);return Ta(r,(o,a)=>{My(r,o,Uy(a))},n),t&&(t.finalized_=!1),r}var fS=new pS,qy=fS.produce;function mS(e,t){let n=0;const o=[];for(;n+1<e.length;){const a=e[n],s=e[n+1];if(t(a,s)){n+=2;continue}else o.push(a),n+=1}return n+1===e.length&&o.push(e[n]),o}const hS=(e,t)=>["pipetteId","volume","labwareId","wellName"].every(n=>e[n]===t[n]),_S=e=>mS(e,(t,r)=>t.commandType==="aspirate"&&r.commandType==="dispense"&&hS(t.params,r.params)),Vy=e=>_S(e),up=(e,t)=>{const r=kt(e,t);return r.type===c.ABSORBANCE_READER_TYPE?r:(console.error(`Absorbance reader state updater expected ${t} moduleState to be absorbanceReader, but it was ${r.type}`),null)},yS=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forAbsorbanceReaderOpenLid: arg resolved to null (moduleId=${String(a)})`);return}const s=up(n,a);s!=null&&(s.lidOpen=!0)},bS=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forAbsorbanceReaderCloseLid: arg resolved to null (moduleId=${String(a)})`);return}const s=up(n,a);s!=null&&(s.lidOpen=!1)},IS=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,{measureMode:a,sampleWavelengths:s,referenceWavelength:i}=e,l=O(e.moduleId,o),u=O(a,o),p=u==="single"||u==="multi"?u:null,d=s.map(h=>D(h,o)),f=i==null?void 0:D(i,o);if(l==null||p==null||d.some(h=>h==null)||f===null){console.error(`forAbsorbanceReaderInitialize: arg resolved to null (moduleId=${String(l)}, measureMode=${String(p)}, sampleWavelengths=${String(d)}, referenceWavelength=${String(f)})`);return}const m=up(n,l);m!=null&&(m.initialization={mode:p,wavelengths:d,referenceWavelength:f},m.lidOpen=!1)};function TS(e,t,r){const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=D(e.volume,n);if(o==null||a==null){console.error(`forAirGapInPlace: arg resolved to null (pipetteId=${String(o)}, volume=${String(a)})`);return}const{robotState:s}=r,i=s.pipettes[o].nozzles;let u=t.pipetteEntities[o].spec.channels;i===c.COLUMN?u=8:i===c.SINGLE&&(u=1),An(u).forEach(p=>{const d=s.liquidState.pipettes[o][p]??{},f=d[Ke]?.volume??0;s.liquidState.pipettes[o][p]={...d,[Ke]:{volume:f+a}}})}var Ul,_m;function wS(){if(_m)return Ul;_m=1;var e=O_(),t=zo(),r=va(),n=nt(),o=Kr(),a=Da(),s=Fa(),i=Fc(),l="[object Map]",u="[object Set]",p=Object.prototype,d=p.hasOwnProperty;function f(m){if(m==null)return!0;if(o(m)&&(n(m)||typeof m=="string"||typeof m.splice=="function"||a(m)||i(m)||r(m)))return!m.length;var h=t(m);if(h==l||h==u)return!m.size;if(s(m))return!e(m).length;for(var _ in m)if(d.call(m,_))return!1;return!0}return Ul=f,Ul}var SS=wS();const ql=Ye(SS);var Vl,ym;function gS(){if(ym)return Vl;ym=1;function e(t,r,n,o){for(var a=t.length,s=n+(o?1:-1);o?s--:++s<a;)if(r(t[s],s,t))return s;return-1}return Vl=e,Vl}var Bl,bm;function ES(){if(bm)return Bl;bm=1;function e(t){return t!==t}return Bl=e,Bl}var xl,Im;function AS(){if(Im)return xl;Im=1;function e(t,r,n){for(var o=n-1,a=t.length;++o<a;)if(t[o]===r)return o;return-1}return xl=e,xl}var zl,Tm;function LS(){if(Tm)return zl;Tm=1;var e=gS(),t=ES(),r=AS();function n(o,a,s){return a===a?r(o,a,s):e(o,t,s)}return zl=n,zl}var Hl,wm;function OS(){if(wm)return Hl;wm=1;var e=LS();function t(r,n){var o=r==null?0:r.length;return!!o&&e(r,n,0)>-1}return Hl=t,Hl}var jl,Sm;function vS(){if(Sm)return jl;Sm=1;function e(t,r,n){for(var o=-1,a=t==null?0:t.length;++o<a;)if(n(r,t[o]))return!0;return!1}return jl=e,jl}var Wl,gm;function PS(){if(gm)return Wl;gm=1;function e(){}return Wl=e,Wl}var Gl,Em;function RS(){if(Em)return Gl;Em=1;var e=P_(),t=PS(),r=Nc(),n=1/0,o=e&&1/r(new e([,-0]))[1]==n?function(a){return new e(a)}:t;return Gl=o,Gl}var Yl,Am;function NS(){if(Am)return Yl;Am=1;var e=__(),t=OS(),r=vS(),n=b_(),o=RS(),a=Nc(),s=200;function i(l,u,p){var d=-1,f=t,m=l.length,h=!0,_=[],y=_;if(p)h=!1,f=r;else if(m>=s){var I=u?null:o(l);if(I)return a(I);h=!1,f=n,y=new e}else y=u?[]:_;e:for(;++d<m;){var b=l[d],w=u?u(b):b;if(b=p||b!==0?b:0,h&&w===w){for(var S=y.length;S--;)if(y[S]===w)continue e;u&&y.push(w),_.push(b)}else f(y,w,p)||(y!==_&&y.push(w),_.push(b))}return _}return Yl=i,Yl}var Kl,Lm;function kS(){if(Lm)return Kl;Lm=1;var e=NS();function t(r){return r&&r.length?e(r):[]}return Kl=t,Kl}var CS=kS();const DS=Ye(CS),cp=e=>{const{nozzles:t,pipetteSpec:r,primaryNozzle:n}=e,o=r.channels;if(t==null)return o;switch(t){case c.ROW:return 12;case c.COLUMN:return 8;case c.SINGLE:return 1;case c.ALL:return o;case c.PARTIAL_COLUMN:return c.PARTIAL_NOZZLE_MAP[n];default:return o}};function MS(e,t,r){const{pipetteId:n,volume:o}=e,{robotState:a,warnings:s}=r,i="labwareId"in e?e.labwareId:a.pipettes[n].entityId??"",l="wellName"in e?e.wellName:a.pipettes[n].wellName??"",{liquidState:u}=a,p=a.pipettes[n].nozzles,d=r.robotState.pipettes[n].primaryNozzle,f=t.pipetteEntities[n].spec,m=t.labwareEntities[i].def,h=m.metadata.displayCategory==="reservoir",_=cp({pipetteSpec:f,nozzles:p,primaryNozzle:d}),{allWellsShared:y,wellsForTips:I}=Jc(_,m,l);if(console.assert(DS(I).length===y?1:I.length,`expected all wells to be shared, or no wells to be shared. Got: ${JSON.stringify(I)}`),_>1&&y){const w=I[0],S=u.labware[i][w],L=o*_>wr(S);ql(S)?s.push(Dl()):L&&s.push(Cl());const g=L?wr(S)/_:o,T=sr(g,S).dest;An(_).forEach(A=>{const E=u.pipettes[n],v=A.toString(),R=E[v],M=L?Sr(R,{...T,[Ke]:{volume:o-g}}):Sr(R,T);E[v]=M}),u.labware[i][w]=sr(o*_,u.labware[i][w]).source;return}if(_===96&&h){I.forEach(w=>{const S=u.labware[i][w],L=o*8>wr(S);ql(S)?s.push(Dl()):L&&s.push(Cl());const g=L?wr(S)/8:o,T=sr(g,S).dest;An(_).forEach(A=>{const E=u.pipettes[n],v=A.toString(),R=E[v],M=L?Sr(R,{...T,[Ke]:{volume:o-g}}):Sr(R,T);E[v]=M}),u.labware[i][w]=sr(g*8,u.labware[i][w]).source});return}An(_).forEach(w=>{const S=w.toString(),L=u.pipettes[n],g=L[S],T=u.labware[i][I[w]],A=sr(o,T).dest;ql(T)?s.push(Dl()):o>wr(T)&&s.push(Cl()),L[S]=Sr(g,A)});const b=u.labware[i];I.forEach(w=>{b[w]=sr(o,b[w]).source}),"labwareId"in e&&(a.pipettes[n]={...a.pipettes[n],entityId:e.labwareId,wellName:l})}function Ya(e){const{robotStateAndWarnings:t,invariantContext:r,entityId:n,pipetteId:o,prevLiquidState:a,useFullVolume:s,volume:i,wellName:l}=e,u=r.pipetteEntities[o].spec,p=t.robotState.pipettes[o].nozzles,d=t.robotState.pipettes[o].primaryNozzle,f=cp({pipetteSpec:u,nozzles:p,primaryNozzle:d}),m=l??null,h=r.labwareEntities[n]!=null?r.labwareEntities[n].def:null;console.assert(!(s&&typeof i=="number"),"dispenseUpdateLiquidState takes either `volume` or `useFullVolume`, but got both"),console.assert(typeof i=="number"||s,"in dispenseUpdateLiquidState, either volume or useFullVolume are required");const{wellsForTips:_,allWellsShared:y}=h!=null&&l!=null?Jc(f,h,l):{wellsForTips:null,allWellsShared:!0},I=a.labware[n]!=null?a.labware[n]:null;let b=null;a.trashBins[n]!=null?b=a.trashBins[n]:a.wasteChute[n]!=null&&(b=a.wasteChute[n]);const w=lr(a.pipettes[o],T=>{const{...A}=T;if(s){const E=wr(A);return E>0?sr(E,A):{source:{},dest:{}}}return sr(i||0,A)});let S=null;if(m!=null&&I!=null)S={[m]:mt(w,(T,A)=>Sr(T,A.dest),I[m])};else if(b!=null){const T=Object.values(a.pipettes[o]).reduce((A,E)=>A+(E[0]?.volume??0),0);b[0]={volume:T}}S==null&&b==null&&console.assert(!1,`expected to merge liquid to a single well with sourceId ${n}`);const L=m!=null&&I!=null&&_!=null?_.reduce((T,A,E)=>({...T,[A]:Sr(w[`${E}`].dest,I[A]||{})}),{}):{},g=y?S:L;a.pipettes[o]=lr(w,"source"),a.trashBins[n]!=null&&b!=null?Object.assign(a.trashBins[n],b):a.wasteChute[n]!=null&&b!=null?Object.assign(a.wasteChute[n],b):a.labware[n]!=null&&g!=null&&(a.labware[n]=Object.assign(I??{},g))}function FS(e,t,r){const{pipetteId:n,labwareId:o,wellName:a}=e,{robotState:s}=r;Ya({pipetteId:n,entityId:o,useFullVolume:!0,wellName:a,prevLiquidState:s.liquidState,invariantContext:t,robotStateAndWarnings:r})}function $S(e,t,r){const{pipetteId:n,configurationParams:o}=e,{style:a,primaryNozzle:s}=o,{runtimeParameters:i}=t,l=O(n,i),u=Ht(a,La,i),p=s==null?void 0:Ht(s,Oa,i);if(l==null||u==null||s!=null&&p==null){console.error(`forConfigureNozzleLayout: arg resolved to null (pipetteId=${String(l)}, style=${String(u)}, primaryNozzle=${String(p)})`);return}const{robotState:d}=r;d.pipettes[l].nozzles=u,d.pipettes[l].primaryNozzle=p??void 0}function US(e,t,r){const{pipetteId:n,volume:o}=e,{robotState:a}=r,s="labwareId"in e?e.labwareId:a.pipettes[n].entityId??"",i="wellName"in e?e.wellName:a.pipettes[n].wellName??"",l=a.liquidState.pipettes[n],p=Object.values(l)[0]?.[Ke]?.volume??0,d=r.robotState.pipettes[n].primaryNozzle;if(Ya({invariantContext:t,entityId:s,pipetteId:n,prevLiquidState:a.liquidState,useFullVolume:!1,volume:o,wellName:i,robotStateAndWarnings:r}),p>0){const f=r.robotState.pipettes[n].nozzles,m=t.pipetteEntities[n].spec,h=cp({pipetteSpec:m,nozzles:f,primaryNozzle:d});Object.keys(l).slice(0,h).forEach(y=>{const I=l[y]??{};l[y]={...I,[Ke]:{volume:0}}})}"labwareId"in e&&(a.pipettes[n]={...a.pipettes[n],entityId:e.labwareId})}function qS(e,t,r){const{runtimeParameters:n}=t,o=O(e.pipette,n),a=e.dropTipLocation==null?void 0:O(e.dropTipLocation,n),s=e.wellName==null?void 0:O(e.wellName,n);if(o==null||e.dropTipLocation!=null&&a==null||e.wellName!=null&&s==null){console.error(`forDropTip: arg resolved to null (pipetteId=${String(o)}, labwareId=${String(a)}, wellName=${String(s)})`);return}const{robotState:i}=r;i.tipState.pipettes[o].hasTip=!1,i.tipState.pipettes[o].tiprackURI=null,i.pipettes[o].tiprackId=void 0;const l=i.tipState,u=t.pipetteEntities[o].spec,p=i.pipettes[o].nozzles,d=Tp(p,u),f=(h,_)=>h.find(y=>y.includes(_)),m=a==null?void 0:t.labwareEntities[a]?.def;a==null||s==null||m==null||!c.getIsTiprack(m)?console.warn(`forDropTip expected ${a} to have definition and to be a tiprack`):(d===c.SINGLE?l.tipracks[a][s]=or:d===c.COLUMN?(f(m.ordering,s)??[]).forEach(_=>l.tipracks[a][_]=or):d===c.ALL?u.channels===96?m.ordering.reduce((_,y)=>_.concat(y),[]).forEach(function(_){l.tipracks[a][_]=or}):(f(m.ordering,s)??[]).forEach(_=>l.tipracks[a][_]=or):u.channels===1?l.tipracks[a][s]=or:u.channels===96?m.ordering.reduce((_,y)=>_.concat(y),[]).forEach(function(_){l.tipracks[a][_]=or}):(f(m.ordering,s)??[]).forEach(_=>l.tipracks[a][_]=or),i.pipettes[o].entityId=a,i.pipettes[o].wellName=s)}function VS(e,t,r){const{labwareId:n,liquidId:o,volumeByWell:a}=e;Object.entries(a).forEach(([s,i])=>{r.robotState.liquidState.labware[n][s][o]={volume:i}})}var Zl,Om;function BS(){if(Om)return Zl;Om=1;function e(t,r){for(var n=-1,o=t==null?0:t.length;++n<o&&r(t[n],n,t)!==!1;);return t}return Zl=e,Zl}var Xl,vm;function pp(){if(vm)return Xl;vm=1;var e=Vc(),t=Pa(),r=Object.prototype,n=r.hasOwnProperty;function o(a,s,i){var l=a[s];(!(n.call(a,s)&&t(l,i))||i===void 0&&!(s in a))&&e(a,s,i)}return Xl=o,Xl}var Ql,Pm;function Zo(){if(Pm)return Ql;Pm=1;var e=pp(),t=Vc();function r(n,o,a,s){var i=!a;a||(a={});for(var l=-1,u=o.length;++l<u;){var p=o[l],d=s?s(a[p],n[p],p,a,n):void 0;d===void 0&&(d=n[p]),i?t(a,p,d):e(a,p,d)}return a}return Ql=r,Ql}var Jl,Rm;function xS(){if(Rm)return Jl;Rm=1;var e=Zo(),t=xo();function r(n,o){return n&&e(o,t(o),n)}return Jl=r,Jl}var eu,Nm;function zS(){if(Nm)return eu;Nm=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return eu=e,eu}var tu,km;function HS(){if(km)return tu;km=1;var e=pr(),t=Fa(),r=zS(),n=Object.prototype,o=n.hasOwnProperty;function a(s){if(!e(s))return r(s);var i=t(s),l=[];for(var u in s)u=="constructor"&&(i||!o.call(s,u))||l.push(u);return l}return tu=a,tu}var ru,Cm;function dp(){if(Cm)return ru;Cm=1;var e=A_(),t=HS(),r=Kr();function n(o){return r(o)?e(o,!0):t(o)}return ru=n,ru}var nu,Dm;function jS(){if(Dm)return nu;Dm=1;var e=Zo(),t=dp();function r(n,o){return n&&e(o,t(o),n)}return nu=r,nu}var wo={exports:{}};wo.exports;var Mm;function WS(){return Mm||(Mm=1,(function(e,t){var r=Kt(),n=t&&!t.nodeType&&t,o=n&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===n,s=a?r.Buffer:void 0,i=s?s.allocUnsafe:void 0;function l(u,p){if(p)return u.slice();var d=u.length,f=i?i(d):new u.constructor(d);return u.copy(f),f}e.exports=l})(wo,wo.exports)),wo.exports}var ou,Fm;function GS(){if(Fm)return ou;Fm=1;function e(t,r){var n=-1,o=t.length;for(r||(r=Array(o));++n<o;)r[n]=t[n];return r}return ou=e,ou}var au,$m;function YS(){if($m)return au;$m=1;var e=Zo(),t=kc();function r(n,o){return e(n,t(n),o)}return au=r,au}var su,Um;function fp(){if(Um)return su;Um=1;var e=L_(),t=e(Object.getPrototypeOf,Object);return su=t,su}var iu,qm;function By(){if(qm)return iu;qm=1;var e=Oc(),t=fp(),r=kc(),n=g_(),o=Object.getOwnPropertySymbols,a=o?function(s){for(var i=[];s;)e(i,r(s)),s=t(s);return i}:n;return iu=a,iu}var lu,Vm;function KS(){if(Vm)return lu;Vm=1;var e=Zo(),t=By();function r(n,o){return e(n,t(n),o)}return lu=r,lu}var uu,Bm;function mp(){if(Bm)return uu;Bm=1;var e=w_(),t=By(),r=dp();function n(o){return e(o,r,t)}return uu=n,uu}var cu,xm;function ZS(){if(xm)return cu;xm=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n){var o=n.length,a=new n.constructor(o);return o&&typeof n[0]=="string"&&t.call(n,"index")&&(a.index=n.index,a.input=n.input),a}return cu=r,cu}var pu,zm;function hp(){if(zm)return pu;zm=1;var e=T_();function t(r){var n=new r.constructor(r.byteLength);return new e(n).set(new e(r)),n}return pu=t,pu}var du,Hm;function XS(){if(Hm)return du;Hm=1;var e=hp();function t(r,n){var o=n?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return du=t,du}var fu,jm;function QS(){if(jm)return fu;jm=1;var e=/\w*$/;function t(r){var n=new r.constructor(r.source,e.exec(r));return n.lastIndex=r.lastIndex,n}return fu=t,fu}var mu,Wm;function JS(){if(Wm)return mu;Wm=1;var e=$n(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function n(o){return r?Object(r.call(o)):{}}return mu=n,mu}var hu,Gm;function eg(){if(Gm)return hu;Gm=1;var e=hp();function t(r,n){var o=n?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return hu=t,hu}var _u,Ym;function tg(){if(Ym)return _u;Ym=1;var e=hp(),t=XS(),r=QS(),n=JS(),o=eg(),a="[object Boolean]",s="[object Date]",i="[object Map]",l="[object Number]",u="[object RegExp]",p="[object Set]",d="[object String]",f="[object Symbol]",m="[object ArrayBuffer]",h="[object DataView]",_="[object Float32Array]",y="[object Float64Array]",I="[object Int8Array]",b="[object Int16Array]",w="[object Int32Array]",S="[object Uint8Array]",L="[object Uint8ClampedArray]",g="[object Uint16Array]",T="[object Uint32Array]";function A(E,v,R){var M=E.constructor;switch(v){case m:return e(E);case a:case s:return new M(+E);case h:return t(E,R);case _:case y:case I:case b:case w:case S:case L:case g:case T:return o(E,R);case i:return new M;case l:case d:return new M(E);case u:return r(E);case p:return new M;case f:return n(E)}}return _u=A,_u}var yu,Km;function rg(){if(Km)return yu;Km=1;var e=pr(),t=Object.create,r=(function(){function n(){}return function(o){if(!e(o))return{};if(t)return t(o);n.prototype=o;var a=new n;return n.prototype=void 0,a}})();return yu=r,yu}var bu,Zm;function ng(){if(Zm)return bu;Zm=1;var e=rg(),t=fp(),r=Fa();function n(o){return typeof o.constructor=="function"&&!r(o)?e(t(o)):{}}return bu=n,bu}var Iu,Xm;function og(){if(Xm)return Iu;Xm=1;var e=zo(),t=cr(),r="[object Map]";function n(o){return t(o)&&e(o)==r}return Iu=n,Iu}var Tu,Qm;function ag(){if(Qm)return Tu;Qm=1;var e=og(),t=Dc(),r=Mc(),n=r&&r.isMap,o=n?t(n):e;return Tu=o,Tu}var wu,Jm;function sg(){if(Jm)return wu;Jm=1;var e=zo(),t=cr(),r="[object Set]";function n(o){return t(o)&&e(o)==r}return wu=n,wu}var Su,eh;function ig(){if(eh)return Su;eh=1;var e=sg(),t=Dc(),r=Mc(),n=r&&r.isSet,o=n?t(n):e;return Su=o,Su}var gu,th;function xy(){if(th)return gu;th=1;var e=Rc(),t=BS(),r=pp(),n=xS(),o=jS(),a=WS(),s=GS(),i=YS(),l=KS(),u=v_(),p=mp(),d=zo(),f=ZS(),m=tg(),h=ng(),_=nt(),y=Da(),I=ag(),b=pr(),w=ig(),S=xo(),L=dp(),g=1,T=2,A=4,E="[object Arguments]",v="[object Array]",R="[object Boolean]",M="[object Date]",F="[object Error]",G="[object Function]",Y="[object GeneratorFunction]",oe="[object Map]",fe="[object Number]",J="[object Object]",Re="[object RegExp]",Ve="[object Set]",Me="[object String]",We="[object Symbol]",ie="[object WeakMap]",Ne="[object ArrayBuffer]",Be="[object DataView]",Ae="[object Float32Array]",ae="[object Float64Array]",K="[object Int8Array]",j="[object Int16Array]",k="[object Int32Array]",B="[object Uint8Array]",U="[object Uint8ClampedArray]",re="[object Uint16Array]",V="[object Uint32Array]",Z={};Z[E]=Z[v]=Z[Ne]=Z[Be]=Z[R]=Z[M]=Z[Ae]=Z[ae]=Z[K]=Z[j]=Z[k]=Z[oe]=Z[fe]=Z[J]=Z[Re]=Z[Ve]=Z[Me]=Z[We]=Z[B]=Z[U]=Z[re]=Z[V]=!0,Z[F]=Z[G]=Z[ie]=!1;function W(x,z,le,xe,ot,Ge){var ye,at=z&g,Tt=z&T,Ct=z&A;if(le&&(ye=ot?le(x,xe,ot,Ge):le(x)),ye!==void 0)return ye;if(!b(x))return x;var wt=_(x);if(wt){if(ye=f(x),!at)return s(x,ye)}else{var ke=d(x),st=ke==G||ke==Y;if(y(x))return a(x,at);if(ke==J||ke==E||st&&!ot){if(ye=Tt||st?{}:h(x),!at)return Tt?l(x,o(ye,x)):i(x,n(ye,x))}else{if(!Z[ke])return ot?x:{};ye=m(x,ke,at)}}Ge||(Ge=new e);var Ee=Ge.get(x);if(Ee)return Ee;Ge.set(x,ye),w(x)?x.forEach(function(ue){ye.add(W(ue,z,le,ue,x,Ge))}):I(x)&&x.forEach(function(ue,ce){ye.set(ce,W(ue,z,le,ce,x,Ge))});var Ce=Ct?Tt?p:u:Tt?L:S,Fe=wt?void 0:Ce(x);return t(Fe||x,function(ue,ce){Fe&&(ce=ue,ue=x[ce]),r(ye,ce,W(ue,z,le,ce,x,Ge))}),ye}return gu=W,gu}var Eu,rh;function zy(){if(rh)return Eu;rh=1;function e(t,r,n){var o=-1,a=t.length;r<0&&(r=-r>a?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var s=Array(a);++o<a;)s[o]=t[o+r];return s}return Eu=e,Eu}var Au,nh;function lg(){if(nh)return Au;nh=1;var e=$a(),t=zy();function r(n,o){return o.length<2?n:e(n,t(o,0,-1))}return Au=r,Au}var Lu,oh;function ug(){if(oh)return Lu;oh=1;var e=qn(),t=ky(),r=lg(),n=Vn(),o=Object.prototype,a=o.hasOwnProperty;function s(i,l){l=e(l,i);var u=-1,p=l.length;if(!p)return!0;for(;++u<p;){var d=n(l[u]);if(d==="__proto__"&&!a.call(i,"__proto__")||(d==="constructor"||d==="prototype")&&u<p-1)return!1}var f=r(i,l);return f==null||delete f[n(t(l))]}return Lu=s,Lu}var Ou,ah;function cg(){if(ah)return Ou;ah=1;var e=Un(),t=fp(),r=cr(),n="[object Object]",o=Function.prototype,a=Object.prototype,s=o.toString,i=a.hasOwnProperty,l=s.call(Object);function u(p){if(!r(p)||e(p)!=n)return!1;var d=t(p);if(d===null)return!0;var f=i.call(d,"constructor")&&d.constructor;return typeof f=="function"&&f instanceof f&&s.call(f)==l}return Ou=u,Ou}var vu,sh;function pg(){if(sh)return vu;sh=1;var e=cg();function t(r){return e(r)?void 0:r}return vu=t,vu}var Pu,ih;function dg(){if(ih)return Pu;ih=1;var e=f_();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return Pu=t,Pu}var Ru,lh;function fg(){if(lh)return Ru;lh=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return Ru=e,Ru}var Nu,uh;function Hy(){if(uh)return Nu;uh=1;var e=fg(),t=Math.max;function r(n,o,a){return o=t(o===void 0?n.length-1:o,0),function(){for(var s=arguments,i=-1,l=t(s.length-o,0),u=Array(l);++i<l;)u[i]=s[o+i];i=-1;for(var p=Array(o+1);++i<o;)p[i]=s[i];return p[o]=a(u),e(n,this,p)}}return Nu=r,Nu}var ku,ch;function mg(){if(ch)return ku;ch=1;function e(t){return function(){return t}}return ku=e,ku}var Cu,ph;function hg(){if(ph)return Cu;ph=1;var e=mg(),t=D_(),r=$o(),n=t?function(o,a){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return Cu=n,Cu}var Du,dh;function _g(){if(dh)return Du;dh=1;var e=800,t=16,r=Date.now;function n(o){var a=0,s=0;return function(){var i=r(),l=t-(i-s);if(s=i,l>0){if(++a>=e)return arguments[0]}else a=0;return o.apply(void 0,arguments)}}return Du=n,Du}var Mu,fh;function jy(){if(fh)return Mu;fh=1;var e=hg(),t=_g(),r=t(e);return Mu=r,Mu}var Fu,mh;function yg(){if(mh)return Fu;mh=1;var e=dg(),t=Hy(),r=jy();function n(o){return r(t(o,void 0,e),o+"")}return Fu=n,Fu}var $u,hh;function bg(){if(hh)return $u;hh=1;var e=Bo(),t=xy(),r=ug(),n=qn(),o=Zo(),a=pg(),s=yg(),i=mp(),l=1,u=2,p=4,d=s(function(f,m){var h={};if(f==null)return h;var _=!1;m=e(m,function(I){return I=n(I,f),_||(_=I.length>1),I}),o(f,i(f),h),_&&(h=t(h,l|u|p,a));for(var y=m.length;y--;)r(h,m[y]);return h});return $u=d,$u}var Ig=bg();const Tg=Ye(Ig),yc="TOUCHED_PIPETTABLE_LABWARE";var Uu,_h;function wg(){if(_h)return Uu;_h=1;var e=$c();function t(r,n){return e(r,n)}return Uu=t,Uu}var Sg=wg();const gg=Ye(Sg),Ka=e=>{const{node:t,stack:r=[],robotState:n,memo:o=new Map}=e;let a=r;if(!(typeof t=="object"&&"labwareId"in t))return a=[...r,t],o.set(t,a),{stack:a,memo:o};const{labwareId:s}=t,i=n.labware[s];if(i!=null&&i.stackedOnNode!=null){const{stack:l,memo:u}=Ka({node:i.stackedOnNode,stack:[...r,t],robotState:n,memo:o});Wy(o,u),a=l,o.set(t,a)}return{stack:a,memo:o}},Eg=e=>{const{node:t,robotState:r,deckDef:n,deckConfiguration:o}=e,{stack:a}=Ka({node:t,robotState:r}),{cutoutFixtures:s}=n,i=a.find(l=>typeof l=="object"&&"addressableAreaName"in l);if(i!=null&&typeof i=="object"&&"addressableAreaName"in i){const{addressableAreaName:l}=i;for(const{id:u,providesAddressableAreas:p}of s){const[d]=Object.entries(p).find(([f,m])=>m.includes(l))??[];if(d!=null){const f=o.find(({cutoutId:I})=>I===d),{cutoutFixtureId:m,cutoutId:h}=f,_=m===u&&h===d,y=Object.entries(r.modules).find(([I,{slot:b}])=>c.FLEX_CUTOUT_BY_SLOT_ID[b]===h);if(_&&y!=null)return y[0]}}}return null},Wy=(e,t)=>{t.forEach((r,n)=>{e.set(n,r)})},Ag=(e,t)=>e.some(r=>gg(r,t)),Gy=e=>{const{labwareId:t,robotState:r}=e,n=new Map,o={labwareId:t};let a=[];for(const[s,{stackedOnNode:i}]of Object.entries(r.labware)){const l={labwareId:s};if(i==null)continue;let u;const p=n.get(l);if(p!=null)u=p;else{const{stack:d,memo:f}=Ka({node:l,robotState:r,memo:n});if(Wy(n,f),!Ag(d,o))continue;n.set(l,d),u=d}u.length>a.length&&(a=u)}return a},Yy=e=>{const t=[],r=new Set;for(const n of Object.keys(e.labware)){if(r.has(n))continue;const o=Gy({labwareId:n,robotState:e});o.forEach(a=>{typeof a=="object"&&"labwareId"in a&&r.add(a.labwareId)}),t.push(o)}return t},_p=e=>{const{moduleId:t,robotState:r,moduleEntities:n,deckDef:o}=e,a=r.modules[t],s=n[t];if(a==null||s==null)return null;const{slot:i}=a,{model:l}=s,u=c.getAddressableAreaNamesFromLoadedModule(l,i,o);return u.length===0?null:u[0]},Lg=e=>{const{location:t,robotState:r,moduleEntities:n,deckDef:o}=e;if(t==="offDeck"||t==="systemLocation"||t==="wasteChuteLocation")return null;if("slotName"in t)return t.slotName;if("addressableAreaName"in t)return t.addressableAreaName;if("moduleId"in t){const{moduleId:a}=t;return _p({moduleId:a,robotState:r,moduleEntities:n,deckDef:o})}return null},Ky=e=>{const{deckConfiguration:t,deckDefinition:r}=e;return t.reduce((n,{cutoutFixtureId:o,cutoutId:a})=>((r.cutoutFixtures.find(({id:i})=>o===i)?.providesAddressableAreas[a]??[]).forEach(i=>{n.add(i)}),n),new Set)},Og=e=>{const{robotState:t,deckConfiguration:r,deckDefinition:n,moduleEntities:o}=e,a=Ky({deckConfiguration:r,deckDefinition:n}),s=new Set(a),i=Yy(t);for(const l of i){const u=sp(l);if(typeof u=="object"&&"addressableAreaName"in u){const{addressableAreaName:p}=u;s.delete(p)}if(typeof u=="object"&&"slotName"in u){const{slotName:p}=u;s.delete(p)}if(typeof u=="object"&&"moduleId"in u){const{moduleId:p}=u,d=_p({moduleId:p,robotState:t,moduleEntities:o,deckDef:n});d!=null&&s.delete(d)}}return s},vg=e=>{const t=e.toLowerCase();return t.includes("chute")||t.includes("waste")||t.startsWith("gripper")||t==="96channelwastechute"},Zy=e=>{const{stack:t,subjectLabwareId:r,moduleEntities:n,labwareEntityIds:o,modules:a}=e;if(t.length===0||t[0]!==r||t.length<2)return;const s=t[1];if(s===rt){const u=t[2];return u==null?void 0:{kind:"inStackerHopper",moduleId:u}}if(n[s]!=null)return{moduleId:s};if(o.has(s))return{labwareId:s};if(s==="offDeck")return"offDeck";if(s==="systemLocation")return"systemLocation";if(s==="wasteChuteLocation")return"wasteChuteLocation";if(vg(s))return{addressableAreaName:s};const i=Oy(s,a,n)??s;if(Object.entries(a).some(([u,p])=>n[u]?.type===c.FLEX_STACKER_MODULE_TYPE&&p.slot===i)){const u=za(i);if(u!=null)return{addressableAreaName:u}}return{slotName:s}},Pg=e=>typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="inStackerHopper",Rg=e=>typeof e!="object"||e===null?!1:!Pg(e),Ng=(e,t)=>{const{id:r,def:n}=e,{id:o,def:a}=t,s=n.dimensions.xDimension,i=n.dimensions.yDimension,l=a.dimensions.xDimension,u=a.dimensions.yDimension;return s>l&&i>u?{containerLabwareId:r,containedLabwareId:o}:l>s&&u>i?{containerLabwareId:o,containedLabwareId:r}:null},yp=(e,t)=>{const r=new Map;for(const o of Object.keys(e)){const a=e[o].stackedOnNode;if(a==null||!Rg(a))continue;const s=JSON.stringify(a),i=r.get(s)??[];i.push(o),r.set(s,i)}const n={};for(const o of r.values()){if(o.length!==2)continue;const[a,s]=o,i=t[a],l=t[s];if(i==null||l==null)continue;const u=Ng(i,l);if(u==null)continue;const{containerLabwareId:p,containedLabwareId:d}=u;n[p]=d}return Object.keys(n).length===0?e:lr(e,(o,a)=>n[a]!=null?{...o,contains:n[a]}:o)},kg=(e,t,r)=>{const n=Object.keys(e.labware),o=new Set(n);let a=lr(e.labware,(s,i)=>{const l=s.stackedOnNode??Zy({stack:s.stack,subjectLabwareId:i,moduleEntities:t,labwareEntityIds:o,modules:e.modules});return l!=null?{...s,stackedOnNode:l}:{...s}});return a=yp(a,r),{...e,labware:a}};function Cg(e,t,r){const{runtimeParameters:n,labwareEntities:o}=t,a=O(e.labwareId,n);let s=null;if(typeof e.newLocation=="string"){const v=O(e.newLocation,n);v!=null&&(s=v)}else if("labwareId"in e.newLocation){const v=O(e.newLocation.labwareId,n);v!=null&&(s=v===e.newLocation.labwareId?e.newLocation:{labwareId:v})}else if("moduleId"in e.newLocation){const v=O(e.newLocation.moduleId,n);v!=null&&(s=v===e.newLocation.moduleId?e.newLocation:{moduleId:v})}else if("slotName"in e.newLocation){const v=O(e.newLocation.slotName,n);v!=null&&(s=v===e.newLocation.slotName?e.newLocation:{slotName:v})}else{const v=O(e.newLocation.addressableAreaName,n);v!=null&&(s=v===e.newLocation.addressableAreaName?e.newLocation:{addressableAreaName:v})}if(a==null||s==null){console.error(`forMoveLabware: arg resolved to null (labwareId=${String(a)}, newLocation=${String(s)})`);return}const{robotState:i}=r,{modules:l,labware:u}=i;if(u[a]==null)return;const p=ee(u[a].stack),d=Ha(u,p,a),f=d.indexOf(a),m=d.slice(0,f+1),h=c.getIsLid(o[a].def);let _=!1;const y=Object.entries(l).find(([v,{slot:R}])=>{const{type:M}=t.moduleEntities[v]??{};return M===c.FLEX_STACKER_MODULE_TYPE&&R===p})??null,I=y!=null&&y[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE?ar.map(v=>y[1].moduleState.labwareOnShuttle?.[v]).filter(v=>v!=null):[],b=I.includes(a)?I.slice(0,I.indexOf(a)+1):[];if(y!=null&&y[1].moduleState.type===c.FLEX_STACKER_MODULE_TYPE){const v=y[1].moduleState,R=ar.findIndex(M=>v.labwareOnShuttle?.[M]===a);if(R!==-1&&v.labwareOnShuttle!=null)for(const M of ar.slice(R,ar.length))if(M==="primaryLabwareId"){v.labwareOnShuttle=null;break}else v.labwareOnShuttle[M]=null}const w=s,S=Object.entries(l).find(([v,{slot:R}])=>{const{type:M}=t.moduleEntities[v]??{};return M===c.FLEX_STACKER_MODULE_TYPE&&typeof w=="object"&&("moduleId"in w&&w.moduleId===v||"slotName"in w&&R===w.slotName)})??null,[L,g]=S??[];if(L!=null&&g!=null){const v=b.length>0?b:go({slot:p,labwareState:u,modulesState:l}),R=v.indexOf(a),M=g.moduleState;if(R!==-1){const F=v.slice(0,R+1).toReversed();if(M.labwareOnShuttle==null&&(M.labwareOnShuttle={primaryLabwareId:"",adapterLabwareId:null,lidLabwareId:null}),F.length===3)for(let G=0;G<ar.length;G++){const Y=ar[G];M.labwareOnShuttle[Y]=F[G]}else if(F.length===2){const G=F.some(Y=>t.labwareEntities[Y].def.allowedRoles?.some(oe=>oe==="lid"))?["primaryLabwareId","lidLabwareId"]:["adapterLabwareId","primaryLabwareId"];for(let Y=0;Y<G.length;Y++){const oe=G[Y];M.labwareOnShuttle[oe]=F[Y]}}else F.length===1&&(M.labwareOnShuttle.primaryLabwareId=F[0])}}const T=[];if(c.locationIsOffDeck(s))T.push(s);else if("moduleId"in s)if(l[s.moduleId].moduleState.type===c.FLEX_STACKER_MODULE_TYPE)T.push(l[s.moduleId].slot);else if(t.moduleEntities[s.moduleId]?.type===c.VACUUM_MODULE_TYPE){const v=l[s.moduleId].slot,R=go({slot:v,labwareState:u,modulesState:l});R.length>0?T.push(...R):T.push(s.moduleId,v)}else T.push(s.moduleId,l[s.moduleId].slot);else if("slotName"in s){const{slotName:v}=s;v in u?(_=c.getIsPipettableLabware(o[v].def),T.push(...u[v].stack)):T.push(v)}else if("labwareId"in s){const v=s.labwareId;_=c.getIsPipettableLabware(o[v].def);const R=u[v].stack;T.push(...R)}else if("addressableAreaName"in s)if(Ao(s.addressableAreaName)){const v=Object.entries(l).find(([R])=>t.moduleEntities[R]?.type===c.VACUUM_MODULE_TYPE)?.[0];T.push(Ac),v!=null&&T.push(v),T.push(s.addressableAreaName)}else T.push(s.addressableAreaName);m.forEach((v,R)=>{if(u[v]!=null){const M=m.slice(R+1);i.labware[v]={...i.labware[v],stack:[v,...M,...T],...h&&_?{sterility:yc}:{}}}});const A=typeof s=="object"&&"labwareId"in s&&c.getIsPipettableLabware(o[s.labwareId].def);let E=s;if(typeof s=="object"&&s!==null&&"moduleId"in s&&l[s.moduleId].moduleState.type===c.FLEX_STACKER_MODULE_TYPE){const v=za(l[s.moduleId].slot);v!=null&&(E={addressableAreaName:v})}else if(typeof s=="object"&&s!==null&&"moduleId"in s&&t.moduleEntities[s.moduleId]?.type===c.VACUUM_MODULE_TYPE){const v=l[s.moduleId].slot,R=go({slot:v,labwareState:u,modulesState:l}),M=R.length>0?R[0]:null;M!=null&&M in o&&(E={labwareId:M})}i.labware[a].stackedOnNode=E,A&&(i.labware[a].sterility=yc),i.labware=yp(lr(i.labware,v=>Tg(v,"contains")),o)}function Dg(e,t,r){const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=O(e.addressableAreaName,n);if(o==null||a==null){console.error(`forMoveToAddressableArea: arg resolved to null (pipetteId=${String(o)}, addressableAreaName=${String(a)})`);return}const{wasteChuteEntities:s,trashBinEntities:i}=t,l=a,u=c.WASTE_CHUTE_ADDRESSABLE_AREAS.includes(l),p=Object.values(i).find(m=>m.location===yy(l))?.id,d=u?Object.values(s)[0].id:p,{robotState:f}=r;f.pipettes[o]={...f.pipettes[o],entityId:d}}function Mg(e,t,r){const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=O(e.labwareId,n),s=O(e.wellName,n);if(o==null||a==null||s==null){console.error(`forMoveToWell: arg resolved to null (pipetteId=${String(o)}, labwareId=${String(a)}, wellName=${String(s)})`);return}const{robotState:i}=r;i.pipettes[o]={...i.pipettes[o],entityId:a,wellName:s}}function Fg(e,t,r){const{runtimeParameters:n}=t,o=O(e.pipetteId,n),a=O(e.labwareId,n),s=O(e.wellName,n);if(o==null||a==null||s==null){console.error(`forPickUpTip: arg resolved to null (pipetteId=${String(o)}, labwareId=${String(a)}, wellName=${String(s)})`);return}const i=t.pipetteEntities[o].spec,l=t.labwareEntities[a].def;if(!c.getIsTiprack(l))throw new Error(`forPickUpTip expected ${a} to be a tiprack`);const u=r.robotState.tipState,p=r.robotState.pipettes[o].nozzles,d=r.robotState.pipettes[o].primaryNozzle,f=Tp(p,i),m=(y,I)=>y.find(b=>b.includes(I)),h=(y,I)=>{const b=y.findIndex(S=>S.includes(I));if(b===-1)return null;const w=y[b].indexOf(I);return y.map(S=>S[w])},_=(y,I)=>{const b=c.PARTIAL_NOZZLE_MAP[d],w=y.findIndex(A=>A.includes(I)),S=y[w].indexOf(I),L=y[w];if(L.length-S<b){const A=L.length-b;return L.slice(A,L.length)}const T=S+b;return L.slice(S,Math.min(T,L.length))};if(u.pipettes[o].hasTip=!0,u.pipettes[o].tiprackURI=a,f===c.SINGLE)u.tipracks[a][s]=_e;else if(f===c.PARTIAL_COLUMN&&d){const y=_(l.ordering,s);y==null?console.error(`Invalid primary well for tip pick up for partial config: ${s}`):y.forEach(function(I){u.tipracks[a][I]=_e})}else if(f===c.COLUMN){const y=m(l.ordering,s);y==null&&console.error(`Invalid primary well for tip pickup: ${s}`),y?.forEach(function(I){u.tipracks[a][I]=_e})}else if(f===c.ROW){const y=h(l.ordering,s);y==null&&console.error("Invalid primary well for tip pickup: "+s),y?.forEach(function(I){u.tipracks[a][I]=_e})}else if(f===c.ALL)if(i.channels===96)l.ordering.reduce((I,b)=>I.concat(b),[]).forEach(function(I){u.tipracks[a][I]=_e});else{const y=m(l.ordering,s);y==null&&console.error(`Invalid primary well for tip pickup: ${s}`),y?.forEach(function(I){u.tipracks[a][I]=_e})}else if(i.channels===1)u.tipracks[a][s]=_e;else if(i.channels===96)l.ordering.reduce((I,b)=>I.concat(b),[]).forEach(function(I){u.tipracks[a][I]=_e});else{const y=m(l.ordering,s);y==null&&console.error(`Invalid primary well for tip pickup: ${s}`),y?.forEach(function(I){u.tipracks[a][I]=_e})}r.robotState.pipettes[o].tiprackId=a,r.robotState.pipettes[o].tipWell=s}const $g={clean:qo,empty:_e,used:or};function Ug(e,t,r){const{labwareId:n,wellNames:o,tipWellState:a="clean"}=e,s=$g[a],i=r.robotState.tipState.tipracks[n];i!=null&&o.forEach(l=>{i[l]=s})}const Qr=(e,t)=>{const r=kt(e,t);return r.type===c.THERMOCYCLER_MODULE_TYPE?r:(console.error(`Thermocycler state updater expected ${t} moduleState to be thermocycler, but it was ${r.type}`),{})},qg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=D(e.celsius,n);if(o==null||a==null){console.error(`forThermocyclerSetTargetBlockTemperature: arg resolved to null (moduleId=${String(o)}, celsius=${String(a)})`);return}const{robotState:s}=r,i=Qr(s,o);i.currentBlockActivity={type:"blockTargetTemp",blockTargetTemp:a}},Vg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=D(e.celsius,n);if(o==null||a==null){console.error(`forThermocyclerSetTargetLidTemperature: arg resolved to null (moduleId=${String(o)}, celsius=${String(a)})`);return}const{robotState:s}=r,i=Qr(s,o);i.lidTargetTemp=a},Bg=(e,t,r)=>{},xg=(e,t,r)=>{},zg=(e,t,r)=>{},Hg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null){console.error(`forThermocyclerDeactivateBlock: arg resolved to null (moduleId=${String(o)})`);return}const{robotState:a}=r,s=Qr(a,o);s.currentBlockActivity={type:"blockDeactivated"}},jg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null){console.error(`forThermocyclerDeactivateLid: arg resolved to null (moduleId=${String(o)})`);return}const{robotState:a}=r,s=Qr(a,o);s.lidTargetTemp=null},Wg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null){console.error(`forThermocyclerCloseLid: arg resolved to null (moduleId=${String(o)})`);return}const{robotState:a}=r,s=Qr(a,o);s.lidOpen=!1},Gg=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n);if(o==null){console.error(`forThermocyclerOpenLid: arg resolved to null (moduleId=${String(o)})`);return}const{robotState:a}=r,s=Qr(a,o);s.lidOpen=!0};function yh(e,t){const r=D(e.celsius,t),n=D(e.holdSeconds,t);return r==null||n==null?(console.error(`resolveProfileStep: arg resolved to null (celsius=${String(r)}, holdSeconds=${String(n)})`),null):{celsius:r,holdSeconds:n}}function Yg(e,t){const r=[];for(const n of e)if("steps"in n){const o=D(n.repetitions,t);if(o==null)return console.error(`resolveProfileElements: arg resolved to null (repetitions=${String(o)})`),null;const a=[];for(const s of n.steps){const i=yh(s,t);if(i==null)return console.error("resolveProfileElements: arg resolved to null (step=null)"),null;a.push(i)}r.push({steps:a,repetitions:o})}else{const o=yh(n,t);if(o==null)return console.error("resolveProfileElements: arg resolved to null (step=null)"),null;r.push(o)}return r}const Kg=(e,t,r)=>{const{profile:n,...o}=e;Xy({profileElements:n,...o},t,r)},Xy=(e,t,r)=>{const n=NaN+$();Qy({...e,taskId:n},t,r)&&Jy(n,r,c.THERMOCYCLER_MODULE_TYPE)},Qy=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.moduleId,n),a=Yg(e.profileElements,n);if(o==null||a==null)return console.error(`forThermocyclerStartRunExtendedProfile: arg resolved to null (moduleId=${String(o)}, profileElements=${String(a)})`),!1;let s=null;if(e.taskId!=null){const u=O(e.taskId,n);if(u==null)return console.error(`forThermocyclerStartRunExtendedProfile: arg resolved to null (taskId=${String(u)})`),!1;s=u}const{robotState:i}=r,l=Qr(i,o);return l.currentBlockActivity={type:"profile",profileElements:a,taskId:s},l.numProfilesStarted++,!0},Zg=e=>{if(e.currentBlockActivity.type==="profile"){const t=Xg(e.currentBlockActivity.profileElements);return e.currentBlockActivity=t!=null?{type:"blockTargetTemp",blockTargetTemp:t}:{type:"blockDeactivated"},!0}else return!1};function Xg(e){const t=sp(gp(e));return t!=null?t.celsius:null}const Qg=(e,t)=>{const[r,n]=[e.ordering,t.ordering];if(r.length!==n.length)return!1;for(let o=0;o<r.length;o++){const[a,s]=[r[o],n[o]];if(a.length!==s.length)return!1}return!0},bp=(e,t,r)=>{const{labware:n,liquidState:o}=t,s=Ha(n,e).filter(i=>i in r&&c.getIsPipettableLabware(r[i].def));if(s.length===1){const i=o.labware[s[0]];Object.entries(i).forEach(([l,u])=>{i[l]={}});return}if(s.length===2){const i=s[0],l=s[1];if(!Qg(r[i].def,r[l].def))return;const u=o.labware[i],p=o.labware[l];Object.entries(p).forEach(([d,f])=>{const m=u[d];Object.entries(m).forEach(([h,{volume:_}])=>{f[h]={volume:h in f?f[h].volume+_:_}}),u[d]={}})}},Jg=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null){console.error(`forVacuumOpenVent: arg resolved to null (moduleId=${String(n)})`);return}const{robotState:o}=r,a=pt(o,n);a!=null&&(a.ventStatus=Lc)},eE=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null){console.error(`forVacuumCloseVent: arg resolved to null (moduleId=${String(n)})`);return}const{robotState:o}=r,a=pt(o,n);a!=null&&(a.ventStatus=Vo)},tE=(e,t,r)=>{const{runtimeParameters:n,labwareEntities:o}=t,a=O(e.moduleId,n),s=D(e.gaugePressure,n),i=e.duration==null?void 0:D(e.duration,n),l=e.ventAfter==null?!0:je(e.ventAfter,n);if(a==null||s==null||i===null||l==null){console.error(`forVacuumSetPumpPressure: arg resolved to null (moduleId=${String(a)}, gaugePressure=${String(s)}, duration=${String(i)}, ventAfter=${String(l)})`);return}const{taskId:u}=e,{robotState:p}=r,d=pt(p,a);d!=null&&(bp(a,p,o),i==null||u==null?d.currentPumpActivity={type:"indefiniteHold",mode:sc,targetPressure:s}:(d.currentPumpActivity={type:"timedHold",mode:sc,targetPressure:s,durationSeconds:i,taskId:u,ventAfter:l},d.numPumpActivitiesStarted++),d.ventStatus=Vo)},rE=(e,t,r)=>{const{runtimeParameters:n,labwareEntities:o}=t,a=O(e.moduleId,n),s=D(e.percentPower,n),i=e.duration==null?void 0:D(e.duration,n),l=e.ventAfter==null?!0:je(e.ventAfter,n);if(a==null||s==null||i===null||l==null){console.error(`forVacuumSetPumpPower: arg resolved to null (moduleId=${String(a)}, percentPower=${String(s)}, duration=${String(i)}, ventAfter=${String(l)})`);return}const{taskId:u}=e,{robotState:p}=r,d=pt(p,a);d!=null&&(bp(a,p,o),i==null||u==null?d.currentPumpActivity={type:"indefiniteHold",mode:ac,targetPower:s}:(d.currentPumpActivity={type:"timedHold",mode:ac,targetPower:s,durationSeconds:i,taskId:u,ventAfter:l},d.numPumpActivitiesStarted++),d.ventStatus=Vo)},nE=(e,t,r)=>{const n=O(e.moduleId,t.runtimeParameters);if(n==null){console.error(`forVacuumStopPump: arg resolved to null (moduleId=${String(n)})`);return}const{robotState:o}=r,a=pt(o,n);a!=null&&(a.currentPumpActivity={type:"pumpDeactivated"})},oE=(e,t,r)=>{const{runtimeParameters:n,labwareEntities:o}=t,a=O(e.moduleId,n),s=je(e.ventAfter,n);if(a==null||s==null){console.error(`forVacuumStartRunProfile: arg resolved to null (moduleId=${String(a)}, ventAfter=${String(s)})`);return}const{robotState:i}=r,l=pt(i,a),{taskId:u,profile:p}=e;l==null||u==null||(bp(a,i,o),l.currentPumpActivity={type:"profile",profileElements:p,taskId:u,ventAfter:s},l.numPumpActivitiesStarted++)},aE=e=>{if(e.currentPumpActivity.type==="timedHold"||e.currentPumpActivity.type==="profile"){const t=e.currentPumpActivity.ventAfter;return e.currentPumpActivity={type:"pumpDeactivated"},e.ventStatus=t?Lc:Vo,!0}return!1};function sE(e,t,r){const{runtimeParameters:n}=t;for(const o of e.task_ids){const a=O(o,n);a==null&&console.error(`forWaitForTasks: arg resolved to null (taskId=${String(a)})`),a!=null&&Jy(a,r)||r.warnings.push(Nw())}}const Jy=(e,t,r)=>{const{robotState:n}=t,o=Object.values(n.modules).find(a=>{if(r&&a.moduleState.type!==r)return!1;const s=a.moduleState.type==="thermocyclerModuleType"&&a.moduleState.currentBlockActivity.type==="profile"&&a.moduleState.currentBlockActivity.taskId===e,i=a.moduleState.type==="vacuumModuleType"&&(a.moduleState.currentPumpActivity.type==="timedHold"||a.moduleState.currentPumpActivity.type==="profile")&&a.moduleState.currentPumpActivity.taskId===e;return s||i});return o==null?!1:o.moduleState.type==="thermocyclerModuleType"?Zg(o.moduleState):o.moduleState.type==="vacuumModuleType"?aE(o.moduleState):(console.log(`unexpected module type with task: ${o.moduleState.type}`),!1)},jn=(e,t)=>{const r=kt(e,t);return r.type===c.HEATERSHAKER_MODULE_TYPE?r:(console.error(`Heater-Shaker state updater expected ${t} moduleState to be heaterShaker, but it was ${r.type}`),{})},iE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=D(e.celsius,o);if(a==null||s==null){console.error(`forHeaterShakerSetTargetTemperature: arg resolved to null (moduleId=${String(a)}, celsius=${String(s)})`);return}const i=jn(n,a);i.targetTemp=s},lE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forHeaterShakerDeactivateHeater: arg resolved to null (moduleId=${String(a)})`);return}const s=jn(n,a);s.targetTemp=null},uE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=D(e.rpm,o);if(a==null||s==null){console.error(`forHeaterShakerSetTargetShakeSpeed: arg resolved to null (moduleId=${String(a)}, rpm=${String(s)})`);return}const i=jn(n,a);i.targetSpeed=s},cE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forHeaterShakerStopShake: arg resolved to null (moduleId=${String(a)})`);return}const s=jn(n,a);s.targetSpeed=null},pE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forHeaterShakerOpenLatch: arg resolved to null (moduleId=${String(a)})`);return}const s=jn(n,a);s.latchOpen=!0},dE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forHeaterShakerCloseLatch: arg resolved to null (moduleId=${String(a)})`);return}const s=jn(n,a);s.latchOpen=!1},fE=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n);if(o==null){console.error(`forBlowOutInPlace: arg resolved to null (pipetteId=${String(o)})`);return}const{robotState:a}=r,s=a.pipettes[o].entityId??"";Ya({invariantContext:t,pipetteId:o,prevLiquidState:a.liquidState,useFullVolume:!0,robotStateAndWarnings:r,entityId:s})},mE=(e,t,r)=>{const{runtimeParameters:n}=t,o=O(e.pipetteId,n);if(o==null){console.error(`forDropTipInPlace: arg resolved to null (pipetteId=${String(o)})`);return}const{robotState:a}=r,s=a.pipettes[o].entityId??"";a.tipState.pipettes[o]={hasTip:!1,tiprackURI:null},Ya({invariantContext:t,prevLiquidState:a.liquidState,pipetteId:o,useFullVolume:!0,robotStateAndWarnings:r,entityId:s}),a.pipettes[o].tiprackId=void 0};function eb(e,t){e.type===c.MAGNETIC_MODULE_TYPE&&(e.engaged=t)}function hE(e,t,r){const{robotState:n}=r,o=O(e.moduleId,t.runtimeParameters);if(o==null){console.error(`forEngageMagnet: arg resolved to null (moduleId=${String(o)})`);return}const a=kt(n,o);eb(a,!0)}function _E(e,t,r){const{robotState:n}=r,o=O(e.moduleId,t.runtimeParameters);if(o==null){console.error(`forDisengageMagnet: arg resolved to null (moduleId=${String(o)})`);return}const a=kt(n,o);eb(a,!1)}const qu=(e,t)=>{if(t==null)return console.error("expected to find defURI but could not in getLabwareByDefURI"),null;const r=e.findIndex(o=>o.labwareDefURI===t);if(r===-1)return null;const[n]=e.splice(r,1);return n.id},tb=(e,t,r,n)=>{const o=e.labwareInHopper??[];t.forEach(a=>{const{primaryLabwareId:s,adapterLabwareId:i,lidLabwareId:l}=a;r.labware[s]={stack:[s,...l!=null?[l]:[],...n]},i!=null&&(r.labware[i]={stack:[i,s,...l!=null?[l]:[],...n]}),l!=null&&(r.labware[l]={stack:[l,...n]}),o.push({primaryLabwareId:s,adapterLabwareId:i??null,lidLabwareId:l??null})}),e.labwareInHopper=o},rb=(e,t,r,n,o,a,s,i)=>{const u=Object.entries(e.labware).filter(([d,f])=>f[a]===t[a]).map(([d])=>d).map(d=>r[d]),p=[];for(let d=0;d<n;d++){const f=qu(u,t.storedLabwareDetails?.primaryLabwareURI),m=s!=null?qu(u,t.storedLabwareDetails?.adapterLabwareURI):null,h=i!=null?qu(u,t.storedLabwareDetails?.lidLabwareURI):null;f!=null&&(e.labware[f]={stack:[f,...h!=null?[h]:[],...o]},m!=null&&(e.labware[m]={stack:[m,f,...h!=null?[h]:[],...o]}),h!=null&&(e.labware[h]={stack:[h,...o]}),p.push({primaryLabwareId:f,adapterLabwareId:m,lidLabwareId:h})),t.labwareInHopper=p}},yE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=e.count==null?void 0:D(e.count,o);if(a==null||s===null){console.error(`forFlexStackerEmpty: arg resolved to null (moduleId=${String(a)}, count=${String(s)})`);return}const i=Object.entries(n.labware).filter(([,u])=>u.stack.includes(rt)&&u.stack.includes(a)),l=It(n,a);l!=null&&l.labwareInHopper!=null&&(s!=null?l.labwareInHopper=l.labwareInHopper.slice(0,s):l.labwareInHopper=[]),i.forEach(([u])=>{n.labware[u]={...n.labware[u],stack:[u,c.SYSTEM_LOCATION]}})},bE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a),i=e.labware.map(b=>O(b,a));if(s==null||i.some(b=>b==null)){console.error(`forFlexStackerFillItems: arg resolved to null (moduleId=${String(s)}, labware=${String(i)})`);return}const l=i,u=n.modules[s].slot,p=It(n,s);if(p==null||p.storedLabwareDetails==null)return;const{primaryLabwareURI:d,adapterLabwareURI:f,lidLabwareURI:m}=p.storedLabwareDetails,h=[];for(const b of l){const w=o[b].labwareDefURI;if(w===d)h.push({primaryLabwareId:b,adapterLabwareId:null,lidLabwareId:null});else if(w===f){const S=h[h.length-1];S&&(S.adapterLabwareId=b)}else if(w===m){const S=h[h.length-1];S&&(S.lidLabwareId=b)}}const _=[rt,s,u];for(const b of h){const w=[b.adapterLabwareId,b.primaryLabwareId,b.lidLabwareId,..._].filter(L=>L!=null);n.labware[b.primaryLabwareId]={...n.labware[b.primaryLabwareId],stack:w.slice(w.indexOf(b.primaryLabwareId))},b.adapterLabwareId!=null&&(n.labware[b.adapterLabwareId]={...n.labware[b.adapterLabwareId],stack:w.slice(w.indexOf(b.adapterLabwareId))}),b.lidLabwareId!=null&&(n.labware[b.lidLabwareId]={...n.labware[b.lidLabwareId],stack:w.slice(w.indexOf(b.lidLabwareId))});let S=null;for(const L of w)o[L]!=null&&(S==null?n.labware[L].stackedOnNode={kind:"inStackerHopper",moduleId:s}:n.labware[L].stackedOnNode={labwareId:S},S=L)}const y=p.labwareInHopper??[],I=h.map(({primaryLabwareId:b,adapterLabwareId:w,lidLabwareId:S})=>({primaryLabwareId:b,adapterLabwareId:w,lidLabwareId:S}));p.labwareInHopper=[...y,...I]},Vu=(e,t)=>{const r=O(e.loadName,t),n=O(e.namespace,t),o=D(e.version,t);return r==null||n==null||o==null?null:{loadName:r,namespace:n,version:o}},IE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a),i=Vu(e.primaryLabware,a),l=e.adapterLabware==null?null:Vu(e.adapterLabware,a),u=e.lidLabware==null?null:Vu(e.lidLabware,a),p=e.initialCount==null?void 0:D(e.initialCount,a);if(s==null||i==null||e.adapterLabware!=null&&l==null||e.lidLabware!=null&&u==null||p===null){console.error(`forFlexStackerSetStoredLabware: arg resolved to null (moduleId=${String(s)}, primaryLabware=${String(i)}, adapterLabware=${String(l)}, lidLabware=${String(u)}, initialCount=${String(p)})`);return}let d;if(p==null&&e.initialStoredLabware!=null){d=[];for(const _ of e.initialStoredLabware){const y=O(_.primaryLabwareId,a),I=_.adapterLabwareId==null?null:O(_.adapterLabwareId,a),b=_.lidLabwareId==null?null:O(_.lidLabwareId,a);if(y==null||_.adapterLabwareId!=null&&I==null||_.lidLabwareId!=null&&b==null){console.error(`forFlexStackerSetStoredLabware: arg resolved to null (primaryLabwareId=${String(y)}, adapterLabwareId=${String(I)}, lidLabwareId=${String(b)})`);return}d.push({primaryLabwareId:y,adapterLabwareId:I,lidLabwareId:b})}}const f=n.modules[s].slot,m=It(n,s),h=[rt,s,f];m!=null&&(m.storedLabwareDetails={primaryLabwareURI:`${i.namespace}/${i.loadName}/${i.version}`,adapterLabwareURI:l!=null?`${l.namespace}/${l.loadName}/${l.version}`:null,lidLabwareURI:u!=null?`${u.namespace}/${u.loadName}/${u.version}`:null},p!=null?rb(n,m,o,p,h,"setStoredLabwareCount",l?.loadName,u?.loadName):d!=null&&tb(m,d,n,h),m.setStoredLabwareCount=(m?.setStoredLabwareCount??0)+1)},TE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a),i=e.labware.map(T=>O(T,a));if(s==null||i.some(T=>T==null)){console.error(`forFlexStackerSetStoredLabwareItems: arg resolved to null (moduleId=${String(s)}, labware=${String(i)})`);return}const l=i,u=n.modules[s].slot,p=It(n,s);if(p==null)return;const d=l.map(T=>T.split(":")[1]),f=new Set(d),m=Array.from(f),h=m.find(T=>Object.values(o).find(A=>A.labwareDefURI===T&&!A.def.allowedRoles?.includes("lid")&&!A.def.allowedRoles?.includes("adapter"))),_=m.find(T=>Object.values(o).find(A=>A.labwareDefURI===T&&A.def.allowedRoles?.includes("adapter"))),y=m.find(T=>Object.values(o).find(A=>A.labwareDefURI===T&&A.def.allowedRoles?.includes("lid")));if(h==null)throw new Error(`expected to find primaryLabwareURI for storedLabwareDetails but could not with labware ${l}`);p.storedLabwareDetails={primaryLabwareURI:h,adapterLabwareURI:_??null,lidLabwareURI:y??null};const I=[];for(const T of l){const A=o[T].labwareDefURI;if(A===h)I.push({primary:T,adapter:null,lid:null});else if(A===_){const E=I[I.length-1];E&&(E.adapter=T)}else if(A===y){const E=I[I.length-1];E&&(E.lid=T)}}const b=[rt,s,u];for(const T of I){const A=[T.adapter,T.primary,T.lid,...b].filter(E=>E!=null);n.labware[T.primary]={...n.labware[T.primary],stack:A.slice(A.indexOf(T.primary))},T.adapter!=null&&(n.labware[T.adapter]={...n.labware[T.adapter],stack:A.slice(A.indexOf(T.adapter))}),T.lid!=null&&(n.labware[T.lid]={...n.labware[T.lid],stack:A.slice(A.indexOf(T.lid))})}const w=p.labwareInHopper??[],S=I.map(T=>({primaryLabwareId:T.primary,adapterLabwareId:T.adapter,lidLabwareId:T.lid})),L=new Map(w.map(T=>[T.primaryLabwareId,T])),g=[];for(const T of S)g.push(T),L.delete(T.primaryLabwareId);for(const T of w)L.has(T.primaryLabwareId)&&g.push(T);p.labwareInHopper=g},wE=(e,t,r)=>{const{robotState:n}=r,{labwareEntities:o,runtimeParameters:a}=t,s=O(e.moduleId,a),i=e.count==null?void 0:D(e.count,a);if(s==null||i===null){console.error(`forFlexStackerFill: arg resolved to null (moduleId=${String(s)}, count=${String(i)})`);return}const l=n.modules[s].slot,u=It(n,s),p=[rt,s,l];if(u!=null){const d=u.storedLabwareDetails?.adapterLabwareURI,f=u.storedLabwareDetails?.lidLabwareURI;if(i!=null)rb(n,u,o,i,p,"fillCount",d,f);else if(e.labwareToStore!=null){const m=[];for(const h of e.labwareToStore){const _=O(h.primaryLabwareId,a),y=h.adapterLabwareId==null?null:O(h.adapterLabwareId,a),I=h.lidLabwareId==null?null:O(h.lidLabwareId,a);if(_==null||h.adapterLabwareId!=null&&y==null||h.lidLabwareId!=null&&I==null){console.error(`forFlexStackerFill: arg resolved to null (primaryLabwareId=${String(_)}, adapterLabwareId=${String(y)}, lidLabwareId=${String(I)})`);return}m.push({primaryLabwareId:_,adapterLabwareId:y,lidLabwareId:I})}tb(u,m,n,p)}u.fillCount=(u?.fillCount??0)+1}},SE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forFlexStackerRetrieve: arg resolved to null (moduleId=${String(a)})`);return}const s=It(n,a),i=n.modules[a].slot;if(s!=null){const{labwareInHopper:l,labwareOnShuttle:u}=s;if(l!=null&&l.length>0&&u==null){const p=l[0];s.labwareOnShuttle=p,l.shift();const d=[i];let f=null;for(const m of ar){const h=p[m];if(h!=null){if(d.unshift(h),n.labware[h].stack=[...d],f==null){const _=za(i);_!=null?n.labware[h].stackedOnNode={addressableAreaName:_}:console.warn(`Could not find an addressable area for retrieved labware in stacker module ${a} at slot ${i}`)}else n.labware[h].stackedOnNode={labwareId:f};f=h}}}}},gE=(e,t,r)=>{const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forFlexStackerStore: arg resolved to null (moduleId=${String(a)})`);return}const s=It(n,a),i=n.modules[a].slot;if(s!=null){const{labwareOnShuttle:l}=s;if(l!=null){s.labwareInHopper=[l,...s.labwareInHopper??[]],s.labwareOnShuttle=null;let u=null;for(const p of ar){const d=l[p];d!=null&&(n.labware[d].stack=[d,rt,a,i],u==null?(n.labware[d].stackedOnNode={kind:"inStackerHopper",moduleId:a},u=d):n.labware[d].stackedOnNode={labwareId:u})}s.storedLabwareDetails==null&&(s.storedLabwareDetails={primaryLabwareURI:t.labwareEntities[l.primaryLabwareId].labwareDefURI,adapterLabwareURI:l.adapterLabwareId!=null?t.labwareEntities[l.adapterLabwareId].labwareDefURI:null,lidLabwareURI:l.lidLabwareId!=null?t.labwareEntities[l.lidLabwareId].labwareDefURI:null})}}};function nb(e,t,r){e.type===c.TEMPERATURE_MODULE_TYPE&&(e.targetTemperature=t,e.status=r)}function EE(e,t,r){const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=D(e.celsius,o);if(a==null||s==null){console.error(`forSetTemperature: arg resolved to null (moduleId=${String(a)}, celsius=${String(s)})`);return}const i=kt(n,a);nb(i,s,Ec)}function AE(e,t,r){const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o),s=D(e.celsius,o);if(a==null||s==null){console.error(`forAwaitTemperature: arg resolved to null (moduleId=${String(a)}, celsius=${String(s)})`);return}const i=kt(n,a);i.type===c.TEMPERATURE_MODULE_TYPE&&s===i.targetTemperature&&(i.status=gc)}function LE(e,t,r){const{robotState:n}=r,{runtimeParameters:o}=t,a=O(e.moduleId,o);if(a==null){console.error(`forDeactivateTemperature: arg resolved to null (moduleId=${String(a)})`);return}const s=kt(n,a);nb(s,null,Uo)}function ob(e,t,r){if(!e)throw new Error("undefined command passed to getNextRobotStateAndWarning");switch(e.commandType){case"aspirateWhileTracking":case"aspirate":case"aspirateInPlace":if(e.meta?.isAirGap===!0)break;MS(e.params,t,r);break;case"airGapInPlace":TS(e.params,t,r);break;case"dispenseWhileTracking":case"dispense":case"dispenseInPlace":if(e.meta?.isAirGap===!0)break;US(e.params,t,r);break;case"blowout":FS(e.params,t,r);break;case"dropTip":{const{pipetteId:n,labwareId:o,wellName:a}=e.params;qS({pipette:n,dropTipLocation:o,wellName:a},t,r);break}case"pickUpTip":Fg(e.params,t,r);break;case"setTipState":Ug(e.params,t,r);break;case"magneticModule/engage":hE(e.params,t,r);break;case"magneticModule/disengage":_E(e.params,t,r);break;case"moveLabware":Cg(e.params,t,r);break;case"waitForTasks":sE(e.params,t,r);break;case"flexStacker/setStoredLabware":IE(e.params,t,r);break;case"flexStacker/setStoredLabwareItems":TE(e.params,t,r);break;case"flexStacker/prepareShuttle":case"flexStacker/closeLatch":case"flexStacker/openLatch":break;case"flexStacker/empty":yE(e.params,t,r);break;case"flexStacker/fill":wE(e.params,t,r);break;case"flexStacker/fillItems":bE(e.params,t,r);break;case"flexStacker/retrieve":SE(e.params,t,r);break;case"flexStacker/store":gE(e.params,t,r);break;case"setRailLights":case"touchTip":case"configureForVolume":case"loadPipette":case"loadLabware":case"loadModule":case"home":case"moveRelative":case"moveToSlot":case"moveToCoordinates":case"savePosition":case"waitForResume":case"waitForDuration":case"pause":case"delay":case"custom":case"comment":case"captureImage":case"prepareToAspirate":case"liquidProbe":case"loadLiquidClass":case"loadLidStack":case"loadLid":case"getTipPresence":case"identifyModule":case"getNextTip":case"retractAxis":case"sealPipetteToTip":case"tryLiquidProbe":case"unsealPipetteFromTip":case"verifyTipPresence":case"pressureDispense":case"createTimer":break;case"moveToAddressableArea":case"moveToAddressableAreaForDropTip":Dg(e.params,t,r);break;case"moveToWell":Mg(e.params,t,r);break;case"loadLiquid":VS(e.params,t,r);break;case"dropTipInPlace":mE(e.params,t,r);break;case"blowOutInPlace":fE(e.params,t,r);break;case"configureNozzleLayout":$S(e.params,t,r);break;case"temperatureModule/setTargetTemperature":EE(e.params,t,r);break;case"temperatureModule/deactivate":LE(e.params,t,r);break;case"temperatureModule/waitForTemperature":{const{moduleId:n,celsius:o}=e.params;o!=null&&AE({moduleId:n,celsius:o},t,r);break}case"thermocycler/setTargetBlockTemperature":qg(e.params,t,r);break;case"thermocycler/setTargetLidTemperature":Vg(e.params,t,r);break;case"thermocycler/waitForBlockTemperature":Bg(e.params);break;case"thermocycler/waitForLidTemperature":xg(e.params);break;case"thermocycler/deactivateBlock":Hg(e.params,t,r);break;case"thermocycler/deactivateLid":jg(e.params,t,r);break;case"thermocycler/closeLid":Wg(e.params,t,r);break;case"thermocycler/openLid":Gg(e.params,t,r);break;case"thermocycler/runProfile":Kg(e.params,t,r);break;case"thermocycler/runExtendedProfile":Xy(e.params,t,r);break;case"thermocycler/startRunExtendedProfile":Qy(e.params,t,r);break;case"thermocycler/awaitProfileComplete":zg(e.params);break;case"heaterShaker/deactivateHeater":lE(e.params,t,r);break;case"heaterShaker/setTargetTemperature":iE(e.params,t,r);break;case"heaterShaker/setAndWaitForShakeSpeed":case"heaterShaker/setShakeSpeed":uE(e.params,t,r);break;case"heaterShaker/deactivateShaker":cE(e.params,t,r);break;case"heaterShaker/openLabwareLatch":pE(e.params,t,r);break;case"heaterShaker/closeLabwareLatch":dE(e.params,t,r);break;case"heaterShaker/waitForTemperature":break;case"absorbanceReader/openLid":yS(e.params,t,r);break;case"absorbanceReader/closeLid":bS(e.params,t,r);break;case"absorbanceReader/initialize":IS(e.params,t,r);break;case"absorbanceReader/read":break;case"vacuumModule/startSetVacuumPressure":tE(e.params,t,r);break;case"vacuumModule/startSetVacuumPower":rE(e.params,t,r);break;case"vacuumModule/openVent":Jg(e.params,t,r);break;case"vacuumModule/closeVent":eE(e.params,t,r);break;case"vacuumModule/stopVacuum":nE(e.params,t,r);break;case"vacuumModule/startRunProfile":oE({moduleId:e.params.moduleId,profile:e.params.steps,ventAfter:e.params.ventAfter??!0,taskId:e.params.taskId},t,r);break;default:console.error(`unknown command: ${e.commandType} passed to getNextRobotStateAndWarning`)}}function ab(e,t,r){return qy({warnings:[],robotState:r},o=>{ob(e,t,o)})}function Ip(e,t,r){const n=Vy(e);return qy({warnings:[],robotState:r},a=>{n.forEach(s=>{ob(s,t,a)})})}const OE=(e,t,r)=>{const n=e.reduce((o,a,s)=>{const i=o.timeline.length===0?r:sp(o.timeline).robotState;if(o.errors!=null)return o;const l=a(t,i);if("errors"in l)return{timeline:o.timeline,errors:l.errors};const p=Vy(l.commands).reduce((f,m)=>ab(m,t,f.robotState),{robotState:i,warnings:[]}),d={commands:l.commands,robotState:p.robotState,warnings:l.warnings,stepInfo:{stepNumber:l.stepNumber,name:l.name,description:l.description},python:l.python};return{timeline:[...o.timeline,d],errors:null}},{timeline:[],errors:null});return{timeline:n.timeline,errors:n.errors}},Wn=(e,t)=>{const r=t[e]?.stack;return r!=null?ee(r):""},Gn=e=>{if(e.type===c.VACUUM_MODULE_TYPE){const t=e;return t.currentPumpActivity.type==="timedHold"||t.currentPumpActivity.type==="profile"}if(e.type===c.THERMOCYCLER_MODULE_TYPE){const t=e;return t.currentBlockActivity.type==="profile"||t.currentBlockActivity.type==="blockTargetTemp"}return!1},Yn=e=>{const{pipette:t,labware:r,invariantContext:n,prevRobotState:o}=e;if(n.config.OT_PD_DISABLE_MODULE_RESTRICTIONS)return!1;const a=t?n.pipetteEntities[t]:null,s=r?ee(o.labware[r]?.stack):null;if(!t||!r||!a||!s)return!1;const i=Object.keys(n.moduleEntities).some(l=>{const u=n.moduleEntities[l].model;if(Yh.includes(u)){const p=o.modules[l]?.slot;return p==="1"&&s==="4"||p==="3"&&s==="6"}else return!1});return c.GEN_ONE_MULTI_PIPETTES.includes(a.name)&&i},pe=(e,t,r)=>{const n=e.reduce((o,a)=>{if(o.errors.length>0)return o;const s=a(t,o.robotState);if("errors"in s)return{robotState:o.robotState,commands:o.commands,errors:s.errors,warnings:o.warnings};const i=[...o.commands,...s.commands],l=[...o.python?[o.python]:[],...s.python?[s.python]:[]].join(`
|
|
55
|
+
`),u=Ip(s.commands,t,o.robotState);return{...o,robotState:u.robotState,commands:i,warnings:[...o.warnings||[],...s.warnings||[],...u.warnings],...l&&{python:l}}},{robotState:r,commands:[],errors:[],warnings:[]});return n.errors.length>0?{errors:n.errors}:{commands:n.commands,warnings:n.warnings,...n.python&&{python:n.python}}},Xo=(e,t,r)=>{const n=Go(e,t[r]?.stack),o=n&&e[n].moduleState;return!!(o&&o.type===c.THERMOCYCLER_MODULE_TYPE&&o.lidOpen!==!0)},vE=e=>e.commandCreatorFnName!=="delay"&&e.commandCreatorFnName!=="engageMagnet"&&e.commandCreatorFnName!=="disengageMagnet"&&e.commandCreatorFnName!=="setTemperature"&&e.commandCreatorFnName!=="deactivateTemperature"&&"pipette"in e?e.pipette:null,PE=e=>e.commandCreatorFnName==="delay"||e.commandCreatorFnName==="engageMagnet"||e.commandCreatorFnName==="disengageMagnet"||e.commandCreatorFnName==="setTemperature"||e.commandCreatorFnName==="deactivateTemperature",RE=new Date("2025-03-19T00:00:00Z"),NE=2,kE=22;function CE(e,t,r){const{labware:n,modules:o,pipettes:a,commands:s,liquids:i}=e,l=t.protocolType==="python"?t.apiVersion:null,u=l!=null&&l[0]>=NE&&l[1]>=kE,p=t.protocolType==="json"&&r>=RE,d=c.getLabwareDefinitionsByURIForProtocol(s),f=i.reduce((b,w)=>{const{id:S,description:L,displayName:g,displayColor:T}=w;return{...b,[S]:{description:L,displayName:g??"Unknown Liquid",pythonName:"n/a",displayColor:T??"#B7B8B9",liquidGroupId:S}}},{}),m=o.reduce((b,w)=>{const{id:S,model:L}=w;return{...b,[S]:{id:S,type:c.getModuleType(L),model:L,pythonName:"n/a"}}},{}),h=n.reduce((b,w)=>{const{id:S,definitionUri:L}=w,g=d[L];return g==null||g.schemaVersion===3?b:{...b,[S]:{id:S,labwareDefURI:L,def:g,pythonName:"n/a"}}},{}),_=s.reduce((b,w)=>{if(w.commandType==="loadLidStack"&&w.result!=null){const{stackLabwareId:S,lidStackDefinition:L}=w.result;if(S!=null&&L!=null&&b[S]==null&&L.schemaVersion!==3)return{...b,[S]:{id:S,labwareDefURI:c.getLabwareDefURI(L),def:L,pythonName:"n/a"}}}return b},h),y=a.reduce((b,w)=>{const{id:S,pipetteName:L}=w,g=c.getPipetteSpecsV2(L),A=s.filter(R=>R.commandType==="pickUpTip"&&R.params.pipetteId===S).map(R=>_[R.params.labwareId]),E=Array.from(new Set(A.map(R=>R.labwareDefURI))),v=Array.from(new Set(A.map(R=>R.def)));return g==null||(b[S]={name:L,id:S,tiprackLabwareDef:v,tiprackDefURI:E,spec:g,pythonName:"n/a"}),b},{}),I=s.reduce((b,w)=>{if(w.commandType==="loadLidStack"&&w.result!=null){const{params:S}=w,L=cc(S);return{...b,stagingAreaEntities:{...b.stagingAreaEntities,...L}}}else if((w.commandType==="loadLabware"||w.commandType==="loadLid")&&w.result!=null){const{params:S}=w,L=cc(S);return{...b,stagingAreaEntities:{...b.stagingAreaEntities,...L}}}else if(w.commandType==="moveToAddressableArea"||w.commandType==="moveToAddressableAreaForDropTip"){const S=w.params.addressableAreaName,L=`${$()}:${S}`;let g=o_;S==="fixedTrash"?g="cutout12":S.includes("WasteChute")?g="cutoutD3":S.includes("movableTrash")&&(g=`cutout${S.split("movableTrash")[1]}`);let T=b.trashBinEntities;Object.values(b.trashBinEntities).some(E=>E.location===g)||(S.includes("movableTrash")?T={...b.trashBinEntities,[L]:{pythonName:"trash_bin_1",id:L,location:g}}:S==="fixedTrash"&&(T={...b.trashBinEntities,[L]:{pythonName:"trash_bin_1",id:L,location:g}}));let A=b.wasteChuteEntities;return S.includes("WasteChute")&&(A={[L]:{pythonName:"waste_chute",id:L,location:g}}),{...b,trashBinEntities:T,wasteChuteEntities:A}}return b},{wasteChuteEntities:{},trashBinEntities:{},stagingAreaEntities:{},runtimeParameters:{},gripperEntities:{},config:{OT_PD_DISABLE_MODULE_RESTRICTIONS:!0}});return{labwareEntities:_,pipetteEntities:y,moduleEntities:m,liquidEntities:u||p?f:{},...I}}const DE={A3:"A4",B3:"B4",C3:"C4",D3:"D4"};function ME(e,t){const r=e.reduce((s,i)=>i.commandType==="loadPipette"&&i.result!=null?{...s,[i.result.pipetteId]:{mount:i.params.mount}}:s,{}),n=e.reduce((s,i)=>{if(i.commandType==="loadModule"&&i.result!=null){const l=c.getModuleDef(i.params.model).moduleType;return{...s,[i.result.moduleId]:{slot:l===c.FLEX_STACKER_MODULE_TYPE?DE[i.params.location.slotName]:i.params.location.slotName,moduleState:n_[l]}}}return s},{}),o=e.reduce((s,i)=>{if(i.commandType==="loadLidStack"&&i.result!=null){const{result:l}=i,u=l.locationSequences,p=l.labwareIds,d=l.stackLabwareId,f=l.stackLocationSequence,m=h=>{if(c.locationIsOffDeck(h))return[h];if("slotName"in h)return[h.slotName];if("moduleId"in h){const _=n[h.moduleId]?.slot??"offDeck";return[h.moduleId,_]}else if("addressableAreaName"in h)return[h.addressableAreaName];return["offDeck"]};if(u!=null){const h=u.reduce((I,b)=>{const w=b.find(S=>S.kind==="onLabware");return w!=null&&(I[w.labwareId]=b),I},{}),_=p.reduce((I,b,w)=>{const S=h[b]??u[w];if(S!=null){const L=uc(S);I[b]={stack:L[0]===b?L:[b,...L]}}else{const L=i.params.location;c.locationIsOffDeck(L)?I[b]={stack:[b,L]}:"slotName"in L?I[b]={stack:[b,L.slotName]}:I[b]={stack:[b,"offDeck"]}}return I},{}),y=d!=null&&f!=null?[d,...uc(f)]:null;return{...s,..._,...d!=null&&y!=null?{[d]:{stack:y}}:{}}}else{const h=i.params.location,_=p.reduce((I,b)=>{if(c.locationIsOffDeck(h))I[b]={stack:[b,h]};else if("slotName"in h)I[b]={stack:[b,h.slotName]};else if("moduleId"in h){const w=h.moduleId;I[b]={stack:[b,w,n[w].slot]}}else I[b]={stack:[b,"offDeck"]};return I},{}),y=d!=null?[d,...m(h)]:null;return{...s,..._,...d!=null&&y!=null?{[d]:{stack:y}}:{}}}}else if((i.commandType==="loadLabware"||i.commandType==="loadLid")&&i.result!=null){const l=[i.result.labwareId];if(c.locationIsOffDeck(i.params.location))l.push(i.params.location);else if("slotName"in i.params.location)l.push(i.params.location.slotName);else if("moduleId"in i.params.location){const u=i.params.location.moduleId;if(n[u]==null)return console.warn(`Module ${u} not found when processing loadLabware/loadLid command. `),s;l.push(i.params.location.moduleId,n[i.params.location.moduleId].slot)}else if("labwareId"in i.params.location){const u=i.params.location.labwareId;s[u]==null&&(console.warn(`Parent labware ${u} not found when processing loadLabware/loadLid command. `),s[u]={stack:[u,"offDeck"]});const p=s[u].stack;l.push(u,...p)}else l.push(i.params.location.addressableAreaName);return{...s,[i.result.labwareId]:{stack:l}}}else{if(i.commandType==="flexStacker/setStoredLabware")return Ih(i).forEach(u=>{bh(s,u,"setStoredLabwareCount")}),s;if(i.commandType==="flexStacker/fill")return Ih(i).forEach(u=>{bh(s,u,"fillCount")}),s}return s},{}),a=ep({invariantContext:t,labwareLocations:o,moduleLocations:n,pipetteLocations:r});return{frame:{...Ip(e,t,a),command:e[e.length-1]},invariantContext:t}}const bh=(e,t,r)=>{const n=e[t]??{stack:[t,"offDeck"]};e[t]={...n,[r]:(n[r]??0)+1}},Ih=e=>e.result?.storedLabware?.flatMap(r=>[r.primaryLabwareId,r.adapterLabwareId,r.lidLabwareId].filter(n=>n!=null))??[],Tp=(e,t)=>e??(t.channels===1?c.SINGLE:t.channels===96?c.ALL:c.COLUMN);var Bu,Th;function FE(){if(Th)return Bu;Th=1;var e=qc();function t(r,n){var o;return e(r,function(a,s,i){return o=n(a,s,i),!o}),!!o}return Bu=t,Bu}var xu,wh;function $E(){if(wh)return xu;wh=1;var e=y_(),t=Bn(),r=FE(),n=nt(),o=Bc();function a(s,i,l){var u=n(s)?e:r;return l&&o(s,i,l)&&(i=void 0),u(s,t(i,3))}return xu=a,xu}var UE=$E();const Qo=Ye(UE),Kn=(e,t)=>Qo(e,r=>r.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&r.moduleState.latchOpen!==!1&&c.getAreSlotsHorizontallyAdjacent(r.slot,t)),Zn=(e,t,r)=>r.channels!==1&&Qo(e,n=>n.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsHorizontallyAdjacent(n.slot,t)),Jo=(e,t,r,n)=>r.channels!==1&&!n.def.parameters.isTiprack&&Qo(e,o=>o.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&c.getAreSlotsVerticallyAdjacent(o.slot,t)),sb=(e,t,r)=>Qo(e,(o,a)=>c.getAreSlotsHorizontallyAdjacent(r,ee(o.stack))&&c.getIsLabwareAboveHeight(t[a].def,c.MAX_LABWARE_HEIGHT_EAST_WEST_HEATER_SHAKER_MM)),ea=(e,t,r)=>{const n=Go(e,t[r]?.stack),o=n!=null?e[n].moduleState:null;return!!(o&&o.type===c.HEATERSHAKER_MODULE_TYPE&&o.latchOpen!==!1)},Xn=(e,t,r)=>Qo(e,n=>n.moduleState.type===c.HEATERSHAKER_MODULE_TYPE&&n.moduleState.targetSpeed!=null&&n.moduleState.targetSpeed>0&&(r===c.OT2_ROBOT_TYPE?c.getAreSlotsAdjacent(n.slot,t):c.getAreFlexSlotsAdjacent(n.slot,t))),ta=(e,t,r)=>{const n=Go(e,t[r]?.stack),o=n!=null?e[n].moduleState:null;return!!(o&&o.type===c.HEATERSHAKER_MODULE_TYPE&&o.targetSpeed!==null)},Za=e=>{const{args:t,pipetteName:r,tiprackUri:n,liquidClassValuesForTip:o}=e;let a=null;"mixBeforeAspirate"in t?a=t.mixBeforeAspirate:"mixFirstAspirate"in t&&(a=t.mixFirstAspirate);const s=qE(t),i={dispense_position:{offset:{x:t.dispenseXOffset,y:t.dispenseYOffset,z:t.dispenseZOffset},position_reference:t.dispensePositionReference},flow_rate_by_volume:[[0,t.dispenseFlowRateUlSec??0]],delay:{enabled:!!t.dispenseDelay?.seconds,...t.dispenseDelay?.seconds?{duration:t.dispenseDelay?.seconds}:{}},submerge:{delay:{enabled:!!t.dispenseSubmergeDelay?.seconds,...t.dispenseSubmergeDelay?.seconds?{duration:t.dispenseSubmergeDelay?.seconds}:{}},speed:t.dispenseSubmergeSpeed??void 0,start_position:{offset:{x:t.dispenseSubmergeXOffset,y:t.dispenseSubmergeYOffset,z:t.dispenseSubmergeZOffset},position_reference:t.dispenseSubmergePositionReference}},retract:{air_gap_by_volume:[[0,t.dispenseAirGapVolume??0]],delay:{enabled:!!t.dispenseRetractDelay?.seconds,...t.dispenseRetractDelay?.seconds?{duration:t.dispenseRetractDelay?.seconds}:{}},end_position:{offset:{x:t.dispenseRetractXOffset,y:t.dispenseRetractYOffset,z:t.dispenseRetractZOffset},position_reference:t.dispenseRetractPositionReference},speed:t.dispenseRetractSpeed??void 0,touch_tip:{enabled:t.touchTipAfterDispense,z_offset:t.touchTipAfterDispense?t.touchTipAfterDispenseOffsetMmFromTop:void 0,mm_from_edge:t.touchTipAfterDispense&&t.touchTipAfterDispenseMmFromEdge!=null?t.touchTipAfterDispenseMmFromEdge:void 0,speed:t.touchTipAfterDispense?t.touchTipAfterDispenseSpeed:void 0},blowout:{enabled:t.blowoutLocation!=null,location:ib(t.blowoutLocation),flow_rate:t.blowoutLocation!=null?t.blowoutFlowRateUlSec:void 0,...s!=null?{blowout_position:s}:{}}}},l={[r]:{[n]:{aspirate:{aspirate_position:{offset:{x:t.aspirateXOffset,y:t.aspirateYOffset,z:t.aspirateZOffset},position_reference:t.aspiratePositionReference},flow_rate_by_volume:[[0,t.aspirateFlowRateUlSec]],pre_wet:t.preWetTip,correction_by_volume:o?.aspirate.correctionByVolume??[[0,0]],delay:{enabled:!!t.aspirateDelay?.seconds,...t.aspirateDelay?.seconds?{duration:t.aspirateDelay?.seconds}:{}},mix:{enabled:!!a?.volume,...a?.times?{repetitions:a.times}:{},...a?.volume?{volume:a.volume}:{}},submerge:{delay:{enabled:!!t.aspirateSubmergeDelay?.seconds,...t.aspirateSubmergeDelay?.seconds?{duration:t.aspirateSubmergeDelay?.seconds}:{}},speed:t.aspirateSubmergeSpeed??void 0,start_position:{offset:{x:t.aspirateSubmergeXOffset,y:t.aspirateSubmergeYOffset,z:t.aspirateSubmergeZOffset},position_reference:t.aspirateSubmergePositionReference}},retract:{air_gap_by_volume:[[0,t.aspirateAirGapVolume??0]],delay:{enabled:!!t.aspirateRetractDelay?.seconds,...t.aspirateRetractDelay?.seconds?{duration:t.aspirateRetractDelay?.seconds}:{}},end_position:{offset:{x:t.aspirateRetractXOffset,y:t.aspirateRetractYOffset,z:t.aspirateRetractZOffset},position_reference:t.aspirateRetractPositionReference},speed:t.aspirateRetractSpeed??void 0,touch_tip:{enabled:t.touchTipAfterAspirate,z_offset:t.touchTipAfterAspirate?t.touchTipAfterAspirateOffsetMmFromTop:void 0,mm_from_edge:t.touchTipAfterAspirate&&t.touchTipAfterAspirateMmFromEdge!=null?t.touchTipAfterAspirateMmFromEdge:void 0,speed:t.touchTipAfterAspirate?t.touchTipAfterAspirateSpeed:void 0}}},dispense:{...i,correction_by_volume:o?.singleDispense.correctionByVolume??[[0,0]],push_out_by_volume:[[0,t.pushOut??0]],mix:{enabled:"mixInDestination"in t?t.mixInDestination!=null:!1,repetitions:"mixInDestination"in t?t.mixInDestination?.times??void 0:void 0,volume:"mixInDestination"in t?t.mixInDestination?.volume??void 0:void 0}},...t.commandCreatorFnName==="distribute"?{multi_dispense:{...i,correction_by_volume:o?.multiDispense?.correctionByVolume??[[0,0]],..."conditioningVolume"in t?{conditioning_by_volume:[[0,t.conditioningVolume??0]]}:{},..."disposalVolume"in t?{disposal_by_volume:[[0,t.disposalVolume??0]]}:{}}}:{}}}},u=JSON.parse(JSON.stringify(l));return zr(u)},ra=(e,t)=>`${c.getAllLiquidClassDefs()[e].liquidClassName}${t?"_base_class":""}`,ib=e=>{if(e!=null)return e===Xr?"source":e===zn?"destination":"trash"},qE=e=>{const t=ib(e.blowoutLocation);return!t||t==="trash"?null:{offset:{x:e.blowoutXPosition??0,y:e.blowoutYPosition??0,z:e.blowoutOffsetFromTopMm??1},position_reference:e.blowoutPositionReference??c.POSITION_REFERENCE_TOP}},Xa=e=>{const{labwareEntities:t,tiprackIds:r}=e;return`tip_racks=[${r.map(o=>t[o].pythonName).join(", ")}]`};var zu,Sh;function VE(){if(Sh)return zu;Sh=1;var e="Expected a function";function t(r){if(typeof r!="function")throw new TypeError(e);return function(){var n=arguments;switch(n.length){case 0:return!r.call(this);case 1:return!r.call(this,n[0]);case 2:return!r.call(this,n[0],n[1]);case 3:return!r.call(this,n[0],n[1],n[2])}return!r.apply(this,n)}}return zu=t,zu}var Hu,gh;function BE(){if(gh)return Hu;gh=1;var e=pp(),t=qn(),r=Ma(),n=pr(),o=Vn();function a(s,i,l,u){if(!n(s))return s;i=t(i,s);for(var p=-1,d=i.length,f=d-1,m=s;m!=null&&++p<d;){var h=o(i[p]),_=l;if(h==="__proto__"||h==="constructor"||h==="prototype")return s;if(p!=f){var y=m[h];_=u?u(y,h,m):void 0,_===void 0&&(_=n(y)?y:r(i[p+1])?[]:{})}e(m,h,_),m=m[h]}return s}return Hu=a,Hu}var ju,Eh;function xE(){if(Eh)return ju;Eh=1;var e=$a(),t=BE(),r=qn();function n(o,a,s){for(var i=-1,l=a.length,u={};++i<l;){var p=a[i],d=e(o,p);s(d,p)&&t(u,r(p,o),d)}return u}return ju=n,ju}var Wu,Ah;function zE(){if(Ah)return Wu;Ah=1;var e=Bo(),t=Bn(),r=xE(),n=mp();function o(a,s){if(a==null)return{};var i=e(n(a),function(l){return[l]});return s=t(s),r(a,i,function(l,u){return s(l,u[0])})}return Wu=o,Wu}var Gu,Lh;function HE(){if(Lh)return Gu;Lh=1;var e=Bn(),t=VE(),r=zE();function n(o,a){return r(o,t(e(a)))}return Gu=n,Gu}var jE=HE();const WE=Ye(jE);function lb(e){return Object.keys(e.wells)}const GE=(e,t)=>{const r=Object.keys(e||{}).filter(n=>e[n]&&e[n].volume>0);return{wellName:t,groupIds:r,ingreds:WE(e,n=>!n||n.volume<=0)}},YE=(e,t)=>{const r=lb(t);return mt(r,(n,o)=>{const a=e&&e[o];return{...n,[o]:a?GE(e[o],o):{}}},{})},KE=(e,t)=>{const r={};return t.forEach(n=>{const o=e!=null?Object.values(e).reduce((a,s)=>{if(s.groupIds.indexOf(n)!==-1){const l=s.ingreds[n];l?.volume!=null&&(a[s.wellName??"A1"]=l.volume)}return a},{}):{};r[n]=o}),r},ZE=e=>{const t=e.flatMap(r=>r==null?[]:Object.values(r).flatMap(n=>n.groupIds.filter(o=>o!==Ke)));return Array.from(new Set(t))},XE=e=>{const t=e!=null?Object.values(e).flatMap(r=>r.groupIds)?.filter(r=>r!==Ke):[];return Array.from(new Set(t))},ub="#737578",cb=e=>{const t=Number(e);return Number.isInteger(t)?c.DEFAULT_LIQUID_COLORS[t%c.DEFAULT_LIQUID_COLORS.length]:(e!==Ke&&console.warn(`swatchColors expected an integer or ${Ke}, got ${e}`),"transparent")},QE=(e,t)=>{const r=e.filter(n=>n!==Ke);return r.length===0?null:r.length===1?t[r[0]]??cb(r[0]):ub},JE=(e,t)=>mt(e,(r,n,o)=>{const a=QE(n.groupIds,t);return a?{...r,[o]:a}:r},{});var Yu,Oh;function eA(){if(Oh)return Yu;Oh=1;function e(t,r){return t>r}return Yu=e,Yu}var Ku,vh;function tA(){if(vh)return Ku;vh=1;var e=Gh(),t=eA(),r=$o();function n(o){return o&&o.length?e(o,r,t):void 0}return Ku=n,Ku}var rA=tA();const nA=Ye(rA),pb="2.31",oA="9.0.1";function aA(){return["import json","from opentrons import protocol_api, types"].join(`
|
|
56
56
|
`)}function sA(e){function t(n){return n?new Date(n).toISOString():""}const r=Object.fromEntries(Object.entries({protocolName:e.protocolName,author:e.author,description:e.description,created:t(e.created),internalAppBuildDate:e.internalAppBuildDate,lastModified:t(e.lastModified),category:e.category,subcategory:e.subcategory,tags:e.tags?.length&&e.tags.join(", "),protocolDesigner:e.protocolDesigner,source:e.source}).filter(([n,o])=>o));return`metadata = ${zr(r)}`}function iA(e){const r={robotType:{[c.OT2_ROBOT_TYPE]:"OT-2",[c.FLEX_ROBOT_TYPE]:"Flex"}[e],apiLevel:pb};return`requirements = ${zr(r)}`}function db(e,t){const r=Object.keys(e).length>0,n=r?Object.values(e).map(o=>`${o.pythonName} = ${ge}.load_module(${q(o.model)}, ${q(t[o.id].slot)})`).join(`
|
|
57
57
|
`):"";return r?`# Load Modules:
|
|
58
58
|
${n}`:""}function fb(e,t,r){const n=Object.values(t).filter(a=>a.def.allowedRoles?.includes("adapter")),o=Object.values(n).toSorted((a,s)=>{const i=r[a.id].stack,l=r[s.id].stack;return i.includes(s.id)?1:l.includes(a.id)?-1:0}).map(a=>{const{id:s,def:i,pythonName:l}=a,{parameters:u,namespace:p,version:d}=i,f=r[s].stack[1],m=r[s].stack.find(w=>w in e),h=r[s].stack.some(w=>w===l_),_=f in t?t[f]:null;let y,I=null;if(_!=null)y=_.pythonName,I=null;else if(m!=null){const w=e[m];[y,I]=h?[ge,`location=${w.pythonName}.manifold_dock`]:[w.pythonName,null]}else y=ge,I=`location=${f==="offDeck"?Cn:q(f)}`;if(c.getLabwareDefIsStandard(i)){const w=[`${q(u.loadName)}`,...I?[I]:[],`namespace=${q(p)}`,`version=${d}`].join(`,
|
|
@@ -122,34 +122,34 @@ ${s.join(`
|
|
|
122
122
|
${Q(a)},
|
|
123
123
|
)`}).join(`
|
|
124
124
|
`);return t?`def add_parameters(parameters: protocol_api.ParameterContext) -> None:
|
|
125
|
-
${Q(t)}`:""}const hA=(e,t,r,n)=>{const{spec:o}=t,a=e===c.ROW,s=e===c.COLUMN||e===c.ALL&&o.channels===8,i=n.ordering[0].length===1;if(a&&i){const u=s?`H${r.slice(1)}`:`${r.charAt(0)}12`,p=o.nozzleMap[u],d=o.nozzleMap[r],f=p.map((_,y)=>_-d[y]),m=[f[0]/2,f[1]/2,0],h=d.map((_,y)=>_+m[y]);return{x:h[0],y:h[1],z:h[2]}}const l=o.nozzleMap[r];return{x:l[0],y:l[1],z:l[2]}},Ln={back_left:{x:-43.25,y:454.9,z:211.91},front_right:{x:128.75,y:402,z:211.91}},Ph={x:Ln.back_left.x,y:Ln.back_left.y,z:Ln.back_left.z},_A={x:Ln.front_right.x,y:Ln.front_right.y,z:Ln.front_right.z},yA=49.5,Eb=e=>{if(e.addressableArea?.areaType==="slot"){const t=`cutout${e.addressableArea?.id}`;if(t)return t}return null},bA=(e,t,r,n,o,a,s)=>{const{pipetteBoundingBoxOffsets:i}=e.spec,l=hA(a,e,o,n),u=i.backLeftCorner[0],p=i.frontRightCorner[0],d=i.backLeftCorner[1],f=i.frontRightCorner[1],m=r.x-(l.x-u),h=r.x+(p-l.x),_=r.y+(d-l.y),y=r.y-(l.y-f),I=(r.z??0)+t-s;return[{x:m,y:_,z:I},{x:h,y,z:I},{x:h,y:_,z:I},{x:m,y,z:I}]},Ab=(e,t)=>{const r=e[1].x<t[0].x,n=e[0].x>t[1].x,o=e[0].y<t[1].y,a=e[1].y>t[0].y;return!(r||n||o||a)},Rh=(e,t)=>{if(t===c.FLEX_ROBOT_TYPE){const r=c.getDeckDefFromRobotType(t),{addressableAreas:n}=r.locations;return n.find(a=>a.id.includes(e))?.offsetFromCutoutFixture[2]??0}return c.getModuleDef(e).dimensions.bareOverallHeight},IA=e=>{const t=c.getDeckDefFromRobotType(e);return Object.values(t.cutoutFixtures).find(n=>c.WASTE_CHUTE_FIXTURES.includes(n.id))?.height??0},TA=(e,t,r,n)=>{const{modules:o,labware:a}=e,{moduleEntities:s,labwareEntities:i,wasteChuteEntities:l}=t;let u=0;const p=r?.addressableArea?.id;if(p){const d=Ha(a,p),f=Object.keys(o).find(h=>o[h].slot===p);Object.values(l).find(h=>h.location===Eb(r))&&(u+=IA(n)),d.length>0?d.forEach(h=>{o[h]!=null&&(u+=Rh(s[h].model,n)),a[h]!=null&&(u+=i[h].def.dimensions.zDimension)}):f!=null&&(u+=Rh(s[f].model,n))}return u},wA=(e,t,r,n,o)=>{for(const a of t){const s=a.addressableArea?.boundingBox,i=a.position;if(i==null||s==null)continue;const l={x:i[0],y:s.yDimension+i[1],z:i[2]},u={x:i[0]+s.xDimension,y:i[1],z:i[2]};if(Ab([e[0],e[1]],[l,u])&&e[0].z!=null&&TA(r,n,a,o)>=e[0]?.z&&a.addressableArea!=null)return{addressableAreaCausingCollision:a.addressableArea}}return null},SA=(e,t)=>Object.values(t).find(r=>r.type===c.THERMOCYCLER_MODULE_TYPE)?Ab([Ph,_A],[e[0],e[1]])&&e[0].x<=Ph.z:!1,gA=(e,t,r,n)=>{const{wells:o}=e.def,a=o[t];return{x:a.x+r.x,y:a.y+r.y,z:n?a.z+(r.z??0):e.def.dimensions.zDimension}},bt=e=>{const{robotState:t,invariantContext:r,pipetteId:n,labwareId:o,wellLocationOffset:a={x:0,y:0,z:0},wellTargetName:s,primaryNozzle:i,nozzleConfiguration:l,tiprackId:u}=e,{pipetteEntities:p,labwareEntities:d,stagingAreaEntities:f,moduleEntities:m}=r,{labware:h,tipState:_}=t,y=p[n];if(y==null)return{isSafe:!0};const{spec:I}=y,{channels:b}=I,L=I?.displayCategory==="FLEX"?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE,g=c.getDeckDefFromRobotType(L);if(d[o]==null||s==null||b===1)return{isSafe:!0};const T=u?!0:_.pipettes[n]?.hasTip??!1,A=u??_.pipettes[n]?.tiprackURI,E=A!=null?d[A]:null,v=E!=null?E.def.parameters.tipLength:0,R=Object.values(f).map(k=>k.location),M=T?v??0:0,F=ee(h[o].stack),G=h[o].stack.some(k=>m[k]?.type===c.THERMOCYCLER_MODULE_TYPE),Y=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE),oe=(G?c.getPositionFromSlotId(c.B1_ADDRESSABLE_AREA,Y):c.getPositionFromSlotId(F,g))??[0,0,0],fe=G?Y.locations.addressableAreas.find(k=>k.id===c.THERMOCYCLER_MODULE_V2)?.offsetFromCutoutFixture??[0,0,0]:[0,0,0],J={x:fe[0]+oe[0],y:fe[1]+oe[1],z:fe[2]+oe[2]},{def:Re}=d[o],Ve=Ob({wellTargetName:s,primaryNozzle:i,nozzleConfiguration:l,specs:I,labwareDef:Re}),Me={x:a.x+Ve.x+J.x,y:a.y+Ve.y+J.y,z:(a.z??0)+(J.z??0)},We=gA(d[o],s,Me,T),ie=E!=null?EA({pipetteSpecs:I,tiprackUri:E.labwareDefURI,nozzles:l}):0,Ne=d[o].def,Be=bA(y,M,We,Ne,i,l,ie);if(!LA({channels:b,boundingBox:Be,robotType:L}))return{isSafe:!1,reason:{type:"outsidePipetteExtents"}};const K=(L===c.OT2_ROBOT_TYPE?c.getOt2SurroundingSlots(F):c.getFlexSurroundingSlots(F,R)).map(k=>{const B=c.getAddressableAreaFromSlotId(k,g),$=c.getPositionFromSlotId(k,g);return{addressableArea:B,position:$}});if(SA(Be,m))return{isSafe:!1,reason:{type:"thermocyclerLidCollision"}};const j=wA(Be,K,t,r,L);return j!=null?{isSafe:!1,reason:{type:"adjacentAdressableAreaCollision",addressableAreaCausingCollision:j.addressableAreaCausingCollision}}:{isSafe:!0}},wp=e=>{const{tipState:t,primaryNozzle:r,channels:n,nozzleConfiguration:o,wellName:a,tiprackDef:s,tipsToIgnore:i=[]}=e,{ordering:l}=s;if(n===1)return{isSafe:!0,isComplete:t[a]!==_e};if(n===8){const u=r!==c.A1_NOZZLE,p=bc(a),d=l[p],f=u?[...d].reverse():d;if(o===c.SINGLE){const m=f.indexOf(a);return{isSafe:f.slice(m+1).every(h=>t[h]===_e||i.includes(h)),isComplete:t[a]!==_e}}if(o===c.PARTIAL_COLUMN){const m=f.indexOf(a),h=c.PARTIAL_NOZZLE_MAP[r],_=u?f.slice(m-h+1,m+1):f.slice(m,m+h);return{isSafe:f.slice(m+1).every(y=>t[y]===_e||i.includes(y)),isComplete:_.every(y=>t[y]!==_e&&!i.includes(y))}}return{isSafe:!0,isComplete:f.every(m=>t[m]!==_e)}}if(o===c.ALL)return{isSafe:!0,isComplete:Object.keys(s.wells).every(u=>t[u]!==_e)};if(o===c.COLUMN){const u=r===c.A12_NOZZLE,p=bc(a),d=l[p],f=u?[...l].reverse():l,m=f.indexOf(d);return{isSafe:f.slice(m+1).flat().every(h=>t[h]===_e||i.includes(h)),isComplete:f[m].every(h=>t[h]!==_e)}}if(o===c.ROW){const u=l[0].map((m,h)=>l.map(_=>_[h])),d=r===c.H1_NOZZLE?[...u].reverse():u,f=d.findIndex(m=>m.some(h=>h===a));return{isSafe:d.slice(f+1).flat().every(m=>t[m]===_e||i.includes(m)),isComplete:d[f].every(m=>t[m]!==_e)}}if(o===c.SINGLE){const u=On(r??ga({nozzles:o,channels:n})),p=Sp(r??ga({nozzles:o,channels:n})),d=u==="H",m=p==="12"?[...l].reverse():l,h=m.findIndex(_=>_.some(y=>y===a));return{isSafe:m.slice(h).every(_=>{const y=d?[..._].reverse():_,I=y.findIndex(b=>On(b)===On(a));return y.slice(I).every(b=>t[b]===_e||i.includes(b)||b===a)}),isComplete:t[a]!==_e}}return{isSafe:!1}},On=e=>e.slice(0,1),Sp=e=>e.slice(1),bc=e=>parseInt(e.slice(1))-1,ga=e=>{const{nozzles:t,channels:r}=e;if(r===8&&t===c.SINGLE)return"H1";if(r===96){if(t===c.COLUMN)return"A12";if(t===c.SINGLE)return"H12"}return"A1"},na=e=>{const{wellSets:t,nozzles:r,channels:n,primaryNozzle:o}=e;return r===c.ROW?t.map(a=>a[0]):t.map(a=>n===96&&r===c.ALL?o:r===c.COLUMN||n===8&&r===c.ALL||n===8&&r===c.PARTIAL_COLUMN?On(o)==="H"?a[a.length-1]:a[0]:(console.assert(a.length===1,"Well set for SINGLE nozzle configuration should have exactly 1 well"),a[0]))},EA=e=>{const{pipetteSpecs:t,tiprackUri:r,nozzles:n}=e,{channels:o}=t,a=AA(o,n),s=t.pickUpTipConfigurations.pressFit.configurationsByNozzleMap[a]?.default.tipOverlaps;if(s==null)return console.error(`No tip overlaps found for ${n} and ${a} overlap.`),0;const i=Math.max(...Object.keys(s).map(l=>Number(l.slice(1))));return s[`v${i}`]?.[r]??s[`v${i}`]?.default??0},AA=(e,t)=>{if(e===1)return"SingleA1";if(e===8)return t===c.SINGLE?"SingleH1":"Full";if(e===96){if(t===c.SINGLE)return"SingleH12";if(t===c.COLUMN)return"Column12";if(t===c.ROW)return"RowA"}return"Full"},LA=e=>{const{channels:t,boundingBox:r,robotType:n}=e,o=c.getRobotDefFromRobotType(n),{paddingOffsets:a}=o,{front:s,rear:i,leftSide:l,rightSide:u}=a,[p,d]=o.extents,[f,m]=r,{x:h,y:_}=f,{x:y,y:I}=m;if(t===96){if(y<l)return!1;const b=p+u;if(h>b)return!1}if(t!==1){if(_<s)return!1;const b=d+i;if(I>b)return!1}return!0},Lb=e=>{const{channels:t,nozzleMap:r}=e;if(t===1)return 0;const[n,o]=["A1","B1"].map(s=>r[s][1]);return Math.abs(n-o)},Ob=e=>{const t=OA(e),r=vA(e);return{x:t,y:r}},OA=e=>{const{primaryNozzle:t,nozzleConfiguration:r,specs:n,labwareDef:o}=e,{channels:a}=n;if(a!==96)return 0;const{ordering:s}=o,i=s.length===1;if(!i)return 0;let l;const u=Sp(t)==="12"?1:-1;if(r===c.ALL&&a===96||r===c.ROW)l=12;else if(r===c.QUADRANT)l=6;else return u*yA;const p=Lb(n);return i?(l-1)*p/2*u:0},vA=e=>{const{wellTargetName:t,primaryNozzle:r,nozzleConfiguration:n,specs:o,labwareDef:a}=e,{channels:s}=o;if(s===1)return 0;const i=Lb(o),{ordering:l}=a,u=l.findIndex(f=>f.includes(t));if(l[u].length!==1)return 0;if(n===c.PARTIAL_COLUMN){const m=-1*(8-c.PARTIAL_NOZZLE_MAP[r])*i,h=7*i/2;return m+h}const d=On(r)==="H"?-1:1;return 7*i/2*d};function vb(e){const t=e.length===1?e[0]:null;return t!=null&&"steps"in t?{numRepetitions:t.repetitions,repeatingProfileSteps:t.steps}:{numRepetitions:1,repeatingProfileSteps:gp(e)}}function gp(e){return e.flatMap(t=>"steps"in t?by(t.steps,t.repetitions):t)}const PA=e=>{switch(e.commandCreatorFnName){case"consolidate":return P(qb,e);case"delay":return P(Ie,e);case"waitForModuleTask":return P(Kb,e);case"distribute":return P(Vb,e);case"transfer":return P(Hb,e);case"mix":return P($b,e);case"moveLabware":return P(K_,e);case"captureImage":return P(q_,e);case"engageMagnet":return P(H_,e);case"disengageMagnet":return P(z_,e);case"setTemperature":return P(jc,e);case"deactivateTemperature":return P(x_,e);case"waitForTemperature":return P(Kc,e);case"thermocyclerProfile":return P(xb,e);case"thermocyclerState":return P(zb,e);case"heaterShaker":return P(Bb,e);case"comment":return P(V_,e);case"absorbanceReaderOpenLid":return P(U_,e);case"absorbanceReaderCloseLid":return P($a,e);case"absorbanceReaderRead":return P(kb,e);case"absorbanceReaderInitialize":return P(Nb,e);case"flexStackerEmpty":return P(j_,{...e,strategy:"manualWithPause"});case"flexStackerFillItems":return P(W_,e);case"flexStackerRetrieve":return P(G_,e);case"flexStackerStore":return P(Y_,{...e,strategy:"automatic"});case"vacuumCloseVent":return P(jo,e);case"vacuumOpenVent":return P(X_,e);case"vacuumSetPumpPower":return P(Wc,e);case"vacuumSetPumpPressure":return P(Gc,e);case"vacuumStartRunProfile":return P(Yc,e);case"vacuumStopPump":return P(ny,e);case"vacuumCloseVentSetPumpPressure":return P(Wb,e);case"vacuumCloseVentSetPumpPower":return P(jb,e);case"vacuumCloseVentStartProfile":return P(Gb,e);case"airGapInPlace":return P(Pt,e);case"aspirate":return P(Pt,e);case"aspirateInPlace":return P(Ho,e);case"aspirateWhileTracking":return P($w,e);case"blowOutInPlace":return P(xn,e);case"blowout":return P(xc,e);case"configureForVolume":return P(kn,e);case"configureNozzleLayout":return P(B_,e);case"dispense":return P(zc,e);case"dispenseInPlace":return P(tt,e);case"dispenseWhileTracking":return P(qw,e);case"dropTip":return P(Zr,e);case"dropTipInPlace":return P(qa,e);case"home":return P(Vw,e);case"moveRelative":return P(Bw,e);case"moveToAddressableArea":return P(qe,e);case"moveToAddressableAreaForDropTip":return P(Hc,e);case"moveToCoordinates":return P(xw,e);case"moveToWell":return P(H,e);case"pickUpTip":return P(ya,e);case"prepareToAspirate":return P(Rt,e);case"touchTip":return P(Ot,e);case"tryLiquidProbe":return P(zw,e);case"heaterShaker/closeLabwareLatch":return P(oy,e);case"heaterShaker/openLabwareLatch":return P(ay,e);case"heaterShaker/setAndWaitForShakeSpeed":return P(sy,e);case"heaterShaker/deactivateHeater":return P(ic,e);case"heaterShaker/deactivateShaker":return P(lc,e);case"thermocycler/closeLid":return P(Zc,e);case"thermocycler/openLid":return P(uy,e);case"thermocycler/deactivateBlock":return P(iy,e);case"thermocycler/deactivateLid":return P(ly,e);case"thermocycler/setTargetBlockTemperature":return P(cy,e);case"thermocycler/setTargetLidTemperature":return P(Xc,e);case"thermocycler/startRunExtendedProfile":return P(Z_,e)}},U=nT;function Pb(e){return Object.keys(e).sort((r,n)=>{const o=ee(e[r].stack),a=ee(e[n].stack),s=parseInt(o),i=parseInt(a);return De.includes(o)&&De.includes(a)?r.localeCompare(n):De.includes(o)?1:De.includes(a)?-1:s-i})}function Rb(e){const{pipetteId:t,tiprackId:r,invariantContext:n,robotState:o,nozzles:a,primaryNozzle:s}=e,i=n.pipetteEntities[t]?.spec?.channels,l=n.labwareEntities[r]?.def,u=o.tipState.tipracks[r];if(!i||!l||!u)return console.assert(!1,`Pipette ${t} missing channels/spec or tiprack definition`),null;const p=E=>u[E]===qo,d=c.orderWells(l.ordering,"t2b","l2r"),f=c.orderWells(l.ordering,"b2t","l2r"),m=E=>E.find(p)??null,h=E=>[...E].reverse().find(p)??null,_=E=>E.find(v=>v.every(p))??null,y=E=>[...E].reverse().find(v=>v.every(p))??null,I=i===8&&a===c.SINGLE,b=I&&s===c.H1_NOZZLE,w=I&&s===c.A1_NOZZLE,S=i===96&&a===c.SINGLE,L=S&&s===c.H12_NOZZLE,g=S&&s===c.A12_NOZZLE,T=S&&s===c.H1_NOZZLE,A=S&&s===c.A1_NOZZLE;if(i===1||b||L)return m(d);if(w)return m(f);if(a===c.PARTIAL_COLUMN){const E=m(d);if(!E)return null;const v=d.indexOf(E);return d[v]??null}if(a===c.ALL&&i===8)return _(l.ordering)?.[0]??null;if(A)return h(d);if(g)return m(f);if(T)return h(f);if(a===c.COLUMN){const E=l.ordering;return(s===c.A1_NOZZLE?y(E):_(E))?.[0]??null}if(a===c.ROW){const E=l.ordering,v=E[0].map((M,F)=>E.map(G=>G[F]));return(s===c.A1_NOZZLE?y(v):_(v))?.[0]??null}return a===c.ALL&&i===96?d.every(p)?d[0]:null:(console.assert(!1,`Unhandled _getNextTip case for pipette ${t}`),null)}function oa(e,t,r,n,o,a){const s=r.pipetteEntities[e];if(!s)throw new Error(`cannot getNextTiprack, no pipette entity for pipette "${e}"`);const i=[],l=Pb(n.labware).filter(h=>{console.assert(r.labwareEntities[h]?.labwareDefURI!=null,`cannot getNextTiprack, no labware entity for "${h}"`);const _=ee(n.labware[h].stack),y=Ny(_),I=Ry({labwareId:h,labwareRobotState:n.labware,labwareEntities:r.labwareEntities});if(y&&I&&c.getIsTiprack(r.labwareEntities[h].def))return i.push(h),!1;const b=r.labwareEntities[h].labwareDefURI;return y&&b===t});let u=l;const p=s.spec.channels===96,d=[];p&&(u=u.filter(h=>{const _=n.labware[h].stack[1],y=r.labwareEntities[_],I=y?.def.parameters.loadName==="opentrons_flex_96_tiprack_adapter"&&c.getLabwareDefIsStandard(y?.def),b=a===c.ALL?I:!I;return b||d.push(h),b}));let f=null,m=null;for(const h of u){const _=Rb({pipetteId:e,tiprackId:h,nozzles:a,invariantContext:r,robotState:n,primaryNozzle:o}),{isSafe:y}=_!=null?bt({robotState:n,invariantContext:r,pipetteId:e,labwareId:h,wellTargetName:_,primaryNozzle:o,nozzleConfiguration:a}):{isSafe:!1},{isSafe:I,isComplete:b=!1}=_!=null?wp({tipState:n.tipState.tipracks[h],primaryNozzle:o,channels:s.spec.channels,nozzleConfiguration:a,wellName:_,tiprackDef:r.labwareEntities[h].def}):{isSafe:!1};if(_&&y&&I&&b){f=h,m=_;break}}return f&&m?{nextTiprack:{tiprackId:f,well:m},tipracks:{totalTipracks:l.length,excludedBy96Channel:d.length,excludedByLid:i.length,filteredSortedTiprackIds:u}}:{nextTiprack:null,tipracks:{totalTipracks:l.length,excludedBy96Channel:d.length,excludedByLid:i.length,filteredSortedTiprackIds:u}}}function Ja(e,t,r){const n=t.pipetteEntities[e],o=n.spec.liquids.default.maxVolume,a=n.tiprackLabwareDef;let s=null;for(const l of a)if(c.getLabwareDefURI(l)===r){s=l;break}const i=c.getTiprackVolume(s??a[0]);return!o||!i?(console.assert(!1,`getPipetteEffectiveMaxVol expected tiprackMaxVol and pipette maxVolume to be > 0, got',
|
|
126
|
-
${o}, ${i}`),NaN):qI([i,o])??NaN}function kt(e,t){return t in e.modules||console.warn(`getModuleState expected module id "${t}" to be in robot state`),e.modules[t]?.moduleState}const es=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.THERMOCYCLER_MODULE_TYPE?r:null},Qn=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.ABSORBANCE_READER_TYPE?r:null},It=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.FLEX_STACKER_MODULE_TYPE?r:null},pt=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.VACUUM_MODULE_TYPE?r:null},Nb=(e,t,r)=>{const{moduleId:n,measureMode:o,sampleWavelengths:a,referenceWavelength:s}=e,i=Qn(r,n),l=[];if(i==null&&l.push(de()),l.length>0)return{errors:l};const u=[P(
|
|
125
|
+
${Q(t)}`:""}const hA=(e,t,r,n)=>{const{spec:o}=t,a=e===c.ROW,s=e===c.COLUMN||e===c.ALL&&o.channels===8,i=n.ordering[0].length===1;if(a&&i){const u=s?`H${r.slice(1)}`:`${r.charAt(0)}12`,p=o.nozzleMap[u],d=o.nozzleMap[r],f=p.map((_,y)=>_-d[y]),m=[f[0]/2,f[1]/2,0],h=d.map((_,y)=>_+m[y]);return{x:h[0],y:h[1],z:h[2]}}const l=o.nozzleMap[r];return{x:l[0],y:l[1],z:l[2]}},Ln={back_left:{x:-43.25,y:454.9,z:211.91},front_right:{x:128.75,y:402,z:211.91}},Ph={x:Ln.back_left.x,y:Ln.back_left.y,z:Ln.back_left.z},_A={x:Ln.front_right.x,y:Ln.front_right.y,z:Ln.front_right.z},yA=49.5,Eb=e=>{if(e.addressableArea?.areaType==="slot"){const t=`cutout${e.addressableArea?.id}`;if(t)return t}return null},bA=(e,t,r,n,o,a,s)=>{const{pipetteBoundingBoxOffsets:i}=e.spec,l=hA(a,e,o,n),u=i.backLeftCorner[0],p=i.frontRightCorner[0],d=i.backLeftCorner[1],f=i.frontRightCorner[1],m=r.x-(l.x-u),h=r.x+(p-l.x),_=r.y+(d-l.y),y=r.y-(l.y-f),I=(r.z??0)+t-s;return[{x:m,y:_,z:I},{x:h,y,z:I},{x:h,y:_,z:I},{x:m,y,z:I}]},Ab=(e,t)=>{const r=e[1].x<t[0].x,n=e[0].x>t[1].x,o=e[0].y<t[1].y,a=e[1].y>t[0].y;return!(r||n||o||a)},Rh=(e,t)=>{if(t===c.FLEX_ROBOT_TYPE){const r=c.getDeckDefFromRobotType(t),{addressableAreas:n}=r.locations;return n.find(a=>a.id.includes(e))?.offsetFromCutoutFixture[2]??0}return c.getModuleDef(e).dimensions.bareOverallHeight},IA=e=>{const t=c.getDeckDefFromRobotType(e);return Object.values(t.cutoutFixtures).find(n=>c.WASTE_CHUTE_FIXTURES.includes(n.id))?.height??0},TA=(e,t,r,n)=>{const{modules:o,labware:a}=e,{moduleEntities:s,labwareEntities:i,wasteChuteEntities:l}=t;let u=0;const p=r?.addressableArea?.id;if(p){const d=Ha(a,p),f=Object.keys(o).find(h=>o[h].slot===p);Object.values(l).find(h=>h.location===Eb(r))&&(u+=IA(n)),d.length>0?d.forEach(h=>{o[h]!=null&&(u+=Rh(s[h].model,n)),a[h]!=null&&(u+=i[h].def.dimensions.zDimension)}):f!=null&&(u+=Rh(s[f].model,n))}return u},wA=(e,t,r,n,o)=>{for(const a of t){const s=a.addressableArea?.boundingBox,i=a.position;if(i==null||s==null)continue;const l={x:i[0],y:s.yDimension+i[1],z:i[2]},u={x:i[0]+s.xDimension,y:i[1],z:i[2]};if(Ab([e[0],e[1]],[l,u])&&e[0].z!=null&&TA(r,n,a,o)>=e[0]?.z&&a.addressableArea!=null)return{addressableAreaCausingCollision:a.addressableArea}}return null},SA=(e,t)=>Object.values(t).find(r=>r.type===c.THERMOCYCLER_MODULE_TYPE)?Ab([Ph,_A],[e[0],e[1]])&&e[0].x<=Ph.z:!1,gA=(e,t,r,n)=>{const{wells:o}=e.def,a=o[t];return{x:a.x+r.x,y:a.y+r.y,z:n?a.z+(r.z??0):e.def.dimensions.zDimension}},bt=e=>{const{robotState:t,invariantContext:r,pipetteId:n,labwareId:o,wellLocationOffset:a={x:0,y:0,z:0},wellTargetName:s,primaryNozzle:i,nozzleConfiguration:l,tiprackId:u}=e,{pipetteEntities:p,labwareEntities:d,stagingAreaEntities:f,moduleEntities:m}=r,{labware:h,tipState:_}=t,y=p[n];if(y==null)return{isSafe:!0};const{spec:I}=y,{channels:b}=I,L=I?.displayCategory==="FLEX"?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE,g=c.getDeckDefFromRobotType(L);if(d[o]==null||s==null||b===1)return{isSafe:!0};const T=u?!0:_.pipettes[n]?.hasTip??!1,A=u??_.pipettes[n]?.tiprackURI,E=A!=null?d[A]:null,v=E!=null?E.def.parameters.tipLength:0,R=Object.values(f).map(k=>k.location),M=T?v??0:0,F=ee(h[o].stack),G=h[o].stack.some(k=>m[k]?.type===c.THERMOCYCLER_MODULE_TYPE),Y=c.getDeckDefFromRobotType(c.FLEX_ROBOT_TYPE),oe=(G?c.getPositionFromSlotId(c.B1_ADDRESSABLE_AREA,Y):c.getPositionFromSlotId(F,g))??[0,0,0],fe=G?Y.locations.addressableAreas.find(k=>k.id===c.THERMOCYCLER_MODULE_V2)?.offsetFromCutoutFixture??[0,0,0]:[0,0,0],J={x:fe[0]+oe[0],y:fe[1]+oe[1],z:fe[2]+oe[2]},{def:Re}=d[o],Ve=Ob({wellTargetName:s,primaryNozzle:i,nozzleConfiguration:l,specs:I,labwareDef:Re}),Me={x:a.x+Ve.x+J.x,y:a.y+Ve.y+J.y,z:(a.z??0)+(J.z??0)},We=gA(d[o],s,Me,T),ie=E!=null?EA({pipetteSpecs:I,tiprackUri:E.labwareDefURI,nozzles:l}):0,Ne=d[o].def,Be=bA(y,M,We,Ne,i,l,ie);if(!LA({channels:b,boundingBox:Be,robotType:L}))return{isSafe:!1,reason:{type:"outsidePipetteExtents"}};const K=(L===c.OT2_ROBOT_TYPE?c.getOt2SurroundingSlots(F):c.getFlexSurroundingSlots(F,R)).map(k=>{const B=c.getAddressableAreaFromSlotId(k,g),U=c.getPositionFromSlotId(k,g);return{addressableArea:B,position:U}});if(SA(Be,m))return{isSafe:!1,reason:{type:"thermocyclerLidCollision"}};const j=wA(Be,K,t,r,L);return j!=null?{isSafe:!1,reason:{type:"adjacentAdressableAreaCollision",addressableAreaCausingCollision:j.addressableAreaCausingCollision}}:{isSafe:!0}},wp=e=>{const{tipState:t,primaryNozzle:r,channels:n,nozzleConfiguration:o,wellName:a,tiprackDef:s,tipsToIgnore:i=[]}=e,{ordering:l}=s;if(n===1)return{isSafe:!0,isComplete:t[a]!==_e};if(n===8){const u=r!==c.A1_NOZZLE,p=bc(a),d=l[p],f=u?[...d].reverse():d;if(o===c.SINGLE){const m=f.indexOf(a);return{isSafe:f.slice(m+1).every(h=>t[h]===_e||i.includes(h)),isComplete:t[a]!==_e}}if(o===c.PARTIAL_COLUMN){const m=f.indexOf(a),h=c.PARTIAL_NOZZLE_MAP[r],_=u?f.slice(m-h+1,m+1):f.slice(m,m+h);return{isSafe:f.slice(m+1).every(y=>t[y]===_e||i.includes(y)),isComplete:_.every(y=>t[y]!==_e&&!i.includes(y))}}return{isSafe:!0,isComplete:f.every(m=>t[m]!==_e)}}if(o===c.ALL)return{isSafe:!0,isComplete:Object.keys(s.wells).every(u=>t[u]!==_e)};if(o===c.COLUMN){const u=r===c.A12_NOZZLE,p=bc(a),d=l[p],f=u?[...l].reverse():l,m=f.indexOf(d);return{isSafe:f.slice(m+1).flat().every(h=>t[h]===_e||i.includes(h)),isComplete:f[m].every(h=>t[h]!==_e)}}if(o===c.ROW){const u=l[0].map((m,h)=>l.map(_=>_[h])),d=r===c.H1_NOZZLE?[...u].reverse():u,f=d.findIndex(m=>m.some(h=>h===a));return{isSafe:d.slice(f+1).flat().every(m=>t[m]===_e||i.includes(m)),isComplete:d[f].every(m=>t[m]!==_e)}}if(o===c.SINGLE){const u=On(r??ga({nozzles:o,channels:n})),p=Sp(r??ga({nozzles:o,channels:n})),d=u==="H",m=p==="12"?[...l].reverse():l,h=m.findIndex(_=>_.some(y=>y===a));return{isSafe:m.slice(h).every(_=>{const y=d?[..._].reverse():_,I=y.findIndex(b=>On(b)===On(a));return y.slice(I).every(b=>t[b]===_e||i.includes(b)||b===a)}),isComplete:t[a]!==_e}}return{isSafe:!1}},On=e=>e.slice(0,1),Sp=e=>e.slice(1),bc=e=>parseInt(e.slice(1))-1,ga=e=>{const{nozzles:t,channels:r}=e;if(r===8&&t===c.SINGLE)return"H1";if(r===96){if(t===c.COLUMN)return"A12";if(t===c.SINGLE)return"H12"}return"A1"},na=e=>{const{wellSets:t,nozzles:r,channels:n,primaryNozzle:o}=e;return r===c.ROW?t.map(a=>a[0]):t.map(a=>n===96&&r===c.ALL?o:r===c.COLUMN||n===8&&r===c.ALL||n===8&&r===c.PARTIAL_COLUMN?On(o)==="H"?a[a.length-1]:a[0]:(console.assert(a.length===1,"Well set for SINGLE nozzle configuration should have exactly 1 well"),a[0]))},EA=e=>{const{pipetteSpecs:t,tiprackUri:r,nozzles:n}=e,{channels:o}=t,a=AA(o,n),s=t.pickUpTipConfigurations.pressFit.configurationsByNozzleMap[a]?.default.tipOverlaps;if(s==null)return console.error(`No tip overlaps found for ${n} and ${a} overlap.`),0;const i=Math.max(...Object.keys(s).map(l=>Number(l.slice(1))));return s[`v${i}`]?.[r]??s[`v${i}`]?.default??0},AA=(e,t)=>{if(e===1)return"SingleA1";if(e===8)return t===c.SINGLE?"SingleH1":"Full";if(e===96){if(t===c.SINGLE)return"SingleH12";if(t===c.COLUMN)return"Column12";if(t===c.ROW)return"RowA"}return"Full"},LA=e=>{const{channels:t,boundingBox:r,robotType:n}=e,o=c.getRobotDefFromRobotType(n),{paddingOffsets:a}=o,{front:s,rear:i,leftSide:l,rightSide:u}=a,[p,d]=o.extents,[f,m]=r,{x:h,y:_}=f,{x:y,y:I}=m;if(t===96){if(y<l)return!1;const b=p+u;if(h>b)return!1}if(t!==1){if(_<s)return!1;const b=d+i;if(I>b)return!1}return!0},Lb=e=>{const{channels:t,nozzleMap:r}=e;if(t===1)return 0;const[n,o]=["A1","B1"].map(s=>r[s][1]);return Math.abs(n-o)},Ob=e=>{const t=OA(e),r=vA(e);return{x:t,y:r}},OA=e=>{const{primaryNozzle:t,nozzleConfiguration:r,specs:n,labwareDef:o}=e,{channels:a}=n;if(a!==96)return 0;const{ordering:s}=o,i=s.length===1;if(!i)return 0;let l;const u=Sp(t)==="12"?1:-1;if(r===c.ALL&&a===96||r===c.ROW)l=12;else if(r===c.QUADRANT)l=6;else return u*yA;const p=Lb(n);return i?(l-1)*p/2*u:0},vA=e=>{const{wellTargetName:t,primaryNozzle:r,nozzleConfiguration:n,specs:o,labwareDef:a}=e,{channels:s}=o;if(s===1)return 0;const i=Lb(o),{ordering:l}=a,u=l.findIndex(f=>f.includes(t));if(l[u].length!==1)return 0;if(n===c.PARTIAL_COLUMN){const m=-1*(8-c.PARTIAL_NOZZLE_MAP[r])*i,h=7*i/2;return m+h}const d=On(r)==="H"?-1:1;return 7*i/2*d};function vb(e){const t=e.length===1?e[0]:null;return t!=null&&"steps"in t?{numRepetitions:t.repetitions,repeatingProfileSteps:t.steps}:{numRepetitions:1,repeatingProfileSteps:gp(e)}}function gp(e){return e.flatMap(t=>"steps"in t?by(t.steps,t.repetitions):t)}const PA=e=>{switch(e.commandCreatorFnName){case"consolidate":return P(qb,e);case"delay":return P(Ie,e);case"waitForModuleTask":return P(Kb,e);case"distribute":return P(Vb,e);case"transfer":return P(Hb,e);case"mix":return P(Ub,e);case"moveLabware":return P(K_,e);case"captureImage":return P(q_,e);case"engageMagnet":return P(H_,e);case"disengageMagnet":return P(z_,e);case"setTemperature":return P(jc,e);case"deactivateTemperature":return P(x_,e);case"waitForTemperature":return P(Kc,e);case"thermocyclerProfile":return P(xb,e);case"thermocyclerState":return P(zb,e);case"heaterShaker":return P(Bb,e);case"comment":return P(V_,e);case"absorbanceReaderOpenLid":return P($_,e);case"absorbanceReaderCloseLid":return P(Ua,e);case"absorbanceReaderRead":return P(kb,e);case"absorbanceReaderInitialize":return P(Nb,e);case"flexStackerEmpty":return P(j_,{...e,strategy:"manualWithPause"});case"flexStackerFillItems":return P(W_,e);case"flexStackerRetrieve":return P(G_,e);case"flexStackerStore":return P(Y_,{...e,strategy:"automatic"});case"vacuumCloseVent":return P(jo,e);case"vacuumOpenVent":return P(X_,e);case"vacuumSetPumpPower":return P(Wc,e);case"vacuumSetPumpPressure":return P(Gc,e);case"vacuumStartRunProfile":return P(Yc,e);case"vacuumStopPump":return P(ny,e);case"vacuumCloseVentSetPumpPressure":return P(Wb,e);case"vacuumCloseVentSetPumpPower":return P(jb,e);case"vacuumCloseVentStartProfile":return P(Gb,e);case"airGapInPlace":return P(Pt,e);case"aspirate":return P(Pt,e);case"aspirateInPlace":return P(Ho,e);case"aspirateWhileTracking":return P(Uw,e);case"blowOutInPlace":return P(xn,e);case"blowout":return P(xc,e);case"configureForVolume":return P(kn,e);case"configureNozzleLayout":return P(B_,e);case"dispense":return P(zc,e);case"dispenseInPlace":return P(tt,e);case"dispenseWhileTracking":return P(qw,e);case"dropTip":return P(Zr,e);case"dropTipInPlace":return P(qa,e);case"home":return P(Vw,e);case"moveRelative":return P(Bw,e);case"moveToAddressableArea":return P(qe,e);case"moveToAddressableAreaForDropTip":return P(Hc,e);case"moveToCoordinates":return P(xw,e);case"moveToWell":return P(H,e);case"pickUpTip":return P(ya,e);case"prepareToAspirate":return P(Rt,e);case"touchTip":return P(Ot,e);case"tryLiquidProbe":return P(zw,e);case"heaterShaker/closeLabwareLatch":return P(oy,e);case"heaterShaker/openLabwareLatch":return P(ay,e);case"heaterShaker/setAndWaitForShakeSpeed":return P(sy,e);case"heaterShaker/deactivateHeater":return P(ic,e);case"heaterShaker/deactivateShaker":return P(lc,e);case"thermocycler/closeLid":return P(Zc,e);case"thermocycler/openLid":return P(uy,e);case"thermocycler/deactivateBlock":return P(iy,e);case"thermocycler/deactivateLid":return P(ly,e);case"thermocycler/setTargetBlockTemperature":return P(cy,e);case"thermocycler/setTargetLidTemperature":return P(Xc,e);case"thermocycler/startRunExtendedProfile":return P(Z_,e)}},$=nT;function Pb(e){return Object.keys(e).sort((r,n)=>{const o=ee(e[r].stack),a=ee(e[n].stack),s=parseInt(o),i=parseInt(a);return De.includes(o)&&De.includes(a)?r.localeCompare(n):De.includes(o)?1:De.includes(a)?-1:s-i})}function Rb(e){const{pipetteId:t,tiprackId:r,invariantContext:n,robotState:o,nozzles:a,primaryNozzle:s}=e,i=n.pipetteEntities[t]?.spec?.channels,l=n.labwareEntities[r]?.def,u=o.tipState.tipracks[r];if(!i||!l||!u)return console.assert(!1,`Pipette ${t} missing channels/spec or tiprack definition`),null;const p=E=>u[E]===qo,d=c.orderWells(l.ordering,"t2b","l2r"),f=c.orderWells(l.ordering,"b2t","l2r"),m=E=>E.find(p)??null,h=E=>[...E].reverse().find(p)??null,_=E=>E.find(v=>v.every(p))??null,y=E=>[...E].reverse().find(v=>v.every(p))??null,I=i===8&&a===c.SINGLE,b=I&&s===c.H1_NOZZLE,w=I&&s===c.A1_NOZZLE,S=i===96&&a===c.SINGLE,L=S&&s===c.H12_NOZZLE,g=S&&s===c.A12_NOZZLE,T=S&&s===c.H1_NOZZLE,A=S&&s===c.A1_NOZZLE;if(i===1||b||L)return m(d);if(w)return m(f);if(a===c.PARTIAL_COLUMN){const E=m(d);if(!E)return null;const v=d.indexOf(E);return d[v]??null}if(a===c.ALL&&i===8)return _(l.ordering)?.[0]??null;if(A)return h(d);if(g)return m(f);if(T)return h(f);if(a===c.COLUMN){const E=l.ordering;return(s===c.A1_NOZZLE?y(E):_(E))?.[0]??null}if(a===c.ROW){const E=l.ordering,v=E[0].map((M,F)=>E.map(G=>G[F]));return(s===c.A1_NOZZLE?y(v):_(v))?.[0]??null}return a===c.ALL&&i===96?d.every(p)?d[0]:null:(console.assert(!1,`Unhandled _getNextTip case for pipette ${t}`),null)}function oa(e,t,r,n,o,a){const s=r.pipetteEntities[e];if(!s)throw new Error(`cannot getNextTiprack, no pipette entity for pipette "${e}"`);const i=[],l=Pb(n.labware).filter(h=>{console.assert(r.labwareEntities[h]?.labwareDefURI!=null,`cannot getNextTiprack, no labware entity for "${h}"`);const _=ee(n.labware[h].stack),y=Ny(_),I=Ry({labwareId:h,labwareRobotState:n.labware,labwareEntities:r.labwareEntities});if(y&&I&&c.getIsTiprack(r.labwareEntities[h].def))return i.push(h),!1;const b=r.labwareEntities[h].labwareDefURI;return y&&b===t});let u=l;const p=s.spec.channels===96,d=[];p&&(u=u.filter(h=>{const _=n.labware[h].stack[1],y=r.labwareEntities[_],I=y?.def.parameters.loadName==="opentrons_flex_96_tiprack_adapter"&&c.getLabwareDefIsStandard(y?.def),b=a===c.ALL?I:!I;return b||d.push(h),b}));let f=null,m=null;for(const h of u){const _=Rb({pipetteId:e,tiprackId:h,nozzles:a,invariantContext:r,robotState:n,primaryNozzle:o}),{isSafe:y}=_!=null?bt({robotState:n,invariantContext:r,pipetteId:e,labwareId:h,wellTargetName:_,primaryNozzle:o,nozzleConfiguration:a}):{isSafe:!1},{isSafe:I,isComplete:b=!1}=_!=null?wp({tipState:n.tipState.tipracks[h],primaryNozzle:o,channels:s.spec.channels,nozzleConfiguration:a,wellName:_,tiprackDef:r.labwareEntities[h].def}):{isSafe:!1};if(_&&y&&I&&b){f=h,m=_;break}}return f&&m?{nextTiprack:{tiprackId:f,well:m},tipracks:{totalTipracks:l.length,excludedBy96Channel:d.length,excludedByLid:i.length,filteredSortedTiprackIds:u}}:{nextTiprack:null,tipracks:{totalTipracks:l.length,excludedBy96Channel:d.length,excludedByLid:i.length,filteredSortedTiprackIds:u}}}function Ja(e,t,r){const n=t.pipetteEntities[e],o=n.spec.liquids.default.maxVolume,a=n.tiprackLabwareDef;let s=null;for(const l of a)if(c.getLabwareDefURI(l)===r){s=l;break}const i=c.getTiprackVolume(s??a[0]);return!o||!i?(console.assert(!1,`getPipetteEffectiveMaxVol expected tiprackMaxVol and pipette maxVolume to be > 0, got',
|
|
126
|
+
${o}, ${i}`),NaN):qI([i,o])??NaN}function kt(e,t){return t in e.modules||console.warn(`getModuleState expected module id "${t}" to be in robot state`),e.modules[t]?.moduleState}const es=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.THERMOCYCLER_MODULE_TYPE?r:null},Qn=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.ABSORBANCE_READER_TYPE?r:null},It=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.FLEX_STACKER_MODULE_TYPE?r:null},pt=(e,t)=>{const r=e.modules[t]?.moduleState;return r&&r.type===c.VACUUM_MODULE_TYPE?r:null},Nb=(e,t,r)=>{const{moduleId:n,measureMode:o,sampleWavelengths:a,referenceWavelength:s}=e,i=Qn(r,n),l=[];if(i==null&&l.push(de()),l.length>0)return{errors:l};const u=[P(Ua,{moduleId:n}),P(F_,{moduleId:n,measureMode:o,sampleWavelengths:a,referenceWavelength:s??void 0})];return pe(u,t,r)},kb=(e,t,r)=>{const n=[],o=Qn(r,e.moduleId);if((o==null||e.moduleId==null)&&n.push(de()),o?.initialization==null&&n.push(pI()),n.length>0)return{errors:n};const{moduleId:a,fileName:s}=e,i=[P(Ua,{moduleId:a}),P(U_,{moduleId:a,fileName:s})];return pe(i,t,r)},RA=(e,t,r)=>{const{pipetteId:n,trashId:o,flowRate:a,volume:s}=e,i=[P(qe,{pipetteId:n,fixtureId:o,offset:vt}),N(Rt,{pipetteId:n}),P(Pt,{pipetteId:n,volume:s,flowRate:a})];return pe(i,t,r)},NA=(e,t,r)=>{const{pipetteId:n,volume:o,flowRate:a,wasteChuteId:s}=e,i=[P(qe,{pipetteId:n,fixtureId:s,offset:vt}),N(Rt,{pipetteId:n}),P(Pt,{pipetteId:n,flowRate:a,volume:o})];return pe(i,t,r)},kA=(e,t,r)=>{const{labwareId:n,wellName:o,flowRate:a,pipetteId:s,volume:i,type:l}=e,u=t.pipetteEntities[s].pythonName,p=l==="aspirate"?[]:[N(Rt,{pipetteId:s})],d=()=>({commands:[],python:`${u}.air_gap(${[`volume=${i}`,`height=${nc}`,`flow_rate=${a}`].join(", ")})`}),f=[N(H,{pipetteId:s,labwareId:n,wellName:o,wellLocation:{origin:"top",offset:{z:nc,x:0,y:0}}}),...p,N(Pt,{pipetteId:s,volume:i,flowRate:a}),d];return pe(f,t,r)},Cb=(e,t,r)=>{const{pipetteId:n,trashId:o,flowRate:a}=e,{pipetteEntities:s,trashBinEntities:i}=t,l=s[n].pythonName,u=i[o].pythonName,p=()=>({commands:[],python:`${l}.flow_rate.blow_out = ${a}
|
|
127
127
|
${l}.blow_out(${u})`}),d=[N(qe,{pipetteId:n,fixtureId:o,offset:vt}),N(xn,{pipetteId:n,flowRate:a}),p];return pe(d,t,r)},Db=(e,t,r)=>{const{pipetteId:n,flowRate:o,wasteChuteId:a}=e,{pipetteEntities:s,wasteChuteEntities:i}=t,l=s[n].pythonName,u=i[a].pythonName,p=()=>({commands:[],python:`${l}.flow_rate.blow_out = ${o}
|
|
128
|
-
${l}.blow_out(${u})`}),d=[N(qe,{pipetteId:n,fixtureId:a,offset:vt}),N(xn,{pipetteId:n,flowRate:o}),p];return pe(d,t,r)};var Zu,Nh;function CA(){if(Nh)return Zu;Nh=1;var e=M_();function t(r){var n=e(r),o=n%1;return n===n?o?n-o:n:0}return Zu=t,Zu}var Xu,kh;function DA(){if(kh)return Xu;kh=1;var e=zy(),t=Bc(),r=CA(),n=Math.ceil,o=Math.max;function a(s,i,l){(l?t(s,i,l):i===void 0)?i=1:i=o(r(i),0);var u=s==null?0:s.length;if(!u||i<1)return[];for(var p=0,d=0,f=Array(n(u/i));p<u;)f[d++]=e(s,p,p+=i);return f}return Xu=a,Xu}var MA=DA();const Mb=Ye(MA),ir=e=>{const{labwareDef:t,wells:r,primaryNozzle:n}=e,o=c.PARTIAL_NOZZLE_MAP[n]-1,{ordering:a,parameters:s}=t;return r.map(i=>{const l=a.find(p=>p.includes(i));if(l==null)return console.warn(`Could not find column for ${i} in ${s.loadName}`),i;if(l.length===1)return i;const u=l.indexOf(i);return u===-1?(console.warn(`Could not find column index of ${i}`),i):l[u+o]})},Fb=(e,t,r)=>{const{pipetteId:n,trashLocation:o}=e;let a=[];const s=Qc(o);if(r.tipState.pipettes[n]?.hasTip){const i=t.pipetteEntities[n].pythonName,l=()=>({commands:[],python:`${i}.drop_tip()`});a=[N(Hc,{pipetteId:n,addressableAreaName:s}),N(qa,{pipetteId:n}),l]}return pe(a,t,r)}
|
|
128
|
+
${l}.blow_out(${u})`}),d=[N(qe,{pipetteId:n,fixtureId:a,offset:vt}),N(xn,{pipetteId:n,flowRate:o}),p];return pe(d,t,r)};var Zu,Nh;function CA(){if(Nh)return Zu;Nh=1;var e=M_();function t(r){var n=e(r),o=n%1;return n===n?o?n-o:n:0}return Zu=t,Zu}var Xu,kh;function DA(){if(kh)return Xu;kh=1;var e=zy(),t=Bc(),r=CA(),n=Math.ceil,o=Math.max;function a(s,i,l){(l?t(s,i,l):i===void 0)?i=1:i=o(r(i),0);var u=s==null?0:s.length;if(!u||i<1)return[];for(var p=0,d=0,f=Array(n(u/i));p<u;)f[d++]=e(s,p,p+=i);return f}return Xu=a,Xu}var MA=DA();const Mb=Ye(MA),ir=e=>{const{labwareDef:t,wells:r,primaryNozzle:n}=e,o=c.PARTIAL_NOZZLE_MAP[n]-1,{ordering:a,parameters:s}=t;return r.map(i=>{const l=a.find(p=>p.includes(i));if(l==null)return console.warn(`Could not find column for ${i} in ${s.loadName}`),i;if(l.length===1)return i;const u=l.indexOf(i);return u===-1?(console.warn(`Could not find column index of ${i}`),i):l[u+o]})},Fb=(e,t,r)=>{const{pipetteId:n,trashLocation:o}=e;let a=[];const s=Qc(o);if(r.tipState.pipettes[n]?.hasTip){const i=t.pipetteEntities[n].pythonName,l=()=>({commands:[],python:`${i}.drop_tip()`});a=[N(Hc,{pipetteId:n,addressableAreaName:s}),N(qa,{pipetteId:n}),l]}return pe(a,t,r)},$b=(e,t,r)=>{const n=vt,{pipetteId:o,wasteChuteId:a}=e,{pipetteEntities:s,wasteChuteEntities:i}=t;let l=[];if(!r.tipState.pipettes[o].hasTip)l=[];else{const u=s[o].pythonName,p=i[a].pythonName,d=()=>({commands:[],python:`${u}.drop_tip(${p})`});l=[N(qe,{pipetteId:o,fixtureId:a,offset:n}),N(qa,{pipetteId:o}),d]}return pe(l,t,r)},aa=(e,t,r)=>{const{pipette:n,dropTipLocation:o,nozzles:a,primaryNozzle:s,tipRack:i,isFromMixCommand:l=!1,tipSelectionArgs:u}=e,p=r.pipettes[n].nozzles,d=r.pipettes[n].tiprackId,f=t.pipetteEntities[n]?.spec,m=f?.channels;let h=null;if(u==null){if(i==null)return{errors:[TI()]};const E=oa(n,i,t,r,s,a);h=E.nextTiprack;const v=E.tipracks,{excludedBy96Channel:R,excludedByLid:M}=v??{},F=h==null&&m===96&&R>0;if(a===c.ALL&&F)return{errors:[oI()]};if(a===c.COLUMN&&F)return{errors:[aI()]};if(M>0&&h==null)return{errors:[OI()]}}else h={tiprackId:u.tipRackId,well:u.tipWell};if(h==null)return{errors:[nI()]};const _=(f?.displayCategory==="FLEX"||m===96)??!1;if(!f)return{errors:[ht({pipette:n})]};const y=t.labwareEntities[h.tiprackId]?.def,I=t.wasteChuteEntities[o]!=null,b=t.trashBinEntities[o]!=null;if(!y)return{errors:[_t({actionName:"replaceTip",labware:h.tiprackId})]};const w=r.tipState.pipettes[n]?.hasTip;if(!o||!I&&!b&&w)return{errors:[Fn()]};if(Yn({pipette:n,labware:h.tiprackId,invariantContext:t,prevRobotState:r}))return{errors:[Ro()]};const S=Wn(h.tiprackId,r.labware);if(Xn(r.modules,S,_?c.FLEX_ROBOT_TYPE:c.OT2_ROBOT_TYPE))return{errors:[ko()]};if(!_){if(Kn(r.modules,S))return{errors:[No()]};if(Zn(r.modules,S,f))return{errors:[Co()]}}const L=l?P:N,g=[];m!==1&&e.nozzles!=null&&(e.nozzles!==p||h.tiprackId!==d)&&g.push(P(B_,{configurationParams:{primaryNozzle:s,style:e.nozzles},pipetteId:e.pipette}));const T=u?yt:Ia;let A=[L(Zr,{pipette:n,dropTipLocation:o}),...g,L(ya,{pipetteId:n,labwareId:h.tiprackId,wellName:h.well,nozzles:e.nozzles,tipTrackingOption:T,primaryNozzle:s})];return I&&(A=[L($b,{pipetteId:e.pipette,wasteChuteId:t.wasteChuteEntities[e.dropTipLocation].id}),...g,L(ya,{pipetteId:n,labwareId:h.tiprackId,wellName:h.well,nozzles:e.nozzles,tipTrackingOption:T,primaryNozzle:s})]),b&&(A=[L(Fb,{pipetteId:n,trashLocation:t.trashBinEntities[e.dropTipLocation].location}),...g,L(ya,{pipetteId:n,labwareId:h.tiprackId,wellName:h.well,nozzles:e.nozzles,tipTrackingOption:T,primaryNozzle:s})]),pe(A,t,r)},Ch=(e=0)=>e>0?[N(Ie,{seconds:e})]:[],FA=e=>()=>{const{invariantContext:t,pipette:r,times:n,volume:o,aspirateDelaySeconds:a,dispenseDelaySeconds:s,finalPushOut:i,aspirateFlowRateUlSec:l,dispenseFlowRateUlSec:u,positionArgs:p}=e,{pipetteEntities:d,labwareEntities:f}=t,m=d[r].pythonName;let h=null;if(p!=null){const{labware:y,well:I,wellOrigin:b,xOffset:w,yOffset:S,zOffset:L}=p,g=f[y].pythonName,T={origin:b,offset:{x:w,y:S,z:L}};h=`location=${g}[${q(I)}]${Gt(T)}`}const _=[`repetitions=${n}`,`volume=${o}`,...h!=null?[h]:[],`aspirate_flow_rate=${l}`,`dispense_flow_rate=${u}`,...a!=null&&a!==0?[`aspirate_delay=${a}`]:[],...s!=null&&s!==0?[`dispense_delay=${s}`]:[],...i!=null?[`final_push_out=${i}`]:[]];return{commands:[],python:`${m}.mix(
|
|
129
129
|
${Q(_.join(`,
|
|
130
130
|
`))},
|
|
131
|
-
)`}},Br=e=>{const{pipette:t,volume:r,times:n,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:a,aspirateDelaySeconds:s=0,dispenseDelaySeconds:i=0,finalPushOut:l,invariantContext:u,liquidClass:p,tiprack:d,moveToWellParams:f,generatePython:m}=e,h=FA({invariantContext:u,pipette:t,volume:r,times:n,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:a,aspirateDelaySeconds:s,dispenseDelaySeconds:i,finalPushOut:l,positionArgs:f!=null?{labware:f.labwareId,well:f.wellName,wellOrigin:f.wellLocation?.origin??c.WELL_ORIGIN_BOTTOM,xOffset:f.wellLocation?.offset?.x??0,yOffset:f.wellLocation?.offset?.y??0,zOffset:f.wellLocation?.offset?.z??0}:void 0}),_=u.pipetteEntities[t].spec,y=c.getByVolumeValue({liquidClass:p,pipetteSpecs:_,tiprackDefUri:d,targetVolume:r,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,I=c.getByVolumeValue({liquidClass:p,pipetteSpecs:_,tiprackDefUri:d,targetVolume:r,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,w=f!=null?[N(H,{...f,wellLocation:{...f.wellLocation}})]:[];for(let S=0;S<n;S++)w.push(N(Ho,{pipetteId:t,volume:r,flowRate:o,...y>0?{correctionVolume:y}:{}}),...Ch(s),N(tt,{pipetteId:t,volume:r,flowRate:a,...S<n-1?{pushOut:0}:l==null?{}:{pushOut:l},...I>0?{correctionVolume:I}:{}}),...Ch(i));return[...w,...m?[h]:[]]}
|
|
131
|
+
)`}},Br=e=>{const{pipette:t,volume:r,times:n,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:a,aspirateDelaySeconds:s=0,dispenseDelaySeconds:i=0,finalPushOut:l,invariantContext:u,liquidClass:p,tiprack:d,moveToWellParams:f,generatePython:m}=e,h=FA({invariantContext:u,pipette:t,volume:r,times:n,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:a,aspirateDelaySeconds:s,dispenseDelaySeconds:i,finalPushOut:l,positionArgs:f!=null?{labware:f.labwareId,well:f.wellName,wellOrigin:f.wellLocation?.origin??c.WELL_ORIGIN_BOTTOM,xOffset:f.wellLocation?.offset?.x??0,yOffset:f.wellLocation?.offset?.y??0,zOffset:f.wellLocation?.offset?.z??0}:void 0}),_=u.pipetteEntities[t].spec,y=c.getByVolumeValue({liquidClass:p,pipetteSpecs:_,tiprackDefUri:d,targetVolume:r,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,I=c.getByVolumeValue({liquidClass:p,pipetteSpecs:_,tiprackDefUri:d,targetVolume:r,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,w=f!=null?[N(H,{...f,wellLocation:{...f.wellLocation}})]:[];for(let S=0;S<n;S++)w.push(N(Ho,{pipetteId:t,volume:r,flowRate:o,...y>0?{correctionVolume:y}:{}}),...Ch(s),N(tt,{pipetteId:t,volume:r,flowRate:a,...S<n-1?{pushOut:0}:l==null?{}:{pushOut:l},...I>0?{correctionVolume:I}:{}}),...Ch(i));return[...w,...m?[h]:[]]},Ub=(e,t,r)=>{const{pipette:o,labware:a,wells:s,volume:i,times:l,changeTip:u,aspirateFlowRateUlSec:p,dispenseFlowRateUlSec:d,blowoutFlowRateUlSec:f,blowoutOffsetFromTopMm:m,dropTipLocation:h,tipRack:_,positionReference:y,xOffset:I,yOffset:b,zOffset:w,finalPushOut:S,nozzles:L,primaryNozzle:g,tipsSelected:T,tiprackSelected:A,tipTracking:E}=e,v=e.aspirateDelaySeconds??0,R=e.dispenseDelaySeconds??0,M=t.pipetteEntities[o]?.spec.channels!==1;if(r.pipettes[o]==null||t.pipetteEntities[o]==null)return{errors:[ht({pipette:o})]};if(r.labware[a]==null)return{errors:[_t({actionName:"mix",labware:a})]};const F=ee(r.labware[a]?.stack);if(Object.keys(t.wasteChuteEntities).length>0&&F===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)return{errors:[Do()]};const Y=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],oe=Y.length>0?Y[0]:null,fe=Object.values(t.labwareEntities).find(({labwareDefURI:K})=>K===h),J=fe!=null&&c.getIsTiprack(fe.def),Re=t.wasteChuteEntities[h]!=null,Ve=t.trashBinEntities[h]!=null,Me=r.pipettes[o]?.tipWell!=null;if(h==null||J&&oe==null&&u!=="never"&&Me||!J&&!Re&&!Ve)return{errors:[Fn()]};if(M){const K=bt({robotState:r,invariantContext:t,pipetteId:o,labwareId:a,wellLocationOffset:{x:I,y:b},wellTargetName:s[0],primaryNozzle:g,nozzleConfiguration:L});if(!K.isSafe)return{errors:[jt({unsafePipetteMovementReason:K.reason})]};const j=bt({robotState:r,invariantContext:t,pipetteId:o,labwareId:a,wellLocationOffset:{x:I,y:b},wellTargetName:s[0],primaryNozzle:g,nozzleConfiguration:L});if(!j.isSafe)return{errors:[jt({unsafePipetteMovementReason:j.reason})]}}const We=c.LOW_VOLUME_PIPETTES.includes(t.pipetteEntities[o].name),ie=We?[P(kn,{pipetteId:o,volume:i})]:[],Ne=t.pipetteEntities[o].spec,Ae=E===yt&&A!=null&&T!=null&&T.length>0?na({wellSets:T,nozzles:L,channels:Ne.channels,primaryNozzle:g}):null,ae=Nn(s,(K,j)=>{let k=[];if(u==="always"||u==="once"&&j===0){const le=Ae?.shift();k=[P(aa,{pipette:o,primaryNozzle:g,dropTipLocation:J&&oe!=null?oe:h,tipRack:_,nozzles:L,...E===yt&&le!=null&&A!=null?{tipSelectionArgs:{tipRackId:A,tipWell:le}}:{},isFromMixCommand:!0})]}const B=We||e.blowoutLocation!=null&&j>0?[P(Rt,{pipetteId:o})]:[],U=e.touchTip?[P(Ot,{pipetteId:o,labwareId:a,wellName:K,zOffsetFromTop:e.touchTipMmFromTop})]:[],re=Iy({pipette:e.pipette,sourceLabwareId:e.labware,sourceWell:K,destLabwareId:e.labware,destWell:K,blowoutLocation:e.blowoutLocation,flowRate:f,offsetFromTopMm:m,invariantContext:t}),W=[...Object.keys(t.wasteChuteEntities),...Object.keys(t.trashBinEntities)].some(le=>le===e.blowoutLocation)?[...U,...re]:[...re,...U],x=J&&(j===s.length-1||u==="always")?[P(Zr,{pipette:o,dropTipLocation:_,isReturnTip:J})]:[],z=Br({pipette:o,volume:i,times:l,aspirateFlowRateUlSec:p,dispenseFlowRateUlSec:d,invariantContext:t,liquidClass:null,tiprack:_,finalPushOut:S,aspirateDelaySeconds:v,dispenseDelaySeconds:R,moveToWellParams:{pipetteId:o,labwareId:a,wellName:K,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[y],offset:{x:I,y:b,z:w}}},generatePython:!0});return[...k,...ie,...B,...z,...W,...x]});return pe(ae,t,r)},qb=(e,t,r)=>{const{aspirateDelay:n,aspirateFlowRateUlSec:o,aspiratePositionReference:a,aspirateRetractDelay:s,aspirateRetractPositionReference:i,aspirateRetractSpeed:l,aspirateRetractXOffset:u,aspirateRetractYOffset:p,aspirateRetractZOffset:d,aspirateSubmergeDelay:f,aspirateSubmergePositionReference:m,aspirateSubmergeSpeed:h,aspirateSubmergeXOffset:_,aspirateSubmergeYOffset:y,aspirateSubmergeZOffset:I,aspirateXOffset:b,aspirateYOffset:w,aspirateZOffset:S,blowoutFlowRateUlSec:L,blowoutLocation:g,changeTip:T,destLabware:A,destWell:E,dispenseDelay:v,dispenseFlowRateUlSec:R,dispensePositionReference:M,dispenseRetractPositionReference:F,dispenseRetractXOffset:G,dispenseRetractYOffset:Y,dispenseRetractZOffset:oe,dispenseSubmergeDelay:fe,dispenseSubmergePositionReference:J,dispenseSubmergeSpeed:Re,dispenseSubmergeXOffset:Ve,dispenseSubmergeYOffset:Me,dispenseSubmergeZOffset:We,dispenseXOffset:ie,dispenseYOffset:Ne,dispenseZOffset:Be,dropTipLocation:Ae,liquidClass:ae,mixInDestination:K,nozzles:j,pipette:k,primaryNozzle:B,pushOut:U,sourceLabware:re,sourceWells:V,tipRack:Z,tipTracking:W,tiprackSelected:x,tipsSelected:z,touchTipAfterAspirate:le,touchTipAfterAspirateMmFromEdge:xe,touchTipAfterAspirateOffsetMmFromTop:ot,touchTipAfterAspirateSpeed:Ge,touchTipAfterDispense:ye,touchTipAfterDispenseMmFromEdge:at,touchTipAfterDispenseOffsetMmFromTop:Tt,touchTipAfterDispenseSpeed:Ct,stepNumber:wt,volume:ke}=e,{pipetteEntities:st,labwareEntities:Ee,trashBinEntities:Ce,wasteChuteEntities:Fe}=t,ue="consolidate",ce=[],Dt=r.pipettes[k],Ze=st[k]?.spec.channels!==1,te=e.aspirateAirGapVolume??0,Te=e.dispenseAirGapVolume??0;Dt==null&&ce.push(ht({pipette:k})),(A==null||Ee[A]==null&&Ce[A]==null&&Fe[A]==null)&&ce.push(zh());const gr=ee(r.labware[A]?.stack),it=ee(r.labware[re]?.stack);Object.keys(Fe).length>0&&(gr===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||it===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&ce.push(Do());const we=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],lt=we.length>0?we[0]:null,en=Object.values(t.labwareEntities).find(({labwareDefURI:Se})=>Se===Ae),Mt=en!=null&&c.getIsTiprack(en.def),sa=t.wasteChuteEntities[Ae]!=null,tn=t.trashBinEntities[Ae]!=null,dr=r.tipState.pipettes[k]?.hasTip;(Ae==null||Mt&<==null&&T!=="never"&&dr||!Mt&&!sa&&!tn)&&ce.push(Fn());let Xe,se;if(T==="never"){const Se=r.tipState.pipettes[k]?.tiprackURI;Xe=t.labwareEntities[Se??""],se=Xe?.labwareDefURI}else Xe=Object.values(Ee).find(({labwareDefURI:Se})=>Se===Z),se=Z;Xe==null&&(T==="never"?ce.push(Yt({actionName:ue,pipette:k})):ce.push(_t({actionName:ue,labware:se})));const{def:Ft=null}=Xe??{},{spec:Le,name:dt,pythonName:ne}=st[k],X=c.getAllLiquidClassDefs()[ae===c.NONE_LIQUID_CLASS_NAME||ae==null?c.WATER_LIQUID_CLASS_NAME:ae].byPipette?.find(({pipetteModel:Se})=>Se===c.getFlexNameConversion(Le))?.byTipType.find(({tiprack:Se})=>Se===se)??null,{aspirate:ft}=X??{},{multiWellHandling:be}=rp({pipetteSpecs:Le,tiprackDefinition:Ft,volume:ke,path:"multiAspirate",numAspirateWells:V.length,numDispenseWells:1,aspirateAirGapByVolume:ft?.retract.airGapByVolume??[],conditioningByVolume:null,disposalByVolume:null}),{numWellsToFitInTip:ut}=be;if((!be.isSupported||ut==null||ut===1)&&ce.push(gI()),Ze&&j!==c.ALL){const Se=bt({robotState:r,invariantContext:t,pipetteId:k,labwareId:re,wellLocationOffset:{x:b,y:w},primaryNozzle:B,nozzleConfiguration:j});Se.isSafe||ce.push(jt({unsafePipetteMovementReason:Se.reason}));const me=bt({robotState:r,invariantContext:t,pipetteId:k,labwareId:A,wellLocationOffset:{x:ie,y:Ne},primaryNozzle:B,nozzleConfiguration:j});me.isSafe||ce.push(jt({unsafePipetteMovementReason:me.reason}))}const Zt=E!=null?Ee[re]?.def.wells[E]?.depth:null,$t=c.getMmFromBottom(Be,M,Zt),rn=c.getMmFromBottom(We,J,Zt),fr=c.getMmFromBottom(oe,F,Zt);if($t!=null&&rn!=null&&$t>rn&&ce.push(wI()),$t!=null&&fr!=null&&$t>fr&&ce.push(SI()),ce.length>0)return{errors:ce};const{tipracks:Er}=oa(k,se,t,r,B,j),mr=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:ke,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Oe=Ce[A]?.pythonName??Fe[A]?.pythonName,Ut=Ce[Ae]?.pythonName??Fe[Ae]?.pythonName,Ar=g==null?null:Ce[g]?.pythonName??Fe[g]?.pythonName,Lr=Ee[re].pythonName,nn=Ee[A]?.pythonName,Or=j===c.PARTIAL_COLUMN?ir({labwareDef:Ee[re].def,wells:V,primaryNozzle:B}):V,on=(j===c.PARTIAL_COLUMN&&E!=null&&Ee[A]!=null?ir({labwareDef:Ee[A].def,wells:[E],primaryNozzle:B}):[E])[0],an=Or.map(Se=>`${Lr}[${q(Se)}]`).join(", "),sn=on!=null&&nn!=null?`${nn}[${q(on)}]`:null,ln=[`name=${q(`${e.commandCreatorFnName}_step_${wt}`)}`,...ae!=null?[`base_liquid_class=${ra(ae,!0)}`]:[],`properties=${Za({args:e,pipetteName:c.isFlexPipette(dt)?c.getFlexNameConversion(Le):dt,tiprackUri:se,liquidClassValuesForTip:X})}`],eo=`${ge}.define_liquid_class(
|
|
132
132
|
${Q(ln.join(`,
|
|
133
133
|
`))},
|
|
134
|
-
)`,Xt=W===yt&&x!=null&&z!=null&&z.length>0?na({wellSets:z,nozzles:j,channels:Le.channels,primaryNozzle:B}):null,cn=Xt!=null&&Xe!=null&&j===c.PARTIAL_COLUMN?ir({labwareDef:Xe?.def,wells:Xt,primaryNozzle:B}):Xt,pn=x!=null?Ee[x]?.pythonName:null,dn=cn?.map(Se=>`${pn}[${q(Se)}]`).join(", "),to=[`volume=${ke}`,`source=[${an}]`,`dest=${sn!=null?`[${sn}]`:Oe}`,`new_tip=${q(Qa(T))}`,...Mt?["return_tip=True",...Ar!=null?[`trash_location=${Ar}`]:[]]:[`trash_location=${
|
|
134
|
+
)`,Xt=W===yt&&x!=null&&z!=null&&z.length>0?na({wellSets:z,nozzles:j,channels:Le.channels,primaryNozzle:B}):null,cn=Xt!=null&&Xe!=null&&j===c.PARTIAL_COLUMN?ir({labwareDef:Xe?.def,wells:Xt,primaryNozzle:B}):Xt,pn=x!=null?Ee[x]?.pythonName:null,dn=cn?.map(Se=>`${pn}[${q(Se)}]`).join(", "),to=[`volume=${ke}`,`source=[${an}]`,`dest=${sn!=null?`[${sn}]`:Oe}`,`new_tip=${q(Qa(T))}`,...Mt?["return_tip=True",...Ar!=null?[`trash_location=${Ar}`]:[]]:[`trash_location=${Ut}`,"keep_last_tip=True"],...Le.channels>1?["group_wells=False"]:[],...Er.filteredSortedTiprackIds.length>0?[Xa({labwareEntities:Ee,tiprackIds:Er.filteredSortedTiprackIds})]:[],`liquid_class=${eo}`,...Xt!=null&&pn!=null?[`tips=[${dn}]`]:[]],ro=()=>({commands:[],python:`${ne}.consolidate_with_liquid_class(
|
|
135
135
|
${Q(to.join(`,
|
|
136
136
|
`))},
|
|
137
|
-
)`}),fn=Mb(V,ut),Qt=c.LOW_VOLUME_PIPETTES.includes(dt)?[N(kn,{pipetteId:k,volume:ke})]:[],no={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[J],offset:{x:Ve,y:Me,z:We}},qt={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[F],offset:{x:G,y:Y,z:oe}},hr=n!=null?[N(Ie,{seconds:n.seconds})]:[],oo=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:Te,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,vr=v!=null?[N(Ie,{seconds:v.seconds})]:[],ao=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:te,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,mn=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:te,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??R,so=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:Te,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,hn=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:Te,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??R,Pr=Hr({retractZOffset:oe,retractPositionReference:F,labwareId:A,labwareEntities:Ee,well:E}),Rr=!Pr&&E!=null?[N(H,{pipetteId:k,labwareId:A,wellName:E,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],ia=[...Nn(fn,(Se,me)=>{const St=(Pe,tr=!0)=>Te>0&&!(T==="never"&&
|
|
137
|
+
)`}),fn=Mb(V,ut),Qt=c.LOW_VOLUME_PIPETTES.includes(dt)?[N(kn,{pipetteId:k,volume:ke})]:[],no={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[J],offset:{x:Ve,y:Me,z:We}},qt={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[F],offset:{x:G,y:Y,z:oe}},hr=n!=null?[N(Ie,{seconds:n.seconds})]:[],oo=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:Te,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,vr=v!=null?[N(Ie,{seconds:v.seconds})]:[],ao=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:te,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,mn=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:te,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??R,so=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:Te,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,hn=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:Te,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??R,Pr=Hr({retractZOffset:oe,retractPositionReference:F,labwareId:A,labwareEntities:Ee,well:E}),Rr=!Pr&&E!=null?[N(H,{pipetteId:k,labwareId:A,wellName:E,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],ia=[...Nn(fn,(Se,me)=>{const St=(Pe,tr=!0)=>Te>0&&!(T==="never"&&$e&&Pe)?[...tr?Rr:[],N(Rt,{pipetteId:k}),N(Pt,{pipetteId:k,volume:Te,flowRate:so,...oo>0?{correctionVolume:oo}:{}}),...hr]:[],Vt=Pe=>E!=null&&ye?[N(Ot,{pipetteId:k,labwareId:A,wellName:E,...at!=null?{mmFromEdge:at}:{},zOffsetFromTop:Tt,...Ct!=null?{speed:Ct}:{}}),...St(Pe).length>0&&Pr?[N(H,{pipetteId:k,labwareId:A,wellName:E,wellLocation:qt})]:[]]:[],ve=me===0,$e=me===fn.length-1,lo=Se.length,he=ke*lo,Qe=T==="always"||T==="once"&&ve;let _r=[];if(Qe){const Pe=Xt?.shift();_r=[P(aa,{pipette:k,primaryNozzle:B,nozzles:j,dropTipLocation:Mt&<!=null?lt:Ae,tipRack:se,...W===yt&&Pe!=null&&x!=null?{tipSelectionArgs:{tipRackId:x,tipWell:Pe}}:{}})]}const Nr=Nn(Se,(Pe,tr)=>{const Mr=tr===0;let Et=0,rr=R;Mr&&!Qe&&!ve?(Et=Te,rr=hn):Mr||(Et=te,rr=mn);const po={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[m],offset:{x:_,y,z:I}},In={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[i],offset:{x:u,y:p,z:d}},Tn=Hr({retractZOffset:d,retractPositionReference:i,labwareId:re,labwareEntities:Ee,well:Pe}),fo=!Tn&&Pe!=null?[N(H,{pipetteId:k,labwareId:re,wellName:Pe,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],wn=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:Et,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Fr=Mr?[...c.LOW_VOLUME_PIPETTES.includes(t.pipetteEntities[k].name)?[N(kn,{pipetteId:k,volume:he})]:[],N(Rt,{pipetteId:k})]:[],mo=Et>0?[N(tt,{pipetteId:k,volume:Et,flowRate:rr,...wn>0?{correctionVolume:wn}:{},isAirGap:!0,pushOut:0}),...vr]:[],$r=[...[N(H,{pipetteId:k,labwareId:re,wellName:Pe,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],...mo,...Fr],Sn=[N(H,{pipetteId:k,labwareId:re,wellName:Pe,wellLocation:po}),N(H,{pipetteId:k,labwareId:re,...h!=null?{speed:h}:{},wellName:Pe,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[a],offset:{x:b,y:w,z:S}}}),...f!=null&&f.seconds>0?[N(Ie,{seconds:f.seconds})]:[]],Ir=le?[N(Ot,{pipetteId:k,labwareId:re,wellName:Pe,...xe!=null?{mmFromEdge:xe}:{},zOffsetFromTop:ot,...Ge!=null?{speed:Ge}:{}}),...te>0&&Tn?[N(H,{pipetteId:k,labwareId:re,wellName:Pe,wellLocation:In})]:[]]:[],Ur=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:te,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,nr=te>0?[...fo,N(Pt,{pipetteId:k,volume:te,flowRate:ao,...Ur>0?{correctionVolume:Ur}:{}}),...hr]:[],Tr=[N(Ho,{pipetteId:k,volume:ke,flowRate:o,correctionVolume:mr}),...hr],ho=[N(H,{pipetteId:k,labwareId:re,...l!=null?{speed:l}:{},wellName:Pe,wellLocation:In}),...s!=null&&s?.seconds>0?[N(Ie,{seconds:s.seconds})]:[]];return[...$r,...Sn,...Tr,...ho,...Ir,...nr]}),kr=E!=null?[N(H,{pipetteId:k,labwareId:A,wellName:E,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION}),N(H,{pipetteId:k,labwareId:A,wellName:E,wellLocation:no,...Re!=null?{speed:Re}:{}})]:[N(qe,{pipetteId:k,fixtureId:A,offset:{x:0,y:0,z:0}})],uo=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:te,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,_n=te>0?[N(tt,{pipetteId:k,volume:te,flowRate:mn,pushOut:0,correctionVolume:uo,isAirGap:!0}),...vr]:[],gt=E!=null?[N(H,{pipetteId:k,labwareId:A,wellName:E,wellLocation:no}),N(H,{pipetteId:k,labwareId:A,...Re!=null?{speed:Re}:{},wellName:E,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[M],offset:{x:ie,y:Ne,z:Be}}}),...fe!=null&&fe.seconds>0?[N(Ie,{seconds:fe.seconds})]:[]]:[],co=c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:he,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,yr=K!=null?0:U,Cr=[N(tt,{pipetteId:k,volume:he,flowRate:R,...yr!=null?{pushOut:yr}:{},correctionVolume:co}),...vr],Jt=(K!=null?c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:K.volume,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null}):o)??o,er=(K!=null?c.getByVolumeValue({liquidClass:ae,pipetteSpecs:Le,tiprackDefUri:se,targetVolume:K.volume,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null}):R)??R,yn=K!=null?Br({pipette:k,volume:K.volume,times:K.times,aspirateFlowRateUlSec:Jt,dispenseFlowRateUlSec:er,aspirateDelaySeconds:n?.seconds,dispenseDelaySeconds:v?.seconds,finalPushOut:U,invariantContext:t,liquidClass:ae,tiprack:se,generatePython:!1}):[],Dr=[N(xn,{pipetteId:k,flowRate:L})];let br=[];g==null||g===Xr?br=[...Vt(!0),...St(!0)]:g===zn&&E!=null?br=[N(H,{pipetteId:k,labwareId:A,wellName:E,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...Dr,...Vt(!0),...St(!0)]:br=[...Vt(!1),...St(!1),N(qe,{pipetteId:k,fixtureId:Object.values(Ce).length>0?Object.values(Ce)[0].id:Object.values(Fe)[0].id,offset:{x:0,y:0,z:0}}),...Dr,...St(!0,!1)];const bn=Mt&&(me===fn.length-1||T==="always")?[N(Zr,{pipette:k,dropTipLocation:se,isReturnTip:Mt})]:[];return[..._r,...Qt,...Nr,...kr,..._n,...gt,...Cr,...yn,...br,...bn]}),ro];return pe(ia,t,r)},$A=(e,t,r)=>{const{pipetteId:n,trashId:o,flowRate:a,volume:s}=e,{pipetteEntities:i,trashBinEntities:l}=t,u=l[o],p=i[n].pythonName,d=u.pythonName,f=[`volume=${s}`,`location=${d}`,`rate=${a} / ${p}.flow_rate.dispense`],m=()=>({commands:[],python:`${p}.dispense(
|
|
138
138
|
${Q(f.join(`,
|
|
139
139
|
`))},
|
|
140
|
-
)`}),h=[N(qe,{pipetteId:n,fixtureId:o,offset:vt}),N(tt,{pipetteId:n,volume:s,flowRate:a}),m];return pe(h,t,r)}
|
|
140
|
+
)`}),h=[N(qe,{pipetteId:n,fixtureId:o,offset:vt}),N(tt,{pipetteId:n,volume:s,flowRate:a}),m];return pe(h,t,r)},UA=(e,t,r)=>{const{pipetteId:n,flowRate:o,volume:a,wasteChuteId:s}=e,{pipetteEntities:i,wasteChuteEntities:l}=t,u=l[s].pythonName,p=i[n].pythonName,d=[`volume=${a}`,`location=${u}`,`rate=${o} / ${p}.flow_rate.dispense`],f=()=>({commands:[],python:`${p}.dispense(
|
|
141
141
|
${Q(d.join(`,
|
|
142
142
|
`))},
|
|
143
|
-
)`}),m=[N(qe,{pipetteId:n,fixtureId:s,offset:vt}),N(tt,{pipetteId:n,flowRate:o,volume:a}),f];return pe(m,t,r)},Vb=(e,t,r)=>{const{aspirateDelay:n,aspirateFlowRateUlSec:o,aspiratePositionReference:a,aspirateRetractDelay:s,aspirateRetractPositionReference:i,aspirateRetractSpeed:l,aspirateRetractXOffset:u,aspirateRetractYOffset:p,aspirateRetractZOffset:d,aspirateSubmergeDelay:f,aspirateSubmergePositionReference:m,aspirateSubmergeSpeed:h,aspirateSubmergeXOffset:_,aspirateSubmergeYOffset:y,aspirateSubmergeZOffset:I,aspirateXOffset:b,aspirateYOffset:w,aspirateZOffset:S,blowoutFlowRateUlSec:L,blowoutLocation:g,changeTip:T,destLabware:A,destWells:E,dispenseDelay:v,dispenseFlowRateUlSec:R,dispensePositionReference:M,dispenseRetractDelay:F,dispenseRetractPositionReference:G,dispenseRetractSpeed:Y,dispenseRetractXOffset:oe,dispenseRetractYOffset:fe,dispenseRetractZOffset:J,dispenseSubmergeDelay:Re,dispenseSubmergePositionReference:Ve,dispenseSubmergeSpeed:Me,dispenseSubmergeXOffset:We,dispenseSubmergeYOffset:ie,dispenseSubmergeZOffset:Ne,dispenseXOffset:Be,dispenseYOffset:Ae,dispenseZOffset:ae,dropTipLocation:K,liquidClass:j,mixBeforeAspirate:k,nozzles:B,pipette
|
|
143
|
+
)`}),m=[N(qe,{pipetteId:n,fixtureId:s,offset:vt}),N(tt,{pipetteId:n,flowRate:o,volume:a}),f];return pe(m,t,r)},Vb=(e,t,r)=>{const{aspirateDelay:n,aspirateFlowRateUlSec:o,aspiratePositionReference:a,aspirateRetractDelay:s,aspirateRetractPositionReference:i,aspirateRetractSpeed:l,aspirateRetractXOffset:u,aspirateRetractYOffset:p,aspirateRetractZOffset:d,aspirateSubmergeDelay:f,aspirateSubmergePositionReference:m,aspirateSubmergeSpeed:h,aspirateSubmergeXOffset:_,aspirateSubmergeYOffset:y,aspirateSubmergeZOffset:I,aspirateXOffset:b,aspirateYOffset:w,aspirateZOffset:S,blowoutFlowRateUlSec:L,blowoutLocation:g,changeTip:T,destLabware:A,destWells:E,dispenseDelay:v,dispenseFlowRateUlSec:R,dispensePositionReference:M,dispenseRetractDelay:F,dispenseRetractPositionReference:G,dispenseRetractSpeed:Y,dispenseRetractXOffset:oe,dispenseRetractYOffset:fe,dispenseRetractZOffset:J,dispenseSubmergeDelay:Re,dispenseSubmergePositionReference:Ve,dispenseSubmergeSpeed:Me,dispenseSubmergeXOffset:We,dispenseSubmergeYOffset:ie,dispenseSubmergeZOffset:Ne,dispenseXOffset:Be,dispenseYOffset:Ae,dispenseZOffset:ae,dropTipLocation:K,liquidClass:j,mixBeforeAspirate:k,nozzles:B,pipette:U,preWetTip:re,primaryNozzle:V,pushOut:Z,sourceLabware:W,sourceWell:x,tipRack:z,tipTracking:le,tiprackSelected:xe,tipsSelected:ot,touchTipAfterAspirate:Ge,touchTipAfterAspirateMmFromEdge:ye,touchTipAfterAspirateOffsetMmFromTop:at,touchTipAfterAspirateSpeed:Tt,touchTipAfterDispense:Ct,touchTipAfterDispenseMmFromEdge:wt,touchTipAfterDispenseOffsetMmFromTop:ke,touchTipAfterDispenseSpeed:st,stepNumber:Ee,volume:Ce}=e,{pipetteEntities:Fe,labwareEntities:ue,trashBinEntities:ce,wasteChuteEntities:Dt}=t,Ze="distribute",te=[],Te=Fe[U]?.spec.channels!==1,gr=ue[W]?.def.parameters.quirks?.includes("touchTipDisabled"),it=e.aspirateAirGapVolume??0,ze=e.dispenseAirGapVolume??0,we=e.disposalVolume!=null&&e.disposalVolume>0?e.disposalVolume:0,lt=e.conditioningVolume!=null&&e.conditioningVolume>0?e.conditioningVolume:0;(r.pipettes[U]==null||Fe[U]==null)&&te.push(ht({pipette:U})),(!W||!r.labware[W])&&te.push(_t({actionName:Ze,labware:W}));const en=ee(r.labware[A]?.stack),Mt=ee(r.labware[W]?.stack);Object.keys(Dt).length>0&&(en===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||Mt===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&te.push(Do());const tn=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],dr=tn.length>0?tn[0]:null,Xe=Object.values(t.labwareEntities).find(({labwareDefURI:he})=>he===K),se=Xe!=null&&c.getIsTiprack(Xe.def),Ft=t.wasteChuteEntities[K]!=null,Le=t.trashBinEntities[K]!=null,dt=r.tipState.pipettes[U]?.hasTip;(K==null||se&&dr==null&&T!=="never"&&dt||!se&&!Ft&&!Le)&&te.push(Fn());let ne,X;if(T==="never"){const he=r.tipState.pipettes[U]?.tiprackURI;ne=t.labwareEntities[he??""],X=ne?.labwareDefURI}else ne=Object.values(ue).find(({labwareDefURI:he})=>he===z),X=z;ne==null&&(T==="never"?te.push(Yt({actionName:Ze,pipette:U})):te.push(_t({actionName:Ze,labware:X})));const{def:ft=null}=ne??{},{spec:be,name:ut,pythonName:Zt}=Fe[U],$t=c.getAllLiquidClassDefs()[j===c.NONE_LIQUID_CLASS_NAME||j==null?c.WATER_LIQUID_CLASS_NAME:j].byPipette?.find(({pipetteModel:he})=>he===c.getFlexNameConversion(be))?.byTipType.find(({tiprack:he})=>he===X)??null,{aspirate:rn,multiDispense:fr}=$t??{},{multiWellHandling:Er}=rp({pipetteSpecs:be,tiprackDefinition:ft,volume:Ce,path:"multiDispense",numAspirateWells:1,numDispenseWells:E.length,conditioningByVolume:fr?.conditioningByVolume??[],disposalByVolume:fr?.disposalByVolume??[],aspirateAirGapByVolume:rn?.retract.airGapByVolume??[]}),{numWellsToFitInTip:mr}=Er;if((!Er.isSupported||mr==null||mr===1)&&te.push(EI()),Te&&B!==c.ALL){const he=bt({robotState:r,invariantContext:t,pipetteId:U,labwareId:W,wellLocationOffset:{x:b,y:w},wellTargetName:x,primaryNozzle:V,nozzleConfiguration:B});he.isSafe||te.push(jt({unsafePipetteMovementReason:he.reason}));const Qe=bt({robotState:r,invariantContext:t,pipetteId:U,labwareId:A,wellLocationOffset:{x:Be,y:Ae},wellTargetName:E[0],primaryNozzle:V,nozzleConfiguration:B});Qe.isSafe||te.push(jt({unsafePipetteMovementReason:Qe.reason}))}const Oe=t.labwareEntities[W]?.def.wells[x]?.depth??null,Ut=c.getMmFromBottom(S,a,Oe),Ar=c.getMmFromBottom(I,m,Oe),Lr=c.getMmFromBottom(d,i,Oe);Ut!=null&&Ar!=null&&Ut>Ar&&te.push(Hh()),Ut!=null&&Lr!=null&&Ut>Lr&&te.push(jh());const nn=[N(H,{pipetteId:U,labwareId:W,wellName:x,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],Or=Ja(U,t,X)-it;if(Math.floor((Or-we)/Ce)===0&&te.push(ba({actionName:Ze,volume:Ce,maxVolume:Or,disposalVolume:we})),te.length>0)return{errors:te};const{tipracks:an}=oa(U,X,t,r,V,B),sn=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:Ce,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,ln=ce[A]?.pythonName??Dt[A]?.pythonName,eo=ce[K]?.pythonName??Dt[K]?.pythonName,un=g==null?null:ce[g]?.pythonName??Dt[g]?.pythonName,Xt=ue[W].pythonName,cn=ue[A]?.pythonName,pn=(B===c.PARTIAL_COLUMN?ir({labwareDef:ue[W].def,wells:[x],primaryNozzle:V}):[x])[0],dn=B===c.PARTIAL_COLUMN&&E!=null&&ue[A]!=null?ir({labwareDef:ue[A].def,wells:E,primaryNozzle:V}):E,to=`${Xt}[${q(pn)}]`,ro=dn.map(he=>`${cn}[${q(he)}]`).join(", "),fn=[`name=${q(`${e.commandCreatorFnName}_step_${Ee}`)}`,...j!=null?[`base_liquid_class=${ra(j,!0)}`]:[],`properties=${Za({args:e,pipetteName:c.isFlexPipette(ut)?c.getFlexNameConversion(be):ut,tiprackUri:X,liquidClassValuesForTip:$t})}`],Qt=`${ge}.define_liquid_class(
|
|
144
144
|
${Q(fn.join(`,
|
|
145
145
|
`))},
|
|
146
146
|
)`,qt=le===yt&&xe!=null&&ot!=null&&ot.length>0?na({wellSets:ot,nozzles:B,channels:be.channels,primaryNozzle:V}):null,hr=xe!=null?ue[xe]?.pythonName:null,vr=(qt!=null&&ne!=null&&B===c.PARTIAL_COLUMN?ir({labwareDef:ne?.def,wells:qt,primaryNozzle:V}):qt)?.map(he=>`${hr}[${q(he)}]`).join(", "),ao=[`volume=${Ce}`,`source=[${to}]`,`dest=[${ro??ln}]`,`new_tip=${q(Qa(T))}`,...se?["return_tip=True",...un!=null?[`trash_location=${un}`]:[]]:[`trash_location=${eo}`,"keep_last_tip=True"],...be.channels>1?["group_wells=False"]:[],...an.filteredSortedTiprackIds.length>0?[Xa({labwareEntities:ue,tiprackIds:an.filteredSortedTiprackIds})]:[],`liquid_class=${Qt}`,...qt!=null&&hr!=null?[`tips=[${vr}]`]:[]],mn=()=>({commands:[],python:`${Zt}.distribute_with_liquid_class(
|
|
147
147
|
${Q(ao.join(`,
|
|
148
148
|
`))},
|
|
149
|
-
)`}),so={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[m],offset:{x:_,y,z:I}},hn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[i],offset:{x:u,y:p,z:d}},Pr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[Ve],offset:{x:We,y:ie,z:Ne}},Rr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[G],offset:{x:oe,y:fe,z:J}},io=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:it,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,ia=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:it,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??R,Se=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:ze,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,me=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:ze,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??R,St=Mb(E,mr),Vt=Hr({retractZOffset:d,retractPositionReference:i,labwareId:W,labwareEntities:ue,well:x}),ve=!Vt&&x!=null?[N(H,{pipetteId:$,labwareId:W,wellName:x,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],lo=[...Nn(St,(he,Qe)=>{const _r=he.length,Nr=Ce*_r,kr=Nr+we+lt,uo=Qe===0,_n=Qe===St.length-1,gt=T==="always"||T==="once"&&uo,co=c.LOW_VOLUME_PIPETTES.includes(ut)?[N(kn,{pipetteId:$,volume:kr})]:[];let yr=[];if(gt){const $e=qt?.shift();yr=[P(aa,{pipette:$,nozzles:B,primaryNozzle:V,dropTipLocation:se&&dr!=null?dr:K,tipRack:X,...le===yt&&$e!=null&&xe!=null?{tipSelectionArgs:{tipRackId:xe,tipWell:$e}}:{}})]}const Cr=[N(Rt,{pipetteId:$})],Jt=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:ze,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,er=v!=null?[N(Ie,{seconds:v.seconds})]:[],yn=ze>0&&!gt&&!uo&&we===0&&g==null?[N(tt,{isAirGap:!0,pipetteId:$,volume:ze,flowRate:me,...Jt>0?{correctionVolume:Jt}:{},pushOut:0}),...er]:[],Dr=[...nn,...yn,...co,...Cr],br=[N(H,{pipetteId:$,labwareId:W,wellName:x,wellLocation:so}),N(H,{pipetteId:$,labwareId:W,...h!=null?{speed:h}:{},wellName:x,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[a],offset:{x:b,y:w,z:S}}}),...f!=null&&f.seconds>0?[N(Ie,{seconds:f.seconds})]:[]],bn=re?Br({pipette:$,volume:Nr,times:1,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:R,aspirateDelaySeconds:n?.seconds??0,dispenseDelaySeconds:v?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:j,tiprack:X,generatePython:!1}):[],Pe=k!=null?Br({pipette:$,volume:k.volume,times:k.times,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:R,aspirateDelaySeconds:n?.seconds,dispenseDelaySeconds:v?.seconds,finalPushOut:0,invariantContext:t,liquidClass:j,tiprack:X,generatePython:!1}):[],tr=n!=null?[N(Ie,{seconds:n.seconds})]:[],Mr=Ge?[N(Ot,{pipetteId:$,labwareId:W,wellName:x,...ye!=null?{mmFromEdge:ye}:{},zOffsetFromTop:at,...Tt!=null?{speed:Tt}:{}}),...it>0&&Vt?[N(H,{pipetteId:$,labwareId:W,wellName:x,wellLocation:hn})]:[]]:[],Et=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:it,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,rr=it>0?[...ve,N(Pt,{pipetteId:$,volume:it,flowRate:io,...Et>0?{correctionVolume:Et}:{}}),...tr]:[],po=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:kr,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,In=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:lt,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Tn=lt!=null&<>0?[N(tt,{pipetteId:$,volume:lt,flowRate:R,correctionVolume:In,pushOut:0}),...er]:[],fo=[N(Ho,{pipetteId:$,volume:kr,flowRate:o,correctionVolume:po}),...tr,...Tn],wn=[N(H,{pipetteId:$,labwareId:W,...l!=null?{speed:l}:{},wellName:x,wellLocation:hn}),...s!=null&&s?.seconds>0?[N(Ie,{seconds:s.seconds})]:[]],Fr=Nn(he,($e,Ur)=>{const Sn=Ur===0,Ir=Ur===he.length-1,$r=_n&&Ir;let nr=0,Tr=R;Sn&&it>0?(nr=it,Tr=ia):!Sn&&ze>0&<===0&&(nr=ze,Tr=me);const ho=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:nr,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,la=Hr({retractZOffset:J,retractPositionReference:G,labwareId:A,labwareEntities:ue,well:$e}),ts=la?[]:[N(H,{pipetteId:$,labwareId:A,wellName:$e,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],ua=$e!=null?[N(H,{pipetteId:$,labwareId:A,wellName:$e,wellLocation:Pr}),...nr>0?[N(tt,{isAirGap:!0,pipetteId:$,volume:nr,flowRate:Tr,pushOut:0,correctionVolume:ho}),...er]:[],N(H,{pipetteId:$,labwareId:A,...Me!=null?{speed:Me}:{},wellName:$e,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[M],offset:{x:Be,y:Ae,z:ae}}}),...Re!=null&&Re.seconds>0?[N(Ie,{seconds:Re.seconds})]:[]]:[N(qe,{fixtureId:A,pipetteId:$,offset:{x:0,y:0,z:0}})],_o=we===0&&Ir?Z:0,At=[N(tt,{pipetteId:$,volume:Ce,flowRate:R,..._o!=null?{pushOut:_o}:{},correctionVolume:sn}),...er],gn=$e!=null?[N(H,{pipetteId:$,labwareId:A,...Y!=null?{speed:Y}:{},wellName:$e,wellLocation:Rr}),...F!=null&&F?.seconds>0?[N(Ie,{seconds:F.seconds})]:[]]:[],Bt=Ir?[N(xn,{pipetteId:$,flowRate:L})]:[],ca=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:ze,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,xt=(yo,rI=!0)=>ze>0&&!(Ur<he.length-1&<>0)&&!(T==="never"&&$r&&yo)?[...rI?ts:[],N(Rt,{pipetteId:$}),N(Pt,{pipetteId:$,volume:ze,flowRate:Se,...ca>0?{correctionVolume:ca}:{}}),...tr]:[],Lt=yo=>$e!=null&&Ct?[N(Ot,{pipetteId:$,labwareId:A,wellName:$e,...wt!=null?{mmFromEdge:wt}:{},zOffsetFromTop:ke,...st!=null?{speed:st}:{}}),...xt(yo).length>0&&la?[N(H,{pipetteId:$,labwareId:A,wellName:$e,wellLocation:Rr})]:[]]:[];let qr=[];if(g==null||!Ir)qr=[...Lt(!0),...xt(!0)];else if(g===zn)qr=[N(H,{pipetteId:$,labwareId:A,wellName:$e,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...Bt,...Lt(!0),...xt(!0)];else if(g===Xr){const yo=xt(!0);qr=[...Lt(!1),...xt(!1),N(H,{pipetteId:$,labwareId:W,wellName:x,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...Bt,...Ct&&!gr?[N(Ot,{pipetteId:$,labwareId:W,wellName:x,...wt!=null?{mmFromEdge:wt}:{},zOffsetFromTop:ke,...st!=null?{speed:st}:{}})]:[],...yo.length>0?[N(H,{pipetteId:$,labwareId:W,wellName:x,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...xt(!0,!1)]}else qr=[...Lt(!1),...xt(!1),N(qe,{pipetteId:$,fixtureId:Object.values(ce).length>0?Object.values(ce)[0].id:Object.values(Dt)[0].id,offset:{x:0,y:0,z:0}}),...Bt,...xt(!0,!1)];return[...ua,...At,...gn,...qr]}),mo=se&&(Qe===St.length-1||T==="always")?[N(Zr,{pipette:$,dropTipLocation:X,isReturnTip:se})]:[];return[...yr,...Dr,...br,...Pe,...bn,...fo,...wn,...Mr,...rr,...Fr,...mo]}),mn];return pe(lo,t,r)},Bb=(e,t,r)=>{const{timerHours:n,timerMinutes:o,timerSeconds:a,latchOpen:s,targetTemperature:i,rpm:l}=e;if(e.moduleId==null)return{errors:[de()]};const u=kt(r,e.moduleId),p=e.moduleId??"";if(u==null)return{errors:[de()]};const d=[];if(s||d.push(P(oy,{moduleId:p})),i===null?d.push(P(ic,{moduleId:p})):d.push(P(jc,{moduleId:p,celsius:i})),l===null&&"targetSpeed"in u&&u.targetSpeed!==null?d.push(P(lc,{moduleId:p})):l!==null&&d.push(P(sy,{moduleId:p,rpm:l})),[n,o,a].some(m=>m!=null&&m!==0)){i!==null&&d.push(P(Kc,{moduleId:p,celsius:i}));const m=(n??0)*3600+(o??0)*60+(a??0);d.push(P(Ie,{seconds:m})),d.push(P(lc,{moduleId:p})),d.push(P(ic,{moduleId:p}))}return s&&d.push(P(ay,{moduleId:p})),pe(d,t,r)},xb=(e,t,r)=>{const{moduleId:n,profileElements:o,profileTargetLidTemp:a,profileVolume:s}=e,i=es(r,n);if(i===null)return{errors:[de()]};const l=t.moduleEntities[n].pythonName,u=[];i.lidOpen!==!1&&u.push(P(Zc,{moduleId:n})),a!==i.lidTargetTemp&&u.push(P(Xc,{moduleId:n,celsius:a}));const p=`${l}_task_${i.numProfilesStarted+1}`;return u.push(P(Z_,{moduleId:n,profileElements:o,blockMaxVolumeUl:s,taskId:p})),pe(u,t,r)},qA=()=>({lidOpen:!1,lidClosed:!1,setBlockTemperature:!1,deactivateBlockTemperature:!1,setLidTemperature:!1,deactivateLidTemperature:!1}),VA=(e,t)=>!e.lidOpen&&t.lidOpen?{lidOpen:!0}:{},BA=(e,t)=>e.lidOpen&&!t.lidOpen||e.lidOpen===null&&!t.lidOpen?{lidClosed:!0}:{},xA=(e,t)=>t==null?e.currentBlockActivity.type==="blockDeactivated":e.currentBlockActivity.type==="blockTargetTemp"&&e.currentBlockActivity.blockTargetTemp===t,zA=(e,t)=>{const r={...VA(e,t)},n={...BA(e,t)},o=!xA(e,t.blockTargetTemp),a=o&&t.blockTargetTemp===null,s=o&&t.blockTargetTemp!==null,i=e.lidTargetTemp!==t.lidTargetTemp,l=i&&t.lidTargetTemp===null,u=i&&t.lidTargetTemp!==null;return{...qA(),...r,...n,setBlockTemperature:s,deactivateBlockTemperature:a,setLidTemperature:u,deactivateLidTemperature:l}},zb=(e,t,r)=>{const n=es(r,e.moduleId);if(n===null)return{errors:[de()]};if(n.currentBlockActivity.type==="profile")return{errors:[cI()]};const{lidOpen:o,lidClosed:a,setBlockTemperature:s,deactivateBlockTemperature:i,setLidTemperature:l,deactivateLidTemperature:u}=zA(n,e),{blockTargetTemp:p,lidTargetTemp:d}=e,f=[];return o&&f.push(P(uy,{moduleId:e.moduleId})),a&&f.push(P(Zc,{moduleId:e.moduleId})),i&&f.push(P(iy,{moduleId:e.moduleId})),p!==null&&s&&f.push(P(cy,{moduleId:e.moduleId,celsius:p})),u&&f.push(P(ly,{moduleId:e.moduleId})),d!==null&&l&&f.push(P(Xc,{moduleId:e.moduleId,celsius:d})),pe(f,t,r)};var Qu,Dh;function HA(){if(Dh)return Qu;Dh=1;var e=Uo(),t=Hy(),r=jy();function n(o,a){return r(t(o,a,e),o+"")}return Qu=n,Qu}var Ju,Mh;function jA(){if(Mh)return Ju;Mh=1;var e=Kr(),t=cr();function r(n){return t(n)&&e(n)}return Ju=r,Ju}var ec,Fh;function WA(){if(Fh)return ec;Fh=1;var e=S_(),t=Bo(),r=k_(),n=E_(),o=jA(),a=Math.max;function s(i){if(!(i&&i.length))return[];var l=0;return i=e(i,function(u){if(o(u))return l=a(u.length,l),!0}),n(l,function(u){return t(i,r(u))})}return ec=s,ec}var tc,Uh;function GA(){if(Uh)return tc;Uh=1;var e=HA(),t=WA(),r=e(t);return tc=r,tc}var YA=GA();const KA=Ye(YA),Hb=(e,t,r)=>{const{aspirateAirGapVolume:n,aspirateDelay:o,aspirateFlowRateUlSec:a,aspiratePositionReference:s,aspirateRetractDelay:i,aspirateRetractPositionReference:l,aspirateRetractSpeed:u,aspirateRetractXOffset:p,aspirateRetractYOffset:d,aspirateRetractZOffset:f,aspirateSubmergeDelay:m,aspirateSubmergePositionReference:h,aspirateSubmergeSpeed:_,aspirateSubmergeXOffset:y,aspirateSubmergeYOffset:I,aspirateSubmergeZOffset:b,aspirateXOffset:w,aspirateYOffset:S,aspirateZOffset:L,blowoutFlowRateUlSec:g,blowoutLocation:T,changeTip:A,destLabware:E,destWells:v,dispenseAirGapVolume:R,dispenseDelay:M,dispenseFlowRateUlSec:F,dispensePositionReference:G,dispenseRetractDelay:Y,dispenseRetractPositionReference:oe,dispenseRetractSpeed:fe,dispenseRetractXOffset:J,dispenseRetractYOffset:Re,dispenseRetractZOffset:Ve,dispenseSubmergeDelay:Me,dispenseSubmergePositionReference:We,dispenseSubmergeSpeed:ie,dispenseSubmergeXOffset:Ne,dispenseSubmergeYOffset:Be,dispenseSubmergeZOffset:Ae,dispenseXOffset:ae,dispenseYOffset:K,dispenseZOffset:j,dropTipLocation:k,liquidClass:B,mixBeforeAspirate:$,mixInDestination:re,pipette:V,preWetTip:Z,primaryNozzle:W,pushOut:x,sourceLabware:z,nozzles:le,sourceWells:xe,tipRack:ot,tipTracking:Ge,tiprackSelected:ye,tipsSelected:at,touchTipAfterAspirate:Tt,touchTipAfterAspirateMmFromEdge:Ct,touchTipAfterAspirateOffsetMmFromTop:wt,touchTipAfterAspirateSpeed:ke,touchTipAfterDispense:st,touchTipAfterDispenseMmFromEdge:Ee,touchTipAfterDispenseOffsetMmFromTop:Ce,touchTipAfterDispenseSpeed:Fe,volume:ue,stepNumber:ce}=e,{pipetteEntities:Dt,trashBinEntities:Ze,wasteChuteEntities:te,labwareEntities:Te}=t,gr=Hn(Te,te,Ze,E),it=Te[z]?.def.parameters.quirks?.includes("touchTipDisabled");if(!(gr==="labware"&&v!=null&&xe.length===v.length||(gr==="wasteChute"||gr==="trashBin")&&v==null&&xe.length>=1))throw new Error(`Transfer command creator expected N:N source-to-dest wells ratio. Got ${xe.length}:${v?.length} in labware`);const ze="transfer",we=[];(!r.pipettes[V]||!Dt[V])&&we.push(ht({pipette:V})),(!z||!r.labware[z])&&we.push(_t({actionName:ze,labware:z}));const lt=r.labware[E]!=null?ee(r.labware[E].stack):"",en=ee(r.labware[z]?.stack),Mt=Object.keys(te).length>0,sa=te[k]!=null,tn=Ze[k]!=null;Mt&&(lt===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||en===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&we.push(Do());const dr=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],Xe=dr.length>0?dr[0]:null,se=Object.values(t.labwareEntities).find(({labwareDefURI:me})=>me===k),Ft=se!=null&&c.getIsTiprack(se.def),Le=r.tipState.pipettes[V]?.hasTip;if(k==null||Ft&&Xe==null&&A!=="never"&&Le||!Ft&&!sa&&!tn)return{errors:[Fn()]};(!E||!Te[E]&&!te[E]&&!Ze[E])&&we.push(zh());let dt,ne;if(A==="never"){const me=r.tipState.pipettes[V]?.tiprackURI;dt=t.labwareEntities[me??""],ne=dt?.labwareDefURI}else dt=Object.values(Te).find(({labwareDefURI:me})=>me===ot),ne=ot;if(dt==null&&(A==="never"?we.push(Yt({actionName:ze,pipette:V})):we.push(_t({actionName:ze,labware:ne}))),we.length>0)return{errors:we};const X=n||0,ft=R||0,be=Ja(V,t,ne)-X;if(be<=0||!isFinite(be))return we.push(ba({volume:ue,maxVolume:be,actionName:ze})),{errors:we};const ut=Math.ceil(ue/be);if(!isFinite(ut)||ut<=0)return we.push(ba({volume:ue,maxVolume:ut,actionName:ze})),{errors:we};const Zt=ue/ut,Ut=Array(ut).fill(Zt),rn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[h],offset:{x:y,y:I,z:b}},fr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[l],offset:{x:p,y:d,z:f}},Er={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[We],offset:{x:Ne,y:Be,z:Ae}},mr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[oe],offset:{x:J,y:Re,z:Ve}},{spec:Oe,name:$t,pythonName:Ar}=Dt[V],{tipracks:Lr}=oa(V,ne,t,r,W,le),nn=c.getAllLiquidClassDefs()[B===c.NONE_LIQUID_CLASS_NAME||B==null?c.WATER_LIQUID_CLASS_NAME:B].byPipette?.find(({pipetteModel:me})=>me===c.getFlexNameConversion(Oe))?.byTipType.find(({tiprack:me})=>me===ne)??null,Or=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:Zt,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,on=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:Zt,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,an=Ze[E]?.pythonName??te[E]?.pythonName,sn=Ze[k]?.pythonName??te[k]?.pythonName,ln=T==null?null:Ze[T]?.pythonName??te[T]?.pythonName,eo=Te[z].pythonName,un=Te[E]?.pythonName,Xt=le===c.PARTIAL_COLUMN?ir({labwareDef:Te[z].def,wells:xe,primaryNozzle:W}):xe,cn=le===c.PARTIAL_COLUMN&&v!=null&&Te[E]!=null?ir({labwareDef:Te[E].def,wells:v,primaryNozzle:W}):v,pn=Xt.map(me=>`${eo}[${q(me)}]`).join(", "),dn=cn!=null&&un!=null?cn.map(me=>`${un}[${q(me)}]`).join(", "):null,to=[`name=${q(`${e.commandCreatorFnName}_step_${ce}`)}`,...B!=null?[`base_liquid_class=${ra(B,!0)}`]:[],`properties=${Za({args:e,pipetteName:c.isFlexPipette($t)?c.getFlexNameConversion(Oe):$t,tiprackUri:ne,liquidClassValuesForTip:nn})}`],ro=`${ge}.define_liquid_class(
|
|
149
|
+
)`}),so={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[m],offset:{x:_,y,z:I}},hn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[i],offset:{x:u,y:p,z:d}},Pr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[Ve],offset:{x:We,y:ie,z:Ne}},Rr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[G],offset:{x:oe,y:fe,z:J}},io=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:it,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,ia=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:it,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??R,Se=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:ze,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??o,me=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:ze,liquidHandlingAction:"multiDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??R,St=Mb(E,mr),Vt=Hr({retractZOffset:d,retractPositionReference:i,labwareId:W,labwareEntities:ue,well:x}),ve=!Vt&&x!=null?[N(H,{pipetteId:U,labwareId:W,wellName:x,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],lo=[...Nn(St,(he,Qe)=>{const _r=he.length,Nr=Ce*_r,kr=Nr+we+lt,uo=Qe===0,_n=Qe===St.length-1,gt=T==="always"||T==="once"&&uo,co=c.LOW_VOLUME_PIPETTES.includes(ut)?[N(kn,{pipetteId:U,volume:kr})]:[];let yr=[];if(gt){const Ue=qt?.shift();yr=[P(aa,{pipette:U,nozzles:B,primaryNozzle:V,dropTipLocation:se&&dr!=null?dr:K,tipRack:X,...le===yt&&Ue!=null&&xe!=null?{tipSelectionArgs:{tipRackId:xe,tipWell:Ue}}:{}})]}const Cr=[N(Rt,{pipetteId:U})],Jt=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:ze,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,er=v!=null?[N(Ie,{seconds:v.seconds})]:[],yn=ze>0&&!gt&&!uo&&we===0&&g==null?[N(tt,{isAirGap:!0,pipetteId:U,volume:ze,flowRate:me,...Jt>0?{correctionVolume:Jt}:{},pushOut:0}),...er]:[],Dr=[...nn,...yn,...co,...Cr],br=[N(H,{pipetteId:U,labwareId:W,wellName:x,wellLocation:so}),N(H,{pipetteId:U,labwareId:W,...h!=null?{speed:h}:{},wellName:x,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[a],offset:{x:b,y:w,z:S}}}),...f!=null&&f.seconds>0?[N(Ie,{seconds:f.seconds})]:[]],bn=re?Br({pipette:U,volume:Nr,times:1,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:R,aspirateDelaySeconds:n?.seconds??0,dispenseDelaySeconds:v?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:j,tiprack:X,generatePython:!1}):[],Pe=k!=null?Br({pipette:U,volume:k.volume,times:k.times,aspirateFlowRateUlSec:o,dispenseFlowRateUlSec:R,aspirateDelaySeconds:n?.seconds,dispenseDelaySeconds:v?.seconds,finalPushOut:0,invariantContext:t,liquidClass:j,tiprack:X,generatePython:!1}):[],tr=n!=null?[N(Ie,{seconds:n.seconds})]:[],Mr=Ge?[N(Ot,{pipetteId:U,labwareId:W,wellName:x,...ye!=null?{mmFromEdge:ye}:{},zOffsetFromTop:at,...Tt!=null?{speed:Tt}:{}}),...it>0&&Vt?[N(H,{pipetteId:U,labwareId:W,wellName:x,wellLocation:hn})]:[]]:[],Et=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:it,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,rr=it>0?[...ve,N(Pt,{pipetteId:U,volume:it,flowRate:io,...Et>0?{correctionVolume:Et}:{}}),...tr]:[],po=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:kr,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,In=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:lt,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Tn=lt!=null&<>0?[N(tt,{pipetteId:U,volume:lt,flowRate:R,correctionVolume:In,pushOut:0}),...er]:[],fo=[N(Ho,{pipetteId:U,volume:kr,flowRate:o,correctionVolume:po}),...tr,...Tn],wn=[N(H,{pipetteId:U,labwareId:W,...l!=null?{speed:l}:{},wellName:x,wellLocation:hn}),...s!=null&&s?.seconds>0?[N(Ie,{seconds:s.seconds})]:[]],Fr=Nn(he,(Ue,$r)=>{const Sn=$r===0,Ir=$r===he.length-1,Ur=_n&&Ir;let nr=0,Tr=R;Sn&&it>0?(nr=it,Tr=ia):!Sn&&ze>0&<===0&&(nr=ze,Tr=me);const ho=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:nr,liquidHandlingAction:"multiDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,la=Hr({retractZOffset:J,retractPositionReference:G,labwareId:A,labwareEntities:ue,well:Ue}),ts=la?[]:[N(H,{pipetteId:U,labwareId:A,wellName:Ue,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],ua=Ue!=null?[N(H,{pipetteId:U,labwareId:A,wellName:Ue,wellLocation:Pr}),...nr>0?[N(tt,{isAirGap:!0,pipetteId:U,volume:nr,flowRate:Tr,pushOut:0,correctionVolume:ho}),...er]:[],N(H,{pipetteId:U,labwareId:A,...Me!=null?{speed:Me}:{},wellName:Ue,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[M],offset:{x:Be,y:Ae,z:ae}}}),...Re!=null&&Re.seconds>0?[N(Ie,{seconds:Re.seconds})]:[]]:[N(qe,{fixtureId:A,pipetteId:U,offset:{x:0,y:0,z:0}})],_o=we===0&&Ir?Z:0,At=[N(tt,{pipetteId:U,volume:Ce,flowRate:R,..._o!=null?{pushOut:_o}:{},correctionVolume:sn}),...er],gn=Ue!=null?[N(H,{pipetteId:U,labwareId:A,...Y!=null?{speed:Y}:{},wellName:Ue,wellLocation:Rr}),...F!=null&&F?.seconds>0?[N(Ie,{seconds:F.seconds})]:[]]:[],Bt=Ir?[N(xn,{pipetteId:U,flowRate:L})]:[],ca=c.getByVolumeValue({liquidClass:j,pipetteSpecs:be,tiprackDefUri:X,targetVolume:ze,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,xt=(yo,rI=!0)=>ze>0&&!($r<he.length-1&<>0)&&!(T==="never"&&Ur&&yo)?[...rI?ts:[],N(Rt,{pipetteId:U}),N(Pt,{pipetteId:U,volume:ze,flowRate:Se,...ca>0?{correctionVolume:ca}:{}}),...tr]:[],Lt=yo=>Ue!=null&&Ct?[N(Ot,{pipetteId:U,labwareId:A,wellName:Ue,...wt!=null?{mmFromEdge:wt}:{},zOffsetFromTop:ke,...st!=null?{speed:st}:{}}),...xt(yo).length>0&&la?[N(H,{pipetteId:U,labwareId:A,wellName:Ue,wellLocation:Rr})]:[]]:[];let qr=[];if(g==null||!Ir)qr=[...Lt(!0),...xt(!0)];else if(g===zn)qr=[N(H,{pipetteId:U,labwareId:A,wellName:Ue,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...Bt,...Lt(!0),...xt(!0)];else if(g===Xr){const yo=xt(!0);qr=[...Lt(!1),...xt(!1),N(H,{pipetteId:U,labwareId:W,wellName:x,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),...Bt,...Ct&&!gr?[N(Ot,{pipetteId:U,labwareId:W,wellName:x,...wt!=null?{mmFromEdge:wt}:{},zOffsetFromTop:ke,...st!=null?{speed:st}:{}})]:[],...yo.length>0?[N(H,{pipetteId:U,labwareId:W,wellName:x,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...xt(!0,!1)]}else qr=[...Lt(!1),...xt(!1),N(qe,{pipetteId:U,fixtureId:Object.values(ce).length>0?Object.values(ce)[0].id:Object.values(Dt)[0].id,offset:{x:0,y:0,z:0}}),...Bt,...xt(!0,!1)];return[...ua,...At,...gn,...qr]}),mo=se&&(Qe===St.length-1||T==="always")?[N(Zr,{pipette:U,dropTipLocation:X,isReturnTip:se})]:[];return[...yr,...Dr,...br,...Pe,...bn,...fo,...wn,...Mr,...rr,...Fr,...mo]}),mn];return pe(lo,t,r)},Bb=(e,t,r)=>{const{timerHours:n,timerMinutes:o,timerSeconds:a,latchOpen:s,targetTemperature:i,rpm:l}=e;if(e.moduleId==null)return{errors:[de()]};const u=kt(r,e.moduleId),p=e.moduleId??"";if(u==null)return{errors:[de()]};const d=[];if(s||d.push(P(oy,{moduleId:p})),i===null?d.push(P(ic,{moduleId:p})):d.push(P(jc,{moduleId:p,celsius:i})),l===null&&"targetSpeed"in u&&u.targetSpeed!==null?d.push(P(lc,{moduleId:p})):l!==null&&d.push(P(sy,{moduleId:p,rpm:l})),[n,o,a].some(m=>m!=null&&m!==0)){i!==null&&d.push(P(Kc,{moduleId:p,celsius:i}));const m=(n??0)*3600+(o??0)*60+(a??0);d.push(P(Ie,{seconds:m})),d.push(P(lc,{moduleId:p})),d.push(P(ic,{moduleId:p}))}return s&&d.push(P(ay,{moduleId:p})),pe(d,t,r)},xb=(e,t,r)=>{const{moduleId:n,profileElements:o,profileTargetLidTemp:a,profileVolume:s}=e,i=es(r,n);if(i===null)return{errors:[de()]};const l=t.moduleEntities[n].pythonName,u=[];i.lidOpen!==!1&&u.push(P(Zc,{moduleId:n})),a!==i.lidTargetTemp&&u.push(P(Xc,{moduleId:n,celsius:a}));const p=`${l}_task_${i.numProfilesStarted+1}`;return u.push(P(Z_,{moduleId:n,profileElements:o,blockMaxVolumeUl:s,taskId:p})),pe(u,t,r)},qA=()=>({lidOpen:!1,lidClosed:!1,setBlockTemperature:!1,deactivateBlockTemperature:!1,setLidTemperature:!1,deactivateLidTemperature:!1}),VA=(e,t)=>!e.lidOpen&&t.lidOpen?{lidOpen:!0}:{},BA=(e,t)=>e.lidOpen&&!t.lidOpen||e.lidOpen===null&&!t.lidOpen?{lidClosed:!0}:{},xA=(e,t)=>t==null?e.currentBlockActivity.type==="blockDeactivated":e.currentBlockActivity.type==="blockTargetTemp"&&e.currentBlockActivity.blockTargetTemp===t,zA=(e,t)=>{const r={...VA(e,t)},n={...BA(e,t)},o=!xA(e,t.blockTargetTemp),a=o&&t.blockTargetTemp===null,s=o&&t.blockTargetTemp!==null,i=e.lidTargetTemp!==t.lidTargetTemp,l=i&&t.lidTargetTemp===null,u=i&&t.lidTargetTemp!==null;return{...qA(),...r,...n,setBlockTemperature:s,deactivateBlockTemperature:a,setLidTemperature:u,deactivateLidTemperature:l}},zb=(e,t,r)=>{const n=es(r,e.moduleId);if(n===null)return{errors:[de()]};if(n.currentBlockActivity.type==="profile")return{errors:[cI()]};const{lidOpen:o,lidClosed:a,setBlockTemperature:s,deactivateBlockTemperature:i,setLidTemperature:l,deactivateLidTemperature:u}=zA(n,e),{blockTargetTemp:p,lidTargetTemp:d}=e,f=[];return o&&f.push(P(uy,{moduleId:e.moduleId})),a&&f.push(P(Zc,{moduleId:e.moduleId})),i&&f.push(P(iy,{moduleId:e.moduleId})),p!==null&&s&&f.push(P(cy,{moduleId:e.moduleId,celsius:p})),u&&f.push(P(ly,{moduleId:e.moduleId})),d!==null&&l&&f.push(P(Xc,{moduleId:e.moduleId,celsius:d})),pe(f,t,r)};var Qu,Dh;function HA(){if(Dh)return Qu;Dh=1;var e=$o(),t=Hy(),r=jy();function n(o,a){return r(t(o,a,e),o+"")}return Qu=n,Qu}var Ju,Mh;function jA(){if(Mh)return Ju;Mh=1;var e=Kr(),t=cr();function r(n){return t(n)&&e(n)}return Ju=r,Ju}var ec,Fh;function WA(){if(Fh)return ec;Fh=1;var e=S_(),t=Bo(),r=k_(),n=E_(),o=jA(),a=Math.max;function s(i){if(!(i&&i.length))return[];var l=0;return i=e(i,function(u){if(o(u))return l=a(u.length,l),!0}),n(l,function(u){return t(i,r(u))})}return ec=s,ec}var tc,$h;function GA(){if($h)return tc;$h=1;var e=HA(),t=WA(),r=e(t);return tc=r,tc}var YA=GA();const KA=Ye(YA),Hb=(e,t,r)=>{const{aspirateAirGapVolume:n,aspirateDelay:o,aspirateFlowRateUlSec:a,aspiratePositionReference:s,aspirateRetractDelay:i,aspirateRetractPositionReference:l,aspirateRetractSpeed:u,aspirateRetractXOffset:p,aspirateRetractYOffset:d,aspirateRetractZOffset:f,aspirateSubmergeDelay:m,aspirateSubmergePositionReference:h,aspirateSubmergeSpeed:_,aspirateSubmergeXOffset:y,aspirateSubmergeYOffset:I,aspirateSubmergeZOffset:b,aspirateXOffset:w,aspirateYOffset:S,aspirateZOffset:L,blowoutFlowRateUlSec:g,blowoutLocation:T,changeTip:A,destLabware:E,destWells:v,dispenseAirGapVolume:R,dispenseDelay:M,dispenseFlowRateUlSec:F,dispensePositionReference:G,dispenseRetractDelay:Y,dispenseRetractPositionReference:oe,dispenseRetractSpeed:fe,dispenseRetractXOffset:J,dispenseRetractYOffset:Re,dispenseRetractZOffset:Ve,dispenseSubmergeDelay:Me,dispenseSubmergePositionReference:We,dispenseSubmergeSpeed:ie,dispenseSubmergeXOffset:Ne,dispenseSubmergeYOffset:Be,dispenseSubmergeZOffset:Ae,dispenseXOffset:ae,dispenseYOffset:K,dispenseZOffset:j,dropTipLocation:k,liquidClass:B,mixBeforeAspirate:U,mixInDestination:re,pipette:V,preWetTip:Z,primaryNozzle:W,pushOut:x,sourceLabware:z,nozzles:le,sourceWells:xe,tipRack:ot,tipTracking:Ge,tiprackSelected:ye,tipsSelected:at,touchTipAfterAspirate:Tt,touchTipAfterAspirateMmFromEdge:Ct,touchTipAfterAspirateOffsetMmFromTop:wt,touchTipAfterAspirateSpeed:ke,touchTipAfterDispense:st,touchTipAfterDispenseMmFromEdge:Ee,touchTipAfterDispenseOffsetMmFromTop:Ce,touchTipAfterDispenseSpeed:Fe,volume:ue,stepNumber:ce}=e,{pipetteEntities:Dt,trashBinEntities:Ze,wasteChuteEntities:te,labwareEntities:Te}=t,gr=Hn(Te,te,Ze,E),it=Te[z]?.def.parameters.quirks?.includes("touchTipDisabled");if(!(gr==="labware"&&v!=null&&xe.length===v.length||(gr==="wasteChute"||gr==="trashBin")&&v==null&&xe.length>=1))throw new Error(`Transfer command creator expected N:N source-to-dest wells ratio. Got ${xe.length}:${v?.length} in labware`);const ze="transfer",we=[];(!r.pipettes[V]||!Dt[V])&&we.push(ht({pipette:V})),(!z||!r.labware[z])&&we.push(_t({actionName:ze,labware:z}));const lt=r.labware[E]!=null?ee(r.labware[E].stack):"",en=ee(r.labware[z]?.stack),Mt=Object.keys(te).length>0,sa=te[k]!=null,tn=Ze[k]!=null;Mt&&(lt===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA||en===c.GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA)&&we.push(Do());const dr=[...Object.keys(t.trashBinEntities),...Object.keys(t.wasteChuteEntities)],Xe=dr.length>0?dr[0]:null,se=Object.values(t.labwareEntities).find(({labwareDefURI:me})=>me===k),Ft=se!=null&&c.getIsTiprack(se.def),Le=r.tipState.pipettes[V]?.hasTip;if(k==null||Ft&&Xe==null&&A!=="never"&&Le||!Ft&&!sa&&!tn)return{errors:[Fn()]};(!E||!Te[E]&&!te[E]&&!Ze[E])&&we.push(zh());let dt,ne;if(A==="never"){const me=r.tipState.pipettes[V]?.tiprackURI;dt=t.labwareEntities[me??""],ne=dt?.labwareDefURI}else dt=Object.values(Te).find(({labwareDefURI:me})=>me===ot),ne=ot;if(dt==null&&(A==="never"?we.push(Yt({actionName:ze,pipette:V})):we.push(_t({actionName:ze,labware:ne}))),we.length>0)return{errors:we};const X=n||0,ft=R||0,be=Ja(V,t,ne)-X;if(be<=0||!isFinite(be))return we.push(ba({volume:ue,maxVolume:be,actionName:ze})),{errors:we};const ut=Math.ceil(ue/be);if(!isFinite(ut)||ut<=0)return we.push(ba({volume:ue,maxVolume:ut,actionName:ze})),{errors:we};const Zt=ue/ut,$t=Array(ut).fill(Zt),rn={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[h],offset:{x:y,y:I,z:b}},fr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[l],offset:{x:p,y:d,z:f}},Er={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[We],offset:{x:Ne,y:Be,z:Ae}},mr={origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[oe],offset:{x:J,y:Re,z:Ve}},{spec:Oe,name:Ut,pythonName:Ar}=Dt[V],{tipracks:Lr}=oa(V,ne,t,r,W,le),nn=c.getAllLiquidClassDefs()[B===c.NONE_LIQUID_CLASS_NAME||B==null?c.WATER_LIQUID_CLASS_NAME:B].byPipette?.find(({pipetteModel:me})=>me===c.getFlexNameConversion(Oe))?.byTipType.find(({tiprack:me})=>me===ne)??null,Or=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:Zt,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,on=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:Zt,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,an=Ze[E]?.pythonName??te[E]?.pythonName,sn=Ze[k]?.pythonName??te[k]?.pythonName,ln=T==null?null:Ze[T]?.pythonName??te[T]?.pythonName,eo=Te[z].pythonName,un=Te[E]?.pythonName,Xt=le===c.PARTIAL_COLUMN?ir({labwareDef:Te[z].def,wells:xe,primaryNozzle:W}):xe,cn=le===c.PARTIAL_COLUMN&&v!=null&&Te[E]!=null?ir({labwareDef:Te[E].def,wells:v,primaryNozzle:W}):v,pn=Xt.map(me=>`${eo}[${q(me)}]`).join(", "),dn=cn!=null&&un!=null?cn.map(me=>`${un}[${q(me)}]`).join(", "):null,to=[`name=${q(`${e.commandCreatorFnName}_step_${ce}`)}`,...B!=null?[`base_liquid_class=${ra(B,!0)}`]:[],`properties=${Za({args:e,pipetteName:c.isFlexPipette(Ut)?c.getFlexNameConversion(Oe):Ut,tiprackUri:ne,liquidClassValuesForTip:nn})}`],ro=`${ge}.define_liquid_class(
|
|
150
150
|
${Q(to.join(`,
|
|
151
151
|
`))},
|
|
152
152
|
)`,Qt=Ge===yt&&ye!=null&&at!=null&&at.length>0?na({wellSets:at,nozzles:le,channels:Oe.channels,primaryNozzle:W}):null,no=Qt!=null&&dt!=null&&le===c.PARTIAL_COLUMN?ir({labwareDef:dt?.def,wells:Qt,primaryNozzle:W}):Qt,qt=ye!=null?Te[ye]?.pythonName:null,hr=no?.map(me=>`${qt}[${q(me)}]`).join(", "),oo=[`volume=${ue}`,`source=[${pn}]`,`dest=${dn!=null?`[${dn}]`:an}`,`new_tip=${q(Qa(A))}`,...Ft?["return_tip=True",...ln!=null?[`trash_location=${ln}`]:[]]:[`trash_location=${sn}`,"keep_last_tip=True"],...Oe.channels>1?["group_wells=False"]:[],...Lr.filteredSortedTiprackIds.length>0?[Xa({labwareEntities:Te,tiprackIds:Lr.filteredSortedTiprackIds})]:[],`liquid_class=${ro}`,...Qt!=null&&qt!=null?[`tips=[${hr}]`]:[]],vr=()=>({commands:[],python:`${Ar}.transfer_with_liquid_class(
|
|
153
153
|
${Q(oo.join(`,
|
|
154
154
|
`))},
|
|
155
|
-
)`}),ao=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,mn=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??F,so=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:ft,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,hn=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:ft,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??F,Pr=KA(xe,v);let Rr=null,io=null;const Se=[...Pr.reduce((me,St,Vt)=>{const[ve,Ue]=St,lo=Ut.reduce((he,Qe,_r)=>{const Nr=Vt===0&&_r===0,kr=Vt+1===Pr.length,_n=_r+1===Ut.length&&kr;let gt=!1;A==="always"?gt=!0:A==="once"?gt=Nr:A==="perSource"?gt=ve!==Rr:A==="perDest"&&(gt=Nr||Ue!==io);const co=c.LOW_VOLUME_PIPETTES.includes($t)?[N(kn,{pipetteId:V,volume:Qe})]:[];let yr=[];if(gt){const Lt=Qt?.shift();yr=[P(aa,{pipette:V,primaryNozzle:W,nozzles:le,dropTipLocation:Ft&&Xe!=null?Xe:k,tipRack:ne,...le!=null?{nozzles:le}:{},...Ge===yt&&Lt!=null&&ye!=null?{tipSelectionArgs:{tipRackId:ye,tipWell:Lt}}:{}})]}const Cr=Te[z]?.def.wells[ve]?.depth??null,Jt=c.getMmFromBottom(L,s,Cr),er=c.getMmFromBottom(b,h,Cr),yn=c.getMmFromBottom(f,l,Cr);Jt!=null&&er!=null&&Jt>er&&we.push(Hh());const Dr=Hr({retractZOffset:f,retractPositionReference:l,labwareId:z,labwareEntities:Te,well:ve}),br=!Dr&&ve!=null?[N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],bn=Hr({retractZOffset:Ve,retractPositionReference:oe,labwareId:E,labwareEntities:Te,well:Ue}),Pe=!bn&&Ue!=null?[N(H,{pipetteId:V,labwareId:E,wellName:Ue,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[];Jt!=null&&yn!=null&&Jt>yn&&we.push(jh());const tr=[N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],Mr=[N(Rt,{pipetteId:V})],Et=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:ft,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,rr=M!=null?[N(Ie,{seconds:M.seconds})]:[],po=ft>0&&!gt&&(_r>0||Vt>0)?[N(tt,{isAirGap:!0,pipetteId:V,volume:ft,flowRate:hn,...Et>0?{correctionVolume:Et}:{},pushOut:0}),...rr]:[],In=[...tr,...po,...co,...Mr],Tn=[N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:rn}),N(H,{pipetteId:V,labwareId:z,..._!=null?{speed:_}:{},wellName:ve,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[s],offset:{x:w,y:S,z:L}}}),...m!=null&&m.seconds>0?[N(Ie,{seconds:m.seconds})]:[]],fo=Z?Br({pipette:V,volume:Qe,times:1,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:F,aspirateDelaySeconds:o?.seconds??0,dispenseDelaySeconds:M?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:B,tiprack:ne,generatePython:!1}):[],wn=$!=null?Br({pipette:V,volume:$.volume,times:$.times,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:F,aspirateDelaySeconds:o?.seconds,dispenseDelaySeconds:M?.seconds,finalPushOut:0,invariantContext:t,liquidClass:B,tiprack:ne,generatePython:!1}):[],Fr=o!=null?[N(Ie,{seconds:o.seconds})]:[],mo=Tt?[N(Ot,{pipetteId:V,labwareId:z,wellName:ve,...Ct!=null?{mmFromEdge:Ct}:{},zOffsetFromTop:wt,...ke!=null?{speed:ke}:{}}),...X>0&&Dr?[N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:fr})]:[]]:[],$e=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,Ur=X>0?[...br,N(Pt,{pipetteId:V,volume:X,flowRate:ao,...$e>0?{correctionVolume:$e}:{}}),...Fr]:[],Sn=[N(Ho,{pipetteId:V,volume:Qe,flowRate:a,...on>0?{correctionVolume:on}:{}}),...Fr],Ir=[N(H,{pipetteId:V,labwareId:z,...u!=null?{speed:u}:{},wellName:ve,wellLocation:fr}),...i!=null&&i?.seconds>0?[N(Ie,{seconds:i.seconds})]:[]],$r=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,nr=Ue!=null?[N(H,{pipetteId:V,labwareId:E,wellName:Ue,wellLocation:Er}),...X>0?[N(tt,{isAirGap:!0,pipetteId:V,volume:X,flowRate:mn,pushOut:0,...$r>0?{correctionVolume:$r}:{}}),...rr]:[],N(H,{pipetteId:V,labwareId:E,...ie!=null?{speed:ie}:{},wellName:Ue,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[G],offset:{x:ae,y:K,z:j}}}),...Me!=null&&Me.seconds>0?[N(Ie,{seconds:Me.seconds})]:[]]:[N(qe,{fixtureId:E,pipetteId:V,offset:{x:0,y:0,z:0}})],Tr=re!=null&&Ue!=null?0:x,ho=[N(tt,{pipetteId:V,volume:Qe,flowRate:F,...Tr!=null?{pushOut:Tr}:{},...Or>0?{correctionVolume:Or}:{}}),...rr],la=re!=null&&Ue!=null?Br({pipette:V,volume:re.volume,times:re.times,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:F,aspirateDelaySeconds:o?.seconds,dispenseDelaySeconds:M?.seconds,finalPushOut:x,invariantContext:t,liquidClass:B,tiprack:ne,generatePython:!1}):[],ts=Ue!=null?[N(H,{pipetteId:V,labwareId:E,...fe!=null?{speed:fe}:{},wellName:Ue,wellLocation:mr}),...Y!=null&&Y?.seconds>0?[N(Ie,{seconds:Y.seconds})]:[]]:[],ua=N(xn,{pipetteId:V,flowRate:g}),_o=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:ft,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,At=(Lt,qr=!0)=>ft>0&&!(A==="never"&&_n&&Lt)?[...qr?Pe:[],N(Rt,{pipetteId:V}),N(Pt,{pipetteId:V,volume:ft,flowRate:so,..._o>0?{correctionVolume:_o}:{}}),...Fr]:[],gn=Lt=>Ue!=null&&st?[N(Ot,{pipetteId:V,labwareId:E,wellName:Ue,...Ee!=null?{mmFromEdge:Ee}:{},zOffsetFromTop:Ce,...Fe!=null?{speed:Fe}:{}}),...At(Lt).length>0&&bn?[N(H,{pipetteId:V,labwareId:E,wellName:Ue,wellLocation:mr})]:[]]:[];let Bt=[];switch(T){case null:case void 0:Bt=[...gn(!0),...At(!0)];break;case zn:Bt=[ua,...gn(!0),...At(!0)];break;case Xr:Bt=[...gn(!0),...At(!1),N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),ua,...st&&!it?[N(Ot,{pipetteId:V,labwareId:z,wellName:ve,...Ee!=null?{mmFromEdge:Ee}:{},zOffsetFromTop:Ce,...Fe!=null?{speed:Fe}:{}})]:[],...At(!0).length>0?[N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...At(!0,!1)];break;default:T in Ze?Bt=[...gn(!1),...At(!1),N(Cb,{pipetteId:V,flowRate:g,trashId:T}),...At(!0,!1)]:T in te&&(Bt=[N(Db,{pipetteId:V,flowRate:g,wasteChuteId:T}),...At(!0,!1)]);break}const ca=Ft&&(_n||A==="always")?[N(Zr,{pipette:V,dropTipLocation:ne,isReturnTip:Ft})]:[],xt=[...yr,...In,...Tn,...wn,...fo,...Sn,...Ir,...mo,...Ur,...nr,...ho,...la,...ts,...Bt,...ca];return Rr=ve,io=Ue,[...he,...xt]},[]);return[...me,...lo]},[]),vr];return pe(Se,t,r)},jb=(e,t,r)=>pe([P(jo,{moduleId:e.moduleId}),P(Wc,{...e,commandCreatorFnName:"vacuumSetPumpPower"})],t,r),Wb=(e,t,r)=>pe([P(jo,{moduleId:e.moduleId}),P(Gc,{...e,commandCreatorFnName:"vacuumSetPumpPressure"})],t,r),Gb=(e,t,r)=>{const{ventAfter:n}=e;return pe([P(jo,{moduleId:e.moduleId}),P(Yc,{...e,commandCreatorFnName:"vacuumStartRunProfile",ventAfter:n})],t,r)},Yb=(e,t,r)=>{const{runtimeParameters:n}=t,o=[],a=[];if(e.task_ids.forEach(l=>{const u=O(l,n);u==null?o.push(C({parameterName:l})):a.push(u)}),o.length>0)return{errors:o};const s=`[${a.join(", ")}]`,i=`${ge}.wait_for_tasks(${s})`;return{commands:[{key:U(),commandType:"waitForTasks",params:{task_ids:a}}],python:i}},Kb=(e,t,r)=>{const{waitCondition:n}=e;return n==="thermocyclerProfileComplete"?ZA(e,t,r):n==="vacuumProfileComplete"||n==="vacuumStateComplete"?XA(e,t,r):{errors:[CI(n)]}},ZA=(e,t,r)=>{const{moduleId:n}=e,o=[],a=es(r,n);if(a==null)return{errors:[de()]};if(a.currentBlockActivity.type!=="profile")return{errors:[Ep()]};const{taskId:s}=a.currentBlockActivity;return s==null?{errors:[Ep()]}:(o.push(P(Yb,{task_ids:[s]})),pe(o,t,r))},XA=(e,t,r)=>{const{moduleId:n}=e,o=[],a=pt(r,n);if(a==null)return{errors:[de()]};if(a.currentPumpActivity.type!=="timedHold"&&a.currentPumpActivity.type!=="profile")return{errors:[kI()]};const s=a.currentPumpActivity.taskId;return o.push(P(Yb,{task_ids:[s]})),pe(o,t,r)};var rc,$h;function QA(){if($h)return rc;$h=1;var e=xy(),t=1,r=4;function n(o){return e(o,t|r)}return rc=n,rc}var JA=QA();const eL=Ye(JA),Zb=["A1","B1","C1","D1","E1","F1","G1","H1","A2","B2","C2","D2","E2","F2","G2","H2","A3","B3","C3","D3","E3","F3","G3","H3","A4","B4","C4","D4","E4","F4","G4","H4","A5","B5","C5","D5","E5","F5","G5","H5","A6","B6","C6","D6","E6","F6","G6","H6","A7","B7","C7","D7","E7","F7","G7","H7","A8","B8","C8","D8","E8","F8","G8","H8","A9","B9","C9","D9","E9","F9","G9","H9","A10","B10","C10","D10","E10","F10","G10","H10","A11","B11","C11","D11","E11","F11","G11","H11","A12","B12","C12","D12","E12","F12","G12","H12"],Gr="p300SingleId",Po="p300MultiId",Ic="p100096Id",Tc="sourcePlateId",wc="destPlateId",Sc="troughId",tL="A1",rL="tiprack1Id",nL={isAirGap:!0},ma=c.fixture96Plate,qh=c.fixture12Trough,ha=c.fixtureTiprack10ul,zt=c.fixtureTiprack300ul,En=c.fixtureTiprack1000ul,_a=c.fixtureTiprackAdapter,Xb={OT_PD_DISABLE_MODULE_RESTRICTIONS:!1};function Qb(e){return Zb.reduce((t,r)=>({...t,[r]:e?qo:_e}),{})}function oL(e,t){return Array.from("ABCDEFGH").map(r=>`${r}${e}`).reduce((r,n)=>({...r,[n]:t}),{})}function Jb(){const e={[Tc]:{id:Tc,pythonName:"mock_source_plate",labwareDefURI:c.getLabwareDefURI(ma),def:ma},[wc]:{id:wc,pythonName:"mock_dest_plate",labwareDefURI:c.getLabwareDefURI(ma),def:ma},[Sc]:{id:Sc,pythonName:"mock_trough",labwareDefURI:c.getLabwareDefURI(qh),def:qh},tiprack1Id:{id:"tiprack1Id",pythonName:"mock_tip_rack_1",labwareDefURI:c.getLabwareDefURI(zt),def:zt},tiprack2Id:{id:"tiprack2Id",pythonName:"mock_tip_rack_2",labwareDefURI:c.getLabwareDefURI(zt),def:zt},tiprack3Id:{id:"tiprack3Id",pythonName:"mock_tip_rack_3",labwareDefURI:c.getLabwareDefURI(zt),def:zt},tiprack4AdapterId:{id:"tiprack4AdapterId",pythonName:"mock_adapter_4",labwareDefURI:c.getLabwareDefURI(_a),def:_a},tiprack5AdapterId:{id:"tiprack5AdapterId",pythonName:"mock_adapter_5",labwareDefURI:c.getLabwareDefURI(_a),def:_a},tiprack4Id:{id:"tiprack4Id",pythonName:"mock_tip_rack_4",labwareDefURI:c.getLabwareDefURI(En),def:En},tiprack5Id:{id:"tiprack5Id",pythonName:"mock_tip_rack_5",labwareDefURI:c.getLabwareDefURI(En),def:En}},t={},r={[oc]:{id:oc,location:"cutoutA3",pythonName:"trash_bin_1"}},n={p10SingleId:{name:"p10_single",id:"p10SingleId",pythonName:"mock_pipette_p10",tiprackDefURI:[c.getLabwareDefURI(ha)],tiprackLabwareDef:[ha],spec:c.fixtureP10SingleV2Specs},p10MultiId:{name:"p10_multi",id:"p10MultiId",tiprackDefURI:[c.getLabwareDefURI(ha)],tiprackLabwareDef:[ha],spec:c.fixtureP10MultiV2Specs,pythonName:"mock_pipette_p10_multi"},[Gr]:{name:"p300_single",id:Gr,tiprackDefURI:[c.getLabwareDefURI(zt)],tiprackLabwareDef:[zt],spec:c.fixtureP300SingleV2Specs,pythonName:"mock_pipette"},[Po]:{name:"p300_multi",id:Po,tiprackDefURI:[c.getLabwareDefURI(zt)],tiprackLabwareDef:[zt],spec:c.fixtureP300MultiV2Specs,pythonName:"mock_pipette_p300_multi"},[Ic]:{name:"p1000_96",id:Ic,tiprackDefURI:[c.getLabwareDefURI(En)],tiprackLabwareDef:[En],spec:c.fixtureP100096V2Specs,pythonName:"mock_pipette_p1000_96"}};return{labwareEntities:e,moduleEntities:t,pipetteEntities:n,trashBinEntities:r,wasteChuteEntities:{},stagingAreaEntities:{},gripperEntities:{},liquidEntities:{},runtimeParameters:{},config:Xb}}const Jr=e=>{const{invariantContext:t,labwareLocations:r,moduleLocations:n,pipetteLocations:o,tiprackSetting:a}=e,s=ep({invariantContext:t,labwareLocations:r,moduleLocations:n||{},pipetteLocations:o});return s.tipState.tipracks=lr(a,i=>Qb(i)),s},Jn=()=>({pipetteLocations:{[Gr]:{mount:"left",tiprackId:"tiprack1Id"},[Po]:{mount:"right",tiprackId:"tiprack1Id"}},labwareLocations:{tiprack1Id:{stack:["tiprack1Id","1"]},tiprack2Id:{stack:["tiprack2Id","5"]},tiprack4AdapterId:{stack:["tiprack4AdapterId","7"]},tiprack5AdapterId:{stack:["tiprack5AdapterId","8"]},tiprack4Id:{stack:["tiprack4Id","tiprack4AdapterId","7"]},tiprack5Id:{stack:["tiprack5Id","tiprack5AdapterId","8"]},sourcePlateId:{stack:["sourcePlateId","2"]},destPlateId:{stack:["destPlateId","3"]}},moduleLocations:{}}),eI=()=>({pipetteLocations:{[Gr]:{mount:"left"},[Po]:{mount:"right"}},labwareLocations:{tiprack1Id:{stack:["tiprack1Id","B1"]},tiprack2Id:{stack:["tiprack2Id","A2"]},sourcePlateId:{stack:["sourcePlateId","offDeck"]},destPlateId:{stack:["destPlateId","C2"]}},moduleLocations:{}}),tI=e=>Jr({...Jn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),aL=e=>Jr({...eI(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),sL=e=>({robotState:tI(e),warnings:[]}),iL=e=>{const t=Jr({...Jn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}});return t.tipState.pipettes[Gr]={hasTip:!0,tiprackURI:"tiprack1Id"},t},lL=e=>{const t=Jr({...Jn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0}});return t.tipState.pipettes[Gr]={hasTip:!0,tiprackURI:"tiprack1Id"},t.tipState.tipracks.tiprack1Id.A1=_e,t},uL=e=>Jr({...Jn(),invariantContext:e,tiprackSetting:{tiprack1Id:!1,tiprack2Id:!1}}),cL=({temperatureModuleId:e,thermocyclerId:t})=>{const r=Jb();r.moduleEntities={[e]:{id:e,type:c.TEMPERATURE_MODULE_TYPE,model:"foo",pythonName:"mock_temperature_module_1"},[t]:{id:t,type:c.THERMOCYCLER_MODULE_TYPE,model:"foo",pythonName:"mock_thermocycler"}};const n=Jr({...Jn(),invariantContext:r,tiprackSetting:{tiprack1Id:!0}});return n.modules={[e]:{slot:"3",moduleState:{type:c.TEMPERATURE_MODULE_TYPE,status:$o,targetTemperature:null}},[t]:{slot:"span7_8_10_11",moduleState:{type:c.THERMOCYCLER_MODULE_TYPE,currentBlockActivity:{type:"blockDeactivated"},lidTargetTemp:null,lidOpen:null,numProfilesStarted:0}}},{invariantContext:r,robotState:n}},pL=(e,t,r,n)=>{const o=eL(e);return o.modules[t].moduleState={type:c.TEMPERATURE_MODULE_TYPE,targetTemperature:n,status:r},o};exports.ABSORBANCE_READER_INITIAL_STATE=Jh;exports.AIR=Ke;exports.AIR_GAP_META=nL;exports.AIR_GAP_OFFSET_FROM_TOP=nc;exports.AUTOMATIC=Ia;exports.BACK_LEFT_NOZZLES=d_;exports.BOTTOM_UP_LABWARE_POOL_KEYS=ar;exports.BOTTOM_UP_STORED_LABWARE_URI_KEYS=zI;exports.CLEAN=qo;exports.COLUMN_4_SLOTS=De;exports.CUSTOM_LABWARE_DICT_NAME=Va;exports.DEFAULT_BLOWOUT_WELL=tL;exports.DEFAULT_CONFIG=Xb;exports.DEFAULT_PIPETTE=Gr;exports.DEST_LABWARE=wc;exports.DEST_WELL_BLOWOUT_DESTINATION=zn;exports.DIRTY=or;exports.EMPTY=_e;exports.FAKE_HOPPER_LOCATION_MAP=i_;exports.FIXED_TRASH_ID=oc;exports.FLEX_STACKER_MODULE_INITIAL_STATE=t_;exports.FLEX_TRASH_DEF_URI=BI;exports.GRIPPER_LOCATION=o_;exports.HEATERSHAKER_MODULE_INITIAL_STATE=Qh;exports.HOPPER_FAKE_LOCATIONS=s_;exports.HOPPER_STACKER_LOCATION=rt;exports.INDENT=Wo;exports.MAGNETIC_BLOCK_INITIAL_STATE=e_;exports.MAGNETIC_MODULE_INITIAL_STATE=Kh;exports.MANUAL=yt;exports.MAX_STACKABLE_VACUUM_SPACERS=c_;exports.MIXED_WELL_COLOR=ub;exports.MODULES_WITH_COLLISION_ISSUES=Yh;exports.MODULE_INITIAL_STATE_BY_TYPE=n_;exports.MULTI_PIPETTE=Po;exports.NOZZLE_STYLES=La;exports.OFF_DECK=Cn;exports.OT2_TC_SLOTS=xI;exports.OT_2_TRASH_DEF_URI=VI;exports.PAPI_VERSION=pb;exports.PD_APPLICATION_VERSION=oA;exports.PIPETTE_96=Ic;exports.PRIMARY_NOZZLES=Oa;exports.PROTOCOL_CONTEXT_NAME=ge;exports.SLOT_LOCATIONS_TO_FAKE_HOPPER_LOCATIONS=HI;exports.SOURCE_LABWARE=Tc;exports.SOURCE_WELL_BLOWOUT_DESTINATION=Xr;exports.STAGING_AREA_SLOTS=a_;exports.TEMPERATURE_APPROACHING_TARGET=Ec;exports.TEMPERATURE_AT_TARGET=gc;exports.TEMPERATURE_DEACTIVATED=$o;exports.TEMPERATURE_MODULE_INITIAL_STATE=Zh;exports.THERMOCYCLER_MODULE_INITIAL_STATE=Xh;exports.TIPRACK_1=rL;exports.TOUCHED_PIPETTABLE_LABWARE=yc;exports.TROUGH_LABWARE=Sc;exports.VACUUM_AT_TARGET=JI;exports.VACUUM_DEACTIVATED=QI;exports.VACUUM_DOCK_ADDRESSABLE_AREA=l_;exports.VACUUM_DOCK_DISPLAY_LOCATION=p_;exports.VACUUM_DOCK_LOCATION=Ac;exports.VACUUM_MODE_POWER=ac;exports.VACUUM_MODE_PRESSURE=sc;exports.VACUUM_MODULE_INITIAL_STATE=r_;exports.VACUUM_PROGRAM_PROFILE=WI;exports.VACUUM_PROGRAM_STATE=jI;exports.VACUUM_SPACER_LOAD_NAMES=u_;exports.VACUUM_STATE_PUMP_OFF=GI;exports.VACUUM_STATE_PUMP_ON=YI;exports.VACUUM_STATE_VENT=KI;exports.VACUUM_VENT_CLOSED=Vo;exports.VACUUM_VENT_OPEN=Lc;exports.VACUUM_VENT_SET_CLOSED=XI;exports.VACUUM_VENT_SET_OPEN=ZI;exports.ZERO_OFFSET=vt;exports._getNextTip=Rb;exports._wellContentsForLabware=YE;exports.absorbanceReaderCloseInitialize=Nb;exports.absorbanceReaderCloseLid=$a;exports.absorbanceReaderCloseRead=kb;exports.absorbanceReaderCollision=Yo;exports.absorbanceReaderInitialize=F_;exports.absorbanceReaderOpenLid=U_;exports.absorbanceReaderRead=$_;exports.absorbanceReaderStateGetter=Qn;exports.airGapLocationHelper=Yw;exports.aspirate=Lw;exports.assignContainsAmongSiblings=yp;exports.blowOutInWell=xc;exports.captureImage=q_;exports.column4StagingSlotIdFromFlexStackerShuttleAddressableArea=Ly;exports.commandCreatorsTimeline=OE;exports.comment=V_;exports.consolidate=qb;exports.constructInvariantContextFromAnalysis=CE;exports.createEmptyLiquidState=Ty;exports.createStagingAreaForInvariantContext=cc;exports.createTipLiquidState=wy;exports.curryCommandCreator=P;exports.curryWithoutPython=N;exports.deactivateTemperature=x_;exports.deckSlotKeyForFlexStackerShuttleAddressableArea=Xw;exports.delay=Ie;exports.delayLocationHelper=Kw;exports.disengageMagnet=z_;exports.dispense=zc;exports.dispenseLocationHelper=Ww;exports.distribute=Vb;exports.dropTip=Zr;exports.dropTipInPlace=qa;exports.dropTipInTrash=Fb;exports.dropTipInWasteChute=Ub;exports.engageMagnet=H_;exports.enrichRobotStateForStackGraphTraversals=kg;exports.flexStackerEmpty=j_;exports.flexStackerFillItems=W_;exports.flexStackerRetrieve=G_;exports.flexStackerStateGetter=It;exports.flexStackerStore=Y_;exports.formatChangeTipArg=Qa;exports.formatPyDict=zr;exports.formatPyList=J_;exports.formatPyRuntimeValue=Je;exports.formatPyStr=q;exports.formatPyTuple=Q_;exports.formatPyValue=ur;exports.formatPyWellLocation=Gt;exports.getAddressableAreaFromModule=_p;exports.getAddressableAreaNameFromLabwareLocation=Lg;exports.getAllLargestStacks=Yy;exports.getAllProvidedAddressableAreasFromDeckConfig=Ky;exports.getAllWellsForLabware=lb;exports.getCanPlaceStackableVacuumSpacer=my;exports.getChunkForIndentingLists=Ba;exports.getCommandCreatorFromStepArgs=PA;exports.getCustomLiquidClassProperties=Za;exports.getCutoutFromSlot=Eb;exports.getCutoutIdByAddressableArea=hy;exports.getDefaultPrimaryNozzle=ga;exports.getDefineLiquids=yb;exports.getDispenseAirGapLocation=Sy;exports.getFlexStackerCutoutBaseDeckSlotId=tp;exports.getFlexStackerShuttleAddressableArea=za;exports.getFullStackFromLabwares=Ha;exports.getFullStackFromNodeTopDownRecursive=Ka;exports.getHasNoWellsFromCCArgs=PE;exports.getInitialRobotStateStandard=tI;exports.getInitialRobotStateWithOffDeckLabwareStandard=aL;exports.getIsHeaterShakerEastWestMultiChannelPipette=Zn;exports.getIsHeaterShakerEastWestWithLatchOpen=Kn;exports.getIsHeaterShakerNorthSouthOfNonTiprackWithMultiChannelPipette=Jo;exports.getIsInPipettableLocation=Ny;exports.getIsLabwareCompatibleWithStack=vy;exports.getIsRetractSafeForAirGap=Hr;exports.getIsSafePickupWithinTiprack=wp;exports.getIsSlotAHopper=Py;exports.getIsSlotAVacuumDock=Ao;exports.getIsSpaceInHopper=ap;exports.getIsStackableVacuumSpacer=Eo;exports.getIsTallLabwareEastWestOfHeaterShaker=sb;exports.getIsVacuumSpacer=py;exports.getIsVacuumSpacerSeat=dy;exports.getLabwareHasLid=Ry;exports.getLabwareHasLiquid=Ey;exports.getLabwareIdOnShuttle=np;exports.getLabwareSlot=Wn;exports.getLargestStackContainingLabware=Gy;exports.getLargestStackInSlot=go;exports.getLiquidClassName=ra;exports.getLiquidIdsOnLabware=XE;exports.getLiquidIdsOnLabwareStack=ZE;exports.getLoadAdapters=fb;exports.getLoadLabware=hb;exports.getLoadLidStacks=mb;exports.getLoadLiquidClasses=Ib;exports.getLoadLiquids=bb;exports.getLoadModules=db;exports.getLoadPipettes=_b;exports.getLoadTrashBins=Tb;exports.getLoadWasteChute=wb;exports.getLocationTotalVolume=wr;exports.getModuleHasLiveTask=Gn;exports.getModuleIdFromRobotStateStack=Go;exports.getModuleLocationSlot=Zw;exports.getModuleState=kt;exports.getNearestParentInStack=Ay;exports.getNextRobotStateAndWarnings=Ip;exports.getNextRobotStateAndWarningsSingleCommand=ab;exports.getNextTiprack=oa;exports.getNodeParentModuleId=Eg;exports.getNozzleConfig=Tp;exports.getPipetteCenteringFullOffset=Ob;exports.getPipetteIdFromCCArgs=vE;exports.getPipetteMovementSafetyStatus=bt;exports.getPipetteWithTipMaxVol=Ja;exports.getProvidedAddressableAreasExposed=Og;exports.getPythonAssignTipRacksString=Xa;exports.getResultingTimelineFrameFromRunCommands=ME;exports.getRobotInitialStateNoTipsRemain=uL;exports.getRobotStateAndWarningsStandard=sL;exports.getRobotStatePickedUpTipStandard=lL;exports.getRobotStateWithTipStandard=iL;exports.getRunTimeParameters=mA;exports.getSetStoredLabware=gb;exports.getSlotInLocationStack=ee;exports.getStackForLabwareLocation=uc;exports.getStackableVacuumSpacerLoadNamesInStack=fy;exports.getStackedOnNodeFromPdStack=Zy;exports.getStateAndContextTempTCModules=cL;exports.getTargetTipsFromWellSets=na;exports.getThermocyclerProfileRepetitionsForPython=vb;exports.getTipColumn=oL;exports.getTipColumnIndex=bc;exports.getTipColumnName=Sp;exports.getTipRowName=On;exports.getTiprackHasTips=gy;exports.getTiprackTipstate=Qb;exports.getTopLocationInStack=xa;exports.getTopmostLabwareOnModuleFromStackRobotState=Jw;exports.getTransferPlanAndReferenceVolumes=rp;exports.getTrashBinAddressableAreaName=Qc;exports.getTrashLocationFromAddressableAreaName=yy;exports.getTrashOrLabware=Hn;exports.getVolumesPerLiquid=KE;exports.getWasteChuteAddressableAreaNamePip=_y;exports.getWellsForTips=Jc;exports.heaterShaker=Bb;exports.indentPyLines=Q;exports.labwareMatchesLabwareInHopper=op;exports.makeContext=Jb;exports.makeInitialRobotState=ep;exports.makeState=Jr;exports.makeStateArgsLabwareOffDeck=eI;exports.makeStateArgsStandard=Jn;exports.mergeLiquid=Sr;exports.mix=$b;exports.mixBlowoutLocationHelper=Iy;exports.modulePipetteCollision=Yn;exports.moveHelper=Gw;exports.moveLabware=K_;exports.moveToAddressableArea=qe;exports.moveToAddressableAreaForDropTip=Hc;exports.pipetteAdjacentHeaterShakerWhileShaking=Xn;exports.pipetteIntoHeaterShakerLatchOpen=ea;exports.pipetteIntoHeaterShakerWhileShaking=ta;exports.pythonCustomLabwareDict=dA;exports.pythonDefRun=pA;exports.pythonImports=aA;exports.pythonMetadata=sA;exports.pythonRequirements=iA;exports.pythonRuntimeString=Nt;exports.reduceCommandCreators=pe;exports.repeatArray=by;exports.replaceTip=aa;exports.resolveAllowedRuntimeValue=Ht;exports.resolveBooleanRuntimeValue=je;exports.resolveDeckSlotKeyForLabwareStackInSlot=Oy;exports.resolveNumericRuntimeValue=D;exports.resolveRuntimeWellLocation=Dn;exports.resolveStringRuntimeValue=O;exports.robotWithStatusAndTemp=pL;exports.setTemperature=jc;exports.sortLabwareBySlot=Pb;exports.splitLiquid=sr;exports.stepCommands=Sb;exports.swatchColors=cb;exports.thermocyclerPipetteCollision=Xo;exports.thermocyclerProfileStep=xb;exports.thermocyclerStateGetter=es;exports.thermocyclerStateStep=zb;exports.tiprackWellNamesFlat=Zb;exports.touchTip=Ot;exports.transfer=Hb;exports.unrollThermocyclerProfile=gp;exports.uuid=U;exports.vacuumCloseVent=jo;exports.vacuumCloseVentSetPumpPower=jb;exports.vacuumCloseVentSetPumpPressure=Wb;exports.vacuumCloseVentStartProfile=Gb;exports.vacuumModuleStateGetter=pt;exports.vacuumOpenVent=X_;exports.vacuumSetPumpPower=Wc;exports.vacuumSetPumpPressure=Gc;exports.vacuumStartRunProfile=Yc;exports.vacuumStopPump=ny;exports.waitForModuleTask=Kb;exports.waitForTemperature=Kc;exports.wellFillFromWellContents=JE;
|
|
155
|
+
)`}),ao=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,mn=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??F,so=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:ft,liquidHandlingAction:"aspirate",byVolumeProperty:"flowRateByVolume",defaultValue:null})??a,hn=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:ft,liquidHandlingAction:"singleDispense",byVolumeProperty:"flowRateByVolume",defaultValue:null})??F,Pr=KA(xe,v);let Rr=null,io=null;const Se=[...Pr.reduce((me,St,Vt)=>{const[ve,$e]=St,lo=$t.reduce((he,Qe,_r)=>{const Nr=Vt===0&&_r===0,kr=Vt+1===Pr.length,_n=_r+1===$t.length&&kr;let gt=!1;A==="always"?gt=!0:A==="once"?gt=Nr:A==="perSource"?gt=ve!==Rr:A==="perDest"&&(gt=Nr||$e!==io);const co=c.LOW_VOLUME_PIPETTES.includes(Ut)?[N(kn,{pipetteId:V,volume:Qe})]:[];let yr=[];if(gt){const Lt=Qt?.shift();yr=[P(aa,{pipette:V,primaryNozzle:W,nozzles:le,dropTipLocation:Ft&&Xe!=null?Xe:k,tipRack:ne,...le!=null?{nozzles:le}:{},...Ge===yt&&Lt!=null&&ye!=null?{tipSelectionArgs:{tipRackId:ye,tipWell:Lt}}:{}})]}const Cr=Te[z]?.def.wells[ve]?.depth??null,Jt=c.getMmFromBottom(L,s,Cr),er=c.getMmFromBottom(b,h,Cr),yn=c.getMmFromBottom(f,l,Cr);Jt!=null&&er!=null&&Jt>er&&we.push(Hh());const Dr=Hr({retractZOffset:f,retractPositionReference:l,labwareId:z,labwareEntities:Te,well:ve}),br=!Dr&&ve!=null?[N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[],bn=Hr({retractZOffset:Ve,retractPositionReference:oe,labwareId:E,labwareEntities:Te,well:$e}),Pe=!bn&&$e!=null?[N(H,{pipetteId:V,labwareId:E,wellName:$e,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})]:[];Jt!=null&&yn!=null&&Jt>yn&&we.push(jh());const tr=[N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:c.SAFE_MOVE_TO_WELL_LOCATION})],Mr=[N(Rt,{pipetteId:V})],Et=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:ft,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,rr=M!=null?[N(Ie,{seconds:M.seconds})]:[],po=ft>0&&!gt&&(_r>0||Vt>0)?[N(tt,{isAirGap:!0,pipetteId:V,volume:ft,flowRate:hn,...Et>0?{correctionVolume:Et}:{},pushOut:0}),...rr]:[],In=[...tr,...po,...co,...Mr],Tn=[N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:rn}),N(H,{pipetteId:V,labwareId:z,..._!=null?{speed:_}:{},wellName:ve,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[s],offset:{x:w,y:S,z:L}}}),...m!=null&&m.seconds>0?[N(Ie,{seconds:m.seconds})]:[]],fo=Z?Br({pipette:V,volume:Qe,times:1,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:F,aspirateDelaySeconds:o?.seconds??0,dispenseDelaySeconds:M?.seconds??0,finalPushOut:0,invariantContext:t,liquidClass:B,tiprack:ne,generatePython:!1}):[],wn=U!=null?Br({pipette:V,volume:U.volume,times:U.times,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:F,aspirateDelaySeconds:o?.seconds,dispenseDelaySeconds:M?.seconds,finalPushOut:0,invariantContext:t,liquidClass:B,tiprack:ne,generatePython:!1}):[],Fr=o!=null?[N(Ie,{seconds:o.seconds})]:[],mo=Tt?[N(Ot,{pipetteId:V,labwareId:z,wellName:ve,...Ct!=null?{mmFromEdge:Ct}:{},zOffsetFromTop:wt,...ke!=null?{speed:ke}:{}}),...X>0&&Dr?[N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:fr})]:[]]:[],Ue=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,$r=X>0?[...br,N(Pt,{pipetteId:V,volume:X,flowRate:ao,...Ue>0?{correctionVolume:Ue}:{}}),...Fr]:[],Sn=[N(Ho,{pipetteId:V,volume:Qe,flowRate:a,...on>0?{correctionVolume:on}:{}}),...Fr],Ir=[N(H,{pipetteId:V,labwareId:z,...u!=null?{speed:u}:{},wellName:ve,wellLocation:fr}),...i!=null&&i?.seconds>0?[N(Ie,{seconds:i.seconds})]:[]],Ur=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:X,liquidHandlingAction:"singleDispense",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,nr=$e!=null?[N(H,{pipetteId:V,labwareId:E,wellName:$e,wellLocation:Er}),...X>0?[N(tt,{isAirGap:!0,pipetteId:V,volume:X,flowRate:mn,pushOut:0,...Ur>0?{correctionVolume:Ur}:{}}),...rr]:[],N(H,{pipetteId:V,labwareId:E,...ie!=null?{speed:ie}:{},wellName:$e,wellLocation:{origin:c.POSITION_REFERENCE_MAPPED_TO_WELL_ORIGIN[G],offset:{x:ae,y:K,z:j}}}),...Me!=null&&Me.seconds>0?[N(Ie,{seconds:Me.seconds})]:[]]:[N(qe,{fixtureId:E,pipetteId:V,offset:{x:0,y:0,z:0}})],Tr=re!=null&&$e!=null?0:x,ho=[N(tt,{pipetteId:V,volume:Qe,flowRate:F,...Tr!=null?{pushOut:Tr}:{},...Or>0?{correctionVolume:Or}:{}}),...rr],la=re!=null&&$e!=null?Br({pipette:V,volume:re.volume,times:re.times,aspirateFlowRateUlSec:a,dispenseFlowRateUlSec:F,aspirateDelaySeconds:o?.seconds,dispenseDelaySeconds:M?.seconds,finalPushOut:x,invariantContext:t,liquidClass:B,tiprack:ne,generatePython:!1}):[],ts=$e!=null?[N(H,{pipetteId:V,labwareId:E,...fe!=null?{speed:fe}:{},wellName:$e,wellLocation:mr}),...Y!=null&&Y?.seconds>0?[N(Ie,{seconds:Y.seconds})]:[]]:[],ua=N(xn,{pipetteId:V,flowRate:g}),_o=c.getByVolumeValue({liquidClass:B,pipetteSpecs:Oe,tiprackDefUri:ne,targetVolume:ft,liquidHandlingAction:"aspirate",byVolumeProperty:"correctionByVolume",defaultValue:0})??0,At=(Lt,qr=!0)=>ft>0&&!(A==="never"&&_n&&Lt)?[...qr?Pe:[],N(Rt,{pipetteId:V}),N(Pt,{pipetteId:V,volume:ft,flowRate:so,..._o>0?{correctionVolume:_o}:{}}),...Fr]:[],gn=Lt=>$e!=null&&st?[N(Ot,{pipetteId:V,labwareId:E,wellName:$e,...Ee!=null?{mmFromEdge:Ee}:{},zOffsetFromTop:Ce,...Fe!=null?{speed:Fe}:{}}),...At(Lt).length>0&&bn?[N(H,{pipetteId:V,labwareId:E,wellName:$e,wellLocation:mr})]:[]]:[];let Bt=[];switch(T){case null:case void 0:Bt=[...gn(!0),...At(!0)];break;case zn:Bt=[ua,...gn(!0),...At(!0)];break;case Xr:Bt=[...gn(!0),...At(!1),N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:{origin:c.WELL_ORIGIN_TOP}}),ua,...st&&!it?[N(Ot,{pipetteId:V,labwareId:z,wellName:ve,...Ee!=null?{mmFromEdge:Ee}:{},zOffsetFromTop:Ce,...Fe!=null?{speed:Fe}:{}})]:[],...At(!0).length>0?[N(H,{pipetteId:V,labwareId:z,wellName:ve,wellLocation:{origin:c.WELL_ORIGIN_TOP}})]:[],...At(!0,!1)];break;default:T in Ze?Bt=[...gn(!1),...At(!1),N(Cb,{pipetteId:V,flowRate:g,trashId:T}),...At(!0,!1)]:T in te&&(Bt=[N(Db,{pipetteId:V,flowRate:g,wasteChuteId:T}),...At(!0,!1)]);break}const ca=Ft&&(_n||A==="always")?[N(Zr,{pipette:V,dropTipLocation:ne,isReturnTip:Ft})]:[],xt=[...yr,...In,...Tn,...wn,...fo,...Sn,...Ir,...mo,...$r,...nr,...ho,...la,...ts,...Bt,...ca];return Rr=ve,io=$e,[...he,...xt]},[]);return[...me,...lo]},[]),vr];return pe(Se,t,r)},jb=(e,t,r)=>pe([P(jo,{moduleId:e.moduleId}),P(Wc,{...e,commandCreatorFnName:"vacuumSetPumpPower"})],t,r),Wb=(e,t,r)=>pe([P(jo,{moduleId:e.moduleId}),P(Gc,{...e,commandCreatorFnName:"vacuumSetPumpPressure"})],t,r),Gb=(e,t,r)=>{const{ventAfter:n}=e;return pe([P(jo,{moduleId:e.moduleId}),P(Yc,{...e,commandCreatorFnName:"vacuumStartRunProfile",ventAfter:n})],t,r)},Yb=(e,t,r)=>{const{runtimeParameters:n}=t,o=[],a=[];if(e.task_ids.forEach(l=>{const u=O(l,n);u==null?o.push(C({parameterName:l})):a.push(u)}),o.length>0)return{errors:o};const s=`[${a.join(", ")}]`,i=`${ge}.wait_for_tasks(${s})`;return{commands:[{key:$(),commandType:"waitForTasks",params:{task_ids:a}}],python:i}},Kb=(e,t,r)=>{const{waitCondition:n}=e;return n==="thermocyclerProfileComplete"?ZA(e,t,r):n==="vacuumProfileComplete"||n==="vacuumStateComplete"?XA(e,t,r):{errors:[CI(n)]}},ZA=(e,t,r)=>{const{moduleId:n}=e,o=[],a=es(r,n);if(a==null)return{errors:[de()]};if(a.currentBlockActivity.type!=="profile")return{errors:[Ep()]};const{taskId:s}=a.currentBlockActivity;return s==null?{errors:[Ep()]}:(o.push(P(Yb,{task_ids:[s]})),pe(o,t,r))},XA=(e,t,r)=>{const{moduleId:n}=e,o=[],a=pt(r,n);if(a==null)return{errors:[de()]};if(a.currentPumpActivity.type!=="timedHold"&&a.currentPumpActivity.type!=="profile")return{errors:[kI()]};const s=a.currentPumpActivity.taskId;return o.push(P(Yb,{task_ids:[s]})),pe(o,t,r)};var rc,Uh;function QA(){if(Uh)return rc;Uh=1;var e=xy(),t=1,r=4;function n(o){return e(o,t|r)}return rc=n,rc}var JA=QA();const eL=Ye(JA),Zb=["A1","B1","C1","D1","E1","F1","G1","H1","A2","B2","C2","D2","E2","F2","G2","H2","A3","B3","C3","D3","E3","F3","G3","H3","A4","B4","C4","D4","E4","F4","G4","H4","A5","B5","C5","D5","E5","F5","G5","H5","A6","B6","C6","D6","E6","F6","G6","H6","A7","B7","C7","D7","E7","F7","G7","H7","A8","B8","C8","D8","E8","F8","G8","H8","A9","B9","C9","D9","E9","F9","G9","H9","A10","B10","C10","D10","E10","F10","G10","H10","A11","B11","C11","D11","E11","F11","G11","H11","A12","B12","C12","D12","E12","F12","G12","H12"],Gr="p300SingleId",Po="p300MultiId",Ic="p100096Id",Tc="sourcePlateId",wc="destPlateId",Sc="troughId",tL="A1",rL="tiprack1Id",nL={isAirGap:!0},ma=c.fixture96Plate,qh=c.fixture12Trough,ha=c.fixtureTiprack10ul,zt=c.fixtureTiprack300ul,En=c.fixtureTiprack1000ul,_a=c.fixtureTiprackAdapter,Xb={OT_PD_DISABLE_MODULE_RESTRICTIONS:!1};function Qb(e){return Zb.reduce((t,r)=>({...t,[r]:e?qo:_e}),{})}function oL(e,t){return Array.from("ABCDEFGH").map(r=>`${r}${e}`).reduce((r,n)=>({...r,[n]:t}),{})}function Jb(){const e={[Tc]:{id:Tc,pythonName:"mock_source_plate",labwareDefURI:c.getLabwareDefURI(ma),def:ma},[wc]:{id:wc,pythonName:"mock_dest_plate",labwareDefURI:c.getLabwareDefURI(ma),def:ma},[Sc]:{id:Sc,pythonName:"mock_trough",labwareDefURI:c.getLabwareDefURI(qh),def:qh},tiprack1Id:{id:"tiprack1Id",pythonName:"mock_tip_rack_1",labwareDefURI:c.getLabwareDefURI(zt),def:zt},tiprack2Id:{id:"tiprack2Id",pythonName:"mock_tip_rack_2",labwareDefURI:c.getLabwareDefURI(zt),def:zt},tiprack3Id:{id:"tiprack3Id",pythonName:"mock_tip_rack_3",labwareDefURI:c.getLabwareDefURI(zt),def:zt},tiprack4AdapterId:{id:"tiprack4AdapterId",pythonName:"mock_adapter_4",labwareDefURI:c.getLabwareDefURI(_a),def:_a},tiprack5AdapterId:{id:"tiprack5AdapterId",pythonName:"mock_adapter_5",labwareDefURI:c.getLabwareDefURI(_a),def:_a},tiprack4Id:{id:"tiprack4Id",pythonName:"mock_tip_rack_4",labwareDefURI:c.getLabwareDefURI(En),def:En},tiprack5Id:{id:"tiprack5Id",pythonName:"mock_tip_rack_5",labwareDefURI:c.getLabwareDefURI(En),def:En}},t={},r={[oc]:{id:oc,location:"cutoutA3",pythonName:"trash_bin_1"}},n={p10SingleId:{name:"p10_single",id:"p10SingleId",pythonName:"mock_pipette_p10",tiprackDefURI:[c.getLabwareDefURI(ha)],tiprackLabwareDef:[ha],spec:c.fixtureP10SingleV2Specs},p10MultiId:{name:"p10_multi",id:"p10MultiId",tiprackDefURI:[c.getLabwareDefURI(ha)],tiprackLabwareDef:[ha],spec:c.fixtureP10MultiV2Specs,pythonName:"mock_pipette_p10_multi"},[Gr]:{name:"p300_single",id:Gr,tiprackDefURI:[c.getLabwareDefURI(zt)],tiprackLabwareDef:[zt],spec:c.fixtureP300SingleV2Specs,pythonName:"mock_pipette"},[Po]:{name:"p300_multi",id:Po,tiprackDefURI:[c.getLabwareDefURI(zt)],tiprackLabwareDef:[zt],spec:c.fixtureP300MultiV2Specs,pythonName:"mock_pipette_p300_multi"},[Ic]:{name:"p1000_96",id:Ic,tiprackDefURI:[c.getLabwareDefURI(En)],tiprackLabwareDef:[En],spec:c.fixtureP100096V2Specs,pythonName:"mock_pipette_p1000_96"}};return{labwareEntities:e,moduleEntities:t,pipetteEntities:n,trashBinEntities:r,wasteChuteEntities:{},stagingAreaEntities:{},gripperEntities:{},liquidEntities:{},runtimeParameters:{},config:Xb}}const Jr=e=>{const{invariantContext:t,labwareLocations:r,moduleLocations:n,pipetteLocations:o,tiprackSetting:a}=e,s=ep({invariantContext:t,labwareLocations:r,moduleLocations:n||{},pipetteLocations:o});return s.tipState.tipracks=lr(a,i=>Qb(i)),s},Jn=()=>({pipetteLocations:{[Gr]:{mount:"left",tiprackId:"tiprack1Id"},[Po]:{mount:"right",tiprackId:"tiprack1Id"}},labwareLocations:{tiprack1Id:{stack:["tiprack1Id","1"]},tiprack2Id:{stack:["tiprack2Id","5"]},tiprack4AdapterId:{stack:["tiprack4AdapterId","7"]},tiprack5AdapterId:{stack:["tiprack5AdapterId","8"]},tiprack4Id:{stack:["tiprack4Id","tiprack4AdapterId","7"]},tiprack5Id:{stack:["tiprack5Id","tiprack5AdapterId","8"]},sourcePlateId:{stack:["sourcePlateId","2"]},destPlateId:{stack:["destPlateId","3"]}},moduleLocations:{}}),eI=()=>({pipetteLocations:{[Gr]:{mount:"left"},[Po]:{mount:"right"}},labwareLocations:{tiprack1Id:{stack:["tiprack1Id","B1"]},tiprack2Id:{stack:["tiprack2Id","A2"]},sourcePlateId:{stack:["sourcePlateId","offDeck"]},destPlateId:{stack:["destPlateId","C2"]}},moduleLocations:{}}),tI=e=>Jr({...Jn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),aL=e=>Jr({...eI(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}}),sL=e=>({robotState:tI(e),warnings:[]}),iL=e=>{const t=Jr({...Jn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0,tiprack2Id:!0}});return t.tipState.pipettes[Gr]={hasTip:!0,tiprackURI:"tiprack1Id"},t},lL=e=>{const t=Jr({...Jn(),invariantContext:e,tiprackSetting:{tiprack1Id:!0}});return t.tipState.pipettes[Gr]={hasTip:!0,tiprackURI:"tiprack1Id"},t.tipState.tipracks.tiprack1Id.A1=_e,t},uL=e=>Jr({...Jn(),invariantContext:e,tiprackSetting:{tiprack1Id:!1,tiprack2Id:!1}}),cL=({temperatureModuleId:e,thermocyclerId:t})=>{const r=Jb();r.moduleEntities={[e]:{id:e,type:c.TEMPERATURE_MODULE_TYPE,model:"foo",pythonName:"mock_temperature_module_1"},[t]:{id:t,type:c.THERMOCYCLER_MODULE_TYPE,model:"foo",pythonName:"mock_thermocycler"}};const n=Jr({...Jn(),invariantContext:r,tiprackSetting:{tiprack1Id:!0}});return n.modules={[e]:{slot:"3",moduleState:{type:c.TEMPERATURE_MODULE_TYPE,status:Uo,targetTemperature:null}},[t]:{slot:"span7_8_10_11",moduleState:{type:c.THERMOCYCLER_MODULE_TYPE,currentBlockActivity:{type:"blockDeactivated"},lidTargetTemp:null,lidOpen:null,numProfilesStarted:0}}},{invariantContext:r,robotState:n}},pL=(e,t,r,n)=>{const o=eL(e);return o.modules[t].moduleState={type:c.TEMPERATURE_MODULE_TYPE,targetTemperature:n,status:r},o};exports.ABSORBANCE_READER_INITIAL_STATE=Jh;exports.AIR=Ke;exports.AIR_GAP_META=nL;exports.AIR_GAP_OFFSET_FROM_TOP=nc;exports.AUTOMATIC=Ia;exports.BACK_LEFT_NOZZLES=d_;exports.BOTTOM_UP_LABWARE_POOL_KEYS=ar;exports.BOTTOM_UP_STORED_LABWARE_URI_KEYS=zI;exports.CLEAN=qo;exports.COLUMN_4_SLOTS=De;exports.CUSTOM_LABWARE_DICT_NAME=Va;exports.DEFAULT_BLOWOUT_WELL=tL;exports.DEFAULT_CONFIG=Xb;exports.DEFAULT_PIPETTE=Gr;exports.DEST_LABWARE=wc;exports.DEST_WELL_BLOWOUT_DESTINATION=zn;exports.DIRTY=or;exports.EMPTY=_e;exports.FAKE_HOPPER_LOCATION_MAP=i_;exports.FIXED_TRASH_ID=oc;exports.FLEX_STACKER_MODULE_INITIAL_STATE=t_;exports.FLEX_TRASH_DEF_URI=BI;exports.GRIPPER_LOCATION=o_;exports.HEATERSHAKER_MODULE_INITIAL_STATE=Qh;exports.HOPPER_FAKE_LOCATIONS=s_;exports.HOPPER_STACKER_LOCATION=rt;exports.INDENT=Wo;exports.MAGNETIC_BLOCK_INITIAL_STATE=e_;exports.MAGNETIC_MODULE_INITIAL_STATE=Kh;exports.MANUAL=yt;exports.MAX_STACKABLE_VACUUM_SPACERS=c_;exports.MIXED_WELL_COLOR=ub;exports.MODULES_WITH_COLLISION_ISSUES=Yh;exports.MODULE_INITIAL_STATE_BY_TYPE=n_;exports.MULTI_PIPETTE=Po;exports.NOZZLE_STYLES=La;exports.OFF_DECK=Cn;exports.OT2_TC_SLOTS=xI;exports.OT_2_TRASH_DEF_URI=VI;exports.PAPI_VERSION=pb;exports.PD_APPLICATION_VERSION=oA;exports.PIPETTE_96=Ic;exports.PRIMARY_NOZZLES=Oa;exports.PROTOCOL_CONTEXT_NAME=ge;exports.SLOT_LOCATIONS_TO_FAKE_HOPPER_LOCATIONS=HI;exports.SOURCE_LABWARE=Tc;exports.SOURCE_WELL_BLOWOUT_DESTINATION=Xr;exports.STAGING_AREA_SLOTS=a_;exports.TEMPERATURE_APPROACHING_TARGET=Ec;exports.TEMPERATURE_AT_TARGET=gc;exports.TEMPERATURE_DEACTIVATED=Uo;exports.TEMPERATURE_MODULE_INITIAL_STATE=Zh;exports.THERMOCYCLER_MODULE_INITIAL_STATE=Xh;exports.TIPRACK_1=rL;exports.TOUCHED_PIPETTABLE_LABWARE=yc;exports.TROUGH_LABWARE=Sc;exports.VACUUM_AT_TARGET=JI;exports.VACUUM_DEACTIVATED=QI;exports.VACUUM_DOCK_ADDRESSABLE_AREA=l_;exports.VACUUM_DOCK_DISPLAY_LOCATION=p_;exports.VACUUM_DOCK_LOCATION=Ac;exports.VACUUM_MODE_POWER=ac;exports.VACUUM_MODE_PRESSURE=sc;exports.VACUUM_MODULE_INITIAL_STATE=r_;exports.VACUUM_PROGRAM_PROFILE=WI;exports.VACUUM_PROGRAM_STATE=jI;exports.VACUUM_SPACER_LOAD_NAMES=u_;exports.VACUUM_STATE_PUMP_OFF=GI;exports.VACUUM_STATE_PUMP_ON=YI;exports.VACUUM_STATE_VENT=KI;exports.VACUUM_VENT_CLOSED=Vo;exports.VACUUM_VENT_OPEN=Lc;exports.VACUUM_VENT_SET_CLOSED=XI;exports.VACUUM_VENT_SET_OPEN=ZI;exports.ZERO_OFFSET=vt;exports._getNextTip=Rb;exports._wellContentsForLabware=YE;exports.absorbanceReaderCloseInitialize=Nb;exports.absorbanceReaderCloseLid=Ua;exports.absorbanceReaderCloseRead=kb;exports.absorbanceReaderCollision=Yo;exports.absorbanceReaderInitialize=F_;exports.absorbanceReaderOpenLid=$_;exports.absorbanceReaderRead=U_;exports.absorbanceReaderStateGetter=Qn;exports.airGapLocationHelper=Yw;exports.aspirate=Lw;exports.assignContainsAmongSiblings=yp;exports.blowOutInWell=xc;exports.captureImage=q_;exports.column4StagingSlotIdFromFlexStackerShuttleAddressableArea=Ly;exports.commandCreatorsTimeline=OE;exports.comment=V_;exports.consolidate=qb;exports.constructInvariantContextFromAnalysis=CE;exports.createEmptyLiquidState=Ty;exports.createStagingAreaForInvariantContext=cc;exports.createTipLiquidState=wy;exports.curryCommandCreator=P;exports.curryWithoutPython=N;exports.deactivateTemperature=x_;exports.deckSlotKeyForFlexStackerShuttleAddressableArea=Xw;exports.delay=Ie;exports.delayLocationHelper=Kw;exports.disengageMagnet=z_;exports.dispense=zc;exports.dispenseLocationHelper=Ww;exports.distribute=Vb;exports.dropTip=Zr;exports.dropTipInPlace=qa;exports.dropTipInTrash=Fb;exports.dropTipInWasteChute=$b;exports.engageMagnet=H_;exports.enrichRobotStateForStackGraphTraversals=kg;exports.flexStackerEmpty=j_;exports.flexStackerFillItems=W_;exports.flexStackerRetrieve=G_;exports.flexStackerStateGetter=It;exports.flexStackerStore=Y_;exports.formatChangeTipArg=Qa;exports.formatPyDict=zr;exports.formatPyList=J_;exports.formatPyRuntimeValue=Je;exports.formatPyStr=q;exports.formatPyTuple=Q_;exports.formatPyValue=ur;exports.formatPyWellLocation=Gt;exports.getAddressableAreaFromModule=_p;exports.getAddressableAreaNameFromLabwareLocation=Lg;exports.getAllLargestStacks=Yy;exports.getAllProvidedAddressableAreasFromDeckConfig=Ky;exports.getAllWellsForLabware=lb;exports.getCanPlaceStackableVacuumSpacer=my;exports.getChunkForIndentingLists=Ba;exports.getCommandCreatorFromStepArgs=PA;exports.getCustomLiquidClassProperties=Za;exports.getCutoutFromSlot=Eb;exports.getCutoutIdByAddressableArea=hy;exports.getDefaultPrimaryNozzle=ga;exports.getDefineLiquids=yb;exports.getDispenseAirGapLocation=Sy;exports.getFlexStackerCutoutBaseDeckSlotId=tp;exports.getFlexStackerShuttleAddressableArea=za;exports.getFullStackFromLabwares=Ha;exports.getFullStackFromNodeTopDownRecursive=Ka;exports.getHasNoWellsFromCCArgs=PE;exports.getInitialRobotStateStandard=tI;exports.getInitialRobotStateWithOffDeckLabwareStandard=aL;exports.getIsHeaterShakerEastWestMultiChannelPipette=Zn;exports.getIsHeaterShakerEastWestWithLatchOpen=Kn;exports.getIsHeaterShakerNorthSouthOfNonTiprackWithMultiChannelPipette=Jo;exports.getIsInPipettableLocation=Ny;exports.getIsLabwareCompatibleWithStack=vy;exports.getIsRetractSafeForAirGap=Hr;exports.getIsSafePickupWithinTiprack=wp;exports.getIsSlotAHopper=Py;exports.getIsSlotAVacuumDock=Ao;exports.getIsSpaceInHopper=ap;exports.getIsStackableVacuumSpacer=Eo;exports.getIsTallLabwareEastWestOfHeaterShaker=sb;exports.getIsVacuumSpacer=py;exports.getIsVacuumSpacerSeat=dy;exports.getLabwareHasLid=Ry;exports.getLabwareHasLiquid=Ey;exports.getLabwareIdOnShuttle=np;exports.getLabwareSlot=Wn;exports.getLargestStackContainingLabware=Gy;exports.getLargestStackInSlot=go;exports.getLiquidClassName=ra;exports.getLiquidIdsOnLabware=XE;exports.getLiquidIdsOnLabwareStack=ZE;exports.getLoadAdapters=fb;exports.getLoadLabware=hb;exports.getLoadLidStacks=mb;exports.getLoadLiquidClasses=Ib;exports.getLoadLiquids=bb;exports.getLoadModules=db;exports.getLoadPipettes=_b;exports.getLoadTrashBins=Tb;exports.getLoadWasteChute=wb;exports.getLocationTotalVolume=wr;exports.getModuleHasLiveTask=Gn;exports.getModuleIdFromRobotStateStack=Go;exports.getModuleLocationSlot=Zw;exports.getModuleState=kt;exports.getNearestParentInStack=Ay;exports.getNextRobotStateAndWarnings=Ip;exports.getNextRobotStateAndWarningsSingleCommand=ab;exports.getNextTiprack=oa;exports.getNodeParentModuleId=Eg;exports.getNozzleConfig=Tp;exports.getPipetteCenteringFullOffset=Ob;exports.getPipetteIdFromCCArgs=vE;exports.getPipetteMovementSafetyStatus=bt;exports.getPipetteWithTipMaxVol=Ja;exports.getProvidedAddressableAreasExposed=Og;exports.getPythonAssignTipRacksString=Xa;exports.getResultingTimelineFrameFromRunCommands=ME;exports.getRobotInitialStateNoTipsRemain=uL;exports.getRobotStateAndWarningsStandard=sL;exports.getRobotStatePickedUpTipStandard=lL;exports.getRobotStateWithTipStandard=iL;exports.getRunTimeParameters=mA;exports.getSetStoredLabware=gb;exports.getSlotInLocationStack=ee;exports.getStackForLabwareLocation=uc;exports.getStackableVacuumSpacerLoadNamesInStack=fy;exports.getStackedOnNodeFromPdStack=Zy;exports.getStateAndContextTempTCModules=cL;exports.getTargetTipsFromWellSets=na;exports.getThermocyclerProfileRepetitionsForPython=vb;exports.getTipColumn=oL;exports.getTipColumnIndex=bc;exports.getTipColumnName=Sp;exports.getTipRowName=On;exports.getTiprackHasTips=gy;exports.getTiprackTipstate=Qb;exports.getTopLocationInStack=xa;exports.getTopmostLabwareOnModuleFromStackRobotState=Jw;exports.getTransferPlanAndReferenceVolumes=rp;exports.getTrashBinAddressableAreaName=Qc;exports.getTrashLocationFromAddressableAreaName=yy;exports.getTrashOrLabware=Hn;exports.getVolumesPerLiquid=KE;exports.getWasteChuteAddressableAreaNamePip=_y;exports.getWellsForTips=Jc;exports.heaterShaker=Bb;exports.indentPyLines=Q;exports.labwareMatchesLabwareInHopper=op;exports.makeContext=Jb;exports.makeInitialRobotState=ep;exports.makeState=Jr;exports.makeStateArgsLabwareOffDeck=eI;exports.makeStateArgsStandard=Jn;exports.mergeLiquid=Sr;exports.mix=Ub;exports.mixBlowoutLocationHelper=Iy;exports.modulePipetteCollision=Yn;exports.moveHelper=Gw;exports.moveLabware=K_;exports.moveToAddressableArea=qe;exports.moveToAddressableAreaForDropTip=Hc;exports.pipetteAdjacentHeaterShakerWhileShaking=Xn;exports.pipetteIntoHeaterShakerLatchOpen=ea;exports.pipetteIntoHeaterShakerWhileShaking=ta;exports.pythonCustomLabwareDict=dA;exports.pythonDefRun=pA;exports.pythonImports=aA;exports.pythonMetadata=sA;exports.pythonRequirements=iA;exports.pythonRuntimeString=Nt;exports.reduceCommandCreators=pe;exports.repeatArray=by;exports.replaceTip=aa;exports.resolveAllowedRuntimeValue=Ht;exports.resolveBooleanRuntimeValue=je;exports.resolveDeckSlotKeyForLabwareStackInSlot=Oy;exports.resolveNumericRuntimeValue=D;exports.resolveRuntimeWellLocation=Dn;exports.resolveStringRuntimeValue=O;exports.robotWithStatusAndTemp=pL;exports.setTemperature=jc;exports.sortLabwareBySlot=Pb;exports.splitLiquid=sr;exports.stepCommands=Sb;exports.swatchColors=cb;exports.thermocyclerPipetteCollision=Xo;exports.thermocyclerProfileStep=xb;exports.thermocyclerStateGetter=es;exports.thermocyclerStateStep=zb;exports.tiprackWellNamesFlat=Zb;exports.touchTip=Ot;exports.transfer=Hb;exports.unrollThermocyclerProfile=gp;exports.uuid=$;exports.vacuumCloseVent=jo;exports.vacuumCloseVentSetPumpPower=jb;exports.vacuumCloseVentSetPumpPressure=Wb;exports.vacuumCloseVentStartProfile=Gb;exports.vacuumModuleStateGetter=pt;exports.vacuumOpenVent=X_;exports.vacuumSetPumpPower=Wc;exports.vacuumSetPumpPressure=Gc;exports.vacuumStartRunProfile=Yc;exports.vacuumStopPump=ny;exports.waitForModuleTask=Kb;exports.waitForTemperature=Kc;exports.wellFillFromWellContents=JE;
|