UNPKG

@fastintegration/controller

Version:

BIPBOP integration services, backend client.

27 lines (25 loc) 22.8 kB
/** * Bundle of @fastintegration/controller * Generated: 2018-05-08 * Version: 1.2.3 * Dependencies: * * es6-error -- 4.1.1 * * superoverload -- 1.2.3 * * human-interval -- 0.1.6 * * lodash -- 4.17.5 * * p-timeout -- 2.0.1 * * p-finally -- 1.0.0 * * local-storage -- 1.4.2 * * escape-firebase -- 1.0.1 * * unfetch -- 3.0.0 */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("firebase")):"function"==typeof define&&define.amd?define(["exports","firebase"],e):e(t.FastintegrationController=t.FastintegrationController||{},t.firebase)}(this,function(t,l){"use strict";function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function e(t){function e(){t.apply(this,arguments)}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}l=l&&l.hasOwnProperty("default")?l.default:l;var n=function(t){function n(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n);var e=r(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t));return Object.defineProperty(e,"message",{configurable:!0,enumerable:!1,value:t,writable:!0}),Object.defineProperty(e,"name",{configurable:!0,enumerable:!1,value:e.constructor.name,writable:!0}),Error.hasOwnProperty("captureStackTrace")?(Error.captureStackTrace(e,e.constructor),r(e)):(Object.defineProperty(e,"stack",{configurable:!0,enumerable:!1,value:new Error(t).stack,writable:!0}),e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(n,e(Error)),n}(),o="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t,e){return t(e={exports:{}},e.exports),e.exports}var a=i(function(t,e){t.exports=function(){var n=/\s([a-zA-Z]+)/;function b(t){if(null===t)return"null";if(void 0===t)return"undefined";var e=Object.prototype.toString.call(t).match(n);if(!Array.isArray(e))throw new Error("Unexpected type of arg "+String(t));return e[1].toLowerCase()}function g(t){return t.map(function(t,e){return"_"+e}).join(",")}var _=["number","string","array","object","function","regexp","date"].reduce(function(t,e){return t[e]=!0,t},{});return function(){for(var t=arguments,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=t[r];for(var o=0<n.length%2?n.shift():null,i=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var o=t[n],i=Math.floor(n/2);e[i]=e[i]||[],e[i].push(o)}return e}(n),a=new Array(i.length),u=new Array(i.length),c=[],s=0;s<i.length;s++){var f=i[s],l=f[0],p=f[1],h=l.filter(function(t){return!_[t]});if(0<h.length)throw new Error('Signature "'+l.join(", ")+'" contains unsupported types: "'+h.join(", ")+'"');var v=l.join(", ");u[s]=p,l.length>c.length&&(c=l),a[s]="\nif (hashKey === '"+v+"') {\n return fns["+String(s)+"].call(this, "+g(l)+");\n}"}var d=a.join(" else "),y="\nreturn function overloadedFn("+g(c)+") {\n var hashKey = '';\n var len = arguments.length;\n var args = new Array(len);\n\n for (var i = 0; i < len; i++) {\n args[i] = arguments[i];\n }\n\n for (var i = 0; i < len; i++) {\n hashKey += getType(args[i]);\n if (i !== len - 1) {\n hashKey += ', ';\n }\n }\n "+d+"\n "+(0<i.length?"else {":"")+"\n if (!defaultFn) {\n throw new Error('No matching function for call with signature \"' + hashKey + '\"');\n }\n "+(0<i.length?"}":"")+"\n return defaultFn.apply(this, arguments);\n}";return new Function("getType, fns, defaultFn",y)(b,u,o)}}()}),u=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e}(n),c=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e}(u),p=a(function(){return new u},["string"],function(t){return new u(t)},["object"],function(t){var e=t.message,n=t.source,r=t.code,o=t.log;return Object.assign(new u(e),{source:n,code:r,log:o})},["string","number"],function(t,e){return Object.assign(new u(t),{code:e})},["string","string"],function(t,e){return Object.assign(new u(t),{code:parseInt(e,10)})}),s=Object.freeze({FastIntegrationError:u,FastIntegrationWebServiceError:c,default:p}),f=i(function(t){var o=t.exports=function(t){return t?"number"==typeof t?t:(t=(t=function(n){var r=o.languageMap,t=new RegExp("("+Object.keys(r).join("|")+")","g"),e=n.match(t);if(!e)return n;return e.forEach(function(t){var e=1<r[t]?r[t]:r[t].toString().slice(1);n=n.replace(t,e)}),n}(t)).replace(/(second|minute|hour|day|week|month|year)s?(?! ?(s )?and |s?$)/,"$1,")).split(/and|,/).reduce(function(t,e){return t+(""!==e?function(t){var e,n=parseFloat(t,10);e=null!==t.match(/(second|minute|hour|day|week|month|year)s?/)?t.match(/(second|minute|hour|day|week|month|year)s?/)[1]:void 0;n||(n=1);switch(e){case"second":e=1e3;break;case"minute":e=6e4;break;case"hour":e=36e5;break;case"day":e=864e5;break;case"week":e=6048e5;break;case"month":e=2592e6;break;case"year":e=31536e6}return e*n}(e):0)},0):t};o.languageMap={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10}});var h=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)};var v=function(t){return t},d=Math.max;var y=function(i,a,u){return a=d(void 0===a?i.length-1:a,0),function(){for(var t=arguments,e=-1,n=d(t.length-a,0),r=Array(n);++e<n;)r[e]=t[a+e];e=-1;for(var o=Array(a+1);++e<a;)o[e]=t[e];return o[a]=u(r),h(i,this,o)}};var b=function(t){return function(){return t}},g="object"==typeof o&&o&&o.Object===Object&&o,_="object"==typeof self&&self&&self.Object===Object&&self,j=g||_||Function("return this")(),m=j.Symbol,w=Object.prototype,O=w.hasOwnProperty,P=w.toString,k=m?m.toStringTag:void 0;var x=function(t){var e=O.call(t,k),n=t[k];try{var r=!(t[k]=void 0)}catch(t){}var o=P.call(t);return r&&(e?t[k]=n:delete t[k]),o},T=Object.prototype.toString;var A=function(t){return T.call(t)},S="[object Null]",E="[object Undefined]",z=m?m.toStringTag:void 0;var F=function(t){return null==t?void 0===t?E:S:z&&z in Object(t)?x(t):A(t)};var I=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},R="[object AsyncFunction]",U="[object Function]",C="[object GeneratorFunction]",L="[object Proxy]";var $,M=function(t){if(!I(t))return!1;var e=F(t);return e==U||e==C||e==R||e==L},B=j["__core-js_shared__"],J=($=/[^.]+$/.exec(B&&B.keys&&B.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"";var K=function(t){return!!J&&J in t},N=Function.prototype.toString;var q=function(t){if(null!=t){try{return N.call(t)}catch(t){}try{return t+""}catch(t){}}return""},D=/^\[object .+?Constructor\]$/,H=Function.prototype,W=Object.prototype,X=H.toString,Q=W.hasOwnProperty,V=RegExp("^"+X.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Z=function(t){return!(!I(t)||K(t))&&(M(t)?V:D).test(q(t))};var G=function(t,e){return null==t?void 0:t[e]};var Y=function(t,e){var n=G(t,e);return Z(n)?n:void 0},tt=function(){try{var t=Y(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),et=tt?function(t,e){return tt(t,"toString",{configurable:!0,enumerable:!1,value:b(e),writable:!0})}:v,nt=800,rt=16,ot=Date.now;var it=function(n){var r=0,o=0;return function(){var t=ot(),e=rt-(t-o);if(o=t,0<e){if(++r>=nt)return arguments[0]}else r=0;return n.apply(void 0,arguments)}}(et);var at=function(t,e){return it(y(t,e,v),t+"")};var ut=function(){this.__data__=[],this.size=0};var ct=function(t,e){return t===e||t!=t&&e!=e};var st=function(t,e){for(var n=t.length;n--;)if(ct(t[n][0],e))return n;return-1},ft=Array.prototype.splice;var lt=function(t){var e=this.__data__,n=st(e,t);return!(n<0||(n==e.length-1?e.pop():ft.call(e,n,1),--this.size,0))};var pt=function(t){var e=this.__data__,n=st(e,t);return n<0?void 0:e[n][1]};var ht=function(t){return-1<st(this.__data__,t)};var vt=function(t,e){var n=this.__data__,r=st(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function dt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}dt.prototype.clear=ut,dt.prototype.delete=lt,dt.prototype.get=pt,dt.prototype.has=ht,dt.prototype.set=vt;var yt=dt;var bt=function(){this.__data__=new yt,this.size=0};var gt=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var _t=function(t){return this.__data__.get(t)};var jt=function(t){return this.__data__.has(t)},mt=Y(j,"Map"),wt=Y(Object,"create");var Ot=function(){this.__data__=wt?wt(null):{},this.size=0};var Pt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},kt="__lodash_hash_undefined__",xt=Object.prototype.hasOwnProperty;var Tt=function(t){var e=this.__data__;if(wt){var n=e[t];return n===kt?void 0:n}return xt.call(e,t)?e[t]:void 0},At=Object.prototype.hasOwnProperty;var St=function(t){var e=this.__data__;return wt?void 0!==e[t]:At.call(e,t)},Et="__lodash_hash_undefined__";var zt=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=wt&&void 0===e?Et:e,this};function Ft(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Ft.prototype.clear=Ot,Ft.prototype.delete=Pt,Ft.prototype.get=Tt,Ft.prototype.has=St,Ft.prototype.set=zt;var It=Ft;var Rt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Ut=function(t,e){var n=t.__data__;return Rt(e)?n["string"==typeof e?"string":"hash"]:n.map};var Ct=function(t){var e=Ut(this,t).delete(t);return this.size-=e?1:0,e};var Lt=function(t){return Ut(this,t).get(t)};var $t=function(t){return Ut(this,t).has(t)};var Mt=function(t,e){var n=Ut(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function Bt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Bt.prototype.clear=function(){this.size=0,this.__data__={hash:new It,map:new(mt||yt),string:new It}},Bt.prototype.delete=Ct,Bt.prototype.get=Lt,Bt.prototype.has=$t,Bt.prototype.set=Mt;var Jt=Bt,Kt=200;var Nt=function(t,e){var n=this.__data__;if(n instanceof yt){var r=n.__data__;if(!mt||r.length<Kt-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Jt(r)}return n.set(t,e),this.size=n.size,this};function qt(t){var e=this.__data__=new yt(t);this.size=e.size}qt.prototype.clear=bt,qt.prototype.delete=gt,qt.prototype.get=_t,qt.prototype.has=jt,qt.prototype.set=Nt;var Dt=qt;var Ht=function(t,e,n){"__proto__"==e&&tt?tt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n};var Wt=function(t,e,n){(void 0===n||ct(t[e],n))&&(void 0!==n||e in t)||Ht(t,e,n)};var Xt=function(c){return function(t,e,n){for(var r=-1,o=Object(t),i=n(t),a=i.length;a--;){var u=i[c?a:++r];if(!1===e(o[u],u,o))break}return t}}(),Qt=i(function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n?j.Buffer:void 0,i=o?o.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=i?i(n):new t.constructor(n);return t.copy(r),r}}),Vt=j.Uint8Array;var Zt=function(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e};var Gt=function(t,e){var n=e?Zt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var Yt=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e},te=Object.create,ee=function(){function n(){}return function(t){if(!I(t))return{};if(te)return te(t);n.prototype=t;var e=new n;return n.prototype=void 0,e}}();var ne=function(e,n){return function(t){return e(n(t))}}(Object.getPrototypeOf,Object),re=Object.prototype;var oe=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||re)};var ie=function(t){return"function"!=typeof t.constructor||oe(t)?{}:ee(ne(t))};var ae=function(t){return null!=t&&"object"==typeof t},ue="[object Arguments]";var ce=function(t){return ae(t)&&F(t)==ue},se=Object.prototype,fe=se.hasOwnProperty,le=se.propertyIsEnumerable,pe=ce(function(){return arguments}())?ce:function(t){return ae(t)&&fe.call(t,"callee")&&!le.call(t,"callee")},he=Array.isArray,ve=9007199254740991;var de=function(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=ve};var ye=function(t){return null!=t&&de(t.length)&&!M(t)};var be=function(t){return ae(t)&&ye(t)};var ge=function(){return!1},_e=i(function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n?j.Buffer:void 0,i=(o?o.isBuffer:void 0)||ge;t.exports=i}),je="[object Object]",me=Function.prototype,we=Object.prototype,Oe=me.toString,Pe=we.hasOwnProperty,ke=Oe.call(Object);var xe=function(t){if(!ae(t)||F(t)!=je)return!1;var e=ne(t);if(null===e)return!0;var n=Pe.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Oe.call(n)==ke},Te={};Te["[object Float32Array]"]=Te["[object Float64Array]"]=Te["[object Int8Array]"]=Te["[object Int16Array]"]=Te["[object Int32Array]"]=Te["[object Uint8Array]"]=Te["[object Uint8ClampedArray]"]=Te["[object Uint16Array]"]=Te["[object Uint32Array]"]=!0,Te["[object Arguments]"]=Te["[object Array]"]=Te["[object ArrayBuffer]"]=Te["[object Boolean]"]=Te["[object DataView]"]=Te["[object Date]"]=Te["[object Error]"]=Te["[object Function]"]=Te["[object Map]"]=Te["[object Number]"]=Te["[object Object]"]=Te["[object RegExp]"]=Te["[object Set]"]=Te["[object String]"]=Te["[object WeakMap]"]=!1;var Ae=function(t){return ae(t)&&de(t.length)&&!!Te[F(t)]};var Se=function(e){return function(t){return e(t)}},Ee=i(function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n&&g.process,i=function(){try{return o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i}),ze=Ee&&Ee.isTypedArray,Fe=ze?Se(ze):Ae;var Ie=function(t,e){return"__proto__"==e?void 0:t[e]},Re=Object.prototype.hasOwnProperty;var Ue=function(t,e,n){var r=t[e];Re.call(t,e)&&ct(r,n)&&(void 0!==n||e in t)||Ht(t,e,n)};var Ce=function(t,e,n,r){var o=!n;n||(n={});for(var i=-1,a=e.length;++i<a;){var u=e[i],c=r?r(n[u],t[u],u,n,t):void 0;void 0===c&&(c=t[u]),o?Ht(n,u,c):Ue(n,u,c)}return n};var Le=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r},$e=9007199254740991,Me=/^(?:0|[1-9]\d*)$/;var Be=function(t,e){var n=typeof t;return!!(e=null==e?$e:e)&&("number"==n||"symbol"!=n&&Me.test(t))&&-1<t&&t%1==0&&t<e},Je=Object.prototype.hasOwnProperty;var Ke=function(t,e){var n=he(t),r=!n&&pe(t),o=!n&&!r&&_e(t),i=!n&&!r&&!o&&Fe(t),a=n||r||o||i,u=a?Le(t.length,String):[],c=u.length;for(var s in t)!e&&!Je.call(t,s)||a&&("length"==s||o&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Be(s,c))||u.push(s);return u};var Ne=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},qe=Object.prototype.hasOwnProperty;var De=function(t){if(!I(t))return Ne(t);var e=oe(t),n=[];for(var r in t)("constructor"!=r||!e&&qe.call(t,r))&&n.push(r);return n};var He=function(t){return ye(t)?Ke(t,!0):De(t)};var We=function(t){return Ce(t,He(t))};var Xe=function(t,e,n,r,o,i,a){var u=Ie(t,n),c=Ie(e,n),s=a.get(c);if(s)Wt(t,n,s);else{var f=i?i(u,c,n+"",t,e,a):void 0,l=void 0===f;if(l){var p=he(c),h=!p&&_e(c),v=!p&&!h&&Fe(c);f=c,p||h||v?f=he(u)?u:be(u)?Yt(u):h?Qt(c,!(l=!1)):v?Gt(c,!(l=!1)):[]:xe(c)||pe(c)?pe(f=u)?f=We(u):(!I(u)||r&&M(u))&&(f=ie(c)):l=!1}l&&(a.set(c,f),o(f,c,r,i,a),a.delete(c)),Wt(t,n,f)}};var Qe=function r(o,i,a,u,c){o!==i&&Xt(i,function(t,e){if(I(t))c||(c=new Dt),Xe(o,i,e,a,r,u,c);else{var n=u?u(Ie(o,e),t,e+"",o,i,c):void 0;void 0===n&&(n=t),Wt(o,e,n)}},He)};var Ve=function t(e,n,r,o,i,a){return I(e)&&I(n)&&(a.set(n,e),Qe(e,n,void 0,t,a),a.delete(n)),e};var Ze=function(t,e,n){if(!I(n))return!1;var r=typeof e;return!!("number"==r?ye(n)&&Be(e,n.length):"string"==r&&e in n)&&ct(n[e],t)};var Ge=function(u){return at(function(t,e){var n=-1,r=e.length,o=1<r?e[r-1]:void 0,i=2<r?e[2]:void 0;for(o=3<u.length&&"function"==typeof o?(r--,o):void 0,i&&Ze(e[0],e[1],i)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var a=e[n];a&&u(t,a,n,o)}return t})}(function(t,e,n,r){Qe(t,e,n,r)}),Ye=at(function(t){return t.push(void 0,Ve),h(Ge,void 0,t)}),tn=function(e){function t(t){e.call(this,t),this.name="TimeoutError"}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(Error),en=function(i,a,u){return new Promise(function(e,n){if("number"!=typeof a||a<0)throw new TypeError("Expected `ms` to be a positive number");var t,r,o=setTimeout(function(){if("function"!=typeof u){var t=u instanceof Error?u:new tn("string"==typeof u?u:"Promise timed out after "+a+" milliseconds");"function"==typeof i.cancel&&i.cancel(),n(t)}else try{e(u())}catch(t){n(t)}},a);t=i.then(e,n),r=(r=function(){clearTimeout(o)})||function(){},t.then(function(t){return new Promise(function(t){t(r())}).then(function(){return t})},function(t){return new Promise(function(t){t(r())}).then(function(){throw t})})})};en.TimeoutError=tn;var nn={};var rn={getItem:function(t){return t in nn?nn[t]:null},setItem:function(t,e){return nn[t]=e,!0},removeItem:function(t){return!!(t in nn)&&delete nn[t]},clear:function(){return nn={},!0}},on=("localStorage"in o&&o.localStorage&&o.localStorage,function(t){return t.toString().replace(/[.#$[\]]/g,"-")}),an="function"==typeof fetch?fetch.bind():function(o,i){return i=i||{},new Promise(function(t,e){var n=new XMLHttpRequest;for(var r in n.open(i.method||"get",o),i.headers)n.setRequestHeader(r,i.headers[r]);function u(){var r,o=[],i=[],a={};return n.getAllResponseHeaders().replace(/^(.*?):\s*([\s\S]*?)$/gm,function(t,e,n){o.push(e=e.toLowerCase()),i.push([e,n]),r=a[e],a[e]=r?r+","+n:n}),{ok:1==(n.status/200|0),status:n.status,statusText:n.statusText,url:n.responseURL,clone:u,text:function(){return Promise.resolve(n.responseText)},json:function(){return Promise.resolve(n.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([n.response]))},headers:{keys:function(){return o},entries:function(){return i},get:function(t){return a[t.toLowerCase()]},has:function(t){return t.toLowerCase()in a}}}}n.withCredentials="include"==i.credentials,n.onload=function(){t(u())},n.onerror=e,n.send(i.body)})},un={cnj:"https://us-central1-fastjur-71771.cloudfunctions.net/cnj",oab:"https://us-central1-fastjur-71771.cloudfunctions.net/oab",expectation:"https://us-central1-fastjur-71771.cloudfunctions.net/expectation",promad:"https://us-central1-fastjur-71771.cloudfunctions.net/promad",key:"https://us-central1-fastjur-71771.cloudfunctions.net/key"},cn={apiKey:"AIzaSyA_RIZP7bos4M9dRxwa1QVQnXh0Xl0m4pc",authDomain:"fastjur-71771.firebaseapp.com",databaseURL:"https://fastjur-71771.firebaseio.com",projectId:"fastjur-71771",storageBucket:"fastjur-71771.appspot.com",messagingSenderId:"626350414834"};l.initializeApp(cn);var sn=function(t){void 0===t&&(t={}),this.configuration=t};sn.endpoints=function(){return un},sn.checkResponse=function(t){return t.ok&&t.headers.has("content-type")&&-1!==t.headers.get("content-type").indexOf("application/json")},sn.errorResponse=function(t){return Promise.resolve().then(function(){return p(t.json())}).catch(function(){return p(t.statusText)}).then(function(t){throw t})},sn.sendJson=function(t,e){return an(t,{method:"POST",body:JSON.stringify(e),cache:"no-store",redirect:"error",headers:{"Content-Type":"application/json"}}).catch(function(t){throw p(t.toString())}).then(function(t){return sn.checkResponse(t)?t.json():sn.errorResponse(t)})},sn.prototype.idToken=function(){return this.currentUser().then(function(t){return t.getIdToken()})},sn.prototype.authentication=function(){return new Promise(function(r,t){"undefined"==typeof document&&t(new Error),document.body.dispatchEvent(new Event("fastintegration.authentication.required"));var o=function(t){var e=t.detail;document.body.removeEventListener("fastintegration.authentication",o);var n=e.user;r(n)};document.body.addEventListener("fastintegration.authentication",o)})},sn.prototype.currentUser=function(){var t=this,e=l.auth();return Promise.resolve().then(function(){return e.currentUser?e.currentUser:t.authentication()})},sn.prototype.waitForLabel=function(f){return this.currentUser().then(function(t){var s=t.uid;return new Promise(function(e,n){var r,o=l.database(),i="/"+on(s)+"/content/"+f,a="/"+on(s)+"/error/"+f,u=!1,c=function(t){t.val()?(u=!0,r&&o.ref(a).off("value",r),e(t.val())):u||o.ref(i).once("value").then(c)};r=function(t){t.val()?(u=!0,o.ref(a).off("value",c),n(p(t.val()))):u||o.ref(a).once("value").then(r)},o.ref(i).once("value").then(c),o.ref(a).once("value").then(r)})})},sn.prototype.onChange=function(o,e){var i=function(t){return t.val()&&e(t.val())},a=function(t){return t.val()&&e(null,t.val())};return this.currentUser().then(function(t){var e=t.uid;return{error:"/"+on(e)+"/error",content:"/"+on(e)+"/content",database:l.database()}}).then(function(t){var e=t.error,n=t.content,r=t.database;return Promise.resolve().then(function(){r.ref(n).on(o,a),r.ref(e).on(o,i)}).then(function(){return function(){r.ref(n).off(o,a),r.ref(e).off(o,i)}})})},sn.prototype.key=function(){return this.idToken().then(function(t){return sn.sendJson(sn.endpoints().key,{idToken:t})})};var fn=function(n){function r(t){void 0===t&&(t={}),n.call(this,Ye(t,{timeout:{oab:"300 seconds",cnj:"300 seconds",cnjPromise:"300 seconds",expectation:"300 seconds"}}))}return n&&(r.__proto__=n),((r.prototype=Object.create(n&&n.prototype)).constructor=r).prototype.oab=function(e){return en(this.idToken().then(function(t){return n.sendJson(r.endpoints().oab,{oab:e,idToken:t})}),f(this.configuration.timeout.oab))},r.prototype.cnj=function(e){return en(this.idToken().then(function(t){return n.sendJson(r.endpoints().cnj,{cnj:e,idToken:t})}),f(this.configuration.timeout.cnj))},r.prototype.cnjPromise=function(t){var n=this;return en(this.cnj(t).then(function(t){var e=t.label;return n.waitForLabel(e)}),f(this.configuration.timeout.cnjPromise))},r.prototype.oabAsync=function(t,n){var r=this;return en(this.oab(t).then(function(e){return Promise.resolve(e.pushes.map(function(t){return r.onChange(t["label-oab"],n)})).then(function(t){return function(){return{content:e,unregisters:t.map(function(t){return t()})}}})}),f(this.configuration.timeout.oab))},r}(sn);t.exceptions=s,t.JuristekIntegration=fn,t.WebService=sn,Object.defineProperty(t,"__esModule",{value:!0})});