@corva/ui 3.30.0-rc.0 → 3.30.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.
Files changed (65) hide show
  1. package/cjs-bundle/components/Drillstring/BHAComponentDetail/constants.js +1 -1
  2. package/cjs-bundle/components/Drillstring/BHAComponentDetail/constants.js.map +1 -1
  3. package/cjs-bundle/components/Drillstring/BHAComponentIcon.js +1 -1
  4. package/cjs-bundle/components/Drillstring/BHAComponentIcon.js.map +1 -1
  5. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
  6. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
  7. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/EditComponentDialog.js +1 -1
  8. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/EditComponentDialog.js.map +1 -1
  9. package/cjs-bundle/components/Drillstring/BHASchematic.js +1 -1
  10. package/cjs-bundle/components/Drillstring/BHASchematic.js.map +1 -1
  11. package/cjs-bundle/components/Drillstring/BHATileIcon.js +1 -1
  12. package/cjs-bundle/components/Drillstring/BHATileIcon.js.map +1 -1
  13. package/cjs-bundle/constants/bha.js +1 -1
  14. package/cjs-bundle/constants/bha.js.map +1 -1
  15. package/cjs-bundle/constants/drillstring.js +1 -1
  16. package/cjs-bundle/constants/drillstring.js.map +1 -1
  17. package/cjs-bundle/utils/DrillstringUtils.js +1 -1
  18. package/cjs-bundle/utils/DrillstringUtils.js.map +1 -1
  19. package/cjs-bundle/utils/bha.js +1 -1
  20. package/cjs-bundle/utils/bha.js.map +1 -1
  21. package/cjs-bundle/utils/drillstring/conversion.js +1 -1
  22. package/cjs-bundle/utils/drillstring/conversion.js.map +1 -1
  23. package/cjs-bundle/utils/drillstring/schematic.js +1 -1
  24. package/cjs-bundle/utils/drillstring/schematic.js.map +1 -1
  25. package/cjs-bundle/utils/drillstring/validation.js +1 -1
  26. package/cjs-bundle/utils/drillstring/validation.js.map +1 -1
  27. package/components/Drillstring/BHAComponentDetail/constants.d.ts.map +1 -1
  28. package/components/Drillstring/BHAComponentDetail/constants.js +1 -1
  29. package/components/Drillstring/BHAComponentDetail/constants.js.map +1 -1
  30. package/components/Drillstring/BHAComponentIcon.d.ts.map +1 -1
  31. package/components/Drillstring/BHAComponentIcon.js +1 -1
  32. package/components/Drillstring/BHAComponentIcon.js.map +1 -1
  33. package/components/Drillstring/BHAComponentsTable/components/Component.d.ts.map +1 -1
  34. package/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
  35. package/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
  36. package/components/Drillstring/BHAComponentsTable/components/EditComponentDialog.d.ts.map +1 -1
  37. package/components/Drillstring/BHAComponentsTable/components/EditComponentDialog.js +1 -1
  38. package/components/Drillstring/BHAComponentsTable/components/EditComponentDialog.js.map +1 -1
  39. package/components/Drillstring/BHASchematic.d.ts.map +1 -1
  40. package/components/Drillstring/BHASchematic.js +1 -1
  41. package/components/Drillstring/BHASchematic.js.map +1 -1
  42. package/components/Drillstring/BHATileIcon.d.ts.map +1 -1
  43. package/components/Drillstring/BHATileIcon.js +1 -1
  44. package/components/Drillstring/BHATileIcon.js.map +1 -1
  45. package/constants/bha.d.ts +1 -0
  46. package/constants/bha.d.ts.map +1 -1
  47. package/constants/bha.js +1 -1
  48. package/constants/bha.js.map +1 -1
  49. package/constants/drillstring.d.ts.map +1 -1
  50. package/constants/drillstring.js +1 -1
  51. package/constants/drillstring.js.map +1 -1
  52. package/package.json +1 -1
  53. package/utils/DrillstringUtils.d.ts.map +1 -1
  54. package/utils/DrillstringUtils.js +1 -1
  55. package/utils/DrillstringUtils.js.map +1 -1
  56. package/utils/bha.js +1 -1
  57. package/utils/bha.js.map +1 -1
  58. package/utils/drillstring/conversion.d.ts.map +1 -1
  59. package/utils/drillstring/conversion.js +1 -1
  60. package/utils/drillstring/conversion.js.map +1 -1
  61. package/utils/drillstring/schematic.js +1 -1
  62. package/utils/drillstring/schematic.js.map +1 -1
  63. package/utils/drillstring/validation.d.ts.map +1 -1
  64. package/utils/drillstring/validation.js +1 -1
  65. package/utils/drillstring/validation.js.map +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("lodash/set"),r=require("lodash/get"),i=require("moment"),o=require("./convert.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e),a=n(t),l=n(r),_=n(i);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){s.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i.isMinInclusive,n=void 0===o||o,s=parseFloat(e);return!Number.isNaN(s)&&(!(n&&s<t||!n&&s<=t)&&!(r&&s>r))}function c(e,t,r){var i=o.getUnitPreference("shortLength"),n=e,s=t;"in"!==i&&(n=o.convertValue(e,"shortLength",i,"in"),s=o.convertValue(t,"shortLength",i,"in"));var a=2.673*(s*s-n*n),l="in"!==i?o.convertValue(a,"massPerLength","lb-ft"):a;return r>=.5*l&&r<=1.5*l}function d(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return null==e?null:t&&r?parseFloat(o.convertValue(e,t,o.getUnitPreference(t),r,i)):parseFloat(e)}function m(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return 0===e||e?t&&r?o.convertValue(e,t,r,null,i):e:null}exports.convertRecordBackToImperialUnit=function(e){var t=l.default(e,["data","components"]);"bit"===l.default(t,[0,"family"])&&(t=t.reverse().map((function(e,t){return h(h({},e),{},{order:t})})),e=a.default(e,["data","components"],t));var r=e.toJS().data,i=r.start_timestamp_str&&_.default(new Date(r.start_timestamp_str));return i&&i.isValid()&&(r.start_timestamp=i.unix()),delete r.start_timestamp_str,r.start_depth=d(r.start_depth,"length","ft"),r.components=r.components.map((function(e){var t=Object.assign({},e);if(t.inner_diameter=d(t.inner_diameter,"shortLength","in"),t.outer_diameter=d(t.outer_diameter,"shortLength","in",4),t.linear_weight=d(t.linear_weight,"massPerLength","lb-ft"),t.weight=d(t.weight,"mass","lb"),t.length=d(t.length,"length","ft"),t.component_length=d(t.component_length,"length","ft"),t.outer_diameter_tooljoint=d(t.outer_diameter_tooljoint,"shortLength","in"),t.inner_diameter_tooljoint=d(t.inner_diameter_tooljoint,"shortLength","in"),t.length_tooljoint=d(t.length_tooljoint,"length","ft"),"bit"===t.family||"ur"===t.family){var r=d(1,"shortLength","in");if(t.size=d(t.size,"shortLength","in",3),t.nozzle_sizes&&t.nozzle_sizes.length>0)for(var i=0;i<t.nozzle_sizes.length;i+=1){var o=t.nozzle_sizes[i];o.size=1!==r?32*d(o.size,"shortLength","in"):o.size}t.tfa=1!==r?t.tfa*(r*r):t.tfa}if("pdm"===t.family){if(t.max_weight_on_bit=d(t.max_weight_on_bit,"force","klbf"),t.min_standard_flowrate=d(t.min_standard_flowrate,"volumeFlowRate","gal/min"),t.max_standard_flowrate=d(t.max_standard_flowrate,"volumeFlowRate","gal/min"),t.max_operating_differential_pressure=d(t.max_operating_differential_pressure,"pressure","psi"),t.torque_at_max_operating_differential_pressure=d(t.torque_at_max_operating_differential_pressure,"torque","ft-klbf",3),t.rpg=d(t.rpg,"revolutionPerVolume","rpg"),t.off_bottom_pressure_loss&&t.off_bottom_pressure_loss.length>0)for(var n=0;n<t.off_bottom_pressure_loss.length;n+=1){var s=t.off_bottom_pressure_loss[n];s.flow_rate=d(s.flow_rate,"volumeFlowRate","gal/min"),s.pressure_loss=d(s.pressure_loss,"pressure","psi")}t.has_stabilizer||delete t.stabilizer,t.stabilizer&&(t.stabilizer.inner_diameter=t.stabilizer.inner_diameter&&d(t.stabilizer.inner_diameter,"shortLength","in"),t.stabilizer.outer_diameter=t.stabilizer.outer_diameter&&d(t.stabilizer.outer_diameter,"shortLength","in"),t.stabilizer.linear_weight=t.stabilizer.linear_weight&&d(t.stabilizer.linear_weight,"massPerLength","lb-ft"),t.stabilizer.weight=t.stabilizer.weight&&d(t.stabilizer.weight,"mass","lb"),t.stabilizer.length=t.length&&d(t.stabilizer.length,"length","ft"),t.stabilizer.gauge_od=t.stabilizer.gauge_od&&d(t.stabilizer.gauge_od,"shortLength","in"),t.stabilizer.gauge_length=t.stabilizer.gauge_length&&d(t.stabilizer.gauge_length,"shortLength","in"),t.stabilizer.blade_width=t.stabilizer.blade_width&&d(t.stabilizer.blade_width,"shortLength","in"),t.stabilizer.stab_centerpoint_to_bit=t.stabilizer.stab_centerpoint_to_bit&&d(t.stabilizer.stab_centerpoint_to_bit,"length","ft"))}if("stabilizer"===t.family&&(t.gauge_od=d(t.gauge_od,"shortLength","in"),t.gauge_length=d(t.gauge_length,"shortLength","in"),t.blade_width=d(t.blade_width,"shortLength","in")),("mwd"===t.family||"rss"===t.family||"agitator"===t.family)&&t.pressure_loss&&t.pressure_loss.length>0)for(var a=0;a<t.pressure_loss.length;a+=1){var l=t.pressure_loss[a];l.flow_rate=d(l.flow_rate,"volumeFlowRate","gal/min"),l.pressure_loss=d(l.pressure_loss,"pressure","psi")}return"bit"!==t.family&&delete t.bit_type,!t.has_gamma_sensor&&Number.isFinite(t.gamma_sensor_to_bit_distance)&&delete t.gamma_sensor_to_bit_distance,!t.has_survey_sensor&&Number.isFinite(t.bit_to_survey_distance)&&delete t.bit_to_survey_distance,!t.has_directional_sensor&&Number.isFinite(t.directional_sensor_to_bit_distance)&&delete t.directional_sensor_to_bit_distance,delete t.c_length,t})),h(h({},e),{},{data:r})},exports.convertRecordtoPrefUnit=function(e){var t=e.toJS().data,r=t.components;if(t.start_depth=m(t.start_depth,"length","ft"),r.length>0)if("bit"===r[0].family){r[0].c_length=r[0].length||0;for(var i=1;i<r.length;i+=1)r[i].c_length=parseFloat(r[i-1].c_length)+parseFloat(r[i].length||0)}else{var o=r.length-1;r[o].c_length=r[o].length||0;for(var n=o-1;n>=0;n-=1)r[n].c_length=parseFloat(r[n+1].c_length)+parseFloat(r[n].length||0)}for(var s=0;s<r.length;s+=1){var a=r[s];if(a.inner_diameter=m(a.inner_diameter,"shortLength","in"),a.outer_diameter=m(a.outer_diameter,"shortLength","in",4),a.linear_weight=m(a.linear_weight,"massPerLength","lb-ft"),a.weight=m(a.weight,"mass","lb"),a.length=m(a.length,"length","ft"),a.component_length=m(a.component_length,"length","ft"),a.outer_diameter_tooljoint=m(a.outer_diameter_tooljoint,"shortLength","in"),a.inner_diameter_tooljoint=m(a.inner_diameter_tooljoint,"shortLength","in"),a.length_tooljoint=m(a.length_tooljoint,"length","ft"),a.c_length=m(a.c_length,"length","ft"),a.gamma_sensor_to_bit_distance=m(a.gamma_sensor_to_bit_distance,"length","ft"),"bit"===a.family||"ur"===a.family){var l=m(1,"shortLength","in");if(a.size=m(a.size,"shortLength","in"),a.nozzle_sizes&&a.nozzle_sizes.length>0)for(var _=0;_<a.nozzle_sizes.length;_+=1){var u=a.nozzle_sizes[_];u.size=1!==l?m(u.size,"shortLength","in")/32:u.size}a.tfa=1!==l?a.tfa*(l*l):a.tfa}if("pdm"===a.family){if(a.max_weight_on_bit=m(a.max_weight_on_bit,"force","klbf"),a.min_standard_flowrate=m(a.min_standard_flowrate,"volumeFlowRate","gal/min"),a.max_standard_flowrate=m(a.max_standard_flowrate,"volumeFlowRate","gal/min"),a.max_operating_differential_pressure=m(a.max_operating_differential_pressure,"pressure","psi"),a.torque_at_max_operating_differential_pressure=m(a.torque_at_max_operating_differential_pressure,"torque","ft-klbf",3),a.off_bottom_pressure_loss&&a.off_bottom_pressure_loss.length>0)for(var g=0;g<a.off_bottom_pressure_loss.length;g+=1){var c=a.off_bottom_pressure_loss[g];c.flow_rate=m(c.flow_rate,"volumeFlowRate","gal/min"),c.pressure_loss=m(c.pressure_loss,"pressure","psi")}a.rpg=m(a.rpg,"revolutionPerVolume","rpg"),a.has_stabilizer&&a.stabilizer&&(a.stabilizer.inner_diameter=m(a.stabilizer.inner_diameter,"shortLength","in"),a.stabilizer.outer_diameter=m(a.stabilizer.outer_diameter,"shortLength","in"),a.stabilizer.linear_weight=m(a.stabilizer.linear_weight,"massPerLength","lb-ft"),a.stabilizer.weight=m(a.stabilizer.weight,"mass","lb"),a.stabilizer.length=m(a.stabilizer.length,"length","ft"),a.stabilizer.gauge_od=m(a.stabilizer.gauge_od,"shortLength","in"),a.stabilizer.gauge_length=m(a.stabilizer.gauge_length,"shortLength","in"),a.stabilizer.blade_width=m(a.stabilizer.blade_width,"shortLength","in"),a.stabilizer.stab_centerpoint_to_bit=m(a.stabilizer.stab_centerpoint_to_bit,"length","ft"))}if("stabilizer"===a.family&&(a.gauge_od=m(a.gauge_od,"shortLength","in"),a.gauge_length=m(a.gauge_length,"shortLength","in"),a.blade_width=m(a.blade_width,"shortLength","in")),("mwd"===a.family||"rss"===a.family||"agitator"===a.family)&&a.pressure_loss&&a.pressure_loss.length>0)for(var d=0;d<a.pressure_loss.length;d+=1){var f=a.pressure_loss[d];f.flow_rate=m(f.flow_rate,"volumeFlowRate","gal/min"),f.pressure_loss=m(f.pressure_loss,"pressure","psi")}}return h(h({},e),{},{data:t})},exports.ctoi=d,exports.ctop=m,exports.isValidLinearWeight=c,exports.isValidNumber=g,exports.sValueEmpty=function(e){return null==e||""===e},exports.validate=function(e){var t=e.toJS().data,r=t.id,i=t.start_timestamp_str,n=t.start_depth,s=t.components,a=o.getUnitDisplay("shortLength"),l=o.getUnitDisplay("length"),u={general:{},components:{},specificErrors:{}},h=s.filter((function(e){return"bit"===e.family})),d=h.length>0?h[0].size:null,f=s.filter((function(e){return"mwd"===e.family&&e.has_gamma_sensor})),b=!1;if(isValueEmpty(r)&&(u.id="It should not be empty.",b=!0),i&&!_.default(new Date(i)).isValid()&&(b=!0,u.start_timestamp="Invalid Date."),Number.isFinite(n)){var p=o.convertValue(0,"length","ft"),v=o.convertValue(55e3,"length","ft"),z=o.convertValue(1,"length","ft");(n<=p||n>v)&&(b=!0,u.start_depth="Should be a positive number ".concat(p.toFixed(2),"~").concat(v.toFixed(2)," (").concat(l,")")),n===z&&(b=!0,u.start_depth="Should not be equal to ".concat(z," (").concat(l,")"))}else b=!0,u.start_depth="It should not be empty.";for(var w=0;w<s.length;w+=1){var V=void 0,y=void 0,L=void 0,x=void 0,F=void 0,j=void 0,I=void 0,O=void 0,q=void 0,E=void 0,P=void 0,D=void 0,k=void 0,S=void 0,N=void 0,R=s[w],T={};switch(R.family){case"ct":V=o.convertValue(0,"shortLength","in"),L=o.convertValue(100,"shortLength","in"),y=o.convertValue(1,"shortLength","in"),x=o.convertValue(100,"shortLength","in"),S=o.convertValue(0,"shortLength","in"),N=o.convertValue(500,"shortLength","in"),I=o.convertValue(0,"length","ft");break;case"dp":case"hwdp":V=o.convertValue(1,"shortLength","in"),L=o.convertValue(7,"shortLength","in"),y=o.convertValue(2,"shortLength","in"),x=o.convertValue(8,"shortLength","in"),O=o.convertValue(1,"shortLength","in"),q=o.convertValue(7,"shortLength","in"),E=o.convertValue(2,"shortLength","in"),P=o.convertValue(10,"shortLength","in"),I=o.convertValue(0,"length","ft");break;case"dc":V=o.convertValue(.5,"shortLength","in"),L=o.convertValue(7,"shortLength","in"),y=o.convertValue(2,"shortLength","in"),x=o.convertValue(13,"shortLength","in"),I=o.convertValue(0,"length","ft");break;case"stabilizer":default:V=o.convertValue(0,"shortLength","in"),L=o.convertValue(100,"shortLength","in"),y=o.convertValue(1,"shortLength","in"),x=o.convertValue(100,"shortLength","in"),I=o.convertValue(0,"length","ft");break;case"pdm":y=o.convertValue(2,"shortLength","in"),x=o.convertValue(15,"shortLength","in"),V=o.convertValue(0,"shortLength","in"),L=o.convertValue(12,"shortLength","in"),I=o.convertValue(4,"length","ft"),k=0;break;case"mwd":case"agitator":case"rss":y=o.convertValue(2,"shortLength","in"),x=o.convertValue(13,"shortLength","in"),V=o.convertValue(0,"shortLength","in"),L=o.convertValue(12,"shortLength","in"),I=o.convertValue(1,"length","ft"),D=0;break;case"ur":V=o.convertValue(0,"shortLength","in"),L=o.convertValue(50,"shortLength","in"),y=o.convertValue(1,"shortLength","in"),x=o.convertValue(50,"shortLength","in"),F=o.convertValue(1,"shortLength","in"),j=o.convertValue(50,"shortLength","in");case"bit":}if(isValueEmpty(V)||isValueEmpty(y)||(g(R.inner_diameter,V,L)||(T.inner_diameter="".concat(V.toFixed(1),"~").concat(L.toFixed(1)," (").concat(a,")"),b=!0),g(R.outer_diameter,y,x)||(T.outer_diameter="".concat(y.toFixed(1),"~").concat(x.toFixed(1)," (").concat(a,")"),b=!0),g(R.inner_diameter,V,L)&&g(R.outer_diameter,y,x)&&!g(R.inner_diameter,V,R.outer_diameter)&&(T.outer_diameter="O.D > I.D",b=!0),!T.outer_diameter&&d&&+R.outer_diameter+o.convertValue(.1,"shortLength","in")>d&&(T.outer_diameter=" O.D + 0.1 < Bit Size",b=!0),g(R.linear_weight,0)||(T.linear_weight="Invalid value",b=!0),"dp"!==R.family&&"hwdp"!==R.family&&"dc"!==R.family&&"ct"!==R.family&&"ur"!==R.family||T.inner_diameter||T.outer_diameter||T.linear_weight||c(R.inner_diameter,R.outer_diameter,R.linear_weight)||(T.linear_weight="Invalid range",b=!0)),"ur"===R.family&&(g(R.ur_opened_od,F,j)?R.ur_opened_od<d&&(T.ur_opened_od="Max O.D (Opened) >= Bit Size",b=!0):(T.ur_opened_od="".concat(F.toFixed(1),"~").concat(j.toFixed(1)," (").concat(a,")"),b=!0)),isValueEmpty(O)||isValueEmpty(E)||(g(R.inner_diameter_tooljoint,O,q)||(T.inner_diameter_tooljoint="".concat(O.toFixed(1),"~").concat(q.toFixed(1)," (").concat(a,")"),b=!0),g(R.outer_diameter_tooljoint,E,P)||(T.outer_diameter_tooljoint="".concat(E.toFixed(1),"~").concat(P.toFixed(1)," (").concat(a,")"),b=!0),g(R.outer_diameter_tooljoint,R.outer_diameter,P)||(T.outer_diameter_tooljoint="Tool Joint O.D >= O.D",b=!0)),isValueEmpty(I)||g(R.length,I)||(T.length="Invalid value",b=!0),isValueEmpty(R.length_tooljoint)||isValueEmpty(R.component_length)||+R.length_tooljoint>+R.component_length&&(T.length_tooljoint="Tool Joint Length < Component Length",b=!0),R.off_bottom_pressure_loss&&R.off_bottom_pressure_loss.length>0){T.off_bottom_pressure_loss={};for(var B=0;B<R.off_bottom_pressure_loss.length;B+=1){var U=R.off_bottom_pressure_loss[B];T.off_bottom_pressure_loss[B]={},isValueEmpty(U.flow_rate)&&(T.off_bottom_pressure_loss[B].flow_rate="flow rate is required.",b=!0),isValueEmpty(U.pressure_loss)&&(T.off_bottom_pressure_loss[B].pressure_loss="pressure loss is required.",b=!0),isValueEmpty(k)||g(U.pressure_loss,k,null,{isMinInclusive:!1})||(T.off_bottom_pressure_loss[B].pressure_loss="Invalid range",b=!0)}}if(R.pressure_loss&&R.pressure_loss.length>0){T.pressure_loss={};for(var J=0;J<R.pressure_loss.length;J+=1){var M=R.pressure_loss[J];T.pressure_loss[J]={},isValueEmpty(M.flow_rate)&&(T.pressure_loss[J].flow_rate="flow rate is required.",b=!0),isValueEmpty(M.pressure_loss)&&(T.pressure_loss[J].pressure_loss="pressure loss is required.",b=!0),isValueEmpty(D)||g(M.pressure_loss,D,null,{isMinInclusive:!1})||(T.pressure_loss[J].pressure_loss="Invalid range",b=!0)}}if(R.has_stabilizer&&R.stabilizer){var C=o.convertValue(0,"shortLength","in"),A=o.convertValue(100,"shortLength","in"),W=o.convertValue(1,"shortLength","in"),G=o.convertValue(100,"shortLength","in"),H=o.convertValue(0,"length","ft");g(R.stabilizer.inner_diameter,C,A)&&g(R.stabilizer.outer_diameter,W,G)&&!g(R.stabilizer.inner_diameter,V,R.stabilizer.outer_diameter)&&(T.stabilizer_outer_diameter="O.D > I.D",b=!0),g(R.stabilizer.inner_diameter,C,A)||(T.stabilizer_inner_diameter="".concat(C.toFixed(1),"~").concat(A.toFixed(1)," (").concat(a,")"),b=!0),g(R.stabilizer.outer_diameter,W,G)||(T.stabilizer_outer_diameter="".concat(W.toFixed(1),"~").concat(G.toFixed(1)," (").concat(a,")"),b=!0),isValueEmpty(H)||g(R.stabilizer.length,H)||(T.stabilizer_length="Invalid value",b=!0),isValueEmpty(R.stabilizer.linear_weight)&&(T.stabilizer_linear_weight="Invalid value",b=!0),!T.stabilizer_outer_diameter&&d&&+R.stabilizer.outer_diameter+o.convertValue(.1,"shortLength","in")>d&&(T.stabilizer_outer_diameter=" O.D + 0.1 < Bit Size",b=!0)}if("ct"===R.family&&(g(R.reel_diameter,S,N)||(T.reel_diameter="".concat(S.toFixed(1),"~").concat(N.toFixed(1)," (").concat(a,")"),b=!0)),"bit"===R.family){var K=m(1,"shortLength","in"),Q=K*K*0,X=K*K*20;g(R.tfa,Q,X)||(T.tfa="TFA must be ".concat(Q.toFixed(2),"~").concat(20..toFixed(2)),b=!0)}if("rss"===R.family&&(g(R.flow_loss_percentage,0,10)||(T.flow_loss_percentage="It must be ".concat(0,"~").concat(10),b=!0)),"mwd"===R.family&&(f.length>1?(T.gamma_sensor_to_bit_distance="Only 1 gamma sensor allowed. Currently ".concat(f.length),b=!0):R.has_gamma_sensor&&!Number.isFinite(R.gamma_sensor_to_bit_distance)&&(T.gamma_sensor_to_bit_distance="This field is required.",b=!0),R.has_survey_sensor&&!Number.isFinite(R.bit_to_survey_distance)?(T.bit_to_survey_distance="This field is required.",b=!0):R.has_survey_sensor&&R.bit_to_survey_distance<=0?(T.bit_to_survey_distance="Should be a positive number.",b=!0):R.has_survey_sensor&&R.bit_to_survey_distance>150&&(T.bit_to_survey_distance="Should be less then 150.",b=!0),R.has_directional_sensor&&!Number.isFinite(R.directional_sensor_to_bit_distance)?(T.directional_sensor_to_bit_distance="This field is required.",b=!0):R.has_directional_sensor&&R.directional_sensor_to_bit_distance<=0?(T.directional_sensor_to_bit_distance="Should be a positive number.",b=!0):R.has_directional_sensor&&R.directional_sensor_to_bit_distance>150&&(T.directional_sensor_to_bit_distance="Should be less then 150.",b=!0)),"pdm"===R.family){var Y=void 0,Z=void 0;g(R.number_rotor_lobes,1,10)||(T.number_rotor_lobes="It must be ".concat(1,"~").concat(10),b=!0),g(R.number_stator_lobes,2,10)||(T.number_stator_lobes="It must be ".concat(2,"~").concat(10),b=!0),g(R.rpg,0,10)||(T.rpg="It must be ".concat(0,"~").concat(10),b=!0),Y=o.convertValue(0,"force","klbf"),Z=o.convertValue(200,"force","klbf"),isValueEmpty(R.max_weight_on_bit)||g(R.max_weight_on_bit,Y,Z)||(T.max_weight_on_bit="It must be ".concat(Z.toFixed(2),"~").concat(Z.toFixed(2)),b=!0),Y=o.convertValue(0,"volumeFlowRate","gal/min"),Z=o.convertValue(2500,"volumeFlowRate","gal/min"),g(R.min_standard_flowrate,Y,Z)||(T.min_standard_flowrate="It must be ".concat(Y.toFixed(2),"~").concat(Z.toFixed(2)),b=!0),g(R.max_standard_flowrate,Y,Z)||(T.max_standard_flowrate="It must be ".concat(Y.toFixed(2),"~").concat(Z.toFixed(2)),b=!0),Y=o.convertValue(0,"pressure","psi"),Z=o.convertValue(3e3,"pressure","psi"),g(R.max_operating_differential_pressure,Y,Z)||(T.max_operating_differential_pressure="It must be ".concat(Y.toFixed(2),"~").concat(Z.toFixed(2)),b=!0),Y=o.convertValue(0,"torque","ft-klbf"),Z=o.convertValue(40,"torque","ft-klbf"),g(R.torque_at_max_operating_differential_pressure,Y,Z)||(T.torque_at_max_operating_differential_pressure="It must be ".concat(Y.toFixed(2),"~").concat(Z.toFixed(2)),b=!0),g(R.flow_loss_percentage,0,20)||(T.flow_loss_percentage="It must be ".concat(0,"~").concat(20),b=!0)}u.components[R.id]=T}return 1!==h.length&&(u.general.bit_count='Number of "BIT" components is invalid.',b=!0),1===h.length&&"bit"!==s[s.length-1].family&&"bit"!==s[0].family&&(u.general.bit_position='"BIT" category should be on the bottom of the list.',b=!0),b?u:null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("lodash/set"),r=require("lodash/get"),i=require("moment"),o=require("./convert.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e),a=n(t),l=n(r),_=n(i);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){s.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i.isMinInclusive,n=void 0===o||o,s=parseFloat(e);return!Number.isNaN(s)&&(!(n&&s<t||!n&&s<=t)&&!(r&&s>r))}function c(e,t,r){var i=o.getUnitPreference("shortLength"),n=e,s=t;"in"!==i&&(n=o.convertValue(e,"shortLength",i,"in"),s=o.convertValue(t,"shortLength",i,"in"));var a=2.673*(s*s-n*n),l="in"!==i?o.convertValue(a,"massPerLength","lb-ft"):a;return r>=.5*l&&r<=1.5*l}function d(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return null==e?null:t&&r?parseFloat(o.convertValue(e,t,o.getUnitPreference(t),r,i)):parseFloat(e)}function m(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return 0===e||e?t&&r?o.convertValue(e,t,r,null,i):e:null}exports.convertRecordBackToImperialUnit=function(e){var t=l.default(e,["data","components"]);"bit"===l.default(t,[0,"family"])&&(t=t.reverse().map((function(e,t){return h(h({},e),{},{order:t})})),e=a.default(e,["data","components"],t));var r=e.toJS().data,i=r.start_timestamp_str&&_.default(new Date(r.start_timestamp_str));return i&&i.isValid()&&(r.start_timestamp=i.unix()),delete r.start_timestamp_str,r.start_depth=d(r.start_depth,"length","ft"),r.components=r.components.map((function(e){var t=Object.assign({},e);if(t.inner_diameter=d(t.inner_diameter,"shortLength","in"),t.outer_diameter=d(t.outer_diameter,"shortLength","in",4),t.linear_weight=d(t.linear_weight,"massPerLength","lb-ft"),t.weight=d(t.weight,"mass","lb"),t.length=d(t.length,"length","ft"),t.component_length=d(t.component_length,"length","ft"),t.outer_diameter_tooljoint=d(t.outer_diameter_tooljoint,"shortLength","in"),t.inner_diameter_tooljoint=d(t.inner_diameter_tooljoint,"shortLength","in"),t.length_tooljoint=d(t.length_tooljoint,"length","ft"),"bit"===t.family||"ur"===t.family){var r=d(1,"shortLength","in");if(t.size=d(t.size,"shortLength","in",3),t.nozzle_sizes&&t.nozzle_sizes.length>0)for(var i=0;i<t.nozzle_sizes.length;i+=1){var o=t.nozzle_sizes[i];o.size=1!==r?32*d(o.size,"shortLength","in"):o.size}t.tfa=1!==r?t.tfa*(r*r):t.tfa}if("pdm"===t.family){if(t.max_weight_on_bit=d(t.max_weight_on_bit,"force","klbf"),t.min_standard_flowrate=d(t.min_standard_flowrate,"volumeFlowRate","gal/min"),t.max_standard_flowrate=d(t.max_standard_flowrate,"volumeFlowRate","gal/min"),t.max_operating_differential_pressure=d(t.max_operating_differential_pressure,"pressure","psi"),t.torque_at_max_operating_differential_pressure=d(t.torque_at_max_operating_differential_pressure,"torque","ft-klbf",3),t.rpg=d(t.rpg,"revolutionPerVolume","rpg"),t.off_bottom_pressure_loss&&t.off_bottom_pressure_loss.length>0)for(var n=0;n<t.off_bottom_pressure_loss.length;n+=1){var s=t.off_bottom_pressure_loss[n];s.flow_rate=d(s.flow_rate,"volumeFlowRate","gal/min"),s.pressure_loss=d(s.pressure_loss,"pressure","psi")}t.has_stabilizer||delete t.stabilizer,t.stabilizer&&(t.stabilizer.inner_diameter=t.stabilizer.inner_diameter&&d(t.stabilizer.inner_diameter,"shortLength","in"),t.stabilizer.outer_diameter=t.stabilizer.outer_diameter&&d(t.stabilizer.outer_diameter,"shortLength","in"),t.stabilizer.linear_weight=t.stabilizer.linear_weight&&d(t.stabilizer.linear_weight,"massPerLength","lb-ft"),t.stabilizer.weight=t.stabilizer.weight&&d(t.stabilizer.weight,"mass","lb"),t.stabilizer.length=t.length&&d(t.stabilizer.length,"length","ft"),t.stabilizer.gauge_od=t.stabilizer.gauge_od&&d(t.stabilizer.gauge_od,"shortLength","in"),t.stabilizer.gauge_length=t.stabilizer.gauge_length&&d(t.stabilizer.gauge_length,"shortLength","in"),t.stabilizer.blade_width=t.stabilizer.blade_width&&d(t.stabilizer.blade_width,"shortLength","in"),t.stabilizer.stab_centerpoint_to_bit=t.stabilizer.stab_centerpoint_to_bit&&d(t.stabilizer.stab_centerpoint_to_bit,"length","ft"))}if("stabilizer"!==t.family&&"ags"!==t.family||(t.gauge_od=d(t.gauge_od,"shortLength","in"),t.gauge_length=d(t.gauge_length,"shortLength","in"),t.blade_width=d(t.blade_width,"shortLength","in")),("mwd"===t.family||"rss"===t.family||"agitator"===t.family)&&t.pressure_loss&&t.pressure_loss.length>0)for(var a=0;a<t.pressure_loss.length;a+=1){var l=t.pressure_loss[a];l.flow_rate=d(l.flow_rate,"volumeFlowRate","gal/min"),l.pressure_loss=d(l.pressure_loss,"pressure","psi")}return"bit"!==t.family&&delete t.bit_type,!t.has_gamma_sensor&&Number.isFinite(t.gamma_sensor_to_bit_distance)&&delete t.gamma_sensor_to_bit_distance,!t.has_survey_sensor&&Number.isFinite(t.bit_to_survey_distance)&&delete t.bit_to_survey_distance,!t.has_directional_sensor&&Number.isFinite(t.directional_sensor_to_bit_distance)&&delete t.directional_sensor_to_bit_distance,delete t.c_length,t})),h(h({},e),{},{data:r})},exports.convertRecordtoPrefUnit=function(e){var t=e.toJS().data,r=t.components;if(t.start_depth=m(t.start_depth,"length","ft"),r.length>0)if("bit"===r[0].family){r[0].c_length=r[0].length||0;for(var i=1;i<r.length;i+=1)r[i].c_length=parseFloat(r[i-1].c_length)+parseFloat(r[i].length||0)}else{var o=r.length-1;r[o].c_length=r[o].length||0;for(var n=o-1;n>=0;n-=1)r[n].c_length=parseFloat(r[n+1].c_length)+parseFloat(r[n].length||0)}for(var s=0;s<r.length;s+=1){var a=r[s];if(a.inner_diameter=m(a.inner_diameter,"shortLength","in"),a.outer_diameter=m(a.outer_diameter,"shortLength","in",4),a.linear_weight=m(a.linear_weight,"massPerLength","lb-ft"),a.weight=m(a.weight,"mass","lb"),a.length=m(a.length,"length","ft"),a.component_length=m(a.component_length,"length","ft"),a.outer_diameter_tooljoint=m(a.outer_diameter_tooljoint,"shortLength","in"),a.inner_diameter_tooljoint=m(a.inner_diameter_tooljoint,"shortLength","in"),a.length_tooljoint=m(a.length_tooljoint,"length","ft"),a.c_length=m(a.c_length,"length","ft"),a.gamma_sensor_to_bit_distance=m(a.gamma_sensor_to_bit_distance,"length","ft"),"bit"===a.family||"ur"===a.family){var l=m(1,"shortLength","in");if(a.size=m(a.size,"shortLength","in"),a.nozzle_sizes&&a.nozzle_sizes.length>0)for(var _=0;_<a.nozzle_sizes.length;_+=1){var u=a.nozzle_sizes[_];u.size=1!==l?m(u.size,"shortLength","in")/32:u.size}a.tfa=1!==l?a.tfa*(l*l):a.tfa}if("pdm"===a.family){if(a.max_weight_on_bit=m(a.max_weight_on_bit,"force","klbf"),a.min_standard_flowrate=m(a.min_standard_flowrate,"volumeFlowRate","gal/min"),a.max_standard_flowrate=m(a.max_standard_flowrate,"volumeFlowRate","gal/min"),a.max_operating_differential_pressure=m(a.max_operating_differential_pressure,"pressure","psi"),a.torque_at_max_operating_differential_pressure=m(a.torque_at_max_operating_differential_pressure,"torque","ft-klbf",3),a.off_bottom_pressure_loss&&a.off_bottom_pressure_loss.length>0)for(var g=0;g<a.off_bottom_pressure_loss.length;g+=1){var c=a.off_bottom_pressure_loss[g];c.flow_rate=m(c.flow_rate,"volumeFlowRate","gal/min"),c.pressure_loss=m(c.pressure_loss,"pressure","psi")}a.rpg=m(a.rpg,"revolutionPerVolume","rpg"),a.has_stabilizer&&a.stabilizer&&(a.stabilizer.inner_diameter=m(a.stabilizer.inner_diameter,"shortLength","in"),a.stabilizer.outer_diameter=m(a.stabilizer.outer_diameter,"shortLength","in"),a.stabilizer.linear_weight=m(a.stabilizer.linear_weight,"massPerLength","lb-ft"),a.stabilizer.weight=m(a.stabilizer.weight,"mass","lb"),a.stabilizer.length=m(a.stabilizer.length,"length","ft"),a.stabilizer.gauge_od=m(a.stabilizer.gauge_od,"shortLength","in"),a.stabilizer.gauge_length=m(a.stabilizer.gauge_length,"shortLength","in"),a.stabilizer.blade_width=m(a.stabilizer.blade_width,"shortLength","in"),a.stabilizer.stab_centerpoint_to_bit=m(a.stabilizer.stab_centerpoint_to_bit,"length","ft"))}if("stabilizer"!==a.family&&"ags"!==a.family||(a.gauge_od=m(a.gauge_od,"shortLength","in"),a.gauge_length=m(a.gauge_length,"shortLength","in"),a.blade_width=m(a.blade_width,"shortLength","in")),("mwd"===a.family||"rss"===a.family||"agitator"===a.family)&&a.pressure_loss&&a.pressure_loss.length>0)for(var d=0;d<a.pressure_loss.length;d+=1){var f=a.pressure_loss[d];f.flow_rate=m(f.flow_rate,"volumeFlowRate","gal/min"),f.pressure_loss=m(f.pressure_loss,"pressure","psi")}}return h(h({},e),{},{data:t})},exports.ctoi=d,exports.ctop=m,exports.isValidLinearWeight=c,exports.isValidNumber=g,exports.sValueEmpty=function(e){return null==e||""===e},exports.validate=function(e){var t=e.toJS().data,r=t.id,i=t.start_timestamp_str,n=t.start_depth,s=t.components,a=o.getUnitDisplay("shortLength"),l=o.getUnitDisplay("length"),u={general:{},components:{},specificErrors:{}},h=s.filter((function(e){return"bit"===e.family})),d=h.length>0?h[0].size:null,f=s.filter((function(e){return"mwd"===e.family&&e.has_gamma_sensor})),b=!1;if(isValueEmpty(r)&&(u.id="It should not be empty.",b=!0),i&&!_.default(new Date(i)).isValid()&&(b=!0,u.start_timestamp="Invalid Date."),Number.isFinite(n)){var p=o.convertValue(0,"length","ft"),v=o.convertValue(55e3,"length","ft"),z=o.convertValue(1,"length","ft");(n<=p||n>v)&&(b=!0,u.start_depth="Should be a positive number ".concat(p.toFixed(2),"~").concat(v.toFixed(2)," (").concat(l,")")),n===z&&(b=!0,u.start_depth="Should not be equal to ".concat(z," (").concat(l,")"))}else b=!0,u.start_depth="It should not be empty.";for(var w=0;w<s.length;w+=1){var V=void 0,y=void 0,L=void 0,x=void 0,F=void 0,j=void 0,I=void 0,O=void 0,q=void 0,E=void 0,P=void 0,D=void 0,k=void 0,S=void 0,N=void 0,R=s[w],T={};switch(R.family){case"ct":V=o.convertValue(0,"shortLength","in"),L=o.convertValue(100,"shortLength","in"),y=o.convertValue(1,"shortLength","in"),x=o.convertValue(100,"shortLength","in"),S=o.convertValue(0,"shortLength","in"),N=o.convertValue(500,"shortLength","in"),I=o.convertValue(0,"length","ft");break;case"dp":case"hwdp":V=o.convertValue(1,"shortLength","in"),L=o.convertValue(7,"shortLength","in"),y=o.convertValue(2,"shortLength","in"),x=o.convertValue(8,"shortLength","in"),O=o.convertValue(1,"shortLength","in"),q=o.convertValue(7,"shortLength","in"),E=o.convertValue(2,"shortLength","in"),P=o.convertValue(10,"shortLength","in"),I=o.convertValue(0,"length","ft");break;case"dc":V=o.convertValue(.5,"shortLength","in"),L=o.convertValue(7,"shortLength","in"),y=o.convertValue(2,"shortLength","in"),x=o.convertValue(13,"shortLength","in"),I=o.convertValue(0,"length","ft");break;case"stabilizer":case"ags":default:V=o.convertValue(0,"shortLength","in"),L=o.convertValue(100,"shortLength","in"),y=o.convertValue(1,"shortLength","in"),x=o.convertValue(100,"shortLength","in"),I=o.convertValue(0,"length","ft");break;case"pdm":y=o.convertValue(2,"shortLength","in"),x=o.convertValue(15,"shortLength","in"),V=o.convertValue(0,"shortLength","in"),L=o.convertValue(12,"shortLength","in"),I=o.convertValue(4,"length","ft"),k=0;break;case"mwd":case"agitator":case"rss":y=o.convertValue(2,"shortLength","in"),x=o.convertValue(13,"shortLength","in"),V=o.convertValue(0,"shortLength","in"),L=o.convertValue(12,"shortLength","in"),I=o.convertValue(1,"length","ft"),D=0;break;case"ur":V=o.convertValue(0,"shortLength","in"),L=o.convertValue(50,"shortLength","in"),y=o.convertValue(1,"shortLength","in"),x=o.convertValue(50,"shortLength","in"),F=o.convertValue(1,"shortLength","in"),j=o.convertValue(50,"shortLength","in");case"bit":}if(isValueEmpty(V)||isValueEmpty(y)||(g(R.inner_diameter,V,L)||(T.inner_diameter="".concat(V.toFixed(1),"~").concat(L.toFixed(1)," (").concat(a,")"),b=!0),g(R.outer_diameter,y,x)||(T.outer_diameter="".concat(y.toFixed(1),"~").concat(x.toFixed(1)," (").concat(a,")"),b=!0),g(R.inner_diameter,V,L)&&g(R.outer_diameter,y,x)&&!g(R.inner_diameter,V,R.outer_diameter)&&(T.outer_diameter="O.D > I.D",b=!0),!T.outer_diameter&&d&&+R.outer_diameter+o.convertValue(.1,"shortLength","in")>d&&(T.outer_diameter=" O.D + 0.1 < Bit Size",b=!0),g(R.linear_weight,0)||(T.linear_weight="Invalid value",b=!0),"dp"!==R.family&&"hwdp"!==R.family&&"dc"!==R.family&&"ct"!==R.family&&"ur"!==R.family||T.inner_diameter||T.outer_diameter||T.linear_weight||c(R.inner_diameter,R.outer_diameter,R.linear_weight)||(T.linear_weight="Invalid range",b=!0)),"ur"===R.family&&(g(R.ur_opened_od,F,j)?R.ur_opened_od<d&&(T.ur_opened_od="Max O.D (Opened) >= Bit Size",b=!0):(T.ur_opened_od="".concat(F.toFixed(1),"~").concat(j.toFixed(1)," (").concat(a,")"),b=!0)),isValueEmpty(O)||isValueEmpty(E)||(g(R.inner_diameter_tooljoint,O,q)||(T.inner_diameter_tooljoint="".concat(O.toFixed(1),"~").concat(q.toFixed(1)," (").concat(a,")"),b=!0),g(R.outer_diameter_tooljoint,E,P)||(T.outer_diameter_tooljoint="".concat(E.toFixed(1),"~").concat(P.toFixed(1)," (").concat(a,")"),b=!0),g(R.outer_diameter_tooljoint,R.outer_diameter,P)||(T.outer_diameter_tooljoint="Tool Joint O.D >= O.D",b=!0)),isValueEmpty(I)||g(R.length,I)||(T.length="Invalid value",b=!0),isValueEmpty(R.length_tooljoint)||isValueEmpty(R.component_length)||+R.length_tooljoint>+R.component_length&&(T.length_tooljoint="Tool Joint Length < Component Length",b=!0),R.off_bottom_pressure_loss&&R.off_bottom_pressure_loss.length>0){T.off_bottom_pressure_loss={};for(var B=0;B<R.off_bottom_pressure_loss.length;B+=1){var U=R.off_bottom_pressure_loss[B];T.off_bottom_pressure_loss[B]={},isValueEmpty(U.flow_rate)&&(T.off_bottom_pressure_loss[B].flow_rate="flow rate is required.",b=!0),isValueEmpty(U.pressure_loss)&&(T.off_bottom_pressure_loss[B].pressure_loss="pressure loss is required.",b=!0),isValueEmpty(k)||g(U.pressure_loss,k,null,{isMinInclusive:!1})||(T.off_bottom_pressure_loss[B].pressure_loss="Invalid range",b=!0)}}if(R.pressure_loss&&R.pressure_loss.length>0){T.pressure_loss={};for(var J=0;J<R.pressure_loss.length;J+=1){var M=R.pressure_loss[J];T.pressure_loss[J]={},isValueEmpty(M.flow_rate)&&(T.pressure_loss[J].flow_rate="flow rate is required.",b=!0),isValueEmpty(M.pressure_loss)&&(T.pressure_loss[J].pressure_loss="pressure loss is required.",b=!0),isValueEmpty(D)||g(M.pressure_loss,D,null,{isMinInclusive:!1})||(T.pressure_loss[J].pressure_loss="Invalid range",b=!0)}}if(R.has_stabilizer&&R.stabilizer){var C=o.convertValue(0,"shortLength","in"),A=o.convertValue(100,"shortLength","in"),W=o.convertValue(1,"shortLength","in"),G=o.convertValue(100,"shortLength","in"),H=o.convertValue(0,"length","ft");g(R.stabilizer.inner_diameter,C,A)&&g(R.stabilizer.outer_diameter,W,G)&&!g(R.stabilizer.inner_diameter,V,R.stabilizer.outer_diameter)&&(T.stabilizer_outer_diameter="O.D > I.D",b=!0),g(R.stabilizer.inner_diameter,C,A)||(T.stabilizer_inner_diameter="".concat(C.toFixed(1),"~").concat(A.toFixed(1)," (").concat(a,")"),b=!0),g(R.stabilizer.outer_diameter,W,G)||(T.stabilizer_outer_diameter="".concat(W.toFixed(1),"~").concat(G.toFixed(1)," (").concat(a,")"),b=!0),isValueEmpty(H)||g(R.stabilizer.length,H)||(T.stabilizer_length="Invalid value",b=!0),isValueEmpty(R.stabilizer.linear_weight)&&(T.stabilizer_linear_weight="Invalid value",b=!0),!T.stabilizer_outer_diameter&&d&&+R.stabilizer.outer_diameter+o.convertValue(.1,"shortLength","in")>d&&(T.stabilizer_outer_diameter=" O.D + 0.1 < Bit Size",b=!0)}if("ct"===R.family&&(g(R.reel_diameter,S,N)||(T.reel_diameter="".concat(S.toFixed(1),"~").concat(N.toFixed(1)," (").concat(a,")"),b=!0)),"bit"===R.family){var K=m(1,"shortLength","in"),Q=K*K*0,X=K*K*20;g(R.tfa,Q,X)||(T.tfa="TFA must be ".concat(Q.toFixed(2),"~").concat(20..toFixed(2)),b=!0)}if("rss"===R.family&&(g(R.flow_loss_percentage,0,10)||(T.flow_loss_percentage="It must be ".concat(0,"~").concat(10),b=!0)),"mwd"===R.family&&(f.length>1?(T.gamma_sensor_to_bit_distance="Only 1 gamma sensor allowed. Currently ".concat(f.length),b=!0):R.has_gamma_sensor&&!Number.isFinite(R.gamma_sensor_to_bit_distance)&&(T.gamma_sensor_to_bit_distance="This field is required.",b=!0),R.has_survey_sensor&&!Number.isFinite(R.bit_to_survey_distance)?(T.bit_to_survey_distance="This field is required.",b=!0):R.has_survey_sensor&&R.bit_to_survey_distance<=0?(T.bit_to_survey_distance="Should be a positive number.",b=!0):R.has_survey_sensor&&R.bit_to_survey_distance>150&&(T.bit_to_survey_distance="Should be less then 150.",b=!0),R.has_directional_sensor&&!Number.isFinite(R.directional_sensor_to_bit_distance)?(T.directional_sensor_to_bit_distance="This field is required.",b=!0):R.has_directional_sensor&&R.directional_sensor_to_bit_distance<=0?(T.directional_sensor_to_bit_distance="Should be a positive number.",b=!0):R.has_directional_sensor&&R.directional_sensor_to_bit_distance>150&&(T.directional_sensor_to_bit_distance="Should be less then 150.",b=!0)),"pdm"===R.family){var Y=void 0,Z=void 0;g(R.number_rotor_lobes,1,10)||(T.number_rotor_lobes="It must be ".concat(1,"~").concat(10),b=!0),g(R.number_stator_lobes,2,10)||(T.number_stator_lobes="It must be ".concat(2,"~").concat(10),b=!0),g(R.rpg,0,10)||(T.rpg="It must be ".concat(0,"~").concat(10),b=!0),Y=o.convertValue(0,"force","klbf"),Z=o.convertValue(200,"force","klbf"),isValueEmpty(R.max_weight_on_bit)||g(R.max_weight_on_bit,Y,Z)||(T.max_weight_on_bit="It must be ".concat(Z.toFixed(2),"~").concat(Z.toFixed(2)),b=!0),Y=o.convertValue(0,"volumeFlowRate","gal/min"),Z=o.convertValue(2500,"volumeFlowRate","gal/min"),g(R.min_standard_flowrate,Y,Z)||(T.min_standard_flowrate="It must be ".concat(Y.toFixed(2),"~").concat(Z.toFixed(2)),b=!0),g(R.max_standard_flowrate,Y,Z)||(T.max_standard_flowrate="It must be ".concat(Y.toFixed(2),"~").concat(Z.toFixed(2)),b=!0),Y=o.convertValue(0,"pressure","psi"),Z=o.convertValue(3e3,"pressure","psi"),g(R.max_operating_differential_pressure,Y,Z)||(T.max_operating_differential_pressure="It must be ".concat(Y.toFixed(2),"~").concat(Z.toFixed(2)),b=!0),Y=o.convertValue(0,"torque","ft-klbf"),Z=o.convertValue(40,"torque","ft-klbf"),g(R.torque_at_max_operating_differential_pressure,Y,Z)||(T.torque_at_max_operating_differential_pressure="It must be ".concat(Y.toFixed(2),"~").concat(Z.toFixed(2)),b=!0),g(R.flow_loss_percentage,0,20)||(T.flow_loss_percentage="It must be ".concat(0,"~").concat(20),b=!0)}u.components[R.id]=T}return 1!==h.length&&(u.general.bit_count='Number of "BIT" components is invalid.',b=!0),1===h.length&&"bit"!==s[s.length-1].family&&"bit"!==s[0].family&&(u.general.bit_position='"BIT" category should be on the bottom of the list.',b=!0),b?u:null};
2
2
  //# sourceMappingURL=DrillstringUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DrillstringUtils.js","sources":["../../../src/utils/DrillstringUtils.js"],"sourcesContent":["/************ deprecated DO NOT USE IT ************************/\n/************ new version in drillstring folder */\n/* eslint-disable camelcase */\nimport set from 'lodash/set';\nimport get from 'lodash/get';\nimport moment from 'moment';\n\nimport { getUnitPreference, convertValue, getUnitDisplay } from './convert';\n\nconst ALLOWED_DIFF_OD_BIT_SIZE = 0.1;\n\nconst DEF_MIN_ID = 0;\nconst DEF_MAX_ID = 100;\nconst DEF_MIN_OD = 1;\nconst DEF_MAX_OD = 100;\nconst DEF_MIN_LENGTH = 0;\n\nconst UR_MIN_ID = 0;\nconst UR_MAX_ID = 50;\nconst UR_MIN_BODY_OD = 1;\nconst UR_MAX_BODY_OD = 50;\nconst UR_MIN_OPENED_OD = 1;\nconst UR_MAX_OPENED_OD = 50;\n\nconst CT_MIN_ID = 0;\nconst CT_MAX_ID = 100;\nconst CT_MIN_OD = 1;\nconst CT_MAX_OD = 100;\nconst CT_MIN_RD = 0;\nconst CT_MAX_RD = 500;\nconst CT_MIN_LENGTH = 0;\n\nconst DP_MIN_ID = 1;\nconst DP_MAX_ID = 7;\nconst DP_MIN_OD = 2;\nconst DP_MAX_OD = 8;\nconst DP_MIN_TJ_ID = 1;\nconst DP_MAX_TJ_ID = 7;\nconst DP_MIN_TJ_OD = 2;\nconst DP_MAX_TJ_OD = 10;\nconst DP_MIN_LENGTH = 0;\n\nconst HWDP_MIN_ID = 1;\nconst HWDP_MAX_ID = 7;\nconst HWDP_MIN_OD = 2;\nconst HWDP_MAX_OD = 8;\nconst HWDP_MIN_TJ_ID = 1;\nconst HWDP_MAX_TJ_ID = 7;\nconst HWDP_MIN_TJ_OD = 2;\nconst HWDP_MAX_TJ_OD = 10;\nconst HWDP_MIN_LENGTH = 0;\n\nconst DC_MIN_ID = 0.5;\nconst DC_MAX_ID = 7;\nconst DC_MIN_OD = 2;\nconst DC_MAX_OD = 13;\nconst DC_MIN_LENGTH = 0;\n\nconst STABLE_MIN_ID = 0;\nconst STABLE_MAX_ID = 100;\nconst STABLE_MIN_OD = 1;\nconst STABLE_MAX_OD = 100;\nconst STABLE_MIN_LENGTH = 0;\n\nconst PDM_MIN_OD = 2;\nconst PDM_MAX_OD = 15;\nconst PDM_MIN_ID = 0;\nconst PDM_MAX_ID = 12;\nconst PDM_MIN_LENGTH = 4;\n\nconst PDM_MIN_STATOR = 2;\nconst PDM_MAX_STATOR = 10;\nconst PDM_MIN_ROTOR = 1;\nconst PDM_MAX_ROTOR = 10;\nconst PDM_MIN_RPG = 0;\nconst PDM_MAX_RPG = 10;\nconst PDM_MIN_WOB = 0;\nconst PDM_MAX_WOB = 200;\nconst PDM_MIN_FLOW_RANGE = 0;\nconst PDM_MAX_FLOW_RANGE = 2500;\nconst PDM_MIN_MODP = 0;\nconst PDM_MAX_MODP = 3000;\nconst PDM_MIN_TMODP = 0;\nconst PDM_MAX_TMODP = 40;\nconst PDM_MIN_FLOW_LOSS = 0;\nconst PDM_MAX_FLOW_LOSS = 20;\nconst PDM_MIN_OFF_BOTTOM_PRESSURE_LOSS = 0;\n\nconst MWD_MIN_ID = 0;\nconst MWD_MAX_ID = 12;\nconst MWD_MIN_OD = 2;\nconst MWD_MAX_OD = 13;\nconst MWD_MIN_LENGTH = 1.0;\nconst MWD_MIN_PRESSURE_LOSS = 0;\n\nconst RSS_MIN_ID = 0;\nconst RSS_MAX_ID = 12;\nconst RSS_MIN_OD = 2;\nconst RSS_MAX_OD = 13;\nconst RSS_MIN_LENGTH = 1.0;\nconst RSS_MIN_FLOW_LOSS = 0;\nconst RSS_MAX_FLOW_LOSS = 10;\nconst RSS_MIN_PRESSURE_LOSS = 0;\n\nconst AGITATOR_MIN_ID = 0;\nconst AGITATOR_MAX_ID = 12;\nconst AGITATOR_MIN_OD = 2;\nconst AGITATOR_MAX_OD = 13;\nconst AGITATOR_MIN_LENGTH = 1.0;\nconst AGITATOR_MIN_PRESSURE_LOSS = 0;\n\nconst BIT_MIN_TFA = 0;\nconst BIT_MAX_TFA = 20;\n\nconst DEPTH_IN_HOLE_MIN = 0;\nconst DEPTH_IN_HOLE_MAX = 55000;\nconst DEPTH_IN_HOLE_PROHIBITED = 1;\n\nexport function sValueEmpty(val) {\n return val === null || typeof val === 'undefined' || val === '';\n}\n\nexport function isValidNumber(num, min, max, { isMinInclusive = true } = {}) {\n const parsedNum = parseFloat(num);\n if (Number.isNaN(parsedNum)) {\n return false;\n }\n if ((isMinInclusive && parsedNum < min) || (!isMinInclusive && parsedNum <= min)) {\n return false;\n }\n\n if (max && parsedNum > max) {\n return false;\n }\n\n return true;\n}\n\nexport function isValidLinearWeight(id, od, linearWeight) {\n const prefShortLengthUnit = getUnitPreference('shortLength');\n let convertedId = id;\n let convertedOd = od;\n if (prefShortLengthUnit !== 'in') {\n convertedId = convertValue(id, 'shortLength', prefShortLengthUnit, 'in');\n convertedOd = convertValue(od, 'shortLength', prefShortLengthUnit, 'in');\n }\n\n const estimation = 2.673 * (convertedOd * convertedOd - convertedId * convertedId);\n\n const convertedEstimation =\n prefShortLengthUnit !== 'in' ? convertValue(estimation, 'massPerLength', 'lb-ft') : estimation;\n\n return linearWeight >= convertedEstimation * 0.5 && linearWeight <= convertedEstimation * 1.5;\n}\n\nexport function validate(recordData) {\n const {\n data: { id, start_timestamp_str, start_depth, components },\n } = recordData.toJS();\n const shortLengthUnitDisplay = getUnitDisplay('shortLength');\n const lengthUnitDisplay = getUnitDisplay('length');\n const errors = {\n general: {},\n components: {},\n specificErrors: {},\n };\n const bitComponents = components.filter(comp => comp.family === 'bit');\n const bitSize = bitComponents.length > 0 ? bitComponents[0].size : null;\n const mwdHavingGamma = components.filter(comp => comp.family === 'mwd' && comp.has_gamma_sensor);\n let hasFormErrors = false;\n\n if (isValueEmpty(id)) {\n errors.id = 'It should not be empty.';\n hasFormErrors = true;\n }\n\n if (start_timestamp_str && !moment(new Date(start_timestamp_str)).isValid()) {\n hasFormErrors = true;\n errors.start_timestamp = 'Invalid Date.';\n }\n\n if (Number.isFinite(start_depth)) {\n const minDepth = convertValue(DEPTH_IN_HOLE_MIN, 'length', 'ft');\n const maxDepth = convertValue(DEPTH_IN_HOLE_MAX, 'length', 'ft');\n const prohibitedDepth = convertValue(DEPTH_IN_HOLE_PROHIBITED, 'length', 'ft');\n if (start_depth <= minDepth || start_depth > maxDepth) {\n hasFormErrors = true;\n errors.start_depth = `Should be a positive number ${minDepth.toFixed(2)}~${maxDepth.toFixed(\n 2\n )} (${lengthUnitDisplay})`;\n }\n if (start_depth === prohibitedDepth) {\n hasFormErrors = true;\n errors.start_depth = `Should not be equal to ${prohibitedDepth} (${lengthUnitDisplay})`;\n }\n } else {\n hasFormErrors = true;\n errors.start_depth = 'It should not be empty.';\n }\n\n for (let i = 0; i < components.length; i += 1) {\n let min_id;\n let min_od;\n let max_id;\n let max_od;\n let min_opened_od;\n let max_opened_od;\n let min_length;\n let min_tj_id;\n let max_tj_id;\n let min_tj_od;\n let max_tj_od;\n let min_pressure_loss;\n let min_off_bottom_pressure_loss;\n let min_rd;\n let max_rd;\n\n const comp = components[i];\n const error = {};\n switch (comp.family) {\n case 'ct':\n min_id = convertValue(CT_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(CT_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(CT_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(CT_MAX_OD, 'shortLength', 'in');\n min_rd = convertValue(CT_MIN_RD, 'shortLength', 'in');\n max_rd = convertValue(CT_MAX_RD, 'shortLength', 'in');\n min_length = convertValue(CT_MIN_LENGTH, 'length', 'ft');\n break;\n\n case 'dp':\n min_id = convertValue(DP_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(DP_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(DP_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(DP_MAX_OD, 'shortLength', 'in');\n min_tj_id = convertValue(DP_MIN_TJ_ID, 'shortLength', 'in');\n max_tj_id = convertValue(DP_MAX_TJ_ID, 'shortLength', 'in');\n min_tj_od = convertValue(DP_MIN_TJ_OD, 'shortLength', 'in');\n max_tj_od = convertValue(DP_MAX_TJ_OD, 'shortLength', 'in');\n min_length = convertValue(DP_MIN_LENGTH, 'length', 'ft');\n break;\n\n case 'hwdp':\n min_id = convertValue(HWDP_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(HWDP_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(HWDP_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(HWDP_MAX_OD, 'shortLength', 'in');\n min_tj_id = convertValue(HWDP_MIN_TJ_ID, 'shortLength', 'in');\n max_tj_id = convertValue(HWDP_MAX_TJ_ID, 'shortLength', 'in');\n min_tj_od = convertValue(HWDP_MIN_TJ_OD, 'shortLength', 'in');\n max_tj_od = convertValue(HWDP_MAX_TJ_OD, 'shortLength', 'in');\n min_length = convertValue(HWDP_MIN_LENGTH, 'length', 'ft');\n break;\n\n case 'dc':\n min_id = convertValue(DC_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(DC_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(DC_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(DC_MAX_OD, 'shortLength', 'in');\n min_length = convertValue(DC_MIN_LENGTH, 'length', 'ft');\n break;\n\n case 'stabilizer':\n min_id = convertValue(STABLE_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(STABLE_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(STABLE_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(STABLE_MAX_OD, 'shortLength', 'in');\n min_length = convertValue(STABLE_MIN_LENGTH, 'length', 'ft');\n break;\n\n case 'pdm':\n min_od = convertValue(PDM_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(PDM_MAX_OD, 'shortLength', 'in');\n min_id = convertValue(PDM_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(PDM_MAX_ID, 'shortLength', 'in');\n min_length = convertValue(PDM_MIN_LENGTH, 'length', 'ft');\n min_off_bottom_pressure_loss = PDM_MIN_OFF_BOTTOM_PRESSURE_LOSS;\n break;\n\n case 'mwd':\n min_od = convertValue(MWD_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(MWD_MAX_OD, 'shortLength', 'in');\n min_id = convertValue(MWD_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(MWD_MAX_ID, 'shortLength', 'in');\n min_length = convertValue(MWD_MIN_LENGTH, 'length', 'ft');\n min_pressure_loss = MWD_MIN_PRESSURE_LOSS;\n break;\n\n case 'agitator':\n min_od = convertValue(AGITATOR_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(AGITATOR_MAX_OD, 'shortLength', 'in');\n min_id = convertValue(AGITATOR_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(AGITATOR_MAX_ID, 'shortLength', 'in');\n min_length = convertValue(AGITATOR_MIN_LENGTH, 'length', 'ft');\n min_pressure_loss = AGITATOR_MIN_PRESSURE_LOSS;\n break;\n\n case 'rss':\n min_od = convertValue(RSS_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(RSS_MAX_OD, 'shortLength', 'in');\n min_id = convertValue(RSS_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(RSS_MAX_ID, 'shortLength', 'in');\n min_length = convertValue(RSS_MIN_LENGTH, 'length', 'ft');\n min_pressure_loss = RSS_MIN_PRESSURE_LOSS;\n break;\n\n case 'ur':\n min_id = convertValue(UR_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(UR_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(UR_MIN_BODY_OD, 'shortLength', 'in');\n max_od = convertValue(UR_MAX_BODY_OD, 'shortLength', 'in');\n min_opened_od = convertValue(UR_MIN_OPENED_OD, 'shortLength', 'in');\n max_opened_od = convertValue(UR_MAX_OPENED_OD, 'shortLength', 'in');\n break;\n\n case 'bit':\n break;\n\n default:\n min_id = convertValue(DEF_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(DEF_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(DEF_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(DEF_MAX_OD, 'shortLength', 'in');\n min_length = convertValue(DEF_MIN_LENGTH, 'length', 'ft');\n break;\n }\n\n if (!isValueEmpty(min_id) && !isValueEmpty(min_od)) {\n if (!isValidNumber(comp.inner_diameter, min_id, max_id)) {\n error.inner_diameter = `${min_id.toFixed(1)}~${max_id.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.outer_diameter, min_od, max_od)) {\n error.outer_diameter = `${min_od.toFixed(1)}~${max_od.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n\n if (\n isValidNumber(comp.inner_diameter, min_id, max_id) &&\n isValidNumber(comp.outer_diameter, min_od, max_od) &&\n !isValidNumber(comp.inner_diameter, min_id, comp.outer_diameter)\n ) {\n error.outer_diameter = 'O.D > I.D';\n hasFormErrors = true;\n }\n\n if (!error.outer_diameter && bitSize) {\n if (\n +comp.outer_diameter + convertValue(ALLOWED_DIFF_OD_BIT_SIZE, 'shortLength', 'in') >\n bitSize\n ) {\n error.outer_diameter = ' O.D + 0.1 < Bit Size';\n hasFormErrors = true;\n }\n }\n\n // only check validity of linear weight when family is not bit\n if (!isValidNumber(comp.linear_weight, 0)) {\n error.linear_weight = 'Invalid value';\n hasFormErrors = true;\n }\n\n if (\n comp.family === 'dp' ||\n comp.family === 'hwdp' ||\n comp.family === 'dc' ||\n comp.family === 'ct' ||\n comp.family === 'ur'\n ) {\n if (!error.inner_diameter && !error.outer_diameter && !error.linear_weight) {\n if (!isValidLinearWeight(comp.inner_diameter, comp.outer_diameter, comp.linear_weight)) {\n error.linear_weight = 'Invalid range';\n hasFormErrors = true;\n }\n }\n }\n }\n if (comp.family === 'ur') {\n if (!isValidNumber(comp.ur_opened_od, min_opened_od, max_opened_od)) {\n error.ur_opened_od = `${min_opened_od.toFixed(1)}~${max_opened_od.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n } else if (comp.ur_opened_od < bitSize) {\n error.ur_opened_od = 'Max O.D (Opened) >= Bit Size';\n hasFormErrors = true;\n }\n }\n\n if (!isValueEmpty(min_tj_id) && !isValueEmpty(min_tj_od)) {\n if (!isValidNumber(comp.inner_diameter_tooljoint, min_tj_id, max_tj_id)) {\n error.inner_diameter_tooljoint = `${min_tj_id.toFixed(1)}~${max_tj_id.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.outer_diameter_tooljoint, min_tj_od, max_tj_od)) {\n error.outer_diameter_tooljoint = `${min_tj_od.toFixed(1)}~${max_tj_od.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.outer_diameter_tooljoint, comp.outer_diameter, max_tj_od)) {\n error.outer_diameter_tooljoint = 'Tool Joint O.D >= O.D';\n hasFormErrors = true;\n }\n }\n\n if (!isValueEmpty(min_length)) {\n if (!isValidNumber(comp.length, min_length)) {\n error.length = 'Invalid value';\n hasFormErrors = true;\n }\n }\n\n if (!isValueEmpty(comp.length_tooljoint) && !isValueEmpty(comp.component_length)) {\n if (+comp.length_tooljoint > +comp.component_length) {\n error.length_tooljoint = 'Tool Joint Length < Component Length';\n hasFormErrors = true;\n }\n }\n\n if (comp.off_bottom_pressure_loss && comp.off_bottom_pressure_loss.length > 0) {\n error.off_bottom_pressure_loss = {};\n for (let j = 0; j < comp.off_bottom_pressure_loss.length; j += 1) {\n const obpsItem = comp.off_bottom_pressure_loss[j];\n error.off_bottom_pressure_loss[j] = {};\n if (isValueEmpty(obpsItem.flow_rate)) {\n error.off_bottom_pressure_loss[j].flow_rate = 'flow rate is required.';\n hasFormErrors = true;\n }\n if (isValueEmpty(obpsItem.pressure_loss)) {\n error.off_bottom_pressure_loss[j].pressure_loss = 'pressure loss is required.';\n hasFormErrors = true;\n }\n if (\n !isValueEmpty(min_off_bottom_pressure_loss) &&\n !isValidNumber(obpsItem.pressure_loss, min_off_bottom_pressure_loss, null, {\n isMinInclusive: false,\n })\n ) {\n error.off_bottom_pressure_loss[j].pressure_loss = 'Invalid range';\n hasFormErrors = true;\n }\n }\n }\n\n if (comp.pressure_loss && comp.pressure_loss.length > 0) {\n error.pressure_loss = {};\n for (let j = 0; j < comp.pressure_loss.length; j += 1) {\n const pressureLossItem = comp.pressure_loss[j];\n error.pressure_loss[j] = {};\n if (isValueEmpty(pressureLossItem.flow_rate)) {\n error.pressure_loss[j].flow_rate = 'flow rate is required.';\n hasFormErrors = true;\n }\n if (isValueEmpty(pressureLossItem.pressure_loss)) {\n error.pressure_loss[j].pressure_loss = 'pressure loss is required.';\n hasFormErrors = true;\n }\n if (\n !isValueEmpty(min_pressure_loss) &&\n !isValidNumber(pressureLossItem.pressure_loss, min_pressure_loss, null, {\n isMinInclusive: false,\n })\n ) {\n error.pressure_loss[j].pressure_loss = 'Invalid range';\n hasFormErrors = true;\n }\n }\n }\n\n if (comp.has_stabilizer && comp.stabilizer) {\n const stab_min_id = convertValue(STABLE_MIN_ID, 'shortLength', 'in');\n const stab_max_id = convertValue(STABLE_MAX_ID, 'shortLength', 'in');\n const stab_min_od = convertValue(STABLE_MIN_OD, 'shortLength', 'in');\n const stab_max_od = convertValue(STABLE_MAX_OD, 'shortLength', 'in');\n const stab_min_length = convertValue(STABLE_MIN_LENGTH, 'length', 'ft');\n\n if (\n isValidNumber(comp.stabilizer.inner_diameter, stab_min_id, stab_max_id) &&\n isValidNumber(comp.stabilizer.outer_diameter, stab_min_od, stab_max_od) &&\n !isValidNumber(comp.stabilizer.inner_diameter, min_id, comp.stabilizer.outer_diameter)\n ) {\n error.stabilizer_outer_diameter = 'O.D > I.D';\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.stabilizer.inner_diameter, stab_min_id, stab_max_id)) {\n error.stabilizer_inner_diameter = `${stab_min_id.toFixed(1)}~${stab_max_id.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n if (!isValidNumber(comp.stabilizer.outer_diameter, stab_min_od, stab_max_od)) {\n error.stabilizer_outer_diameter = `${stab_min_od.toFixed(1)}~${stab_max_od.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n if (!isValueEmpty(stab_min_length)) {\n if (!isValidNumber(comp.stabilizer.length, stab_min_length)) {\n error.stabilizer_length = 'Invalid value';\n hasFormErrors = true;\n }\n }\n if (isValueEmpty(comp.stabilizer.linear_weight)) {\n error.stabilizer_linear_weight = 'Invalid value';\n hasFormErrors = true;\n }\n if (!error.stabilizer_outer_diameter && bitSize) {\n if (\n +comp.stabilizer.outer_diameter +\n convertValue(ALLOWED_DIFF_OD_BIT_SIZE, 'shortLength', 'in') >\n bitSize\n ) {\n error.stabilizer_outer_diameter = ' O.D + 0.1 < Bit Size';\n hasFormErrors = true;\n }\n }\n }\n\n // specificErrors\n if (comp.family === 'ct') {\n if (!isValidNumber(comp.reel_diameter, min_rd, max_rd)) {\n error.reel_diameter = `${min_rd.toFixed(1)}~${max_rd.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n }\n\n if (comp.family === 'bit') {\n const ratio = ctop(1, 'shortLength', 'in');\n const lowerLimit = BIT_MIN_TFA * (ratio * ratio);\n const upperLimit = BIT_MAX_TFA * (ratio * ratio);\n if (!isValidNumber(comp.tfa, lowerLimit, upperLimit)) {\n error.tfa = `TFA must be ${lowerLimit.toFixed(2)}~${BIT_MAX_TFA.toFixed(2)}`;\n hasFormErrors = true;\n }\n }\n\n if (comp.family === 'rss') {\n if (!isValidNumber(comp.flow_loss_percentage, RSS_MIN_FLOW_LOSS, RSS_MAX_FLOW_LOSS)) {\n error.flow_loss_percentage = `It must be ${RSS_MIN_FLOW_LOSS}~${RSS_MAX_FLOW_LOSS}`;\n hasFormErrors = true;\n }\n }\n\n if (comp.family === 'mwd') {\n if (mwdHavingGamma.length > 1) {\n error.gamma_sensor_to_bit_distance = `Only 1 gamma sensor allowed. Currently ${mwdHavingGamma.length}`;\n hasFormErrors = true;\n } else if (comp.has_gamma_sensor && !Number.isFinite(comp.gamma_sensor_to_bit_distance)) {\n error.gamma_sensor_to_bit_distance = 'This field is required.';\n hasFormErrors = true;\n }\n\n if (comp.has_survey_sensor && !Number.isFinite(comp.bit_to_survey_distance)) {\n error.bit_to_survey_distance = 'This field is required.';\n hasFormErrors = true;\n } else if (comp.has_survey_sensor && comp.bit_to_survey_distance <= 0) {\n error.bit_to_survey_distance = 'Should be a positive number.';\n hasFormErrors = true;\n } else if (comp.has_survey_sensor && comp.bit_to_survey_distance > 150) {\n error.bit_to_survey_distance = 'Should be less then 150.';\n hasFormErrors = true;\n }\n\n if (\n comp.has_directional_sensor &&\n !Number.isFinite(comp.directional_sensor_to_bit_distance)\n ) {\n error.directional_sensor_to_bit_distance = 'This field is required.';\n hasFormErrors = true;\n } else if (comp.has_directional_sensor && comp.directional_sensor_to_bit_distance <= 0) {\n error.directional_sensor_to_bit_distance = 'Should be a positive number.';\n hasFormErrors = true;\n } else if (comp.has_directional_sensor && comp.directional_sensor_to_bit_distance > 150) {\n error.directional_sensor_to_bit_distance = 'Should be less then 150.';\n hasFormErrors = true;\n }\n }\n\n if (comp.family === 'pdm') {\n let pdmFieldUnitLower;\n let pdmFieldUnitUpper;\n\n if (!isValidNumber(comp.number_rotor_lobes, PDM_MIN_ROTOR, PDM_MAX_ROTOR)) {\n error.number_rotor_lobes = `It must be ${PDM_MIN_ROTOR}~${PDM_MAX_ROTOR}`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.number_stator_lobes, PDM_MIN_STATOR, PDM_MAX_STATOR)) {\n error.number_stator_lobes = `It must be ${PDM_MIN_STATOR}~${PDM_MAX_STATOR}`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.rpg, PDM_MIN_RPG, PDM_MAX_RPG)) {\n error.rpg = `It must be ${PDM_MIN_RPG}~${PDM_MAX_RPG}`;\n hasFormErrors = true;\n }\n\n pdmFieldUnitLower = convertValue(PDM_MIN_WOB, 'force', 'klbf');\n pdmFieldUnitUpper = convertValue(PDM_MAX_WOB, 'force', 'klbf');\n if (\n !isValueEmpty(comp.max_weight_on_bit) &&\n !isValidNumber(comp.max_weight_on_bit, pdmFieldUnitLower, pdmFieldUnitUpper)\n ) {\n error.max_weight_on_bit = `It must be ${pdmFieldUnitUpper.toFixed(\n 2\n )}~${pdmFieldUnitUpper.toFixed(2)}`;\n hasFormErrors = true;\n }\n\n pdmFieldUnitLower = convertValue(PDM_MIN_FLOW_RANGE, 'volumeFlowRate', 'gal/min');\n pdmFieldUnitUpper = convertValue(PDM_MAX_FLOW_RANGE, 'volumeFlowRate', 'gal/min');\n if (!isValidNumber(comp.min_standard_flowrate, pdmFieldUnitLower, pdmFieldUnitUpper)) {\n error.min_standard_flowrate = `It must be ${pdmFieldUnitLower.toFixed(\n 2\n )}~${pdmFieldUnitUpper.toFixed(2)}`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.max_standard_flowrate, pdmFieldUnitLower, pdmFieldUnitUpper)) {\n error.max_standard_flowrate = `It must be ${pdmFieldUnitLower.toFixed(\n 2\n )}~${pdmFieldUnitUpper.toFixed(2)}`;\n hasFormErrors = true;\n }\n\n pdmFieldUnitLower = convertValue(PDM_MIN_MODP, 'pressure', 'psi');\n pdmFieldUnitUpper = convertValue(PDM_MAX_MODP, 'pressure', 'psi');\n if (\n !isValidNumber(\n comp.max_operating_differential_pressure,\n pdmFieldUnitLower,\n pdmFieldUnitUpper\n )\n ) {\n error.max_operating_differential_pressure = `It must be ${pdmFieldUnitLower.toFixed(\n 2\n )}~${pdmFieldUnitUpper.toFixed(2)}`;\n hasFormErrors = true;\n }\n\n pdmFieldUnitLower = convertValue(PDM_MIN_TMODP, 'torque', 'ft-klbf');\n pdmFieldUnitUpper = convertValue(PDM_MAX_TMODP, 'torque', 'ft-klbf');\n if (\n !isValidNumber(\n comp.torque_at_max_operating_differential_pressure,\n pdmFieldUnitLower,\n pdmFieldUnitUpper\n )\n ) {\n error.torque_at_max_operating_differential_pressure = `It must be ${pdmFieldUnitLower.toFixed(\n 2\n )}~${pdmFieldUnitUpper.toFixed(2)}`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.flow_loss_percentage, PDM_MIN_FLOW_LOSS, PDM_MAX_FLOW_LOSS)) {\n error.flow_loss_percentage = `It must be ${PDM_MIN_FLOW_LOSS}~${PDM_MAX_FLOW_LOSS}`;\n hasFormErrors = true;\n }\n }\n\n errors.components[comp.id] = error;\n }\n\n if (bitComponents.length !== 1) {\n errors.general.bit_count = 'Number of \"BIT\" components is invalid.';\n hasFormErrors = true;\n }\n\n if (\n bitComponents.length === 1 &&\n components[components.length - 1].family !== 'bit' &&\n components[0].family !== 'bit'\n ) {\n // bit should be top or bottom\n errors.general.bit_position = '\"BIT\" category should be on the bottom of the list.';\n hasFormErrors = true;\n }\n\n if (hasFormErrors) {\n return errors;\n }\n return null;\n}\n\nexport function convertRecordBackToImperialUnit(record) {\n // if bit is top, reverse the components;\n let components = get(record, ['data', 'components']);\n if (get(components, [0, 'family']) === 'bit') {\n components = components.reverse().map((comp, idx) => ({ ...comp, order: idx }));\n record = set(record, ['data', 'components'], components); // eslint-disable-line no-param-reassign\n }\n\n const { data } = record.toJS();\n const objStartTime = data.start_timestamp_str && moment(new Date(data.start_timestamp_str));\n if (objStartTime && objStartTime.isValid()) {\n data.start_timestamp = objStartTime.unix();\n }\n delete data.start_timestamp_str;\n\n data.start_depth = ctoi(data.start_depth, 'length', 'ft');\n data.components = data.components.map(component => {\n const cc = Object.assign({}, component);\n cc.inner_diameter = ctoi(cc.inner_diameter, 'shortLength', 'in');\n cc.outer_diameter = ctoi(cc.outer_diameter, 'shortLength', 'in', 4);\n cc.linear_weight = ctoi(cc.linear_weight, 'massPerLength', 'lb-ft');\n cc.weight = ctoi(cc.weight, 'mass', 'lb');\n cc.length = ctoi(cc.length, 'length', 'ft');\n cc.component_length = ctoi(cc.component_length, 'length', 'ft');\n cc.outer_diameter_tooljoint = ctoi(cc.outer_diameter_tooljoint, 'shortLength', 'in');\n cc.inner_diameter_tooljoint = ctoi(cc.inner_diameter_tooljoint, 'shortLength', 'in');\n cc.length_tooljoint = ctoi(cc.length_tooljoint, 'length', 'ft');\n\n if (cc.family === 'bit' || cc.family === 'ur') {\n const ratio = ctoi(1, 'shortLength', 'in');\n cc.size = ctoi(cc.size, 'shortLength', 'in', 3);\n if (cc.nozzle_sizes && cc.nozzle_sizes.length > 0) {\n for (let j = 0; j < cc.nozzle_sizes.length; j += 1) {\n const item = cc.nozzle_sizes[j];\n item.size = ratio !== 1 ? ctoi(item.size, 'shortLength', 'in') * 32 : item.size;\n }\n }\n cc.tfa = ratio !== 1 ? cc.tfa * (ratio * ratio) : cc.tfa;\n }\n\n if (cc.family === 'pdm') {\n cc.max_weight_on_bit = ctoi(cc.max_weight_on_bit, 'force', 'klbf');\n cc.min_standard_flowrate = ctoi(cc.min_standard_flowrate, 'volumeFlowRate', 'gal/min');\n cc.max_standard_flowrate = ctoi(cc.max_standard_flowrate, 'volumeFlowRate', 'gal/min');\n cc.max_operating_differential_pressure = ctoi(\n cc.max_operating_differential_pressure,\n 'pressure',\n 'psi'\n );\n cc.torque_at_max_operating_differential_pressure = ctoi(\n cc.torque_at_max_operating_differential_pressure,\n 'torque',\n 'ft-klbf',\n 3\n );\n cc.rpg = ctoi(cc.rpg, 'revolutionPerVolume', 'rpg');\n\n if (cc.off_bottom_pressure_loss && cc.off_bottom_pressure_loss.length > 0) {\n for (let j = 0; j < cc.off_bottom_pressure_loss.length; j += 1) {\n const item = cc.off_bottom_pressure_loss[j];\n item.flow_rate = ctoi(item.flow_rate, 'volumeFlowRate', 'gal/min');\n item.pressure_loss = ctoi(item.pressure_loss, 'pressure', 'psi');\n }\n }\n if (!cc.has_stabilizer) {\n delete cc.stabilizer;\n }\n if (cc.stabilizer) {\n cc.stabilizer.inner_diameter =\n cc.stabilizer.inner_diameter && ctoi(cc.stabilizer.inner_diameter, 'shortLength', 'in');\n cc.stabilizer.outer_diameter =\n cc.stabilizer.outer_diameter && ctoi(cc.stabilizer.outer_diameter, 'shortLength', 'in');\n cc.stabilizer.linear_weight =\n cc.stabilizer.linear_weight &&\n ctoi(cc.stabilizer.linear_weight, 'massPerLength', 'lb-ft');\n cc.stabilizer.weight = cc.stabilizer.weight && ctoi(cc.stabilizer.weight, 'mass', 'lb');\n cc.stabilizer.length = cc.length && ctoi(cc.stabilizer.length, 'length', 'ft');\n cc.stabilizer.gauge_od =\n cc.stabilizer.gauge_od && ctoi(cc.stabilizer.gauge_od, 'shortLength', 'in');\n cc.stabilizer.gauge_length =\n cc.stabilizer.gauge_length && ctoi(cc.stabilizer.gauge_length, 'shortLength', 'in');\n cc.stabilizer.blade_width =\n cc.stabilizer.blade_width && ctoi(cc.stabilizer.blade_width, 'shortLength', 'in');\n cc.stabilizer.stab_centerpoint_to_bit =\n cc.stabilizer.stab_centerpoint_to_bit &&\n ctoi(cc.stabilizer.stab_centerpoint_to_bit, 'length', 'ft');\n }\n }\n\n if (cc.family === 'stabilizer') {\n cc.gauge_od = ctoi(cc.gauge_od, 'shortLength', 'in');\n cc.gauge_length = ctoi(cc.gauge_length, 'shortLength', 'in');\n cc.blade_width = ctoi(cc.blade_width, 'shortLength', 'in');\n }\n\n if (cc.family === 'mwd' || cc.family === 'rss' || cc.family === 'agitator') {\n if (cc.pressure_loss && cc.pressure_loss.length > 0) {\n for (let j = 0; j < cc.pressure_loss.length; j += 1) {\n const item = cc.pressure_loss[j];\n item.flow_rate = ctoi(item.flow_rate, 'volumeFlowRate', 'gal/min');\n item.pressure_loss = ctoi(item.pressure_loss, 'pressure', 'psi');\n }\n }\n }\n\n if (cc.family !== 'bit') {\n delete cc.bit_type;\n }\n if (!cc.has_gamma_sensor && Number.isFinite(cc.gamma_sensor_to_bit_distance)) {\n delete cc.gamma_sensor_to_bit_distance;\n }\n if (!cc.has_survey_sensor && Number.isFinite(cc.bit_to_survey_distance)) {\n delete cc.bit_to_survey_distance;\n }\n if (!cc.has_directional_sensor && Number.isFinite(cc.directional_sensor_to_bit_distance)) {\n delete cc.directional_sensor_to_bit_distance;\n }\n delete cc.c_length;\n return cc;\n });\n\n return {\n ...record,\n data,\n };\n}\n\nexport function ctoi(val, unitType, unit, precision = 2) {\n if (val === null || typeof val === 'undefined') {\n return null;\n }\n if (!unitType || !unit) {\n return parseFloat(val);\n }\n return parseFloat(convertValue(val, unitType, getUnitPreference(unitType), unit, precision));\n}\n\nexport function convertRecordtoPrefUnit(record) {\n const { data } = record.toJS();\n const { components } = data;\n data.start_depth = ctop(data.start_depth, 'length', 'ft');\n\n if (components.length > 0) {\n if (components[0].family === 'bit') {\n components[0].c_length = components[0].length || 0;\n for (let i = 1; i < components.length; i += 1) {\n components[i].c_length =\n parseFloat(components[i - 1].c_length) + parseFloat(components[i].length || 0);\n }\n } else {\n const lastIndex = components.length - 1;\n components[lastIndex].c_length = components[lastIndex].length || 0;\n for (let i = lastIndex - 1; i >= 0; i -= 1) {\n components[i].c_length =\n parseFloat(components[i + 1].c_length) + parseFloat(components[i].length || 0);\n }\n }\n }\n\n for (let i = 0; i < components.length; i += 1) {\n const comp = components[i];\n comp.inner_diameter = ctop(comp.inner_diameter, 'shortLength', 'in');\n comp.outer_diameter = ctop(comp.outer_diameter, 'shortLength', 'in', 4);\n comp.linear_weight = ctop(comp.linear_weight, 'massPerLength', 'lb-ft');\n comp.weight = ctop(comp.weight, 'mass', 'lb');\n comp.length = ctop(comp.length, 'length', 'ft');\n comp.component_length = ctop(comp.component_length, 'length', 'ft');\n comp.outer_diameter_tooljoint = ctop(comp.outer_diameter_tooljoint, 'shortLength', 'in');\n comp.inner_diameter_tooljoint = ctop(comp.inner_diameter_tooljoint, 'shortLength', 'in');\n comp.length_tooljoint = ctop(comp.length_tooljoint, 'length', 'ft');\n\n comp.c_length = ctop(comp.c_length, 'length', 'ft');\n comp.gamma_sensor_to_bit_distance = ctop(comp.gamma_sensor_to_bit_distance, 'length', 'ft');\n\n if (comp.family === 'bit' || comp.family === 'ur') {\n const ratio = ctop(1, 'shortLength', 'in');\n comp.size = ctop(comp.size, 'shortLength', 'in');\n if (comp.nozzle_sizes && comp.nozzle_sizes.length > 0) {\n for (let j = 0; j < comp.nozzle_sizes.length; j += 1) {\n const item = comp.nozzle_sizes[j];\n item.size = ratio !== 1 ? ctop(item.size, 'shortLength', 'in') / 32 : item.size;\n }\n }\n comp.tfa = ratio !== 1 ? comp.tfa * (ratio * ratio) : comp.tfa;\n }\n\n if (comp.family === 'pdm') {\n comp.max_weight_on_bit = ctop(comp.max_weight_on_bit, 'force', 'klbf');\n comp.min_standard_flowrate = ctop(comp.min_standard_flowrate, 'volumeFlowRate', 'gal/min');\n comp.max_standard_flowrate = ctop(comp.max_standard_flowrate, 'volumeFlowRate', 'gal/min');\n comp.max_operating_differential_pressure = ctop(\n comp.max_operating_differential_pressure,\n 'pressure',\n 'psi'\n );\n comp.torque_at_max_operating_differential_pressure = ctop(\n comp.torque_at_max_operating_differential_pressure,\n 'torque',\n 'ft-klbf',\n 3\n );\n if (comp.off_bottom_pressure_loss && comp.off_bottom_pressure_loss.length > 0) {\n for (let j = 0; j < comp.off_bottom_pressure_loss.length; j += 1) {\n const item = comp.off_bottom_pressure_loss[j];\n item.flow_rate = ctop(item.flow_rate, 'volumeFlowRate', 'gal/min');\n item.pressure_loss = ctop(item.pressure_loss, 'pressure', 'psi');\n }\n }\n comp.rpg = ctop(comp.rpg, 'revolutionPerVolume', 'rpg');\n if (comp.has_stabilizer && comp.stabilizer) {\n comp.stabilizer.inner_diameter = ctop(comp.stabilizer.inner_diameter, 'shortLength', 'in');\n comp.stabilizer.outer_diameter = ctop(comp.stabilizer.outer_diameter, 'shortLength', 'in');\n comp.stabilizer.linear_weight = ctop(\n comp.stabilizer.linear_weight,\n 'massPerLength',\n 'lb-ft'\n );\n comp.stabilizer.weight = ctop(comp.stabilizer.weight, 'mass', 'lb');\n comp.stabilizer.length = ctop(comp.stabilizer.length, 'length', 'ft');\n comp.stabilizer.gauge_od = ctop(comp.stabilizer.gauge_od, 'shortLength', 'in');\n comp.stabilizer.gauge_length = ctop(comp.stabilizer.gauge_length, 'shortLength', 'in');\n comp.stabilizer.blade_width = ctop(comp.stabilizer.blade_width, 'shortLength', 'in');\n comp.stabilizer.stab_centerpoint_to_bit = ctop(\n comp.stabilizer.stab_centerpoint_to_bit,\n 'length',\n 'ft'\n );\n }\n }\n\n if (comp.family === 'stabilizer') {\n comp.gauge_od = ctop(comp.gauge_od, 'shortLength', 'in');\n comp.gauge_length = ctop(comp.gauge_length, 'shortLength', 'in');\n comp.blade_width = ctop(comp.blade_width, 'shortLength', 'in');\n }\n\n if (comp.family === 'mwd' || comp.family === 'rss' || comp.family === 'agitator') {\n if (comp.pressure_loss && comp.pressure_loss.length > 0) {\n for (let j = 0; j < comp.pressure_loss.length; j += 1) {\n const item = comp.pressure_loss[j];\n item.flow_rate = ctop(item.flow_rate, 'volumeFlowRate', 'gal/min');\n item.pressure_loss = ctop(item.pressure_loss, 'pressure', 'psi');\n }\n }\n }\n }\n return {\n ...record,\n data,\n };\n}\n\nexport function ctop(val, unitType, unit, precision = 2) {\n if (val !== 0 && !val) {\n return null;\n }\n return unitType && unit ? convertValue(val, unitType, unit, null, precision) : val;\n}\n"],"names":["isValidNumber","num","min","max","_ref","arguments","length","undefined","_ref$isMinInclusive","isMinInclusive","parsedNum","parseFloat","Number","isNaN","isValidLinearWeight","id","od","linearWeight","prefShortLengthUnit","getUnitPreference","convertedId","convertedOd","convertValue","estimation","convertedEstimation","ctoi","val","unitType","unit","precision","ctop","record","components","get","reverse","map","comp","idx","_objectSpread","order","set","data","toJS","objStartTime","start_timestamp_str","moment","Date","isValid","start_timestamp","unix","start_depth","component","cc","Object","assign","inner_diameter","outer_diameter","linear_weight","weight","component_length","outer_diameter_tooljoint","inner_diameter_tooljoint","length_tooljoint","family","ratio","size","nozzle_sizes","j","item","tfa","max_weight_on_bit","min_standard_flowrate","max_standard_flowrate","max_operating_differential_pressure","torque_at_max_operating_differential_pressure","rpg","off_bottom_pressure_loss","flow_rate","pressure_loss","has_stabilizer","stabilizer","gauge_od","gauge_length","blade_width","stab_centerpoint_to_bit","bit_type","has_gamma_sensor","isFinite","gamma_sensor_to_bit_distance","has_survey_sensor","bit_to_survey_distance","has_directional_sensor","directional_sensor_to_bit_distance","c_length","i","lastIndex","recordData","_recordData$toJS$data","shortLengthUnitDisplay","getUnitDisplay","lengthUnitDisplay","errors","general","specificErrors","bitComponents","filter","bitSize","mwdHavingGamma","hasFormErrors","isValueEmpty","minDepth","maxDepth","prohibitedDepth","concat","toFixed","min_id","min_od","max_id","max_od","min_opened_od","max_opened_od","min_length","min_tj_id","max_tj_id","min_tj_od","max_tj_od","min_pressure_loss","min_off_bottom_pressure_loss","min_rd","max_rd","error","ur_opened_od","obpsItem","pressureLossItem","stab_min_id","stab_max_id","stab_min_od","stab_max_od","stab_min_length","stabilizer_outer_diameter","stabilizer_inner_diameter","stabilizer_length","stabilizer_linear_weight","reel_diameter","lowerLimit","upperLimit","flow_loss_percentage","pdmFieldUnitLower","pdmFieldUnitUpper","number_rotor_lobes","number_stator_lobes","bit_count","bit_position"],"mappings":"w4BA0HO,SAASA,EAAcC,EAAKC,EAAKC,GAAqC,IAAAC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAJ,CAAE,EAAAG,EAAAJ,EAA5BK,eAAAA,cAAqBD,EAC5DE,EAAYC,WAAWV,GAC7B,OAAIW,OAAOC,MAAMH,OAGZD,GAAkBC,E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8G,qBAxkBJ,EACA,MAwkBlBhB,EAAMgB,qBAAoB,cAAAjC,OAzkBR,EAykB0C,KAAAA,OAxkB1C,IAykBlBL,GAAgB,EAEpB,CAEAP,EAAOrE,WAAWI,EAAKrB,IAAMmH,CAC/B,CAiBA,OAf6B,IAAzB1B,EAAclG,SAChB+F,EAAOC,QAAQiD,UAAY,yCAC3B3C,GAAgB,GAIS,IAAzBJ,EAAclG,QAC+B,QAA7C0B,EAAWA,EAAW1B,OAAS,GAAGyD,QACT,QAAzB/B,EAAW,GAAG+B,SAGdsC,EAAOC,QAAQkD,aAAe,sDAC9B5C,GAAgB,GAGdA,EACKP,EAEF,IACT"}
1
+ {"version":3,"file":"DrillstringUtils.js","sources":["../../../src/utils/DrillstringUtils.js"],"sourcesContent":["/************ deprecated DO NOT USE IT ************************/\n/************ new version in drillstring folder */\n/* eslint-disable camelcase */\nimport set from 'lodash/set';\nimport get from 'lodash/get';\nimport moment from 'moment';\n\nimport { getUnitPreference, convertValue, getUnitDisplay } from './convert';\n\nconst ALLOWED_DIFF_OD_BIT_SIZE = 0.1;\n\nconst DEF_MIN_ID = 0;\nconst DEF_MAX_ID = 100;\nconst DEF_MIN_OD = 1;\nconst DEF_MAX_OD = 100;\nconst DEF_MIN_LENGTH = 0;\n\nconst UR_MIN_ID = 0;\nconst UR_MAX_ID = 50;\nconst UR_MIN_BODY_OD = 1;\nconst UR_MAX_BODY_OD = 50;\nconst UR_MIN_OPENED_OD = 1;\nconst UR_MAX_OPENED_OD = 50;\n\nconst CT_MIN_ID = 0;\nconst CT_MAX_ID = 100;\nconst CT_MIN_OD = 1;\nconst CT_MAX_OD = 100;\nconst CT_MIN_RD = 0;\nconst CT_MAX_RD = 500;\nconst CT_MIN_LENGTH = 0;\n\nconst DP_MIN_ID = 1;\nconst DP_MAX_ID = 7;\nconst DP_MIN_OD = 2;\nconst DP_MAX_OD = 8;\nconst DP_MIN_TJ_ID = 1;\nconst DP_MAX_TJ_ID = 7;\nconst DP_MIN_TJ_OD = 2;\nconst DP_MAX_TJ_OD = 10;\nconst DP_MIN_LENGTH = 0;\n\nconst HWDP_MIN_ID = 1;\nconst HWDP_MAX_ID = 7;\nconst HWDP_MIN_OD = 2;\nconst HWDP_MAX_OD = 8;\nconst HWDP_MIN_TJ_ID = 1;\nconst HWDP_MAX_TJ_ID = 7;\nconst HWDP_MIN_TJ_OD = 2;\nconst HWDP_MAX_TJ_OD = 10;\nconst HWDP_MIN_LENGTH = 0;\n\nconst DC_MIN_ID = 0.5;\nconst DC_MAX_ID = 7;\nconst DC_MIN_OD = 2;\nconst DC_MAX_OD = 13;\nconst DC_MIN_LENGTH = 0;\n\nconst STABLE_MIN_ID = 0;\nconst STABLE_MAX_ID = 100;\nconst STABLE_MIN_OD = 1;\nconst STABLE_MAX_OD = 100;\nconst STABLE_MIN_LENGTH = 0;\n\nconst PDM_MIN_OD = 2;\nconst PDM_MAX_OD = 15;\nconst PDM_MIN_ID = 0;\nconst PDM_MAX_ID = 12;\nconst PDM_MIN_LENGTH = 4;\n\nconst PDM_MIN_STATOR = 2;\nconst PDM_MAX_STATOR = 10;\nconst PDM_MIN_ROTOR = 1;\nconst PDM_MAX_ROTOR = 10;\nconst PDM_MIN_RPG = 0;\nconst PDM_MAX_RPG = 10;\nconst PDM_MIN_WOB = 0;\nconst PDM_MAX_WOB = 200;\nconst PDM_MIN_FLOW_RANGE = 0;\nconst PDM_MAX_FLOW_RANGE = 2500;\nconst PDM_MIN_MODP = 0;\nconst PDM_MAX_MODP = 3000;\nconst PDM_MIN_TMODP = 0;\nconst PDM_MAX_TMODP = 40;\nconst PDM_MIN_FLOW_LOSS = 0;\nconst PDM_MAX_FLOW_LOSS = 20;\nconst PDM_MIN_OFF_BOTTOM_PRESSURE_LOSS = 0;\n\nconst MWD_MIN_ID = 0;\nconst MWD_MAX_ID = 12;\nconst MWD_MIN_OD = 2;\nconst MWD_MAX_OD = 13;\nconst MWD_MIN_LENGTH = 1.0;\nconst MWD_MIN_PRESSURE_LOSS = 0;\n\nconst RSS_MIN_ID = 0;\nconst RSS_MAX_ID = 12;\nconst RSS_MIN_OD = 2;\nconst RSS_MAX_OD = 13;\nconst RSS_MIN_LENGTH = 1.0;\nconst RSS_MIN_FLOW_LOSS = 0;\nconst RSS_MAX_FLOW_LOSS = 10;\nconst RSS_MIN_PRESSURE_LOSS = 0;\n\nconst AGITATOR_MIN_ID = 0;\nconst AGITATOR_MAX_ID = 12;\nconst AGITATOR_MIN_OD = 2;\nconst AGITATOR_MAX_OD = 13;\nconst AGITATOR_MIN_LENGTH = 1.0;\nconst AGITATOR_MIN_PRESSURE_LOSS = 0;\n\nconst BIT_MIN_TFA = 0;\nconst BIT_MAX_TFA = 20;\n\nconst DEPTH_IN_HOLE_MIN = 0;\nconst DEPTH_IN_HOLE_MAX = 55000;\nconst DEPTH_IN_HOLE_PROHIBITED = 1;\n\nexport function sValueEmpty(val) {\n return val === null || typeof val === 'undefined' || val === '';\n}\n\nexport function isValidNumber(num, min, max, { isMinInclusive = true } = {}) {\n const parsedNum = parseFloat(num);\n if (Number.isNaN(parsedNum)) {\n return false;\n }\n if ((isMinInclusive && parsedNum < min) || (!isMinInclusive && parsedNum <= min)) {\n return false;\n }\n\n if (max && parsedNum > max) {\n return false;\n }\n\n return true;\n}\n\nexport function isValidLinearWeight(id, od, linearWeight) {\n const prefShortLengthUnit = getUnitPreference('shortLength');\n let convertedId = id;\n let convertedOd = od;\n if (prefShortLengthUnit !== 'in') {\n convertedId = convertValue(id, 'shortLength', prefShortLengthUnit, 'in');\n convertedOd = convertValue(od, 'shortLength', prefShortLengthUnit, 'in');\n }\n\n const estimation = 2.673 * (convertedOd * convertedOd - convertedId * convertedId);\n\n const convertedEstimation =\n prefShortLengthUnit !== 'in' ? convertValue(estimation, 'massPerLength', 'lb-ft') : estimation;\n\n return linearWeight >= convertedEstimation * 0.5 && linearWeight <= convertedEstimation * 1.5;\n}\n\nexport function validate(recordData) {\n const {\n data: { id, start_timestamp_str, start_depth, components },\n } = recordData.toJS();\n const shortLengthUnitDisplay = getUnitDisplay('shortLength');\n const lengthUnitDisplay = getUnitDisplay('length');\n const errors = {\n general: {},\n components: {},\n specificErrors: {},\n };\n const bitComponents = components.filter(comp => comp.family === 'bit');\n const bitSize = bitComponents.length > 0 ? bitComponents[0].size : null;\n const mwdHavingGamma = components.filter(comp => comp.family === 'mwd' && comp.has_gamma_sensor);\n let hasFormErrors = false;\n\n if (isValueEmpty(id)) {\n errors.id = 'It should not be empty.';\n hasFormErrors = true;\n }\n\n if (start_timestamp_str && !moment(new Date(start_timestamp_str)).isValid()) {\n hasFormErrors = true;\n errors.start_timestamp = 'Invalid Date.';\n }\n\n if (Number.isFinite(start_depth)) {\n const minDepth = convertValue(DEPTH_IN_HOLE_MIN, 'length', 'ft');\n const maxDepth = convertValue(DEPTH_IN_HOLE_MAX, 'length', 'ft');\n const prohibitedDepth = convertValue(DEPTH_IN_HOLE_PROHIBITED, 'length', 'ft');\n if (start_depth <= minDepth || start_depth > maxDepth) {\n hasFormErrors = true;\n errors.start_depth = `Should be a positive number ${minDepth.toFixed(2)}~${maxDepth.toFixed(\n 2\n )} (${lengthUnitDisplay})`;\n }\n if (start_depth === prohibitedDepth) {\n hasFormErrors = true;\n errors.start_depth = `Should not be equal to ${prohibitedDepth} (${lengthUnitDisplay})`;\n }\n } else {\n hasFormErrors = true;\n errors.start_depth = 'It should not be empty.';\n }\n\n for (let i = 0; i < components.length; i += 1) {\n let min_id;\n let min_od;\n let max_id;\n let max_od;\n let min_opened_od;\n let max_opened_od;\n let min_length;\n let min_tj_id;\n let max_tj_id;\n let min_tj_od;\n let max_tj_od;\n let min_pressure_loss;\n let min_off_bottom_pressure_loss;\n let min_rd;\n let max_rd;\n\n const comp = components[i];\n const error = {};\n switch (comp.family) {\n case 'ct':\n min_id = convertValue(CT_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(CT_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(CT_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(CT_MAX_OD, 'shortLength', 'in');\n min_rd = convertValue(CT_MIN_RD, 'shortLength', 'in');\n max_rd = convertValue(CT_MAX_RD, 'shortLength', 'in');\n min_length = convertValue(CT_MIN_LENGTH, 'length', 'ft');\n break;\n\n case 'dp':\n min_id = convertValue(DP_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(DP_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(DP_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(DP_MAX_OD, 'shortLength', 'in');\n min_tj_id = convertValue(DP_MIN_TJ_ID, 'shortLength', 'in');\n max_tj_id = convertValue(DP_MAX_TJ_ID, 'shortLength', 'in');\n min_tj_od = convertValue(DP_MIN_TJ_OD, 'shortLength', 'in');\n max_tj_od = convertValue(DP_MAX_TJ_OD, 'shortLength', 'in');\n min_length = convertValue(DP_MIN_LENGTH, 'length', 'ft');\n break;\n\n case 'hwdp':\n min_id = convertValue(HWDP_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(HWDP_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(HWDP_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(HWDP_MAX_OD, 'shortLength', 'in');\n min_tj_id = convertValue(HWDP_MIN_TJ_ID, 'shortLength', 'in');\n max_tj_id = convertValue(HWDP_MAX_TJ_ID, 'shortLength', 'in');\n min_tj_od = convertValue(HWDP_MIN_TJ_OD, 'shortLength', 'in');\n max_tj_od = convertValue(HWDP_MAX_TJ_OD, 'shortLength', 'in');\n min_length = convertValue(HWDP_MIN_LENGTH, 'length', 'ft');\n break;\n\n case 'dc':\n min_id = convertValue(DC_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(DC_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(DC_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(DC_MAX_OD, 'shortLength', 'in');\n min_length = convertValue(DC_MIN_LENGTH, 'length', 'ft');\n break;\n\n case 'stabilizer':\n case 'ags':\n min_id = convertValue(STABLE_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(STABLE_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(STABLE_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(STABLE_MAX_OD, 'shortLength', 'in');\n min_length = convertValue(STABLE_MIN_LENGTH, 'length', 'ft');\n break;\n\n case 'pdm':\n min_od = convertValue(PDM_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(PDM_MAX_OD, 'shortLength', 'in');\n min_id = convertValue(PDM_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(PDM_MAX_ID, 'shortLength', 'in');\n min_length = convertValue(PDM_MIN_LENGTH, 'length', 'ft');\n min_off_bottom_pressure_loss = PDM_MIN_OFF_BOTTOM_PRESSURE_LOSS;\n break;\n\n case 'mwd':\n min_od = convertValue(MWD_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(MWD_MAX_OD, 'shortLength', 'in');\n min_id = convertValue(MWD_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(MWD_MAX_ID, 'shortLength', 'in');\n min_length = convertValue(MWD_MIN_LENGTH, 'length', 'ft');\n min_pressure_loss = MWD_MIN_PRESSURE_LOSS;\n break;\n\n case 'agitator':\n min_od = convertValue(AGITATOR_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(AGITATOR_MAX_OD, 'shortLength', 'in');\n min_id = convertValue(AGITATOR_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(AGITATOR_MAX_ID, 'shortLength', 'in');\n min_length = convertValue(AGITATOR_MIN_LENGTH, 'length', 'ft');\n min_pressure_loss = AGITATOR_MIN_PRESSURE_LOSS;\n break;\n\n case 'rss':\n min_od = convertValue(RSS_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(RSS_MAX_OD, 'shortLength', 'in');\n min_id = convertValue(RSS_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(RSS_MAX_ID, 'shortLength', 'in');\n min_length = convertValue(RSS_MIN_LENGTH, 'length', 'ft');\n min_pressure_loss = RSS_MIN_PRESSURE_LOSS;\n break;\n\n case 'ur':\n min_id = convertValue(UR_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(UR_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(UR_MIN_BODY_OD, 'shortLength', 'in');\n max_od = convertValue(UR_MAX_BODY_OD, 'shortLength', 'in');\n min_opened_od = convertValue(UR_MIN_OPENED_OD, 'shortLength', 'in');\n max_opened_od = convertValue(UR_MAX_OPENED_OD, 'shortLength', 'in');\n break;\n\n case 'bit':\n break;\n\n default:\n min_id = convertValue(DEF_MIN_ID, 'shortLength', 'in');\n max_id = convertValue(DEF_MAX_ID, 'shortLength', 'in');\n min_od = convertValue(DEF_MIN_OD, 'shortLength', 'in');\n max_od = convertValue(DEF_MAX_OD, 'shortLength', 'in');\n min_length = convertValue(DEF_MIN_LENGTH, 'length', 'ft');\n break;\n }\n\n if (!isValueEmpty(min_id) && !isValueEmpty(min_od)) {\n if (!isValidNumber(comp.inner_diameter, min_id, max_id)) {\n error.inner_diameter = `${min_id.toFixed(1)}~${max_id.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.outer_diameter, min_od, max_od)) {\n error.outer_diameter = `${min_od.toFixed(1)}~${max_od.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n\n if (\n isValidNumber(comp.inner_diameter, min_id, max_id) &&\n isValidNumber(comp.outer_diameter, min_od, max_od) &&\n !isValidNumber(comp.inner_diameter, min_id, comp.outer_diameter)\n ) {\n error.outer_diameter = 'O.D > I.D';\n hasFormErrors = true;\n }\n\n if (!error.outer_diameter && bitSize) {\n if (\n +comp.outer_diameter + convertValue(ALLOWED_DIFF_OD_BIT_SIZE, 'shortLength', 'in') >\n bitSize\n ) {\n error.outer_diameter = ' O.D + 0.1 < Bit Size';\n hasFormErrors = true;\n }\n }\n\n // only check validity of linear weight when family is not bit\n if (!isValidNumber(comp.linear_weight, 0)) {\n error.linear_weight = 'Invalid value';\n hasFormErrors = true;\n }\n\n if (\n comp.family === 'dp' ||\n comp.family === 'hwdp' ||\n comp.family === 'dc' ||\n comp.family === 'ct' ||\n comp.family === 'ur'\n ) {\n if (!error.inner_diameter && !error.outer_diameter && !error.linear_weight) {\n if (!isValidLinearWeight(comp.inner_diameter, comp.outer_diameter, comp.linear_weight)) {\n error.linear_weight = 'Invalid range';\n hasFormErrors = true;\n }\n }\n }\n }\n if (comp.family === 'ur') {\n if (!isValidNumber(comp.ur_opened_od, min_opened_od, max_opened_od)) {\n error.ur_opened_od = `${min_opened_od.toFixed(1)}~${max_opened_od.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n } else if (comp.ur_opened_od < bitSize) {\n error.ur_opened_od = 'Max O.D (Opened) >= Bit Size';\n hasFormErrors = true;\n }\n }\n\n if (!isValueEmpty(min_tj_id) && !isValueEmpty(min_tj_od)) {\n if (!isValidNumber(comp.inner_diameter_tooljoint, min_tj_id, max_tj_id)) {\n error.inner_diameter_tooljoint = `${min_tj_id.toFixed(1)}~${max_tj_id.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.outer_diameter_tooljoint, min_tj_od, max_tj_od)) {\n error.outer_diameter_tooljoint = `${min_tj_od.toFixed(1)}~${max_tj_od.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.outer_diameter_tooljoint, comp.outer_diameter, max_tj_od)) {\n error.outer_diameter_tooljoint = 'Tool Joint O.D >= O.D';\n hasFormErrors = true;\n }\n }\n\n if (!isValueEmpty(min_length)) {\n if (!isValidNumber(comp.length, min_length)) {\n error.length = 'Invalid value';\n hasFormErrors = true;\n }\n }\n\n if (!isValueEmpty(comp.length_tooljoint) && !isValueEmpty(comp.component_length)) {\n if (+comp.length_tooljoint > +comp.component_length) {\n error.length_tooljoint = 'Tool Joint Length < Component Length';\n hasFormErrors = true;\n }\n }\n\n if (comp.off_bottom_pressure_loss && comp.off_bottom_pressure_loss.length > 0) {\n error.off_bottom_pressure_loss = {};\n for (let j = 0; j < comp.off_bottom_pressure_loss.length; j += 1) {\n const obpsItem = comp.off_bottom_pressure_loss[j];\n error.off_bottom_pressure_loss[j] = {};\n if (isValueEmpty(obpsItem.flow_rate)) {\n error.off_bottom_pressure_loss[j].flow_rate = 'flow rate is required.';\n hasFormErrors = true;\n }\n if (isValueEmpty(obpsItem.pressure_loss)) {\n error.off_bottom_pressure_loss[j].pressure_loss = 'pressure loss is required.';\n hasFormErrors = true;\n }\n if (\n !isValueEmpty(min_off_bottom_pressure_loss) &&\n !isValidNumber(obpsItem.pressure_loss, min_off_bottom_pressure_loss, null, {\n isMinInclusive: false,\n })\n ) {\n error.off_bottom_pressure_loss[j].pressure_loss = 'Invalid range';\n hasFormErrors = true;\n }\n }\n }\n\n if (comp.pressure_loss && comp.pressure_loss.length > 0) {\n error.pressure_loss = {};\n for (let j = 0; j < comp.pressure_loss.length; j += 1) {\n const pressureLossItem = comp.pressure_loss[j];\n error.pressure_loss[j] = {};\n if (isValueEmpty(pressureLossItem.flow_rate)) {\n error.pressure_loss[j].flow_rate = 'flow rate is required.';\n hasFormErrors = true;\n }\n if (isValueEmpty(pressureLossItem.pressure_loss)) {\n error.pressure_loss[j].pressure_loss = 'pressure loss is required.';\n hasFormErrors = true;\n }\n if (\n !isValueEmpty(min_pressure_loss) &&\n !isValidNumber(pressureLossItem.pressure_loss, min_pressure_loss, null, {\n isMinInclusive: false,\n })\n ) {\n error.pressure_loss[j].pressure_loss = 'Invalid range';\n hasFormErrors = true;\n }\n }\n }\n\n if (comp.has_stabilizer && comp.stabilizer) {\n const stab_min_id = convertValue(STABLE_MIN_ID, 'shortLength', 'in');\n const stab_max_id = convertValue(STABLE_MAX_ID, 'shortLength', 'in');\n const stab_min_od = convertValue(STABLE_MIN_OD, 'shortLength', 'in');\n const stab_max_od = convertValue(STABLE_MAX_OD, 'shortLength', 'in');\n const stab_min_length = convertValue(STABLE_MIN_LENGTH, 'length', 'ft');\n\n if (\n isValidNumber(comp.stabilizer.inner_diameter, stab_min_id, stab_max_id) &&\n isValidNumber(comp.stabilizer.outer_diameter, stab_min_od, stab_max_od) &&\n !isValidNumber(comp.stabilizer.inner_diameter, min_id, comp.stabilizer.outer_diameter)\n ) {\n error.stabilizer_outer_diameter = 'O.D > I.D';\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.stabilizer.inner_diameter, stab_min_id, stab_max_id)) {\n error.stabilizer_inner_diameter = `${stab_min_id.toFixed(1)}~${stab_max_id.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n if (!isValidNumber(comp.stabilizer.outer_diameter, stab_min_od, stab_max_od)) {\n error.stabilizer_outer_diameter = `${stab_min_od.toFixed(1)}~${stab_max_od.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n if (!isValueEmpty(stab_min_length)) {\n if (!isValidNumber(comp.stabilizer.length, stab_min_length)) {\n error.stabilizer_length = 'Invalid value';\n hasFormErrors = true;\n }\n }\n if (isValueEmpty(comp.stabilizer.linear_weight)) {\n error.stabilizer_linear_weight = 'Invalid value';\n hasFormErrors = true;\n }\n if (!error.stabilizer_outer_diameter && bitSize) {\n if (\n +comp.stabilizer.outer_diameter +\n convertValue(ALLOWED_DIFF_OD_BIT_SIZE, 'shortLength', 'in') >\n bitSize\n ) {\n error.stabilizer_outer_diameter = ' O.D + 0.1 < Bit Size';\n hasFormErrors = true;\n }\n }\n }\n\n // specificErrors\n if (comp.family === 'ct') {\n if (!isValidNumber(comp.reel_diameter, min_rd, max_rd)) {\n error.reel_diameter = `${min_rd.toFixed(1)}~${max_rd.toFixed(\n 1\n )} (${shortLengthUnitDisplay})`;\n hasFormErrors = true;\n }\n }\n\n if (comp.family === 'bit') {\n const ratio = ctop(1, 'shortLength', 'in');\n const lowerLimit = BIT_MIN_TFA * (ratio * ratio);\n const upperLimit = BIT_MAX_TFA * (ratio * ratio);\n if (!isValidNumber(comp.tfa, lowerLimit, upperLimit)) {\n error.tfa = `TFA must be ${lowerLimit.toFixed(2)}~${BIT_MAX_TFA.toFixed(2)}`;\n hasFormErrors = true;\n }\n }\n\n if (comp.family === 'rss') {\n if (!isValidNumber(comp.flow_loss_percentage, RSS_MIN_FLOW_LOSS, RSS_MAX_FLOW_LOSS)) {\n error.flow_loss_percentage = `It must be ${RSS_MIN_FLOW_LOSS}~${RSS_MAX_FLOW_LOSS}`;\n hasFormErrors = true;\n }\n }\n\n if (comp.family === 'mwd') {\n if (mwdHavingGamma.length > 1) {\n error.gamma_sensor_to_bit_distance = `Only 1 gamma sensor allowed. Currently ${mwdHavingGamma.length}`;\n hasFormErrors = true;\n } else if (comp.has_gamma_sensor && !Number.isFinite(comp.gamma_sensor_to_bit_distance)) {\n error.gamma_sensor_to_bit_distance = 'This field is required.';\n hasFormErrors = true;\n }\n\n if (comp.has_survey_sensor && !Number.isFinite(comp.bit_to_survey_distance)) {\n error.bit_to_survey_distance = 'This field is required.';\n hasFormErrors = true;\n } else if (comp.has_survey_sensor && comp.bit_to_survey_distance <= 0) {\n error.bit_to_survey_distance = 'Should be a positive number.';\n hasFormErrors = true;\n } else if (comp.has_survey_sensor && comp.bit_to_survey_distance > 150) {\n error.bit_to_survey_distance = 'Should be less then 150.';\n hasFormErrors = true;\n }\n\n if (\n comp.has_directional_sensor &&\n !Number.isFinite(comp.directional_sensor_to_bit_distance)\n ) {\n error.directional_sensor_to_bit_distance = 'This field is required.';\n hasFormErrors = true;\n } else if (comp.has_directional_sensor && comp.directional_sensor_to_bit_distance <= 0) {\n error.directional_sensor_to_bit_distance = 'Should be a positive number.';\n hasFormErrors = true;\n } else if (comp.has_directional_sensor && comp.directional_sensor_to_bit_distance > 150) {\n error.directional_sensor_to_bit_distance = 'Should be less then 150.';\n hasFormErrors = true;\n }\n }\n\n if (comp.family === 'pdm') {\n let pdmFieldUnitLower;\n let pdmFieldUnitUpper;\n\n if (!isValidNumber(comp.number_rotor_lobes, PDM_MIN_ROTOR, PDM_MAX_ROTOR)) {\n error.number_rotor_lobes = `It must be ${PDM_MIN_ROTOR}~${PDM_MAX_ROTOR}`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.number_stator_lobes, PDM_MIN_STATOR, PDM_MAX_STATOR)) {\n error.number_stator_lobes = `It must be ${PDM_MIN_STATOR}~${PDM_MAX_STATOR}`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.rpg, PDM_MIN_RPG, PDM_MAX_RPG)) {\n error.rpg = `It must be ${PDM_MIN_RPG}~${PDM_MAX_RPG}`;\n hasFormErrors = true;\n }\n\n pdmFieldUnitLower = convertValue(PDM_MIN_WOB, 'force', 'klbf');\n pdmFieldUnitUpper = convertValue(PDM_MAX_WOB, 'force', 'klbf');\n if (\n !isValueEmpty(comp.max_weight_on_bit) &&\n !isValidNumber(comp.max_weight_on_bit, pdmFieldUnitLower, pdmFieldUnitUpper)\n ) {\n error.max_weight_on_bit = `It must be ${pdmFieldUnitUpper.toFixed(\n 2\n )}~${pdmFieldUnitUpper.toFixed(2)}`;\n hasFormErrors = true;\n }\n\n pdmFieldUnitLower = convertValue(PDM_MIN_FLOW_RANGE, 'volumeFlowRate', 'gal/min');\n pdmFieldUnitUpper = convertValue(PDM_MAX_FLOW_RANGE, 'volumeFlowRate', 'gal/min');\n if (!isValidNumber(comp.min_standard_flowrate, pdmFieldUnitLower, pdmFieldUnitUpper)) {\n error.min_standard_flowrate = `It must be ${pdmFieldUnitLower.toFixed(\n 2\n )}~${pdmFieldUnitUpper.toFixed(2)}`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.max_standard_flowrate, pdmFieldUnitLower, pdmFieldUnitUpper)) {\n error.max_standard_flowrate = `It must be ${pdmFieldUnitLower.toFixed(\n 2\n )}~${pdmFieldUnitUpper.toFixed(2)}`;\n hasFormErrors = true;\n }\n\n pdmFieldUnitLower = convertValue(PDM_MIN_MODP, 'pressure', 'psi');\n pdmFieldUnitUpper = convertValue(PDM_MAX_MODP, 'pressure', 'psi');\n if (\n !isValidNumber(\n comp.max_operating_differential_pressure,\n pdmFieldUnitLower,\n pdmFieldUnitUpper\n )\n ) {\n error.max_operating_differential_pressure = `It must be ${pdmFieldUnitLower.toFixed(\n 2\n )}~${pdmFieldUnitUpper.toFixed(2)}`;\n hasFormErrors = true;\n }\n\n pdmFieldUnitLower = convertValue(PDM_MIN_TMODP, 'torque', 'ft-klbf');\n pdmFieldUnitUpper = convertValue(PDM_MAX_TMODP, 'torque', 'ft-klbf');\n if (\n !isValidNumber(\n comp.torque_at_max_operating_differential_pressure,\n pdmFieldUnitLower,\n pdmFieldUnitUpper\n )\n ) {\n error.torque_at_max_operating_differential_pressure = `It must be ${pdmFieldUnitLower.toFixed(\n 2\n )}~${pdmFieldUnitUpper.toFixed(2)}`;\n hasFormErrors = true;\n }\n\n if (!isValidNumber(comp.flow_loss_percentage, PDM_MIN_FLOW_LOSS, PDM_MAX_FLOW_LOSS)) {\n error.flow_loss_percentage = `It must be ${PDM_MIN_FLOW_LOSS}~${PDM_MAX_FLOW_LOSS}`;\n hasFormErrors = true;\n }\n }\n\n errors.components[comp.id] = error;\n }\n\n if (bitComponents.length !== 1) {\n errors.general.bit_count = 'Number of \"BIT\" components is invalid.';\n hasFormErrors = true;\n }\n\n if (\n bitComponents.length === 1 &&\n components[components.length - 1].family !== 'bit' &&\n components[0].family !== 'bit'\n ) {\n // bit should be top or bottom\n errors.general.bit_position = '\"BIT\" category should be on the bottom of the list.';\n hasFormErrors = true;\n }\n\n if (hasFormErrors) {\n return errors;\n }\n return null;\n}\n\nexport function convertRecordBackToImperialUnit(record) {\n // if bit is top, reverse the components;\n let components = get(record, ['data', 'components']);\n if (get(components, [0, 'family']) === 'bit') {\n components = components.reverse().map((comp, idx) => ({ ...comp, order: idx }));\n record = set(record, ['data', 'components'], components); // eslint-disable-line no-param-reassign\n }\n\n const { data } = record.toJS();\n const objStartTime = data.start_timestamp_str && moment(new Date(data.start_timestamp_str));\n if (objStartTime && objStartTime.isValid()) {\n data.start_timestamp = objStartTime.unix();\n }\n delete data.start_timestamp_str;\n\n data.start_depth = ctoi(data.start_depth, 'length', 'ft');\n data.components = data.components.map(component => {\n const cc = Object.assign({}, component);\n cc.inner_diameter = ctoi(cc.inner_diameter, 'shortLength', 'in');\n cc.outer_diameter = ctoi(cc.outer_diameter, 'shortLength', 'in', 4);\n cc.linear_weight = ctoi(cc.linear_weight, 'massPerLength', 'lb-ft');\n cc.weight = ctoi(cc.weight, 'mass', 'lb');\n cc.length = ctoi(cc.length, 'length', 'ft');\n cc.component_length = ctoi(cc.component_length, 'length', 'ft');\n cc.outer_diameter_tooljoint = ctoi(cc.outer_diameter_tooljoint, 'shortLength', 'in');\n cc.inner_diameter_tooljoint = ctoi(cc.inner_diameter_tooljoint, 'shortLength', 'in');\n cc.length_tooljoint = ctoi(cc.length_tooljoint, 'length', 'ft');\n\n if (cc.family === 'bit' || cc.family === 'ur') {\n const ratio = ctoi(1, 'shortLength', 'in');\n cc.size = ctoi(cc.size, 'shortLength', 'in', 3);\n if (cc.nozzle_sizes && cc.nozzle_sizes.length > 0) {\n for (let j = 0; j < cc.nozzle_sizes.length; j += 1) {\n const item = cc.nozzle_sizes[j];\n item.size = ratio !== 1 ? ctoi(item.size, 'shortLength', 'in') * 32 : item.size;\n }\n }\n cc.tfa = ratio !== 1 ? cc.tfa * (ratio * ratio) : cc.tfa;\n }\n\n if (cc.family === 'pdm') {\n cc.max_weight_on_bit = ctoi(cc.max_weight_on_bit, 'force', 'klbf');\n cc.min_standard_flowrate = ctoi(cc.min_standard_flowrate, 'volumeFlowRate', 'gal/min');\n cc.max_standard_flowrate = ctoi(cc.max_standard_flowrate, 'volumeFlowRate', 'gal/min');\n cc.max_operating_differential_pressure = ctoi(\n cc.max_operating_differential_pressure,\n 'pressure',\n 'psi'\n );\n cc.torque_at_max_operating_differential_pressure = ctoi(\n cc.torque_at_max_operating_differential_pressure,\n 'torque',\n 'ft-klbf',\n 3\n );\n cc.rpg = ctoi(cc.rpg, 'revolutionPerVolume', 'rpg');\n\n if (cc.off_bottom_pressure_loss && cc.off_bottom_pressure_loss.length > 0) {\n for (let j = 0; j < cc.off_bottom_pressure_loss.length; j += 1) {\n const item = cc.off_bottom_pressure_loss[j];\n item.flow_rate = ctoi(item.flow_rate, 'volumeFlowRate', 'gal/min');\n item.pressure_loss = ctoi(item.pressure_loss, 'pressure', 'psi');\n }\n }\n if (!cc.has_stabilizer) {\n delete cc.stabilizer;\n }\n if (cc.stabilizer) {\n cc.stabilizer.inner_diameter =\n cc.stabilizer.inner_diameter && ctoi(cc.stabilizer.inner_diameter, 'shortLength', 'in');\n cc.stabilizer.outer_diameter =\n cc.stabilizer.outer_diameter && ctoi(cc.stabilizer.outer_diameter, 'shortLength', 'in');\n cc.stabilizer.linear_weight =\n cc.stabilizer.linear_weight &&\n ctoi(cc.stabilizer.linear_weight, 'massPerLength', 'lb-ft');\n cc.stabilizer.weight = cc.stabilizer.weight && ctoi(cc.stabilizer.weight, 'mass', 'lb');\n cc.stabilizer.length = cc.length && ctoi(cc.stabilizer.length, 'length', 'ft');\n cc.stabilizer.gauge_od =\n cc.stabilizer.gauge_od && ctoi(cc.stabilizer.gauge_od, 'shortLength', 'in');\n cc.stabilizer.gauge_length =\n cc.stabilizer.gauge_length && ctoi(cc.stabilizer.gauge_length, 'shortLength', 'in');\n cc.stabilizer.blade_width =\n cc.stabilizer.blade_width && ctoi(cc.stabilizer.blade_width, 'shortLength', 'in');\n cc.stabilizer.stab_centerpoint_to_bit =\n cc.stabilizer.stab_centerpoint_to_bit &&\n ctoi(cc.stabilizer.stab_centerpoint_to_bit, 'length', 'ft');\n }\n }\n\n if (cc.family === 'stabilizer' || cc.family === 'ags') {\n cc.gauge_od = ctoi(cc.gauge_od, 'shortLength', 'in');\n cc.gauge_length = ctoi(cc.gauge_length, 'shortLength', 'in');\n cc.blade_width = ctoi(cc.blade_width, 'shortLength', 'in');\n }\n\n if (cc.family === 'mwd' || cc.family === 'rss' || cc.family === 'agitator') {\n if (cc.pressure_loss && cc.pressure_loss.length > 0) {\n for (let j = 0; j < cc.pressure_loss.length; j += 1) {\n const item = cc.pressure_loss[j];\n item.flow_rate = ctoi(item.flow_rate, 'volumeFlowRate', 'gal/min');\n item.pressure_loss = ctoi(item.pressure_loss, 'pressure', 'psi');\n }\n }\n }\n\n if (cc.family !== 'bit') {\n delete cc.bit_type;\n }\n if (!cc.has_gamma_sensor && Number.isFinite(cc.gamma_sensor_to_bit_distance)) {\n delete cc.gamma_sensor_to_bit_distance;\n }\n if (!cc.has_survey_sensor && Number.isFinite(cc.bit_to_survey_distance)) {\n delete cc.bit_to_survey_distance;\n }\n if (!cc.has_directional_sensor && Number.isFinite(cc.directional_sensor_to_bit_distance)) {\n delete cc.directional_sensor_to_bit_distance;\n }\n delete cc.c_length;\n return cc;\n });\n\n return {\n ...record,\n data,\n };\n}\n\nexport function ctoi(val, unitType, unit, precision = 2) {\n if (val === null || typeof val === 'undefined') {\n return null;\n }\n if (!unitType || !unit) {\n return parseFloat(val);\n }\n return parseFloat(convertValue(val, unitType, getUnitPreference(unitType), unit, precision));\n}\n\nexport function convertRecordtoPrefUnit(record) {\n const { data } = record.toJS();\n const { components } = data;\n data.start_depth = ctop(data.start_depth, 'length', 'ft');\n\n if (components.length > 0) {\n if (components[0].family === 'bit') {\n components[0].c_length = components[0].length || 0;\n for (let i = 1; i < components.length; i += 1) {\n components[i].c_length =\n parseFloat(components[i - 1].c_length) + parseFloat(components[i].length || 0);\n }\n } else {\n const lastIndex = components.length - 1;\n components[lastIndex].c_length = components[lastIndex].length || 0;\n for (let i = lastIndex - 1; i >= 0; i -= 1) {\n components[i].c_length =\n parseFloat(components[i + 1].c_length) + parseFloat(components[i].length || 0);\n }\n }\n }\n\n for (let i = 0; i < components.length; i += 1) {\n const comp = components[i];\n comp.inner_diameter = ctop(comp.inner_diameter, 'shortLength', 'in');\n comp.outer_diameter = ctop(comp.outer_diameter, 'shortLength', 'in', 4);\n comp.linear_weight = ctop(comp.linear_weight, 'massPerLength', 'lb-ft');\n comp.weight = ctop(comp.weight, 'mass', 'lb');\n comp.length = ctop(comp.length, 'length', 'ft');\n comp.component_length = ctop(comp.component_length, 'length', 'ft');\n comp.outer_diameter_tooljoint = ctop(comp.outer_diameter_tooljoint, 'shortLength', 'in');\n comp.inner_diameter_tooljoint = ctop(comp.inner_diameter_tooljoint, 'shortLength', 'in');\n comp.length_tooljoint = ctop(comp.length_tooljoint, 'length', 'ft');\n\n comp.c_length = ctop(comp.c_length, 'length', 'ft');\n comp.gamma_sensor_to_bit_distance = ctop(comp.gamma_sensor_to_bit_distance, 'length', 'ft');\n\n if (comp.family === 'bit' || comp.family === 'ur') {\n const ratio = ctop(1, 'shortLength', 'in');\n comp.size = ctop(comp.size, 'shortLength', 'in');\n if (comp.nozzle_sizes && comp.nozzle_sizes.length > 0) {\n for (let j = 0; j < comp.nozzle_sizes.length; j += 1) {\n const item = comp.nozzle_sizes[j];\n item.size = ratio !== 1 ? ctop(item.size, 'shortLength', 'in') / 32 : item.size;\n }\n }\n comp.tfa = ratio !== 1 ? comp.tfa * (ratio * ratio) : comp.tfa;\n }\n\n if (comp.family === 'pdm') {\n comp.max_weight_on_bit = ctop(comp.max_weight_on_bit, 'force', 'klbf');\n comp.min_standard_flowrate = ctop(comp.min_standard_flowrate, 'volumeFlowRate', 'gal/min');\n comp.max_standard_flowrate = ctop(comp.max_standard_flowrate, 'volumeFlowRate', 'gal/min');\n comp.max_operating_differential_pressure = ctop(\n comp.max_operating_differential_pressure,\n 'pressure',\n 'psi'\n );\n comp.torque_at_max_operating_differential_pressure = ctop(\n comp.torque_at_max_operating_differential_pressure,\n 'torque',\n 'ft-klbf',\n 3\n );\n if (comp.off_bottom_pressure_loss && comp.off_bottom_pressure_loss.length > 0) {\n for (let j = 0; j < comp.off_bottom_pressure_loss.length; j += 1) {\n const item = comp.off_bottom_pressure_loss[j];\n item.flow_rate = ctop(item.flow_rate, 'volumeFlowRate', 'gal/min');\n item.pressure_loss = ctop(item.pressure_loss, 'pressure', 'psi');\n }\n }\n comp.rpg = ctop(comp.rpg, 'revolutionPerVolume', 'rpg');\n if (comp.has_stabilizer && comp.stabilizer) {\n comp.stabilizer.inner_diameter = ctop(comp.stabilizer.inner_diameter, 'shortLength', 'in');\n comp.stabilizer.outer_diameter = ctop(comp.stabilizer.outer_diameter, 'shortLength', 'in');\n comp.stabilizer.linear_weight = ctop(\n comp.stabilizer.linear_weight,\n 'massPerLength',\n 'lb-ft'\n );\n comp.stabilizer.weight = ctop(comp.stabilizer.weight, 'mass', 'lb');\n comp.stabilizer.length = ctop(comp.stabilizer.length, 'length', 'ft');\n comp.stabilizer.gauge_od = ctop(comp.stabilizer.gauge_od, 'shortLength', 'in');\n comp.stabilizer.gauge_length = ctop(comp.stabilizer.gauge_length, 'shortLength', 'in');\n comp.stabilizer.blade_width = ctop(comp.stabilizer.blade_width, 'shortLength', 'in');\n comp.stabilizer.stab_centerpoint_to_bit = ctop(\n comp.stabilizer.stab_centerpoint_to_bit,\n 'length',\n 'ft'\n );\n }\n }\n\n if (comp.family === 'stabilizer' || comp.family === 'ags') {\n comp.gauge_od = ctop(comp.gauge_od, 'shortLength', 'in');\n comp.gauge_length = ctop(comp.gauge_length, 'shortLength', 'in');\n comp.blade_width = ctop(comp.blade_width, 'shortLength', 'in');\n }\n\n if (comp.family === 'mwd' || comp.family === 'rss' || comp.family === 'agitator') {\n if (comp.pressure_loss && comp.pressure_loss.length > 0) {\n for (let j = 0; j < comp.pressure_loss.length; j += 1) {\n const item = comp.pressure_loss[j];\n item.flow_rate = ctop(item.flow_rate, 'volumeFlowRate', 'gal/min');\n item.pressure_loss = ctop(item.pressure_loss, 'pressure', 'psi');\n }\n }\n }\n }\n return {\n ...record,\n data,\n };\n}\n\nexport function ctop(val, unitType, unit, precision = 2) {\n if (val !== 0 && !val) {\n return null;\n }\n return unitType && unit ? convertValue(val, unitType, unit, null, precision) : val;\n}\n"],"names":["isValidNumber","num","min","max","_ref","arguments","length","undefined","_ref$isMinInclusive","isMinInclusive","parsedNum","parseFloat","Number","isNaN","isValidLinearWeight","id","od","linearWeight","prefShortLengthUnit","getUnitPreference","convertedId","convertedOd","convertValue","estimation","convertedEstimation","ctoi","val","unitType","unit","precision","ctop","record","components","get","reverse","map","comp","idx","_objectSpread","order","set","data","toJS","objStartTime","start_timestamp_str","moment","Date","isValid","start_timestamp","unix","start_depth","component","cc","Object","assign","inner_diameter","outer_diameter","linear_weight","weight","component_length","outer_diameter_tooljoint","inner_diameter_tooljoint","length_tooljoint","family","ratio","size","nozzle_sizes","j","item","tfa","max_weight_on_bit","min_standard_flowrate","max_standard_flowrate","max_operating_differential_pressure","torque_at_max_operating_differential_pressure","rpg","off_bottom_pressure_loss","flow_rate","pressure_loss","has_stabilizer","stabilizer","gauge_od","gauge_length","blade_width","stab_centerpoint_to_bit","bit_type","has_gamma_sensor","isFinite","gamma_sensor_to_bit_distance","has_survey_sensor","bit_to_survey_distance","has_directional_sensor","directional_sensor_to_bit_distance","c_length","i","lastIndex","recordData","_recordData$toJS$data","shortLengthUnitDisplay","getUnitDisplay","lengthUnitDisplay","errors","general","specificErrors","bitComponents","filter","bitSize","mwdHavingGamma","hasFormErrors","isValueEmpty","minDepth","maxDepth","prohibitedDepth","concat","toFixed","min_id","min_od","max_id","max_od","min_opened_od","max_opened_od","min_length","min_tj_id","max_tj_id","min_tj_od","max_tj_od","min_pressure_loss","min_off_bottom_pressure_loss","min_rd","max_rd","error","ur_opened_od","obpsItem","pressureLossItem","stab_min_id","stab_max_id","stab_min_od","stab_max_od","stab_min_length","stabilizer_outer_diameter","stabilizer_inner_diameter","stabilizer_length","stabilizer_linear_weight","reel_diameter","lowerLimit","upperLimit","flow_loss_percentage","pdmFieldUnitLower","pdmFieldUnitUpper","number_rotor_lobes","number_stator_lobes","bit_count","bit_position"],"mappings":"w4BA0HO,SA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B,GAGlBuC,EAAoB7H,EAAAA,aA5jBJ,EA4jBgC,SAAU,WAC1D8H,EAAoB9H,EAAAA,aA5jBJ,GA4jBgC,SAAU,WAEvDtB,EACCoC,EAAKsC,8CACLyE,EACAC,KAGFlB,EAAMxD,8CAA6C,cAAAuC,OAAiBkC,EAAkBjC,QACpF,GACD,KAAAD,OAAImC,EAAkBlC,QAAQ,IAC/BN,GAAgB,GAGb5G,EAAcoC,EAAK8G,qBAzkBJ,EACA,MAykBlBhB,EAAMgB,qBAAoB,cAAAjC,OA1kBR,EA0kB0C,KAAAA,OAzkB1C,IA0kBlBL,GAAgB,EAEpB,CAEAP,EAAOrE,WAAWI,EAAKrB,IAAMmH,CAC/B,CAiBA,OAf6B,IAAzB1B,EAAclG,SAChB+F,EAAOC,QAAQiD,UAAY,yCAC3B3C,GAAgB,GAIS,IAAzBJ,EAAclG,QAC+B,QAA7C0B,EAAWA,EAAW1B,OAAS,GAAGyD,QACT,QAAzB/B,EAAW,GAAG+B,SAGdsC,EAAOC,QAAQkD,aAAe,sDAC9B5C,GAAgB,GAGdA,EACKP,EAEF,IACT"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/defineProperty"),a=require("@babel/runtime/regenerator"),n=require("lodash/get"),i=require("lodash/maxBy"),o=require("./convert.js"),u=require("../clients/jsonApi/index.js"),l=require("../constants/bha.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(e),b=s(r),p=s(t),f=s(a),N=s(n),m=s(i);function d(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function h(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?d(Object(t),!0).forEach((function(r){p.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var v,E=function(e,r,t,a){var n=e;return!function(e){return e&&-1!==e}(a)?null!=r&&r.company_id&&(n=h({company_id:r.company_id},n)):n=h({company_id:a},n),t&&(n["data.well_sections"]={$in:t}),n},I=(v=b.default(f.default.mark((function e(r,t){var a,n,i,o;return f.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((a=r.map((function(e){var r=Number(e._id),a=e.bha_ids||[];return E({asset_id:r,"data.id":{$in:a}},e,null,t)}))).length){e.next=3;break}return e.abrupt("return",[]);case 3:return n=a.length>1?{$or:a}:a[0],i={aggregate:JSON.stringify([{$match:n},{$limit:1e4}])},o=[],e.prev=7,e.next=10,u.getAppStorage(l.COLLECTIONS.drillstring.provider,l.COLLECTIONS.drillstring.collection,null,i);case 10:o=e.sent,e.next=16;break;case 13:e.prev=13,e.t0=e.catch(7),o=[];case 16:return e.abrupt("return",o);case 17:case"end":return e.stop()}}),e,null,[[7,13]])}))),function(e,r){return v.apply(this,arguments)}),S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=Object.values(l.BHA_FAMILY),t=!1,a=e.reduce((function(e,a){var n=a.family,i=a.material;if(t||r.includes(n)||i===l.NON_MAGNETIC_TYPE){if(t=!0,r.includes(n)){var o={family:n,bitType:n===l.BHA_FAMILY.bit?a.bit_type:""};return e.push(o),e}return e.length&&"other"===e[e.length-1].family||e.push({family:"other",bitType:""}),e}return e}),[]);return a},g=function(e,r){return parseFloat(parseFloat(e).toFixed(r)).toString()};exports.calculateBHALengthMax=function(e){var r;if(!e.length)return 0;var t=(null===(r=m.default(e,(function(e){var r,t=(null===(r=e.data)||void 0===r?void 0:r.components)||[];return S(t).reduce((function(e,r){var t=r.family;return t===l.BHA_FAMILY.rss||t===l.BHA_FAMILY.pdm?e+2:Object.values(l.BHA_FAMILY).includes(t)?e:e+1}),0)})).data)||void 0===r?void 0:r.components)||[];return S(t).reduce((function(e,r){var t=r.family;return t===l.BHA_FAMILY.rss||t===l.BHA_FAMILY.pdm?e+2:Object.values(l.BHA_FAMILY).includes(t)?e:e+1}),0)},exports.getBHAInformation=function(e,r,t){var a=t.filter((function(t){var a;return t.asset_id===e&&(null===(a=t.data)||void 0===a?void 0:a.id)===r}));return a.length>0?a[0]:[]},exports.getBHASchematic=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=[];return e.forEach((function(e){var t=e.family,a=e.material,n=e.stabilizer;["bit","pdm","rss","stabilizer","ur"].includes(t)?r.push({family:t,hasStabilizer:!!n,bitType:N.default(e,"bit_type")}):"Non Magnetic"!==a||0!==r.length&&r.slice(-1)[0].material===a||r.push({family:"other",material:a})})),r},exports.getBhaBitSize=function(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t="shortLength",a=null===(e=r.find((function(e){return"bit"===e.family})))||void 0===e?void 0:e.size,n=a?"".concat(Math.round(1e3*a)/1e3):a,i=o.convertValue(n,t,"in")||"-",u=o.getUnitDisplay(t);return"".concat(i," ").concat(u)},exports.getBhaDepthIn=function(e){var r=Number.isFinite(e)?o.convertValue(e,"length","ft",null,3):0;return"".concat(r," ").concat(o.getUnitDisplay("length"))},exports.getErrors=function(e,r,t){var a="inc"===t?l.MAX_INC_LIMIT:parseInt(o.convertValue(l.MAX_DEPTH_LIMIT,"length","ft"),10),n=[e,r].reduce((function(e,r){var n;return n=Number.isFinite(r)?a>=r?null:function(e){var r="inc"===e?l.MAX_INC_LIMIT:parseInt(o.convertValue(l.MAX_DEPTH_LIMIT,"length","ft"),10);return"Must be within 0 ~ ".concat(r)}(t):"Invalid value",e.concat([n])}),[]),i=c.default(n,2),u=i[0],s=i[1];return Number.isFinite(e)&&Number.isFinite(r)&&e>=r?["Should be less than max value","Should be greater than min value"]:[u,s]},exports.getUnitConvertedValue=function(e,r){var t;switch(r){case l.PERCENTILE_KEYS.ropRotary:case l.PERCENTILE_KEYS.ropSlide:case l.METRICS_KEYS.netROP:case l.METRICS_KEYS.ropRotary:case l.METRICS_KEYS.ropSlide:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"velocity","ft/h"));break;case l.METRICS_KEYS.distance:case l.METRICS_KEYS.holeDepth:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"length","ft"));break;case l.DRILLSTRING_KEYS.bitToBend:case l.DRILLSTRING_KEYS.hwdpLength:case l.METRICS_KEYS.rotaryFootage:case l.METRICS_KEYS.slideFootage:t=Number.isNaN(Number.parseFloat(e))?e:parseFloat(o.convertValue(e,"length","ft")).fixFloat(2);break;case l.METRICS_KEYS.turnRate:case l.METRICS_KEYS.buildRate:t=Number.isNaN(Number.parseFloat(e))?e:parseFloat(o.convertValue(e,"anglePerLength","dp100f")).toFixed(2);break;case l.METRICS_KEYS.onBottomTime:case l.METRICS_KEYS.totalTime:t=Number.isNaN(Number.parseFloat(e))?e:parseFloat(e).toFixed(2);break;case l.PERCENTILE_KEYS.mse:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"msePressure","psi"));break;case l.PERCENTILE_KEYS.wob:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"force","klbf"));break;case l.PERCENTILE_KEYS.diffPressure:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"pressure","psi"));break;case l.PERCENTILE_KEYS.flowIn:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"volumeFlowRate","gal/min"));break;case l.DRILLSTRING_KEYS.tfa:t=Number.isNaN(parseFloat(e))?e:parseFloat(e).fixFloat(2);break;case l.DRILLSTRING_KEYS.holeSize:t=Number.isNaN(Number.parseFloat(e))?e:g(o.convertValue(e,"shortLength","in"),3);break;case l.DRILLSTRING_KEYS.motorSize:t=Number.isNaN(Number.parseFloat(e))?e:g(o.convertValue(e,"shortLength","in"),2);break;case l.MOTOR_CONFIG.outer_diameter:t=Number.isNaN(Number.parseFloat(e))?e:g(o.convertValue(e,"shortLength","in"),1);break;case l.DRILLSTRING_KEYS.motorBend:t=Number.isNaN(Number.parseFloat(e))?e:g(e,2);break;default:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(e)}return t},exports.loadDrillStringData=I,exports.removeZero=g;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/defineProperty"),a=require("@babel/runtime/regenerator"),n=require("lodash/get"),i=require("lodash/maxBy"),o=require("./convert.js"),u=require("../clients/jsonApi/index.js"),l=require("../constants/bha.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(e),b=s(r),p=s(t),f=s(a),N=s(n),m=s(i);function d(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function h(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?d(Object(t),!0).forEach((function(r){p.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var v,E=function(e,r,t,a){var n=e;return!function(e){return e&&-1!==e}(a)?null!=r&&r.company_id&&(n=h({company_id:r.company_id},n)):n=h({company_id:a},n),t&&(n["data.well_sections"]={$in:t}),n},g=(v=b.default(f.default.mark((function e(r,t){var a,n,i,o;return f.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((a=r.map((function(e){var r=Number(e._id),a=e.bha_ids||[];return E({asset_id:r,"data.id":{$in:a}},e,null,t)}))).length){e.next=3;break}return e.abrupt("return",[]);case 3:return n=a.length>1?{$or:a}:a[0],i={aggregate:JSON.stringify([{$match:n},{$limit:1e4}])},o=[],e.prev=7,e.next=10,u.getAppStorage(l.COLLECTIONS.drillstring.provider,l.COLLECTIONS.drillstring.collection,null,i);case 10:o=e.sent,e.next=16;break;case 13:e.prev=13,e.t0=e.catch(7),o=[];case 16:return e.abrupt("return",o);case 17:case"end":return e.stop()}}),e,null,[[7,13]])}))),function(e,r){return v.apply(this,arguments)}),I=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=Object.values(l.BHA_FAMILY),t=!1,a=e.reduce((function(e,a){var n=a.family,i=a.material;if(t||r.includes(n)||i===l.NON_MAGNETIC_TYPE){if(t=!0,r.includes(n)){var o={family:n,bitType:n===l.BHA_FAMILY.bit?a.bit_type:""};return e.push(o),e}return e.length&&"other"===e[e.length-1].family||e.push({family:"other",bitType:""}),e}return e}),[]);return a},S=function(e,r){return parseFloat(parseFloat(e).toFixed(r)).toString()};exports.calculateBHALengthMax=function(e){var r;if(!e.length)return 0;var t=(null===(r=m.default(e,(function(e){var r,t=(null===(r=e.data)||void 0===r?void 0:r.components)||[];return I(t).reduce((function(e,r){var t=r.family;return t===l.BHA_FAMILY.rss||t===l.BHA_FAMILY.pdm?e+2:Object.values(l.BHA_FAMILY).includes(t)?e:e+1}),0)})).data)||void 0===r?void 0:r.components)||[];return I(t).reduce((function(e,r){var t=r.family;return t===l.BHA_FAMILY.rss||t===l.BHA_FAMILY.pdm?e+2:Object.values(l.BHA_FAMILY).includes(t)?e:e+1}),0)},exports.getBHAInformation=function(e,r,t){var a=t.filter((function(t){var a;return t.asset_id===e&&(null===(a=t.data)||void 0===a?void 0:a.id)===r}));return a.length>0?a[0]:[]},exports.getBHASchematic=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=[];return e.forEach((function(e){var t=e.family,a=e.material,n=e.stabilizer;["bit","pdm","rss","stabilizer","ags","ur"].includes(t)?r.push({family:t,hasStabilizer:!!n,bitType:N.default(e,"bit_type")}):"Non Magnetic"!==a||0!==r.length&&r.slice(-1)[0].material===a||r.push({family:"other",material:a})})),r},exports.getBhaBitSize=function(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t="shortLength",a=null===(e=r.find((function(e){return"bit"===e.family})))||void 0===e?void 0:e.size,n=a?"".concat(Math.round(1e3*a)/1e3):a,i=o.convertValue(n,t,"in")||"-",u=o.getUnitDisplay(t);return"".concat(i," ").concat(u)},exports.getBhaDepthIn=function(e){var r=Number.isFinite(e)?o.convertValue(e,"length","ft",null,3):0;return"".concat(r," ").concat(o.getUnitDisplay("length"))},exports.getErrors=function(e,r,t){var a="inc"===t?l.MAX_INC_LIMIT:parseInt(o.convertValue(l.MAX_DEPTH_LIMIT,"length","ft"),10),n=[e,r].reduce((function(e,r){var n;return n=Number.isFinite(r)?a>=r?null:function(e){var r="inc"===e?l.MAX_INC_LIMIT:parseInt(o.convertValue(l.MAX_DEPTH_LIMIT,"length","ft"),10);return"Must be within 0 ~ ".concat(r)}(t):"Invalid value",e.concat([n])}),[]),i=c.default(n,2),u=i[0],s=i[1];return Number.isFinite(e)&&Number.isFinite(r)&&e>=r?["Should be less than max value","Should be greater than min value"]:[u,s]},exports.getUnitConvertedValue=function(e,r){var t;switch(r){case l.PERCENTILE_KEYS.ropRotary:case l.PERCENTILE_KEYS.ropSlide:case l.METRICS_KEYS.netROP:case l.METRICS_KEYS.ropRotary:case l.METRICS_KEYS.ropSlide:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"velocity","ft/h"));break;case l.METRICS_KEYS.distance:case l.METRICS_KEYS.holeDepth:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"length","ft"));break;case l.DRILLSTRING_KEYS.bitToBend:case l.DRILLSTRING_KEYS.hwdpLength:case l.METRICS_KEYS.rotaryFootage:case l.METRICS_KEYS.slideFootage:t=Number.isNaN(Number.parseFloat(e))?e:parseFloat(o.convertValue(e,"length","ft")).fixFloat(2);break;case l.METRICS_KEYS.turnRate:case l.METRICS_KEYS.buildRate:t=Number.isNaN(Number.parseFloat(e))?e:parseFloat(o.convertValue(e,"anglePerLength","dp100f")).toFixed(2);break;case l.METRICS_KEYS.onBottomTime:case l.METRICS_KEYS.totalTime:t=Number.isNaN(Number.parseFloat(e))?e:parseFloat(e).toFixed(2);break;case l.PERCENTILE_KEYS.mse:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"msePressure","psi"));break;case l.PERCENTILE_KEYS.wob:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"force","klbf"));break;case l.PERCENTILE_KEYS.diffPressure:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"pressure","psi"));break;case l.PERCENTILE_KEYS.flowIn:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(o.convertValue(e,"volumeFlowRate","gal/min"));break;case l.DRILLSTRING_KEYS.tfa:t=Number.isNaN(parseFloat(e))?e:parseFloat(e).fixFloat(2);break;case l.DRILLSTRING_KEYS.holeSize:t=Number.isNaN(Number.parseFloat(e))?e:S(o.convertValue(e,"shortLength","in"),3);break;case l.DRILLSTRING_KEYS.motorSize:t=Number.isNaN(Number.parseFloat(e))?e:S(o.convertValue(e,"shortLength","in"),2);break;case l.MOTOR_CONFIG.outer_diameter:t=Number.isNaN(Number.parseFloat(e))?e:S(o.convertValue(e,"shortLength","in"),1);break;case l.DRILLSTRING_KEYS.motorBend:t=Number.isNaN(Number.parseFloat(e))?e:S(e,2);break;default:t=Number.isNaN(Number.parseFloat(e))?e:Math.floor(e)}return t},exports.loadDrillStringData=g,exports.removeZero=S;
2
2
  //# sourceMappingURL=bha.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bha.js","sources":["../../../src/utils/bha.js"],"sourcesContent":["import get from 'lodash/get';\nimport maxBy from 'lodash/maxBy';\n\nimport { getUnitDisplay, convertValue } from '~/utils/convert';\nimport { getAppStorage } from '~/clients/jsonApi';\nimport {\n METRICS_KEYS,\n DRILLSTRING_KEYS,\n BHA_FAMILY,\n MOTOR_CONFIG,\n PERCENTILE_KEYS,\n NON_MAGNETIC_TYPE,\n COLLECTIONS,\n MAX_DEPTH_LIMIT,\n MAX_INC_LIMIT,\n} from '~/constants/bha';\n\nconst PDM_COUNT_UNIT = 2;\nconst OTHER_COUNT_UNIT = 1;\nconst ALL_COMPANY_ID = -1;\n\nconst isNotAllCompany = companyId => companyId && companyId !== ALL_COMPANY_ID;\n\nexport const getBHAInformation = (assetId, bhaId, drillStringData) => {\n const dataInDrillString = drillStringData.filter(\n item => item.asset_id === assetId && item.data?.id === bhaId\n );\n\n if (dataInDrillString.length > 0) {\n return dataInDrillString[0];\n }\n return [];\n};\n\n/**\n * Drillstring/BHA bit size calculator\n * @param {array} components - list of components\n * @return {number} - bit size\n */\nexport const getBhaBitSize = (components = []) => {\n const fieldName = 'shortLength';\n const bitSize = components.find(c => c.family === 'bit')?.size;\n\n const roundedBitSize = bitSize ? `${Math.round(bitSize * 1000) / 1000}` : bitSize;\n\n const adjustedBitSize = convertValue(roundedBitSize, fieldName, 'in') || '-';\n const bitSizeUnit = getUnitDisplay(fieldName);\n\n return `${adjustedBitSize} ${bitSizeUnit}`;\n};\n\nexport const getBhaDepthIn = startDepth => {\n const adjustedDepth = Number.isFinite(startDepth)\n ? convertValue(startDepth, 'length', 'ft', null, 3)\n : 0;\n return `${adjustedDepth} ${getUnitDisplay('length')}`;\n};\n\n// IMPORTANT: Added company_id\nconst updateQuery = (query, item, selectedSectionNames, companyId) => {\n let updatedQuery = query;\n\n if (isNotAllCompany(companyId)) {\n updatedQuery = {\n company_id: companyId,\n ...updatedQuery,\n };\n } else if (item?.company_id) {\n updatedQuery = {\n company_id: item.company_id,\n ...updatedQuery,\n };\n }\n\n if (selectedSectionNames) {\n updatedQuery['data.well_sections'] = { $in: selectedSectionNames };\n }\n\n return updatedQuery;\n};\n\n// NOTE: Load data from drillstring collection for list view\nexport const loadDrillStringData = async (curBHAandWellIds, companyId) => {\n // NOTE: Produce the query\n const queryCombined = curBHAandWellIds.map(item => {\n const assetId = Number(item._id); // eslint-disable-line no-underscore-dangle\n const bhaIds = item.bha_ids || [];\n\n const query = {\n asset_id: assetId,\n 'data.id': { $in: bhaIds },\n };\n\n return updateQuery(query, item, null, companyId);\n });\n\n if (!queryCombined.length) return [];\n\n const $match = queryCombined.length > 1 ? { $or: queryCombined } : queryCombined[0];\n const $limit = 10000;\n\n const queryJson = {\n aggregate: JSON.stringify([{ $match }, { $limit }]),\n };\n\n let drillStringData = [];\n try {\n drillStringData = await getAppStorage(\n COLLECTIONS.drillstring.provider,\n COLLECTIONS.drillstring.collection,\n null,\n queryJson\n );\n } catch (e) {\n drillStringData = [];\n }\n\n return drillStringData;\n};\n\nconst calculateBHAComponentDetails = (components = []) => {\n const bhaFamilyValues = Object.values(BHA_FAMILY);\n let passed = false;\n\n const distList = components.reduce((result, item) => {\n const { family, material } = item;\n\n if (passed || bhaFamilyValues.includes(family) || material === NON_MAGNETIC_TYPE) {\n passed = true;\n\n if (bhaFamilyValues.includes(family)) {\n const categoryInfo = {\n family,\n bitType: family === BHA_FAMILY.bit ? item.bit_type : '',\n };\n\n result.push(categoryInfo);\n\n return result;\n }\n\n const otherInfo = {\n family: 'other',\n bitType: '',\n };\n\n if (!result.length || result[result.length - 1].family !== 'other') result.push(otherInfo);\n\n return result;\n }\n\n return result;\n }, []);\n\n return distList;\n};\n\nexport const calculateBHALengthMax = drillStringData => {\n if (!drillStringData.length) {\n return 0;\n }\n\n // NOTE: BHA = bit + pdm + stabilizer (in this app)\n const maxRecord = maxBy(drillStringData, drillstringRecord => {\n const components = drillstringRecord.data?.components || [];\n\n const componentDetails = calculateBHAComponentDetails(components);\n\n return componentDetails.reduce((result, record) => {\n const { family } = record;\n if (family === BHA_FAMILY.rss || family === BHA_FAMILY.pdm) {\n return result + PDM_COUNT_UNIT;\n } else if (!Object.values(BHA_FAMILY).includes(family)) {\n return result + OTHER_COUNT_UNIT;\n }\n return result;\n }, 0);\n });\n\n // NOTE: Calculate the length\n const maxLengthComponent = maxRecord.data?.components || [];\n const maxLength = calculateBHAComponentDetails(maxLengthComponent).reduce((result, record) => {\n const { family } = record;\n if (family === BHA_FAMILY.rss || family === BHA_FAMILY.pdm) {\n return result + PDM_COUNT_UNIT;\n } else if (!Object.values(BHA_FAMILY).includes(family)) {\n return result + OTHER_COUNT_UNIT;\n }\n return result;\n }, 0);\n return maxLength;\n};\n\n// NOTE: Remove unnecessary 0\nexport const removeZero = (value, decimals) => {\n return parseFloat(parseFloat(value).toFixed(decimals)).toString();\n};\n\nexport const getUnitConvertedValue = (value, key) => {\n let convertedValue;\n\n switch (key) {\n case PERCENTILE_KEYS.ropRotary:\n case PERCENTILE_KEYS.ropSlide:\n case METRICS_KEYS.netROP:\n case METRICS_KEYS.ropRotary:\n case METRICS_KEYS.ropSlide:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'velocity', 'ft/h'))\n : value;\n break;\n case METRICS_KEYS.distance:\n case METRICS_KEYS.holeDepth:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'length', 'ft'))\n : value;\n break;\n case DRILLSTRING_KEYS.bitToBend:\n case DRILLSTRING_KEYS.hwdpLength:\n case METRICS_KEYS.rotaryFootage:\n case METRICS_KEYS.slideFootage:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? parseFloat(convertValue(value, 'length', 'ft')).fixFloat(2)\n : value;\n break;\n case METRICS_KEYS.turnRate:\n case METRICS_KEYS.buildRate:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? parseFloat(convertValue(value, 'anglePerLength', 'dp100f')).toFixed(2)\n : value;\n break;\n case METRICS_KEYS.onBottomTime:\n case METRICS_KEYS.totalTime:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? parseFloat(value).toFixed(2)\n : value;\n break;\n case PERCENTILE_KEYS.mse:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'msePressure', 'psi'))\n : value;\n break;\n case PERCENTILE_KEYS.wob:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'force', 'klbf'))\n : value;\n break;\n case PERCENTILE_KEYS.diffPressure:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'pressure', 'psi'))\n : value;\n break;\n case PERCENTILE_KEYS.flowIn:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'volumeFlowRate', 'gal/min'))\n : value;\n break;\n case DRILLSTRING_KEYS.tfa:\n convertedValue = !Number.isNaN(parseFloat(value)) ? parseFloat(value).fixFloat(2) : value;\n break;\n case DRILLSTRING_KEYS.holeSize:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? removeZero(convertValue(value, 'shortLength', 'in'), 3)\n : value;\n break;\n case DRILLSTRING_KEYS.motorSize:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? removeZero(convertValue(value, 'shortLength', 'in'), 2)\n : value;\n break;\n case MOTOR_CONFIG.outer_diameter:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? removeZero(convertValue(value, 'shortLength', 'in'), 1)\n : value;\n break;\n case DRILLSTRING_KEYS.motorBend:\n convertedValue = !Number.isNaN(Number.parseFloat(value)) ? removeZero(value, 2) : value;\n break;\n default:\n convertedValue = !Number.isNaN(Number.parseFloat(value)) ? Math.floor(value) : value;\n }\n return convertedValue;\n};\n\n// NOTE: Get error text when inputted value exceeds max limit\nconst getLimitErrorText = incOrDepth => {\n const maxLimit =\n incOrDepth === 'inc'\n ? MAX_INC_LIMIT\n : parseInt(convertValue(MAX_DEPTH_LIMIT, 'length', 'ft'), 10);\n\n return `Must be within 0 ~ ${maxLimit}`;\n};\n\nexport const getErrors = (minValue, maxValue, incOrDepth) => {\n const maxLimit =\n incOrDepth === 'inc'\n ? MAX_INC_LIMIT\n : parseInt(convertValue(MAX_DEPTH_LIMIT, 'length', 'ft'), 10);\n\n const [errorTextForMin, errorTextForMax] = [minValue, maxValue].reduce((result, value) => {\n let errorText;\n if (Number.isFinite(value)) {\n errorText = maxLimit >= value ? null : getLimitErrorText(incOrDepth);\n } else {\n errorText = 'Invalid value';\n }\n return result.concat([errorText]);\n }, []);\n\n if (Number.isFinite(minValue) && Number.isFinite(maxValue) && minValue >= maxValue) {\n return ['Should be less than max value', 'Should be greater than min value'];\n }\n\n return [errorTextForMin, errorTextForMax];\n};\n\nexport const getBHASchematic = (components = []) => {\n const schematic = [];\n\n components.forEach(component => {\n const { family, material, stabilizer } = component;\n if (['bit', 'pdm', 'rss', 'stabilizer', 'ur'].includes(family)) {\n schematic.push({\n family,\n hasStabilizer: !!stabilizer,\n bitType: get(component, 'bit_type'),\n });\n } else if (\n material === 'Non Magnetic' &&\n (schematic.length === 0 || schematic.slice(-1)[0].material !== material)\n ) {\n schematic.push({\n family: 'other',\n material,\n });\n }\n });\n\n return schematic;\n};\n"],"names":["_ref","updateQuery","query","item","selectedSectionNames","companyId","updatedQuery","isNotAllCompany","company_id","_objectSpread","$in","loadDrillStringData","_asyncToGenerator","_regeneratorRuntime","mark","_callee","curBHAandWellIds","queryCombined","$match","queryJson","drillStringData","wrap","_context","prev","next","map","assetId","Number","_id","bhaIds","bha_ids","asset_id","length","abrupt","$or","aggregate","JSON","stringify","$limit","getAppStorage","COLLECTIONS","drillstring","provider","collection","sent","t0","stop","_x","_x2","apply","this","arguments","calculateBHAComponentDetails","components","bhaFamilyValues","Object","values","BHA_FAMILY","passed","distList","reduce","result","family","material","includes","NON_MAGNETIC_TYPE","categoryInfo","bitType","bit","bit_type","push","removeZero","value","decimals","parseFloat","toFixed","toString","_maxRecord$data","maxLengthComponent","maxBy","drillstringRecord","_drillstringRecord$da","data","record","rss","pdm","bhaId","dataInDrillString","filter","_item$data","id","schematic","forEach","component","stabilizer","hasStabilizer","get","slice","_components$find","fieldName","bitSize","find","c","size","roundedBitSize","concat","Math","round","adjustedBitSize","convertValue","bitSizeUnit","getUnitDisplay","startDepth","adjustedDepth","isFinite","minValue","maxValue","incOrDepth","maxLimit","MAX_INC_LIMIT","parseInt","MAX_DEPTH_LIMIT","_reduce","errorText","getLimitErrorText","_reduce2","_slicedToArray","errorTextForMin","errorTextForMax","key","convertedValue","PERCENTILE_KEYS","ropRotary","ropSlide","METRICS_KEYS","netROP","isNaN","floor","distance","holeDepth","DRILLSTRING_KEYS","bitToBend","hwdpLength","rotaryFootage","slideFootage","fixFloat","turnRate","buildRate","onBottomTime","totalTime","mse","wob","diffPressure","flowIn","tfa","holeSize","motorSize","MOTOR_CONFIG","outer_diameter","motorBend"],"mappings":"6lCAiBA,IAiEmCA,EAvB7BC,EAAc,SAACC,EAAOC,EAAMC,EAAsBC,GACtD,IAAIC,EAAeJ,EAkBnB,OAzDsB,SAAAG,GAAS,OAAIA,IAFd,IAE2BA,CAA4B,CAyCxEE,CAAgBF,GAKTF,SAAAA,EAAMK,aACfF,EAAYG,EAAA,CACVD,WAAYL,EAAKK,YACdF,IAPLA,EAAYG,EAAA,CACVD,WAAYH,GACTC,GASHF,IACFE,EAAa,sBAAwB,CAAEI,IAAKN,IAGvCE,CACT,EAGaK,GAAsBX,EAAAY,EAAAA,QAAAC,EAAA,QAAAC,MAAA,SAAAC,EAAOC,EAAkBX,GAAS,IAAAY,EAAAC,EAAAC,EAAAC,EAAA,OAAAP,UAAAQ,MAAA,SAAAC,GAAA,OAAA,OAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAYjE,IAVIP,EAAgBD,EAAiBS,KAAI,SAAAtB,GACzC,IAAMuB,EAAUC,OAAOxB,EAAKyB,KACtBC,EAAS1B,EAAK2B,SAAW,GAO/B,OAAO7B,EALO,CACZ8B,SAAUL,EACV,UAAW,CAAEhB,IAAKmB,IAGM1B,EAAM,KAAME,EACxC,KAEmB2B,OAAM,C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B,EAAkBvG,OAAO6G,MAAM7G,OAAO+C,WAAWF,IAE7CA,EADAD,EAAWsC,EAAYA,aAACrC,EAAO,cAAe,MAAO,GAEzD,MACF,KAAKoE,EAAgBA,iBAACmB,UACpB7B,EAAkBvG,OAAO6G,MAAM7G,OAAO+C,WAAWF,IAAiCA,EAAvBD,EAAWC,EAAO,GAC7E,MACF,QACE0D,EAAkBvG,OAAO6G,MAAM7G,OAAO+C,WAAWF,IAA8BA,EAApBkC,KAAK+B,MAAMjE,GAE1E,OAAO0D,CACT"}
1
+ {"version":3,"file":"bha.js","sources":["../../../src/utils/bha.js"],"sourcesContent":["import get from 'lodash/get';\nimport maxBy from 'lodash/maxBy';\n\nimport { getUnitDisplay, convertValue } from '~/utils/convert';\nimport { getAppStorage } from '~/clients/jsonApi';\nimport {\n METRICS_KEYS,\n DRILLSTRING_KEYS,\n BHA_FAMILY,\n MOTOR_CONFIG,\n PERCENTILE_KEYS,\n NON_MAGNETIC_TYPE,\n COLLECTIONS,\n MAX_DEPTH_LIMIT,\n MAX_INC_LIMIT,\n} from '~/constants/bha';\n\nconst PDM_COUNT_UNIT = 2;\nconst OTHER_COUNT_UNIT = 1;\nconst ALL_COMPANY_ID = -1;\n\nconst isNotAllCompany = companyId => companyId && companyId !== ALL_COMPANY_ID;\n\nexport const getBHAInformation = (assetId, bhaId, drillStringData) => {\n const dataInDrillString = drillStringData.filter(\n item => item.asset_id === assetId && item.data?.id === bhaId\n );\n\n if (dataInDrillString.length > 0) {\n return dataInDrillString[0];\n }\n return [];\n};\n\n/**\n * Drillstring/BHA bit size calculator\n * @param {array} components - list of components\n * @return {number} - bit size\n */\nexport const getBhaBitSize = (components = []) => {\n const fieldName = 'shortLength';\n const bitSize = components.find(c => c.family === 'bit')?.size;\n\n const roundedBitSize = bitSize ? `${Math.round(bitSize * 1000) / 1000}` : bitSize;\n\n const adjustedBitSize = convertValue(roundedBitSize, fieldName, 'in') || '-';\n const bitSizeUnit = getUnitDisplay(fieldName);\n\n return `${adjustedBitSize} ${bitSizeUnit}`;\n};\n\nexport const getBhaDepthIn = startDepth => {\n const adjustedDepth = Number.isFinite(startDepth)\n ? convertValue(startDepth, 'length', 'ft', null, 3)\n : 0;\n return `${adjustedDepth} ${getUnitDisplay('length')}`;\n};\n\n// IMPORTANT: Added company_id\nconst updateQuery = (query, item, selectedSectionNames, companyId) => {\n let updatedQuery = query;\n\n if (isNotAllCompany(companyId)) {\n updatedQuery = {\n company_id: companyId,\n ...updatedQuery,\n };\n } else if (item?.company_id) {\n updatedQuery = {\n company_id: item.company_id,\n ...updatedQuery,\n };\n }\n\n if (selectedSectionNames) {\n updatedQuery['data.well_sections'] = { $in: selectedSectionNames };\n }\n\n return updatedQuery;\n};\n\n// NOTE: Load data from drillstring collection for list view\nexport const loadDrillStringData = async (curBHAandWellIds, companyId) => {\n // NOTE: Produce the query\n const queryCombined = curBHAandWellIds.map(item => {\n const assetId = Number(item._id); // eslint-disable-line no-underscore-dangle\n const bhaIds = item.bha_ids || [];\n\n const query = {\n asset_id: assetId,\n 'data.id': { $in: bhaIds },\n };\n\n return updateQuery(query, item, null, companyId);\n });\n\n if (!queryCombined.length) return [];\n\n const $match = queryCombined.length > 1 ? { $or: queryCombined } : queryCombined[0];\n const $limit = 10000;\n\n const queryJson = {\n aggregate: JSON.stringify([{ $match }, { $limit }]),\n };\n\n let drillStringData = [];\n try {\n drillStringData = await getAppStorage(\n COLLECTIONS.drillstring.provider,\n COLLECTIONS.drillstring.collection,\n null,\n queryJson\n );\n } catch (e) {\n drillStringData = [];\n }\n\n return drillStringData;\n};\n\nconst calculateBHAComponentDetails = (components = []) => {\n const bhaFamilyValues = Object.values(BHA_FAMILY);\n let passed = false;\n\n const distList = components.reduce((result, item) => {\n const { family, material } = item;\n\n if (passed || bhaFamilyValues.includes(family) || material === NON_MAGNETIC_TYPE) {\n passed = true;\n\n if (bhaFamilyValues.includes(family)) {\n const categoryInfo = {\n family,\n bitType: family === BHA_FAMILY.bit ? item.bit_type : '',\n };\n\n result.push(categoryInfo);\n\n return result;\n }\n\n const otherInfo = {\n family: 'other',\n bitType: '',\n };\n\n if (!result.length || result[result.length - 1].family !== 'other') result.push(otherInfo);\n\n return result;\n }\n\n return result;\n }, []);\n\n return distList;\n};\n\nexport const calculateBHALengthMax = drillStringData => {\n if (!drillStringData.length) {\n return 0;\n }\n\n // NOTE: BHA = bit + pdm + stabilizer (in this app)\n const maxRecord = maxBy(drillStringData, drillstringRecord => {\n const components = drillstringRecord.data?.components || [];\n\n const componentDetails = calculateBHAComponentDetails(components);\n\n return componentDetails.reduce((result, record) => {\n const { family } = record;\n if (family === BHA_FAMILY.rss || family === BHA_FAMILY.pdm) {\n return result + PDM_COUNT_UNIT;\n } else if (!Object.values(BHA_FAMILY).includes(family)) {\n return result + OTHER_COUNT_UNIT;\n }\n return result;\n }, 0);\n });\n\n // NOTE: Calculate the length\n const maxLengthComponent = maxRecord.data?.components || [];\n const maxLength = calculateBHAComponentDetails(maxLengthComponent).reduce((result, record) => {\n const { family } = record;\n if (family === BHA_FAMILY.rss || family === BHA_FAMILY.pdm) {\n return result + PDM_COUNT_UNIT;\n } else if (!Object.values(BHA_FAMILY).includes(family)) {\n return result + OTHER_COUNT_UNIT;\n }\n return result;\n }, 0);\n return maxLength;\n};\n\n// NOTE: Remove unnecessary 0\nexport const removeZero = (value, decimals) => {\n return parseFloat(parseFloat(value).toFixed(decimals)).toString();\n};\n\nexport const getUnitConvertedValue = (value, key) => {\n let convertedValue;\n\n switch (key) {\n case PERCENTILE_KEYS.ropRotary:\n case PERCENTILE_KEYS.ropSlide:\n case METRICS_KEYS.netROP:\n case METRICS_KEYS.ropRotary:\n case METRICS_KEYS.ropSlide:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'velocity', 'ft/h'))\n : value;\n break;\n case METRICS_KEYS.distance:\n case METRICS_KEYS.holeDepth:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'length', 'ft'))\n : value;\n break;\n case DRILLSTRING_KEYS.bitToBend:\n case DRILLSTRING_KEYS.hwdpLength:\n case METRICS_KEYS.rotaryFootage:\n case METRICS_KEYS.slideFootage:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? parseFloat(convertValue(value, 'length', 'ft')).fixFloat(2)\n : value;\n break;\n case METRICS_KEYS.turnRate:\n case METRICS_KEYS.buildRate:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? parseFloat(convertValue(value, 'anglePerLength', 'dp100f')).toFixed(2)\n : value;\n break;\n case METRICS_KEYS.onBottomTime:\n case METRICS_KEYS.totalTime:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? parseFloat(value).toFixed(2)\n : value;\n break;\n case PERCENTILE_KEYS.mse:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'msePressure', 'psi'))\n : value;\n break;\n case PERCENTILE_KEYS.wob:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'force', 'klbf'))\n : value;\n break;\n case PERCENTILE_KEYS.diffPressure:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'pressure', 'psi'))\n : value;\n break;\n case PERCENTILE_KEYS.flowIn:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? Math.floor(convertValue(value, 'volumeFlowRate', 'gal/min'))\n : value;\n break;\n case DRILLSTRING_KEYS.tfa:\n convertedValue = !Number.isNaN(parseFloat(value)) ? parseFloat(value).fixFloat(2) : value;\n break;\n case DRILLSTRING_KEYS.holeSize:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? removeZero(convertValue(value, 'shortLength', 'in'), 3)\n : value;\n break;\n case DRILLSTRING_KEYS.motorSize:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? removeZero(convertValue(value, 'shortLength', 'in'), 2)\n : value;\n break;\n case MOTOR_CONFIG.outer_diameter:\n convertedValue = !Number.isNaN(Number.parseFloat(value))\n ? removeZero(convertValue(value, 'shortLength', 'in'), 1)\n : value;\n break;\n case DRILLSTRING_KEYS.motorBend:\n convertedValue = !Number.isNaN(Number.parseFloat(value)) ? removeZero(value, 2) : value;\n break;\n default:\n convertedValue = !Number.isNaN(Number.parseFloat(value)) ? Math.floor(value) : value;\n }\n return convertedValue;\n};\n\n// NOTE: Get error text when inputted value exceeds max limit\nconst getLimitErrorText = incOrDepth => {\n const maxLimit =\n incOrDepth === 'inc'\n ? MAX_INC_LIMIT\n : parseInt(convertValue(MAX_DEPTH_LIMIT, 'length', 'ft'), 10);\n\n return `Must be within 0 ~ ${maxLimit}`;\n};\n\nexport const getErrors = (minValue, maxValue, incOrDepth) => {\n const maxLimit =\n incOrDepth === 'inc'\n ? MAX_INC_LIMIT\n : parseInt(convertValue(MAX_DEPTH_LIMIT, 'length', 'ft'), 10);\n\n const [errorTextForMin, errorTextForMax] = [minValue, maxValue].reduce((result, value) => {\n let errorText;\n if (Number.isFinite(value)) {\n errorText = maxLimit >= value ? null : getLimitErrorText(incOrDepth);\n } else {\n errorText = 'Invalid value';\n }\n return result.concat([errorText]);\n }, []);\n\n if (Number.isFinite(minValue) && Number.isFinite(maxValue) && minValue >= maxValue) {\n return ['Should be less than max value', 'Should be greater than min value'];\n }\n\n return [errorTextForMin, errorTextForMax];\n};\n\nexport const getBHASchematic = (components = []) => {\n const schematic = [];\n\n components.forEach(component => {\n const { family, material, stabilizer } = component;\n if (['bit', 'pdm', 'rss', 'stabilizer', 'ags', 'ur'].includes(family)) {\n schematic.push({\n family,\n hasStabilizer: !!stabilizer,\n bitType: get(component, 'bit_type'),\n });\n } else if (\n material === 'Non Magnetic' &&\n (schematic.length === 0 || schematic.slice(-1)[0].material !== material)\n ) {\n schematic.push({\n family: 'other',\n material,\n });\n }\n });\n\n return schematic;\n};\n"],"names":["_ref","updateQuery","query","item","selectedSectionNames","companyId","updatedQuery","isNotAllCompany","company_id","_objectSpread","$in","loadDrillStringData","_asyncToGenerator","_regeneratorRuntime","mark","_callee","curBHAandWellIds","queryCombined","$match","queryJson","drillStringData","wrap","_context","prev","next","map","assetId","Number","_id","bhaIds","bha_ids","asset_id","length","abrupt","$or","aggregate","JSON","stringify","$limit","getAppStorage","COLLECTIONS","drillstring","provider","collection","sent","t0","stop","_x","_x2","apply","this","arguments","calculateBHAComponentDetails","components","bhaFamilyValues","Object","values","BHA_FAMILY","passed","distList","reduce","result","family","material","includes","NON_MAGNETIC_TYPE","categoryInfo","bitType","bit","bit_type","push","removeZero","value","decimals","parseFloat","toFixed","toString","_maxRecord$data","maxLengthComponent","maxBy","drillstringRecord","_drillstringRecord$da","data","record","rss","pdm","bhaId","dataInDrillString","filter","_item$data","id","schematic","forEach","component","stabilizer","hasStabilizer","get","slice","_components$find","fieldName","bitSize","find","c","size","roundedBitSize","concat","Math","round","adjustedBitSize","convertValue","bitSizeUnit","getUnitDisplay","startDepth","adjustedDepth","isFinite","minValue","maxValue","incOrDepth","maxLimit","MAX_INC_LIMIT","parseInt","MAX_DEPTH_LIMIT","_reduce","errorText","getLimitErrorText","_reduce2","_slicedToArray","errorTextForMin","errorTextForMax","key","convertedValue","PERCENTILE_KEYS","ropRotary","ropSlide","METRICS_KEYS","netROP","isNaN","floor","distance","holeDepth","DRILLSTRING_KEYS","bitToBend","hwdpLength","rotaryFootage","slideFootage","fixFloat","turnRate","buildRate","onBottomTime","totalTime","mse","wob","diffPressure","flowIn","tfa","holeSize","motorSize","MOTOR_CONFIG","outer_diameter","motorBend"],"mappings":"6lCAiBA,IAiEmCA,EAvB7BC,EAAc,SAACC,EAAOC,EAAMC,EAAsBC,GACtD,IAAIC,EAAeJ,EAkBnB,OAzDsB,SAAAG,GAAS,OAAIA,IAFd,IAE2BA,CAA4B,CAyCxEE,CAAgBF,GAKTF,SAAAA,EAAMK,aACfF,EAAYG,EAAA,CACVD,WAAYL,EAAKK,YACdF,IAPLA,EAAYG,EAAA,CACVD,WAAYH,GACTC,GASHF,IACFE,EAA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