UNPKG

@theidentityselector/thiss-ds

Version:

A set of clients for the thiss.io service

1 lines 50.2 kB
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.thiss=n():t.thiss=n()}(this,(()=>(()=>{var t={684:function(t){"undefined"!=typeof self&&self,t.exports=function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return{}.hasOwnProperty.call(t,n)},e.p="",e(e.s=0)}([function(t,n,e){"use strict";e.r(n);var r={};function o(t){return"[object RegExp]"==={}.toString.call(t)}e.r(r),e.d(r,"WeakMap",(function(){return q}));var i="mock:",a="file:",u="about:",c="iframe",s="popup",f="Call was rejected by callee.\r\n";function d(t){return void 0===t&&(t=window),t.location.protocol===u}function l(t){if(t)try{if(t.parent&&t.parent!==t)return t.parent}catch(t){}}function h(t){if(t&&!l(t))try{return t.opener}catch(t){}}function p(t){try{return!0}catch(t){}return!1}function w(t){var n=(t=t||window).location;if(!n)throw new Error("Can not read window location");var e=n.protocol;if(!e)throw new Error("Can not read window protocol");if(e===a)return a+"//";if(e===u){var r=l(t);return r&&p()?w(r):u+"//"}var o=n.host;if(!o)throw new Error("Can not read window host");return e+"//"+o}function y(t){var n=w(t=t||window);return n&&t.mockDomain&&0===t.mockDomain.indexOf(i)?t.mockDomain:n}function v(t){if(!function(t){try{if(t===window)return!0}catch(t){}try{var n=Object.getOwnPropertyDescriptor(t,"location");if(n&&!1===n.enumerable)return!1}catch(t){}try{if(d(t)&&p())return!0}catch(t){}try{if(w(t)===w(window))return!0}catch(t){}return!1}(t))return!1;try{if(t===window)return!0;if(d(t)&&p())return!0;if(y(window)===y(t))return!0}catch(t){}return!1}function m(t,n){if(!t||!n)return!1;var e=l(n);return e?e===t:-1!==function(t){var n=[];try{for(;t.parent!==t;)n.push(t.parent),t=t.parent}catch(t){}return n}(n).indexOf(t)}function g(t){var n,e,r=[];try{n=t.frames}catch(e){n=t}try{e=n.length}catch(t){}if(0===e)return r;if(e){for(var o=0;o<e;o++){var i=void 0;try{i=n[o]}catch(t){continue}r.push(i)}return r}for(var a=0;a<100;a++){var u=void 0;try{u=n[a]}catch(t){return r}if(!u)return r;r.push(u)}return r}var _=[],b=[];function x(t,n){void 0===n&&(n=!0);try{if(t===window)return!1}catch(t){return!0}try{if(!t)return!0}catch(t){return!0}try{if(t.closed)return!0}catch(t){return!t||t.message!==f}if(n&&v(t))try{if(t.mockclosed)return!0}catch(t){}try{if(!t.parent||!t.top)return!0}catch(t){}var e=function(t,n){for(var e=0;e<t.length;e++)try{if(t[e]===n)return e}catch(t){}return-1}(_,t);if(-1!==e){var r=b[e];if(r&&function(t){if(!t.contentWindow)return!0;if(!t.parentNode)return!0;var n=t.ownerDocument;return!(!n||!n.documentElement||n.documentElement.contains(t))}(r))return!0}return!1}function k(t){return h(t=t||window)||l(t)||void 0}function S(t,n){if("string"==typeof t){if("string"==typeof n)return"*"===t||n===t;if(o(n))return!1;if(Array.isArray(n))return!1}return o(t)?o(n)?t.toString()===n.toString():!Array.isArray(n)&&Boolean(n.match(t)):!!Array.isArray(t)&&(Array.isArray(n)?JSON.stringify(t)===JSON.stringify(n):!o(n)&&t.some((function(t){return S(t,n)})))}function E(t){try{if(t===window)return!0}catch(t){if(t&&t.message===f)return!0}try{if("[object Window]"==={}.toString.call(t))return!0}catch(t){if(t&&t.message===f)return!0}try{if(window.Window&&t instanceof window.Window)return!0}catch(t){if(t&&t.message===f)return!0}try{if(t&&t.self===t)return!0}catch(t){if(t&&t.message===f)return!0}try{if(t&&t.parent===t)return!0}catch(t){if(t&&t.message===f)return!0}try{if(t&&t.top===t)return!0}catch(t){if(t&&t.message===f)return!0}return!1}function j(t){try{if(!t)return!1;if("undefined"!=typeof Promise&&t instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&t instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&t instanceof window.constructor)return!1;var n={}.toString;if(n){var e=n.call(t);if("[object Window]"===e||"[object global]"===e||"[object DOMWindow]"===e)return!1}if("function"==typeof t.then)return!0}catch(t){return!1}return!1}var O,W=[],P=[],A=0;function C(){if(!A&&O){var t=O;O=null,t.resolve()}}function D(){A+=1}function I(){A-=1,C()}var T=function(){function t(t){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=[],t){var e,r,o=!1,i=!1,a=!1;D();try{t((function(t){a?n.resolve(t):(o=!0,e=t)}),(function(t){a?n.reject(t):(i=!0,r=t)}))}catch(t){return I(),void this.reject(t)}I(),a=!0,o?this.resolve(e):i&&this.reject(r)}}var n=t.prototype;return n.resolve=function(t){if(this.resolved||this.rejected)return this;if(j(t))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=t,this.dispatch(),this},n.reject=function(t){var n=this;if(this.resolved||this.rejected)return this;if(j(t))throw new Error("Can not reject promise with another promise");if(!t){var e=t&&"function"==typeof t.toString?t.toString():{}.toString.call(t);t=new Error("Expected reject to be called with Error, got "+e)}return this.rejected=!0,this.error=t,this.errorHandled||setTimeout((function(){n.errorHandled||function(t,n){if(-1===W.indexOf(t)){W.push(t),setTimeout((function(){throw t}),1);for(var e=0;e<P.length;e++)P[e](t,n)}}(t,n)}),1),this.dispatch(),this},n.asyncReject=function(t){return this.errorHandled=!0,this.reject(t),this},n.dispatch=function(){var n=this,e=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(e||r)){this.dispatching=!0,D();for(var i=function(i){var a=o[i],u=a.onSuccess,c=a.onError,s=a.promise,f=void 0;if(e)try{f=u?u(n.value):n.value}catch(t){return s.reject(t),"continue"}else if(r){if(!c)return s.reject(n.error),"continue";try{f=c(n.error)}catch(t){return s.reject(t),"continue"}}f instanceof t&&(f.resolved||f.rejected)?(f.resolved?s.resolve(f.value):s.reject(f.error),f.errorHandled=!0):j(f)?f instanceof t&&(f.resolved||f.rejected)?f.resolved?s.resolve(f.value):s.reject(f.error):f.then((function(t){s.resolve(t)}),(function(t){s.reject(t)})):s.resolve(f)},a=0;a<o.length;a++)i(a);o.length=0,this.dispatching=!1,I()}},n.then=function(n,e){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for success handler");if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.then expected a function for error handler");var r=new t;return this.handlers.push({promise:r,onSuccess:n,onError:e}),this.errorHandled=!0,this.dispatch(),r},n.catch=function(t){return this.then(void 0,t)},n.finally=function(n){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.finally expected a function");return this.then((function(e){return t.try(n).then((function(){return e}))}),(function(e){return t.try(n).then((function(){throw e}))}))},n.timeout=function(t,n){var e=this;if(this.resolved||this.rejected)return this;var r=setTimeout((function(){e.resolved||e.rejected||e.reject(n||new Error("Promise timed out after "+t+"ms"))}),t);return this.then((function(t){return clearTimeout(r),t}))},n.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},t.resolve=function(n){return n instanceof t?n:j(n)?new t((function(t,e){return n.then(t,e)})):(new t).resolve(n)},t.reject=function(n){return(new t).reject(n)},t.asyncReject=function(n){return(new t).asyncReject(n)},t.all=function(n){var e=new t,r=n.length,o=[];if(!r)return e.resolve(o),e;for(var i=function(i){var a=n[i];if(a instanceof t){if(a.resolved)return o[i]=a.value,r-=1,"continue"}else if(!j(a))return o[i]=a,r-=1,"continue";t.resolve(a).then((function(t){o[i]=t,0==(r-=1)&&e.resolve(o)}),(function(t){e.reject(t)}))},a=0;a<n.length;a++)i(a);return 0===r&&e.resolve(o),e},t.hash=function(n){var e={};return t.all(Object.keys(n).map((function(r){return t.resolve(n[r]).then((function(t){e[r]=t}))}))).then((function(){return e}))},t.map=function(n,e){return t.all(n.map(e))},t.onPossiblyUnhandledException=function(t){return function(t){return P.push(t),{cancel:function(){P.splice(P.indexOf(t),1)}}}(t)},t.try=function(n,e,r){if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.try expected a function");var o;D();try{o=n.apply(e,r||[])}catch(n){return I(),t.reject(n)}return I(),t.resolve(o)},t.delay=function(n){return new t((function(t){setTimeout(t,n)}))},t.isPromise=function(n){return!!(n&&n instanceof t)||j(n)},t.flush=function(){return n=O=O||new t,C(),n;var n},t}();function M(){return(M=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}function z(t,n){for(var e=0;e<t.length;e++)try{if(t[e]===n)return e}catch(t){}return-1}var R,L=Object.defineProperty,N=Date.now()%1e9,q=function(){function t(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,N+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+N,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var t=new WeakMap,n={};return Object.freeze(n),t.set(n,"__testvalue__"),"__testvalue__"===t.get(n)}catch(t){return!1}}())try{this.weakmap=new WeakMap}catch(t){}this.keys=[],this.values=[]}var n=t.prototype;return n._cleanupClosedWindows=function(){for(var t=this.weakmap,n=this.keys,e=0;e<n.length;e++){var r=n[e];if(E(r)&&x(r)){if(t)try{t.delete(r)}catch(t){}n.splice(e,1),this.values.splice(e,1),e-=1}}},n.isSafeToReadWrite=function(t){return!E(t)},n.set=function(t,n){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.set(t,n)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t)){var r=this.name,o=t[r];o&&o[0]===t?o[1]=n:L(t,r,{value:[t,n],writable:!0})}else{this._cleanupClosedWindows();var i=this.keys,a=this.values,u=z(i,t);-1===u?(i.push(t),a.push(n)):a[u]=n}},n.get=function(t){if(!t)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{if(n.has(t))return n.get(t)}catch(t){delete this.weakmap}if(!this.isSafeToReadWrite(t)){this._cleanupClosedWindows();var e=z(this.keys,t);if(-1===e)return;return this.values[e]}var r=t[this.name];if(r&&r[0]===t)return r[1]},n.delete=function(t){if(!t)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.delete(t)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t)){var e=t[this.name];e&&e[0]===t&&(e[0]=e[1]=void 0)}else{this._cleanupClosedWindows();var r=this.keys,o=z(r,t);-1!==o&&(r.splice(o,1),this.values.splice(o,1))}},n.has=function(t){if(!t)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{if(n.has(t))return!0}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t)){var e=t[this.name];return!(!e||e[0]!==t)}return this._cleanupClosedWindows(),-1!==z(this.keys,t)},n.getOrSet=function(t,n){if(this.has(t))return this.get(t);var e=n();return this.set(t,e),e},t}();function F(){var t="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,(function(){return t.charAt(Math.floor(16*Math.random()))}))+"_"+function(t){if("function"==typeof btoa)return btoa(t);if("undefined"!=typeof Buffer)return Buffer.from(t,"utf8").toString("base64");throw new Error("Can not find window.btoa or Buffer")}((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function H(t){var n={};function e(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];var i=function(t){try{return JSON.stringify([].slice.call(t),(function(t,n){return"function"==typeof n?"memoize["+function(t){if(R=R||new q,null==t||"object"!=typeof t&&"function"!=typeof t)throw new Error("Invalid object");var n=R.get(t);return n||(n=typeof t+":"+F(),R.set(t,n)),n}(n)+"]":n}))}catch(t){throw new Error("Arguments not serializable -- can not be used to memoize")}}(r);return n.hasOwnProperty(i)||(n[i]=t.apply(this,arguments).finally((function(){delete n[i]}))),n[i]}return e.reset=function(){n={}},e}function J(){}function U(t,n){if(void 0===n&&(n=1),n>=3)return"stringifyError stack overflow";try{if(!t)return"<unknown error: "+{}.toString.call(t)+">";if("string"==typeof t)return t;if(t instanceof Error){var e=t&&t.stack,r=t&&t.message;if(e&&r)return-1!==e.indexOf(r)?e:r+"\n"+e;if(e)return e;if(r)return r}return"function"==typeof t.toString?t.toString():{}.toString.call(t)}catch(t){return"Error while stringifying error: "+U(t,n+1)}}function B(t){return"string"==typeof t?t:t&&"function"==typeof t.toString?t.toString():{}.toString.call(t)}function G(t){return"[object RegExp]"==={}.toString.call(t)}function K(t,n,e){if(t.hasOwnProperty(n))return t[n];var r=e();return t[n]=r,r}Object.create(Error.prototype);var Q="postrobot_method",Y="postrobot_hello",Z="*",$="cross_domain_zalgo_promise",V="cross_domain_function",X="cross_domain_window";function tt(t){return void 0===t&&(t=window),t!==window?t.__post_robot_10_0_14__:t.__post_robot_10_0_14__=t.__post_robot_10_0_14__||{}}var nt=function(){return{}};function et(t,n){return void 0===t&&(t="store"),void 0===n&&(n=nt),K(tt(),t,(function(){var t=n();return{has:function(n){return t.hasOwnProperty(n)},get:function(n,e){return t.hasOwnProperty(n)?t[n]:e},set:function(n,e){return t[n]=e,e},del:function(n){delete t[n]},getOrSet:function(n,e){return K(t,n,e)},reset:function(){t=n()},keys:function(){return Object.keys(t)}}}))}var rt=function(){};function ot(){var t=tt();return t.WINDOW_WILDCARD=t.WINDOW_WILDCARD||new rt,t.WINDOW_WILDCARD}function it(t,n){return void 0===t&&(t="store"),void 0===n&&(n=nt),et("windowStore").getOrSet(t,(function(){var e=new q,r=function(t){return e.getOrSet(t,n)};return{has:function(n){return r(n).hasOwnProperty(t)},get:function(n,e){var o=r(n);return o.hasOwnProperty(t)?o[t]:e},set:function(n,e){return r(n)[t]=e,e},del:function(n){delete r(n)[t]},getOrSet:function(n,e){return K(r(n),t,e)}}}))}function at(){return et("instance").getOrSet("instanceID",F)}function ut(t){return it("helloPromises").getOrSet(t,(function(){return new T}))}function ct(t,n){return(0,n.send)(t,Y,{instanceID:at()},{domain:Z,timeout:-1}).then((function(n){var e=n.origin,r=n.data.instanceID;return ut(t).resolve({win:t,domain:e}),{win:t,domain:e,instanceID:r}}))}function st(t,n){var e=n.send;return it("windowInstanceIDPromises").getOrSet(t,(function(){return ct(t,{send:e}).then((function(t){return t.instanceID}))}))}function ft(t){it("knownWindows").set(t,!0)}var dt,lt="function",ht="error",pt="promise",wt="regex",yt="date",vt="array",mt="object",gt="string",_t="number",bt="boolean",xt="null",kt="undefined";function St(t){return"object"==typeof t&&null!==t&&"string"==typeof t.__type__}function Et(t){return void 0===t?kt:null===t?xt:Array.isArray(t)?vt:"function"==typeof t?lt:"object"==typeof t?t instanceof Error?ht:"function"==typeof t.then?pt:"[object RegExp]"==={}.toString.call(t)?wt:"[object Date]"==={}.toString.call(t)?yt:mt:"string"==typeof t?gt:"number"==typeof t?_t:"boolean"==typeof t?bt:void 0}function jt(t,n){return{__type__:t,__val__:n}}var Ot,Wt=((dt={})[lt]=function(){},dt[ht]=function(t){return jt(ht,{message:t.message,stack:t.stack,code:t.code})},dt[pt]=function(){},dt[wt]=function(t){return jt(wt,t.source)},dt[yt]=function(t){return jt(yt,t.toJSON())},dt[vt]=function(t){return t},dt[mt]=function(t){return t},dt[gt]=function(t){return t},dt[_t]=function(t){return t},dt[bt]=function(t){return t},dt[xt]=function(t){return t},dt),Pt={},At=((Ot={})[lt]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},Ot[ht]=function(t){var n=t.stack,e=t.code,r=new Error(t.message);return r.code=e,r.stack=n+"\n\n"+r.stack,r},Ot[pt]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},Ot[wt]=function(t){return new RegExp(t)},Ot[yt]=function(t){return new Date(t)},Ot[vt]=function(t){return t},Ot[mt]=function(t){return t},Ot[gt]=function(t){return t},Ot[_t]=function(t){return t},Ot[bt]=function(t){return t},Ot[xt]=function(t){return t},Ot),Ct={};function Dt(){for(var t=et("idToProxyWindow"),n=0,e=t.keys();n<e.length;n++){var r=e[n];t.get(r).shouldClean()&&t.del(r)}}function It(t,n,e){var r,o=e.send;return{id:t,type:h(n)?s:c,getInstanceID:H((function(){return st(n,{send:o})})),close:function(){return T.try((function(){n.close()}))},getName:function(){return T.try((function(){if(!x(n))return r}))},focus:function(){return T.try((function(){n.focus()}))},isClosed:function(){return T.try((function(){return x(n)}))},setLocation:function(t){return T.try((function(){if(v(n))try{if(n.location&&"function"==typeof n.location.replace)return void n.location.replace(t)}catch(t){}n.location=t}))},setName:function(t){return T.try((function(){(n=function(t){if(!v(t))throw new Error("Expected window to be same domain");return t}(n)).name=t,n.frameElement&&n.frameElement.setAttribute("name",t),r=t}))}}}new T((function(t){if(window.document&&window.document.body)return t(window.document.body);var n=setInterval((function(){if(window.document&&window.document.body)return clearInterval(n),t(window.document.body)}),10)}));var Tt=function(){function t(t,n,e){var r=e.send;this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.serializedWindow=t,this.actualWindowPromise=new T,this.send=r,n&&this.setWindow(n)}var n=t.prototype;return n.getType=function(){return this.serializedWindow.type},n.isPopup=function(){return this.getType()===s},n.isIframe=function(){return this.getType()===c},n.setLocation=function(t){var n=this;return this.serializedWindow.setLocation(t).then((function(){return n}))},n.setName=function(t){var n=this;return this.serializedWindow.setName(t).then((function(){return n}))},n.close=function(){var t=this;return this.serializedWindow.close().then((function(){return t}))},n.focus=function(){var t=this;return T.try((function(){return T.all([t.isPopup()&&t.serializedWindow.getName().then((function(t){t&&window.open("",t)})),t.serializedWindow.focus()])})).then((function(){return t}))},n.isClosed=function(){return this.serializedWindow.isClosed()},n.getWindow=function(){return this.actualWindow},n.setWindow=function(t){this.actualWindow=t,this.serializedWindow=It(this.serializedWindow.id,t,{send:this.send}),this.actualWindowPromise.resolve(t)},n.awaitWindow=function(){return this.actualWindowPromise},n.matchWindow=function(t){var n=this;return T.try((function(){return n.actualWindow?t===n.actualWindow:T.all([n.getInstanceID(),st(t,{send:n.send})]).then((function(e){var r=e[0]===e[1];return r&&n.setWindow(t),r}))}))},n.unwrap=function(){return this.actualWindow||this},n.getInstanceID=function(){return this.serializedWindow.getInstanceID()},n.serialize=function(){return this.serializedWindow},n.shouldClean=function(){return this.actualWindow&&x(this.actualWindow)},t.unwrap=function(n){return t.isProxyWindow(n)?n.unwrap():n},t.serialize=function(n,e){var r=e.send;return Dt(),t.toProxyWindow(n,{send:r}).serialize()},t.deserialize=function(n,e){var r=e.on,o=e.send;return Dt(),et("idToProxyWindow").getOrSet(n.id,(function(){return new t(n,null,{on:r,send:o})}))},t.isProxyWindow=function(t){return Boolean(t&&!E(t)&&t.isProxyWindow)},t.toProxyWindow=function(n,e){var r=e.send;if(Dt(),t.isProxyWindow(n))return n;var o=n;return it("winToProxyWindow").getOrSet(n,(function(){var n=F(),e=new t(It(n,o,{send:r}),o,{send:r});return et("idToProxyWindow").set(n,e)}))},t}();function Mt(t,n,e,r,o){var i=it("methodStore"),a=et("proxyWindowMethods");Tt.isProxyWindow(r)?a.set(t,{val:n,name:e,domain:o,source:r}):(a.del(t),i.getOrSet(r,(function(){return{}}))[t]={domain:o,name:e,val:n,source:r})}function zt(t,n){var e=it("methodStore"),r=et("proxyWindowMethods");return e.getOrSet(t,(function(){return{}}))[n]||r.get(n)}function Rt(t,n,e,r,o){var i;i=o.on,et("builtinListeners").getOrSet("functionCalls",(function(){return i(Q,{domain:Z},(function(t){var n=t.source,e=t.origin,r=t.data,o=r.id,i=r.name,a=zt(n,o);if(!a)throw new Error("Could not find method '"+r.name+"' with id: "+r.id+" in "+y(window));var u=a.source,c=a.domain,s=a.val;return T.try((function(){if(!S(c,e))throw new Error("Method '"+r.name+"' domain "+JSON.stringify(G(a.domain)?a.domain.source:a.domain)+" does not match origin "+e+" in "+y(window));if(Tt.isProxyWindow(u))return u.matchWindow(n).then((function(t){if(!t)throw new Error("Method call '"+r.name+"' failed - proxy window does not match source in "+y(window))}))})).then((function(){return s.apply({source:n,origin:e},r.args)}),(function(t){return T.try((function(){if(s.onError)return s.onError(t)})).then((function(){throw t.stack&&(t.stack="Remote call to "+i+"()\n\n"+t.stack),t}))})).then((function(t){return{result:t,id:o,name:i}}))}))}));var a=e.__id__||F();t=Tt.unwrap(t);var u=e.__name__||e.name||r;return Tt.isProxyWindow(t)?(Mt(a,e,u,t,n),t.awaitWindow().then((function(t){Mt(a,e,u,t,n)}))):Mt(a,e,u,t,n),jt(V,{id:a,name:u})}function Lt(t,n,e,r){var o,i=r.on,a=r.send;return function(t,n){void 0===n&&(n=Pt);var e=JSON.stringify(t,(function(t){var e=this[t];if(St(this))return e;var r=Et(e);if(!r)return e;var o=n[r]||Wt[r];return o?o(e,t):e}));return void 0===e?kt:e}(e,((o={})[pt]=function(e,r){return function(t,n,e,r,o){return jt($,{then:Rt(t,n,(function(t,n){return e.then(t,n)}),r,{on:o.on,send:o.send})})}(t,n,e,r,{on:i,send:a})},o[lt]=function(e,r){return Rt(t,n,e,r,{on:i,send:a})},o[mt]=function(t){return E(t)||Tt.isProxyWindow(t)?jt(X,Tt.serialize(t,{send:a})):t},o))}function Nt(t,n,e,r){var o,i=r.on,a=r.send;return function(t,n){if(void 0===n&&(n=Ct),t!==kt)return JSON.parse(t,(function(t,e){if(St(this))return e;var r,o;if(St(e)?(r=e.__type__,o=e.__val__):(r=Et(e),o=e),!r)return o;var i=n[r]||At[r];return i?i(o,t):o}))}(e,((o={})[$]=function(t){return new T(t.then)},o[V]=function(e){return function(t,n,r,o){var i=e.id,a=e.name,u=o.send,c=function(e){function r(){var o=arguments;return Tt.toProxyWindow(t,{send:u}).awaitWindow().then((function(t){var c=zt(t,i);if(c&&c.val!==r)return c.val.apply({source:window,origin:y()},o);var s={domain:n,fireAndForget:e.fireAndForget},f=[].slice.call(o);return u(t,Q,{id:i,name:a,args:f},s).then((function(t){if(!e.fireAndForget)return t.data.result}))})).catch((function(t){throw t}))}return void 0===e&&(e={}),r.__name__=a,r.__origin__=n,r.__source__=t,r.__id__=i,r.origin=n,r},s=c();return s.fireAndForget=c({fireAndForget:!0}),s}(t,n,0,{on:i,send:a})},o[X]=function(t){return Tt.deserialize(t,{on:(n={on:i,send:a}).on,send:n.send});var n},o))}var qt={};function Ft(t,n,e,r){var o,i=r.on,a=r.send;if(x(t))throw new Error("Window is closed");for(var u=Lt(t,n,((o={}).__post_robot_10_0_14__=M({id:F(),origin:y(window)},e),o),{on:i,send:a}),c=Object.keys(qt),s=[],f=0;f<c.length;f++){var d=c[f];try{qt[d](t,u,n)}catch(t){s.push(t)}}if(s.length===c.length)throw new Error("All post-robot messaging strategies failed:\n\n"+s.map(U).join("\n\n"))}qt.postrobot_post_message=function(t,n,e){(Array.isArray(e)?e:"string"==typeof e?[e]:[Z]).map((function(t){return 0===t.indexOf(a)?Z:t})).forEach((function(e){t.postMessage(n,e)}))};var Ht,Jt="__domain_regex__";function Ut(t){return et("responseListeners").get(t)}function Bt(t){et("responseListeners").del(t)}function Gt(t){return et("erroredResponseListeners").has(t)}function Kt(t){var n=t.name,e=t.win,r=t.domain,o=it("requestListeners");if(e===Z&&(e=null),r===Z&&(r=null),!n)throw new Error("Name required to get request listener");for(var i=0,a=[e,ot()];i<a.length;i++){var u=a[i];if(u){var c=o.get(u);if(c){var s=c[n];if(s){if(r&&"string"==typeof r){if(s[r])return s[r];if(s[Jt])for(var f=0,d=s[Jt];f<d.length;f++){var l=d[f],h=l.listener;if(S(l.regex,r))return h}}if(s[Z])return s[Z]}}}}}var Qt=((Ht={}).postrobot_message_request=function(t,n,e,r){var o=r.on,i=r.send,a=Kt({name:e.name,win:t,domain:n});function u(r,a,u){void 0===u&&(u={}),e.fireAndForget||x(t)||Ft(t,n,M({type:r,ack:a,hash:e.hash,name:e.name},u),{on:o,send:i})}return T.all([u("postrobot_message_ack"),T.try((function(){if(!a)throw new Error("No handler found for post message: "+e.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!S(a.domain,n))throw new Error("Request origin "+n+" does not match domain "+a.domain.toString());return a.handler({source:t,origin:n,data:e.data})})).then((function(t){return u("postrobot_message_response","success",{data:t})}),(function(t){return u("postrobot_message_response","error",{error:t})}))]).then(J).catch((function(t){if(a&&a.handleError)return a.handleError(t);throw t}))},Ht.postrobot_message_ack=function(t,n,e){if(!Gt(e.hash)){var r=Ut(e.hash);if(!r)throw new Error("No handler found for post message ack for message: "+e.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!S(r.domain,n))throw new Error("Ack origin "+n+" does not match domain "+r.domain.toString());if(t!==r.win)throw new Error("Ack source does not match registered window");r.ack=!0}},Ht.postrobot_message_response=function(t,n,e){if(!Gt(e.hash)){var r,i=Ut(e.hash);if(!i)throw new Error("No handler found for post message response for message: "+e.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!S(i.domain,n))throw new Error("Response origin "+n+" does not match domain "+(r=i.domain,Array.isArray(r)?"("+r.join(" | ")+")":o(r)?"RegExp("+r.toString():r.toString()));if(t!==i.win)throw new Error("Response source does not match registered window");Bt(e.hash),"error"===e.ack?i.promise.reject(e.error):"success"===e.ack&&i.promise.resolve({source:t,origin:n,data:e.data})}},Ht);function Yt(t,n){var e=n.on,r=n.send,o=et("receivedMessages");if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!t.source)return}catch(t){return}var i=t.source,u=t.origin,c=function(t,n,e,r){var o,i=r.on,a=r.send;try{o=Nt(n,e,t,{on:i,send:a})}catch(t){return}if(o&&"object"==typeof o&&null!==o&&(o=o.__post_robot_10_0_14__)&&"object"==typeof o&&null!==o&&o.type&&"string"==typeof o.type&&Qt[o.type])return o}(t.data,i,u,{on:e,send:r});c&&(ft(i),o.has(c.id)||(o.set(c.id,!0),x(i)&&!c.fireAndForget||(0===c.origin.indexOf(a)&&(u=a+"//"),Qt[c.type](i,u,c,{on:e,send:r}))))}function Zt(t,n,e){if(!t)throw new Error("Expected name");if("function"==typeof n&&(e=n,n={}),!e)throw new Error("Expected handler");(n=n||{}).name=t,n.handler=e||n.handler;var r=n.window,o=n.domain,i=function t(n,e){var r=n.name,o=n.win,i=n.domain,a=it("requestListeners");if(!r||"string"!=typeof r)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(t({name:r,domain:i,win:s[c]},e));return{cancel:function(){for(var t=0;t<u.length;t++)u[t].cancel()}}}if(Array.isArray(i)){for(var f=[],d=0,l=i;d<l.length;d++)f.push(t({name:r,win:o,domain:l[d]},e));return{cancel:function(){for(var t=0;t<f.length;t++)f[t].cancel()}}}var h=Kt({name:r,win:o,domain:i});if(o&&o!==Z||(o=ot()),i=i||Z,h)throw o&&i?new Error("Request listener already exists for "+r+" on domain "+i.toString()+" for "+(o===ot()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+r+" for "+(o===ot()?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+r+" on domain "+i.toString()):new Error("Request listener already exists for "+r);var p,w,y=a.getOrSet(o,(function(){return{}})),v=K(y,r,(function(){return{}})),m=i.toString();return G(i)?(p=K(v,Jt,(function(){return[]}))).push(w={regex:i,listener:e}):v[m]=e,{cancel:function(){delete v[m],w&&(p.splice(p.indexOf(w,1)),p.length||delete v[Jt]),Object.keys(v).length||delete y[r],o&&!Object.keys(y).length&&a.del(o)}}}({name:t,win:r,domain:o},{handler:n.handler,handleError:n.errorHandler||function(t){throw t},window:r,domain:o||Z,name:t});return{cancel:function(){i.cancel()}}}function $t(t,n,e){"function"==typeof(n=n||{})&&(e=n,n={});var r,o=new T;return n.errorHandler=function(t){r.cancel(),o.reject(t)},r=Zt(t,n,(function(t){if(r.cancel(),o.resolve(t),e)return e(t)})),o.cancel=r.cancel,o}var Vt=function t(n,e,r,o){var i=(o=o||{}).domain||Z,a=o.timeout||-1,u=o.timeout||5e3,c=o.fireAndForget||!1;return T.try((function(){return function(t,n,e){if(!t)throw new Error("Expected name");if(e&&"string"!=typeof e&&!Array.isArray(e)&&!G(e))throw new TypeError("Expected domain to be a string, array, or regex");if(x(n))throw new Error("Target window is closed")}(e,n,i),function(t,n,e,r){var o=r.send;return T.try((function(){return function(t,n){var e=k(n);if(e)return e===t;if(n===t)return!1;if(function(t){if(t){try{if(t.top)return t.top}catch(t){}if(l(t)===t)return t;try{if(m(window,t)&&window.top)return window.top}catch(t){}try{if(m(t,window)&&window.top)return window.top}catch(t){}for(var n=0,e=function t(n){for(var e=[],r=0,o=g(n);r<o.length;r++){var i=o[r];e.push(i);for(var a=0,u=t(i);a<u.length;a++)e.push(u[a])}return e}(t);n<e.length;n++){var r=e[n];try{if(r.top)return r.top}catch(t){}if(l(r)===r)return r}}}(n)===n)return!1;for(var r=0,o=g(t);r<o.length;r++)if(o[r]===n)return!0;return!1}(window,t)?function(t,n,e){void 0===n&&(n=5e3),void 0===e&&(e="Window");var r=ut(t);return-1!==n&&(r=r.timeout(n,new Error(e+" did not load after "+n+"ms"))),r}(t,e):G(n)?ct(t,{send:o}):{domain:n}})).then((function(t){return t.domain}))}(n,i,u,{send:t})})).then((function(o){if(!S(i,o))throw new Error("Domain "+B(i)+" does not match "+B(o));i=o;var u,s,f=e===Q&&r&&"string"==typeof r.name?r.name+"()":e,d=new T,l=e+"_"+F();if(!c){var h={name:e,win:n,domain:i,promise:d};!function(t,n){et("responseListeners").set(t,n)}(l,h);var p=it("requestPromises").getOrSet(n,(function(){return[]}));p.push(d),d.catch((function(){!function(t){et("erroredResponseListeners").set(t,!0)}(l),Bt(l)}));var w=function(t){return it("knownWindows").get(t,!1)}(n)?1e4:2e3,v=a,m=w,g=v,_=(u=function(){return x(n)?d.reject(new Error("Window closed for "+e+" before "+(h.ack?"response":"ack"))):h.cancelled?d.reject(new Error("Response listener was cancelled for "+e)):(m=Math.max(m-500,0),-1!==g&&(g=Math.max(g-500,0)),h.ack||0!==m?0===g?d.reject(new Error("No response for postMessage "+f+" in "+y()+" in "+v+"ms")):void 0:d.reject(new Error("No ack for postMessage "+f+" in "+y()+" in "+w+"ms")))},function t(){s=setTimeout((function(){u(),t()}),500)}(),{cancel:function(){clearTimeout(s)}});d.finally((function(){_.cancel(),p.splice(p.indexOf(d,1))})).catch(J)}return Ft(n,i,{type:"postrobot_message_request",hash:l,name:e,data:r,fireAndForget:c},{on:Zt,send:t}),c?d.resolve():d}))};function Xt(t,n,e){return Lt(t,n,e,{on:Zt,send:Vt})}function tn(t,n,e){return Nt(t,n,e,{on:Zt,send:Vt})}function nn(t){return Tt.toProxyWindow(t,{send:Vt})}function en(){var t,n,e,r;tt().initialized||(tt().initialized=!0,n=(t={on:Zt,send:Vt}).on,e=t.send,(r=tt()).receiveMessage=r.receiveMessage||function(t){return Yt(t,{on:n,send:e})},function(t){var n=t.on,e=t.send;et().getOrSet("postMessageListener",(function(){return(t=window).addEventListener("message",r=function(t){!function(t,n){var e=n.on,r=n.send,o=t.source||t.sourceElement,i=t.origin||t.originalEvent&&t.originalEvent.origin,u=t.data;if("null"===i&&(i=a+"//"),o){if(!i)throw new Error("Post message did not have origin domain");Yt({source:o,origin:i,data:u},{on:e,send:r})}}(t,{on:n,send:e})}),{cancel:function(){t.removeEventListener("message",r)}};var t,r}))}({on:Zt,send:Vt}),function(t){var n=t.on,e=t.send;et("builtinListeners").getOrSet("helloListener",(function(){var t=n(Y,{domain:Z},(function(t){var n=t.source,e=t.origin;return ut(n).resolve({win:n,domain:e}),{instanceID:at()}})),r=k();return r&&ct(r,{send:e}).catch(J),t}))}({on:Zt,send:Vt}))}function rn(){var t;!function(){for(var t=et("responseListeners"),n=0,e=t.keys();n<e.length;n++){var r=e[n],o=t.get(r);o&&(o.cancelled=!0),t.del(r)}}(),(t=et().get("postMessageListener"))&&t.cancel(),delete window.__post_robot_10_0_14__}function on(t){for(var n=0,e=it("requestPromises").get(t,[]);n<e.length;n++)e[n].reject(new Error("Window cleaned up before response")).catch(J)}e.d(n,"bridge",(function(){})),e.d(n,"Promise",(function(){return T})),e.d(n,"TYPES",(function(){return!0})),e.d(n,"ProxyWindow",(function(){return Tt})),e.d(n,"setup",(function(){return en})),e.d(n,"destroy",(function(){return rn})),e.d(n,"serializeMessage",(function(){return Xt})),e.d(n,"deserializeMessage",(function(){return tn})),e.d(n,"toProxyWindow",(function(){return nn})),e.d(n,"on",(function(){return Zt})),e.d(n,"once",(function(){return $t})),e.d(n,"send",(function(){return Vt})),e.d(n,"markWindowKnown",(function(){return ft})),e.d(n,"cleanUpWindow",(function(){return on})),en()}])},702:(t,n,e)=>{t.exports=e(684),t.exports.default=t.exports}},n={};function e(r){var o=n[r];if(void 0!==o)return o.exports;var i=n[r]={exports:{}};return t[r].call(i.exports,i,i.exports,e),i.exports}return e.n=t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),(()=>{"use strict";var t=e(702),n=e.n(t);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,a(r.key),r)}}function a(t){var n=function(t){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var e=n.call(t,"string");if("object"!=r(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(n)?n:n+""}var u=function(){return t=function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this._url=n,this._selector=e.selector,this._frame=window.document.createElement("iframe"),this._frame.id="ps_"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),this._frame.src=n,this._init_iframe(this._selector),this.dst=this._frame.contentWindow||this._frame,this.apikey=e.apikey||void 0,delete e.apikey,this.opts=e},(e=[{key:"_init_iframe",value:function(t){void 0!==t?this.show_checkbox(t):this.hide_checkbox(void 0)}},{key:"_detach_checkbox",value:function(t){var n=t||this._selector;if(n){var e=window.document.querySelector(n);if(e)try{this._frame=e.removeChild(this._frame)}catch(t){console.log("Iframe not attached to: ".concat(n))}}}},{key:"hide_checkbox",value:function(t){try{return this._detach_checkbox(t),this._frame.style["content-visibility"]="hidden",this._frame.style.display="none",this._frame.style.position="absolute",this._frame.style.top="-999px",this._frame.style.left="-999px",this._frame.style.height="0px",this._frame.style.width="0px",this._frame.style.border="0px",window.document.body.appendChild(this._frame),this.dst=this._frame.contentWindow||this._frame,!0}catch(t){return console.log("Problem attaching hidden checkbox: ".concat(t)),!1}}},{key:"show_checkbox",value:function(t){try{var e=window.document.body.querySelector(t);return null!==e?(this._detach_checkbox("body"),this._frame.style["content-visibility"]="visible",this._frame.style.display="inline-block",this._frame.style.position="relative",this._frame.style.top="0px",this._frame.style.left="0px",this._frame.style.height="40px",this._frame.style.width="40px",this._frame.style.border="0px",this._frame.style["background-color"]="transparent",e.appendChild(this._frame),this.dst=this._frame.contentWindow||this._frame,n().send(this.dst,"init-checkbox").then((function(t){console.log("Handled init-checkbox message")})).catch((function(t){console.log("Error handling init-checkbox message: ".concat(t))})),!0):(console.log("Selector not found: ".concat(t)),!1)}catch(t){return console.log("Problem attaching checkbox: ".concat(t)),!1}}},{key:"update",value:function(t,e){return n().send(this.dst,"update",{context:t,entity:e,apikey:this.apikey})}},{key:"entities",value:function(t){var e=this;return n().send(e.dst,"entities",{context:t,apikey:e.apikey}).then((function(t){return t})).catch((function(r){return new Promise((function(r,o){var i=window.setTimeout((function(){o("Timeout waiting for initialized message: ".concat(3e4))}),3e4);n().on("initialized",{window:e.dst},(function(o){window.clearTimeout(i),r(n().send(e.dst,"entities",{context:t,apikey:e.apikey}))}))}))}))}},{key:"remove",value:function(t,e){return n().send(this.dst,"remove",{context:t,entity_id:e,apikey:this.apikey})}},{key:"clear",value:function(t){return n().send(this.dst,"clear",{context:t,apikey:this.apikey})}},{key:"entity",value:function(t,e){return n().send(this.dst,"entity",{context:t,entity_id:e,apikey:this.apikey})}},{key:"has_storage_access",value:function(t){return n().send(this.dst,"has_storage_access",{context:t,apikey:this.apikey})}}])&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function s(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;c=!1}else for(;!(c=(r=i.call(e)).done)&&(u.push(r.value),u.length!==n);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,n)||function(t,n){if(t){if("string"==typeof t)return f(t,n);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?f(t,n):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function d(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function l(t){var n=function(t){if("object"!=c(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var e=n.call(t,"string");if("object"!=c(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==c(n)?n:n+""}var h=function(){return t=function t(n,e){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.rawEntity=n,this.detectedStandard=null,this.extractedAttributes={},this.type=e,this.openidType=null,this.schemaConfigs={SAML:{detect:function(t){return t.hasOwnProperty("title")},extractors:{}},Openid:{detect:function(t){return t.hasOwnProperty("entity_types")},extractors:{}}},this.init()},(n=[{key:"init",value:function(){var t=this;if(this.detectedStandard=this.detectStandard(),!this.detectedStandard)throw new Error("Unable to detect a valid standard");"Openid"===this.detectedStandard?(this.openidType="sp"===this.type?"openid_relaying_party":"openid_provider",this.schemaConfigs.Openid.extractors={entityID:function(t){return t.entity_id},title:function(n){return n.ui_infos[t.openidType].display_name},title_langs:function(n){var e={};for(var r in n.ui_infos[t.openidType])r.startsWith("display_name")&&r.includes("#")&&(e[r.split("#")[1]]=n.ui_infos[t.openidType][r]);return e},descr:function(n){return n.ui_infos[t.openidType].description||null},descr_langs:function(n){var e={};for(var r in n.ui_infos[t.openidType])r.startsWith("description")&&r.includes("#")&&(e[r.split("#")[1]]=n.ui_infos[t.openidType][r]);return e},entity_icon:function(t){return null},entity_icon_url:function(n){return n.ui_infos[t.openidType].logo_uri?{url:n.ui_infos[t.openidType].logo_uri,width:100,height:100}:null},domain:function(t){return null},name_tag:function(t){return null},hidden:function(t){return!1},hint:function(t){return!1},discovery_responses:function(t){return null}}):"SAML"===this.detectedStandard&&(this.schemaConfigs.SAML.extractors={entityID:function(t){return t.entityID},title:function(t){return t.title},title_langs:function(t){return t.title_langs||{}},descr:function(t){return t.descr||null},descr_langs:function(t){return t.descr_langs||{}},entity_icon:function(t){return t.entity_icon||null},entity_icon_url:function(t){return t.entity_icon_url||null},domain:function(t){return t.domain||null},name_tag:function(t){return t.name_tag||null},hidden:function(t){return"true"===t.hidden},hint:function(t){return"true"===t.hint},discovery_responses:function(t){return t.discovery_responses||null}}),this.extractedAttributes=this.extractAttributes()}},{key:"detectStandard",value:function(){for(var t=0,n=Object.entries(this.schemaConfigs);t<n.length;t++){var e=s(n[t],2),r=e[0],o=e[1];try{if(o.detect(this.rawEntity))return r}catch(t){continue}}return null}},{key:"extractAttributes",value:function(){if(!this.detectedStandard)return{};for(var t=this.schemaConfigs[this.detectedStandard],n={},e=0,r=Object.entries(t.extractors);e<r.length;e++){var o=s(r[e],2),i=o[0],a=o[1];try{var u=a(this.rawEntity);n[i]=u}catch(t){n[i]=null,console.warn("Failed to extract attribute '".concat(i,"':"),t.message)}}return n}},{key:"getAttribute",value:function(t){return this.extractedAttributes.hasOwnProperty(t)?this.extractedAttributes[t]:null}},{key:"hasAttribute",value:function(t){return this.extractedAttributes.hasOwnProperty(t)&&null!==this.extractedAttributes[t]}},{key:"getDiscoJSON",value:function(){return this.extractedAttributes}}])&&d(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();function p(t,n){var e=(65535&t)+(65535&n);return(t>>16)+(n>>16)+(e>>16)<<16|65535&e}function w(t,n){return t<<n|t>>>32-n}function y(t,n,e,r){return t<20?n&e|~n&r:t<40?n^e^r:t<60?n&e|n&r|e&r:n^e^r}function v(t){return t<20?1518500249:t<40?1859775393:t<60?-1894007588:-899497514}function m(t){return function(t){for(var n,e="0123456789abcdef",r="",o=0;o<t.length;o++)n=t.charCodeAt(o),r+=e.charAt(n>>>4&15)+e.charAt(15&n);return r}(function(t){return function(t){for(var n="",e=0;e<32*t.length;e+=8)n+=String.fromCharCode(t[e>>5]>>>24-e%32&255);return n}(function(t,n){t[n>>5]|=128<<24-n%32,t[15+(n+64>>9<<4)]=n;for(var e=Array(80),r=1732584193,o=-271733879,i=-1732584194,a=271733878,u=-1009589776,c=0;c<t.length;c+=16){for(var s=r,f=o,d=i,l=a,h=u,m=0;m<80;m++){e[m]=m<16?t[c+m]:w(e[m-3]^e[m-8]^e[m-14]^e[m-16],1);var g=p(p(w(r,5),y(m,o,i,a)),p(p(u,e[m]),v(m)));u=a,a=i,i=w(o,30),o=r,r=g}r=p(r,s),o=p(o,f),i=p(i,d),a=p(a,l),u=p(u,h)}return Array(r,o,i,a,u)}(function(t){for(var n=Array(t.length>>2),e=0;e<n.length;e++)n[e]=0;for(e=0;e<8*t.length;e+=8)n[e>>5]|=(255&t.charCodeAt(e/8))<<24-e%32;return n}(t),8*t.length))}(function(t){for(var n,e,r="",o=-1;++o<t.length;)n=t.charCodeAt(o),e=o+1<t.length?t.charCodeAt(o+1):0,55296<=n&&n<=56319&&56320<=e&&e<=57343&&(n=65536+((1023&n)<<10)+(1023&e),o++),n<=127?r+=String.fromCharCode(n):n<=2047?r+=String.fromCharCode(192|n>>>6&31,128|63&n):n<=65535?r+=String.fromCharCode(224|n>>>12&15,128|n>>>6&63,128|63&n):n<=2097151&&(r+=String.fromCharCode(240|n>>>18&7,128|n>>>12&63,128|n>>>6&63,128|63&n));return r}(t)))}function g(t){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(t)}function _(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,S(r.key),r)}}function b(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function x(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?b(Object(e),!0).forEach((function(n){k(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):b(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}function k(t,n,e){return(n=S(n))in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function S(t){var n=function(t){if("object"!=g(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var e=n.call(t,"string");if("object"!=g(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==g(n)?n:n+""}function E(t){return"{sha1}"+m(t)}function j(t){return fetch(t,{method:"GET",headers:{Accept:"application/json"}}).then((function(n){if(404==n.status)throw new URIError("".concat(t,": not found"));return n})).then((function(t){var n=t.headers.get("content-type");if(n&&n.includes("application/json"))return t.json();throw new SyntaxError("MDQ didn't provide a JSON response")}))}var O=function(){return t=function t(n,e,r){var o,i,a,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),"string"==typeof r?(o=c.selector,i=c.entityID,a=c.trustProfile):"object"===g(r)?(o=r.selector,i=r.entityID,a=r.trustProfile,r="thiss.io"):r="thiss.io",this.mdq="function"==typeof n?n:function(t){return function(t,n,e,r){return function(t,n,e,r){var o=r+t+".json";return e&&n&&(o="".concat(o,"?entityID=").concat(encodeURIComponent(e),"&trustProfile=").concat(n)),j(o).then((function(t){return Array.isArray(t)&&t.length>0&&(t=t[0]),t}))}(t,n,e,r).catch((function(t){console.log(t)}))}(E(t),a,i,n)},this.mdq_sp=function(t){return function(t,n){return j(n+E(t)+".json").then((function(t){return"[object Array]"===Object.prototype.toString.call(t)&&(t=t[0]),t})).catch((function(t){console.log("ERROR getting SP md:",t)}))}(t,n)},this.ps=e instanceof u?e:new u(e,{selector:o}),this.context=r},n=[{key:"with_items",value:function(t){var n=this;this.ps.entities(this.context).then((function(n){return t(n.data)})).then((function(t){t&&t.data&&t.data.forEach((function(t){this.ps.update(n.context,t)}))}))}},{key:"saml_discovery_response",value:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.do_saml_discovery_response(t,n).then((function(t){var n=Object.fromEntries(new URLSearchParams(window.location.search));return function(t,n){n&&n.return||(n=x(x({},n),{},{return:"/"}));var e=n.return;if("/"===e&&(e=window.location.origin?window.location.origin+"/":window.location.protocol+"//"+window.location.host+"/"),void 0===e||!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error("Invalid return query param: ".concat(e));var r=-1===e.indexOf("?")?"?":"&",o=n.returnIDParam,i=new h(t,"idp"),a=i.getAttribute("entityID");return o||("SAML"===i.detectedStandard?o="entityID":"Openid"===i.detectedStandard&&(o="iss",e=function(t){try{var n=new URL(t);if(n.searchParams.has("target")){var e=n.searchParams.get("target");n.searchParams.delete("target"),n.searchParams.set("target_link_uri",e)}return n.toString()}catch(n){return console.error("Invalid URL:",n),t}}(e))),a&&(e+=r+o+"="+a),e}(t.entity,n)})).then((function(t){window.top.location.href=t})).catch((function(t){console.log(t)}))}},{key:"pin",value:function(t){return this.do_saml_discovery_response(t,!0)}},{key:"do_saml_discovery_response",value:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],e=this;return e.ps.entity(e.context,t).then((function(t){return t.data})).then((function(r){return void 0===r?e.mdq(t).then((function(t){if(n)return e.ps.update(e.context,t).then((function(t){return t.data}));var r=Date.now(),o={entity:t,last_refresh:r,last_use:r};return Promise.resolve(o)})):Promise.resolve(r)})).catch((function(t){return console.log(t)}))}},{key:"remove",value:function(t){return this.ps.remove(this.context,t)}}],n&&_(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();function W(t,n){var e=window.document;Array.from(n.children).forEach((function(t){return o.removeChild(t)}));var r=new h(t);["type","title","title_langs","descr","descr_langs","entity_icon","entity_icon_url"].forEach((function(t){var o=r.getAttribute(t),i=e.createElement("dt");i.textContent=t,n.appendChild(i);var a=e.createElement("dd");if("entity_icon"===t){var u=e.createElement("img");u.setAttribute("src",o),a.appendChild(u)}else a.textContent=JSON.stringify(o);n.appendChild(a)}))}window.onload=function(){var t=new O("https://md.thiss.io/entities/","https://use.thiss.io/ps/","test",{selector:"#checkbox-anchor"}),n=window.document,e=n.getElementById("info"),r=n.getElementById("lookup"),o=n.getElementB