!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("pmrpc",[],r):"object"==typeof exports?exports.pmrpc=r():t.pmrpc=r()}(this,function(){return function(t){function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var e={};return r.m=t,r.c=e,r.i=function(t){return t},r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},r.p="",r(r.s=148)}([function(t,r){var e=Array.isArray;t.exports=e},function(t,r,e){var n=e(38),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},function(t,r,e){function n(t){return null==t?void 0===t?a:c:s&&s in Object(t)?i(t):u(t)}var o=e(8),i=e(98),u=e(123),c="[object Null]",a="[object Undefined]",s=o?o.toStringTag:void 0;t.exports=n},function(t,r,e){function n(t,r){var e=i(t,r);return o(e)?e:void 0}var o=e(79),i=e(100);t.exports=n},function(t,r){function e(t){return null!=t&&"object"==typeof t}t.exports=e},function(t,r){function e(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}t.exports=e},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default={INVOKE:"invoke",RPC_RESOLVE:"rpc-resolve",RPC_REJECT:"rpc-reject",API_DESCRIPTION:"api-desc",INVOKE_FUNCTION:"invoke-func",RESOLVE:"resolve",REJECT:"reject",REQUEST_API:"request-api"}},function(t,r,e){function n(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r0&&void 0!==arguments[0]?arguments[0]:{},r=t.type;return"Error"===r||(0,c.default)((0,i.default)(self,[r,"prototype"]))},s=function(t){var r=t.type,e=t.stack,n=t.message,o=new(self[r]||Error)(n);return o.stack=e,o},f=function(t){return{type:t.constructor.name,message:t.message,stack:t.stack}};r.serialize=function(t){return Promise.reject((0,c.default)(t)?f(t):t)},r.deserialize=function(t){return a(t)?s(t):t}},function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r2&&void 0!==arguments[2]?arguments[2]:[];return new Promise(function(r){var c=new MessageChannel,a=c.port1,s=c.port2;t.__port=s,(0,o.isWorker)()||e instanceof Worker||e instanceof MessagePort?e.postMessage(t,[s].concat(n(u))):e.postMessage(t,i,[s].concat(n(u))),a.onmessage=function(t){var e=t.data;return r(e)}})},r.sendResponse=function(t,r){return function(e){return t.postMessage({intent:r,result:e})}}},function(t,r,e){var n=e(3),o=e(1),i=n(o,"Map");t.exports=i},function(t,r,e){function n(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1&&t%1==0&&t<=n}var n=9007199254740991;t.exports=e},function(t,r,e){function n(t){return"symbol"==typeof t||i(t)&&o(t)==u}var o=e(2),i=e(4),u="[object Symbol]";t.exports=n},function(t,r,e){function n(t){return u(t)?o(t):i(t)}var o=e(67),i=e(35),u=e(14);t.exports=n},function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,"__esModule",{value:!0});var o=e(6),i=n(o),u=e(18);r.default=function(t){var r=t.intent,e=t.result;switch(r){case i.default.RESOLVE:return e;case i.default.REJECT:return Promise.reject((0,u.deserialize)(e))}}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){return"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope},o=function(t){return document.getElementById(t)};r.isWorker=n,r.getChildFrameById=o},function(t,r,e){function n(t){var r=this.__data__=new o(t);this.size=r.size}var o=e(7),i=e(127),u=e(128),c=e(129),a=e(130),s=e(131);n.prototype.clear=i,n.prototype.delete=u,n.prototype.get=c,n.prototype.has=a,n.prototype.set=s,t.exports=n},function(t,r){function e(t,r){for(var e=-1,n=null==t?0:t.length,o=Array(n);++ep))return!1;var h=f.get(t);if(h&&f.get(r))return h==r;var d=-1,y=!0,_=e&a?new o:void 0;for(f.set(t,r),f.set(r,t);++d-1&&t%1==0&&t2&&void 0!==arguments[2]?arguments[2]:{},n=e.onApiCall;a.hasApp(t)&&a.unregisterApp(t),a.registerApp(t,r,n),d.addSingleHandler(b)},r.request=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=_(r);return(0,v.send)({intent:l.default.REQUEST_API,appId:t},e).then(function(r){return r?(0,p.buildApiFromDescription)(t,r,e):Promise.reject(new Error("App with ID "+t+" not found"))})},r.unset=function(t){a.unregisterApp(t),a.isEmpty()&&d.removeSingleHandler(b)}},function(t,r,e){(function(r,n){!function(r,e){t.exports=e()}(0,function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function o(t){return"function"==typeof t}function i(t){G=t}function u(t){Q=t}function c(){return function(){return r.nextTick(p)}}function a(){return void 0!==H?function(){H(p)}:l()}function s(){var t=0,r=new Z(p),e=document.createTextNode("");return r.observe(e,{characterData:!0}),function(){e.data=t=++t%2}}function f(){var t=new MessageChannel;return t.port1.onmessage=p,function(){return t.port2.postMessage(0)}}function l(){var t=setTimeout;return function(){return t(p,1)}}function p(){for(var t=0;t0?1:-1)*Math.floor(Math.abs(r)):r},e=Math.pow(2,53)-1,n=function(t){var n=r(t);return Math.min(Math.max(n,0),e)},o=function(t){if(null!=t){if(["string","number","boolean","symbol"].indexOf(typeof t)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in t)return Symbol.iterator;if("@@iterator"in t)return"@@iterator"}},i=function(r,e){if(null!=r&&null!=e){var n=r[e];if(null==n)return;if(!t(n))throw new TypeError(n+" is not a function");return n}},u=function(t){var r=t.next();return!Boolean(r.done)&&r};return function(r){"use strict";var e,c=this,a=arguments.length>1?arguments[1]:void 0;if(void 0!==a){if(!t(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(e=arguments[2])}var s,f,l=i(r,o(r));if(void 0!==l){s=t(c)?Object(new c):[];var p=l.call(r);if(null==p)throw new TypeError("Array.from requires an array-like or iterable object");f=0;for(var v,h;;){if(!(v=u(p)))return s.length=f,s;h=v.value,s[f]=a?a.call(e,h,f):h,f++}}else{var d=Object(r);if(null==r)throw new TypeError("Array.from requires an array-like object - not null or undefined");var y=n(d.length);s=t(c)?Object(new c(y)):new Array(y),f=0;for(var _;f-1}var o=e(9);t.exports=n},function(t,r,e){function n(t,r){var e=this.__data__,n=o(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this}var o=e(9);t.exports=n},function(t,r,e){function n(){this.size=0,this.__data__={hash:new o,map:new(u||i),string:new o}}var o=e(59),i=e(7),u=e(20);t.exports=n},function(t,r,e){function n(t){var r=o(this,t).delete(t);return this.size-=r?1:0,r}var o=e(10);t.exports=n},function(t,r,e){function n(t){return o(this,t).get(t)}var o=e(10);t.exports=n},function(t,r,e){function n(t){return o(this,t).has(t)}var o=e(10);t.exports=n},function(t,r,e){function n(t,r){var e=o(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this}var o=e(10);t.exports=n},function(t,r){function e(t){var r=-1,e=Array(t.size);return t.forEach(function(t,n){e[++r]=[n,t]}),e}t.exports=e},function(t,r,e){function n(t){var r=o(t,function(t){return e.size===i&&e.clear(),t}),e=r.cache;return r}var o=e(140),i=500;t.exports=n},function(t,r,e){var n=e(45),o=n(Object.keys,Object);t.exports=o},function(t,r,e){(function(t){var n=e(38),o="object"==typeof r&&r&&!r.nodeType&&r,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,u=i&&i.exports===o,c=u&&n.process,a=function(){try{return c&&c.binding&&c.binding("util")}catch(t){}}();t.exports=a}).call(r,e(49)(t))},function(t,r){function e(t){return o.call(t)}var n=Object.prototype,o=n.toString;t.exports=e},function(t,r){function e(t){return this.__data__.set(t,n),this}var n="__lodash_hash_undefined__";t.exports=e},function(t,r){function e(t){return this.__data__.has(t)}t.exports=e},function(t,r){function e(t){var r=-1,e=Array(t.size);return t.forEach(function(t){e[++r]=t}),e}t.exports=e},function(t,r,e){function n(){this.__data__=new o,this.size=0}var o=e(7);t.exports=n},function(t,r){function e(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e}t.exports=e},function(t,r){function e(t){return this.__data__.get(t)}t.exports=e},function(t,r){function e(t){return this.__data__.has(t)}t.exports=e},function(t,r,e){function n(t,r){var e=this.__data__;if(e instanceof o){var n=e.__data__;if(!i||n.length1)for(var e=1;e