Js
Js
Js
function __webpack_require__(moduleId) {
if (installedModules[moduleId]) return installedModules[moduleId].exports;
var module = installedModules[moduleId] = {
exports: {},
id: moduleId,
loaded: !1
};
return modules[moduleId].call(module.exports, module, module.exports,
__webpack_require__), module.loaded = !0, module.exports
}
var installedModules = {};
return __webpack_require__.m = modules, __webpack_require__.c =
installedModules, __webpack_require__.p = "", __webpack_require__(0)
}([function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__, msf = __webpack_require__(1);
msf.version = "{{version}}", __WEBPACK_AMD_DEFINE_RESULT__ = function() {
return msf
}.call(exports, __webpack_require__, exports, module), !(void 0 !==
__WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)),
module.exports = msf
}, function(module, exports, __webpack_require__) {
"use strict";
var util = __webpack_require__(5),
Service = (__webpack_require__(2), __webpack_require__(3)),
Search = __webpack_require__(4),
search = null;
module.exports.logger = util.logger, module.exports.search = function(callback)
{
return search || (search = new Search), callback && (search.once("found",
function(services) {
callback(null, services)
}), setTimeout(function() {
search.start()
}, 0)), search
}, module.exports.local = function(callback) {
Service.getLocal(callback)
}, module.exports.remote = function(uri, callback) {
Service.getByURI(uri, callback)
}
}, function(module) {
"use strict";
function EventEmitter() {
this._events = this._events || {}, this._maxListeners = this._maxListeners
|| void 0
}
function isFunction(arg) {
return "function" == typeof arg
}
function isNumber(arg) {
return "number" == typeof arg
}
function isObject(arg) {
return "object" == typeof arg && null !== arg
}
function isUndefined(arg) {
return void 0 === arg
}
module.exports = EventEmitter, EventEmitter.EventEmitter = EventEmitter,
EventEmitter.prototype._disabledEvents = {}, EventEmitter.prototype._events = void
0, EventEmitter.prototype._maxListeners = void 0, EventEmitter.defaultMaxListeners
= 10, EventEmitter.prototype.setMaxListeners = function(n) {
if (!isNumber(n) || 0 > n || isNaN(n)) throw TypeError("n must be a
positive number");
return this._maxListeners = n, this
}, EventEmitter.prototype.emit = function(type) {
var er, handler, len, args, i, listeners;
if (this._events || (this._events = {}), this._disabledEvents[type]) return
!1;
if ("error" === type && (!this._events.error ||
isObject(this._events.error) && !this._events.error.length)) {
if (er = arguments[1], er instanceof Error) throw er;
throw TypeError('Uncaught, unspecified "error" event.')
}
if (handler = this._events[type], isUndefined(handler)) return !1;
if (isFunction(handler)) switch (arguments.length) {
case 1:
handler.call(this);
break;
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
default:
for (len = arguments.length, args = new Array(len - 1), i = 1; len
> i; i++) args[i - 1] = arguments[i];
handler.apply(this, args)
} else if (isObject(handler)) {
for (len = arguments.length, args = new Array(len - 1), i = 1; len > i;
i++) args[i - 1] = arguments[i];
for (listeners = handler.slice(), len = listeners.length, i = 0; len >
i; i++) {
var r = listeners[i].apply(this, args);
if ("stopEvent" === r) break
}
}
return !0
}, EventEmitter.prototype.addListener = function(type, listener) {
var m;
if (!isFunction(listener)) throw TypeError("listener must be a function");
if (this._events || (this._events = {}), this._events.newListener &&
this.emit("newListener", type, isFunction(listener.listener) ? listener.listener :
listener), this._events[type] ? isObject(this._events[type]) ?
this._events[type].push(listener) : this._events[type] = [this._events[type],
listener] : this._events[type] = listener, isObject(this._events[type]) && !
this._events[type].warned) {
var m;
m = isUndefined(this._maxListeners) ?
EventEmitter.defaultMaxListeners : this._maxListeners, m && m > 0 &&
this._events[type].length > m && (this._events[type].warned = !0,
console.error("(node) warning: possible EventEmitter memory leak detected. %d
listeners added. Use emitter.setMaxListeners() to increase limit.",
this._events[type].length), "function" == typeof console.trace && console.trace())
}
return this
}, EventEmitter.prototype.on = function() {
EventEmitter.prototype.addListener.apply(this, arguments)
}, EventEmitter.prototype.once = function(type, listener) {
function g() {
this.removeListener(type, g), fired || (fired = !0,
listener.apply(this, arguments))
}
if (!isFunction(listener)) throw TypeError("listener must be a function");
var fired = !1;
return g.listener = listener, this.on(type, g), this
}, EventEmitter.prototype.removeListener = function(type, listener) {
var list, position, length, i;
if (!isFunction(listener)) throw TypeError("listener must be a function");
if (!this._events || !this._events[type]) return this;
if (list = this._events[type], length = list.length, position = -1, list
=== listener || isFunction(list.listener) && list.listener === listener) delete
this._events[type], this._events.removeListener && this.emit("removeListener",
type, listener);
else if (isObject(list)) {
for (i = length; i-- > 0;)
if (list[i] === listener || list[i].listener && list[i].listener
=== listener) {
position = i;
break
}
if (0 > position) return this;
1 === list.length ? (list.length = 0, delete this._events[type]) :
list.splice(position, 1), this._events.removeListener &&
this.emit("removeListener", type, listener)
}
return this
}, EventEmitter.prototype.off = function() {
EventEmitter.prototype.removeListener.apply(this, arguments)
}, EventEmitter.prototype.removeAllListeners = function(type) {
var key, listeners;
if (!this._events) return this;
if (!this._events.removeListener) return 0 === arguments.length ?
this._events = {} : this._events[type] && delete this._events[type], this;
if (0 === arguments.length) {
for (key in this._events) "removeListener" !== key &&
this.removeAllListeners(key);
return this.removeAllListeners("removeListener"), this._events = {},
this
}
if (listeners = this._events[type], isFunction(listeners))
this.removeListener(type, listeners);
else
for (; listeners.length;) this.removeListener(type,
listeners[listeners.length - 1]);
return delete this._events[type], this
}, EventEmitter.prototype.listeners = function(type) {
var ret;
return ret = this._events && this._events[type] ?
isFunction(this._events[type]) ? [this._events[type]] :
this._events[type].slice() : []
}, EventEmitter.prototype.disableEvent = function(type) {
type && "string" == typeof type && (this._disabledEvents[type] = !0)
}, EventEmitter.prototype.enableEvent = function(type) {
type && "string" == typeof type && delete this._disabledEvents[type]
}, EventEmitter.listenerCount = function(emitter, type) {
var ret;
return ret = emitter._events && emitter._events[type] ?
isFunction(emitter._events[type]) ? 1 : emitter._events[type].length : 0
}
}, function(module, exports, __webpack_require__) {
"use strict";
function Service(description) {
this.id = description.id, this.name = description.name, this.version =
description.version, this.type = description.type, this.uri = description.uri,
this.device = description.device, props.readOnly(this, ["id", "name", "version",
"type", "uri", "device"])
}
var util = __webpack_require__(5),
props = util.props,
Application = __webpack_require__(6),
Channel = __webpack_require__(7);
Service.prototype.application = function(id, channelUri) {
return new Application(this, id, channelUri)
}, Service.prototype.channel = function(uri) {
return new Channel(this, uri)
}, Service.getLocal = function(callback) {
Service.getByURI("http://127.0.0.1:8001/api/v2/", callback)
}, Service.getByURI = function(uri, callback) {
var oReq = new XMLHttpRequest;
oReq.timeout = 5e3, oReq.ontimeout = function() {
callback()
}, oReq.onload = function() {
if (200 === this.status) try {
var result = JSON.parse(this.responseText);
callback(null, new Service(result))
} catch (e) {
callback(e)
} else callback()
}, oReq.open("get", uri, !0), oReq.send()
}, module.exports = Service
}, function(module, exports, __webpack_require__) {
"use strict";
function Search() {
Search.super_.call(this), this.discoveryFrame = null, this.status =
Search.STATUS_STOPPED;
var self = this,
frame = document.createElement("iframe");
frame.setAttribute("width", "1"), frame.setAttribute("height", "1"),
frame.style.display = "none", frame.src =
"http://multiscreen.samsung.com/discoveryservice/v2/discover",
document.body.appendChild(frame), this.windowMessageListener = function(event) {
if (event.source === frame.contentWindow)
if (event.data && "discovery.ready" === event.data.event)
self.discoveryFrame = event.source, self.onSearchReady();
else if (event.data && "discovery.result" === event.data.event) {
for (var results = [], Service = __webpack_require__(3), i = 0; i <
event.data.result.length; i++) results.push(new Service(event.data.result[i]));
self.onSearchResult(results)
} else event.data && "discovery.error" === event.data.event &&
(self.onSearchError(event.data.error), this.status = Search.STATUS_STOPPED)
}, window.addEventListener("message", this.windowMessageListener),
props["private"](this, ["discoveryFrame", "windowMessageListener"])
}
var util = __webpack_require__(5),
props = util.props,
EventEmitter = __webpack_require__(2);
util.inherits(Search, EventEmitter), Search.STATUS_STOPPED = "stopped",
Search.STATUS_STARTED = "started", Search.prototype.start = function() {
if (this.status === Search.STATUS_STOPPED) {
if (this.discoveryFrame) this.discoveryFrame.postMessage({
method: "discovery.search"
}, "*");
else {
var self = this;
this.once("ready", function() {
self.discoveryFrame.postMessage({
method: "discovery.search"
}, "*")
})
}
this.onSearchStart()
} else console.warn("a previous search is already in progress")
}, Search.prototype.stop = function() {
this.onSearchStop()
}, Search.prototype.onSearchReady = function() {
this.emit("ready")
}, Search.prototype.onSearchResult = function(results) {
this.status !== Search.STATUS_STOPPED && this.emit("found", results),
this.status = Search.STATUS_STOPPED
}, Search.prototype.onSearchError = function(error) {
this.emit("error", error), this.status = Search.STATUS_STOPPED
}, Search.prototype.onSearchStart = function() {
this.status = Search.STATUS_STARTED, this.emit("start", this)
}, Search.prototype.onSearchStop = function() {
this.status = Search.STATUS_STOPPED, this.emit("stop", this)
}, module.exports = Search
}, function(module, exports, __webpack_require__) {
module.exports = {
logger: __webpack_require__(8),
url: __webpack_require__(9),
inherits: __webpack_require__(10),
props: __webpack_require__(11),
types: __webpack_require__(12),
queryString: __webpack_require__(13)
}
}, function(module, exports, __webpack_require__) {
"use strict";
function createLevel(level) {
return function() {
var args = Array.prototype.slice.call(arguments);
args.unshift(level), logger.log.apply(logger, args)
}
}
for (var levels = ["error", "warn", "info", "verbose", "debug", "silly"],
logger = {
level: "disabled",
log: function(level) {
if ("disabled" !== logger.level && levels.indexOf(level) <=
levels.indexOf(logger.level)) {
var args = Array.prototype.slice.call(arguments, 1);
args.unshift("[MSF:" + level.toUpperCase() + "]"),
console[level] ? console[level].apply(console, args) : console.log.apply(console,
args)
}
}
}, i = 0; i < levels.length; i++) {
var level = levels[i];
logger[level] = createLevel(level)
}
module.exports = logger
}, function(module, exports, __webpack_require__) {
"use strict";
var queryString = __webpack_require__(13),
url = {
isValid: function(u) {
var pattern = /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::
(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/;
return u.match(pattern) ? !0 : !1
},
parse: function(u) {
var oUrl = {},
parser = document.createElement("a");
return parser.href = u, oUrl.href = parser.href, oUrl.protocol =
parser.protocol, oUrl.hostname = parser.hostname, oUrl.port = parser.port,
oUrl.pathname = parser.pathname, oUrl.search = parser.search, oUrl.hash =
parser.hash, oUrl.host = parser.host, oUrl.queryString =
queryString.parse(parser.search), oUrl
}
};
module.exports = url
}, function(module) {
"use strict";
module.exports = "function" == typeof Object.create ? function(ctor, superCtor)
{
ctor.super_ = superCtor, ctor.prototype =
Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: !1,
writable: !0,
configurable: !0
}
})
} : function(ctor, superCtor) {
ctor.super_ = superCtor;
var TempCtor = function() {};
TempCtor.prototype = superCtor.prototype, ctor.prototype = new TempCtor,
ctor.prototype.constructor = ctor
}
}, function(module) {
"use strict";
function createDescriptor(e, c, w, v) {
return {
enumerable: e,
configurable: c,
writable: w,
value: v
}
}
module.exports = {
readOnly: function(obj, key) {
Array.isArray(key) ? key.forEach(function(k) {
Object.defineProperty(obj, k, createDescriptor(!0, !0, !1, obj[k]))
}) : Object.defineProperty(obj, key, createDescriptor(!0, !0, !1,
obj[key]))
},
"private": function(obj, key) {
Array.isArray(key) ? key.forEach(function(k) {
Object.defineProperty(obj, k, createDescriptor(!1, !0, !0, obj[k]))
}) : Object.defineProperty(obj, key, createDescriptor(!1, !0, !0,
obj[key]))
}
}
}, function(module) {
"use strict";
module.exports = {
isString: function(obj) {
return "string" == typeof obj
},
isNull: function(obj) {
return null === obj
},
isBoolean: function(obj) {
return "boolean" == typeof obj
},
isNumber: function(obj) {
return "number" == typeof obj
},
isObject: function(obj) {
return obj === Object(obj)
},
isArray: function(obj) {
return obj.constructor === Array
},
isFunction: function(obj) {
return "function" == typeof obj
},
isUndefined: function(obj) {
return "undefined" == typeof obj
}
}
}, function(module) {
"use strict";
/*!
query-string
Parse and stringify URL query strings
https://github.com/sindresorhus/query-string
by Sindre Sorhus
MIT License
*/
var queryString = {};
queryString.parse = function(str) {
return "string" != typeof str ? {} : (str = str.trim().replace(/^(\?|#)/,
""), str ? str.trim().split("&").reduce(function(ret, param) {
var parts = param.replace(/\+/g, " ").split("="),
key = parts[0],
val = parts[1];
return key = decodeURIComponent(key), val = void 0 === val ? null :
decodeURIComponent(val), ret.hasOwnProperty(key) ? Array.isArray(ret[key]) ?
ret[key].push(val) : ret[key] = [ret[key], val] : ret[key] = val, ret
}, {}) : {})
}, queryString.stringify = function(obj) {
return obj ? Object.keys(obj).map(function(key) {
var val = obj[key];
return Array.isArray(val) ? val.map(function(val2) {
return encodeURIComponent(key) + "=" + encodeURIComponent(val2)
}).join("&") : encodeURIComponent(key) + "=" + encodeURIComponent(val)
}).join("&") : ""
}, module.exports = queryString
}, function(module, exports, __webpack_require__) {
"use strict";
function ClientList(channel) {
if (!types.isObject(channel)) throw new TypeError("channel must be of type
Channel");
this.channel = channel, ClientList.super_.call(this)
}
var util = __webpack_require__(5),
types = util.types;
util.inherits(ClientList, Array), Object.defineProperty(ClientList.prototype,
"me", {
get: function() {
return this.getById(this.channel.clientId)
}
}), ClientList.prototype.clear = function() {
this.length = 0
}, ClientList.prototype.remove = function(item) {
var i = this.indexOf(item);
return -1 !== i ? (this.splice(i, 1), item) : null
}, ClientList.prototype.getById = function(id) {
if (!types.isString(id) && !types.isNumber(id)) throw new TypeError("id
must be a valid string or number");
for (var i = 0; i < this.length; i++)
if (this[i].id === id) return this[i];
return null
}, module.exports = ClientList
}]);
//# sourceMappingURL=msf-2.0.21.min.js.map