@nemme/js-sdk 0.2.0

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.
Files changed (38) hide show
  1. package/README.md +8 -0
  2. package/dist/assets/js-sdk.css +1 -0
  3. package/dist/browser.d.ts +14 -0
  4. package/dist/client.d.ts +31 -0
  5. package/dist/config.d.ts +4 -0
  6. package/dist/deliveries/delivery-manager.d.ts +52 -0
  7. package/dist/forms/form-manager.d.ts +19 -0
  8. package/dist/forms/form-wrapper/form-wrapper.d.ts +13 -0
  9. package/dist/forms/form-wrapper/step.d.ts +13 -0
  10. package/dist/forms/form.d.ts +2 -0
  11. package/dist/forms/index.d.ts +5 -0
  12. package/dist/forms/question-choice/question-choice.d.ts +20 -0
  13. package/dist/forms/question-text/question-text.d.ts +15 -0
  14. package/dist/forms/question-wrapper.d.ts +14 -0
  15. package/dist/forms/transition-end/transition-end.d.ts +11 -0
  16. package/dist/forms/transition-start/transition-start.d.ts +12 -0
  17. package/dist/forms/transition-wrapper.d.ts +12 -0
  18. package/dist/i18n.d.ts +2 -0
  19. package/dist/index.cjs +68 -0
  20. package/dist/index.cjs.map +1 -0
  21. package/dist/index.d.ts +6 -0
  22. package/dist/index.esm.js +4904 -0
  23. package/dist/index.esm.js.map +1 -0
  24. package/dist/nemme-sdk.umd.js +68 -0
  25. package/dist/nemme-sdk.umd.js.map +1 -0
  26. package/dist/networking/httpClient.d.ts +36 -0
  27. package/dist/networking/index.d.ts +2 -0
  28. package/dist/react/NemmeProvider.d.ts +9 -0
  29. package/dist/react/context.d.ts +7 -0
  30. package/dist/react/index.d.ts +3 -0
  31. package/dist/react/useNemme.d.ts +8 -0
  32. package/dist/react/useNemmeContext.d.ts +1 -0
  33. package/dist/tracking/tracking-manager.d.ts +62 -0
  34. package/dist/translations/en.json.d.ts +9 -0
  35. package/dist/translations/nb.json.d.ts +4 -0
  36. package/dist/utils/index.d.ts +2 -0
  37. package/dist/utils/logger.d.ts +26 -0
  38. package/package.json +88 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,68 @@
1
+ "use strict";var Kr=Object.defineProperty;var Jr=(a,e,t)=>e in a?Kr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var V=(a,e,t)=>Jr(a,typeof e!="symbol"?e+"":e,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const F=require("react"),Zr=require("react-dom");function Yr(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const b=Yr(F);var je={},Kt;function Xr(){if(Kt)return je;Kt=1;var a=Zr;if(process.env.NODE_ENV==="production")je.createRoot=a.createRoot,je.hydrateRoot=a.hydrateRoot;else{var e=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;je.createRoot=function(t,r){e.usingClientEntryPoint=!0;try{return a.createRoot(t,r)}finally{e.usingClientEntryPoint=!1}},je.hydrateRoot=function(t,r,n){e.usingClientEntryPoint=!0;try{return a.hydrateRoot(t,r,n)}finally{e.usingClientEntryPoint=!1}}}return je}var Gr=Xr();const Qr=(a,e,t,r)=>{var i,o,l,c;const n=[t,{code:e,...r||{}}];if((o=(i=a==null?void 0:a.services)==null?void 0:i.logger)!=null&&o.forward)return a.services.logger.forward(n,"warn","react-i18next::",!0);Oe(n[0])&&(n[0]=`react-i18next:: ${n[0]}`),(c=(l=a==null?void 0:a.services)==null?void 0:l.logger)!=null&&c.warn?a.services.logger.warn(...n):console!=null&&console.warn&&console.warn(...n)},Jt={},It=(a,e,t,r)=>{Oe(t)&&Jt[t]||(Oe(t)&&(Jt[t]=new Date),Qr(a,e,t,r))},kr=(a,e)=>()=>{if(a.isInitialized)e();else{const t=()=>{setTimeout(()=>{a.off("initialized",t)},0),e()};a.on("initialized",t)}},Vt=(a,e,t)=>{a.loadNamespaces(e,kr(a,t))},Zt=(a,e,t,r)=>{if(Oe(t)&&(t=[t]),a.options.preload&&a.options.preload.indexOf(e)>-1)return Vt(a,t,r);t.forEach(n=>{a.options.ns.indexOf(n)<0&&a.options.ns.push(n)}),a.loadLanguages(e,kr(a,r))},en=(a,e,t={})=>!e.languages||!e.languages.length?(It(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(a,{lng:t.lng,precheck:(r,n)=>{var i;if(((i=t.bindI18n)==null?void 0:i.indexOf("languageChanging"))>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!n(r.isLanguageChangingTo,a))return!1}}),Oe=a=>typeof a=="string",tn=a=>typeof a=="object"&&a!==null,rn=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,nn={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},an=a=>nn[a],sn=a=>a.replace(rn,an);let Ht={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:sn};const on=(a={})=>{Ht={...Ht,...a}},ln=()=>Ht;let Er;const un=a=>{Er=a},cn=()=>Er,dn={type:"3rdParty",init(a){on(a.options.react),un(a)}},Or=F.createContext();class fn{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const hn=(a,e)=>{const t=F.useRef();return F.useEffect(()=>{t.current=a},[a,e]),t.current},Pr=(a,e,t,r)=>a.getFixedT(e,t,r),pn=(a,e,t,r)=>F.useCallback(Pr(a,e,t,r),[a,e,t,r]),Wt=(a,e={})=>{var U,B,te,K;const{i18n:t}=e,{i18n:r,defaultNS:n}=F.useContext(Or)||{},i=t||r||cn();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new fn),!i){It(i,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const H=(_,X)=>Oe(X)?X:tn(X)&&Oe(X.defaultValue)?X.defaultValue:Array.isArray(_)?_[_.length-1]:_,D=[H,{},!1];return D.t=H,D.i18n={},D.ready=!1,D}(U=i.options.react)!=null&&U.wait&&It(i,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...ln(),...i.options.react,...e},{useSuspense:l,keyPrefix:c}=o;let d=n||((B=i.options)==null?void 0:B.defaultNS);d=Oe(d)?[d]:d||["translation"],(K=(te=i.reportNamespaces).addUsedNamespaces)==null||K.call(te,d);const h=(i.isInitialized||i.initializedStoreOnce)&&d.every(H=>en(H,i,o)),p=pn(i,e.lng||null,o.nsMode==="fallback"?d:d[0],c),g=()=>p,y=()=>Pr(i,e.lng||null,o.nsMode==="fallback"?d:d[0],c),[v,k]=F.useState(g);let j=d.join();e.lng&&(j=`${e.lng}${j}`);const T=hn(j),P=F.useRef(!0);F.useEffect(()=>{const{bindI18n:H,bindI18nStore:D}=o;P.current=!0,!h&&!l&&(e.lng?Zt(i,e.lng,d,()=>{P.current&&k(y)}):Vt(i,d,()=>{P.current&&k(y)})),h&&T&&T!==j&&P.current&&k(y);const _=()=>{P.current&&k(y)};return H&&(i==null||i.on(H,_)),D&&(i==null||i.store.on(D,_)),()=>{P.current=!1,i&&(H==null||H.split(" ").forEach(X=>i.off(X,_))),D&&i&&D.split(" ").forEach(X=>i.store.off(X,_))}},[i,j]),F.useEffect(()=>{P.current&&h&&k(g)},[i,c,h]);const A=[v,i,h];if(A.t=v,A.i18n=i,A.ready=h,h||!h&&!l)return A;throw new Promise(H=>{e.lng?Zt(i,e.lng,d,()=>H()):Vt(i,d,()=>H())})};function gn({i18n:a,defaultNS:e,children:t}){const r=F.useMemo(()=>({i18n:a,defaultNS:e}),[a,e]);return F.createElement(Or.Provider,{value:r},t)}var ut={exports:{}},We={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Yt;function mn(){if(Yt)return We;Yt=1;var a=F,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,n=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(l,c,d){var h,p={},g=null,y=null;d!==void 0&&(g=""+d),c.key!==void 0&&(g=""+c.key),c.ref!==void 0&&(y=c.ref);for(h in c)r.call(c,h)&&!i.hasOwnProperty(h)&&(p[h]=c[h]);if(l&&l.defaultProps)for(h in c=l.defaultProps,c)p[h]===void 0&&(p[h]=c[h]);return{$$typeof:e,type:l,key:g,ref:y,props:p,_owner:n.current}}return We.Fragment=t,We.jsx=o,We.jsxs=o,We}var ze={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Xt;function yn(){return Xt||(Xt=1,process.env.NODE_ENV!=="production"&&function(){var a=F,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),v=Symbol.iterator,k="@@iterator";function j(s){if(s===null||typeof s!="object")return null;var f=v&&s[v]||s[k];return typeof f=="function"?f:null}var T=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function P(s){{for(var f=arguments.length,m=new Array(f>1?f-1:0),x=1;x<f;x++)m[x-1]=arguments[x];A("error",s,m)}}function A(s,f,m){{var x=T.ReactDebugCurrentFrame,O=x.getStackAddendum();O!==""&&(f+="%s",m=m.concat([O]));var E=m.map(function(w){return String(w)});E.unshift("Warning: "+f),Function.prototype.apply.call(console[s],console,E)}}var U=!1,B=!1,te=!1,K=!1,H=!1,D;D=Symbol.for("react.module.reference");function _(s){return!!(typeof s=="string"||typeof s=="function"||s===r||s===i||H||s===n||s===d||s===h||K||s===y||U||B||te||typeof s=="object"&&s!==null&&(s.$$typeof===g||s.$$typeof===p||s.$$typeof===o||s.$$typeof===l||s.$$typeof===c||s.$$typeof===D||s.getModuleId!==void 0))}function X(s,f,m){var x=s.displayName;if(x)return x;var O=f.displayName||f.name||"";return O!==""?m+"("+O+")":m}function be(s){return s.displayName||"Context"}function M(s){if(s==null)return null;if(typeof s.tag=="number"&&P("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case r:return"Fragment";case t:return"Portal";case i:return"Profiler";case n:return"StrictMode";case d:return"Suspense";case h:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case l:var f=s;return be(f)+".Consumer";case o:var m=s;return be(m._context)+".Provider";case c:return X(s,s.render,"ForwardRef");case p:var x=s.displayName||null;return x!==null?x:M(s.type)||"Memo";case g:{var O=s,E=O._payload,w=O._init;try{return M(w(E))}catch{return null}}}return null}var I=Object.assign,Q=0,Y,G,ne,oe,ve,z,re;function ae(){}ae.__reactDisabledLog=!0;function Pe(){{if(Q===0){Y=console.log,G=console.info,ne=console.warn,oe=console.error,ve=console.group,z=console.groupCollapsed,re=console.groupEnd;var s={configurable:!0,enumerable:!0,value:ae,writable:!0};Object.defineProperties(console,{info:s,log:s,warn:s,error:s,group:s,groupCollapsed:s,groupEnd:s})}Q++}}function Re(){{if(Q--,Q===0){var s={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},s,{value:Y}),info:I({},s,{value:G}),warn:I({},s,{value:ne}),error:I({},s,{value:oe}),group:I({},s,{value:ve}),groupCollapsed:I({},s,{value:z}),groupEnd:I({},s,{value:re})})}Q<0&&P("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var xe=T.ReactCurrentDispatcher,we;function ce(s,f,m){{if(we===void 0)try{throw Error()}catch(O){var x=O.stack.trim().match(/\n( *(at )?)/);we=x&&x[1]||""}return`
18
+ `+we+s}}var Se=!1,de;{var yt=typeof WeakMap=="function"?WeakMap:Map;de=new yt}function Fe(s,f){if(!s||Se)return"";{var m=de.get(s);if(m!==void 0)return m}var x;Se=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var E;E=xe.current,xe.current=null,Pe();try{if(f){var w=function(){throw Error()};if(Object.defineProperty(w.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(w,[])}catch(J){x=J}Reflect.construct(s,[],w)}else{try{w.call()}catch(J){x=J}s.call(w.prototype)}}else{try{throw Error()}catch(J){x=J}s()}}catch(J){if(J&&x&&typeof J.stack=="string"){for(var R=J.stack.split(`
19
+ `),N=x.stack.split(`
20
+ `),C=R.length-1,$=N.length-1;C>=1&&$>=0&&R[C]!==N[$];)$--;for(;C>=1&&$>=0;C--,$--)if(R[C]!==N[$]){if(C!==1||$!==1)do if(C--,$--,$<0||R[C]!==N[$]){var q=`
21
+ `+R[C].replace(" at new "," at ");return s.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",s.displayName)),typeof s=="function"&&de.set(s,q),q}while(C>=1&&$>=0);break}}}finally{Se=!1,xe.current=E,Re(),Error.prepareStackTrace=O}var ee=s?s.displayName||s.name:"",W=ee?ce(ee):"";return typeof s=="function"&&de.set(s,W),W}function vt(s,f,m){return Fe(s,!1)}function bt(s){var f=s.prototype;return!!(f&&f.isReactComponent)}function fe(s,f,m){if(s==null)return"";if(typeof s=="function")return Fe(s,bt(s));if(typeof s=="string")return ce(s);switch(s){case d:return ce("Suspense");case h:return ce("SuspenseList")}if(typeof s=="object")switch(s.$$typeof){case c:return vt(s.render);case p:return fe(s.type,f,m);case g:{var x=s,O=x._payload,E=x._init;try{return fe(E(O),f,m)}catch{}}}return""}var ie=Object.prototype.hasOwnProperty,De={},_e=T.ReactDebugCurrentFrame;function he(s){if(s){var f=s._owner,m=fe(s.type,s._source,f?f.type:null);_e.setExtraStackFrame(m)}else _e.setExtraStackFrame(null)}function xt(s,f,m,x,O){{var E=Function.call.bind(ie);for(var w in s)if(E(s,w)){var R=void 0;try{if(typeof s[w]!="function"){var N=Error((x||"React class")+": "+m+" type `"+w+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[w]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw N.name="Invariant Violation",N}R=s[w](f,w,x,m,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(C){R=C}R&&!(R instanceof Error)&&(he(O),P("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",x||"React class",m,w,typeof R),he(null)),R instanceof Error&&!(R.message in De)&&(De[R.message]=!0,he(O),P("Failed %s type: %s",m,R.message),he(null))}}}var wt=Array.isArray;function ke(s){return wt(s)}function St(s){{var f=typeof Symbol=="function"&&Symbol.toStringTag,m=f&&s[Symbol.toStringTag]||s.constructor.name||"Object";return m}}function kt(s){try{return et(s),!1}catch{return!0}}function et(s){return""+s}function Me(s){if(kt(s))return P("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",St(s)),et(s)}var tt=T.ReactCurrentOwner,Et={key:!0,ref:!0,__self:!0,__source:!0},Ae,Ie;function Ot(s){if(ie.call(s,"ref")){var f=Object.getOwnPropertyDescriptor(s,"ref").get;if(f&&f.isReactWarning)return!1}return s.ref!==void 0}function Pt(s){if(ie.call(s,"key")){var f=Object.getOwnPropertyDescriptor(s,"key").get;if(f&&f.isReactWarning)return!1}return s.key!==void 0}function Rt(s,f){typeof s.ref=="string"&&tt.current}function Lt(s,f){{var m=function(){Ae||(Ae=!0,P("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",f))};m.isReactWarning=!0,Object.defineProperty(s,"key",{get:m,configurable:!0})}}function Ct(s,f){{var m=function(){Ie||(Ie=!0,P("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",f))};m.isReactWarning=!0,Object.defineProperty(s,"ref",{get:m,configurable:!0})}}var jt=function(s,f,m,x,O,E,w){var R={$$typeof:e,type:s,key:f,ref:m,props:w,_owner:E};return R._store={},Object.defineProperty(R._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(R,"_self",{configurable:!1,enumerable:!1,writable:!1,value:x}),Object.defineProperty(R,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(R.props),Object.freeze(R)),R};function Ve(s,f,m,x,O){{var E,w={},R=null,N=null;m!==void 0&&(Me(m),R=""+m),Pt(f)&&(Me(f.key),R=""+f.key),Ot(f)&&(N=f.ref,Rt(f,O));for(E in f)ie.call(f,E)&&!Et.hasOwnProperty(E)&&(w[E]=f[E]);if(s&&s.defaultProps){var C=s.defaultProps;for(E in C)w[E]===void 0&&(w[E]=C[E])}if(R||N){var $=typeof s=="function"?s.displayName||s.name||"Unknown":s;R&&Lt(w,$),N&&Ct(w,$)}return jt(s,R,N,O,x,tt.current,w)}}var Le=T.ReactCurrentOwner,pe=T.ReactDebugCurrentFrame;function le(s){if(s){var f=s._owner,m=fe(s.type,s._source,f?f.type:null);pe.setExtraStackFrame(m)}else pe.setExtraStackFrame(null)}var Ee;Ee=!1;function Ce(s){return typeof s=="object"&&s!==null&&s.$$typeof===e}function rt(){{if(Le.current){var s=M(Le.current.type);if(s)return`
22
+
23
+ Check the render method of \``+s+"`."}return""}}function nt(s){return""}var at={};function it(s){{var f=rt();if(!f){var m=typeof s=="string"?s:s.displayName||s.name;m&&(f=`
24
+
25
+ Check the top-level render call using <`+m+">.")}return f}}function He(s,f){{if(!s._store||s._store.validated||s.key!=null)return;s._store.validated=!0;var m=it(f);if(at[m])return;at[m]=!0;var x="";s&&s._owner&&s._owner!==Le.current&&(x=" It was passed a child from "+M(s._owner.type)+"."),le(s),P('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',m,x),le(null)}}function st(s,f){{if(typeof s!="object")return;if(ke(s))for(var m=0;m<s.length;m++){var x=s[m];Ce(x)&&He(x,f)}else if(Ce(s))s._store&&(s._store.validated=!0);else if(s){var O=j(s);if(typeof O=="function"&&O!==s.entries)for(var E=O.call(s),w;!(w=E.next()).done;)Ce(w.value)&&He(w.value,f)}}}function Tt(s){{var f=s.type;if(f==null||typeof f=="string")return;var m;if(typeof f=="function")m=f.propTypes;else if(typeof f=="object"&&(f.$$typeof===c||f.$$typeof===p))m=f.propTypes;else return;if(m){var x=M(f);xt(m,s.props,"prop",x,s)}else if(f.PropTypes!==void 0&&!Ee){Ee=!0;var O=M(f);P("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof f.getDefaultProps=="function"&&!f.getDefaultProps.isReactClassApproved&&P("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ot(s){{for(var f=Object.keys(s.props),m=0;m<f.length;m++){var x=f[m];if(x!=="children"&&x!=="key"){le(s),P("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",x),le(null);break}}s.ref!==null&&(le(s),P("Invalid attribute `ref` supplied to `React.Fragment`."),le(null))}}var Ue={};function lt(s,f,m,x,O,E){{var w=_(s);if(!w){var R="";(s===void 0||typeof s=="object"&&s!==null&&Object.keys(s).length===0)&&(R+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var N=nt();N?R+=N:R+=rt();var C;s===null?C="null":ke(s)?C="array":s!==void 0&&s.$$typeof===e?(C="<"+(M(s.type)||"Unknown")+" />",R=" Did you accidentally export a JSX literal instead of a component?"):C=typeof s,P("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",C,R)}var $=Ve(s,f,m,O,E);if($==null)return $;if(w){var q=f.children;if(q!==void 0)if(x)if(ke(q)){for(var ee=0;ee<q.length;ee++)st(q[ee],s);Object.freeze&&Object.freeze(q)}else P("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else st(q,s)}if(ie.call(f,"key")){var W=M(s),J=Object.keys(f).filter(function(qr){return qr!=="key"}),Be=J.length>0?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}";if(!Ue[W+Be]){var Dt=J.length>0?"{"+J.join(": ..., ")+": ...}":"{}";P(`A props object containing a "key" prop is being spread into JSX:
26
+ let props = %s;
27
+ <%s {...props} />
28
+ React keys must be passed directly to JSX without using spread:
29
+ let props = %s;
30
+ <%s key={someKey} {...props} />`,Be,W,Dt,W),Ue[W+Be]=!0}}return s===r?ot($):Tt($),$}}function Nt(s,f,m){return lt(s,f,m,!0)}function $t(s,f,m){return lt(s,f,m,!1)}var Ft=$t,u=Nt;ze.Fragment=r,ze.jsx=Ft,ze.jsxs=u}()),ze}var Gt;function vn(){return Gt||(Gt=1,process.env.NODE_ENV==="production"?ut.exports=mn():ut.exports=yn()),ut.exports}var S=vn();const bn=({step:a,form:e,formState:t,onDismiss:r,onNextStep:n,onPreviousStep:i,onUpdateResponse:o})=>{const{t:l}=Wt(),d=(h=>{let p=0;if(e.startTransition){if(h===p)return{type:"start",transition:e.startTransition};p++}const g=h-p;return g>=0&&g<e.questions.length?{type:"question",questionIndex:g,question:e.questions[g]}:(p+=e.questions.length,e.endTransition&&h===p?{type:"end",transition:e.endTransition}:null)})(a);if((d==null?void 0:d.type)==="start"){const{title:h,description:p,image:g,includeOptOut:y,customStartButton:v,startButtonText:k,customOptOutButton:j,optOutButtonText:T}=d.transition;return S.jsx(An,{title:h,description:p,icon:e.icon,image:g,quitText:y?j?T:l("Quit"):void 0,onQuit:y?()=>r(t):void 0,startText:v?k:l("Start"),onStart:n})}if((d==null?void 0:d.type)==="end"){const{title:h,description:p,image:g,customEndButton:y,endButtonText:v,customEndButtonLink:k,endButtonLink:j}=d.transition;return S.jsx(Mn,{title:h,description:p,icon:e.icon,image:g,quitText:y?v:l("Done"),onQuit:n,externalLink:k?j:void 0})}if((d==null?void 0:d.type)==="question"){const{question:h}=d;if(h.questionType==="choice"){const{title:p,description:g,image:y,alternatives:v,maxSelections:k,required:j}=h,T=t.responses[h.id]||[],P=(k?T.length<=k||k===4:!0)&&(j?T.length>0:!0);return S.jsx(Fn,{title:p,description:g,image:y,alternatives:v,onPrevious:i,onNext:n,icon:e.icon,maxAlternatives:k,onQuit:()=>r(t),selectedAlternatives:T,onAlternativeSelect:A=>{if(k>1){const B=T,te=B.includes(A)?B.filter(K=>K!==A):k&&B.length>=k&&k!=4?B:[...B,A];o(h.id,te)}else T.includes(A)?o(h.id,[]):o(h.id,[A])},isValid:P})}if(h.questionType==="text"){const{title:p,description:g,image:y,maxChars:v,limited:k,required:j}=h,T=t.responses[h.id]||"",P=(k&&v?T.length<=v:!0)&&(j?T.length>0:!0);return S.jsx(_n,{title:p,icon:e.icon,description:g,onNext:n,onPrevious:i,onQuit:()=>r(t),image:y,maxCharacters:k?v:void 0,inputText:T,setInputText:A=>{k&&v&&A.length>v||o(h.id,A)},isValid:P})}}return null},xn=({form:a,onDismiss:e,onComplete:t})=>{const n=(a.startTransition?1:0)+a.questions.length+(a.endTransition?1:0)-1,[i,o]=F.useState({responses:{},currentStep:0,startedAt:new Date}),l=F.useCallback((p,g)=>{o(y=>({...y,responses:{...y.responses,[p]:g}}))},[]),c=F.useCallback(p=>{o(g=>({...g,currentStep:p}))},[]),d=F.useCallback(()=>{if(i.currentStep<n)c(i.currentStep+1);else{const p={...i,completedAt:new Date};t(p)}},[i,n,c,t]),h=F.useCallback(()=>{i.currentStep>0&&c(i.currentStep-1)},[i.currentStep,c]);return S.jsx("div",{className:"flex flex-col justify-center items-center absolute inset-0 bg-overlay-background-default-light dark:bg-overlay-background-default-dark",children:S.jsx(bn,{step:i.currentStep,form:a,formState:i,onDismiss:e,onNextStep:d,onPreviousStep:h,onUpdateResponse:l})})},wn=new Map([["bold",b.createElement(b.Fragment,null,b.createElement("path",{d:"M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z"}))],["duotone",b.createElement(b.Fragment,null,b.createElement("path",{d:"M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z",opacity:"0.2"}),b.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["fill",b.createElement(b.Fragment,null,b.createElement("path",{d:"M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z"}))],["light",b.createElement(b.Fragment,null,b.createElement("path",{d:"M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z"}))],["regular",b.createElement(b.Fragment,null,b.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["thin",b.createElement(b.Fragment,null,b.createElement("path",{d:"M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z"}))]]),Sn=new Map([["bold",b.createElement(b.Fragment,null,b.createElement("path",{d:"M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z"}))],["duotone",b.createElement(b.Fragment,null,b.createElement("path",{d:"M160,48V208L80,128Z",opacity:"0.2"}),b.createElement("path",{d:"M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z"}))],["fill",b.createElement(b.Fragment,null,b.createElement("path",{d:"M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z"}))],["light",b.createElement(b.Fragment,null,b.createElement("path",{d:"M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z"}))],["regular",b.createElement(b.Fragment,null,b.createElement("path",{d:"M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"}))],["thin",b.createElement(b.Fragment,null,b.createElement("path",{d:"M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z"}))]]),kn=new Map([["bold",b.createElement(b.Fragment,null,b.createElement("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"}))],["duotone",b.createElement(b.Fragment,null,b.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),b.createElement("path",{d:"M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z"}))],["fill",b.createElement(b.Fragment,null,b.createElement("path",{d:"M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"}))],["light",b.createElement(b.Fragment,null,b.createElement("path",{d:"M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z"}))],["regular",b.createElement(b.Fragment,null,b.createElement("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"}))],["thin",b.createElement(b.Fragment,null,b.createElement("path",{d:"M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z"}))]]),En=new Map([["bold",b.createElement(b.Fragment,null,b.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",b.createElement(b.Fragment,null,b.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),b.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",b.createElement(b.Fragment,null,b.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",b.createElement(b.Fragment,null,b.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",b.createElement(b.Fragment,null,b.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",b.createElement(b.Fragment,null,b.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),Rr=F.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),Qe=b.forwardRef((a,e)=>{const{alt:t,color:r,size:n,weight:i,mirrored:o,children:l,weights:c,...d}=a,{color:h="currentColor",size:p,weight:g="regular",mirrored:y=!1,...v}=b.useContext(Rr);return b.createElement("svg",{ref:e,xmlns:"http://www.w3.org/2000/svg",width:n??p,height:n??p,fill:r??h,viewBox:"0 0 256 256",transform:o||y?"scale(-1, 1)":void 0,...v,...d},!!t&&b.createElement("title",null,t),l,c.get(i??g))});Qe.displayName="IconBase";const Lr=b.forwardRef((a,e)=>b.createElement(Qe,{ref:e,...a,weights:wn}));Lr.displayName="ArrowSquareOutIcon";const Cr=b.forwardRef((a,e)=>b.createElement(Qe,{ref:e,...a,weights:Sn}));Cr.displayName="CaretLeftIcon";const jr=b.forwardRef((a,e)=>b.createElement(Qe,{ref:e,...a,weights:kn}));jr.displayName="CaretRightIcon";const gt=b.forwardRef((a,e)=>b.createElement(Qe,{ref:e,...a,weights:En}));gt.displayName="XIcon";var _t={exports:{}},qe={};/**
31
+ * @license React
32
+ * react-jsx-runtime.production.min.js
33
+ *
34
+ * Copyright (c) Facebook, Inc. and its affiliates.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */var Qt;function On(){if(Qt)return qe;Qt=1;var a=F,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,n=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(l,c,d){var h,p={},g=null,y=null;d!==void 0&&(g=""+d),c.key!==void 0&&(g=""+c.key),c.ref!==void 0&&(y=c.ref);for(h in c)r.call(c,h)&&!i.hasOwnProperty(h)&&(p[h]=c[h]);if(l&&l.defaultProps)for(h in c=l.defaultProps,c)p[h]===void 0&&(p[h]=c[h]);return{$$typeof:e,type:l,key:g,ref:y,props:p,_owner:n.current}}return qe.Fragment=t,qe.jsx=o,qe.jsxs=o,qe}var ct={};/**
39
+ * @license React
40
+ * react-jsx-runtime.development.js
41
+ *
42
+ * Copyright (c) Facebook, Inc. and its affiliates.
43
+ *
44
+ * This source code is licensed under the MIT license found in the
45
+ * LICENSE file in the root directory of this source tree.
46
+ */var er;function Pn(){return er||(er=1,process.env.NODE_ENV!=="production"&&function(){var a=F,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),v=Symbol.iterator,k="@@iterator";function j(u){if(u===null||typeof u!="object")return null;var s=v&&u[v]||u[k];return typeof s=="function"?s:null}var T=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function P(u){{for(var s=arguments.length,f=new Array(s>1?s-1:0),m=1;m<s;m++)f[m-1]=arguments[m];A("error",u,f)}}function A(u,s,f){{var m=T.ReactDebugCurrentFrame,x=m.getStackAddendum();x!==""&&(s+="%s",f=f.concat([x]));var O=f.map(function(E){return String(E)});O.unshift("Warning: "+s),Function.prototype.apply.call(console[u],console,O)}}var U=!1,B=!1,te=!1,K=!1,H=!1,D;D=Symbol.for("react.module.reference");function _(u){return!!(typeof u=="string"||typeof u=="function"||u===r||u===i||H||u===n||u===d||u===h||K||u===y||U||B||te||typeof u=="object"&&u!==null&&(u.$$typeof===g||u.$$typeof===p||u.$$typeof===o||u.$$typeof===l||u.$$typeof===c||u.$$typeof===D||u.getModuleId!==void 0))}function X(u,s,f){var m=u.displayName;if(m)return m;var x=s.displayName||s.name||"";return x!==""?f+"("+x+")":f}function be(u){return u.displayName||"Context"}function M(u){if(u==null)return null;if(typeof u.tag=="number"&&P("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case r:return"Fragment";case t:return"Portal";case i:return"Profiler";case n:return"StrictMode";case d:return"Suspense";case h:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case l:var s=u;return be(s)+".Consumer";case o:var f=u;return be(f._context)+".Provider";case c:return X(u,u.render,"ForwardRef");case p:var m=u.displayName||null;return m!==null?m:M(u.type)||"Memo";case g:{var x=u,O=x._payload,E=x._init;try{return M(E(O))}catch{return null}}}return null}var I=Object.assign,Q=0,Y,G,ne,oe,ve,z,re;function ae(){}ae.__reactDisabledLog=!0;function Pe(){{if(Q===0){Y=console.log,G=console.info,ne=console.warn,oe=console.error,ve=console.group,z=console.groupCollapsed,re=console.groupEnd;var u={configurable:!0,enumerable:!0,value:ae,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}Q++}}function Re(){{if(Q--,Q===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},u,{value:Y}),info:I({},u,{value:G}),warn:I({},u,{value:ne}),error:I({},u,{value:oe}),group:I({},u,{value:ve}),groupCollapsed:I({},u,{value:z}),groupEnd:I({},u,{value:re})})}Q<0&&P("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var xe=T.ReactCurrentDispatcher,we;function ce(u,s,f){{if(we===void 0)try{throw Error()}catch(x){var m=x.stack.trim().match(/\n( *(at )?)/);we=m&&m[1]||""}return`
47
+ `+we+u}}var Se=!1,de;{var yt=typeof WeakMap=="function"?WeakMap:Map;de=new yt}function Fe(u,s){if(!u||Se)return"";{var f=de.get(u);if(f!==void 0)return f}var m;Se=!0;var x=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var O;O=xe.current,xe.current=null,Pe();try{if(s){var E=function(){throw Error()};if(Object.defineProperty(E.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(E,[])}catch(W){m=W}Reflect.construct(u,[],E)}else{try{E.call()}catch(W){m=W}u.call(E.prototype)}}else{try{throw Error()}catch(W){m=W}u()}}catch(W){if(W&&m&&typeof W.stack=="string"){for(var w=W.stack.split(`
48
+ `),R=m.stack.split(`
49
+ `),N=w.length-1,C=R.length-1;N>=1&&C>=0&&w[N]!==R[C];)C--;for(;N>=1&&C>=0;N--,C--)if(w[N]!==R[C]){if(N!==1||C!==1)do if(N--,C--,C<0||w[N]!==R[C]){var $=`
50
+ `+w[N].replace(" at new "," at ");return u.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",u.displayName)),typeof u=="function"&&de.set(u,$),$}while(N>=1&&C>=0);break}}}finally{Se=!1,xe.current=O,Re(),Error.prepareStackTrace=x}var q=u?u.displayName||u.name:"",ee=q?ce(q):"";return typeof u=="function"&&de.set(u,ee),ee}function vt(u,s,f){return Fe(u,!1)}function bt(u){var s=u.prototype;return!!(s&&s.isReactComponent)}function fe(u,s,f){if(u==null)return"";if(typeof u=="function")return Fe(u,bt(u));if(typeof u=="string")return ce(u);switch(u){case d:return ce("Suspense");case h:return ce("SuspenseList")}if(typeof u=="object")switch(u.$$typeof){case c:return vt(u.render);case p:return fe(u.type);case g:{var m=u,x=m._payload,O=m._init;try{return fe(O(x))}catch{}}}return""}var ie=Object.prototype.hasOwnProperty,De={},_e=T.ReactDebugCurrentFrame;function he(u){if(u){var s=fe(u.type);_e.setExtraStackFrame(s)}else _e.setExtraStackFrame(null)}function xt(u,s,f,m,x){{var O=Function.call.bind(ie);for(var E in u)if(O(u,E)){var w=void 0;try{if(typeof u[E]!="function"){var R=Error((m||"React class")+": "+f+" type `"+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof u[E]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}w=u[E](s,E,m,f,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(N){w=N}w&&!(w instanceof Error)&&(he(x),P("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",m||"React class",f,E,typeof w),he(null)),w instanceof Error&&!(w.message in De)&&(De[w.message]=!0,he(x),P("Failed %s type: %s",f,w.message),he(null))}}}var wt=Array.isArray;function ke(u){return wt(u)}function St(u){{var s=typeof Symbol=="function"&&Symbol.toStringTag,f=s&&u[Symbol.toStringTag]||u.constructor.name||"Object";return f}}function kt(u){try{return!1}catch{return!0}}function et(u){return""+u}function Me(u){if(kt())return P("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",St(u)),et(u)}var tt=T.ReactCurrentOwner,Et={key:!0,ref:!0,__self:!0,__source:!0},Ae,Ie;function Ot(u){if(ie.call(u,"ref")){var s=Object.getOwnPropertyDescriptor(u,"ref").get;if(s&&s.isReactWarning)return!1}return u.ref!==void 0}function Pt(u){if(ie.call(u,"key")){var s=Object.getOwnPropertyDescriptor(u,"key").get;if(s&&s.isReactWarning)return!1}return u.key!==void 0}function Rt(u,s){{var f=function(){Ae||(Ae=!0,P("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};f.isReactWarning=!0,Object.defineProperty(u,"key",{get:f,configurable:!0})}}function Lt(u,s){{var f=function(){Ie||(Ie=!0,P("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};f.isReactWarning=!0,Object.defineProperty(u,"ref",{get:f,configurable:!0})}}var Ct=function(u,s,f,m,x,O,E){var w={$$typeof:e,type:u,key:s,ref:f,props:E,_owner:O};return w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(w,"_self",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.defineProperty(w,"_source",{configurable:!1,enumerable:!1,writable:!1,value:x}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w};function jt(u,s,f,m,x){{var O,E={},w=null,R=null;f!==void 0&&(Me(f),w=""+f),Pt(s)&&(Me(s.key),w=""+s.key),Ot(s)&&(R=s.ref);for(O in s)ie.call(s,O)&&!Et.hasOwnProperty(O)&&(E[O]=s[O]);if(u&&u.defaultProps){var N=u.defaultProps;for(O in N)E[O]===void 0&&(E[O]=N[O])}if(w||R){var C=typeof u=="function"?u.displayName||u.name||"Unknown":u;w&&Rt(E,C),R&&Lt(E,C)}return Ct(u,w,R,x,m,tt.current,E)}}var Ve=T.ReactCurrentOwner,Le=T.ReactDebugCurrentFrame;function pe(u){if(u){var s=fe(u.type);Le.setExtraStackFrame(s)}else Le.setExtraStackFrame(null)}var le;le=!1;function Ee(u){return typeof u=="object"&&u!==null&&u.$$typeof===e}function Ce(){{if(Ve.current){var u=M(Ve.current.type);if(u)return`
51
+
52
+ Check the render method of \``+u+"`."}return""}}function rt(u){return""}var nt={};function at(u){{var s=Ce();if(!s){var f=typeof u=="string"?u:u.displayName||u.name;f&&(s=`
53
+
54
+ Check the top-level render call using <`+f+">.")}return s}}function it(u,s){{if(!u._store||u._store.validated||u.key!=null)return;u._store.validated=!0;var f=at(s);if(nt[f])return;nt[f]=!0;var m="";u&&u._owner&&u._owner!==Ve.current&&(m=" It was passed a child from "+M(u._owner.type)+"."),pe(u),P('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',f,m),pe(null)}}function He(u,s){{if(typeof u!="object")return;if(ke(u))for(var f=0;f<u.length;f++){var m=u[f];Ee(m)&&it(m,s)}else if(Ee(u))u._store&&(u._store.validated=!0);else if(u){var x=j(u);if(typeof x=="function"&&x!==u.entries)for(var O=x.call(u),E;!(E=O.next()).done;)Ee(E.value)&&it(E.value,s)}}}function st(u){{var s=u.type;if(s==null||typeof s=="string")return;var f;if(typeof s=="function")f=s.propTypes;else if(typeof s=="object"&&(s.$$typeof===c||s.$$typeof===p))f=s.propTypes;else return;if(f){var m=M(s);xt(f,u.props,"prop",m,u)}else if(s.PropTypes!==void 0&&!le){le=!0;var x=M(s);P("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",x||"Unknown")}typeof s.getDefaultProps=="function"&&!s.getDefaultProps.isReactClassApproved&&P("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tt(u){{for(var s=Object.keys(u.props),f=0;f<s.length;f++){var m=s[f];if(m!=="children"&&m!=="key"){pe(u),P("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",m),pe(null);break}}u.ref!==null&&(pe(u),P("Invalid attribute `ref` supplied to `React.Fragment`."),pe(null))}}var ot={};function Ue(u,s,f,m,x,O){{var E=_(u);if(!E){var w="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).length===0)&&(w+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var R=rt();R?w+=R:w+=Ce();var N;u===null?N="null":ke(u)?N="array":u!==void 0&&u.$$typeof===e?(N="<"+(M(u.type)||"Unknown")+" />",w=" Did you accidentally export a JSX literal instead of a component?"):N=typeof u,P("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",N,w)}var C=jt(u,s,f,x,O);if(C==null)return C;if(E){var $=s.children;if($!==void 0)if(m)if(ke($)){for(var q=0;q<$.length;q++)He($[q],u);Object.freeze&&Object.freeze($)}else P("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else He($,u)}if(ie.call(s,"key")){var ee=M(u),W=Object.keys(s).filter(function(Dt){return Dt!=="key"}),J=W.length>0?"{key: someKey, "+W.join(": ..., ")+": ...}":"{key: someKey}";if(!ot[ee+J]){var Be=W.length>0?"{"+W.join(": ..., ")+": ...}":"{}";P(`A props object containing a "key" prop is being spread into JSX:
55
+ let props = %s;
56
+ <%s {...props} />
57
+ React keys must be passed directly to JSX without using spread:
58
+ let props = %s;
59
+ <%s key={someKey} {...props} />`,J,ee,Be,ee),ot[ee+J]=!0}}return u===r?Tt(C):st(C),C}}function lt(u,s,f){return Ue(u,s,f,!0)}function Nt(u,s,f){return Ue(u,s,f,!1)}var $t=Nt,Ft=lt;ct.Fragment=r,ct.jsx=$t,ct.jsxs=Ft}()),ct}var tr;function Rn(){return tr||(tr=1,process.env.NODE_ENV==="production"?_t.exports=On():_t.exports=Pn()),_t.exports}var ft=Rn();const me=({variant:a="primary",size:e="medium",text:t,iconBefore:r,iconAfter:n,className:i,disabled:o=!1,...l})=>ft.jsx("button",{className:se("flex gap-2 justify-center items-center rounded-lg disabled:pointer-events-none",Ln(a),Cn(e),i),disabled:o,...l,children:ft.jsxs(Rr.Provider,{value:{size:e==="xsmall"?8:16,weight:"regular",className:se(rr(a,o))},children:[r&&r,t&&ft.jsx("span",{className:se(rr(a,o),jn(e)),children:t}),n&&n]})}),Ln=a=>{switch(a){case"primary":return"border border-grey-0/0 bg-primary-action-button-light dark:bg-primary-action-button-dark hover:bg-primary-action-button-hover-light dark:hover:bg-primary-action-button-hover-dark disabled:bg-primary-action-disabled-light dark:disabled:bg-primary-action-disabled-dark";case"secondary":return"border border-grey-0/0 bg-secondary-action-base-light dark:bg-secondary-action-base-dark hover:bg-system-neutral-grey-8-light dark:hover:bg-system-neutral-grey-8-dark disabled:bg-secondary-action-disabled-light dark:disabled:bg-secondary-action-disabled-dark";case"neutral":return"border border-separator-regular-light dark:border-separator-regular-dark hover:bg-background-universal-overlay-light dark:hover:bg-background-universal-overlay-dark disabled:bg-secondary-action-disabled-light dark:disabled:bg-secondary-action-disabled-dark disabled:border-separator-opaque-light dark:disabled:border-separator-opaque-dark";case"subtle":return"border border-grey-0/0 hover:bg-background-universal-overlay-light dark:hover:bg-background-universal-overlay-dark"}},rr=(a,e)=>{if(e)return"text-label-tertiary-light dark:text-label-tertiary-dark";switch(a){case"primary":return"text-nonadaptable-text-light";case"secondary":return"text-label-quaternary-light dark:text-label-quaternary-dark";case"neutral":return"text-label-primary-light dark:text-label-primary-dark";case"subtle":return"text-label-primary-light dark:text-label-primary-dark"}},Cn=a=>{switch(a){case"xsmall":return"p-1";case"small":return"p-2";case"medium":return"p-3"}},jn=a=>{switch(a){case"xsmall":return"text-[10px] leading-[14px]";case"small":return"text-[13px] leading-[14px]";case"medium":return"text-[15px] leading-[16px] -tracking-0,1"}};function Tr(a){var e,t,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var n=a.length;for(e=0;e<n;e++)a[e]&&(t=Tr(a[e]))&&(r&&(r+=" "),r+=t)}else for(t in a)a[t]&&(r&&(r+=" "),r+=t);return r}function Tn(){for(var a,e,t=0,r="",n=arguments.length;t<n;t++)(a=arguments[t])&&(e=Tr(a))&&(r&&(r+=" "),r+=e);return r}const se=Tn,ye=({children:a,className:e,variant:t="B1",significance:r="primary",as:n})=>{const i=n??Nn[t],o=Nr[t];return ft.jsx(i,{className:se("font-sans",$n[r],e,o),children:a})},Nr={Di1:"text-[72px] font-bold leading-[90px] -tracking-2,5",Di2:"text-[60px] font-bold leading-[72px] -tracking-2,0",Di3:"text-[48px] font-bold leading-[60px] -tracking-1,5",T1:"text-[40px] font-bold leading-[48px] -tracking-1,5",T2:"text-[32px] font-bold leading-[40px] -tracking-1",T3:"text-[24px] font-bold leading-[32px] -tracking-0,5",H1:"text-[24px] font-bold leading-[32px] -tracking-0,5",H2:"text-[20px] font-bold leading-[24px]",H3:"text-[15px] font-bold leading-[20px]",H4:"text-[13px] font-bold leading-[16px]",B1B:"text-[15px] font-bold leading-[24px] -tracking-0,1",B1:"text-[15px] leading-[24px] -tracking-0,1",B1Button:"text-[15px] leading-[16px] -tracking-0,1",B2:"text-[13px] leading-[20px]",B2Button:"text-[13px] leading-[16px]",D1B:"text-[12px] font-bold leading-[16px]",D1:"text-[12px] leading-[16px]",M:"text-[10px] leading-[16px]"},Nn={Di1:"h1",Di2:"h2",Di3:"h3",T1:"h1",T2:"h2",T3:"h3",H1:"h1",H2:"h2",H3:"h3",H4:"h4",B1B:"p",B1:"p",B1Button:"span",B2:"p",B2Button:"span",D1B:"p",D1:"p",M:"p"},$n={primary:"text-label-primary-light dark:text-label-primary-dark",secondary:"text-label-secondary-light dark:text-label-secondary-dark",tertiary:"text-label-tertiary-light dark:text-label-tertiary-dark",quaternary:"text-label-quaternary-light dark:text-label-quaternary-dark",placeholder:"text-label-placeholder-light dark:text-label-placeholder-dark","nonadaptable-text":"text-nonadaptable-text-light dark:text-nonadaptable-text-dark",disabled:"text-primary-action-disabled-light dark:text-primary-action-disabled-dark"},$r=({title:a,icon:e,description:t,image:r,children:n,onPrevious:i,onNext:o,onQuit:l,isValid:c})=>{const{t:d}=Wt();return S.jsxs("div",{className:se("grid mx-4 my-8 rounded-xl border relative","grid-cols-1 p-4 pt-10","md:p-8 md:gap-16 md:max-w-[960px] md:min-w-[660px]",r?"md:grid-cols-2":"md:grid-cols-1","border-separator-opaque-light dark:border-separator-opaque-dark material-ultra-thick-light dark:material-ultra-thick-dark"),children:[S.jsxs("div",{className:"flex flex-col justify-between order-2 md:order-1",children:[S.jsxs("div",{className:"flex flex-col",children:[S.jsxs("div",{className:"flex flex-col gap-1 md:gap-2 pb-3",children:[e&&S.jsx("div",{className:se("h-8 w-8 rounded-lg overflow-hidden mb-1 md:mb-2",r?"hidden md:block":"block"),children:S.jsx("img",{className:"w-full h-full object-cover",src:e,alt:"icon"})}),S.jsx(ye,{variant:"H2",children:a}),t&&t.trim().replace(/\n{3,}/g,`
60
+
61
+ `).split(`
62
+
63
+ `).map((h,p)=>S.jsx(ye,{significance:"secondary",children:h.trim()},p))]}),n]}),S.jsxs("div",{className:"flex justify-end pt-4 gap-2",children:[S.jsx(me,{variant:"subtle",onClick:i,iconBefore:S.jsx(Cr,{}),disabled:!i,text:d("Previous")}),S.jsx(me,{variant:"subtle",onClick:o,iconAfter:S.jsx(jr,{}),disabled:!o||!c,text:d("Next")})]}),l&&S.jsx(me,{className:"absolute top-0 right-1 md:top-1",variant:"subtle",size:"small",onClick:l,iconAfter:S.jsx(gt,{}),"aria-label":"quit"})]}),r&&S.jsx("div",{className:"flex flex-col justify-center order-1 md:order-2",children:S.jsx("div",{className:"rounded-lg overflow-hidden mb-6 md:mb-0",children:S.jsx("img",{className:"w-full h-full object-cover aspect-video md:aspect-square",src:r,alt:"image"})})})]})},Fn=({title:a,icon:e,description:t,image:r,onPrevious:n,onNext:i,onQuit:o,alternatives:l=[],onAlternativeSelect:c,selectedAlternatives:d,maxAlternatives:h,isValid:p})=>S.jsx($r,{title:a,icon:e,description:t,image:r,onPrevious:n,onNext:i,onQuit:o,isValid:p,children:S.jsx("div",{className:"flex flex-col max-h-[272px] md:max-h-full overflow-y-auto",children:h===1?S.jsx("div",{className:"flex flex-col py-3 md:py-4 gap-2 items-end md:items-start",children:l.map(g=>S.jsxs("button",{onClick:()=>c(g.id),className:"flex items-center gap-2 p-3 justify-end rounded-lg border text-label-primary-light dark:text-label-primary-dark border-separator-regular-light dark:border-separator-regular-dark",children:[S.jsx(ye,{variant:"B1Button",children:g.text}),S.jsx(Dn,{size:20,selected:d.includes(g.id)})]},g.id))}):S.jsx("div",{className:"flex py-3 md:py-4 gap-2 justify-end md:justify-start flex-wrap",children:l.map(g=>S.jsx("button",{onClick:()=>c(g.id),className:se("flex items-center gap-2 p-3 justify-end rounded-lg border",d.includes(g.id)?"text-label-quaternary-light dark:text-label-quaternary-dark border-label-quaternary-light dark:border-label-quaternary-dark bg-secondary-action-base-light dark:bg-secondary-action-base-dark":"text-label-primary-light dark:text-label-primary-dark border-separator-regular-light dark:border-separator-regular-dark"),children:S.jsx(ye,{variant:"B1Button",significance:d.includes(g.id)?"quaternary":"primary",children:g.text})},g.id))})})}),Dn=({size:a=16,strokeColor:e="currentColor",fillColor:t="none",selected:r=!1})=>{const n=a+1,i=n/2,o=(a-2)/2;return S.jsxs("svg",{width:a,height:a,viewBox:`0 0 ${n} ${n}`,fill:r?t:"none",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("circle",{cx:i,cy:i,r:o,stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),r&&S.jsx("circle",{cx:i,cy:i,r:o-3,fill:e})]})},_n=({title:a,icon:e,description:t,image:r,onPrevious:n,onNext:i,onQuit:o,inputText:l,setInputText:c,maxCharacters:d,isValid:h})=>{const{t:p}=Wt();return S.jsx($r,{title:a,icon:e,description:t,image:r,onPrevious:n,onNext:i,onQuit:o,isValid:h,children:S.jsxs("div",{className:"flex flex-col py-3 gap-2",children:[d&&S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx(ye,{significance:"secondary",children:p("Max {{maxCharacters}} characters",{maxCharacters:d})}),S.jsx(ye,{significance:"secondary",children:`${l.length}/${d}`})]}),S.jsxs("div",{className:"flex flex-col relative",children:[S.jsx(ye,{as:"div",className:se("overflow-y-hidden whitespace-pre-wrap invisible break-words rounded-lg py-3 px-4 min-h-20 border-separator-opaque-light dark:border-separator-opaque-dark"),children:l}),S.jsx("textarea",{id:"primary",placeholder:p("Type your answer here"),className:se("absolute inset-0 resize-none","overflow-hidden break-words outline-none resize-none bg-grey-0/0","rounded-lg py-3 px-4 min-h-20 border border-separator-opaque-light dark:border-separator-opaque-dark","text-label-primary-light dark:text-label-primary-dark",Nr.B1),value:l,onChange:g=>c(g.target.value)})]})]})})},Fr=({title:a,icon:e,description:t,image:r,children:n,wrapperClassName:i})=>S.jsxs("div",{className:se("grid mx-4 my-8 rounded-xl border","grid-cols-1 p-4 pt-10","md:p-8 md:gap-16 md:max-w-[960px] md:min-w-[660px]",r?"md:grid-cols-2":"md:grid-cols-1","border-separator-opaque-light dark:border-separator-opaque-dark material-ultra-thick-light dark:material-ultra-thick-dark",i),children:[S.jsxs("div",{className:"flex flex-col justify-between gap-6 md:gap-8 order-2 md:order-1",children:[S.jsxs("div",{className:"flex flex-col gap-6 md:gap-8",children:[S.jsxs("div",{className:"flex flex-col gap-2 md:gap-4",children:[e&&S.jsx("div",{className:se("h-8 w-8 rounded-lg overflow-hidden",r?"hidden md:block":"block"),children:S.jsx("img",{className:"w-full h-full object-cover",src:e,alt:"icon"})}),S.jsx(ye,{variant:"H2",children:a})]}),t&&t.trim().replace(/\n{3,}/g,`
64
+
65
+ `).split(`
66
+
67
+ `).map((o,l)=>S.jsx(ye,{children:o.trim()},l))]}),n]}),r&&S.jsx("div",{className:"flex flex-col justify-center order-1 md:order-2",children:S.jsx("div",{className:"rounded-lg overflow-hidden mb-6 md:mb-0",children:S.jsx("img",{className:"w-full h-full object-cover aspect-video md:aspect-square",src:r,alt:"image"})})})]}),Mn=({title:a,icon:e,description:t,image:r,quitText:n,onQuit:i,externalLink:o})=>S.jsxs(Fr,{title:a,icon:e,description:t,image:r,children:[S.jsx("div",{className:"flex justify-end gap-2",children:o?S.jsx(me,{variant:"secondary",text:n,iconAfter:S.jsx(Lr,{}),onClick:()=>{window.open(o,"_blank"),i==null||i()}}):S.jsx(me,{variant:"secondary",onClick:i,text:n})}),i&&S.jsx(me,{className:"absolute -top-2 -right-2 md:-top-4 md:-right-4",variant:"secondary",size:"small",onClick:i,iconAfter:S.jsx(gt,{}),"aria-label":"quit"})]}),An=({title:a,icon:e,description:t,image:r,quitText:n,onQuit:i,startText:o,onStart:l})=>S.jsxs(Fr,{title:a,icon:e,description:t,image:r,wrapperClassName:"relative",children:[S.jsxs("div",{className:"flex justify-end gap-2",children:[i&&n&&S.jsx(me,{variant:"subtle",text:n,onClick:i}),S.jsx(me,{variant:"secondary",text:o,onClick:l})]}),i&&S.jsx(me,{className:"absolute top-0 right-1 md:top-1",variant:"subtle",size:"small",onClick:i,iconAfter:S.jsx(gt,{}),"aria-label":"quit"})]});let Dr={};function In(){return Dr}function Vn(a){Dr=a}const Hn={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"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},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"}},Un=(a,e,t)=>{let r;const n=Hn[a];return typeof n=="string"?r=n:e===1?r=n.one:r=n.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+r:r+" ago":r};function Mt(a){return(e={})=>{const t=e.width?String(e.width):a.defaultWidth;return a.formats[t]||a.formats[a.defaultWidth]}}const Bn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Wn=(a,e,t,r)=>Bn[a];function Ke(a){return(e,t)=>{const r=t!=null&&t.context?String(t.context):"standalone";let n;if(r==="formatting"&&a.formattingValues){const o=a.defaultFormattingWidth||a.defaultWidth,l=t!=null&&t.width?String(t.width):o;n=a.formattingValues[l]||a.formattingValues[o]}else{const o=a.defaultWidth,l=t!=null&&t.width?String(t.width):a.defaultWidth;n=a.values[l]||a.values[o]}const i=a.argumentCallback?a.argumentCallback(e):e;return n[i]}}const zn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},qn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Kn={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Jn={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Zn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Yn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Xn=(a,e)=>{const t=Number(a),r=t%100;if(r>20||r<10)switch(r%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},Gn={ordinalNumber:Xn,era:Ke({values:zn,defaultWidth:"wide"}),quarter:Ke({values:qn,defaultWidth:"wide",argumentCallback:a=>a-1}),month:Ke({values:Kn,defaultWidth:"wide"}),day:Ke({values:Jn,defaultWidth:"wide"}),dayPeriod:Ke({values:Zn,defaultWidth:"wide",formattingValues:Yn,defaultFormattingWidth:"wide"})};function Je(a){return(e,t={})=>{const r=t.width,n=r&&a.matchPatterns[r]||a.matchPatterns[a.defaultMatchWidth],i=e.match(n);if(!i)return null;const o=i[0],l=r&&a.parsePatterns[r]||a.parsePatterns[a.defaultParseWidth],c=Array.isArray(l)?ea(l,p=>p.test(o)):Qn(l,p=>p.test(o));let d;d=a.valueCallback?a.valueCallback(c):c,d=t.valueCallback?t.valueCallback(d):d;const h=e.slice(o.length);return{value:d,rest:h}}}function Qn(a,e){for(const t in a)if(Object.prototype.hasOwnProperty.call(a,t)&&e(a[t]))return t}function ea(a,e){for(let t=0;t<a.length;t++)if(e(a[t]))return t}function ta(a){return(e,t={})=>{const r=e.match(a.matchPattern);if(!r)return null;const n=r[0],i=e.match(a.parsePattern);if(!i)return null;let o=a.valueCallback?a.valueCallback(i[0]):i[0];o=t.valueCallback?t.valueCallback(o):o;const l=e.slice(n.length);return{value:o,rest:l}}}const ra=/^(\d+)(th|st|nd|rd)?/i,na=/\d+/i,aa={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},ia={any:[/^b/i,/^(a|c)/i]},sa={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},oa={any:[/1/i,/2/i,/3/i,/4/i]},la={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},ua={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ca={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},da={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},fa={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ha={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},pa={ordinalNumber:ta({matchPattern:ra,parsePattern:na,valueCallback:a=>parseInt(a,10)}),era:Je({matchPatterns:aa,defaultMatchWidth:"wide",parsePatterns:ia,defaultParseWidth:"any"}),quarter:Je({matchPatterns:sa,defaultMatchWidth:"wide",parsePatterns:oa,defaultParseWidth:"any",valueCallback:a=>a+1}),month:Je({matchPatterns:la,defaultMatchWidth:"wide",parsePatterns:ua,defaultParseWidth:"any"}),day:Je({matchPatterns:ca,defaultMatchWidth:"wide",parsePatterns:da,defaultParseWidth:"any"}),dayPeriod:Je({matchPatterns:fa,defaultMatchWidth:"any",parsePatterns:ha,defaultParseWidth:"any"})};function ga(a){const e={},t=In();for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);for(const r in a)Object.prototype.hasOwnProperty.call(a,r)&&(a[r]===void 0?delete e[r]:e[r]=a[r]);Vn(e)}const ma={full:"EEEE, d MMMM yyyy",long:"d MMMM yyyy",medium:"d MMM yyyy",short:"dd/MM/yyyy"},ya={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},va={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ba={date:Mt({formats:ma,defaultWidth:"full"}),time:Mt({formats:ya,defaultWidth:"full"}),dateTime:Mt({formats:va,defaultWidth:"full"})},xa={code:"en-GB",formatDistance:Un,formatLong:ba,formatRelative:Wn,localize:Gn,match:pa,options:{weekStartsOn:1,firstWeekContainsDate:4}},L=a=>typeof a=="string",Ze=()=>{let a,e;const t=new Promise((r,n)=>{a=r,e=n});return t.resolve=a,t.reject=e,t},nr=a=>a==null?"":""+a,wa=(a,e,t)=>{a.forEach(r=>{e[r]&&(t[r]=e[r])})},Sa=/###/g,ar=a=>a&&a.indexOf("###")>-1?a.replace(Sa,"."):a,ir=a=>!a||L(a),Ye=(a,e,t)=>{const r=L(e)?e.split("."):e;let n=0;for(;n<r.length-1;){if(ir(a))return{};const i=ar(r[n]);!a[i]&&t&&(a[i]=new t),Object.prototype.hasOwnProperty.call(a,i)?a=a[i]:a={},++n}return ir(a)?{}:{obj:a,k:ar(r[n])}},sr=(a,e,t)=>{const{obj:r,k:n}=Ye(a,e,Object);if(r!==void 0||e.length===1){r[n]=t;return}let i=e[e.length-1],o=e.slice(0,e.length-1),l=Ye(a,o,Object);for(;l.obj===void 0&&o.length;)i=`${o[o.length-1]}.${i}`,o=o.slice(0,o.length-1),l=Ye(a,o,Object),l!=null&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=t},ka=(a,e,t,r)=>{const{obj:n,k:i}=Ye(a,e,Object);n[i]=n[i]||[],n[i].push(t)},ht=(a,e)=>{const{obj:t,k:r}=Ye(a,e);if(t&&Object.prototype.hasOwnProperty.call(t,r))return t[r]},Ea=(a,e,t)=>{const r=ht(a,t);return r!==void 0?r:ht(e,t)},_r=(a,e,t)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in a?L(a[r])||a[r]instanceof String||L(e[r])||e[r]instanceof String?t&&(a[r]=e[r]):_r(a[r],e[r],t):a[r]=e[r]);return a},Te=a=>a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Oa={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Pa=a=>L(a)?a.replace(/[&<>"'\/]/g,e=>Oa[e]):a;class Ra{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const La=[" ",",","?","!",";"],Ca=new Ra(20),ja=(a,e,t)=>{e=e||"",t=t||"";const r=La.filter(o=>e.indexOf(o)<0&&t.indexOf(o)<0);if(r.length===0)return!0;const n=Ca.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let i=!n.test(a);if(!i){const o=a.indexOf(t);o>0&&!n.test(a.substring(0,o))&&(i=!0)}return i},Ut=(a,e,t=".")=>{if(!a)return;if(a[e])return Object.prototype.hasOwnProperty.call(a,e)?a[e]:void 0;const r=e.split(t);let n=a;for(let i=0;i<r.length;){if(!n||typeof n!="object")return;let o,l="";for(let c=i;c<r.length;++c)if(c!==i&&(l+=t),l+=r[c],o=n[l],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<r.length-1)continue;i+=c-i+1;break}n=o}return n},Xe=a=>a==null?void 0:a.replace("_","-"),Ta={type:"logger",log(a){this.output("log",a)},warn(a){this.output("warn",a)},error(a){this.output("error",a)},output(a,e){var t,r;(r=(t=console==null?void 0:console[a])==null?void 0:t.apply)==null||r.call(t,console,e)}};let Na=class Bt{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Ta,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,r,n){return n&&!this.debug?null:(L(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Bt(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Bt(this.logger,e)}};var ue=new Na;class mt{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const n=this.observers[r].get(t)||0;this.observers[r].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([n,i])=>{for(let o=0;o<i;o++)n(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([n,i])=>{for(let o=0;o<i;o++)n.apply(n,[e,...t])})}}class or extends mt{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,r,n={}){var d,h;const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,o=n.ignoreJSONStructure!==void 0?n.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;e.indexOf(".")>-1?l=e.split("."):(l=[e,t],r&&(Array.isArray(r)?l.push(...r):L(r)&&i?l.push(...r.split(i)):l.push(r)));const c=ht(this.data,l);return!c&&!t&&!r&&e.indexOf(".")>-1&&(e=l[0],t=l[1],r=l.slice(2).join(".")),c||!o||!L(r)?c:Ut((h=(d=this.data)==null?void 0:d[e])==null?void 0:h[t],r,i)}addResource(e,t,r,n,i={silent:!1}){const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let l=[e,t];r&&(l=l.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(l=e.split("."),n=t,t=l[1]),this.addNamespaces(t),sr(this.data,l,n),i.silent||this.emit("added",e,t,r,n)}addResources(e,t,r,n={silent:!1}){for(const i in r)(L(r[i])||Array.isArray(r[i]))&&this.addResource(e,t,i,r[i],{silent:!0});n.silent||this.emit("added",e,t,r)}addResourceBundle(e,t,r,n,i,o={silent:!1,skipCopy:!1}){let l=[e,t];e.indexOf(".")>-1&&(l=e.split("."),n=r,r=t,t=l[1]),this.addNamespaces(t);let c=ht(this.data,l)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),n?_r(c,r,i):c={...c,...r},sr(this.data,l,c),o.silent||this.emit("added",e,t,r)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(n=>t[n]&&Object.keys(t[n]).length>0)}toJSON(){return this.data}}var Mr={processors:{},addPostProcessor(a){this.processors[a.name]=a},handle(a,e,t,r,n){return a.forEach(i=>{var o;e=((o=this.processors[i])==null?void 0:o.process(e,t,r,n))??e}),e}};const lr={},ur=a=>!L(a)&&typeof a!="boolean"&&typeof a!="number";class pt extends mt{constructor(e,t={}){super(),wa(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ue.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const r={...t};if(e==null)return!1;const n=this.resolve(e,r);return(n==null?void 0:n.res)!==void 0}extractFromKey(e,t){let r=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const n=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let i=t.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!ja(e,r,n);if(o&&!l){const c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:L(i)?[i]:i};const d=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(d[0])>-1)&&(i=d.shift()),e=d.join(n)}return{key:e,namespaces:L(i)?[i]:i}}translate(e,t,r){let n=typeof t=="object"?{...t}:t;if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:l,namespaces:c}=this.extractFromKey(e[e.length-1],n),d=c[c.length-1];let h=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;h===void 0&&(h=":");const p=n.lng||this.language,g=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((p==null?void 0:p.toLowerCase())==="cimode")return g?i?{res:`${d}${h}${l}`,usedKey:l,exactUsedKey:l,usedLng:p,usedNS:d,usedParams:this.getUsedParamsDetails(n)}:`${d}${h}${l}`:i?{res:l,usedKey:l,exactUsedKey:l,usedLng:p,usedNS:d,usedParams:this.getUsedParamsDetails(n)}:l;const y=this.resolve(e,n);let v=y==null?void 0:y.res;const k=(y==null?void 0:y.usedKey)||l,j=(y==null?void 0:y.exactUsedKey)||l,T=["[object Number]","[object Function]","[object RegExp]"],P=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,A=!this.i18nFormat||this.i18nFormat.handleAsObject,U=n.count!==void 0&&!L(n.count),B=pt.hasDefaultValue(n),te=U?this.pluralResolver.getSuffix(p,n.count,n):"",K=n.ordinal&&U?this.pluralResolver.getSuffix(p,n.count,{ordinal:!1}):"",H=U&&!n.ordinal&&n.count===0,D=H&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${te}`]||n[`defaultValue${K}`]||n.defaultValue;let _=v;A&&!v&&B&&(_=D);const X=ur(_),be=Object.prototype.toString.apply(_);if(A&&_&&X&&T.indexOf(be)<0&&!(L(P)&&Array.isArray(_))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(k,_,{...n,ns:c}):`key '${l} (${this.language})' returned an object instead of string.`;return i?(y.res=M,y.usedParams=this.getUsedParamsDetails(n),y):M}if(o){const M=Array.isArray(_),I=M?[]:{},Q=M?j:k;for(const Y in _)if(Object.prototype.hasOwnProperty.call(_,Y)){const G=`${Q}${o}${Y}`;B&&!v?I[Y]=this.translate(G,{...n,defaultValue:ur(D)?D[Y]:void 0,joinArrays:!1,ns:c}):I[Y]=this.translate(G,{...n,joinArrays:!1,ns:c}),I[Y]===G&&(I[Y]=_[Y])}v=I}}else if(A&&L(P)&&Array.isArray(v))v=v.join(P),v&&(v=this.extendTranslation(v,e,n,r));else{let M=!1,I=!1;!this.isValidLookup(v)&&B&&(M=!0,v=D),this.isValidLookup(v)||(I=!0,v=l);const Y=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&I?void 0:v,G=B&&D!==v&&this.options.updateMissing;if(I||M||G){if(this.logger.log(G?"updateKey":"missingKey",p,d,l,G?D:v),o){const z=this.resolve(l,{...n,keySeparator:!1});z&&z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let ne=[];const oe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&oe&&oe[0])for(let z=0;z<oe.length;z++)ne.push(oe[z]);else this.options.saveMissingTo==="all"?ne=this.languageUtils.toResolveHierarchy(n.lng||this.language):ne.push(n.lng||this.language);const ve=(z,re,ae)=>{var Re;const Pe=B&&ae!==v?ae:Y;this.options.missingKeyHandler?this.options.missingKeyHandler(z,d,re,Pe,G,n):(Re=this.backendConnector)!=null&&Re.saveMissing&&this.backendConnector.saveMissing(z,d,re,Pe,G,n),this.emit("missingKey",z,d,re,v)};this.options.saveMissing&&(this.options.saveMissingPlurals&&U?ne.forEach(z=>{const re=this.pluralResolver.getSuffixes(z,n);H&&n[`defaultValue${this.options.pluralSeparator}zero`]&&re.indexOf(`${this.options.pluralSeparator}zero`)<0&&re.push(`${this.options.pluralSeparator}zero`),re.forEach(ae=>{ve([z],l+ae,n[`defaultValue${ae}`]||D)})}):ve(ne,l,D))}v=this.extendTranslation(v,e,n,y,r),I&&v===l&&this.options.appendNamespaceToMissingKey&&(v=`${d}${h}${l}`),(I||M)&&this.options.parseMissingKeyHandler&&(v=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${d}${h}${l}`:l,M?v:void 0,n))}return i?(y.res=v,y.usedParams=this.getUsedParamsDetails(n),y):v}extendTranslation(e,t,r,n,i){var c,d;if((c=this.i18nFormat)!=null&&c.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const h=L(e)&&(((d=r==null?void 0:r.interpolation)==null?void 0:d.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(h){const y=e.match(this.interpolator.nestingRegexp);p=y&&y.length}let g=r.replace&&!L(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(g={...this.options.interpolation.defaultVariables,...g}),e=this.interpolator.interpolate(e,g,r.lng||this.language||n.usedLng,r),h){const y=e.match(this.interpolator.nestingRegexp),v=y&&y.length;p<v&&(r.nest=!1)}!r.lng&&n&&n.res&&(r.lng=this.language||n.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,(...y)=>(i==null?void 0:i[0])===y[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${y[0]} in key: ${t[0]}`),null):this.translate(...y,t),r)),r.interpolation&&this.interpolator.reset()}const o=r.postProcess||this.options.postProcess,l=L(o)?[o]:o;return e!=null&&(l!=null&&l.length)&&r.applyPostProcessor!==!1&&(e=Mr.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...n,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,t={}){let r,n,i,o,l;return L(e)&&(e=[e]),e.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,t),h=d.key;n=h;let p=d.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));const g=t.count!==void 0&&!L(t.count),y=g&&!t.ordinal&&t.count===0,v=t.context!==void 0&&(L(t.context)||typeof t.context=="number")&&t.context!=="",k=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);p.forEach(j=>{var T,P;this.isValidLookup(r)||(l=j,!lr[`${k[0]}-${j}`]&&((T=this.utils)!=null&&T.hasLoadedNamespace)&&!((P=this.utils)!=null&&P.hasLoadedNamespace(l))&&(lr[`${k[0]}-${j}`]=!0,this.logger.warn(`key "${n}" for languages "${k.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),k.forEach(A=>{var te;if(this.isValidLookup(r))return;o=A;const U=[h];if((te=this.i18nFormat)!=null&&te.addLookupKeys)this.i18nFormat.addLookupKeys(U,h,A,j,t);else{let K;g&&(K=this.pluralResolver.getSuffix(A,t.count,t));const H=`${this.options.pluralSeparator}zero`,D=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(U.push(h+K),t.ordinal&&K.indexOf(D)===0&&U.push(h+K.replace(D,this.options.pluralSeparator)),y&&U.push(h+H)),v){const _=`${h}${this.options.contextSeparator}${t.context}`;U.push(_),g&&(U.push(_+K),t.ordinal&&K.indexOf(D)===0&&U.push(_+K.replace(D,this.options.pluralSeparator)),y&&U.push(_+H))}}let B;for(;B=U.pop();)this.isValidLookup(r)||(i=B,r=this.getResource(A,j,B,t))}))})}),{res:r,usedKey:n,exactUsedKey:i,usedLng:o,usedNS:l}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,r,n={}){var i;return(i=this.i18nFormat)!=null&&i.getResource?this.i18nFormat.getResource(e,t,r,n):this.resourceStore.getResource(e,t,r,n)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!L(e.replace);let n=r?e.replace:e;if(r&&typeof e.count<"u"&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n={...this.options.interpolation.defaultVariables,...n}),!r){n={...n};for(const i of t)delete n[i]}return n}static hasDefaultValue(e){const t="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,t.length)&&e[r]!==void 0)return!0;return!1}}class cr{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ue.create("languageUtils")}getScriptPartFromCode(e){if(e=Xe(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=Xe(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(L(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(r=>{if(t)return;const n=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(r=>{if(t)return;const n=this.getScriptPartFromCode(r);if(this.isSupportedCode(n))return t=n;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return t=i;t=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&(o.indexOf("-")>0&&i.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===i||o.indexOf(i)===0&&i.length>1))return o})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),L(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}toResolveHierarchy(e,t){const r=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),n=[],i=o=>{o&&(this.isSupportedCode(o)?n.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return L(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(e))):L(e)&&i(this.formatLanguageCode(e)),r.forEach(o=>{n.indexOf(o)<0&&i(this.formatLanguageCode(o))}),n}}const dr={zero:0,one:1,two:2,few:3,many:4,other:5},fr={select:a=>a===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class $a{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=ue.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const r=Xe(e==="dev"?"en":e),n=t.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:n});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let o;try{o=new Intl.PluralRules(r,{type:n})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),fr;if(!e.match(/-|_/))return fr;const c=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(c,t)}return this.pluralRulesCache[i]=o,o}needsPlural(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,r={}){return this.getSuffixes(e,r).map(n=>`${t}${n}`)}getSuffixes(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),r?r.resolvedOptions().pluralCategories.sort((n,i)=>dr[n]-dr[i]).map(n=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${n}`):[]}getSuffix(e,t,r={}){const n=this.getRule(e,r);return n?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${n.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,r))}}const hr=(a,e,t,r=".",n=!0)=>{let i=Ea(a,e,t);return!i&&n&&L(t)&&(i=Ut(a,t,r),i===void 0&&(i=Ut(e,t,r))),i},At=a=>a.replace(/\$/g,"$$$$");class Fa{constructor(e={}){var t;this.logger=ue.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:r,useRawValueToEscape:n,prefix:i,prefixEscaped:o,suffix:l,suffixEscaped:c,formatSeparator:d,unescapeSuffix:h,unescapePrefix:p,nestingPrefix:g,nestingPrefixEscaped:y,nestingSuffix:v,nestingSuffixEscaped:k,nestingOptionsSeparator:j,maxReplaces:T,alwaysFormat:P}=e.interpolation;this.escape=t!==void 0?t:Pa,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=n!==void 0?n:!1,this.prefix=i?Te(i):o||"{{",this.suffix=l?Te(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=h?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=g?Te(g):y||Te("$t("),this.nestingSuffix=v?Te(v):k||Te(")"),this.nestingOptionsSeparator=j||",",this.maxReplaces=T||1e3,this.alwaysFormat=P!==void 0?P:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,r)=>(t==null?void 0:t.source)===r?(t.lastIndex=0,t):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,r,n){var y;let i,o,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=v=>{if(v.indexOf(this.formatSeparator)<0){const P=hr(t,c,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(P,void 0,r,{...n,...t,interpolationkey:v}):P}const k=v.split(this.formatSeparator),j=k.shift().trim(),T=k.join(this.formatSeparator).trim();return this.format(hr(t,c,j,this.options.keySeparator,this.options.ignoreJSONStructure),T,r,{...n,...t,interpolationkey:j})};this.resetRegExp();const h=(n==null?void 0:n.missingInterpolationHandler)||this.options.missingInterpolationHandler,p=((y=n==null?void 0:n.interpolation)==null?void 0:y.skipOnVariables)!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:v=>At(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?At(this.escape(v)):At(v)}].forEach(v=>{for(l=0;i=v.regex.exec(e);){const k=i[1].trim();if(o=d(k),o===void 0)if(typeof h=="function"){const T=h(e,i,n);o=L(T)?T:""}else if(n&&Object.prototype.hasOwnProperty.call(n,k))o="";else if(p){o=i[0];continue}else this.logger.warn(`missed to pass in variable ${k} for interpolating ${e}`),o="";else!L(o)&&!this.useRawValueToEscape&&(o=nr(o));const j=v.safeValue(o);if(e=e.replace(i[0],j),p?(v.regex.lastIndex+=o.length,v.regex.lastIndex-=i[0].length):v.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,t,r={}){let n,i,o;const l=(c,d)=>{const h=this.nestingOptionsSeparator;if(c.indexOf(h)<0)return c;const p=c.split(new RegExp(`${h}[ ]*{`));let g=`{${p[1]}`;c=p[0],g=this.interpolate(g,o);const y=g.match(/'/g),v=g.match(/"/g);(((y==null?void 0:y.length)??0)%2===0&&!v||v.length%2!==0)&&(g=g.replace(/'/g,'"'));try{o=JSON.parse(g),d&&(o={...d,...o})}catch(k){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,k),`${c}${h}${g}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;n=this.nestingRegexp.exec(e);){let c=[];o={...r},o=o.replace&&!L(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let d=!1;if(n[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(n[1])){const h=n[1].split(this.formatSeparator).map(p=>p.trim());n[1]=h.shift(),c=h,d=!0}if(i=t(l.call(this,n[1].trim(),o),o),i&&n[0]===e&&!L(i))return i;L(i)||(i=nr(i)),i||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),i=""),d&&(i=c.reduce((h,p)=>this.format(h,p,r.lng,{...r,interpolationkey:n[1].trim()}),i.trim())),e=e.replace(n[0],i),this.regexp.lastIndex=0}return e}}const Da=a=>{let e=a.toLowerCase().trim();const t={};if(a.indexOf("(")>-1){const r=a.split("(");e=r[0].toLowerCase().trim();const n=r[1].substring(0,r[1].length-1);e==="currency"&&n.indexOf(":")<0?t.currency||(t.currency=n.trim()):e==="relativetime"&&n.indexOf(":")<0?t.range||(t.range=n.trim()):n.split(";").forEach(o=>{if(o){const[l,...c]=o.split(":"),d=c.join(":").trim().replace(/^'+|'+$/g,""),h=l.trim();t[h]||(t[h]=d),d==="false"&&(t[h]=!1),d==="true"&&(t[h]=!0),isNaN(d)||(t[h]=parseInt(d,10))}})}return{formatName:e,formatOptions:t}},pr=a=>{const e={};return(t,r,n)=>{let i=n;n&&n.interpolationkey&&n.formatParams&&n.formatParams[n.interpolationkey]&&n[n.interpolationkey]&&(i={...i,[n.interpolationkey]:void 0});const o=r+JSON.stringify(i);let l=e[o];return l||(l=a(Xe(r),n),e[o]=l),l(t)}},_a=a=>(e,t,r)=>a(Xe(t),r)(e);class Ma{constructor(e={}){this.logger=ue.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const r=t.cacheInBuiltFormats?pr:_a;this.formats={number:r((n,i)=>{const o=new Intl.NumberFormat(n,{...i});return l=>o.format(l)}),currency:r((n,i)=>{const o=new Intl.NumberFormat(n,{...i,style:"currency"});return l=>o.format(l)}),datetime:r((n,i)=>{const o=new Intl.DateTimeFormat(n,{...i});return l=>o.format(l)}),relativetime:r((n,i)=>{const o=new Intl.RelativeTimeFormat(n,{...i});return l=>o.format(l,i.range||"day")}),list:r((n,i)=>{const o=new Intl.ListFormat(n,{...i});return l=>o.format(l)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=pr(t)}format(e,t,r,n={}){const i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(l=>l.indexOf(")")>-1)){const l=i.findIndex(c=>c.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,l)].join(this.formatSeparator)}return i.reduce((l,c)=>{var p;const{formatName:d,formatOptions:h}=Da(c);if(this.formats[d]){let g=l;try{const y=((p=n==null?void 0:n.formatParams)==null?void 0:p[n.interpolationkey])||{},v=y.locale||y.lng||n.locale||n.lng||r;g=this.formats[d](l,v,{...h,...n,...y})}catch(y){this.logger.warn(y)}return g}else this.logger.warn(`there was no format function for ${d}`);return l},e)}}const Aa=(a,e)=>{a.pending[e]!==void 0&&(delete a.pending[e],a.pendingCount--)};class Ia extends mt{constructor(e,t,r,n={}){var i,o;super(),this.backend=e,this.store=t,this.services=r,this.languageUtils=r.languageUtils,this.options=n,this.logger=ue.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=n.maxParallelReads||10,this.readingCalls=0,this.maxRetries=n.maxRetries>=0?n.maxRetries:5,this.retryTimeout=n.retryTimeout>=1?n.retryTimeout:350,this.state={},this.queue=[],(o=(i=this.backend)==null?void 0:i.init)==null||o.call(i,r,n.backend,n)}queueLoad(e,t,r,n){const i={},o={},l={},c={};return e.forEach(d=>{let h=!0;t.forEach(p=>{const g=`${d}|${p}`;!r.reload&&this.store.hasResourceBundle(d,p)?this.state[g]=2:this.state[g]<0||(this.state[g]===1?o[g]===void 0&&(o[g]=!0):(this.state[g]=1,h=!1,o[g]===void 0&&(o[g]=!0),i[g]===void 0&&(i[g]=!0),c[p]===void 0&&(c[p]=!0)))}),h||(l[d]=!0)}),(Object.keys(i).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(i),pending:Object.keys(o),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(e,t,r){const n=e.split("|"),i=n[0],o=n[1];t&&this.emit("failedLoading",i,o,t),!t&&r&&this.store.addResourceBundle(i,o,r,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&r&&(this.state[e]=0);const l={};this.queue.forEach(c=>{ka(c.loaded,[i],o),Aa(c,e),t&&c.errors.push(t),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{l[d]||(l[d]={});const h=c.loaded[d];h.length&&h.forEach(p=>{l[d][p]===void 0&&(l[d][p]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(e,t,r,n=0,i=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:r,tried:n,wait:i,callback:o});return}this.readingCalls++;const l=(d,h)=>{if(this.readingCalls--,this.waitingReads.length>0){const p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(d&&h&&n<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,r,n+1,i*2,o)},i);return}o(d,h)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(e,t);d&&typeof d.then=="function"?d.then(h=>l(null,h)).catch(l):l(null,d)}catch(d){l(d)}return}return c(e,t,l)}prepareLoading(e,t,r={},n){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();L(e)&&(e=this.languageUtils.toResolveHierarchy(e)),L(t)&&(t=[t]);const i=this.queueLoad(e,t,r,n);if(!i.toLoad.length)return i.pending.length||n(),null;i.toLoad.forEach(o=>{this.loadOne(o)})}load(e,t,r){this.prepareLoading(e,t,{},r)}reload(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}loadOne(e,t=""){const r=e.split("|"),n=r[0],i=r[1];this.read(n,i,"read",void 0,void 0,(o,l)=>{o&&this.logger.warn(`${t}loading namespace ${i} for language ${n} failed`,o),!o&&l&&this.logger.log(`${t}loaded namespace ${i} for language ${n}`,l),this.loaded(e,o,l)})}saveMissing(e,t,r,n,i,o={},l=()=>{}){var c,d,h,p,g;if((d=(c=this.services)==null?void 0:c.utils)!=null&&d.hasLoadedNamespace&&!((p=(h=this.services)==null?void 0:h.utils)!=null&&p.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${r}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((g=this.backend)!=null&&g.create){const y={...o,isUpdate:i},v=this.backend.create.bind(this.backend);if(v.length<6)try{let k;v.length===5?k=v(e,t,r,n,y):k=v(e,t,r,n),k&&typeof k.then=="function"?k.then(j=>l(null,j)).catch(l):l(null,k)}catch(k){l(k)}else v(e,t,r,n,l,y)}!e||!e[0]||this.store.addResource(e[0],t,r,n)}}}const gr=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:a=>{let e={};if(typeof a[1]=="object"&&(e=a[1]),L(a[1])&&(e.defaultValue=a[1]),L(a[2])&&(e.tDescription=a[2]),typeof a[2]=="object"||typeof a[3]=="object"){const t=a[3]||a[2];Object.keys(t).forEach(r=>{e[r]=t[r]})}return e},interpolation:{escapeValue:!0,format:a=>a,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),mr=a=>{var e,t;return L(a.ns)&&(a.ns=[a.ns]),L(a.fallbackLng)&&(a.fallbackLng=[a.fallbackLng]),L(a.fallbackNS)&&(a.fallbackNS=[a.fallbackNS]),((t=(e=a.supportedLngs)==null?void 0:e.indexOf)==null?void 0:t.call(e,"cimode"))<0&&(a.supportedLngs=a.supportedLngs.concat(["cimode"])),typeof a.initImmediate=="boolean"&&(a.initAsync=a.initImmediate),a},dt=()=>{},Va=a=>{Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(t=>{typeof a[t]=="function"&&(a[t]=a[t].bind(a))})};class Ge extends mt{constructor(e={},t){if(super(),this.options=mr(e),this.services={},this.logger=ue,this.modules={external:[]},Va(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(L(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const r=gr();this.options={...r,...this.options,...mr(e)},this.options.interpolation={...r.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const n=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?ue.init(n(this.modules.logger),this.options):ue.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:d=Ma;const h=new cr(this.options);this.store=new or(this.options.resources,this.options);const p=this.services;p.logger=ue,p.resourceStore=this.store,p.languageUtils=h,p.pluralResolver=new $a(h,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(p.formatter=n(d),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new Fa(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new Ia(n(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",(g,...y)=>{this.emit(g,...y)}),this.modules.languageDetector&&(p.languageDetector=n(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=n(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new pt(this.services,this.options),this.translator.on("*",(g,...y)=>{this.emit(g,...y)}),this.modules.external.forEach(g=>{g.init&&g.init(this)})}if(this.format=this.options.interpolation.format,t||(t=dt),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=(...h)=>this.store[d](...h)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=(...h)=>(this.store[d](...h),this)});const l=Ze(),c=()=>{const d=(h,p)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(p),t(h,p)};if(this.languages&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),l}loadResources(e,t=dt){var i,o;let r=t;const n=L(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if((n==null?void 0:n.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const l=[],c=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(p=>{p!=="cimode"&&l.indexOf(p)<0&&l.push(p)})};n?c(n):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(h=>c(h)),(o=(i=this.options.preload)==null?void 0:i.forEach)==null||o.call(i,d=>c(d)),this.services.backendConnector.load(l,this.options.ns,d=>{!d&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(d)})}else r(null)}reloadResources(e,t,r){const n=Ze();return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),r||(r=dt),this.services.backendConnector.reload(e,t,i=>{n.resolve(),r(i)}),n}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Mr.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let t=0;t<this.languages.length;t++){const r=this.languages[t];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const r=Ze();this.emit("languageChanging",e);const n=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},i=(l,c)=>{c?this.isLanguageChangingTo===e&&(n(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve((...d)=>this.t(...d)),t&&t(l,(...d)=>this.t(...d))},o=l=>{var h,p;!e&&!l&&this.services.languageDetector&&(l=[]);const c=L(l)?l:l&&l[0],d=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(L(l)?[l]:l);d&&(this.language||n(d),this.translator.language||this.translator.changeLanguage(d),(p=(h=this.services.languageDetector)==null?void 0:h.cacheUserLanguage)==null||p.call(h,d)),this.loadResources(d,g=>{i(g,d)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),r}getFixedT(e,t,r){const n=(i,o,...l)=>{let c;typeof o!="object"?c=this.options.overloadTranslationOptionHandler([i,o].concat(l)):c={...o},c.lng=c.lng||n.lng,c.lngs=c.lngs||n.lngs,c.ns=c.ns||n.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||n.keyPrefix);const d=this.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(i)?h=i.map(p=>`${c.keyPrefix}${d}${p}`):h=c.keyPrefix?`${c.keyPrefix}${d}${i}`:i,this.t(h,c)};return L(e)?n.lng=e:n.lngs=e,n.ns=t,n.keyPrefix=r,n}t(...e){var t;return(t=this.translator)==null?void 0:t.translate(...e)}exists(...e){var t;return(t=this.translator)==null?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=t.lng||this.resolvedLanguage||this.languages[0],n=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(l,c)=>{const d=this.services.backendConnector.state[`${l}|${c}`];return d===-1||d===0||d===2};if(t.precheck){const l=t.precheck(this,o);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!n||o(i,e)))}loadNamespaces(e,t){const r=Ze();return this.options.ns?(L(e)&&(e=[e]),e.forEach(n=>{this.options.ns.indexOf(n)<0&&this.options.ns.push(n)}),this.loadResources(n=>{r.resolve(),t&&t(n)}),r):(t&&t(),Promise.resolve())}loadLanguages(e,t){const r=Ze();L(e)&&(e=[e]);const n=this.options.preload||[],i=e.filter(o=>n.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return i.length?(this.options.preload=n.concat(i),this.loadResources(o=>{r.resolve(),t&&t(o)}),r):(t&&t(),Promise.resolve())}dir(e){var n,i;if(e||(e=this.resolvedLanguage||(((n=this.languages)==null?void 0:n.length)>0?this.languages[0]:this.language)),!e)return"rtl";const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((i=this.services)==null?void 0:i.languageUtils)||new cr(gr());return t.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new Ge(e,t)}cloneInstance(e={},t=dt){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const n={...this.options,...e,isClone:!0},i=new Ge(n);if((e.debug!==void 0||e.prefix!==void 0)&&(i.logger=i.logger.clone(e)),["store","services","language"].forEach(l=>{i[l]=this[l]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r){const l=Object.keys(this.store.data).reduce((c,d)=>(c[d]={...this.store.data[d]},c[d]=Object.keys(c[d]).reduce((h,p)=>(h[p]={...c[d][p]},h),c[d]),c),{});i.store=new or(l,n),i.services.resourceStore=i.store}return i.translator=new pt(i.services,n),i.translator.on("*",(l,...c)=>{i.emit(l,...c)}),i.init(n,t),i.translator.options=n,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Z=Ge.createInstance();Z.createInstance=Ge.createInstance;Z.createInstance;Z.dir;Z.init;Z.loadResources;Z.reloadResources;Z.use;Z.changeLanguage;Z.getFixedT;Z.t;Z.exists;Z.setDefaultNamespace;Z.hasLoadedNamespace;Z.loadNamespaces;Z.loadLanguages;const{slice:Ha,forEach:Ua}=[];function Ba(a){return Ua.call(Ha.call(arguments,1),e=>{if(e)for(const t in e)a[t]===void 0&&(a[t]=e[t])}),a}function Wa(a){return typeof a!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(t=>t.test(a))}const yr=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,za=function(a,e){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},n=encodeURIComponent(e);let i=`${a}=${n}`;if(r.maxAge>0){const o=r.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");i+=`; Max-Age=${Math.floor(o)}`}if(r.domain){if(!yr.test(r.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${r.domain}`}if(r.path){if(!yr.test(r.path))throw new TypeError("option path is invalid");i+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");i+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r.partitioned&&(i+="; Partitioned"),i},vr={create(a,e,t,r){let n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};t&&(n.expires=new Date,n.expires.setTime(n.expires.getTime()+t*60*1e3)),r&&(n.domain=r),document.cookie=za(a,e,n)},read(a){const e=`${a}=`,t=document.cookie.split(";");for(let r=0;r<t.length;r++){let n=t[r];for(;n.charAt(0)===" ";)n=n.substring(1,n.length);if(n.indexOf(e)===0)return n.substring(e.length,n.length)}return null},remove(a,e){this.create(a,"",-1,e)}};var qa={name:"cookie",lookup(a){let{lookupCookie:e}=a;if(e&&typeof document<"u")return vr.read(e)||void 0},cacheUserLanguage(a,e){let{lookupCookie:t,cookieMinutes:r,cookieDomain:n,cookieOptions:i}=e;t&&typeof document<"u"&&vr.create(t,a,r,n,i)}},Ka={name:"querystring",lookup(a){var r;let{lookupQuerystring:e}=a,t;if(typeof window<"u"){let{search:n}=window.location;!window.location.search&&((r=window.location.hash)==null?void 0:r.indexOf("?"))>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));const o=n.substring(1).split("&");for(let l=0;l<o.length;l++){const c=o[l].indexOf("=");c>0&&o[l].substring(0,c)===e&&(t=o[l].substring(c+1))}}return t}},Ja={name:"hash",lookup(a){var n;let{lookupHash:e,lookupFromHashIndex:t}=a,r;if(typeof window<"u"){const{hash:i}=window.location;if(i&&i.length>2){const o=i.substring(1);if(e){const l=o.split("&");for(let c=0;c<l.length;c++){const d=l[c].indexOf("=");d>0&&l[c].substring(0,d)===e&&(r=l[c].substring(d+1))}}if(r)return r;if(!r&&t>-1){const l=i.match(/\/([a-zA-Z-]*)/g);return Array.isArray(l)?(n=l[typeof t=="number"?t:0])==null?void 0:n.replace("/",""):void 0}}}return r}};let Ne=null;const br=()=>{if(Ne!==null)return Ne;try{if(Ne=typeof window<"u"&&window.localStorage!==null,!Ne)return!1;const a="i18next.translate.boo";window.localStorage.setItem(a,"foo"),window.localStorage.removeItem(a)}catch{Ne=!1}return Ne};var Za={name:"localStorage",lookup(a){let{lookupLocalStorage:e}=a;if(e&&br())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(a,e){let{lookupLocalStorage:t}=e;t&&br()&&window.localStorage.setItem(t,a)}};let $e=null;const xr=()=>{if($e!==null)return $e;try{if($e=typeof window<"u"&&window.sessionStorage!==null,!$e)return!1;const a="i18next.translate.boo";window.sessionStorage.setItem(a,"foo"),window.sessionStorage.removeItem(a)}catch{$e=!1}return $e};var Ya={name:"sessionStorage",lookup(a){let{lookupSessionStorage:e}=a;if(e&&xr())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(a,e){let{lookupSessionStorage:t}=e;t&&xr()&&window.sessionStorage.setItem(t,a)}},Xa={name:"navigator",lookup(a){const e=[];if(typeof navigator<"u"){const{languages:t,userLanguage:r,language:n}=navigator;if(t)for(let i=0;i<t.length;i++)e.push(t[i]);r&&e.push(r),n&&e.push(n)}return e.length>0?e:void 0}},Ga={name:"htmlTag",lookup(a){let{htmlTag:e}=a,t;const r=e||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(t=r.getAttribute("lang")),t}},Qa={name:"path",lookup(a){var n;let{lookupFromPathIndex:e}=a;if(typeof window>"u")return;const t=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?(n=t[typeof e=="number"?e:0])==null?void 0:n.replace("/",""):void 0}},ei={name:"subdomain",lookup(a){var n,i;let{lookupFromSubdomainIndex:e}=a;const t=typeof e=="number"?e+1:1,r=typeof window<"u"&&((i=(n=window.location)==null?void 0:n.hostname)==null?void 0:i.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[t]}};let Ar=!1;try{document.cookie,Ar=!0}catch{}const Ir=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Ar||Ir.splice(1,1);const ti=()=>({order:Ir,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:a=>a});class Vr{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=Ba(t,this.options||{},ti()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=n=>n.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(qa),this.addDetector(Ka),this.addDetector(Za),this.addDetector(Ya),this.addDetector(Xa),this.addDetector(Ga),this.addDetector(Qa),this.addDetector(ei),this.addDetector(Ja)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,t=[];return e.forEach(r=>{if(this.detectors[r]){let n=this.detectors[r].lookup(this.options);n&&typeof n=="string"&&(n=[n]),n&&(t=t.concat(n))}}),t=t.filter(r=>r!=null&&!Wa(r)).map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(e,this.options)}))}}Vr.type="languageDetector";const Hr={apiBaseUrl:"https://api.nemme.io",debug:!1},ri="Previous",ni="Next",ai={Previous:ri,Next:ni,"Type your answer here":"Type your answer here","Max {{maxCharacters}} characters":"Max {{maxCharacters}} characters"},ii={};ga({locale:xa});Z.use(Vr).use(dn).init({debug:Hr.debug,fallbackLng:"en",interpolation:{escapeValue:!1},resources:{en:{translation:ai},nb:{tranlation:ii}}});const wr={debug:0,info:1,warn:2,error:3};class zt{constructor(e={}){V(this,"prefix");V(this,"enabled");V(this,"level");this.prefix=e.prefix||"Nemme SDK",this.enabled=e.enabled!==void 0?e.enabled:!0,this.level=e.level||"info"}shouldLog(e){return this.enabled&&wr[e]>=wr[this.level]}formatMessage(e){return`[${this.prefix}] ${e}`}debug(e,...t){this.shouldLog("debug")&&console.debug(this.formatMessage(e),...t)}info(e,...t){this.shouldLog("info")&&console.info(this.formatMessage(e),...t)}warn(e,...t){this.shouldLog("warn")&&console.warn(this.formatMessage(e),...t)}error(e,...t){this.shouldLog("error")&&console.error(this.formatMessage(e),...t)}child(e){return new zt({prefix:`${this.prefix}:${e}`,enabled:this.enabled,level:this.level})}configure(e){e.prefix!==void 0&&(this.prefix=e.prefix),e.enabled!==void 0&&(this.enabled=e.enabled),e.level!==void 0&&(this.level=e.level)}}const Ur=new zt,Sr=Ur.child("network"),si=3e4,oi=(a,e)=>{const t=new URL(a,Hr.apiBaseUrl);return e&&Object.entries(e).forEach(([r,n])=>{n!=null&&t.searchParams.append(r,String(n))}),t.toString()},ge={async request(a,e={}){const{method:t="GET",headers:r={},body:n,params:i,timeout:o=si}=e,l=oi(a,i),c={"Content-Type":"application/json",Accept:"application/json",...r},d={method:t,headers:c,body:n?JSON.stringify(n):void 0},h=new AbortController,p=setTimeout(()=>h.abort(),o);d.signal=h.signal;try{const g=await fetch(l,d);let y;const v=g.headers.get("content-type");if(v&&v.includes("application/json"))y=await g.json();else{const j=await g.text();try{y=JSON.parse(j)}catch{y=j}}const k={data:y,status:g.status,statusText:g.statusText,headers:g.headers,ok:g.ok};if(g.ok)k.ok=!0;else{const j=`Request failed with status ${g.status}: ${g.statusText}`;Sr.error(j,{url:l,method:t,status:g.status,data:k.data}),k.ok=!1,k.error={message:j,details:k.data}}return k}catch(g){let y="Network request failed",v={};return g instanceof DOMException&&g.name==="AbortError"?(y=`Request timeout after ${o}ms`,v={timeout:o,url:l}):v={message:g instanceof Error?g.message:String(g),url:l,method:t},Sr.error(y,v),{data:{},status:0,statusText:y,headers:new Headers,ok:!1,error:{message:y,details:v}}}finally{clearTimeout(p)}},async get(a,e={}){return this.request(a,{...e,method:"GET"})},async post(a,e,t={}){return this.request(a,{...t,method:"POST",body:e})},async put(a,e,t={}){return this.request(a,{...t,method:"PUT",body:e})},async patch(a,e,t={}){return this.request(a,{...t,method:"PATCH",body:e})},async delete(a,e={}){return this.request(a,{...e,method:"DELETE"})}};class li{constructor(e,t){V(this,"logger");V(this,"headers");this.logger=e,this.headers=t}async fetchAndDisplayForm(e,t,r){this.logger.debug(`Fetching form config for: ${e}`);try{const n=await ge.get(`/external/forms/${e}`,{headers:this.headers});n.ok&&n.data?(this.logger.info(`Form config loaded for: ${e}`,n.data),this.displayForm(n.data,t,r)):this.logger.warn(`No form config found for: ${e}`)}catch(n){this.logger.error(`Failed to fetch form config for: ${e}`,n)}}displayForm(e,t,r){const n=document.createElement("div");n.id="nm",document.body.appendChild(n);const i=Gr.createRoot(n),o=F.createElement(gn,{i18n:Z},F.createElement(xn,{form:e,onDismiss:async l=>{await t(),await this.postFormResponse(e,l),i.unmount(),n.remove(),this.logger.info("Form dismissed",l)},onComplete:async l=>{await r(),await this.postFormResponse(e,l),i.unmount(),n.remove(),this.logger.info("Form completed",l)}}));i.render(o)}async postFormResponse(e,t){this.logger.info("Posting form response",t);const r=await ge.post(`/external/forms/${e.slug}`,t,{headers:this.headers});this.logger.info("Form response posted",r.data)}}class ui{constructor(e,t){V(this,"logger");V(this,"headers");V(this,"formManager");V(this,"deliveries",[]);this.logger=e,this.headers=t,this.formManager=new li(e,t)}async loadDeliveries(){try{this.logger.debug("Loading deliveries");const e=await ge.get("/external/deliveries",{headers:this.headers});this.deliveries=e.data,this.logger.info(`Loaded ${this.deliveries.length} deliveries`)}catch(e){this.logger.error("Failed to load deliveries",e),this.deliveries=[]}}async evaluateDeliveryTriggers(e){for(const t of this.deliveries)for(const r of t.triggers)if(this.shouldTriggerDelivery(r,e)){if(!await this.isDeliveryValid(t)){this.logger.debug(`Delivery ${t.id} is not valid, skipping`);continue}await this.executeDelivery(t,r);return}}shouldTriggerDelivery(e,t){if(this.hasActiveDelivery())return!1;switch(e.triggerType){case"page_url":return e.urlPattern?this.matchesUrlPattern(t.url,e.urlPattern):!0;case"custom_event":return e.eventName?t.eventName===e.eventName:!1;default:return!1}}hasActiveDelivery(){return document.getElementById("nm")!==null}async executeDelivery(e,t){if(e.productType==="FRM"){this.logger.debug(`Triggering form delivery: ${e.productSlug}`,{triggerType:t.triggerType,urlPattern:t.urlPattern,eventName:t.eventName});try{const n=await this.createDeliveryResponse(e);await this.formManager.fetchAndDisplayForm(e.productSlug,async()=>{this.logger.debug(`Form for delivery: ${e.productSlug} was cancelled`),n&&await this.updateDeliveryResponse(e.id,n.id,!0)},async()=>{this.logger.debug(`Form for delivery: ${e.productSlug} was completed`),n&&await this.updateDeliveryResponse(e.id,n.id,!1,!0)})}catch(n){this.logger.error(`Failed to load form for delivery: ${e.productSlug}`,n)}}}matchesUrlPattern(e,t){let r;try{r=new URL(e).pathname}catch{r=e.startsWith("/")?e:`/${e}`}const n=t.replace(/\*\*/g,"§DOUBLE_STAR§").replace(/\*/g,"[^/]*").replace(/§DOUBLE_STAR§/g,".*").replace(/\?/g,"."),o=new RegExp(`^${n}$`).test(r);return this.logger.debug("URL pattern matching",{originalUrl:e,pathname:r,pattern:t,regexPattern:n,matches:o}),o}async createDeliveryResponse(e){try{return(await ge.post(`/external/deliveries/${e.id}/responses`,{},{headers:this.headers})).data}catch(t){this.logger.error(`Failed to create delivery response for delivery: ${e.id}`,t)}}async updateDeliveryResponse(e,t,r=!1,n=!1){try{await ge.patch(`/external/deliveries/${e}/responses/${t}`,{wasDismissed:r,wasCompleted:n},{headers:this.headers})}catch(i){this.logger.error(`Failed to update delivery response: ${t} for delivery: ${e}`,i)}}async isDeliveryValid(e){try{return(await ge.get(`/external/deliveries/${e.id}/should-deliver`,{headers:this.headers})).data}catch(t){return this.logger.error(`Failed to get delivery should-deliver for delivery: ${e.id}`,t),!1}}}class ci{constructor({logger:e,headers:t,sessionId:r,eventDefinitions:n,batchConfig:i,onPageView:o}){V(this,"logger");V(this,"headers");V(this,"sessionId");V(this,"eventDefinitions",[]);V(this,"onPageView");V(this,"backlog",[]);V(this,"flushTimeout",null);V(this,"batchConfig",{enabled:!0,size:10,delayMs:1e4,sendOnUnload:!0});V(this,"originalHistoryMethods",null);V(this,"EVENT_PAGE_VIEW","page_view");this.logger=e,this.headers=t,this.sessionId=r,this.eventDefinitions=n,this.onPageView=o,this.flushEvents=this.flushEvents.bind(this),this.handlePopState=this.handlePopState.bind(this),this.handleVisibilityChange=this.handleVisibilityChange.bind(this),this.setupBatching(i)}setupBatching(e){typeof e=="boolean"?this.batchConfig.enabled=e:e&&(this.batchConfig={...this.batchConfig,...e}),this.batchConfig.enabled&&this.batchConfig.sendOnUnload&&typeof window<"u"&&(window.addEventListener("beforeunload",this.flushEvents),window.addEventListener("pagehide",this.flushEvents))}async setupPageViewTracking(){if(typeof window>"u")return;this.originalHistoryMethods={pushState:history.pushState,replaceState:history.replaceState};const e=history.pushState;history.pushState=async(...r)=>{e.apply(history,r),await this.trackPageView()};const t=history.replaceState;history.replaceState=async(...r)=>{t.apply(history,r),await this.trackPageView()},window.addEventListener("popstate",this.handlePopState),document.addEventListener("visibilitychange",this.handleVisibilityChange)}async track(e){if(!this.sessionId){this.logger.warn("Tracking manager not initialized, cannot track event");return}const{eventKey:t,data:r={}}=e;this.logger.debug("Tracking event",{eventKey:t,data:r});const n={sessionId:this.sessionId,eventKey:t,data:r||{},timestamp:new Date().toISOString(),page:window.location.href};this.validateEvent(n),this.batchConfig.enabled?(this.backlog.push(n),this.scheduleFlush()):await this.sendEvents([n])}async trackPageView(){var e;typeof window>"u"||(await this.track({eventKey:this.EVENT_PAGE_VIEW,data:{title:document.title}}),(e=this.onPageView)==null||e.call(this,window.location.href))}async flush(){return this.flushEvents()}destroy(){this.originalHistoryMethods&&(history.pushState=this.originalHistoryMethods.pushState,history.replaceState=this.originalHistoryMethods.replaceState,this.originalHistoryMethods=null),typeof window<"u"&&(window.removeEventListener("popstate",this.handlePopState),document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.flushEvents),window.removeEventListener("pagehide",this.flushEvents)),this.flushTimeout&&(clearTimeout(this.flushTimeout),this.flushTimeout=null)}validateEvent(e){if(e.eventKey===this.EVENT_PAGE_VIEW)return;const t=this.eventDefinitions.find(i=>i.eventKey===e.eventKey);if(!t){this.logger.warn(`Event ${e.eventKey} is not registered`);return}const r=t.properties,n=e.data;if(n)for(const i of Object.keys(n)){const o=n[i],l=r.find(c=>c.name===i);if(!l){this.logger.warn(`Property ${i} is not registered for event ${e.eventKey}`);return}l.type==="string"&&typeof o!="string"&&this.logger.warn(`Property ${l.name} has type ${l.type} but value is of type ${typeof o}`),l.type==="boolean"&&typeof o!="boolean"&&this.logger.warn(`Property ${l.name} has type ${l.type} but value is of type ${typeof o}`),l.type==="number"&&typeof o!="number"&&this.logger.warn(`Property ${l.name} has type ${l.type} but value is of type ${typeof o}`)}}async handlePopState(){await this.trackPageView()}async handleVisibilityChange(){document.visibilityState==="visible"&&await this.trackPageView()}scheduleFlush(){if(this.backlog.length>=this.batchConfig.size){this.flushEvents();return}this.flushTimeout||(this.flushTimeout=window.setTimeout(()=>{this.flushEvents()},this.batchConfig.delayMs))}async flushEvents(){if(this.flushTimeout&&(clearTimeout(this.flushTimeout),this.flushTimeout=null),this.backlog.length===0)return;const e=[...this.backlog];this.backlog=[];try{await this.sendEvents(e)}catch(t){this.backlog.unshift(...e),this.logger.error("Failed to send batched events",t)}}async sendEvents(e){if(e.length!==0)if(e.length===1){const t=e[0];await ge.post("/external/trackings/track",t,{headers:this.headers})}else await ge.post("/external/trackings/batch",e,{headers:this.headers})}}class qt{constructor(e){V(this,"clientKey");V(this,"userIdentifier");V(this,"initialized",!1);V(this,"clientLogger",Ur.child("client"));V(this,"headers",{});V(this,"trackingManager");this.clientKey=e}async init({userIdentifier:e,debug:t=!1,batch:r}){if(!e)throw new Error("userIdentifier is required parameter");this.userIdentifier=e,this.clientLogger.configure({enabled:t,level:t?"debug":"info"}),this.headers={"X-Client-Key":this.clientKey,"X-User-Id":this.userIdentifier};try{const n=await this.initializeSession();await this.initializeManagers(n,r),this.initialized=!0,this.clientLogger.info("Nemme client initialized",{clientKey:this.clientKey,userIdentifier:this.userIdentifier})}catch(n){this.clientLogger.error("Error during initialization:",n)}return this}async flush(){var e;return(e=this.trackingManager)==null?void 0:e.flush()}destroy(){var e;(e=this.trackingManager)==null||e.destroy()}async track(e){if(!this.initialized||!this.trackingManager){this.clientLogger.warn("Nemme client not initialized, some operations may fail");return}return this.trackingManager.track(e)}async initializeSession(){var e;try{const t=await ge.post("/external/trackings/initialize",{},{headers:this.headers});if(!t.ok)throw new Error(((e=t.error)==null?void 0:e.message)||"Request for initialising session failed");return t.data}catch(t){throw this.clientLogger.error("Error during initialization",t),t}}async initializeManagers(e,t){const r=new ui(this.clientLogger,this.headers),n=new ci({logger:this.clientLogger,headers:this.headers,sessionId:e.sessionId,eventDefinitions:e.eventDefinitions,batchConfig:t,onPageView:async i=>{await r.evaluateDeliveryTriggers({url:i})}});await r.loadDeliveries(),typeof window<"u"&&(await n.setupPageViewTracking(),await n.trackPageView(),await n.flush()),this.trackingManager=n}}const di=a=>new qt(a),Br=F.createContext(void 0),fi=({clientKey:a,config:e,children:t})=>{const[r,n]=F.useState(null),[i,o]=F.useState(!1),[l,c]=F.useState(null);F.useEffect(()=>{let h=null,p=!1;const g=async()=>{try{const y=new qt(a);if(await y.init(e),p){y.destroy();return}h=y,n(y),o(!0),c(null)}catch(y){p||(c(y instanceof Error?y.message:"Failed to initialize Nemme client"),o(!1))}};return n(null),o(!1),c(null),g(),()=>{p=!0,h&&h.destroy()}},[a,e]);const d={client:r,isInitialized:i,error:l};return S.jsx(Br.Provider,{value:d,children:t})},Wr=()=>{const a=F.useContext(Br);if(a===void 0)throw new Error("useNemmeContext must be used within a NemmeProvider");return a},hi=()=>{const{client:a,isInitialized:e,error:t}=Wr(),r=F.useCallback(async i=>{if(!a||!e){console.warn("Nemme client not initialized");return}return a.track(i)},[a,e]),n=F.useCallback(async()=>{if(!a||!e){console.warn("Nemme client not initialized");return}return a.flush()},[a,e]);return{track:r,flush:n,isInitialized:e,error:t,client:a}},zr=a=>di(a);exports.NemmeClient=qt;exports.NemmeProvider=fi;exports.NemmeSDK=zr;exports.default=zr;exports.useNemme=hi;exports.useNemmeContext=Wr;
68
+ //# sourceMappingURL=index.cjs.map