@atomic.io/action-cards-web-sdk-cdn-icons 24.2.1
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 +1766 -0
- package/package.json +88 -0
- package/public/LICENSES.txt +236 -0
- package/public/iframe-manager.js +9 -0
- package/public/sdk.d.ts +1233 -0
- package/public/sdk.js +9 -0
package/public/sdk.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*! For license information please see sdk-cdn-icons.js.LICENSE.txt */
|
|
2
|
+
/*!
|
|
3
|
+
* @license
|
|
4
|
+
* Atomic Web SDK 24.2.1
|
|
5
|
+
* Copyright 2022 Atomic.io Limited.
|
|
6
|
+
* For licenses of open source libraries used by the Atomic SDK, please
|
|
7
|
+
* see https://downloads.atomic.io/web-sdk/release/24.2.1/LICENSES.txt.
|
|
8
|
+
*/
|
|
9
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AtomicSDK=t():e.AtomicSDK=t()}(globalThis,(()=>(()=>{var e={4963:e=>{e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},7722:(e,t,n)=>{var r=n(6314)("unscopables"),i=Array.prototype;null==i[r]&&n(7728)(i,r,{}),e.exports=function(e){i[r][e]=!0}},7007:(e,t,n)=>{var r=n(5286);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},9315:(e,t,n)=>{var r=n(2110),i=n(875),o=n(2337);e.exports=function(e){return function(t,n,a){var s,c=r(t),l=i(c.length),d=o(a,l);if(e&&n!=n){for(;l>d;)if((s=c[d++])!=s)return!0}else for(;l>d;d++)if((e||d in c)&&c[d]===n)return e||d||0;return!e&&-1}}},2032:e=>{var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},5645:e=>{var t=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=t)},741:(e,t,n)=>{var r=n(4963);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},1355:e=>{e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},7057:(e,t,n)=>{e.exports=!n(4253)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},2457:(e,t,n)=>{var r=n(5286),i=n(3816).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},4430:e=>{e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},2985:(e,t,n)=>{var r=n(3816),i=n(5645),o=n(7728),a=n(3415),s=n(741),c="prototype",l=function(e,t,n){var d,u,p,h,m=e&l.F,g=e&l.G,v=e&l.S,f=e&l.P,b=e&l.B,y=g?r:v?r[t]||(r[t]={}):(r[t]||{})[c],S=g?i:i[t]||(i[t]={}),w=S[c]||(S[c]={});for(d in g&&(n=t),n)p=((u=!m&&y&&void 0!==y[d])?y:n)[d],h=b&&u?s(p,r):f&&"function"==typeof p?s(Function.call,p):p,y&&a(y,d,p,e&l.U),S[d]!=p&&o(S,d,h),f&&w[d]!=p&&(w[d]=p)};r.core=i,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},4253:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},18:(e,t,n)=>{e.exports=n(3825)("native-function-to-string",Function.toString)},3816:e=>{var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)},9181:e=>{var t={}.hasOwnProperty;e.exports=function(e,n){return t.call(e,n)}},7728:(e,t,n)=>{var r=n(9275),i=n(681);e.exports=n(7057)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},639:(e,t,n)=>{var r=n(3816).document;e.exports=r&&r.documentElement},1734:(e,t,n)=>{e.exports=!n(7057)&&!n(4253)((function(){return 7!=Object.defineProperty(n(2457)("div"),"a",{get:function(){return 7}}).a}))},9797:(e,t,n)=>{var r=n(2032);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},5286:e=>{e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},9988:(e,t,n)=>{"use strict";var r=n(2503),i=n(681),o=n(2943),a={};n(7728)(a,n(6314)("iterator"),(function(){return this})),e.exports=function(e,t,n){e.prototype=r(a,{next:i(1,n)}),o(e,t+" Iterator")}},2923:(e,t,n)=>{"use strict";var r=n(4461),i=n(2985),o=n(3415),a=n(7728),s=n(7234),c=n(9988),l=n(2943),d=n(468),u=n(6314)("iterator"),p=!([].keys&&"next"in[].keys()),h="keys",m="values",g=function(){return this};e.exports=function(e,t,n,v,f,b,y){c(n,t,v);var S,w,k,C=function(e){if(!p&&e in _)return _[e];switch(e){case h:case m:return function(){return new n(this,e)}}return function(){return new n(this,e)}},x=t+" Iterator",I=f==m,O=!1,_=e.prototype,T=_[u]||_["@@iterator"]||f&&_[f],D=T||C(f),j=f?I?C("entries"):D:void 0,M="Array"==t&&_.entries||T;if(M&&(k=d(M.call(new e)))!==Object.prototype&&k.next&&(l(k,x,!0),r||"function"==typeof k[u]||a(k,u,g)),I&&T&&T.name!==m&&(O=!0,D=function(){return T.call(this)}),r&&!y||!p&&!O&&_[u]||a(_,u,D),s[t]=D,s[x]=g,f)if(S={values:I?D:C(m),keys:b?D:C(h),entries:j},y)for(w in S)w in _||o(_,w,S[w]);else i(i.P+i.F*(p||O),t,S);return S}},5436:e=>{e.exports=function(e,t){return{value:t,done:!!e}}},7234:e=>{e.exports={}},4461:e=>{e.exports=!1},2503:(e,t,n)=>{var r=n(7007),i=n(5588),o=n(4430),a=n(9335)("IE_PROTO"),s=function(){},c="prototype",l=function(){var e,t=n(2457)("iframe"),r=o.length;for(t.style.display="none",n(639).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),l=e.F;r--;)delete l[c][o[r]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(s[c]=r(e),n=new s,s[c]=null,n[a]=e):n=l(),void 0===t?n:i(n,t)}},9275:(e,t,n)=>{var r=n(7007),i=n(1734),o=n(1689),a=Object.defineProperty;t.f=n(7057)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},5588:(e,t,n)=>{var r=n(9275),i=n(7007),o=n(7184);e.exports=n(7057)?Object.defineProperties:function(e,t){i(e);for(var n,a=o(t),s=a.length,c=0;s>c;)r.f(e,n=a[c++],t[n]);return e}},468:(e,t,n)=>{var r=n(9181),i=n(508),o=n(9335)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},189:(e,t,n)=>{var r=n(9181),i=n(2110),o=n(9315)(!1),a=n(9335)("IE_PROTO");e.exports=function(e,t){var n,s=i(e),c=0,l=[];for(n in s)n!=a&&r(s,n)&&l.push(n);for(;t.length>c;)r(s,n=t[c++])&&(~o(l,n)||l.push(n));return l}},7184:(e,t,n)=>{var r=n(189),i=n(4430);e.exports=Object.keys||function(e){return r(e,i)}},681:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},3415:(e,t,n)=>{var r=n(3816),i=n(7728),o=n(9181),a=n(3953)("src"),s=n(18),c="toString",l=(""+s).split(c);n(5645).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,n,s){var c="function"==typeof n;c&&(o(n,"name")||i(n,"name",t)),e[t]!==n&&(c&&(o(n,a)||i(n,a,e[t]?""+e[t]:l.join(String(t)))),e===r?e[t]=n:s?e[t]?e[t]=n:i(e,t,n):(delete e[t],i(e,t,n)))})(Function.prototype,c,(function(){return"function"==typeof this&&this[a]||s.call(this)}))},2943:(e,t,n)=>{var r=n(9275).f,i=n(9181),o=n(6314)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},9335:(e,t,n)=>{var r=n(3825)("keys"),i=n(3953);e.exports=function(e){return r[e]||(r[e]=i(e))}},3825:(e,t,n)=>{var r=n(5645),i=n(3816),o="__core-js_shared__",a=i[o]||(i[o]={});(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(4461)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},2337:(e,t,n)=>{var r=n(1467),i=Math.max,o=Math.min;e.exports=function(e,t){return(e=r(e))<0?i(e+t,0):o(e,t)}},1467:e=>{var t=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:t)(e)}},2110:(e,t,n)=>{var r=n(9797),i=n(1355);e.exports=function(e){return r(i(e))}},875:(e,t,n)=>{var r=n(1467),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},508:(e,t,n)=>{var r=n(1355);e.exports=function(e){return Object(r(e))}},1689:(e,t,n)=>{var r=n(5286);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},3953:e=>{var t=0,n=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++t+n).toString(36))}},6314:(e,t,n)=>{var r=n(3825)("wks"),i=n(3953),o=n(3816).Symbol,a="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=r},6997:(e,t,n)=>{"use strict";var r=n(7722),i=n(5436),o=n(7234),a=n(2110);e.exports=n(2923)(Array,"Array",(function(e,t){this._t=a(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):i(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])}),"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},1181:(e,t,n)=>{for(var r=n(6997),i=n(7184),o=n(3415),a=n(3816),s=n(7728),c=n(7234),l=n(6314),d=l("iterator"),u=l("toStringTag"),p=c.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},m=i(h),g=0;g<m.length;g++){var v,f=m[g],b=h[f],y=a[f],S=y&&y.prototype;if(S&&(S[d]||s(S,d,p),S[u]||s(S,u,f),c[f]=p,b))for(v in r)S[v]||o(S,v,r[v],!0)}},4630:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>s});var r=n(6213),i=n.n(r),o=n(3645),a=n.n(o)()(i());a.push([e.id,"/* Take care to only target specific ID base styles here to avoid style pollution in the host site */\niframe.atomic-sdk-frame.launcher {\n width: 460px;\n position: fixed;\n bottom: 100px;\n right: 0px;\n top: 0px;\n height: 100%;\n max-width: 100%;\n animation: atomic-sdk-launcher-close 0.1s ease forwards;\n}\n\niframe.atomic-sdk-frame.launcher.open {\n animation: atomic-sdk-launcher-open 0.1s ease forwards;\n}\n\n@keyframes atomic-sdk-launcher-open {\n 0% {\n opacity: 0;\n transform: translateY(20px);\n pointer-events: auto;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n z-index: 2;\n }\n}\n\n@keyframes atomic-sdk-launcher-close {\n 0% {\n opacity: 1;\n transform: translateY(0);\n pointer-events: none;\n }\n 100% {\n opacity: 0;\n transform: translateY(20px);\n z-index: -2;\n }\n}\n\n.atomic-sdk-launcher {\n background-color: blue;\n overflow: hidden;\n height: 60px;\n width: 60px;\n border-radius: 999px;\n box-shadow: 0 2px 20px 0 rgba(0, 0, 0, 0.1);\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0;\n transform: scale(0.1);\n animation: atomic-sdk-launcher 0.2s forwards;\n transition: all 0.1s ease;\n cursor: pointer;\n border: 0;\n}\n\n@keyframes atomic-sdk-launcher {\n from {\n transform: scale(0.1);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n}\n\n.atomic-sdk-launcher-wrapper {\n width: 60px;\n height: 60px;\n display: flex;\n position: fixed;\n bottom: 20px;\n right: 20px;\n}\n\niframe.atomic-sdk-frame.standalone.shrink {\n max-height: 2000px;\n transition: max-height 1s ease-out 2.3s;\n}\n\n#atomic-sdk-toast-container {\n position: fixed;\n bottom: 0;\n left: 50%;\n transform: translateX(-50%);\n max-width: 500px;\n height: 0px;\n z-index: 2;\n}",""]);const s=a},3645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,i,o){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var c=this[s][0];null!=c&&(a[c]=!0)}for(var l=0;l<e.length;l++){var d=[].concat(e[l]);r&&a[d[0]]||(void 0!==o&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=o),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),i&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=i):d[4]="".concat(i)),t.push(d))}},t}},6213:e=>{"use strict";e.exports=function(e){return e[1]}},3561:e=>{e.exports=function(e){var t=new Date(e.getTime()),n=t.getTimezoneOffset();return t.setSeconds(0,0),6e4*n+t.getTime()%6e4}},4844:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=Number(t);return n.setDate(n.getDate()+i),n}},2680:(e,t,n)=>{var r=n(2951);e.exports=function(e,t){var n=Number(t);return r(e,36e5*n)}},7538:(e,t,n)=>{var r=n(2385),i=n(1138);e.exports=function(e,t){var n=Number(t);return i(e,r(e)+n)}},2951:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e).getTime(),i=Number(t);return new Date(n+i)}},1318:(e,t,n)=>{var r=n(2951);e.exports=function(e,t){var n=Number(t);return r(e,6e4*n)}},9331:(e,t,n)=>{var r=n(1884),i=n(2807);e.exports=function(e,t){var n=r(e),o=Number(t),a=n.getMonth()+o,s=new Date(0);s.setFullYear(n.getFullYear(),a,1),s.setHours(0,0,0,0);var c=i(s);return n.setMonth(a,Math.min(c,n.getDate())),n}},1482:(e,t,n)=>{var r=n(9331);e.exports=function(e,t){var n=Number(t);return r(e,3*n)}},9723:(e,t,n)=>{var r=n(2951);e.exports=function(e,t){var n=Number(t);return r(e,1e3*n)}},5932:(e,t,n)=>{var r=n(4844);e.exports=function(e,t){var n=Number(t);return r(e,7*n)}},6083:(e,t,n)=>{var r=n(9331);e.exports=function(e,t){var n=Number(t);return r(e,12*n)}},6739:(e,t,n)=>{var r=n(1884);e.exports=function(e,t,n,i){var o=r(e).getTime(),a=r(t).getTime(),s=r(n).getTime(),c=r(i).getTime();if(o>a||s>c)throw new Error("The start of the range cannot be after the end of the range");return o<c&&s<a}},7886:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){if(!(t instanceof Array))throw new TypeError(toString.call(t)+" is not an instance of Array");var n,i,o=r(e).getTime();return t.forEach((function(e,t){var a=r(e),s=Math.abs(o-a.getTime());(void 0===n||s<i)&&(n=t,i=s)})),n}},3806:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){if(!(t instanceof Array))throw new TypeError(toString.call(t)+" is not an instance of Array");var n,i,o=r(e).getTime();return t.forEach((function(e){var t=r(e),a=Math.abs(o-t.getTime());(void 0===n||a<i)&&(n=t,i=a)})),n}},3374:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e).getTime(),i=r(t).getTime();return n<i?-1:n>i?1:0}},3558:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e).getTime(),i=r(t).getTime();return n>i?-1:n<i?1:0}},6656:(e,t,n)=>{var r=n(6579);e.exports=function(e,t){var n=r(e),i=r(t),o=n.getTime()-6e4*n.getTimezoneOffset(),a=i.getTime()-6e4*i.getTimezoneOffset();return Math.round((o-a)/864e5)}},6554:(e,t,n)=>{var r=n(1971);e.exports=function(e,t){var n=r(e),i=r(t),o=n.getTime()-6e4*n.getTimezoneOffset(),a=i.getTime()-6e4*i.getTimezoneOffset();return Math.round((o-a)/6048e5)}},7051:(e,t,n)=>{var r=n(2385);e.exports=function(e,t){return r(e)-r(t)}},1924:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=r(t);return 12*(n.getFullYear()-i.getFullYear())+(n.getMonth()-i.getMonth())}},9729:(e,t,n)=>{var r=n(21),i=n(1884);e.exports=function(e,t){var n=i(e),o=i(t);return 4*(n.getFullYear()-o.getFullYear())+(r(n)-r(o))}},9871:(e,t,n)=>{var r=n(5344);e.exports=function(e,t,n){var i=r(e,n),o=r(t,n),a=i.getTime()-6e4*i.getTimezoneOffset(),s=o.getTime()-6e4*o.getTimezoneOffset();return Math.round((a-s)/6048e5)}},8509:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=r(t);return n.getFullYear()-i.getFullYear()}},6056:(e,t,n)=>{var r=n(1884),i=n(6656),o=n(3374);e.exports=function(e,t){var n=r(e),a=r(t),s=o(n,a),c=Math.abs(i(n,a));return n.setDate(n.getDate()-s*c),s*(c-(o(n,a)===-s))}},298:(e,t,n)=>{var r=n(8081);e.exports=function(e,t){var n=r(e,t)/36e5;return n>0?Math.floor(n):Math.ceil(n)}},9973:(e,t,n)=>{var r=n(1884),i=n(7051),o=n(3374),a=n(9883);e.exports=function(e,t){var n=r(e),s=r(t),c=o(n,s),l=Math.abs(i(n,s));return n=a(n,c*l),c*(l-(o(n,s)===-c))}},8081:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=r(t);return n.getTime()-i.getTime()}},604:(e,t,n)=>{var r=n(8081);e.exports=function(e,t){var n=r(e,t)/6e4;return n>0?Math.floor(n):Math.ceil(n)}},1387:(e,t,n)=>{var r=n(1884),i=n(1924),o=n(3374);e.exports=function(e,t){var n=r(e),a=r(t),s=o(n,a),c=Math.abs(i(n,a));return n.setMonth(n.getMonth()-s*c),s*(c-(o(n,a)===-s))}},9403:(e,t,n)=>{var r=n(1387);e.exports=function(e,t){var n=r(e,t)/3;return n>0?Math.floor(n):Math.ceil(n)}},7977:(e,t,n)=>{var r=n(8081);e.exports=function(e,t){var n=r(e,t)/1e3;return n>0?Math.floor(n):Math.ceil(n)}},4496:(e,t,n)=>{var r=n(6056);e.exports=function(e,t){var n=r(e,t)/7;return n>0?Math.floor(n):Math.ceil(n)}},760:(e,t,n)=>{var r=n(1884),i=n(8509),o=n(3374);e.exports=function(e,t){var n=r(e),a=r(t),s=o(n,a),c=Math.abs(i(n,a));return n.setFullYear(n.getFullYear()-s*c),s*(c-(o(n,a)===-s))}},3332:(e,t,n)=>{var r=n(3558),i=n(1884),o=n(7977),a=n(1387),s=n(7479),c=43200;e.exports=function(e,t,n){var l=n||{},d=r(e,t),u=l.locale,p=s.distanceInWords.localize;u&&u.distanceInWords&&u.distanceInWords.localize&&(p=u.distanceInWords.localize);var h,m,g={addSuffix:Boolean(l.addSuffix),comparison:d};d>0?(h=i(e),m=i(t)):(h=i(t),m=i(e));var v,f=o(m,h),b=m.getTimezoneOffset()-h.getTimezoneOffset(),y=Math.round(f/60)-b;if(y<2)return l.includeSeconds?f<5?p("lessThanXSeconds",5,g):f<10?p("lessThanXSeconds",10,g):f<20?p("lessThanXSeconds",20,g):f<40?p("halfAMinute",null,g):p(f<60?"lessThanXMinutes":"xMinutes",1,g):0===y?p("lessThanXMinutes",1,g):p("xMinutes",y,g);if(y<45)return p("xMinutes",y,g);if(y<90)return p("aboutXHours",1,g);if(y<1440)return p("aboutXHours",Math.round(y/60),g);if(y<2520)return p("xDays",1,g);if(y<c)return p("xDays",Math.round(y/1440),g);if(y<86400)return p("aboutXMonths",v=Math.round(y/c),g);if((v=a(m,h))<12)return p("xMonths",Math.round(y/c),g);var S=v%12,w=Math.floor(v/12);return S<3?p("aboutXYears",w,g):S<9?p("overXYears",w,g):p("almostXYears",w+1,g)}},7666:(e,t,n)=>{var r=n(3558),i=n(1884),o=n(7977),a=n(7479),s=525600;e.exports=function(e,t,n){var c=n||{},l=r(e,t),d=c.locale,u=a.distanceInWords.localize;d&&d.distanceInWords&&d.distanceInWords.localize&&(u=d.distanceInWords.localize);var p,h,m,g={addSuffix:Boolean(c.addSuffix),comparison:l};l>0?(p=i(e),h=i(t)):(p=i(t),h=i(e));var v=Math[c.partialMethod?String(c.partialMethod):"floor"],f=o(h,p),b=h.getTimezoneOffset()-p.getTimezoneOffset(),y=v(f/60)-b;if("s"===(m=c.unit?String(c.unit):y<1?"s":y<60?"m":y<1440?"h":y<43200?"d":y<s?"M":"Y"))return u("xSeconds",f,g);if("m"===m)return u("xMinutes",y,g);if("h"===m)return u("xHours",v(y/60),g);if("d"===m)return u("xDays",v(y/1440),g);if("M"===m)return u("xMonths",v(y/43200),g);if("Y"===m)return u("xYears",v(y/s),g);throw new Error("Unknown unit: "+m)}},6272:(e,t,n)=>{var r=n(3332);e.exports=function(e,t){return r(Date.now(),e,t)}},5411:(e,t,n)=>{var r=n(1884);e.exports=function(e,t,n){var i=r(e),o=void 0!==n?n:1,a=r(t).getTime();if(i.getTime()>a)throw new Error("The first date cannot be after the second date");var s=[],c=i;for(c.setHours(0,0,0,0);c.getTime()<=a;)s.push(r(c)),c.setDate(c.getDate()+o);return s}},549:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e);return t.setHours(23,59,59,999),t}},2653:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e);return t.setMinutes(59,59,999),t}},6718:(e,t,n)=>{var r=n(1322);e.exports=function(e){return r(e,{weekStartsOn:1})}},5648:(e,t,n)=>{var r=n(2385),i=n(1971);e.exports=function(e){var t=r(e),n=new Date(0);n.setFullYear(t+1,0,4),n.setHours(0,0,0,0);var o=i(n);return o.setMilliseconds(o.getMilliseconds()-1),o}},9877:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e);return t.setSeconds(59,999),t}},9356:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}},5661:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e),n=t.getMonth(),i=n-n%3+3;return t.setMonth(i,0),t.setHours(23,59,59,999),t}},6415:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e);return t.setMilliseconds(999),t}},4404:(e,t,n)=>{var r=n(549);e.exports=function(){return r(new Date)}},7410:e=>{e.exports=function(){var e=new Date,t=e.getFullYear(),n=e.getMonth(),r=e.getDate(),i=new Date(0);return i.setFullYear(t,n,r+1),i.setHours(23,59,59,999),i}},1322:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=t&&Number(t.weekStartsOn)||0,i=r(e),o=i.getDay(),a=6+(o<n?-7:0)-(o-n);return i.setDate(i.getDate()+a),i.setHours(23,59,59,999),i}},782:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e),n=t.getFullYear();return t.setFullYear(n+1,0,0),t.setHours(23,59,59,999),t}},4106:e=>{e.exports=function(){var e=new Date,t=e.getFullYear(),n=e.getMonth(),r=e.getDate(),i=new Date(0);return i.setFullYear(t,n,r-1),i.setHours(23,59,59,999),i}},5616:(e,t,n)=>{var r=n(8612),i=n(6563),o=n(2385),a=n(1884),s=n(623),c=n(7479);var l={M:function(e){return e.getMonth()+1},MM:function(e){return p(e.getMonth()+1,2)},Q:function(e){return Math.ceil((e.getMonth()+1)/3)},D:function(e){return e.getDate()},DD:function(e){return p(e.getDate(),2)},DDD:function(e){return r(e)},DDDD:function(e){return p(r(e),3)},d:function(e){return e.getDay()},E:function(e){return e.getDay()||7},W:function(e){return i(e)},WW:function(e){return p(i(e),2)},YY:function(e){return p(e.getFullYear(),4).substr(2)},YYYY:function(e){return p(e.getFullYear(),4)},GG:function(e){return String(o(e)).substr(2)},GGGG:function(e){return o(e)},H:function(e){return e.getHours()},HH:function(e){return p(e.getHours(),2)},h:function(e){var t=e.getHours();return 0===t?12:t>12?t%12:t},hh:function(e){return p(l.h(e),2)},m:function(e){return e.getMinutes()},mm:function(e){return p(e.getMinutes(),2)},s:function(e){return e.getSeconds()},ss:function(e){return p(e.getSeconds(),2)},S:function(e){return Math.floor(e.getMilliseconds()/100)},SS:function(e){return p(Math.floor(e.getMilliseconds()/10),2)},SSS:function(e){return p(e.getMilliseconds(),3)},Z:function(e){return u(e.getTimezoneOffset(),":")},ZZ:function(e){return u(e.getTimezoneOffset())},X:function(e){return Math.floor(e.getTime()/1e3)},x:function(e){return e.getTime()}};function d(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|]$/g,""):e.replace(/\\/g,"")}function u(e,t){t=t||"";var n=e>0?"-":"+",r=Math.abs(e),i=r%60;return n+p(Math.floor(r/60),2)+t+p(i,2)}function p(e,t){for(var n=Math.abs(e).toString();n.length<t;)n="0"+n;return n}e.exports=function(e,t,n){var r=t?String(t):"YYYY-MM-DDTHH:mm:ss.SSSZ",i=(n||{}).locale,o=c.format.formatters,u=c.format.formattingTokensRegExp;i&&i.format&&i.format.formatters&&(o=i.format.formatters,i.format.formattingTokensRegExp&&(u=i.format.formattingTokensRegExp));var p=a(e);return s(p)?function(e,t,n){var r,i,o=e.match(n),a=o.length;for(r=0;r<a;r++)i=t[o[r]]||l[o[r]],o[r]=i||d(o[r]);return function(e){for(var t="",n=0;n<a;n++)o[n]instanceof Function?t+=o[n](e,l):t+=o[n];return t}}(r,o,u)(p):"Invalid Date"}},5540:(e,t,n)=>{var r=n(1884);e.exports=function(e){return r(e).getDate()}},2476:(e,t,n)=>{var r=n(1884);e.exports=function(e){return r(e).getDay()}},8612:(e,t,n)=>{var r=n(1884),i=n(9834),o=n(6656);e.exports=function(e){var t=r(e);return o(t,i(t))+1}},2807:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e),n=t.getFullYear(),i=t.getMonth(),o=new Date(0);return o.setFullYear(n,i+1,0),o.setHours(0,0,0,0),o.getDate()}},4789:(e,t,n)=>{var r=n(1164);e.exports=function(e){return r(e)?366:365}},7921:(e,t,n)=>{var r=n(1884);e.exports=function(e){return r(e).getHours()}},6373:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e).getDay();return 0===t&&(t=7),t}},6563:(e,t,n)=>{var r=n(1884),i=n(1971),o=n(3892);e.exports=function(e){var t=r(e),n=i(t).getTime()-o(t).getTime();return Math.round(n/6048e5)+1}},7098:(e,t,n)=>{var r=n(3892),i=n(5932);e.exports=function(e){var t=r(e),n=r(i(t,60)).valueOf()-t.valueOf();return Math.round(n/6048e5)}},2385:(e,t,n)=>{var r=n(1884),i=n(1971);e.exports=function(e){var t=r(e),n=t.getFullYear(),o=new Date(0);o.setFullYear(n+1,0,4),o.setHours(0,0,0,0);var a=i(o),s=new Date(0);s.setFullYear(n,0,4),s.setHours(0,0,0,0);var c=i(s);return t.getTime()>=a.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}},8597:(e,t,n)=>{var r=n(1884);e.exports=function(e){return r(e).getMilliseconds()}},3362:(e,t,n)=>{var r=n(1884);e.exports=function(e){return r(e).getMinutes()}},3503:(e,t,n)=>{var r=n(1884);e.exports=function(e){return r(e).getMonth()}},5541:(e,t,n)=>{var r=n(1884);e.exports=function(e,t,n,i){var o=r(e).getTime(),a=r(t).getTime(),s=r(n).getTime(),c=r(i).getTime();if(o>a||s>c)throw new Error("The start of the range cannot be after the end of the range");if(!(o<c&&s<a))return 0;var l=(c>a?a:c)-(s<o?o:s);return Math.ceil(l/864e5)}},21:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e);return Math.floor(t.getMonth()/3)+1}},8780:(e,t,n)=>{var r=n(1884);e.exports=function(e){return r(e).getSeconds()}},2482:(e,t,n)=>{var r=n(1884);e.exports=function(e){return r(e).getTime()}},8194:(e,t,n)=>{var r=n(1884);e.exports=function(e){return r(e).getFullYear()}},7292:(e,t,n)=>{e.exports={addDays:n(4844),addHours:n(2680),addISOYears:n(7538),addMilliseconds:n(2951),addMinutes:n(1318),addMonths:n(9331),addQuarters:n(1482),addSeconds:n(9723),addWeeks:n(5932),addYears:n(6083),areRangesOverlapping:n(6739),closestIndexTo:n(7886),closestTo:n(3806),compareAsc:n(3374),compareDesc:n(3558),differenceInCalendarDays:n(6656),differenceInCalendarISOWeeks:n(6554),differenceInCalendarISOYears:n(7051),differenceInCalendarMonths:n(1924),differenceInCalendarQuarters:n(9729),differenceInCalendarWeeks:n(9871),differenceInCalendarYears:n(8509),differenceInDays:n(6056),differenceInHours:n(298),differenceInISOYears:n(9973),differenceInMilliseconds:n(8081),differenceInMinutes:n(604),differenceInMonths:n(1387),differenceInQuarters:n(9403),differenceInSeconds:n(7977),differenceInWeeks:n(4496),differenceInYears:n(760),distanceInWords:n(3332),distanceInWordsStrict:n(7666),distanceInWordsToNow:n(6272),eachDay:n(5411),endOfDay:n(549),endOfHour:n(2653),endOfISOWeek:n(6718),endOfISOYear:n(5648),endOfMinute:n(9877),endOfMonth:n(9356),endOfQuarter:n(5661),endOfSecond:n(6415),endOfToday:n(4404),endOfTomorrow:n(7410),endOfWeek:n(1322),endOfYear:n(782),endOfYesterday:n(4106),format:n(5616),getDate:n(5540),getDay:n(2476),getDayOfYear:n(8612),getDaysInMonth:n(2807),getDaysInYear:n(4789),getHours:n(7921),getISODay:n(6373),getISOWeek:n(6563),getISOWeeksInYear:n(7098),getISOYear:n(2385),getMilliseconds:n(8597),getMinutes:n(3362),getMonth:n(3503),getOverlappingDaysInRanges:n(5541),getQuarter:n(21),getSeconds:n(8780),getTime:n(2482),getYear:n(8194),isAfter:n(2849),isBefore:n(7754),isDate:n(4286),isEqual:n(9601),isFirstDayOfMonth:n(1364),isFriday:n(2350),isFuture:n(9593),isLastDayOfMonth:n(4399),isLeapYear:n(1164),isMonday:n(126),isPast:n(798),isSameDay:n(4801),isSameHour:n(3344),isSameISOWeek:n(8029),isSameISOYear:n(7877),isSameMinute:n(4465),isSameMonth:n(248),isSameQuarter:n(5347),isSameSecond:n(1742),isSameWeek:n(4868),isSameYear:n(2130),isSaturday:n(2687),isSunday:n(2978),isThisHour:n(1587),isThisISOWeek:n(657),isThisISOYear:n(6106),isThisMinute:n(7980),isThisMonth:n(2767),isThisQuarter:n(1687),isThisSecond:n(7391),isThisWeek:n(147),isThisYear:n(576),isThursday:n(7999),isToday:n(5886),isTomorrow:n(7962),isTuesday:n(6330),isValid:n(623),isWednesday:n(5999),isWeekend:n(7455),isWithinRange:n(6254),isYesterday:n(9099),lastDayOfISOWeek:n(1944),lastDayOfISOYear:n(9312),lastDayOfMonth:n(4949),lastDayOfQuarter:n(3146),lastDayOfWeek:n(106),lastDayOfYear:n(2674),max:n(1489),min:n(3185),parse:n(1884),setDate:n(6130),setDay:n(1110),setDayOfYear:n(1418),setHours:n(6574),setISODay:n(8212),setISOWeek:n(570),setISOYear:n(1138),setMilliseconds:n(3934),setMinutes:n(4809),setMonth:n(6059),setQuarter:n(4059),setSeconds:n(1670),setYear:n(3821),startOfDay:n(6579),startOfHour:n(555),startOfISOWeek:n(1971),startOfISOYear:n(3892),startOfMinute:n(5580),startOfMonth:n(5130),startOfQuarter:n(9309),startOfSecond:n(9966),startOfToday:n(9978),startOfTomorrow:n(7743),startOfWeek:n(5344),startOfYear:n(9834),startOfYesterday:n(6441),subDays:n(5627),subHours:n(7413),subISOYears:n(9883),subMilliseconds:n(8502),subMinutes:n(3350),subMonths:n(1141),subQuarters:n(6607),subSeconds:n(9256),subWeeks:n(9862),subYears:n(8524)}},2849:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=r(t);return n.getTime()>i.getTime()}},7754:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=r(t);return n.getTime()<i.getTime()}},4286:e=>{e.exports=function(e){return e instanceof Date}},9601:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=r(t);return n.getTime()===i.getTime()}},1364:(e,t,n)=>{var r=n(1884);e.exports=function(e){return 1===r(e).getDate()}},2350:(e,t,n)=>{var r=n(1884);e.exports=function(e){return 5===r(e).getDay()}},9593:(e,t,n)=>{var r=n(1884);e.exports=function(e){return r(e).getTime()>(new Date).getTime()}},4399:(e,t,n)=>{var r=n(1884),i=n(549),o=n(9356);e.exports=function(e){var t=r(e);return i(t).getTime()===o(t).getTime()}},1164:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e).getFullYear();return t%400==0||t%4==0&&t%100!=0}},126:(e,t,n)=>{var r=n(1884);e.exports=function(e){return 1===r(e).getDay()}},798:(e,t,n)=>{var r=n(1884);e.exports=function(e){return r(e).getTime()<(new Date).getTime()}},4801:(e,t,n)=>{var r=n(6579);e.exports=function(e,t){var n=r(e),i=r(t);return n.getTime()===i.getTime()}},3344:(e,t,n)=>{var r=n(555);e.exports=function(e,t){var n=r(e),i=r(t);return n.getTime()===i.getTime()}},8029:(e,t,n)=>{var r=n(4868);e.exports=function(e,t){return r(e,t,{weekStartsOn:1})}},7877:(e,t,n)=>{var r=n(3892);e.exports=function(e,t){var n=r(e),i=r(t);return n.getTime()===i.getTime()}},4465:(e,t,n)=>{var r=n(5580);e.exports=function(e,t){var n=r(e),i=r(t);return n.getTime()===i.getTime()}},248:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=r(t);return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()}},5347:(e,t,n)=>{var r=n(9309);e.exports=function(e,t){var n=r(e),i=r(t);return n.getTime()===i.getTime()}},1742:(e,t,n)=>{var r=n(9966);e.exports=function(e,t){var n=r(e),i=r(t);return n.getTime()===i.getTime()}},4868:(e,t,n)=>{var r=n(5344);e.exports=function(e,t,n){var i=r(e,n),o=r(t,n);return i.getTime()===o.getTime()}},2130:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=r(t);return n.getFullYear()===i.getFullYear()}},2687:(e,t,n)=>{var r=n(1884);e.exports=function(e){return 6===r(e).getDay()}},2978:(e,t,n)=>{var r=n(1884);e.exports=function(e){return 0===r(e).getDay()}},1587:(e,t,n)=>{var r=n(3344);e.exports=function(e){return r(new Date,e)}},657:(e,t,n)=>{var r=n(8029);e.exports=function(e){return r(new Date,e)}},6106:(e,t,n)=>{var r=n(7877);e.exports=function(e){return r(new Date,e)}},7980:(e,t,n)=>{var r=n(4465);e.exports=function(e){return r(new Date,e)}},2767:(e,t,n)=>{var r=n(248);e.exports=function(e){return r(new Date,e)}},1687:(e,t,n)=>{var r=n(5347);e.exports=function(e){return r(new Date,e)}},7391:(e,t,n)=>{var r=n(1742);e.exports=function(e){return r(new Date,e)}},147:(e,t,n)=>{var r=n(4868);e.exports=function(e,t){return r(new Date,e,t)}},576:(e,t,n)=>{var r=n(2130);e.exports=function(e){return r(new Date,e)}},7999:(e,t,n)=>{var r=n(1884);e.exports=function(e){return 4===r(e).getDay()}},5886:(e,t,n)=>{var r=n(6579);e.exports=function(e){return r(e).getTime()===r(new Date).getTime()}},7962:(e,t,n)=>{var r=n(6579);e.exports=function(e){var t=new Date;return t.setDate(t.getDate()+1),r(e).getTime()===r(t).getTime()}},6330:(e,t,n)=>{var r=n(1884);e.exports=function(e){return 2===r(e).getDay()}},623:(e,t,n)=>{var r=n(4286);e.exports=function(e){if(r(e))return!isNaN(e);throw new TypeError(toString.call(e)+" is not an instance of Date")}},5999:(e,t,n)=>{var r=n(1884);e.exports=function(e){return 3===r(e).getDay()}},7455:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e).getDay();return 0===t||6===t}},6254:(e,t,n)=>{var r=n(1884);e.exports=function(e,t,n){var i=r(e).getTime(),o=r(t).getTime(),a=r(n).getTime();if(o>a)throw new Error("The start of the range cannot be after the end of the range");return i>=o&&i<=a}},9099:(e,t,n)=>{var r=n(6579);e.exports=function(e){var t=new Date;return t.setDate(t.getDate()-1),r(e).getTime()===r(t).getTime()}},1944:(e,t,n)=>{var r=n(106);e.exports=function(e){return r(e,{weekStartsOn:1})}},9312:(e,t,n)=>{var r=n(2385),i=n(1971);e.exports=function(e){var t=r(e),n=new Date(0);n.setFullYear(t+1,0,4),n.setHours(0,0,0,0);var o=i(n);return o.setDate(o.getDate()-1),o}},4949:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}},3146:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e),n=t.getMonth(),i=n-n%3+3;return t.setMonth(i,0),t.setHours(0,0,0,0),t}},106:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=t&&Number(t.weekStartsOn)||0,i=r(e),o=i.getDay(),a=6+(o<n?-7:0)-(o-n);return i.setHours(0,0,0,0),i.setDate(i.getDate()+a),i}},2674:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e),n=t.getFullYear();return t.setFullYear(n+1,0,0),t.setHours(0,0,0,0),t}},8854:e=>{var t=["M","MM","Q","D","DD","DDD","DDDD","d","E","W","WW","YY","YYYY","GG","GGGG","H","HH","h","hh","m","mm","s","ss","S","SS","SSS","Z","ZZ","X","x"];e.exports=function(e){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(r);var i=t.concat(n).sort().reverse();return new RegExp("(\\[[^\\[]*\\])|(\\\\)?("+i.join("|")+"|.)","g")}},2894:e=>{e.exports=function(){var e={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};return{localize:function(t,n,r){var i;return r=r||{},i="string"==typeof e[t]?e[t]:1===n?e[t].one:e[t].other.replace("{{count}}",n),r.addSuffix?r.comparison>0?"in "+i:i+" ago":i}}}},664:(e,t,n)=>{var r=n(8854);e.exports=function(){var e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],t=["January","February","March","April","May","June","July","August","September","October","November","December"],n=["Su","Mo","Tu","We","Th","Fr","Sa"],i=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],a=["AM","PM"],s=["am","pm"],c=["a.m.","p.m."],l={MMM:function(t){return e[t.getMonth()]},MMMM:function(e){return t[e.getMonth()]},dd:function(e){return n[e.getDay()]},ddd:function(e){return i[e.getDay()]},dddd:function(e){return o[e.getDay()]},A:function(e){return e.getHours()/12>=1?a[1]:a[0]},a:function(e){return e.getHours()/12>=1?s[1]:s[0]},aa:function(e){return e.getHours()/12>=1?c[1]:c[0]}};return["M","D","DDD","d","Q","W"].forEach((function(e){l[e+"o"]=function(t,n){return function(e){var t=e%100;if(t>20||t<10)switch(t%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"}(n[e](t))}})),{formatters:l,formattingTokensRegExp:r(l)}}},7479:(e,t,n)=>{var r=n(2894),i=n(664);e.exports={distanceInWords:r(),format:i()}},1489:(e,t,n)=>{var r=n(1884);e.exports=function(){var e=Array.prototype.slice.call(arguments).map((function(e){return r(e)})),t=Math.max.apply(null,e);return new Date(t)}},3185:(e,t,n)=>{var r=n(1884);e.exports=function(){var e=Array.prototype.slice.call(arguments).map((function(e){return r(e)})),t=Math.min.apply(null,e);return new Date(t)}},1884:(e,t,n)=>{var r=n(3561),i=n(4286),o=36e5,a=6e4,s=/[T ]/,c=/:/,l=/^(\d{2})$/,d=[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],u=/^(\d{4})/,p=[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],h=/^-(\d{2})$/,m=/^-?(\d{3})$/,g=/^-?(\d{2})-?(\d{2})$/,v=/^-?W(\d{2})$/,f=/^-?W(\d{2})-?(\d{1})$/,b=/^(\d{2}([.,]\d*)?)$/,y=/^(\d{2}):?(\d{2}([.,]\d*)?)$/,S=/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,w=/([Z+-].*)$/,k=/^(Z)$/,C=/^([+-])(\d{2})$/,x=/^([+-])(\d{2}):?(\d{2})$/;function I(e,t,n){t=t||0,n=n||0;var r=new Date(0);r.setUTCFullYear(e,0,4);var i=7*t+n+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+i),r}e.exports=function(e,t){if(i(e))return new Date(e.getTime());if("string"!=typeof e)return new Date(e);var n=(t||{}).additionalDigits;n=null==n?2:Number(n);var O=function(e){var t,n={},r=e.split(s);c.test(r[0])?(n.date=null,t=r[0]):(n.date=r[0],t=r[1]);if(t){var i=w.exec(t);i?(n.time=t.replace(i[1],""),n.timezone=i[1]):n.time=t}return n}(e),_=function(e,t){var n,r=d[t],i=p[t];if(n=u.exec(e)||i.exec(e)){var o=n[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(n=l.exec(e)||r.exec(e)){var a=n[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}(O.date,n),T=_.year,D=function(e,t){if(null===t)return null;var n,r,i;if(0===e.length)return(r=new Date(0)).setUTCFullYear(t),r;if(n=h.exec(e))return r=new Date(0),i=parseInt(n[1],10)-1,r.setUTCFullYear(t,i),r;if(n=m.exec(e)){r=new Date(0);var o=parseInt(n[1],10);return r.setUTCFullYear(t,0,o),r}if(n=g.exec(e)){r=new Date(0),i=parseInt(n[1],10)-1;var a=parseInt(n[2],10);return r.setUTCFullYear(t,i,a),r}if(n=v.exec(e))return I(t,parseInt(n[1],10)-1);if(n=f.exec(e)){return I(t,parseInt(n[1],10)-1,parseInt(n[2],10)-1)}return null}(_.restDateString,T);if(D){var j,M=D.getTime(),A=0;if(O.time&&(A=function(e){var t,n,r;if(t=b.exec(e))return(n=parseFloat(t[1].replace(",",".")))%24*o;if(t=y.exec(e))return n=parseInt(t[1],10),r=parseFloat(t[2].replace(",",".")),n%24*o+r*a;if(t=S.exec(e)){n=parseInt(t[1],10),r=parseInt(t[2],10);var i=parseFloat(t[3].replace(",","."));return n%24*o+r*a+1e3*i}return null}(O.time)),O.timezone)j=function(e){var t,n;if(t=k.exec(e))return 0;if(t=C.exec(e))return n=60*parseInt(t[2],10),"+"===t[1]?-n:n;if(t=x.exec(e))return n=60*parseInt(t[2],10)+parseInt(t[3],10),"+"===t[1]?-n:n;return 0}(O.timezone)*a;else{var F=M+A,E=new Date(F);j=r(E);var P=new Date(F);P.setDate(E.getDate()+1);var H=r(P)-r(E);H>0&&(j+=H)}return new Date(M+A+j)}return new Date(e)}},6130:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=Number(t);return n.setDate(i),n}},1110:(e,t,n)=>{var r=n(1884),i=n(4844);e.exports=function(e,t,n){var o=n&&Number(n.weekStartsOn)||0,a=r(e),s=Number(t),c=a.getDay();return i(a,((s%7+7)%7<o?7:0)+s-c)}},1418:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=Number(t);return n.setMonth(0),n.setDate(i),n}},6574:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=Number(t);return n.setHours(i),n}},8212:(e,t,n)=>{var r=n(1884),i=n(4844),o=n(6373);e.exports=function(e,t){var n=r(e),a=Number(t),s=o(n);return i(n,a-s)}},570:(e,t,n)=>{var r=n(1884),i=n(6563);e.exports=function(e,t){var n=r(e),o=Number(t),a=i(n)-o;return n.setDate(n.getDate()-7*a),n}},1138:(e,t,n)=>{var r=n(1884),i=n(3892),o=n(6656);e.exports=function(e,t){var n=r(e),a=Number(t),s=o(n,i(n)),c=new Date(0);return c.setFullYear(a,0,4),c.setHours(0,0,0,0),(n=i(c)).setDate(n.getDate()+s),n}},3934:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=Number(t);return n.setMilliseconds(i),n}},4809:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=Number(t);return n.setMinutes(i),n}},6059:(e,t,n)=>{var r=n(1884),i=n(2807);e.exports=function(e,t){var n=r(e),o=Number(t),a=n.getFullYear(),s=n.getDate(),c=new Date(0);c.setFullYear(a,o,15),c.setHours(0,0,0,0);var l=i(c);return n.setMonth(o,Math.min(s,l)),n}},4059:(e,t,n)=>{var r=n(1884),i=n(6059);e.exports=function(e,t){var n=r(e),o=Number(t)-(Math.floor(n.getMonth()/3)+1);return i(n,n.getMonth()+3*o)}},1670:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=Number(t);return n.setSeconds(i),n}},3821:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=r(e),i=Number(t);return n.setFullYear(i),n}},6579:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e);return t.setHours(0,0,0,0),t}},555:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e);return t.setMinutes(0,0,0),t}},1971:(e,t,n)=>{var r=n(5344);e.exports=function(e){return r(e,{weekStartsOn:1})}},3892:(e,t,n)=>{var r=n(2385),i=n(1971);e.exports=function(e){var t=r(e),n=new Date(0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),i(n)}},5580:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e);return t.setSeconds(0,0),t}},5130:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e);return t.setDate(1),t.setHours(0,0,0,0),t}},9309:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e),n=t.getMonth(),i=n-n%3;return t.setMonth(i,1),t.setHours(0,0,0,0),t}},9966:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e);return t.setMilliseconds(0),t}},9978:(e,t,n)=>{var r=n(6579);e.exports=function(){return r(new Date)}},7743:e=>{e.exports=function(){var e=new Date,t=e.getFullYear(),n=e.getMonth(),r=e.getDate(),i=new Date(0);return i.setFullYear(t,n,r+1),i.setHours(0,0,0,0),i}},5344:(e,t,n)=>{var r=n(1884);e.exports=function(e,t){var n=t&&Number(t.weekStartsOn)||0,i=r(e),o=i.getDay(),a=(o<n?7:0)+o-n;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}},9834:(e,t,n)=>{var r=n(1884);e.exports=function(e){var t=r(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}},6441:e=>{e.exports=function(){var e=new Date,t=e.getFullYear(),n=e.getMonth(),r=e.getDate(),i=new Date(0);return i.setFullYear(t,n,r-1),i.setHours(0,0,0,0),i}},5627:(e,t,n)=>{var r=n(4844);e.exports=function(e,t){var n=Number(t);return r(e,-n)}},7413:(e,t,n)=>{var r=n(2680);e.exports=function(e,t){var n=Number(t);return r(e,-n)}},9883:(e,t,n)=>{var r=n(7538);e.exports=function(e,t){var n=Number(t);return r(e,-n)}},8502:(e,t,n)=>{var r=n(2951);e.exports=function(e,t){var n=Number(t);return r(e,-n)}},3350:(e,t,n)=>{var r=n(1318);e.exports=function(e,t){var n=Number(t);return r(e,-n)}},1141:(e,t,n)=>{var r=n(9331);e.exports=function(e,t){var n=Number(t);return r(e,-n)}},6607:(e,t,n)=>{var r=n(1482);e.exports=function(e,t){var n=Number(t);return r(e,-n)}},9256:(e,t,n)=>{var r=n(9723);e.exports=function(e,t){var n=Number(t);return r(e,-n)}},9862:(e,t,n)=>{var r=n(5932);e.exports=function(e,t){var n=Number(t);return r(e,-n)}},8524:(e,t,n)=>{var r=n(6083);e.exports=function(e,t){var n=Number(t);return r(e,-n)}},6400:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Component:()=>S,Fragment:()=>y,_unmount:()=>E,cloneElement:()=>L,createContext:()=>W,createElement:()=>v,createRef:()=>b,h:()=>v,hydrate:()=>R,isValidElement:()=>i,options:()=>r,render:()=>H,toChildArray:()=>O});var r,i,o,a,s,c,l,d,u={},p=[],h=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function m(e,t){for(var n in t)e[n]=t[n];return e}function g(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n){var r,i=arguments,o={};for(r in t)"key"!==r&&"ref"!==r&&(o[r]=t[r]);if(arguments.length>3)for(n=[n],r=3;r<arguments.length;r++)n.push(i[r]);if(null!=n&&(o.children=n),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===o[r]&&(o[r]=e.defaultProps[r]);return f(e,o,t&&t.key,t&&t.ref,null)}function f(e,t,n,i,o){var a={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o};return null==o&&(a.__v=a),r.vnode&&r.vnode(a),a}function b(){return{}}function y(e){return e.children}function S(e,t){this.props=e,this.context=t}function w(e,t){if(null==t)return e.__?w(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?w(e):null}function k(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return k(e)}}function C(e){(!e.__d&&(e.__d=!0)&&o.push(e)&&!a++||c!==r.debounceRendering)&&((c=r.debounceRendering)||s)(x)}function x(){for(var e;a=o.length;)e=o.sort((function(e,t){return e.__v.__b-t.__v.__b})),o=[],e.some((function(e){var t,n,r,i,o,a,s;e.__d&&(a=(o=(t=e).__v).__e,(s=t.__P)&&(n=[],(r=m({},o)).__v=r,i=j(s,o,r,t.__n,void 0!==s.ownerSVGElement,null,n,null==a?w(o):a),M(n,o),i!=a&&k(o)))}))}function I(e,t,n,r,i,o,a,s,c){var l,d,h,m,v,f,b,y=n&&n.__k||p,S=y.length;if(s==u&&(s=null!=o?o[0]:S?w(n,0):null),l=0,t.__k=O(t.__k,(function(n){if(null!=n){if(n.__=t,n.__b=t.__b+1,null===(h=y[l])||h&&n.key==h.key&&n.type===h.type)y[l]=void 0;else for(d=0;d<S;d++){if((h=y[d])&&n.key==h.key&&n.type===h.type){y[d]=void 0;break}h=null}if(m=j(e,n,h=h||u,r,i,o,a,s,c),(d=n.ref)&&h.ref!=d&&(b||(b=[]),h.ref&&b.push(h.ref,null,n),b.push(d,n.__c||m,n)),null!=m){var p;if(null==f&&(f=m),void 0!==n.__d)p=n.__d,n.__d=void 0;else if(o==h||m!=s||null==m.parentNode){e:if(null==s||s.parentNode!==e)e.appendChild(m),p=null;else{for(v=s,d=0;(v=v.nextSibling)&&d<S;d+=2)if(v==m)break e;e.insertBefore(m,s),p=s}"option"==t.type&&(e.value="")}s=void 0!==p?p:m.nextSibling,"function"==typeof t.type&&(t.__d=s)}else s&&h.__e==s&&s.parentNode!=e&&(s=w(h))}return l++,n})),t.__e=f,null!=o&&"function"!=typeof t.type)for(l=o.length;l--;)null!=o[l]&&g(o[l]);for(l=S;l--;)null!=y[l]&&E(y[l],y[l]);if(b)for(l=0;l<b.length;l++)F(b[l],b[++l],b[++l])}function O(e,t,n){if(null==n&&(n=[]),null==e||"boolean"==typeof e)t&&n.push(t(null));else if(Array.isArray(e))for(var r=0;r<e.length;r++)O(e[r],t,n);else n.push(t?t("string"==typeof e||"number"==typeof e?f(null,e,null,null,e):null!=e.__e||null!=e.__c?f(e.type,e.props,e.key,null,e.__v):e):e);return n}function _(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]="number"==typeof n&&!1===h.test(t)?n+"px":null==n?"":n}function T(e,t,n,r,i){var o,a,s,c,l;if(i?"className"===t&&(t="class"):"class"===t&&(t="className"),"style"===t)if(o=e.style,"string"==typeof n)o.cssText=n;else{if("string"==typeof r&&(o.cssText="",r=null),r)for(c in r)n&&c in n||_(o,c,"");if(n)for(l in n)r&&n[l]===r[l]||_(o,l,n[l])}else"o"===t[0]&&"n"===t[1]?(a=t!==(t=t.replace(/Capture$/,"")),s=t.toLowerCase(),t=(s in e?s:t).slice(2),n?(r||e.addEventListener(t,D,a),(e.l||(e.l={}))[t]=n):e.removeEventListener(t,D,a)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&!i&&t in e?e[t]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/^xlink:?/,""))?null==n||!1===n?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):null==n||!1===n&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,n))}function D(e){this.l[e.type](r.event?r.event(e):e)}function j(e,t,n,i,o,a,s,c,l){var d,u,p,h,g,v,f,b,w,k,C=t.type;if(void 0!==t.constructor)return null;(d=r.__b)&&d(t);try{e:if("function"==typeof C){if(b=t.props,w=(d=C.contextType)&&i[d.__c],k=d?w?w.props.value:d.__:i,n.__c?f=(u=t.__c=n.__c).__=u.__E:("prototype"in C&&C.prototype.render?t.__c=u=new C(b,k):(t.__c=u=new S(b,k),u.constructor=C,u.render=P),w&&w.sub(u),u.props=b,u.state||(u.state={}),u.context=k,u.__n=i,p=u.__d=!0,u.__h=[]),null==u.__s&&(u.__s=u.state),null!=C.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=m({},u.__s)),m(u.__s,C.getDerivedStateFromProps(b,u.__s))),h=u.props,g=u.state,p)null==C.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==C.getDerivedStateFromProps&&b!==h&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(b,k),!u.__e&&null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(b,u.__s,k)||t.__v===n.__v&&!u.__){for(u.props=b,u.state=u.__s,t.__v!==n.__v&&(u.__d=!1),u.__v=t,t.__e=n.__e,t.__k=n.__k,u.__h.length&&s.push(u),d=0;d<t.__k.length;d++)t.__k[d]&&(t.__k[d].__=t);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(b,u.__s,k),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(h,g,v)}))}u.context=k,u.props=b,u.state=u.__s,(d=r.__r)&&d(t),u.__d=!1,u.__v=t,u.__P=e,d=u.render(u.props,u.state,u.context),t.__k=null!=d&&d.type==y&&null==d.key?d.props.children:Array.isArray(d)?d:[d],null!=u.getChildContext&&(i=m(m({},i),u.getChildContext())),p||null==u.getSnapshotBeforeUpdate||(v=u.getSnapshotBeforeUpdate(h,g)),I(e,t,n,i,o,a,s,c,l),u.base=t.__e,u.__h.length&&s.push(u),f&&(u.__E=u.__=null),u.__e=!1}else null==a&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=A(n.__e,t,n,i,o,a,s,l);(d=r.diffed)&&d(t)}catch(e){t.__v=null,r.__e(e,t,n)}return t.__e}function M(e,t){r.__c&&r.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){r.__e(e,t.__v)}}))}function A(e,t,n,r,i,o,a,s){var c,l,d,h,m,g=n.props,v=t.props;if(i="svg"===t.type||i,null!=o)for(c=0;c<o.length;c++)if(null!=(l=o[c])&&((null===t.type?3===l.nodeType:l.localName===t.type)||e==l)){e=l,o[c]=null;break}if(null==e){if(null===t.type)return document.createTextNode(v);e=i?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,v.is&&{is:v.is}),o=null,s=!1}if(null===t.type)g!==v&&e.data!=v&&(e.data=v);else{if(null!=o&&(o=p.slice.call(e.childNodes)),d=(g=n.props||u).dangerouslySetInnerHTML,h=v.dangerouslySetInnerHTML,!s){if(g===u)for(g={},m=0;m<e.attributes.length;m++)g[e.attributes[m].name]=e.attributes[m].value;(h||d)&&(h&&d&&h.__html==d.__html||(e.innerHTML=h&&h.__html||""))}(function(e,t,n,r,i){var o;for(o in n)"children"===o||"key"===o||o in t||T(e,o,null,n[o],r);for(o in t)i&&"function"!=typeof t[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===t[o]||T(e,o,t[o],n[o],r)})(e,v,g,i,s),h?t.__k=[]:(t.__k=t.props.children,I(e,t,n,r,"foreignObject"!==t.type&&i,o,a,u,s)),s||("value"in v&&void 0!==(c=v.value)&&c!==e.value&&T(e,"value",c,g.value,!1),"checked"in v&&void 0!==(c=v.checked)&&c!==e.checked&&T(e,"checked",c,g.checked,!1))}return e}function F(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){r.__e(e,n)}}function E(e,t,n){var i,o,a;if(r.unmount&&r.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||F(i,null,t)),n||"function"==typeof e.type||(n=null!=(o=e.__e)),e.__e=e.__d=void 0,null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){r.__e(e,t)}i.base=i.__P=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&E(i[a],t,n);null!=o&&g(o)}function P(e,t,n){return this.constructor(e,n)}function H(e,t,n){var i,o,a;r.__&&r.__(e,t),o=(i=n===l)?null:n&&n.__k||t.__k,e=v(y,null,[e]),a=[],j(t,(i?t:n||t).__k=e,o||u,u,void 0!==t.ownerSVGElement,n&&!i?[n]:o?null:p.slice.call(t.childNodes),a,n||u,i),M(a,e)}function R(e,t){H(e,t,l)}function L(e,t){var n,r;for(r in t=m(m({},e.props),t),arguments.length>2&&(t.children=p.slice.call(arguments,2)),n={},t)"key"!==r&&"ref"!==r&&(n[r]=t[r]);return f(e.type,n,t.key||e.key,t.ref||e.ref,null)}function W(e){var t={},n={__c:"__cC"+d++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var r,i=this;return this.getChildContext||(r=[],this.getChildContext=function(){return t[n.__c]=i,t},this.shouldComponentUpdate=function(e){i.props.value!==e.value&&r.some((function(t){t.context=e.value,C(t)}))},this.sub=function(e){r.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r.splice(r.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Consumer.contextType=n,n.Provider.__=n,n}r={__e:function(e,t){for(var n,r;t=t.__;)if((n=t.__c)&&!n.__)try{if(n.constructor&&null!=n.constructor.getDerivedStateFromError&&(r=!0,n.setState(n.constructor.getDerivedStateFromError(e))),null!=n.componentDidCatch&&(r=!0,n.componentDidCatch(e)),r)return C(n.__E=n)}catch(t){e=t}throw e}},i=function(e){return null!=e&&void 0===e.constructor},S.prototype.setState=function(e,t){var n;n=this.__s!==this.state?this.__s:this.__s=m({},this.state),"function"==typeof e&&(e=e(n,this.props)),e&&m(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),C(this))},S.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),C(this))},S.prototype.render=y,o=[],a=0,s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,l=u,d=0},4798:e=>{"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};e.exports=function(e,n){void 0===e&&(e={}),void 0===n&&(n=null);var r=e||{},i=[];function o(){i.forEach((function(e){return e(r)}))}return{middleware:n,setState:function(e){r=t({},r,"function"==typeof e?e(r):e),o()},subscribe:function(e){return i.push(e),function(){i.splice(i.indexOf(e),1)}},getState:function(){return r},reset:function(){r=e,o()}}}},1042:(e,t)=>{"use strict";function n(e,t){if(null!=t){if(t.then)return t.then(e.setState);e.setState(t)}}t.m=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reverse(),function(t,r,i){if(e.length<1)return n(t,r.apply(void 0,[t.getState()].concat(i)));var o=e.map((function(e){return e(t)})).reduce((function(e,t){return t(e,i)}),function(e,t){return function(r){return n(e,r.apply(void 0,[e.getState()].concat(t)))}}(t,i));return o(r)}}},5576:(e,t,n)=>{"use strict";var r=n(6400),i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},i(e,t)};function o(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.apply(this,arguments)};function s(e,t){for(var n in e)if(e[n]!==t[n])return!1;for(var n in t)if(!(n in e))return!1;return!0}function c(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return"function"==typeof t.middleware?t.middleware(t,e,n):function(e,t){if(null!=t){if(t.then)return t.then(e.setState);e.setState(t)}}(t,e.apply(void 0,[t.getState()].concat(n)))}}var l=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.update=function(){var e=r.getProps(r.props,r.context);s(e,r.state)||r.setState(e)},r.state=r.getProps(t,n),r.actions=r.getActions(),r}return o(t,e),t.prototype.componentWillMount=function(){this.unsubscribe=this.context.store.subscribe(this.update)},t.prototype.componentWillUnmount=function(){this.unsubscribe(this.update)},t.prototype.componentWillReceiveProps=function(e,t){var n=this.getProps(e,t);s(n,this.state)||this.setState(n)},t.prototype.getProps=function(e,t){var n=e.mapToProps,r=t.store&&t.store.getState()||{};return n?n(r,e):r},t.prototype.getActions=function(){return function(e,t,n){e="function"==typeof e?e(t,n):e;var r={};for(var i in e){var o=e[i];r[i]=c(o,t)}return r}(this.props.actions,this.context.store,this.props)},t.prototype.render=function(e,t,n){var r=e.children,i=n.store;return(r&&r[0]||r)(a({store:i},t,this.actions))},t}(r.Component),d=l;(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}o(t,e),t.prototype.getChildContext=function(){return{store:this.props.store}},t.prototype.render=function(){return this.props.children&&this.props.children[0]||this.props.children}})(r.Component),t.lj=l},7867:(e,t)=>{"use strict";function n(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return"function"==typeof t.middleware?t.middleware(t,e,n):function(e,t){if(null!=t){if(t.then)return t.then(e.setState);e.setState(t)}}(t,e.apply(void 0,[t.getState()].concat(n)))}}var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};t.kv=function(e,t,r){e="function"==typeof e?e(t,r):e;var i={};for(var o in e){var a=e[o];i[o]=n(a,t)}return i},t.Y2=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.reduce((function(e,n){return r({},e,"function"==typeof n?n.apply(void 0,t):n)}),{})}}},5373:(e,t,n)=>{var r=n(4630);r&&r.__esModule&&(r=r.default),e.exports="string"==typeof r?r:r.toString()},5877:(e,t,n)=>{var r=n(3570),i=n(1171),o=i;o.v1=r,o.v4=i,e.exports=o},5327:e=>{for(var t=[],n=0;n<256;++n)t[n]=(n+256).toString(16).substr(1);e.exports=function(e,n){var r=n||0,i=t;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},5217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var n=new Uint8Array(16);e.exports=function(){return t(n),n}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}},3570:(e,t,n)=>{var r,i,o=n(5217),a=n(5327),s=0,c=0;e.exports=function(e,t,n){var l=t&&n||0,d=t||[],u=(e=e||{}).node||r,p=void 0!==e.clockseq?e.clockseq:i;if(null==u||null==p){var h=o();null==u&&(u=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==p&&(p=i=16383&(h[6]<<8|h[7]))}var m=void 0!==e.msecs?e.msecs:(new Date).getTime(),g=void 0!==e.nsecs?e.nsecs:c+1,v=m-s+(g-c)/1e4;if(v<0&&void 0===e.clockseq&&(p=p+1&16383),(v<0||m>s)&&void 0===e.nsecs&&(g=0),g>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=m,c=g,i=p;var f=(1e4*(268435455&(m+=122192928e5))+g)%4294967296;d[l++]=f>>>24&255,d[l++]=f>>>16&255,d[l++]=f>>>8&255,d[l++]=255&f;var b=m/4294967296*1e4&268435455;d[l++]=b>>>8&255,d[l++]=255&b,d[l++]=b>>>24&15|16,d[l++]=b>>>16&255,d[l++]=p>>>8|128,d[l++]=255&p;for(var y=0;y<6;++y)d[l+y]=u[y];return t||a(d)}},1171:(e,t,n)=>{var r=n(5217),i=n(5327);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var s=0;s<16;++s)t[o+s]=a[s];return t||i(a)}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.d(r,{default:()=>ii});n(1181);const e=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;let r=new CustomEvent(e,{bubbles:!1,cancelable:!1,detail:t});n.dispatchEvent(r)};var t=n(5877),i=n(7867);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let a;!function(e){e[e.DISABLED=0]="DISABLED",e[e.TRANSACTIONS=1]="TRANSACTIONS",e[e.PAYLOAD=2]="PAYLOAD",e[e.FULL_DETAIL=3]="FULL_DETAIL"}(a||(a={}));class s{static debug(e){s.logLevel!==a.DISABLED&&(e.level1||e.level2||e.level3)&&console.log(...this.constructLogPayload(e))}static warn(e){s.logLevel!==a.DISABLED&&(e.level1||e.level2||e.level3)&&console.warn(...this.constructLogPayload(e))}static error(e){s.logLevel!==a.DISABLED&&(e.level1||e.level2||e.level3)&&console.error(...this.constructLogPayload(e))}}o(s,"logLevel",a.DISABLED),o(s,"constructLogPayload",(e=>{const t=["AtomicSDK Web -"];return s.logLevel>=a.TRANSACTIONS&&e.level1&&t.push(...e.level1),s.logLevel>=a.PAYLOAD&&e.level2&&t.push(...e.level2),s.logLevel>=a.FULL_DETAIL&&e.level3&&t.push(...e.level3),t}));const c="io.atomic.events.sdkLogout",l="io.atomic.events.cardFeedUpdateReceived",d="io.atomic.events.pollingFallbackEnabled",u="io.atomic.events.pollingFallbackDisabled",p="io.atomic.events.socketAuthenticationError",h="io.atomic.events.streamFilterApplied",m="sdkInitialisation",g="displayedCards",v=()=>{const e=document.querySelector("script#atomic-frame-manager"),t=e?e.src:null;if(!t)return null;const n=new URL(t),r=n.protocol.toLowerCase();return("http:"===r||"https:"===r)&&"localhost"!==n.hostname?null:t};var f=n(7292);const b="custom-ping",y="auth",S="subscribe",w="unsubscribe",k="events",C="custom-pong",x="auth-success",I="token-expiry",O="update-cards",_="events-processed",T="error",D="invalid-token",j="expired-token",M="invalid-stream-container-id",A="invalid-filter",F="invalid-message";var E=n(4798),P=n.n(E),H=n(1042);const R={application:{open:!1,windowOrigin:null,streamContainerId:"",isPreview:!1,cardListRefreshInterval:15e3,runtimeVariableResolutionTimeout:5e3,embedMode:"launcher",customStrings:{},firstLoadStyles:{backgroundColor:"#FFFFFF",textColor:"rgba(0,0,0,0.5)",loadingSpinnerColor:"#000000",buttonTextColor:"#000000"},enabledUiElements:{cardListToast:!0,customToastContainer:!1,cardListHeader:!0},interfaceStyle:"automatic"},cardFeed:{lastModified:"",cardInstances:[],runtimeVariables:{},runtimeVariableAnalyticsEnabled:!1,tutorialSeen:!0,status:{loaded:!1}},navigationStack:{items:[]},cardResponses:{},validationStates:{},theme:{},cardStates:{},messages:{lastMessageId:"0"}};let L;const W=()=>{if(!L)throw new Error("You must initialise the store before accessing it.");return L};var N,V,Y,$=n(6400),q=0,z=[],U=$.options.__r,B=$.options.diffed,K=$.options.__c,Q=$.options.unmount;function G(e,t){$.options.__h&&$.options.__h(V,e,q||t),q=0;var n=V.__H||(V.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function J(e){return q=1,X(le,e)}function X(e,t,n){var r=G(N++,2);return r.__c||(r.__c=V,r.__=[n?n(t):le(void 0,t),function(t){var n=e(r.__[0],t);r.__[0]!==n&&(r.__[0]=n,r.__c.setState({}))}]),r.__}function Z(e,t){var n=G(N++,3);!$.options.__s&&ce(n.__H,t)&&(n.__=e,n.__H=t,V.__H.__h.push(n))}function ee(e,t){var n=G(N++,4);!$.options.__s&&ce(n.__H,t)&&(n.__=e,n.__H=t,V.__h.push(n))}function te(e){return q=5,re((function(){return{current:e}}),[])}function ne(e,t,n){q=6,ee((function(){"function"==typeof e?e(t()):e&&(e.current=t())}),null==n?n:n.concat(e))}function re(e,t){var n=G(N++,7);return ce(n.__H,t)?(n.__H=t,n.__h=e,n.__=e()):n.__}function ie(e){var t=V.context[e.__c],n=G(N++,9);return n.__c=e,t?(null==n.__&&(n.__=!0,t.sub(V)),t.props.value):e.__}function oe(){z.some((function(e){if(e.__P)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){return e.__H.__h=[],$.options.__e(t,e.__v),!0}})),z=[]}function ae(e){e.t&&e.t()}function se(e){var t=e.__();"function"==typeof t&&(e.t=t)}function ce(e,t){return!e||t.some((function(t,n){return t!==e[n]}))}function le(e,t){return"function"==typeof t?t(e):t}$.options.__r=function(e){U&&U(e),N=0,(V=e.__c).__H&&(V.__H.__h.forEach(ae),V.__H.__h.forEach(se),V.__H.__h=[])},$.options.diffed=function(e){B&&B(e);var t=e.__c;if(t){var n=t.__H;n&&n.__h.length&&(1!==z.push(t)&&Y===$.options.requestAnimationFrame||((Y=$.options.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);"undefined"!=typeof window&&(t=requestAnimationFrame(n))})(oe))}},$.options.__c=function(e,t){t.some((function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter((function(e){return!e.__||se(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],$.options.__e(n,e.__v)}})),K&&K(e,t)},$.options.unmount=function(e){Q&&Q(e);var t=e.__c;if(t){var n=t.__H;if(n)try{n.__.forEach((function(e){return e.t&&e.t()}))}catch(e){$.options.__e(e,t.__v)}}};var de=n(5576);const ue=(e,t,n)=>{const r=e.cardFeed.cardInstances;if(r){const i=r.find((e=>e.instance.id===t)),o=i&&i.subviews[n];if(i&&o){const t={kind:"subview",cardInstance:i,cardInstanceId:i.instance.id,subviewId:n};return pe(e,t)}}return e};const pe=(e,t)=>{let n=e.navigationStack.items.slice();for(const[e,r]of n.entries())switch(r.cardInstanceId!==t.cardInstanceId&&(n=[]),r.kind){case"subview":case"snooze":case"feedback":r.kind===t.kind&&n.splice(e,1);break;case"media":r.kind===t.kind&&r.item.url===t.item.url&&n.splice(e,1)}return Object.assign(Object.assign({},e),{navigationStack:{items:[...n,t]}})};var he=n(2807),me=n.n(he);const ge=e=>Object.keys(e).filter((t=>e[t])).join(" "),ve=(e,t)=>{const n=((e,t)=>me()(new Date(t,e-1)))(e,t),r=new Date(t,e-1,1).getDay()||7,i=[...Array(n)].map(((n,i)=>({date:new Date(t,e-1,i+1),style:{msGridRow:Math.ceil((r+i)/7),msGridColumn:(r-1+i)%7+1,gridRowStart:Math.ceil((r+i)/7),gridColumnStart:(r-1+i)%7+1}})));return i},fe=(e,t)=>{let{isMax:n,isMin:r}=t;const i=new Date(e);return n?(0,f.endOfDay)((0,f.addMinutes)(i,i.getTimezoneOffset())):r?(0,f.addMinutes)(i,i.getTimezoneOffset()):i};var be=n(5616),ye=n.n(be),Se=n(623),we=n.n(Se);const ke={required:(e,t)=>{const n=e.errorMessage||"This field is required";return e.required&&(null==t||null==t||"string"==typeof t&&0==t.length)?{type:"invalid",errorMessage:n}:{type:"valid"}},minimumDate:(e,t)=>{const n=fe(e.minimumDate,{isMin:!0}),r=e.errorMessage||`Value must be after ${ye()(n,"DD MMM YYYY")}`;if(null==t||null==t)return{type:"invalid",errorMessage:r};const i=new Date(t);return!we()(i)||i<n?{type:"invalid",errorMessage:r}:{type:"valid"}},maximumDate:(e,t)=>{const n=fe(e.maximumDate,{isMax:!0}),r=e.errorMessage||`Value must be before ${ye()(n,"DD MMM YYYY")}`;if(null==t||null==t)return{type:"invalid",errorMessage:r};const i=new Date(t);return!we()(i)||i>n?{type:"invalid",errorMessage:r}:{type:"valid"}},regexp:(e,t)=>{const n=e.errorMessage||"Value does not meet requirements";if(null==t||null==t)return{type:"invalid",errorMessage:n};try{if(!new RegExp(e.regexp).test(t))return{type:"invalid",errorMessage:n}}catch(e){}return{type:"valid"}},minimum:(e,t)=>{const n=e.errorMessage||`Value must be at least ${e.minimum}`;return null==t||null==t||t<e.minimum?{type:"invalid",errorMessage:n}:{type:"valid"}},maximum:(e,t)=>{const n=e.errorMessage||`Value must be no more than ${e.maximum}`;return null==t||null==t||t>e.maximum?{type:"invalid",errorMessage:n}:{type:"valid"}},minimumLength:(e,t)=>{const n=e.errorMessage||(1===e.minimumLength?"Value must be at least 1 character":`Value must be at least ${e.minimumLength} characters`);return null==t||null==t||t.length<e.minimumLength?{type:"invalid",errorMessage:n}:{type:"valid"}},maximumLength:(e,t)=>{const n=e.errorMessage||(1===e.maximumLength?"Value must be no more than 1 character":`Value must be no more than ${e.maximumLength} characters`);return null==t||null==t?{type:"valid"}:t.length>e.maximumLength?{type:"invalid",errorMessage:n}:{type:"valid"}}},Ce=["required","minimumLength","maximumLength","minimum","maximum","minimumDate","maximumDate","regexp"],xe=(e,t)=>{if(!t)return{type:"valid"};for(const n in Ce){const r=Ce[n];if(void 0===t[r])continue;const i=ke[r];if(i){const n=i(t[r].attributes,e);if("invalid"===n.type)return n}}return{type:"valid"}},Ie=()=>({handleImageLinkPress(e,t,n){const r=e.navigationStack.items.length?"subview":"topview",i=Object.assign(Object.assign({},n.currentSubviewId&&{subviewId:n.currentSubviewId}),n.currentSubviewTitle&&{subviewTitle:n.currentSubviewTitle});return n.layoutId?ue(e,t,n.layoutId):n.payload&&!e.application.isPreview?_e(e,"payload","image",t,r,n.payload,i):e},handleLinkButtonPress(e,t,n,r,i){const o=e.navigationStack.items.length?"subview":"topview";return r?ue(e,t,r):i&&!e.application.isPreview?_e(e,"payload","linkButton",t,o,i,n):e},handleSubmitButtonPayload(e,t,n,r){const i=e.navigationStack.items.length?"subview":"topview";return _e(e,"payload","submitButton",t,i,r,n)},openExternalUrl:(e,t,n,r,i,o,a)=>(null==a?void 0:a.url)&&!e.application.isPreview?Te(e,i,o,t,n,a,r):e,handleFormChange:(e,t,n,r,i)=>Oe(e,t,{[n]:r},i),createResponseWithDefaults:(e,t,n,r)=>Oe(e,t,n,r),validateField(e,t,n,r,i,o){var a,s,c,l;let d=xe(r,i);const u=d&&!o?{[n]:d}:{},p=d&&o?{[n]:d}:{},h=e.validationStates,m=null!==(a=null===(c=h[t])||void 0===c?void 0:c.validations)&&void 0!==a?a:{},g=null!==(s=null===(l=h[t])||void 0===l?void 0:l.subviews)&&void 0!==s?s:{};return Object.assign(Object.assign({},e),{validationStates:Object.assign(Object.assign({},h),{[t]:{validations:Object.assign(Object.assign({},m),u),subviews:Object.assign(Object.assign({},g),p&&o?{[o]:Object.assign(Object.assign({},g[o]),p)}:{})}})})},validateCurrentSubview(e,t){const n=(e=>e.navigationStack.items.length?e.navigationStack.items[e.navigationStack.items.length-1]:null)(e);if(n&&(void 0!==(r=n)&&"subview"===r.kind)){const r=n.subviewId,i=n.cardInstance.subviews[r],o=De(e,i.nodes,t,r);let a=e.validationStates;return Object.assign(Object.assign({},e),{validationStates:Object.assign(Object.assign({},a),{[t]:Object.assign(Object.assign({},e.validationStates[t]),{subviews:{[r]:o}})})})}var r;return e},validateCardTopLevel(e,t){const[n]=e.cardFeed.cardInstances.filter((e=>e.instance.id===t));let r={};return n&&(r=De(e,n.defaultView.nodes,t)),Object.assign(Object.assign({},e),{validationStates:Object.assign(Object.assign({},e.validationStates),{[t]:Object.assign(Object.assign({},e.validationStates[t]),{validations:r})})})}}),Oe=(e,t,n,r)=>{var i;const o=e.cardResponses[t]||{},a=r?null===(i=o.subviews)||void 0===i?void 0:i[r]:{};return Object.assign(Object.assign({},e),{cardResponses:Object.assign(Object.assign({},e.cardResponses),{[t]:{responses:Object.assign(Object.assign({},o.responses),r?{}:n),subviews:Object.assign(Object.assign({},o.subviews),r?{[r]:Object.assign(Object.assign({},a),n)}:{})}})})},_e=(e,t,n,r,i,o,a)=>Object.assign(Object.assign({},e),{externalAction:Object.assign({actionId:(new Date).getTime(),linkMethod:t,trigger:n,cardInstanceId:r,cardViewState:i,subviewData:a},o?{payload:{actionPayload:o,cardInstanceId:r,streamContainerId:e.application.streamContainerId}}:{})}),Te=(e,t,n,r,i,o,a)=>Object.assign(Object.assign({},e),{externalAction:{actionId:(new Date).getTime(),linkMethod:t,trigger:n,urlLink:o,cardInstanceId:r,cardViewState:i,subviewData:a}}),De=(e,t,n,r)=>{var i;const o=Wn(t),a=r?null===(i=e.cardResponses[n].subviews)||void 0===i?void 0:i[r]:e.cardResponses[n].responses;let s={};for(const e in o){const t=o[e];t.attributes.name&&a&&(s[t.attributes.name]=xe(a[t.attributes.name],t.validations))}return s};let je;const Me=()=>(je||(je=(0,i.kv)((0,i.Y2)(Ie),W())),je),Ae=(e,t,n)=>{var r,i;const o=W().getState().cardResponses,a=null===(r=o[e])||void 0===r||null===(i=r.responses)||void 0===i?void 0:i[t];return null!=a?a:n?null===(s=o[e])||void 0===s||null===(c=s.subviews)||void 0===c||null===(l=c[n])||void 0===l?void 0:l[t]:void 0;var s,c,l};var Fe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const Ee=(e,t)=>e?Object.keys(e).reduce(((n,r)=>{const i=e[r];return t.includes(i||"")||(n[r]=e[r]),n}),{}):e,Pe=e=>Ee(e,["submitted","dismissed","snoozed","submitted-subview","centering"]),He=(e,t,n)=>{var r,i;const o=null===(r=e.cardFeed.cardInstances.filter((e=>e.instance.id!==t))[0])||void 0===r||null===(i=r.instance)||void 0===i?void 0:i.id;return Object.assign(Object.assign({},e.cardStates),o&&{[o]:n})},Re=(e,t,n)=>(e||[]).reduce(((e,r,i)=>(n[r.instance.id]&&void 0===(t||[]).find((e=>e.instance.id===r.instance.id))&&e.splice(i,0,r),e)),[...t]),Le=function(){let e=Number(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0);return""+ ++e},We=(e,t)=>t&&t.name===er.noInternet?"No internet connection":e,Ne=(e,t)=>{var n;return((null===(n=t.application.enabledUiElements.toastConfig)||void 0===n?void 0:n.toastMessages)||{})[e]},Ve=(e,t)=>{switch(t){case"cardList":return Object.assign(Object.assign({},e.messages),{cardList:void 0});case"subview":return Object.assign(Object.assign({},e.messages),{subview:void 0});default:return{lastMessageId:Le(e.messages.lastMessageId),cardList:void 0,subview:void 0}}},Ye=()=>({updateAppOpen(e,t){const n="launcher"===e.application.embedMode&&!0===e.application.open&&!1===t;return Object.assign(Object.assign({},e),{application:Object.assign(Object.assign({},e.application),{open:t}),messages:n?Ve(e):e.messages})},submittingCard:(e,t)=>Object.assign(Object.assign({},e),{cardStates:Object.assign(Object.assign({},e.cardStates),{[t]:"submitting"})}),submittedCard(e,t,n){const r=Ne("submittedCard",e),i=Le(e.messages.lastMessageId);return Object.assign(Object.assign({},e),{cardStates:Object.assign(Object.assign({},e.cardStates),{[t]:n?"submitted-subview":"submitted"}),messages:Object.assign(Object.assign({},e.messages),{cardList:{text:null!=r?r:"Card submitted",messageId:i,cardInstanceId:t,action:"submitted"},lastMessageId:i})})},failedToSubmitCard(e,t,n,r,i,o){const a=Ee(e.cardStates,["centering","fixed-position"]),s=Le(e.messages.lastMessageId),c=Le(s);return Object.assign(Object.assign({},e),{cardStates:Object.assign(Object.assign({},a),{[t]:null}),messages:{cardList:Object.assign({text:n?void 0:We("Couldn't submit",i),messageId:s,cardInstanceId:t,action:"submit-failed",responseValues:r},o||{}),subview:Object.assign({text:n?We("Couldn't submit",i):void 0,messageId:c,cardInstanceId:t,action:"submit-failed",responseValues:r},o||{}),lastMessageId:c}})},dismissingCard:(e,t)=>Object.assign(Object.assign({},e),{cardStates:Object.assign(Object.assign({},e.cardStates),{[t]:"dismissing"})}),dismissedCard(e,t){const n=Ne("dismissedCard",e),r=Le(e.messages.lastMessageId);return Object.assign(Object.assign({},e),{cardStates:Object.assign(Object.assign({},e.cardStates),{[t]:"dismissed"}),messages:Object.assign(Object.assign({},e.messages),{cardList:{text:null!=n?n:"Card dismissed",messageId:r,cardInstanceId:t,action:"dismissed"},lastMessageId:r})})},failedToDismissCard(e,t,n,r){const i=Ee(e.cardStates,["centering","fixed-position"]),o=Le(e.messages.lastMessageId);return Object.assign(Object.assign({},e),{cardStates:Object.assign(Object.assign({},i),{[t]:null}),messages:Object.assign(Object.assign({},e.messages),{cardList:{text:We("Couldn't dismiss",r),messageId:o,cardInstanceId:t,action:"dismiss-failed",source:n},lastMessageId:o})})},snoozingCard:(e,t)=>Object.assign(Object.assign({},e),{cardStates:Object.assign(Object.assign({},e.cardStates),{[t]:"snoozing"})}),snoozedCard(e,t,n){const r=Ne("snoozedCard",e),i=Le(e.messages.lastMessageId);let o;return o=(0,f.isToday)(n)?(0,f.format)(n,"h:mm A"):(0,f.format)(n,"D MMM YYYY, h:mm A"),Object.assign(Object.assign({},e),{cardStates:Object.assign(Object.assign({},e.cardStates),{[t]:"snoozed"}),messages:Object.assign(Object.assign({},e.messages),{cardList:{text:null!=r?r:`Snoozed until ${o}`,messageId:i,cardInstanceId:t,action:"snoozed"},lastMessageId:i})})},failedToSnoozeCard(e,t,n,r,i){const o=Ee(e.cardStates,["centering","fixed-position"]),a=Le(e.messages.lastMessageId);return Object.assign(Object.assign({},e),{cardStates:Object.assign(Object.assign({},o),{[t]:null}),messages:Object.assign(Object.assign({},e.messages),{cardList:{text:We("Couldn't snooze",i),messageId:a,cardInstanceId:t,action:"snooze-failed",snoozeDate:n,source:r},lastMessageId:a})})},fixPositionRemainingCard:(e,t)=>Object.assign(Object.assign({},e),{cardStates:e.cardFeed.cardInstances.length<=2?He(e,t,"fixed-position"):Ee(e.cardStates,["centering","fixed-position"])}),centerRemainingCard(e,t){const n=e.cardFeed.cardInstances,r=n.filter((e=>e.instance.id!==t));return Object.assign(Object.assign({},e),{cardFeed:Object.assign(Object.assign({},e.cardFeed),{cardInstances:e.cardFeed.cardInstances.length<=2?r:n,status:{loaded:!0},updateId:(new Date).getTime()}),cardStates:e.cardFeed.cardInstances.length<=2?He(e,t,"centering"):Ee(e.cardStates,["centering","fixed-position"])})},removeCardState:(e,t)=>Object.assign(Object.assign({},e),{cardStates:Object.assign(Object.assign({},e.cardStates),{[t]:null})}),removeCard(e,t){if(e.application.isPreview)return e;const n=e.cardFeed.cardInstances.filter((e=>e.instance.id!==t)),r=Object.assign({},e.cardStates);return delete r[t],Object.assign(Object.assign({},e),{cardFeed:Object.assign(Object.assign({},e.cardFeed),{cardInstances:n,status:{loaded:!0},updateId:(new Date).getTime()}),cardStates:r})},cardFeedDeltaUpdate(e,t,n,r){return Fe(this,void 0,void 0,(function*(){let i=Object.assign({},e),o=!1,a=[];if(t.forEach((e=>{switch(e.type){case"remove-card":{const{cardInstanceId:t,actionType:n}=e.data;if("limit"!==n&&(o=!0),i.application.isPreview)break;const r=i.cardFeed.cardInstances,a=i.application.isPreview?r:r.filter((e=>e.instance.id!==t));i=Object.assign(Object.assign({},i),{cardFeed:Object.assign(Object.assign({},i.cardFeed),{cardInstances:a})});break}case"update-card":{const{cardInstance:t,actionType:n}=e.data;let r=!1;t.runtimeVariables&&a.push(t);const s=i.cardFeed.cardInstances.map((e=>(e.instance.id===t.instance.id&&(r=!0,e=Object.assign({},t)),e)));r||(o=!0,s.push(t)),"unsnooze"===n&&(i.cardStates[t.instance.id]=null),i=Object.assign(Object.assign({},i),{cardFeed:Object.assign(Object.assign({},i.cardFeed),{cardInstances:s})});break}}})),a.length>0){const t=yield r(a),n=e.cardFeed.runtimeVariables.values;i.cardFeed.runtimeVariables={values:new Map([...n||new Map,...(null==t?void 0:t.values)||new Map]),updateId:(new Date).getTime()}}i.cardFeed.cardInstances=(e=>null==e?void 0:e.sort(((e,t)=>{const{priority:n,lastCardActiveTime:r,receivedAt:i}=e.metadata,{priority:o,lastCardActiveTime:a,receivedAt:s}=t.metadata;let c=0;return c=n-o,0===c&&(c=new Date(a).getTime()-new Date(r).getTime()),0===c&&(c=new Date(s).getTime()-new Date(i).getTime()),c})))(i.cardFeed.cardInstances),n(e.cardFeed.cardInstances.length!==i.cardFeed.cardInstances.length||o),"single-card"===e.application.embedMode&&(i.navigationStack={items:[]});const s=Ee(e.cardStates,["centering","fixed-position"]),c=Pe(s),l=Re(e.cardFeed.cardInstances,i.cardFeed.cardInstances,c);return i.cardFeed.cardInstances=l,i.cardFeed.tutorialSeen=e.cardFeed.tutorialSeen||l.length>0,i.cardFeed.updateId=(new Date).getTime(),i.cardFeed.status.loaded=!0,i.cardStates=s,i}))},clearMessage:(e,t)=>Object.assign(Object.assign({},e),{messages:Ve(e,t)}),cardFeedLoading:e=>Object.assign(Object.assign({},e),{cardFeed:Object.assign(Object.assign({},e.cardFeed),{status:{loaded:!1}})}),cardFeedLoaded(e,t){if(t.error){let n;if(t.error.name===er.noInternet)n="noInternet";else n="apiError";return s.error({level1:["Error loading card feed"],level2:[n],level3:[t.error]}),Object.assign(Object.assign({},e),{cardFeed:Object.assign(Object.assign({},e.cardFeed),{status:{loaded:!1,errorState:n}})})}if(!t.cardInstances)return Object.assign(Object.assign({},e),{cardFeed:Object.assign(Object.assign({},e.cardFeed),{status:Object.assign(Object.assign({},e.cardFeed.status),{loaded:!0})})});const n=Ee(e.cardStates,["centering","fixed-position"]),r=Pe(n),i=Re(e.cardFeed.cardInstances,t.cardInstances,r);return Object.assign(Object.assign({},e),{cardFeed:Object.assign(Object.assign({},e.cardFeed),{lastModified:t.lastModified,cardInstances:i,unfilteredCardInstanceCount:t.unfilteredCardInstanceCount||t.cardInstances.length,runtimeVariables:Object.assign(Object.assign({},t.runtimeVariables),{updateId:(new Date).getTime()}),tutorialSeen:e.cardFeed.tutorialSeen||t.cardInstances.length>0,status:{loaded:!0},updateId:(new Date).getTime(),metadata:t.metadata}),navigationStack:{items:"single-card"===e.application.embedMode?[]:e.navigationStack.items},cardStates:r})},runtimeVariablesResolved:(e,t)=>t.values?Object.assign(Object.assign({},e),{cardFeed:Object.assign(Object.assign({},e.cardFeed),{runtimeVariables:Object.assign(Object.assign({},e.cardFeed.runtimeVariables),{values:t.values,updateId:(new Date).getTime()})})}):e,runtimeVariableReplacement(e,t){var n,r;const i=null!==(n=null==t?void 0:t.values)&&void 0!==n?n:null===(r=e.cardFeed.runtimeVariables)||void 0===r?void 0:r.values;return e.cardFeed.cardInstances.map((e=>Nn(e,(null==i?void 0:i.get(e.instance.id))||new Map([])))),Object.assign(Object.assign({},e),{cardFeed:Object.assign(Object.assign({},e.cardFeed),{runtimeVariables:null!=t?t:e.cardFeed.runtimeVariables})})},themeLoading:e=>Object.assign(Object.assign({},e),{theme:Object.assign(Object.assign({},e.theme),{status:{loaded:!1}})}),themeLoaded(e,t){if(t.error){let n;if(t.error.name===er.noInternet)n="noInternet";else n="apiError";return Object.assign(Object.assign({},e),{theme:Object.assign(Object.assign({},e.theme),{status:{loaded:!1,errorState:n}})})}return t.theme?Object.assign(Object.assign({},e),{theme:{themePayload:t.theme,status:{loaded:!0}}}):e},feedbackReceived(e,t){if(e.application.isPreview)return e;const n=Ne("feedbackReceived",e),r=Le(e.messages.lastMessageId);return Object.assign(Object.assign({},e),{messages:Object.assign(Object.assign({},e.messages),{cardList:{text:null!=n?n:"Feedback received",messageId:r,cardInstanceId:t,action:"other"},lastMessageId:r})})},userLoggedOut:e=>Object.assign(Object.assign({},e),{application:Object.assign(Object.assign({},e.application),{open:!1}),cardFeed:Object.assign(Object.assign({},e.cardFeed),{lastModified:"",cardInstances:[],runtimeVariables:{},status:{loaded:!0}}),navigationStack:{items:[]},cardResponses:{},validationStates:{},cardStates:{},messages:{lastMessageId:"0"}})});var $e=0,qe=document.head.appendChild(document.createElement("style")).sheet;function ze(e,t){var n="p"+$e++,r=t+n;return e.forEach((function(e){if(/^@/.test(e)){var t=e.indexOf("{")+1;e=e.slice(0,t)+r+e.slice(t)}else e=r+e;try{qe.insertRule(e,qe.cssRules.length)}catch(e){}})),n}function Ue(e,t){return t+"{"+e+"}"}function Be(e,t){var n=[""];for(var r in t=t||0,e){var i=e[r];i&&(r=r.replace(/[A-Z]/g,"-$&").toLowerCase(),i.sub||Array.isArray(i)?(i=Array.isArray(i)?i:[i]).forEach((function(e){return n[0]+=r+":"+e+";"})):(r=r.replace(/&/g,""),n.push(Ue(Be(i,!/^@/.test(r)).join(""),r))))}return t||(n[0]=Ue(n[0],"")),n}const Ke=function(e,t){var n={};return(t=t||{}).returnObject?{style:r,css:i}:r;function r(t){return function(n){return function(r,o){var a="function"==typeof n?n(r):n;return delete r.theme,r.class=[i(a),r.class].filter(Boolean).join(" "),e(t,r,r.children||[])}}}function i(e){var t=Be(e),r=t.join("");return n[r]||(n[r]=ze(t,"."))}}($.h),Qe=function(e){return ze([Ue(Be(e,1).join(""),"")],"@keyframes ")};const Ge=(e,t)=>n=>{let{themeMethod:r,primaryAccessor:i,secondaryAccessor:o,fallbackStyle:a,skipThemeHelperFallbacks:s,skipDefaultStyle:c}=n;const l=i?e[r](i,{skipFallback:s}):void 0,d=o?e[r](o,{skipFallback:!0}):void 0;let u="getCSSColor"===r?e.getCSSColor(i||o||"",{skipPrimaryStyle:!0}):e[r]("");return c&&(u=""),"secondary"===t&&d?d:l&&("primary"===t||"secondary"===t&&!e.hasSecondaryButtonStyle)?l:a||u||""},Je=Qe({from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}),Xe=(Ke("svg")((()=>({animation:`${Je} 1s infinite linear`}))),Ke("i")((e=>{let{size:t,styles:n}=e;return Object.assign({fontFamily:"'Font Awesome 5 Free'",fontWeight:"900",fontSize:`${t}px`,width:`${t}px`,textAlign:"center",fontStyle:"normal",fontVariant:"normal",textRendering:"auto","-moz-osx-font-smoothing":"grayscale","-webkit-font-smoothing":"antialiased"},n)})),Ke("div")((e=>{var t;let{color:n,size:r,styles:i}=e;return Object.assign(Object.assign(Object.assign({display:"flex",justifyContent:"center",alignItems:"center"},n?{fill:n}:{}),i),{width:`${r}px`,height:null!==(t=i.lineHeight)&&void 0!==t?t:`${r}px`})})),e=>{let{theme:t,appearance:n}=e;const r=Ge(t,n),i=(e,t)=>t?{[e]:t}:{},o=t.getShape("buttonWidth.global"),a=r({themeMethod:"getCSSFontProperties",primaryAccessor:"button",secondaryAccessor:"buttonSecondary",fallbackStyle:{}});return Object.assign(Object.assign(Object.assign({cursor:"pointer",width:"hugsLabel"===o?"auto":"100%",padding:r({themeMethod:"getPadding",primaryAccessor:"button",secondaryAccessor:"buttonSecondary",fallbackStyle:"10px 20px"}),backgroundColor:r({themeMethod:"getCSSColor",primaryAccessor:"background.button",secondaryAccessor:"background.buttonSecondary"}),color:r({themeMethod:"getCSSColor",primaryAccessor:"text.button",secondaryAccessor:"text.buttonSecondary"}),textAlign:"center"},a),{borderStyle:"solid",borderColor:r({themeMethod:"getCSSColor",primaryAccessor:"border.button",secondaryAccessor:"border.buttonSecondary",fallbackStyle:"transparent",skipThemeHelperFallbacks:!0}),borderWidth:r({themeMethod:"getShape",primaryAccessor:"border.button",secondaryAccessor:"border.buttonSecondary",fallbackStyle:"0px"}),borderRadius:r({themeMethod:"getShape",primaryAccessor:"borderRadius.button",secondaryAccessor:"borderRadius.buttonSecondary",fallbackStyle:"0px"}),boxShadow:r({themeMethod:"getCSSShadowProperties",primaryAccessor:"button",secondaryAccessor:"buttonSecondary",skipThemeHelperFallbacks:!0,fallbackStyle:"none"}),display:"flex",alignItems:"center",whiteSpace:"pre-wrap",":hover":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},i("color",r({themeMethod:"getCSSColor",primaryAccessor:"text.buttonHover",secondaryAccessor:"text.buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("backgroundColor",r({themeMethod:"getCSSColor",primaryAccessor:"background.buttonHover",secondaryAccessor:"background.buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("padding",r({themeMethod:"getPadding",primaryAccessor:"buttonHover",secondaryAccessor:"buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("borderColor",r({themeMethod:"getCSSColor",primaryAccessor:"border.buttonHover",secondaryAccessor:"border.buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("borderWidth",r({themeMethod:"getShape",primaryAccessor:"border.buttonHover",secondaryAccessor:"border.buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("borderRadius",r({themeMethod:"getShape",primaryAccessor:"borderRadius.buttonHover",secondaryAccessor:"borderRadius.buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("boxShadow",r({themeMethod:"getCSSShadowProperties",primaryAccessor:"buttonHover",secondaryAccessor:"buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),":active":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},i("color",r({themeMethod:"getCSSColor",primaryAccessor:"text.buttonActive",secondaryAccessor:"text.buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),{backgroundColor:r({themeMethod:"getCSSColor",primaryAccessor:"background.buttonActive",secondaryAccessor:"background.buttonActiveSecondary",fallbackStyle:"rgba(0,0,0,0.1)",skipThemeHelperFallbacks:!0})}),i("borderColor",r({themeMethod:"getCSSColor",primaryAccessor:"border.buttonActive",secondaryAccessor:"border.buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("borderWidth",r({themeMethod:"getShape",primaryAccessor:"border.buttonActive",secondaryAccessor:"border.buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("borderRadius",r({themeMethod:"getShape",primaryAccessor:"borderRadius.buttonActive",secondaryAccessor:"borderRadius.buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("padding",r({themeMethod:"getPadding",primaryAccessor:"buttonActive",secondaryAccessor:"buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("boxShadow",r({themeMethod:"getCSSShadowProperties",primaryAccessor:"buttonActive",secondaryAccessor:"buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0})))}),t.getElementFocusCSSProperties())}),Ze=(Ke("button")((e=>Object.assign({},Xe(e)))),Ke("a")((e=>Object.assign(Object.assign({},Xe(e)),{textDecoration:"none"}))),Ke("div")((e=>{var t,n;let r,i,{labelAlignment:o,iconAlignment:a}=e;return"right"===a?(r="row-reverse",i=null!==(t=null==o?void 0:o.replace("left","flex-end").replace("right","flex-start"))&&void 0!==t?t:"center"):(r="row",i=null!==(n=null==o?void 0:o.replace("left","flex-start").replace("right","flex-end"))&&void 0!==n?n:"center"),{width:"100%",display:"flex",justifyContent:i,alignItems:"center",flexDirection:r}})),Ke("span")((()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}))),e=>{let{theme:t,appearance:n}=e;const r=Ge(t,n),i=(e,t)=>t?{[e]:t}:{},o=r({themeMethod:"getCSSFontProperties",primaryAccessor:"action",secondaryAccessor:"actionSecondary",fallbackStyle:{}}),a=t.getShape("buttonWidth.global"),s=t.getShape("buttonLayout.global"),c=r({themeMethod:"getCSSColor",primaryAccessor:"background.action",secondaryAccessor:"background.actionSecondary"}),l="transparent"===c||c.replace(/\s/g,"").match(/rgba\(\d+,\d+,\d+,0\)/);let d="100%";return l&&(d="calc(100% + 40px)"),Object.assign(Object.assign(Object.assign({cursor:"pointer",padding:r({themeMethod:"getPadding",primaryAccessor:"action",secondaryAccessor:"actionSecondary",fallbackStyle:"10px 20px"}),margin:l&&"horizontal"!==s?"0 -20px":"0px",color:r({themeMethod:"getCSSColor",primaryAccessor:"text.action",secondaryAccessor:"text.actionSecondary"}),display:"flex",alignItems:"center",textAlign:"left"},o),{maxWidth:d,width:"hugsLabel"===a?"auto":d,backgroundColor:c,borderStyle:"solid",borderColor:r({themeMethod:"getCSSColor",primaryAccessor:"border.action",secondaryAccessor:"border.actionSecondary",fallbackStyle:"transparent",skipThemeHelperFallbacks:!0}),borderWidth:r({themeMethod:"getShape",primaryAccessor:"border.action",secondaryAccessor:"border.actionSecondary",fallbackStyle:"0px"}),borderRadius:r({themeMethod:"getShape",primaryAccessor:"borderRadius.action",secondaryAccessor:"borderRadius.actionSecondary",fallbackStyle:"0px"}),boxShadow:r({themeMethod:"getCSSShadowProperties",primaryAccessor:"action",secondaryAccessor:"actionSecondary",skipThemeHelperFallbacks:!0,fallbackStyle:"none"}),":hover":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},i("color",r({themeMethod:"getCSSColor",primaryAccessor:"text.buttonHover",secondaryAccessor:"text.buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),{backgroundColor:r({themeMethod:"getCSSColor",primaryAccessor:"background.buttonHover",secondaryAccessor:"background.buttonHoverSecondary",fallbackStyle:"rgba(0,0,0,0.05)",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0})}),i("padding",r({themeMethod:"getPadding",primaryAccessor:"buttonHover",secondaryAccessor:"buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("borderColor",r({themeMethod:"getCSSColor",primaryAccessor:"border.buttonHover",secondaryAccessor:"border.buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("borderWidth",r({themeMethod:"getShape",primaryAccessor:"border.buttonHover",secondaryAccessor:"border.buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("borderRadius",r({themeMethod:"getShape",primaryAccessor:"borderRadius.buttonHover",secondaryAccessor:"borderRadius.buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("boxShadow",r({themeMethod:"getCSSShadowProperties",primaryAccessor:"buttonHover",secondaryAccessor:"buttonHoverSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),":active":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},i("color",r({themeMethod:"getCSSColor",primaryAccessor:"text.buttonActive",secondaryAccessor:"text.buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),{backgroundColor:r({themeMethod:"getCSSColor",primaryAccessor:"background.buttonActive",secondaryAccessor:"background.buttonActiveSecondary",fallbackStyle:"rgba(0,0,0,0.1)",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0})}),i("borderColor",r({themeMethod:"getCSSColor",primaryAccessor:"border.buttonActive",secondaryAccessor:"border.buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("borderWidth",r({themeMethod:"getShape",primaryAccessor:"border.buttonActive",secondaryAccessor:"border.buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("borderRadius",r({themeMethod:"getShape",primaryAccessor:"borderRadius.buttonActive",secondaryAccessor:"borderRadius.buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("padding",r({themeMethod:"getPadding",primaryAccessor:"buttonActive",secondaryAccessor:"buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0}))),i("boxShadow",r({themeMethod:"getCSSShadowProperties",primaryAccessor:"buttonActive",secondaryAccessor:"buttonActiveSecondary",skipThemeHelperFallbacks:!0,skipDefaultStyle:!0})))}),t.getElementFocusCSSProperties())}),et=(Ke("button")((e=>Object.assign({},Ze(e)))),Ke("a")((e=>Object.assign(Object.assign({},Ze(e)),{textDecoration:"none"}))),Ke("div")((e=>{var t,n;let r,i,{labelAlignment:o,iconAlignment:a}=e;return"right"===a?(r="row-reverse",i=null!==(t=null==o?void 0:o.replace("left","flex-end").replace("right","flex-start"))&&void 0!==t?t:"flex-start"):(r="row",i=null!==(n=null==o?void 0:o.replace("left","flex-start").replace("right","flex-end"))&&void 0!==n?n:"flex-start"),{width:"100%",display:"flex",justifyContent:i,alignItems:"center",flexDirection:r}})),Ke("span")((()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}))),Qe({to:{opacity:"0"}}),Qe({to:{opacity:"1"}}),Qe({to:{opacity:"1",width:"400%",paddingTop:"400%"}}));Qe({to:{opacity:"0",transform:"scale(0.9)"}}),Qe({from:{opacity:"1",transform:"scale(1)"},to:{opacity:"0",transform:"scale(0)"}}),Qe({to:{transform:"translateX(-120%)"}}),Qe({from:{left:"100%"},to:{left:"50%"}}),Qe({from:{},to:{height:"0px"}}),Qe({from:{},to:{width:"0px"}}),Ke("div")((e=>{let{theme:t}=e;return{background:t.getCSSColor("background.cardCompletion"),position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",transformOrigin:"center",borderRadius:"999px",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",opacity:"0",width:"0px",paddingTop:"0px",".submitting":{animation:`${et} 0.6s ease 0.2s forwards`},".submitted":{animation:`${et} 0s ease forwards`},".submitted-subview":{animation:`${et} 0.6s ease 0.2s forwards`}}}));var tt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const nt=e=>{switch(e.type){case"string":return e.defaultValue;case"number":return e.defaultValue.toString();case"boolean":return e.defaultValue?"true":"false";case"list":return e.defaultValue.join(", ");case"date":const t=new Date(e.defaultValue);return isNaN(t.getTime())?e.defaultValue:(0,f.format)(t,e.defaultFormatterOption||"");default:return String(e.defaultValue)}},rt=(e,t,n,r,i,o,a)=>tt(void 0,void 0,void 0,(function*(){const c=`feed/${e}${a?"?filters="+JSON.stringify(a):""}`,l=yield lr.get(c,t,r||"",{streamContainerId:e});if(304===l.response.status)return s.debug({level1:["Feed unchanged response received by HTTP"]}),{};if(200===l.response.status){s.debug({level1:["Feed update received by HTTP"]});let e=l.data.cardInstances,t=l.data.metadata;const r=e.length;o&&e.length>o&&(e=e.slice(0,o));const a=yield st(e,n,i);return{lastModified:l.response.etag,cardInstances:e,metadata:t,unfilteredCardInstanceCount:r,runtimeVariables:a}}return{error:l.response.error}})),it=(e,t,n,r)=>tt(void 0,void 0,void 0,(function*(){const i=yield lr.post("response",{streamContainerId:e,cardInstanceId:t,values:n},r,{streamContainerId:e,cardInstanceId:t});return{ok:i.data&&1==i.data.ok,event:i.data&&i.data.event,error:i.response&&i.response.error}})),ot=(e,t,n)=>tt(void 0,void 0,void 0,(function*(){const r=yield lr.post("dismiss",{streamContainerId:e,cardInstanceId:t},n,{streamContainerId:e,cardInstanceId:t});return{ok:r.data&&1==r.data.ok,event:r.data&&r.data.event,error:r.response.error}})),at=(e,t,n,r)=>tt(void 0,void 0,void 0,(function*(){const i=yield lr.post("snooze",{streamContainerId:e,cardInstanceId:t,interval:`PT${Math.max(0,n)}S`},r,{streamContainerId:e,cardInstanceId:t});return{ok:i.data&&!0===i.data.ok,event:i.data&&i.data.event,error:i.response.error}})),st=(e,t,n)=>tt(void 0,void 0,void 0,(function*(){let r=e.filter((e=>e.runtimeVariables&&e.runtimeVariables.length)).map((e=>{const t=e.runtimeVariables||[];return{eventName:e.instance.eventName,lifecycleId:e.instance.lifecycleId,id:e.instance.id,runtimeVariables:new Map(t.map((e=>[e.name,nt(e)])))}}));if(r.length){let e=r;if(n){let i=!1;const o=new Promise((e=>{setTimeout((()=>{i||(console.error(`Resolution of runtime variables exceeded the timeout (${t}ms). Falling back to default values.`),e(r))}),t)})),a=r.map((e=>Object.assign(Object.assign({},e),{runtimeVariables:new Map(e.runtimeVariables)})));e=yield Promise.race([o,n(a).then((e=>(i=!0,e)))])}const i=e.reduce(((e,t)=>(r.filter((e=>e.id===t.id)).length>0&&e.set(t.id,t.runtimeVariables),e)),new Map);return{values:i}}return{}}));let ct;!function(e){e.DISMISSED="dismissed",e.DISMISS_FAILED="dismiss-failed",e.SUBMITTED="submitted",e.SUBMIT_FAILED="submit-failed",e.SNOOZED="snoozed",e.SNOOZE_FAILED="snooze-failed",e.VOTED_USEFUL="voted-useful",e.VOTED_NOT_USEFUL="voted-not-useful"}(ct||(ct={}));(0,$.createContext)({cardEventDispatcher:{dispatchCardEvent:e=>{}},analyticsDispatcher:{sendEvent:e=>{}},authTokenProvider:{requestToken:()=>Promise.resolve(void 0)},runtimeVariableResolver:void 0});const lt="sdk-initialized",dt="runtime-vars-updated",ut="request-failed",pt="notification-received";function ht(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let mt;!function(e){e.STATE="state-update",e.ANALYTICS_EVENT="analytics-event-dispatched"}(mt||(mt={}));class gt{constructor(){ht(this,"channel",void 0),ht(this,"isOpen",!1),ht(this,"eventListeners",new Map),this.channel=new BroadcastChannel("stream-container-broadcast-channel"),this.isOpen=!0,window.addEventListener("pagehide",(()=>{this.close()}))}addEventListener(e,t,n){if(!("BroadcastChannel"in window))return s.error({level1:["BroadcastChannel API not supported in this browser"]});const r=n=>{n.type===e&&t(n)},i=n||`${e}-${Date.now().toString()}-${this.eventListeners.size}`;return this.channel.addEventListener(e,r),this.eventListeners.set(i,r),i}removeEventListener(e){if(!("BroadcastChannel"in window))return s.error({level1:["BroadcastChannel API not supported in this browser"]});const t=this.eventListeners.get(e);return!!t&&(this.channel.removeEventListener("message",t),this.eventListeners.delete(e),!0)}postMessage(e){if(!("BroadcastChannel"in window))return s.error({level1:["BroadcastChannel API not supported in this browser"]});this.channel.postMessage(e)}close(){this.channel.close(),this.isOpen=!1}}Ke("div")((e=>{let{isWorkflow:t,feedOrientation:n}=e;return Object.assign({},t||"horizontal"!==n?{}:{display:"flex",flexDirection:"column",flexGrow:"1",justifyContent:"flex-end"})})),Ke("div")((e=>{let{theme:t,headlineFontProperties:n}=e;return{color:t.getCSSColor("text.headline"),display:"grid",gridTemplateColumns:"auto 1fr",gridTemplateRows:`${n.lineHeight} 1fr`,padding:"10px 0"}})),Ke("h2")((e=>{let{theme:t}=e;return Object.assign(Object.assign({gridColumnStart:"2",gridRowStart:"span 2"},t.getCSSFontProperties("headline")),{margin:"0",whiteSpace:"pre-wrap","overflow-wrap":"break-word","word-wrap":"break-word","word-break":"break-word"})}));const vt=32,ft=Ke("div")((e=>{let{theme:t,mode:n,cursor:r,hPadding:i}=e;return Object.assign(Object.assign({minHeight:"stacked"===n?"70px":"50px",borderRadius:"4px",border:`1px solid ${t.getCSSColor("border.component")}`},t.getElementFocusCSSProperties()),{backgroundColor:t.getCSSColor("background.component"),display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px",padding:`10px ${void 0!==i?i:20}px`,flexGrow:"1",cursor:r||"pointer"})})),bt=e=>{let{nodeKey:t,children:n,mode:r,cursor:i,ref:o,theme:a,onClick:s,tabFocusable:c,innerRef:l,hPadding:d}=e;const u=c?e=>{e.charCode===vt&&s&&(e.preventDefault(),s())}:void 0;return(0,$.h)("div",{ref:o},(0,$.h)(ft,{key:t,"data-element-key":t,mode:r,theme:a,cursor:i,class:"component-field-wrapper",onClick:s,onKeyPress:u,tabIndex:c?0:void 0,ref:l,hPadding:d},n))},yt=Ke("div")((e=>{let{thumbnailUrl:t,theme:n}=e;return{backgroundColor:n.getCSSColor("background.media"),borderRadius:n.getShape("borderRadius.media"),width:"30px",height:"30px",marginRight:"10px",backgroundImage:`url(${t})`,backgroundSize:"cover",backgroundPosition:"center",alignSelf:"start"}})),St=e=>{let{thumbnailUrl:t,theme:n}=e;return(0,$.h)(yt,{thumbnailUrl:t,theme:n})},wt=e=>Object.assign(Object.assign({backgroundColor:e.getCSSColor("background.component"),color:e.getCSSColor("text.primary")},e.getCSSFontProperties("primary")),{border:"none",boxSizing:"border-box",height:"100%",width:"100%",display:"flex",flexGrow:"1",overflow:"hidden",":focus":{outline:"none"},"::placeholder":{color:e.getCSSColor("text.hint")},whiteSpace:"pre-wrap"}),kt=Ke("textarea")((e=>{let{theme:t}=e;return Object.assign(Object.assign({},wt(t)),{resize:"none",boxSizing:"content-box"})})),Ct=Ke("input")((e=>{let t,{theme:n}=e,r=n.getNumericFontSize("primary"),i=n.getCSSFontProperties("primary");if(i&&i.lineHeight&&r){const e=Math.ceil(.05*r);t=Number(i.lineHeight.replace("px",""))+e}return Object.assign(Object.assign({},wt(n)),t?{lineHeight:`${t}px`}:{})})),xt=(e,t)=>{let n=0;"getComputedStyle"in window&&document.defaultView&&(n=parseInt(document.defaultView.getComputedStyle(e,null).getPropertyValue("line-height"))),e.style.height="auto",e.style.height=1===t?"auto":t>0?t*n+"px":`${e.scrollHeight}px`},It=Ke("div")((e=>{let{theme:t}=e;return Object.assign(Object.assign({color:t.getCSSColor("text.error")},t.getCSSFontProperties("error")),{margin:"-10px 0 30px 0"})})),Ot=e=>{let{theme:t,cardInstanceId:n,subviewId:r,name:i}=e;return(0,$.h)(de.lj,{mapToProps:e=>{let{validationStates:t}=e;return{validationStates:t}}},(e=>{let{validationStates:o}=e;const a=o[n]||{};let s;var c,l,d;r?s=null===(c=a.subviews)||void 0===c||null===(l=c[r])||void 0===l?void 0:l[i]:s=null===(d=a.validations)||void 0===d?void 0:d[i];return s&&s.errorMessage?(0,$.h)(It,{theme:t,role:"alert","data-testid":"validation"},s.errorMessage):null}))};function _t(e,t){for(var n in t)e[n]=t[n];return e}function Tt(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}var Dt=function(e){var t,n;function r(t){var n;return(n=e.call(this,t)||this).isPureReactComponent=!0,n}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,r.prototype.shouldComponentUpdate=function(e,t){return Tt(this.props,e)||Tt(this.state,t)},r}($.Component);var jt=$.options.__b;$.options.__b=function(e){e.type&&e.type.t&&e.ref&&(e.props.ref=e.ref,e.ref=null),jt&&jt(e)};var Mt=function(e,t){return e?(0,$.toChildArray)(e).reduce((function(e,n,r){return e.concat(t(n,r))}),[]):null},At={map:Mt,forEach:Mt,count:function(e){return e?(0,$.toChildArray)(e).length:0},only:function(e){if(1!==(e=(0,$.toChildArray)(e)).length)throw new Error("Children.only() expects only one child.");return e[0]},toArray:$.toChildArray},Ft=$.options.__e;function Et(e){return e&&((e=_t({},e)).__c=null,e.__k=e.__k&&e.__k.map(Et)),e}function Pt(){this.__u=0,this.o=null,this.__b=null}function Ht(e){var t=e.__.__c;return t&&t.u&&t.u(e)}function Rt(){this.i=null,this.l=null}$.options.__e=function(e,t,n){if(e.then)for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return r.__c(e,t.__c);Ft(e,t,n)},(Pt.prototype=new $.Component).__c=function(e,t){var n=this;null==n.o&&(n.o=[]),n.o.push(t);var r=Ht(n.__v),i=!1,o=function(){i||(i=!0,r?r(a):a())};t.__c=t.componentWillUnmount,t.componentWillUnmount=function(){o(),t.__c&&t.__c()};var a=function(){var e;if(! --n.__u)for(n.__v.__k[0]=n.state.u,n.setState({u:n.__b=null});e=n.o.pop();)e.forceUpdate()};n.__u++||n.setState({u:n.__b=n.__v.__k[0]}),e.then(o,o)},Pt.prototype.render=function(e,t){return this.__b&&(this.__v.__k[0]=Et(this.__b),this.__b=null),[(0,$.createElement)($.Component,null,t.u?null:e.children),t.u&&e.fallback]};var Lt=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Rt.prototype=new $.Component).u=function(e){var t=this,n=Ht(t.__v),r=t.l.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),Lt(t,e,r)):i()};n?n(o):o()}},Rt.prototype.render=function(e){this.i=null,this.l=new Map;var t=(0,$.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Rt.prototype.componentDidUpdate=Rt.prototype.componentDidMount=function(){var e=this;e.l.forEach((function(t,n){Lt(e,n,t)}))};var Wt=function(){function e(){}var t=e.prototype;return t.getChildContext=function(){return this.props.context},t.render=function(e){return e.children},e}();function Nt(e){var t=this,n=e.container,r=(0,$.createElement)(Wt,{context:t.context},e.vnode);return t.s&&t.s!==n&&(t.v.parentNode&&t.s.removeChild(t.v),(0,$._unmount)(t.h),t.p=!1),e.vnode?t.p?(n.__k=t.__k,(0,$.render)(r,n),t.__k=n.__k):(t.v=document.createTextNode(""),(0,$.hydrate)("",n),n.appendChild(t.v),t.p=!0,t.s=n,(0,$.render)(r,n,t.v),t.__k=t.v.__k):t.p&&(t.v.parentNode&&t.s.removeChild(t.v),(0,$._unmount)(t.h)),t.h=r,t.componentWillUnmount=function(){t.v.parentNode&&t.s.removeChild(t.v),(0,$._unmount)(t.h)},null}var Vt=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;$.Component.prototype.isReactComponent={};var Yt="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;function $t(e,t,n){if(null==t.__k)for(;t.firstChild;)t.removeChild(t.firstChild);return(0,$.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}var qt=$.options.event;function zt(e,t){e["UNSAFE_"+t]&&!e[t]&&Object.defineProperty(e,t,{configurable:!1,get:function(){return this["UNSAFE_"+t]},set:function(e){this["UNSAFE_"+t]=e}})}$.options.event=function(e){qt&&(e=qt(e)),e.persist=function(){};var t=!1,n=!1,r=e.stopPropagation;e.stopPropagation=function(){r.call(e),t=!0};var i=e.preventDefault;return e.preventDefault=function(){i.call(e),n=!0},e.isPropagationStopped=function(){return t},e.isDefaultPrevented=function(){return n},e.nativeEvent=e};var Ut={configurable:!0,get:function(){return this.class}},Bt=$.options.vnode;$.options.vnode=function(e){e.$$typeof=Yt;var t=e.type,n=e.props;if(t){if(n.class!=n.className&&(Ut.enumerable="className"in n,null!=n.className&&(n.class=n.className),Object.defineProperty(n,"className",Ut)),"function"!=typeof t){var r,i,o;for(o in n.defaultValue&&void 0!==n.value&&(n.value||0===n.value||(n.value=n.defaultValue),delete n.defaultValue),Array.isArray(n.value)&&n.multiple&&"select"===t&&((0,$.toChildArray)(n.children).forEach((function(e){-1!=n.value.indexOf(e.props.value)&&(e.props.selected=!0)})),delete n.value),n)if(r=Vt.test(o))break;if(r)for(o in i=e.props={},n)i[Vt.test(o)?o.replace(/[A-Z0-9]/,"-$&").toLowerCase():o]=n[o]}!function(t){var n=e.type,r=e.props;if(r&&"string"==typeof n){var i={};for(var o in r)/^on(Ani|Tra|Tou)/.test(o)&&(r[o.toLowerCase()]=r[o],delete r[o]),i[o.toLowerCase()]=o;if(i.ondoubleclick&&(r.ondblclick=r[i.ondoubleclick],delete r[i.ondoubleclick]),i.onbeforeinput&&(r.onbeforeinput=r[i.onbeforeinput],delete r[i.onbeforeinput]),i.onchange&&("textarea"===n||"input"===n.toLowerCase()&&!/^fil|che|ra/i.test(r.type))){var a=i.oninput||"oninput";r[a]||(r[a]=r[i.onchange],delete r[i.onchange])}}}(),"function"==typeof t&&!t.m&&t.prototype&&(zt(t.prototype,"componentWillMount"),zt(t.prototype,"componentWillReceiveProps"),zt(t.prototype,"componentWillUpdate"),t.m=!0)}Bt&&Bt(e)};function Kt(e){return!!e&&e.$$typeof===Yt}const Qt={useState:J,useReducer:X,useEffect:Z,useLayoutEffect:ee,useRef:te,useImperativeHandle:ne,useMemo:re,useCallback:function(e,t){return q=8,re((function(){return e}),t)},useContext:ie,useDebugValue:function(e,t){$.options.useDebugValue&&$.options.useDebugValue(t?t(e):e)},version:"16.8.0",Children:At,render:$t,hydrate:$t,unmountComponentAtNode:function(e){return!!e.__k&&((0,$.render)(null,e),!0)},createPortal:function(e,t){return(0,$.createElement)(Nt,{vnode:e,container:t})},createElement:$.createElement,createContext:$.createContext,createFactory:function(e){return $.createElement.bind(null,e)},cloneElement:function(e){return Kt(e)?$.cloneElement.apply(null,arguments):e},createRef:$.createRef,Fragment:$.Fragment,isValidElement:Kt,findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:$.Component,PureComponent:Dt,memo:function(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:Tt(this.props,e)}function r(t){return this.shouldComponentUpdate=n,(0,$.createElement)(e,_t({},t))}return r.prototype.isReactComponent=!0,r.displayName="Memo("+(e.displayName||e.name)+")",r.t=!0,r},forwardRef:function(e){function t(t){var n=_t({},t);return delete n.ref,e(n,t.ref)}return t.prototype.isReactComponent=t.t=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},unstable_batchedUpdates:function(e,t){return e(t)},Suspense:Pt,SuspenseList:Rt,lazy:function(e){var t,n,r;function i(i){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){r=e})),r)throw r;if(!n)throw t;return(0,$.createElement)(n,i)}return i.displayName="Lazy",i.t=!0,i}};let Gt=null;Qt.forwardRef(((e,t)=>{let{nodeKey:n,cardInstanceId:r,subviewId:i,attributes:{defaultValue:o,numberOfLines:a,name:s,thumbnailSrc:c,placeholder:l,maxLength:d},validations:u,theme:p,variableResolver:h,onValueChanged:m}=e;const g=te(null),v=te(o),[f,b]=J(h(o)),y=1===a?Ct:kt;Z((()=>{const{current:{base:e}}=g;xt(e,a)})),Z((()=>{const e=Ae(r,s,i);e?(v.current=e,b(e)):Me().handleFormChange(r,s,f,i)}),[]),Z((()=>{if(o!==v.current){if(f===h(v.current)){const e=h(o);b(e),Me().handleFormChange(r,s,e,i)}v.current=o}}),[o]);const S=h(l);return(0,$.h)(de.lj,{actions:Ie,mapToProps:()=>{}},(e=>(ne(t,(()=>({clearInput:()=>{b(""),g.current.base&&xt(g.current.base,a),e.handleFormChange(r,s,"",i)}}))),(0,$.h)($.Fragment,null,(0,$.h)(bt,{nodeKey:n,mode:"inline",theme:p},c&&(0,$.h)(St,{thumbnailUrl:h(c),theme:p}),(0,$.h)(y,{theme:p,ref:g,placeholder:S,value:f,maxlength:d,className:"input-text",onInput:t=>{const{current:{base:n}}=g,{value:o}=t.target;b(o),xt(n,a),((e,t)=>{null!==Gt&&(clearTimeout(Gt),Gt=null),Gt=setTimeout((()=>{t(r,s,null!=e?e:void 0,u,i)}),200)})(o,e.validateField),e.handleFormChange(r,s,o,i),m&&m(o)},rows:"1",title:S})),(0,$.h)(Ot,{name:s,cardInstanceId:r,subviewId:i,theme:p})))))}));const Jt="22px",Xt=e=>Object.assign(Object.assign({margin:"0",paddingLeft:"0",listStyleType:"none"},e.getCSSFontProperties("body")),{color:e.getCSSColor("text.body")}),Zt=e=>{let t;return Bn(t)||(t=e.getCSSFontProperties("bullet")),{"> li":{display:"flex",margin:"0 0 5px"},"> li.without-icon:before":Object.assign({content:'"•"',textAlign:"center",flexBasis:Jt,minWidth:Jt,marginRight:"10px",color:e.getCSSColor("icon.bullet")},t?{fontSize:t.fontSize,lineHeight:t.lineHeight}:{}),"> li.with-icon i":{flexBasis:Jt,minWidth:Jt,textAlign:"center"},"> li:last-child":{marginBottom:"10px"}}};Ke("ul")((e=>{let{theme:t}=e;return Object.assign(Object.assign({},Xt(t)),Zt(t))})),Ke("ol")((e=>{let{theme:t}=e;return Object.assign(Object.assign(Object.assign({},Xt(t)),Zt(t)),{counterReset:"item","> li.without-icon:before":Object.assign(Object.assign(Object.assign({},Xt(t)["> li.without-icon:before"]),Zt(t)["> li.without-icon:before"]),{content:'counter(item) "."',counterIncrement:"item"})})})),Ke("ul")((e=>{let{theme:t}=e;return Object.assign(Object.assign({},Xt(t)),{margin:"5px 20px 5px 0"," li":{display:"inline"}," li:before":{content:'", "'}," li:first-child:before":{content:'""'}})})),Ke("li")((e=>{let{theme:t}=e;return{color:t.getCSSColor("text.body"),whiteSpace:"pre-wrap","overflow-wrap":"break-word","word-wrap":"break-word","word-break":"break-word"}}));$.Component;Ke("a")((e=>{let{isLinkEnabled:t,theme:n,url:r}=e;return{border:`1px solid ${n.getCSSColor("border.mediaThumb")}`,borderRadius:n.getShape("borderRadius.mediaThumb"),overflow:"hidden",display:"flex",margin:"10px 0",backgroundColor:n.getCSSColor("background.mediaThumbnail"),cursor:t||r?"pointer":"default"}})),Ke("div")((e=>{let{thumbnail:t,theme:n}=e;return{display:"flex",width:"100px",minWidth:"100px",height:"100px",backgroundColor:n.getCSSColor("background.media"),backgroundSize:"cover",backgroundPosition:"center",backgroundImage:`url('${t}')`,alignItems:"center",justifyContent:"center"}})),Ke("div")((()=>({padding:"12px 15px 10px 15px",display:"flex",flexFlow:"row wrap",minWidth:"0px"}))),Ke("div")((e=>{let{theme:t}=e;return Object.assign(Object.assign({},t.getCSSFontProperties("mediaTitle")),{color:t.getCSSColor("text.mediaTitle"),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginBottom:"0px",width:"100%"})})),Ke("div")((e=>{let{theme:t}=e;return Object.assign(Object.assign({},t.getCSSFontProperties("mediaSubtitle")),{color:t.getCSSColor("text.mediaSubtitle"),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:"100%"})})),Ke("a")((e=>{let{isLinkEnabled:t,theme:n}=e;return Object.assign(Object.assign(Object.assign({border:"0px"},n.getElementFocusCSSProperties()),n.getCSSFontProperties("mediaAction")),{color:n.getCSSColor("text.mediaAction"),textDecoration:"none",display:"block",marginTop:"auto",width:"100%",cursor:t?"pointer":"default",visibility:t?"visible":"hidden"})}));Ke("div")((e=>{let{backgroundImage:t,theme:n,mediaType:r,dimensions:i,loadedDimensions:o,url:a}=e;const s=`calc(${n.getShape("borderRadius.card")} - ${n.getShape("border.card")})`;return Object.assign(Object.assign({width:"calc(100% + 40px)",border:"0px",borderRadius:`${s} ${s} 0 0`,backgroundImage:`url(${t})`,backgroundSize:"cover",backgroundPosition:"center",backgroundColor:n.getCSSColor("background.media"),display:"flex",alignItems:"center",justifyContent:"center",margin:"-10px -20px 10px -20px",overflow:"hidden",cursor:"image"===r||"video"===r||a?"pointer":"default"},en({dimensions:i,naturalDimensions:o})),n.getElementFocusCSSProperties())}));Ke("div")((e=>{let{backgroundImage:t,theme:n,mediaType:r,dimensions:i,loadedDimensions:o,url:a}=e;return Object.assign(Object.assign({border:`1px solid ${n.getCSSColor("border.media")}`,borderRadius:`${n.getShape("borderRadius.media")}`,backgroundImage:`url(${t})`,backgroundSize:"cover",backgroundPosition:"center",backgroundColor:n.getCSSColor("background.media"),margin:"10px 0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"image"===r||"video"===r||a?"pointer":"default",overflow:"hidden"},en({dimensions:i,naturalDimensions:o})),n.getElementFocusCSSProperties())}));Ke("p")({padding:"10px 0",margin:"0"}),Ke("a")((e=>{let{theme:t,mediaType:n,url:r}=e;return Object.assign(Object.assign(Object.assign(Object.assign({border:"0px"},t.getElementFocusCSSProperties()),{color:t.getCSSColor("text.link")}),t.getCSSFontProperties("body")),{textDecoration:"none",cursor:"image"===n||"video"===n||r?"pointer":"default","&:hover":{textDecoration:"underline"},whiteSpace:"pre-wrap"})}));const en=e=>{var t,n;let{dimensions:r,naturalDimensions:i}=e;if(null==r?void 0:r.height)switch(null==r?void 0:r.height){case"short":return{height:"50px"};case"medium":return{height:"120px"};case"tall":default:return{height:"200px"};case"original":const e=(null==r||null===(t=r.originalDimensions)||void 0===t?void 0:t.width)||(null==i?void 0:i.width),o=(null==r||null===(n=r.originalDimensions)||void 0===n?void 0:n.height)||(null==i?void 0:i.height);return e&&o?{aspectRatio:`${e} / ${o}`}:{height:"200px"}}return{height:"200px"}},tn=(Ke("div")((e=>{let{theme:t}=e;return{borderRadius:"40px",width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",background:t.getCSSColor("background.mediaControl")}})),{objectFit:"contain",width:"100%",height:"100%",background:"black"});Ke("video")(Object.assign({},tn)),Ke("video")((()=>Object.assign({},tn))),Ke("div")((e=>{let{maskRadius:t,dimensions:n,loadedDimensions:r,format:i}=e;return Object.assign({borderRadius:"banner"===i?`${t} ${t} 0 0`:t,overflow:"hidden",margin:"banner"===i?"-10px -20px 10px -20px":"10px 0"},n?en({dimensions:n,naturalDimensions:r}):{height:"200px"})})),Ke("div")((e=>{let{theme:t}=e;return{background:t.getCSSColor("overlay.mediaBanner"),display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"}}));const nn=(e,t)=>{let n;return Bn(n)||(n=e.getCSSFontProperties("bullet")),{[`>${t} > li`]:Object.assign({display:"flex",margin:"0 0 5px"},"ol"===t?{counterIncrement:"count"}:{}),[`>${t} > li:before`]:Object.assign({content:"ol"===t?'counter(count)"."':'"•"',textAlign:"center",marginRight:"10px",flexBasis:"22px",minWidth:"22px",color:e.getCSSColor("icon.bullet")},n?{fontSize:n.fontSize,lineHeight:n.lineHeight}:{}),[`>${t} > li:last-child`]:{marginBottom:"10px"}}};Ke("div")((e=>{let{theme:t}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:t.getCSSColor("text.body"),gridColumnStart:"2",gridRowStart:"span 2"},t.getCSSFontProperties("body")),{marginRight:"10px"," em":{fontStyle:"italic"}," strong":{fontWeight:"bold"}," code":{borderRadius:"3px",padding:"5px",backgroundColor:"rgba(0,0,0,0.05)"},"> ul":Object.assign({},{paddingLeft:"0",margin:"0",whiteSpace:"pre-wrap",listStyleType:"none"})}),nn(t,"ul")),{"> ol":Object.assign(Object.assign({},{paddingLeft:"0",margin:"0",whiteSpace:"pre-wrap",listStyleType:"none"}),{counterReset:"count"})}),nn(t,"ol")),{" a":{color:t.getCSSColor("text.link")}," p":Object.assign({margin:"10px 0 0 0",whiteSpace:"pre-wrap","overflow-wrap":"break-word","word-wrap":"break-word","word-break":"break-word"},t.getCSSFontProperties("body"))," p:first-child":{marginTop:"0"}," .md-subview-link":{textDecoration:"underline",cursor:"pointer"}})})),Ke("div")((e=>{let{theme:t,bodyFontProperties:n,isWorkflow:r}=e;return{display:"grid",gridTemplateColumns:"auto 1fr",gridTemplateRows:`${n.lineHeight} 1fr`,color:t.getCSSColor("text.body"),padding:r?"0 0 20px 0":"10px 0px"}})),Ke("div")((e=>{let{theme:t}=e;return{backgroundColor:t.getCSSColor("background.component"),color:t.getCSSColor("text.primary"),display:"flex",":focus":{outline:"none"},"-webkit-user-select":"none","-moz-user-select":"none",userSelect:"none"}})),Ke("button")((e=>{let{theme:t,disabled:n}=e;return Object.assign(Object.assign({backgroundColor:n?t.getCSSColor("background.stepperDisabled"):t.getCSSColor("background.stepper"),border:"0px",borderRadius:"99px",width:"24px",height:"24px",display:"flex",padding:"0",alignItems:"center",cursor:n?"initial":"pointer"},t.getElementFocusCSSProperties()),{" svg":{height:"100%"}})})),Ke("input")((e=>{let{theme:t}=e;return Object.assign(Object.assign({color:t.getCSSColor("text.primary")},t.getCSSFontProperties("primary")),{backgroundColor:t.getCSSColor("background.component"),width:"40px",maxWidth:"40px",minWidth:"40px",paddingTop:"1px",textAlign:"center",border:"0","-moz-appearance":"textfield",":focus":{outline:"none"},"::-webkit-inner-spin-button, ::-webkit-outer-spin-button":{"-webkit-appearance":"none",margin:"0"}})})),Ke("div")((e=>{let{theme:t}=e;return Object.assign(Object.assign({},t.getCSSFontProperties("primary")),{color:t.getCSSColor("text.primary"),flexGrow:"1",whiteSpace:"pre-wrap"})}));Ke("div")((e=>{let{theme:t,mode:n}=e;return Object.assign(Object.assign({},t.getCSSFontProperties("stacked"===n?"pinned":"primary")),{flexGrow:"1",whiteSpace:"pre-wrap",color:"stacked"===n?t.getCSSColor("text.pinned"):t.getCSSColor("text.primary"),paddingBottom:"stacked"===n?"2px":"0px"})})),Ke("button")((e=>{let{on:t,theme:n}=e;return Object.assign({backgroundColor:n.getCSSColor(t?"background.switchOn":"background.switchOff"),transition:"0.25s ease-in-out",position:"relative",border:"0px",borderRadius:"99px",width:"40px",height:"22px",cursor:"pointer",flexShrink:"0"},n.getElementFocusCSSProperties())})),Ke("div")((e=>{let{on:t,theme:n}=e;return{transition:"0.25s ease-in-out",position:"absolute",top:"2px",left:t?"50%":"2px",backgroundColor:n.getCSSColor(t?"icon.switchOn":"icon.switchOff"),width:"18px",height:"18px",borderRadius:"99px"}})),Ke("div")((e=>{let{theme:t}=e;return Object.assign({border:"0"},t.getElementFocusCSSProperties())})),Ke("div")((e=>{let{theme:t,mode:n}=e;return Object.assign(Object.assign({},t.getCSSFontProperties("stacked"===n?"pinned":"primary")),{display:"stacked"===n?"block":"inherit",flexGrow:"1",cursor:"pointer"})})),Ke("div")((()=>({justifyContent:"space-between",alignItems:"center"}))),Ke("div")((()=>({"-webkit-user-select":"none","-moz-user-select":"none",userSelect:"none"}))),Ke("div")((e=>{let{open:t,openPosition:n,height:r,theme:i}=e;return Object.assign(Object.assign({position:"absolute",top:`${n}px`,left:t?"20px":"-999px",width:"calc(100% - 40px)",marginBottom:"20px",backgroundColor:"white",boxShadow:"0px 2px 10px 0px rgba(0, 0, 0, 0.2)",cursor:"pointer",height:`${r}px`,maxHeight:"335px",overflow:"auto",zIndex:"40",borderRadius:"5px",color:"black"},i.getCSSFontProperties("primary")),{visibility:t?"visible":"hidden"})})),Ke("div")((e=>{let{theme:t}=e;return Object.assign({padding:"20px",":hover":{backgroundColor:"rgba(0,0,0,0.05)"},":active":{backgroundColor:"rgba(0,0,0,0.1)"},border:"0px"},t.getElementFocusCSSProperties())})),Ke("div")((e=>{let{theme:t,mode:n}=e;return Object.assign(Object.assign({},t.getCSSFontProperties("stacked"===n?"primary":"secondary")),{marginRight:"10px",color:"stacked"===n?t.getCSSColor("text.primary"):t.getCSSColor("text.secondary"),paddingTop:"stacked"===n?"2px":"0px"})}));var rn=n(6083),on=n.n(rn),an=n(9331),sn=n.n(an),cn=n(5932),ln=n.n(cn),dn=n(4844),un=n.n(dn),pn=n(4801),hn=n.n(pn),mn=n(7754),gn=n.n(mn),vn=n(6254),fn=n.n(vn),bn=n(5886),yn=n.n(bn);const Sn=e=>{let{fillColor:t}=e;return(0,$.h)("svg",{width:"31",height:"30",viewBox:"0 0 31 30",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,$.h)("path",{d:"M13.8376 10L18.8376 15L13.8376 20",stroke:t,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}))},wn=e=>{let{fillColor:t}=e;return(0,$.h)("svg",{width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,$.h)("path",{d:"M6.16235 11L1.16235 6L6.16235 1",stroke:t,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}))},kn=Ke("div")({height:"100%",width:"30px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",justifySelf:"center"}),Cn=Ke("div")((e=>{var t;let{theme:n}=e;return{"-webkit-user-select":"none","-moz-user-select":"none",userSelect:"none",display:"grid",gridTemplate:"auto / 42px 1fr 42px",alignItems:"center",margin:"0 auto",width:"100%",color:null!==(t=n.getCSSColor("text.datePickerCalendarMonthYear",{skipFallback:!0}))&&void 0!==t?t:"black","> h1":{textAlign:"center",textTransform:"none",lineHeight:"30px",margin:"0 0 10px",gridColumn:"2"},"> input":{display:"block",fontSize:"small",fontWeight:"bold",textAlign:"center",lineHeight:"15px",height:"18px",width:"60px",margin:"0 auto",backgroundColor:"transparent",fontFamily:"inherit",border:"1px solid lightgray",paddingLeft:"11px"},"> div:first-of-type":{gridColumn:"1"},"> div:last-of-type":{gridColumn:"3"}}})),xn=Ke("span")({fontSize:"15px"}),In=Ke("span")({fontSize:"15px",fontWeight:"normal"}),On=e=>{var t,n;let{theme:r,month:i,year:o="",onBack:a,onForward:s,locale:c}=e;return(0,$.h)(Cn,{theme:r},(0,$.h)(kn,{onClick:a},(0,$.h)(wn,{fillColor:null!==(t=r.getCSSColor("background.datePickerCalendarMonthNavArrows",{skipFallback:!0}))&&void 0!==t?t:"rgba(0,0,0,0.5)"})),(0,$.h)("h1",{className:"MonthDisplay","aria-live":"assertive"},(0,$.h)(xn,null,function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"en-US";return window.months=window.months||[...Array(12)].map(((t,n)=>new Date(2017,n,1).toLocaleDateString(e,{month:"long"}))),window.months}(c)[i-1]+" "),(0,$.h)(In,null,o)),(0,$.h)(kn,{onClick:s},(0,$.h)(Sn,{fillColor:null!==(n=r.getCSSColor("background.datePickerCalendarMonthNavArrows",{skipFallback:!0}))&&void 0!==n?n:"rgba(0,0,0,0.5)"})))};var _n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};const Tn=Ke("button")((e=>{var t,n,r,i,o,a,s;let{isDisabled:c,isSelected:l,isToday:d,isFocused:u,theme:p}=e,h=null!==(t=p.getCSSColor("text.datePickerCalendarDateItem",{skipFallback:!0}))&&void 0!==t?t:"rgba(0, 0, 0, 1)",m=p.getCSSColor("text.datePickerCalendarHoverDateItem",{skipFallback:!0}),g="transparent",v=null!==(n=p.getCSSColor("background.datePickerCalendarHoverDateItem",{skipFallback:!0}))&&void 0!==n?n:"rgba(0, 0, 0, 0.05)";const f="#1E6EFA";d&&!l?h=null!==(r=p.getCSSColor("text.datePickerCalendarCurrentDate",{skipFallback:!0}))&&void 0!==r?r:f:l?(h=null!==(i=p.getCSSColor("text.datePickerCalendarSelectedDateItem",{skipFallback:!0}))&&void 0!==i?i:"white",g=null!==(o=p.getCSSColor("background.datePickerCalendarSelectedDateItem",{skipFallback:!0}))&&void 0!==o?o:f,v=g):u?g="rgba(0, 0, 0, 0.05)":c&&(h="rgba(0, 0, 0, 0.2)",v="transparent");const b=null!==(a=p.getShape("borderRadius.datePickerCalendarDateItem",{skipFallback:!0}))&&void 0!==a?a:"99px";return{userSelect:"none",display:"flex",justifySelf:"center",alignItems:"center",justifyContent:"center",fontFamily:"inherit",fontSize:"small",lineHeight:"15px",margin:"0",position:"relative",width:"string"==typeof b&&(null===(s=b.match(new RegExp(/([1-9])+/g)))||void 0===s?void 0:s.length)?"40px":"100%",height:"40px",outline:"none",border:"2px solid transparent",cursor:c?"initial":"pointer",backgroundColor:g,borderRadius:b,":hover":Object.assign(Object.assign({},m?{color:m}:{}),{backgroundColor:v}),color:h}})),Dn=e=>{let{theme:t,date:n,dateLabel:r,style:i,onSelect:o,onHover:a,onFocus:s}=e,c=_n(e,["theme","date","dateLabel","style","onSelect","onHover","onFocus"]);const l=te(null);return(0,$.h)(Tn,{ref:l,role:"gridcell",title:r,"aria-label":r,"aria-selected":c.isSelected?"true":"false",key:n,style:i,class:`CalendarDay ${ge(c)}`,isToday:yn()(n),isDisabled:c.isDisabled,isSelected:c.isSelected,isFocused:c.isFocused,theme:t,tabIndex:"-1",onMouseUp:e=>{e.stopPropagation(),c.isDisabled||(l.current&&document.activeElement!==l.current&&l.current.base.focus(),o(n))},onMouseEnter:()=>{c.isDisabled||a(n)},onMouseLeave:()=>{c.isDisabled||a(null)},onFocus:()=>{c.isDisabled||s(n)}},n.getDate())},jn=Ke("div")((e=>{var t;let{theme:n}=e;return{cursor:"default",borderWidth:"1px",backgroundColor:null!==(t=n.getCSSColor("background.datePickerCalendar",{skipFallback:!0}))&&void 0!==t?t:"white",width:"100%",margin:"0",padding:"10px",borderRadius:"5px",boxSizing:"border-box","> div:focus":{outline:"none"},"> .focus-visible":{outline:"none",boxShadow:`0 0 0 2px ${n.getCSSColor("border.focus")} inset`}}})),Mn=Ke("div")({padding:"5px"}),An=Ke("div")({display:"grid",gridTemplate:"auto / repeat(7, 1fr)"}),Fn=Ke("div")((e=>{var t;let{theme:n}=e;return{userSelect:"none",textAlign:"center",textTransform:"none",color:null!==(t=n.getCSSColor("text.datePickerCalendarDaysSubHeading",{skipFallback:!0}))&&void 0!==t?t:"rgba(0,0,0,0.5)",fontSize:"13px"}})),En=Ke("div")({display:"grid",gridTemplate:"auto / repeat(7, 1fr)","-ms-grid-rows":"auto","-ms-grid-columns":"(1fr)[7]",marginBottom:"5px"}),Pn=e=>{const{month:t,year:n,isDateHovered:r,isDateFocused:i,isDateSelected:o,isDateInRange:a,isDateHighlighted:s,isDateEnabled:c,onDateFocused:l,onDateHovered:d,onDateSelected:u,onChangeMonth:p,onChangeYear:h,calendarRef:m,disabled:g,locale:v,theme:f}=e,b=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"en-US";return window.days=window.days||[...Array(7)].map(((t,n)=>({dayName:new Date(Date.UTC(2017,0,n+2)).toLocaleDateString(e,{weekday:"long"}),style:{msGridColumn:n+1,gridColumnStart:n+1}}))),window.days}(v),y=ve(t,n||0);return(0,$.h)(jn,{theme:f},(0,$.h)(On,{theme:f,month:t,year:n,onBack:p(-1),onForward:p(1),onChangeYear:h,locale:v,disabled:g}),(0,$.h)(Mn,{className:"Calendar",role:"grid",ref:m,tabIndex:0},(0,$.h)(En,{role:"row"},b.map((e=>{let{dayName:t,style:n}=e;return(0,$.h)(Fn,{key:t,theme:f,style:n,role:"columnheader","aria-label":t},(0,$.h)("abbr",null,t.slice(0,1)))}))),(0,$.h)(An,{role:"row"},y.map((e=>{let{date:t,style:n}=e;return(0,$.h)(Dn,{key:t,theme:f,date:t,dateLabel:ye()(t,"dddd, MMMM D, YYYY"),style:n,isToday:yn()(t),isHovered:r(t),isFocused:i(t),isSelected:o(t),isInRange:a(t),isHighlighted:s(t),isDisabled:g||!c(t),onSelect:u,onHover:d,onFocus:l})})))))};const Hn="DatePicker",Rn="DateRangePicker";class Ln extends $.Component{constructor(e){var t,n,r;super(e),r=void 0,(n="calendar")in(t=this)?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r;const i=e.date||new Date,o=i.getMonth()+1,a=i.getFullYear();this.state={month:o,year:a,focused:i,hovered:new Date},this.calendar=(0,$.createRef)(),this.handleKeyPress=this.handleKeyPress.bind(this),this.onDateHovered=this.onDateHovered.bind(this),this.onDateSelected=this.onDateSelected.bind(this),this.onDateFocused=this.onDateFocused.bind(this),this.isDateHovered=this.isDateHovered.bind(this),this.isDateFocused=this.isDateFocused.bind(this),this.isDateSelected=this.isDateSelected.bind(this),this.isDateInRange=this.isDateInRange.bind(this),this.isDateEnabled=this.isDateEnabled.bind(this),this.isDateHighlighted=this.isDateHighlighted.bind(this),this.onChangeMonth=this.onChangeMonth.bind(this),this.onChangeYear=this.onChangeYear.bind(this)}componentDidMount(){window.addEventListener("keydown",this.handleKeyPress)}componentWillUnmount(){window.removeEventListener("keydown",this.handleKeyPress)}handleKeyPress(e){var t;if(!(null===(t=this.calendar)||void 0===t?void 0:t.current.base.contains(document.activeElement)))return;if(9===e.keyCode)return;e.preventDefault();const{shiftKey:n,keyCode:r}=e,i=13===r,o=33===r,a=34===r,s=37===r,c=38===r,l=39===r,d=40===r,u=r===vt,{isDateEnabled:p}=this.props;let{focused:h}=this.state;if(i)p(h)&&this.onDateSelected(h);else if(n&&o){const e=on()(h,-1);p(e)&&this.onDateFocused(e)}else if(n&&a){const e=on()(h,1);p(e)&&this.onDateFocused(e)}else if(o){const e=sn()(h,-1);p(e)&&this.onDateFocused(e)}else if(a){const e=sn()(h,1);p(e)&&this.onDateFocused(e)}else if(c){const e=ln()(h,-1);p(e)&&this.onDateFocused(e)}else if(d){const e=ln()(h,1);p(e)&&this.onDateFocused(e)}else if(s){const e=un()(h,-1);p(e)&&this.onDateFocused(e)}else if(l){const e=un()(h,1);p(e)&&this.onDateFocused(e)}else u&&this.onDateSelected(h)}onChangeYear(e){e.preventDefault(),this.setState({year:parseInt(e.target.value)||void 0})}onChangeMonth(e){let{month:t,year:n=0}=this.state,r=t+e,i=n;return r<1&&(r=12+r,i-=1),r>12&&(r-=12,i+=1),()=>{this.setState({month:r,year:i})}}onDateSelected(e){const{type:t,onDateSelected:n,onStartDateSelected:r,onEndDateSelected:i}=this.props;if(t===Hn)n&&n(e);else if(t===Rn){const t=!this.props.startDate,n=this.props.startDate&&this.props.endDate,o=this.props.startDate&&this.props.startDate>e;t||n||o?(r&&r(e),i&&i(null)):i&&i(e)}}onDateHovered(e){const{onDateHovered:t}=this.props;e&&this.state.hovered&&this.state.hovered.getDate()!==e.getDate()&&this.setState({hovered:e},(()=>{t&&t(e)}))}onDateFocused(e){const{onDateFocused:t}=this.props,n=e.getMonth()+1,r=e.getFullYear();this.state.focused&&this.state.focused!==e&&this.setState({focused:e,month:n,year:r},(()=>{t&&t(e)}))}isDateEnabled(e){const{isDateEnabled:t}=this.props;return t(e)}isDateHighlighted(e){const{isDateHighlighted:t}=this.props;return t(e)}isDateFocused(e){return hn()(e,this.state.focused)}isDateHovered(e){return hn()(e,this.state.hovered)}isDateSelected(e){return(this.props.type===Hn?[this.props.date]:[this.props.startDate,this.props.endDate]).some((t=>!!t&&hn()(t,e)))}isDateInRange(e){if(this.props.type===Hn)return!1;const{startDate:t,endDate:n}=this.props,{focused:r,hovered:i}=this.state,o=n||(t&&r&&!hn()(t,r)?r:i);return!(!t||!o||gn()(o,t))&&fn()(e,t,o)}componentWillReceiveProps(e){var t;e&&e.open!==this.props.open&&!0===e.open&&((null===(t=this.calendar)||void 0===t?void 0:t.current)&&this.calendar.current.base.focus())}render(){return(0,$.h)(Pn,{calendarRef:this.calendar,month:this.state.month,year:this.state.year,isDateHovered:this.isDateHovered,isDateFocused:this.isDateFocused,isDateSelected:this.isDateSelected,isDateInRange:this.isDateInRange,isDateHighlighted:this.isDateHighlighted,isDateEnabled:this.isDateEnabled,onDateSelected:this.onDateSelected,onDateHovered:this.onDateHovered,onDateFocused:this.onDateFocused,onChangeMonth:this.onChangeMonth,onChangeYear:this.onChangeYear,locale:this.props.locale,disabled:this.props.disabled,theme:this.props.theme})}}Ln.defaultProps={type:Hn,locale:"en-US",isDateHighlighted:e=>!1,isDateEnabled:e=>!0,disabled:!1};Ke("div")((e=>{let{mode:t,theme:n}=e;return Object.assign(Object.assign({},n.getCSSFontProperties("stacked"===t?"pinned":"primary")),{display:"stacked"===t?"block":"inherit",flexGrow:"1",cursor:"pointer"})})),Ke("div")((()=>({justifyContent:"space-between",alignItems:"center"}))),Ke("div")((()=>({"-webkit-user-select":"none","-moz-user-select":"none",userSelect:"none"}))),Ke("button")((e=>{let{open:t,theme:n}=e;return Object.assign({position:"absolute",top:"10px",right:"10px",width:"30px",height:"30px",display:"flex",alignItems:"center",justifyContent:"center",border:"0px",borderRadius:"30px",zIndex:"10",background:n.getCSSColor(t?"background.optionsActive":"background.options"),"&:hover":{background:n.getCSSColor("background.optionsHover")}," > svg":{fill:n.getCSSColor(t?"icon.optionsActive":"icon.options")},"&:hover > svg":{fill:n.getCSSColor("icon.optionsHover")}},n.getElementFocusCSSProperties())})),Ke("button")((e=>{let{theme:t}=e;return Object.assign({position:"absolute",top:"10px",right:"10px",width:"30px",height:"30px",display:"flex",alignItems:"center",justifyContent:"center",border:"0px",borderRadius:"30px",zIndex:"10",background:"transparent"," > svg":{stroke:t.getCSSColor("icon.options")},"&:hover":{background:t.getCSSColor("background.optionsActive")},"&:hover > svg":{stroke:t.getCSSColor("icon.optionsActive")}},t.getElementFocusCSSProperties())})),Ke("ul")((e=>{var t;let n,{theme:r,open:i,maxHeight:o,maxWidth:a,direction:s}=e;switch(s){case"up":n="translateY(-100%) translateY(-50px)";break;case"down":case"left":n="translateY(0)";break;case"right":n="translateX(90%)"}return{position:"absolute",top:"50px",right:"10px",width:"300px",flexShrink:"0",background:r.getCSSColor("background.sheet"),display:"flex",flexFlow:"column",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.2)",borderRadius:null!==(t=r.getShape("borderRadius.sheet",{skipFallback:!0}))&&void 0!==t?t:"5px",padding:"10px 0",overflow:"auto",listStyle:"none",margin:"0",zIndex:"11",maxHeight:i?`${o}`:"0px",maxWidth:i?`${a}`:"0px",visibility:i?"visible":"hidden",transform:n}})),Ke("button")((e=>{let{theme:t}=e;return Object.assign(Object.assign(Object.assign({padding:"15px 20px",cursor:"pointer",display:"flex",flexShrink:"0",alignItems:"center",background:"transparent"},t.getCSSFontProperties("sheetItem")),{color:t.getCSSColor("text.sheetItem"),width:"100%",margin:"0 0 0 0"," svg":{fill:t.getCSSColor("icon.sheetItem")},"&:hover":{background:t.getCSSColor("background.sheetItemActive"),color:t.getCSSColor("text.sheetItemActive")},"&:hover svg":{fill:t.getCSSColor("icon.sheetItemActive")},border:"0px"}),t.getElementFocusCSSProperties())})),Ke("span")((()=>({maxWidth:"240px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}))),Ke("li")((e=>{let{theme:t}=e;return{borderTop:`1px solid ${t.getCSSColor("border.sheetItemDivider")}`,height:"1px",margin:"10px 0"}})),Ke("li")((()=>({flexShrink:"0"}))),Ke("p")((e=>{let{theme:t}=e;return Object.assign(Object.assign({display:"grid",gridTemplateColumns:"auto 1fr",color:t.getCSSColor("text.category")},t.getCSSFontProperties("category")),{padding:"10px 30px 8px 0px",margin:"0",whiteSpace:"pre-wrap"})}));Ke("div")((e=>{var t,n,r,i,o;let{theme:a,feedOrientation:s,isWorkflow:c,transparencies:l}=e;const d=a.getShape("buttonLayout.global"),u=a.getShape("buttonAlignment.global"),p=l.finalButtonTransparent?"0":c?"20px":"10px",h=l.primaryButtonTransparent||l.secondaryButtonTransparent?"0px":"10px",m=!1===l.primaryButtonTransparent,g=!1===l.secondaryButtonTransparent;let v,f;m||g?(v="10px",f="20px"):(v="0px",f="10px");const b=Object.assign({flexGrow:"1",flexDirection:"column"},"horizontal"===d?{alignItems:"flex-end"}:{justifyContent:"flex-end"}),y={paddingBottom:c?f:v,flexDirection:"row",overflowX:"scroll",margin:"0 -20px",paddingLeft:"20px",paddingRight:"20px",marginRight:"-20px","::-webkit-scrollbar":{display:"none"},"-ms-overflow-style":"none",scrollbarWidth:"none","> button:not(:last-child)":{marginRight:null!==(t=a.getShape("buttonSpacingAfter.global",{skipFallback:!0}))&&void 0!==t?t:h},"> a:not(:last-child)":{marginRight:null!==(n=a.getShape("buttonSpacingAfter.global",{skipFallback:!0}))&&void 0!==n?n:h}},S={flexDirection:"column",alignItems:null!==(r={left:"flex-start",center:"center",right:"flex-end"}[u])&&void 0!==r?r:"flex-start","> button:not(:last-child)":{marginBottom:null!==(i=a.getShape("buttonSpacingAfter.global",{skipFallback:!0}))&&void 0!==i?i:h},"> button:last-child":{marginBottom:p},"> a:not(:last-child)":{marginBottom:null!==(o=a.getShape("buttonSpacingAfter.global",{skipFallback:!0}))&&void 0!==o?o:h},"> a:last-child":{marginBottom:p}};return Object.assign(Object.assign({paddingTop:l.firstButtonTransparent?"0px":"10px",display:"flex",alignItems:"center"},"horizontal"===s?b:{}),"horizontal"===d?y:S)}));const Wn=e=>{let t=Array();for(var n in e){const r=e[n];t.push(r),r.children&&(t=t.concat(Wn(r.children)))}return t},Nn=(e,t)=>{const n=e=>{for(let r in e){const i=e[r];"string"==typeof i&&(e[r]=Yn(i,t)),"object"==typeof i&&n(i)}},r=e=>{const t=[];for(let o=0;o<e.length;o++){var i;const a=e[o];a.children&&(null===(i=a.children)||void 0===i?void 0:i.length)>0&&(a.children=r(a.children)),a.attributes&&n(a.attributes),t.push(a)}return t};e.defaultView.nodes=r(e.defaultView.nodes);for(let n in e.subviews){const i=e.subviews[n];e.subviews[n].nodes=r(i.nodes),i.title&&(e.subviews[n].title=Yn(i.title,t))}},Vn=/!\{([\w\.]+?)\}/g,Yn=(e,t)=>e&&t&&"string"==typeof e?e.replace(Vn,((e,n)=>t.get(n)||"")):e||"",$n=(f.addYears,f.addMonths,f.addWeeks,f.addDays,f.addHours,f.addMinutes,f.addSeconds,e=>{if("string"!=typeof e)return!1;const t=new Date(e);if(t instanceof Date)try{return t.toISOString()===e}catch(e){return!1}return!1}),qn=e=>{if(!zn(e))throw new Error("JWT supplied has an incorrect format");try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(t);return JSON.parse(n)}catch(e){throw new Error("JWT payload could not be parsed")}},zn=e=>!!e.match(/^[\w-]+\.[\w-]+\.[\w-]*$/),Un=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Bn=e=>e&&Un(e)&&0===Object.keys(e).length;var Kn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function Qn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Gn=e=>{if(!e)return null;try{const t=qn(e);let n=t.atomic_sub||t.sub||null;return"number"==typeof n&&(n=String(n)),"string"==typeof n?n:null}catch(e){return null}},Jn="AtomicAnalyticsQueue";var Xn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function Zn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const er={noInternet:"AACNoInternetError",missingApiHost:"AACMissingApiHostError",apiError:"AACApiError",invalidParameters:"AACInvalidParametersError",notPermitted:"AACOperationNotPermittedError",authTokenError:"AACAuthTokenError"},tr="Device is not connected to the internet",nr="API host was not specified for the request.",rr="An API error occurred.",ir="Failed to retrieve an authentication token for request.",or={method:"GET",mode:"cors"},ar=e=>Xn(void 0,void 0,void 0,(function*(){const t=yield e.text();try{return{text:t,json:JSON.parse(t)}}catch(e){}return{text:t}})),sr=e=>e<400,cr=(t,n,r,i)=>{var o;const a=null!==(o=Gn(r))&&void 0!==o?o:void 0;e("request-failed",{request:{path:t,statusCode:n,streamContainerId:"string"==typeof(null==i?void 0:i.streamContainerId)?null==i?void 0:i.streamContainerId:void 0,cardInstanceId:"string"==typeof(null==i?void 0:i.cardInstanceId)?null==i?void 0:i.cardInstanceId:void 0,endUserId:a}})};class lr{static initialise(e,n,r){this.apiHost=e,this.apiKey=n,this.environmentId=r,this.instanceId=(0,t.v4)()}static reset(){this.apiHost="https://client-api.atomic.io",this.apiKey=void 0,this.environmentId=void 0}static setTestHostHeader(e){this.testHost=e}static setClientAppVersion(e){this.clientAppVersion=e}static verifyInitialised(){if(!this.isInitialised())throw new Error("The Atomic SDK has not been initialised with an API host, API key and environment ID. Call `AtomicSDK.initialise(apiHost, apiKey, environmentId)` before attempting to use the SDK.")}static isInitialised(){return void 0!==this.apiKey&&void 0!==this.environmentId}static get(e,t,n,r){return Xn(this,void 0,void 0,(function*(){let i,o;if(this.verifyInitialised(),!navigator.onLine){const e=new Error(tr);return e.name=er.noInternet,{response:{error:e}}}{const a=pr(this.apiHost,e,this.environmentId);if(!a){const e=new Error(nr);return e.name=er.missingApiHost,{response:{error:e}}}let s;if(t)try{s=yield t.requestToken()}catch(e){const t=new Error(`${ir} ${e}`);return t.name=er.authTokenError,{response:{error:t}}}const c=Object.assign(Object.assign({},or),{headers:dr({instanceId:this.instanceId,apiKey:this.apiKey,authToken:s,lastModified:n,testHost:this.testHost,clientAppVersion:this.clientAppVersion})});try{const t=yield fetch(a,c);o=t.status;const n=yield ar(t);if(n.json&&(i=n.json),!sr(t.status))throw cr(e,o,s,r),new Error(`GET request failed with status code ${t.status}.`);return{data:i,response:{status:t.status,etag:t.headers.get("etag")}}}catch(e){const t=new Error(`${rr} ${e}`);return t.name=er.apiError,{data:i,response:{status:o,error:t}}}}}))}static post(e,t,n,r){return Xn(this,void 0,void 0,(function*(){if(this.verifyInitialised(),!navigator.onLine){const e=new Error(tr);return e.name=er.noInternet,{response:{error:e}}}{let i,o;const a=pr(this.apiHost,e,this.environmentId);if(!a){const e=new Error(nr);return e.name=er.missingApiHost,{response:{error:e}}}let s;if(n)try{s=yield n.requestToken()}catch(e){const t=new Error(`${ir} ${e}`);return t.name=er.authTokenError,{response:{error:t}}}const c=Object.assign(Object.assign({},or),{method:"POST",headers:dr({instanceId:this.instanceId,apiKey:this.apiKey,authToken:s,testHost:this.testHost,clientAppVersion:this.clientAppVersion}),body:JSON.stringify(t)});try{const t=yield fetch(a,c);o=t.status;const n=yield ar(t);if(n.json&&(i=n.json),!sr(t.status))throw cr(e,o,s,r),new Error(`POST request failed with status code ${t.status}.`);return{data:i,response:{status:t.status}}}catch(e){const t=new Error(`${rr} ${e}`);return t.name=er.apiError,{data:i,response:{status:o,error:t}}}}}))}static put(e,t,n,r){return Xn(this,void 0,void 0,(function*(){if(this.verifyInitialised(),!navigator.onLine){const e=new Error(tr);return e.name=er.noInternet,{response:{error:e}}}{let i,o;const a=pr(this.apiHost,e,this.environmentId);if(!a){const e=new Error(nr);return e.name=er.missingApiHost,{response:{error:e}}}let s;if(n)try{s=yield n.requestToken()}catch(e){const t=new Error(`${ir} ${e}`);return t.name=er.authTokenError,{response:{error:t}}}const c=Object.assign(Object.assign({},or),{method:"PUT",headers:dr({instanceId:this.instanceId,apiKey:this.apiKey,authToken:s,testHost:this.testHost,clientAppVersion:this.clientAppVersion}),body:JSON.stringify(t)});try{const t=yield fetch(a,c);o=t.status;const n=yield ar(t);if(n.json&&(i=n.json),!sr(t.status))throw cr(e,o,s,r),new Error(`PUT request failed with status code ${t.status}.`);return{data:i,response:{status:t.status}}}catch(e){const t=new Error(`${rr} ${e}`);return t.name=er.apiError,{data:i,response:{status:o,error:t}}}}}))}static delete(e,t,n,r){return Xn(this,void 0,void 0,(function*(){if(this.verifyInitialised(),!navigator.onLine){const e=new Error(tr);return e.name=er.noInternet,{response:{error:e}}}{let i,o;const a=pr(this.apiHost,e,this.environmentId);if(!a){const e=new Error(nr);return e.name=er.missingApiHost,{response:{error:e}}}let s;if(n)try{s=yield n.requestToken()}catch(e){const t=new Error(`${ir} ${e}`);return t.name=er.authTokenError,{response:{error:t}}}const c=Object.assign(Object.assign({},or),{method:"DELETE",headers:dr({instanceId:this.instanceId,apiKey:this.apiKey,authToken:s,testHost:this.testHost,clientAppVersion:this.clientAppVersion}),body:JSON.stringify(t)});try{const t=yield fetch(a,c);o=t.status;const n=yield ar(t);if(n.json&&(i=n.json),!sr(t.status))throw cr(e,o,s,r),new Error(`DELETE request failed with status code ${t.status}.`);return{data:i,response:{status:t.status}}}catch(e){const t=new Error(`${rr} ${e}`);return t.name=er.apiError,{data:i,response:{status:o,error:t}}}}}))}}Zn(lr,"apiHost","https://client-api.atomic.io"),Zn(lr,"apiKey",void 0),Zn(lr,"environmentId",void 0),Zn(lr,"instanceId",void 0),Zn(lr,"testHost",void 0),Zn(lr,"clientAppVersion","unknown");const dr=e=>ur("header",Object.assign({},e)),ur=(e,t)=>{const n="header"===e;let r={"x-atomic-sdk-platform":"Web","x-atomic-sdk-version":"24.2.1","x-atomic-sdk-timezone":Intl.DateTimeFormat().resolvedOptions().timeZone,"x-atomic-sdk-device":navigator.userAgent};if(t.instanceId&&(r["x-atomic-sdk-instance-id"]=t.instanceId),n&&(r["Content-Type"]="application/json"),t.apiKey){r["ws"===t.scheme?"api-key":"x-atomic-sdk-api-key"]=t.apiKey}return t.authToken&&(n?r.Authorization=`Bearer ${t.authToken}`:r.Token=t.authToken),t.lastModified&&n&&(r["If-None-Match"]=t.lastModified),t.testHost&&(r["x-atomic-test-host"]=t.testHost),t.clientAppVersion&&(r["x-atomic-sdk-client-app-version"]=t.clientAppVersion),t.error&&(r.error=t.error),r},pr=(e,t,n)=>{if(!e||0==e.trim().length)return null;return`${e.endsWith("/")?e:`${e}/`}${n&&n.trim().length>0?`${n}/`:""}${t}`};function hr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let mr;!function(e){e[e.notPermitted=1013]="notPermitted",e[e.missingApi=1008]="missingApi",e[e.retryConnection=1011]="retryConnection",e[e.goingAway=1001]="goingAway",e[e.abnormalClosure=1006]="abnormalClosure",e[e.sdkClosedConnection=3e3]="sdkClosedConnection",e[e.sdkChangingProtocol=3001]="sdkChangingProtocol",e[e.sdkReinitialisedWebSocket=3002]="sdkReinitialisedWebSocket",e[e.sdkSessionEnding=3003]="sdkSessionEnding",e[e.sdkCordovaBackgrounded=3004]="sdkCordovaBackgrounded",e[e.sdkPersistedToBrowserCache=3005]="sdkPersistedToBrowserCache",e[e.unitTestConnectionClose=3006]="unitTestConnectionClose"}(mr||(mr={}));const gr={name:"Not initialised",message:"WebSocket client has not been initialised"},vr={name:"No connection",message:"WebSocket connection is not established"},fr={name:"WebSocket not ready",message:"WebSocket connection is not ready to send message"},br={name:"Dispatch message error",message:"Unable to dispatch the client message on the WebSocket connection"};class yr{static initialise(e,t,n){let r;try{r=new URL(e),r.protocol="https:"===r.protocol?"wss":"ws"}catch(e){throw s.error({level1:["error creating WebSocket URL from supplied API host"],level2:[e]}),e}this.apiHost===r.toString()&&this.apiKey===t&&this.environmentId===n||this.isConnected()&&this.close(mr.sdkReinitialisedWebSocket,"Connection closed by SDK, WebSocket has been reinitialised"),this.apiHost=r.toString(),this.apiKey=t,this.environmentId=n,window.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&(s.debug({level3:[`WebSocket client visibilitychange event triggered, page is ${document.visibilityState} checking connection health`]}),this.connectionHealthCheck())})),v()&&(document.addEventListener("pause",(()=>{s.debug({level3:["Cordova app pause event triggered"]}),this.close(mr.sdkCordovaBackgrounded,"Connection closed by SDK, clean up WebSocket connection as app has been backgrounded")}),!1),document.addEventListener("resume",(()=>{s.debug({level3:["Cordova app resume event triggered"]}),ii.reinitialiseWebSocketConnection()}),!1))}static isInitialised(){return void 0!==this.apiKey&&void 0!==this.environmentId&&void 0!==this.apiHost}static reset(){this.apiHost=void 0,this.apiKey=void 0,this.environmentId=void 0,this.openingConnection=!1,this.connectionAuthenticated=!1,this.webSocketConnection=void 0,this.connectionTimeout=void 0,this.pingTimeout=void 0}static setTestHostParam(e){this.testHost=e}static setConnectionTimeout(){this.clearTimeouts(),this.connectionTimeout=setTimeout((()=>{try{this.dispatchMessage({messageType:b})}catch(e){s.error({level3:["Error sending custom ping message:",e]})}this.pingTimeout=setTimeout((()=>{s.debug({level3:["WebSocket client ping timeout reached, closing connection"]}),this.close(mr.sdkClosedConnection,"connection timed out")}),this.connectionTimer)}),this.connectionTimer)}static setClientAppVersion(e){this.clientAppVersion=e}static connectionHealthCheck(){yr.isInitialised()&&yr.isConnected()&&Or.lastPongSuccess&&(0,f.differenceInMilliseconds)((new Date).toISOString(),Or.lastPongSuccess)>this.staleConnectionTimer&&(s.debug({level3:["WebSocket connection has become stale, re-initialising"]}),ii.reinitialiseWebSocketConnection())}static clearTimeouts(){this.connectionTimeout&&clearTimeout(this.connectionTimeout),this.pingTimeout&&clearTimeout(this.pingTimeout)}static isConnected(){return!this.openingConnection&&!!this.webSocketConnection&&this.webSocketConnection.readyState==this.webSocketConnection.OPEN}static close(e,t){var n;e===mr.sdkSessionEnding&&Or.unsubscribeActiveSubscriptions(),null===(n=this.webSocketConnection)||void 0===n||n.close(e,t),this.connectionAuthenticated=!1,this.clearTimeouts()}static purgeMessageQueue(){this.messageQueue.length&&(this.messageQueue.forEach((e=>{let t;if(e.messageType===S)t=e,t.data.subscriptions=t.data.subscriptions.filter((e=>Object.keys(ii.streamContainers).includes(e.subscriptionId))),t.data.subscriptions.length||(t=null);else t=e;try{t&&this.dispatchMessage(t),s.debug({level3:["WebSocket client purging message queue, message sent by WebSockets: ",t]})}catch(e){s.error({level1:["purging message queue, error sending message"],level2:[e]})}})),this.messageQueue=[])}static dispatchMessage(e){var n;const r=(0,t.v4)(),i=Object.assign(Object.assign({},e),{messageId:r}),o=JSON.stringify(i);try{const t=this.webSocketConnection;if(!t)throw new Error(vr.message);if(t.readyState===t.CLOSING||t.readyState===t.CLOSED)throw new Error(fr.message);return t.readyState===t.CONNECTING?this.messageQueue.push(e):t.send(o)}catch(e){const t=new Error;throw t.name=br.name,t.message=null!==(n=e.message)&&void 0!==n?n:br.message,t}}static setEventListeners(e,t){e.onmessage=e=>{if(this.setConnectionTimeout(),e.data)try{const n=JSON.parse(e.data);t.onMessage(n)}catch(e){console.error(e)}},e.onopen=()=>{var e;this.setConnectionTimeout(),null===(e=t.onOpen)||void 0===e||e.call(t)},e.onclose=e=>{var n;null===(n=t.onClose)||void 0===n||n.call(t,e)},e.onerror=e=>{t.onError(e)}}static open(e,t,n){try{if(!this.isInitialised())throw new Error(gr.message);if(!navigator.onLine){const e=new Error(tr);throw e.name=er.noInternet,e}const r=pr(this.apiHost,e,this.environmentId);if(!r){const e=new Error(nr);throw e.name=er.missingApiHost,e}if(this.webSocketConnection)switch(this.webSocketConnection.readyState){case this.webSocketConnection.OPEN:this.close(mr.sdkReinitialisedWebSocket,"Connection closed by SDK, request to open new connection received");break;case this.webSocketConnection.CLOSING:return setTimeout((()=>{this.open(e,t,n)}),500)}const i=((e,t)=>{let n=ur("query",Object.assign({},t));for(const t in n)e.searchParams.set(t.toLowerCase(),n[t]);return e})(new URL(r),Object.assign(Object.assign({apiKey:this.apiKey,scheme:"ws",clientAppVersion:this.clientAppVersion},this.testHost?{testHost:this.testHost}:{}),n?{error:n}:{}));this.openingConnection=!0,this.webSocketConnection=new WebSocket(i.toString()),this.setEventListeners(this.webSocketConnection,t),this.openingConnection=!1;const o=e=>{let t=mr.sdkSessionEnding;e.persisted&&(t=mr.sdkPersistedToBrowserCache),this.close(t,"Connection closed by SDK, clean up WebSocket connection as page has been closed"),Or.lastPongSuccess=void 0,window.removeEventListener("pagehide",o)};return window.addEventListener("pagehide",o),this.webSocketConnection.readyState}catch(e){throw this.openingConnection=!1,e}}}hr(yr,"apiHost",void 0),hr(yr,"apiKey",void 0),hr(yr,"environmentId",void 0),hr(yr,"clientAppVersion","unknown"),hr(yr,"testHost",void 0),hr(yr,"openingConnection",!1),hr(yr,"authenticatingConnection",!1),hr(yr,"connectionAuthenticated",!1),hr(yr,"authenticationTimeout",7e3),hr(yr,"messageQueue",[]),hr(yr,"webSocketConnection",void 0),hr(yr,"connectionTimeout",void 0),hr(yr,"pingTimeout",void 0),hr(yr,"connectionTimer",3e4),hr(yr,"staleConnectionTimer",2*yr.connectionTimer+5e3);var Sr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function wr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const kr={name:"Invalid stream container id",message:"an invalid stream container id was provided with the subscription request"},Cr={name:"Invalid filter",message:"an invalid filter was provided with the subscription request"},xr={name:"Invalid token",message:'Atomic platform responded with an "invalid token" message'},Ir={name:"Expired token",message:'Atomic platform responded with an "expired token" message'};class Or{static reset(){this.activeSubscriptions={},this.lastPongSuccess=void 0}static messageSubscribedContainer(e,t){if(void 0===ii.streamContainers[e])return s.error({level3:["No stream container found for subscriptionId: ",e]});ii.streamContainers[e].sendMessageToIframe(t)}static messageAllSubscribedContainers(e){Object.values(this.activeSubscriptions).forEach((t=>{this.messageSubscribedContainer(t.subscriptionId,e)}))}static handleWebSocketMessage(e){return Sr(this,void 0,void 0,(function*(){switch(e.messageType){case C:s.debug({level1:["pong received by WebSockets"],level2:[e]}),this.lastPongSuccess=(new Date).toISOString();break;case x:yr.connectionAuthenticated||(yr.connectionAuthenticated=!0,ii.authMessageResolve()),s.debug({level1:["auth success received by WebSockets"],level2:[e]});break;case I:s.debug({level1:["token expiry received by WebSockets"],level2:[e]}),yr.connectionAuthenticated=!1;try{yield ii.handleTokenRequest({skipCache:!0,authWebSocket:!0}),this.resubscribeActiveSubscriptions()}catch(e){s.error({level1:["Token expired, new token request failed"],level2:[e]})}break;case O:{s.debug({level1:["update cards received by WebSockets"],level2:[e]});const t=e.data.updates,n={};null==t||t.forEach((e=>{const{subscriptionId:t}=e.data;n[t]||(n[t]=[]),n[t].push(e)}));Object.keys(n).forEach((e=>{this.messageSubscribedContainer(e,{action:l,values:{cardFeedUpdates:n[e]}})}));break}case _:{var t;s.debug({level1:["analytics events processed received by WebSockets"],level2:[e]});const n=null===(t=e.data)||void 0===t?void 0:t.eventIds;n&&Array.isArray(n)&&ii.analyticsQueue.removeProcessedEvents(n);break}case T:this.handleWebSocketErrorMessage(e);break;default:s.debug({level1:["unknown message received by WebSockets"],level2:[e]})}}))}static handleWebSocketErrorMessage(e){var t,n,r;return Sr(this,void 0,void 0,(function*(){switch(e.data.errorType){case D:{const e=new Error(xr.message);e.name=xr.name,s.error({level1:["Invalid token error received by WebSockets."],level2:[e]}),yr.connectionAuthenticated||ii.authMessageReject(e),yr.connectionAuthenticated=!1;try{yield ii.handleTokenRequest({skipCache:!0,authWebSocket:!0}),this.resubscribeActiveSubscriptions()}catch(e){s.error({level1:["Token invalid, new token request failed"],level2:[e]}),this.messageAllSubscribedContainers({action:"io.atomic.events.invalidToken",values:null!==(t=e.message)&&void 0!==t?t:e})}break}case j:{const t=new Error(null!==(n=e.data.errorMessage)&&void 0!==n?n:Ir.message);t.name=Ir.name,s.error({level1:["Expired token error received by WebSockets"],level2:[t]}),yr.connectionAuthenticated||ii.authMessageReject(t),yr.connectionAuthenticated=!1;try{yield ii.handleTokenRequest({skipCache:!0,authWebSocket:!0}),this.resubscribeActiveSubscriptions()}catch(e){s.error({level1:["Token expired, new token request failed"],level2:[e]}),this.messageAllSubscribedContainers({action:"io.atomic.events.expiredToken",values:null!==(r=e.message)&&void 0!==r?r:e})}break}case M:{var i;const t=e.data.subscriptionId,n=new Error(`${kr.message} - ${null===(i=this.activeSubscriptions[t])||void 0===i?void 0:i.streamContainerId}`);n.name=kr.name,s.error({level1:["Invalid stream container id error received by WebSockets"],level2:[n]}),this.messageSubscribedContainer(t,{action:"io.atomic.events.invalidStreamContainerId",values:n.message});break}case A:{const t=e.data.subscriptionId,n=new Error(Cr.message);n.name=Cr.name,n.message=Cr.message,s.error({level1:["Invalid filter error received by WebSockets"],level2:[n]}),this.messageSubscribedContainer(t,{action:"io.atomic.events.invalidFilter",values:n.message});break}case F:s.error({level1:["Invalid message error received by WebSockets"],level2:[e]});break;default:s.debug({level1:["unknown error received by WebSockets"],level2:[e]})}}))}static subscribeToCardFeed(e){try{yr.dispatchMessage({messageType:S,data:{subscriptions:e}}),e.forEach((e=>this.activeSubscriptions[e.subscriptionId]=e))}catch(e){throw s.error({level1:["Error subscribing to card feed via WebSocket"],level2:[e]}),e}}static unsubscribeFromCardFeed(e){try{yr.dispatchMessage({messageType:w,data:{subscriptionIds:e}}),e.forEach((e=>delete this.activeSubscriptions[e]))}catch(e){s.error({level1:["Error unsubscribing from card feed via WebSocket"],level2:[e]})}}static resubscribeActiveSubscriptions(){const e=Object.values(this.activeSubscriptions);e.length&&(this.subscribeToCardFeed(e),e.forEach((e=>this.messageSubscribedContainer(e.subscriptionId,{action:u}))))}static unsubscribeActiveSubscriptions(){const e=Object.values(this.activeSubscriptions);e.length&&this.unsubscribeFromCardFeed(e.map((e=>e.subscriptionId)))}static sendAuthMessage(e){try{yr.dispatchMessage({messageType:y,authToken:e})}catch(e){s.error({level1:["Error sending auth message to WebSocket"],level2:[e]})}}static sendAnalyticsMessage(e,t){if(!ii.webSocketDisabled&&yr.isConnected())try{yr.dispatchMessage({messageType:k,authToken:t,data:{events:e}})}catch(e){s.error({level1:["Error sending analytics message to WebSocket"],level2:[e]})}}}wr(Or,"activeSubscriptions",{}),wr(Or,"lastPongSuccess",void 0);const _r=Object.freeze({cardCompleted:"card-completed",cardDismissed:"card-dismissed",cardSnoozed:"card-snoozed",cardFeedUpdated:"card-feed-updated",cardDisplayed:"card-displayed",cardVotedUp:"card-voted-up",cardVotedDown:"card-voted-down",runtimeVarsUpdated:"runtime-vars-updated",streamDisplayed:"stream-displayed",userRedirected:"user-redirected",snoozeOptionsDisplayed:"snooze-options-displayed",snoozeOptionsCanceled:"snooze-options-canceled",cardSubviewDisplayed:"card-subview-displayed",cardSubviewExited:"card-subview-exited",videoPlayed:"video-played",videoCompleted:"video-completed",sdkInitialized:"sdk-initialized",requestFailed:"request-failed",notificationReceived:"notification-received"});let Tr;!function(e){e.cardCompleted="card-completed",e.cardDismissed="card-dismissed",e.cardSnoozed="card-snoozed",e.cardFeedUpdated="card-feed-updated",e.cardDisplayed="card-displayed",e.cardVotedUp="card-voted-up",e.cardVotedDown="card-voted-down",e.runtimeVarsUpdated="runtime-vars-updated",e.streamDisplayed="stream-displayed",e.userRedirected="user-redirected",e.snoozeOptionsDisplayed="snooze-options-displayed",e.snoozeOptionsCanceled="snooze-options-canceled",e.cardSubviewDisplayed="card-subview-displayed",e.cardSubviewExited="card-subview-exited",e.videoPlayed="video-played",e.videoCompleted="video-completed",e.sdkInitialized="sdk-initialized",e.requestFailed="request-failed",e.notificationReceived="notification-received"}(Tr||(Tr={}));const Dr=e=>(!e.eventName&&e.analyticsEvent&&(e.eventName=e.analyticsEvent),e),jr=e=>{const n=(new Date).toISOString();return{id:(0,t.v4)(),analyticsEvent:Tr.cardFeedUpdated,eventName:Tr.cardFeedUpdated,endUserId:e.endUserId,timestamp:n,properties:{cardCount:e.cardCount},sdkContext:{containerId:e.streamContainerId},eventContext:{userLocalTimestamp:(0,f.format)(n,"YYYY-MM-DDTHH:mm:ss.SSSZ")}}};function Mr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ar=e=>{const t=new Error(e);return t.name="Stream filter error",s.error({level1:[t]}),t},Fr=(e,t)=>{let n=!0;return!!e.length&&(e.reduce(((e,r)=>(t.includes(typeof r)||(n=!1),typeof e!=typeof r&&(n=!1),r))),n)};class Er{constructor(e,t){var n=this;Mr(this,"filters",void 0),Mr(this,"onApplyFilter",void 0),Mr(this,"onClearFilter",void 0),Mr(this,"addVariableFilter",(e=>this.variableFilter("variables",e,"addVariableFilter"))),Mr(this,"addPayloadVariableFilter",(e=>this.variableFilter("eventPayload.detail",e,"addPayloadVariableFilter"))),Mr(this,"addPayloadMetadataFilter",(e=>this.variableFilter("eventPayload.metadata",e,"addPayloadMetadataFilter","metadata"))),Mr(this,"variableFilter",(function(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"variable";if(!t)throw Ar(`The name of the ${i} you are filtering by must be supplied to \`${r}\``);return Pr(n.filters,e,t,(e=>{const t=Array.isArray(e);if(!t&&!["string","number","boolean","null"].includes(typeof e))throw Ar(`Incorrect value provided for "${i}" filter. Must be a string, a number, a boolean or null.`);if(t&&!Fr(e,["string","number"]))throw Ar(`Incorrect value provided for "${i}" filter, for "in" or "notIn" must be either an array of numbers or an array of strings.`)}),["equals","greaterThan","greaterThanOrEqualTo","in","lessThan","lessThanOrEqualTo","notEqualTo","notIn","between"])})),Mr(this,"addCardTemplateIdFilter",(()=>Pr(this.filters,"metadata","cardTemplateId",(e=>{const t=Array.isArray(e);if(!t&&"string"!=typeof e)throw Ar('Incorrect "card template id" filter value provided, must be a string.');if(t&&!Fr(e,["string"]))throw Ar('Incorrect "card template id" filter value provided, for "in" or "notIn" an array of strings must be supplied.')}),["equals","in","notEqualTo","notIn"]))),Mr(this,"addCardTemplateNameFilter",(()=>Pr(this.filters,"metadata","cardTemplateName",(e=>{const t=Array.isArray(e);if(!t&&"string"!=typeof e)throw Ar('Incorrect "card template name" filter value provided, must be a string.');if(t&&!Fr(e,["string"]))throw Ar('Incorrect "card template name" filter value provided, for "in" or "notIn" an array of strings must be supplied.')}),["equals","in","notEqualTo","notIn"]))),Mr(this,"addCardCreatedFilter",(()=>Pr(this.filters,"metadata","created",(e=>{if("string"!=typeof e||!$n(e))throw Ar('Incorrect "card created" filter value provided, must be a valid ISO date string')}),["equals","greaterThan","greaterThanOrEqualTo","lessThan","lessThanOrEqualTo","notEqualTo"]))),Mr(this,"addCardPriorityFilter",(()=>Pr(this.filters,"metadata","priority",(e=>{const t=typeof e,n=Array.isArray(e);if(n&&!Fr(e,["number"]))throw Ar('Incorrect "card priority" filter value provided. For "in" and "notIn" must be a number between 1 & 10 inclusive.');if(n){let t=!1;if(e.forEach((e=>{(e>10||e<1)&&(t=!0)})),t)throw Ar('Incorrect "card priority" filter value provided. For "in" and "notIn" must be a number between 1 & 10 inclusive.')}else if(!n&&"number"!==t||isNaN(e)||e>10||e<1)throw Ar('Incorrect "card priority" filter value provided, must be a number between 1 & 10 inclusive.')}),["equals","greaterThan","greaterThanOrEqualTo","in","lessThan","lessThanOrEqualTo","notEqualTo","notIn","between"]))),Mr(this,"clearFilters",(()=>{this.filters={},this.onClearFilter()})),Mr(this,"apply",(()=>{this.onApplyFilter()})),Mr(this,"getFilterObject",(()=>this.filters)),this.filters={},this.onApplyFilter=e,this.onClearFilter=t}}const Pr=(e,t,n,r,i)=>{const o=(i,o)=>a=>{r(a),((e,t,n)=>{const r=typeof t;switch(e){case"eq":case"ne":if(!["number","string","boolean","null"].includes(r))throw Ar(`Operator "${n}" must be a number, string, boolean or null`);break;case"gt":case"gte":case"lt":case"lte":if(!["string","number"].includes(r))throw Ar(`Operator "${n}" must be a number or ISO date string`);if("string"===r&&!$n(t))throw Ar(`Operator "${n}" must be a number or ISO date string`);break;case"in":case"nin":if(!Array.isArray(t))throw Ar(`Operator "${n}" must be either an array of numbers or an array of strings`);if(!Fr(t,["string","number"]))throw Ar(`Operator "${n}" must be either an array of numbers or an array of strings`);break;case"between":if(2!==t.length||!Fr(t,["number"]))throw Ar(`Operator "${n}" must be an array of 2 numbers: [minimumValue, maximumValue]`)}})(i,a,o),e[`${t}.${n}__${i}`]=a},a={equals:o("eq","equals"),greaterThan:o("gt","greaterThan"),greaterThanOrEqualTo:o("gte","greaterThanOrEqualTo"),in:o("in","in"),lessThan:o("lt","lessThan"),lessThanOrEqualTo:o("lte","lessThanOrEqualto"),notEqualTo:o("ne","notEqualTo"),notIn:o("nin","notIn"),between:o("between","between")};return Object.keys(a).forEach((e=>{i.includes(e)||delete a[e]})),a};function Hr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Rr{constructor(e){var t,n,r,i,o;Hr(this,"totals",void 0),Hr(this,"metricsByContainer",void 0);const a=(()=>{const e=sessionStorage.getItem(g),t=e?JSON.parse(e):void 0;return new Set(t)})();let s={active:0,unseen:0};(null==e||null===(t=e.aggregates)||void 0===t||null===(n=t.cards)||void 0===n?void 0:n.total)&&(s.active=e.aggregates.cards.total.active,s.unseen=e.aggregates.cards.total.unseenCardInstanceIds.filter((e=>!a.has(e))).length),this.totals=s,this.metricsByContainer=(null==e||null===(r=e.aggregates)||void 0===r||null===(i=r.cards)||void 0===i||null===(o=i.byContainer)||void 0===o?void 0:o.reduce(((e,t)=>(e[t.containerId]={unseen:t.unseenCardInstanceIds.filter((e=>!a.has(e))).length,active:t.active},e)),{}))||{}}unseenCards(){return this.totals.unseen||0}totalCards(){return this.totals.active||0}unseenCardsForStreamContainer(e){var t;return(null===(t=this.metricsByContainer[e])||void 0===t?void 0:t.unseen)||0}totalCardsForStreamContainer(e){var t;return(null===(t=this.metricsByContainer[e])||void 0===t?void 0:t.active)||0}}var Lr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};let Wr;const Nr=(e,t,n)=>Lr(void 0,void 0,void 0,(function*(){zr();let r=Object.assign({deviceId:Wr.deviceId,appId:Wr.appId,streamContainerIds:e,platform:Wr.platform},n?{notificationsEnabled:n}:{});const{data:i,response:o}=yield lr.put("register-containers",r,t);if(Ur(Nr.name,i),o.error)throw o.error;return 200===o.status})),Vr=(e,t)=>Lr(void 0,void 0,void 0,(function*(){zr();let n={token:e,deviceId:Wr.deviceId,appId:Wr.appId,platform:Wr.platform};const{data:r,response:i}=yield lr.put("register",n,t);if(Ur(Vr.name,r),i.error)throw i.error;return 200===i.status})),Yr=e=>Lr(void 0,void 0,void 0,(function*(){zr();let t={deviceId:Wr.deviceId,appId:Wr.appId};const{data:n,response:r}=yield lr.delete("deregister-token",t,e);if(Ur(Yr.name,n),r.error)throw r.error;return 200===r.status})),$r=e=>{if(!Un(e))return null;const t=e.atomic;if(!Un(t))return null;const n=t,{source:r,cardInstanceId:i,streamContainerId:o,detail:a}=n;return"io.atomic"!==r||"string"!=typeof i||"number"!=typeof o&&"string"!=typeof o?null:{cardInstanceId:i,containerId:o.toString(),detail:Un(a)?a:{}}},qr=e=>{const t=[];return e||t.push("deviceInfo should be a non-null object."),(null==e?void 0:e.platform)||t.push('platform should be either "iOS" or "Android".'),(null==e?void 0:e.deviceId)||t.push("deviceId should be a non-empty string."),(null==e?void 0:e.appId)||t.push("appId should be a non-empty string."),(null==e?void 0:e.platform)&&!["ios","android"].includes(e.platform.toLowerCase())&&t.push('platform is invalid: should be either "iOS" or "Android".'),t.length>0?{success:!1,errors:t}:{success:!0,errors:[]}},zr=()=>{if(!qr(Wr).success)throw new Error("You must call setNativeDeviceInfo before registering for native notifications")},Ur=(e,t)=>{var n;(null==t||null===(n=t.errors)||void 0===n?void 0:n.length)&&s.error({level1:[`Errors detected with ${e}`,...t.errors.map((e=>null==e?void 0:e.title))]})};var Br=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const Kr=e=>{var t;const n=[],r=["mon","tue","wed","thu","fri","sat","sun","default"];if(null===(t=e.preferences)||void 0===t?void 0:t.notifications){for(const[t,o]of Object.entries(null===(i=e.preferences)||void 0===i?void 0:i.notifications)){var i;if(!r.includes(t)){n.push(`Invalid key provided for "${t}", notification preferences can only be provided for the following keys: ${r.toString()}`);continue}if(!(null==o?void 0:o.length))continue;const a=o.map((e=>{const{from:r,to:i}=e,o=e=>`${e.hours.toString().padStart(2,"0")}:${e.minutes.toString().padStart(2,"0")}`;if(!r&&!i||r&&!i||!r&&i)n.push(`Invalid notification range provided for ${t}, both a "from" & "to" value are required`);else if(isNaN(r.hours)||isNaN(r.minutes)||isNaN(i.hours)||isNaN(i.minutes))n.push(`Invalid notification range provided for ${t}, non-numeric value provided for "from" or "to"`);else if(r.hours>23||r.hours<0||i.hours>23||i.hours<0)n.push(`Invalid notification range provided for ${t}, hours must be between 0 & 23 inclusive`);else if(r.minutes>59||r.minutes<0||i.minutes>59||i.minutes<0)n.push(`Invalid notification range provided for ${t}, minutes must be between 0 & 59 inclusive`);else{if(!(r.hours>i.hours))return{from:o(r),to:o(i)};n.push(`Invalid notification range provided for ${t}, end time must be earlier than start time`)}}));e.preferences.notifications[t]=a}n.length&&(s.warn({level1:n}),delete e.preferences.notifications)}},Qr=()=>({updateTotalCardCount:(e,t,n)=>Object.assign(Object.assign({},e),{cardFeed:Object.assign(Object.assign({},e.cardFeed),{lastModified:null!=n?n:e.cardFeed.lastModified,metadata:Object.assign(Object.assign({},e.cardFeed.metadata),{totalCards:t})})}),setStreamFilter:(e,t)=>Object.assign(Object.assign({},e),{cardFeed:Object.assign(Object.assign({},e.cardFeed),{streamFilter:t})}),finishExternalAction(e,t){var n;return Object.assign(Object.assign({},e),{externalAction:(null===(n=e.externalAction)||void 0===n?void 0:n.actionId)===t?void 0:e.externalAction})}});var Gr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function Jr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Xr=n(5373),Zr="authCallbackError",ei="authRetryIntervalPending",ti="authTokenError",ni=(e,t)=>{t(e)},ri=(e,t)=>{var n,r,i,o,a;const s=(null===(n=t.features)||void 0===n||null===(r=n.cordova)||void 0===r?void 0:r.enabled)||!1,c=s?v():"https://downloads.atomic.io/web-sdk/release/24.2.1/iframe-manager-cdn-icons.js";if(s&&!c)return void console.error("The Atomic SDK could not locate a required script (iframe-manager.js). Ensure you have included the script on your page and have added the ID `atomic-frame-manager` to the element.");const l=null===(i=t.enabledUiElements)||void 0===i||null===(o=i.customContainerHeader)||void 0===o?void 0:o.headerElement;(null===(a=t.enabledUiElements)||void 0===a?void 0:a.customContainerHeader)&&(t.enabledUiElements.customContainerHeader.headerElement="");const d=`\n <!doctype html>\n <head>\n <title>Atomic SDK</title>\n <style>\n html,body {margin: 0; height: 100%; width:100%; overflow: hidden;}\n * {box-sizing: border-box;}\n </style>\n </head>\n <body>\n <script src='${c}' data-config='${JSON.stringify(t).replace(/'/g,"'")}' type='application/javascript'><\/script>\n <div id='custom-container-header' style='display:none;'>${null!=l?l:""}</div>\n </body>\n </html>\n`;e.setAttribute("srcdoc",d)};class ii{static setSessionDelegate(e,t){this.tokenRetryInterval=t||0,this.onAuthTokenRequested=e}static setTokenExpiryInterval(e){if(!("number"==typeof e&&e>0))return s.error({level1:["Could not set token expiry interval, invalid value provided. The value must be a number greater than 0."]});this.tokenExpiryInterval=e}static launch(e){ii.init();const t=new oi(e,Object.assign(Object.assign({},this.internalConfig),{autosizeFrame:!1}),"launcher",this.analyticsQueue);return ii.streamContainers[t.instanceId]={sendMessageToIframe:e=>t.sendMessageToIframe(e),logout:()=>{t.sendMessageToIframe({action:c})}},t}static embed(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];ii.init();const r=new oi(t,Object.assign(Object.assign({},this.internalConfig),{autosizeFrame:n}),"standalone",this.analyticsQueue,e);return ii.streamContainers[r.instanceId]={sendMessageToIframe:e=>r.sendMessageToIframe(e),logout:()=>{r.sendMessageToIframe({action:c})}},r}static singleCard(e,t){ii.init();const n=new oi(t,Object.assign(Object.assign({},this.internalConfig),{autosizeFrame:!0}),"single-card",this.analyticsQueue,e);return ii.streamContainers[n.instanceId]={sendMessageToIframe:e=>n.sendMessageToIframe(e),logout:()=>{n.sendMessageToIframe({action:c})}},n}static observableStreamContainer(e){const t=new ai(e,Object.assign({},this.internalConfig),this.analyticsQueue);return ii.streamContainers[t.instanceId]={sendMessageToIframe:e=>t.onMessageReceived(e),logout:()=>{t.onMessageReceived({action:c})}},t}static init(){return Gr(this,void 0,void 0,(function*(){if(!ii.hasPerformedInitialisation){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Xr)),document.head.appendChild(e),window.addEventListener("request-failed",(e=>{const t=e.detail,n=this.analyticsQueue.enqueue({timestamp:new Date,endUserId:t.request.endUserId||"",containerId:t.request.streamContainerId,cardInstanceId:t.request.cardInstanceId,eventName:ut,properties:{path:t.request.path,statusCode:t.request.statusCode}});if(n){var r;Or.sendAnalyticsMessage([n]);const e=Dr(n);null===(r=ii.sdkEventObserver)||void 0===r||r.call(ii,e)}})),ii.hasPerformedInitialisation=!0}const e=yr.webSocketConnection;e&&(null==e?void 0:e.readyState)!==(null==e?void 0:e.CLOSED)||this.internalConfig.webSocketDisabled||(yield this.createWebSocketConnection().catch((e=>{s.debug({level3:[`SDK init, error creating WebSocket connection: ${e}`]})})))}))}static initialise(e,t,n){return Gr(this,void 0,void 0,(function*(){const r={webSocketDisabled:this.internalConfig.webSocketDisabled,pollingFallbackDisabled:this.internalConfig.pollingFallbackDisabled,testHost:this.internalConfig.testHost,clientAppVersion:this.internalConfig.clientAppVersion};this.internalConfig=Object.assign({apiHost:e,apiKey:t,environmentId:n},r),e&&t&&n&&sessionStorage.setItem(m,JSON.stringify({initialiseCalled:!0,eventDispatched:!1})),ii.cachedToken=void 0,lr.initialise(e,t,n),this.internalConfig.webSocketDisabled||(yr.initialise(e,t,n),Or.reset(),yield this.createWebSocketConnection().catch((e=>{s.debug({level3:[`SDK initialise, error creating WebSocket connection: ${e}`]})}))),window.addEventListener("pageshow",(r=>{r.persisted&&(lr.initialise(e,t,n),this.internalConfig.webSocketDisabled||(yr.initialise(e,t,n),this.createWebSocketConnection().catch((e=>{s.debug({level3:[`SDK network clients reinitialized after page loaded from cache, error creating WebSocket connection: ${e}`]})}))),this.initialiseSDKBroadcastChannel())}))}))}static initialiseSDKBroadcastChannel(){var e;(null===(e=ii.containersBroadcastChannel)||void 0===e?void 0:e.isOpen)||(ii.containersBroadcastChannel=new gt)}static setApiProtocol(e){const{apiHost:t,apiKey:n,environmentId:r}=this.internalConfig;if(t||n||r)throw new Error("You must set API protocol before initialising the SDK. This is because the SDK needs to know the protocol to use when creating a connection to the Atomic Platform.");this.internalConfig.webSocketDisabled="http"===e,this.webSocketDisabled="http"===e}static enableDebugMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;s.logLevel=e,Object.values(ii.streamContainers).forEach((t=>t.sendMessageToIframe({action:"io.atomic.events.logLevelUpdate",values:{logLevel:e}})))}static createWebSocketConnection(){return Gr(this,arguments,void 0,(function*(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;const n={1:100,2:15e3,3:6e4};if(yr.openingConnection)return;const r={onMessage:e=>{Or.handleWebSocketMessage(e)},onError:e=>{s.error({level3:["WebSocket error handler received error message",e]})},onOpen:()=>Gr(this,void 0,void 0,(function*(){try{yield this.handleTokenRequest({skipCache:!0,authWebSocket:!0}),Or.lastPongSuccess=(new Date).toISOString(),Or.resubscribeActiveSubscriptions()}catch(e){s.error({level1:["Error authenticating WebSocket."],level2:[e]}),Object.values(ii.streamContainers).forEach((t=>{var n;t.sendMessageToIframe({action:p,values:null!==(n=e.message)&&void 0!==n?n:e})}))}})),onClose:r=>{switch(r.code){case mr.sdkChangingProtocol:case mr.sdkReinitialisedWebSocket:case mr.sdkSessionEnding:case mr.sdkCordovaBackgrounded:case mr.sdkPersistedToBrowserCache:case mr.unitTestConnectionClose:s.debug({level1:[`WebSocket closed with ${r.code} connection close code`],level2:[r]});break;case mr.retryConnection:if(s.debug({level1:[`WebSocket closed with ${r.code} connection close code`],level2:[r]}),e<3){const t=e+1;setTimeout((()=>{this.createWebSocketConnection(t)}),n[t])}else this.triggerPollingFallback(t);break;case mr.sdkClosedConnection:case mr.notPermitted:case mr.abnormalClosure:default:ii.internalConfig.pollingFallbackDisabled||this.triggerPollingFallback(t),s.debug({level1:[`WebSocket closed with ${r.code} connection close code`],level2:[r]})}}};try{yr.open("socket",r,t)}catch(e){s.error({level1:["Error creating WebSocket connection"],level2:[e]});const t=new Error(`Error creating WebSocket connection: ${e}`);throw t.name="WebSocket connection error",t}}))}static reinitialiseWebSocketConnection(){yr.close(mr.sdkReinitialisedWebSocket),this.createWebSocketConnection()}static authenticateWebSocketConnection(e){return Gr(this,void 0,void 0,(function*(){Or.sendAuthMessage(e),yr.connectionAuthenticated||(yr.authenticatingConnection=!0,yield new Promise(((e,t)=>{const n=setTimeout((()=>{ii.authMessageReject("WebSocket authentication timed out")}),yr.authenticationTimeout);ii.authMessageResolve=()=>{s.debug({level3:["WebSocket auth promise resolved."]}),e(),yr.purgeMessageQueue(),clearTimeout(n),yr.authenticatingConnection=!1},ii.authMessageReject=e=>{s.error({level3:["WebSocket auth promise rejected.",e]}),Object.values(ii.streamContainers).forEach((t=>{var n;t.sendMessageToIframe({action:p,values:null!==(n=e.message)&&void 0!==n?n:e})})),t(e),clearTimeout(n),yr.authenticatingConnection=!1}})))}))}static simulateWebSocketError(e){yr.close(),this.createWebSocketConnection(0,e)}static triggerPollingFallback(e){var t;ii.authMessageResolve=()=>null,ii.authMessageReject=()=>null,e&&(yr.close(),yr.clearTimeouts()),Object.values(this.streamContainers).forEach((e=>{e.sendMessageToIframe({action:d})}));const n=this.analyticsQueue.enqueue({timestamp:new Date,eventName:ut,endUserId:null!==(t=Gn(ii.cachedToken))&&void 0!==t?t:"",properties:Object.assign({path:`${this.internalConfig.environmentId}/socket`},e?{source:"user-simulate"}:{})});if(n){var r;Or.sendAnalyticsMessage([n]);const e=Dr(n);null===(r=ii.sdkEventObserver)||void 0===r||r.call(ii,e)}}static setTestHostHeader(e){this.internalConfig.testHost=e,lr.setTestHostHeader(e),yr.setTestHostParam(e)}static setClientAppVersion(e){if(!("string"==typeof e))return s.error({level1:["Could not set client app version"],level2:[": Invalid value provided, must be a string."]});e.length>128&&s.warn({level1:["Client app version truncated"],level2:[": value provided was longer than 128 character maximum."]});const t=e.substring(0,128);lr.setClientAppVersion(t),yr.setClientAppVersion(t),this.internalConfig.clientAppVersion=t}static setRetryTimer(){ii.tokenRetryInterval&&!ii.tokenRetryTimer&&(ii.tokenRetryTimer=setTimeout((()=>{ii.tokenRetryTimer=void 0}),ii.tokenRetryInterval))}static handleTokenRequest(e){var t,n;return Gr(this,void 0,void 0,(function*(){var r;let i,o=new Error;if(!ii.onAuthTokenRequested)throw o.message="Could not resolve an auth token. `AtomicSDK.setSessionDelegate` must be used to set a callback resolving to a promise that supplies an authentication token.",o.name=Zr,o;if(ii.tokenRetryTimer)throw o.message="Not ready to retry token request",o.name=ei,o;if(ii.cachedToken&&!(null==e?void 0:e.skipCache)){const e=qn(ii.cachedToken);if(!(e=>{const t=Math.floor((new Date).getTime()/1e3);return 1===(0,f.compareAsc)(t,e)})(e.exp-ii.tokenExpiryInterval))return ii.cachedToken;i=e}const a=yield Promise.race([new Promise((e=>{setTimeout((()=>{e(void 0)}),5e3)})),null===(r=ii.onAuthTokenRequested)||void 0===r?void 0:r.call(ii)]);if(!a||0===a.length)throw o.message="An authentication token was required for the request, however no token was returned.",o.name=ti,ii.setRetryTimer(),o;if(!zn(a))throw o.message="The auth token provided is not a valid JWT.",o.name=ti,ii.setRetryTimer(),o;if(i&&i.exp-i.iat<3600){const e=qn(a);(null!==(t=i.atomic_sub)&&void 0!==t?t:i.sub)!==(null!==(n=e.atomic_sub)&&void 0!==n?n:e.sub)&&s.error({level1:["User ID has changed between authenticated requests without first calling `AtomicSDK.logout` be sure to call this when a user is logged out"]})}const c=Gn(a),l=JSON.parse(sessionStorage.getItem(m)||"{}");if(c&&l.initialiseCalled&&!l.eventDispatched){const e={endUserId:c,eventName:lt,timestamp:new Date,properties:{}},t=ii.analyticsQueue.enqueue(e,"sdk-initialized");if(t){var d;Or.sendAnalyticsMessage([t]);const e=Dr(t);null===(d=ii.sdkEventObserver)||void 0===d||d.call(ii,e)}sessionStorage.setItem(m,JSON.stringify(Object.assign(Object.assign({},l),{eventDispatched:!0})))}if((null==e?void 0:e.authWebSocket)&&yr.isConnected()&&!yr.authenticatingConnection)try{yield ii.authenticateWebSocketConnection(a)}catch(o){throw s.error({level3:["Fresh auth token received, error authenticating WebSocket connection with new token.",o]}),o}return ii.cachedToken=a}))}static getCurrentUserId(){var e;return null!==(e=Gn(ii.cachedToken))&&void 0!==e?e:""}static requestCardCount(e){return Gr(this,void 0,void 0,(function*(){if(!e)throw new Error("A stream container ID is required when requesting card count.");if(!lr.isInitialised())throw new Error("You must call `AtomicSDK.initialise` before attempting to request card count.");try{const t=yield lr.get(`feed/${e}`,{requestToken:yield ii.handleTokenRequest},void 0,{streamContainerId:e});if(t.response.error)throw t.response.error;if(200===t.response.status&&t.data&&t.data.cardInstances)return{totalCards:t.data.cardInstances.length};throw new Error("Unexpected response returned when fetching card count.")}catch(e){throw new Error(`Card count could not be retrieved. ${e.message}`)}}))}static sendEvent(e){return Gr(this,void 0,void 0,(function*(){var t,n,r;if(console.error(new Error("`AtomicSDK.sendEvent` is deprecated and will be removed in a future release.")),!e.name)throw new Error("An event name is required to send an event.");if(!lr.isInitialised())throw new Error("You must call `AtomicSDK.initialise` before attempting to send an event.");let i={name:e.name,payload:{detail:(null===(t=e.payload)||void 0===t?void 0:t.detail)||{},metadata:(null===(n=e.payload)||void 0===n?void 0:n.metadata)||{},notificationDetail:(null===(r=e.payload)||void 0===r?void 0:r.notificationDetail)||{}}};e.lifecycleId&&(i.lifecycleId=e.lifecycleId);try{const e=yield lr.post("event",{data:i},{requestToken:yield ii.handleTokenRequest});if(e.data&&e.data.errors){const t=e.data.errors.map((e=>e.title||"")).join("\n");throw new Error(`The following errors were returned: ${t}`)}if(e.response.error)throw e.response.error;if(200!==e.response.status)throw new Error("No error information was available.");return e.data}catch(e){throw new Error(`The event could not be sent. ${e.message}`)}}))}static sendCustomEvent(e){return Gr(this,void 0,void 0,(function*(){var t;if(!lr.isInitialised())throw new Error("You must call `AtomicSDK.initialise` before attempting to send a custom event.");const n=Gn(yield ii.handleTokenRequest());if(!n)throw new Error("Could not send custom event, a valid user ID was not obtained from the auth token.");if("string"!=typeof e.eventName||!(null===(t=e.eventName)||void 0===t?void 0:t.length))throw new Error("Could not send custom event, an invalid event name was supplied. The `eventName` must be a string of non zero length.");if(void 0!==e.properties&&(Array.isArray(e.properties)||null===e.properties||"object"!=typeof e.properties))throw new Error("Could not send custom event, an invalid value was supplied for event properties.");const r=this.analyticsQueue.enqueue(Object.assign({endUserId:n,eventName:e.eventName,timestamp:new Date},e.properties?{properties:e.properties}:{}),"custom");r&&Or.sendAnalyticsMessage([r])}))}static observeSDKEvents(e){this.sdkEventObserver=e}static requestUserMetrics(){return Gr(this,void 0,void 0,(function*(){if(!lr.isInitialised())throw new Error("You must call `AtomicSDK.initialise` before attempting to request user metrics.");try{const e=yield lr.get("user-metrics",{requestToken:yield ii.handleTokenRequest},this.cachedUserMetrics.lastModified);if(e.response.error)throw e.response.error;switch(e.response.status){case 200:return this.cachedUserMetrics={lastModified:e.response.etag||void 0,userMetricsResponse:e.data,userMetrics:new Rr(e.data)},this.cachedUserMetrics.userMetrics;case 304:if(this.cachedUserMetrics.userMetricsResponse)return new Rr(this.cachedUserMetrics.userMetricsResponse);throw new Error("Response indicated that there were no new metrics, but no cached metrics could be returned.");default:throw new Error("No error information was available.")}}catch(e){throw new Error(`User metrics could not be retrieved. ${e.message}`)}}))}static updateUser(e){return Gr(this,void 0,void 0,(function*(){if(!lr.isInitialised())throw new Error("You must call `AtomicSDK.initialise` before attempting to update a user profile.");try{const{ok:r,error:i}=yield(t=e,n={requestToken:yield ii.handleTokenRequest},Br(void 0,void 0,void 0,(function*(){var e,r;(null===(e=t.preferences)||void 0===e?void 0:e.notifications)&&Kr(t);const{data:i,response:o}=yield lr.put("update-user",t,n);return(null==i||null===(r=i.errors)||void 0===r?void 0:r.length)&&s.error({level1:["Errors detected with user update:",...i.errors.map((e=>null==e?void 0:e.title))]}),o.error?{ok:!1,error:o.error}:{ok:200===o.status}})));if(i)throw i;return r}catch(e){throw new Error(`User update could not be completed. ${e.message}`)}var t,n}))}static onCardAction(e,t){if(!lr.isInitialised())throw new Error("You must call `AtomicSDK.initialise` before attempting to execute a card action.");if(!e||!t)throw new Error("You must provide a valid container ID and card ID to execute a card action.");return{dismiss:(n,r)=>Gr(this,void 0,void 0,(function*(){const i=yield ot(e,t,{requestToken:yield ii.handleTokenRequest});i.ok?n():i.error&&r(i.error)})),snooze:(n,r,i)=>Gr(this,void 0,void 0,(function*(){if(!i||"number"!=typeof i||i<0)throw new Error("Invalid snooze interval, interval must be a positive number");const o=yield at(e,t,i,{requestToken:yield ii.handleTokenRequest});o.ok?n():o.error&&r(o.error)})),submit:(n,r,i,o)=>Gr(this,void 0,void 0,(function*(){const a=null!=o?o:{};if(!i)throw new Error("Submit button name missing, a button name must be supplied to submit a card response");for(const[e,t]of Object.entries(a)){if("string"!=typeof e)throw new Error("Invalid card response supplied, response keys must be strings");if(!["string","number","boolean"].includes(typeof t))throw new Error("Invalid card response supplied, response values must be strings, numbers or booleans")}const s=yield it(e,t,Object.assign(Object.assign({},a),{[i]:null}),{requestToken:yield ii.handleTokenRequest});s.ok?n():s.error&&r(s.error)}))}}static logout(){return Gr(this,arguments,void 0,(function*(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0])try{yield ii.deregisterDeviceForNotifications()}catch(e){e.message.includes("You must call setNativeDeviceInfo before registering for native notifications")||console.error(`Problem de-registering notifications when logging out: ${e.message}`)}Object.values(ii.streamContainers).forEach((e=>{e.logout()})),ii.streamContainers={},yield this.analyticsQueue.flush(),ii.cachedUserMetrics={},ii.cachedToken=void 0,ii.tokenRetryTimer=void 0,ii.sdkEventObserver=null,sessionStorage.removeItem(g),yr.close(mr.sdkSessionEnding,"Connection closed by SDK, user logged out"),yr.reset(),ii.internalConfig=Object.assign(Object.assign({},ii.internalConfig),{apiHost:void 0,apiKey:void 0,environmentId:void 0}),lr.reset()}))}static login(e,t,n,r,i){ii.initialise(e,t,n),ii.setSessionDelegate(r,i)}static setNativeDeviceInfo(e){try{return(e=>{const t=qr(e);if(t.success)return Wr=e,!0;{const e=`Device info set with invalid parameters: ${t.errors.join("\n")}`;throw console.error(e),new Error(e)}})(e)}catch(e){throw new Error(`Failed to setNativeDeviceInfo: ${e.message}`)}}static registerDeviceForNotifications(e){return Gr(this,void 0,void 0,(function*(){if(!lr.isInitialised())throw new Error("You must call `AtomicSDK.initialise` before attempting to register the device for push notifications");try{return yield Vr(e,{requestToken:yield ii.handleTokenRequest})}catch(e){throw new Error(`${Vr.name} could not be completed. ${e.message}`)}}))}static deregisterDeviceForNotifications(){return Gr(this,void 0,void 0,(function*(){if(!lr.isInitialised())throw new Error("You must call `AtomicSDK.initialise` before attempting to deregister the device for push notifications");try{return yield Yr({requestToken:yield ii.handleTokenRequest})}catch(e){throw new Error(`${Yr.name} could not be completed. ${e.message}`)}}))}static registerStreamContainersForNotifications(e,t){return Gr(this,void 0,void 0,(function*(){if(!lr.isInitialised())throw new Error("You must call `AtomicSDK.initialise` before attempting to register stream containers for notifications");try{return yield Nr(e,{requestToken:yield ii.handleTokenRequest},t)}catch(e){throw new Error(`${Nr.name} could not be completed. ${e.message}`)}}))}static notificationFromPushPayload(e){return $r(e)}static trackPushNotificationReceived(e){var t;const n=$r(e);if(null==n)return!1;const r=null!==(t=Gn(ii.cachedToken))&&void 0!==t?t:"";let i={eventName:pt,endUserId:r,containerId:n.containerId,cardInstanceId:n.cardInstanceId,timestamp:new Date};const o=ii.analyticsQueue.enqueue(i);if(o){var a;Or.sendAnalyticsMessage([o]);const e=Dr(o);null===(a=ii.sdkEventObserver)||void 0===a||a.call(ii,e)}return!0}}Jr(ii,"hasPerformedInitialisation",!1),Jr(ii,"webSocketDisabled",!1),Jr(ii,"cachedUserMetrics",{}),Jr(ii,"internalConfig",{}),Jr(ii,"cachedToken",void 0),Jr(ii,"onError",void 0),Jr(ii,"sdkEventObserver",null),Jr(ii,"SDKEvents",_r),Jr(ii,"userMetricsTriggerEvents",new Set([_r.cardFeedUpdated,_r.cardCompleted,_r.cardDismissed,_r.cardSnoozed,_r.streamDisplayed,_r.sdkInitialized,_r.cardDisplayed])),Jr(ii,"onAuthTokenRequested",void 0),Jr(ii,"tokenRetryInterval",0),Jr(ii,"tokenRetryTimer",void 0),Jr(ii,"tokenExpiryInterval",60),Jr(ii,"authMessageResolve",(()=>null)),Jr(ii,"authMessageReject",(()=>null)),Jr(ii,"streamContainers",{}),Jr(ii,"containersBroadcastChannel","BroadcastChannel"in window?new gt:void 0),Jr(ii,"analyticsQueue",new class{constructor(){Qn(this,"eventQueue",[]),Qn(this,"flushTimeout",null),Qn(this,"flushPromise",null);const e=localStorage.getItem(Jn);if(e)try{this.eventQueue=JSON.parse(e)}catch(e){}this.scheduleFlush()}createEventPayload(e,n){const r={id:(0,t.v4)(),endUserId:e.endUserId,timestamp:e.timestamp.toISOString(),properties:e.properties||{},eventContext:{userLocalTimestamp:(0,f.format)(e.timestamp,"YYYY-MM-DDTHH:mm:ss.SSSZ")}};switch(n){case"standard":{const t=e;return Object.assign(Object.assign({},r),{analyticsEvent:t.eventName,hostContext:t.hostContext||{},sdkContext:{containerId:t.containerId||""},streamContext:{streamLength:t.streamLength||0,streamLengthVisible:t.streamLengthVisible||0,cardPositionInStream:t.streamCardPosition||0},cardContext:{cardInstanceId:t.cardInstanceId||"",cardInstanceStatus:t.cardInstanceStatus||"",cardViewState:t.cardViewState||"topview",cardPresentation:"individual"}})}case"custom":return Object.assign(Object.assign({},r),{eventType:"custom",eventName:e.eventName,sdkContext:{}});case"sdk-initialized":return Object.assign(Object.assign({},r),{analyticsEvent:e.eventName,hostContext:{},cardContext:{},streamContext:{},sdkContext:{}});default:return null}}enqueue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"standard";if(!lr.isInitialised())return null;const n=this.createEventPayload(e,t);return n&&(this.eventQueue.push(n),this.eventQueue.length>500&&this.eventQueue.splice(0,this.eventQueue.length-500)),this.persistQueue(),n}removeProcessedEvents(e){this.eventQueue.length&&(this.eventQueue=this.eventQueue.filter((t=>!e.includes(t.id))),this.persistQueue())}performFlush(){return Kn(this,void 0,void 0,(function*(){if(null!=this.flushTimeout&&(window.clearTimeout(this.flushTimeout),this.flushTimeout=null),this.eventQueue.length&&lr.isInitialised()){const e=[...this.eventQueue];200===(yield lr.put("analytics",{data:e})).response.status&&(this.eventQueue=this.eventQueue.filter((t=>!e.includes(t))),this.persistQueue())}this.scheduleFlush()}))}flush(){return Kn(this,void 0,void 0,(function*(){return this.flushPromise=null===this.flushPromise?this.performFlush():this.flushPromise.then((()=>this.performFlush())),this.flushPromise}))}scheduleFlush(){this.flushTimeout=window.setTimeout(this.flush.bind(this),3e4)}persistQueue(){localStorage.setItem(Jn,JSON.stringify(this.eventQueue))}});class oi{constructor(e,n,r,i,o){Jr(this,"iframe",void 0),Jr(this,"modalIframe",void 0),Jr(this,"toastIframe",void 0),Jr(this,"outsideClickListener",void 0),Jr(this,"queuedMessages",[]),Jr(this,"iframeLoaded",!1),Jr(this,"appOpen",!1),Jr(this,"launchButtonIconContainer",void 0),Jr(this,"launcher",void 0),Jr(this,"resizeObserver",void 0),Jr(this,"resolvedConfiguration",void 0),Jr(this,"instanceId",void 0),Jr(this,"streamFilters",new Er((()=>this.sendMessageToIframe({action:h,values:{filter:this.streamFilters.getFilterObject()}})),(()=>{this.sendMessageToIframe({action:h,values:{filter:void 0}})}))),Jr(this,"config",void 0),Jr(this,"analyticsQueue",void 0);const a=`${e.streamContainerId}`;if(null===e.streamContainerId||void 0===e.streamContainerId||"string"!=typeof e.streamContainerId&&"number"!=typeof e.streamContainerId||0===a.trim().length)throw new Error("The Atomic SDK failed to start. You must pass a `streamContainerId` when instantiating a stream container.");if(!ii.onAuthTokenRequested)throw new Error("You must use `AtomicSDK.setSessionDelegate` to set a callback resolving to a promise that supplies an authentication token before attempting to create a stream container.");if(!this.iframeLoaded){var s,c;let l=Object.assign(Object.assign(Object.assign({},e),{streamContainerId:a}),n),d=l.cardListRefreshInterval;l.cardListRefreshInterval=null!=d?0==d?0:Math.max(1e3,d):void 0;let u=l.runtimeVariableResolutionTimeout;if(l.runtimeVariableResolutionTimeout=null!=u?Math.max(0,u):void 0,"single-card"!==r&&(null===(s=e.features)||void 0===s||null===(c=s.horizontalContainerConfig)||void 0===c?void 0:c.enabled)&&!e.features.horizontalContainerConfig.cardWidth)throw new Error("The card width must be specified in the `horizontalContainerConfig` configuration object when attempting to create a stream container in horizontal mode.");this.resolvedConfiguration=l,this.instanceId=(0,t.v4)(),this.analyticsQueue=i,this.initIframe(l,r,o)}}stop(){this.iframeLoaded=!1,this.iframe&&this.iframe.parentNode&&this.iframe.parentNode.removeChild(this.iframe),this.modalIframe&&this.modalIframe.parentNode&&this.modalIframe.parentNode.removeChild(this.modalIframe),this.toastIframe&&this.toastIframe.parentNode&&this.toastIframe.parentNode.removeChild(this.toastIframe),this.launcher&&this.launcher.parentNode&&this.launcher.parentNode.removeChild(this.launcher),Or.activeSubscriptions[this.instanceId]&&(Or.unsubscribeFromCardFeed([this.instanceId]),delete ii.streamContainers[this.instanceId])}updateVariables(){this.sendMessageToIframe({action:"io.atomic.events.requestRuntimeVariables"})}setOpen(e){var t;if(void 0===e)return s.error({level1:["Open status not supplied to updateOpenStatus"]});if("launcher"===this.config.embedMode)document.removeEventListener("click",this.outsideClickListener);else if(!(null===(t=this.config.features)||void 0===t?void 0:t.controlledContainerOpenState))return s.error({level1:["To change the open status for this container you must enable `controlledContainerOpenState` in the features configuration"]});this.appOpen!==e&&(this.appOpen=e,this.updateAppOpen())}getIcon(e){var t;const{openIconSrc:n,closeIconSrc:r}=(null===(t=this.config.enabledUiElements)||void 0===t?void 0:t.launcherButton)||{};return n&&r?`<img src="${e?r:n}" style="max-height: 100%; max-width: 100%; margin: auto">`:e?'\n <svg width="12" height="12" viewBox="0 0 12 12">\n <path\n d="M1 1L6 6L11 11M1 11L11 1"\n stroke-width="2"\n stroke-linecap="round"\n stroke="white"\n style="pointer-events: none;"\n />\n </svg>\n ':'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="20"\n height="32"\n viewBox="0 0 28 32"\n fill="none"\n style="pointer-events: none;"\n >\n <path\n d="M18 22.8V26C18 28.2091 16.2091 30 14 30C11.7909 30 10 28.2091 10 26V22.8M18 22.8H10M18 22.8H26L22.8 19.6V17.2M10 22.8H2L5.2 19.6C5.2 19.6 5.2 15.5998 5.2 10.7998C5.2 5.9998 9.2 2 14 2C15.433 2 16.7947 2.3565 18 2.98436M11.6 11.6L15.6 15.6L26 5.2"\n stroke="white"\n stroke-width="3"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n </svg>\n '}toggleAppOpen(){this.appOpen=!this.appOpen,this.updateAppOpen()}updateAppOpen(){const e={action:"updateAppOpen",values:{open:this.appOpen}};this.sendMessageToIframe(e)}initLauncherButton(){var e;const{disabled:t,backgroundColor:n}=(null===(e=this.config.enabledUiElements)||void 0===e?void 0:e.launcherButton)||{};if(t)return;const r=document.createElement("div"),i=document.createElement("button");i.tabIndex=0,r.className="atomic-sdk-launcher-wrapper",i.className="atomic-sdk-launcher",i.setAttribute("data-testid","launcher-button"),this.launchButtonIconContainer=i,this.launcher=r,i.style.backgroundColor=n||"",i.innerHTML=this.getIcon(!1),r.appendChild(i),document.body.appendChild(r),r.addEventListener("click",(()=>{this.toggleAppOpen()})),this.outsideClickListener=e=>{e.target&&this.launcher&&this.launcher.contains(e.target)||this.toggleAppOpen()}}initIframe(t,n,r){var i,o,a,c,l;const d=Object.assign(Object.assign({},t),{windowOrigin:this.getWindowOrigin(),embedMode:n,instanceId:this.instanceId});if(this.config=d,this.iframe=document.createElement("iframe"),this.iframe.classList.add("atomic-sdk-frame"),this.iframe.classList.add(d.embedMode),this.iframe.setAttribute("frameBorder","0"),this.iframe.setAttribute("title",(null===(i=t.customStrings)||void 0===i?void 0:i.cardListTitle)||"Cards"),"ResizeObserver"in window){const t=document.createElement("div");t.style.width="1rem",t.style.visibility="hidden",t.id="text-size-observer",document.body.appendChild(t),this.resizeObserver=new ResizeObserver((t=>{var n,r;const i=null===(n=t[0])||void 0===n||null===(r=n.contentRect)||void 0===r?void 0:r.width;i&&this.iframe.contentWindow&&e("browser-font-changed",{fontSize:i},this.iframe.contentWindow)})),this.resizeObserver.observe(document.querySelector("#text-size-observer"))}d.logLevel=s.logLevel,r?r.appendChild(this.iframe):document.body.appendChild(this.iframe),this.iframe.addEventListener("load",(()=>{this.iframeLoaded=!0,this.flushMessages()})),ri(this.iframe,d),("single-card"===n&&(null===(o=t.enabledUiElements)||void 0===o?void 0:o.cardListToast)||(null===(a=t.enabledUiElements)||void 0===a?void 0:a.customToastContainer))&&(this.toastIframe=document.createElement("iframe"),this.toastIframe.classList.add("atomic-sdk-frame"),this.toastIframe.classList.add("toast-container"),this.toastIframe.setAttribute("id","atomic-sdk-toast-container"),this.toastIframe.setAttribute("frameBorder","0"),this.toastIframe.setAttribute("title","Toast messages"),this.toastIframe.setAttribute("role","presentation"),this.toastIframe.setAttribute("aria-hidden","true"),r?r.appendChild(this.toastIframe):document.body.appendChild(this.toastIframe),ri(this.toastIframe,Object.assign(Object.assign({},d),{embedMode:"toast"}))),("single-card"===n||"standalone"===n&&(null===(c=t.features)||void 0===c||null===(l=c.horizontalContainerConfig)||void 0===l?void 0:l.enabled))&&(this.modalIframe=document.createElement("iframe"),this.modalIframe.classList.add("atomic-sdk-frame"),this.modalIframe.classList.add("modal-subview"),this.modalIframe.setAttribute("frameBorder","0"),this.modalIframe.setAttribute("role","presentation"),this.modalIframe.setAttribute("aria-hidden","true"),this.modalIframe.setAttribute("title","Empty Modal"),r?r.appendChild(this.modalIframe):document.body.appendChild(this.modalIframe),ri(this.modalIframe,Object.assign(Object.assign({},d),{embedMode:"modal-subview"}))),window.addEventListener("message",this.onMessageReceived.bind(this))}onMessageReceived(e){var t;return Gr(this,void 0,void 0,(function*(){if(e.source===this.iframe.contentWindow||this.modalIframe&&e.source===this.modalIframe.contentWindow)switch(e.data.action){case"io.atomic.events.cardCountChanged":{var n;this.config.onCardCountChanged&&this.config.onCardCountChanged(e.data.cardCount,e.data.totalCards);const t=jr({cardCount:e.data.cardCount,streamContainerId:this.resolvedConfiguration.streamContainerId||"",endUserId:ii.getCurrentUserId()});null===(n=ii.sdkEventObserver)||void 0===n||n.call(ii,t);break}case"io.atomic.events.ready":switch(this.config.embedMode){case"standalone":case"single-card":var r;this.appOpen=!(null===(r=this.config.features)||void 0===r?void 0:r.controlledContainerOpenState),this.updateAppOpen();break;case"launcher":this.iframe.tabIndex=-1,this.initLauncherButton()}break;case"io.atomic.events.resolveRuntimeVariables":this.handleRuntimeVariableResolution(e.data.requestId,e.data.cards,this.config.onRuntimeVariablesRequested||ni);break;case"io.atomic.events.linkButtonPressed":this.config.onLinkButtonPressed&&this.config.onLinkButtonPressed(e.data.payload);break;case"io.atomic.events.submitButtonPressed":this.config.onSubmitButtonPressed&&this.config.onSubmitButtonPressed(e.data.payload);break;case"io.atomic.events.didUpdateAppOpen":var i,o;if(this.appOpen=e.data.values.open,"launcher"===this.config.embedMode)this.updateVisibilityForLauncher(),null===(i=(o=this.resolvedConfiguration).onLauncherToggled)||void 0===i||i.call(o,this.appOpen);break;case"io.atomic.events.frameHeightChanged":this.config.onSizeChanged&&this.config.onSizeChanged(this.iframe.clientWidth,e.data.height);break;case"io.atomic.events.analyticsEventReceived":if(e.data.sdkOnlyEvent){var a;const t=this.analyticsQueue.createEventPayload(e.data.event,"standard");t&&(null===(a=ii.sdkEventObserver)||void 0===a||a.call(ii,Dr(t)))}else this.enqueueAnalyticsEvent(e.data.event);break;case"io.atomic.events.cardEventReceived":{this.config.onCardEvent&&this.config.onCardEvent(e.data.event);const t=((e,t)=>{const n=e.eventPayload?Object.assign({},e.eventPayload):null;if(!n)return null;switch(e.type){case"snoozed":n.eventName=Tr.cardSnoozed,n.analyticsEvent=Tr.cardSnoozed;break;case"dismissed":n.eventName=Tr.cardDismissed,n.analyticsEvent=Tr.cardDismissed;break;case"submitted":n.eventName=Tr.cardCompleted,n.analyticsEvent=Tr.cardCompleted;break;default:return null}return n.sdkContext={containerId:t},n})(e.data.event,e.data.streamContainerId);var c;if(t)ii.cachedUserMetrics={},null===(c=ii.sdkEventObserver)||void 0===c||c.call(ii,t);break}case"io.atomic.events.errorReceived":ii.onError&&ii.onError(e.data.error);break;case"io.atomic.events.authTokenRequested":if(e.data.requestId&&ii.onAuthTokenRequested){let t;try{t=yield ii.handleTokenRequest(),this.sendMessageToIframe({action:"io.atomic.events.authTokenReceived",values:{requestId:e.data.requestId,authToken:t}},e.source)}catch(t){s.error({level3:["stream container requested auth token, error retrieving token",t]}),this.sendMessageToIframe({action:"io.atomic.events.authTokenError",values:{requestId:e.data.requestId,error:t.message}})}}else console.error("The Atomic SDK requested an authentication token but no authentication callback has been set using `AtomicSDK.setSessionDelegate`. Use this method to set a callback resolving to a promise that supplies an authentication token");break;case"io.atomic.events.cardFeedSubscribeRequested":try{yr.connectionAuthenticated||(yield ii.handleTokenRequest({skipCache:!0,authWebSocket:!0})),Or.subscribeToCardFeed([{subscriptionId:this.instanceId,streamContainerId:e.data.streamContainerId,filters:this.streamFilters.getFilterObject()}]),this.sendMessageToIframe({action:"io.atomic.events.cardFeedSubscriptionId",values:{subscriptionId:this.instanceId}})}catch(e){this.sendMessageToIframe({action:"io.atomic.events.feedSubscribeError",values:null!==(t=e.message)&&void 0!==t?t:e}),s.error({level1:["error sending card feed subscription request by WebSockets"],level2:[e]})}break;case"io.atomic.events.subscriptionRetryExceeded":yr.close(mr.sdkClosedConnection,"Subscription retry exceeded"),ii.authMessageResolve=()=>null,ii.authMessageReject=()=>null;break;case"io.atomic.events.cardFeedUnsubscribeRequested":e.data.subscriptionId===this.instanceId&&(Or.unsubscribeFromCardFeed([this.instanceId]),delete ii.streamContainers[this.instanceId]);break;case"io.atomic.events.socketReconnectionRequested":ii.createWebSocketConnection().catch((e=>{var t;this.sendMessageToIframe({action:p,values:null!==(t=e.message)&&void 0!==t?t:e})}));break;case"io.atomic.events.socketConnectionHealthcheck":yr.connectionHealthCheck()}}))}enqueueAnalyticsEvent(e){const t=this.analyticsQueue.enqueue(e);if(t){var n;Or.sendAnalyticsMessage([t]);const e=Dr(t);null===(n=ii.sdkEventObserver)||void 0===n||n.call(ii,e)}ii.containersBroadcastChannel?ii.containersBroadcastChannel.postMessage({type:mt.ANALYTICS_EVENT,eventQueued:e}):s.error({level1:["BroadcastChannel API unavailable"]})}updateVisibilityForLauncher(){var e;this.appOpen?(this.iframe.className+=" open",this.iframe.tabIndex=0,this.iframe.focus(),document.addEventListener("click",this.outsideClickListener)):(this.iframe.className=this.iframe.className.replace(" open",""),this.iframe.tabIndex=-1,null===(e=this.launchButtonIconContainer)||void 0===e||e.focus(),document.removeEventListener("click",this.outsideClickListener));this.launchButtonIconContainer&&(this.launchButtonIconContainer.innerHTML=this.getIcon(this.appOpen))}handleRuntimeVariableResolution(e,t,n){n(t.map((e=>Object.assign(Object.assign({},e),{runtimeVariables:new Map(e.runtimeVariables)}))),(n=>{let r=t;if(Array.isArray(n))if(n.length!==t.length)console.error(`The number of cards returned from the runtime variable resolver (${n.length}) is not equal to the cards provided (${t.length}).`);else{n.every((e=>{if(!(e.runtimeVariables instanceof Map))return!1;for(const t of e.runtimeVariables)if("string"!=typeof t[0]||"string"!=typeof t[1])return!1;return!0}))?r=n:console.error("One or more runtime variables have been resolved to non-string types. Runtime variables can only be resolved to strings currently.")}else console.error("Incorrect type returned when resolving runtime variables - an array of cards was expected.");const i={action:"didResolveRuntimeVariables",values:{cards:r.map((e=>Object.assign(Object.assign({},e),{runtimeVariables:Array.from(e.runtimeVariables.entries())}))),requestId:e}};this.sendMessageToIframe(i)}))}sendMessageToIframe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.iframe.contentWindow;t&&(this.iframeLoaded?t.postMessage(e,this.getWindowOrigin()):this.queuedMessages.push(e))}flushMessages(){const e=this.iframe.contentWindow;e&&(this.queuedMessages.forEach((t=>e.postMessage(t,this.getWindowOrigin()))),this.queuedMessages=[])}getWindowOrigin(){var e,t;return(null===(e=this.resolvedConfiguration.features)||void 0===e||null===(t=e.cordova)||void 0===t?void 0:t.enabled)?"*":`${window.location.protocol}//${window.location.host}`}}class ai{constructor(e,n,r){if(Jr(this,"resolvedConfiguration",void 0),Jr(this,"instanceId",void 0),Jr(this,"streamFilters",new Er((()=>{s.debug({level1:[`applied stream filter for stream container: ${this.instanceId}`],level2:[this.streamFilters.getFilterObject()]}),this.sendWebSocketFeedSubscriptionMessage()}),(()=>{s.debug({level1:[`cleared stream filter for stream container: ${this.instanceId}`]}),this.sendWebSocketFeedSubscriptionMessage()}))),Jr(this,"analyticsQueue",void 0),Jr(this,"pollCounter",0),Jr(this,"pollTimer",void 0),Jr(this,"store",void 0),Jr(this,"boundActions",void 0),Jr(this,"tokenProvider",{requestToken:()=>Gr(this,void 0,void 0,(function*(){return yield ii.handleTokenRequest()}))}),"string"!=typeof e.streamContainerId||0===e.streamContainerId.trim().length)throw new Error("Failed to start stream container. You must pass a `streamContainerId` when instantiating a stream container.");{if(!ii.onAuthTokenRequested)throw new Error("You must use `AtomicSDK.setSessionDelegate` to set a callback resolving to a promise that supplies an authentication token before attempting to create a stream container.");let o=Object.assign(Object.assign({},e),n),a=o.cardListRefreshInterval;o.cardListRefreshInterval=null!=a?0==a?0:Math.max(1e3,a):void 0;let s=o.runtimeVariableResolutionTimeout;o.runtimeVariableResolutionTimeout=null!=s?Math.max(0,s):void 0,this.resolvedConfiguration=o,this.instanceId=(0,t.v4)(),this.store=((e,t)=>{var n,r,i;let{streamContainerId:o,windowOrigin:a,subviewCardInstance:s,startingLayoutId:c,cardInstances:l,cardListRefreshInterval:d,runtimeVariableResolutionTimeout:u,embedMode:p,customStrings:h,cardListTutorialSeen:m,features:g,firstLoadStyles:v,enabledUiElements:f,interfaceStyle:b}=e;const y=t&&t.length?(0,H.m)(...t):null,S="preview"===p,w=null==g?void 0:g.runtimeVariableAnalytics;return L=P()(Object.assign(Object.assign({},R),{application:Object.assign(Object.assign({},R.application),{isPreview:S,streamContainerId:void 0!==o?o:R.application.streamContainerId,windowOrigin:a||R.application.windowOrigin,cardListRefreshInterval:void 0!==d?d:R.application.cardListRefreshInterval,runtimeVariableResolutionTimeout:void 0!==u?u:R.application.runtimeVariableResolutionTimeout,embedMode:p,customStrings:h||R.application.customStrings,cardLimit:"single-card"===p?1:void 0,firstLoadStyles:{backgroundColor:(null==v?void 0:v.backgroundColor)||R.application.firstLoadStyles.backgroundColor,textColor:(null==v?void 0:v.textColor)||R.application.firstLoadStyles.textColor,loadingSpinnerColor:(null==v?void 0:v.loadingSpinnerColor)||R.application.firstLoadStyles.loadingSpinnerColor,buttonTextColor:(null==v?void 0:v.buttonTextColor)||R.application.firstLoadStyles.buttonTextColor},enabledUiElements:{cardListToast:null===(n=null==f?void 0:f.cardListToast)||void 0===n||n,customToastContainer:null!==(r=null==f?void 0:f.customToastContainer)&&void 0!==r&&r,toastConfig:null==f?void 0:f.toastConfig,cardListHeader:null===(i=null==f?void 0:f.cardListHeader)||void 0===i||i,customContainerHeader:null==f?void 0:f.customContainerHeader},interfaceStyle:void 0!==b?b:"automatic"}),navigationStack:{items:s&&c?[{cardInstance:s,cardInstanceId:s.instance.id,subviewId:c,kind:"subview"}]:R.navigationStack.items},cardFeed:Object.assign(Object.assign({},R.cardFeed),{cardInstances:l||R.cardFeed.cardInstances,tutorialSeen:void 0===m||m,runtimeVariableAnalyticsEnabled:void 0!==w&&w,cardVoting:null==g?void 0:g.cardVoting,cardMinimumHeight:null==g?void 0:g.cardMinimumHeight,horizontalContainerConfig:null==g?void 0:g.horizontalContainerConfig})}),y),L})(Object.assign(Object.assign({},o),{embedMode:"headless"})),this.boundActions=(0,i.kv)((0,i.Y2)(Ye,Qr),this.store),this.analyticsQueue=r}}start(){s.debug({level3:[`Starting card feed updates for observable stream container: ${this.instanceId}`]}),ii.streamContainers[this.instanceId]||(ii.streamContainers[this.instanceId]={sendMessageToIframe:e=>this.onMessageReceived(e),logout:()=>{this.onMessageReceived({action:c})}}),this.resolvedConfiguration.webSocketDisabled?this.pollCardFeed():Or.activeSubscriptions[this.instanceId]||this.sendWebSocketFeedSubscriptionMessage()}stop(){s.debug({level3:[`Stopping card feed updates for observable stream container: ${this.instanceId}`]}),Or.activeSubscriptions[this.instanceId]&&Or.unsubscribeFromCardFeed([this.instanceId]),this.cancelCardListPolling(),delete ii.streamContainers[this.instanceId]}pollCardFeed(){var e,t;return Gr(this,void 0,void 0,(function*(){const n=this.store.getState(),r=n.cardFeed,i=yield rt(n.application.streamContainerId,this.tokenProvider,n.application.runtimeVariableResolutionTimeout,n.cardFeed.lastModified,this.runtimeVariableResolver.bind(this),void 0,this.streamFilters.getFilterObject());this.trackCardCountChange(r,i),this.boundActions.cardFeedLoaded(i),this.boundActions.runtimeVariableReplacement(),this.resolvedConfiguration.cardFeedHandler(null!==(e=this.store.getState().cardFeed.cardInstances)&&void 0!==e?e:[]),0!==this.resolvedConfiguration.cardListRefreshInterval&&(this.pollTimer=setTimeout((()=>{clearTimeout(this.pollTimer),this.resolvedConfiguration.webSocketDisabled?this.pollCardFeed():this.pollCounter<9?(this.pollCounter++,this.pollCardFeed()):(this.pollCounter=0,this.pollTimer=null,s.debug({level3:["Attempt to reconnect websocket initiated"]}),ii.createWebSocketConnection().catch((e=>{var t;s.debug({level3:["Error reconnecting websocket",e]}),null===(t=ii.onError)||void 0===t||t.call(ii,e)})))}),null!==(t=this.resolvedConfiguration.cardListRefreshInterval)&&void 0!==t?t:R.application.cardListRefreshInterval))}))}cancelCardListPolling(){this.pollTimer&&(clearTimeout(this.pollTimer),s.debug({level3:[`Observable stream container ${this.instanceId}, card feed polling cancelled`]})),this.pollTimer=null,this.pollCounter=0}sendWebSocketFeedSubscriptionMessage(){Or.subscribeToCardFeed([{subscriptionId:this.instanceId,streamContainerId:this.resolvedConfiguration.streamContainerId||"",filters:this.streamFilters.getFilterObject()}])}handleCardFeedUpdate(e){var t,n;return Gr(this,void 0,void 0,(function*(){const r=this.store.getState(),i=r.cardFeed;let o;const a=e.filter((e=>("replace-feed"===e.type&&(o=e),"replace-feed"!==e.type)));if(o){const{instances:e,totalCards:n}=o.data.cardInstances,a=yield st(e,r.application.runtimeVariableResolutionTimeout,this.runtimeVariableResolver.bind(this)),s={cardInstances:e,unfilteredCardInstanceCount:e.length,runtimeVariables:a,metadata:{totalCards:n},lastModified:void 0};this.trackCardCountChange(i,s),this.boundActions.cardFeedLoaded(s),this.boundActions.runtimeVariableReplacement(),this.resolvedConfiguration.cardFeedHandler(null!==(t=this.store.getState().cardFeed.cardInstances)&&void 0!==t?t:[])}if(a.length){const e=e=>Gr(this,void 0,void 0,(function*(){if(e){const e=yield(t=r.application.streamContainerId,n=this.tokenProvider,tt(void 0,void 0,void 0,(function*(){const e=yield lr.get(`feed/${t}`,n,void 0,{streamContainerId:t});var r,i;return 200===e.response.status&&e.data&&e.data.metadata?{cardCount:null===(r=e.data.cardInstances)||void 0===r?void 0:r.length,totalCards:null===(i=e.data.metadata)||void 0===i?void 0:i.totalCards,lastModified:e.response.etag}:{error:e.response.error}})));if(e.error)s.error({level1:["error retrieving total card count after card feed updated"],level2:[e.error]});else{const{totalCards:t,lastModified:n}=e;t&&this.boundActions.updateTotalCardCount(t,n),this.trackCardCountChange(i,this.store.getState().cardFeed)}}var t,n})),t=e=>Gr(this,void 0,void 0,(function*(){return yield st(e,r.application.runtimeVariableResolutionTimeout,this.runtimeVariableResolver.bind(this))}));yield this.boundActions.cardFeedDeltaUpdate(a,e,t),this.boundActions.runtimeVariableReplacement(),this.resolvedConfiguration.cardFeedHandler(null!==(n=this.store.getState().cardFeed.cardInstances)&&void 0!==n?n:[])}}))}trackCardCountChange(e,t){var n,r,i,o,a;const s=e.cardInstances.map((e=>e.instance.id)),c=(null==t||null===(i=t.cardInstances)||void 0===i?void 0:i.map((e=>e.instance.id)))||[],l=(null===(o=e.metadata)||void 0===o?void 0:o.totalCards)||0,d=(null===(a=t.metadata)||void 0===a?void 0:a.totalCards)||0;if(!((e,t)=>e.length===t.length&&(e.sort(),t.sort(),e.every(((e,n)=>e===t[n]))))(s,c)||l!==d){var u,p,h;if(this.resolvedConfiguration.onCardCountChanged)this.resolvedConfiguration.onCardCountChanged(null!==(n=null===(h=t.cardInstances)||void 0===h?void 0:h.length)&&void 0!==n?n:0,d);const e=jr({cardCount:null!==(r=null===(u=t.cardInstances)||void 0===u?void 0:u.length)&&void 0!==r?r:0,streamContainerId:this.resolvedConfiguration.streamContainerId||"",endUserId:ii.getCurrentUserId()});null===(p=ii.sdkEventObserver)||void 0===p||p.call(ii,e)}}runtimeVariableResolver(e){const t=this.resolvedConfiguration.onRuntimeVariablesRequested||ni;return new Promise((n=>{t(e.map((e=>Object.assign(Object.assign({},e),{runtimeVariables:new Map(e.runtimeVariables)}))),(t=>{let r=e;if(Array.isArray(t))if(t.length!==e.length)console.error(`The number of cards returned from the runtime variable resolver (${t.length}) is not equal to the cards provided (${e.length}).`);else{t.every((e=>{if(!(e.runtimeVariables instanceof Map))return!1;for(const t of e.runtimeVariables)if("string"!=typeof t[0]||"string"!=typeof t[1])return!1;return!0}))?r=t:console.error("One or more runtime variables have been resolved to non-string types. Runtime variables can only be resolved to strings currently.")}else console.error("Incorrect type returned when resolving runtime variables - an array of cards was expected.");n(r)}))}))}sendAnalyticsEvent(e){return Gr(this,arguments,void 0,(function*(){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];yr.connectionHealthCheck();const n=this.store.getState(),r=n.cardFeed.cardInstances||[],i=r.filter((t=>t.instance.id===e.cardInstanceId)),o=i.length?i[0]:null,a=o?r.indexOf(o)+1:0;let c;try{c=yield this.tokenProvider.requestToken()}catch(e){s.error({level1:["Error requesting auth token to send analytics event"],level2:[e]})}const l=Object.assign(Object.assign({},e),{endUserId:Gn(c)||"",cardInstanceStatus:o?o.instance.status:"",containerId:n.application.streamContainerId,timestamp:new Date,streamCardPosition:a,streamLength:n.cardFeed.unfilteredCardInstanceCount,streamLengthVisible:r.length});let d;if(t?d=this.analyticsQueue.createEventPayload(l,"standard"):(d=this.analyticsQueue.enqueue(l),Or.sendAnalyticsMessage([d])),d){var u;const e=Dr(d);null===(u=ii.sdkEventObserver)||void 0===u||u.call(ii,e)}}))}updateVariables(){var e,t;return Gr(this,void 0,void 0,(function*(){const n=this.store.getState(),r=yield rt(n.application.streamContainerId,this.tokenProvider,n.application.runtimeVariableResolutionTimeout,"",this.runtimeVariableResolver.bind(this),void 0,this.streamFilters.getFilterObject());r.error&&s.error({level1:["error retrieving card feed for runtime variable update"],level2:[r.error]});const i=yield st(null!==(e=r.cardInstances)&&void 0!==e?e:[],n.application.runtimeVariableResolutionTimeout,this.runtimeVariableResolver.bind(this));this.boundActions.cardFeedLoaded(r),this.boundActions.runtimeVariableReplacement(i),this.resolvedConfiguration.cardFeedHandler(null!==(t=this.store.getState().cardFeed.cardInstances)&&void 0!==t?t:[]),n.cardFeed.cardInstances.forEach((e=>{if(e.runtimeVariables&&e.runtimeVariables.values){var t;const r=null===(t=n.cardFeed.runtimeVariables.values)||void 0===t?void 0:t.get(e.instance.id);this.sendAnalyticsEvent({cardInstanceId:e.instance.id,cardViewState:"topview",eventName:dt,properties:{resolvedVariables:e.runtimeVariables.reduce(((e,t)=>(e[t.name]=(null==r?void 0:r.get(t.name))||"",e)),{})}},!1===n.cardFeed.runtimeVariableAnalyticsEnabled)}}))}))}onMessageReceived(e){switch(e.action){case l:const t=e.values.cardFeedUpdates;this.handleCardFeedUpdate(t);break;case d:void 0===this.pollTimer&&this.pollCardFeed();break;case u:this.cancelCardListPolling();break;case c:this.stop();break;default:s.debug({level3:["Unknown message received by headless stream container: ",e.data]})}}}})(),r=r.default})()));
|