@scrypted/amcrest
Advanced tools
Comparing version 0.0.27 to 0.0.28
@@ -1,1 +0,1 @@ | ||
!function(e,t){for(var r in t)e[r]=t[r]}(window,function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=17)}([function(e,t,r){"use strict";var o=r(5),n=Object.prototype.toString;function s(e){return"[object Array]"===n.call(e)}function i(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==n.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===n.call(e)}function p(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(null,e[n],n,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===n.call(e)},isBuffer:function(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:c,isUndefined:i,isDate:function(e){return"[object Date]"===n.call(e)},isFile:function(e){return"[object File]"===n.call(e)},isBlob:function(e){return"[object Blob]"===n.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:p,merge:function e(){var t={};function r(r,o){c(t[o])&&c(r)?t[o]=e(t[o],r):c(r)?t[o]=e({},r):s(r)?t[o]=r.slice():t[o]=r}for(var o=0,n=arguments.length;o<n;o++)p(arguments[o],r);return t},extend:function(e,t,r){return p(t,(function(t,n){e[n]=r&&"function"==typeof t?o(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(e,t){e.exports=require("url")},function(e,t,r){"use strict";var o=r(0);function n(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(o.isURLSearchParams(t))s=t.toString();else{var i=[];o.forEach(t,(function(e,t){null!=e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,(function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),i.push(n(t)+"="+n(e))})))})),s=i.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},function(e,t,r){"use strict";var o=r(9);e.exports=function(e,t,r,n,s){var i=new Error(e);return o(i,t,r,n,s)}},function(e,t,r){"use strict";var o=r(18);try{o=Object.assign(o,{log:deviceManager.getDeviceLogger(void 0),deviceManager:deviceManager,endpointManager:endpointManager,mediaManager:mediaManager,systemManager:systemManager,pluginHostAPI:pluginHostAPI})}catch(e){console.error("sdk initialization error, import @scrypted/sdk/types instead",e)}e.exports=o,e.exports.default=o},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),o=0;o<r.length;o++)r[o]=arguments[o];return e.apply(t,r)}}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";var o=r(0),n=r(29),s={"Content-Type":"application/x-www-form-urlencoded"};function i(e,t){!o.isUndefined(e)&&o.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,c={adapter:("undefined"!=typeof XMLHttpRequest?a=r(30):"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(a=r(36)),a),transformRequest:[function(e,t){return n(t,"Accept"),n(t,"Content-Type"),o.isFormData(e)||o.isArrayBuffer(e)||o.isBuffer(e)||o.isStream(e)||o.isFile(e)||o.isBlob(e)?e:o.isArrayBufferView(e)?e.buffer:o.isURLSearchParams(e)?(i(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):o.isObject(e)?(i(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),o.forEach(["post","put","patch"],(function(e){c.headers[e]=o.merge(s)})),e.exports=c},function(e,t,r){"use strict";var o=r(3);e.exports=function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(o("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},function(e,t,r){"use strict";e.exports=function(e,t,r,o,n){return e.config=t,r&&(e.code=r),e.request=o,e.response=n,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,r){"use strict";var o=r(32),n=r(33);e.exports=function(e,t){return e&&!o(t)?n(e,t):t}},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("https")},function(e,t,r){"use strict";var o=r(1),n=o.URL,s=r(11),i=r(12),a=r(14).Writable,c=r(37),u=r(38),p=["abort","aborted","connect","error","socket","timeout"],d=Object.create(null);p.forEach((function(e){d[e]=function(t,r,o){this._redirectable.emit(e,t,r,o)}}));var h=x("ERR_FR_REDIRECTION_FAILURE",""),f=x("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),l=x("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),m=x("ERR_STREAM_WRITE_AFTER_END","write after end");function g(e,t){a.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var r=this;this._onNativeResponse=function(e){r._processResponse(e)},this._performRequest()}function v(e){var t={maxRedirects:21,maxBodyLength:10485760},r={};return Object.keys(e).forEach((function(s){var i=s+":",a=r[i]=e[s],p=t[s]=Object.create(a);Object.defineProperties(p,{request:{value:function(e,s,a){if("string"==typeof e){var p=e;try{e=S(new n(p))}catch(t){e=o.parse(p)}}else n&&e instanceof n?e=S(e):(a=s,s=e,e={protocol:i});return"function"==typeof s&&(a=s,s=null),(s=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,s)).nativeProtocols=r,c.equal(s.protocol,i,"protocol mismatch"),u("options",s),new g(s,a)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,r){var o=p.request(e,t,r);return o.end(),o},configurable:!0,enumerable:!0,writable:!0}})})),t}function y(){}function S(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function b(e,t){var r;for(var o in t)e.test(o)&&(r=t[o],delete t[o]);return r}function x(e,t){function r(e){Error.captureStackTrace(this,this.constructor),this.message=e||t}return r.prototype=new Error,r.prototype.constructor=r,r.prototype.name="Error ["+e+"]",r.prototype.code=e,r}function w(e){for(var t=0;t<p.length;t++)e.removeListener(p[t],d[p[t]]);e.on("error",y),e.abort()}g.prototype=Object.create(a.prototype),g.prototype.abort=function(){w(this._currentRequest),this.emit("abort")},g.prototype.write=function(e,t,r){if(this._ending)throw new m;if(!("string"==typeof e||"object"==typeof e&&"length"in e))throw new TypeError("data should be a string, Buffer or Uint8Array");"function"==typeof t&&(r=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new l),this.abort()):r&&r()},g.prototype.end=function(e,t,r){if("function"==typeof e?(r=e,e=t=null):"function"==typeof t&&(r=t,t=null),e){var o=this,n=this._currentRequest;this.write(e,t,(function(){o._ended=!0,n.end(null,null,r)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,r)},g.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},g.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},g.prototype.setTimeout=function(e,t){var r=this;function o(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function n(t){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout((function(){r.emit("timeout"),s()}),e),o(t)}function s(){clearTimeout(this._timeout),t&&r.removeListener("timeout",t),this.socket||r._currentRequest.removeListener("socket",n)}return t&&this.on("timeout",t),this.socket?n(this.socket):this._currentRequest.once("socket",n),this.on("socket",o),this.once("response",s),this.once("error",s),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){g.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(g.prototype,e,{get:function(){return this._currentRequest[e]}})})),g.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},g.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var r=e.substr(0,e.length-1);this._options.agent=this._options.agents[r]}var n=this._currentRequest=t.request(this._options,this._onNativeResponse);this._currentUrl=o.format(this._options),n._redirectable=this;for(var s=0;s<p.length;s++)n.on(p[s],d[p[s]]);if(this._isRedirect){var i=0,a=this,c=this._requestBodyBuffers;!function e(t){if(n===a._currentRequest)if(t)a.emit("error",t);else if(i<c.length){var r=c[i++];n.finished||n.write(r.data,r.encoding,e)}else a._ended&&n.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},g.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var r=e.headers.location;if(r&&!1!==this._options.followRedirects&&t>=300&&t<400){if(w(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)return void this.emit("error",new f);((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],b(/^content-/i,this._options.headers));var n=b(/^host$/i,this._options.headers)||o.parse(this._currentUrl).hostname,s=o.resolve(this._currentUrl,r);u("redirecting to",s),this._isRedirect=!0;var i=o.parse(s);if(Object.assign(this._options,i),i.hostname!==n&&b(/^authorization$/i,this._options.headers),"function"==typeof this._options.beforeRedirect){var a={headers:e.headers};try{this._options.beforeRedirect.call(null,this._options,a)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){var c=new h("Redirected request failed: "+e.message);c.cause=e,this.emit("error",c)}}else e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[]},e.exports=v({http:s,https:i}),e.exports.wrap=v},function(e,t){e.exports=require("stream")},function(e,t,r){"use strict";var o=r(0);e.exports=function(e,t){t=t||{};var r={},n=["url","method","data"],s=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(e,t){return o.isPlainObject(e)&&o.isPlainObject(t)?o.merge(e,t):o.isPlainObject(t)?o.merge({},t):o.isArray(t)?t.slice():t}function u(n){o.isUndefined(t[n])?o.isUndefined(e[n])||(r[n]=c(void 0,e[n])):r[n]=c(e[n],t[n])}o.forEach(n,(function(e){o.isUndefined(t[e])||(r[e]=c(void 0,t[e]))})),o.forEach(s,u),o.forEach(i,(function(n){o.isUndefined(t[n])?o.isUndefined(e[n])||(r[n]=c(void 0,e[n])):r[n]=c(void 0,t[n])})),o.forEach(a,(function(o){o in t?r[o]=c(e[o],t[o]):o in e&&(r[o]=c(void 0,e[o]))}));var p=n.concat(s).concat(i).concat(a),d=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===p.indexOf(e)}));return o.forEach(d,u),r}},function(e,t,r){"use strict";function o(e){this.message=e}o.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},o.prototype.__CANCEL__=!0,e.exports=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=a();if(t&&t.has(e))return t.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var s=o?Object.getOwnPropertyDescriptor(e,n):null;s&&(s.get||s.set)?Object.defineProperty(r,n,s):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r(4)),n=r(20),s=r(44),i=r(14);function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}const{mediaManager:c}=o.default;class u extends s.RtspSmartCamera{listenEvents(){const e=new i.EventEmitter;return e.destroy=()=>{},(async()=>{const t=this.createClient();try{const r=await t.listenEvents();e.destroy=()=>{r.removeAllListeners(),r.destroy()},r.on("close",()=>e.emit("error",new Error("close"))),r.on("error",t=>e.emit("error",t)),r.on("event",e=>{e===n.AmcrestEvent.MotionStart?this.motionDetected=!0:e===n.AmcrestEvent.MotionStop?this.motionDetected=!1:e===n.AmcrestEvent.AudioStart?this.audioDetected=!0:e===n.AmcrestEvent.AudioStop&&(this.audioDetected=!1)})}catch(t){e.emit("error",t)}})(),e}createClient(){return new n.AmcrestCameraClient(this.storage.getItem("ip"),this.getUsername(),this.getPassword())}async takePicture(){const e=this.createClient();return c.createMediaObject(e.jpegSnapshot(),"image/jpeg")}async getConstructedStreamUrl(){return`rtsp://${this.getRtspAddress()}/cam/realmonitor?channel=1&subtype=0`}}class p extends s.RtspProvider{getAdditionalInterfaces(){return[o.ScryptedInterface.Camera,o.ScryptedInterface.AudioSensor,o.ScryptedInterface.MotionSensor]}getDevice(e){return new u(e)}}var d=new p;t.default=d},function(e,t,r){"use strict";const o=r(19);class n{constructor(e){this.nativeId=e}get storage(){return this._storage||(this._storage=deviceManager.getDeviceStorage(this.nativeId)),this._storage}get log(){return this._log||(this._log=deviceManager.getDeviceLogger(this.nativeId)),this._log}get console(){return this._console||(this._console=deviceManager.getDeviceConsole(this.nativeId)),this._console}_lazyLoadDeviceState(){this._deviceState||(this.nativeId?this._deviceState=deviceManager.getDeviceState(this.nativeId):this._deviceState=deviceManager.getDeviceState())}}class s{constructor(e,t,r,o){this.mixinDevice=e,this.mixinDevice=e,this.mixinDeviceInterfaces=t,this._deviceState=r,this.mixinProviderNativeId=o}get storage(){return this._storage||(this._storage=deviceManager.getMixinStorage(this.id,this.mixinProviderNativeId)),this._storage}_lazyLoadDeviceState(){}release(){}}!function(){function e(e){return function(){return this._lazyLoadDeviceState(),this._deviceState[e]}}function t(e){return function(t){this._lazyLoadDeviceState(),this._deviceState[e]=t}}for(var r of Object.values(o.ScryptedInterfaceProperty))Object.defineProperty(n.prototype,r,{set:t(r),get:e(r)}),Object.defineProperty(s.prototype,r,{set:t(r),get:e(r)})}();const i={ScryptedDeviceBase:n,MixinDeviceBase:s};Object.assign(i,o),e.exports=i,e.exports.default=i},function(e,t,r){"use strict";const o={};e.exports=o,e.exports.default=o,e.exports.ScryptedDeviceType={Builtin:"Builtin",Camera:"Camera",Fan:"Fan",Light:"Light",Switch:"Switch",Outlet:"Outlet",Sensor:"Sensor",Scene:"Scene",Program:"Program",Automation:"Automation",Vacuum:"Vacuum",Notifier:"Notifier",Thermostat:"Thermostat",Lock:"Lock",PasswordControl:"PasswordControl",Display:"Display",Speaker:"Speaker",Event:"Event",Entry:"Entry",Garage:"Garage",DeviceProvider:"DeviceProvider",DataSource:"DataSource",API:"API",Doorbell:"Doorbell",Irrigation:"Irrigation",Valve:"Valve",Unknown:"Unknown"},e.exports.TemperatureUnit={C:"C",F:"F"},e.exports.ThermostatMode={Off:"Off",Cool:"Cool",Heat:"Heat",HeatCool:"HeatCool",Auto:"Auto",FanOnly:"FanOnly",Purifier:"Purifier",Eco:"Eco",Dry:"Dry",On:"On"},e.exports.LockState={Locked:"Locked",Unlocked:"Unlocked",Jammed:"Jammed"},e.exports.MediaPlayerState={Idle:"Idle",Playing:"Playing",Paused:"Paused",Buffering:"Buffering"},e.exports.ScryptedInterface={ScryptedDevice:"ScryptedDevice",OnOff:"OnOff",Brightness:"Brightness",ColorSettingTemperature:"ColorSettingTemperature",ColorSettingRgb:"ColorSettingRgb",ColorSettingHsv:"ColorSettingHsv",Notifier:"Notifier",StartStop:"StartStop",Pause:"Pause",Dock:"Dock",TemperatureSetting:"TemperatureSetting",Thermometer:"Thermometer",HumiditySensor:"HumiditySensor",Camera:"Camera",VideoCamera:"VideoCamera",Intercom:"Intercom",Lock:"Lock",PasswordStore:"PasswordStore",Authenticator:"Authenticator",Scene:"Scene",Entry:"Entry",EntrySensor:"EntrySensor",DeviceProvider:"DeviceProvider",Battery:"Battery",Refresh:"Refresh",MediaPlayer:"MediaPlayer",Online:"Online",SoftwareUpdate:"SoftwareUpdate",BufferConverter:"BufferConverter",Settings:"Settings",BinarySensor:"BinarySensor",IntrusionSensor:"IntrusionSensor",PowerSensor:"PowerSensor",AudioSensor:"AudioSensor",MotionSensor:"MotionSensor",OccupancySensor:"OccupancySensor",FloodSensor:"FloodSensor",UltravioletSensor:"UltravioletSensor",LuminanceSensor:"LuminanceSensor",PositionSensor:"PositionSensor",MediaSource:"MediaSource",MessagingEndpoint:"MessagingEndpoint",OauthClient:"OauthClient",MixinProvider:"MixinProvider",HttpRequestHandler:"HttpRequestHandler",EngineIOHandler:"EngineIOHandler",PushHandler:"PushHandler",Program:"Program",Scriptable:"Scriptable"},e.exports.ScryptedInterfaceDescriptors={ScryptedDevice:{name:"ScryptedDevice",properties:["id","interfaces","mixins","info","name","providedInterfaces","providedName","providedRoom","providedType","providerId","room","type"],methods:["listen","setName","setRoom","setType"]},OnOff:{name:"OnOff",properties:["on"],methods:["turnOff","turnOn"]},Brightness:{name:"Brightness",properties:["brightness"],methods:["setBrightness"]},ColorSettingTemperature:{name:"ColorSettingTemperature",properties:["colorTemperature"],methods:["getTemperatureMaxK","getTemperatureMinK","setColorTemperature"]},ColorSettingRgb:{name:"ColorSettingRgb",properties:["rgb"],methods:["setRgb"]},ColorSettingHsv:{name:"ColorSettingHsv",properties:["hsv"],methods:["setHsv"]},Notifier:{name:"Notifier",properties:[],methods:["sendNotification"]},StartStop:{name:"StartStop",properties:["running"],methods:["start","stop"]},Pause:{name:"Pause",properties:["paused"],methods:["pause","resume"]},Dock:{name:"Dock",properties:["docked"],methods:["dock"]},TemperatureSetting:{name:"TemperatureSetting",properties:["thermostatAvailableModes","thermostatMode","thermostatSetpoint","thermostatSetpointHigh","thermostatSetpointLow"],methods:["setThermostatMode","setThermostatSetpoint","setThermostatSetpointHigh","setThermostatSetpointLow"]},Thermometer:{name:"Thermometer",properties:["temperature","temperatureUnit"],methods:[]},HumiditySensor:{name:"HumiditySensor",properties:["humidity"],methods:[]},Camera:{name:"Camera",properties:[],methods:["takePicture"]},VideoCamera:{name:"VideoCamera",properties:[],methods:["getVideoStream","getVideoStreamOptions"]},Intercom:{name:"Intercom",properties:[],methods:["startIntercom","stopIntercom"]},Lock:{name:"Lock",properties:["lockState"],methods:["lock","unlock"]},PasswordStore:{name:"PasswordStore",properties:[],methods:["addPassword","getPasswords","removePassword"]},Authenticator:{name:"Authenticator",properties:[],methods:["checkPassword"]},Scene:{name:"Scene",properties:[],methods:["activate","deactivate","isReversible"]},Entry:{name:"Entry",properties:[],methods:["closeEntry","openEntry"]},EntrySensor:{name:"EntrySensor",properties:["entryOpen"],methods:[]},DeviceProvider:{name:"DeviceProvider",properties:[],methods:["discoverDevices","getDevice"]},Battery:{name:"Battery",properties:["batteryLevel"],methods:[]},Refresh:{name:"Refresh",properties:[],methods:["getRefreshFrequency","refresh"]},MediaPlayer:{name:"MediaPlayer",properties:[],methods:["getMediaStatus","load","seek","skipNext","skipPrevious"]},Online:{name:"Online",properties:["online"],methods:[]},SoftwareUpdate:{name:"SoftwareUpdate",properties:["updateAvailable"],methods:["checkForUpdate","installUpdate"]},BufferConverter:{name:"BufferConverter",properties:["fromMimeType","toMimeType"],methods:["convert"]},Settings:{name:"Settings",properties:[],methods:["getSettings","putSetting"]},BinarySensor:{name:"BinarySensor",properties:["binaryState"],methods:[]},IntrusionSensor:{name:"IntrusionSensor",properties:["intrusionDetected"],methods:[]},PowerSensor:{name:"PowerSensor",properties:["powerDetected"],methods:[]},AudioSensor:{name:"AudioSensor",properties:["audioDetected"],methods:[]},MotionSensor:{name:"MotionSensor",properties:["motionDetected"],methods:[]},OccupancySensor:{name:"OccupancySensor",properties:["occupied"],methods:[]},FloodSensor:{name:"FloodSensor",properties:["flooded"],methods:[]},UltravioletSensor:{name:"UltravioletSensor",properties:["ultraviolet"],methods:[]},LuminanceSensor:{name:"LuminanceSensor",properties:["luminance"],methods:[]},PositionSensor:{name:"PositionSensor",properties:["position"],methods:[]},MediaSource:{name:"MediaSource",properties:[],methods:["getMedia"]},MessagingEndpoint:{name:"MessagingEndpoint",properties:[],methods:[]},OauthClient:{name:"OauthClient",properties:[],methods:["getOauthUrl","onOauthCallback"]},MixinProvider:{name:"MixinProvider",properties:[],methods:["canMixin","getMixin","releaseMixin"]},HttpRequestHandler:{name:"HttpRequestHandler",properties:[],methods:["onRequest"]},EngineIOHandler:{name:"EngineIOHandler",properties:[],methods:["onConnection"]},PushHandler:{name:"PushHandler",properties:[],methods:["onPush"]},Program:{name:"Program",properties:[],methods:["run"]},Scriptable:{name:"Scriptable",properties:[],methods:["saveScript","loadScripts","eval"]}},e.exports.ScryptedInterfaceProperty={},Object.values(e.exports.ScryptedInterfaceDescriptors).map(e=>e.properties).flat().forEach(t=>e.exports.ScryptedInterfaceProperty[t]=t),e.exports.ScryptedMimeTypes={AcceptUrlParameter:"accept-url",Url:"text/x-uri",InsecureLocalUrl:"text/x-insecure-local-uri",LocalUrl:"text/x-local-uri",PushEndpoint:"text/x-push-endpoint",FFmpegInput:"x-scrypted/x-ffmpeg-input",RTCAVOffer:"x-scrypted/x-rtc-av-offer",RTCAVAnswer:"x-scrypted/x-rtc-av-answer"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AmcrestCameraClient=t.AmcrestEvent=void 0;var o,n=(o=r(21))&&o.__esModule?o:{default:o};let s;t.AmcrestEvent=s,function(e){e.MotionStart="Code=VideoMotion;action=Start",e.MotionStop="Code=VideoMotion;action=Stop",e.AudioStart="Code=AudioMutation;action=Start",e.AudioStop="Code=AudioMutation;action=Stop"}(s||(t.AmcrestEvent=s={}));t.AmcrestCameraClient=class{constructor(e,t,r){this.ip=e,this.username=t,this.password=r,this.digestAuth=new n.default({username:t,password:r})}async jpegSnapshot(){const e=await this.digestAuth.request({method:"GET",responseType:"arraybuffer",url:`http://${this.ip}/cgi-bin/snapshot.cgi`});return Buffer.from(e.data)}async listenEvents(){const e=(await this.digestAuth.request({method:"GET",responseType:"stream",url:`http://${this.ip}/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion,AudioMutation]`})).data;return e.on("data",t=>{const r=t.toString();for(const t of Object.values(s))-1!==r.indexOf(t)&&e.emit("event",t)}),e}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(22),n=r(1),s=r(23);t.default=class{constructor({axios:e,password:t,username:r}){this.axios=e||s.default,this.count=0,this.password=t,this.username=r}async request(e){var t,r;try{return await this.axios.request(e)}catch(s){if(void 0===s.response||401!==s.response.status||!(null===(t=s.response.headers["www-authenticate"])||void 0===t?void 0:t.includes("nonce")))throw s;const i=s.response.headers["www-authenticate"].split(", ").map(e=>e.split("="));++this.count;const a=("00000000"+this.count).slice(-8),c=o.randomBytes(24).toString("hex"),u=i.find(e=>e[0].toLowerCase().indexOf("realm")>-1)[1].replace(/"/g,""),p=i.find(e=>e[0].toLowerCase().indexOf("nonce")>-1)[1].replace(/"/g,""),d=o.createHash("md5").update(`${this.username}:${u}:${this.password}`).digest("hex"),h=n.parse(e.url).pathname,f=o.createHash("md5").update(`${null!==(r=e.method)&&void 0!==r?r:"GET"}:${h}`).digest("hex"),l=o.createHash("md5").update(`${d}:${p}:${a}:${c}:auth:${f}`).digest("hex"),m=`Digest username="${this.username}",realm="${u}",nonce="${p}",uri="${h}",qop="auth",algorithm="MD5",response="${l}",nc="${a}",cnonce="${c}"`;return e.headers?e.headers.authorization=m:e.headers={authorization:m},this.axios.request(e)}}}},function(e,t){e.exports=require("crypto")},function(e,t,r){"use strict";e.exports=r(24)},function(e,t,r){"use strict";var o=r(0),n=r(5),s=r(25),i=r(15);function a(e){var t=new s(e),r=n(s.prototype.request,t);return o.extend(r,s.prototype,t),o.extend(r,t),r}var c=a(r(7));c.Axios=s,c.create=function(e){return a(i(c.defaults,e))},c.Cancel=r(16),c.CancelToken=r(41),c.isCancel=r(6),c.all=function(e){return Promise.all(e)},c.spread=r(42),c.isAxiosError=r(43),e.exports=c,e.exports.default=c},function(e,t,r){"use strict";var o=r(0),n=r(2),s=r(26),i=r(27),a=r(15);function c(e){this.defaults=e,this.interceptors={request:new s,response:new s}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[i,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},c.prototype.getUri=function(e){return e=a(this.defaults,e),n(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),o.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,r,o){return this.request(a(o||{},{method:e,url:t,data:r}))}})),e.exports=c},function(e,t,r){"use strict";var o=r(0);function n(){this.handlers=[]}n.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){o.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=n},function(e,t,r){"use strict";var o=r(0),n=r(28),s=r(6),i=r(7);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=n(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),o.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return a(e),t.data=n(t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(a(e),t&&t.response&&(t.response.data=n(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){"use strict";var o=r(0);e.exports=function(e,t,r){return o.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t,r){"use strict";var o=r(0);e.exports=function(e,t){o.forEach(e,(function(r,o){o!==t&&o.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[o])}))}},function(e,t,r){"use strict";var o=r(0),n=r(8),s=r(31),i=r(2),a=r(10),c=r(34),u=r(35),p=r(3);e.exports=function(e){return new Promise((function(t,r){var d=e.data,h=e.headers;o.isFormData(d)&&delete h["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";h.Authorization="Basic "+btoa(l+":"+m)}var g=a(e.baseURL,e.url);if(f.open(e.method.toUpperCase(),i(g,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,f.onreadystatechange=function(){if(f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))){var o="getAllResponseHeaders"in f?c(f.getAllResponseHeaders()):null,s={data:e.responseType&&"text"!==e.responseType?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:o,config:e,request:f};n(t,r,s),f=null}},f.onabort=function(){f&&(r(p("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){r(p("Network Error",e,null,f)),f=null},f.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(p(t,e,"ECONNABORTED",f)),f=null},o.isStandardBrowserEnv()){var v=(e.withCredentials||u(g))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;v&&(h[e.xsrfHeaderName]=v)}if("setRequestHeader"in f&&o.forEach(h,(function(e,t){void 0===d&&"content-type"===t.toLowerCase()?delete h[t]:f.setRequestHeader(t,e)})),o.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),e.responseType)try{f.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){f&&(f.abort(),r(e),f=null)})),d||(d=null),f.send(d)}))}},function(e,t,r){"use strict";var o=r(0);e.exports=o.isStandardBrowserEnv()?{write:function(e,t,r,n,s,i){var a=[];a.push(e+"="+encodeURIComponent(t)),o.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),o.isString(n)&&a.push("path="+n),o.isString(s)&&a.push("domain="+s),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var o=r(0),n=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,s,i={};return e?(o.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=o.trim(e.substr(0,s)).toLowerCase(),r=o.trim(e.substr(s+1)),t){if(i[t]&&n.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},function(e,t,r){"use strict";var o=r(0);e.exports=o.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var o=e;return t&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=o.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var o=r(0),n=r(8),s=r(10),i=r(2),a=r(11),c=r(12),u=r(13).http,p=r(13).https,d=r(1),h=r(39),f=r(40),l=r(3),m=r(9),g=/https:?/;e.exports=function(e){return new Promise((function(t,r){var v=function(e){t(e)},y=function(e){r(e)},S=e.data,b=e.headers;if(b["User-Agent"]||b["user-agent"]||(b["User-Agent"]="axios/"+f.version),S&&!o.isStream(S)){if(Buffer.isBuffer(S));else if(o.isArrayBuffer(S))S=Buffer.from(new Uint8Array(S));else{if(!o.isString(S))return y(l("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));S=Buffer.from(S,"utf-8")}b["Content-Length"]=S.length}var x=void 0;e.auth&&(x=(e.auth.username||"")+":"+(e.auth.password||""));var w=s(e.baseURL,e.url),_=d.parse(w),O=_.protocol||"http:";if(!x&&_.auth){var P=_.auth.split(":");x=(P[0]||"")+":"+(P[1]||"")}x&&delete b.Authorization;var R=g.test(O),C=R?e.httpsAgent:e.httpAgent,E={path:i(_.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:b,agent:C,agents:{http:e.httpAgent,https:e.httpsAgent},auth:x};e.socketPath?E.socketPath=e.socketPath:(E.hostname=_.hostname,E.port=_.port);var A,k=e.proxy;if(!k&&!1!==k){var T=O.slice(0,-1)+"_proxy",M=process.env[T]||process.env[T.toUpperCase()];if(M){var D=d.parse(M),j=process.env.no_proxy||process.env.NO_PROXY,B=!0;if(j)B=!j.split(",").map((function(e){return e.trim()})).some((function(e){return!!e&&("*"===e||("."===e[0]&&_.hostname.substr(_.hostname.length-e.length)===e||_.hostname===e))}));if(B&&(k={host:D.hostname,port:D.port,protocol:D.protocol},D.auth)){var U=D.auth.split(":");k.auth={username:U[0],password:U[1]}}}}k&&(E.headers.host=_.hostname+(_.port?":"+_.port:""),function e(t,r,o){if(t.hostname=r.host,t.host=r.host,t.port=r.port,t.path=o,r.auth){var n=Buffer.from(r.auth.username+":"+r.auth.password,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+n}t.beforeRedirect=function(t){t.headers.host=t.host,e(t,r,t.href)}}(E,k,O+"//"+_.hostname+(_.port?":"+_.port:"")+E.path));var L=R&&(!k||g.test(k.protocol));e.transport?A=e.transport:0===e.maxRedirects?A=L?c:a:(e.maxRedirects&&(E.maxRedirects=e.maxRedirects),A=L?p:u),e.maxBodyLength>-1&&(E.maxBodyLength=e.maxBodyLength);var I=A.request(E,(function(t){if(!I.aborted){var r=t,s=t.req||I;if(204!==t.statusCode&&"HEAD"!==s.method&&!1!==e.decompress)switch(t.headers["content-encoding"]){case"gzip":case"compress":case"deflate":r=r.pipe(h.createUnzip()),delete t.headers["content-encoding"]}var i={status:t.statusCode,statusText:t.statusMessage,headers:t.headers,config:e,request:s};if("stream"===e.responseType)i.data=r,n(v,y,i);else{var a=[];r.on("data",(function(t){a.push(t),e.maxContentLength>-1&&Buffer.concat(a).length>e.maxContentLength&&(r.destroy(),y(l("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,s)))})),r.on("error",(function(t){I.aborted||y(m(t,e,null,s))})),r.on("end",(function(){var t=Buffer.concat(a);"arraybuffer"!==e.responseType&&(t=t.toString(e.responseEncoding),e.responseEncoding&&"utf8"!==e.responseEncoding||(t=o.stripBOM(t))),i.data=t,n(v,y,i)}))}}}));I.on("error",(function(t){I.aborted&&"ERR_FR_TOO_MANY_REDIRECTS"!==t.code||y(m(t,e,null,I))})),e.timeout&&I.setTimeout(e.timeout,(function(){I.abort(),y(l("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",I))})),e.cancelToken&&e.cancelToken.promise.then((function(e){I.aborted||(I.abort(),y(e))})),o.isStream(S)?S.on("error",(function(t){y(m(t,e,null,I))})).pipe(I):I.end(S)}))}},function(e,t){e.exports=require("assert")},function(e,t,r){"use strict";var o;e.exports=function(){if(!o){try{o=r(!function(){var e=new Error("Cannot find module 'debug'");throw e.code="MODULE_NOT_FOUND",e}())("follow-redirects")}catch(e){}"function"!=typeof o&&(o=function(){})}o.apply(null,arguments)}},function(e,t){e.exports=require("zlib")},function(e){e.exports=JSON.parse('{"name":"axios","version":"0.21.1","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test && bundlesize","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://github.com/axios/axios","devDependencies":{"bundlesize":"^0.17.0","coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.0.2","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^20.1.0","grunt-karma":"^2.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^1.3.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.2.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^5.2.0","sinon":"^4.5.0","typescript":"^2.8.1","url-search-params":"^0.10.0","webpack":"^1.13.1","webpack-dev-server":"^1.14.1"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.10.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},function(e,t,r){"use strict";var o=r(16);function n(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new o(e),t(r.reason))}))}n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.source=function(){var e;return{token:new n((function(t){e=t})),cancel:e}},e.exports=n},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RtspProvider=t.RtspSmartCamera=t.RtspCamera=void 0;var o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=n();if(t&&t.has(e))return t.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}r.default=e,t&&t.set(e,r);return r}(r(4));function n(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return n=function(){return e},e}const{log:s,deviceManager:i,mediaManager:a}=o.default;class c extends o.ScryptedDeviceBase{constructor(e){super(e)}async getVideoStreamOptions(){return[{video:{},audio:this.isAudioDisabled()?null:{}}]}async getStreamUrl(){return this.storage.getItem("url")}isAudioDisabled(){return"true"===this.storage.getItem("noAudio")}async getVideoStream(){const e=new URL(await this.getStreamUrl());e.username=this.storage.getItem("username"),e.password=this.storage.getItem("password");const t=await this.getVideoStreamOptions(),r={inputArguments:["-rtsp_transport","tcp","-analyzeduration","15000000","-probesize","10000000","-reorder_queue_size","1024","-max_delay","20000000","-i",e.toString()],mediaStreamOptions:null==t?void 0:t[0]};return a.createFFmpegMediaObject(r)}async getUrlSettings(){return[{key:"url",title:"RTSP Stream URL",placeholder:"rtsp://192.168.1.100:4567/foo/bar",value:this.storage.getItem("url")}]}getUsername(){return this.storage.getItem("username")}getPassword(){return this.storage.getItem("password")}async getSettings(){return[{key:"username",title:"Username",value:this.getUsername()},{key:"password",title:"Password",value:this.getPassword(),type:"Password"},{key:"noAudio",title:"No Audio",description:"Enable this setting if the stream does not have audio or to mute audio.",type:"boolean",value:this.isAudioDisabled().toString()},...await this.getUrlSettings()]}async putSetting(e,t){this.storage.setItem(e,t.toString())}}t.RtspCamera=c;t.RtspSmartCamera=class extends c{constructor(e){super(e),this.listenLoop()}listenLoop(){this.listener=this.listenEvents(),this.listener.on("error",e=>{this.console.error("listen loop error, restarting in 10 seconds",e),setTimeout(()=>this.listenLoop(),1e4)})}async putSetting(e,t){super.putSetting(e,t),this.listener.emit("error",new Error("new settings"))}async getUrlSettings(){const e=await this.getConstructedStreamUrl();return[{key:"ip",title:"Address",placeholder:"192.168.1.100[:554]",value:this.storage.getItem("ip")},{key:"httpPort",title:"HTTP Port Override",placeholder:"80",value:this.storage.getItem("httpPort")},{key:"rtspUrlOverride",title:"RTSP URL Override",description:"Override the RTSP URL if your camera is using a non default port, channel, or rebroadcasted through an NVR. Default: "+e,placeholder:e,value:this.storage.getItem("rtspUrlOverride")}]}getHttpAddress(){return`${this.storage.getItem("ip")}:${this.storage.getItem("httpPort")||80}`}getRtspUrlOverride(){return this.storage.getItem("rtspUrlOverride")}getRtspAddress(){return this.storage.getItem("ip")}async getStreamUrl(){return this.getRtspUrlOverride()||await this.getConstructedStreamUrl()}};class u extends o.ScryptedDeviceBase{constructor(e){var t,r,o;super(e),t=this,r="devices",o=new Map,r in t?Object.defineProperty(t,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[r]=o;for(const e of i.getNativeIds())e&&this.getDevice(e)}getAdditionalInterfaces(){return[]}async getSettings(){return[{key:"new-camera",title:"Add RTSP Camera",placeholder:"Camera name, e.g.: Back Yard Camera, Baby Camera, etc"}]}async putSetting(e,t){var r=Math.random().toString(),n=t.toString();i.onDeviceDiscovered({nativeId:r,name:n,interfaces:[o.ScryptedInterface.VideoCamera,o.ScryptedInterface.Settings,...this.getAdditionalInterfaces()],type:o.ScryptedDeviceType.Camera});var a=`New Camera ${n} ready. Check the notification area to complete setup.`;s.a(a),s.clearAlert(a)}async discoverDevices(e){}createCamera(e){return new c(e)}getDevice(e){let t=this.devices.get(e);return t||(t=this.createCamera(e),t&&this.devices.set(e,t)),t}}t.RtspProvider=u}])); | ||
!function(e,t){for(var r in t)e[r]=t[r]}(window,function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=17)}([function(e,t,r){"use strict";var o=r(5),n=Object.prototype.toString;function s(e){return"[object Array]"===n.call(e)}function i(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==n.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===n.call(e)}function p(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(null,e[n],n,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===n.call(e)},isBuffer:function(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:c,isUndefined:i,isDate:function(e){return"[object Date]"===n.call(e)},isFile:function(e){return"[object File]"===n.call(e)},isBlob:function(e){return"[object Blob]"===n.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:p,merge:function e(){var t={};function r(r,o){c(t[o])&&c(r)?t[o]=e(t[o],r):c(r)?t[o]=e({},r):s(r)?t[o]=r.slice():t[o]=r}for(var o=0,n=arguments.length;o<n;o++)p(arguments[o],r);return t},extend:function(e,t,r){return p(t,(function(t,n){e[n]=r&&"function"==typeof t?o(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(e,t){e.exports=require("url")},function(e,t,r){"use strict";var o=r(0);function n(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(o.isURLSearchParams(t))s=t.toString();else{var i=[];o.forEach(t,(function(e,t){null!=e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,(function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),i.push(n(t)+"="+n(e))})))})),s=i.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},function(e,t,r){"use strict";var o=r(9);e.exports=function(e,t,r,n,s){var i=new Error(e);return o(i,t,r,n,s)}},function(e,t,r){"use strict";var o=r(18);try{o=Object.assign(o,{log:deviceManager.getDeviceLogger(void 0),deviceManager:deviceManager,endpointManager:endpointManager,mediaManager:mediaManager,systemManager:systemManager,pluginHostAPI:pluginHostAPI})}catch(e){console.error("sdk initialization error, import @scrypted/sdk/types instead",e)}e.exports=o,e.exports.default=o},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),o=0;o<r.length;o++)r[o]=arguments[o];return e.apply(t,r)}}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";var o=r(0),n=r(29),s={"Content-Type":"application/x-www-form-urlencoded"};function i(e,t){!o.isUndefined(e)&&o.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,c={adapter:("undefined"!=typeof XMLHttpRequest?a=r(30):"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(a=r(36)),a),transformRequest:[function(e,t){return n(t,"Accept"),n(t,"Content-Type"),o.isFormData(e)||o.isArrayBuffer(e)||o.isBuffer(e)||o.isStream(e)||o.isFile(e)||o.isBlob(e)?e:o.isArrayBufferView(e)?e.buffer:o.isURLSearchParams(e)?(i(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):o.isObject(e)?(i(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),o.forEach(["post","put","patch"],(function(e){c.headers[e]=o.merge(s)})),e.exports=c},function(e,t,r){"use strict";var o=r(3);e.exports=function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(o("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},function(e,t,r){"use strict";e.exports=function(e,t,r,o,n){return e.config=t,r&&(e.code=r),e.request=o,e.response=n,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,r){"use strict";var o=r(32),n=r(33);e.exports=function(e,t){return e&&!o(t)?n(e,t):t}},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("https")},function(e,t,r){"use strict";var o=r(1),n=o.URL,s=r(11),i=r(12),a=r(14).Writable,c=r(37),u=r(38),p=["abort","aborted","connect","error","socket","timeout"],d=Object.create(null);p.forEach((function(e){d[e]=function(t,r,o){this._redirectable.emit(e,t,r,o)}}));var h=x("ERR_FR_REDIRECTION_FAILURE",""),f=x("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),l=x("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),m=x("ERR_STREAM_WRITE_AFTER_END","write after end");function g(e,t){a.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var r=this;this._onNativeResponse=function(e){r._processResponse(e)},this._performRequest()}function v(e){var t={maxRedirects:21,maxBodyLength:10485760},r={};return Object.keys(e).forEach((function(s){var i=s+":",a=r[i]=e[s],p=t[s]=Object.create(a);Object.defineProperties(p,{request:{value:function(e,s,a){if("string"==typeof e){var p=e;try{e=S(new n(p))}catch(t){e=o.parse(p)}}else n&&e instanceof n?e=S(e):(a=s,s=e,e={protocol:i});return"function"==typeof s&&(a=s,s=null),(s=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,s)).nativeProtocols=r,c.equal(s.protocol,i,"protocol mismatch"),u("options",s),new g(s,a)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,r){var o=p.request(e,t,r);return o.end(),o},configurable:!0,enumerable:!0,writable:!0}})})),t}function y(){}function S(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function b(e,t){var r;for(var o in t)e.test(o)&&(r=t[o],delete t[o]);return r}function x(e,t){function r(e){Error.captureStackTrace(this,this.constructor),this.message=e||t}return r.prototype=new Error,r.prototype.constructor=r,r.prototype.name="Error ["+e+"]",r.prototype.code=e,r}function w(e){for(var t=0;t<p.length;t++)e.removeListener(p[t],d[p[t]]);e.on("error",y),e.abort()}g.prototype=Object.create(a.prototype),g.prototype.abort=function(){w(this._currentRequest),this.emit("abort")},g.prototype.write=function(e,t,r){if(this._ending)throw new m;if(!("string"==typeof e||"object"==typeof e&&"length"in e))throw new TypeError("data should be a string, Buffer or Uint8Array");"function"==typeof t&&(r=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new l),this.abort()):r&&r()},g.prototype.end=function(e,t,r){if("function"==typeof e?(r=e,e=t=null):"function"==typeof t&&(r=t,t=null),e){var o=this,n=this._currentRequest;this.write(e,t,(function(){o._ended=!0,n.end(null,null,r)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,r)},g.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},g.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},g.prototype.setTimeout=function(e,t){var r=this;function o(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function n(t){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout((function(){r.emit("timeout"),s()}),e),o(t)}function s(){clearTimeout(this._timeout),t&&r.removeListener("timeout",t),this.socket||r._currentRequest.removeListener("socket",n)}return t&&this.on("timeout",t),this.socket?n(this.socket):this._currentRequest.once("socket",n),this.on("socket",o),this.once("response",s),this.once("error",s),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){g.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(g.prototype,e,{get:function(){return this._currentRequest[e]}})})),g.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},g.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var r=e.substr(0,e.length-1);this._options.agent=this._options.agents[r]}var n=this._currentRequest=t.request(this._options,this._onNativeResponse);this._currentUrl=o.format(this._options),n._redirectable=this;for(var s=0;s<p.length;s++)n.on(p[s],d[p[s]]);if(this._isRedirect){var i=0,a=this,c=this._requestBodyBuffers;!function e(t){if(n===a._currentRequest)if(t)a.emit("error",t);else if(i<c.length){var r=c[i++];n.finished||n.write(r.data,r.encoding,e)}else a._ended&&n.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},g.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var r=e.headers.location;if(r&&!1!==this._options.followRedirects&&t>=300&&t<400){if(w(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)return void this.emit("error",new f);((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],b(/^content-/i,this._options.headers));var n=b(/^host$/i,this._options.headers)||o.parse(this._currentUrl).hostname,s=o.resolve(this._currentUrl,r);u("redirecting to",s),this._isRedirect=!0;var i=o.parse(s);if(Object.assign(this._options,i),i.hostname!==n&&b(/^authorization$/i,this._options.headers),"function"==typeof this._options.beforeRedirect){var a={headers:e.headers};try{this._options.beforeRedirect.call(null,this._options,a)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){var c=new h("Redirected request failed: "+e.message);c.cause=e,this.emit("error",c)}}else e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[]},e.exports=v({http:s,https:i}),e.exports.wrap=v},function(e,t){e.exports=require("stream")},function(e,t,r){"use strict";var o=r(0);e.exports=function(e,t){t=t||{};var r={},n=["url","method","data"],s=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(e,t){return o.isPlainObject(e)&&o.isPlainObject(t)?o.merge(e,t):o.isPlainObject(t)?o.merge({},t):o.isArray(t)?t.slice():t}function u(n){o.isUndefined(t[n])?o.isUndefined(e[n])||(r[n]=c(void 0,e[n])):r[n]=c(e[n],t[n])}o.forEach(n,(function(e){o.isUndefined(t[e])||(r[e]=c(void 0,t[e]))})),o.forEach(s,u),o.forEach(i,(function(n){o.isUndefined(t[n])?o.isUndefined(e[n])||(r[n]=c(void 0,e[n])):r[n]=c(void 0,t[n])})),o.forEach(a,(function(o){o in t?r[o]=c(e[o],t[o]):o in e&&(r[o]=c(void 0,e[o]))}));var p=n.concat(s).concat(i).concat(a),d=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===p.indexOf(e)}));return o.forEach(d,u),r}},function(e,t,r){"use strict";function o(e){this.message=e}o.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},o.prototype.__CANCEL__=!0,e.exports=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=a();if(t&&t.has(e))return t.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var s=o?Object.getOwnPropertyDescriptor(e,n):null;s&&(s.get||s.set)?Object.defineProperty(r,n,s):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r(4)),n=r(20),s=r(44),i=r(14);function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}const{mediaManager:c}=o.default;class u extends s.RtspSmartCamera{listenEvents(){const e=new i.EventEmitter;return e.destroy=()=>{},(async()=>{const t=this.createClient();try{const r=await t.listenEvents();e.destroy=()=>{r.removeAllListeners(),r.destroy()},r.on("close",()=>e.emit("error",new Error("close"))),r.on("error",t=>e.emit("error",t)),r.on("event",e=>{e===n.AmcrestEvent.MotionStart?this.motionDetected=!0:e===n.AmcrestEvent.MotionStop?this.motionDetected=!1:e===n.AmcrestEvent.AudioStart?this.audioDetected=!0:e===n.AmcrestEvent.AudioStop&&(this.audioDetected=!1)})}catch(t){e.emit("error",t)}})(),e}createClient(){return new n.AmcrestCameraClient(this.storage.getItem("ip"),this.getUsername(),this.getPassword())}async takePicture(){const e=this.createClient();return c.createMediaObject(e.jpegSnapshot(),"image/jpeg")}async getConstructedStreamUrl(){return`rtsp://${this.getRtspAddress()}/cam/realmonitor?channel=1&subtype=0`}}class p extends s.RtspProvider{getAdditionalInterfaces(){return[o.ScryptedInterface.Camera,o.ScryptedInterface.AudioSensor,o.ScryptedInterface.MotionSensor]}getDevice(e){return new u(e)}}var d=new p;t.default=d},function(e,t,r){"use strict";const o=r(19);class n{constructor(e){this.nativeId=e}get storage(){return this._storage||(this._storage=deviceManager.getDeviceStorage(this.nativeId)),this._storage}get log(){return this._log||(this._log=deviceManager.getDeviceLogger(this.nativeId)),this._log}get console(){return this._console||(this._console=deviceManager.getDeviceConsole(this.nativeId)),this._console}_lazyLoadDeviceState(){this._deviceState||(this.nativeId?this._deviceState=deviceManager.getDeviceState(this.nativeId):this._deviceState=deviceManager.getDeviceState())}}class s{constructor(e,t,r,o){this.mixinDevice=e,this.mixinDevice=e,this.mixinDeviceInterfaces=t,this._deviceState=r,this.mixinProviderNativeId=o}get storage(){return this._storage||(this._storage=deviceManager.getMixinStorage(this.id,this.mixinProviderNativeId)),this._storage}_lazyLoadDeviceState(){}release(){}}!function(){function e(e){return function(){return this._lazyLoadDeviceState(),this._deviceState[e]}}function t(e){return function(t){this._lazyLoadDeviceState(),this._deviceState[e]=t}}for(var r of Object.values(o.ScryptedInterfaceProperty))Object.defineProperty(n.prototype,r,{set:t(r),get:e(r)}),Object.defineProperty(s.prototype,r,{set:t(r),get:e(r)})}();const i={ScryptedDeviceBase:n,MixinDeviceBase:s};Object.assign(i,o),e.exports=i,e.exports.default=i},function(e,t,r){"use strict";const o={};e.exports=o,e.exports.default=o,e.exports.ScryptedDeviceType={Builtin:"Builtin",Camera:"Camera",Fan:"Fan",Light:"Light",Switch:"Switch",Outlet:"Outlet",Sensor:"Sensor",Scene:"Scene",Program:"Program",Automation:"Automation",Vacuum:"Vacuum",Notifier:"Notifier",Thermostat:"Thermostat",Lock:"Lock",PasswordControl:"PasswordControl",Display:"Display",Speaker:"Speaker",Event:"Event",Entry:"Entry",Garage:"Garage",DeviceProvider:"DeviceProvider",DataSource:"DataSource",API:"API",Doorbell:"Doorbell",Irrigation:"Irrigation",Valve:"Valve",Unknown:"Unknown"},e.exports.TemperatureUnit={C:"C",F:"F"},e.exports.ThermostatMode={Off:"Off",Cool:"Cool",Heat:"Heat",HeatCool:"HeatCool",Auto:"Auto",FanOnly:"FanOnly",Purifier:"Purifier",Eco:"Eco",Dry:"Dry",On:"On"},e.exports.LockState={Locked:"Locked",Unlocked:"Unlocked",Jammed:"Jammed"},e.exports.MediaPlayerState={Idle:"Idle",Playing:"Playing",Paused:"Paused",Buffering:"Buffering"},e.exports.ScryptedInterface={ScryptedDevice:"ScryptedDevice",OnOff:"OnOff",Brightness:"Brightness",ColorSettingTemperature:"ColorSettingTemperature",ColorSettingRgb:"ColorSettingRgb",ColorSettingHsv:"ColorSettingHsv",Notifier:"Notifier",StartStop:"StartStop",Pause:"Pause",Dock:"Dock",TemperatureSetting:"TemperatureSetting",Thermometer:"Thermometer",HumiditySensor:"HumiditySensor",Camera:"Camera",VideoCamera:"VideoCamera",Intercom:"Intercom",Lock:"Lock",PasswordStore:"PasswordStore",Authenticator:"Authenticator",Scene:"Scene",Entry:"Entry",EntrySensor:"EntrySensor",DeviceProvider:"DeviceProvider",Battery:"Battery",Refresh:"Refresh",MediaPlayer:"MediaPlayer",Online:"Online",SoftwareUpdate:"SoftwareUpdate",BufferConverter:"BufferConverter",Settings:"Settings",BinarySensor:"BinarySensor",IntrusionSensor:"IntrusionSensor",PowerSensor:"PowerSensor",AudioSensor:"AudioSensor",MotionSensor:"MotionSensor",OccupancySensor:"OccupancySensor",FloodSensor:"FloodSensor",UltravioletSensor:"UltravioletSensor",LuminanceSensor:"LuminanceSensor",PositionSensor:"PositionSensor",MediaSource:"MediaSource",MessagingEndpoint:"MessagingEndpoint",OauthClient:"OauthClient",MixinProvider:"MixinProvider",HttpRequestHandler:"HttpRequestHandler",EngineIOHandler:"EngineIOHandler",PushHandler:"PushHandler",Program:"Program",Scriptable:"Scriptable"},e.exports.ScryptedInterfaceDescriptors={ScryptedDevice:{name:"ScryptedDevice",properties:["id","interfaces","mixins","info","name","providedInterfaces","providedName","providedRoom","providedType","providerId","room","type"],methods:["listen","setName","setRoom","setType"]},OnOff:{name:"OnOff",properties:["on"],methods:["turnOff","turnOn"]},Brightness:{name:"Brightness",properties:["brightness"],methods:["setBrightness"]},ColorSettingTemperature:{name:"ColorSettingTemperature",properties:["colorTemperature"],methods:["getTemperatureMaxK","getTemperatureMinK","setColorTemperature"]},ColorSettingRgb:{name:"ColorSettingRgb",properties:["rgb"],methods:["setRgb"]},ColorSettingHsv:{name:"ColorSettingHsv",properties:["hsv"],methods:["setHsv"]},Notifier:{name:"Notifier",properties:[],methods:["sendNotification"]},StartStop:{name:"StartStop",properties:["running"],methods:["start","stop"]},Pause:{name:"Pause",properties:["paused"],methods:["pause","resume"]},Dock:{name:"Dock",properties:["docked"],methods:["dock"]},TemperatureSetting:{name:"TemperatureSetting",properties:["thermostatAvailableModes","thermostatMode","thermostatSetpoint","thermostatSetpointHigh","thermostatSetpointLow"],methods:["setThermostatMode","setThermostatSetpoint","setThermostatSetpointHigh","setThermostatSetpointLow"]},Thermometer:{name:"Thermometer",properties:["temperature","temperatureUnit"],methods:[]},HumiditySensor:{name:"HumiditySensor",properties:["humidity"],methods:[]},Camera:{name:"Camera",properties:[],methods:["takePicture"]},VideoCamera:{name:"VideoCamera",properties:[],methods:["getVideoStream","getVideoStreamOptions"]},Intercom:{name:"Intercom",properties:[],methods:["startIntercom","stopIntercom"]},Lock:{name:"Lock",properties:["lockState"],methods:["lock","unlock"]},PasswordStore:{name:"PasswordStore",properties:[],methods:["addPassword","getPasswords","removePassword"]},Authenticator:{name:"Authenticator",properties:[],methods:["checkPassword"]},Scene:{name:"Scene",properties:[],methods:["activate","deactivate","isReversible"]},Entry:{name:"Entry",properties:[],methods:["closeEntry","openEntry"]},EntrySensor:{name:"EntrySensor",properties:["entryOpen"],methods:[]},DeviceProvider:{name:"DeviceProvider",properties:[],methods:["discoverDevices","getDevice"]},Battery:{name:"Battery",properties:["batteryLevel"],methods:[]},Refresh:{name:"Refresh",properties:[],methods:["getRefreshFrequency","refresh"]},MediaPlayer:{name:"MediaPlayer",properties:[],methods:["getMediaStatus","load","seek","skipNext","skipPrevious"]},Online:{name:"Online",properties:["online"],methods:[]},SoftwareUpdate:{name:"SoftwareUpdate",properties:["updateAvailable"],methods:["checkForUpdate","installUpdate"]},BufferConverter:{name:"BufferConverter",properties:["fromMimeType","toMimeType"],methods:["convert"]},Settings:{name:"Settings",properties:[],methods:["getSettings","putSetting"]},BinarySensor:{name:"BinarySensor",properties:["binaryState"],methods:[]},IntrusionSensor:{name:"IntrusionSensor",properties:["intrusionDetected"],methods:[]},PowerSensor:{name:"PowerSensor",properties:["powerDetected"],methods:[]},AudioSensor:{name:"AudioSensor",properties:["audioDetected"],methods:[]},MotionSensor:{name:"MotionSensor",properties:["motionDetected"],methods:[]},OccupancySensor:{name:"OccupancySensor",properties:["occupied"],methods:[]},FloodSensor:{name:"FloodSensor",properties:["flooded"],methods:[]},UltravioletSensor:{name:"UltravioletSensor",properties:["ultraviolet"],methods:[]},LuminanceSensor:{name:"LuminanceSensor",properties:["luminance"],methods:[]},PositionSensor:{name:"PositionSensor",properties:["position"],methods:[]},MediaSource:{name:"MediaSource",properties:[],methods:["getMedia"]},MessagingEndpoint:{name:"MessagingEndpoint",properties:[],methods:[]},OauthClient:{name:"OauthClient",properties:[],methods:["getOauthUrl","onOauthCallback"]},MixinProvider:{name:"MixinProvider",properties:[],methods:["canMixin","getMixin","releaseMixin"]},HttpRequestHandler:{name:"HttpRequestHandler",properties:[],methods:["onRequest"]},EngineIOHandler:{name:"EngineIOHandler",properties:[],methods:["onConnection"]},PushHandler:{name:"PushHandler",properties:[],methods:["onPush"]},Program:{name:"Program",properties:[],methods:["run"]},Scriptable:{name:"Scriptable",properties:[],methods:["saveScript","loadScripts","eval"]}},e.exports.ScryptedInterfaceProperty={},Object.values(e.exports.ScryptedInterfaceDescriptors).map(e=>e.properties).flat().forEach(t=>e.exports.ScryptedInterfaceProperty[t]=t),e.exports.ScryptedMimeTypes={AcceptUrlParameter:"accept-url",Url:"text/x-uri",InsecureLocalUrl:"text/x-insecure-local-uri",LocalUrl:"text/x-local-uri",PushEndpoint:"text/x-push-endpoint",FFmpegInput:"x-scrypted/x-ffmpeg-input",RTCAVOffer:"x-scrypted/x-rtc-av-offer",RTCAVAnswer:"x-scrypted/x-rtc-av-answer"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AmcrestCameraClient=t.AmcrestEvent=void 0;var o,n=(o=r(21))&&o.__esModule?o:{default:o};let s;t.AmcrestEvent=s,function(e){e.MotionStart="Code=VideoMotion;action=Start",e.MotionStop="Code=VideoMotion;action=Stop",e.AudioStart="Code=AudioMutation;action=Start",e.AudioStop="Code=AudioMutation;action=Stop"}(s||(t.AmcrestEvent=s={}));t.AmcrestCameraClient=class{constructor(e,t,r){this.ip=e,this.username=t,this.password=r,this.digestAuth=new n.default({username:t,password:r})}async jpegSnapshot(){const e=await this.digestAuth.request({method:"GET",responseType:"arraybuffer",url:`http://${this.ip}/cgi-bin/snapshot.cgi`});return Buffer.from(e.data)}async listenEvents(){const e=`http://${this.ip}/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion,AudioMutation]`;console.log("preparing event listener",e);const t=(await this.digestAuth.request({method:"GET",responseType:"stream",url:e})).data;return t.on("data",e=>{const r=e.toString();for(const e of Object.values(s))-1!==r.indexOf(e)&&t.emit("event",e)}),t}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(22),n=r(1),s=r(23);t.default=class{constructor({axios:e,password:t,username:r}){this.axios=e||s.default,this.count=0,this.password=t,this.username=r}async request(e){var t,r;try{return await this.axios.request(e)}catch(s){if(void 0===s.response||401!==s.response.status||!(null===(t=s.response.headers["www-authenticate"])||void 0===t?void 0:t.includes("nonce")))throw s;const i=s.response.headers["www-authenticate"].split(", ").map(e=>e.split("="));++this.count;const a=("00000000"+this.count).slice(-8),c=o.randomBytes(24).toString("hex"),u=i.find(e=>e[0].toLowerCase().indexOf("realm")>-1)[1].replace(/"/g,""),p=i.find(e=>e[0].toLowerCase().indexOf("nonce")>-1)[1].replace(/"/g,""),d=o.createHash("md5").update(`${this.username}:${u}:${this.password}`).digest("hex"),h=n.parse(e.url).pathname,f=o.createHash("md5").update(`${null!==(r=e.method)&&void 0!==r?r:"GET"}:${h}`).digest("hex"),l=o.createHash("md5").update(`${d}:${p}:${a}:${c}:auth:${f}`).digest("hex"),m=`Digest username="${this.username}",realm="${u}",nonce="${p}",uri="${h}",qop="auth",algorithm="MD5",response="${l}",nc="${a}",cnonce="${c}"`;return e.headers?e.headers.authorization=m:e.headers={authorization:m},this.axios.request(e)}}}},function(e,t){e.exports=require("crypto")},function(e,t,r){"use strict";e.exports=r(24)},function(e,t,r){"use strict";var o=r(0),n=r(5),s=r(25),i=r(15);function a(e){var t=new s(e),r=n(s.prototype.request,t);return o.extend(r,s.prototype,t),o.extend(r,t),r}var c=a(r(7));c.Axios=s,c.create=function(e){return a(i(c.defaults,e))},c.Cancel=r(16),c.CancelToken=r(41),c.isCancel=r(6),c.all=function(e){return Promise.all(e)},c.spread=r(42),c.isAxiosError=r(43),e.exports=c,e.exports.default=c},function(e,t,r){"use strict";var o=r(0),n=r(2),s=r(26),i=r(27),a=r(15);function c(e){this.defaults=e,this.interceptors={request:new s,response:new s}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[i,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},c.prototype.getUri=function(e){return e=a(this.defaults,e),n(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),o.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,r,o){return this.request(a(o||{},{method:e,url:t,data:r}))}})),e.exports=c},function(e,t,r){"use strict";var o=r(0);function n(){this.handlers=[]}n.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){o.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=n},function(e,t,r){"use strict";var o=r(0),n=r(28),s=r(6),i=r(7);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=n(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),o.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return a(e),t.data=n(t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(a(e),t&&t.response&&(t.response.data=n(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){"use strict";var o=r(0);e.exports=function(e,t,r){return o.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t,r){"use strict";var o=r(0);e.exports=function(e,t){o.forEach(e,(function(r,o){o!==t&&o.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[o])}))}},function(e,t,r){"use strict";var o=r(0),n=r(8),s=r(31),i=r(2),a=r(10),c=r(34),u=r(35),p=r(3);e.exports=function(e){return new Promise((function(t,r){var d=e.data,h=e.headers;o.isFormData(d)&&delete h["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";h.Authorization="Basic "+btoa(l+":"+m)}var g=a(e.baseURL,e.url);if(f.open(e.method.toUpperCase(),i(g,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,f.onreadystatechange=function(){if(f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))){var o="getAllResponseHeaders"in f?c(f.getAllResponseHeaders()):null,s={data:e.responseType&&"text"!==e.responseType?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:o,config:e,request:f};n(t,r,s),f=null}},f.onabort=function(){f&&(r(p("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){r(p("Network Error",e,null,f)),f=null},f.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(p(t,e,"ECONNABORTED",f)),f=null},o.isStandardBrowserEnv()){var v=(e.withCredentials||u(g))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;v&&(h[e.xsrfHeaderName]=v)}if("setRequestHeader"in f&&o.forEach(h,(function(e,t){void 0===d&&"content-type"===t.toLowerCase()?delete h[t]:f.setRequestHeader(t,e)})),o.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),e.responseType)try{f.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){f&&(f.abort(),r(e),f=null)})),d||(d=null),f.send(d)}))}},function(e,t,r){"use strict";var o=r(0);e.exports=o.isStandardBrowserEnv()?{write:function(e,t,r,n,s,i){var a=[];a.push(e+"="+encodeURIComponent(t)),o.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),o.isString(n)&&a.push("path="+n),o.isString(s)&&a.push("domain="+s),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var o=r(0),n=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,s,i={};return e?(o.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=o.trim(e.substr(0,s)).toLowerCase(),r=o.trim(e.substr(s+1)),t){if(i[t]&&n.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},function(e,t,r){"use strict";var o=r(0);e.exports=o.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var o=e;return t&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=o.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var o=r(0),n=r(8),s=r(10),i=r(2),a=r(11),c=r(12),u=r(13).http,p=r(13).https,d=r(1),h=r(39),f=r(40),l=r(3),m=r(9),g=/https:?/;e.exports=function(e){return new Promise((function(t,r){var v=function(e){t(e)},y=function(e){r(e)},S=e.data,b=e.headers;if(b["User-Agent"]||b["user-agent"]||(b["User-Agent"]="axios/"+f.version),S&&!o.isStream(S)){if(Buffer.isBuffer(S));else if(o.isArrayBuffer(S))S=Buffer.from(new Uint8Array(S));else{if(!o.isString(S))return y(l("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));S=Buffer.from(S,"utf-8")}b["Content-Length"]=S.length}var x=void 0;e.auth&&(x=(e.auth.username||"")+":"+(e.auth.password||""));var w=s(e.baseURL,e.url),_=d.parse(w),O=_.protocol||"http:";if(!x&&_.auth){var P=_.auth.split(":");x=(P[0]||"")+":"+(P[1]||"")}x&&delete b.Authorization;var R=g.test(O),C=R?e.httpsAgent:e.httpAgent,E={path:i(_.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:b,agent:C,agents:{http:e.httpAgent,https:e.httpsAgent},auth:x};e.socketPath?E.socketPath=e.socketPath:(E.hostname=_.hostname,E.port=_.port);var A,k=e.proxy;if(!k&&!1!==k){var T=O.slice(0,-1)+"_proxy",M=process.env[T]||process.env[T.toUpperCase()];if(M){var D=d.parse(M),j=process.env.no_proxy||process.env.NO_PROXY,B=!0;if(j)B=!j.split(",").map((function(e){return e.trim()})).some((function(e){return!!e&&("*"===e||("."===e[0]&&_.hostname.substr(_.hostname.length-e.length)===e||_.hostname===e))}));if(B&&(k={host:D.hostname,port:D.port,protocol:D.protocol},D.auth)){var U=D.auth.split(":");k.auth={username:U[0],password:U[1]}}}}k&&(E.headers.host=_.hostname+(_.port?":"+_.port:""),function e(t,r,o){if(t.hostname=r.host,t.host=r.host,t.port=r.port,t.path=o,r.auth){var n=Buffer.from(r.auth.username+":"+r.auth.password,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+n}t.beforeRedirect=function(t){t.headers.host=t.host,e(t,r,t.href)}}(E,k,O+"//"+_.hostname+(_.port?":"+_.port:"")+E.path));var L=R&&(!k||g.test(k.protocol));e.transport?A=e.transport:0===e.maxRedirects?A=L?c:a:(e.maxRedirects&&(E.maxRedirects=e.maxRedirects),A=L?p:u),e.maxBodyLength>-1&&(E.maxBodyLength=e.maxBodyLength);var I=A.request(E,(function(t){if(!I.aborted){var r=t,s=t.req||I;if(204!==t.statusCode&&"HEAD"!==s.method&&!1!==e.decompress)switch(t.headers["content-encoding"]){case"gzip":case"compress":case"deflate":r=r.pipe(h.createUnzip()),delete t.headers["content-encoding"]}var i={status:t.statusCode,statusText:t.statusMessage,headers:t.headers,config:e,request:s};if("stream"===e.responseType)i.data=r,n(v,y,i);else{var a=[];r.on("data",(function(t){a.push(t),e.maxContentLength>-1&&Buffer.concat(a).length>e.maxContentLength&&(r.destroy(),y(l("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,s)))})),r.on("error",(function(t){I.aborted||y(m(t,e,null,s))})),r.on("end",(function(){var t=Buffer.concat(a);"arraybuffer"!==e.responseType&&(t=t.toString(e.responseEncoding),e.responseEncoding&&"utf8"!==e.responseEncoding||(t=o.stripBOM(t))),i.data=t,n(v,y,i)}))}}}));I.on("error",(function(t){I.aborted&&"ERR_FR_TOO_MANY_REDIRECTS"!==t.code||y(m(t,e,null,I))})),e.timeout&&I.setTimeout(e.timeout,(function(){I.abort(),y(l("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",I))})),e.cancelToken&&e.cancelToken.promise.then((function(e){I.aborted||(I.abort(),y(e))})),o.isStream(S)?S.on("error",(function(t){y(m(t,e,null,I))})).pipe(I):I.end(S)}))}},function(e,t){e.exports=require("assert")},function(e,t,r){"use strict";var o;e.exports=function(){if(!o){try{o=r(!function(){var e=new Error("Cannot find module 'debug'");throw e.code="MODULE_NOT_FOUND",e}())("follow-redirects")}catch(e){}"function"!=typeof o&&(o=function(){})}o.apply(null,arguments)}},function(e,t){e.exports=require("zlib")},function(e){e.exports=JSON.parse('{"name":"axios","version":"0.21.1","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test && bundlesize","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://github.com/axios/axios","devDependencies":{"bundlesize":"^0.17.0","coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.0.2","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^20.1.0","grunt-karma":"^2.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^1.3.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.2.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^5.2.0","sinon":"^4.5.0","typescript":"^2.8.1","url-search-params":"^0.10.0","webpack":"^1.13.1","webpack-dev-server":"^1.14.1"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.10.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},function(e,t,r){"use strict";var o=r(16);function n(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new o(e),t(r.reason))}))}n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.source=function(){var e;return{token:new n((function(t){e=t})),cancel:e}},e.exports=n},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RtspProvider=t.RtspSmartCamera=t.RtspCamera=void 0;var o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=n();if(t&&t.has(e))return t.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var i=o?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(r,s,i):r[s]=e[s]}r.default=e,t&&t.set(e,r);return r}(r(4));function n(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return n=function(){return e},e}const{log:s,deviceManager:i,mediaManager:a}=o.default;class c extends o.ScryptedDeviceBase{constructor(e){super(e)}async getVideoStreamOptions(){return[{video:{},audio:this.isAudioDisabled()?null:{}}]}async getStreamUrl(){return this.storage.getItem("url")}isAudioDisabled(){return"true"===this.storage.getItem("noAudio")}async getVideoStream(){const e=new URL(await this.getStreamUrl());e.username=this.storage.getItem("username"),e.password=this.storage.getItem("password");const t=await this.getVideoStreamOptions(),r={inputArguments:["-rtsp_transport","tcp","-analyzeduration","15000000","-probesize","10000000","-reorder_queue_size","1024","-max_delay","20000000","-i",e.toString()],mediaStreamOptions:null==t?void 0:t[0]};return a.createFFmpegMediaObject(r)}async getUrlSettings(){return[{key:"url",title:"RTSP Stream URL",placeholder:"rtsp://192.168.1.100:4567/foo/bar",value:this.storage.getItem("url")}]}getUsername(){return this.storage.getItem("username")}getPassword(){return this.storage.getItem("password")}async getSettings(){return[{key:"username",title:"Username",value:this.getUsername()},{key:"password",title:"Password",value:this.getPassword(),type:"Password"},{key:"noAudio",title:"No Audio",description:"Enable this setting if the stream does not have audio or to mute audio.",type:"boolean",value:this.isAudioDisabled().toString()},...await this.getUrlSettings()]}async putSetting(e,t){this.storage.setItem(e,t.toString())}}t.RtspCamera=c;t.RtspSmartCamera=class extends c{constructor(e){super(e),this.listenLoop()}listenLoop(){this.listener=this.listenEvents(),this.listener.on("error",e=>{this.console.error("listen loop error, restarting in 10 seconds",e),setTimeout(()=>this.listenLoop(),1e4)})}async putSetting(e,t){super.putSetting(e,t),this.listener.emit("error",new Error("new settings"))}async getUrlSettings(){const e=await this.getConstructedStreamUrl();return[{key:"ip",title:"Address",placeholder:"192.168.1.100[:554]",value:this.storage.getItem("ip")},{key:"httpPort",title:"HTTP Port Override",placeholder:"80",value:this.storage.getItem("httpPort")},{key:"rtspUrlOverride",title:"RTSP URL Override",description:"Override the RTSP URL if your camera is using a non default port, channel, or rebroadcasted through an NVR. Default: "+e,placeholder:e,value:this.storage.getItem("rtspUrlOverride")}]}getHttpAddress(){return`${this.storage.getItem("ip")}:${this.storage.getItem("httpPort")||80}`}getRtspUrlOverride(){return this.storage.getItem("rtspUrlOverride")}getRtspAddress(){return this.storage.getItem("ip")}async getStreamUrl(){return this.getRtspUrlOverride()||await this.getConstructedStreamUrl()}};class u extends o.ScryptedDeviceBase{constructor(e){var t,r,o;super(e),t=this,r="devices",o=new Map,r in t?Object.defineProperty(t,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[r]=o;for(const e of i.getNativeIds())e&&this.getDevice(e)}getAdditionalInterfaces(){return[]}async getSettings(){return[{key:"new-camera",title:"Add RTSP Camera",placeholder:"Camera name, e.g.: Back Yard Camera, Baby Camera, etc"}]}async putSetting(e,t){var r=Math.random().toString(),n=t.toString();i.onDeviceDiscovered({nativeId:r,name:n,interfaces:[o.ScryptedInterface.VideoCamera,o.ScryptedInterface.Settings,...this.getAdditionalInterfaces()],type:o.ScryptedDeviceType.Camera});var a=`New Camera ${n} ready. Check the notification area to complete setup.`;s.a(a),s.clearAlert(a)}async discoverDevices(e){}createCamera(e){return new c(e)}getDevice(e){let t=this.devices.get(e);return t||(t=this.createCamera(e),t&&this.devices.set(e,t)),t}}t.RtspProvider=u}])); |
{ | ||
"name": "@scrypted/amcrest", | ||
"version": "0.0.27", | ||
"version": "0.0.28", | ||
"description": "Amcrest Plugin for Scrypted", | ||
@@ -5,0 +5,0 @@ "author": "Scrypted", |
@@ -35,6 +35,9 @@ import AxiosDigestAuth from '@mhoc/axios-digest-auth'; | ||
async listenEvents() { | ||
const url = `http://${this.ip}/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion,AudioMutation]`; | ||
console.log('preparing event listener', url); | ||
const response = await this.digestAuth.request({ | ||
method: "GET", | ||
responseType: 'stream', | ||
url: `http://${this.ip}/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion,AudioMutation]`, | ||
url, | ||
}); | ||
@@ -41,0 +44,0 @@ const stream = response.data as Readable; |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
66224
156