// Décodeur LoRaWAN officiel : Tics'O - (WATTECO) // Source : https://github.com/TheThingsNetwork/lorawan-devices/blob/master/vendor/watteco/ticso.js // The Things Network Device Repository, fichier publié par le constructeur, distribué sans modification. // Format : decodeUplink(input) (TTN v3 / ChirpStack v4). Hébergé par smartbuildings.fr. "use strict";function _defineProperties(e,t){for(var a=0;a14?e.getNextSample(10):a>0?function(e,t,a){return e.getNextSample(10,a)+t+Math.pow(2,a)-1}(e,t,a):t}function s(e,t){var a=e.getNextSample(t);return 12===t?function(e){var t=2147483648&e?-1:1,a=(e>>23&255)-127,r=8388607&e;if(128===a)return t*(r?Number.NaN:Number.POSITIVE_INFINITY);if(-127===a){if(0===r)return 0*t;a=-126,r/=1<<22}else r=(r|1<<23)/(1<<23);return t*r*Math.pow(2,a)}(a):a}function c(e,t,a,r,n){var i=e.getNextSample(6,n);return 0===a?function(e,t,a,r){return e>=Math.pow(2,r-1)?e*t+a:(e+1-Math.pow(2,r))*t+a}(i,r,t,n):1===a?(i+Math.pow(2,n)-1)*r+t:t-(i+(Math.pow(2,n)-1))*r}Math.trunc=Math.trunc||function(e){return isNaN(e)?NaN:e>0?Math.floor(e):Math.ceil(e)},e.exports={normalisation_batch:function(e){for(var s=e.date,d=function(e,s,d,u){var l=function(){for(var e=[],t=0;t<16;)e.push({codingType:0,codingTable:0,resolution:null,uncompressSamples:[]}),t+=1;return{batch_counter:0,batch_relative_timestamp:0,series:e}}(),p=function(e){function r(e,t,a){var r=t,n=a-1;if(8*e.length0;)e[r>>3]&1<<(7&r)&&(o|=1<0&&(s=8);o>0;){for(var c=0;s>0;){var d=n>>3;this.byteArray[d]&1<<(7&n)&&(i|=1<<8*(o-1)+c),s--,c++,n+=1}o--,s=8}if((3==e||5==e||7==e||9==e)&&i&1<=2;)t.push(parseInt(e.substring(0,2),16)),e=e.substring(2,e.length);return t}(d)),_=function(e){for(var t=e.toString(2);t.length<8;)t="0"+t;return{isCommonTimestamp:parseInt(t[t.length-2],2),hasSample:!parseInt(t[t.length-3],2),batch_req:parseInt(t[t.length-4],2),nb_of_type_measure:parseInt(t.substring(0,4),2)}}(p.getNextSample(4));l.batch_counter=p.getNextSample(4,3),p.getNextSample(4,1);var f=function(e,t,a,o,s){for(var c=0,d=0,u=0;u0?n.push(t.getNextSample(10,c)+d+Math.pow(2,c)-1):n.push(d)}else n.push(t.getNextSample(10));i=n[s]}return{timestampCommon:n,lastTimestamp:i}}(e,t,s,a),l=u.timestampCommon,p=u.lastTimestamp,_=0;_0)P.data.value=c(t,g,e.series[m].codingType,r[m].resol,E);else{if(f){f=0;continue}P.data.value=g}}else P.data.value=t.getNextSample(r[m].sampletype);P.data_relative_timestamp=l[v],e.series[m].uncompressSamples.push(P)}}return p}(e,t,a,r,s,d):function(e,t,a,r,i,s){for(var d={},u=0;ur&&(r=v.data_relative_timestamp),(E=t.getNextBifromHi(e.series[l].codingTable))<=14){var P=e.series[l].uncompressSamples[e.series[l].uncompressSamples.length-1].data.value;v.data.value=E>0?c(t,P,e.series[l].codingType,a[l].resol,E):P}else v.data.value=t.getNextSample(a[l].sampletype);e.series[l].uncompressSamples.push(v)}}return r}(e,t,r,i,s,d)}(l,p,v,s,m,_,e)),l.batch_relative_timestamp=i(p,m),function(e,t,a){var r={batch_counter:e.batch_counter,batch_relative_timestamp:e.batch_relative_timestamp};return a&&(r.batch_absolute_timestamp=a),r.dataset=e.series.reduce((function(r,n,i){return r.concat(n.uncompressSamples.map((function(r){var n,o,s,c={data_relative_timestamp:r.data_relative_timestamp,data:{value:t[i].divide?r.data.value/t[i].divide:r.data.value,label:t[i].taglbl}};return t[i].lblname&&(c.data.label_name=t[i].lblname),a&&(c.data_absolute_timestamp=(n=a,o=e.batch_relative_timestamp,s=r.data_relative_timestamp,new Date(new Date(n).getTime()-1e3*(o-s)).toISOString())),c})))}),[]),r}(l,s,u)}(e.batch1,e.batch2,e.payload,s),u=[],l=0;l4)throw new Error("Unsupported Size");return 1===t&&(128&e)>0?e-=256:2===t&&(32768&e)>0?e-=65536:3===t&&(8388608&e)>0?e-=16777216:4===t&&(2147483648&e)>0&&(e-=4294967296),e},Bytes2Float32:function(e){var t=2147483648&e?-1:1,a=(e>>23&255)-127,r=8388607&e;if(128===a)return t*(r?Number.NaN:Number.POSITIVE_INFINITY);if(-127===a){if(0===r)return 0;a=-126,r/=1<<23}else r=(r|1<<23)/(1<<23);return t*r*Math.pow(2,a)},BytesToInt64:function(e,t,a,r){void 0===r&&(r=!1);var n,i,o="U"!=a.substr(0,1),s=parseInt(a.substr(1,2),10)/8,c=s;r?(n=-1,i=t+s-1):(n=1,i=t);for(var d=0,u=i;c>0;u+=n,c--)d=(d<<8)+e[u];return o&&s<8&&128&e[i]&&(d-=1<<8*s),d},decimalToHex:function(e,t){var a=e.toString(16).toUpperCase();for(t=null!=t?t:2;a.lengthnew Date(n[t].date))&&(n[t]={value:a,date:r})}}));var i={};for(var o in a)a.hasOwnProperty(o)&&(i[o]=a[o]);for(var s in n)n.hasOwnProperty(s)&&!i.hasOwnProperty(s)&&(i[s]=n[s].value);return i}e.exports={watteco_decodeUplink:function(e,t,a){e.bytes,e.fPort;var o=e.recvTime;try{var s=r.normalisation_standard(e,a),c=s.payload;if("batch"!==s.type)return{data:i(s.data),warnings:s.warning};var d={batch1:t[0],batch2:t[1],payload:c,date:o};try{return{data:i(n.normalisation_batch(d)),warnings:[]}}catch(e){return{errors:e.message,warnings:[]}}}catch(e){return{errors:e.message,warnings:[]}}}}},907:function(e,t,a){var r=a(839),n=r.UintToInt,i=r.Bytes2Float32,o=r.BytesToInt64,s=r.decimalToHex,c=r.zeroPad,d=(r.BytesToHexStr,function(){function e(t){var a;return _classCallCheck(this,e),(a=_callSuper(this,e,[t])).name="ValidationError",a}return _inherits(e,_wrapNativeSuper(Error)),_createClass(e)}()),u={16:{name:"boolean",size:1},8:{name:"general8",size:1},9:{name:"general16",size:2},10:{name:"general24",size:3},11:{name:"general32",size:4},24:{name:"bitmap8",size:1},25:{name:"bitmap16",size:2},32:{name:"uint8",size:1},33:{name:"uint16",size:2},34:{name:"uint24",size:3},35:{name:"uint32",size:4},40:{name:"int8",size:1},41:{name:"int16",size:2},43:{name:"int32",size:4},48:{name:"enum8",size:1},66:{name:"char string",size:1},65:{name:"bytes string",size:1},67:{name:"long bytes string",size:2},76:{name:"structured ordered sequence",size:2},57:{name:"single",size:4}},l={32778:{0:{0:{divider:1,function_type:"int",name:"positive_active_energy",size:4},1:{divider:1,function_type:"int",name:"negative_active_energy",size:4},2:{divider:1,function_type:"int",name:"positive_reactive_energy",size:4},3:{divider:1,function_type:"int",name:"negative_reactive_energy",size:4},4:{divider:1,function_type:"int",name:"positive_active_power",size:4},5:{divider:1,function_type:"int",name:"negative_active_power",size:4},6:{divider:1,function_type:"int",name:"positive_reactive_power",size:4},7:{divider:1,function_type:"int",name:"negative_reactive_power",size:4}}},32784:{0:{0:{divider:1,function_type:"int",name:"active_energy_a",size:4},1:{divider:1,function_type:"int",name:"reactive_energy_a",size:4},2:{divider:1,function_type:"int",name:"active_energy_b",size:4},3:{divider:1,function_type:"int",name:"reactive_energy_b",size:4},4:{divider:1,function_type:"int",name:"active_energy_c",size:4},5:{divider:1,function_type:"int",name:"reactive_energy_c",size:4},6:{divider:1,function_type:"int",name:"active_energy_abc",size:4},7:{divider:1,function_type:"int",name:"reactive_energy_abc",size:4}},1:{0:{divider:1,function_type:"int",name:"active_power_a",size:4},1:{divider:1,function_type:"int",name:"reactive_power_a",size:4},2:{divider:1,function_type:"int",name:"active_power_b",size:4},3:{divider:1,function_type:"int",name:"reactive_power_b",size:4},4:{divider:1,function_type:"int",name:"active_power_c",size:4},5:{divider:1,function_type:"int",name:"reactive_power_c",size:4},6:{divider:1,function_type:"int",name:"active_power_abc",size:4},7:{divider:1,function_type:"int",name:"reactive_power_abc",size:4}}},32779:{0:{0:{divider:10,function_type:"int",name:"Vrms",size:2},1:{divider:10,function_type:"int",name:"Irms",size:2},2:{divider:1,function_type:"int",name:"angle",size:2}}},32781:{0:{0:{divider:10,function_type:"int",name:"Vrms_a",size:2},1:{divider:10,function_type:"int",name:"Irms_a",size:2},2:{divider:1,function_type:"int",name:"angle_a",size:2},3:{divider:10,function_type:"int",name:"Vrms_b",size:2},4:{divider:10,function_type:"int",name:"Irms_b",size:2},5:{divider:1,function_type:"int",name:"angle_b",size:2},6:{divider:10,function_type:"int",name:"Vrms_c",size:2},7:{divider:10,function_type:"int",name:"Irms_c",size:2},8:{divider:1,function_type:"int",name:"angle_c",size:2}}},32850:{0:{0:{divider:1e3,function_type:"int",name:"frequency",size:2},1:{divider:1e3,function_type:"int",name:"frequency_min",size:2},2:{divider:1e3,function_type:"int",name:"frequency_max",size:2},3:{divider:10,function_type:"int",name:"Vrms",size:2},4:{divider:10,function_type:"int",name:"Vrms_min",size:2},5:{divider:10,function_type:"int",name:"Vrms_max",size:2},6:{divider:10,function_type:"int",name:"Vpeak",size:2},7:{divider:10,function_type:"int",name:"Vpeak_min",size:2},8:{divider:10,function_type:"int",name:"Vpeak_max",size:2},9:{divider:1,function_type:"int",name:"over_voltage",size:2},10:{divider:1,function_type:"int",name:"sag_voltage",size:2}}},32773:{0:{0:{divider:1,function_type:"none",name:"pin_state_1",size:1},1:{divider:1,function_type:"none",name:"pin_state_2",size:1},2:{divider:1,function_type:"none",name:"pin_state_3",size:1},3:{divider:1,function_type:"none",name:"pin_state_4",size:1},4:{divider:1,function_type:"none",name:"pin_state_5",size:1},5:{divider:1,function_type:"none",name:"pin_state_6",size:1},6:{divider:1,function_type:"none",name:"pin_state_7",size:1},7:{divider:1,function_type:"none",name:"pin_state_8",size:1},8:{divider:1,function_type:"none",name:"pin_state_9",size:1},9:{divider:1,function_type:"none",name:"pin_state_10",size:1}}},80:{6:{0:{divider:1e3,function_type:"none",name:"power_modes",size:2},1:{divider:1e3,function_type:"none",name:"current_power_source",size:2},2:{divider:1e3,function_type:"none",name:"constant_power",size:2},3:{divider:1e3,function_type:"none",name:"rechargeable_battery",size:2},4:{divider:1e3,function_type:"none",name:"disposable_battery",size:2},5:{divider:1e3,function_type:"none",name:"solar_harvesting",size:2},6:{divider:1e3,function_type:"none",name:"TIC_harvesting",size:2}}}};function p(e){var t="",a=e.toString(2);return t+=c(a,8)}function _(e,t,a,r,o,s,c,d,p,_){if(138===e||10==e){var f=u[c],m=p,v=f.size,E=f.name;void 0===m&&(m="single"===E?"float":"int8"===E||"int16"===E||"int32"===E?"int":"none");var P=function(e,t,a,r,o,s,c,d,u){var p={reportCauses:[],causesMessages:[]};138===e&&p.causesMessages.push("alarm triggered");var _=o;if(_>=r.length)return p;var f=!1,m=3&(r[o]>>=4);if(2==m)f=!0;else if(1!=m)throw new Error("Alarm decoding: Unexpected cause type. (ReportParams byte = ".concat(r[o],")"));if(++_>=r.length)throw new Error("Alarm decoding: Unexpected end of causes.)");function v(e,t,a){if(_+t-1>=r.length)throw new Error("Alarm decoding: Unexpected end of data while reading value.");for(var o=0,s=0;s=r.length)throw new Error("Alarm decoding: Unexpected end of data before reading CSD.");var P=r[_++];E.criterionIndex=7&P;var g=P>>3&3;E.mode=1===g?"delta":2===g?"threshold":"unused",E.hasFallen=!!(32&P),E.hasExceeded=!!(64&P),E.isAlarm=!!(128&P);var y=void 0,h=void 0,b=void 0,S=void 0,A=void 0,z=void 0,H=void 0,T=E.hasExceeded&&E.hasFallen?"exceed&fall":E.hasExceeded?"exceed":E.hasFallen?"fall":"",C=null;if(f){if(_>=r.length)throw new Error("Alarm decoding: Unexpected end of data before reading FI.");var N=s,R=c,U=d;if(E.fieldIndex=0,null!=u&&!0===u&&(C=r[_++],E.fieldIndex=C,l[t]&&l[t][a]&&l[t][a][C])){var D=l[t][a][C];N=D.function_type||s,R=D.size||c,U=D.divider||d,z=D.name||"FieldUndef !"}y=v(N,R,U),"threshold"===E.mode&&(h=v(N,R,U))}if("threshold"===E.mode&&f){if(_>=r.length)throw new Error("Alarm decoding: Unexpected end of data before reading Occ.");var M=r[_++];if(b=M,M>0&&128&M){if(_+3>=r.length)throw new Error("Alarm decoding: Invalid OccH or OccL read.");S=r[_++]<<8|r[_++],A=r[_++]<<8|r[_++]}}p.reportCauses.push(E),f?(H="threshold"===E.mode?void 0!==S?"cause:{alarm:".concat(E.isAlarm,", criterion_index: ").concat(E.criterionIndex,", mode: threshold, crossing: ").concat(T,", value: ").concat(y,", gap: ").concat(h,", occurences_up: ").concat(S,", occurences_down: ").concat(A):"cause:{alarm:".concat(E.isAlarm,", criterion_index: ").concat(E.criterionIndex,", mode: threshold, crossing: ").concat(T,", value: ").concat(y,", gap: ").concat(h,", occurences: ").concat(b):"cause:{alarm:".concat(E.isAlarm,", criterion_index: ").concat(E.criterionIndex,", mode: delta, value: ").concat(y),z&&(H+=", field: ".concat(z)),H+="}"):(H="cause:{alarm:".concat(E.isAlarm,", criterion_index: ").concat(E.criterionIndex,", mode: ").concat(E.mode),"threshold"===E.mode&&(H+=", crossing: ".concat(T)),H+="}"),p.causesMessages.push(H)}if(_!==r.length)throw new Error("Alarm decoding: Remaining unprocessed bytes detected. Expected ".concat(r.length,", but stopped at ").concat(_,"."));return p}(e,t,a,r,s,m,v,d,_);o.zclheader.alarmmsg=P.causesMessages}}e.exports={normalisation_standard:function(e,t){var a=[],r=e.bytes,c=function(e,t){var a={},r=0;a.lora={},a.lora.port=t;var c=e.length,u="";a.lora.payload="";for(var l=0;l>5|(6&e[0])<<2,m=e[1],a.zclheader.cmdID=s(m,2),v=256*e[2]+e[3],a.zclheader.clustID=s(v,4),10===m||138===m||1===m){r=1,a.data={},E=256*e[4]+e[5],a.zclheader.attID=s(E,4);var P=e[4],g=0;if(10!==m&&138!==m||(g=7),138===m&&(a.zclheader.alarm=1),1===m&&(g=8,a.zclheader.status=e[6]),83===v||84===v||85===v||86===v||87===v){if("function"!=typeof globalThis.TIC_Decode)throw new d("TIC_Decode function not found");a.data=globalThis.TIC_Decode(v,E,e.slice(g+1))}if(0===v&&2===E){a.data.firmware="";for(var y=0;y<3;y++)a.data.firmware+=String(e[g+y]),y<2&&(a.data.firmware+=".");var h=256*e[g+3]*256+256*e[g+4]+e[g+5];a.data.firmware+="."+h.toString()}if(0===v&&3===E){var b=e[g];a.data.kernel="";for(var S=0;S>13,a.data.modbus_last_frame_of_serie=(7168&Q)>>10;for(var $=0;$<=9;$++)a.data["modbus_EP".concat($)]=!!(Q&1<<$);function Ve(e,t,a,r,n,i){if(!0===e){if(0===a&&(n.data["modbus_slaveID_EP".concat(i)]=r[t],n.data["modbus_fnctID_EP".concat(i)]=r[t+1],n.data["modbus_datasize_EP".concat(i)]=r[t+2],t+=3),n.data["modbus_payload_EP".concat(i)]="",void 0===r[t])return n;for(var o=0;o0;)a.zclheader.modepower=e[14+5*Je],a.zclheader.powersource=e[15+5*Je],a.zclheader.delta=256*e[16+5*Je]+e[17+5*Je],a.zclheader.changedpowersource=e[18+5*Je],Je++,Be--}if(0===r)throw new d("bad payload3")}else a.batch={},a.batch.report="batch";return a}(r,e.fPort);if(void 0!==c.zclheader){if(void 0!==c.zclheader.alarmmsg&&(a=c.zclheader.alarmmsg),7===r[1])return{data:c.zclheader,warning:a};if(9===r[1])return{data:c.zclheader,warning:a};if(1===r[1]){if(void 0===c.zclheader.data){for(var u=[],l=!0,f=0;l;){var m=Object.keys(c.data)[f];if(void 0===m){l=!1;break}u.push({variable:m,value:c.data[m],date:e.recvTime}),f++}return{data:u,type:"standard",warning:a}}return{data:{variable:"read reporting configuration response status",value:c.zclheader.data,date:e.recvTime},warning:a}}}if(void 0!==c.zclheader){if(void 0!==t){for(var v=c.zclheader.endpoint,E=!0,P=0,g=[],y="";E;){var h=Object.keys(c.data)[P];if(void 0===h){E=!1;break}void 0===t[h]?g.push({variable:h,value:c.data[h],date:e.recvTime}):"NA"===(y=t[h][v])?g.push({variable:y,value:"NA",date:e.recvTime}):g.push({variable:y,value:c.data[h],date:e.recvTime}),P++}return{data:g,type:"standard",warning:a}}throw new d("bad decoding")}return{type:c.batch.report,payload:c.lora.payload}}}},640:function(e,t,a){var r=a(839),n=(r.UintToInt,r.Bytes2Float32),i=r.BytesToInt64,o=(r.decimalToHex,r.zeroPad),s=r.BytesToHexStr;e.exports={TIC_Decode:function(e,t,a){var r=["!?!","*",""," ACTIF","ACTIF","CONSO","CONTROLE","DEP","INACTIF","PROD","TEST","kVA","kW"],c=["!?!","*",""," ? ","000","HC","HCD","HCE","HCH","HH","HH ","HP","HP ","HPD","HPE","HPH","JA","JA ","P","P ","PM","PM ","XXX"],d=["!?!","*","","BT 4 SUP36","BT 5 SUP36","HTA 5 ","HTA 8 ","TJ EJP ","TJ EJP-HH ","TJ EJP-PM ","TJ EJP-SD ","TJ LU ","TJ LU-CH ","TJ LU-P ","TJ LU-PH ","TJ LU-SD ","TJ MU ","TV A5 BASE","TV A8 BASE","BASE","H PLEINE-CREUSE","HPHC","HC","HC et Week-End","EJP","PRODUCTEUR"],u=["!?!","*",""," ? ","000","HC","HCD","HCE","HCH","HH","HH ","HP","HP ","HPD","HPE","HPH","JA","JA ","P","P ","PM","PM ","XXX","INDEX NON CONSO","BASE","HEURE CREUSE","HEURE PLEINE","HEURE NORMALE","HEURE POINTE","HC BLEU","BUHC","HP BLEU","BUHP","HC BLANC","BCHC","HP BLANC","BCHP","HC ROUGE","RHC","HP ROUGE","RHP","HEURE WEEK-END"],l=["!?!","*","","BT 4 SUP36","BT 5 SUP36","HTA 5 ","HTA 8 ","TJ EJP ","TJ EJP-HH ","TJ EJP-PM ","TJ EJP-SD ","TJ LU ","TJ LU-CH ","TJ LU-P ","TJ LU-PH ","TJ LU-SD ","TJ MU ","TV A5 BASE","TV A8 BASE","BASE","H PLEINE-CREUSE","HPHC","HC","HC et Week-End","EJP","PRODUCTEUR"];function p(e,t,a){var r="";if(128&e[t]){var n=127&e[t];t+=1,n>0?(r=String.fromCharCode.apply(null,e.slice(t,t+n)),t+=n):r=""}else r=a[127&e[t]],t+=1;return{x:r,i:t}}function _(e,t){return{x:o(i(e,t,"U8"),2)+"/"+o(i(e,t+1,"U8"),2)+"/"+o(i(e,t+2,"U8"),2)+" "+o(i(e,t+3,"U8"),2)+":"+o(i(e,t+4,"U8"),2)+":"+o(i(e,t+5,"U8"),2),i:t+=6}}function f(e,t,a){var r=i(e,t,"U32",a);t+=4,r+=Date.UTC(2e3,0,1,0,0,0)/1e3;var n=new Date(1e3*r);return{x:o(n.getDate(),2)+"/"+o(n.getMonth(),2)+"/"+n.getFullYear()+" "+o(n.getHours(),2)+":"+o(n.getMinutes(),2)+":"+o(n.getSeconds(),2),i:t}}function m(e,t,a){return{x:String.fromCharCode.apply(null,e.slice(t,t+a)),i:t+=a}}function v(e,t){return{b:e,i:t}}function E(e,t){return function(e,t){var a=e.slice(t).indexOf(0);return{x:String.fromCharCode.apply(null,e.slice(t,t+a)),i:t+=a+1}}(e,t)}function P(e,t){return{x:i(e,t,"U8"),i:t+=1}}function g(e,t){return{x:i(e,t,"U16"),i:t+=2}}function y(e,t){return{x:i(e,t,"I16"),i:t+=2}}function h(e,t){return{x:i(e,t,"U24"),i:t+=3}}function b(e,t){var a={};for(t=1;t<=4;t++)a["Value_"+t]=i(e,t,"U24"),t+=3;return{x:a,i:t}}function S(e,t){return{x:i(e,t,"U32"),i:t+=4}}function A(e,t){return{x:Ee=n(e,t),i:t+=4}}function z(e,t){return _(e,t)}function H(e,t){return f(e,t)}function T(e,t){return p(e,t,c)}function C(e,t){return{x:{},i:t=p(e,f(e,t).i,c).i}}function N(e,t){var a=o(i(e,t,"U8"),2);t++;var r=o(i(e,t,"U8"),2);return t++,{x:a+"/"+r+" "+o(i(e,t,"U8"),2),i:++t}}function R(e,t){var a={},r=m(e,t,1),n=_(e,r.i),o=i(e,t,"U8");return t=n.i+1,a.S=r.x,a.Date=n.x,a.Value=o,{x:a,i:t}}function U(e,t){var a={},r=m(e,t,1),n=_(e,r.i),o=i(e,t,"U16");return t=n.i+1,a.S=r.x,a.Date=n.x,a.Value=o,{x:a,i:t}}function D(e,t){var a={},r=m(e,t,1),n=_(e,r.i),o=i(e,t,"U24");return t=n.i+1,a.S=r.x,a.Date=n.x,a.Value=o,{x:a,i:t}}function M(e,t){return p(e,t,r)}function x(e,t){var a={},n=i(e,t,"U24");t+=3,a.Value=n;var o=p(e,t,r);return a.Label=o.x,{x:a,i:t=o.i}}function w(e,t){return p(e,t,d)}function I(e,t){for(var a=[],r=0;r<11;r++){var n={},c=o(i(e,t,"U8"),2);if(t++,255===c)n.Status="NONUTILE";else{var d=o(i(e,t,"U8"),2);t++;var u=s(e.slice(t,2));t++,n.Time=c+":"+d,n.Status=u,t+=e[t]+1}a.push(n)}return{x:a,i:t}}function O(e){return e}function F(e){return e}function B(e){return e}function J(e){return e}function V(e){return e}function X(e){return e}function G(e){return e}function q(e){return e}function k(e){return e}function L(e){return e}function Y(e){return e}function j(e){return e}function W(e){return e}function Z(e){return e}function K(e){return e}function Q(e){return e}function $(e){return e}function ee(e){return e}function te(e){return e}function ae(e){return e}function re(e){return e}var ne=[["CONTRAT",E,0,F],["DATECOUR",z,0,O],["DATE",z,0,O],["EA",h,0,function(e){return e}],["ERP",h,0,function(e){return e}],["PTCOUR",E,0,F],["PREAVIS",E,0,F],["MODE",v,0,F],["DATEPA1",z,0,O],["PA1",g,0,j],["DATEPA2",z,0,O],["PA2",g,0,j],["DATEPA3",z,0,O],["PA3",g,0,j],["DATEPA4",z,0,O],["PA4",g,0,j],["DATEPA5",z,0,O],["PA5",g,0,j],["DATEPA6",z,0,O],["PA6",g,0,j],["*p*",h,0,G],["KDC",P,0,Y],["KDCD",P,0,Y],["TGPHI",A,0,re],["PSP",g,0,j],["PSPM",g,0,j],["PSHPH",g,0,j],["PSHPD",g,0,j],["PSHCH",g,0,j],["PSHCD",g,0,j],["PSHPE",g,0,j],["PSHCE",g,0,j],["PSJA",g,0,j],["PSHH",g,0,j],["PSHD",g,0,j],["PSHM",g,0,j],["PSDSM",g,0,j],["PSSCM",g,0,j],["MODE",v,0,F],["PA1MN",g,0,j],["PA10MN",g,0,j],["PREA1MN",y,0,W],["PREA10MN",y,0,W],["TGPHI",A,0,re],["U10MN",g,0,function(e){return e}]],ie=[["DEBUTp",z,0,O,0],["FINp",z,0,O,6],["CAFp",g,0,X,12],["DATEEAp",z,0,O,14],["EApP",h,0,ee,20],["EApPM",h,0,ee,23],["EApHCE",h,0,ee,26],["EApHCH",h,0,ee,29],["EApHH",h,0,ee,32],["EApHCD",h,0,ee,35],["EApHD",h,0,ee,38],["EApJA",h,0,ee,41],["EApHPE",h,0,ee,44],["EApHPH",h,0,ee,47],["EApHPD",h,0,ee,50],["EApSCM",h,0,ee,53],["EApHM",h,0,ee,56],["EApDSM",h,0,ee,59],["DATEERPp",z,0,O,62],["ERPpP",h,0,ae,68],["ERPpPM",h,0,ae,71],["ERPpHCE",h,0,ae,74],["ERPpHCH",h,0,ae,77],["ERPpHH",h,0,ae,80],["ERPpHCD",h,0,ae,83],["ERPpHD",h,0,ae,86],["ERPpJA",h,0,ae,89],["ERPpHPE",h,0,ae,92],["ERPpHPH",h,0,ae,95],["ERPpHPD",h,0,ae,98],["ERPpSCM",h,0,ae,101],["ERPpHM",h,0,ae,104],["ERPpDSM",h,0,ae,107],["DATEERNp",z,0,O,110],["ERNpP",h,0,ae,116],["ERNpPM",h,0,ae,119],["ERNpHCE",h,0,ae,122],["ERNpHCH",h,0,ae,125],["ERNpHH",h,0,ae,128],["ERNpHCD",h,0,ae,131],["ERNpHD",h,0,ae,134],["ERNpJA",h,0,ae,137],["ERNpHPE",h,0,ae,140],["ERNpHPH",h,0,ae,143],["ERNpHPD",h,0,ae,146],["ERNpSCM",h,0,ae,149],["ERNpHM",h,0,ae,152],["ERNpDSM",h,0,ae,155]],oe=[["DEBUTp1",z,0,O,0],["FINp1",z,0,O,6],["CAFp1",g,0,X,12],["DATEEAp1",z,0,O,14],["EAp1P",h,0,ee,20],["EAp1PM",h,0,ee,23],["EAp1HCE",h,0,ee,26],["EAp1HCH",h,0,ee,29],["EAp1HH",h,0,ee,32],["EAp1HCD",h,0,ee,35],["EAp1HD",h,0,ee,38],["EAp1JA",h,0,ee,41],["EAp1HPE",h,0,ee,44],["EAp1HPH",h,0,ee,47],["EAp1HPD",h,0,ee,50],["EAp1SCM",h,0,ee,53],["EAp1HM",h,0,ee,56],["EAp1DSM",h,0,ee,59],["DATEERPp1",z,0,O,62],["ERPp1P",h,0,ae,68],["ERPp1PM",h,0,ae,71],["ERPp1HCE",h,0,ae,74],["ERPp1HCH",h,0,ae,77],["ERPp1HH",h,0,ae,80],["ERPp1HCD",h,0,ae,83],["ERPp1HD",h,0,ae,86],["ERPp1JA",h,0,ae,89],["ERPp1HPE",h,0,ae,92],["ERPp1HPH",h,0,ae,95],["ERPp1HPD",h,0,ae,98],["ERPp1SCM",h,0,ae,101],["ERPp1HM",h,0,ae,104],["ERPp1DSM",h,0,ae,107],["DATEERNp1",z,0,O,110],["ERNp1P",h,0,ae,116],["ERNp1PM",h,0,ae,119],["ERNp1HCE",h,0,ae,122],["ERNp1HCH",h,0,ae,125],["ERNp1HH",h,0,ae,128],["ERNp1HCD",h,0,ae,131],["ERNp1HD",h,0,ae,134],["ERNp1JA",h,0,ae,137],["ERNp1HPE",h,0,ae,140],["ERNp1HPH",h,0,ae,143],["ERNp1HPD",h,0,ae,146],["ERNp1SCM",h,0,ae,149],["ERNp1HM",h,0,ae,152],["ERNp1DSM",h,0,ae,155]],se=[["ADIR1",g,0,V],["ADIR2",g,0,V],["ADIR3",g,0,V],["ADCO",E,0,F],["OPTARIF",E,0,F],["ISOUSC",P,0,J],["BASE",S,0,L],["HCHC",S,0,L],["HCHP",S,0,L],["EJPHN",S,0,L],["EJPHPM",S,0,L],["BBRHCJB",S,0,L],["BBRHPJB",S,0,L],["BBRHCJW",S,0,L],["BBRHPJW",S,0,L],["BBRHCJR",S,0,L],["BBRHPJR",S,0,L],["PEJP",P,0,J],["GAZ",S,0,k],["AUTRE",S,0,k],["PTEC",E,0,F],["DEMAIN",E,0,F],["IINST",g,0,V],["IINST1",g,0,V],["IINST2",g,0,V],["IINST3",g,0,V],["ADPS",g,0,V],["IMAX",g,0,V],["IMAX1",g,0,V],["IMAX2",g,0,V],["IMAX3",g,0,V],["PMAX",S,0,G],["PAPP",S,0,G],["HHPHC",function(e,t){return{x:String.fromCharCode.apply(null,e.slice(0,1)),i:t+=1}},0,function(e){return e}],["MOTDETAT",E,0,F],["PPOT",P,0,function(e){return e}]],ce=[["JAUNE",function(e,t){var a=o(i(e,t,"U8"),2);t++;var r=o(i(e,t,"U8"),2);t++;var n=o(i(e,t,"U8"),2);return t++,{x:n+"/"+o(i(e,t,"U8"),2)+" "+a+":"+r,i:++t}},0,O],["JAUNE",E,0,F],["JAUNE",E,0,F],["JAUNE",h,0,G],["JAUNE",P,0,J],["ENERG",function(e,t){var a={};for(t=1;t<=4;t++)a["Value_"+t]=i(e,t,"U24"),t+=3;return{x:a,i:t}},0,q],["ENERG",h,0,q],["ENERG",h,0,q],["ENERG",h,0,q],["ENERG",h,0,q],["ENERG",h,0,q],["PERCC",N,0,O],["PERCC",P,0,J],["PMAXC",b,0,G],["PMAXC",h,0,G],["PMAXC",h,0,G],["PMAXC",h,0,G],["TDEPA",b,0,G],["TDEPA",h,0,G],["TDEPA",h,0,G],["TDEPA",h,0,G],["PERCP",N,0,O],["PERCP",P,0,J],["PMAXP",b,0,G],["PMAXP",h,0,G],["PMAXP",h,0,G],["PMAXP",h,0,G],["PSOUSC",b,0,G],["PSOUSC",h,0,G],["PSOUSC",h,0,G],["PSOUSC",h,0,G],["PSOUSP",b,0,G],["PSOUSP",h,0,G],["PSOUSP",h,0,G],["PSOUSP",h,0,G],["FCOU",function(e,t){var a=o(i(e,t,"U8"),2);return t++,{x:a+":"+o(i(e,t,"U8"),2),i:++t}},0,O],["FCOU",P,0,J]],de=[["ADSC",E,0,F],["VTIC",P,0,J],["DATE",function(e,t){var a={},r=m(e,t,1),n=_(e,r.i);return a.S=r.x,a.Date=n.x,{x:a,i:t=n.i}},0,O],["NGTF",function(e,t){return p(e,t,l)},0,F],["LTARF",function(e,t){return p(e,t,u)},0,F],["EAST",S,0,L],["EASF01",S,0,L],["EASF02",S,0,L],["EASF03",S,0,L],["EASF04",S,0,L],["EASF05",S,0,L],["EASF06",S,0,L],["EASF07",S,0,L],["EASF08",S,0,L],["EASF09",S,0,L],["EASF10",S,0,L],["EASD01",S,0,L],["EASD02",S,0,L],["EASD03",S,0,L],["EASD04",S,0,L],["EAIT",S,0,L],["ERQ1",S,0,L],["ERQ2",S,0,L],["ERQ3",S,0,L],["ERQ4",S,0,L],["IRMS1",g,0,V],["IRMS2",g,0,V],["IRMS3",g,0,V],["URMS1",g,0,V],["URMS2",g,0,V],["URMS3",g,0,V],["PREF",P,0,J],["PCOUP",P,0,J],["SINSTS",h,0,G],["SINSTS1",h,0,G],["SINSTS2",h,0,G],["SINSTS3",h,0,G],["SMAXSN",D,0,G],["SMAXSN1",D,0,G],["SMAXSN2",D,0,G],["SMAXSN3",D,0,G],["SMAXSN?1",D,0,G],["SMAXSN1?1",D,0,G],["SMAXSN2?1",D,0,G],["SMAXSN3?1",D,0,G],["SINSTI",h,0,G],["SMAXIN",D,0,G],["SMAXIN-1",D,0,G],["CCASN",D,0,G],["CCASN?1",D,0,G],["CCAIN",D,0,G],["CCAIN?1",D,0,G],["UMOY1",U,0,V],["UMOY2",U,0,V],["UMOY3",U,0,V],["STGE",function(e,t){var a=s(e.slice(t,2));return t+=4,{x:a,i:t+=4}},0,O],["DPM1",R,0,J],["FPM1",R,0,J],["DPM2",R,0,J],["FPM2",R,0,J],["DPM3",R,0,J],["FPM3",R,0,J],["MSG1",E,0,F],["MSG2",E,0,F],["PRM",E,0,F],["RELAIS",function(e,t){return{x:i(e,t,"U8"),i:++t}},0,V],["NTARF",P,0,J],["NJOURF",P,0,J],["NJOURF+1",P,0,J],["PJOURF+1",I,0,O],["PPOINTE",I,0,O]],ue=[["TRAME",M,0,F],["ADS",function(e,t){return{x:s(e.slice(t+1,t+1+e[t])),i:t+=e[t]+1}},0,O],["MESURES1",w,0,F],["DATE",z,0,O],["EA_s",h,0,Z],["ER+_s",h,0,K],["ER-_s",h,0,K],["EAPP_s",h,0,Q],["EA_i",h,0,Z],["ER+_i",h,0,K],["ER-_i",h,0,K],["EAPP_i",h,0,Q],["PTCOUR1",T,0,F],["TARIFDYN",M,0,F],["ETATDYN1",T,0,F],["PREAVIS1",T,0,B],["TDYN1CD",C,0,O],["TDYN1CF",C,0,O],["TDYN1FD",C,0,O],["TDYN1FF",C,0,O],["MODE",M,0,F],["CONFIG",M,0,F],["DATEPA1",z,0,O],["PA1_s",g,0,j],["PA1_i",g,0,j],["DATEPA2",H,0,O],["PA2_s",g,0,j],["PA2_i",g,0,j],["DATEPA3",H,0,O],["PA3_s",g,0,j],["PA3_i",g,0,j],["DATEPA4",H,0,O],["PA4_s",g,0,j],["PA4_i",g,0,j],["DATEPA5",H,0,O],["PA5_s",g,0,j],["PA5_i",g,0,j],["DATEPA6",H,0,O],["PA6_s",g,0,j],["PA6_i",g,0,j],["DebP",H,0,O],["EAP_s",h,0,$],["EAP_i",h,0,$],["ER+P_s",h,0,te],["ER-P_s",h,0,te],["ER+P_i",h,0,te],["ER-P_i",h,0,te],["DebP-1",H,0,O],["FinP-1",H,0,O],["EaP-1_s",h,0,$],["EaP-1_i",h,0,$],["ER+P-1_s",h,0,te],["ER-P-1_s",h,0,te],["ER+P-1_i",h,0,te],["ER-P-1_i",h,0,te],["PS",x,0,O],["PREAVIS",M,0,F],["PA1MN",g,0,j],["PMAX_s",x,0,O],["PMAX_i",x,0,O],["TGPHI_s",A,0,re],["TGPHI_i",A,0,re],["MESURES2",w,0,F],["PTCOUR2",T,0,F],["ETATDYN2",T,0,F],["PREAVIS2",T,0,B],["TDYN2CD",C,0,O],["TDYN2CF",C,0,O],["TDYN2FD",C,0,O],["TDYN2FF",C,0,O],["DebP_2",H,0,O],["EaP_s2",h,0,$],["DebP-1_2",H,0,O],["FinP-1_2",H,0,O],["EaP-1_s2",h,0,$],["_DDMES1_",h,0,function(e){return e}]],le=[],pe={};if(83==e)if(!1&t)pe=ne,le._TICFrameType="ICE Generale";else if(!1&t)pe=ie,le._TICFrameType="ICE Periode P";else{if(!(!1&t))return le;pe=oe,le._TICFrameType="ICE Periode P moins 1"}else if(84==e)pe=se,le._TICFrameType="CBE/Historique";else if(85==e)pe=ce,le._TICFrameType="CJE";else if(86==e)pe=de,le._TICFrameType="Standard";else{if(87!=e)return le;pe=ue,le._TICFrameType="PMEPMI"}var _e=function(e){var t=[],a=e[0],r=31&a;if(0==r&&(r=8),32&a)for(var n=1;n1;o--)for(var s=0;s<8;s++)e[o-1]>>s&1&&t.push(i),i++;return{DescSize:r,Indexes:t}}(a),fe=_e.DescSize,me=_e.Indexes,ve=a.slice(0,fe),Ee={};128&~ve[0]||(Ee.Obsolete=!0),Ee.Bytes=s(ve),Ee.Indexes=me,le._Descriptor=Ee;for(var Pe=fe,ge=0;ge