UNPKG

@scrypted/reolink

Version:

Reolink Plugin for Scrypted

2 lines 366 kB
/*! For license information please see main.nodejs.js.LICENSE.txt */ (()=>{var e={4694:(e,t)=>{t.jspack=new function(){var e,t=!1,n=this;n._DeArray=function(e,t,n){return[e.slice(t,t+n)]},n._EnArray=function(e,t,n,r){for(var i=0;i<n;e[t+i]=r[i]?r[i]:0,i++);},n._DeChar=function(e,t){return String.fromCharCode(e[t])},n._EnChar=function(e,t,n){e[t]=n.charCodeAt(0)},n._DeInt=function(n,r){var i,o,s,a=t?e.len-1:0,c=t?-1:1,u=a+c*e.len;for(i=0,o=a,s=1;o!=u;i+=n[r+o]*s,o+=c,s*=256);return e.bSigned&&i&Math.pow(2,8*e.len-1)&&(i-=Math.pow(2,8*e.len)),i},n._EnInt=function(n,r,i){var o,s=t?e.len-1:0,a=t?-1:1,c=s+a*e.len;for(i=i<e.min?e.min:i>e.max?e.max:i,o=s;o!=c;n[r+o]=255&i,o+=a,i>>=8);},n._DeString=function(e,t,n){for(var r=new Array(n),i=0;i<n;r[i]=String.fromCharCode(e[t+i]),i++);return r.join("")},n._EnString=function(e,t,n,r){for(var i,o=0;o<n;e[t+o]=(i=r.charCodeAt(o))?i:0,o++);},n._De754=function(n,r){var i,o,s,a,c,u,l,p,d,h;for(l=e.mLen,d=(h=(1<<(p=8*e.len-e.mLen-1))-1)>>1,a=t?0:e.len-1,c=t?1:-1,i=n[r+a],a+=c,o=i&(1<<-(u=-7))-1,i>>=-u,u+=p;u>0;o=256*o+n[r+a],a+=c,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=l;u>0;s=256*s+n[r+a],a+=c,u-=8);switch(o){case 0:o=1-d;break;case h:return s?NaN:1/0*(i?-1:1);default:s+=Math.pow(2,l),o-=d}return(i?-1:1)*s*Math.pow(2,o-l)},n._En754=function(n,r,i){var o,s,a,c,u,l,p,d,h,f;for(p=e.mLen,h=(f=(1<<(d=8*e.len-e.mLen-1))-1)>>1,o=i<0?1:0,i=Math.abs(i),isNaN(i)||i==1/0?(a=isNaN(i)?1:0,s=f):(s=Math.floor(Math.log(i)/Math.LN2),i*(l=Math.pow(2,-s))<1&&(s--,l*=2),(i+=s+h>=1?e.rt/l:e.rt*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(i*l-1)*Math.pow(2,p),s+=h):(a=i*Math.pow(2,h-1)*Math.pow(2,p),s=0)),c=t?e.len-1:0,u=t?-1:1;p>=8;n[r+c]=255&a,c+=u,a/=256,p-=8);for(s=s<<p|a,d+=p;d>0;n[r+c]=255&s,c+=u,s/=256,d-=8);n[r+c-u]|=128*o},n._DeInt64=function(n,r){var i,o,s,a=t?0:7,c=t?1:-1,u=a+8*c,l=[0,0,!e.bSigned];for(i=a,s=1,o=0;i!=u;l[s]=(l[s]<<8>>>0)+n[r+i],i+=c,s=++o<4?1:0);return l},n._EnInt64=function(e,n,r){var i,o,s,a,c=t?0:7,u=t?1:-1,l=c+8*u;for(i=c,s=1,o=0,a=24;i!=l;e[n+i]=r[s]>>a&255,i+=u,s=++o<4?1:0,a=24-o%4*8);},n._sPattern="(\\d + )?([AxcbBhHsfdiIlLqQ])",n._lenLut={A:1,x:1,c:1,b:1,B:1,h:2,H:2,s:1,f:4,d:8,i:4,I:4,l:4,L:4,q:8,Q:8},n._elLut={A:{en:n._EnArray,de:n._DeArray},s:{en:n._EnString,de:n._DeString},c:{en:n._EnChar,de:n._DeChar},b:{en:n._EnInt,de:n._DeInt,len:1,bSigned:!0,min:-Math.pow(2,7),max:Math.pow(2,7)-1},B:{en:n._EnInt,de:n._DeInt,len:1,bSigned:!1,min:0,max:Math.pow(2,8)-1},h:{en:n._EnInt,de:n._DeInt,len:2,bSigned:!0,min:-Math.pow(2,15),max:Math.pow(2,15)-1},H:{en:n._EnInt,de:n._DeInt,len:2,bSigned:!1,min:0,max:Math.pow(2,16)-1},i:{en:n._EnInt,de:n._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},I:{en:n._EnInt,de:n._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},l:{en:n._EnInt,de:n._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},L:{en:n._EnInt,de:n._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},f:{en:n._En754,de:n._De754,len:4,mLen:23,rt:Math.pow(2,-24)-Math.pow(2,-77)},d:{en:n._En754,de:n._De754,len:8,mLen:52,rt:0},q:{en:n._EnInt64,de:n._DeInt64,bSigned:!0},Q:{en:n._EnInt64,de:n._DeInt64,bSigned:!1}},n._UnpackSeries=function(t,n,r,i){for(var o=e.de,s=[],a=0;a<t;s.push(o(r,i+a*n)),a++);return s},n._PackSeries=function(t,n,r,i,o,s){for(var a=e.en,c=0;c<t;a(r,i+c*n,o[s+c]),c++);},n.Unpack=function(n,r,i){t="<"!=n.charAt(0),i=i||0;for(var o,s,a,c=new RegExp(this._sPattern,"g"),u=[];o=c.exec(n);){if(i+(s=null==o[1]||""==o[1]?1:parseInt(o[1]))*(a=this._lenLut[o[2]])>r.length)return;switch(o[2]){case"A":case"s":u.push(this._elLut[o[2]].de(r,i,s));break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":e=this._elLut[o[2]],u.push(this._UnpackSeries(s,a,r,i))}i+=s*a}return Array.prototype.concat.apply([],u)},n.PackTo=function(n,r,i,o){t="<"!=n.charAt(0);for(var s,a,c,u,l=new RegExp(this._sPattern,"g"),p=0;s=l.exec(n);){if(i+(a=null==s[1]||""==s[1]?1:parseInt(s[1]))*(c=this._lenLut[s[2]])>r.length)return!1;switch(s[2]){case"A":case"s":if(p+1>o.length)return!1;this._elLut[s[2]].en(r,i,a,o[p]),p+=1;break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":if(e=this._elLut[s[2]],p+a>o.length)return!1;this._PackSeries(a,c,r,i,o,p),p+=a;break;case"x":for(u=0;u<a;u++)r[i+u]=0}i+=a*c}return r},n.Pack=function(e,t){return this.PackTo(e,new Array(this.CalcLength(e)),0,t)},n.CalcLength=function(e){for(var t,n=new RegExp(this._sPattern,"g"),r=0;t=n.exec(e);)r+=(null==t[1]||""==t[1]?1:parseInt(t[1]))*this._lenLut[t[2]];return r}}},3144:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(2887)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},2887:(e,t,n)=>{e.exports=function(e){function t(e){let n,i,o,s=null;function a(...e){if(!a.enabled)return;const r=a,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];n=o.call(r,t),e.splice(s,1),s--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,n){const r=t(this.namespace+("undefined"==typeof n?":":n)+e);return r.log=this.log,r}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(8582),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},4652:(e,t,n)=>{"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=n(3144):e.exports=n(314)},314:(e,t,n)=>{const r=n(2018),i=n(9023);t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r<n.length;r++)e.inspectOpts[n[r]]=t.inspectOpts[n[r]]},t.log=function(...e){return process.stderr.write(i.formatWithOptions(t.inspectOpts,...e)+"\n")},t.formatArgs=function(n){const{namespace:r,useColors:i}=this;if(i){const t=this.color,i="[3"+(t<8?t:"8;5;"+t),o=` ${i};1m${r} `;n[0]=o+n[0].split("\n").join("\n"+o),n.push(i+"m+"+e.exports.humanize(this.diff)+"")}else n[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+r+" "+n[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):r.isatty(process.stderr.fd)},t.destroy=i.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=n(932);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=n(2887)(t);const{formatters:o}=e.exports;o.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},o.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}},2851:e=>{"use strict";e.exports=(e,t=process.argv)=>{const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),i=t.indexOf("--");return-1!==r&&(-1===i||r<i)}},8582:e=>{var t=1e3,n=60*t,r=60*n,i=24*r,o=7*i,s=365.25*i;function a(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,c){c=c||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===u&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=i)return a(e,o,i,"day");if(o>=r)return a(e,o,r,"hour");if(o>=n)return a(e,o,n,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=r)return Math.round(e/r)+"h";if(o>=n)return Math.round(e/n)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},932:(e,t,n)=>{"use strict";const r=n(857),i=n(2018),o=n(2851),{env:s}=process;let a;function c(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function u(e,t){if(0===a)return 0;if(o("color=16m")||o("color=full")||o("color=truecolor"))return 3;if(o("color=256"))return 2;if(e&&!t&&void 0===a)return 0;const n=a||0;if("dumb"===s.TERM)return n;if("win32"===process.platform){const e=r.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in s)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in s))||"codeship"===s.CI_NAME?1:n;if("TEAMCITY_VERSION"in s)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(s.TEAMCITY_VERSION)?1:0;if("truecolor"===s.COLORTERM)return 3;if("TERM_PROGRAM"in s){const e=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(s.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(s.TERM)||"COLORTERM"in s?1:n}o("no-color")||o("no-colors")||o("color=false")||o("color=never")?a=0:(o("color")||o("colors")||o("color=true")||o("color=always"))&&(a=1),"FORCE_COLOR"in s&&(a="true"===s.FORCE_COLOR?1:"false"===s.FORCE_COLOR?0:0===s.FORCE_COLOR.length?1:Math.min(parseInt(s.FORCE_COLOR,10),3)),e.exports={supportsColor:function(e){return c(u(e,e&&e.isTTY))},stdout:c(u(!0,i.isatty(1))),stderr:c(u(!0,i.isatty(2)))}},4803:e=>{var t="__lodash_hash_undefined__",n="[object Function]",r="[object GeneratorFunction]",i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/,s=/^\./,a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,c=/\\(\\)?/g,u=/^\[object .+?Constructor\]$/,l="object"==typeof global&&global&&global.Object===Object&&global,p="object"==typeof self&&self&&self.Object===Object&&self,d=l||p||Function("return this")();var h,f=Array.prototype,m=Function.prototype,g=Object.prototype,y=d["__core-js_shared__"],v=(h=/[^.]+$/.exec(y&&y.keys&&y.keys.IE_PROTO||""))?"Symbol(src)_1."+h:"",w=m.toString,b=g.hasOwnProperty,S=g.toString,T=RegExp("^"+w.call(b).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_=d.Symbol,P=f.splice,C=M(d,"Map"),E=M(Object,"create"),O=_?_.prototype:void 0,I=O?O.toString:void 0;function D(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function x(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function A(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function R(e,t){for(var n,r,i=e.length;i--;)if((n=e[i][0])===(r=t)||n!=n&&r!=r)return i;return-1}function k(e,t){var n;t=function(e,t){if(B(e))return!1;var n=typeof e;if("number"==n||"symbol"==n||"boolean"==n||null==e||V(e))return!0;return o.test(e)||!i.test(e)||null!=t&&e in Object(t)}(t,e)?[t]:B(n=t)?n:L(n);for(var r=0,s=t.length;null!=e&&r<s;)e=e[U(t[r++])];return r&&r==s?e:void 0}function N(e){if(!H(e)||(t=e,v&&v in t))return!1;var t,i=function(e){var t=H(e)?S.call(e):"";return t==n||t==r}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?T:u;return i.test(function(e){if(null!=e){try{return w.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function F(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function M(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return N(n)?n:void 0}D.prototype.clear=function(){this.__data__=E?E(null):{}},D.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},D.prototype.get=function(e){var n=this.__data__;if(E){var r=n[e];return r===t?void 0:r}return b.call(n,e)?n[e]:void 0},D.prototype.has=function(e){var t=this.__data__;return E?void 0!==t[e]:b.call(t,e)},D.prototype.set=function(e,n){return this.__data__[e]=E&&void 0===n?t:n,this},x.prototype.clear=function(){this.__data__=[]},x.prototype.delete=function(e){var t=this.__data__,n=R(t,e);return!(n<0)&&(n==t.length-1?t.pop():P.call(t,n,1),!0)},x.prototype.get=function(e){var t=this.__data__,n=R(t,e);return n<0?void 0:t[n][1]},x.prototype.has=function(e){return R(this.__data__,e)>-1},x.prototype.set=function(e,t){var n=this.__data__,r=R(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},A.prototype.clear=function(){this.__data__={hash:new D,map:new(C||x),string:new D}},A.prototype.delete=function(e){return F(this,e).delete(e)},A.prototype.get=function(e){return F(this,e).get(e)},A.prototype.has=function(e){return F(this,e).has(e)},A.prototype.set=function(e,t){return F(this,e).set(e,t),this};var L=j((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(V(e))return I?I.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return s.test(e)&&n.push(""),e.replace(a,(function(e,t,r,i){n.push(r?i.replace(c,"$1"):t||e)})),n}));function U(e){if("string"==typeof e||V(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function j(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(j.Cache||A),n}j.Cache=A;var B=Array.isArray;function H(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function V(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==S.call(e)}e.exports=function(e,t,n){var r=null==e?void 0:k(e,t);return void 0===r?n:r}},8377:(e,t,n)=>{const r=n(8611),i=n(5692),o=n(6982),s=n(4434),a=n(7016),c=n(9023),u=n(527).linerase,l=n(527).parseSOAPString,p=n(1802).parseString,d=n(1802).processors.stripPrefix,h=function(){};var f=function(e,t){s.EventEmitter.call(this),t=t||h,this.useSecure=e.useSecure||!1,this.secureOpts=e.secureOpts||{},this.hostname=e.hostname,this.username=e.username,this.password=e.password,this.port=e.port||(e.useSecure?443:80),this.path=e.path||"/onvif/device_service",this.timeout=e.timeout||12e4,this.agent=e.agent||!1,this.preserveAddress=e.preserveAddress||!1,this.events={},this.on("newListener",function(e){"event"===e&&0===this.listeners(e).length&&setImmediate(function(){this._eventRequest()}.bind(this))}.bind(this)),!1!==e.autoconnect&&setImmediate(function(){this.connect(t)}.bind(this))};c.inherits(f,s.EventEmitter),f.prototype.connect=function(e){this.getSystemDateAndTime(function(t,n,r){if(t)return e.call(this,t,null,r);function i(){var t=[];this.uri&&this.uri.media&&(t.push(this.getProfiles),t.push(this.getVideoSources));var n=t.length,r=!1;if(n>0)t.forEach(function(t){t.call(this,function(t){if(t)e&&!r&&(e.call(this,t),r=!0);else if(! --n&&(this.getActiveSources(),this.emit("connect"),e))return e.call(this,t)}.bind(this))}.bind(this));else if(this.emit("connect"),e)return e.call(this,!1)}this.getServices(!0,function(t){return t?this.getCapabilities(function(t,n,r){return t?e.call(this,t,null,r):i.call(this)}.bind(this)):this.media2Support?void this.getProfiles(function(e){return e&&(this.media2Support=!1),i.call(this)}.bind(this)):i.call(this)}.bind(this))}.bind(this))},f.prototype._request=function(e,t){if("function"!=typeof t)throw new Error("'callback' must be a function");if(void 0===e.body)throw new Error("'options.body' must be a defined");if(void 0===e.action||null===e.action){let n={xmlns:!0,tagNameProcessors:[d]};p(e.body,n,((n,r)=>{if(n)return t(n);for(const t of Object.keys(r.Envelope.Body[0])){const n=r.Envelope.Body[0][t];if(!1===t.startsWith("$")){e.action=n[0].$ns.uri+"/"+n[0].$ns.local;break}}this._requestPart2.call(this,e,t)}))}else this._requestPart2.call(this,e,t)},f.prototype._requestPart2=function(e,t){var n=this,o=!1,s=e.url||{hostname:this.hostname,port:this.port,agent:this.agent,path:e.service?this.uri&&this.uri[e.service]?this.uri[e.service].path:e.service:this.path,timeout:this.timeout};s.headers={"Content-Type":`application/soap+xml;charset=utf-8;action="${e.action}"`,"Content-Length":Buffer.byteLength(e.body,"utf8"),charset:"utf-8"},s.method="POST";var a=this.useSecure?i:r;s=this.useSecure?Object.assign({},this.secureOpts,s):s;var c=a.request(s,(function(e){const r=e.statusCode;var i=[],s=0;e.on("data",(function(e){i.push(e),s+=e.length})),e.on("end",(function(){if(!0!==o){o=!0;var e=Buffer.concat(i,s).toString("utf8");n.emit("rawResponse",e,r),l(e,t,r)}}))}));c.setTimeout(e.replyTimeout?e.replyTimeout:this.timeout,(function(){!0!==o&&(o=!0,t(new Error("Network timeout")),c.abort())})),c.on("error",(function(e){!0!==o&&(o=!0,"ECONNREFUSED"===e.code&&"ECONNREFUSED"===e.errno&&"connect"===e.syscall||"ECONNRESET"===e.code&&"ECONNRESET"===e.errno&&e.syscall,t(e))})),this.emit("rawRequest",e.body),c.write(e.body),c.end()},f.prototype.getSystemDateAndTime=function(e){this._request({body:'<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>'},function(t,n,r,i){if(!t)try{let i,o=n[0].getSystemDateAndTimeResponse[0].systemDateAndTime[0],s=o.UTCDateTime||o.localDateTime;if(void 0===s)i=new Date;else{let e=u(s[0]);i=new Date(Date.UTC(e.date.year,e.date.month-1,e.date.day,e.time.hour,e.time.minute,e.time.second))}this.timeShift||(this.timeShift=i-1e3*process.uptime()),e.call(this,t,i,r)}catch(t){e.call(this,t,null,r)}if(t){let n="";r&&(n=r.toLowerCase()),i&&401===i||r&&(n.includes("sender not authorized")||n.includes("unauthorized")||n.includes("notauthorized"))?this._request({body:this._envelopeHeader()+'<GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/>'+this._envelopeFooter()},function(t,n,r){try{let i,o=n[0].getSystemDateAndTimeResponse[0].systemDateAndTime[0],s=o.UTCDateTime||o.localDateTime;if(void 0===s)i=new Date;else{let e=u(s[0]);i=new Date(Date.UTC(e.date.year,e.date.month-1,e.date.day,e.time.hour,e.time.minute,e.time.second))}this.timeShift||(this.timeShift=i-1e3*process.uptime()),e.call(this,t,i,r)}catch(t){e.call(this,t,null,r)}}.bind(this)):e.call(this,t,null,r)}}.bind(this))},f.prototype.setSystemDateAndTime=function(e,t){if(-1===["Manual","NTP"].indexOf(e.dateTimeType))return t(new Error("DateTimeType should be `Manual` or `NTP`"));this._request({body:this._envelopeHeader()+'<SetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"><DateTimeType>'+e.dateTimeType+"</DateTimeType><DaylightSavings>"+!!e.daylightSavings+"</DaylightSavings>"+(void 0!==e.timezone?'<TimeZone><TZ xmlns="http://www.onvif.org/ver10/schema">'+e.timezone+"</TZ></TimeZone>":"")+(void 0!==e.dateTime&&e.dateTime instanceof Date?'<UTCDateTime><Time xmlns="http://www.onvif.org/ver10/schema"><Hour>'+e.dateTime.getUTCHours()+"</Hour><Minute>"+e.dateTime.getUTCMinutes()+"</Minute><Second>"+e.dateTime.getUTCSeconds()+'</Second></Time><Date xmlns="http://www.onvif.org/ver10/schema"><Year>'+e.dateTime.getUTCFullYear()+"</Year><Month>"+(e.dateTime.getUTCMonth()+1)+"</Month><Day>"+e.dateTime.getUTCDate()+"</Day></Date></UTCDateTime>":"")+"</SetSystemDateAndTime>"+this._envelopeFooter()},function(e,n,r){if(e||""!==u(n).setSystemDateAndTimeResponse)return t.call(this,""!==u(n).setSystemDateAndTimeResponse?new Error("Wrong `SetSystemDateAndTime` response"):e,n,r);this.getSystemDateAndTime(t)}.bind(this))},f.prototype.getCapabilities=function(e){this._request({body:this._envelopeHeader()+'<GetCapabilities xmlns="http://www.onvif.org/ver10/device/wsdl"><Category>All</Category></GetCapabilities>'+this._envelopeFooter()},function(t,n,r){if(!t&&(this.capabilities=u(n[0].getCapabilitiesResponse[0].capabilities[0]),this.uri||(this.uri={}),["PTZ","media","imaging","events","device"].forEach(function(e){this.capabilities[e]&&this.capabilities[e].XAddr&&(this.uri[e.toLowerCase()]=this._parseUrl(this.capabilities[e].XAddr))}.bind(this)),this.capabilities.extension&&Object.keys(this.capabilities.extension).forEach(function(e){this.capabilities.extension[e].XAddr&&(this.uri[e]=a.parse(this.capabilities.extension[e].XAddr))}.bind(this)),this.uri.replay&&!this.uri.recording)){var i=this.uri.replay.href.replace("replay","recording");console.warn("WARNING: Adding "+i+" for bad Profile G device"),this.uri.recording=a.parse(i)}e&&e.call(this,t,this.capabilities,r)}.bind(this))},f.prototype.getServiceCapabilities=function(e){this._request({body:this._envelopeHeader()+'<GetServiceCapabilities xmlns="http://www.onvif.org/ver10/device/wsdl" />'+this._envelopeFooter()},function(t,n,r){t||(n=u(n),this.serviceCapabilities={network:n.getServiceCapabilitiesResponse.capabilities.network.$,security:n.getServiceCapabilitiesResponse.capabilities.security.$,system:n.getServiceCapabilitiesResponse.capabilities.system.$},n.getServiceCapabilitiesResponse.capabilities.misc&&(this.serviceCapabilities.auxiliaryCommands=n.getServiceCapabilitiesResponse.capabilities.misc.$.AuxiliaryCommands.split(" "))),e&&e.call(this,t,this.serviceCapabilities,r)}.bind(this))},f.prototype.getActiveSources=function(){this.videoSources.$&&(this.videoSources=[this.videoSources]),this.defaultProfiles=[],this.activeSources=[],this.videoSources.forEach(function(e,t){var n=e.$.token,r=this.profiles.filter((function(e){if(e.videoSourceConfiguration&&e.videoEncoderConfiguration&&(e.videoSourceConfiguration.sourceToken===n||e.videoSourceConfiguration.sourceToken===e.videoSourceConfiguration.name))return!0}));if(0!==r.length){if(0===t&&(this.defaultProfile=r[0]),this.defaultProfiles[t]=r[0],this.activeSources[t]={sourceToken:e.$.token,profileToken:this.defaultProfiles[t].$.token,videoSourceConfigurationToken:this.defaultProfiles[t].videoSourceConfiguration.$.token},this.defaultProfiles[t].videoEncoderConfiguration){var i=this.defaultProfiles[t].videoEncoderConfiguration;this.activeSources[t].encoding=i.encoding,this.activeSources[t].width=i.resolution?i.resolution.width:"",this.activeSources[t].height=i.resolution?i.resolution.height:"",this.activeSources[t].fps=i.rateControl?i.rateControl.frameRateLimit:"",this.activeSources[t].bitrate=i.rateControl?i.rateControl.bitrateLimit:""}0===t&&(this.activeSource=this.activeSources[t]),this.defaultProfiles[t].PTZConfiguration&&(this.activeSources[t].ptz={name:this.defaultProfiles[t].PTZConfiguration.name,token:this.defaultProfiles[t].PTZConfiguration.$.token})}else if(0===t)throw new Error("Unrecognized configuration")}.bind(this)),0===this.activeSources.length&&this.emit("warning","There are no active sources at this device")},f.prototype.getServices=function(e,t){"function"==typeof e&&(t=e,e=!0),this._request({body:this._envelopeHeader()+'<GetServices xmlns="http://www.onvif.org/ver10/device/wsdl"><IncludeCapability>'+e+"</IncludeCapability></GetServices>"+this._envelopeFooter()},function(e,n,r){e||(this.services=u(n).getServicesResponse.service,this.uri||(this.uri={}),this.media2Support=!1,this.services.forEach((e=>{if(Object.prototype.hasOwnProperty.call(e,"namespace")&&Object.prototype.hasOwnProperty.call(e,"XAddr")){let t=a.parse(e.namespace);if("www.onvif.org"===t.hostname){let n=t.path.substring(1).split("/");"media"===n[1]&&"ver20"===n[0]&&(this.media2Support=!0,n[1]="media2"),this.uri[n[1]]=this._parseUrl(e.XAddr)}}}))),t&&t.call(this,e,this.services,r)}.bind(this))},f.prototype.getDeviceInformation=function(e){this._request({body:this._envelopeHeader()+'<GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/>'+this._envelopeFooter()},function(t,n,r){t||(this.deviceInformation=u(n).getDeviceInformationResponse),e&&e.call(this,t,this.deviceInformation,r)}.bind(this))},f.prototype.getHostname=function(e){this._request({body:this._envelopeHeader()+'<GetHostname xmlns="http://www.onvif.org/ver10/device/wsdl"/>'+this._envelopeFooter()},function(t,n,r){e&&e.call(this,t,t?null:u(n).getHostnameResponse.hostnameInformation,r)}.bind(this))},f.prototype.getScopes=function(e){this._request({body:this._envelopeHeader()+'<GetScopes xmlns="http://www.onvif.org/ver10/device/wsdl"/>'+this._envelopeFooter()},function(t,n,r){t||(this.scopes=u(n).getScopesResponse.scopes,void 0===this.scopes?this.scopes=[]:Array.isArray(this.scopes)||(this.scopes=[this.scopes])),e&&e.call(this,t,this.scopes,r)}.bind(this))},f.prototype.setScopes=function(e,t){this._request({body:this._envelopeHeader()+'<SetScopes xmlns="http://www.onvif.org/ver10/device/wsdl">'+e.map((function(e){return"<Scopes>"+e+"</Scopes>"})).join("")+"</SetScopes>"+this._envelopeFooter()},function(e,n,r){if(e||""!==u(n).setScopesResponse)return t(""!==u(n).setScopesResponse?new Error("Wrong `SetScopes` response"):e,n,r);this.getScopes(t)}.bind(this))},f.prototype.systemReboot=function(e){this._request({service:"deviceIO",body:this._envelopeHeader()+'<SystemReboot xmlns="http://www.onvif.org/ver10/device/wsdl"/>'+this._envelopeFooter()},(function(t,n,r){t||(n=n[0].systemRebootResponse[0].message[0]),e.call(this,t,n,r)}))},f.prototype.setSystemFactoryDefault=function(e,t){void 0===t&&(t=e,e=!1);let n=this._envelopeHeader()+'<SetSystemFactoryDefault xmlns="http://www.onvif.org/ver10/device/wsdl"><FactoryDefault>'+(e?"Hard":"Soft")+"</FactoryDefault></SetSystemFactoryDefault>"+this._envelopeFooter();this._request({service:"device",body:n},(function(e,n,r){t&&t.call(this,e,null,r)}))},f.prototype._passwordDigest=function(){let e=new Date(1e3*process.uptime()+(this.timeShift||0)).toISOString(),t=Buffer.allocUnsafe(16);t.writeUIntLE(Math.ceil(4294967296*Math.random()),0,4),t.writeUIntLE(Math.ceil(4294967296*Math.random()),4,4),t.writeUIntLE(Math.ceil(4294967296*Math.random()),8,4),t.writeUIntLE(Math.ceil(4294967296*Math.random()),12,4);let n=o.createHash("sha1");return n.update(Buffer.concat([t,Buffer.from(e,"ascii"),Buffer.from(this.password,"ascii")])),{passdigest:n.digest("base64"),nonce:t.toString("base64"),timestamp:e}},f.prototype._envelopeHeader=function(e){var t='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header>';if(this.username&&this.password){var n=this._passwordDigest();t+='<Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>'+this.username+'</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">'+n.passdigest+'</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">'+n.nonce+'</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">'+n.timestamp+"</Created></UsernameToken></Security>"}return void 0!==e&&e||(t+='</s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">'),t},f.prototype._envelopeFooter=function(){return"</s:Body></s:Envelope>"},f.prototype._parseUrl=function(e){const t=a.parse(e);return!this.preserveAddress||this.hostname===t.hostname&&this.port===t.port||(t.hostname=this.hostname,t.host=this.hostname+":"+this.port,t.port=this.port,t.href=a.format(t)),t},e.exports={Cam:f},n(8030)(f),n(6941)(f),n(5570)(f),n(8096)(f),n(1556)(f),n(8149)(f),n(4623)(f)},8030:(e,t,n)=>{e.exports=function(e){const t=n(527).linerase;e.prototype.getNTP=function(e){this._request({service:"device",body:this._envelopeHeader()+'<GetNTP xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>'},(function(n,r,i){n||(this.NTP=t(r[0].getNTPResponse[0].NTPInformation[0])),e.call(this,n,n?null:this.NTP,i)}))},e.prototype.setNTP=function(e,t){Array.isArray(e.NTPManual)||(e.NTPManual=[]),(e.type||e.ipv4Address||e.ipv6Address||e.dnsName||e.extension)&&e.NTPManual.push({type:e.type,IPv4Address:e.ipv4Address,IPv6Address:e.ipv6Address,DNSname:e.dnsName,extension:e.extension});let n=this._envelopeHeader()+'<SetNTP xmlns="http://www.onvif.org/ver10/device/wsdl"><FromDHCP>'+e.fromDHCP+"</FromDHCP>";e.NTPManual&&Array.isArray(e.NTPManual)&&e.NTPManual.forEach((e=>{n+=e.type?'<NTPManual><Type xmlns="http://www.onvif.org/ver10/schema">'+e.type+"</Type>"+(e.IPv4Address?'<IPv4Address xmlns="http://www.onvif.org/ver10/schema">'+e.IPv4Address+"</IPv4Address>":"")+(e.IPv6Address?'<IPv6Address xmlns="http://www.onvif.org/ver10/schema">'+e.IPv6Address+"</IPv6Address>":"")+(e.DNSname?"<DNSname>"+e.DNSname+"</DNSname>":"")+(e.extension?"<Extension>"+e.extension+"</Extension>":"")+"</NTPManual>":""})),n+="</SetNTP>"+this._envelopeFooter(),this._request({service:"device",body:n},t.bind(this))},e.prototype.getNetworkInterfaces=function(e){this._request({service:"device",body:this._envelopeHeader()+'<GetNetworkInterfaces xmlns="http://www.onvif.org/ver10/device/wsdl"/>'+this._envelopeFooter()},function(n,r,i){n||(this.networkInterfaces=t(r).getNetworkInterfacesResponse.networkInterfaces,Array.isArray(this.networkInterfaces)||(this.networkInterfaces=[this.networkInterfaces])),e&&e.call(this,n,this.networkInterfaces,i)}.bind(this))},e.prototype.setNetworkInterfaces=function(e,n){let r=e.networkInterface,i=!1,o=!1;if(r.IPv4)try{i=r.IPv4.manual.address!==this.hostname}catch(e){i=!1}else if(r.IPv6)try{o=r.IPv6.manual.address!==this.hostname}catch(e){o=!1}let s=this._envelopeHeader()+'<SetNetworkInterfaces xmlns="http://www.onvif.org/ver10/device/wsdl"><InterfaceToken>'+e.interfaceToken+'</InterfaceToken><NetworkInterface><Enabled xmlns="http://www.onvif.org/ver10/schema">'+r.enabled+"</Enabled>"+(r.link?'<Link xmlns="http://www.onvif.org/ver10/schema"><AutoNegotiation>'+r.link.autoNegotiation+"</AutoNegotiation><Speed>"+r.link.speed+"</Speed><Duplex>"+r.link.duplex+"</Duplex></Link>":"")+(isNaN(r.MTU)?"":'<MTU xmlns="http://www.onvif.org/ver10/schema">'+r.MTU+"</MTU>")+(r.IPv4?'<IPv4 xmlns="http://www.onvif.org/ver10/schema"><Enabled>'+r.IPv4.enabled+"</Enabled><Manual><Address>"+r.IPv4.manual.address+"</Address><PrefixLength>"+r.IPv4.manual.prefixLength+"</PrefixLength></Manual><DHCP>"+r.IPv4.DHCP+"</DHCP></IPv4>":"")+(r.IPv6?'<IPv6 xmlns="http://www.onvif.org/ver10/schema"><Enabled>'+r.IPv6.enabled+"</Enabled><AcceptRouterAdvert >"+r.IPv6.acceptRouterAdvert+"</AcceptRouterAdvert><Manual><Address>"+r.IPv6.manual.address+"</Address><PrefixLength>"+r.IPv6.manual.prefixLength+"</PrefixLength></Manual><DHCP>"+r.IPv6.DHCP+"</DHCP></IPv6>":"")+"</NetworkInterface></SetNetworkInterfaces>"+this._envelopeFooter();this._request({service:"device",body:s},function(e,s,a){n&&(e||(i&&(this.hostname=r.IPv4.manual.address),o&&(this.hostname=r.IPv6.manual.address),s=t(s[0].setNetworkInterfacesResponse)),n.call(this,e,s,a))}.bind(this))},e.prototype.getNetworkDefaultGateway=function(e){this._request({service:"device",body:this._envelopeHeader()+'<GetNetworkDefaultGateway xmlns="http://www.onvif.org/ver10/device/wsdl"/>'+this._envelopeFooter()},function(n,r,i){e&&(n||(this.networkDefaultGateway=t(r[0].getNetworkDefaultGatewayResponse[0].networkGateway)),e.call(this,n,this.networkDefaultGateway,i))}.bind(this))},e.prototype.setNetworkDefaultGateway=function(e,t){this._request({service:"device",body:this._envelopeHeader()+'<SetNetworkDefaultGateway xmlns="http://www.onvif.org/ver10/device/wsdl">'+(e.IPv4Address?"<IPv4Address>"+e.IPv4Address+"</IPv4Address>":"")+(e.IPv6Address?"<IPv6Address>"+e.IPv6Address+"</IPv6Address>":"")+"</SetNetworkDefaultGateway>"+this._envelopeFooter()},function(e,n,r){if(t){if(e)return t.call(this,e,n,r);this.getNetworkDefaultGateway(t.bind(this))}}.bind(this))},e.prototype.getDNS=function(e){this._request({service:"device",body:this._envelopeHeader()+'<GetDNS xmlns="http://www.onvif.org/ver10/device/wsdl"/>'+this._envelopeFooter()},function(n,r,i){e&&(n||(this.DNS=t(r[0].getDNSResponse[0].DNSInformation),this.DNS.DNSManual&&!Array.isArray(this.DNS.DNSManual)&&(this.DNS.DNSManual=[this.DNS.DNSManual]),this.DNS.DNSFromDHCP&&!Array.isArray(this.DNS.DNSFromDHCP)&&(this.DNS.DNSFromDHCP=[this.DNS.DNSFromDHCP])),e.call(this,n,this.DNS,i))}.bind(this))},e.prototype.setDNS=function(e,t){let n=this._envelopeHeader()+'<SetDNS xmlns="http://www.onvif.org/ver10/device/wsdl"><FromDHCP>'+!!e.fromDHCP+"</FromDHCP>"+(e.searchDomain?"<SearchDomain>"+e.searchDomain+"</SearchDomain>":"");e.DNSManual.forEach((function(e){n+='<DNSManual><Type xmlns="http://www.onvif.org/ver10/schema">'+("IPv6"===e.type?"IPv6":"IPv4")+"</Type>"+(e.IPv4Address?'<IPv4Address xmlns="http://www.onvif.org/ver10/schema">'+e.IPv4Address+"</IPv4Address>":"")+(e.IPv6Address?'<IPv6Address xmlns="http://www.onvif.org/ver10/schema">'+e.IPv6Address+"</IPv6Address>":"")+"</DNSManual>"})),n+="</SetDNS>"+this._envelopeFooter(),this._request({service:"device",body:n},function(e,n,r){if(t){if(e)return t.call(this,e,null,r);this.getDNS(t)}}.bind(this))},e.prototype.getNetworkProtocols=function(e){this._request({service:"device",body:this._envelopeHeader()+'<GetNetworkProtocols xmlns="http://www.onvif.org/ver10/device/wsdl"/>'+this._envelopeFooter()},function(n,r,i){n||(this.networkProtocols=t(r).getNetworkProtocolsResponse),e&&e.call(this,n,this.networkProtocols,i)}.bind(this))},e.prototype.getUsers=function(e){this._request({service:"device",body:this._envelopeHeader()+'<GetUsers xmlns="http://www.onvif.org/ver10/device/wsdl" />'+this._envelopeFooter()},function(n,r,i){if(e){if(!n){var o=r[0].getUsersResponse[0].user;o=o.map((function(e){return t(e)})),this.users=o,r=o}e.call(this,n,r,i)}}.bind(this))},e.prototype.createUsers=function(e,t){if(e.every((function(e){return!!(e.username&&e.password&&e.userLevel)}))){var n="";e.forEach((function(e){n+='<User><Username xmlns="http://www.onvif.org/ver10/schema">'+e.username+'</Username><Password xmlns="http://www.onvif.org/ver10/schema">'+e.password+'</Password><UserLevel xmlns="http://www.onvif.org/ver10/schema">'+e.userLevel+"</UserLevel></User>"}));var r=this._envelopeHeader()+'<CreateUsers xmlns="http://www.onvif.org/ver10/device/wsdl">'+n+"</CreateUsers>"+this._envelopeFooter();this._request({service:"device",body:r},function(e,n,r){t&&(e?t.call(this,e,n,r):this.getUsers(t))}.bind(this))}else t.call(this,new Error("Missing username, password or user level"),null,null)},e.prototype.setUsers=function(e,t){if(e.every((function(e){return!!(e.username&&e.password&&e.userLevel)}))){var n="";e.forEach((function(e){n+='<User><Username xmlns="http://www.onvif.org/ver10/schema">'+e.username+'</Username><Password xmlns="http://www.onvif.org/ver10/schema">'+e.password+'</Password><UserLevel xmlns="http://www.onvif.org/ver10/schema">'+e.userLevel+"</UserLevel></User>"}));var r=this._envelopeHeader()+'<SetUser xmlns="http://www.onvif.org/ver10/device/wsdl">'+n+"</SetUser>"+this._envelopeFooter();this._request({service:"device",body:r},function(n,r,i){if(t)if(n)t.call(this,n,r,i);else{var o=!1;e.some((function(e){if(e.username===this.username)return o=!0,this.password=e.password,!0})),o?setTimeout(function(){this.getUsers(t)}.bind(this),2e3):this.getUsers(t)}}.bind(this))}else t.call(this,new Error("Missing username, password or user level"),null,null)},e.prototype.deleteUsers=function(e,t){var n=[];if(e.forEach((function(e){"string"==typeof e&&e.length>0?n.push(e):"object"==typeof e&&e.username&&n.push(e.username)})),!n.length)return t.call(this,new Error("No username"),null,null);var r="";n.forEach((function(e){r+="<Username>"+e+"</Username>"}));var i=this._envelopeHeader()+'<DeleteUsers xmlns="http://www.onvif.org/ver10/device/wsdl">'+r+"</DeleteUsers>"+this._envelopeFooter();this._request({service:"device",body:i},function(e,n,r){t&&(e?t.call(this,e,n,r):this.getUsers(t))}.bind(this))},e.prototype.sendAuxiliaryCommand=function(e,t){let n=this._envelopeHeader()+'<SendAuxiliaryCommand xmlns="http://www.onvif.org/ver10/device/wsdl"><AuxiliaryCommand xmlns="http://www.onvif.org/ver10/schema">'+e.data+"</AuxiliaryCommand></SendAuxiliaryCommand>"+this._envelopeFooter();this._request({service:"device",body:n},function(e,n,r){t&&t.call(this,e,n,r)}.bind(this))}}},6748:(e,t,n)=>{const r=n(8377).Cam,i=n(4434),o=n(527).guid,s=n(527).linerase,a=n(527).parseSOAPString,c=n(7016),u=n(857);var l=Object.create(new i.EventEmitter);l.probe=function(e,t){void 0===t&&("function"==typeof e?(t=e,e={}):e=e||{}),t=t||function(){};var i={},p=[],d="urn:uuid:"+(e.messageId||o()),h=Buffer.from('<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><Header><wsa:MessageID xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">'+d+'</wsa:MessageID><wsa:To xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To><wsa:Action xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</wsa:Action></Header><Body><Probe xmlns="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Types>dn:NetworkVideoTransmitter</Types><Scopes /></Probe></Body></Envelope>'),f=n(7194).createSocket("udp4");f.on("error",(function(e){l.emit("error",e),t(e)}));const m=function(t,n){a(t.toString(),(function(t,o,a,u){if(t||!o[0].probeMatches)p.push(t||new Error("Wrong SOAP message from "+n.address+":"+n.port,a)),l.emit("error","Wrong SOAP message from "+n.address+":"+n.port,a);else{var d=(o=s(o)).probeMatches.probeMatch.endpointReference.address;if(!i[d]){var h;if(!1!==e.resolve){var f=o.probeMatches.probeMatch.XAddrs.split(" ").map(c.parse),m=(g=f,y=n.address,g.filter((function(e){return e.hostname===y}))[0]||g[0]);(h=new r({hostname:m.hostname,port:m.port,path:m.path,urn:d})).xaddrs=f}else h=o;i[d]=h,l.emit("device",h,n,a)}}var g,y}),200)};if(e.device){var g=u.networkInterfaces();e.device in g&&g[e.device].some((function(t){if("IPv4"===t.family)return f.bind(e.listeningPort||null,t.address),!0}))}f.on("message",m),f.send(h,0,h.length,3702,"239.255.255.250"),setTimeout(function(){f.removeListener("message",m),f.close(),t(p.length?p:null,Object.keys(i).map((function(e){return i[e]})))}.bind(this),e.timeout||5e3)},e.exports={Discovery:l}},6941:(e,t,n)=>{e.exports=function(e){const t=n(527).linerase,r=n(527).parseSOAPString,i=["ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENETUNREACH"];function o(e){return new Date(Date.now()-e.currentTime.getTime()+e.terminationTime.getTime())}e.prototype.getEventProperties=function(e){this._request({service:"events",body:this._envelopeHeader()+'<GetEventProperties xmlns="http://www.onvif.org/ver10/events/wsdl"/>'+this._envelopeFooter()},function(n,r,i){n||(this.events.properties=t(r).getEventPropertiesResponse),e.call(this,n,n?null:this.events.properties,i)}.bind(this))},e.prototype.getEventServiceCapabilities=function(e){this._request({service:"events",body:this._envelopeHeader()+'<GetServiceCapabilities xmlns="http://www.onvif.org/ver10/events/wsdl"/>'+this._envelopeFooter()},function(n,r,i){if(!n)var o=t(r[0].getServiceCapabilitiesResponse[0].capabilities[0].$);e.call(this,n,o,i)}.bind(this))},e.prototype.subscribe=function(e,n){let r=this._envelopeHeader(!0);r+="<a:ReplyTo><a:Address>"+e.url+"</a:Address></a:ReplyTo>",r+='</s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Subscribe xmlns="http://docs.oasis-open.org/wsn/b-2"><ConsumerReference><a:Address>'+e.url+"</a:Address></ConsumerReference><InitialTerminationTime>PT2M</InitialTerminationTime></Subscribe>"+this._envelopeFooter(),this._request({service:"events",body:r},function(e,r,i){e||(this.events.subscription=t(r[0].subscribeResponse[0]),this.events.subscription.subscriptionReference.address=this._parseUrl(this.events.subscription.subscriptionReference.address),this.events.terminationTime=o(this.events.subscription)),n.call(this,e,e?null:this.events.subscription,i)}.bind(this))},e.prototype.createPullPointSubscription=function(e){this._request({service:"events",body:this._envelopeHeader()+'<CreatePullPointSubscription xmlns="http://www.onvif.org/ver10/events/wsdl"><InitialTerminationTime>PT2M</InitialTerminationTime></CreatePullPointSubscription>'+this._envelopeFooter()},function(n,r,i){n||(this.events.subscription=t(r[0].createPullPointSubscriptionResponse[0]),this.events.subscription.subscriptionReference.address=this._parseUrl(this.events.subscription.subscriptionReference.address),this.events.terminationTime=o(this.events.subscription)),e.call(this,n,n?null:this.events.subscription,i)}.bind(this))},e.prototype.renew=function(e,n){n||(n=e);let r=null,i=null;try{r=this.events.subscription.subscriptionReference.address}catch(e){return void(n&&n.call&&n.call(this,new Error("You should create pull-point subscription first!")))}try{i=this.events.subscription.subscriptionReference.referenceParameters.subscriptionId}catch(e){i=null}let o=this._envelopeHeader(!0);o+=i?'<a:To mustUnderstand="1">'+r.href+'</a:To><SubscriptionId xmlns="http://www.axis.com/2009/event" a:IsReferenceParameter="true">'+this.events.subscription.subscriptionReference.referenceParameters.subscriptionId+"</SubscriptionId>":"<a:To>"+r.href+"</a:To>",o+='</s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Renew xmlns="http://docs.oasis-open.org/wsn/b-2"><TerminationTime>PT2M</TerminationTime></Renew>'+this._envelopeFooter(),this._request({url:r,body:o},function(e,r,i){if(!e)var o=t(r).renewResponse;n.call(this,e,o,i)}.bind(this))},e.prototype.pullMessages=function(e,n){let r=null,i=null;try{r=this.events.subscription.subscriptionReference.address}catch(e){if(!n||!n.call)throw new Error("You should create pull-point subscription first!");return void n.call(this,new Error("You should create pull-point subscription first!"))}try{i=this.events.subscription.subscriptionReference.referenceParameters.subscriptionId}catch(e){i=null}let o=this._envelopeHeader(!0);o+=i?'<a:To mustUnderstand="1">'+r.href+'</a:To><SubscriptionId xmlns="http://www.axis.com/2009/event" a:IsReferenceParameter="true">'+i+"</SubscriptionId>":"<a:To>"+r.href+"</a:To>",o+='</s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><PullMessages xmlns="http://www.onvif.org/ver10/events/wsdl"><Timeout>PT1M</Timeout><MessageLimit>'+(e.messageLimit||10)+"</MessageLimit></PullMessages>"+this._envelopeFooter(),this._request({url:r,body:o,replyTimeout:8e4},function(e,r,i){if(!e)var o=t(r).pullMessagesResponse;n.call(this,e,o,i)}.bind(this))},e.prototype.unsubscribe=function(e,n){let r=null,i=null;try{r=this.events.subscription.subscriptionReference.address}catch(t){return void(e&&e.call&&e.call(this,new Error("You should create pull-point subscription first!")))}try{i=this.events.subscription.subscriptionReference.referenceParameters.subscriptionId}catch(e){i=null}delete this.events.subscription,delete this.events.terminationTime;let o=this._envelopeHeader(!0);o+=i?'<a:To mustUnderstand="1">'+r.href+'</a:To><SubscriptionId xmlns="http://www.axis.com/2009/event" a:IsReferenceParameter="true">'+i+"</SubscriptionId>":"<a:To>"+r.href+"</a:To>",o+='</s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Unsubscribe xmlns="http://docs.oasis-open.org/wsn/b-2"/>'+this._envelopeFooter(),this._request({url:r,body:o},function(r,i,o){if(!r){n||this.removeAllListeners("event");var s=t(i).unsubscribeResponse}e&&e.call&&e.call(this,r,s,o)}.bind(this))},e.prototype._eventRequest=function(){this.listeners("event").length?(this.events.messageLimit=this.events.messageLimit||10,!this.events.subscription||!this.events.terminationTime||Date.now()>this.events.terminationTime?this.createPullPointSubscription(function(e){e?(this.emit("eventsError",e),"object"==typeof e&&i.includes(e.code)&&this._restartEventRequest()):(delete this._eventReconnectms,this._eventPull())}.bind(this)):this._eventPull()):(delete this.events.terminationTime,this.unsubscribe())},e.prototype._eventPull=function(){this.listeners("event").length&&this.events.subscription?this.pullMessages({messageLimit:this.events.messageLimit},function(e,t,n){e?(this.emit("eventsError",e),"object"==typeof e&&i.includes(e.code)?this._restartEventRequest():this.unsubscribe((function(e,t,n){this._eventRequest()}),!0)):(delete this._eventReconnectms,t.notificationMessage&&(Array.isArray(t.notificationMessage)||(t.notificationMessage=[t.notificationMessage]),t.notificationMessage.forEach(function(e){this.emit("event",e,n)}.bind(this))),this.events.terminationTime=o(t),this.renew({},(function(e,t){e||(this.events.terminationTime=o(t)),this._eventRequest()})))}.bind(this)):(delete this.events.terminationTime,this.events.subscription&&this.unsubscribe())},e.prototype._restartEventRequest=function(){this._eventReconnectms||(this._eventReconnectms=10),se