Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save limkokhole/1aae633cdc6128628bd2a5f66c69306b to your computer and use it in GitHub Desktop.
Save limkokhole/1aae633cdc6128628bd2a5f66c69306b to your computer and use it in GitHub Desktop.
messenger.Extensions/debug.js
/*1539272086,,JIT Construction: v4409275,en_US*/
/**
* Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
* copy, modify, and distribute this software in source code or binary form for use
* in connection with the web services and APIs provided by Facebook.
*
* As with any software that integrates with the Facebook platform, your use of
* this software is subject to the Facebook Platform Policy
* [http://developers.facebook.com/policy/]. This copyright notice shall be
* included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
try {
window.MessengerExtensions || (function (window, fb_fif_window) {
var apply = Function.prototype.apply;
function bindContext(fn, thisArg) {
return function _sdkBound() {
return apply.call(fn, thisArg, arguments);
};
}
var global = {
__type: 'JS_SDK_SANDBOX',
window: window,
document: window.document
};
var sandboxWhitelist = ['setTimeout', 'setInterval', 'clearTimeout', 'clearInterval'];
for (var i = 0; i < sandboxWhitelist.length; i++) {
global[sandboxWhitelist[i]] = bindContext(window[sandboxWhitelist[i]], window);
}
(function () {
var self = window;
var __DEV__ = 1;
function emptyFunction() {};
var __transform_includes = {};
var __annotator,
__bodyWrapper;
var __w,
__t;
var undefined;
var __p;
with (this) {
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @provides GenericFunctionVisitor
* @polyfill
*
* This file contains the functions used for the generic JS function
* transform. Please add your functionality to these functions if you
* want to wrap or annotate functions.
*
* Please see the DEX https://fburl.com/80903169 for more information.
*/
(function () {
var funcCalls = {};
var createMeta = function createMeta(type, signature) {
if (!type && !signature) {
return null;
}
var meta = {};
if (typeof type !== 'undefined') {
meta.type = type;
}
if (typeof signature !== 'undefined') {
meta.signature = signature;
}
return meta;
};
var getMeta = function getMeta(name, params) {
return createMeta(
name && /^[A-Z]/.test(name) ? name : undefined,
params && (params.params && params.params.length || params.returns) ?
'function(' + (
params.params ? params.params.map(function (param) {
return /\?/.test(param) ?
'?' + param.replace('?', '') :
param;
}).join(',') : '') +
')' + (
params.returns ? ':' + params.returns : '') :
undefined);
};
var noopAnnotator = function noopAnnotator(fn, funcMeta, params) {
return fn;
};
var genericAnnotator = function genericAnnotator(fn, funcMeta, params) {
if ('sourcemeta' in __transform_includes) {
fn.__SMmeta = funcMeta;
}
if ('typechecks' in __transform_includes) {
var meta = getMeta(funcMeta ? funcMeta.name : undefined, params);
if (meta) {
__w(fn, meta);
}
}
return fn;
};
var noopBodyWrapper = function noopBodyWrapper(scope, args, fn) {
return fn.apply(scope, args);
};
var typecheckBodyWrapper = function typecheckBodyWrapper(scope, args, fn, params) {
if (params && params.params) {
__t.apply(scope, params.params);
}
var result = fn.apply(scope, args);
if (params && params.returns) {
__t([result, params.returns]);
}
return result;
};
var codeUsageBodyWrapper = function codeUsageBodyWrapper(scope, args, fn, params, funcMeta) {
if (funcMeta) {
if (!funcMeta.callId) {
funcMeta.callId = funcMeta.module + ':' + (
funcMeta.line || 0) + ':' + (
funcMeta.column || 0);
}
var key = funcMeta.callId;
funcCalls[key] = (funcCalls[key] || 0) + 1;
}
return fn.apply(scope, args);
};
if (typeof __transform_includes === 'undefined') {
__annotator = noopAnnotator;
__bodyWrapper = noopBodyWrapper;
} else {
__annotator = genericAnnotator;
if ('codeusage' in __transform_includes) {
__annotator = noopAnnotator;
__bodyWrapper = codeUsageBodyWrapper;
__bodyWrapper.getCodeUsage = function () {
return funcCalls;
};
__bodyWrapper.clearCodeUsage = function () {
funcCalls = {};
};
} else if ('typechecks' in __transform_includes) {
__bodyWrapper = typecheckBodyWrapper;
} else {
__bodyWrapper = noopBodyWrapper;
}
}
})();
__t = function (x) {
return x[0]
};
__w = function (x) {
return x
};
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* This is a lightweigh implementation of require and __d which is used by the
* JavaScript SDK.
* This implementation requires that all modules are defined in order by how
* they depend on each other, so that it is guaranteed that no module will
* require a module that has not got all of its dependencies satisfied.
* This means that it is generally only usable in cases where all resources are
* resolved and packaged together.
*
* @providesInline commonjs-require-lite
* @typechecks
*/
var require,
__d;
(function (global) {
var map = {},
resolved = {};
var defaultDeps =
['global', 'require', 'requireDynamic', 'requireLazy', 'module', 'exports'];
require = function (id, soft) {
if (Object.prototype.hasOwnProperty.call(resolved, id)) {
return resolved[id];
}
if (!Object.prototype.hasOwnProperty.call(map, id)) {
if (soft) {
return null;
}
throw new Error('Module ' + id + ' has not been defined');
}
var module = map[id],
deps = module.deps,
length = module.factory.length,
dep,
args = [];
for (var i = 0; i < length; i++) {
switch (deps[i]) {
case 'module':
dep = module;
break;
case 'exports':
dep = module.exports;
break;
case 'global':
dep = global;
break;
case 'require':
dep = require;
break;
case 'requireDynamic':
dep = null;
break;
case 'requireLazy':
dep = null;
break;
default:
dep = require.call(null, deps[i]);
}
args.push(dep);
}
module.factory.apply(global, args);
resolved[id] = module.exports;
return module.exports;
};
__d = function (id, deps, factory,
_special) {
if (typeof factory === 'function') {
map[id] = {
factory: factory,
deps: defaultDeps.concat(deps),
exports: {}
};
if (_special === 3) {
require.call(null, id);
}
} else {
resolved[id] = factory;
}
};
})(this);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES5Array", [], (function $module_ES5Array(global, require, requireDynamic, requireLazy, module, exports) {
var ES5Array = {};
ES5Array.isArray = function (object) {
return Object.prototype.toString.call(object) == '[object Array]';
};
module.exports = ES5Array;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES5ArrayPrototype", [], (function $module_ES5ArrayPrototype(global, require, requireDynamic, requireLazy, module, exports) {
var ES5ArrayPrototype = {};
ES5ArrayPrototype.map = function (func, context) {
if (typeof func !== 'function') {
throw new TypeError();
}
var ii;
var len = this.length;
var r = new Array(len);
for (ii = 0; ii < len; ++ii) {
if (ii in this) {
r[ii] = func.call(context, this[ii], ii, this);
}
}
return r;
};
ES5ArrayPrototype.forEach = function (func, context) {
ES5ArrayPrototype.map.call(this, func, context);
};
ES5ArrayPrototype.filter = function (func, context) {
if (typeof func !== 'function') {
throw new TypeError();
}
var ii;
var val;
var len = this.length;
var r = [];
for (ii = 0; ii < len; ++ii) {
if (ii in this) {
val = this[ii];
if (func.call(context, val, ii, this)) {
r.push(val);
}
}
}
return r;
};
ES5ArrayPrototype.every = function (func, context) {
if (typeof func !== 'function') {
throw new TypeError();
}
var t = new Object(this);
var len = t.length;
for (var ii = 0; ii < len; ii++) {
if (ii in t) {
if (!func.call(context, t[ii], ii, t)) {
return false;
}
}
}
return true;
};
ES5ArrayPrototype.some = function (func, context) {
if (typeof func !== 'function') {
throw new TypeError();
}
var t = new Object(this);
var len = t.length;
for (var ii = 0; ii < len; ii++) {
if (ii in t) {
if (func.call(context, t[ii], ii, t)) {
return true;
}
}
}
return false;
};
ES5ArrayPrototype.indexOf = function (val, index) {
var len = this.length;
index |= 0;
if (index < 0) {
index += len;
}
for (; index < len; index++) {
if (index in this && this[index] === val) {
return index;
}
}
return -1;
};
module.exports = ES5ArrayPrototype;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES5Date", [], (function $module_ES5Date(global, require, requireDynamic, requireLazy, module, exports) {
var ES5Date = {};
ES5Date.now = function () {
return new Date().getTime();
};
module.exports = ES5Date;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES5FunctionPrototype", [], (function $module_ES5FunctionPrototype(global, require, requireDynamic, requireLazy, module, exports) {
var ES5FunctionPrototype = {};
ES5FunctionPrototype.bind = function (context) {
if (typeof this !== 'function') {
throw new TypeError('Bind must be called on a function');
}
var target = this;
var appliedArguments = Array.prototype.slice.call(arguments, 1);
function bound() {
return target.apply(
context,
appliedArguments.concat(Array.prototype.slice.call(arguments)));
}
bound.displayName = 'bound:' + (target.displayName || target.name || '(?)');
bound.toString = function toString() {
return 'bound: ' + target;
};
return bound;
};
module.exports = ES5FunctionPrototype;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ie8DontEnum", [], (function $module_ie8DontEnum(global, require, requireDynamic, requireLazy, module, exports) {
var dontEnumProperties = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'prototypeIsEnumerable',
'constructor'];
var hasOwnProperty = {}
.hasOwnProperty;
var ie8DontEnum = function ie8DontEnum() {};
if ({
toString: true
}
.propertyIsEnumerable('toString')) {
ie8DontEnum = function ie8DontEnum(object, onProp) {
for (var i = 0; i < dontEnumProperties.length; i++) {
var property = dontEnumProperties[i];
if (hasOwnProperty.call(object, property)) {
onProp(property);
}
}
};
}
module.exports = ie8DontEnum;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES5Object", ["ie8DontEnum"], (function $module_ES5Object(global, require, requireDynamic, requireLazy, module, exports, ie8DontEnum) {
var hasOwnProperty = {}
.hasOwnProperty;
var ES5Object = {};
function F() {}
ES5Object.create = function (proto) {
if (__DEV__) {
if (arguments.length > 1) {
throw new Error(
'Object.create implementation supports only the first parameter');
}
}
var type = typeof proto;
if (type != 'object' && type != 'function') {
throw new TypeError('Object prototype may only be a Object or null');
}
F.prototype = proto;
return new F();
};
ES5Object.keys = function (object) {
var type = typeof object;
if (type != 'object' && type != 'function' || object === null) {
throw new TypeError('Object.keys called on non-object');
}
var keys = [];
for (var key in object) {
if (hasOwnProperty.call(object, key)) {
keys.push(key);
}
}
ie8DontEnum(object, function (prop) {
return keys.push(prop);
});
return keys;
};
ES5Object.freeze = function (object) {
return object;
};
ES5Object.isFrozen = function () {
return false;
};
ES5Object.seal = function (object) {
return object;
};
module.exports = ES5Object;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES5StringPrototype", [], (function $module_ES5StringPrototype(global, require, requireDynamic, requireLazy, module, exports) {
var ES5StringPrototype = {};
ES5StringPrototype.trim = function () {
if (this == null) {
throw new TypeError('String.prototype.trim called on null or undefined');
}
return String.prototype.replace.call(this, /^\s+|\s+$/g, '');
};
ES5StringPrototype.startsWith = function (search) {
var string = String(this);
if (this == null) {
throw new TypeError(
'String.prototype.startsWith called on null or undefined');
}
var pos = arguments.length > 1 ? Number(arguments[1]) : 0;
if (isNaN(pos)) {
pos = 0;
}
var start = Math.min(Math.max(pos, 0), string.length);
return string.indexOf(String(search), pos) == start;
};
ES5StringPrototype.endsWith = function (search) {
var string = String(this);
if (this == null) {
throw new TypeError(
'String.prototype.endsWith called on null or undefined');
}
var stringLength = string.length;
var searchString = String(search);
var pos = arguments.length > 1 ? Number(arguments[1]) : stringLength;
if (isNaN(pos)) {
pos = 0;
}
var end = Math.min(Math.max(pos, 0), stringLength);
var start = end - searchString.length;
if (start < 0) {
return false;
}
return string.lastIndexOf(searchString, start) == start;
};
ES5StringPrototype.includes = function (search) {
if (this == null) {
throw new TypeError(
'String.prototype.contains called on null or undefined');
}
var string = String(this);
var pos = arguments.length > 1 ? Number(arguments[1]) : 0;
if (isNaN(pos)) {
pos = 0;
}
return string.indexOf(String(search), pos) != -1;
};
ES5StringPrototype.contains = ES5StringPrototype.includes;
ES5StringPrototype.repeat = function (count) {
if (this == null) {
throw new TypeError('String.prototype.repeat called on null or undefined');
}
var string = String(this);
var n = count ? Number(count) : 0;
if (isNaN(n)) {
n = 0;
}
if (n < 0 || n === Infinity) {
throw RangeError();
}
if (n === 1) {
return string;
}
if (n === 0) {
return '';
}
var result = '';
while (n) {
if (n & 1) {
result += string;
}
if (n >>= 1) {
string += string;
}
}
return result;
};
module.exports = ES5StringPrototype;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES6Array", [], function $module_ES6Array(global, require, requireDynamic, requireLazy, module, exports) {
'use strict';
var ES6Array = {
from: function from(arrayLike) {
if (arrayLike == null) {
throw new TypeError('Object is null or undefined');
}
var mapFn = arguments[1];
var thisArg = arguments[2];
var C = this;
var items = Object(arrayLike);
var symbolIterator =
typeof Symbol === 'function' ? typeof Symbol === "function" ? Symbol.iterator : "@@iterator" : '@@iterator';
var mapping = typeof mapFn === 'function';
var usingIterator = typeof items[symbolIterator] === 'function';
var key = 0;
var ret;
var value;
if (usingIterator) {
ret = typeof C === 'function' ? new C() : [];
var it = items[symbolIterator]();
var next;
while (!(next = it.next()).done) {
value = next.value;
if (mapping) {
value = mapFn.call(thisArg, value, key);
}
ret[key] = value;
key += 1;
}
ret.length = key;
return ret;
}
var len = items.length;
if (isNaN(len) || len < 0) {
len = 0;
}
ret = typeof C === 'function' ? new C(len) : new Array(len);
while (key < len) {
value = items[key];
if (mapping) {
value = mapFn.call(thisArg, value, key);
}
ret[key] = value;
key += 1;
}
ret.length = key;
return ret;
}
};
module.exports = ES6Array;
}, null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES6ArrayPrototype", [], (function $module_ES6ArrayPrototype(global, require, requireDynamic, requireLazy, module, exports) {
var ES6ArrayPrototype = {
find: function find(predicate, thisArg) {
if (this == null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var index = ES6ArrayPrototype.findIndex.call(this, predicate, thisArg);
return index === -1 ? void 0 : this[index];
},
findIndex: function findIndex(predicate, thisArg) {
if (this == null) {
throw new TypeError(
'Array.prototype.findIndex called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
for (var i = 0; i < length; i++) {
if (predicate.call(thisArg, list[i], i, list)) {
return i;
}
}
return -1;
},
fill: function fill(value) {
if (this == null) {
throw new TypeError('Array.prototype.fill called on null or undefined');
}
var O = Object(this);
var len = O.length >>> 0;
var start = arguments[1];
var relativeStart = start >> 0;
var k =
relativeStart < 0 ?
Math.max(len + relativeStart, 0) :
Math.min(relativeStart, len);
var end = arguments[2];
var relativeEnd = end === undefined ? len : end >> 0;
var final =
relativeEnd < 0 ?
Math.max(len + relativeEnd, 0) :
Math.min(relativeEnd, len);
while (k < final) {
O[k] = value;
k++;
}
return O;
}
};
module.exports = ES6ArrayPrototype;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES6DatePrototype", [], (function $module_ES6DatePrototype(global, require, requireDynamic, requireLazy, module, exports) {
function pad(number) {
return (number < 10 ? '0' : '') + number;
}
var ES6DatePrototype = {
toISOString: function toISOString() {
if (!isFinite(this)) {
throw new Error('Invalid time value');
}
var year = this.getUTCFullYear();
year =
(year < 0 ? '-' : year > 9999 ? '+' : '') +
('00000' + Math.abs(year)).slice(0 <= year && year <= 9999 ? -4 : -6);
return (
year +
'-' +
pad(this.getUTCMonth() + 1) +
'-' +
pad(this.getUTCDate()) +
'T' +
pad(this.getUTCHours()) +
':' +
pad(this.getUTCMinutes()) +
':' +
pad(this.getUTCSeconds()) +
'.' +
(this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) +
'Z');
}
};
module.exports = ES6DatePrototype;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES6Number", [], (function $module_ES6Number(global, require, requireDynamic, requireLazy, module, exports) {
var EPSILON = Math.pow(2, -52);
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
var MIN_SAFE_INTEGER = -1 * MAX_SAFE_INTEGER;
var ES6Number = {
isFinite: function (_isFinite) {
function isFinite(_x) {
return _isFinite.apply(this, arguments);
}
isFinite.toString = function () {
return _isFinite.toString();
};
return isFinite;
}
(function (value) {
return typeof value === 'number' && isFinite(value);
}),
isNaN: function (_isNaN) {
function isNaN(_x2) {
return _isNaN.apply(this, arguments);
}
isNaN.toString = function () {
return _isNaN.toString();
};
return isNaN;
}
(function (value) {
return typeof value === 'number' && isNaN(value);
}),
isInteger: function isInteger(value) {
return this.isFinite(value) && Math.floor(value) === value;
},
isSafeInteger: function isSafeInteger(value) {
return (
this.isFinite(value) &&
value >= this.MIN_SAFE_INTEGER &&
value <= this.MAX_SAFE_INTEGER &&
Math.floor(value) === value);
},
EPSILON: EPSILON,
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER,
MIN_SAFE_INTEGER: MIN_SAFE_INTEGER
};
module.exports = ES6Number;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES6Object", ["ie8DontEnum"], (function $module_ES6Object(global, require, requireDynamic, requireLazy, module, exports, ie8DontEnum) {
var hasOwnProperty = {}
.hasOwnProperty;
var ES6Object = {
assign: function assign(target) {
if (target == null) {
throw new TypeError('Object.assign target cannot be null or undefined');
}
target = Object(target);
for (var i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
var source = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
if (source == null) {
continue;
}
source = Object(source);
for (var prop in source) {
if (hasOwnProperty.call(source, prop)) {
target[prop] = source[prop];
}
}
ie8DontEnum(source, function (prop) {
return target[prop] = source[prop];
});
}
return target;
},
is: function is(x, y) {
if (x === y) {
return x !== 0 || 1 / x === 1 / y;
} else {
return x !== x && y !== y;
}
}
};
module.exports = ES6Object;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*
*/
__d("ES7ArrayPrototype", ["ES5Array", "ES5ArrayPrototype"], (function $module_ES7ArrayPrototype(global, require, requireDynamic, requireLazy, module, exports, _require, _require2) {
var
isArray = _require.isArray;
var
indexOf = _require2.indexOf;
function toLength(number) {
return Math.min(Math.max(toInteger(number), 0), Number.MAX_SAFE_INTEGER);
}
function toInteger(number) {
var n = Number(number);
return isFinite(n) && n !== 0 ? sign(n) * Math.floor(Math.abs(n)) : n;
}
function sign(number) {
return number >= 0 ? 1 : -1;
}
var ES7ArrayPrototype = {
includes: function includes(needle) {
'use strict';
if (
needle !== undefined &&
isArray(this) &&
!(typeof needle === 'number' && isNaN(needle))) {
return indexOf.apply(this, arguments) !== -1;
}
var o = Object(this);
var len = o.length ? toLength(o.length) : 0;
if (len === 0) {
return false;
}
var fromIndex = arguments.length > 1 ? toInteger(arguments[1]) : 0;
var i = fromIndex < 0 ? Math.max(len + fromIndex, 0) : fromIndex;
var NaNLookup = isNaN(needle) && typeof needle === 'number';
while (i < len) {
var value = o[i];
if (
value === needle ||
typeof value === 'number' && NaNLookup && isNaN(value)) {
return true;
}
i++;
}
return false;
}
};
module.exports = ES7ArrayPrototype;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES7Object", ["ie8DontEnum"], (function $module_ES7Object(global, require, requireDynamic, requireLazy, module, exports, ie8DontEnum) {
var hasOwnProperty = {}
.hasOwnProperty;
var ES7Object = {};
ES7Object.entries = function (object) {
if (object == null) {
throw new TypeError('Object.entries called on non-object');
}
var entries = [];
for (var key in object) {
if (hasOwnProperty.call(object, key)) {
entries.push([key, object[key]]);
}
}
ie8DontEnum(object, function (prop) {
return entries.push([prop, object[prop]]);
});
return entries;
};
ES7Object.values = function (object) {
if (object == null) {
throw new TypeError('Object.values called on non-object');
}
var values = [];
for (var key in object) {
if (hasOwnProperty.call(object, key)) {
values.push(object[key]);
}
}
ie8DontEnum(object, function (prop) {
return values.push(object[prop]);
});
return values;
};
module.exports = ES7Object;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("ES7StringPrototype", [], (function $module_ES7StringPrototype(global, require, requireDynamic, requireLazy, module, exports) {
var ES7StringPrototype = {};
ES7StringPrototype.trimLeft = function () {
return this.replace(/^\s+/, '');
};
ES7StringPrototype.trimRight = function () {
return this.replace(/\s+$/, '');
};
module.exports = ES7StringPrototype;
}), null);
/**
* MIT License
*
* Copyright (c) 2017 The copyright holders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell co
* pies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in al
* l copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IM
* PLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNES
* S FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
* OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WH
* ETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED AND IS NOT MEANT TO BE
* EDITED THROUGH NORMAL MEANS. PLEASE CHECK THE DOCUMENTATION FOR
* DETAILS AND GUIDANCE: http://fburl.com/js-libs-www
*
* @preserve-header
* @nolint
*/
__d("json3-3.3.2", [], (function $module_json3_3_3_2(global, require, requireDynamic, requireLazy, module, exports) {
'use strict';
var exports$1 = {};
var module$1 = {
exports: exports$1
};
var define;
function TROMPLE_MAIN() {
/*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */
(function () {
// Detect the `define` function exposed by asynchronous module loaders. The
// strict `define` check is necessary for compatibility with `r.js`.
var isLoader = typeof define === "function" && define.amd;
// A set of types used to distinguish objects from primitives.
var objectTypes = {
"function": true,
"object": true
};
// Detect the `exports` object exposed by CommonJS implementations.
var freeExports = objectTypes[typeof exports$1] && exports$1 && !exports$1.nodeType && exports$1;
// Use the `global` object exposed by Node (including Browserify via
// `insert-module-globals`), Narwhal, and Ringo as the default context,
// and the `window` object in browsers. Rhino exports a `global` function
// instead.
var root = objectTypes[typeof window] && window || this,
freeGlobal = freeExports && objectTypes[typeof module$1] && module$1 && !module$1.nodeType && typeof global == "object" && global;
if (freeGlobal && (freeGlobal["global"] === freeGlobal || freeGlobal["window"] === freeGlobal || freeGlobal["self"] === freeGlobal)) {
root = freeGlobal;
}
// Public: Initializes JSON 3 using the given `context` object, attaching the
// `stringify` and `parse` functions to the specified `exports` object.
function runInContext(context, exports) {
context || (context = root["Object"]());
exports || (exports = root["Object"]());
// Native constructor aliases.
var Number = context["Number"] || root["Number"],
String = context["String"] || root["String"],
Object = context["Object"] || root["Object"],
Date = context["Date"] || root["Date"],
SyntaxError = context["SyntaxError"] || root["SyntaxError"],
TypeError = context["TypeError"] || root["TypeError"],
Math = context["Math"] || root["Math"],
nativeJSON = context["JSON"] || root["JSON"];
// Delegate to the native `stringify` and `parse` implementations.
if (typeof nativeJSON == "object" && nativeJSON) {
exports.stringify = nativeJSON.stringify;
exports.parse = nativeJSON.parse;
}
// Convenience aliases.
var objectProto = Object.prototype,
getClass = objectProto.toString,
isProperty,
forEach,
undef;
// Test the `Date#getUTC*` methods. Based on work by @Yaffle.
var isExtended = new Date(-3509827334573292);
try {
// The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical
// results for certain dates in Opera >= 10.53.
isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 &&
// Safari < 2.0.2 stores the internal millisecond time value correctly,
// but clips the values returned by the date methods to the range of
// signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).
isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;
} catch (exception) {}
// Internal: Determines whether the native `JSON.stringify` and `parse`
// implementations are spec-compliant. Based on work by Ken Snyder.
function has(name) {
if (has[name] !== undef) {
// Return cached feature test result.
return has[name];
}
var isSupported;
if (name == "bug-string-char-index") {
// IE <= 7 doesn't support accessing string characters using square
// bracket notation. IE 8 only supports this for primitives.
isSupported = "a"[0] != "a";
} else if (name == "json") {
// Indicates whether both `JSON.stringify` and `JSON.parse` are
// supported.
isSupported = has("json-stringify") && has("json-parse");
} else {
var value,
serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';
// Test `JSON.stringify`.
if (name == "json-stringify") {
var stringify = exports.stringify,
stringifySupported = typeof stringify == "function" && isExtended;
if (stringifySupported) {
// A test function object with a custom `toJSON` method.
(value = function () {
return 1;
}).toJSON = value;
try {
stringifySupported =
// Firefox 3.1b1 and b2 serialize string, number, and boolean
// primitives as object literals.
stringify(0) === "0" &&
// FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
// literals.
stringify(new Number()) === "0" &&
stringify(new String()) == '""' &&
// FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
// does not define a canonical JSON representation (this applies to
// objects with `toJSON` properties as well, *unless* they are nested
// within an object or array).
stringify(getClass) === undef &&
// IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
// FF 3.1b3 pass this test.
stringify(undef) === undef &&
// Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
// respectively, if the value is omitted entirely.
stringify() === undef &&
// FF 3.1b1, 2 throw an error if the given value is not a number,
// string, array, object, Boolean, or `null` literal. This applies to
// objects with custom `toJSON` methods as well, unless they are nested
// inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
// methods entirely.
stringify(value) === "1" &&
stringify([value]) == "[1]" &&
// Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
// `"[null]"`.
stringify([undef]) == "[null]" &&
// YUI 3.0.0b1 fails to serialize `null` literals.
stringify(null) == "null" &&
// FF 3.1b1, 2 halts serialization if an array contains a function:
// `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3
// elides non-JSON values from objects and arrays, unless they
// define custom `toJSON` methods.
stringify([undef, getClass, null]) == "[null,null,null]" &&
// Simple serialization test. FF 3.1b1 uses Unicode escape sequences
// where character escape codes are expected (e.g., `\b` => `\u0008`).
stringify({
"a": [value, true, false, null, "\x00\b\n\f\r\t"]
}) == serialized &&
// FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
stringify(null, value) === "1" &&
stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" &&
// JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
// serialize extended years.
stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' &&
// The milliseconds are optional in ES 5, but required in 5.1.
stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' &&
// Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
// four-digit years instead of six-digit years. Credits: @Yaffle.
stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' &&
// Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
// values less than 1000. Credits: @Yaffle.
stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
} catch (exception) {
stringifySupported = false;
}
}
isSupported = stringifySupported;
}
// Test `JSON.parse`.
if (name == "json-parse") {
var parse = exports.parse;
if (typeof parse == "function") {
try {
// FF 3.1b1, b2 will throw an exception if a bare literal is provided.
// Conforming implementations should also coerce the initial argument to
// a string prior to parsing.
if (parse("0") === 0 && !parse(false)) {
// Simple parsing test.
value = parse(serialized);
var parseSupported = value["a"].length == 5 && value["a"][0] === 1;
if (parseSupported) {
try {
// Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.
parseSupported = !parse('"\t"');
} catch (exception) {}
if (parseSupported) {
try {
// FF 4.0 and 4.0.1 allow leading `+` signs and leading
// decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow
// certain octal literals.
parseSupported = parse("01") !== 1;
} catch (exception) {}
}
if (parseSupported) {
try {
// FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal
// points. These environments, along with FF 3.1b1 and 2,
// also allow trailing commas in JSON objects and arrays.
parseSupported = parse("1.") !== 1;
} catch (exception) {}
}
}
}
} catch (exception) {
parseSupported = false;
}
}
isSupported = parseSupported;
}
}
return has[name] = !!isSupported;
}
if (!has("json")) {
// Common `[[Class]]` name aliases.
var functionClass = "[object Function]",
dateClass = "[object Date]",
numberClass = "[object Number]",
stringClass = "[object String]",
arrayClass = "[object Array]",
booleanClass = "[object Boolean]";
// Detect incomplete support for accessing string characters by index.
var charIndexBuggy = has("bug-string-char-index");
// Define additional utility methods if the `Date` methods are buggy.
if (!isExtended) {
var floor = Math.floor;
// A mapping between the months of the year and the number of days between
// January 1st and the first of the respective month.
var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
// Internal: Calculates the number of days between the Unix epoch and the
// first day of the given month.
var getDay = function (year, month) {
return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = + (month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);
};
}
// Internal: Determines if a property is a direct property of the given
// object. Delegates to the native `Object#hasOwnProperty` method.
if (!(isProperty = objectProto.hasOwnProperty)) {
isProperty = function (property) {
var members = {},
constructor;
if ((members.__proto__ = null, members.__proto__ = {
// The *proto* property cannot be set multiple times in recent
// versions of Firefox and SeaMonkey.
"toString": 1
}, members).toString != getClass) {
// Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but
// supports the mutable *proto* property.
isProperty = function (property) {
// Capture and break the object's prototype chain (see section 8.6.2
// of the ES 5.1 spec). The parenthesized expression prevents an
// unsafe transformation by the Closure Compiler.
var original = this.__proto__,
result = property in(this.__proto__ = null, this);
// Restore the original prototype chain.
this.__proto__ = original;
return result;
};
} else {
// Capture a reference to the top-level `Object` constructor.
constructor = members.constructor;
// Use the `constructor` property to simulate `Object#hasOwnProperty` in
// other environments.
isProperty = function (property) {
var parent = (this.constructor || constructor).prototype;
return property in this && !(property in parent && this[property] === parent[property]);
};
}
members = null;
return isProperty.call(this, property);
};
}
// Internal: Normalizes the `for...in` iteration algorithm across
// environments. Each enumerated key is yielded to a `callback` function.
forEach = function (object, callback) {
var size = 0,
Properties,
members,
property;
// Tests for bugs in the current environment's `for...in` algorithm. The
// `valueOf` property inherits the non-enumerable flag from
// `Object.prototype` in older versions of IE, Netscape, and Mozilla.
(Properties = function () {
this.valueOf = 0;
}).prototype.valueOf = 0;
// Iterate over a new instance of the `Properties` class.
members = new Properties();
for (property in members) {
// Ignore all properties inherited from `Object.prototype`.
if (isProperty.call(members, property)) {
size++;
}
}
Properties = members = null;
// Normalize the iteration algorithm.
if (!size) {
// A list of non-enumerable properties inherited from `Object.prototype`.
members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"];
// IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable
// properties.
forEach = function (object, callback) {
var isFunction = getClass.call(object) == functionClass,
property,
length;
var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty;
for (property in object) {
// Gecko <= 1.0 enumerates the `prototype` property of functions under
// certain conditions; IE does not.
if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) {
callback(property);
}
}
// Manually invoke the callback for each non-enumerable property.
for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property));
};
} else if (size == 2) {
// Safari <= 2.0.4 enumerates shadowed properties twice.
forEach = function (object, callback) {
// Create a set of iterated properties.
var members = {},
isFunction = getClass.call(object) == functionClass,
property;
for (property in object) {
// Store each property name to prevent double enumeration. The
// `prototype` property of functions is not enumerated due to cross-
// environment inconsistencies.
if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) {
callback(property);
}
}
};
} else {
// No bugs detected; use the standard `for...in` algorithm.
forEach = function (object, callback) {
var isFunction = getClass.call(object) == functionClass,
property,
isConstructor;
for (property in object) {
if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) {
callback(property);
}
}
// Manually invoke the callback for the `constructor` property due to
// cross-environment inconsistencies.
if (isConstructor || isProperty.call(object, (property = "constructor"))) {
callback(property);
}
};
}
return forEach(object, callback);
};
// Public: Serializes a JavaScript `value` as a JSON string. The optional
// `filter` argument may specify either a function that alters how object and
// array members are serialized, or an array of strings and numbers that
// indicates which properties should be serialized. The optional `width`
// argument may be either a string or number that specifies the indentation
// level of the output.
if (!has("json-stringify")) {
// Internal: A map of control characters and their escaped equivalents.
var Escapes = {
92: "\\\\",
34: '\\"',
8: "\\b",
12: "\\f",
10: "\\n",
13: "\\r",
9: "\\t"
};
// Internal: Converts `value` into a zero-padded string such that its
// length is at least equal to `width`. The `width` must be <= 6.
var leadingZeroes = "000000";
var toPaddedString = function (width, value) {
// The `|| 0` expression is necessary to work around a bug in
// Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`.
return (leadingZeroes + (value || 0)).slice(-width);
};
// Internal: Double-quotes a string `value`, replacing all ASCII control
// characters (characters with code unit values between 0 and 31) with
// their escaped equivalents. This is an implementation of the
// `Quote(value)` operation defined in ES 5.1 section 15.12.3.
var unicodePrefix = "\\u00";
var quote = function (value) {
var result = '"',
index = 0,
length = value.length,
useCharIndex = !charIndexBuggy || length > 10;
var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value);
for (; index < length; index++) {
var charCode = value.charCodeAt(index);
// If the character is a control character, append its Unicode or
// shorthand escape sequence; otherwise, append the character as-is.
switch (charCode) {
case 8:
case 9:
case 10:
case 12:
case 13:
case 34:
case 92:
result += Escapes[charCode];
break;
default:
if (charCode < 32) {
result += unicodePrefix + toPaddedString(2, charCode.toString(16));
break;
}
result += useCharIndex ? symbols[index] : value.charAt(index);
}
}
return result + '"';
};
// Internal: Recursively serializes an object. Implements the
// `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.
var serialize = function (property, object, callback, properties, whitespace, indentation, stack) {
var value,
className,
year,
month,
date,
time,
hours,
minutes,
seconds,
milliseconds,
results,
element,
index,
length,
prefix,
result;
try {
// Necessary for host object support.
value = object[property];
} catch (exception) {}
if (typeof value == "object" && value) {
className = getClass.call(value);
if (className == dateClass && !isProperty.call(value, "toJSON")) {
if (value > -1 / 0 && value < 1 / 0) {
// Dates are serialized according to the `Date#toJSON` method
// specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15
// for the ISO 8601 date time string format.
if (getDay) {
// Manually compute the year, month, date, hours, minutes,
// seconds, and milliseconds if the `getUTC*` methods are
// buggy. Adapted from @Yaffle's `date-shim` project.
date = floor(value / 864e5);
for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++);
for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++);
date = 1 + date - getDay(year, month);
// The `time` value specifies the time within the day (see ES
// 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used
// to compute `A modulo B`, as the `%` operator does not
// correspond to the `modulo` operation for negative numbers.
time = (value % 864e5 + 864e5) % 864e5;
// The hours, minutes, seconds, and milliseconds are obtained by
// decomposing the time within the day. See section 15.9.1.10.
hours = floor(time / 36e5) % 24;
minutes = floor(time / 6e4) % 60;
seconds = floor(time / 1e3) % 60;
milliseconds = time % 1e3;
} else {
year = value.getUTCFullYear();
month = value.getUTCMonth();
date = value.getUTCDate();
hours = value.getUTCHours();
minutes = value.getUTCMinutes();
seconds = value.getUTCSeconds();
milliseconds = value.getUTCMilliseconds();
}
// Serialize extended years correctly.
value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) +
"-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) +
// Months, dates, hours, minutes, and seconds should have two
// digits; milliseconds should have three.
"T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) +
// Milliseconds are optional in ES 5.0, but required in 5.1.
"." + toPaddedString(3, milliseconds) + "Z";
} else {
value = null;
}
} else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) {
// Prototype <= 1.6.1 adds non-standard `toJSON` methods to the
// `Number`, `String`, `Date`, and `Array` prototypes. JSON 3
// ignores all `toJSON` methods on these objects unless they are
// defined directly on an instance.
value = value.toJSON(property);
}
}
if (callback) {
// If a replacement function was provided, call it to obtain the value
// for serialization.
value = callback.call(object, property, value);
}
if (value === null) {
return "null";
}
className = getClass.call(value);
if (className == booleanClass) {
// Booleans are represented literally.
return "" + value;
} else if (className == numberClass) {
// JSON numbers must be finite. `Infinity` and `NaN` are serialized as
// `"null"`.
return value > -1 / 0 && value < 1 / 0 ? "" + value : "null";
} else if (className == stringClass) {
// Strings are double-quoted and escaped.
return quote("" + value);
}
// Recursively serialize objects and arrays.
if (typeof value == "object") {
// Check for cyclic structures. This is a linear search; performance
// is inversely proportional to the number of unique nested objects.
for (length = stack.length; length--; ) {
if (stack[length] === value) {
// Cyclic structures cannot be serialized by `JSON.stringify`.
throw TypeError();
}
}
// Add the object to the stack of traversed objects.
stack.push(value);
results = [];
// Save the current indentation level and indent one additional level.
prefix = indentation;
indentation += whitespace;
if (className == arrayClass) {
// Recursively serialize array elements.
for (index = 0, length = value.length; index < length; index++) {
element = serialize(index, value, callback, properties, whitespace, indentation, stack);
results.push(element === undef ? "null" : element);
}
result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]";
} else {
// Recursively serialize object members. Members are selected from
// either a user-specified list of property names, or the object
// itself.
forEach(properties || value, function (property) {
var element = serialize(property, value, callback, properties, whitespace, indentation, stack);
if (element !== undef) {
// According to ES 5.1 section 15.12.3: "If `gap` {whitespace}
// is not the empty string, let `member` {quote(property) + ":"}
// be the concatenation of `member` and the `space` character."
// The "`space` character" refers to the literal space
// character, not the `space` {width} argument provided to
// `JSON.stringify`.
results.push(quote(property) + ":" + (whitespace ? " " : "") + element);
}
});
result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}";
}
// Remove the object from the traversed object stack.
stack.pop();
return result;
}
};
// Public: `JSON.stringify`. See ES 5.1 section 15.12.3.
exports.stringify = function (source, filter, width) {
var whitespace,
callback,
properties,
className;
if (objectTypes[typeof filter] && filter) {
if ((className = getClass.call(filter)) == functionClass) {
callback = filter;
} else if (className == arrayClass) {
// Convert the property names array into a makeshift set.
properties = {};
for (var index = 0, length = filter.length, value; index < length; value = filter[index++], (className = getClass.call(value), className == stringClass || className == numberClass) && (properties[value] = 1));
}
}
if (width) {
if ((className = getClass.call(width)) == numberClass) {
// Convert the `width` to an integer and create a string containing
// `width` number of space characters.
if ((width -= width % 1) > 0) {
for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " ");
}
} else if (className == stringClass) {
whitespace = width.length <= 10 ? width : width.slice(0, 10);
}
}
// Opera <= 7.54u2 discards the values associated with empty string keys
// (`""`) only if they are used directly within an object member list
// (e.g., `!("" in { "": 1})`).
return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []);
};
}
// Public: Parses a JSON source string.
if (!has("json-parse")) {
var fromCharCode = String.fromCharCode;
// Internal: A map of escaped control characters and their unescaped
// equivalents.
var Unescapes = {
92: "\\",
34: '"',
47: "/",
98: "\b",
116: "\t",
110: "\n",
102: "\f",
114: "\r"
};
// Internal: Stores the parser state.
var Index,
Source;
// Internal: Resets the parser state and throws a `SyntaxError`.
var abort = function () {
Index = Source = null;
throw SyntaxError();
};
// Internal: Returns the next token, or `"$"` if the parser has reached
// the end of the source string. A token may be a string, number, `null`
// literal, or Boolean literal.
var lex = function () {
var source = Source,
length = source.length,
value,
begin,
position,
isSigned,
charCode;
while (Index < length) {
charCode = source.charCodeAt(Index);
switch (charCode) {
case 9:
case 10:
case 13:
case 32:
// Skip whitespace tokens, including tabs, carriage returns, line
// feeds, and space characters.
Index++;
break;
case 123:
case 125:
case 91:
case 93:
case 58:
case 44:
// Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at
// the current position.
value = charIndexBuggy ? source.charAt(Index) : source[Index];
Index++;
return value;
case 34:
// `"` delimits a JSON string; advance to the next character and
// begin parsing the string. String tokens are prefixed with the
// sentinel `@` character to distinguish them from punctuators and
// end-of-string tokens.
for (value = "@", Index++; Index < length; ) {
charCode = source.charCodeAt(Index);
if (charCode < 32) {
// Unescaped ASCII control characters (those with a code unit
// less than the space character) are not permitted.
abort();
} else if (charCode == 92) {
// A reverse solidus (`\`) marks the beginning of an escaped
// control character (including `"`, `\`, and `/`) or Unicode
// escape sequence.
charCode = source.charCodeAt(++Index);
switch (charCode) {
case 92:
case 34:
case 47:
case 98:
case 116:
case 110:
case 102:
case 114:
// Revive escaped control characters.
value += Unescapes[charCode];
Index++;
break;
case 117:
// `\u` marks the beginning of a Unicode escape sequence.
// Advance to the first character and validate the
// four-digit code point.
begin = ++Index;
for (position = Index + 4; Index < position; Index++) {
charCode = source.charCodeAt(Index);
// A valid sequence comprises four hexdigits (case-
// insensitive) that form a single hexadecimal value.
if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {
// Invalid Unicode escape sequence.
abort();
}
}
// Revive the escaped character.
value += fromCharCode("0x" + source.slice(begin, Index));
break;
default:
// Invalid escape sequence.
abort();
}
} else {
if (charCode == 34) {
// An unescaped double-quote character marks the end of the
// string.
break;
}
charCode = source.charCodeAt(Index);
begin = Index;
// Optimize for the common case where a string is valid.
while (charCode >= 32 && charCode != 92 && charCode != 34) {
charCode = source.charCodeAt(++Index);
}
// Append the string as-is.
value += source.slice(begin, Index);
}
}
if (source.charCodeAt(Index) == 34) {
// Advance to the next character and return the revived string.
Index++;
return value;
}
// Unterminated string.
abort();
default:
// Parse numbers and literals.
begin = Index;
// Advance past the negative sign, if one is specified.
if (charCode == 45) {
isSigned = true;
charCode = source.charCodeAt(++Index);
}
// Parse an integer or floating-point value.
if (charCode >= 48 && charCode <= 57) {
// Leading zeroes are interpreted as octal literals.
if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) {
// Illegal octal literal.
abort();
}
isSigned = false;
// Parse the integer component.
for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++);
// Floats cannot contain a leading decimal point; however, this
// case is already accounted for by the parser.
if (source.charCodeAt(Index) == 46) {
position = ++Index;
// Parse the decimal component.
for (; position < length && (charCode = source.charCodeAt(position), charCode >= 48 && charCode <= 57); position++);
if (position == Index) {
// Illegal trailing decimal.
abort();
}
Index = position;
}
// Parse exponents. The `e` denoting the exponent is
// case-insensitive.
charCode = source.charCodeAt(Index);
if (charCode == 101 || charCode == 69) {
charCode = source.charCodeAt(++Index);
// Skip past the sign following the exponent, if one is
// specified.
if (charCode == 43 || charCode == 45) {
Index++;
}
// Parse the exponential component.
for (position = Index; position < length && (charCode = source.charCodeAt(position), charCode >= 48 && charCode <= 57); position++);
if (position == Index) {
// Illegal empty exponent.
abort();
}
Index = position;
}
// Coerce the parsed value to a JavaScript number.
return +source.slice(begin, Index);
}
// A negative sign may only precede numbers.
if (isSigned) {
abort();
}
// `true`, `false`, and `null` literals.
if (source.slice(Index, Index + 4) == "true") {
Index += 4;
return true;
} else if (source.slice(Index, Index + 5) == "false") {
Index += 5;
return false;
} else if (source.slice(Index, Index + 4) == "null") {
Index += 4;
return null;
}
// Unrecognized token.
abort();
}
}
// Return the sentinel `$` character if the parser has reached the end
// of the source string.
return "$";
};
// Internal: Parses a JSON `value` token.
var get = function (value) {
var results,
hasMembers;
if (value == "$") {
// Unexpected end of input.
abort();
}
if (typeof value == "string") {
if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") {
// Remove the sentinel `@` character.
return value.slice(1);
}
// Parse object and array literals.
if (value == "[") {
// Parses a JSON array, returning a new JavaScript array.
results = [];
for (; ; hasMembers || (hasMembers = true)) {
value = lex();
// A closing square bracket marks the end of the array literal.
if (value == "]") {
break;
}
// If the array literal contains elements, the current token
// should be a comma separating the previous element from the
// next.
if (hasMembers) {
if (value == ",") {
value = lex();
if (value == "]") {
// Unexpected trailing `,` in array literal.
abort();
}
} else {
// A `,` must separate each array element.
abort();
}
}
// Elisions and leading commas are not permitted.
if (value == ",") {
abort();
}
results.push(get(value));
}
return results;
} else if (value == "{") {
// Parses a JSON object, returning a new JavaScript object.
results = {};
for (; ; hasMembers || (hasMembers = true)) {
value = lex();
// A closing curly brace marks the end of the object literal.
if (value == "}") {
break;
}
// If the object literal contains members, the current token
// should be a comma separator.
if (hasMembers) {
if (value == ",") {
value = lex();
if (value == "}") {
// Unexpected trailing `,` in object literal.
abort();
}
} else {
// A `,` must separate each object member.
abort();
}
}
// Leading commas are not permitted, object property names must be
// double-quoted strings, and a `:` must separate each property
// name and value.
if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") {
abort();
}
results[value.slice(1)] = get(lex());
}
return results;
}
// Unexpected token encountered.
abort();
}
return value;
};
// Internal: Updates a traversed object member.
var update = function (source, property, callback) {
var element = walk(source, property, callback);
if (element === undef) {
delete source[property];
} else {
source[property] = element;
}
};
// Internal: Recursively traverses a parsed JSON object, invoking the
// `callback` function for each value. This is an implementation of the
// `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
var walk = function (source, property, callback) {
var value = source[property],
length;
if (typeof value == "object" && value) {
// `forEach` can't be used to traverse an array in Opera <= 8.54
// because its `Object#hasOwnProperty` implementation returns `false`
// for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).
if (getClass.call(value) == arrayClass) {
for (length = value.length; length--; ) {
update(value, length, callback);
}
} else {
forEach(value, function (property) {
update(value, property, callback);
});
}
}
return callback.call(source, property, value);
};
// Public: `JSON.parse`. See ES 5.1 section 15.12.2.
exports.parse = function (source, callback) {
var result,
value;
Index = 0;
Source = "" + source;
result = get(lex());
// If a JSON string contains multiple tokens, it is invalid.
if (lex() != "$") {
abort();
}
// Reset the parser state.
Index = Source = null;
return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result;
};
}
}
exports["runInContext"] = runInContext;
return exports;
}
if (freeExports && !isLoader) {
// Export for CommonJS environments.
runInContext(root, freeExports);
} else {
// Export for web browsers and JavaScript engines.
var nativeJSON = root.JSON,
previousJSON = root["JSON3"],
isRestored = false;
var JSON3 = runInContext(root, (root["JSON3"] = {
// Public: Restores the original value of the global `JSON` object and
// returns a reference to the `JSON3` object.
"noConflict": function () {
if (!isRestored) {
isRestored = true;
root.JSON = nativeJSON;
root["JSON3"] = previousJSON;
nativeJSON = previousJSON = null;
}
return JSON3;
}
}));
root.JSON = {
"parse": JSON3.parse,
"stringify": JSON3.stringify
};
}
// Export for asynchronous module loaders.
if (isLoader) {
define(function () {
return JSON3;
});
}
}).call(this);
}
var TROMPLE_HAS_RAN = false;
var main = function () {
if (!TROMPLE_HAS_RAN) {
TROMPLE_HAS_RAN = true;
TROMPLE_MAIN();
}
return module$1.exports;
};
var trompleEntryPoint = function (requirePath) {
switch (requirePath) {
case undefined:
return main();
}
};
module.exports = trompleEntryPoint;
/* */
}), null);
__d("json3", ["json3-3.3.2"], (function $module_json3(global, require, requireDynamic, requireLazy, module, exports) { // @flow
// @nolint
module.exports = require("json3-3.3.2")();
/* */
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
*
* scripts/static_resources/js/fb-transforms/babel-7/babel-plugin-jssdk
* converts ES5/ES6 code into using this module in ES3 style.
*
* @format
*/
__d("ES", ["ES5Array", "ES5ArrayPrototype", "ES5Date", "ES5FunctionPrototype", "ES5Object", "ES5StringPrototype", "ES6Array", "ES6ArrayPrototype", "ES6DatePrototype", "ES6Number", "ES6Object", "ES7ArrayPrototype", "ES7Object", "ES7StringPrototype", "json3"], (function $module_ES(global, require, requireDynamic, requireLazy, module, exports, ES5Array, ES5ArrayPrototype, ES5Date, ES5FunctionPrototype, ES5Object, ES5StringPrototype, ES6Array, ES6ArrayPrototype, ES6DatePrototype, ES6Number, ES6Object, ES7ArrayPrototype, ES7Object, ES7StringPrototype, JSON3) {
var toString = {}
.toString;
var methodCache = {
'JSON.stringify': JSON3.stringify,
'JSON.parse': JSON3.parse
};
var es5Polyfills = {
'Array.prototype': ES5ArrayPrototype,
'Function.prototype': ES5FunctionPrototype,
'String.prototype': ES5StringPrototype,
Object: ES5Object,
Array: ES5Array,
Date: ES5Date
};
var es6Polyfills = {
Object: ES6Object,
'Array.prototype': ES6ArrayPrototype,
'Date.prototype': ES6DatePrototype,
Number: ES6Number,
Array: ES6Array
};
var es7Polyfills = {
Object: ES7Object,
'String.prototype': ES7StringPrototype,
'Array.prototype': ES7ArrayPrototype
};
function setupMethodsCache(polyfills) {
for (var pName in polyfills) {
if (!Object.prototype.hasOwnProperty.call(polyfills, pName)) {
continue;
}
var polyfillObject = polyfills[pName];
var accessor = pName.split('.');
if (accessor.length === 2) {
var
obj = accessor[0],
prop = accessor[1];
if (!obj || !prop || !window[obj] || !window[obj][prop]) {
var windowObj = obj ? window[obj] : '-';
var windowObjProp =
obj && window[obj] && prop ? window[obj][prop] : '-';
throw new Error(
'Unexpected state (t11975770): ' + (
obj + ", " + prop + ", " + windowObj + ", " + windowObjProp + ", " + pName));
}
}
var nativeObject =
accessor.length === 2 ? window[accessor[0]][accessor[1]] : window[pName];
for (var _prop in polyfillObject) {
if (!Object.prototype.hasOwnProperty.call(polyfillObject, _prop)) {
continue;
}
if (typeof polyfillObject[_prop] !== 'function') {
methodCache[pName + '.' + _prop] = polyfillObject[_prop];
continue;
}
var nativeFunction = nativeObject[_prop];
methodCache[pName + '.' + _prop] =
nativeFunction && /\{\s+\[native code\]\s\}/.test(nativeFunction) ?
nativeFunction :
polyfillObject[_prop];
}
}
}
setupMethodsCache(es5Polyfills);
setupMethodsCache(es6Polyfills);
setupMethodsCache(es7Polyfills);
function ES(lhs, rhs, proto) {
var type = proto ? toString.call(lhs).slice(8, -1) + '.prototype' : lhs;
var propValue = methodCache[type + '.' + rhs] || lhs[rhs];
if (typeof propValue === 'function') {
for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
args[_key - 3] = arguments[_key];
}
return propValue.apply(lhs, args);
} else if (propValue) {
return propValue;
}
throw new Error("Polyfill " + type + " does not have implementation of " + rhs);
}
module.exports = ES;
}), null);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @format
*/
__d("sdk.babelHelpers", ["ES5FunctionPrototype", "ES5Object", "ES6Object"], (function $module_sdk_babelHelpers(global, require, requireDynamic, requireLazy, module, exports, ES5FunctionPrototype, ES5Object, ES6Object) {
var babelHelpers = {};
var hasOwn = Object.prototype.hasOwnProperty;
babelHelpers.inherits = function (subClass, superClass) {
ES6Object.assign(subClass, superClass);
subClass.prototype = ES5Object.create(superClass && superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__superConstructor__ = superClass;
return superClass;
};
babelHelpers._extends = ES6Object.assign;
babelHelpers["extends"] = babelHelpers._extends;
babelHelpers.objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (!hasOwn.call(obj, i) || keys.indexOf(i) >= 0) {
continue;
}
target[i] = obj[i];
}
return target;
};
babelHelpers.taggedTemplateLiteralLoose = function (strings, raw) {
strings.raw = raw;
return strings;
};
babelHelpers.bind = ES5FunctionPrototype.bind;
module.exports = babelHelpers;
}), null);
var ES = require('ES');
var babelHelpers = require('sdk.babelHelpers');
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @provides iterator.enumerate
* @requires Array
* Object.enumFix
* Object
* Object.es6
* @polyfill
*
*/
(function (global, undefined) {
var KIND_KEYS = 'keys';
var KIND_VALUES = 'values';
var KIND_ENTRIES = 'entries';
var ArrayIterators = function () {
var hasNative = hasNativeIterator(Array);
var ArrayIterator;
if (!hasNative) {
ArrayIterator = function () {
function ArrayIterator(array, kind) {
"use strict";
this.$ArrayIterator_iteratedObject = array;
this.$ArrayIterator_kind = kind;
this.$ArrayIterator_nextIndex = 0;
}
ArrayIterator.prototype.
next = function () {
"use strict";
if (this.$ArrayIterator_iteratedObject == null) {
return {
value: undefined,
done: true
};
}
var array = this.$ArrayIterator_iteratedObject;
var len = this.$ArrayIterator_iteratedObject.length;
var index = this.$ArrayIterator_nextIndex;
var kind = this.$ArrayIterator_kind;
if (index >= len) {
this.$ArrayIterator_iteratedObject = undefined;
return {
value: undefined,
done: true
};
}
this.$ArrayIterator_nextIndex = index + 1;
if (kind === KIND_KEYS) {
return {
value: index,
done: false
};
} else if (kind === KIND_VALUES) {
return {
value: array[index],
done: false
};
} else if (kind === KIND_ENTRIES) {
return {
value: [index, array[index]],
done: false
};
}
};
ArrayIterator.prototype[typeof Symbol === "function" ?
Symbol.iterator : "@@iterator"] = function () {
"use strict";
return this;
};
return ArrayIterator;
}
();
}
return {
keys: hasNative ?
function (array) {
return array.keys();
}
:
function (array) {
return new ArrayIterator(array, KIND_KEYS);
},
values: hasNative ?
function (array) {
return array.values();
}
:
function (array) {
return new ArrayIterator(array, KIND_VALUES);
},
entries: hasNative ?
function (array) {
return array.entries();
}
:
function (array) {
return new ArrayIterator(array, KIND_ENTRIES);
}
};
}
();
var StringIterators = function () {
var hasNative = hasNativeIterator(String);
var StringIterator;
if (!hasNative) {
StringIterator = function () {
function StringIterator(string) {
"use strict";
this.$StringIterator_iteratedString = string;
this.$StringIterator_nextIndex = 0;
}
StringIterator.prototype.
next = function () {
"use strict";
if (this.$StringIterator_iteratedString == null) {
return {
value: undefined,
done: true
};
}
var index = this.$StringIterator_nextIndex;
var s = this.$StringIterator_iteratedString;
var len = s.length;
if (index >= len) {
this.$StringIterator_iteratedString = undefined;
return {
value: undefined,
done: true
};
}
var ret;
var first = s.charCodeAt(index);
if (first < 0xD800 || first > 0xDBFF || index + 1 === len) {
ret = s[index];
} else {
var second = s.charCodeAt(index + 1);
if (second < 0xDC00 || second > 0xDFFF) {
ret = s[index];
} else {
ret = s[index] + s[index + 1];
}
}
this.$StringIterator_nextIndex = index + ret.length;
return {
value: ret,
done: false
};
};
StringIterator.prototype[typeof Symbol === "function" ?
Symbol.iterator : "@@iterator"] = function () {
"use strict";
return this;
};
return StringIterator;
}
();
}
return {
keys: function keys() {
throw TypeError("Strings default iterator doesn't implement keys.");
},
values: hasNative ?
function (string) {
return string[typeof Symbol === "function" ? Symbol.iterator : "@@iterator"]();
}
:
function (string) {
return new StringIterator(string);
},
entries: function entries() {
throw TypeError("Strings default iterator doesn't implement entries.");
}
};
}
();
function hasNativeIterator(classObject) {
return typeof classObject.prototype[typeof Symbol === "function" ? Symbol.iterator : "@@iterator"] === 'function' &&
typeof classObject.prototype.values === 'function' &&
typeof classObject.prototype.keys === 'function' &&
typeof classObject.prototype.entries === 'function';
}
function ObjectIterator(object, kind) {
"use strict";
this.$ObjectIterator_iteratedObject = object;
this.$ObjectIterator_kind = kind;
this.$ObjectIterator_keys = ES("Object", "keys", false, object);
this.$ObjectIterator_nextIndex = 0;
}
ObjectIterator.prototype.
next = function () {
"use strict";
var len = this.$ObjectIterator_keys.length;
var index = this.$ObjectIterator_nextIndex;
var kind = this.$ObjectIterator_kind;
var key = this.$ObjectIterator_keys[index];
if (index >= len) {
this.$ObjectIterator_iteratedObject = undefined;
return {
value: undefined,
done: true
};
}
this.$ObjectIterator_nextIndex = index + 1;
if (kind === KIND_KEYS) {
return {
value: key,
done: false
};
} else if (kind === KIND_VALUES) {
return {
value: this.$ObjectIterator_iteratedObject[key],
done: false
};
} else if (kind === KIND_ENTRIES) {
return {
value: [key, this.$ObjectIterator_iteratedObject[key]],
done: false
};
}
};
ObjectIterator.prototype[typeof Symbol === "function" ?
Symbol.iterator : "@@iterator"] = function () {
"use strict";
return this;
};
var GenericIterators = {
keys: function keys(object) {
return new ObjectIterator(object, KIND_KEYS);
},
values: function values(object) {
return new ObjectIterator(object, KIND_VALUES);
},
entries: function entries(object) {
return new ObjectIterator(object, KIND_ENTRIES);
}
};
function enumerate(object, kind) {
if (typeof object === 'string') {
return StringIterators[kind || KIND_VALUES](object);
} else if (ES("Array", "isArray", false, object)) {
return ArrayIterators[kind || KIND_VALUES](object);
} else if (object[typeof Symbol === "function" ? Symbol.iterator : "@@iterator"]) {
return object[typeof Symbol === "function" ? Symbol.iterator : "@@iterator"]();
} else {
return GenericIterators[kind || KIND_ENTRIES](object);
}
}
ES("Object", "assign", false, enumerate, {
KIND_KEYS: KIND_KEYS,
KIND_VALUES: KIND_VALUES,
KIND_ENTRIES: KIND_ENTRIES,
keys: function keys(object) {
return enumerate(object, KIND_KEYS);
},
values: function values(object) {
return enumerate(object, KIND_VALUES);
},
entries: function entries(object) {
return enumerate(object, KIND_ENTRIES);
},
generic: GenericIterators.entries
});
global.FB_enumerate = enumerate;
})(typeof global === 'undefined' ? this : global);
/**
* Copyright 2013-2014 Facebook, Inc.
* @provides Collections.es6
* @polyfill old ie8 webkit modern
* @preventMunge
* @requires iterator.enumerate
* @requires TypeChecker
* @requires GenericFunctionVisitor
*/
(function (global, undefined) {
var windowObj = global.window || global;
function guid() {
return 'f' + (Math.random() * (1 << 30)).toString(16).replace('.', '');
}
function isNode(object) {
var doc = object ? object.ownerDocument || object : document;
var defaultView = doc.defaultView || windowObj;
return !!(object && (
typeof defaultView.Node === 'function' ? object instanceof defaultView.Node :
typeof object === 'object' &&
typeof object.nodeType === 'number' &&
typeof object.nodeName === 'string'));
}
function shouldPolyfillES6Collection(collectionName) {
var Collection = windowObj[collectionName];
if (Collection == null) {
return true;
}
if (typeof windowObj.Symbol !== 'function') {
return true;
}
var proto = Collection.prototype;
return Collection == null ||
typeof Collection !== 'function' ||
typeof proto.clear !== 'function' ||
new Collection().size !== 0 ||
typeof proto.keys !== 'function' ||
typeof proto['for' + 'Each'] !== 'function';
}
var enumerate = global.FB_enumerate;
var Map = function () {
if (!shouldPolyfillES6Collection('Map')) {
return windowObj.Map;
}
var KIND_KEY = 'key';
var KIND_VALUE = 'value';
var KIND_KEY_VALUE = 'key+value';
var KEY_PREFIX = '$map_';
var SECRET_SIZE_PROP;
if (__DEV__) {
SECRET_SIZE_PROP = '$size' + guid();
}
var OLD_IE_HASH_PREFIX = 'IE_HASH_';
function Map(iterable) {
"use strict";
if (!isObject(this)) {
throw new TypeError('Wrong map object type.');
}
initMap(this);
if (iterable != null) {
var it = enumerate(iterable);
var next;
while (!(next = it.next()).done) {
if (!isObject(next.value)) {
throw new TypeError('Expected iterable items to be pair objects.');
}
this.set(next.value[0], next.value[1]);
}
}
}
Map.prototype.
clear = function () {
"use strict";
initMap(this);
};
Map.prototype.
has = function (key) {
"use strict";
var index = getIndex(this, key);
return !!(index != null && this._mapData[index]);
};
Map.prototype.
set = function (key, value) {
"use strict";
var index = getIndex(this, key);
if (index != null && this._mapData[index]) {
this._mapData[index][1] = value;
} else {
index = this._mapData.push([
key,
value]) -
1;
setIndex(this, key, index);
if (__DEV__) {
this[SECRET_SIZE_PROP] += 1;
} else {
this.size += 1;
}
}
return this;
};
Map.prototype.
get = function (key) {
"use strict";
var index = getIndex(this, key);
if (index == null) {
return undefined;
} else {
return this._mapData[index][1];
}
};
Map.prototype["delete"] =
function (key) {
"use strict";
var index = getIndex(this, key);
if (index != null && this._mapData[index]) {
setIndex(this, key, undefined);
this._mapData[index] = undefined;
if (__DEV__) {
this[SECRET_SIZE_PROP] -= 1;
} else {
this.size -= 1;
}
return true;
} else {
return false;
}
};
Map.prototype.
entries = function () {
"use strict";
return new MapIterator(this, KIND_KEY_VALUE);
};
Map.prototype.
keys = function () {
"use strict";
return new MapIterator(this, KIND_KEY);
};
Map.prototype.
values = function () {
"use strict";
return new MapIterator(this, KIND_VALUE);
};
Map.prototype.
forEach = function (callback, thisArg) {
"use strict";
if (typeof callback !== 'function') {
throw new TypeError('Callback must be callable.');
}
var boundCallback = ES(callback, "bind", true, thisArg || undefined);
var mapData = this._mapData;
for (var i = 0; i < mapData.length; i++) {
var entry = mapData[i];
if (entry != null) {
boundCallback(entry[1], entry[0], this);
}
}
};
Map.prototype[typeof Symbol === "function" ?
Symbol.iterator : "@@iterator"] = function () {
"use strict";
return this.entries();
};
function MapIterator(map, kind) {
"use strict";
if (!(isObject(map) && map._mapData)) {
throw new TypeError('Object is not a map.');
}
if (ES([KIND_KEY, KIND_KEY_VALUE, KIND_VALUE], "indexOf", true, kind) === -1) {
throw new Error('Invalid iteration kind.');
}
this._map = map;
this._nextIndex = 0;
this._kind = kind;
}
MapIterator.prototype.
next = function () {
"use strict";
if (!this instanceof Map) {
throw new TypeError('Expected to be called on a MapIterator.');
}
var map = this._map;
var index = this._nextIndex;
var kind = this._kind;
if (map == null) {
return createIterResultObject(undefined, true);
}
var entries = map._mapData;
while (index < entries.length) {
var record = entries[index];
index += 1;
this._nextIndex = index;
if (record) {
if (kind === KIND_KEY) {
return createIterResultObject(record[0], false);
} else if (kind === KIND_VALUE) {
return createIterResultObject(record[1], false);
} else if (kind) {
return createIterResultObject(record, false);
}
}
}
this._map = undefined;
return createIterResultObject(undefined, true);
};
MapIterator.prototype[typeof Symbol === "function" ?
Symbol.iterator : "@@iterator"] = function () {
"use strict";
return this;
};
function getIndex(map, key) {
if (isObject(key)) {
var hash = getHash(key);
return hash ? map._objectIndex[hash] : undefined;
} else {
var prefixedKey = KEY_PREFIX + key;
if (typeof key === 'string') {
return map._stringIndex[prefixedKey];
} else {
return map._otherIndex[prefixedKey];
}
}
}
function setIndex(map, key, index) {
var shouldDelete = index == null;
if (isObject(key)) {
var hash = getHash(key);
if (!hash) {
hash = createHash(key);
}
if (shouldDelete) {
delete map._objectIndex[hash];
} else {
map._objectIndex[hash] = index;
}
} else {
var prefixedKey = KEY_PREFIX + key;
if (typeof key === 'string') {
if (shouldDelete) {
delete map._stringIndex[prefixedKey];
} else {
map._stringIndex[prefixedKey] = index;
}
} else if (shouldDelete) {
delete map._otherIndex[prefixedKey];
} else {
map._otherIndex[prefixedKey] = index;
}
}
}
function initMap(map) {
map._mapData = [];
map._objectIndex = {};
map._stringIndex = {};
map._otherIndex = {};
if (__DEV__) {
if (Map.__isES5) {
if (Object.prototype.hasOwnProperty.call(map, SECRET_SIZE_PROP)) {
map[SECRET_SIZE_PROP] = 0;
} else {
Object.defineProperty(map, SECRET_SIZE_PROP, {
value: 0,
writable: true
});
Object.defineProperty(map, 'size', {
set: function set(v) {
console.error(
'PLEASE FIX ME: You are changing the map size property which ' +
'should not be writable and will break in production.');
throw new Error('The map size property is not writable.');
},
get: function get() {
return map[SECRET_SIZE_PROP];
}
});
}
return;
}
}
map.size = 0;
}
function isObject(o) {
return o != null && (typeof o === 'object' || typeof o === 'function');
}
function createIterResultObject(value, done) {
return {
value: value,
done: done
};
}
Map.__isES5 = function () {
try {
Object.defineProperty({}, '__.$#x', {});
return true;
} catch (e) {
return false;
}
}
();
function isExtensible(o) {
if (!Map.__isES5 || !Object.isExtensible) {
return true;
} else {
return Object.isExtensible(o);
}
}
function getIENodeHash(node) {
var uniqueID;
switch (node.nodeType) {
case 1:
uniqueID = node.uniqueID;
break;
case 9:
uniqueID = node.documentElement.uniqueID;
break;
default:
return null;
}
if (uniqueID) {
return OLD_IE_HASH_PREFIX + uniqueID;
} else {
return null;
}
}
var hashProperty = guid();
function getHash(o) {
if (o[hashProperty]) {
return o[hashProperty];
} else if (!Map.__isES5 &&
o.propertyIsEnumerable &&
o.propertyIsEnumerable[hashProperty]) {
return o.propertyIsEnumerable[hashProperty];
} else if (!Map.__isES5 &&
isNode(o) &&
getIENodeHash(o)) {
return getIENodeHash(o);
} else if (!Map.__isES5 && o[hashProperty]) {
return o[hashProperty];
}
}
var createHash = function () {
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
var hashCounter = 0;
return function createHash(o) {
if (isExtensible(o)) {
hashCounter += 1;
if (Map.__isES5) {
Object.defineProperty(o, hashProperty, {
enumerable: false,
writable: false,
configurable: false,
value: hashCounter
});
} else if (o.propertyIsEnumerable) {
o.propertyIsEnumerable = function () {
return propIsEnumerable.apply(this, arguments);
};
o.propertyIsEnumerable[hashProperty] = hashCounter;
} else if (isNode(o)) {
o[hashProperty] = hashCounter;
} else {
throw new Error('Unable to set a non-enumerable property on object.');
}
return hashCounter;
} else {
throw new Error('Non-extensible objects are not allowed as keys.');
}
};
}
();
return __annotator(Map, {
name: 'Map'
});
}
();
var Set = function () {
if (!shouldPolyfillES6Collection('Set')) {
return windowObj.Set;
}
function Set(iterable) {
"use strict";
if (this == null ||
typeof this !== 'object' && typeof this !== 'function') {
throw new TypeError('Wrong set object type.');
}
initSet(this);
if (iterable != null) {
var it = enumerate(iterable);
var next;
while (!(next = it.next()).done) {
this.add(next.value);
}
}
}
Set.prototype.
add = function (value) {
"use strict";
this._map.set(value, value);
this.size = this._map.size;
return this;
};
Set.prototype.
clear = function () {
"use strict";
initSet(this);
};
Set.prototype["delete"] =
function (value) {
"use strict";
var ret = this._map["delete"](value);
this.size = this._map.size;
return ret;
};
Set.prototype.
entries = function () {
"use strict";
return this._map.entries();
};
Set.prototype.
forEach = function (callback) {
"use strict";
var thisArg = arguments[1];
var it = this._map.keys();
var next;
while (!(next = it.next()).done) {
callback.call(thisArg, next.value, next.value, this);
}
};
Set.prototype.
has = function (value) {
"use strict";
return this._map.has(value);
};
Set.prototype.
values = function () {
"use strict";
return this._map.values();
};
Set.prototype.
keys = function () {
"use strict";
return this.values();
};
Set.prototype[typeof Symbol === "function" ?
Symbol.iterator : "@@iterator"] = function () {
"use strict";
return this.values();
};
function initSet(set) {
set._map = new Map();
set.size = set._map.size;
}
return __annotator(Set, {
name: 'Set'
});
}
();
global.Map = Map;
global.Set = Set;
})(typeof global === 'undefined' ? this : global);
__d("UrlMapConfig", [], {
"www": "www.facebook.com",
"m": "m.facebook.com",
"connect": "connect.facebook.net",
"business": "business.facebook.com",
"api": "api.facebook.com",
"api_read": "api-read.facebook.com",
"graph": "graph.facebook.com",
"an": "an.facebook.com",
"fbcdn": "static.xx.fbcdn.net",
"cdn": "staticxx.facebook.com"
});
__d("JSSDKRuntimeConfig", [], {
"locale": "en_US",
"revision": "4409275",
"rtl": false,
"sdkab": null,
"sdkns": "MessengerExtensions",
"sdkurl": "https:\/\/connect.facebook.net\/en_US\/messenger.Extensions\/debug.js"
});
__d("BrowserExtensionsConfig", [], {
"payment_request_validator_disabled": ["1543781662564215"],
"meta_tag_init_enabled": true,
"meta_tag_init_app_ids": ["578236995688977"]
});
__d("ManagedError", [], function $module_ManagedError(global, require, requireDynamic, requireLazy, module, exports) {
var _Error,
_superProto;
_Error = babelHelpers.inherits(
ManagedError, Error);
_superProto = _Error && _Error.prototype;
function ManagedError(message, innerError) {
"use strict";
_superProto.constructor.call(this, message !== null && message !== undefined ? message : '');
if (message !== null && message !== undefined) {
this.message = message;
} else {
this.message = '';
}
this.innerError = innerError;
}
module.exports = ManagedError;
}, null);
__d("errorCode", [], function $module_errorCode(global, require, requireDynamic, requireLazy, module, exports) {
'use strict';
function errorCode(name) {
throw new Error(
'errorCode' + '("' + name + '"): This should not happen. Oh noes!');
}
module.exports = errorCode;
}, null);
__d("guid", [], (function $module_guid(global, require, requireDynamic, requireLazy, module, exports) {
function guid() {
return 'f' + (Math.random() * (1 << 30)).toString(16).replace('.', '');
}
module.exports = guid;
}), null);
__d("sdk.UA", [], function $module_sdk_UA(global, require, requireDynamic, requireLazy, module, exports) {
var uas = navigator.userAgent;
var devices = {
iphone: /\b(iPhone|iP[ao]d)/.test(uas),
ipad: /\b(iP[ao]d)/.test(uas),
android: /Android/i.test(uas),
nativeApp: /FBAN\/\w+;/i.test(uas),
nativeAndroidApp: /FB_IAB\/\w+;/i.test(uas),
nativeInstagramApp: /Instagram/i.test(uas),
nativeMessengeriOSApp: /MessengerForiOS/i.test(uas),
nativeMessengerAndroidApp: /Orca\-Android/i.test(uas),
ucBrowser: /UCBrowser/i.test(uas)
};
var mobile = /Mobile/i.test(uas);
var versions = {
ie: NaN,
firefox: NaN,
chrome: NaN,
webkit: NaN,
osx: NaN,
edge: NaN,
operaMini: NaN,
ucWeb: NaN
};
var agent = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(
uas);
if (agent) {
versions.ie = agent[1] ?
parseFloat(agent[1]) :
agent[4] ?
parseFloat(agent[4]) :
NaN;
versions.firefox = agent[2] || '';
versions.webkit = agent[3] || '';
if (agent[3]) {
var chromeAgent = /(?:Chrome\/(\d+\.\d+))/.exec(uas);
versions.chrome = chromeAgent ? chromeAgent[1] : '';
var edgeAgent = /(?:Edge\/(\d+\.\d+))/.exec(uas);
versions.edge = edgeAgent ? edgeAgent[1] : '';
}
}
var mac = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(uas);
if (mac) {
versions.osx = mac[1];
}
var operaMini = /(?:Opera Mini\/(\d+(?:\.\d+)?))/.exec(uas);
if (operaMini) {
versions.operaMini = operaMini[1];
}
var ucWeb = /(?:UCWEB\/(\d+(?:\.\d+))?)/.exec(uas);
if (ucWeb) {
versions.ucWeb = ucWeb[1] || '2.0';
}
function getVersionParts(version) {
return ES(String(version).
split('.'), "map", true,
function (v) {
return parseFloat(v);
});
}
var UA = {};
ES(ES("Object", "keys", false, versions), "map", true, function (key) {
UA[key] = function () {
return parseFloat(versions[key]);
};
UA[key].getVersionParts = function () {
return getVersionParts(versions[key]);
};
});
ES(ES("Object", "keys", false, devices), "map", true, function (key) {
UA[key] = function () {
return devices[key];
};
});
UA.mobile = function () {
return devices.iphone || devices.ipad || devices.android || mobile;
};
UA.mTouch = function () {
return devices.android || devices.iphone || devices.ipad;
};
UA.facebookInAppBrowser = function () {
return devices.nativeApp || devices.nativeAndroidApp;
};
UA.inAppBrowser = function () {
return (
devices.nativeApp || devices.nativeAndroidApp || devices.nativeInstagramApp);
};
UA.mBasic = function () {
return !!(versions.ucWeb || versions.operaMini);
};
UA.instagram = function () {
return devices.nativeInstagramApp;
};
UA.messenger = function () {
return (
devices.nativeMessengeriOSApp || devices.nativeMessengerAndroidApp);
};
module.exports = UA;
}, null);
__d("normalizeError", ["sdk.UA"], function $module_normalizeError(global, require, requireDynamic, requireLazy, module, exports, UA) {
'use strict';
var normalizeError = function normalizeError(err) {
var info = {
line: err.lineNumber || err.line,
message: err.message,
name: err.name,
script: err.fileName || err.sourceURL || err.script,
stack: err.stackTrace || err.stack
};
info._originalError = err;
var matches = /([\w:\.\/]+\.js):(\d+)/.exec(err.stack);
if (UA.chrome() && matches) {
info.script = matches[1];
info.line = parseInt(matches[2], 10);
}
for (var k in info) {
info[k] == null && delete info[k];
}
return info;
};
module.exports = normalizeError;
}, null);
__d("QueryString", [], function $module_QueryString(global, require, requireDynamic, requireLazy, module, exports) {
function encode(bag) {
var pairs = [];
ES(ES("Object", "keys", false, bag).
sort(), "forEach", true,
function (key) {
var value = bag[key];
if (value === undefined) {
return;
}
if (value === null) {
pairs.push(key);
return;
}
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
});
return pairs.join('&');
}
function decode(str, strict) {
if (strict === void 0) {
strict = false;
}
var data = {};
if (str === '') {
return data;
}
var pairs = str.split('&');
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split('=', 2);
var key = decodeURIComponent(pair[0]);
if (strict && Object.prototype.hasOwnProperty.call(data, key)) {
throw new URIError('Duplicate key: ' + key);
}
data[key] = pair.length === 2 ? decodeURIComponent(pair[1]) : null;
}
return data;
}
function appendToUrl(url, params) {
return (
url + (
ES(url, "indexOf", true, '?') !== -1 ? '&' : '?') + (
typeof params === 'string' ? params : QueryString.encode(params)));
}
var QueryString = {
encode: encode,
decode: decode,
appendToUrl: appendToUrl
};
module.exports = QueryString;
}, null);
__d("Env", [], function $module_Env(global, require, requireDynamic, requireLazy, module, exports) {
var Env = {
start: ES("Date", "now", false),
nocatch: false,
ajaxpipe_token: null
};
if (global.Env) {
ES("Object", "assign", false, Env, global.Env);
}
global.Env = Env;
module.exports = Env;
}, null);
__d("javascript_shared_TAAL_OpCode", [], function $module_javascript_shared_TAAL_OpCode(global, require, requireDynamic, requireLazy, module, exports) {
module.exports = ES("Object", "freeze", false, {
PREVIOUS_FILE: 1,
PREVIOUS_FRAME: 2,
PREVIOUS_DIR: 3,
FORCED_KEY: 4
});
}, null);
__d("TAALOpcodes", ["javascript_shared_TAAL_OpCode"], (function $module_TAALOpcodes(global, require, requireDynamic, requireLazy, module, exports, javascript_TAAL_OpCode) {
'use strict';
var TAALOpcodes = {
previousFile: function previousFile() {
return javascript_TAAL_OpCode.PREVIOUS_FILE;
},
previousFrame: function previousFrame() {
return javascript_TAAL_OpCode.PREVIOUS_FRAME;
},
previousDirectory: function previousDirectory() {
return javascript_TAAL_OpCode.PREVIOUS_DIR;
},
getString: function getString(opcodes) {
return opcodes && opcodes.length ? " TAAL[" + opcodes.join(';') + "]" : '';
}
};
module.exports = TAALOpcodes;
}), null);
__d("TAAL", ["TAALOpcodes"], function $module_TAAL(global, require, requireDynamic, requireLazy, module, exports, TAALOpcodes) {
'use strict';
var TAAL = {
blameToPreviousFile: function blameToPreviousFile(message) {
return this.applyOpcodes(message, [TAALOpcodes.previousFile()]);
},
blameToPreviousFrame: function blameToPreviousFrame(message) {
return this.applyOpcodes(message, [TAALOpcodes.previousFrame()]);
},
blameToPreviousDirectory: function blameToPreviousDirectory(message) {
return this.applyOpcodes(message, [TAALOpcodes.previousDirectory()]);
},
applyOpcodes: function applyOpcodes(
message,
opcodes) {
return message + TAALOpcodes.getString(opcodes);
}
};
module.exports = TAAL;
}, null);
__d("eprintf", [], function $module_eprintf(global, require, requireDynamic, requireLazy, module, exports) {
'use strict';
function eprintf(errorMessage) {
for (var _len = arguments.length, rawArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
rawArgs[_key - 1] = arguments[_key];
}
var args = ES(rawArgs, "map", true, function (arg) {
return String(arg);
});
var expectedLength = errorMessage.split('%s').length - 1;
if (expectedLength !== args.length) {
return eprintf(
'eprintf args number mismatch: %s', ES("JSON", "stringify", false,
[errorMessage].concat(args)));
}
var index = 0;
return errorMessage.replace(/%s/g, function () {
return String(args[index++]);
});
}
module.exports = eprintf;
}, null);
__d("ex", ["eprintf"], function $module_ex(global, require, requireDynamic, requireLazy, module, exports, eprintf) {
function ex(format) {
for (var _len = arguments.length, rawArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
rawArgs[_key - 1] = arguments[_key];
}
var args = ES(rawArgs, "map", true, function (arg) {
return String(arg);
});
var expectedLength = format.split('%s').length - 1;
if (expectedLength !== args.length) {
return ex('ex args number mismatch: %s', ES("JSON", "stringify", false, [format].concat(args)));
}
if (__DEV__) {
return eprintf.call.apply(eprintf, [null, format].concat(args));
} else {
return ex._prefix + ES("JSON", "stringify", false, [format].concat(args)) + ex._suffix;
}
}
ex._prefix = '<![EX[';
ex._suffix = ']]>';
module.exports = ex;
}, null);
__d("sprintf", [], (function $module_sprintf(global, require, requireDynamic, requireLazy, module, exports) {
function sprintf(format) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var index = 0;
return format.replace(/%s/g, function () {
return String(args[index++]);
});
}
module.exports = sprintf;
}), null);
__d("invariant", ["Env", "TAAL", "ex", "sprintf"], function $module_invariant(global, require, requireDynamic, requireLazy, module, exports, Env, TAAL, ex, sprintf) {
'use strict';
var printingFunction = ex;
if (__DEV__) {
printingFunction = sprintf;
}
function invariant(
condition,
format) {
if (!condition) {
var formatString = format;
for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
params[_key - 2] = arguments[_key];
}
if (typeof formatString === 'number') {
var _buildProdMessage =
buildProdMessage(formatString, params),
message = _buildProdMessage.message,
decoderLink = _buildProdMessage.decoderLink;
formatString = message;
params.unshift(decoderLink);
} else if (formatString === undefined) {
formatString = 'Invariant: ';
for (var i = 0; i < params.length; i++) {
formatString += '%s,';
}
}
formatString = TAAL.blameToPreviousFrame(formatString);
var error = new Error(printingFunction.apply(undefined, [formatString].concat(params)));
error.name = 'Invariant Violation';
error.messageWithParams = [formatString].concat(params);
throw error;
}
}
function buildProdMessage(
number,
params) {
var message = "Minified invariant #" + number + "; %s";
if (params.length > 0) {
message += ' Params: ' + ES(params, "map", true, function (_) {
return '%s';
}).join(', ');
}
var decoderLink =
Env.show_invariant_decoder === true ? "visit " +
buildDecoderLink(number, params) + " to see the full message." :
'';
return {
message: message,
decoderLink: decoderLink
};
}
function buildDecoderLink(number, params) {
var decodeURI = "https://our.intern.facebook.com/intern/invariant/" + number + "/";
if (params.length > 0) {
decodeURI +=
'?' +
ES(params, "map", true,
function (param, index) {
return "args[" +
index + "]=" + encodeURIComponent(String(param));
}).
join('&');
}
return decodeURI;
}
module.exports = invariant;
}, null);
__d("UrlMap", ["UrlMapConfig", "invariant"], function $module_UrlMap(global, require, requireDynamic, requireLazy, module, exports, UrlMapConfig, invariant) {
var UrlMap = {
resolve: function resolve(key) {
var protocol = 'https';
if (key in UrlMapConfig) {
return protocol + '://' + UrlMapConfig[key];
}
key in UrlMapConfig || invariant(0, 'Unknown key in UrlMapConfig: %s', key);
return '';
}
};
module.exports = UrlMap;
}, null);
__d("ObservableMixin", [], function $module_ObservableMixin(global, require, requireDynamic, requireLazy, module, exports) {
function ObservableMixin() {
this.__observableEvents = {};
}
ObservableMixin.prototype = {
inform: function inform(what) {
var args = Array.prototype.slice.call(arguments, 1);
var list = Array.prototype.slice.call(this.getSubscribers(what));
for (var i = 0; i < list.length; i++) {
if (list[i] === null)
continue;
if (__DEV__) {
list[i].apply(this, args);
} else {
try {
list[i].apply(this, args);
} catch (e) {
setTimeout(function () {
throw e;
}, 0);
}
}
}
return this;
},
getSubscribers: function getSubscribers(toWhat) {
return (
this.__observableEvents[toWhat] || (this.__observableEvents[toWhat] = []));
},
clearSubscribers: function clearSubscribers(toWhat) {
if (toWhat) {
this.__observableEvents[toWhat] = [];
}
return this;
},
clearAllSubscribers: function clearAllSubscribers() {
this.__observableEvents = {};
return this;
},
subscribe: function subscribe(toWhat, withWhat) {
var list = this.getSubscribers(toWhat);
list.push(withWhat);
return this;
},
unsubscribe: function unsubscribe(toWhat, withWhat) {
var list = this.getSubscribers(toWhat);
for (var i = 0; i < list.length; i++) {
if (list[i] === withWhat) {
list.splice(i, 1);
break;
}
}
return this;
},
monitor: function monitor(toWhat, withWhat) {
if (!withWhat()) {
var monitor = ES(function (value) {
if (withWhat.apply(withWhat, arguments)) {
this.unsubscribe(toWhat, monitor);
}
}, "bind", true, this);
this.subscribe(toWhat, monitor);
}
return this;
}
};
module.exports = ObservableMixin;
}, null);
__d("AssertionError", ["ManagedError"], function $module_AssertionError(global, require, requireDynamic, requireLazy, module, exports, ManagedError) {
function AssertionError(message) {
ManagedError.prototype.constructor.apply(this, arguments);
}
AssertionError.prototype = new ManagedError();
AssertionError.prototype.constructor = AssertionError;
module.exports = AssertionError;
}, null);
__d("Assert", ["AssertionError", "sprintf"], function $module_Assert(global, require, requireDynamic, requireLazy, module, exports, AssertionError, sprintf) {
function assert(expression, message) {
if (typeof expression !== 'boolean' || !expression) {
throw new AssertionError(message);
}
return expression;
}
function assertType(type, expression, message) {
var actualType;
if (expression === undefined) {
actualType = 'undefined';
} else if (expression === null) {
actualType = 'null';
} else {
var className = Object.prototype.toString.call(expression);
actualType = /\s(\w*)/.exec(className)[1].toLowerCase();
}
assert(
ES(type, "indexOf", true, actualType) !== -1,
message || sprintf('Expression is of type %s, not %s', actualType, type));
return expression;
}
function assertInstanceOf(type, expression, message) {
assert(
expression instanceof type,
message || 'Expression not instance of type');
return expression;
}
function _define(type, test) {
Assert['is' + type] = test;
Assert['maybe' + type] = function (expression, message) {
if (expression != null) {
test(expression, message);
}
};
}
var Assert = {
isInstanceOf: assertInstanceOf,
isTrue: assert,
isTruthy: function isTruthy(expression, message) {
return assert(!!expression, message);
},
type: assertType,
define: function define(type, fn) {
type = type.substring(0, 1).toUpperCase() + type.substring(1).toLowerCase();
_define(type, function (expression, message) {
assert(fn(expression), message);
});
}
};
ES([
'Array',
'Boolean',
'Date',
'Function',
'Null',
'Number',
'Object',
'Regexp',
'String',
'Undefined'], "forEach", true,
function (type) {
_define(type, ES(assertType, "bind", true, null, type.toLowerCase()));
});
module.exports = Assert;
}, null);
__d("Type", ["Assert"], function $module_Type(global, require, requireDynamic, requireLazy, module, exports, Assert) {
function Type() {
var mixins = this.__mixins;
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixins[i].apply(this, arguments);
}
}
}
function _instanceOf(constructor, which) {
if (which instanceof constructor) {
return true;
}
if (which instanceof Type) {
for (var i = 0; i < which.__mixins.length; i++) {
if (which.__mixins[i] == constructor) {
return true;
}
}
}
return false;
}
function mixin(to, from) {
var prototype = to.prototype;
if (!ES("Array", "isArray", false, from)) {
from = [from];
}
for (var i = 0; i < from.length; i++) {
var mixinFrom = from[i];
if (typeof mixinFrom === 'function') {
prototype.__mixins.push(mixinFrom);
mixinFrom = mixinFrom.prototype;
}
ES(ES("Object", "keys", false, mixinFrom), "forEach", true, function (key) {
prototype[key] = mixinFrom[key];
});
}
}
function _extend(
from,
prototype,
mixins) {
var constructor =
prototype && Object.prototype.hasOwnProperty.call(prototype, 'constructor') ?
prototype.constructor :
function () {
this.parent.apply(this, arguments);
};
Assert.isFunction(constructor);
if (from && from.prototype instanceof Type === false) {
throw new Error('parent type does not inherit from Type');
}
from = from || Type;
function F() {}
F.prototype = from.prototype;
constructor.prototype = new F();
if (prototype) {
ES("Object", "assign", false, constructor.prototype, prototype);
}
constructor.prototype.constructor = constructor;
constructor.parent = from;
constructor.prototype.__mixins = from.prototype.__mixins ?
Array.prototype.slice.call(from.prototype.__mixins) :
[];
if (mixins) {
mixin(constructor, mixins);
}
constructor.prototype.parent = function () {
this.parent = from.prototype.parent;
from.apply(this, arguments);
};
constructor.prototype.parentCall = function (method) {
return from.prototype[method].apply(
this,
Array.prototype.slice.call(arguments, 1));
};
constructor.extend = function (prototype, mixins) {
return _extend(this, prototype, mixins);
};
return constructor;
}
ES("Object", "assign", false, Type.prototype, {
instanceOf: function instanceOf(type) {
return _instanceOf(type, this);
}
});
ES("Object", "assign", false, Type, {
extend: function extend(prototype, mixins) {
return typeof prototype === 'function' ?
_extend.apply(null, arguments) :
_extend(null, prototype, mixins);
},
instanceOf: _instanceOf
});
module.exports = Type;
}, null);
__d("sdk.Model", ["ObservableMixin", "Type"], function $module_sdk_Model(global, require, requireDynamic, requireLazy, module, exports, ObservableMixin, Type) {
'use strict';
var Model = Type.extend({
constructor: function constructor(properties) {
this.parent();
var propContainer = {};
var model = this;
ES(ES("Object", "keys", false, properties), "forEach", true, function (name) {
propContainer[name] = properties[name];
model['set' + name] = function (value) {
if (value === propContainer[name]) {
return model;
}
propContainer[name] = value;
model.inform(name + '.change', value);
return model;
};
model['get' + name] = function () {
return propContainer[name];
};
});
}
},
ObservableMixin);
module.exports = Model;
}, null);
__d("sdk.Runtime", ["JSSDKRuntimeConfig", "sdk.Model"], function $module_sdk_Runtime(global, require, requireDynamic, requireLazy, module, exports, RuntimeConfig, Model) {
var ENVIRONMENTS = {
UNKNOWN: 0,
PAGETAB: 1,
CANVAS: 2,
PLATFORM: 4
};
var Runtime = new Model({
AccessToken: '',
AutoLogAppEvents: false,
ClientID: '',
CookieUserID: '',
Environment: ENVIRONMENTS.UNKNOWN,
Initialized: false,
IsVersioned: false,
KidDirectedSite: undefined,
Locale: RuntimeConfig.locale,
LoggedIntoFacebook: undefined,
LoginStatus: undefined,
Revision: RuntimeConfig.revision,
Rtl: RuntimeConfig.rtl,
Scope: undefined,
SDKAB: RuntimeConfig.sdkab,
SDKUrl: RuntimeConfig.sdkurl,
SDKNS: RuntimeConfig.sdkns,
UseCookie: false,
UseLocalStorage: true,
UserID: '',
Version: undefined
});
ES("Object", "assign", false, Runtime, {
ENVIRONMENTS: ENVIRONMENTS,
isEnvironment: function isEnvironment(target) {
var environment = this.getEnvironment();
return (target | environment) === environment;
},
isCanvasEnvironment: function isCanvasEnvironment() {
return (
this.isEnvironment(ENVIRONMENTS.CANVAS) ||
this.isEnvironment(ENVIRONMENTS.PAGETAB));
}
});
(function () {
var environment = /app_runner/.test(window.name) ?
ENVIRONMENTS.PAGETAB :
/iframe_canvas/.test(window.name) ?
ENVIRONMENTS.CANVAS :
ENVIRONMENTS.UNKNOWN;
if ((environment | ENVIRONMENTS.PAGETAB) === environment) {
environment |= ENVIRONMENTS.CANVAS;
}
Runtime.setEnvironment(environment);
})();
module.exports = Runtime;
}, null);
__d("sdk.Scribe", ["QueryString", "UrlMap", "sdk.Runtime"], function $module_sdk_Scribe(global, require, requireDynamic, requireLazy, module, exports, QueryString, UrlMap, Runtime) {
function log(category, data) {
if (typeof data.extra === 'object') {
data.extra.revision = Runtime.getRevision();
}
new Image().src = QueryString.appendToUrl(
UrlMap.resolve('www') + '/common/scribe_endpoint.php', {
c: category,
m: ES("JSON", "stringify", false, data)
});
}
var Scribe = {
log: log
};
module.exports = Scribe;
}, null);
__d("URIRFC3986", [], function $module_URIRFC3986(global, require, requireDynamic, requireLazy, module, exports) {
var PARSE_PATTERN = new RegExp(
'^' +
'([^:/?#]+:)?' +
'(//' +
'([^\\\\/?#@]*@)?' +
'(' +
'\\[[A-Fa-f0-9:.]+\\]|' +
'[^\\/?#:]*' +
')' +
'(:[0-9]*)?' +
')?' +
'([^?#]*)' +
'(\\?[^#]*)?' +
'(#.*)?');
var URIRFC3986 = {
parse: function parse(uriString) {
if (ES(uriString, "trim", true) === '') {
return null;
}
var captures = uriString.match(PARSE_PATTERN);
if (captures == null) {
return null;
}
var uri = {};
uri.uri = captures[0] ? captures[0] : null;
uri.scheme = captures[1] ?
captures[1].substr(0, captures[1].length - 1) :
null;
uri.authority = captures[2] ? captures[2].substr(2) : null;
uri.userinfo = captures[3] ?
captures[3].substr(0, captures[3].length - 1) :
null;
uri.host = captures[2] ? captures[4] : null;
uri.port = captures[5] ?
captures[5].substr(1) ?
parseInt(captures[5].substr(1), 10) :
null :
null;
uri.path = captures[6] ? captures[6] : null;
uri.query = captures[7] ? captures[7].substr(1) : null;
uri.fragment = captures[8] ? captures[8].substr(1) : null;
uri.isGenericURI = uri.authority === null && !!uri.scheme;
return uri;
}
};
module.exports = URIRFC3986;
}, null);
__d("createObjectFrom", [], function $module_createObjectFrom(global, require, requireDynamic, requireLazy, module, exports) {
function createObjectFrom(
keys,
values) {
if (__DEV__) {
if (!ES("Array", "isArray", false, keys)) {
throw new TypeError('Must pass an array of keys.');
}
}
if (values === undefined) {
return createObjectFrom(keys, true);
}
var object = {};
if (ES("Array", "isArray", false, values)) {
for (var ii = keys.length - 1; ii >= 0; ii--) {
object[keys[ii]] = values[ii];
}
} else {
for (var _ii = keys.length - 1; _ii >= 0; _ii--) {
object[keys[_ii]] = values;
}
}
return object;
}
module.exports = createObjectFrom;
}, null);
__d("URISchemes", ["createObjectFrom"], function $module_URISchemes(global, require, requireDynamic, requireLazy, module, exports, createObjectFrom) {
var defaultSchemes = createObjectFrom([
'blob',
'cmms',
'fb',
'fba',
'fbatwork',
'fb-ama',
'fb-workchat',
'fb-workchat-secure',
'fb-messenger',
'fb-messenger-public',
'fb-messenger-group-thread',
'fb-page-messages',
'fb-pma',
'fbcf',
'fbconnect',
'fbinternal',
'fbmobilehome',
'fbrpc',
'file',
'ftp',
'http',
'https',
'mailto',
'ms-app',
'intent',
'itms',
'itms-apps',
'itms-services',
'market',
'svn+ssh',
'fbstaging',
'tel',
'sms',
'pebblejs',
'sftp',
'whatsapp',
'moments',
'flash',
'fblite',
'chrome-extension',
'webcal',
'fb124024574287414',
'fb124024574287414rc',
'fb124024574287414master',
'fb1576585912599779',
'fb929757330408142',
'designpack',
'fbpixelcloud',
'fbapi20130214',
'fb1196383223757595',
'tbauth',
'oculus',
'oculus.store',
'skype',
'callto',
'workchat',
'fb236786383180508',
'fb1775440806014337',
'data']);
var URISchemes = {
isAllowed: function isAllowed(schema) {
if (!schema) {
return true;
}
return Object.prototype.hasOwnProperty.call(defaultSchemes, schema.toLowerCase());
}
};
module.exports = URISchemes;
}, null);
__d("setHostSubdomain", [], (function $module_setHostSubdomain(global, require, requireDynamic, requireLazy, module, exports) {
function setHostSubdomain(domain, subdomain) {
var pieces = domain.split('.');
if (pieces.length < 3) {
pieces.unshift(subdomain);
} else {
pieces[0] = subdomain;
}
return pieces.join('.');
}
module.exports = setHostSubdomain;
}), null);
__d("URIBase", ["URIRFC3986", "URISchemes", "ex", "invariant", "setHostSubdomain"], function $module_URIBase(global, require, requireDynamic, requireLazy, module, exports, URIRFC3986, URISchemes, ex, invariant, setHostSubdomain) {
var UNSAFE_DOMAIN_PATTERN = new RegExp(
'[\\x00-\\x2c\\x2f\\x3b-\\x40\\x5c\\x5e\\x60\\x7b-\\x7f' +
'\\uFDD0-\\uFDEF\\uFFF0-\\uFFFF' +
'\\u2047\\u2048\\uFE56\\uFE5F\\uFF03\\uFF0F\\uFF1F]');
var SECURITY_PATTERN = new RegExp(
'^(?:[^/]*:|' +
'[\\x00-\\x1f]*/[\\x00-\\x1f]*/)');
function parse(
uri,
uriToParse,
shouldThrow,
serializer) {
if (!uriToParse) {
return true;
}
if (uriToParse instanceof URIBase) {
uri.setProtocol(uriToParse.getProtocol());
uri.setDomain(uriToParse.getDomain());
uri.setPort(uriToParse.getPort());
uri.setPath(uriToParse.getPath());
uri.setQueryData(
serializer.deserialize(serializer.serialize(uriToParse.getQueryData())));
uri.setFragment(uriToParse.getFragment());
uri.setIsGeneric(uriToParse.getIsGeneric());
uri.setForceFragmentSeparator(uriToParse.getForceFragmentSeparator());
return true;
}
uriToParse = ES(uriToParse.toString(), "trim", true);
var components = URIRFC3986.parse(uriToParse) || {
fragment: null,
scheme: null
};
if (!shouldThrow && !URISchemes.isAllowed(components.scheme)) {
return false;
}
uri.setProtocol(components.scheme || '');
if (!shouldThrow && UNSAFE_DOMAIN_PATTERN.test(components.host || '')) {
return false;
}
uri.setDomain(components.host || '');
uri.setPort(components.port || '');
uri.setPath(components.path || '');
if (shouldThrow) {
uri.setQueryData(serializer.deserialize(components.query || '') || {});
} else {
try {
uri.setQueryData(serializer.deserialize(components.query || '') || {});
} catch (_unused) {
return false;
}
}
uri.setFragment(components.fragment || '');
if (components.fragment === '') {
uri.setForceFragmentSeparator(true);
}
uri.setIsGeneric(components.isGenericURI || false);
if (components.userinfo !== null) {
if (shouldThrow) {
throw new Error(
ex(
'URI.parse: invalid URI (userinfo is not allowed in a URI): %s',
uri.toString()));
} else {
return false;
}
}
if (!uri.getDomain() && ES(uri.getPath(), "indexOf", true, '\\') !== -1) {
if (shouldThrow) {
throw new Error(
ex(
'URI.parse: invalid URI (no domain but multiple back-slashes): %s',
uri.toString()));
} else {
return false;
}
}
if (!uri.getProtocol() && SECURITY_PATTERN.test(uriToParse)) {
if (shouldThrow) {
throw new Error(
ex(
'URI.parse: invalid URI (unsafe protocol-relative URLs): %s',
uri.toString()));
} else {
return false;
}
}
if (uri.getDomain() && uri.getPath() && !ES(uri.getPath(), "startsWith", true, '/')) {
if (shouldThrow) {
throw new Error(
ex(
'URI.parse: invalid URI (domain and path where path lacks leading slash): %s',
uri.toString()));
} else {
return false;
}
}
return true;
}
var uriFilters = [];
URIBase.
tryParse = function (uri, serializer) {
"use strict";
var result = new URIBase(null, serializer);
return parse(result, uri, false, serializer) ? result : null;
};
URIBase.
isValid = function (uri, serializer) {
"use strict";
return !!URIBase.tryParse(uri, serializer);
};
function URIBase(uri, serializer) {
"use strict";
serializer || invariant(0, 'no serializer set');
this.$URIBase_serializer = serializer;
this.$URIBase_protocol = '';
this.$URIBase_domain = '';
this.$URIBase_port = '';
this.$URIBase_path = '';
this.$URIBase_fragment = '';
this.$URIBase_isGeneric = false;
this.$URIBase_queryData = {};
this.$URIBase_forceFragmentSeparator = false;
parse(this, uri, true, serializer);
}
URIBase.prototype.
setProtocol = function (protocol) {
"use strict";
if (!URISchemes.isAllowed(protocol)) {
false || invariant(0, '"%s" is not a valid protocol for a URI.', protocol);
}
this.$URIBase_protocol = protocol;
return this;
};
URIBase.prototype.
getProtocol = function () {
"use strict";
return (this.$URIBase_protocol || '').toLowerCase();
};
URIBase.prototype.
setSecure = function (secure) {
"use strict";
return this.setProtocol(secure ? 'https' : 'http');
};
URIBase.prototype.
isSecure = function () {
"use strict";
return this.getProtocol() === 'https';
};
URIBase.prototype.
setDomain = function (domain) {
"use strict";
if (UNSAFE_DOMAIN_PATTERN.test(domain)) {
throw new Error(
ex(
'URI.setDomain: unsafe domain specified: %s for url %s',
domain,
this.toString()));
}
this.$URIBase_domain = domain;
return this;
};
URIBase.prototype.
getDomain = function () {
"use strict";
return this.$URIBase_domain;
};
URIBase.prototype.
setPort = function (port) {
"use strict";
this.$URIBase_port = port;
return this;
};
URIBase.prototype.
getPort = function () {
"use strict";
return this.$URIBase_port;
};
URIBase.prototype.
setPath = function (path) {
"use strict";
if (__DEV__) {
if (path && path.charAt(0) !== '/') {
console.warn(
'Path does not begin with a "/" which means this URI ' +
'will likely be malformed. Ensure any string passed to .setPath() ' +
'leads with "/"');
}
}
this.$URIBase_path = path;
return this;
};
URIBase.prototype.
getPath = function () {
"use strict";
return this.$URIBase_path;
};
URIBase.prototype.
addQueryData = function (mapOrKey, value) {
"use strict";
if (Object.prototype.toString.call(mapOrKey) === '[object Object]') {
ES("Object", "assign", false, this.$URIBase_queryData, mapOrKey);
} else {
this.$URIBase_queryData[mapOrKey] = value;
}
return this;
};
URIBase.prototype.
setQueryData = function (map) {
"use strict";
this.$URIBase_queryData = map;
return this;
};
URIBase.prototype.
getQueryData = function () {
"use strict";
return this.$URIBase_queryData;
};
URIBase.prototype.
removeQueryData = function (keys) {
"use strict";
if (!ES("Array", "isArray", false, keys)) {
keys = [keys];
}
for (var i = 0, length = keys.length; i < length; ++i) {
delete this.$URIBase_queryData[keys[i]];
}
return this;
};
URIBase.prototype.
setFragment = function (fragment) {
"use strict";
this.$URIBase_fragment = fragment;
this.setForceFragmentSeparator(false);
return this;
};
URIBase.prototype.
getFragment = function () {
"use strict";
return this.$URIBase_fragment;
};
URIBase.prototype.
setForceFragmentSeparator = function (shouldForce) {
"use strict";
this.$URIBase_forceFragmentSeparator = shouldForce;
return this;
};
URIBase.prototype.
getForceFragmentSeparator = function () {
"use strict";
return this.$URIBase_forceFragmentSeparator;
};
URIBase.prototype.
setIsGeneric = function (isGeneric) {
"use strict";
this.$URIBase_isGeneric = isGeneric;
return this;
};
URIBase.prototype.
getIsGeneric = function () {
"use strict";
return this.$URIBase_isGeneric;
};
URIBase.prototype.
isEmpty = function () {
"use strict";
return !(
this.getPath() ||
this.getProtocol() ||
this.getDomain() ||
this.getPort() ||
ES("Object", "keys", false, this.getQueryData()).length > 0 ||
this.getFragment());
};
URIBase.prototype.
toString = function () {
"use strict";
var uri = this;
for (var i = 0; i < uriFilters.length; i++) {
uri = uriFilters[i](uri);
}
return uri.$URIBase_toStringImpl();
};
URIBase.prototype.
$URIBase_toStringImpl = function () {
"use strict";
var str = '';
var protocol = this.getProtocol();
if (protocol) {
str += protocol + ':' + (this.getIsGeneric() ? '' : '//');
}
var domain = this.getDomain();
if (domain) {
str += domain;
}
var port = this.getPort();
if (port) {
str += ':' + port;
}
var path = this.getPath();
if (path) {
str += path;
} else if (str) {
str += '/';
}
var queryStr = this.$URIBase_serializer.serialize(this.getQueryData());
if (queryStr) {
str += '?' + queryStr;
}
var fragment = this.getFragment();
if (fragment) {
str += '#' + fragment;
} else if (this.getForceFragmentSeparator()) {
str += '#';
}
return str;
};
URIBase.
registerFilter = function (filter) {
"use strict";
uriFilters.push(filter);
};
URIBase.prototype.
getOrigin = function () {
"use strict";
var port = this.getPort();
return (
this.getProtocol() + '://' + this.getDomain() + (port ? ':' + port : ''));
};
URIBase.prototype.
getQualifiedURIBase = function () {
"use strict";
return new URIBase(this, this.$URIBase_serializer).qualify();
};
URIBase.prototype.
qualify = function () {
"use strict";
if (!this.getDomain()) {
var current = new URIBase(window.location.href, this.$URIBase_serializer);
this.setProtocol(current.getProtocol()).
setDomain(current.getDomain()).
setPort(current.getPort());
}
return this;
};
URIBase.prototype.
setSubdomain = function (subdomain) {
"use strict";
var domain = this.qualify().getDomain();
return this.setDomain(setHostSubdomain(domain, subdomain));
};
URIBase.prototype.
getSubdomain = function () {
"use strict";
if (!this.getDomain()) {
return '';
}
var domains = this.getDomain().split('.');
if (domains.length <= 2) {
return '';
} else {
return domains[0];
}
};
module.exports = URIBase;
}, null);
__d("sdk.URI", ["Assert", "QueryString", "URIBase"], function $module_sdk_URI(global, require, requireDynamic, requireLazy, module, exports, Assert, QueryString, URIBase) {
var _URIBase,
_superProto;
var facebookRe = /\.facebook\.com$/;
var serializer = {
serialize: function serialize(map) {
return map ? QueryString.encode(map) : '';
},
deserialize: function deserialize(text) {
return text ? QueryString.decode(text) : {};
}
};
_URIBase = babelHelpers.inherits(
URI, URIBase);
_superProto = _URIBase && _URIBase.prototype;
function URI(uri) {
"use strict";
Assert.isString(uri, 'The passed argument was of invalid type.');
_superProto.constructor.call(this, uri, serializer);
}
URI.prototype.
isFacebookURI = function () {
"use strict";
return facebookRe.test(this.getDomain());
};
URI.prototype.
valueOf = function () {
"use strict";
return this.toString();
};
URI.
isValidURI = function (uri) {
"use strict";
return URIBase.isValid(uri, serializer);
};
module.exports = URI;
}, null);
__d("wrapFunction", [], function $module_wrapFunction(global, require, requireDynamic, requireLazy, module, exports) {
var wrappers = {};
var wrapFunction = function wrapFunction(
fn,
type,
source) {
return function () {
var callee = type in wrappers ? wrappers[type](fn, source) : fn;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return callee.apply(this, args);
};
};
wrapFunction.setWrapper = function (
fn,
type) {
wrappers[type] = fn;
};
module.exports = wrapFunction;
}, null);
__d("BrowserExtensions.ErrorHandling", ["ManagedError", "errorCode", "guid", "normalizeError", "sdk.Scribe", "sdk.URI", "wrapFunction"], function $module_BrowserExtensions_ErrorHandling(global, require, requireDynamic, requireLazy, module, exports, ManagedError, errorCode, guid, normalizeError, Scribe, URI, wrapFunction) {
'use strict';
var handleError = true;
var currentEntry = '';
var loggingRef = guid();
function errorHandler(error) {
var originalError = error._originalError;
delete error._originalError;
var origin =
window.location.origin || new URI(window.location.href).getOrigin();
Scribe.log('browser_extensions_sdk_errors', {
loggingRef: loggingRef,
version: '0.1',
error: error.name || error.message,
extra: error,
uri: window.location.href,
origin: origin
});
throw originalError;
}
function guard(func, entry) {
return function () {
if (!handleError) {
return func.apply(this, arguments);
}
try {
currentEntry = entry;
return func.apply(this, arguments);
} catch (error) {
if (error instanceof ManagedError) {
throw error;
}
var data = normalizeError(error);
data.entry = entry;
var sanitizedArgs = ES(Array.prototype.slice.
call(arguments), "map", true,
function (arg) {
var type = Object.prototype.toString.call(arg);
return /^\[object (String|Number|Boolean|Object|Date)\]$/.test(type) ?
arg :
arg.toString();
});
data.args = ES("JSON", "stringify", false, sanitizedArgs).substring(0, 200);
errorHandler(data);
}
finally {
currentEntry = '';
}
};
}
function unguard(func) {
if (!func.__wrapper) {
func.__wrapper = function () {
try {
return func.apply(this, arguments);
} catch (e) {
window.setTimeout(function () {
throw e;
}, 0);
return false;
}
};
}
return func.__wrapper;
}
function getCalleeName(arg) {
try {
return arg && arg.callee && arg.callee.caller ? arg.callee.caller.name : '';
} catch (_unused) {
return '';
}
}
function wrap(real, entry) {
return function (fn, delay) {
var name =
entry +
':' + (
currentEntry || '[global]') +
':' + (
fn.name ||
'[anonymous]' + (
getCalleeName(arguments) ?
'(' + getCalleeName(arguments) + ')' :
''));
return real(wrapFunction(fn, 'entry', name), delay);
};
}
function getErrorMessage(error) {
if (
error ===
2018162) {
return 'This feature is currently not available.';
}
return 'An unexpected error has occured.' + error;
}
if (handleError) {
setTimeout = wrap(setTimeout, 'setTimeout');
setInterval = wrap(setInterval, 'setInterval');
wrapFunction.setWrapper(guard, 'entry');
}
var ErrorHandler = {
getErrorMessage: getErrorMessage,
guard: guard,
unguard: unguard
};
module.exports = ErrorHandler;
}, null);
__d("keyMirror", ["invariant"], function $module_keyMirror(global, require, requireDynamic, requireLazy, module, exports, invariant) {
'use strict';
function keyMirror(obj) {
var ret = {};
obj instanceof Object && !ES("Array", "isArray", false, obj) || invariant(0,
'keyMirror(...): Argument must be an object.');
for (var key in obj) {
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
continue;
}
ret[key] = key;
}
return ret;
}
module.exports = keyMirror;
}, null);
__d("BrowserExtensions.DeviceTypes", ["keyMirror"], (function $module_BrowserExtensions_DeviceTypes(global, require, requireDynamic, requireLazy, module, exports, keyMirror) {
'use strict';
var DeviceTypes = keyMirror({
ANDROID: null,
IOS: null,
WEB: null,
TEST_MODE: null,
UNKNOWN: null
});
module.exports = babelHelpers["extends"]({},
DeviceTypes, {
getDeviceType: function getDeviceType() {
if (!navigator.userAgent) {
return DeviceTypes.UNKNOWN;
}
if (navigator.userAgent.match(/android/i)) {
return DeviceTypes.ANDROID;
}
if (
navigator.userAgent.match(/iPhone/) ||
navigator.userAgent.match(/iPod/) ||
navigator.userAgent.match(/iPad/)) {
return DeviceTypes.IOS;
}
if (
navigator.userAgent.match(/Chrome/) ||
navigator.userAgent.match(/Firefox/) ||
navigator.userAgent.match(/Safari/) ||
navigator.userAgent.match(/MSIE|Trident|Edge/)) {
return DeviceTypes.WEB;
}
return DeviceTypes.UNKNOWN;
}
});
}), null);
__d("flattenPHPQueryData", ["invariant"], (function $module_flattenPHPQueryData(global, require, requireDynamic, requireLazy, module, exports, invariant) {
function flattenPHPQueryData(
obj) {
return _flattenPHPQueryData(obj, '', {});
}
function _flattenPHPQueryData(
obj,
name,
componentsObject) {
if (obj === null || obj === undefined) {
componentsObject[name] = undefined;
} else if (typeof obj === 'object') {
typeof obj.appendChild !== 'function' || invariant(0,
'Trying to serialize a DOM node. Bad idea.');
for (var k in obj) {
if (
k !== '$$typeof' &&
Object.prototype.hasOwnProperty.call(obj, k) &&
obj[k] !== undefined) {
_flattenPHPQueryData(
obj[k],
name ? name + '[' + k + ']' : k,
componentsObject);
}
}
} else {
componentsObject[name] = obj;
}
return componentsObject;
}
module.exports = flattenPHPQueryData;
}), null);
__d("PHPQuerySerializer", ["flattenPHPQueryData", "invariant"], (function $module_PHPQuerySerializer(global, require, requireDynamic, requireLazy, module, exports, flattenPHPQueryData, invariant) {
function serialize(obj) {
var kv_pairs = [];
var componentsObject = flattenPHPQueryData(obj);
for (var component in componentsObject) {
if (Object.prototype.hasOwnProperty.call(componentsObject, component)) {
var key = encodeComponent(component);
if (componentsObject[component] === undefined) {
kv_pairs.push(key);
} else {
kv_pairs.push(
key + '=' + encodeComponent(String(componentsObject[component])));
}
}
}
return kv_pairs.join('&');
}
function encodeComponent(raw) {
return encodeURIComponent(raw).
replace(/%5D/g, ']').
replace(/%5B/g, '[');
}
var ARRAY_QUERY_PATTERN = /^([-_\w]+)((?:\[[-_\w]*\])+)=?(.*)/;
function replaceBadKeys(key) {
if (key === 'hasOwnProperty' || key === '__proto__') {
return '\ud83d\udf56';
}
return key;
}
function deserialize(query) {
if (!query) {
return {};
}
var result = {};
var queryAsString = query.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
var queryAsArray = queryAsString.split('&');
var hasOwnProp = Object.prototype.hasOwnProperty;
for (var ii = 0, length = queryAsArray.length; ii < length; ii++) {
var match = queryAsArray[ii].match(ARRAY_QUERY_PATTERN);
if (!match) {
var term = queryAsArray[ii].split('=');
result[decodeComponent(term[0])] =
term[1] === undefined ? null : decodeComponent(term[1]);
} else {
var indices = match[2].split(/\]\[|\[|\]/).slice(0, -1);
var name = match[1];
var value = decodeComponent(match[3] || '');
indices[0] = name;
var resultNode = result;
for (var i = 0; i < indices.length - 1; i++) {
var key = replaceBadKeys(indices[i]);
if (key) {
if (!hasOwnProp.call(resultNode, key)) {
var nv =
indices[i + 1] && !indices[i + 1].match(/^\d{1,3}$/) ? {}
: [];
resultNode[key] = nv;
if (resultNode[key] !== nv) {
return result;
}
}
resultNode = resultNode[key];
} else {
if (indices[i + 1] && !indices[i + 1].match(/^\d{1,3}$/)) {
resultNode.push({});
} else {
resultNode.push([]);
}
resultNode = resultNode[resultNode.length - 1];
}
}
if (resultNode instanceof Array && indices[indices.length - 1] === '') {
resultNode.push(value);
} else {
resultNode[replaceBadKeys(indices[indices.length - 1])] = value;
}
}
}
return result;
}
function decodeComponent(encoded_s) {
try {
return decodeURIComponent(encoded_s.replace(/\+/g, ' '));
} catch (_unused) {
if (__DEV__) {
console.error('Bad UTF8 in URL: ', encoded_s);
}
return encoded_s;
}
}
var PHPQuerySerializer = {
serialize: serialize,
encodeComponent: encodeComponent,
deserialize: deserialize,
decodeComponent: decodeComponent
};
module.exports = PHPQuerySerializer;
}), null);
__d("ReloadPage", [], function $module_ReloadPage(global, require, requireDynamic, requireLazy, module, exports) {
var ReloadPage = {
now: function now(forcedReload) {
global.window.location.reload(forcedReload);
},
delay: function delay(timeout) {
global.setTimeout(ES(this.now, "bind", true, this), timeout);
}
};
module.exports = ReloadPage;
}, null);
__d("areSameOrigin", [], function $module_areSameOrigin(global, require, requireDynamic, requireLazy, module, exports) {
function areSameOrigin(first, second) {
if (first.isEmpty() || second.isEmpty()) {
return false;
}
if (first.getProtocol() && first.getProtocol() != second.getProtocol()) {
return false;
}
if (first.getDomain() && first.getDomain() != second.getDomain()) {
return false;
}
if (
first.getPort() &&
first.getPort().toString() !== second.getPort().toString()) {
return false;
}
return true;
}
module.exports = areSameOrigin;
}, null);
__d("ifRequired", [], (function $module_ifRequired(global, require, requireDynamic, requireLazy, module, exports) {
function ifRequired(id, cbYes, cbNo) {
var requiredModule;
requireLazy &&
requireLazy.call(null, [id], function (x) {
requiredModule = x;
});
if (requiredModule && cbYes) {
return cbYes(requiredModule);
} else if (!requiredModule && cbNo) {
return cbNo();
}
}
module.exports = ifRequired;
}), null);
__d("isFacebookURI", [], function $module_isFacebookURI(global, require, requireDynamic, requireLazy, module, exports) {
var facebookURIRegex = null;
var FB_PROTOCOLS = ['http', 'https'];
function isFacebookURI(uri) {
if (!facebookURIRegex) {
facebookURIRegex = new RegExp('(^|\\.)facebook\\.com$', 'i');
}
if (uri.isEmpty() && uri.toString() !== '#') {
return false;
}
if (!uri.getDomain() && !uri.getProtocol()) {
return true;
}
return (
ES(FB_PROTOCOLS, "indexOf", true, uri.getProtocol()) !== -1 &&
facebookURIRegex.test(uri.getDomain()));
}
isFacebookURI.setRegex = function (regex) {
facebookURIRegex = regex;
};
module.exports = isFacebookURI;
}, null);
__d("memoize", ["invariant"], (function $module_memoize(global, require, requireDynamic, requireLazy, module, exports, invariant) {
function memoize(f) {
var f1 = f;
var result;
return function () {
!arguments.length || invariant(0,
'A memoized function cannot be called with arguments');
if (f1) {
result = f1();
f1 = null;
}
return result;
};
}
module.exports = memoize;
}), null);
__d("unqualifyURI", [], (function $module_unqualifyURI(global, require, requireDynamic, requireLazy, module, exports) {
function unqualifyURI(uri) {
uri.
setProtocol(null).
setDomain(null).
setPort(null);
}
module.exports = unqualifyURI;
}), null);
__d("URI", ["PHPQuerySerializer", "ReloadPage", "URIBase", "areSameOrigin", "ifRequired", "isFacebookURI", "memoize", "unqualifyURI"], function $module_URI(global, require, requireDynamic, requireLazy, module, exports, PHPQuerySerializer, ReloadPage, URIBase, areSameOrigin, ifRequired, isFacebookURI, memoize, unqualifyURI) {
var _URIBase,
_superProto;
var getURIWithCurrentOrigin = memoize(function () {
return new URI(window.location.href);
});
function getPageTransitionsIfInitialized() {
return ifRequired('PageTransitions', function (PageTransitions) {
if (PageTransitions.isInitialized()) {
return PageTransitions;
}
});
}
_URIBase = babelHelpers.inherits(
URI, URIBase);
_superProto = _URIBase && _URIBase.prototype;
function URI(uri) {
"use strict";
_superProto.constructor.call(this, uri || '', PHPQuerySerializer);
}
URI.prototype.
setPath = function (path) {
"use strict";
this.path = path;
return _superProto.setPath.call(this, path);
};
URI.prototype.
getPath = function () {
"use strict";
var path = _superProto.getPath.call(this);
if (path) {
return path.replace(/^\/+/, '/');
}
return path;
};
URI.prototype.
setProtocol = function (protocol) {
"use strict";
this.protocol = protocol;
return _superProto.setProtocol.call(this, protocol);
};
URI.prototype.
setDomain = function (domain) {
"use strict";
this.domain = domain;
return _superProto.setDomain.call(this, domain);
};
URI.prototype.
setPort = function (port) {
"use strict";
this.port = port;
return _superProto.setPort.call(this, port);
};
URI.prototype.
setFragment = function (fragment) {
"use strict";
this.fragment = fragment;
return _superProto.setFragment.call(this, fragment);
};
URI.prototype.
stripTrailingSlash = function () {
"use strict";
this.setPath(this.getPath().replace(/\/$/, ''));
return this;
};
URI.prototype.
valueOf = function () {
"use strict";
return this.toString();
};
URI.prototype.
isSubdomainOfDomain = function (superdomain) {
"use strict";
var domain = this.getDomain();
if (superdomain === '' || domain === '') {
return false;
}
if (ES(domain, "endsWith", true, superdomain)) {
var domainLen = domain.length;
var superdomainLen = superdomain.length;
var pos = domainLen - superdomainLen - 1;
if (domainLen === superdomainLen || domain[pos] === '.') {
return URI.isValidURI(superdomain);
}
}
return false;
};
URI.prototype.
getRegisteredDomain = function () {
"use strict";
if (!this.getDomain()) {
return '';
}
if (!isFacebookURI(this)) {
return null;
}
var parts = this.getDomain().split('.');
var index = ES(parts, "indexOf", true, 'facebook');
if (index === -1) {
index = ES(parts, "indexOf", true, 'workplace');
}
return parts.slice(index).join('.');
};
URI.prototype.
getUnqualifiedURI = function () {
"use strict";
var uri = new URI(this);
unqualifyURI(uri);
return uri;
};
URI.prototype.
getQualifiedURI = function () {
"use strict";
return new URI(this).qualify();
};
URI.prototype.
isSameOrigin = function (asThisURI) {
"use strict";
var other = asThisURI;
if (!other) {
other = getURIWithCurrentOrigin();
} else if (!(other instanceof URI)) {
other = new URI(other.toString());
}
return areSameOrigin(this, other);
};
URI.
go = function (uri, force, replace) {
"use strict";
URI.goURIOnWindow(uri, window, force, replace);
};
URI.
goURIOnWindow = function (
uri,
w,
force,
replace) {
"use strict";
var uriObj = new URI(uri);
var uriString = uriObj.toString();
var wd = w ? w : window;
ifRequired('PageNavigationStageLogger', function (PageNavigationStageLogger) {
if (force) {
PageNavigationStageLogger.setNote('force');
} else if (!global.PageTransitions) {
PageNavigationStageLogger.setNote('no_pagetrans');
}
PageNavigationStageLogger.setCookieForNavigation(uriString);
});
if (!force && global.PageTransitions) {
global.PageTransitions.go(uriString, replace);
} else if (window.location.href === uriString) {
ReloadPage.now();
} else if (replace) {
wd.location.replace(uriString);
} else {
wd.location.href = uriString;
}
};
URI.prototype.
go = function (force, replace) {
"use strict";
URI.go(this, force, replace);
};
URI.
tryParseURI = function (uri) {
"use strict";
var base = URIBase.tryParse(uri, PHPQuerySerializer);
return base ? new URI(base) : null;
};
URI.
isValidURI = function (uri) {
"use strict";
return URIBase.isValid(uri, PHPQuerySerializer);
};
URI.
getRequestURI = function (
respectPageTransitions,
suppressWarning) {
"use strict";
respectPageTransitions =
respectPageTransitions === undefined || respectPageTransitions;
if (respectPageTransitions) {
var PageTransitions = getPageTransitionsIfInitialized();
if (PageTransitions) {
return PageTransitions.getCurrentURI(
!!suppressWarning).
getQualifiedURI();
}
}
return new URI(window.location.href);
};
URI.
getMostRecentURI = function () {
"use strict";
var PageTransitions = getPageTransitionsIfInitialized();
if (PageTransitions) {
return PageTransitions.getMostRecentURI().getQualifiedURI();
}
return new URI(window.location.href);
};
URI.
getNextURI = function () {
"use strict";
var PageTransitions = getPageTransitionsIfInitialized();
if (PageTransitions) {
return PageTransitions.getNextURI().getQualifiedURI();
}
return new URI(window.location.href);
};
URI.
encodeComponent = function (raw) {
"use strict";
return encodeURIComponent(raw).
replace(/%5D/g, ']').
replace(/%5B/g, '[');
};
URI.
decodeComponent = function (encoded_s) {
"use strict";
return decodeURIComponent(encoded_s.replace(/\+/g, ' '));
};
ES("Object", "assign", false, URI, {
expression: /(((\w+):\/\/)([^\/:]*)(:(\d+))?)?([^#?]*)(\?([^#]*))?(#(.*))?/,
arrayQueryExpression: /^(\w+)((?:\[\w*\])+)=?(.*)/
});
if (__DEV__) {
if (typeof Object.defineProperty === 'function') {
var proto = URI.prototype;
var props = ['path', 'protocol', 'domain', 'port', 'fragment'];
ES(props, "forEach", true, ES(function (prop) {
var privateProp = '_URI_' + prop;
var capitalized = prop.charAt(0).toUpperCase() + prop.slice(1);
Object.defineProperty(proto, prop, {
get: function get() {
console.warn(
'URI: Do not access the ' +
prop +
' property directly. ' +
'Use get' +
capitalized +
'() instead.');
return this[privateProp];
},
set: function set(newValue) {
this[privateProp] = newValue;
}
});
}, "bind", true, this));
}
}
module.exports = URI;
}, null);
__d("isMessengerDotComURI", [], function $module_isMessengerDotComURI(global, require, requireDynamic, requireLazy, module, exports) {
var messengerDotComURIRegex = new RegExp('(^|\\.)messenger\\.com$', 'i');
var PROTOCOLS = ['https'];
function isMessengerDotComURI(uri) {
if (uri.isEmpty() && uri.toString() !== '#') {
return false;
}
if (!uri.getDomain() && !uri.getProtocol()) {
return false;
}
return (
ES(PROTOCOLS, "indexOf", true, uri.getProtocol()) !== -1 &&
messengerDotComURIRegex.test(uri.getDomain()));
}
module.exports = isMessengerDotComURI;
}, null);
__d("BrowserExtensionsUtilities", ["URI", "isFacebookURI", "isMessengerDotComURI"], function $module_BrowserExtensionsUtilities(global, require, requireDynamic, requireLazy, module, exports, URI, isFacebookURI, isMessengerDotComURI) {
function getTargetOrigin() {
var origins = window.location.ancestorOrigins;
if (origins && origins.length > 0) {
var topOriginURI = new URI(origins[origins.length - 1]);
if (isFacebookURI(topOriginURI) || isMessengerDotComURI(topOriginURI)) {
return topOriginURI.getOrigin();
}
}
var currentURI = new URI(window.location.href);
var origin = currentURI.getQueryData().fb_iframe_origin;
var originURI = origin && new URI(origin);
if (
originURI && (
isFacebookURI(originURI) || isMessengerDotComURI(originURI))) {
return originURI.getOrigin();
}
if (/messenger/.test(window.name)) {
return 'https://www.messenger.com:443';
} else if (/instagram/.test(window.name)) {
return 'https://www.instagram.com:443';
} else {
return 'https://www.facebook.com:443';
}
}
var BrowserExtensionUtilities = {
getTargetOrigin: getTargetOrigin
};
module.exports = BrowserExtensionUtilities;
}, null);
__d("isInstagramURI", [], function $module_isInstagramURI(global, require, requireDynamic, requireLazy, module, exports) {
function isInstagramURI(uri) {
if (uri.isEmpty() && uri.toString() !== '#') {
return false;
}
if (!uri.getDomain() && !uri.getProtocol()) {
return false;
}
return uri.isSecure() && uri.isSubdomainOfDomain('instagram.com');
}
module.exports = isInstagramURI;
}, null);
__d("FBExtension.HostAppTypes", ["URI", "isFacebookURI", "isInstagramURI", "isMessengerDotComURI", "keyMirror", "sdk.UA", "BrowserExtensionsUtilities"], function $module_FBExtension_HostAppTypes(global, require, requireDynamic, requireLazy, module, exports, URI, isFacebookURI, isInstagramURI, isMessengerDotComURI, keyMirror, UA, _require) {
'use strict';
var HostAppTypes = keyMirror({
MESSENGER: null,
INSTAGRAM: null,
FACEBOOK: null,
UNKNOWN: null
});
var
getTargetOrigin = _require.getTargetOrigin;
function getHostAppTypeFromOrigin(uri) {
if (!uri) {
return HostAppTypes.UNKNOWN;
} else if (isFacebookURI(uri)) {
return HostAppTypes.FACEBOOK;
} else if (isMessengerDotComURI(uri)) {
return HostAppTypes.MESSENGER;
} else if (isInstagramURI(uri)) {
return HostAppTypes.INSTAGRAM;
}
return HostAppTypes.UNKNOWN;
}
module.exports = babelHelpers["extends"]({},
HostAppTypes, {
getHostAppType: function getHostAppType() {
if (UA.mobile()) {
if (UA.facebookInAppBrowser()) {
return HostAppTypes.FACEBOOK;
} else if (UA.instagram()) {
return HostAppTypes.INSTAGRAM;
} else if (UA.messenger()) {
return HostAppTypes.MESSENGER;
}
return HostAppTypes.UNKNOWN;
}
var targetOrigin = getTargetOrigin();
return getHostAppTypeFromOrigin(new URI(targetOrigin));
}
});
}, null);
__d("Log", [], function $module_Log(global, require, requireDynamic, requireLazy, module, exports) {
'use strict';
var Level = {
DEBUG: 3,
INFO: 2,
WARNING: 1,
ERROR: 0
};
var log = function log(
name,
level,
format) {
for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
args[_key - 3] = arguments[_key];
}
var index = 0;
var msg = format.replace(/%s/g, function () {
return String(args[index++]);
});
var console = window.console;
if (console && Log.level >= level) {
console[name in console ? name : 'log'](msg);
}
};
var Log = {
level: __DEV__ ? 3 : -1,
Level: Level,
debug: ES(log, "bind", true, null, 'debug', Level.DEBUG),
info: ES(log, "bind", true, null, 'info', Level.INFO),
warn: ES(log, "bind", true, null, 'warn', Level.WARNING),
error: ES(log, "bind", true, null, 'error', Level.ERROR),
log: log
};
module.exports = Log;
}, null);
__d("JSONRPC", ["Log"], function $module_JSONRPC(global, require, requireDynamic, requireLazy, module, exports, Log) {
function JSONRPC(write) {
"use strict";
this.$JSONRPC_counter = 0;
this.$JSONRPC_callbacks = {};
this.remote = ES(function (context) {
this.$JSONRPC_context = context;
return this.remote;
}, "bind", true, this);
this.local = {};
this.$JSONRPC_write = write;
}
JSONRPC.prototype.
stub = function (stub) {
"use strict";
this.remote[stub] = ES(function () {
var message = {
jsonrpc: '2.0',
method: stub
};
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (typeof args[args.length - 1] === 'function') {
message.id = ++this.$JSONRPC_counter;
this.$JSONRPC_callbacks[message.id] = args.pop();
}
message.params = args;
this.$JSONRPC_write(ES("JSON", "stringify", false, message), this.$JSONRPC_context || {
method: stub
});
}, "bind", true, this);
};
JSONRPC.prototype.
read = function (message, context) {
"use strict";
var rpc = ES("JSON", "parse", false, message),
id = rpc.id;
if (!rpc.method) {
if (!this.$JSONRPC_callbacks[id]) {
Log.warn('Could not find callback %s', id);
return;
}
var callback = this.$JSONRPC_callbacks[id];
delete this.$JSONRPC_callbacks[id];
delete rpc.id;
delete rpc.jsonrpc;
callback(rpc);
return;
}
var instance = this,
method = this.local[rpc.method],
send;
if (id) {
send = function send(type, value) {
var response = {
jsonrpc: '2.0',
id: id
};
response[type] = value;
setTimeout(function () {
instance.$JSONRPC_write(ES("JSON", "stringify", false, response), context);
}, 0);
};
} else {
send = function send() {};
}
if (!method) {
Log.error('Method "%s" has not been defined', rpc.method);
send('error', {
code: -32601,
message: 'Method not found',
data: rpc.method
});
return;
}
rpc.params.push(ES(send, "bind", true, null, 'result'));
rpc.params.push(ES(send, "bind", true, null, 'error'));
try {
var returnValue = method.apply(context || null, rpc.params);
if (typeof returnValue !== 'undefined') {
send('result', returnValue);
}
} catch (rpcEx) {
Log.error(
'Invokation of RPC method %s resulted in the error: %s',
rpc.method,
rpcEx.message);
send('error', {
code: -32603,
message: 'Internal error',
data: rpcEx.message
});
}
};
module.exports = JSONRPC;
}, null);
__d("isInIframe", [], function $module_isInIframe(global, require, requireDynamic, requireLazy, module, exports) {
var inFrame = window != window.top;
function isInIframe() {
return inFrame;
}
module.exports = isInIframe;
}, null);
__d("emptyFunction", [], function $module_emptyFunction(global, require, requireDynamic, requireLazy, module, exports) {
function makeEmptyFunction(
arg) {
return function () {
return arg;
};
}
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
}, null);
__d("sdk.DOMEventListener", ["emptyFunction", "invariant", "wrapFunction"], function $module_sdk_DOMEventListener(global, require, requireDynamic, requireLazy, module, exports, emptyFunction, invariant, wrapFunction) {
var supportsPassive = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function get() {
supportsPassive = true;
}
});
window.addEventListener('test', null, opts);
} catch (_unused) {}
var _add,
_remove;
if (window.addEventListener) {
_add = function add(
target,
name,
listener,
options) {
if (options === void 0) {
options = false;
}
listener.wrapper = wrapFunction(
listener,
'entry',
'DOMEventListener.add ' + name);
target.addEventListener(
name,
listener.wrapper,
supportsPassive ? options : false);
};
_remove = function remove(
target,
name,
listener,
options) {
if (options === void 0) {
options = false;
}
target.removeEventListener(
name,
listener.wrapper,
supportsPassive ? options : false);
};
} else if (window.attachEvent) {
_add = function add(
target,
name,
listener) {
listener.wrapper = wrapFunction(
listener,
'entry',
'DOMEventListener.add ' + name);
target.attachEvent || invariant(0, '`target` has no `attachEvent` method.');
target.attachEvent('on' + name, listener.wrapper);
};
_remove = function remove(
target,
name,
listener) {
target.detachEvent || invariant(0, '`target` has no `detachEvent` method.');
target.detachEvent('on' + name, listener.wrapper);
};
} else {
_remove = _add = emptyFunction;
}
var DOMEventListener = {
add: function add(
target,
name,
listener,
options) {
if (options === void 0) {
options = false;
}
_add(target, name, listener, options);
return {
remove: function remove() {
_remove(target, name, listener, options);
}
};
},
remove: _remove
};
module.exports = DOMEventListener;
}, null);
__d("BrowserExtensions.DesktopBridge", ["BrowserExtensions.DeviceTypes", "BrowserExtensionsUtilities", "FBExtension.HostAppTypes", "JSONRPC", "invariant", "isFacebookURI", "isInIframe", "isMessengerDotComURI", "sdk.DOMEventListener", "sdk.URI"], function $module_BrowserExtensions_DesktopBridge(global, require, requireDynamic, requireLazy, module, exports, DeviceTypes, _require, HostAppTypes, JSONRPC, invariant, isFacebookURI, isInIframe, isMessengerDotComURI, DOMEventListener, URI) {
'use strict';
var
getTargetOrigin = _require.getTargetOrigin;
var RPC_PREFIX = 'MESSENGER_EXTENSIONS_RPC:';
var _jsonrpc;
var supportedFeatures = {
supported_features: [
'context',
'sharing_broadcast',
'sharing_direct',
'sharing_open_graph']
};
function init() {
if (!isInIframe()) {
return;
}
DOMEventListener.add(window, 'message', receiveMessage, false);
var targetOrigin = getTargetOrigin();
_jsonrpc = new JSONRPC(function (message) {
parent.postMessage(RPC_PREFIX + message, targetOrigin);
});
_jsonrpc.stub('askPermission');
_jsonrpc.stub('getContext');
_jsonrpc.stub('getGrantedPermissions');
_jsonrpc.stub('requestCloseBrowser');
_jsonrpc.stub('beginShareFlow');
}
function askPermission(
param,
successCallback,
errorCallback) {
_jsonrpc !== null && _jsonrpc !== undefined || invariant(0,
'JavaScript bridge is not available.');
_jsonrpc.remote.askPermission(param.permission, function (response) {
if (response.result) {
successCallback(response.result);
} else if (response.error) {
errorCallback(response.error.code, response.error.message);
}
});
}
function beginShareFlow(
param,
successCallback,
errorCallback) {
_jsonrpc !== null && _jsonrpc !== undefined || invariant(0,
'JavaScript bridge is not available.');
_jsonrpc.remote.beginShareFlow(
param.sharing_type,
param.content_for_share,
param.content_for_preview,
function (response) {
if (response.result) {
successCallback(response.result);
} else if (response.error) {
errorCallback(response.error.code, response.error.message);
}
});
}
function getSupportedFeatures(
param,
successCallback,
errorCallback) {
var allSupportedFeatures = supportedFeatures.supported_features;
allSupportedFeatures.push('sharing_media_template');
allSupportedFeatures = {
supported_features: allSupportedFeatures
};
successCallback(allSupportedFeatures);
}
function getContext(
param,
successCallback,
errorCallback) {
_jsonrpc !== null && _jsonrpc !== undefined || invariant(0,
'JavaScript bridge is not available.');
_jsonrpc.remote.getContext(param.appID, function (response) {
if (response.result) {
successCallback(response.result);
} else if (response.error) {
errorCallback(response.error.code, response.error.message);
}
});
}
function getGrantedPermissions(
param,
successCallback,
errorCallback) {
_jsonrpc !== null && _jsonrpc !== undefined || invariant(0,
'JavaScript bridge is not available.');
_jsonrpc.remote.getGrantedPermissions(function (response) {
if (response.result) {
successCallback(response.result);
} else if (response.error) {
errorCallback(response.error.code, response.error.message);
}
});
}
function getVersion(
param,
successCallback,
errorCallback) {
var reply = {
version: 0
};
successCallback(reply);
}
function getEnvironment(
param,
successCallback,
errorCallback) {
var reply = {
host_app: HostAppTypes.getHostAppType().toLowerCase(),
platform: DeviceTypes.getDeviceType().toLowerCase()
};
successCallback(reply);
}
function requestCloseBrowser(
param,
successCallback,
errorCallback) {
_jsonrpc !== null && _jsonrpc !== undefined || invariant(0,
'JavaScript bridge is not available.');
_jsonrpc.remote.requestCloseBrowser(function (response) {
successCallback();
});
}
function receiveMessage(event) {
_jsonrpc !== null && _jsonrpc !== undefined || invariant(0,
'JavaScript bridge is not available.');
if (typeof event.data !== 'string' || !ES(event.data, "startsWith", true, RPC_PREFIX)) {
return;
}
var origin = event.origin || event.originalEvent.origin;
var originURI = new URI(origin);
isFacebookURI(originURI) || isMessengerDotComURI(originURI) || invariant(0,
'SDK received message from unrecognized origin.');
_jsonrpc.read(event.data.substring(RPC_PREFIX.length));
}
var DesktopBridge = {
init: init,
askPermission: askPermission,
beginShareFlow: beginShareFlow,
getContext: getContext,
getSupportedFeatures: getSupportedFeatures,
getGrantedPermissions: getGrantedPermissions,
getVersion: getVersion,
getEnvironment: getEnvironment,
requestCloseBrowser: requestCloseBrowser
};
module.exports = DesktopBridge;
}, null);
__d("ErrorConstants", [], function $module_ErrorConstants(global, require, requireDynamic, requireLazy, module, exports) {
'use strict';
var ErrorConstants = {
ANONYMOUS_GUARD_TAG: '<anonymous guard>',
EVAL_FRAME_PATTERN_CHROME: /^at .*eval eval (at .*\:\d+\:\d+), .*$/,
GLOBAL_ERROR_HANDLER_TAG:
typeof window === 'undefined' ?
'<self.onerror>' :
'<window.onerror>',
GLOBAL_REACT_ERROR_HANDLER_TAG: '<global.react>',
IE_AND_OTHER_FRAME_PATTERN: /(.*)[@\s][^\s]+$/,
IE_STACK_TRACE_REFERENCES: [
'Unknown script code',
'Function code',
'eval code']
};
module.exports = ErrorConstants;
}, null);
__d("CometErrorUtils", ["ErrorConstants"], function $module_CometErrorUtils(global, require, requireDynamic, requireLazy, module, exports, ErrorConstants) {
'use strict';
if (Error.stackTraceLimit != null && Error.stackTraceLimit < 40) {
Error.stackTraceLimit = 40;
}
var CometErrorUtils = {
getColumn: function getColumn(err) {
var _err$columnNumber;
var column = (_err$columnNumber = err.columnNumber) != null ? _err$columnNumber : '';
return String(column);
},
getColumnFromStackData: function getColumnFromStackData(stackData) {
return stackData[0] && stackData[0].column || '';
},
getIEFrame: function getIEFrame(frame) {
for (var i = 0; i < ErrorConstants.IE_STACK_TRACE_REFERENCES.length; i++) {
var ref = ' ' + ErrorConstants.IE_STACK_TRACE_REFERENCES[i];
if (ES(frame, "endsWith", true, ref)) {
return [frame, frame.substring(0, frame.length - ref.length)];
}
}
return null;
},
getLine: function getLine(err) {
var _err$lineNumber;
var line = (_err$lineNumber = err.lineNumber) != null ? _err$lineNumber : '';
return String(line);
},
getLineFromStackData: function getLineFromStackData(stackData) {
return stackData[0] && stackData[0].line || '';
},
getReactComponentStack: function getReactComponentStack(componentStack) {
if (componentStack == null || componentStack === '') {
return null;
}
var stack = componentStack.split('\n');
stack.splice(0, 1);
return ES(stack, "map", true, function (line) {
return ES(line, "trim", true);
});
},
getScript: function getScript(err) {
var _err$fileName;
var script = (_err$fileName = err.fileName) != null ? _err$fileName : '';
return String(script);
},
getScriptFromStackData: function getScriptFromStackData(stackData) {
return stackData[0] && stackData[0].script || '';
},
normalizeError: function normalizeError(err) {
var stackData = CometErrorUtils.normalizeErrorStack(err);
var reactComponentStack = CometErrorUtils.getReactComponentStack(
err.reactComponentStackForLogging);
var info = {
_originalError: err,
cerror: true,
column:
CometErrorUtils.getColumn(err) ||
CometErrorUtils.getColumnFromStackData(stackData),
deferredSource: null,
extra: {},
fbloggerMetadata: [],
guard: '',
guardList: [],
line:
CometErrorUtils.getLine(err) ||
CometErrorUtils.getLineFromStackData(stackData),
message: err.message,
messageWithParams: [],
name: err.name,
reactComponentStack: reactComponentStack,
script:
CometErrorUtils.getScript(err) ||
CometErrorUtils.getScriptFromStackData(stackData),
serverHash: null,
stack: ES(stackData, "map", true, function (frame) {
return frame.text;
}).join('\n'),
stackFrames: stackData,
type: ''
};
if (typeof info.message === 'string') {
info.messageWithParams = [info.message];
} else {
info.messageObject = info.message;
info.message = String(info.message) + ' (' + typeof info.message + ')';
}
if (typeof window !== 'undefined' && window && window.location) {
info.windowLocationURL = window.location.href;
}
for (var k in info) {
if (info[k] == null) {
delete info[k];
}
}
return info;
},
normalizeErrorStack: function normalizeErrorStack(error) {
var stack = error.stack;
if (stack == null) {
return [];
}
var message = error.message;
var stackWithoutErrorType = stack.replace(/^[\w \.\<\>:]+:\s/, '');
var stackWithoutMessage =
message != null && ES(stackWithoutErrorType, "startsWith", true, message) ?
stackWithoutErrorType.substr(message.length + 1) :
stackWithoutErrorType !== stack ?
stackWithoutErrorType.replace(/^.*?\n/, '') :
stack;
return ES(stackWithoutMessage.
split(/\n\n/)[0].
replace(/[\(\)]|\[.*?\]/g, '').
split('\n'), "map", true,
function (frameRaw) {
var frame = ES(frameRaw, "trim", true);
var evalMatch = frame.match(ErrorConstants.EVAL_FRAME_PATTERN_CHROME);
if (evalMatch) {
frame = evalMatch[1];
}
var line;
var column;
var locationMatch = frame.match(/:(\d+)(?::(\d+))?$/);
if (locationMatch) {
line = locationMatch[1];
column = locationMatch[2];
frame = frame.slice(0, -locationMatch[0].length);
}
var identifier;
var stackMatch =
CometErrorUtils.getIEFrame(frame) ||
frame.match(ErrorConstants.IE_AND_OTHER_FRAME_PATTERN);
if (stackMatch) {
frame = frame.substring(stackMatch[1].length + 1);
var identifierMatch = stackMatch[1].match(
/(?:at)?\s*(.*)(?:[^\s]+|$)/);
identifier = identifierMatch ? identifierMatch[1] : '';
}
if (ES(frame, "includes", true, 'charset=utf-8;base64,')) {
frame = '<inlined-file>';
}
var stackFrame = {
column: column,
identifier: identifier,
line: line,
script: frame
};
var sfIdentifier =
identifier != null && identifier !== '' ?
' ' + identifier + ' (' :
' ';
var sfIdentifier1 = sfIdentifier.length > 1 ? ')' : '';
var sfLine = line != null && line !== '' ? ':' + line : '';
var sfColumn = column != null && column !== '' ? ':' + column : '';
var text = " at" + sfIdentifier + frame + sfLine + sfColumn + sfIdentifier1;
return babelHelpers["extends"]({},
stackFrame, {
text: text
});
});
}
};
module.exports = CometErrorUtils;
}, null);
__d("FBLoggerMetadata", [], function $module_FBLoggerMetadata(global, require, requireDynamic, requireLazy, module, exports) {
'use strict';
var globalMetadata = [];
function FBLoggerMetadata() {
this.metadata = [].concat(globalMetadata);
}
FBLoggerMetadata.prototype.
addMetadata = function (product, name, value) {
this.metadata.push([product, name, value]);
return this;
};
FBLoggerMetadata.prototype.
isEmpty = function () {
return this.metadata.length === 0;
};
FBLoggerMetadata.prototype.
getAll = function () {
var invalidMetadata = [];
var validMetadata = ES(this.metadata, "filter", true, function (entry) {
if (entry == null) {
return false;
}
var invalidLine = ES(entry, "filter", true,
function (item) {
return String(item) && ES(String(item), "indexOf", true, ':') > -1;
});
if (invalidLine.length > 0) {
invalidMetadata.push(entry);
return false;
}
return true;
});
return {
invalidMetadata: invalidMetadata,
validMetadata: validMetadata
};
};
FBLoggerMetadata.
addGlobalMetadata = function (product, name, value) {
globalMetadata.push([product, name, value]);
};
FBLoggerMetadata.
getGlobalMetadata = function () {
return globalMetadata;
};
FBLoggerMetadata.
unsetGlobalMetadata = function (product, name) {
globalMetadata = ES(globalMetadata, "filter", true, function (entry) {
return !(
ES("Array", "isArray", false, entry) &&
entry[0] === product &&
entry[1] === name);
});
};
module.exports = FBLoggerMetadata;
}, null);
__d("erx", ["ex"], function $module_erx(global, require, requireDynamic, requireLazy, module, exports, ex) {
'use strict';
function erx(transformedMessage) {
if (typeof transformedMessage !== 'string') {
return transformedMessage;
}
var prefixLeft = ES(transformedMessage, "indexOf", true, ex._prefix);
var suffixLeft = transformedMessage.lastIndexOf(ex._suffix);
if (prefixLeft < 0 || suffixLeft < 0) {
return [transformedMessage];
}
var prefixRight = prefixLeft + ex._prefix.length;
var suffixRight = suffixLeft + ex._suffix.length;
if (prefixRight >= suffixLeft) {
return ['erx slice failure: %s', transformedMessage];
}
var leftSlice = transformedMessage.substring(0, prefixLeft);
var rightSlice = transformedMessage.substring(suffixRight);
var message = transformedMessage.substring(prefixRight, suffixLeft);
try {
var messageWithParams = ES("JSON", "parse", false, message);
messageWithParams[0] = leftSlice + messageWithParams[0] + rightSlice;
return messageWithParams;
} catch (err) {
return ['erx parse failure: %s because %s', message, err.message];
}
}
module.exports = erx;
}, null);
__d("removeFromArray", [], function $module_removeFromArray(global, require, requireDynamic, requireLazy, module, exports) {
function removeFromArray(array, element) {
var index = ES(array, "indexOf", true, element);
if (index !== -1) {
array.splice(index, 1);
}
}
module.exports = removeFromArray;
}, null);
__d("ErrorUtils", ["CometErrorUtils", "Env", "ErrorConstants", "FBLoggerMetadata", "eprintf", "erx", "removeFromArray", "sprintf"], function $module_ErrorUtils(global, require, requireDynamic, requireLazy, module, exports, CometErrorUtils, Env, ErrorConstants, FBLoggerMetadata, eprintf, erx, removeFromArray, sprintf) {
'use strict';
var GENERATED_GUARD_TAG = '<generated guard>';
var HTTP_OR_HTTPS_URI_PATTERN = /^https?:\/\//i;
var TYPECHECKER_ERROR_PATTERN = /^Type Mismatch for/;
var listeners = [];
var sourceResolver;
var history = [];
var MAX_HISTORY = 50;
var guardList = [];
var isGuarding = false;
var isReporting = false;
var hasLoggedAnyProductionError = false;
var nocatch = /\bnocatch\b/.test(location.search);
function getColumn(err) {
var column = err.columnNumber || err.column;
return column != null ? String(column) : '';
}
function getColumnFromStackData(stackData) {
return stackData[0] && stackData[0].column || '';
}
function getLine(err) {
var line = err.lineNumber || err.line;
return line != null ? String(line) : '';
}
function getLineFromStackData(stackData) {
return stackData[0] && stackData[0].line || '';
}
function getScript(err) {
var script = err.fileName || err.sourceURL;
return script != null ? String(script) : '';
}
function getScriptFromStackData(stackData) {
return stackData[0] && stackData[0].script || '';
}
function normalizeErrorStack(error) {
var stack = error.stackTrace || error.stack;
if (stack == null) {
return [];
}
var message = error.message;
var stackWithoutErrorType = stack.replace(/^[\w \.\<\>:]+:\s/, '');
var stackWithoutMessage =
message != null && ES(stackWithoutErrorType, "startsWith", true, message) ?
stackWithoutErrorType.substr(message.length + 1) :
stackWithoutErrorType !== stack ?
stackWithoutErrorType.replace(/^.*?\n/, '') :
stack;
return ES(stackWithoutMessage.
split(/\n\n/)[0].
replace(/[\(\)]|\[.*?\]/g, '').
split('\n'), "map", true,
function (frame) {
frame = ES(frame, "trim", true);
var evalMatch = frame.match(ErrorConstants.EVAL_FRAME_PATTERN_CHROME);
if (evalMatch) {
frame = evalMatch[1];
}
var line;
var column;
var locationMatch = frame.match(/:(\d+)(?::(\d+))?$/);
if (locationMatch) {
line = locationMatch[1];
column = locationMatch[2];
frame = frame.slice(0, -locationMatch[0].length);
}
var identifier;
var stackMatch =
CometErrorUtils.getIEFrame(frame) ||
frame.match(ErrorConstants.IE_AND_OTHER_FRAME_PATTERN);
if (stackMatch) {
frame = frame.substring(stackMatch[1].length + 1);
var identifierMatch = stackMatch[1].match(
/(?:at)?\s*(.*)(?:[^\s]+|$)/);
identifier = identifierMatch ? identifierMatch[1] : '';
}
if (ES(frame, "includes", true, 'charset=utf-8;base64,')) {
frame = '<inlined-file>';
}
var stackFrame = {
column: column,
identifier: identifier,
line: line,
script: frame
};
if (sourceResolver) {
sourceResolver(stackFrame);
}
var text =
' at' + (
stackFrame.identifier ? ' ' + stackFrame.identifier + ' (' : ' ') +
stackFrame.script + (
stackFrame.line ? ':' + stackFrame.line : '') + (
stackFrame.column ? ':' + stackFrame.column : '') + (
stackFrame.identifier ? ')' : '');
return babelHelpers["extends"]({},
stackFrame, {
text: text
});
});
}
function pushGuard(name) {
guardList.unshift(name);
isGuarding = true;
}
function popGuard() {
guardList.shift();
isGuarding = guardList.length !== 0;
}
var ErrorUtils = {
ANONYMOUS_GUARD_TAG: ErrorConstants.ANONYMOUS_GUARD_TAG,
GENERATED_GUARD_TAG: GENERATED_GUARD_TAG,
GLOBAL_ERROR_HANDLER_TAG: ErrorConstants.GLOBAL_ERROR_HANDLER_TAG,
history: history,
addListener: function addListener(listener, noPlayback) {
if (noPlayback === void 0) {
noPlayback = false;
}
listeners.push(listener);
if (!noPlayback) {
ES(history, "forEach", true, function (h) {
return listener(h.error, h.loggingType);
});
}
},
removeListener: function removeListener(listener) {
removeFromArray(listeners, listener);
},
setSourceResolver: function setSourceResolver(resolver) {
sourceResolver = resolver;
},
applyWithGuard: function applyWithGuard(
func,
context,
args,
onError,
name,
metaArgs) {
pushGuard(name || ErrorConstants.ANONYMOUS_GUARD_TAG);
if (Env.nocatch) {
nocatch = true;
}
if (nocatch) {
var returnValue;
try {
returnValue = func.apply(context, args || []);
}
finally {
popGuard();
}
return returnValue;
}
try {
return Function.prototype.apply.call(func, context, args || []);
} catch (ex) {
var usedException = ex;
if (usedException == null) {
try {
var contextValue = context;
var makeString = function makeString(v) {
if (v == null) {
return '<unset>';
} else if (typeof v === 'object' && v.toString) {
return v.toString();
} else if (typeof v === 'boolean' && v.toString) {
return v.toString();
} else if (typeof v === 'number' && v.toString) {
return v.toString();
} else if (typeof v === 'string') {
return v;
} else if (typeof v === 'symbol' && v.toString) {
return v.toString();
} else if (typeof v === 'function' && v.toString) {
return v.toString();
}
return '<unset>';
};
if (context != null) {
if (context == window) {
contextValue = '[The window object]';
} else if (context == global) {
contextValue = '[The global object]';
} else {
var _context = context;
var _contextValue = {};
ES(ES("Object", "keys", false, _context), "map", true, function (key, index) {
var value = _context[key];
_contextValue[key] = makeString(value);
});
contextValue = _contextValue;
}
}
var argsValue = ES(args || [], "map", true, makeString);
var errorMessageFormat =
'applyWithGuard threw null or undefined:\nFunc: %s\nContext: %s\nArgs: %s';
var functionString =
func.toString && func.toString().substr(0, 1024);
var contextString = ES("JSON", "stringify", false, contextValue).substr(0, 1024);
var argsString = ES("JSON", "stringify", false, argsValue).substr(0, 1024);
var errorMessage = sprintf(
errorMessageFormat,
functionString ?
functionString :
'this function does not support toString',
contextString,
argsString);
usedException = new Error(errorMessage);
usedException.messageWithParams = [
errorMessageFormat,
functionString ?
functionString :
'this function does not support toString',
contextString,
argsString];
} catch (exn) {
var failedErrorMessageFormat =
'applyWithGuard threw null or undefined with unserializable data:\nFunc: %s\nMetaEx: %s';
var _functionString =
func.toString && func.toString().substr(0, 1024);
var failedErrorMessage = sprintf(
failedErrorMessageFormat,
_functionString ?
_functionString :
'this function does not support toString',
exn.message);
usedException = new Error(failedErrorMessage);
usedException.messageWithParams = [
failedErrorMessage,
_functionString ?
_functionString :
'this function does not support toString',
exn.message];
}
}
if (metaArgs && metaArgs.deferredSource) {
usedException.deferredSource = metaArgs.deferredSource;
}
var err = ErrorUtils.normalizeError(usedException);
if (onError) {
onError(err);
}
if (!err.extra) {
err.extra = {};
}
if (func) {
try {
err.extra[func.toString().substring(0, 100)] = 'function';
} catch (e) {}
}
if (args) {
err.extra[
ES("Array", "from", false, args).
toString().
substring(0, 100)] =
'args';
}
err.guard = guardList[0];
err.guardList = guardList.slice();
if (__DEV__) {
if (!nocatch && !ErrorUtils.applyWithGuard.warned) {
console.warn(
'Note: Error catching is enabled, which may lead to ' +
'misleading stack traces in the JS debugger. To disable, ' +
'whitelist yourself in the "js_nocatch" gatekeeper. See ' +
'ErrorUtils.js for more info.');
ErrorUtils.applyWithGuard.warned = true;
}
}
ErrorUtils.reportError(err, false, 'GUARDED');
}
finally {
popGuard();
}
},
guard: function guard(f, name, context) {
name = name || f.name || GENERATED_GUARD_TAG;
function guarded() {
return ErrorUtils.applyWithGuard(
f,
context || this, [].concat(Array.prototype.slice.call(
arguments)),
null,
name);
}
if (f.__SMmeta) {
guarded.__SMmeta = f.__SMmeta;
}
if (__DEV__) {
guarded.toString = ES(f.toString, "bind", true, f);
}
return guarded;
},
inGuard: function inGuard() {
return isGuarding;
},
normalizeError: function normalizeError(err) {
var originalError = err;
err = err != null ? err : {};
if (Object.prototype.hasOwnProperty.call(err, '_originalError')) {
return err;
}
var stackData = normalizeErrorStack(err);
var stackPopped = false;
if (err.framesToPop) {
var framesToPop = err.framesToPop;
var lastPoppedFrame;
while (framesToPop > 0 && stackData.length > 0) {
lastPoppedFrame = stackData.shift();
framesToPop--;
stackPopped = true;
}
if (
TYPECHECKER_ERROR_PATTERN.test(err.message) &&
err.framesToPop === 2 &&
lastPoppedFrame) {
if (HTTP_OR_HTTPS_URI_PATTERN.test(lastPoppedFrame.script)) {
err.message +=
' at ' +
lastPoppedFrame.script + (
lastPoppedFrame.line ? ':' + lastPoppedFrame.line : '') + (
lastPoppedFrame.column ? ':' + lastPoppedFrame.column : '');
}
}
}
var reactComponentStack = CometErrorUtils.getReactComponentStack(
err.reactComponentStackForLogging);
var fbloggerMetadata = err.fbloggerMetadata ? err.fbloggerMetadata : [];
var globalMetadata = ES(FBLoggerMetadata.getGlobalMetadata(), "map", true, function (d) {
return (
d.join(':'));
});
var mergedMetadata = [].concat(fbloggerMetadata, globalMetadata);
if (mergedMetadata.length === 0) {
mergedMetadata = undefined;
}
var info = {
_originalError: originalError,
cerror: false,
column: stackPopped ?
getColumnFromStackData(stackData) :
getColumn(err) || getColumnFromStackData(stackData),
deferredSource: err.deferredSource,
extra: err.extra,
fbloggerMetadata: mergedMetadata,
guard: err.guard,
guardList: err.guardList,
line: stackPopped ?
getLineFromStackData(stackData) :
getLine(err) || getLineFromStackData(stackData),
message: err.message,
messageWithParams: err.messageWithParams,
name: err.name,
reactComponentStack: reactComponentStack,
script: stackPopped ?
getScriptFromStackData(stackData) :
getScript(err) || getScriptFromStackData(stackData),
serverHash: err.serverHash,
snapshot: err.snapshot,
stack: ES(stackData, "map", true, function (frame) {
return frame.text;
}).join('\n'),
stackFrames: stackData,
type: err.type
};
if (typeof info.message === 'string') {
info.messageWithParams = info.messageWithParams || erx(info.message);
} else {
info.messageObject = info.message;
info.message = String(info.message) + ' (' + typeof info.message + ')';
}
if (info.messageWithParams) {
info.message = eprintf.apply(undefined, info.messageWithParams);
}
if (typeof window !== 'undefined' && window && window.location) {
info.windowLocationURL = window.location.href;
}
if (sourceResolver) {
sourceResolver(info);
}
for (var k in info) {
if (info[k] == null) {
delete info[k];
}
}
return info;
},
onerror: function onerror(
message,
script,
line,
column,
error) {
error = error || {};
error.message = error.message || message;
error.script = error.script || script;
error.line = error.line || line;
error.column = error.column || column;
error.guard = ErrorConstants.GLOBAL_ERROR_HANDLER_TAG;
error.guardList = [ErrorConstants.GLOBAL_ERROR_HANDLER_TAG];
ErrorUtils.reportError(error, true, 'FATAL');
},
reportError: function reportError(
err,
quiet,
loggingType) {
if (quiet === void 0) {
quiet = false;
}
if (loggingType === void 0) {
loggingType = 'DEPRECATED';
}
if (isReporting) {
console.error('Error reported during error processing', err);
return false;
}
if (err.reactComponentStack) {
pushGuard(ErrorConstants.GLOBAL_REACT_ERROR_HANDLER_TAG);
}
if (guardList.length > 0) {
err.guard = err.guard || guardList[0];
err.guardList = guardList.slice();
}
if (err.reactComponentStack) {
popGuard();
}
var normalizedError = ErrorUtils.normalizeError(err);
if (!quiet) {
var cons = global.console;
var originalError = normalizedError._originalError;
var originalErrorMessageString =
originalError != null ? "" + originalError.message : '';
if (__DEV__) {
var message = originalErrorMessageString + "\n" + normalizedError.stack;
var originalErrorStringified = String(originalError);
var errorInStandardFormat = "Error: " + originalErrorMessageString;
if (originalErrorStringified !== errorInStandardFormat) {
message += "\nOriginal error: " + originalErrorStringified;
}
if (cons[normalizedError.type]) {
cons[normalizedError.type](message);
} else {
cons.error(message);
}
} else {
if (
(!cons[normalizedError.type] || normalizedError.type === 'error') &&
!hasLoggedAnyProductionError) {
var truncatedErrorMessage =
originalErrorMessageString.length > 80 ?
originalErrorMessageString.slice(0, 77) + "..." :
originalErrorMessageString;
cons.error(
'ErrorUtils caught an error: "' +
truncatedErrorMessage +
'". Subsequent errors won\'t be logged; see ' +
'https://fburl.com/debugjs.');
hasLoggedAnyProductionError = true;
}
}
}
if (history.length > MAX_HISTORY) {
history.splice(MAX_HISTORY / 2, 1);
}
history.push({
error: normalizedError,
loggingType: loggingType
});
isReporting = true;
for (var i = 0; i < listeners.length; i++) {
try {
listeners[i](normalizedError, loggingType);
} catch (e) {
console.error('Error thrown from listener during error processing', e);
}
}
isReporting = false;
return true;
}
};
global.onerror = ErrorUtils.onerror;
module.exports = global.ErrorUtils = ErrorUtils;
if (typeof __t === 'function' && __t.setHandler) {
__t.setHandler(ErrorUtils.reportError);
}
}, 3);
__d("defaultTo", [], (function $module_defaultTo(global, require, requireDynamic, requireLazy, module, exports) {
'use strict';
function defaultTo(checkValue, defaultValue) {
return checkValue == null ?
defaultValue :
typeof checkValue === 'string' && checkValue === '' ?
defaultValue :
checkValue;
}
module.exports = defaultTo;
}), null);
__d("ErrorGuard", ["CometErrorUtils", "ErrorConstants", "defaultTo"], function $module_ErrorGuard(global, require, requireDynamic, requireLazy, module, exports, CometErrorUtils, ErrorConstants, defaultTo) {
'use strict';
var isReporting = false;
var hasLoggedAnyProductionError = false;
var history = [];
var MAX_HISTORY = 50;
var listeners = [];
var ErrorGuard = {
guardList: [],
isGuarding: false,
addListener: function addListener(listener, noPlayback) {
if (noPlayback === void 0) {
noPlayback = false;
}
listeners.push(listener);
if (!noPlayback) {
ES(history, "forEach", true, function (h) {
return listener(h.error, h.loggingType);
});
}
},
applyWithGuard: function applyWithGuard(
func,
context,
args,
metaArgs) {
ErrorGuard.pushGuard(
metaArgs && metaArgs.name != null && metaArgs.name !== '' ?
metaArgs.name :
ErrorConstants.ANONYMOUS_GUARD_TAG);
try {
return Function.prototype.apply.call(func, context, args || []);
} catch (ex) {
var err = CometErrorUtils.normalizeError(ex);
if (metaArgs && metaArgs.deferredSource) {
err.deferredSource = metaArgs.deferredSource;
}
if (metaArgs && metaArgs.onError) {
metaArgs.onError(err);
}
if (err.extra == null) {
err.extra = {};
}
if (typeof err.extra === 'object') {
if (func) {
try {
err.extra[func.toString().substring(0, 100)] = 'function';
} catch (e) {}
}
if (args) {
err.extra[
ES("Array", "from", false, args).
toString().
substring(0, 100)] =
'args';
}
}
err.guard = ErrorGuard.guardList[0];
err.guardList = ErrorGuard.guardList.slice();
if (__DEV__) {
console.error(err);
}
ErrorGuard.reportError(err, false, 'GUARDED');
}
finally {
ErrorGuard.popGuard();
}
return null;
},
onerror: function onerror(
message,
script,
line,
column,
originalError) {
var error = originalError || new Error(message);
error.message = error.message || message;
error.lineNumber = Number(defaultTo(String(error.lineNumber), line));
error.columnNumber = Number(defaultTo(String(error.columnNumber), column));
error = CometErrorUtils.normalizeError(error);
error.script = defaultTo(error.script, script);
error.guard = ErrorConstants.GLOBAL_ERROR_HANDLER_TAG;
error.guardList = [ErrorConstants.GLOBAL_ERROR_HANDLER_TAG];
ErrorGuard.reportError(error, true, 'FATAL');
},
popGuard: function popGuard() {
ErrorGuard.guardList.shift();
ErrorGuard.isGuarding = ErrorGuard.guardList.length !== 0;
},
pushGuard: function pushGuard(name) {
ErrorGuard.guardList.unshift(name);
ErrorGuard.isGuarding = true;
},
removeListener: function removeListener(listener) {
var index = ES(history, "indexOf", true, listener);
if (index !== -1) {
history.splice(index, 1);
}
},
reportError: function reportError(
error,
quiet,
loggingType) {
if (quiet === void 0) {
quiet = false;
}
if (loggingType === void 0) {
loggingType = 'DEPRECATED';
}
if (isReporting) {
return false;
}
error.cerror = true;
if (error.reactComponentStack == null) {
ErrorGuard.pushGuard(ErrorConstants.GLOBAL_REACT_ERROR_HANDLER_TAG);
}
if (ErrorGuard.guardList.length > 0) {
var _error$guard;
error.guard = (_error$guard = error.guard) != null ? _error$guard : ErrorGuard.guardList[0];
error.guardList = ErrorGuard.guardList.slice();
}
if (error.reactComponentStack) {
ErrorGuard.popGuard();
}
if (!quiet) {
var cons = global.console;
var originalErrorMessageString = "" + error.message;
if (__DEV__) {
var message = originalErrorMessageString + "\n" + error.stack;
var originalErrorStringified = String(error);
var errorInStandardFormat = "Error: " + originalErrorMessageString;
if (originalErrorStringified !== errorInStandardFormat) {
message += "\nOriginal error: " + originalErrorStringified;
}
if (cons[error.type]) {
cons[error.type](message);
} else {
cons.error(message);
}
} else {
if (
(!cons[error.type] || error.type === 'error') &&
!hasLoggedAnyProductionError) {
var truncatedErrorMessage =
originalErrorMessageString.length > 80 ?
originalErrorMessageString.slice(0, 77) + "..." :
originalErrorMessageString;
cons.error(
'ErrorUtils caught an error: "' +
truncatedErrorMessage +
'". Subsequent errors won\'t be logged; see ' +
'https://fburl.com/debugjs.');
hasLoggedAnyProductionError = true;
}
}
}
if (history.length > MAX_HISTORY) {
history.splice(MAX_HISTORY / 2, 1);
}
history.push({
error: error,
loggingType: loggingType
});
isReporting = true;
for (var i = 0; i < listeners.length; i++) {
try {
listeners[i](error, loggingType);
} catch (e) {
console.error('Error thrown from listener during error processing', e);
}
}
isReporting = false;
return true;
}
};
global.onerror = ErrorGuard.onerror;
module.exports = ErrorGuard;
}, null);
__d("FBLogMessageCore", ["CometErrorUtils", "ErrorGuard"], function $module_FBLogMessageCore(global, require, requireDynamic, requireLazy, module, exports, CometErrorUtils, ErrorGuard) {
'use strict';
var levelMap = {
info: 'log',
mustfix: 'error',
warn: 'warn'
};
function printingFunction(format) {
for (var _len = arguments.length, rawArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
rawArgs[_key - 1] = arguments[_key];
}
return "<![EX[" + ES("JSON", "stringify", false, [
format].concat(ES(
rawArgs, "map", true, function (arg) {
return String(arg);
}))) + "]]";
}
function FBLogMessageCore(project) {
this.project = project;
}
FBLogMessageCore.prototype.
$FBLogMessageCore_log = function (
level,
format) {
var error;
for (var _len2 = arguments.length, params = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
params[_key2 - 2] = arguments[_key2];
}
if (this.error) {
error = this.error;
var wrappedFormat = format + ' from %s: %s';
params.push(error.name);
params.push(error.message);
error.message = printingFunction.apply(undefined, [wrappedFormat].concat(params));
} else {
error = new Error(printingFunction.apply(undefined, [format].concat(params)));
}
if (this.error && ES(error.name, "startsWith", true, '<level:')) {
var logger = new FBLogMessageCore('fblogger');
logger.warn('Double logging detected');
}
var errorDescription =
'FBLogger' + (this.error ? " caught " + error.name : '');
error.name = "<level:" + level + "> <name:" + this.project + "> " + errorDescription;
var normalizedError = CometErrorUtils.normalizeError(error);
normalizedError.type = levelMap[level];
ErrorGuard.reportError(normalizedError, false, 'FBLOGGER');
};
FBLogMessageCore.prototype.
mustfix = function (format) {
for (var _len3 = arguments.length, params = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
params[_key3 - 1] = arguments[_key3];
}
this.$FBLogMessageCore_log.apply(this, ['mustfix', format].concat(params));
};
FBLogMessageCore.prototype.
warn = function (format) {
for (var _len4 = arguments.length, params = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
params[_key4 - 1] = arguments[_key4];
}
this.$FBLogMessageCore_log.apply(this, ['warn', format].concat(params));
};
FBLogMessageCore.prototype.
info = function (format) {
if (__DEV__) {
for (var _len5 = arguments.length, params = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
params[_key5 - 1] = arguments[_key5];
}
this.$FBLogMessageCore_log.apply(this, ['info', format].concat(params));
}
};
FBLogMessageCore.prototype.
debug = function (format) {};
FBLogMessageCore.prototype.
catching = function (error) {
if (!(error instanceof Error)) {
new FBLogMessageCore('fblogger').warn(
'Catching non-Error object is not supported');
} else {
this.error = error;
}
return this;
};
module.exports = FBLogMessageCore;
}, null);
__d("FBLogMessage", ["ErrorUtils", "FBLoggerMetadata", "FBLogMessageCore", "TAAL", "TAALOpcodes", "erx", "ex", "sprintf"], function $module_FBLogMessage(global, require, requireDynamic, requireLazy, module, exports, ErrorUtils, FBLoggerMetadata, FBLogMessageCore, TAAL, TAALOpcodes, erx, ex, sprintf) {
'use strict';
var _FBLogMessageCore,
_superProto;
var levelMap = {
mustfix: 'error',
warn: 'warn',
info: 'log'
};
var printingFunction = ex;
var times = function times(x) {
return function (f) {
if (x > 0) {
f();
times(x - 1)(f);
}
};
};
_FBLogMessageCore = babelHelpers.inherits(
FBLogMessage, FBLogMessageCore);
_superProto = _FBLogMessageCore && _FBLogMessageCore.prototype;
function FBLogMessage(project) {
_superProto.constructor.call(this, project);
this.metadata = new FBLoggerMetadata();
this.taalOpcodes = [];
}
FBLogMessage.prototype.
$FBLogMessage_log = function (
level,
format) {
var framesToPop = 2;
if (format === undefined) {
var logger = new FBLogMessage('fblogger');
times(framesToPop)(function () {
return logger.blameToPreviousFrame();
});
logger.mustfix(
'You provided an undefined format string to FBLogger, dropping log line');
return;
}
var error;
for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
params[_key - 2] = arguments[_key];
}
if (this.error) {
error = this.error;
var wrappedFormat = format + ' from %s: %s';
params.push(error.name);
params.push(error.message ? sprintf.apply(null, erx(error.message)) : '');
error.message = printingFunction.apply(undefined, [wrappedFormat].concat(params));
} else {
times(framesToPop)(ES(function () {
return (
this.taalOpcodes.unshift(TAALOpcodes.previousFrame()));
}, "bind", true, this));
if (this.taalOpcodes) {
var taalFormat = TAAL.applyOpcodes(format, this.taalOpcodes);
error = new Error(printingFunction.apply(undefined, [taalFormat].concat(params)));
} else {
error = new Error(printingFunction.apply(undefined, [format].concat(params)));
}
}
if (this.error && ES(error.name, "startsWith", true, '<level:')) {
var _logger = new FBLogMessage('fblogger');
times(framesToPop)(function () {
return _logger.blameToPreviousFrame();
});
_logger.warn('Double logging detected');
}
var errorDescription =
'FBLogger' + (this.error ? " caught " + error.name : '');
error.name = sprintf(
'<level:%s> <name:%s> %s',
level,
this.project,
errorDescription);
error = ErrorUtils.normalizeError(error);
if (!this.metadata.isEmpty()) {
var _this$metadata$getAll =
this.metadata.getAll(),
invalidMetadata = _this$metadata$getAll.invalidMetadata,
validMetadata = _this$metadata$getAll.validMetadata;
if (invalidMetadata.length > 0) {
var _logger2 = new FBLogMessage('fblogger');
times(framesToPop)(function () {
return _logger2.blameToPreviousFrame();
});
_logger2.warn(
'Metadata cannot contain colon %s',
ES(invalidMetadata, "map", true, function (entry) {
return entry.join(':');
}).join(' '));
}
error.fbloggerMetadata = ES(validMetadata, "map", true, function (entry) {
return entry.join(':');
});
}
var type = levelMap[level];
error.type = type;
if (this.error) {
if (this.taalOpcodes && this.taalOpcodes.length) {
var _logger3 = new FBLogMessage('fblogger');
times(framesToPop)(function () {
return _logger3.blameToPreviousFrame();
});
_logger3.warn('Blame helpers do not work with catching');
}
}
ErrorUtils.reportError(error, false, 'FBLOGGER');
};
FBLogMessage.prototype.
mustfix = function (format) {
for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
params[_key2 - 1] = arguments[_key2];
}
this.$FBLogMessage_log.apply(this, ['mustfix', format].concat(params));
};
FBLogMessage.prototype.
warn = function (format) {
for (var _len3 = arguments.length, params = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
params[_key3 - 1] = arguments[_key3];
}
this.$FBLogMessage_log.apply(this, ['warn', format].concat(params));
};
FBLogMessage.prototype.
info = function (format) {
if (__DEV__) {
for (var _len4 = arguments.length, params = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
params[_key4 - 1] = arguments[_key4];
}
this.$FBLogMessage_log.apply(this, ['info', format].concat(params));
}
};
FBLogMessage.prototype.
debug = function (format) {};
FBLogMessage.prototype.
catching = function (error) {
if (!(error instanceof Error)) {
new FBLogMessage('fblogger').
blameToPreviousFrame().
warn('Catching non-Error object is not supported');
} else {
_superProto.catching.call(this, error);
}
return this;
};
FBLogMessage.prototype.
blameToPreviousFile = function () {
this.taalOpcodes.push(TAALOpcodes.previousFile());
return this;
};
FBLogMessage.prototype.
blameToPreviousFrame = function () {
this.taalOpcodes.push(TAALOpcodes.previousFrame());
return this;
};
FBLogMessage.prototype.
blameToPreviousDirectory = function () {
this.taalOpcodes.push(TAALOpcodes.previousDirectory());
return this;
};
FBLogMessage.prototype.
addMetadata = function (product, name, value) {
this.metadata.addMetadata(product, name, value);
return this;
};
module.exports = FBLogMessage;
}, null);
__d("FBLogger", ["FBLoggerMetadata", "FBLogMessage"], (function $module_FBLogger(global, require, requireDynamic, requireLazy, module, exports, FBLoggerMetadata, FBLogMessage) {
'use strict';
var FBLogger = function FBLogger(project) {
return new FBLogMessage(project);
};
FBLogger.addGlobalMetadata = function (product, name, value) {
FBLoggerMetadata.addGlobalMetadata(product, name, value);
};
module.exports = FBLogger;
}), null);
__d("WebStorage", ["FBLogger", "ex"], function $module_WebStorage(global, require, requireDynamic, requireLazy, module, exports, FBLogger, ex) {
'use strict';
var storageCache = {};
var storageCacheForRead = {};
function getCachedStorage(
cache,
fn,
storageName) {
if (!Object.prototype.hasOwnProperty.call(storageCache, storageName)) {
storageCache[storageName] = fn(storageName);
}
return storageCache[storageName];
}
function getStorageForRead(storageName) {
try {
return window[storageName];
} catch (e) {
FBLogger('web_storage').warn(
'Failed to get storage for read %s',
e.message);
}
return null;
}
function getStorage(storageName) {
try {
var storage = window[storageName];
if (storage) {
var key = '__test__' + ES("Date", "now", false);
storage.setItem(key, '');
storage.removeItem(key);
}
return storage;
} catch (e) {
FBLogger('web_storage').warn('Failed to get storage %s', e.message);
}
return null;
}
function getKeys(storage) {
var keys = [];
for (var i = 0; i < storage.length; i++) {
keys.push(storage.key(i) || '');
}
return keys;
}
function setItemGuarded(storage, key, value) {
if (storage == null) {
return new Error('storage cannot be null');
}
var err = null;
try {
storage.setItem(key, value);
} catch (e) {
var keys = ES(getKeys(storage), "map", true, function (key) {
var len = (storage.getItem(key) || '').length;
return key + '(' + len + ')';
});
err = new Error(
ex(
'%sStorage quota exceeded while setting %s(%s). ' +
'Items(length) follows: %s',
e.name ? e.name + ': ' : '',
key,
value.length,
keys.join()));
FBLogger('web_storage').
catching(err).
mustfix('Error set item');
}
return err;
}
var WebStorage = {
getLocalStorage: function getLocalStorage() {
return getCachedStorage(storageCache, getStorage, 'localStorage');
},
getSessionStorage: function getSessionStorage() {
return getCachedStorage(storageCache, getStorage, 'sessionStorage');
},
getLocalStorageForRead: function getLocalStorageForRead() {
return getCachedStorage(
storageCacheForRead,
getStorageForRead,
'localStorage');
},
getSessionStorageForRead: function getSessionStorageForRead() {
return getCachedStorage(
storageCacheForRead,
getStorageForRead,
'sessionStorage');
},
setItemGuarded: setItemGuarded
};
module.exports = WebStorage;
}, null);
__d("InstantExperiencesDebuggerUtils", ["URI", "WebStorage"], function $module_InstantExperiencesDebuggerUtils(global, require, requireDynamic, requireLazy, module, exports, URI, WebStorage) {
'use strict';
function isDebugModeEnabled() {
if (getAppID()) {
return true;
}
return false;
}
function getAppID() {
var storage = WebStorage.getLocalStorage();
if (!storage) {
return null;
}
return storage.getItem('com.facebook.fbextensions.debug_mode');
}
function getURI(path, appID, callbackParamsString) {
var callbackParamsObject = {
callback_params: ES("JSON", "parse", false, callbackParamsString)
};
var uri = new URI().
setDomain('www.facebook.com').
setProtocol('https').
setPath(path.replace('{app_id}', appID));
uri.addQueryData(callbackParamsObject);
return uri;
}
module.exports = {
isDebugModeEnabled: isDebugModeEnabled,
getAppID: getAppID,
getURI: getURI
};
}, null);
__d("InstantExperiencesDebuggerDialogCall", ["InstantExperiencesDebuggerUtils", "sdk.URI"], function $module_InstantExperiencesDebuggerDialogCall(global, require, requireDynamic, requireLazy, module, exports, InstantExperiencesDebuggerUtils, URI) {
'use strict';
function InstantExperiencesDebuggerDialogCall(
callbackParamsString,
callbackHandler,
dialogWidth,
dialogHeight) {
this.
__isDialogOriginValid = function (origin) {
if (!origin) {
return false;
}
var originUri = new URI(origin);
if (
originUri.getDomain() !== this.uri.getDomain() ||
originUri.getProtocol() !== 'https') {
return false;
}
return true;
};
this.
__handleResult = ES(function (event) {
if (!this.__isDialogOriginValid(event.origin)) {
return;
}
var eventData = event.data;
var callbackID = ES("JSON", "parse", false, this.callbackParamsString).callbackID;
if (!event.data || !eventData[callbackID]) {
return;
}
var result = ES("JSON", "parse", false, eventData[callbackID]);
if (!result.requestUpdate) {
window.removeEventListener('message', this.__handleResult);
}
if (result.success) {
this.callbackHandler(true, callbackID, eventData[callbackID]);
return;
}
this.callbackHandler(false, callbackID, eventData[callbackID]);
}, "bind", true, this);
var appID = InstantExperiencesDebuggerUtils.getAppID();
if (!appID) {
throw new Error('Unable to find app ID');
}
this.appID = appID;
this.callbackHandler = callbackHandler;
this.callbackParamsString = callbackParamsString;
this.dialogWidth = dialogWidth ? dialogWidth : 600;
this.dialogHeight = dialogHeight ? dialogHeight : 450;
this.dialogWindow = null;
}
InstantExperiencesDebuggerDialogCall.prototype.setDialogUri = function (uri) {
this.uri = uri;
};
InstantExperiencesDebuggerDialogCall.prototype.
openDialog = function () {
var top =
window.innerHeight / 2 - this.dialogHeight / 2 + window.screenTop;
var left =
window.innerWidth / 2 - this.dialogWidth / 2 + window.screenLeft;
this.dialogWindow = window.open(
this.uri,
'InstantExperiencesDeveloperDialog',
'width=' +
this.dialogWidth +
',height=' +
this.dialogHeight +
',top=' +
top +
',left=' +
left);
window.addEventListener('message', ES(this.__handleResult, "bind", true, this));
};
module.exports = InstantExperiencesDebuggerDialogCall;
}, null);
__d("InstantExperiencesDeveloperDialogPaths", [], function $module_InstantExperiencesDeveloperDialogPaths(global, require, requireDynamic, requireLazy, module, exports) {
module.exports = ES("Object", "freeze", false, {
"CAN_MAKE_PAYMENT_PATH": "\/instantexperiences\/developer_dialog\/{app_id}\/canmakepayment\/",
"GET_USER_ID_PATH": "\/instantexperiences\/developer_dialog\/{app_id}\/getuserid\/",
"PAYMENTS_CHECKOUT_PATH": "\/instantexperiences\/developer_dialog\/{app_id}\/paymentscheckout\/",
"REQUEST_FORM_FIELDS_PATH": "\/instantexperiences\/developer_dialog\/{app_id}\/requestformfields\/"
});
}, null);
__d("InstantExperiencesDebuggerCanMakePaymentDialogCall", ["InstantExperiencesDebuggerDialogCall", "InstantExperiencesDebuggerUtils", "InstantExperiencesDeveloperDialogPaths"], function $module_InstantExperiencesDebuggerCanMakePaymentDialogCall(global, require, requireDynamic, requireLazy, module, exports, InstantExperiencesDebuggerDialogCall, InstantExperiencesDebuggerUtils, InstantExperiencesDeveloperDialogPaths) {
'use strict';
var _InstantExperiencesDe,
_superProto;
_InstantExperiencesDe = babelHelpers.inherits(
InstantExperiencesDebuggerCanMakePaymentDialogCall, InstantExperiencesDebuggerDialogCall);
_superProto = _InstantExperiencesDe && _InstantExperiencesDe.prototype;
function InstantExperiencesDebuggerCanMakePaymentDialogCall(callbackParams, callbackHandler) {
_superProto.constructor.call(this, callbackParams, callbackHandler);
this.setDialogUri(
InstantExperiencesDebuggerUtils.getURI(
InstantExperiencesDeveloperDialogPaths.CAN_MAKE_PAYMENT_PATH,
this.appID,
callbackParams));
}
module.exports = InstantExperiencesDebuggerCanMakePaymentDialogCall;
}, null);
__d("InstantExperiencesDebuggerGetUserIDDialogCall", ["InstantExperiencesDebuggerDialogCall", "InstantExperiencesDebuggerUtils", "InstantExperiencesDeveloperDialogPaths"], function $module_InstantExperiencesDebuggerGetUserIDDialogCall(global, require, requireDynamic, requireLazy, module, exports, InstantExperiencesDebuggerDialogCall, InstantExperiencesDebuggerUtils, InstantExperiencesDeveloperDialogPaths) {
'use strict';
var _InstantExperiencesDe,
_superProto;
_InstantExperiencesDe = babelHelpers.inherits(
InstantExperiencesDebuggerGetUserIDDialogCall, InstantExperiencesDebuggerDialogCall);
_superProto = _InstantExperiencesDe && _InstantExperiencesDe.prototype;
function InstantExperiencesDebuggerGetUserIDDialogCall(
callbackParamsString,
callbackHandler,
dialogWidth,
dialogHeight) {
_superProto.constructor.call(this, callbackParamsString, callbackHandler, dialogWidth, dialogHeight);
this.setDialogUri(
InstantExperiencesDebuggerUtils.getURI(
InstantExperiencesDeveloperDialogPaths.GET_USER_ID_PATH,
this.appID,
callbackParamsString));
}
module.exports = InstantExperiencesDebuggerGetUserIDDialogCall;
}, null);
__d("InstantExperiencesDebuggerPaymentsCheckoutDialogCall", ["InstantExperiencesDebuggerDialogCall", "InstantExperiencesDebuggerUtils", "InstantExperiencesDeveloperDialogPaths"], function $module_InstantExperiencesDebuggerPaymentsCheckoutDialogCall(global, require, requireDynamic, requireLazy, module, exports, InstantExperiencesDebuggerDialogCall, InstantExperiencesDebuggerUtils, InstantExperiencesDeveloperDialogPaths) {
'use strict';
var _InstantExperiencesDe,
_superProto;
_InstantExperiencesDe = babelHelpers.inherits(
InstantExperiencesDebuggerPaymentsCheckoutDialogCall, InstantExperiencesDebuggerDialogCall);
_superProto = _InstantExperiencesDe && _InstantExperiencesDe.prototype;
function InstantExperiencesDebuggerPaymentsCheckoutDialogCall(callbackParams, callbackHandler) {
_superProto.constructor.call(this, callbackParams, callbackHandler, 420, 850);
this.setDialogUri(
InstantExperiencesDebuggerUtils.getURI(
InstantExperiencesDeveloperDialogPaths.PAYMENTS_CHECKOUT_PATH,
this.appID,
callbackParams));
}
InstantExperiencesDebuggerPaymentsCheckoutDialogCall.prototype.
postMessage = function (callName, callbackParamsString) {
if (this.dialogWindow && !this.dialogWindow.closed) {
this.callbackParamsString = callbackParamsString;
this.dialogWindow.postMessage({
callName: callName,
callData: ES("JSON", "parse", false, callbackParamsString)
},
'https://www.facebook.com');
}
};
InstantExperiencesDebuggerPaymentsCheckoutDialogCall.prototype.
isWindowOpen = function () {
return this.dialogWindow && !this.dialogWindow.closed;
};
module.exports = InstantExperiencesDebuggerPaymentsCheckoutDialogCall;
}, null);
__d("InstantExperiencesDebuggerRequestFormFieldsDialogCall", ["InstantExperiencesDebuggerDialogCall", "InstantExperiencesDebuggerUtils", "InstantExperiencesDeveloperDialogPaths"], function $module_InstantExperiencesDebuggerRequestFormFieldsDialogCall(global, require, requireDynamic, requireLazy, module, exports, InstantExperiencesDebuggerDialogCall, InstantExperiencesDebuggerUtils, InstantExperiencesDeveloperDialogPaths) {
'use strict';
var _InstantExperiencesDe,
_superProto;
_InstantExperiencesDe = babelHelpers.inherits(
InstantExperiencesDebuggerRequestFormFieldsDialogCall, InstantExperiencesDebuggerDialogCall);
_superProto = _InstantExperiencesDe && _InstantExperiencesDe.prototype;
function InstantExperiencesDebuggerRequestFormFieldsDialogCall(
callbackParams,
callbackHandler,
dialogWidth,
dialogHeight) {
_superProto.constructor.call(this, callbackParams, callbackHandler, dialogWidth, dialogHeight);
this.setDialogUri(
InstantExperiencesDebuggerUtils.getURI(
InstantExperiencesDeveloperDialogPaths.REQUEST_FORM_FIELDS_PATH,
this.appID,
callbackParams));
}
module.exports = InstantExperiencesDebuggerRequestFormFieldsDialogCall;
}, null);
__d("InstantExperiencesDebuggerApiBridge", ["InstantExperiencesDebuggerCanMakePaymentDialogCall", "InstantExperiencesDebuggerGetUserIDDialogCall", "InstantExperiencesDebuggerPaymentsCheckoutDialogCall", "InstantExperiencesDebuggerRequestFormFieldsDialogCall"], function $module_InstantExperiencesDebuggerApiBridge(global, require, requireDynamic, requireLazy, module, exports, InstantExperiencesDebuggerCanMakePaymentDialogCall, InstantExperiencesDebuggerGetUserIDDialogCall, InstantExperiencesDebuggerPaymentsCheckoutDialogCall, InstantExperiencesDebuggerRequestFormFieldsDialogCall) {
'use strict';
InstantExperiencesDebuggerApiBridge.prototype.
initializeCallbackHandler = function (callParamsString) {
var callParams = ES("JSON", "parse", false, callParamsString);
this.callbackHandler = window[callParams.name];
};
InstantExperiencesDebuggerApiBridge.prototype.
getUserID = function (callbackParamsString) {
try {
var callHandler = new InstantExperiencesDebuggerGetUserIDDialogCall(
callbackParamsString,
this.callbackHandler);
callHandler.openDialog();
} catch (e) {
console.warn(e.message);
return;
}
};
InstantExperiencesDebuggerApiBridge.prototype.
requestFormFields = function (callbackParamsString) {
try {
var callHandler = new InstantExperiencesDebuggerRequestFormFieldsDialogCall(
callbackParamsString,
this.callbackHandler,
600,
640);
callHandler.openDialog();
} catch (e) {
console.warn(e.message);
return;
}
};
InstantExperiencesDebuggerApiBridge.prototype.
canMakePayment = function (callbackParamsString) {
try {
var callHandler = new InstantExperiencesDebuggerCanMakePaymentDialogCall(
callbackParamsString,
this.callbackHandler);
callHandler.openDialog();
} catch (e) {
console.warn(e.message);
return;
}
};
InstantExperiencesDebuggerApiBridge.prototype.
canShowPaymentModule = function (callbackParamsString) {
try {
var callbackID = ES("JSON", "parse", false, callbackParamsString).callbackID;
var result = {
success: true,
canShowPaymentModule: !(
this.paymentsCallHandler && this.paymentsCallHandler.isWindowOpen())
};
this.callbackHandler(true, callbackID, ES("JSON", "stringify", false, result));
} catch (e) {
console.warn(e.message);
return;
}
};
InstantExperiencesDebuggerApiBridge.prototype.
paymentsCheckout = function (callbackParamsString) {
try {
if (this.paymentsCallHandler && this.paymentsCallHandler.isWindowOpen()) {
var result = {
success: false,
errorCode: 0,
errorMessage: 'Payments window already exists'
};
var callbackID = ES("JSON", "parse", false, callbackParamsString).callbackID;
this.callbackHandler(false, callbackID, ES("JSON", "stringify", false, result));
return;
}
this.paymentsCallHandler = new InstantExperiencesDebuggerPaymentsCheckoutDialogCall(
callbackParamsString,
this.callbackHandler);
this.paymentsCallHandler.openDialog();
} catch (e) {
console.warn(e.message);
return;
}
};
InstantExperiencesDebuggerApiBridge.prototype.
paymentsCheckoutChargeRequestSuccessReturn = function (callbackParamsString) {
this.$InstantExperiencesDebuggerApiBridge_postMessageToCurrentDialog(
'paymentsCheckoutChargeRequestSuccessReturn',
callbackParamsString);
};
InstantExperiencesDebuggerApiBridge.prototype.
paymentsCheckoutChargeRequestUnknownReturn = function (callbackParamsString) {
this.$InstantExperiencesDebuggerApiBridge_postMessageToCurrentDialog(
'paymentsCheckoutChargeRequestErrorReturn',
callbackParamsString);
};
InstantExperiencesDebuggerApiBridge.prototype.
paymentsCheckoutChargeRequestErrorReturn = function (callbackParamsString) {
this.$InstantExperiencesDebuggerApiBridge_postMessageToCurrentDialog(
'paymentsCheckoutChargeRequestUnknownReturn',
callbackParamsString);
};
InstantExperiencesDebuggerApiBridge.prototype.
paymentsCheckoutShippingAddressReturn = function (callbackParamsString) {
this.$InstantExperiencesDebuggerApiBridge_postMessageToCurrentDialog(
'paymentsCheckoutShippingAddressReturn',
callbackParamsString);
};
InstantExperiencesDebuggerApiBridge.prototype.
paymentsCheckoutShippingOptionReturn = function (callbackParamsString) {
this.$InstantExperiencesDebuggerApiBridge_postMessageToCurrentDialog(
'paymentsCheckoutShippingOptionReturn',
callbackParamsString);
};
InstantExperiencesDebuggerApiBridge.prototype.
$InstantExperiencesDebuggerApiBridge_postMessageToCurrentDialog = function (callName, callbackParamsString) {
if (this.paymentsCallHandler) {
this.paymentsCallHandler.postMessage(callName, callbackParamsString);
}
};
function InstantExperiencesDebuggerApiBridge() {}
module.exports = InstantExperiencesDebuggerApiBridge;
}, null);
__d("sdk.Event", [], function $module_sdk_Event(global, require, requireDynamic, requireLazy, module, exports) {
'use strict';
var Event = {
SUBSCRIBE: 'event.subscribe',
UNSUBSCRIBE: 'event.unsubscribe',
subscribers: function subscribers() {
if (!this._subscribersMap) {
this._subscribersMap = {};
}
return this._subscribersMap;
},
subscribe: function subscribe(name, cb) {
var subs = this.subscribers();
if (!subs[name]) {
subs[name] = [cb];
} else {
if (ES(subs[name], "indexOf", true, cb) == -1) {
subs[name].push(cb);
}
}
if (name != this.SUBSCRIBE && name != this.UNSUBSCRIBE) {
this.fire(this.SUBSCRIBE, name, subs[name]);
}
},
unsubscribe: function unsubscribe(name, cb) {
var subs = this.subscribers()[name];
if (subs) {
ES(subs, "forEach", true, function (value, key) {
if (value === cb) {
subs.splice(key, 1);
}
});
}
if (name != this.SUBSCRIBE && name != this.UNSUBSCRIBE) {
this.fire(this.UNSUBSCRIBE, name, subs);
}
},
monitor: function monitor(name, callback) {
if (!callback()) {
var ctx = this;
var fn = function fn() {
if (callback.apply(callback, arguments)) {
ctx.unsubscribe(name, fn);
}
};
this.subscribe(name, fn);
}
},
clear: function clear(name) {
delete this.subscribers()[name];
},
fire: function fire(name) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var subs = this.subscribers()[name];
if (subs) {
ES(subs, "forEach", true, function (sub) {
if (sub) {
sub.apply(this, args);
}
});
}
}
};
module.exports = Event;
}, null);
__d("BrowserExtensions", ["BrowserExtensions.DesktopBridge", "BrowserExtensions.DeviceTypes", "BrowserExtensions.ErrorHandling", "InstantExperiencesDebuggerApiBridge", "InstantExperiencesDebuggerUtils", "errorCode", "guid", "sdk.Event"], function $module_BrowserExtensions(global, require, requireDynamic, requireLazy, module, exports, DesktopBridge, DeviceTypes, ErrorHandling, InstantExperiencesDebuggerApiBridge, InstantExperiencesDebuggerUtils, errorCode, guid, Event) {
'use strict';
var externalInterface = {};
var callbackMap = {};
var currentDevice = DeviceTypes.getDeviceType();
var extensionAPIBridge = null;
setTimeout(function () {
extensionAPIBridge = getAPIBridge();
if (extensionAPIBridge) {
window._FBCallbackHandler = fbCallbackHandler;
var callParamsJSON = ES("JSON", "stringify", false, {
name: '_FBCallbackHandler'
});
if (extensionAPIBridge instanceof InstantExperiencesDebuggerApiBridge) {
console.warn('Instant Experiences debug mode is enabled');
extensionAPIBridge.initializeCallbackHandler(callParamsJSON);
} else {
switch (currentDevice) {
case DeviceTypes.IOS:
if (extensionAPIBridge.initializeCallbackHandler) {
extensionAPIBridge.initializeCallbackHandler.postMessage(
callParamsJSON);
}
break;
case DeviceTypes.ANDROID:
if (extensionAPIBridge.initializeCallbackHandler) {
extensionAPIBridge.initializeCallbackHandler(callParamsJSON);
}
break;
case DeviceTypes.WEB:
extensionAPIBridge.init();
break;
default:
break;
}
}
}
if (window.extAsyncInit && !window.extAsyncInit.hasRun) {
window.extAsyncInit.hasRun = true;
ErrorHandling.unguard(window.extAsyncInit)();
}
if (extensionAPIBridge && extensionAPIBridge.getNonce) {
callNativeBridge(
'getNonce',
function (nonceResult) {
window._FBNonce = nonceResult.nonce;
fireBridgeReady();
},
function () {}, {});
} else {
fireBridgeReady();
}
}, 0);
function fireBridgeReady() {
Event.fire('browserExtensions.bridgeReady');
}
function getAPIBridge() {
if (InstantExperiencesDebuggerUtils.isDebugModeEnabled()) {
return new InstantExperiencesDebuggerApiBridge();
}
switch (currentDevice) {
case DeviceTypes.ANDROID:
return window._FBExtensions;
case DeviceTypes.IOS:
return window.webkit && window.webkit.messageHandlers;
case DeviceTypes.WEB:
return window.name === 'facebook_ref' || window.name === 'messenger_ref' ?
DesktopBridge :
null;
}
return null;
}
function fbCallbackHandler(
resultStatus,
callbackID,
resultJSON) {
if (callbackMap[callbackID] === undefined) {
return;
}
var result = null;
try {
if (resultJSON) {
result = ES("JSON", "parse", false, resultJSON);
}
} catch (_unused) {}
if (!result) {
result = {};
}
if (resultStatus) {
callbackMap[callbackID].success(result);
} else {
var errorMessage = result.errorMessage;
if (!errorMessage) {
errorMessage = ErrorHandling.getErrorMessage(result.errorCode);
}
callbackMap[callbackID].error(result.errorCode, errorMessage);
}
delete callbackMap[callbackID];
}
function provide(source) {
ES("Object", "assign", false, externalInterface, source);
}
function callNativeBridge(
callName,
successCallback,
errorCallback,
callParams) {
if (!extensionAPIBridge) {
if (window.MessengerExtensions) {
errorCallback(
2071011,
'Messenger Extensions are not enabled - could be ' +
'"messenger_extensions" was not set on a url, the domain was not ' +
'whitelisted or this is an outdated version of Messenger client.');
} else {
errorCallback(
2071011,
'JavaScript bridge does not exist - Please make sure you are in ' +
'latest version of Facebook or Messenger App.');
}
return;
}
if (!(callName in extensionAPIBridge)) {
if (window.MessengerExtensions) {
errorCallback(
2071010,
'This SDK method is not supported on this Messenger client. ' +
'Please upgrade.');
} else {
errorCallback(
2071010,
'The API provided by the SDK is not available on this device.');
}
return;
}
callParams.callbackID = guid();
callbackMap[callParams.callbackID] = {
success: successCallback,
error: errorCallback
};
if (window._FBNonce) {
callParams.nonce = window._FBNonce;
}
var callParamsJSON = ES("JSON", "stringify", false, callParams);
if (InstantExperiencesDebuggerUtils.isDebugModeEnabled()) {
extensionAPIBridge[callName](callParamsJSON);
return;
}
switch (currentDevice) {
case DeviceTypes.IOS:
extensionAPIBridge[callName].postMessage(callParamsJSON);
break;
case DeviceTypes.ANDROID:
extensionAPIBridge[callName](callParamsJSON);
break;
case DeviceTypes.WEB:
extensionAPIBridge[callName](callParams, successCallback, errorCallback);
break;
default:
break;
}
}
function getExternalInterface() {
return externalInterface;
}
module.exports = {
provide: provide,
callNativeBridge: callNativeBridge,
getAPIBridge: getAPIBridge,
getExternalInterface: getExternalInterface
};
}, null);
__d("legacy:BrowserExtensions.MessengerInterface", ["BrowserExtensions"], (function $module_legacy_BrowserExtensions_MessengerInterface(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
window.MessengerExtensions = BrowserExtensions.getExternalInterface();
}), 3);
__d("legacy:BrowserExtensions.getUserID", ["BrowserExtensions"], (function $module_legacy_BrowserExtensions_getUserID(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
BrowserExtensions.provide({
getUserID: function getUserID(successCallback, errorCallback) {
BrowserExtensions.callNativeBridge(
'getUserID',
function (result) {
return (
successCallback({
asid: result.asid !== '0' ? result.asid : null,
psid: result.psid !== '0' ? result.psid : null
}));
},
errorCallback, {});
}
});
}), 3);
__d("legacy:BrowserExtensions.hasCapability", ["BrowserExtensions"], function $module_legacy_BrowserExtensions_hasCapability(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
BrowserExtensions.provide({
hasCapability: function hasCapability(
successCallback,
errorCallback,
capabilities) {
BrowserExtensions.callNativeBridge(
'hasCapability',
function (result) {
var capabilityResults = {};
for (var _iterator = ES(capabilities, "filter", true, function (c) {
return (c in result);
}), _isArray = ES("Array", "isArray", false, _iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[typeof Symbol === "function" ? Symbol.iterator : "@@iterator"](); ; ) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length)
break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done)
break;
_ref = _i.value;
}
var capability = _ref;
capabilityResults[capability] = result[capability];
}
successCallback(capabilityResults);
},
errorCallback, {
capabilities: capabilities
});
}
});
}, 3);
__d("legacy:BrowserExtensions.requestCloseBrowser", ["BrowserExtensions"], (function $module_legacy_BrowserExtensions_requestCloseBrowser(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
BrowserExtensions.provide({
requestCloseBrowser: function requestCloseBrowser(
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'requestCloseBrowser',
successCallback,
errorCallback, {});
}
});
}), 3);
__d("MessengerBrowserExtensions.addToMPLibrary", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_addToMPLibrary(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function addToMPLibrary(
productID,
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'addToMPLibrary',
successCallback,
errorCallback, {
productID: productID
});
}
module.exports = addToMPLibrary;
}), null);
__d("MessengerBrowserExtensions.addToMPPlaylist", ["BrowserExtensions"], function $module_MessengerBrowserExtensions_addToMPPlaylist(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function addToMPPlaylist(
productID,
playlistID,
playlistName,
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'addToMPPlaylist',
successCallback,
errorCallback, {
productID: productID,
playlistID: playlistID,
playlistName: playlistName
});
}
module.exports = addToMPPlaylist;
}, null);
__d("MessengerBrowserExtensions.getMPNowPlayingItem", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_getMPNowPlayingItem(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function getMPNowPlayingItem(
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'getMPNowPlayingItem',
successCallback,
errorCallback, {});
}
module.exports = getMPNowPlayingItem;
}), null);
__d("MessengerBrowserExtensions.getMPPlaybackState", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_getMPPlaybackState(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function getMPPlaybackState(
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'getMPPlaybackState',
successCallback,
errorCallback, {});
}
module.exports = getMPPlaybackState;
}), null);
__d("MessengerBrowserExtensions.pauseMPMusic", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_pauseMPMusic(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function pauseMPMusic(
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'pauseMPMusic',
successCallback,
errorCallback, {});
}
module.exports = pauseMPMusic;
}), null);
__d("MessengerBrowserExtensions.playMPMusic", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_playMPMusic(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function playMPMusic(successCallback, errorCallback) {
BrowserExtensions.callNativeBridge(
'playMPMusic',
successCallback,
errorCallback, {});
}
module.exports = playMPMusic;
}), null);
__d("MessengerBrowserExtensions.presentSKSetupViewController", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_presentSKSetupViewController(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function presentSKSetupViewController(
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'presentSKSetupViewController',
successCallback,
errorCallback, {});
}
module.exports = presentSKSetupViewController;
}), null);
__d("MessengerBrowserExtensions.requestSKAuthorization", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_requestSKAuthorization(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function requestSKAuthorization(
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'requestSKAuthorization',
successCallback,
errorCallback, {});
}
module.exports = requestSKAuthorization;
}), null);
__d("MessengerBrowserExtensions.requestSKCapabilities", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_requestSKCapabilities(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function requestSKCapabilities(
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'requestSKCapabilities',
successCallback,
errorCallback, {});
}
module.exports = requestSKCapabilities;
}), null);
__d("MessengerBrowserExtensions.requestSKPersonalizationToken", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_requestSKPersonalizationToken(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function requestSKPersonalizationToken(
clientToken,
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'requestSKPersonalizationToken',
successCallback,
errorCallback, {
clientToken: clientToken
});
}
module.exports = requestSKPersonalizationToken;
}), null);
__d("MessengerBrowserExtensions.requestSKStorefrontIdentifier", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_requestSKStorefrontIdentifier(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function requestSKStorefrontIdentifier(
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'requestSKStorefrontIdentifier',
successCallback,
errorCallback, {});
}
module.exports = requestSKStorefrontIdentifier;
}), null);
__d("MessengerBrowserExtensions.setMPQueue", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_setMPQueue(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function setMPQueue(
storeIDs,
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'setMPQueue',
successCallback,
errorCallback, {
storeIDs: storeIDs
});
}
module.exports = setMPQueue;
}), null);
__d("MessengerBrowserExtensions.setupSKCloudServiceWithAuthorization", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_setupSKCloudServiceWithAuthorization(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function setupSKCloudServiceWithAuthorization(
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'setupSKCloudServiceWithAuthorization',
successCallback,
errorCallback, {});
}
module.exports = setupSKCloudServiceWithAuthorization;
}), null);
__d("MessengerBrowserExtensions.stopMPMusic", ["BrowserExtensions"], (function $module_MessengerBrowserExtensions_stopMPMusic(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions) {
'use strict';
function stopMPMusic(successCallback, errorCallback) {
BrowserExtensions.callNativeBridge(
'stopMPMusic',
successCallback,
errorCallback, {});
}
module.exports = stopMPMusic;
}), null);
__d("legacy:MessengerBrowserExtensions.AppleMusic", ["BrowserExtensions", "MessengerBrowserExtensions.addToMPLibrary", "MessengerBrowserExtensions.addToMPPlaylist", "MessengerBrowserExtensions.getMPNowPlayingItem", "MessengerBrowserExtensions.getMPPlaybackState", "MessengerBrowserExtensions.pauseMPMusic", "MessengerBrowserExtensions.playMPMusic", "MessengerBrowserExtensions.presentSKSetupViewController", "MessengerBrowserExtensions.requestSKAuthorization", "MessengerBrowserExtensions.requestSKCapabilities", "MessengerBrowserExtensions.requestSKPersonalizationToken", "MessengerBrowserExtensions.requestSKStorefrontIdentifier", "MessengerBrowserExtensions.setMPQueue", "MessengerBrowserExtensions.setupSKCloudServiceWithAuthorization", "MessengerBrowserExtensions.stopMPMusic"], function $module_legacy_MessengerBrowserExtensions_AppleMusic(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions, addToMPLibrary, addToMPPlaylist, getMPNowPlayingItem, getMPPlaybackState, pauseMPMusic, playMPMusic, presentSKSetupViewController, requestSKAuthorization, requestSKCapabilities, requestSKPersonalizationToken, requestSKStorefrontIdentifier, setMPQueue, setupSKCloudServiceWithAuthorization, stopMPMusic) {
'use strict';
BrowserExtensions.provide({
AppleMusic: {
addToMPLibrary: addToMPLibrary,
addToMPPlaylist: addToMPPlaylist,
getMPNowPlayingItem: getMPNowPlayingItem,
getMPPlaybackState: getMPPlaybackState,
pauseMPMusic: pauseMPMusic,
playMPMusic: playMPMusic,
presentSKSetupViewController: presentSKSetupViewController,
requestSKAuthorization: requestSKAuthorization,
requestSKCapabilities: requestSKCapabilities,
requestSKPersonalizationToken: requestSKPersonalizationToken,
requestSKStorefrontIdentifier: requestSKStorefrontIdentifier,
setupSKCloudServiceWithAuthorization: setupSKCloudServiceWithAuthorization,
setMPQueue: setMPQueue,
stopMPMusic: stopMPMusic
}
});
}, 3);
__d("InvalidConfigError", [], function $module_InvalidConfigError(global, require, requireDynamic, requireLazy, module, exports) {
var _Error,
_superProto;
_Error = babelHelpers.inherits(
InvalidConfigError, Error);
_superProto = _Error && _Error.prototype;
function InvalidConfigError(msg) {
"use strict";
_superProto.constructor.call(this, msg);
this.name = 'InvalidConfigError';
this.message = msg;
}
module.exports = InvalidConfigError;
}, null);
__d("PaymentRequestValidator", ["BrowserExtensionsConfig", "InvalidConfigError"], function $module_PaymentRequestValidator(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensionsConfig, InvalidConfigError) {
var paymentActionLabelOptions = ['Pay', 'Donate', 'Place Order'];
var paymentMethodRegExp = new RegExp(
'^https?://(www.)?facebook.com/payments/?$',
'i');
var FBPaymentsMethodLegacyID = 'fb';
var validateDevConfig = function validateDevConfig(devConfig) {
if (!ES("Array", "isArray", false, devConfig.methodData) || devConfig.methodData.length < 1) {
throw new InvalidConfigError(
'PaymentRequest configuration error: methodData must be a non-empty array');
}
var method;
ES(devConfig.methodData, "forEach", true, function (_ref) {
var supportedMethods = _ref.supportedMethods,
data = _ref.data;
ES(supportedMethods, "forEach", true, function (name) {
if (paymentMethodRegExp.test(name) || name === FBPaymentsMethodLegacyID) {
method = data;
}
});
});
if (!method) {
throw new InvalidConfigError(
'PaymentRequest configuration error: Invalid payment method name in' +
' supportedMethods');
}
if (
method.payActionLabel &&
!ES(paymentActionLabelOptions, "includes", true, method.payActionLabel)) {
throw new InvalidConfigError(
'PaymentRequest configuration error: Invalid payActionLabel in methodData');
}
if (!method.merchantFBPageId) {
throw new InvalidConfigError(
'PaymentRequest configuration error: MerchantFBPageId in methodData must' +
' be non-empty');
}
if (!method.termsUrl) {
throw new InvalidConfigError(
'PaymentRequest configuration error: TermsUrl in methodData must be' +
' non-empty');
}
if (
!ES(BrowserExtensionsConfig.payment_request_validator_disabled, "includes", true,
method.merchantFBPageId.toString())) {
if (!devConfig.details) {
throw new InvalidConfigError(
'PaymentRequest configuration error: paymentDetails cannot be empty');
}
var items = devConfig.details.displayItems;
if (!ES("Array", "isArray", false, items) || items.length < 1) {
throw new InvalidConfigError(
'PaymentRequest configuration error: displayItems in paymentDetails' +
' must be a non-empty array');
}
ES(items, "forEach", true, function (item) {
validateItem(item);
});
if (!devConfig.details.total) {
throw new InvalidConfigError(
'PaymentRequest configuration error: total in paymentDetails must be' +
' non-empty');
}
validateAmount(devConfig.details.total.amount);
var shippingOptions = devConfig.details.shippingOptions;
if (
devConfig.options.requestShipping && ES("Array", "isArray", false,
shippingOptions) &&
shippingOptions.length >= 1) {
ES(shippingOptions, "forEach", true, function (option) {
validateShippingOption(option);
});
}
}
return 0;
};
var validateShippingOption = function validateShippingOption(option) {
if (!option) {
throw new InvalidConfigError(
'PaymentRequest configuration error:' +
' shipping option must be non-empty');
}
if (!option.id) {
throw new InvalidConfigError(
'PaymentRequest configuration error: id in the shippingOption must be' +
' non-empty');
}
validateItem(option);
};
var validateItem = function validateItem(item) {
if (!item) {
throw new InvalidConfigError(
'PaymentRequest configuration error: item' + ' must be non-empty');
}
if (!item.label) {
throw new InvalidConfigError(
'PaymentRequest configuration error: item label must be non-empty');
}
validateAmount(item.amount);
};
var validateAmount = function validateAmount(amount) {
if (!amount) {
throw new InvalidConfigError(
'PaymentRequest configuration error: item' + ' amount must be non-empty');
}
if (!isWellFormedCurrencyCode(amount.currency)) {
throw new InvalidConfigError(
'PaymentRequest configuration error: invalid currency');
}
if (!isValidDecimalMonetaryValue(amount.value)) {
throw new InvalidConfigError(
'PaymentRequest configuration error: invalid payment value');
}
};
var isValidDecimalMonetaryValue = function isValidDecimalMonetaryValue(value) {
return (
typeof value === 'string' && value.match(/^-?[0-9]+(\.[0-9]+)?$/) ||
typeof value === 'number');
};
var isWellFormedCurrencyCode = function isWellFormedCurrencyCode(currency) {
return (
typeof currency === 'string' &&
currency.length == 3 &&
currency.match(/[^A-Za-z]/) == null);
};
module.exports = {
validateDevConfig: validateDevConfig,
validateShippingOption: validateShippingOption
};
}, null);
__d("getPaymentAddress", [], function $module_getPaymentAddress(global, require, requireDynamic, requireLazy, module, exports) {
function getPaymentAddress(address) {
var pa = new PaymentAddress();
pa.country = address.country;
pa.addressLine = [address.street1];
if (address.street2) {
pa.addressLine.push(address.street2);
}
pa.region = address.region;
pa.city = address.city;
pa.postalCode = address.postal_code;
pa.recipient = address.name;
return pa;
}
function PaymentAddress() {
"use strict";
this.
dependentLocality = '';
this.
sortingCode = '';
this.
languageCode = '';
this.
organization = '';
this.
phone = '';
}
module.exports = getPaymentAddress;
}, null);
__d("getPaymentRequestUpdateEvent", [], (function $module_getPaymentRequestUpdateEvent(global, require, requireDynamic, requireLazy, module, exports) {
var successCallback;
var errorCallback;
function getPaymentRequestUpdateEvent(
success,
fail,
paymentRequest) {
successCallback = success;
errorCallback = fail;
var event = new PaymentRequestUpdateEvent();
event.target = paymentRequest;
return event;
}
PaymentRequestUpdateEvent.prototype.
updateWith = function (p) {
"use strict";
p.then(function (details) {
return successCallback(details);
})["catch"](function (errMessage) {
return (
errorCallback(errMessage));
});
};
function PaymentRequestUpdateEvent() {
"use strict";
}
module.exports = getPaymentRequestUpdateEvent;
}), null);
__d("camelizeProps", [], (function $module_camelizeProps(global, require, requireDynamic, requireLazy, module, exports) {
function camelize(key) {
return key.replace(/_[a-z]/g, function (match) {
return match.charAt(1).toUpperCase();
});
}
function camelizeProps(source) {
var dest = {};
for (var prop in source) {
if (Object.prototype.hasOwnProperty.call(source, prop)) {
if (typeof source[prop] === 'object') {
dest[camelize(prop)] = camelizeProps(source[prop]);
} else {
dest[camelize(prop)] = source[prop];
}
}
}
return dest;
}
module.exports = camelizeProps;
}), null);
__d("getPaymentResponse", ["camelizeProps", "getPaymentAddress"], function $module_getPaymentResponse(global, require, requireDynamic, requireLazy, module, exports, camelizeProps, getPaymentAddress) {
var callback = function callback() {};
function getPaymentResponse(
chargeRequest,
devConfigOptions,
cb) {
callback = cb;
var info = chargeRequest.collected_purchase_info;
var response = new PaymentResponse();
response.details = camelizeProps({
paymentData: info.payment_data,
paymentId: chargeRequest.payment_id,
orderData: chargeRequest.order_info
});
if (devConfigOptions.requestShipping) {
response.shippingAddress = getPaymentAddress(info.shipping_address);
}
if (devConfigOptions.requestPayerName) {
response.payerName = info.contact_name;
}
if (devConfigOptions.requestPayerEmail) {
response.payerEmail = info.contact_email;
}
if (devConfigOptions.requestPayerPhone) {
response.payerPhone = info.contact_phone;
}
if (info.shipping_option) {
response.shippingOption = info.shipping_option;
}
return response;
}
function PaymentResponse() {
"use strict";
this.
paymentRequestID = '';
this.
methodName = 'fb';
this.
details = {};
this.
shippingAddress = {};
this.
shippingOption = '';
this.
payerName = '';
this.
payerEmail = '';
this.
payerPhone = '';
}
PaymentResponse.prototype.
complete = function (result, message) {
"use strict";
callback(result, message);
return new Promise(function (resolve) {
return resolve();
});
};
module.exports = getPaymentResponse;
}, null);
__d("BrowserExtensions.PaymentRequest", ["BrowserExtensions", "InvalidConfigError", "PaymentRequestValidator", "getPaymentAddress", "getPaymentRequestUpdateEvent", "getPaymentResponse", "guid"], function $module_BrowserExtensions_PaymentRequest(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions, InvalidConfigError, PaymentRequestValidator, getPaymentAddress, getPaymentRequestUpdateEvent, getPaymentResponse, guid) {
'use strict';
var _Error,
_superProto,
_Error2,
_superProto2,
_Error3,
_superProto3;
var paymentMethodRegExp = new RegExp(
'^https?://(www.)?facebook.com/payments/?$',
'i');
var FBPaymentsMethodLegacyID = 'fb';
var listeners;
var handlers;
var devConfig;
var requestState = '';
var instance;
var nativeChargeRequestHandler;
var isPaymentRequestShowing = false;
function nativeResultsHandler(result) {
switch (result.status) {
case 'chargeRequest':
nativeChargeRequestHandler(result);
break;
case 'shipping':
instance.shippingAddress = getPaymentAddress(result.shippingAddress);
ES(listeners.shippingaddresschange, "forEach", true, function (handler) {
return (
handler(
getPaymentRequestUpdateEvent(
nativeShippingAddressHandler,
nativeShippingAddressErrorHandler,
instance)));
});
var addressHandler = instance.onshippingaddresschange;
if (typeof addressHandler === 'function') {
addressHandler(
getPaymentRequestUpdateEvent(
nativeShippingAddressHandler,
nativeShippingAddressErrorHandler,
instance));
}
break;
case 'shippingOption':
instance.shippingOption = result.shippingOption;
ES(listeners.shippingoptionchange, "forEach", true, function (handler) {
return (
handler(
getPaymentRequestUpdateEvent(
nativeShippingOptionsHandler,
nativeShippingOptionErrorHandler,
instance)));
});
var optionHandler = instance.onshippingoptionchange;
if (typeof optionHandler === 'function') {
optionHandler(
getPaymentRequestUpdateEvent(
nativeShippingOptionsHandler,
nativeShippingOptionErrorHandler,
instance));
}
break;
case 'confirmationClose':
break;
case 'checkoutCancel':
ES(listeners.checkoutcancel, "forEach", true, function (handler) {
return handler();
});
isPaymentRequestShowing = false;
break;
default:
isPaymentRequestShowing = false;
throw Error('Unexpected error');
}
}
function nativeResultsErrorHandler(apiErrorCode, apiErrorMessage) {
throw Error(apiErrorMessage + " (" + apiErrorCode + ")");
}
function nativeShippingAddressHandler(devDetails, errorMessage) {
if (errorMessage === void 0) {
errorMessage = '';
}
var contentConfiguration = {};
if (devDetails) {
devConfig.details = devDetails;
var checkoutConfiguration;
try {
checkoutConfiguration = getCheckoutConfiguration();
contentConfiguration =
checkoutConfiguration.checkout_configuration.content_configuration;
} catch (e) {
errorMessage = e.message;
}
}
isPaymentRequestShowing = !errorMessage;
BrowserExtensions.callNativeBridge(
'paymentsCheckoutShippingAddressReturn',
nativeResultsHandler,
nativeResultsErrorHandler, {
contentConfiguration: contentConfiguration,
errorMessage: errorMessage,
handlers: handlers
});
}
function nativeShippingOptionsHandler(devDetails, errorMessage) {
if (errorMessage === void 0) {
errorMessage = '';
}
var contentConfiguration = {};
if (devDetails) {
devConfig.details = devDetails;
var checkoutConfiguration;
try {
checkoutConfiguration = getCheckoutConfiguration();
contentConfiguration =
checkoutConfiguration.checkout_configuration.content_configuration;
} catch (e) {
errorMessage = e.message;
}
}
isPaymentRequestShowing = !errorMessage;
BrowserExtensions.callNativeBridge(
'paymentsCheckoutShippingOptionReturn',
nativeResultsHandler,
nativeResultsErrorHandler, {
contentConfiguration: contentConfiguration,
errorMessage: errorMessage,
handlers: handlers
});
}
function nativeShippingAddressErrorHandler(errorMessage) {
nativeShippingAddressHandler(null, errorMessage);
}
function nativeShippingOptionErrorHandler(errorMessage) {
nativeShippingOptionsHandler(null, errorMessage);
}
function nativeChargeRequestSuccessHandler(paymentId, successMessage) {
BrowserExtensions.callNativeBridge(
'paymentsCheckoutChargeRequestSuccessReturn',
nativeResultsHandler,
nativeResultsErrorHandler, {
paymentId: paymentId,
successMessage: successMessage ? successMessage : '',
handlers: handlers
});
}
function nativeChargeRequestErrorHandler(paymentId, errorMessage) {
BrowserExtensions.callNativeBridge(
'paymentsCheckoutChargeRequestErrorReturn',
nativeResultsHandler,
nativeResultsErrorHandler, {
paymentId: paymentId,
errorMessage: errorMessage ? errorMessage : '',
handlers: handlers
});
}
function nativeChargeRequestUnknownHandler(paymentId, errorMessage) {
BrowserExtensions.callNativeBridge(
'paymentsCheckoutChargeRequestUnknownReturn',
nativeResultsHandler,
nativeResultsErrorHandler, {
paymentId: paymentId,
errorMessage: errorMessage ? errorMessage : '',
handlers: handlers
});
}
function getPurchaseInfo() {
var info = [{
identifier: 'payment_method'
}, {
identifier: 'pin_and_fingerprint'
}
];
if (devConfig.options.requestShipping) {
info.push({
identifier: 'shipping_address'
});
}
if (devConfig.options.requestPayerName) {
info.push({
identifier: 'contact_name'
});
}
if (devConfig.options.requestPayerEmail) {
info.push({
identifier: 'contact_email'
});
}
if (devConfig.options.requestPayerPhone) {
info.push({
identifier: 'contact_phone'
});
}
if (devConfig.details.shippingOptions) {
var preSelect;
var options = ES(devConfig.details.shippingOptions, "map", true, function (option) {
if (option.selected) {
preSelect = option.id;
}
return {
option_id: option.id,
option_title: option.label,
option_price_list: [{
label: 'Shipping',
currency_amount: {
currency: option.amount.currency,
amount: option.amount.value
}
}
]
};
});
info.push({
identifier: 'options',
collected_data_key: 'shipping_option',
title: 'Shipping Method',
actionable_title: 'Choose Shipping Method',
option_list_title: 'Shipping Methods',
price_model: 'apply_none',
should_pre_select: !!preSelect,
pre_selected_option_ids: preSelect ? [preSelect] : [],
options: options
});
}
return info;
}
function getPriceList() {
return ES(devConfig.details.displayItems, "map", true, function (item) {
return {
label: item.label,
currency_amount: {
currency: item.amount.currency,
amount: item.amount.value
}
};
});
}
function getCheckoutConfiguration() {
try {
PaymentRequestValidator.validateDevConfig(devConfig);
} catch (e) {
throw e;
}
var method;
ES(devConfig.methodData, "forEach", true, function (_ref) {
var supportedMethods = _ref.supportedMethods,
data = _ref.data;
ES(supportedMethods, "forEach", true, function (name) {
if (paymentMethodRegExp.test(name) || name === FBPaymentsMethodLegacyID) {
method = data;
}
});
});
if (!method) {
throw new InvalidConfigError(
'PaymentRequest configuration error: Invalid payment method name in' +
' supportedMethods');
}
var total = devConfig.details.total;
return {
checkout_configuration: {
version: '1.1.2',
payment_info: {
order_id: method.orderId || '',
receiver_id: method.merchantFBPageId ?
String(method.merchantFBPageId) :
'',
ig_receiver_id: method.merchantIGId ? String(method.merchantIGId) : '',
extra_data: method.extraData
},
order_status_model: {
type: devConfig.options.requestShipping ?
'js_update_checkout' :
'fixed_amount'
},
content_configuration: {
entity: {
participant: {
title: method.merchantTitle,
image_url: method.merchantImageUrl
}
},
price_list: getPriceList(),
price_total: {
label: total.label || 'Total',
currency_amount: {
currency: total.amount.currency,
amount: total.amount.value
}
},
purchase_info: getPurchaseInfo(),
pay_action_content: {
action_title: method.payActionLabel,
merchant_name: method.merchantTitle || '',
terms_and_policies_url: method.termsUrl || ''
},
confirmation_configuration: {
confirmation_text: method.confirmationText,
confirmation_image_url: method.confirmationImageUrl || '',
confirmation_share_url: method.confirmationShareUrl || ''
}
}
}
};
}
function refreshPaymentModuleStatus() {
return new Promise(function (resolve, reject) {
BrowserExtensions.callNativeBridge(
'canShowPaymentModule',
function (result) {
resolve(result.canShowPaymentModule);
},
function (errorCode, errorMessage) {
resolve(!isPaymentRequestShowing);
}, {});
});
}
function PaymentRequest(
methodData,
details,
options) {
if (options === void 0) {
options = {};
}
listeners = {
shippingaddresschange: [],
shippingoptionchange: [],
checkoutcancel: []
};
devConfig = {
methodData: methodData,
details: details,
options: options
};
requestState = 'created';
if ('Symbol' in window) {
this[typeof Symbol === "function" ? Symbol.toStringTag : "@@toStringTag"] = 'PaymentRequest';
}
this.onshippingoptionchange = null;
this.onshippingaddresschange = null;
methodData && ES(
methodData, "forEach", true, ES(function (_ref2) {
var supportedMethods = _ref2.supportedMethods,
data = _ref2.data;
supportedMethods && ES(
supportedMethods, "forEach", true, ES(function (name) {
if (
paymentMethodRegExp.test(name) ||
name === FBPaymentsMethodLegacyID) {
this.method = data;
}
}, "bind", true, this));
}, "bind", true, this));
instance = this;
}
PaymentRequest.prototype.
show = function () {
if (!(this instanceof PaymentRequest)) {
return new Promise(function (_, reject) {
return reject();
});
}
if (requestState !== 'created') {
throw new InvalidStateError();
}
return refreshPaymentModuleStatus().then(function (canShowPaymentModule) {
if (!canShowPaymentModule) {
throw new AbortError();
}
requestState = 'interactive';
handlers = {
handleShippingAddress: listeners.shippingaddresschange.length > 0,
handleChargeRequest: true,
onConfirmationClose: true,
onCheckoutCancel: listeners.checkoutcancel.length > 0
};
return new Promise(function (resolve, reject) {
nativeChargeRequestHandler = function nativeChargeRequestHandler(result) {
isPaymentRequestShowing = false;
var response = getPaymentResponse(
result.chargeRequest,
devConfig.options,
function (devStatus, message) {
if (devStatus === 'success') {
nativeChargeRequestSuccessHandler(
result.chargeRequest.payment_id,
message);
}
if (devStatus === 'failure') {
nativeChargeRequestErrorHandler(
result.chargeRequest.payment_id,
message);
}
if (devStatus === 'unknown') {
nativeChargeRequestUnknownHandler(
result.chargeRequest.payment_id,
message);
}
});
if (!instance.paymentRequestID) {
instance.paymentRequestID = guid();
}
response.paymentRequestID = instance.paymentRequestID;
resolve(response);
};
var checkoutConfiguration;
try {
checkoutConfiguration = getCheckoutConfiguration();
} catch (e) {
isPaymentRequestShowing = false;
reject(e);
return;
}
isPaymentRequestShowing = true;
BrowserExtensions.callNativeBridge(
'paymentsCheckout',
function (result) {
try {
nativeResultsHandler(result);
} catch (ex) {
isPaymentRequestShowing = false;
reject(ex);
}
},
function (errCode, errMessage) {
isPaymentRequestShowing = false;
reject(errMessage || errCode);
}, {
configuration: checkoutConfiguration,
handlers: handlers
});
});
});
};
PaymentRequest.prototype.
addEventListener = function (ev, listener) {
listeners[ev].push(listener);
};
PaymentRequest.prototype.
canMakePayment = function () {
return new Promise(function (resolve, reject) {
try {
PaymentRequestValidator.validateDevConfig(devConfig);
} catch (e) {
reject(e);
return;
}
if (requestState !== 'created') {
reject(new InvalidStateError());
return;
}
if (!BrowserExtensions.getAPIBridge()) {
reject(new NotSupportedError());
return;
}
var pageId =
instance && instance.method && instance.method.merchantFBPageId ?
String(instance.method.merchantFBPageId) :
'';
var igId =
instance && instance.method && instance.method.merchantIGId ?
String(instance.method.merchantIGId) :
'';
BrowserExtensions.callNativeBridge(
'canMakePayment',
function (result) {
resolve(
result.canMakePayment === true || result.canMakePayment === 'true');
},
function (errCode, errMessage) {
reject(errMessage || errCode);
}, {
merchantFBPageId: pageId,
merchantIGId: igId
});
});
};
PaymentRequest.prototype.
abort = function () {
if (!(this instanceof PaymentRequest)) {
return new Promise(function (_, reject) {
return reject();
});
}
if (requestState !== 'interactive') {
throw new InvalidStateError();
}
requestState = 'closed';
isPaymentRequestShowing = false;
return new Promise(function (resolve, reject) {});
};
_Error = babelHelpers.inherits(
AbortError, Error);
_superProto = _Error && _Error.prototype;
function AbortError() {
_Error.apply(this, arguments);
}
_Error2 = babelHelpers.inherits(
InvalidStateError, Error);
_superProto2 = _Error2 && _Error2.prototype;
function InvalidStateError() {
_Error2.apply(this, arguments);
}
_Error3 = babelHelpers.inherits(
NotSupportedError, Error);
_superProto3 = _Error3 && _Error3.prototype;
function NotSupportedError() {
_Error3.apply(this, arguments);
}
module.exports = PaymentRequest;
}, null);
__d("BrowserExtensions.processPayment", ["BrowserExtensions", "errorCode"], (function $module_BrowserExtensions_processPayment(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions, errorCode) {
'use strict';
function processPayment(
successCallback,
errorCallback,
amount) {
BrowserExtensions.callNativeBridge(
'processPayment',
function (result) {
return (
successCallback({
payment_result: result.payment_result.split('\\n').join('\n')
}));
},
function (apiErrorCode, apiErrorMessage) {
if (!apiErrorCode) {
apiErrorCode = 2071002;
apiErrorMessage =
'The payment method was declined by the ' +
'Issuer. Please try another payment method.';
}
errorCallback(apiErrorCode, apiErrorMessage);
}, {
amount: amount
});
}
module.exports = processPayment;
}), null);
__d("BrowserExtensions.requestAuthorizedPaymentCredentials", ["BrowserExtensions", "errorCode"], (function $module_BrowserExtensions_requestAuthorizedPaymentCredentials(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions, errorCode) {
'use strict';
function requestAuthorizedPaymentCredentials(
successCallback,
errorCallback,
amount) {
BrowserExtensions.callNativeBridge(
'requestAuthorizedCredentials',
function (result) {
return (
successCallback({
token_card_number: result.token.split('\\n').join('\n'),
token_cvv: result.cardVerifier.split('\\n').join('\n'),
token_expiry: result.token_expiry,
zip_code: result.zip_code
}));
},
function (apiErrorCode, apiErrorMessage) {
if (!apiErrorCode) {
apiErrorCode = 2071002;
apiErrorMessage =
'The payment method was declined by the ' +
'Issuer. Please try another payment method.';
}
errorCallback(apiErrorCode, apiErrorMessage);
}, {
amount: '' + amount
});
}
module.exports = requestAuthorizedPaymentCredentials;
}), null);
__d("BrowserExtensions.requestPaymentCredentials", ["BrowserExtensions", "errorCode", "keyMirror"], function $module_BrowserExtensions_requestPaymentCredentials(global, require, requireDynamic, requireLazy, module, exports, BrowserExtensions, errorCode, keyMirror) {
'use strict';
var UserInfoType = keyMirror({
CONTACT_NAME: null,
CONTACT_EMAIL: null,
CONTACT_PHONE: null,
SHIPPING_ADDRESS: null
});
function requestPaymentCredentials(
successCallback,
errorCallback,
requestedUserInfo) {
if (!(requestedUserInfo instanceof Array)) {
console.warn(
'You are calling requestPaymentCredentials with unsupported param');
requestedUserInfo = null;
} else {
if (requestedUserInfo) {
for (var i = 0; i < requestedUserInfo.length; ++i) {
if (!UserInfoType[requestedUserInfo[i]]) {
var apiErrorCode = 2071013;
var apiErrorMessage = 'Unsupported user info passed in';
errorCallback(apiErrorCode, apiErrorMessage);
return;
}
}
}
}
_requestPaymentCredentialsInternal(
successCallback,
errorCallback,
false,
requestedUserInfo);
}
function _requestPaymentCredentialsInternal(
successCallback,
errorCallback,
isRetry,
requestedUserInfo) {
BrowserExtensions.callNativeBridge(
'requestCredentials',
function (result) {
return (
successCallback(
result.name,
result.email,
result.cardType,
result.cardLastFourDigits,
result.shippingAddress));
},
function (apiErrorCode, apiErrorMessage) {
if (apiErrorCode === 24002 && !isRetry) {
_requestPaymentCredentialsInternal(
successCallback,
errorCallback,
true,
requestedUserInfo);
return;
}
if (!apiErrorCode) {
apiErrorCode = 2071001;
apiErrorMessage = 'The request declined by the user';
}
errorCallback(apiErrorCode, apiErrorMessage);
}, {
title: 'BrowserExtensionsPayment',
imageURL: 'https://www.facebook.com/',
amount: '1',
requestedUserInfo: requestedUserInfo
});
}
module.exports = requestPaymentCredentials;
}, null);
__d("legacy:MessengerBrowserExtensions.Payments", ["BrowserExtensions", "BrowserExtensions.PaymentRequest", "BrowserExtensions.processPayment", "BrowserExtensions.requestAuthorizedPaymentCredentials", "BrowserExtensions.requestPaymentCredentials"], (function $module_legacy_MessengerBrowserExtensions_Payments(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions, PaymentRequest, processPayment, requestAuthorizedPaymentCredentials, requestPaymentCredentials) {
'use strict';
BrowserExtensions.provide({
requestPaymentCredentials: requestPaymentCredentials,
requestAuthorizedPaymentCredentials: requestAuthorizedPaymentCredentials,
processPayment: processPayment,
PaymentRequest: PaymentRequest
});
}), 3);
__d("legacy:MessengerBrowserExtensions.askPermission", ["BrowserExtensions"], function $module_legacy_MessengerBrowserExtensions_askPermission(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
BrowserExtensions.provide({
askPermission: function askPermission(
successCallback,
errorCallback,
permission) {
BrowserExtensions.callNativeBridge(
'askPermission',
function (result) {
return (
successCallback({
isGranted:
result &&
result.permissions &&
ES(result.permissions, "indexOf", true, permission) !== -1,
permissions: result && result.permissions
}));
},
errorCallback, {
permission: permission
});
}
});
}, 3);
__d("MNPlatformAttachmentType", [], function $module_MNPlatformAttachmentType(global, require, requireDynamic, requireLazy, module, exports) {
module.exports = ES("Object", "freeze", false, {
"IMAGE": "image",
"VIDEO": "video",
"AUDIO": "audio",
"FILE": "file",
"LOCATION": "location",
"TEMPLATE": "template",
"FALLBACK": "fallback"
});
}, null);
__d("ads-lib-urllib", [], function $module_ads_lib_urllib(global, require, requireDynamic, requireLazy, module, exports) {
function objectifyUrl(text) {
return parse(urllib.normalize(ES(text, "trim", true)));
}
var EXPRESSION = /^(?:(\w+):)?(?:\/\/([^\/:?#]*)(?::(\d+))?)?([^#?]*)(?:\?([^#]*))?(?:#(.*))?/;
var INVALID_DOMAIN = 'invalid.invalid';
function sanitizeDomain(domain) {
var re = new RegExp(
'[\\x00-\\x2c\\x2f\\x3b-\\x40\\x5c\\x5e\\x60\\x7b-\\x7f' +
'\\uFDD0-\\uFDEF\\uFFF0-\\uFFFF' +
'\\u2047\\u2048\\uFE56\\uFE5F\\uFF03\\uFF0F\\uFF1F]');
if (re.test(domain)) {
return INVALID_DOMAIN;
} else {
return domain;
}
}
function parse(uri) {
var m =
ES(uri.
toString(), "trim", true).
match(EXPRESSION) || [];
var parts = {
protocol: m[1] || '',
domain: sanitizeDomain(m[2] || ''),
port: m[3] || '',
path: m[4] || '',
query_s: m[5] || '',
fragment: m[6] || ''
};
if (!parts.domain && ES(parts.path, "indexOf", true, '\\') !== -1) {
return {};
}
var re = new RegExp(
'^(?:[^/]*:|' +
'[\\x00-\\x1f]*/[\\x00-\\x1f]*/)');
if (!parts.protocol && re.test(uri.toString())) {
return {};
}
return parts;
}
function partsToString(parts) {
var r = '';
parts.protocol && (r += parts.protocol + '://');
parts.domain && (r += parts.domain);
parts.port && (r += ':' + parts.port);
if (parts.domain && !parts.path) {
r += '/';
}
parts.path && (r += parts.path);
parts.query_s && (r += '?' + parts.query_s);
parts.fragment && (r += '#' + parts.fragment);
return r;
}
var urllib = {
normalize: function normalize(urlText) {
if (!urlText) {
return urlText;
}
var urlParts = parse(urlText);
if (!urlParts.protocol) {
urlParts.protocol = 'http';
}
return partsToString(urlParts);
},
isUrlSimple: function isUrlSimple(text) {
var parts = ES(text, "trim", true).split('.');
return (
parts.length > 1 &&
ES(parts, "filter", true, function (p) {
return !p;
}).length === 0);
},
isUrl: function isUrl(text) {
if (!text) {
return false;
}
var t = objectifyUrl(text);
return !!(
t.domain &&
t.domain !== INVALID_DOMAIN &&
urllib.isUrlSimple(t.domain));
},
isPotentialUrl: function isPotentialUrl(text) {
if (!text) {
return true;
}
var t = objectifyUrl(text);
return !!(t.domain && t.domain !== INVALID_DOMAIN);
},
getDomain: function getDomain(text) {
if (!text) {
return null;
}
var parts = objectifyUrl(text);
return parts.domain && parts.domain !== INVALID_DOMAIN ?
parts.domain :
null;
}
};
module.exports = urllib;
}, null);
__d("legacy:MessengerBrowserExtensions.beginShareFlow", ["BrowserExtensions", "MNPlatformAttachmentType", "ads-lib-urllib", "errorCode", "keyMirror"], function $module_legacy_MessengerBrowserExtensions_beginShareFlow(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions, MNPlatformAttachmentType, urllib, errorCode, keyMirror) {
'use strict';
var BROADCAST = 'broadcast';
var CURRENT_THREAD = 'current_thread';
var GENERIC = 'generic';
var MEDIA = 'media';
var M_ME_DOMAIN = 'm.me';
var FB_DOMAIN = 'www.facebook.com';
var OPEN_GRAPH = 'open_graph';
var PLACE_CARD = 'place_card';
var MessageContentFieldsForClient = keyMirror({
content_for_preview: null,
content_for_share: null,
sharing_type: null
});
var MessageContentFieldsWithGenericTemplate = keyMirror({
attachment: null
});
var MessageContentFields = keyMirror({
title: null,
subtitle: null,
image_url: null,
item_url: null,
button_title: null,
button_url: null
});
var MessageContentAttachmentFields = keyMirror({
type: null,
payload: null
});
var MessageContentForPreviewFields = keyMirror({
preview_type: null,
title: null,
subtitle: null,
image_url: null,
item_url: null,
open_graph_url: null,
button_url: null,
button_title: null,
target_display: null,
attachment_id: null,
facebook_media_url: null,
media_type: null
});
function validateMessageContent(
messageContent,
errorCallback) {
if (!messageContent) {
errorCallback(
2071014,
'Invalid MessageContent provided to SDK API call');
return false;
}
var title = messageContent[MessageContentFields.title];
var subtitle = messageContent[MessageContentFields.subtitle];
var image_url = messageContent[MessageContentFields.image_url];
var item_url = messageContent[MessageContentFields.item_url];
var button_url = messageContent[MessageContentFields.button_url];
var button_title = messageContent[MessageContentFields.button_title];
if (!title || typeof title !== 'string') {
errorCallback(
2071015,
'Invalid title string provided in message content');
return false;
}
if (subtitle && typeof subtitle !== 'string') {
errorCallback(
2071016,
'Invalid subtitle string provided in message content');
return false;
}
if (
image_url && typeof image_url !== 'string' ||
image_url && !urllib.isUrl(image_url)) {
errorCallback(
2071017,
'Invalid image URL provided in message content');
return false;
}
if (
item_url && typeof item_url !== 'string' ||
item_url && !urllib.isUrl(item_url)) {
errorCallback(
2071018,
'Invalid item URL provided in message content');
return false;
}
if (
button_url && typeof button_url !== 'string' ||
button_title && typeof button_title !== 'string' ||
button_url && !urllib.isUrl(button_url) ||
!button_url && button_title ||
button_url && !button_title) {
errorCallback(
2071019,
'Invalid button data provided in message content');
return false;
}
if (!button_url && !item_url) {
errorCallback(
2071020,
'URL data is missing in message content. ' +
'Please provide item_url, button_url or both');
return false;
}
return true;
}
function validateMessageContentAndGetPreviewParams(
messageContent,
sharingType,
errorCallback) {
var contentForPreview = {};
contentForPreview[MessageContentForPreviewFields.preview_type] = 'DEFAULT';
if (!messageContent) {
errorCallback(
2071014,
'Invalid MessageContent provided to SDK API call');
return null;
}
if (sharingType !== BROADCAST && sharingType !== CURRENT_THREAD) {
errorCallback(
2071021,
'Invalid Sharing Type provided to SDK API call ');
return null;
}
var attachment =
messageContent[MessageContentFieldsWithGenericTemplate.attachment];
if (!attachment) {
errorCallback(
2071022,
'Invalid attachment in MessageContent provided to SDK API call');
return null;
}
var type = attachment[MessageContentAttachmentFields.type];
if (
type !== MNPlatformAttachmentType.TEMPLATE &&
type !== MNPlatformAttachmentType.IMAGE) {
errorCallback(
2071023,
'Invalid attachment type in MessageContent provided to SDK API call');
return null;
}
var payload = attachment[MessageContentAttachmentFields.payload];
if (!payload) {
errorCallback(
2071024,
'Invalid payload in MessageContent provided to SDK API call');
return null;
}
if (type === MNPlatformAttachmentType.IMAGE) {
var image_url = payload.url;
if (!validateImageURL(image_url, errorCallback)) {
return null;
}
contentForPreview[MessageContentForPreviewFields.image_url] = image_url;
return contentForPreview;
}
var template_type = payload.template_type;
if (
template_type !== GENERIC &&
template_type !== OPEN_GRAPH &&
template_type !== MEDIA &&
template_type !== PLACE_CARD) {
errorCallback(
2071024,
'Invalid template type in MessageContent provided to SDK API call');
return null;
}
var elements = payload.elements;
if (!elements || !elements instanceof Array || elements.length > 1) {
errorCallback(
2071024,
'Invalid payload elements in MessageContent provided to SDK API call');
return null;
}
var element = elements[0];
var default_action_url = null;
switch (template_type) {
case OPEN_GRAPH:
contentForPreview = getContentForPreviewWithOpenGraphURL(
element,
contentForPreview,
errorCallback);
if (contentForPreview === null || contentForPreview === undefined) {
return null;
}
default_action_url = element.url;
break;
case GENERIC:
contentForPreview = getContentForPreviewWithGenericAttachment(
element,
contentForPreview,
errorCallback);
if (contentForPreview === null || contentForPreview === undefined) {
return null;
}
var default_action = element.default_action;
if (default_action) {
if (default_action.type !== 'web_url' || !default_action.url) {
errorCallback(
2071024,
'Invalid default action in MessageContent provided to SDK API call');
return null;
}
default_action_url = default_action.url;
if (
default_action_url && typeof default_action_url !== 'string' ||
default_action_url && !urllib.isUrl(default_action_url)) {
errorCallback(
2071024,
'Invalid default_action URL provided in message content');
return null;
}
}
contentForPreview[
MessageContentForPreviewFields.item_url] =
default_action_url;
break;
case MEDIA:
contentForPreview = getContentForPreviewWithMediaAttachment(
element,
contentForPreview,
errorCallback);
if (contentForPreview === null || contentForPreview === undefined) {
return null;
}
break;
case PLACE_CARD:
contentForPreview = getContentForPreviewWithGenericAttachment(
element,
contentForPreview,
errorCallback);
if (contentForPreview === null || contentForPreview === undefined) {
return null;
}
break;
}
if (template_type === PLACE_CARD) {
return contentForPreview;
}
var buttons = element.buttons;
var button_title = null;
var button_url = null;
if (buttons) {
if (!(buttons instanceof Array) || buttons.length > 1) {
errorCallback(
2071024,
'Invalid payload buttons in MessageContent provided to SDK API call');
return null;
}
var button = buttons[0];
var button_type = button.type;
if (!button_type || button_type !== 'web_url') {
errorCallback(
2071024,
'Invalid button type in MessageContent provided to SDK API call');
return null;
}
button_title = button.title;
if (!button_title) {
errorCallback(
2071024,
'Invalid payload button title in MessageContent provided to SDK API call');
return null;
}
button_url = button.url;
if (
button_url && typeof button_url !== 'string' ||
button_url && !urllib.isUrl(button_url)) {
errorCallback(
2071024,
'Invalid button URL provided in message content');
return null;
}
}
contentForPreview[MessageContentForPreviewFields.button_title] = button_title;
contentForPreview[MessageContentForPreviewFields.button_url] = button_url;
contentForPreview[
MessageContentForPreviewFields.target_display] =
getTargetTitleFromURL(button_title, button_url, default_action_url);
return contentForPreview;
}
function getContentForPreviewWithOpenGraphURL(
element,
contentForPreview,
errorCallback) {
var open_graph_url = element.url;
if (typeof open_graph_url !== 'string' || !urllib.isUrl(open_graph_url)) {
errorCallback(
2071025,
'Invalid open graph url provided in message content');
return null;
}
contentForPreview[
MessageContentForPreviewFields.open_graph_url] =
open_graph_url;
contentForPreview[MessageContentForPreviewFields.preview_type] = 'OPEN_GRAPH';
contentForPreview[MessageContentForPreviewFields.item_url] = open_graph_url;
return contentForPreview;
}
function getContentForPreviewWithGenericAttachment(
element,
contentForPreview,
errorCallback) {
var element_title = element.title;
if (!element_title) {
errorCallback(
2071024,
'Invalid element title in MessageContent provided to SDK API call');
return null;
}
var image_url = element.image_url;
if (!validateImageURL(image_url, errorCallback)) {
return null;
}
contentForPreview[MessageContentForPreviewFields.title] = element.title;
contentForPreview[MessageContentForPreviewFields.subtitle] = element.subtitle;
contentForPreview[MessageContentForPreviewFields.image_url] =
element.image_url;
return contentForPreview;
}
function getContentForPreviewWithMediaAttachment(
element,
contentForPreview,
errorCallback) {
if (element.title || element.subtitle) {
errorCallback(
2071024,
'Invalid title/subtitle provided to MEDIA template');
return null;
}
var media_url = element.url;
var media_type = element.media_type;
if (
media_type !== MNPlatformAttachmentType.IMAGE &&
media_type !== MNPlatformAttachmentType.VIDEO) {
errorCallback(
2071024,
'Invalid media type in Media Template');
return null;
}
if (media_url) {
if (!validateImageURL(media_url, errorCallback)) {
return null;
}
var domain = urllib.getDomain(media_url);
if (domain === FB_DOMAIN) {
contentForPreview[MessageContentForPreviewFields.facebook_media_url] =
element.url;
} else {
contentForPreview[MessageContentForPreviewFields.image_url] = element.url;
}
contentForPreview[MessageContentForPreviewFields.media_type] = media_type;
}
if (element.attachment_id) {
contentForPreview[MessageContentForPreviewFields.attachment_id] =
element.attachment_id;
}
return contentForPreview;
}
function validateImageURL(
image_url,
errorCallback) {
if (
image_url && typeof image_url !== 'string' ||
image_url && !urllib.isUrl(image_url)) {
errorCallback(
2071017,
'Invalid image URL provided in message content');
return false;
}
return true;
}
function getTargetTitleFromURL(
button_title,
button_url,
default_action_url) {
var default_action_name = getPageNameFromURL(default_action_url);
var button_action_name = getPageNameFromURL(button_url);
if (!button_title || !button_action_name) {
return default_action_name;
}
var page_action_name = button_action_name || default_action_name;
if (page_action_name) {
return button_title + ' - ' + page_action_name;
}
return null;
}
function getPageNameFromURL(url) {
if (!url) {
return null;
}
var url_domain = urllib.getDomain(url);
if (!url_domain) {
return null;
}
if (url_domain && url_domain.toLowerCase() === M_ME_DOMAIN) {
var base_name = url.substring(ES(url, "indexOf", true, M_ME_DOMAIN));
base_name = base_name.split('?')[0];
var name_parts = base_name.split('/');
if (name_parts.length > 1) {
var page_name = name_parts[1];
if (page_name !== '') {
return '@' + page_name.toLowerCase();
}
}
}
return url_domain;
}
BrowserExtensions.provide({
beginShareFlow: function beginShareFlow(
successCallback,
errorCallback,
messageContent,
sharingType) {
var contentPreviewParam = validateMessageContentAndGetPreviewParams(
messageContent,
sharingType,
errorCallback);
if (!contentPreviewParam) {
return;
}
var contentForClient = {};
contentForClient[
MessageContentFieldsForClient.content_for_share] = ES("JSON", "stringify", false,
messageContent);
contentForClient[
MessageContentFieldsForClient.content_for_preview] =
contentPreviewParam;
contentForClient[MessageContentFieldsForClient.sharing_type] = sharingType;
BrowserExtensions.callNativeBridge(
'beginShareFlow',
function (result) {
result.is_sent = result.is_sent === 'true' || result.is_sent === true;
successCallback(result);
},
errorCallback,
contentForClient);
}
});
}, 3);
__d("legacy:MessengerBrowserExtensions.getContext", ["BrowserExtensions"], (function $module_legacy_MessengerBrowserExtensions_getContext(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
BrowserExtensions.provide({
getContext: function getContext(
appID,
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'getContext',
successCallback,
errorCallback, {
appID: appID
});
}
});
}), 3);
__d("legacy:MessengerBrowserExtensions.getGrantedPermissions", ["BrowserExtensions"], function $module_legacy_MessengerBrowserExtensions_getGrantedPermissions(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
BrowserExtensions.provide({
getGrantedPermissions: function getGrantedPermissions(
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'getGrantedPermissions',
successCallback,
errorCallback, {});
}
});
}, 3);
__d("legacy:MessengerBrowserExtensions.getSupportedFeatures", ["BrowserExtensions"], (function $module_legacy_MessengerBrowserExtensions_getSupportedFeatures(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
BrowserExtensions.provide({
getSupportedFeatures: function getSupportedFeatures(
successCallback,
errorCallback) {
BrowserExtensions.callNativeBridge(
'getSupportedFeatures',
successCallback,
errorCallback, {});
}
});
}), 3);
__d("legacy:MessengerBrowserExtensions.isInExtension", ["BrowserExtensions"], function $module_legacy_MessengerBrowserExtensions_isInExtension(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
BrowserExtensions.provide({
isInExtension: function isInExtension() {
return !!BrowserExtensions.getAPIBridge();
}
});
}, 3);
__d("legacy:MessengerBrowserExtensions.purchaseComplete", ["BrowserExtensions"], (function $module_legacy_MessengerBrowserExtensions_purchaseComplete(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
BrowserExtensions.provide({
purchaseComplete: function purchaseComplete(
successCallback,
errorCallback,
amount) {
BrowserExtensions.callNativeBridge(
'purchaseComplete',
function () {
return successCallback();
},
errorCallback, {
amount: amount
});
}
});
}), 3);
__d("legacy:MessengerBrowserExtensions.resetCart", ["BrowserExtensions"], (function $module_legacy_MessengerBrowserExtensions_resetCart(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
BrowserExtensions.provide({
resetCart: function resetCart(successCallback, errorCallback) {
BrowserExtensions.callNativeBridge(
'resetCart',
function () {
return successCallback();
},
errorCallback, {});
}
});
}), 3);
__d("legacy:MessengerBrowserExtensions.updateCart", ["BrowserExtensions"], (function $module_legacy_MessengerBrowserExtensions_updateCart(global, require, requireDynamic, requireLazy, __DO_NOT_USE__module, __DO_NOT_USE__exports, BrowserExtensions) {
'use strict';
BrowserExtensions.provide({
updateCart: function updateCart(
successCallback,
errorCallback,
itemCount,
cartURL,
expiry) {
BrowserExtensions.callNativeBridge(
'updateCart',
function (result) {
return successCallback();
},
errorCallback, {
itemCount: itemCount,
cartURL: cartURL,
expiry: expiry
});
}
});
}), 3);
}
}).call(global);
})(window.inDapIF ? parent.window : window, window);
} catch (e) {
new Image().src = "https:\/\/www.facebook.com\/" + 'common/scribe_endpoint.php?c=jssdk_error&m=' + encodeURIComponent('{"error":"LOAD", "extra": {"name":"' + e.name + '","line":"' + (e.lineNumber || e.line) + '","script":"' + (e.fileName || e.sourceURL || e.script) + '","stack":"' + (e.stackTrace || e.stack) + '","revision":"4409275","namespace":"MessengerExtensions","message":"' + e.message + '"}}');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment