@notabene/javascript-sdk 2.0.0-next.13 → 2.0.0-next.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -48,10 +48,24 @@ There are two options for loading the Notabene SDK:
48
48
 
49
49
  Or installing the library:
50
50
 
51
+ Using Yarn:
52
+
51
53
  ```bash
52
54
  yarn add @notabene/javascript-sdk
53
55
  ```
54
56
 
57
+ Using NPM:
58
+
59
+ ```bash
60
+ npm install @notabene/javascript-sdk
61
+ ```
62
+
63
+ If you installed the library into your project, you can import it into your project:
64
+
65
+ ```js
66
+ import Notabene from '@notabene/javascript-sdk';
67
+ ```
68
+
55
69
  ## Usage
56
70
 
57
71
  ### Authentication
@@ -65,7 +79,6 @@ Use the [customer token endpoint](https://devx.notabene.id/docs/customertoken) w
65
79
  Create a new Notabene instance:
66
80
 
67
81
  ```js
68
-
69
82
  const notabene = new Notabene({
70
83
  nodeUrl: 'https://api.notabene.id',
71
84
  authToken: '{CUSTOMER_TOKEN}',
@@ -100,7 +113,7 @@ The simplest way to get the result is to use:
100
113
 
101
114
  ```js
102
115
  try {
103
- const {valid, ivms101} = await withdrawal.completion()
116
+ const { valid, value, txCreate, ivms101, proof } = await withdrawal.completion()
104
117
  if (valid) {
105
118
  // Submit result to your backend
106
119
  }
@@ -124,7 +137,7 @@ withdrawal.update({
124
137
  To be notified once the validation is completed so you can submit the withdrawal to your back end:
125
138
 
126
139
  ```js
127
- withdrawal.on('complete', {valid, txCreate } => ...)
140
+ withdrawal.on('complete', { valid, value, txCreate, ivms101, proof } => ...)
128
141
  ```
129
142
 
130
143
  To be notified of any errors use:
@@ -211,7 +224,7 @@ Instantiate the modal and open it
211
224
 
212
225
  ```js
213
226
  const connect = notabene.createConnectWallet({asset:'ETH'}, options);
214
- const {valid, ivms101, proof } = await connect.openModal();
227
+ const { valid, value, txCreate, ivms101, proof } = await connect.openModal();
215
228
  ```
216
229
 
217
230
  ### Linked Component
@@ -254,6 +267,12 @@ All components can be configured using an optional [TransactionOptions](./docs/i
254
267
  The following shows the full set of options in typescript:
255
268
 
256
269
  ```ts
270
+ import Notabene, {
271
+ AgentType,
272
+ PersonType,
273
+ ProofTypes,
274
+ } from '@notabene/javascript-sdk';
275
+
257
276
  const options: TransactionOptions = {
258
277
  proofs: {
259
278
  microTransfer: {
@@ -261,13 +280,13 @@ const options: TransactionOptions = {
261
280
  amountSubunits: '12344',
262
281
  timeout: 86440,
263
282
  },
264
- fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration],
283
+ fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
265
284
  },
266
- allowedAgentTypes: [AgentType.PRIVATE, AgentType.VASP],
285
+ allowedAgentTypes: [AgentType.PRIVATE, AgentType.VASP], // js ['WALLET','VASP']
267
286
  allowedCounterpartyTypes: [
268
- PersonType.LEGAL,
269
- PersonType.NATURAL,
270
- PersonType.SELF,
287
+ PersonType.LEGAL, // JS: 'legal'
288
+ PersonType.NATURAL, // JS: 'natural'
289
+ PersonType.SELF, // JS: 'self'
271
290
  ],
272
291
  fields: {
273
292
  naturalPerson: {
@@ -291,6 +310,10 @@ const options: TransactionOptions = {
291
310
  nationalIdentification: false,
292
311
  countryOfRegistration: true,
293
312
  },
313
+ vasps: {
314
+ addUnknown: true, // Allow users to add a missing VASP - Defaults to false
315
+ onlyActive: true // Only list active VASPs - Default false
316
+ }
294
317
  },
295
318
  };
296
319
  const withdrawal = notabene.createWithdrawalAssist(tx, options);
@@ -303,7 +326,7 @@ const withdrawal = notabene.createWithdrawalAssist(tx, options);
303
326
  ```ts
304
327
  const firstParty: TransactionOptions = {
305
328
  allowedCounterpartyTypes: [
306
- PersonType.SELF,
329
+ PersonType.SELF, // JS: 'self'
307
330
  ],
308
331
  };
309
332
  ```
@@ -312,7 +335,7 @@ const firstParty: TransactionOptions = {
312
335
 
313
336
  ```ts
314
337
  const vasp2vasp: TransactionOptions = {
315
- allowedAgentTypes: [AgentType.VASP],
338
+ allowedAgentTypes: [AgentType.VASP], // js ['VASP']
316
339
  };
317
340
  ```
318
341
 
@@ -320,7 +343,7 @@ const vasp2vasp: TransactionOptions = {
320
343
 
321
344
  ```ts
322
345
  const options: TransactionOptions = {
323
- allowedAgentTypes: [AgentType.PRIVATE],
346
+ allowedAgentTypes: [AgentType.PRIVATE], // js ['WALLET']
324
347
  };
325
348
  ```
326
349
 
@@ -343,7 +366,7 @@ const options: TransactionOptions = {
343
366
  amountSubunits: '1234',
344
367
  timeout: 86440, // Optional timeout in seconds, which is displayed to the user
345
368
  },
346
- fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration],
369
+ fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
347
370
  }
348
371
  }
349
372
  ```
@@ -371,7 +394,7 @@ You may accept a few options if none of the other are available. We do not recom
371
394
  ```ts
372
395
  const options: TransactionOptions = {
373
396
  proofs: {
374
- fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration],
397
+ fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
375
398
  }
376
399
  }
377
400
  ```
@@ -0,0 +1 @@
1
+ function e(e){return e&&e.__esModule?e.default:e}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r={},t={},o=n.parcelRequire31dc;null==o&&((o=function(e){if(e in r)return r[e].exports;if(e in t){var n=t[e];delete t[e];var o={id:e,exports:{}};return r[e]=o,n.call(o.exports,o,o.exports),o.exports}var i=new Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(e,n){t[e]=n},n.parcelRequire31dc=o),o.register("cZQrj",(function(e,n){"undefined"!=typeof self?self:e.exports,e.exports=function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=n,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,n){if(1&n&&(e=r(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)r.d(t,o,function(n){return e[n]}.bind(null,o));return t},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return{}.hasOwnProperty.call(e,n)},r.p="",r(r.s=0)}([function(e,n,r){r.r(n),r.d(n,"ElementNode",(function(){return i})),r.d(n,"FragmentNode",(function(){return a})),r.d(n,"TextNode",(function(){return u})),r.d(n,"ComponentNode",(function(){return c})),r.d(n,"node",(function(){return h})),r.d(n,"Fragment",(function(){return p})),r.d(n,"text",(function(){return w})),r.d(n,"dom",(function(){return _})),r.d(n,"react",(function(){return C})),r.d(n,"html",(function(){return W})),r.d(n,"preact",(function(){return R})),r.d(n,"regex",(function(){return A})),r.d(n,"NODE_TYPE",(function(){return t})),r.d(n,"Style",(function(){return M})),r.d(n,"Regex",(function(){return k})),r.d(n,"RegexText",(function(){return z})),r.d(n,"RegexWord",(function(){return F})),r.d(n,"RegexCharacters",(function(){return L})),r.d(n,"RegexGroup",(function(){return U})),r.d(n,"RegexUnion",(function(){return q}));var t={ELEMENT:"element",TEXT:"text",COMPONENT:"component",FRAGMENT:"fragment"};function o(e,n){for(var r=[],t=0;t<e.length;t++){var o=e[t].render(n);if(o)if(Array.isArray(o))for(var i=0;i<o.length;i++){var a=o[i];a&&r.push(a)}else r.push(o)}return r}var i=function(){function e(e,n,r){this.type=t.ELEMENT,this.name=void 0,this.props=void 0,this.children=void 0,this.onRender=void 0,this.name=e,this.props=n||{},this.children=r;var o=this.props.onRender;"function"==typeof o&&(this.onRender=o,delete n.onRender)}var n=e.prototype;return n.render=function(e){var n=e(this);return this.onRender&&this.onRender(n),n},n.renderChildren=function(e){return o(this.children,e)},e}(),a=function(){function e(e){this.type=t.FRAGMENT,this.children=void 0,this.children=e}return e.prototype.render=function(e){return o(this.children,e)},e}(),u=function(){function e(e){this.type=t.TEXT,this.text=void 0,this.text=e}return e.prototype.render=function(e){return e(this)},e}(),c=function(){function e(e,n,r){this.type=t.COMPONENT,this.component=void 0,this.props=void 0,this.children=void 0,this.component=e,this.props=n||{},this.children=r,this.props.children=r}var n=e.prototype;return n.renderComponent=function(e){var n,r,t=(n=this.component(this.props,this.children),1===(r=s(Array.isArray(n)?n:[n])).length?r[0]:r.length>1?new a(r):void 0);if(t)return t.render(e)},n.render=function(e){return e(this)},n.renderChildren=function(e){return o(this.children,e)},e}();function s(e){for(var n=[],r=0;r<e.length;r++){var o=e[r];if(o)if("string"==typeof o||"number"==typeof o)n.push(new u(o.toString()));else{if("boolean"==typeof o)continue;if(Array.isArray(o))for(var i=0,a=s(o);i<a.length;i++)n.push(a[i]);else{if(!o||o.type!==t.ELEMENT&&o.type!==t.TEXT&&o.type!==t.COMPONENT)throw new TypeError("Unrecognized node type: "+typeof o);n.push(o)}}}return n}var d,f,l,h=function(e,n){for(var r=arguments.length,t=new Array(r>2?r-2:0),o=2;o<r;o++)t[o-2]=arguments[o];if(t=s(t),"string"==typeof e)return new i(e,n,t);if("function"==typeof e)return new c(e,n,t);throw new TypeError("Expected jsx element to be a string or a function")},p=function(e,n){return n};function w(){return function e(n){if(n.type===t.COMPONENT)return[].concat(n.renderComponent(e)).join("");if(n.type===t.ELEMENT)throw new Error("Text renderer does not support basic elements");if(n.type===t.TEXT)return n.text;throw new TypeError("Unhandleable node: "+n.type)}}function v(e){return null!=e}var m=((d={}).svg="http://www.w3.org/2000/svg",d),y=((f={})["xlink:href"]="http://www.w3.org/1999/xlink",f);function g(e,n){return e.createTextNode(n.text)}function E(e,n){for(var r=n.props,t=0,o=Object.keys(r);t<o.length;t++){var i=o[t],a=r[i];if(null!=a&&"el"!==i&&"innerHTML"!==i)if(i.match(/^on[A-Z][a-z]/)&&"function"==typeof a)e.addEventListener(i.slice(2).toLowerCase(),a);else if("string"==typeof a||"number"==typeof a){var u=y[i];u?e.setAttributeNS(u,i,a.toString()):e.setAttribute(i,a.toString())}else"boolean"==typeof a&&!0===a&&e.setAttribute(i,"")}"iframe"!==e.tagName.toLowerCase()||r.id||e.setAttribute("id","jsx-iframe-"+"xxxxxxxxxx".replace(/./g,(function(){return"0123456789abcdef".charAt(Math.floor(16*Math.random()))})))}var b=((l={}).iframe=function(e,n){var r=n.children[0];if(1!==n.children.length||!r||r.type!==t.ELEMENT||"html"!==r.name)throw new Error("Expected only single html element node as child of iframe element");e.addEventListener("load",(function(){var n=e.contentWindow;if(!n)throw new Error("Expected frame to have contentWindow");for(var t=n.document,o=t.documentElement;o.children&&o.children.length;)o.removeChild(o.children[0]);for(var i=r.render(_({doc:t}));i.children.length;)o.appendChild(i.children[0])}))},l.script=function(e,n){var r=n.children[0];if(1!==n.children.length||!r||r.type!==t.TEXT)throw new Error("Expected only single text node as child of script element");e.text=r.text},l.default=function(e,n,r){for(var t=0,o=n.renderChildren(r);t<o.length;t++)e.appendChild(o[t])},l);function x(e,n,r,t){if(n.props.hasOwnProperty("innerHTML")){if(n.children.length)throw new Error("Expected no children to be passed when innerHTML prop is set");var o=n.props.innerHTML;if("string"!=typeof o)throw new TypeError("innerHTML prop must be string");"script"===n.name?e.text=o:(e.innerHTML=o,function(e,n){void 0===n&&(n=window.document);for(var r=0,t=e.querySelectorAll("script");r<t.length;r++){var o=t[r],i=o.parentNode;if(i){var a=n.createElement("script");a.text=o.textContent,i.replaceChild(a,o)}}}(e,r))}else(b[n.name]||b.default)(e,n,t)}function _(e){void 0===e&&(e={});var n=e.doc,r=void 0===n?document:n;return function e(n){if(n.type===t.COMPONENT)return n.renderComponent(e);if(n.type===t.TEXT)return g(r,n);if(n.type===t.ELEMENT){var o=m[n.name.toLowerCase()];if(o)return function e(n,o){if(n.type===t.COMPONENT)return n.renderComponent((function(n){return e(n,o)}));if(n.type===t.TEXT)return g(r,n);if(n.type===t.ELEMENT){var i=(a=n,u=o,r.createElementNS(u,a.name));return E(i,n),x(i,n,r,(function(n){return e(n,o)})),i}var a,u;throw new TypeError("Unhandleable node")}(n,o);var i=(a=r,(u=n).props.el?u.props.el:a.createElement(u.name));return E(i,n),x(i,n,r,e),i}var a,u;throw new TypeError("Unhandleable node")}}function P(){return(P=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)({}).hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}function T(e,n){if(null==e)return{};var r,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)n.indexOf(r=i[t])>=0||(o[r]=e[r]);return o}var O=["innerHTML","class"];function C(e){var n=(void 0===e?{}:e).React;if(!n)throw new Error("Must pass React library to react renderer");return function e(r){if(r.type===t.COMPONENT)return n.createElement.apply(n,[function(){return r.renderComponent(e)||null},r.props].concat(r.renderChildren(e)));if(r.type===t.ELEMENT)return n.createElement.apply(n,[r.name,(o=r.props,i=o.innerHTML,P({dangerouslySetInnerHTML:i?{__html:i}:null,className:o.class},T(o,O)))].concat(r.renderChildren(e)));var o,i;if(r.type===t.TEXT)return r.text;throw new TypeError("Unhandleable node")}}var N={br:!0};function D(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/\//g,"&#x2F;")}function W(){return function e(n){if(n.type===t.COMPONENT)return[].concat(n.renderComponent(e)).join("");if(n.type===t.ELEMENT){var r=(i=n.props,(a=Object.keys(i).filter((function(e){var n=i[e];return"innerHTML"!==e&&("string"==typeof n||"number"==typeof n||!0===n)}))).length?" "+a.map((function(e){var n=i[e];if(!0===n)return""+D(e);if("string"!=typeof n&&"number"!=typeof n)throw new TypeError("Unexpected prop type: "+typeof n);return""===n?D(e):D(e)+'="'+D(n.toString())+'"'})).join(" "):"");if(N[n.name])return"<"+n.name+r+" />";var o="string"==typeof n.props.innerHTML?n.props.innerHTML:n.renderChildren(e).join("");return"<"+n.name+r+">"+o+"</"+n.name+">"}var i,a;if(n.type===t.TEXT)return D(n.text);throw new TypeError("Unhandleable node: "+n.type)}}var S=["innerHTML"];function R(e){var n=(void 0===e?{}:e).Preact;if(!n)throw new Error("Must pass Preact library to react renderer");return function e(r){if(r.type===t.COMPONENT)return n.h.apply(n,[function(){return r.renderComponent(e)||null},r.props].concat(r.renderChildren(e)));if(r.type===t.ELEMENT)return n.h.apply(n,[r.name,(o=r.props,i=o.innerHTML,P({dangerouslySetInnerHTML:i?{__html:i}:null},T(o,S)))].concat(r.renderChildren(e)));var o,i;if(r.type===t.TEXT)return r.text;throw new TypeError("Unhandleable node")}}function A(){var e=w();return function(n){return new RegExp(e(n))}}function M(e){var n=e.css,r=e.nonce,t=e.children;return h(p,null,h("style",{innerHTML:"string"==typeof n?n:n._getCss(),nonce:r}),t)}A.node=function(e,n){for(var r=arguments.length,t=new Array(r>2?r-2:0),o=2;o<r;o++)t[o-2]=arguments[o];var i=h.apply(void 0,[e,n].concat(t));return e.renderer?i.render(e.renderer()):i};var j=function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&")},I=function(e,n){return(n=function(e,n){if(!n)throw new Error("Must pass children to "+e);return n}(e,n)).map((function(e){return e.type===t.TEXT?new u(j(e.text)):e}))};function k(e,n){var r=e.exact,t=void 0===r||r;return n=I("RegexGroup",n),t?["^"].concat(n,["$"]):n}function z(e,n){return I("RegexText",n)}function F(e,n){return function(e,n){if(n&&n.length)throw new Error("Must not pass children to RegexWord")}(0,n),"\\w+"}function L(e,n){return["["].concat(I("RegexText",n),["]"])}function U(e,n){var r=e.repeat,t=e.repeatMin,o=e.repeatMax,i=e.name,a=e.optional,c=void 0!==a&&a,s=e.capture,d=void 0===s||s,f=e.union,l=void 0!==f&&f;if(n=I("RegexGroup",n),v(r)&&(v(t)||v(o)))throw new Error("repeat can not be used with repeatMin or repeatMax");if(i&&!d)throw new Error("Named groups must be captured");if(l){for(var h=[],p=0,w=n;p<w.length;p++)h.push(w[p]),h.push(new u("|"));h.pop(),n=h}var m=[];return m.push(d?"(":"(?:"),i&&m.push("?<"+j(i)+">"),m.push.apply(m,n),m.push(")"),v(r)&&("number"==typeof r?m.push("{"+r+"}"):!0===r&&m.push("+")),(v(t)||v(o))&&m.push("{"+(t||"")+","+(o||"")+"}"),c&&m.push("?"),m}function q(e,n){for(var r=[],t=0,o=n=I("RegexGroup",n);t<o.length;t++)r.push(o[t]),r.push("|");return r.pop(),r}k.renderer=A}])})),o.register("cBfIu",(function(e,n){var r=o("8BAlD").Buffer;"undefined"!=typeof self?self:e.exports,e.exports=function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=n,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,n){if(1&n&&(e=r(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)r.d(t,o,function(n){return e[n]}.bind(null,o));return t},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return{}.hasOwnProperty.call(e,n)},r.p="",r(r.s=0)}([function(e,n,t){function o(e,n){return(o=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function i(e,n){e.prototype=Object.create(n.prototype),e.prototype.constructor=e,o(e,n)}function a(){return(a=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)({}).hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}function u(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&"function"==typeof window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&"function"==typeof window.constructor&&e instanceof window.constructor)return!1;var n={}.toString;if(n){var r=n.call(e);if("[object Window]"===r||"[object global]"===r||"[object DOMWindow]"===r)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}t.r(n),t.d(n,"PopupOpenError",(function(){return Fe})),t.d(n,"create",(function(){return kr})),t.d(n,"destroy",(function(){return Lr})),t.d(n,"destroyComponents",(function(){return zr})),t.d(n,"destroyAll",(function(){return Fr})),t.d(n,"PROP_TYPE",(function(){return wr})),t.d(n,"PROP_SERIALIZATION",(function(){return vr})),t.d(n,"CONTEXT",(function(){return mr})),t.d(n,"EVENT",(function(){return yr}));var c,s=[],d=[],f=0;function l(){if(!f&&c){var e=c;c=null,e.resolve()}}function h(){f+=1}function p(){f-=1,l()}var w=function(){function e(e){var n=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],e){var r,t,o=!1,i=!1,a=!1;h();try{e((function(e){a?n.resolve(e):(o=!0,r=e)}),(function(e){a?n.reject(e):(i=!0,t=e)}))}catch(e){return p(),void this.reject(e)}p(),a=!0,o?this.resolve(r):i&&this.reject(t)}}var n=e.prototype;return n.resolve=function(e){if(this.resolved||this.rejected)return this;if(u(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},n.reject=function(e){var n=this;if(this.resolved||this.rejected)return this;if(u(e))throw new Error("Can not reject promise with another promise");if(!e){var r=e&&"function"==typeof e.toString?e.toString():{}.toString.call(e);e=new Error("Expected reject to be called with Error, got "+r)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout((function(){n.errorHandled||function(e,n){if(-1===s.indexOf(e)){s.push(e),setTimeout((function(){throw e}),1);for(var r=0;r<d.length;r++)d[r](e,n)}}(e,n)}),1),this.dispatch(),this},n.asyncReject=function(e){return this.errorHandled=!0,this.reject(e),this},n.dispatch=function(){var n=this.resolved,r=this.rejected,t=this.handlers;if(!this.dispatching&&(n||r)){this.dispatching=!0,h();for(var o=function(e,n){return e.then((function(e){n.resolve(e)}),(function(e){n.reject(e)}))},i=0;i<t.length;i++){var a=t[i],c=a.onSuccess,s=a.onError,d=a.promise,f=void 0;if(n)try{f=c?c(this.value):this.value}catch(e){d.reject(e);continue}else if(r){if(!s){d.reject(this.error);continue}try{f=s(this.error)}catch(e){d.reject(e);continue}}if(f instanceof e&&(f.resolved||f.rejected)){var l=f;l.resolved?d.resolve(l.value):d.reject(l.error),l.errorHandled=!0}else u(f)?f instanceof e&&(f.resolved||f.rejected)?f.resolved?d.resolve(f.value):d.reject(f.error):o(f,d):d.resolve(f)}t.length=0,this.dispatching=!1,p()}},n.then=function(n,r){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for success handler");if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.then expected a function for error handler");var t=new e;return this.handlers.push({promise:t,onSuccess:n,onError:r}),this.errorHandled=!0,this.dispatch(),t},n.catch=function(e){return this.then(void 0,e)},n.finally=function(n){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.finally expected a function");return this.then((function(r){return e.try(n).then((function(){return r}))}),(function(r){return e.try(n).then((function(){throw r}))}))},n.timeout=function(e,n){var r=this;if(this.resolved||this.rejected)return this;var t=setTimeout((function(){r.resolved||r.rejected||r.reject(n||new Error("Promise timed out after "+e+"ms"))}),e);return this.then((function(e){return clearTimeout(t),e}))},n.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.lazy=function(){return this.errorHandled=!0,this},e.resolve=function(n){return n instanceof e?n:u(n)?new e((function(e,r){return n.then(e,r)})):(new e).resolve(n)},e.reject=function(n){return(new e).reject(n)},e.asyncReject=function(n){return(new e).asyncReject(n)},e.all=function(n){var r=new e,t=n.length,o=[].slice();if(!t)return r.resolve(o),r;for(var i=function(e,n,i){return n.then((function(n){o[e]=n,0==(t-=1)&&r.resolve(o)}),(function(e){i.reject(e)}))},a=0;a<n.length;a++){var c=n[a];if(c instanceof e){if(c.resolved){o[a]=c.value,t-=1;continue}}else if(!u(c)){o[a]=c,t-=1;continue}i(a,e.resolve(c),r)}return 0===t&&r.resolve(o),r},e.hash=function(n){var r={},t=[],o=function(e){if(n.hasOwnProperty(e)){var o=n[e];u(o)?t.push(o.then((function(n){r[e]=n}))):r[e]=o}};for(var i in n)o(i);return e.all(t).then((function(){return r}))},e.map=function(n,r){return e.all(n.map(r))},e.onPossiblyUnhandledException=function(e){return n=e,d.push(n),{cancel:function(){d.splice(d.indexOf(n),1)}};var n},e.try=function(n,r,t){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.try expected a function");var o;h();try{o=n.apply(r,t||[])}catch(n){return p(),e.reject(n)}return p(),e.resolve(o)},e.delay=function(n){return new e((function(e){setTimeout(e,n)}))},e.isPromise=function(n){return!!(n&&n instanceof e)||u(n)},e.flush=function(){return n=e,r=c=c||new n,l(),r;var n,r},e}();function v(e){return"[object RegExp]"==={}.toString.call(e)}var m={IFRAME:"iframe",POPUP:"popup"},y="Call was rejected by callee.\r\n";function g(e){return void 0===e&&(e=window),e.location.protocol}function E(e){if(void 0===e&&(e=window),e.mockDomain){var n=e.mockDomain.split("//")[0];if(n)return n}return g(e)}function b(e){return void 0===e&&(e=window),"about:"===E(e)}function x(e){if(void 0===e&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch(e){}}function _(e){if(void 0===e&&(e=window),e&&!x(e))try{return e.opener}catch(e){}}function P(e){try{return!0}catch(e){}return!1}function T(e){void 0===e&&(e=window);var n=e.location;if(!n)throw new Error("Can not read window location");var r=g(e);if(!r)throw new Error("Can not read window protocol");if("file:"===r)return"file://";if("about:"===r){var t=x(e);return t&&P()?T(t):"about://"}var o=n.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function O(e){void 0===e&&(e=window);var n=T(e);return n&&e.mockDomain&&0===e.mockDomain.indexOf("mock:")?e.mockDomain:n}function C(e){if(!function(e){try{if(e===window)return!0}catch(e){}try{var n=Object.getOwnPropertyDescriptor(e,"location");if(n&&!1===n.enumerable)return!1}catch(e){}try{if(b(e)&&P())return!0}catch(e){}try{if(void 0===(r=e)&&(r=window),"mock:"===E(r)&&P())return!0}catch(e){}var r;try{if(T(e)===T(window))return!0}catch(e){}return!1}(e))return!1;try{if(e===window)return!0;if(b(e)&&P())return!0;if(O(window)===O(e))return!0}catch(e){}return!1}function N(e){if(!C(e))throw new Error("Expected window to be same domain");return e}function D(e,n){if(!e||!n)return!1;var r=x(n);return r?r===e:-1!==function(e){var n=[];try{for(;e.parent!==e;)n.push(e.parent),e=e.parent}catch(e){}return n}(n).indexOf(e)}function W(e){var n,r,t=[];try{n=e.frames}catch(r){n=e}try{r=n.length}catch(e){}if(0===r)return t;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=n[o]}catch(e){continue}t.push(i)}return t}for(var a=0;a<100;a++){var u=void 0;try{u=n[a]}catch(e){return t}if(!u)return t;t.push(u)}return t}function S(e){for(var n=[],r=0,t=W(e);r<t.length;r++){var o=t[r];n.push(o);for(var i=0,a=S(o);i<a.length;i++)n.push(a[i])}return n}function R(e){void 0===e&&(e=window);try{if(e.top)return e.top}catch(e){}if(x(e)===e)return e;try{if(D(window,e)&&window.top)return window.top}catch(e){}try{if(D(e,window)&&window.top)return window.top}catch(e){}for(var n=0,r=S(e);n<r.length;n++){var t=r[n];try{if(t.top)return t.top}catch(e){}if(x(t)===t)return t}}function A(e){var n=R(e);if(!n)throw new Error("Can not determine top window");var r=[].concat(S(n),[n]);return-1===r.indexOf(e)&&(r=[].concat(r,[e],S(e))),r}var M=[],j=[];function I(e,n){void 0===n&&(n=!0);try{if(e===window)return!1}catch(e){return!0}try{if(!e)return!0}catch(e){return!0}try{if(e.closed)return!0}catch(e){return!e||e.message!==y}if(n&&C(e))try{if(e.mockclosed)return!0}catch(e){}try{if(!e.parent||!e.top)return!0}catch(e){}var r=function(e,n){for(var r=0;r<e.length;r++)try{if(e[r]===n)return r}catch(e){}return-1}(M,e);if(-1!==r){var t=j[r];if(t&&function(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var n=e.ownerDocument;if(n&&n.documentElement&&!n.documentElement.contains(e)){for(var r=e;r.parentNode&&r.parentNode!==r;)r=r.parentNode;if(!r.host||!n.documentElement.contains(r.host))return!0}return!1}(t))return!0}return!1}function k(e){return(e=e||window).navigator.mockUserAgent||e.navigator.userAgent}function z(e,n){for(var r=W(e),t=0;t<r.length;t++){var o=r[t];try{if(C(o)&&o.name===n&&-1!==r.indexOf(o))return o}catch(e){}}try{if(-1!==r.indexOf(e.frames[n]))return e.frames[n]}catch(e){}try{if(-1!==r.indexOf(e[n]))return e[n]}catch(e){}}function F(e,n){return e===_(n)}function L(e){return void 0===e&&(e=window),_(e=e||window)||x(e)||void 0}function U(e,n){for(var r=0;r<e.length;r++)for(var t=e[r],o=0;o<n.length;o++)if(t===n[o])return!0;return!1}function q(e){void 0===e&&(e=window);for(var n=0,r=e;r;)(r=x(r))&&(n+=1);return n}function B(e,n){var r=R(e)||e,t=R(n)||n;try{if(r&&t)return r===t}catch(e){}var o=A(e),i=A(n);if(U(o,i))return!0;var a=_(r),u=_(t);return a&&U(A(a),i)||u&&U(A(u),o),!1}function H(e,n){if("string"==typeof e){if("string"==typeof n)return"*"===e||n===e;if(v(n))return!1;if(Array.isArray(n))return!1}return v(e)?v(n)?e.toString()===n.toString():!Array.isArray(n)&&Boolean(n.match(e)):!!Array.isArray(e)&&(Array.isArray(n)?JSON.stringify(e)===JSON.stringify(n):!v(n)&&e.some((function(e){return H(e,n)})))}function J(e){return e.match(/^(https?|mock|file):\/\//)?e.split("/").slice(0,3).join("/"):O()}function X(e,n,r,t){var o;return void 0===r&&(r=1e3),void 0===t&&(t=1/0),function i(){if(I(e))return o&&clearTimeout(o),n();t<=0?clearTimeout(o):(t-=r,o=setTimeout(i,r))}(),{cancel:function(){o&&clearTimeout(o)}}}function Y(e){try{if(e===window)return!0}catch(e){if(e&&e.message===y)return!0}try{if("[object Window]"==={}.toString.call(e))return!0}catch(e){if(e&&e.message===y)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(e){if(e&&e.message===y)return!0}try{if(e&&e.self===e)return!0}catch(e){if(e&&e.message===y)return!0}try{if(e&&e.parent===e)return!0}catch(e){if(e&&e.message===y)return!0}try{if(e&&e.top===e)return!0}catch(e){if(e&&e.message===y)return!0}try{if(e&&"__unlikely_value__"===e.__cross_domain_utils_window_check__)return!1}catch(e){return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch(e){}return!1}function G(e){if(0!==J(e).indexOf("mock:"))return e;throw new Error("Mock urls not supported out of test mode")}function V(e){if(C(e))return N(e).frameElement;for(var n=0,r=document.querySelectorAll("iframe");n<r.length;n++){var t=r[n];if(t&&t.contentWindow&&t.contentWindow===e)return t}}function Z(e){if(void 0===(r=e)&&(r=window),Boolean(x(r))){var n=V(e);if(n&&n.parentElement)return void n.parentElement.removeChild(n)}var r;try{e.close()}catch(e){}}function $(e,n){for(var r=0;r<e.length;r++)try{if(e[r]===n)return r}catch(e){}return-1}var Q,K=function(){function e(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var e=new WeakMap,n={};return Object.freeze(n),e.set(n,"__testvalue__"),"__testvalue__"===e.get(n)}catch(e){return!1}}())try{this.weakmap=new WeakMap}catch(e){}this.keys=[],this.values=[]}var n=e.prototype;return n._cleanupClosedWindows=function(){for(var e=this.weakmap,n=this.keys,r=0;r<n.length;r++){var t=n[r];if(Y(t)&&I(t)){if(e)try{e.delete(t)}catch(e){}n.splice(r,1),this.values.splice(r,1),r-=1}}},n.isSafeToReadWrite=function(e){return!Y(e)},n.set=function(e,n){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(e,n)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var t=this.name,o=e[t];return void(o&&o[0]===e?o[1]=n:Object.defineProperty(e,t,{value:[e,n],writable:!0}))}catch(e){}this._cleanupClosedWindows();var i=this.keys,a=this.values,u=$(i,e);-1===u?(i.push(e),a.push(n)):a[u]=n},n.get=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{if(n.has(e))return n.get(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=e[this.name];return r&&r[0]===e?r[1]:void 0}catch(e){}this._cleanupClosedWindows();var t=$(this.keys,e);if(-1!==t)return this.values[t]},n.delete=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.delete(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=e[this.name];r&&r[0]===e&&(r[0]=r[1]=void 0)}catch(e){}this._cleanupClosedWindows();var t=this.keys,o=$(t,e);-1!==o&&(t.splice(o,1),this.values.splice(o,1))},n.has=function(e){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{if(n.has(e))return!0}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=e[this.name];return!(!r||r[0]!==e)}catch(e){}return this._cleanupClosedWindows(),-1!==$(this.keys,e)},n.getOrSet=function(e,n){if(this.has(e))return this.get(e);var r=n();return this.set(e,r),r},e}();function ee(e){return(ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ne(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function re(e,n,r){return(re=ne()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var i=new(Function.bind.apply(e,t));return r&&o(i,r.prototype),i}).apply(null,arguments)}function te(e){var n="function"==typeof Map?new Map:void 0;return(te=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return re(e,arguments,ee(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),o(t,e)})(e)}function oe(e){return e.name||e.__name__||e.displayName||"anonymous"}function ie(e,n){try{delete e.name,e.name=n}catch(e){}return e.__name__=e.displayName=n,e}function ae(e){if("function"==typeof btoa)return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(function(e,n){return String.fromCharCode(parseInt(n,16))}))).replace(/[=]/g,"");if(void 0!==r)return r.from(e,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}function ue(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,(function(){return e.charAt(Math.floor(Math.random()*e.length))}))+"_"+ae((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function ce(e){try{return JSON.stringify([].slice.call(e),(function(e,n){return"function"==typeof n?"memoize["+function(e){if(Q=Q||new K,null==e||"object"!=typeof e&&"function"!=typeof e)throw new Error("Invalid object");var n=Q.get(e);return n||(n=typeof e+":"+ue(),Q.set(e,n)),n}(n)+"]":n}))}catch(e){throw new Error("Arguments not serializable -- can not be used to memoize")}}function se(){return{}}var de=0,fe=0;function le(e,n){void 0===n&&(n={});var r,t,o=n.thisNamespace,i=void 0!==o&&o,a=n.time,u=de;de+=1;var c=function(){for(var n=arguments.length,o=new Array(n),c=0;c<n;c++)o[c]=arguments[c];var s;u<fe&&(r=null,t=null,u=de,de+=1),s=i?(t=t||new K).getOrSet(this,se):r=r||{};var d=ce(o),f=s[d];if(f&&a&&Date.now()-f.time<a&&(delete s[d],f=null),f)return f.value;var l=Date.now(),h=e.apply(this,arguments);return s[d]={time:l,value:h},h};return c.reset=function(){r=null,t=null},ie(c,(n.name||oe(e))+"::memoized")}function he(e){var n={};function r(){for(var r=arguments,t=this,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];var u=ce(i);return n.hasOwnProperty(u)||(n[u]=w.try((function(){return e.apply(t,r)})).finally((function(){delete n[u]}))),n[u]}return r.reset=function(){n={}},ie(r,oe(e)+"::promiseMemoized")}function pe(){}function we(e){var n=!1;return ie((function(){if(!n)return n=!0,e.apply(this,arguments)}),oe(e)+"::once")}function ve(e,n){if(void 0===n&&(n=1),n>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+{}.toString.call(e)+">";if("string"==typeof e)return e;if(e instanceof Error){var r=e&&e.stack,t=e&&e.message;if(r&&t)return-1!==r.indexOf(t)?r:t+"\n"+r;if(r)return r;if(t)return t}return e&&e.toString&&"function"==typeof e.toString?e.toString():{}.toString.call(e)}catch(e){return"Error while stringifying error: "+ve(e,n+1)}}function me(e){return"string"==typeof e?e:e&&e.toString&&"function"==typeof e.toString?e.toString():{}.toString.call(e)}function ye(e,n){if(!n)return e;if(Object.assign)return Object.assign(e,n);for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r]);return e}function ge(e){return e}function Ee(e,n){var r;return function t(){r=setTimeout((function(){e(),t()}),n)}(),{cancel:function(){clearTimeout(r)}}}function be(e){return[].slice.call(e)}function xe(e){return null!=e}function _e(e){return"[object RegExp]"==={}.toString.call(e)}function Pe(e,n,r){if(e.hasOwnProperty(n))return e[n];var t=r();return e[n]=t,t}function Te(e){var n,r=[],t=!1,o={set:function(n,r){return t||(e[n]=r,o.register((function(){delete e[n]}))),r},register:function(e){var o=we((function(){return e(n)}));return t?e(n):r.push(o),{cancel:function(){var e=r.indexOf(o);-1!==e&&r.splice(e,1)}}},all:function(e){n=e;var o=[];for(t=!0;r.length;){var i=r.shift();o.push(i())}return w.all(o).then(pe)}};return o}function Oe(e,n){if(null==n)throw new Error("Expected "+e+" to be present");return n}le.clear=function(){fe=de},le((function(e){if(Object.values)return Object.values(e);var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(e[r]);return n}));var Ce=function(e){function n(n){var r;return(r=e.call(this,n)||this).name=r.constructor.name,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r),r.constructor):r.stack=new Error(n).stack,r}return i(n,e),n}(te(Error));function Ne(){var e=document.body;if(!e)throw new Error("Body element not found");return e}function De(){return Boolean(document.body)&&"complete"===document.readyState}function We(){return Boolean(document.body)&&"interactive"===document.readyState}function Se(e){return encodeURIComponent(e)}function Re(e){return function(n,r,t){void 0===t&&(t=[]);var o=n.__inline_memoize_cache__=n.__inline_memoize_cache__||{},i=ce(t);return o.hasOwnProperty(i)?o[i]:o[i]=function(){var n={};if(!e)return n;if(-1===e.indexOf("="))return n;for(var r=0,t=e.split("&");r<t.length;r++){var o=t[r];(o=o.split("="))[0]&&o[1]&&(n[decodeURIComponent(o[0])]=decodeURIComponent(o[1]))}return n}.apply(void 0,t)}(Re,0,[e])}function Ae(e,n){return void 0===n&&(n={}),n&&Object.keys(n).length?(void 0===(r=a({},Re(e),n))&&(r={}),Object.keys(r).filter((function(e){return"string"==typeof r[e]||"boolean"==typeof r[e]})).map((function(e){var n=r[e];if("string"!=typeof n&&"boolean"!=typeof n)throw new TypeError("Invalid type for query");return Se(e)+"="+Se(n.toString())})).join("&")):e;var r}function Me(e,n){e.appendChild(n)}function je(e){return e instanceof window.Element||null!==e&&"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument}function Ie(e,n){return void 0===n&&(n=document),je(e)?e:"string"==typeof e?n.querySelector(e):void 0}function ke(e){return new w((function(n,r){var t=me(e),o=Ie(e);if(o)return n(o);if(De())return r(new Error("Document is ready and element "+t+" does not exist"));var i=setInterval((function(){if(o=Ie(e))n(o),clearInterval(i);else if(De())return clearInterval(i),r(new Error("Document is ready and element "+t+" does not exist"))}),10)}))}le((function(){return new w((function(e){if(De()||We())return e();var n=setInterval((function(){if(De()||We())return clearInterval(n),e()}),10)}))}));var ze,Fe=function(e){function n(){return e.apply(this,arguments)||this}return i(n,e),n}(Ce);function Le(e){if((ze=ze||new K).has(e)){var n=ze.get(e);if(n)return n}var r=new w((function(n,r){e.addEventListener("load",(function(){!function(e){if(function(){for(var e=0;e<M.length;e++){var n=!1;try{n=M[e].closed}catch(e){}n&&(j.splice(e,1),M.splice(e,1))}}(),e&&e.contentWindow)try{M.push(e.contentWindow),j.push(e)}catch(e){}}(e),n(e)})),e.addEventListener("error",(function(t){e.contentWindow?n(e):r(t)}))}));return ze.set(e,r),r}function Ue(e){return Le(e).then((function(e){if(!e.contentWindow)throw new Error("Could not find window in iframe");return e.contentWindow}))}function qe(e,n){void 0===e&&(e={});var r=e.style||{},t=function(e,n,r){void 0===e&&(e="div"),void 0===n&&(n={}),e=e.toLowerCase();var t,o,i,a=document.createElement(e);if(n.style&&ye(a.style,n.style),n.class&&(a.className=n.class.join(" ")),n.id&&a.setAttribute("id",n.id),n.attributes)for(var u=0,c=Object.keys(n.attributes);u<c.length;u++){var s=c[u];a.setAttribute(s,n.attributes[s])}if(n.styleSheet&&(t=a,o=n.styleSheet,void 0===i&&(i=window.document),t.styleSheet?t.styleSheet.cssText=o:t.appendChild(i.createTextNode(o))),n.html){if("iframe"===e)throw new Error("Iframe html can not be written unless container provided and iframe in DOM");a.innerHTML=n.html}return a}("iframe",{attributes:a({allowTransparency:"true"},e.attributes||{}),style:a({backgroundColor:"transparent",border:"none"},r),html:e.html,class:e.class}),o=window.navigator.userAgent.match(/MSIE|Edge/i);return t.hasAttribute("id")||t.setAttribute("id",ue()),Le(t),n&&function(e,n){void 0===n&&(n=document);var r=Ie(e,n);if(r)return r;throw new Error("Can not find element: "+me(e))}(n).appendChild(t),(e.url||o)&&t.setAttribute("src",e.url||"about:blank"),t}function Be(e,n,r){return e.addEventListener(n,r),{cancel:function(){e.removeEventListener(n,r)}}}function He(e){e.style.setProperty("display","")}function Je(e){e.style.setProperty("display","none","important")}function Xe(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ye(e){return!(e&&e.parentNode&&e.ownerDocument&&e.ownerDocument.documentElement&&e.ownerDocument.documentElement.contains(e))}function Ge(e,n,r){var t=void 0===r?{}:r,o=t.width,i=void 0===o||o,a=t.height,u=void 0===a||a,c=t.interval,s=void 0===c?100:c,d=t.win,f=void 0===d?window:d,l=e.offsetWidth,h=e.offsetHeight,p=!1;n({width:l,height:h});var w,v,m=function(){if(!p&&(o=e,Boolean(o.offsetWidth||o.offsetHeight||o.getClientRects().length))){var r=e.offsetWidth,t=e.offsetHeight;(i&&r!==l||u&&t!==h)&&n({width:r,height:t}),l=r,h=t}var o};return f.addEventListener("resize",m),void 0!==f.ResizeObserver?((w=new f.ResizeObserver(m)).observe(e),v=Ee(m,10*s)):void 0!==f.MutationObserver?((w=new f.MutationObserver(m)).observe(e,{attributes:!0,childList:!0,subtree:!0,characterData:!1}),v=Ee(m,10*s)):v=Ee(m,s),{cancel:function(){p=!0,w.disconnect(),window.removeEventListener("resize",m),v.cancel()}}}function Ve(e){for(;e.parentNode;)e=e.parentNode;return"[object ShadowRoot]"===e.toString()}var Ze="undefined"!=typeof document?document.currentScript:null,$e=le((function(){if(Ze)return Ze;if(Ze=function(){try{var e=function(){try{throw new Error("_")}catch(e){return e.stack||""}}(),n=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(e),r=n&&n[1];if(!r)return;for(var t=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();t<o.length;t++){var i=o[t];if(i.src&&i.src===r)return i}}catch(e){}}())return Ze;throw new Error("Can not determine current script")})),Qe=ue();function Ke(e){return"string"==typeof e&&/^[0-9]+%$/.test(e)}function en(e){if("number"==typeof e)return e;var n=e.match(/^([0-9]+)(px|%)$/);if(!n)throw new Error("Could not match css value from "+e);return parseInt(n[1],10)}function nn(e){return en(e)+"px"}function rn(e){return"number"==typeof e?nn(e):Ke(e)?e:nn(e)}function tn(e,n){if("number"==typeof e)return e;if(Ke(e))return parseInt(n*en(e)/100,10);if("string"==typeof(r=e)&&/^[0-9]+px$/.test(r))return en(e);var r;throw new Error("Can not normalize dimension: "+e)}function on(e){void 0===e&&(e=window);var n="__post_robot_10_0_44__";return e!==window?e[n]:e[n]=e[n]||{}}le((function(){var e;try{e=$e()}catch(e){return Qe}var n=e.getAttribute("data-uid");if(n&&"string"==typeof n)return n;if((n=e.getAttribute("data-uid-auto"))&&"string"==typeof n)return n;if(e.src){var r=function(e){for(var n="",r=0;r<e.length;r++){var t=e[r].charCodeAt(0)*r;e[r+1]&&(t+=e[r+1].charCodeAt(0)*(r-1)),n+=String.fromCharCode(97+Math.abs(t)%26)}return n}(JSON.stringify({src:e.src,dataset:e.dataset}));n="uid_"+r.slice(r.length-30)}else n=ue();return e.setAttribute("data-uid-auto",n),n}));var an=function(){return{}};function un(e,n){return void 0===e&&(e="store"),void 0===n&&(n=an),Pe(on(),e,(function(){var e=n();return{has:function(n){return e.hasOwnProperty(n)},get:function(n,r){return e.hasOwnProperty(n)?e[n]:r},set:function(n,r){return e[n]=r,r},del:function(n){delete e[n]},getOrSet:function(n,r){return Pe(e,n,r)},reset:function(){e=n()},keys:function(){return Object.keys(e)}}}))}var cn,sn=function(){};function dn(){var e=on();return e.WINDOW_WILDCARD=e.WINDOW_WILDCARD||new sn,e.WINDOW_WILDCARD}function fn(e,n){return void 0===e&&(e="store"),void 0===n&&(n=an),un("windowStore").getOrSet(e,(function(){var r=new K,t=function(e){return r.getOrSet(e,n)};return{has:function(n){return t(n).hasOwnProperty(e)},get:function(n,r){var o=t(n);return o.hasOwnProperty(e)?o[e]:r},set:function(n,r){return t(n)[e]=r,r},del:function(n){delete t(n)[e]},getOrSet:function(n,r){return Pe(t(n),e,r)}}}))}function ln(){return un("instance").getOrSet("instanceID",ue)}function hn(e,n){var r=n.domain,t=fn("helloPromises"),o=t.get(e);o&&o.resolve({domain:r});var i=w.resolve({domain:r});return t.set(e,i),i}function pn(e,n){return(0,n.send)(e,"postrobot_hello",{instanceID:ln()},{domain:"*",timeout:-1}).then((function(n){var r=n.origin,t=n.data.instanceID;return hn(e,{domain:r}),{win:e,domain:r,instanceID:t}}))}function wn(e,n){var r=n.send;return fn("windowInstanceIDPromises").getOrSet(e,(function(){return pn(e,{send:r}).then((function(e){return e.instanceID}))}))}function vn(e,n,r){void 0===n&&(n=5e3),void 0===r&&(r="Window");var t,o=(t=e,fn("helloPromises").getOrSet(t,(function(){return new w})));return-1!==n&&(o=o.timeout(n,new Error(r+" did not load after "+n+"ms"))),o}function mn(e){fn("knownWindows").set(e,!0)}function yn(e){return"object"==typeof e&&null!==e&&"string"==typeof e.__type__}function gn(e){return void 0===e?"undefined":null===e?"null":Array.isArray(e)?"array":"function"==typeof e?"function":"object"==typeof e?e instanceof Error?"error":"function"==typeof e.then?"promise":"[object RegExp]"==={}.toString.call(e)?"regex":"[object Date]"==={}.toString.call(e)?"date":"object":"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":void 0}function En(e,n){return{__type__:e,__val__:n}}var bn,xn=((cn={}).function=function(){},cn.error=function(e){return En("error",{message:e.message,stack:e.stack,code:e.code,data:e.data})},cn.promise=function(){},cn.regex=function(e){return En("regex",e.source)},cn.date=function(e){return En("date",e.toJSON())},cn.array=function(e){return e},cn.object=function(e){return e},cn.string=function(e){return e},cn.number=function(e){return e},cn.boolean=function(e){return e},cn.null=function(e){return e},cn[void 0]=function(e){return En("undefined",e)},cn),_n={},Pn=((bn={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},bn.error=function(e){var n=e.stack,r=e.code,t=e.data,o=new Error(e.message);return o.code=r,t&&(o.data=t),o.stack=n+"\n\n"+o.stack,o},bn.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},bn.regex=function(e){return new RegExp(e)},bn.date=function(e){return new Date(e)},bn.array=function(e){return e},bn.object=function(e){return e},bn.string=function(e){return e},bn.number=function(e){return e},bn.boolean=function(e){return e},bn.null=function(e){return e},bn[void 0]=function(){},bn),Tn={};function On(){return!!k(window).match(/MSIE|trident|edge\/12|edge\/13/i)}function Cn(e){return!B(window,e)}function Nn(e,n){if(e){if(O()!==J(e))return!0}else if(n&&!C(n))return!0;return!1}function Dn(e){var n=e.win,r=e.domain;return!(!On()||r&&!Nn(r,n)||n&&!Cn(n))}function Wn(e){return"__postrobot_bridge___"+(e=e||J(e)).replace(/[^a-zA-Z0-9]+/g,"_")}function Sn(){return Boolean(window.name&&window.name===Wn(O()))}var Rn=new w((function(e){if(window.document&&window.document.body)return e(window.document.body);var n=setInterval((function(){if(window.document&&window.document.body)return clearInterval(n),e(window.document.body)}),10)}));function An(e){fn("remoteWindowPromises").getOrSet(e,(function(){return new w}))}function Mn(e){var n=fn("remoteWindowPromises").get(e);if(!n)throw new Error("Remote window promise not found");return n}function jn(e,n,r){Mn(e).resolve((function(t,o,i){if(t!==e)throw new Error("Remote window does not match window");if(!H(o,n))throw new Error("Remote domain "+o+" does not match domain "+n);r.fireAndForget(i)}))}function In(e,n){Mn(e).reject(n).catch(pe)}function kn(e){for(var n=e.win,r=e.name,t=e.domain,o=un("popupWindowsByName"),i=fn("popupWindowsByWin"),a=0,u=o.keys();a<u.length;a++){var c=u[a],s=o.get(c);s&&!I(s.win)||o.del(c)}if(I(n))return{win:n,name:r,domain:t};var d=i.getOrSet(n,(function(){return r?o.getOrSet(r,(function(){return{win:n,name:r}})):{win:n}}));if(d.win&&d.win!==n)throw new Error("Different window already linked for window: "+(r||"undefined"));return r&&(d.name=r,o.set(r,d)),t&&(d.domain=t,An(n)),i.set(n,d),d}function zn(e){var n,r,t,o,i,a,u=e.on,c=e.send,s=e.receiveMessage;n=window.open,window.open=function(e,r,t,o){var i=n.call(this,G(e),r,t,o);return i?(kn({win:i,name:r,domain:e?J(e):null}),i):i},t=(r={on:u,send:c,receiveMessage:s}).on,o=r.send,i=r.receiveMessage,a=un("popupWindowsByName"),t("postrobot_open_tunnel",(function(e){var n=e.source,r=e.origin,u=e.data,c=un("bridges").get(r);if(!c)throw new Error("Can not find bridge promise for domain "+r);return c.then((function(e){if(n!==e)throw new Error("Message source does not matched registered bridge for domain "+r);if(!u.name)throw new Error("Register window expected to be passed window name");if(!u.sendMessage)throw new Error("Register window expected to be passed sendMessage method");if(!a.has(u.name))throw new Error("Window with name "+u.name+" does not exist, or was not opened by this window");var c=function(){return a.get(u.name)};if(!c().domain)throw new Error("We do not have a registered domain for window "+u.name);if(c().domain!==r)throw new Error("Message origin "+r+" does not matched registered window origin "+(c().domain||"unknown"));return jn(c().win,r,u.sendMessage),{sendMessage:function(e){if(window&&!window.closed&&c()){var n=c().domain;if(n)try{i({data:e,origin:n,source:c().win},{on:t,send:o})}catch(e){w.reject(e)}}}}}))})),function(e){var n=e.send;on(window).openTunnelToParent=function(e){var r=e.name,t=e.source,o=e.canary,i=e.sendMessage,a=un("tunnelWindows"),u=x(window);if(!u)throw new Error("No parent window found to open tunnel to");var c=function(e){var n=e.name,r=e.source,t=e.canary,o=e.sendMessage;!function(){for(var e=un("tunnelWindows"),n=0,r=e.keys();n<r.length;n++){var t=r[n];I(e[t].source)&&e.del(t)}}();var i=ue();return un("tunnelWindows").set(i,{name:n,source:r,canary:t,sendMessage:o}),i}({name:r,source:t,canary:o,sendMessage:i});return n(u,"postrobot_open_tunnel",{name:r,sendMessage:function(){var e=a.get(c);if(e&&e.source&&!I(e.source)){try{e.canary()}catch(e){return}e.sendMessage.apply(this,arguments)}}},{domain:"*"})}}({send:c}),function(e){var n=e.on,r=e.send,t=e.receiveMessage;w.try((function(){var e,o=_(window);if(o&&Dn({win:o}))return An(o),(e=o,fn("remoteBridgeAwaiters").getOrSet(e,(function(){return w.try((function(){var n=z(e,Wn(O()));if(n)return C(n)&&on(N(n))?n:new w((function(e){var r,t;r=setInterval((function(){if(n&&C(n)&&on(N(n)))return clearInterval(r),clearTimeout(t),e(n)}),100),t=setTimeout((function(){return clearInterval(r),e()}),2e3)}))}))}))).then((function(e){return e?window.name?on(N(e)).openTunnelToParent({name:window.name,source:window,canary:function(){},sendMessage:function(e){if(window&&!window.closed)try{t({data:e,origin:this.origin,source:this.source},{on:n,send:r})}catch(e){w.reject(e)}}}).then((function(e){var n=e.source,r=e.origin,t=e.data;if(n!==o)throw new Error("Source does not match opener");jn(n,r,t.sendMessage)})).catch((function(e){throw In(o,e),e})):In(o,new Error("Can not register with opener: window does not have a name")):In(o,new Error("Can not register with opener: no bridge found in opener"))}))}))}({on:u,send:c,receiveMessage:s})}function Fn(){for(var e=un("idToProxyWindow"),n=0,r=e.keys();n<r.length;n++){var t=r[n];e.get(t).shouldClean()&&e.del(t)}}function Ln(e,n){var r=n.send,t=n.id,o=void 0===t?ue():t,i=e.then((function(e){if(C(e))return N(e).name})),a=e.then((function(e){if(I(e))throw new Error("Window is closed, can not determine type");return _(e)?m.POPUP:m.IFRAME}));i.catch(pe),a.catch(pe);var u=function(){return e.then((function(e){if(!I(e))return C(e)?N(e).name:i}))};return{id:o,getType:function(){return a},getInstanceID:he((function(){return e.then((function(e){return wn(e,{send:r})}))})),close:function(){return e.then(Z)},getName:u,focus:function(){return e.then((function(e){e.focus()}))},isClosed:function(){return e.then((function(e){return I(e)}))},setLocation:function(n,r){return void 0===r&&(r={}),e.then((function(e){var t=window.location.protocol+"//"+window.location.host,o=r.method,i=void 0===o?"get":o,a=r.body;if(0===n.indexOf("/"))n=""+t+n;else if(!n.match(/^https?:\/\//)&&0!==n.indexOf(t))throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(n));if("post"===i)return u().then((function(e){if(!e)throw new Error("Can not post to window without target name");!function(e){var n=e.url,r=e.target,t=e.body,o=e.method,i=void 0===o?"post":o,a=document.createElement("form");if(a.setAttribute("target",r),a.setAttribute("method",i),a.setAttribute("action",n),a.style.display="none",t)for(var u=0,c=Object.keys(t);u<c.length;u++){var s,d=c[u],f=document.createElement("input");f.setAttribute("name",d),f.setAttribute("value",null==(s=t[d])?void 0:s.toString()),a.appendChild(f)}Ne().appendChild(a),a.submit(),Ne().removeChild(a)}({url:n,target:e,method:i,body:a})}));if("get"!==i)throw new Error("Unsupported method: "+i);if(C(e))try{if(e.location&&"function"==typeof e.location.replace)return void e.location.replace(n)}catch(e){}e.location=n}))},setName:function(n){return e.then((function(e){kn({win:e,name:n});var r=C(e),t=V(e);if(!r)throw new Error("Can not set name for cross-domain window: "+n);N(e).name=n,t&&t.setAttribute("name",n),i=w.resolve(n)}))}}}var Un=function(){function e(e){var n=e.send,r=e.win,t=e.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new w,this.serializedWindow=t||Ln(this.actualWindowPromise,{send:n}),un("idToProxyWindow").set(this.getID(),this),r&&this.setWindow(r,{send:n})}var n=e.prototype;return n.getID=function(){return this.serializedWindow.id},n.getType=function(){return this.serializedWindow.getType()},n.isPopup=function(){return this.getType().then((function(e){return e===m.POPUP}))},n.setLocation=function(e,n){var r=this;return this.serializedWindow.setLocation(e,n).then((function(){return r}))},n.getName=function(){return this.serializedWindow.getName()},n.setName=function(e){var n=this;return this.serializedWindow.setName(e).then((function(){return n}))},n.close=function(){var e=this;return this.serializedWindow.close().then((function(){return e}))},n.focus=function(){var e=this,n=this.isPopup(),r=this.getName(),t=w.hash({isPopup:n,name:r}).then((function(e){var n=e.name;e.isPopup&&n&&window.open("",n)})),o=this.serializedWindow.focus();return w.all([t,o]).then((function(){return e}))},n.isClosed=function(){return this.serializedWindow.isClosed()},n.getWindow=function(){return this.actualWindow},n.setWindow=function(e,n){var r=n.send;this.actualWindow=e,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=Ln(this.actualWindowPromise,{send:r,id:this.getID()}),fn("winToProxyWindow").set(e,this)},n.awaitWindow=function(){return this.actualWindowPromise},n.matchWindow=function(e,n){var r=this,t=n.send;return w.try((function(){return r.actualWindow?e===r.actualWindow:w.hash({proxyInstanceID:r.getInstanceID(),knownWindowInstanceID:wn(e,{send:t})}).then((function(n){var o=n.proxyInstanceID===n.knownWindowInstanceID;return o&&r.setWindow(e,{send:t}),o}))}))},n.unwrap=function(){return this.actualWindow||this},n.getInstanceID=function(){return this.serializedWindow.getInstanceID()},n.shouldClean=function(){return Boolean(this.actualWindow&&I(this.actualWindow))},n.serialize=function(){return this.serializedWindow},e.unwrap=function(n){return e.isProxyWindow(n)?n.unwrap():n},e.serialize=function(n,r){var t=r.send;return Fn(),e.toProxyWindow(n,{send:t}).serialize()},e.deserialize=function(n,r){var t=r.send;return Fn(),un("idToProxyWindow").get(n.id)||new e({serializedWindow:n,send:t})},e.isProxyWindow=function(e){return Boolean(e&&!Y(e)&&e.isProxyWindow)},e.toProxyWindow=function(n,r){var t=r.send;if(Fn(),e.isProxyWindow(n))return n;var o=n;return fn("winToProxyWindow").get(o)||new e({win:o,send:t})},e}();function qn(e,n,r,t,o){var i=fn("methodStore"),a=un("proxyWindowMethods");Un.isProxyWindow(t)?a.set(e,{val:n,name:r,domain:o,source:t}):(a.del(e),i.getOrSet(t,(function(){return{}}))[e]={domain:o,name:r,val:n,source:t})}function Bn(e,n){var r=fn("methodStore"),t=un("proxyWindowMethods");return r.getOrSet(e,(function(){return{}}))[n]||t.get(n)}function Hn(e,n,r,t,o){var i,a,u;a=(i={on:o.on,send:o.send}).on,u=i.send,un("builtinListeners").getOrSet("functionCalls",(function(){return a("postrobot_method",{domain:"*"},(function(e){var n=e.source,r=e.origin,t=e.data,o=t.id,i=t.name,a=Bn(n,o);if(!a)throw new Error("Could not find method '"+i+"' with id: "+t.id+" in "+O(window));var c=a.source,s=a.domain,d=a.val;return w.try((function(){if(!H(s,r))throw new Error("Method '"+t.name+"' domain "+JSON.stringify(_e(a.domain)?a.domain.source:a.domain)+" does not match origin "+r+" in "+O(window));if(Un.isProxyWindow(c))return c.matchWindow(n,{send:u}).then((function(e){if(!e)throw new Error("Method call '"+t.name+"' failed - proxy window does not match source in "+O(window))}))})).then((function(){return d.apply({source:n,origin:r},t.args)}),(function(e){return w.try((function(){if(d.onError)return d.onError(e)})).then((function(){var n;throw e.stack&&(e.stack="Remote call to "+i+"("+(void 0===(n=t.args)&&(n=[]),be(n).map((function(e){return"string"==typeof e?"'"+e+"'":void 0===e?"undefined":null===e?"null":"boolean"==typeof e?e.toString():Array.isArray(e)?"[ ... ]":"object"==typeof e?"{ ... }":"function"==typeof e?"() => { ... }":"<"+typeof e+">"})).join(", ")+") failed\n\n")+e.stack),e}))})).then((function(e){return{result:e,id:o,name:i}}))}))}));var c=r.__id__||ue();e=Un.unwrap(e);var s=r.__name__||r.name||t;return"string"==typeof s&&"function"==typeof s.indexOf&&0===s.indexOf("anonymous::")&&(s=s.replace("anonymous::",t+"::")),Un.isProxyWindow(e)?(qn(c,r,s,e,n),e.awaitWindow().then((function(e){qn(c,r,s,e,n)}))):qn(c,r,s,e,n),En("cross_domain_function",{id:c,name:s})}function Jn(e,n,r,t){var o,i=t.on,a=t.send;return function(e,n){void 0===n&&(n=_n);var r=JSON.stringify(e,(function(e){var r=this[e];if(yn(this))return r;var t=gn(r);if(!t)return r;var o=n[t]||xn[t];return o?o(r,e):r}));return void 0===r?"undefined":r}(r,((o={}).promise=function(r,t){return o=r,En("cross_domain_zalgo_promise",{then:Hn(e,n,(function(e,n){return o.then(e,n)}),t,{on:(u={on:i,send:a}).on,send:u.send})});var o,u},o.function=function(r,t){return Hn(e,n,r,t,{on:i,send:a})},o.object=function(e){return Y(e)||Un.isProxyWindow(e)?En("cross_domain_window",Un.serialize(e,{send:a})):e},o))}function Xn(e,n,r,t){var o,i=t.send;return function(e,n){if(void 0===n&&(n=Tn),"undefined"!==e)return JSON.parse(e,(function(e,r){if(yn(this))return r;var t,o;if(yn(r)?(t=r.__type__,o=r.__val__):(t=gn(r),o=r),!t)return o;var i=n[t]||Pn[t];return i?i(o,e):o}))}(r,((o={}).cross_domain_zalgo_promise=function(e){return new w(e.then)},o.cross_domain_function=function(r){return t=e,o=n,u={send:i},c=(a=r).id,s=a.name,d=u.send,f=function(e){function n(){var r=arguments;return Un.toProxyWindow(t,{send:d}).awaitWindow().then((function(t){var i=Bn(t,c);if(i&&i.val!==n)return i.val.apply({source:window,origin:O()},r);var a=[].slice.call(r);return e.fireAndForget?d(t,"postrobot_method",{id:c,name:s,args:a},{domain:o,fireAndForget:!0}):d(t,"postrobot_method",{id:c,name:s,args:a},{domain:o,fireAndForget:!1}).then((function(e){return e.data.result}))})).catch((function(e){throw e}))}return void 0===e&&(e={}),n.__name__=s,n.__origin__=o,n.__source__=t,n.__id__=c,n.origin=o,n},(l=f()).fireAndForget=f({fireAndForget:!0}),l;var t,o,a,u,c,s,d,f,l},o.cross_domain_window=function(e){return Un.deserialize(e,{send:i})},o))}var Yn={};function Gn(e,n,r,t){var o=t.on,i=t.send;return w.try((function(){var t=fn().getOrSet(e,(function(){return{}}));return t.buffer=t.buffer||[],t.buffer.push(r),t.flush=t.flush||w.flush().then((function(){if(I(e))throw new Error("Window is closed");var r,a=Jn(e,n,((r={}).__post_robot_10_0_44__=t.buffer||[],r),{on:o,send:i});delete t.buffer;for(var u=Object.keys(Yn),c=[],s=0;s<u.length;s++){var d=u[s];try{Yn[d](e,a,n)}catch(e){c.push(e)}}if(c.length===u.length)throw new Error("All post-robot messaging strategies failed:\n\n"+c.map((function(e,n){return n+". "+ve(e)})).join("\n\n"))})),t.flush.then((function(){delete t.flush}))})).then(pe)}function Vn(e){return un("responseListeners").get(e)}function Zn(e){un("responseListeners").del(e)}function $n(e){return un("erroredResponseListeners").has(e)}function Qn(e){var n=e.name,r=e.win,t=e.domain,o=fn("requestListeners");if("*"===r&&(r=null),"*"===t&&(t=null),!n)throw new Error("Name required to get request listener");for(var i=0,a=[r,dn()];i<a.length;i++){var u=a[i];if(u){var c=o.get(u);if(c){var s=c[n];if(s){if(t&&"string"==typeof t){if(s[t])return s[t];if(s.__domain_regex__)for(var d=0,f=s.__domain_regex__;d<f.length;d++){var l=f[d],h=l.listener;if(H(l.regex,t))return h}}if(s["*"])return s["*"]}}}}}function Kn(e,n,r,t){var o=t.on,i=t.send,a=Qn({name:r.name,win:e,domain:n}),u="postrobot_method"===r.name&&r.data&&"string"==typeof r.data.name?r.data.name+"()":r.name;function c(t,a,c){return w.flush().then((function(){if(!r.fireAndForget&&!I(e))try{return Gn(e,n,{id:ue(),origin:O(window),type:"postrobot_message_response",hash:r.hash,name:r.name,ack:t,data:a,error:c},{on:o,send:i})}catch(e){throw new Error("Send response message failed for "+u+" in "+O()+"\n\n"+ve(e))}}))}return w.all([w.flush().then((function(){if(!r.fireAndForget&&!I(e))try{return Gn(e,n,{id:ue(),origin:O(window),type:"postrobot_message_ack",hash:r.hash,name:r.name},{on:o,send:i})}catch(e){throw new Error("Send ack message failed for "+u+" in "+O()+"\n\n"+ve(e))}})),w.try((function(){if(!a)throw new Error("No handler found for post message: "+r.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!H(a.domain,n))throw new Error("Request origin "+n+" does not match domain "+a.domain.toString());return a.handler({source:e,origin:n,data:r.data})})).then((function(e){return c("success",e)}),(function(e){return c("error",null,e)}))]).then(pe).catch((function(e){if(a&&a.handleError)return a.handleError(e);throw e}))}function er(e,n,r){if(!$n(r.hash)){var t=Vn(r.hash);if(!t)throw new Error("No handler found for post message ack for message: "+r.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!H(t.domain,n))throw new Error("Ack origin "+n+" does not match domain "+t.domain.toString());if(e!==t.win)throw new Error("Ack source does not match registered window")}catch(e){t.promise.reject(e)}t.ack=!0}}function nr(e,n,r){if(!$n(r.hash)){var t,o=Vn(r.hash);if(!o)throw new Error("No handler found for post message response for message: "+r.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!H(o.domain,n))throw new Error("Response origin "+n+" does not match domain "+(t=o.domain,Array.isArray(t)?"("+t.join(" | ")+")":v(t)?"RegExp("+t.toString()+")":t.toString()));if(e!==o.win)throw new Error("Response source does not match registered window");Zn(r.hash),"error"===r.ack?o.promise.reject(r.error):"success"===r.ack&&o.promise.resolve({source:e,origin:n,data:r.data})}}function rr(e,n){var r=n.on,t=n.send,o=un("receivedMessages");try{if(!window||window.closed||!e.source)return}catch(e){return}var i=e.source,a=e.origin,u=function(e,n,r,t){var o,i=t.on,a=t.send;try{o=Xn(n,r,e,{on:i,send:a})}catch(e){return}if(o&&"object"==typeof o&&null!==o){var u=o.__post_robot_10_0_44__;if(Array.isArray(u))return u}}(e.data,i,a,{on:r,send:t});if(u){mn(i);for(var c=0;c<u.length;c++){var s=u[c];if(o.has(s.id))return;if(o.set(s.id,!0),I(i)&&!s.fireAndForget)return;0===s.origin.indexOf("file:")&&(a="file://");try{"postrobot_message_request"===s.type?Kn(i,a,s,{on:r,send:t}):"postrobot_message_response"===s.type?nr(i,a,s):"postrobot_message_ack"===s.type&&er(i,a,s)}catch(e){setTimeout((function(){throw e}),0)}}}}function tr(e,n,r){if(!e)throw new Error("Expected name");if("function"==typeof(n=n||{})&&(r=n,n={}),!r)throw new Error("Expected handler");(n=n||{}).name=e,n.handler=r||n.handler;var t=n.window,o=n.domain,i=function e(n,r){var t=n.name,o=n.win,i=n.domain,a=fn("requestListeners");if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var u=[],c=0,s=o;c<s.length;c++)u.push(e({name:t,domain:i,win:s[c]},r));return{cancel:function(){for(var e=0;e<u.length;e++)u[e].cancel()}}}if(Array.isArray(i)){for(var d=[],f=0,l=i;f<l.length;f++)d.push(e({name:t,win:o,domain:l[f]},r));return{cancel:function(){for(var e=0;e<d.length;e++)d[e].cancel()}}}var h=Qn({name:t,win:o,domain:i});if(o&&"*"!==o||(o=dn()),i=i||"*",h)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===dn()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===dn()?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+t+" on domain "+i.toString()):new Error("Request listener already exists for "+t);var p,w,v=a.getOrSet(o,(function(){return{}})),m=Pe(v,t,(function(){return{}})),y=i.toString();return _e(i)?(p=Pe(m,"__domain_regex__",(function(){return[]}))).push(w={regex:i,listener:r}):m[y]=r,{cancel:function(){delete m[y],w&&(p.splice(p.indexOf(w,1)),p.length||delete m.__domain_regex__),Object.keys(m).length||delete v[t],o&&!Object.keys(v).length&&a.del(o)}}}({name:e,win:t,domain:o},{handler:n.handler,handleError:n.errorHandler||function(e){throw e},window:t,domain:o||"*",name:e});return{cancel:function(){i.cancel()}}}Yn.postrobot_post_message=function(e,n,r){0===r.indexOf("file:")&&(r="*"),e.postMessage(n,r)},Yn.postrobot_bridge=function(e,n,r){if(!On()&&!Sn())throw new Error("Bridge not needed for browser");if(C(e))throw new Error("Post message through bridge disabled between same domain windows");if(!1!==B(window,e))throw new Error("Can only use bridge to communicate between two different windows, not between frames");!function(e,n,r){var t=F(window,e),o=F(e,window);if(!t&&!o)throw new Error("Can only send messages to and from parent and popup windows");Mn(e).then((function(t){return t(e,n,r)}))}(e,r,n)},Yn.postrobot_global=function(e,n){if(!k(window).match(/MSIE|rv:11|trident|edge\/12|edge\/13/i))throw new Error("Global messaging not needed for browser");if(!C(e))throw new Error("Post message through global disabled between different domain windows");if(!1!==B(window,e))throw new Error("Can only use global to communicate between two different windows, not between frames");var r=on(e);if(!r)throw new Error("Can not find postRobot global on foreign window");r.receiveMessage({source:window,origin:O(),data:n})};var or,ir=function e(n,r,t,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,u=o.timeout||5e3,c=o.fireAndForget||!1;return w.try((function(){if(function(e,n,r){if(!e)throw new Error("Expected name");if(r&&"string"!=typeof r&&!Array.isArray(r)&&!_e(r))throw new TypeError("Can not send "+e+". Expected domain "+JSON.stringify(r)+" to be a string, array, or regex");if(I(n))throw new Error("Can not send "+e+". Target window is closed")}(r,n,i),function(e,n){var r=L(n);if(r)return r===e;if(n===e)return!1;if(R(n)===n)return!1;for(var t=0,o=W(e);t<o.length;t++)if(o[t]===n)return!0;return!1}(window,n))return vn(n,u)})).then((function(r){return t=n,o=i,a=(void 0===r?{}:r).domain,u={send:e}.send,w.try((function(){return"string"==typeof o?o:w.try((function(){return a||pn(t,{send:u}).then((function(e){return e.domain}))})).then((function(e){if(!H(o,o))throw new Error("Domain "+me(o)+" does not match "+me(o));return e}))}));var t,o,a,u})).then((function(o){var i,u,s,d=o,f="postrobot_method"===r&&t&&"string"==typeof t.name?t.name+"()":r,l=new w,h=r+"_"+ue();if(!c){var p={name:r,win:n,domain:d,promise:l};u=h,s=p,un("responseListeners").set(u,s);var v=fn("requestPromises").getOrSet(n,(function(){return[]}));v.push(l),l.catch((function(){!function(e){un("erroredResponseListeners").set(e,!0)}(h),Zn(h)}));var m=(i=n,fn("knownWindows").get(i,!1)?1e4:2e3),y=a,g=m,E=y,b=Ee((function(){return I(n)?l.reject(new Error("Window closed for "+r+" before "+(p.ack?"response":"ack"))):p.cancelled?l.reject(new Error("Response listener was cancelled for "+r)):(g=Math.max(g-500,0),-1!==E&&(E=Math.max(E-500,0)),p.ack||0!==g?0===E?l.reject(new Error("No response for postMessage "+f+" in "+O()+" in "+y+"ms")):void 0:l.reject(new Error("No ack for postMessage "+f+" in "+O()+" in "+m+"ms")))}),500);l.finally((function(){b.cancel(),v.splice(v.indexOf(l,1))})).catch(pe)}return Gn(n,d,{id:ue(),origin:O(window),type:"postrobot_message_request",hash:h,name:r,data:t,fireAndForget:c},{on:tr,send:e}).then((function(){return c?l.resolve():l}),(function(e){throw new Error("Send request message failed for "+f+" in "+O()+"\n\n"+ve(e))}))}))};function ar(e){return Un.toProxyWindow(e,{send:ir})}function ur(e){for(var n=0,r=fn("requestPromises").get(e,[]);n<r.length;n++)r[n].reject(new Error("Window "+(I(e)?"closed":"cleaned up")+" before response")).catch(pe)}function cr(e){if(!C(e))throw new Error("Can not get global for window on different domain");return e.__zoid_9_0_86__||(e.__zoid_9_0_86__={}),e.__zoid_9_0_86__}function sr(e,n){try{return n(cr(e))}catch(e){}}function dr(e){return{get:function(){var n=this;return w.try((function(){if(n.source&&n.source!==window)throw new Error("Can not call get on proxy object from a remote window");return e}))}}}function fr(e){return ae(JSON.stringify(e))}function lr(e){var n=cr(e);return n.references=n.references||{},n.references}function hr(e){var n,r,t=e.data,o=e.metaData,i=e.sender,a=e.receiver,u=e.passByReference,c=void 0!==u&&u,s=e.basic,d=void 0!==s&&s,f=ar(a.win),l=d?JSON.stringify(t):Jn(f,a.domain,t,{on:tr,send:ir}),h=c?(n=l,r=ue(),lr(window)[r]=n,{type:"uid",uid:r}):{type:"raw",val:l};return{serializedData:fr({sender:{domain:i.domain},metaData:o,reference:h}),cleanReference:function(){var e,n;e=window,"uid"===(n=h).type&&delete lr(e)[n.uid]}}}function pr(e){var n,t,o,i=e.sender,a=e.basic,u=void 0!==a&&a,c=(n=e.data,JSON.parse(function(e){if("function"==typeof atob)return decodeURIComponent([].map.call(atob(e),(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""));if(void 0!==r)return r.from(e,"base64").toString("utf8");throw new Error("Can not find window.atob or Buffer")}(n))),s=c.reference,d=c.metaData;t="function"==typeof i.win?i.win({metaData:d}):i.win,o="function"==typeof i.domain?i.domain({metaData:d}):"string"==typeof i.domain?i.domain:c.sender.domain;var f,l,h,p=function(e,n){if("raw"===n.type)return n.val;if("uid"===n.type)return lr(e)[n.uid];throw new Error("Unsupported ref type: "+n.type)}(t,s);return{data:u?JSON.parse(p):(f=t,l=o,h=p,Xn(f,l,h,{on:tr,send:ir})),metaData:d,sender:{win:t,domain:o},reference:s}}or={setupBridge:zn,openBridge:function(e,n){var r=un("bridges"),t=un("bridgeFrames");return n=n||J(e),r.getOrSet(n,(function(){return w.try((function(){if(O()===n)throw new Error("Can not open bridge on the same domain as current domain: "+n);var r=Wn(n);if(z(window,r))throw new Error("Frame with name "+r+" already exists on page");var o,i,a,u=(o=r,i=e,(a=document.createElement("iframe")).setAttribute("name",o),a.setAttribute("id",o),a.setAttribute("style","display: none; margin: 0; padding: 0; border: 0px none; overflow: hidden;"),a.setAttribute("frameborder","0"),a.setAttribute("border","0"),a.setAttribute("scrolling","no"),a.setAttribute("allowTransparency","true"),a.setAttribute("tabindex","-1"),a.setAttribute("hidden","true"),a.setAttribute("title",""),a.setAttribute("role","presentation"),a.src=i,a);return t.set(n,u),Rn.then((function(n){n.appendChild(u);var r=u.contentWindow;return new w((function(e,n){u.addEventListener("load",e),u.addEventListener("error",n)})).then((function(){return vn(r,5e3,"Bridge "+e)})).then((function(){return r}))}))}))}))},linkWindow:kn,linkUrl:function(e,n){kn({win:e,domain:J(n)})},isBridge:Sn,needsBridge:Dn,needsBridgeForBrowser:On,hasBridge:function(e,n){return un("bridges").has(n||J(e))},needsBridgeForWin:Cn,needsBridgeForDomain:Nn,destroyBridges:function(){for(var e=un("bridges"),n=un("bridgeFrames"),r=0,t=n.keys();r<t.length;r++){var o=n.get(t[r]);o&&o.parentNode&&o.parentNode.removeChild(o)}n.reset(),e.reset()}};var wr={STRING:"string",OBJECT:"object",FUNCTION:"function",BOOLEAN:"boolean",NUMBER:"number",ARRAY:"array"},vr={JSON:"json",DOTIFY:"dotify",BASE64:"base64"},mr=m,yr={RENDER:"zoid-render",RENDERED:"zoid-rendered",DISPLAY:"zoid-display",ERROR:"zoid-error",CLOSE:"zoid-close",DESTROY:"zoid-destroy",PROPS:"zoid-props",RESIZE:"zoid-resize",FOCUS:"zoid-focus"};function gr(e){return"__zoid__"+e.name+"__"+e.serializedPayload+"__"}function Er(e){if(!e)throw new Error("No window name");var n=e.split("__"),r=n[1],t=n[2],o=n[3];if("zoid"!==r)throw new Error("Window not rendered by zoid - got "+r);if(!t)throw new Error("Expected component name");if(!o)throw new Error("Expected serialized payload ref");return{name:t,serializedInitialPayload:o}}var br=le((function(e){var n=pr({data:Er(e).serializedInitialPayload,sender:{win:function(e){return function(e){if("opener"===e.type)return Oe("opener",_(window));if("parent"===e.type&&"number"==typeof e.distance)return Oe("parent",(n=window,void 0===(r=e.distance)&&(r=1),function(e,n){void 0===n&&(n=1);for(var r=e,t=0;t<n;t++){if(!r)return;r=x(r)}return r}(n,q(n)-r)));var n,r,t,o;if("global"===e.type&&e.uid&&"string"==typeof e.uid){var i=function(){var n=e.uid,r=L(window);if(!r)throw new Error("Can not find ancestor window");for(var t=0,o=A(r);t<o.length;t++){var i=o[t];if(C(i)){var a=sr(i,(function(e){return e.windows&&e.windows[n]}));if(a)return{v:a}}}}();if("object"==typeof i)return i.v}else if("name"===e.type){var a=e.name;return Oe("namedWindow",z(t=Oe("ancestor",L(window)),o=a)||function e(n,r){var t=z(n,r);if(t)return t;for(var o=0,i=W(n);o<i.length;o++){var a=e(i[o],r);if(a)return a}}(R(t)||t,o))}throw new Error("Unable to find "+e.type+" parent component window")}(e.metaData.windowRef)}}});return{parent:n.sender,payload:n.data,reference:n.reference}}));function xr(){return br(window.name)}function _r(e,n){if(void 0===n&&(n=window),e===x(n))return{type:"parent",distance:q(e)};if(e===_(n))return{type:"opener"};if(C(e)&&(t=e)!==R(t)){var r=N(e).name;if(r)return{type:"name",name:r}}var t}function Pr(e,n,r,t,o){if(!e.hasOwnProperty(r))return t;var i=e[r];return"function"==typeof i.childDecorate?i.childDecorate({value:t,uid:o.uid,tag:o.tag,close:o.close,focus:o.focus,onError:o.onError,onProps:o.onProps,resize:o.resize,getParent:o.getParent,getParentDomain:o.getParentDomain,show:o.show,hide:o.hide,export:o.export,getSiblings:o.getSiblings}):t}function Tr(){return w.try((function(){window.focus()}))}function Or(){return w.try((function(){window.close()}))}var Cr=function(){return pe},Nr=function(e){return we(e.value)};function Dr(e,n,r){for(var t=0,o=Object.keys(a({},e,n));t<o.length;t++){var i=o[t];r(i,n[i],e[i])}}function Wr(e,n,r){var t,o,i,a={};return w.all((t=n,o=e,i=[],Dr(t,o,(function(e,n,t){var o,u,c,s=(o=e,u=n,c=t,w.resolve().then((function(){var e,n;if(null!=c&&u){var t=(e={},e.get=u.queryParam,e.post=u.bodyParam,e)[r],i=(n={},n.get=u.queryValue,n.post=u.bodyValue,n)[r];if(t)return w.hash({finalParam:w.try((function(){return"function"==typeof t?t({value:c}):"string"==typeof t?t:o})),finalValue:w.try((function(){return"function"==typeof i&&xe(c)?i({value:c}):c}))}).then((function(e){var n,r=e.finalParam,t=e.finalValue;if("boolean"==typeof t)n=t.toString();else if("string"==typeof t)n=t.toString();else if("object"==typeof t&&null!==t){if(u.serialization===vr.JSON)n=JSON.stringify(t);else if(u.serialization===vr.BASE64)n=ae(JSON.stringify(t));else if(u.serialization===vr.DOTIFY||!u.serialization){n=function e(n,r,t){for(var o in void 0===r&&(r=""),void 0===t&&(t={}),r=r?r+".":r,n)n.hasOwnProperty(o)&&null!=n[o]&&"function"!=typeof n[o]&&(n[o]&&Array.isArray(n[o])&&n[o].length&&n[o].every((function(e){return"object"!=typeof e}))?t[""+r+o+"[]"]=n[o].join(","):n[o]&&"object"==typeof n[o]?t=e(n[o],""+r+o,t):t[""+r+o]=n[o].toString());return t}(t,o);for(var i=0,c=Object.keys(n);i<c.length;i++){var s=c[i];a[s]=n[s]}return}}else"number"==typeof t&&(n=t.toString());a[r]=n}))}})));i.push(s)})),i)).then((function(){return a}))}function Sr(e){var n,r,t,o,i,u,c,s,d=e.uid,f=e.options,l=e.overrides,h=void 0===l?{}:l,p=e.parentWin,v=void 0===p?window:p,m=f.propsDef,y=f.containerTemplate,g=f.prerenderTemplate,E=f.tag,b=f.name,x=f.attributes,_=f.dimensions,P=f.autoResize,T=f.url,D=f.domain,W=f.exports,S=new w,R=[],A=Te(),M={},j={},k={visible:!0},z=h.event?h.event:(n={},r={},t={on:function(e,n){var t=r[e]=r[e]||[];t.push(n);var o=!1;return{cancel:function(){o||(o=!0,t.splice(t.indexOf(n),1))}}},once:function(e,n){var r=t.on(e,(function(){r.cancel(),n()}));return r},trigger:function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),o=1;o<n;o++)t[o-1]=arguments[o];var i=r[e],a=[];if(i)for(var u=function(e){var n=i[e];a.push(w.try((function(){return n.apply(void 0,t)})))},c=0;c<i.length;c++)u(c);return w.all(a).then(pe)},triggerOnce:function(e){if(n[e])return w.resolve();n[e]=!0;for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return t.trigger.apply(t,[e].concat(o))},reset:function(){r={}}}),F=h.props?h.props:{},U=h.onError,Y=h.getProxyContainer,V=h.show,$=h.hide,Q=h.close,K=h.renderContainer,ee=h.getProxyWindow,ne=h.setProxyWin,re=h.openFrame,te=h.openPrerenderFrame,oe=h.prerender,ie=h.open,ae=h.openPrerender,ce=h.watchForUnload,se=h.getInternalState,de=h.setInternalState,fe=function(){return"function"==typeof _?_({props:F}):_},he=function(){return w.try((function(){return h.resolveInitPromise?h.resolveInitPromise():S.resolve()}))},ge=function(e){return w.try((function(){return h.rejectInitPromise?h.rejectInitPromise(e):S.reject(e)}))},_e=function(e){for(var n={},r=0,t=Object.keys(F);r<t.length;r++){var o=t[r],i=m[o];i&&!1===i.sendToChild||i&&i.sameDomain&&!H(e,O(window))||(n[o]=F[o])}return w.hash(n)},Pe=function(){return w.try((function(){return se?se():k}))},Oe=function(e){return w.try((function(){return de?de(e):k=a({},k,e)}))},Ce=function(){return ee?ee():w.try((function(){var e=F.window;if(e){var n=ar(e);return A.register((function(){return e.close()})),n}return new Un({send:ir})}))},Ne=function(e){return ne?ne(e):w.try((function(){o=e}))},De=function(){return V?V():w.hash({setState:Oe({visible:!0}),showElement:i?i.get().then(He):null}).then(pe)},We=function(){return $?$():w.hash({setState:Oe({visible:!1}),showElement:i?i.get().then(Je):null}).then(pe)},Se=function(){return"function"==typeof T?T({props:F}):T},Re=function(){return"function"==typeof x?x({props:F}):x},je=function(){return J(Se())},ze=function(e,n){var r=n.windowName;return re?re(e,{windowName:r}):w.try((function(){if(e===mr.IFRAME)return dr(qe({attributes:a({name:r,title:b},Re().iframe)}))}))},Le=function(e){return te?te(e):w.try((function(){if(e===mr.IFRAME)return dr(qe({attributes:a({name:"__zoid_prerender_frame__"+b+"_"+ue()+"__",title:"prerender__"+b},Re().iframe)}))}))},Ze=function(e,n,r){return ae?ae(e,n,r):w.try((function(){if(e===mr.IFRAME){if(!r)throw new Error("Expected proxy frame to be passed");return r.get().then((function(e){return A.register((function(){return Xe(e)})),Ue(e).then((function(e){return N(e)})).then((function(e){return ar(e)}))}))}if(e===mr.POPUP)return n;throw new Error("No render context available for "+e)}))},$e=function(){return w.try((function(){if(o)return w.all([z.trigger(yr.FOCUS),o.focus()]).then(pe)}))},Qe=function(){var e=cr(window);return e.windows=e.windows||{},e.windows[d]=window,A.register((function(){delete e.windows[d]})),d},Ke=function(e,n,r,t){if(n===O(window))return{type:"global",uid:Qe()};if(e!==window)throw new Error("Can not construct cross-domain window reference for different target window");if(F.window){var o=t.getWindow();if(!o)throw new Error("Can not construct cross-domain window reference for lazy window prop");if(L(o)!==window)throw new Error("Can not construct cross-domain window reference for window prop with different ancestor")}if(r===mr.POPUP)return{type:"opener"};if(r===mr.IFRAME)return{type:"parent",distance:q(window)};throw new Error("Can not construct window reference for child")},en=function(e,n){return w.try((function(){c=e,u=n,he(),A.register((function(){return n.close.fireAndForget().catch(pe)}))}))},nn=function(e){var n=e.width,r=e.height;return w.try((function(){z.trigger(yr.RESIZE,{width:n,height:r})}))},rn=function(e){return w.try((function(){return z.trigger(yr.DESTROY)})).catch(pe).then((function(){return A.all(e)})).then((function(){S.asyncReject(e||new Error("Component destroyed"))}))},on=le((function(e){return w.try((function(){if(Q){if(I(Q.__source__))return;return Q()}return w.try((function(){return z.trigger(yr.CLOSE)})).then((function(){return rn(e||new Error("Component closed"))}))}))})),an=function(e,n){var r=n.proxyWin,t=n.proxyFrame,o=n.windowName;return ie?ie(e,{proxyWin:r,proxyFrame:t,windowName:o}):w.try((function(){if(e===mr.IFRAME){if(!t)throw new Error("Expected proxy frame to be passed");return t.get().then((function(e){return Ue(e).then((function(n){return A.register((function(){return Xe(e)})),A.register((function(){return ur(n)})),n}))}))}if(e===mr.POPUP){var n=fe(),r=n.width,i=void 0===r?"300px":r,u=n.height,c=void 0===u?"150px":u;i=tn(i,window.outerWidth),c=tn(c,window.outerWidth);var s=function(e,n){var r=(n=n||{}).closeOnUnload,t=void 0===r?1:r,o=n.name,i=void 0===o?"":o,u=n.width,c=n.height,s=0,d=0;u&&(window.outerWidth?d=Math.round((window.outerWidth-u)/2)+window.screenX:window.screen.width&&(d=Math.round((window.screen.width-u)/2))),c&&(window.outerHeight?s=Math.round((window.outerHeight-c)/2)+window.screenY:window.screen.height&&(s=Math.round((window.screen.height-c)/2))),delete n.closeOnUnload,delete n.name,u&&c&&(n=a({top:s,left:d,width:u,height:c,status:1,toolbar:0,menubar:0,resizable:1,scrollbars:1},n));var f,l=Object.keys(n).map((function(e){if(null!=n[e])return e+"="+me(n[e])})).filter(Boolean).join(",");try{f=window.open("",i,l)}catch(e){throw new Fe("Can not open popup window - "+(e.stack||e.message))}if(I(f))throw new Fe("Can not open popup window - blocked");return t&&window.addEventListener("unload",(function(){return f.close()})),f}(0,a({name:o,width:i,height:c},Re().popup));return A.register((function(){return Z(s)})),A.register((function(){return ur(s)})),s}throw new Error("No render context available for "+e)})).then((function(e){return r.setWindow(e,{send:ir}),r.setName(o).then((function(){return r}))}))},un=function(){return w.try((function(){var e=Be(window,"unload",we((function(){rn(new Error("Window navigated away"))}))),n=X(v,rn,3e3);if(A.register(n.cancel),A.register(e.cancel),ce)return ce()}))},cn=function(e){var n=!1;return e.isClosed().then((function(r){return r?(n=!0,on(new Error("Detected component window close"))):w.delay(200).then((function(){return e.isClosed()})).then((function(e){if(e)return n=!0,on(new Error("Detected component window close"))}))})).then((function(){return n}))},sn=function(e){return U?U(e):w.try((function(){if(-1===R.indexOf(e))return R.push(e),S.asyncReject(e),z.trigger(yr.ERROR,e)}))},dn=new w,fn=function(e){return w.try((function(){dn.resolve(e)}))};en.onError=sn;var ln=function(e,n){return e({uid:d,container:n.container,context:n.context,doc:n.doc,frame:n.frame,prerenderFrame:n.prerenderFrame,focus:$e,close:on,state:M,props:F,tag:E,dimensions:fe(),event:z})},hn=function(e,n){var r=n.context;return oe?oe(e,{context:r}):w.try((function(){if(g){var n=e.getWindow();if(n&&C(n)&&function(e){try{if(!e.location.href)return!0;if("about:blank"===e.location.href)return!0}catch(e){}return!1}(n)){var t=(n=N(n)).document,o=ln(g,{context:r,doc:t});if(o){if(o.ownerDocument!==t)throw new Error("Expected prerender template to have been created with document from child window");!function(e,n){var r=n.tagName.toLowerCase();if("html"!==r)throw new Error("Expected element to be html, got "+r);for(var t=e.document.documentElement,o=0,i=be(t.children);o<i.length;o++)t.removeChild(i[o]);for(var a=0,u=be(n.children);a<u.length;a++)t.appendChild(u[a])}(n,o);var i=P.width,a=void 0!==i&&i,u=P.height,c=void 0!==u&&u,s=P.element,d=void 0===s?"body":s;if((d=Ie(d,t))&&(a||c)){var f=Ge(d,(function(e){nn({width:a?e.width:void 0,height:c?e.height:void 0})}),{width:a,height:c,win:n});z.on(yr.RENDERED,f.cancel)}}}}}))},pn=function(e,n){var r=n.proxyFrame,t=n.proxyPrerenderFrame,o=n.context,a=n.rerender;return K?K(e,{proxyFrame:r,proxyPrerenderFrame:t,context:o,rerender:a}):w.hash({container:e.get(),frame:r?r.get():null,prerenderFrame:t?t.get():null,internalState:Pe()}).then((function(e){var n=e.container,r=e.internalState.visible,t=ln(y,{context:o,container:n,frame:e.frame,prerenderFrame:e.prerenderFrame,doc:document});if(t){r||Je(t),Me(n,t);var u=function(e,n){n=we(n);var r,t,o,i=!1,a=[],u=function(){i=!0;for(var e=0;e<a.length;e++)a[e].disconnect();r&&r.cancel(),o&&o.removeEventListener("unload",c),t&&Xe(t)},c=function(){i||(n(),u())};if(Ye(e))return c(),{cancel:u};if(window.MutationObserver)for(var s=e.parentElement;s;){var d=new window.MutationObserver((function(){Ye(e)&&c()}));d.observe(s,{childList:!0}),a.push(d),s=s.parentElement}return(t=document.createElement("iframe")).setAttribute("name","__detect_close_"+ue()+"__"),t.style.display="none",Ue(t).then((function(e){(o=N(e)).addEventListener("unload",c)})),e.appendChild(t),r=Ee((function(){Ye(e)&&c()}),1e3),{cancel:u}}(t,(function(){var e=new Error("Detected container element removed from DOM");return w.delay(1).then((function(){if(!Ye(t))return A.all(e),a().then(he,ge);on(e)}))}));return A.register((function(){return u.cancel()})),A.register((function(){return Xe(t)})),i=dr(t)}}))},wn=function(){return{state:M,event:z,close:on,focus:$e,resize:nn,onError:sn,updateProps:mn,show:De,hide:We}},vn=function(e){void 0===e&&(e={});var n,r,t,o,i,a,u,c,d,f,l=s,h=wn();ye(j,e),n=m,r=F,t=j,i=l,a=(o=h).state,u=o.close,c=o.focus,d=o.event,f=o.onError,Dr(t,n,(function(e,n,o){var s=!1,l=o;Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){return s?l:(s=!0,function(){if(!n)return l;var s=n.alias;if(s&&!xe(o)&&xe(t[s])&&(l=t[s]),n.value&&(l=n.value({props:r,state:a,close:u,focus:c,event:d,onError:f,container:i})),!n.default||xe(l)||xe(t[e])||(l=n.default({props:r,state:a,close:u,focus:c,event:d,onError:f,container:i})),xe(l)){if(n.type===wr.ARRAY?!Array.isArray(l):typeof l!==n.type)throw new TypeError("Prop is not of type "+n.type+": "+e)}else if(!1!==n.required&&!xe(t[e]))throw new Error('Expected prop "'+e+'" to be defined');return xe(l)&&n.decorate&&(l=n.decorate({value:l,props:r,state:a,close:u,focus:c,event:d,onError:f,container:i})),l}())}})})),Dr(r,n,pe)},mn=function(e){return vn(e),S.then((function(){var e=u,n=o;if(e&&n&&c)return _e(c).then((function(r){return e.updateProps(r).catch((function(e){return cn(n).then((function(n){if(!n)throw e}))}))}))}))},yn=function(e){return Y?Y(e):w.try((function(){return ke(e)})).then((function(e){return Ve(e)&&(e=function e(n){var r=function(e){var n=function(e){for(;e.parentNode;)e=e.parentNode;if(Ve(e))return e}(e);if(n&&n.host)return n.host}(n);if(!r)throw new Error("Element is not in shadow dom");var t="shadow-slot-"+ue(),o=document.createElement("slot");o.setAttribute("name",t),n.appendChild(o);var i=document.createElement("div");return i.setAttribute("slot",t),r.appendChild(i),Ve(r)?e(i):i}(e)),s=e,dr(e)}))};return{init:function(){z.on(yr.RENDER,(function(){return F.onRender()})),z.on(yr.DISPLAY,(function(){return F.onDisplay()})),z.on(yr.RENDERED,(function(){return F.onRendered()})),z.on(yr.CLOSE,(function(){return F.onClose()})),z.on(yr.DESTROY,(function(){return F.onDestroy()})),z.on(yr.RESIZE,(function(){return F.onResize()})),z.on(yr.FOCUS,(function(){return F.onFocus()})),z.on(yr.PROPS,(function(e){return F.onProps(e)})),z.on(yr.ERROR,(function(e){return F&&F.onError?F.onError(e):ge(e).then((function(){setTimeout((function(){throw e}),1)}))})),A.register(z.reset)},render:function(e){var n=e.target,r=e.container,t=e.context,i=e.rerender;return w.try((function(){var e=je(),a=D||je();!function(e,n,r){if(e!==window){if(!B(window,e))throw new Error("Can only renderTo an adjacent frame");var t=O();if(!H(n,t)&&!C(e))throw new Error("Can not render remotely to "+n.toString()+" - can only render to "+t);if(r&&"string"!=typeof r)throw new Error("Container passed to renderTo must be a string selector, got "+typeof r+" }")}}(n,a,r);var u=w.try((function(){if(n!==window)return function(e,n){for(var r={},t=0,o=Object.keys(F);t<o.length;t++){var i=o[t],a=m[i];a&&a.allowDelegate&&(r[i]=F[i])}var u=ir(n,"zoid_delegate_"+b,{uid:d,overrides:{props:r,event:z,close:on,onError:sn,getInternalState:Pe,setInternalState:Oe,resolveInitPromise:he,rejectInitPromise:ge}}).then((function(e){var r=e.data.parent;return A.register((function(e){if(!I(n))return r.destroy(e)})),r.getDelegateOverrides()})).catch((function(e){throw new Error("Unable to delegate rendering. Possibly the component is not loaded in the target window.\n\n"+ve(e))}));return Y=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.getProxyContainer.apply(e,n)}))},K=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.renderContainer.apply(e,n)}))},V=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.show.apply(e,n)}))},$=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.hide.apply(e,n)}))},ce=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.watchForUnload.apply(e,n)}))},e===mr.IFRAME?(ee=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.getProxyWindow.apply(e,n)}))},re=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.openFrame.apply(e,n)}))},te=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.openPrerenderFrame.apply(e,n)}))},oe=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.prerender.apply(e,n)}))},ie=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.open.apply(e,n)}))},ae=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.openPrerender.apply(e,n)}))}):e===mr.POPUP&&(ne=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return u.then((function(e){return e.setProxyWin.apply(e,n)}))}),u}(t,n)})),c=F.window,s=un(),l=Wr(m,F,"post"),h=z.trigger(yr.RENDER),p=yn(r),v=Ce(),y=p.then((function(){return vn()})),g=y.then((function(){return Wr(m,F,"get").then((function(e){return function(e,n){var r,t,o=n.query||{},i=n.hash||{},a=e.split("#");t=a[1];var u=(r=a[0]).split("?");r=u[0];var c=Ae(u[1],o),s=Ae(t,i);return c&&(r=r+"?"+c),s&&(r=r+"#"+s),r}(G(Se()),{query:e})}))})),x=v.then((function(r){var o,i,u,c,s,f,l,h,p,w,v,m,y,g;return(i={proxyWin:(o={proxyWin:r,initialChildDomain:e,childDomainMatch:a,target:n,context:t}).proxyWin,initialChildDomain:o.initialChildDomain,childDomainMatch:o.childDomainMatch,target:o.target,context:o.context},h=void 0===i?{}:i,p=h.proxyWin,w=h.initialChildDomain,v=h.childDomainMatch,m=h.target,y=void 0===m?window:m,g=h.context,(u={proxyWin:p,initialChildDomain:w,childDomainMatch:v,context:g},c=void 0===u?{}:u,s=c.proxyWin,f=c.childDomainMatch,l=c.context,_e(c.initialChildDomain).then((function(e){var n;return{uid:d,context:l,tag:E,childDomainMatch:f,version:"9_0_86",props:e,exports:(n=s,{init:function(e){return en(this.origin,e)},close:on,checkClose:function(){return cn(n)},resize:nn,onError:sn,show:De,hide:We,export:fn})}}))).then((function(e){var n=hr({data:e,metaData:{windowRef:Ke(y,w,g,p)},sender:{domain:O(window)},receiver:{win:p,domain:v},passByReference:w===O()}),r=n.serializedData;return A.register(n.cleanReference),r}))).then((function(e){return gr({name:b,serializedPayload:e})}))})),_=x.then((function(e){return ze(t,{windowName:e})})),P=Le(t),T=w.hash({proxyContainer:p,proxyFrame:_,proxyPrerenderFrame:P}).then((function(e){return pn(e.proxyContainer,{context:t,proxyFrame:e.proxyFrame,proxyPrerenderFrame:e.proxyPrerenderFrame,rerender:i})})).then((function(e){return e})),N=w.hash({windowName:x,proxyFrame:_,proxyWin:v}).then((function(e){var n=e.proxyWin;return c?n:an(t,{windowName:e.windowName,proxyWin:n,proxyFrame:e.proxyFrame})})),W=w.hash({proxyWin:N,proxyPrerenderFrame:P}).then((function(e){return Ze(t,e.proxyWin,e.proxyPrerenderFrame)})),R=N.then((function(e){return o=e,Ne(e)})),M=w.hash({proxyPrerenderWin:W,state:R}).then((function(e){return hn(e.proxyPrerenderWin,{context:t})})),j=w.hash({proxyWin:N,windowName:x}).then((function(e){if(c)return e.proxyWin.setName(e.windowName)})),k=w.hash({body:l}).then((function(e){return f.method?f.method:Object.keys(e.body).length?"post":"get"})),L=w.hash({proxyWin:N,windowUrl:g,body:l,method:k,windowName:j,prerender:M}).then((function(e){return e.proxyWin.setLocation(e.windowUrl,{method:e.method,body:e.body})})),U=N.then((function(e){!function e(n,r){var t=!1;return A.register((function(){t=!0})),w.delay(2e3).then((function(){return n.isClosed()})).then((function(o){if(!t)return o?on(new Error("Detected "+r+" close")):e(n,r)}))}(e,t)})),q=w.hash({container:T,prerender:M}).then((function(){return z.trigger(yr.DISPLAY)})),X=N.then((function(n){return r=n,o=e,i=t,w.try((function(){return r.awaitWindow()})).then((function(e){if(or&&or.needsBridge({win:e,domain:o})&&!or.hasBridge(o,o)){var n="function"==typeof f.bridgeUrl?f.bridgeUrl({props:F}):f.bridgeUrl;if(!n)throw new Error("Bridge needed to render "+i);var r=J(n);return or.linkUrl(e,o),or.openBridge(G(n),r)}}));var r,o,i})),Z=L.then((function(){return w.try((function(){var e=F.timeout;if(e)return S.timeout(e,new Error("Loading component timed out after "+e+" milliseconds"))}))})),Q=S.then((function(){return z.trigger(yr.RENDERED)}));return w.hash({initPromise:S,buildUrlPromise:g,onRenderPromise:h,getProxyContainerPromise:p,openFramePromise:_,openPrerenderFramePromise:P,renderContainerPromise:T,openPromise:N,openPrerenderPromise:W,setStatePromise:R,prerenderPromise:M,loadUrlPromise:L,buildWindowNamePromise:x,setWindowNamePromise:j,watchForClosePromise:U,onDisplayPromise:q,openBridgePromise:X,runTimeoutPromise:Z,onRenderedPromise:Q,delegatePromise:u,watchForUnloadPromise:s,finalSetPropsPromise:y})})).catch((function(e){return w.all([sn(e),rn(e)]).then((function(){throw e}),(function(){throw e}))})).then(pe)},destroy:rn,getProps:function(){return F},setProps:vn,export:fn,getHelpers:wn,getDelegateOverrides:function(){return w.try((function(){return{getProxyContainer:yn,show:De,hide:We,renderContainer:pn,getProxyWindow:Ce,watchForUnload:un,openFrame:ze,openPrerenderFrame:Le,prerender:hn,open:an,openPrerender:Ze,setProxyWin:Ne}}))},getExports:function(){return W({getExports:function(){return dn}})}}}function Rr(e){var n=e.uid,r=e.frame,t=e.prerenderFrame,o=e.doc,i=e.props,a=e.event,u=e.dimensions,c=u.width,s=u.height;if(r&&t){var d=o.createElement("div");d.setAttribute("id",n);var f=o.createElement("style");return i.cspNonce&&f.setAttribute("nonce",i.cspNonce),f.appendChild(o.createTextNode("\n #"+n+" {\n display: inline-block;\n position: relative;\n width: "+c+";\n height: "+s+";\n }\n\n #"+n+" > iframe {\n display: inline-block;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n transition: opacity .2s ease-in-out;\n }\n\n #"+n+" > iframe.zoid-invisible {\n opacity: 0;\n }\n\n #"+n+" > iframe.zoid-visible {\n opacity: 1;\n }\n ")),d.appendChild(r),d.appendChild(t),d.appendChild(f),t.classList.add("zoid-visible"),r.classList.add("zoid-invisible"),a.on(yr.RENDERED,(function(){t.classList.remove("zoid-visible"),t.classList.add("zoid-invisible"),r.classList.remove("zoid-invisible"),r.classList.add("zoid-visible"),setTimeout((function(){Xe(t)}),1)})),a.on(yr.RESIZE,(function(e){var n=e.width,r=e.height;"number"==typeof n&&(d.style.width=rn(n)),"number"==typeof r&&(d.style.height=rn(r))})),d}}function Ar(e){var n=e.doc,r=e.props,t=n.createElement("html"),o=n.createElement("body"),i=n.createElement("style"),a=n.createElement("div");return a.classList.add("spinner"),r.cspNonce&&i.setAttribute("nonce",r.cspNonce),t.appendChild(o),o.appendChild(a),o.appendChild(i),i.appendChild(n.createTextNode("\n html, body {\n width: 100%;\n height: 100%;\n }\n\n .spinner {\n position: fixed;\n max-height: 60vmin;\n max-width: 60vmin;\n height: 40px;\n width: 40px;\n top: 50%;\n left: 50%;\n box-sizing: border-box;\n border: 3px solid rgba(0, 0, 0, .2);\n border-top-color: rgba(33, 128, 192, 0.8);\n border-radius: 100%;\n animation: rotation .7s infinite linear;\n }\n\n @keyframes rotation {\n from {\n transform: translateX(-50%) translateY(-50%) rotate(0deg);\n }\n to {\n transform: translateX(-50%) translateY(-50%) rotate(359deg);\n }\n }\n ")),t}var Mr=Te(),jr=Te();function Ir(e){var n,r,t=function(e){var n=e.tag,r=e.url,t=e.domain,o=e.bridgeUrl,i=e.props,u=void 0===i?{}:i,c=e.dimensions,s=void 0===c?{}:c,d=e.autoResize,f=void 0===d?{}:d,l=e.allowedParentDomains,h=void 0===l?"*":l,p=e.attributes,w=void 0===p?{}:p,v=e.defaultContext,m=void 0===v?mr.IFRAME:v,y=e.containerTemplate,g=void 0===y?Rr:y,E=e.prerenderTemplate,b=void 0===E?Ar:E,x=e.validate,_=e.eligible,P=void 0===_?function(){return{eligible:!0}}:_,T=e.logger,O=void 0===T?{info:pe}:T,N=e.exports,D=void 0===N?pe:N,W=e.method,S=e.children,R=void 0===S?function(){return{}}:S,A=n.replace(/-/g,"_"),M=a({},{window:{type:wr.OBJECT,sendToChild:!1,required:!1,allowDelegate:!0,validate:function(e){var n=e.value;if(!Y(n)&&!Un.isProxyWindow(n))throw new Error("Expected Window or ProxyWindow");if(Y(n)){if(I(n))throw new Error("Window is closed");if(!C(n))throw new Error("Window is not same domain")}},decorate:function(e){return ar(e.value)}},timeout:{type:wr.NUMBER,required:!1,sendToChild:!1},cspNonce:{type:wr.STRING,required:!1},onDisplay:{type:wr.FUNCTION,required:!1,sendToChild:!1,allowDelegate:!0,default:Cr,decorate:Nr},onRendered:{type:wr.FUNCTION,required:!1,sendToChild:!1,default:Cr,decorate:Nr},onRender:{type:wr.FUNCTION,required:!1,sendToChild:!1,default:Cr,decorate:Nr},onClose:{type:wr.FUNCTION,required:!1,sendToChild:!1,allowDelegate:!0,default:Cr,decorate:Nr},onDestroy:{type:wr.FUNCTION,required:!1,sendToChild:!1,allowDelegate:!0,default:Cr,decorate:Nr},onResize:{type:wr.FUNCTION,required:!1,sendToChild:!1,allowDelegate:!0,default:Cr},onFocus:{type:wr.FUNCTION,required:!1,sendToChild:!1,allowDelegate:!0,default:Cr},close:{type:wr.FUNCTION,required:!1,sendToChild:!1,childDecorate:function(e){return e.close}},focus:{type:wr.FUNCTION,required:!1,sendToChild:!1,childDecorate:function(e){return e.focus}},resize:{type:wr.FUNCTION,required:!1,sendToChild:!1,childDecorate:function(e){return e.resize}},uid:{type:wr.STRING,required:!1,sendToChild:!1,childDecorate:function(e){return e.uid}},tag:{type:wr.STRING,required:!1,sendToChild:!1,childDecorate:function(e){return e.tag}},getParent:{type:wr.FUNCTION,required:!1,sendToChild:!1,childDecorate:function(e){return e.getParent}},getParentDomain:{type:wr.FUNCTION,required:!1,sendToChild:!1,childDecorate:function(e){return e.getParentDomain}},show:{type:wr.FUNCTION,required:!1,sendToChild:!1,childDecorate:function(e){return e.show}},hide:{type:wr.FUNCTION,required:!1,sendToChild:!1,childDecorate:function(e){return e.hide}},export:{type:wr.FUNCTION,required:!1,sendToChild:!1,childDecorate:function(e){return e.export}},onError:{type:wr.FUNCTION,required:!1,sendToChild:!1,childDecorate:function(e){return e.onError}},onProps:{type:wr.FUNCTION,required:!1,sendToChild:!1,childDecorate:function(e){return e.onProps}},getSiblings:{type:wr.FUNCTION,required:!1,sendToChild:!1,childDecorate:function(e){return e.getSiblings}}},u);if(!g)throw new Error("Container template required");return{name:A,tag:n,url:r,domain:t,bridgeUrl:o,method:W,propsDef:M,dimensions:s,autoResize:f,allowedParentDomains:h,attributes:w,defaultContext:m,containerTemplate:g,prerenderTemplate:b,validate:x,logger:O,eligible:P,children:R,exports:"function"==typeof D?D:function(e){for(var n=e.getExports,r={},t=function(e,t){var o=t[e],i=D[o].type,a=n().then((function(e){return e[o]}));r[o]=i===wr.FUNCTION?function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return a.then((function(e){return e.apply(void 0,n)}))}:a},o=0,i=Object.keys(D);o<i.length;o++)t(o,i);return r}}}(e),o=t.name,i=t.tag,u=t.defaultContext,c=t.eligible,s=t.children,d=cr(window),f=[],l=function(){if(function(e){try{return Er(window.name).name===e}catch(e){}return!1}(o)){var e=xr().payload;if(e.tag===i&&H(e.childDomainMatch,O()))return!0}return!1},h=le((function(){if(l()){if(window.xprops)throw delete d.components[i],new Error("Can not register "+o+" as child - child already registered");var e=function(e){var n,r=e.tag,t=e.propsDef,o=e.autoResize,i=e.allowedParentDomains,a=[],u=xr(),c=u.parent,s=u.payload,d=c.win,f=c.domain,l=new w,h=s.version,p=s.uid,v=s.exports,m=s.context,y=s.props;if("9_0_86"!==h)throw new Error("Parent window has zoid version "+h+", child window has version 9_0_86");var g=v.show,E=v.hide,b=v.close,x=v.onError,_=v.checkClose,P=v.export,T=v.resize,D=v.init,W=function(){return d},S=function(){return f},R=function(e){return a.push(e),{cancel:function(){a.splice(a.indexOf(e),1)}}},M=function(e){return T.fireAndForget({width:e.width,height:e.height})},j=function(e){return l.resolve(e),P(e)},I=function(e){var t=(void 0===e?{}:e).anyParent,o=[],i=n.parent;if(void 0===t&&(t=!i),!t&&!i)throw new Error("No parent found for "+r+" child");for(var a=0,u=A(window);a<u.length;a++){var c=u[a];if(C(c)){var s=N(c).xprops;if(s&&W()===s.getParent()){var d=s.parent;if(t||!i||d&&d.uid===i.uid){var f=sr(c,(function(e){return e.exports}));o.push({props:s,exports:f})}}}}return o},k=function(e,o,i){void 0===i&&(i=!1);var u=function(e,n,r,t,o,i){void 0===i&&(i=!1);for(var a={},u=0,c=Object.keys(r);u<c.length;u++){var s=c[u],d=n[s];if(!d||!d.sameDomain||t===O(window)&&C(e)){var f=Pr(n,0,s,r[s],o);a[s]=f,d&&d.alias&&!a[d.alias]&&(a[d.alias]=f)}}if(!i)for(var l=0,h=Object.keys(n);l<h.length;l++){var p=h[l];r.hasOwnProperty(p)||(a[p]=Pr(n,0,p,void 0,o))}return a}(d,t,e,o,{tag:r,show:g,hide:E,close:b,focus:Tr,onError:x,resize:M,getSiblings:I,onProps:R,getParent:W,getParentDomain:S,uid:p,export:j},i);n?ye(n,u):n=u;for(var c=0;c<a.length;c++)(0,a[c])(n)},z=function(e){return w.try((function(){return k(e,f,!0)}))};return{init:function(){return w.try((function(){return C(d)&&function(e){var n=e.componentName,r=e.parentComponentWindow,t=pr({data:Er(window.name).serializedInitialPayload,sender:{win:r},basic:!0}),o=t.sender;if("uid"===t.reference.type||"global"===t.metaData.windowRef.type){var i=hr({data:t.data,metaData:{windowRef:_r(r)},sender:{domain:o.domain},receiver:{win:window,domain:O()},basic:!0});window.name=gr({name:n,serializedPayload:i.serializedData})}}({componentName:e.name,parentComponentWindow:d}),cr(window).exports=e.exports({getExports:function(){return l}}),function(e,n){if(!H(e,n))throw new Error("Can not be rendered by domain: "+n)}(i,f),mn(d),window.addEventListener("beforeunload",(function(){_.fireAndForget()})),window.addEventListener("unload",(function(){_.fireAndForget()})),X(d,(function(){Or()})),D({updateProps:z,close:Or})})).then((function(){var e,n,r,t,i;return(e=o.width,n=void 0!==e&&e,r=o.height,t=void 0!==r&&r,i=o.element,ke(void 0===i?"body":i).catch(pe).then((function(e){return{width:n,height:t,element:e}}))).then((function(e){var n=e.width,r=e.height,t=e.element;t&&(n||r)&&m!==mr.POPUP&&Ge(t,(function(e){M({width:n?e.width:void 0,height:r?e.height:void 0})}),{width:n,height:r})}))})).catch((function(e){x(e)}))},getProps:function(){return n||(k(y,f),n)}}}(t);return e.init(),e}}));if(h(),n=tr("zoid_allow_delegate_"+o,(function(){return!0})),r=tr("zoid_delegate_"+o,(function(e){var n=e.data;return{parent:Sr({uid:n.uid,options:t,overrides:n.overrides,parentWin:e.source})}})),jr.register(n.cancel),jr.register(r.cancel),d.components=d.components||{},d.components[i])throw new Error("Can not register multiple components with the same tag: "+i);return d.components[i]=!0,{init:function e(n){var r,d="zoid-"+i+"-"+ue(),l=n||{},h=c({props:l}),p=h.eligible,v=h.reason,m=l.onDestroy;l.onDestroy=function(){if(r&&p&&f.splice(f.indexOf(r),1),m)return m.apply(void 0,arguments)};var y=Sr({uid:d,options:t});y.init(),p?y.setProps(l):l.onDestroy&&l.onDestroy(),Mr.register((function(e){return y.destroy(e||new Error("zoid destroyed all components"))}));var g=function(n){var r=(void 0===n?{}:n).decorate;return e((void 0===r?ge:r)(l))},E=function(e,n,t){return w.try((function(){if(!p){var n=new Error(v||o+" component is not eligible");return y.destroy(n).then((function(){throw n}))}if(!Y(e))throw new Error("Must pass window to renderTo");return r=l,i=t,w.try((function(){if(r.window)return ar(r.window).getType();if(i){if(i!==mr.IFRAME&&i!==mr.POPUP)throw new Error("Unrecognized context: "+i);return i}return u}));var r,i})).then((function(o){if(n=function(e,n){if(n){if("string"!=typeof n&&!je(n))throw new TypeError("Expected string or element selector to be passed");return n}if(e===mr.POPUP)return"body";throw new Error("Expected element to be passed to render iframe")}(o,n),e!==window&&"string"!=typeof n)throw new Error("Must pass string element when rendering to another window");return y.render({target:e,container:n,context:o,rerender:function(){var o=g();return ye(r,o),o.renderTo(e,n,t)}})})).catch((function(e){return y.destroy(e).then((function(){throw e}))}))};return r=a({},y.getExports(),y.getHelpers(),function(){for(var e=s(),n={},r=function(r,t){var o=t[r],i=e[o];n[o]=function(e){var n=y.getProps(),r=a({},e,{parent:{uid:d,props:n,export:y.export}});return i(r)}},t=0,o=Object.keys(e);t<o.length;t++)r(t,o);return n}(),{isEligible:function(){return p},clone:g,render:function(e,n){return E(window,e,n)},renderTo:function(e,n,r){return E(e,n,r)}}),p&&f.push(r),r},instances:f,driver:function(e,n){throw new Error("Driver support not enabled")},isChild:l,canRenderTo:function(e){return ir(e,"zoid_allow_delegate_"+o).then((function(e){return e.data})).catch((function(){return!1}))},registerChild:h}}var kr=function(e){!function(){var e,n,r,t,o,i,a,u,c,s;on().initialized||(on().initialized=!0,u=(a={on:tr,send:ir}).on,c=a.send,(s=on()).receiveMessage=s.receiveMessage||function(e){return rr(e,{on:u,send:c})},o=(t={on:tr,send:ir}).on,i=t.send,un().getOrSet("postMessageListener",(function(){return Be(window,"message",(function(e){var n,r,t,a;n=e,t=(r={on:o,send:i}).on,a=r.send,w.try((function(){var e=n.source||n.sourceElement,r=n.origin||n.originalEvent&&n.originalEvent.origin,o=n.data;if("null"===r&&(r="file://"),e){if(!r)throw new Error("Post message did not have origin domain");rr({source:e,origin:r,data:o},{on:t,send:a})}}))}))})),zn({on:tr,send:ir,receiveMessage:rr}),n=(e={on:tr,send:ir}).on,r=e.send,un("builtinListeners").getOrSet("helloListener",(function(){var e=n("postrobot_hello",{domain:"*"},(function(e){return hn(e.source,{domain:e.origin}),{instanceID:ln()}})),t=L();return t&&pn(t,{send:r}).catch((function(e){})),e})))}();var n=Ir(e),r=function(e){return n.init(e)};r.driver=function(e,r){return n.driver(e,r)},r.isChild=function(){return n.isChild()},r.canRenderTo=function(e){return n.canRenderTo(e)},r.instances=n.instances;var t=n.registerChild();return t&&(window.xprops=r.xprops=t.getProps()),r};function zr(e){or&&or.destroyBridges();var n=Mr.all(e);return Mr=Te(),n}var Fr=zr;function Lr(e){var n;return Fr(),delete window.__zoid_9_0_86__,function(){for(var e=un("responseListeners"),n=0,r=e.keys();n<r.length;n++){var t=r[n],o=e.get(t);o&&(o.cancelled=!0),e.del(t)}}(),(n=un().get("postMessageListener"))&&n.cancel(),delete window.__post_robot_10_0_44__,jr.all(e)}}])})),o.register("8BAlD",(function(e,n){}));var i={};i=o("cZQrj");var a={},u=o("8BAlD");let c;u&&u.env,(a=o("cBfIu")).default=a,function(e){e.WITHDRAWAL="WITHDRAWAL",e.POST_DEPOSIT="POST_DEPOSIT"}(c||(c={}));const s={vaspDID:{type:"string",required:!0},transaction:{type:"object",required:!1},error:{type:"object",required:!1},onError:{type:"function",required:!0},storeTransaction:{type:"function",required:!0},theme:{type:"object",required:!1},dictionary:{type:"object",required:!1},transactionTypeAllowed:{type:"string",required:!1},nonCustodialDeclarationType:{type:"string",required:!1},beneficiaryDetails:{type:"array",required:!1},fieldsProps:{type:"object",required:!1},fallbacks:{type:"array",required:!1},optInFeatures:{type:"array",required:!1}},d={...s,onRequireAdditionalInformation:{type:"function",required:!0},onValidStateChange:{type:"function",required:!0}},f={...s,close:{type:"function"},popupOpen:{type:"boolean",required:!0},setPopupOpen:{type:"function",required:!0}};class l{async renderWidget(e=c.WITHDRAWAL){this._renderWidget(e)}async _renderWidget(e){if(this.widgetRendered)return console.error("Notabene: Widget already rendered, please destroy it first"),void this.config.onError(new Error("Widget already rendered, please destroy it first"));this.widget=await this.buildWidget(),this.popup=await this.buildPopup(),this.widget.updateProps({transaction:this.tx,type:e}),this.popup.updateProps({transaction:this.tx,type:e}),this.popup.hide(),await this.widget.render(this.config.container),await this.renderPopup()}async renderPopup(){this.popup&&(this.popupRendered||(await this.popup.render(this.config.container),this.popupRendered=!0))}async destroyWidget(){this.widgetRendered&&this.popupRendered?(await a.destroy(),this.shouldBeDestroyed=!1,this.widgetRendered=!1,this.popupRendered=!1):this.shouldBeDestroyed=!0}setTransaction(e){this.tx=e,this.widgetRendered&&(this.widget.updateProps({transaction:e}),this.popup.updateProps({transaction:e}))}cleanUpDestroyedComponents(){this.shouldBeDestroyed&&this.destroyWidget()}getWidgetUrl(){const e=new URL(this.config.widget);return e.hash=`authToken=${this.config.authToken}`,e.toString()}getAdditionalInfoUrl(){const e=new URL(this.config.widget);return e.search="popup=true",e.hash=`authToken=${this.config.authToken}`,e.toString()}handleError(e){this.error=e,this.widget&&this.popup&&(this.widget.updateProps({error:e}),this.popup.updateProps({error:e})),e&&this.config.onError&&this.config.onError(e)}buildWidget(){if(!this.config.authToken)return void console.error("Notabene: authToken is required");const n=e(a).create({tag:"widget",url:this.getWidgetUrl(),dimensions:{width:"100%",height:"280px"},attributes:{iframe:{allow:"usb *;bluetooth *"}},props:d})({vaspDID:this.config.vaspDID,transaction:{},theme:this.config.theme,dictionary:this.config.dictionary,transactionTypeAllowed:this.config.transactionTypeAllowed,nonCustodialDeclarationType:this.config.nonCustodialDeclarationType,beneficiaryDetails:this.config.beneficiaryDetails,fieldsProps:this.config.fieldsProps,fallbacks:this.config.fallbacks,optInFeatures:this.config.optInFeatures,counterpartyManualEntry:this.config.counterpartyManualEntry,onRequireAdditionalInformation:()=>{this.popup.updateProps({popupOpen:!0}),this.popup.show()},onValidStateChange:e=>{this.config.onValidStateChange(e)},error:this.error,onError:e=>{this.handleError(e),console.debug("Notabene: Error handler called")},storeTransaction:e=>{this.setTransaction(e)}});return n.event.on(e(a).EVENT.RENDERED,(()=>{this.widgetRendered=!0,this.cleanUpDestroyedComponents()})),n}buildPopup(){if(!this.config.authToken)return void console.error("Notabene: authToken is required");const n=e(a).create({tag:"popup",url:this.getAdditionalInfoUrl(),children:()=>({Transaction:this.tx}),dimensions:{width:"100%",height:"100%"},attributes:{iframe:{allow:"usb *;bluetooth *"}},props:f,containerTemplate:({uid:e,doc:n,frame:r,prerenderFrame:t})=>i.node("div",{id:e,class:"nb-container"},i.node("style",null,`\n #${e}.container {\n border: 5px solid red;\n }\n .nb-overlay {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(0,0,0,0.5);\n }\n .nb-popup {\n width: 100%;\n height: 100%;\n }\n .nb-preloader {\n display: none;\n }\n `),i.node("div",{class:"nb-overlay"},i.node("node",{el:r,class:"nb-popup"}),i.node("node",{el:t,class:"nb-preloader"}))).render(i.dom({doc:n}))})({vaspDID:this.config.vaspDID,transaction:this.tx,beneficiaryDetails:this.config.beneficiaryDetails,fieldsProps:this.config.fieldsProps,counterpartyManualEntry:this.config.counterpartyManualEntry,storeTransaction:e=>{this.setTransaction(e),console.debug("Notabene: Transaction stored")},close:()=>{this.popup.close(),console.debug("Notabene: Popup closing")},setPopupOpen:e=>{this.popup.updateProps({popupOpen:e})},error:this.error,onError:e=>{this.handleError(e),console.debug("Notabene: Error handler called")},popupOpen:!1,theme:this.config.theme,dictionary:this.config.dictionary,transactionTypeAllowed:this.config.transactionTypeAllowed,nonCustodialDeclarationType:this.config.nonCustodialDeclarationType,fallbacks:this.config.fallbacks,optInFeatures:this.config.optInFeatures});return n.event.on(e(a).EVENT.RENDERED,(()=>{this.popupRendered=!0,this.cleanUpDestroyedComponents()})),n}constructor(e){this.config=e,this.config.nonCustodialDeclarationType=e.nonCustodialDeclarationType||"SIGNATURE",this.config.transactionTypeAllowed=e.transactionTypeAllowed||"ALL",this.widgetRendered=!1,this.shouldBeDestroyed=!1,this.popupRendered=!1,this.config.fallbacks=this.config.fallbacks||[{flow:"WALLET_NOT_SUPPORTED",action:"DECLARATION"}],this.config.counterpartyManualEntry=void 0===this.config.counterpartyManualEntry||this.config.counterpartyManualEntry}}window&&(window.Notabene=l),window&&(window.Notabene=l);
package/dist/notabene.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var c=(o,e,t)=>e in o?d(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var n=(o,e,t)=>c(o,typeof e!="symbol"?e+"":e,t);var a=(o=>(o.COMPLETE="complete",o.RESIZE="resize",o.RESULT="result",o.READY="ready",o.INVALID="invalid",o.MODAL="openModal",o.ERROR="error",o.CLOSE="closeModal",o.CANCEL="cancel",o))(a||{}),l=(o=>(o.UPDATE="update",o.REQUEST_RESPONSE="requestResponse",o))(l||{});class m{constructor(){n(this,"listeners",new Map);n(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(e){this.port=e,this.port.onmessage=this.handleMessage,this.port.start()}on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){const s=this.listeners.get(e);s&&(s.delete(t),s.size===0&&this.listeners.delete(e))}handleMessage(e){console.log("received message",e.data);const t=e.data;if(typeof t=="object"&&t!==null&&"type"in t){const s=t.type,r=this.listeners.get(s);r&&r.forEach(i=>i(t))}}send(e){this.port&&this.port.postMessage(e)}}class u{constructor(e,t){n(this,"_url");n(this,"_value");n(this,"_errors",[]);n(this,"iframe");n(this,"eventManager");n(this,"modal");this._url=e,this._value=t,this.eventManager=new m,this.on(a.INVALID,s=>{s.type===a.INVALID&&(this._errors=s.errors,this._value=s.value)}),this.on(a.RESIZE,s=>{s.type===a.RESIZE&&this.iframe&&(this.iframe.style.height=`${s.height}px`)})}get url(){return this._url}get value(){return this._value}get errors(){return this._errors}open(){document.location.href=this.url}mount(e){const t=document.querySelector(e);if(!t)throw new Error(`parentID ${e} not found`);this.embed(t)}embed(e){var t,s;this.iframe=document.createElement("iframe"),this.iframe.src=this.url,this.iframe.allow="web-share",this.iframe.style.width="100%",this.iframe.style.height="100px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",e.appendChild(this.iframe),window.addEventListener("message",r=>{var i,h;r.source===((i=this.iframe)==null?void 0:i.contentWindow)&&(console.log("received message from iframe",r.data),(h=this.eventManager)==null||h.setPort(r.ports[0]))}),(s=(t=this.iframe)==null?void 0:t.contentWindow)==null||s.focus()}send(e){this.eventManager.send(e)}on(e,t){this.eventManager.on(e,t)}off(e,t){this.eventManager.off(e,t)}update(e){this._value=e,this.send({type:l.UPDATE,value:e})}completion(){return new Promise((e,t)=>{this.on(a.COMPLETE,s=>{e(s.response)}),this.on("error",s=>{t(new Error(s.message))})})}openModal(){return this.modal&&this.closeModal(),this.modal=document.createElement("dialog"),this.modal.style.border="none",this.modal.style.backgroundColor="transparent",this.modal.style.maxWidth="100vw",this.modal.style.maxHeight="100vh",this.modal.style.width="600px",this.modal.style.height="800px",document.body.appendChild(this.modal),this.embed(this.modal),this.on(a.CANCEL,()=>{this.closeModal()}),this.on(a.CLOSE,()=>{this.closeModal()}),this.on(a.COMPLETE,()=>{this.closeModal()}),this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion()}closeModal(){var e;this.modal&&(console.log("closeModal"),(e=this.modal)==null||e.close(),this.modal.remove(),this.modal=void 0)}}function f(o){return Object.entries(o).map(([e,t])=>{if(!(e&&t))return;const s=encodeURIComponent(e),r=encodeURIComponent(typeof t=="object"?JSON.stringify(t):t);return`${s}=${r}`}).filter(e=>!!e).join("&")}class p{constructor(e){n(this,"nodeUrl");n(this,"authToken");n(this,"uxUrl");n(this,"theme");n(this,"locale");this.uxUrl=e.uxUrl||"https://connect.notabene.id",this.nodeUrl=e.nodeUrl,this.authToken=e.authToken,this.theme=e.theme,this.locale=e.locale}componentUrl(e,t,s,r){const i=new URL(this.uxUrl);i.pathname=e;const h=f({authToken:this.authToken,value:t,configuration:s});return i.hash=h,this.nodeUrl&&i.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&i.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&i.searchParams.set("locale",this.locale),r&&(r.callback&&i.searchParams.set("callback_url",r.callback),r.redirectUri&&i.searchParams.set("redirect_uri",r.redirectUri)),i.toString()}createComponent(e,t,s,r){return new u(this.componentUrl(e,t,s,r),t)}createWithdrawalAssist(e,t,s){return this.createComponent("withdrawal-assist",e,t,s)}createDepositAssist(e,t,s){return this.createComponent("deposit-assist",e,t,s)}createConnectWallet(e,t,s){return this.createComponent("connect",e,t,s)}createDepositRequest(e,t,s){return this.createComponent("deposit-request",e,t,s)}decodeFragmentToObject(e){return e.slice(1).split("&").reduce((s,r)=>{const[i,h]=r.split("=");return s[decodeURIComponent(i)]=decodeURIComponent(h),s},{})}}module.exports=p;
1
+ "use strict";var E=Object.defineProperty;var g=(t,e,s)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var o=(t,e,s)=>g(t,typeof e!="symbol"?e+"":e,s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var d=(t=>(t.PRIVATE="WALLET",t.VASP="VASP",t))(d||{}),c=(t=>(t.NATURAL="natural",t.LEGAL="legal",t.SELF="self",t))(c||{}),m=(t=>(t.EMPTY="empty",t.VERIFY="verify",t.PENDING="pending",t.VERIFIED="verified",t.BANNED="banned",t))(m||{}),a=(t=>(t.COMPLETE="complete",t.RESIZE="resize",t.RESULT="result",t.READY="ready",t.INVALID="invalid",t.MODAL="openModal",t.ERROR="error",t.CLOSE="closeModal",t.CANCEL="cancel",t))(a||{}),u=(t=>(t.UPDATE="update",t.REQUEST_RESPONSE="requestResponse",t))(u||{}),f=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(f||{}),p=(t=>(t.SelfDeclaration="self-declaration",t.PersonalSignEIP191="eip-191",t.PersonalSignEIP712="eip-712",t.PersonalSignBIP137="bip-137",t.PersonalSignXPUB="xpub",t.MicroTransfer="microtransfer",t.Screenshot="screenshot",t))(p||{});class v{constructor(){o(this,"listeners",new Map);o(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(e){this.port=e,this.port.onmessage=this.handleMessage,this.port.start()}on(e,s){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(s)}off(e,s){const r=this.listeners.get(e);r&&(r.delete(s),r.size===0&&this.listeners.delete(e))}handleMessage(e){console.log("received message",e.data);const s=e.data;if(typeof s=="object"&&s!==null&&"type"in s){const r=s.type,i=this.listeners.get(r);i&&i.forEach(n=>n(s))}}send(e){this.port&&this.port.postMessage(e)}}class I{constructor(e,s){o(this,"_url");o(this,"_value");o(this,"_errors",[]);o(this,"iframe");o(this,"eventManager");o(this,"modal");this._url=e,this._value=s,this.eventManager=new v,this.on(a.INVALID,r=>{r.type===a.INVALID&&(this._errors=r.errors,this._value=r.value)}),this.on(a.RESIZE,r=>{r.type===a.RESIZE&&this.iframe&&(this.iframe.style.height=`${r.height}px`)})}get url(){return this._url}get value(){return this._value}get errors(){return this._errors}open(){document.location.href=this.url}mount(e){const s=document.querySelector(e);if(!s)throw new Error(`parentID ${e} not found`);this.embed(s)}embed(e,s=!1){var r,i;console.log(this.url),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(s?"":"&embedded=true"),this.iframe.allow="web-share",this.iframe.style.width="100%",this.iframe.style.height="100px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",e.appendChild(this.iframe),window.addEventListener("message",n=>{var l,h;n.source===((l=this.iframe)==null?void 0:l.contentWindow)&&(console.log("received message from iframe",n.data),(h=this.eventManager)==null||h.setPort(n.ports[0]))}),(i=(r=this.iframe)==null?void 0:r.contentWindow)==null||i.focus()}send(e){this.eventManager.send(e)}on(e,s){this.eventManager.on(e,s)}off(e,s){this.eventManager.off(e,s)}update(e){this._value=e,this.send({type:u.UPDATE,value:e})}completion(){return new Promise((e,s)=>{this.on(a.COMPLETE,r=>{e(r.response)}),this.on("error",r=>{s(new Error(r.message))})})}openModal(){return this.modal&&this.closeModal(),this.modal=document.createElement("dialog"),this.modal.style.border="none",this.modal.style.backgroundColor="transparent",this.modal.style.maxWidth="100vw",this.modal.style.maxHeight="100vh",this.modal.style.width="600px",this.modal.style.height="800px",document.body.appendChild(this.modal),this.embed(this.modal,!0),this.on(a.CANCEL,()=>{this.closeModal()}),this.on(a.CLOSE,()=>{this.closeModal()}),this.on(a.COMPLETE,()=>{this.closeModal()}),this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion()}closeModal(){var e;this.modal&&(console.log("closeModal"),(e=this.modal)==null||e.close(),this.modal.remove(),this.modal=void 0)}}function M(t){return Object.entries(t).map(([e,s])=>{if(!(e&&s))return;const r=encodeURIComponent(e),i=encodeURIComponent(typeof s=="object"?JSON.stringify(s):s);return`${r}=${i}`}).filter(e=>!!e).join("&")}class U{constructor(e){o(this,"nodeUrl");o(this,"authToken");o(this,"uxUrl");o(this,"theme");o(this,"locale");this.uxUrl=e.uxUrl||"https://connect.notabene.id",this.nodeUrl=e.nodeUrl,this.authToken=e.authToken,this.theme=e.theme,this.locale=e.locale}componentUrl(e,s,r,i){const n=new URL(this.uxUrl);n.pathname=e;const l=M({authToken:this.authToken,value:s,configuration:r});return n.hash=l,this.nodeUrl&&n.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&n.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&n.searchParams.set("locale",this.locale),i&&(i.callback&&n.searchParams.set("callback_url",i.callback),i.redirectUri&&n.searchParams.set("redirect_uri",i.redirectUri)),n.toString()}createComponent(e,s,r,i){return new I(this.componentUrl(e,s,r,i),s)}createWithdrawalAssist(e,s,r){return this.createComponent("withdrawal-assist",e,s,r)}createWalletAssist(e,s,r){return this.createComponent("wallet-assist",e,s,r)}createDepositAssist(e,s,r){return this.createComponent("deposit-assist",e,s,r)}createConnectWallet(e,s,r){return this.createComponent("connect",e,s,r)}createDepositRequest(e,s,r){return this.createComponent("deposit-request",e,s,r)}decodeFragmentToObject(e){return e.slice(1).split("&").reduce((r,i)=>{const[n,l]=i.split("=");return r[decodeURIComponent(n)]=decodeURIComponent(l),r},{})}}exports.AgentType=d;exports.CMType=a;exports.PersonType=c;exports.ProofStatus=f;exports.ProofTypes=p;exports.Status=m;exports.default=U;
@@ -227,6 +227,7 @@ export declare interface Counterparty {
227
227
  nationalIdentification?: NationalIdentification;
228
228
  website?: URI;
229
229
  phone?: string;
230
+ email?: string;
230
231
  }
231
232
 
232
233
  /**
@@ -341,7 +342,7 @@ export declare class EmbeddedComponent<V, R> {
341
342
  * Embeds the component into a parent element
342
343
  * @param parent - The parent element to embed the component into
343
344
  */
344
- embed(parent: Element): void;
345
+ embed(parent: Element, modal?: boolean): void;
345
346
  /**
346
347
  * Sends a message to the embedded component
347
348
  * @param message - The message to send
@@ -730,6 +731,16 @@ declare class Notabene {
730
731
  * @returns A new EmbeddedComponent instance for withdrawal assistance
731
732
  */
732
733
  createWithdrawalAssist(value: Partial<Withdrawal>, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<Partial<Withdrawal>, TransactionResponse<Withdrawal>>;
734
+ /**
735
+ * Creates a wallet assist component
736
+ *
737
+ * @param value - Withdrawal transaction data
738
+ * @param options - Optional transaction options
739
+ * @param callbacks - Optional callback configuration
740
+ * @returns A new EmbeddedComponent instance for withdrawal assistance
741
+ * @alpha
742
+ */
743
+ createWalletAssist(value: Partial<Withdrawal>, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<Partial<Withdrawal>, TransactionResponse<Withdrawal>>;
733
744
  /**
734
745
  * Creates a deposit assist component
735
746
  *
@@ -747,6 +758,7 @@ declare class Notabene {
747
758
  * @param options - Optional transaction options
748
759
  * @param callbacks - Optional callback configuration
749
760
  * @returns A new EmbeddedComponent instance for connection
761
+ * @alpha
750
762
  */
751
763
  createConnectWallet(value: ConnectionRequest, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<ConnectionRequest, ConnectionResponse>;
752
764
  /**
@@ -756,7 +768,7 @@ declare class Notabene {
756
768
  * @param options - Optional transaction options
757
769
  * @param callbacks - Optional callback configuration
758
770
  * @returns A new EmbeddedComponent instance for deposit requests
759
- * @alpha
771
+ * @public
760
772
  */
761
773
  createDepositRequest(value: DepositRequest, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<DepositRequest, TransactionResponse<DepositRequest>>;
762
774
  /**
package/dist/notabene.js CHANGED
@@ -1,29 +1,29 @@
1
- var d = Object.defineProperty;
2
- var c = (o, e, t) => e in o ? d(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var n = (o, e, t) => c(o, typeof e != "symbol" ? e + "" : e, t);
4
- var a = /* @__PURE__ */ ((o) => (o.COMPLETE = "complete", o.RESIZE = "resize", o.RESULT = "result", o.READY = "ready", o.INVALID = "invalid", o.MODAL = "openModal", o.ERROR = "error", o.CLOSE = "closeModal", o.CANCEL = "cancel", o))(a || {}), l = /* @__PURE__ */ ((o) => (o.UPDATE = "update", o.REQUEST_RESPONSE = "requestResponse", o))(l || {});
5
- class m {
1
+ var c = Object.defineProperty;
2
+ var m = (t, e, s) => e in t ? c(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
+ var o = (t, e, s) => m(t, typeof e != "symbol" ? e + "" : e, s);
4
+ var u = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(u || {}), f = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(f || {}), E = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(E || {}), a = /* @__PURE__ */ ((t) => (t.COMPLETE = "complete", t.RESIZE = "resize", t.RESULT = "result", t.READY = "ready", t.INVALID = "invalid", t.MODAL = "openModal", t.ERROR = "error", t.CLOSE = "closeModal", t.CANCEL = "cancel", t))(a || {}), d = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(d || {}), p = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(p || {}), g = /* @__PURE__ */ ((t) => (t.SelfDeclaration = "self-declaration", t.PersonalSignEIP191 = "eip-191", t.PersonalSignEIP712 = "eip-712", t.PersonalSignBIP137 = "bip-137", t.PersonalSignXPUB = "xpub", t.MicroTransfer = "microtransfer", t.Screenshot = "screenshot", t))(g || {});
5
+ class v {
6
6
  constructor() {
7
- n(this, "listeners", /* @__PURE__ */ new Map());
8
- n(this, "port");
7
+ o(this, "listeners", /* @__PURE__ */ new Map());
8
+ o(this, "port");
9
9
  this.handleMessage = this.handleMessage.bind(this);
10
10
  }
11
11
  setPort(e) {
12
12
  this.port = e, this.port.onmessage = this.handleMessage, this.port.start();
13
13
  }
14
- on(e, t) {
15
- this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(t);
14
+ on(e, s) {
15
+ this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(s);
16
16
  }
17
- off(e, t) {
18
- const s = this.listeners.get(e);
19
- s && (s.delete(t), s.size === 0 && this.listeners.delete(e));
17
+ off(e, s) {
18
+ const r = this.listeners.get(e);
19
+ r && (r.delete(s), r.size === 0 && this.listeners.delete(e));
20
20
  }
21
21
  handleMessage(e) {
22
22
  console.log("received message", e.data);
23
- const t = e.data;
24
- if (typeof t == "object" && t !== null && "type" in t) {
25
- const s = t.type, r = this.listeners.get(s);
26
- r && r.forEach((i) => i(t));
23
+ const s = e.data;
24
+ if (typeof s == "object" && s !== null && "type" in s) {
25
+ const r = s.type, i = this.listeners.get(r);
26
+ i && i.forEach((n) => n(s));
27
27
  }
28
28
  }
29
29
  // Method to send messages through the port
@@ -31,23 +31,23 @@ class m {
31
31
  this.port && this.port.postMessage(e);
32
32
  }
33
33
  }
34
- class u {
34
+ class I {
35
35
  /**
36
36
  * Creates an instance of EmbeddedComponent.
37
37
  * @param url - The URL of the embedded component
38
38
  * @param value - The initial transaction value
39
39
  */
40
- constructor(e, t) {
41
- n(this, "_url");
42
- n(this, "_value");
43
- n(this, "_errors", []);
44
- n(this, "iframe");
45
- n(this, "eventManager");
46
- n(this, "modal");
47
- this._url = e, this._value = t, this.eventManager = new m(), this.on(a.INVALID, (s) => {
48
- s.type === a.INVALID && (this._errors = s.errors, this._value = s.value);
49
- }), this.on(a.RESIZE, (s) => {
50
- s.type === a.RESIZE && this.iframe && (this.iframe.style.height = `${s.height}px`);
40
+ constructor(e, s) {
41
+ o(this, "_url");
42
+ o(this, "_value");
43
+ o(this, "_errors", []);
44
+ o(this, "iframe");
45
+ o(this, "eventManager");
46
+ o(this, "modal");
47
+ this._url = e, this._value = s, this.eventManager = new v(), this.on(a.INVALID, (r) => {
48
+ r.type === a.INVALID && (this._errors = r.errors, this._value = r.value);
49
+ }), this.on(a.RESIZE, (r) => {
50
+ r.type === a.RESIZE && this.iframe && (this.iframe.style.height = `${r.height}px`);
51
51
  });
52
52
  }
53
53
  /**
@@ -79,20 +79,20 @@ class u {
79
79
  * @throws Will throw an error if the parent element is not found
80
80
  */
81
81
  mount(e) {
82
- const t = document.querySelector(e);
83
- if (!t) throw new Error(`parentID ${e} not found`);
84
- this.embed(t);
82
+ const s = document.querySelector(e);
83
+ if (!s) throw new Error(`parentID ${e} not found`);
84
+ this.embed(s);
85
85
  }
86
86
  /**
87
87
  * Embeds the component into a parent element
88
88
  * @param parent - The parent element to embed the component into
89
89
  */
90
- embed(e) {
91
- var t, s;
92
- this.iframe = document.createElement("iframe"), this.iframe.src = this.url, this.iframe.allow = "web-share", this.iframe.style.width = "100%", this.iframe.style.height = "100px", this.iframe.style.border = "none", this.iframe.style.overflow = "hidden", e.appendChild(this.iframe), window.addEventListener("message", (r) => {
93
- var i, h;
94
- r.source === ((i = this.iframe) == null ? void 0 : i.contentWindow) && (console.log("received message from iframe", r.data), (h = this.eventManager) == null || h.setPort(r.ports[0]));
95
- }), (s = (t = this.iframe) == null ? void 0 : t.contentWindow) == null || s.focus();
90
+ embed(e, s = !1) {
91
+ var r, i;
92
+ console.log(this.url), this.iframe = document.createElement("iframe"), this.iframe.src = this.url + (s ? "" : "&embedded=true"), this.iframe.allow = "web-share", this.iframe.style.width = "100%", this.iframe.style.height = "100px", this.iframe.style.border = "none", this.iframe.style.overflow = "hidden", e.appendChild(this.iframe), window.addEventListener("message", (n) => {
93
+ var l, h;
94
+ n.source === ((l = this.iframe) == null ? void 0 : l.contentWindow) && (console.log("received message from iframe", n.data), (h = this.eventManager) == null || h.setPort(n.ports[0]));
95
+ }), (i = (r = this.iframe) == null ? void 0 : r.contentWindow) == null || i.focus();
96
96
  }
97
97
  /**
98
98
  * Sends a message to the embedded component
@@ -106,34 +106,34 @@ class u {
106
106
  * @param messageType - The type of message to listen for
107
107
  * @param callback - The callback function to execute when the message is received
108
108
  */
109
- on(e, t) {
110
- this.eventManager.on(e, t);
109
+ on(e, s) {
110
+ this.eventManager.on(e, s);
111
111
  }
112
112
  /**
113
113
  * Removes an event listener for a specific message type
114
114
  * @param messageType - The type of message to stop listening for
115
115
  * @param callback - The callback function to remove
116
116
  */
117
- off(e, t) {
118
- this.eventManager.off(e, t);
117
+ off(e, s) {
118
+ this.eventManager.off(e, s);
119
119
  }
120
120
  /**
121
121
  * Updates the transaction value and sends an update message to the component
122
122
  * @param value - The new transaction value
123
123
  */
124
124
  update(e) {
125
- this._value = e, this.send({ type: l.UPDATE, value: e });
125
+ this._value = e, this.send({ type: d.UPDATE, value: e });
126
126
  }
127
127
  /**
128
128
  * Waits for the component to complete and returns the transaction response
129
129
  * @returns A promise that resolves with the transaction response
130
130
  */
131
131
  completion() {
132
- return new Promise((e, t) => {
133
- this.on(a.COMPLETE, (s) => {
134
- e(s.response);
135
- }), this.on("error", (s) => {
136
- t(new Error(s.message));
132
+ return new Promise((e, s) => {
133
+ this.on(a.COMPLETE, (r) => {
134
+ e(r.response);
135
+ }), this.on("error", (r) => {
136
+ s(new Error(r.message));
137
137
  });
138
138
  });
139
139
  }
@@ -141,7 +141,7 @@ class u {
141
141
  * Opens the component in a modal dialog
142
142
  */
143
143
  openModal() {
144
- return this.modal && this.closeModal(), this.modal = document.createElement("dialog"), this.modal.style.border = "none", this.modal.style.backgroundColor = "transparent", this.modal.style.maxWidth = "100vw", this.modal.style.maxHeight = "100vh", this.modal.style.width = "600px", this.modal.style.height = "800px", document.body.appendChild(this.modal), this.embed(this.modal), this.on(a.CANCEL, () => {
144
+ return this.modal && this.closeModal(), this.modal = document.createElement("dialog"), this.modal.style.border = "none", this.modal.style.backgroundColor = "transparent", this.modal.style.maxWidth = "100vw", this.modal.style.maxHeight = "100vh", this.modal.style.width = "600px", this.modal.style.height = "800px", document.body.appendChild(this.modal), this.embed(this.modal, !0), this.on(a.CANCEL, () => {
145
145
  this.closeModal();
146
146
  }), this.on(a.CLOSE, () => {
147
147
  this.closeModal();
@@ -160,27 +160,27 @@ class u {
160
160
  this.modal && (console.log("closeModal"), (e = this.modal) == null || e.close(), this.modal.remove(), this.modal = void 0);
161
161
  }
162
162
  }
163
- function f(o) {
164
- return Object.entries(o).map(([e, t]) => {
165
- if (!(e && t)) return;
166
- const s = encodeURIComponent(e), r = encodeURIComponent(
167
- typeof t == "object" ? JSON.stringify(t) : t
163
+ function U(t) {
164
+ return Object.entries(t).map(([e, s]) => {
165
+ if (!(e && s)) return;
166
+ const r = encodeURIComponent(e), i = encodeURIComponent(
167
+ typeof s == "object" ? JSON.stringify(s) : s
168
168
  );
169
- return `${s}=${r}`;
169
+ return `${r}=${i}`;
170
170
  }).filter((e) => !!e).join("&");
171
171
  }
172
- class E {
172
+ class L {
173
173
  /**
174
174
  * Creates a new instance of the Notabene SDK
175
175
  *
176
176
  * @param config - Configuration options for the Notabene SDK
177
177
  */
178
178
  constructor(e) {
179
- n(this, "nodeUrl");
180
- n(this, "authToken");
181
- n(this, "uxUrl");
182
- n(this, "theme");
183
- n(this, "locale");
179
+ o(this, "nodeUrl");
180
+ o(this, "authToken");
181
+ o(this, "uxUrl");
182
+ o(this, "theme");
183
+ o(this, "locale");
184
184
  this.uxUrl = e.uxUrl || "https://connect.notabene.id", this.nodeUrl = e.nodeUrl, this.authToken = e.authToken, this.theme = e.theme, this.locale = e.locale;
185
185
  }
186
186
  /**
@@ -193,15 +193,15 @@ class E {
193
193
  * @returns component URL
194
194
  * @internal
195
195
  */
196
- componentUrl(e, t, s, r) {
197
- const i = new URL(this.uxUrl);
198
- i.pathname = e;
199
- const h = f({
196
+ componentUrl(e, s, r, i) {
197
+ const n = new URL(this.uxUrl);
198
+ n.pathname = e;
199
+ const l = U({
200
200
  authToken: this.authToken,
201
- value: t,
202
- configuration: s
201
+ value: s,
202
+ configuration: r
203
203
  });
204
- return i.hash = h, this.nodeUrl && i.searchParams.set("nodeUrl", this.nodeUrl), this.theme && i.searchParams.set("theme", JSON.stringify(this.theme)), this.locale && i.searchParams.set("locale", this.locale), r && (r.callback && i.searchParams.set("callback_url", r.callback), r.redirectUri && i.searchParams.set("redirect_uri", r.redirectUri)), i.toString();
204
+ return n.hash = l, this.nodeUrl && n.searchParams.set("nodeUrl", this.nodeUrl), this.theme && n.searchParams.set("theme", JSON.stringify(this.theme)), this.locale && n.searchParams.set("locale", this.locale), i && (i.callback && n.searchParams.set("callback_url", i.callback), i.redirectUri && n.searchParams.set("redirect_uri", i.redirectUri)), n.toString();
205
205
  }
206
206
  /**
207
207
  * Creates a new embedded component
@@ -213,10 +213,10 @@ class E {
213
213
  * @returns A new EmbeddedComponent instance
214
214
  * @internal
215
215
  */
216
- createComponent(e, t, s, r) {
217
- return new u(
218
- this.componentUrl(e, t, s, r),
219
- t
216
+ createComponent(e, s, r, i) {
217
+ return new I(
218
+ this.componentUrl(e, s, r, i),
219
+ s
220
220
  );
221
221
  }
222
222
  /**
@@ -227,8 +227,20 @@ class E {
227
227
  * @param callbacks - Optional callback configuration
228
228
  * @returns A new EmbeddedComponent instance for withdrawal assistance
229
229
  */
230
- createWithdrawalAssist(e, t, s) {
231
- return this.createComponent("withdrawal-assist", e, t, s);
230
+ createWithdrawalAssist(e, s, r) {
231
+ return this.createComponent("withdrawal-assist", e, s, r);
232
+ }
233
+ /**
234
+ * Creates a wallet assist component
235
+ *
236
+ * @param value - Withdrawal transaction data
237
+ * @param options - Optional transaction options
238
+ * @param callbacks - Optional callback configuration
239
+ * @returns A new EmbeddedComponent instance for withdrawal assistance
240
+ * @alpha
241
+ */
242
+ createWalletAssist(e, s, r) {
243
+ return this.createComponent("wallet-assist", e, s, r);
232
244
  }
233
245
  /**
234
246
  * Creates a deposit assist component
@@ -239,12 +251,12 @@ class E {
239
251
  * @returns A new EmbeddedComponent instance for deposit assistance
240
252
  * @alpha
241
253
  */
242
- createDepositAssist(e, t, s) {
254
+ createDepositAssist(e, s, r) {
243
255
  return this.createComponent(
244
256
  "deposit-assist",
245
257
  e,
246
- t,
247
- s
258
+ s,
259
+ r
248
260
  );
249
261
  }
250
262
  /**
@@ -254,13 +266,14 @@ class E {
254
266
  * @param options - Optional transaction options
255
267
  * @param callbacks - Optional callback configuration
256
268
  * @returns A new EmbeddedComponent instance for connection
269
+ * @alpha
257
270
  */
258
- createConnectWallet(e, t, s) {
271
+ createConnectWallet(e, s, r) {
259
272
  return this.createComponent(
260
273
  "connect",
261
274
  e,
262
- t,
263
- s
275
+ s,
276
+ r
264
277
  );
265
278
  }
266
279
  /**
@@ -270,10 +283,10 @@ class E {
270
283
  * @param options - Optional transaction options
271
284
  * @param callbacks - Optional callback configuration
272
285
  * @returns A new EmbeddedComponent instance for deposit requests
273
- * @alpha
286
+ * @public
274
287
  */
275
- createDepositRequest(e, t, s) {
276
- return this.createComponent("deposit-request", e, t, s);
288
+ createDepositRequest(e, s, r) {
289
+ return this.createComponent("deposit-request", e, s, r);
277
290
  }
278
291
  /**
279
292
  * Decodes a URL fragment into an object
@@ -283,14 +296,20 @@ class E {
283
296
  */
284
297
  decodeFragmentToObject(e) {
285
298
  return e.slice(1).split("&").reduce(
286
- (s, r) => {
287
- const [i, h] = r.split("=");
288
- return s[decodeURIComponent(i)] = decodeURIComponent(h), s;
299
+ (r, i) => {
300
+ const [n, l] = i.split("=");
301
+ return r[decodeURIComponent(n)] = decodeURIComponent(l), r;
289
302
  },
290
303
  {}
291
304
  );
292
305
  }
293
306
  }
294
307
  export {
295
- E as default
308
+ u as AgentType,
309
+ a as CMType,
310
+ f as PersonType,
311
+ p as ProofStatus,
312
+ g as ProofTypes,
313
+ E as Status,
314
+ L as default
296
315
  };
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "author": "Notabene <developers@notabene.id>",
11
11
  "license": "MIT",
12
- "version": "2.0.0-next.13",
12
+ "version": "2.0.0-next.15",
13
13
  "source": "src/notabene.ts",
14
14
  "main": "dist/notabene.js",
15
15
  "types": "dist/notabene.d.ts",
@@ -91,9 +91,10 @@ export default class EmbeddedComponent<V, R> {
91
91
  * @param parent - The parent element to embed the component into
92
92
  */
93
93
 
94
- embed(parent: Element) {
94
+ embed(parent: Element, modal: boolean = false) {
95
+ console.log(this.url);
95
96
  this.iframe = document.createElement('iframe');
96
- this.iframe.src = this.url;
97
+ this.iframe.src = this.url + (!modal ? '&embedded=true' : '');
97
98
  this.iframe.allow = 'web-share';
98
99
  this.iframe.style.width = '100%';
99
100
  this.iframe.style.height = '100px';
@@ -184,7 +185,7 @@ export default class EmbeddedComponent<V, R> {
184
185
  this.modal.style.height = '800px';
185
186
 
186
187
  document.body.appendChild(this.modal);
187
- this.embed(this.modal);
188
+ this.embed(this.modal, true);
188
189
  this.on(CMType.CANCEL, () => {
189
190
  this.closeModal();
190
191
  });
package/src/notabene.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import EmbeddedComponent from './components/EmbeddedComponent';
2
2
  import type {
3
3
  Agent,
4
- AgentType,
5
4
  CallbackOptions,
6
5
  ComponentMessage,
7
6
  ConnectionRequest,
@@ -15,25 +14,28 @@ import type {
15
14
  IVMS101,
16
15
  MicroTransferProof,
17
16
  OwnershipProof,
18
- PersonType,
19
- ProofStatus,
20
- ProofTypes,
21
17
  ScreenshotProof,
22
18
  SignatureProof,
23
- Status,
24
19
  Theme,
25
20
  Transaction,
26
21
  TransactionAsset,
27
22
  TransactionOptions,
23
+ TransactionResponse,
28
24
  VASP,
29
25
  Wallet,
30
26
  Withdrawal,
31
27
  } from './types';
32
- import { CMType, TransactionResponse } from './types';
28
+ import {
29
+ AgentType,
30
+ CMType,
31
+ PersonType,
32
+ ProofStatus,
33
+ ProofTypes,
34
+ Status,
35
+ } from './types';
33
36
  import { encodeObjectToFragment } from './utils/urls';
34
37
 
35
38
  export type {
36
- CMType,
37
39
  ComponentMessage,
38
40
  EmbeddedComponent,
39
41
  ConnectionRequest,
@@ -53,19 +55,15 @@ export type {
53
55
  MicroTransferProof,
54
56
  DeclarationProof,
55
57
  Notabene,
56
- ProofStatus,
57
- ProofTypes,
58
58
  IVMS101,
59
- PersonType,
60
- Status,
61
59
  VASP,
62
60
  Wallet,
63
61
  Agent,
64
- AgentType,
65
62
  OwnershipProof,
66
63
  TransactionOptions,
67
64
  CallbackOptions,
68
65
  };
66
+ export { CMType, ProofStatus, ProofTypes, PersonType, Status, AgentType };
69
67
 
70
68
  /**
71
69
  * Configuration for the Notabene SDK
@@ -215,6 +213,26 @@ export default class Notabene {
215
213
  >('withdrawal-assist', value, options, callbacks);
216
214
  }
217
215
 
216
+ /**
217
+ * Creates a wallet assist component
218
+ *
219
+ * @param value - Withdrawal transaction data
220
+ * @param options - Optional transaction options
221
+ * @param callbacks - Optional callback configuration
222
+ * @returns A new EmbeddedComponent instance for withdrawal assistance
223
+ * @alpha
224
+ */
225
+ public createWalletAssist(
226
+ value: Partial<Withdrawal>,
227
+ options?: TransactionOptions,
228
+ callbacks?: CallbackOptions,
229
+ ) {
230
+ return this.createComponent<
231
+ Partial<Withdrawal>,
232
+ TransactionResponse<Withdrawal>
233
+ >('wallet-assist', value, options, callbacks);
234
+ }
235
+
218
236
  /**
219
237
  * Creates a deposit assist component
220
238
  *
@@ -244,6 +262,7 @@ export default class Notabene {
244
262
  * @param options - Optional transaction options
245
263
  * @param callbacks - Optional callback configuration
246
264
  * @returns A new EmbeddedComponent instance for connection
265
+ * @alpha
247
266
  */
248
267
  public createConnectWallet(
249
268
  value: ConnectionRequest,
@@ -265,7 +284,7 @@ export default class Notabene {
265
284
  * @param options - Optional transaction options
266
285
  * @param callbacks - Optional callback configuration
267
286
  * @returns A new EmbeddedComponent instance for deposit requests
268
- * @alpha
287
+ * @public
269
288
  */
270
289
  public createDepositRequest(
271
290
  value: DepositRequest,
package/src/types.ts CHANGED
@@ -206,6 +206,7 @@ export interface Counterparty {
206
206
  nationalIdentification?: NationalIdentification;
207
207
  website?: URI;
208
208
  phone?: string;
209
+ email?: string;
209
210
  }
210
211
 
211
212
  /**