@nemme/js-sdk 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -3
- package/dist/browser.d.ts +9 -3
- package/dist/index.cjs +5 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1801 -2984
- package/dist/index.esm.js.map +1 -1
- package/dist/nemme-sdk.umd.js +5 -47
- package/dist/nemme-sdk.umd.js.map +1 -1
- package/package.json +6 -7
package/dist/nemme-sdk.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(C,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],b):(C=typeof globalThis<"u"?globalThis:C||self,b(C.NemmeSDK={},C.React,C.ReactDOM))})(this,(function(C,b,W){"use strict";var Kr=Object.defineProperty;var Wr=(C,b,W)=>b in C?Kr(C,b,{enumerable:!0,configurable:!0,writable:!0,value:W}):C[b]=W;var S=(C,b,W)=>Wr(C,typeof b!="symbol"?b+"":b,W);function Rt(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const p=Rt(b);var le={},Ne;function Ft(){if(Ne)return le;Ne=1;var i=W;return le.createRoot=i.createRoot,le.hydrateRoot=i.hydrateRoot,le}var Mt=Ft();const $t=(i,e,t,n)=>{var s,a,o,c;const r=[t,{code:e,...n||{}}];if((a=(s=i==null?void 0:i.services)==null?void 0:s.logger)!=null&&a.forward)return i.services.logger.forward(r,"warn","react-i18next::",!0);_(r[0])&&(r[0]=`react-i18next:: ${r[0]}`),(c=(o=i==null?void 0:i.services)==null?void 0:o.logger)!=null&&c.warn?i.services.logger.warn(...r):console!=null&&console.warn&&console.warn(...r)},je={},ye=(i,e,t,n)=>{_(t)&&je[t]||(_(t)&&(je[t]=new Date),$t(i,e,t,n))},Te=(i,e)=>()=>{if(i.isInitialized)e();else{const t=()=>{setTimeout(()=>{i.off("initialized",t)},0),e()};i.on("initialized",t)}},xe=(i,e,t)=>{i.loadNamespaces(e,Te(i,t))},Re=(i,e,t,n)=>{if(_(t)&&(t=[t]),i.options.preload&&i.options.preload.indexOf(e)>-1)return xe(i,t,n);t.forEach(r=>{i.options.ns.indexOf(r)<0&&i.options.ns.push(r)}),i.loadLanguages(e,Te(i,n))},Dt=(i,e,t={})=>!e.languages||!e.languages.length?(ye(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(i,{lng:t.lng,precheck:(n,r)=>{if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!r(n.isLanguageChangingTo,i))return!1}}),_=i=>typeof i=="string",At=i=>typeof i=="object"&&i!==null,Vt=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,It={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Ht=i=>It[i];let be={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:i=>i.replace(Vt,Ht)};const Bt=(i={})=>{be={...be,...i}},qt=()=>be;let Fe;const zt=i=>{Fe=i},Ut=()=>Fe,_t={type:"3rdParty",init(i){Bt(i.options.react),zt(i)}},Me=b.createContext();class Kt{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Wt=(i,e)=>{const t=b.useRef();return b.useEffect(()=>{t.current=i},[i,e]),t.current},$e=(i,e,t,n)=>i.getFixedT(e,t,n),Zt=(i,e,t,n)=>b.useCallback($e(i,e,t,n),[i,e,t,n]),we=(i,e={})=>{var N,j,z,R;const{i18n:t}=e,{i18n:n,defaultNS:r}=b.useContext(Me)||{},s=t||n||Ut();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new Kt),!s){ye(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const P=(k,$)=>_($)?$:At($)&&_($.defaultValue)?$.defaultValue:Array.isArray(k)?k[k.length-1]:k,E=[P,{},!1];return E.t=P,E.i18n={},E.ready=!1,E}(N=s.options.react)!=null&&N.wait&&ye(s,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...qt(),...s.options.react,...e},{useSuspense:o,keyPrefix:c}=a;let l=r||((j=s.options)==null?void 0:j.defaultNS);l=_(l)?[l]:l||["translation"],(R=(z=s.reportNamespaces).addUsedNamespaces)==null||R.call(z,l);const u=(s.isInitialized||s.initializedStoreOnce)&&l.every(P=>Dt(P,s,a)),d=Zt(s,e.lng||null,a.nsMode==="fallback"?l:l[0],c),h=()=>d,f=()=>$e(s,e.lng||null,a.nsMode==="fallback"?l:l[0],c),[g,y]=b.useState(h);let w=l.join();e.lng&&(w=`${e.lng}${w}`);const v=Wt(w),L=b.useRef(!0);b.useEffect(()=>{const{bindI18n:P,bindI18nStore:E}=a;L.current=!0,!u&&!o&&(e.lng?Re(s,e.lng,l,()=>{L.current&&y(f)}):xe(s,l,()=>{L.current&&y(f)})),u&&v&&v!==w&&L.current&&y(f);const k=()=>{L.current&&y(f)};return P&&(s==null||s.on(P,k)),E&&(s==null||s.store.on(E,k)),()=>{L.current=!1,s&&P&&(P==null||P.split(" ").forEach($=>s.off($,k))),E&&s&&E.split(" ").forEach($=>s.store.off($,k))}},[s,w]),b.useEffect(()=>{L.current&&u&&y(h)},[s,c,u]);const O=[g,s,u];if(O.t=g,O.i18n=s,O.ready=u,u||!u&&!o)return O;throw new Promise(P=>{e.lng?Re(s,e.lng,l,()=>P()):xe(s,l,()=>P())})};function Jt({i18n:i,defaultNS:e,children:t}){const n=b.useMemo(()=>({i18n:i,defaultNS:e}),[i,e]);return b.createElement(Me.Provider,{value:n},t)}var ve={exports:{}},Y={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,28 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var rr;function hn(){if(rr)return $e;rr=1;var a=C,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 $e.Fragment=t,$e.jsx=o,$e.jsxs=o,$e}var Me={};/**
|
|
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 nr;function pn(){return nr||(nr=1,process.env.NODE_ENV!=="production"&&function(){var a=C,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 T(s){if(s===null||typeof s!="object")return null;var f=v&&s[v]||s[k];return typeof f=="function"?f:null}var N=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=N.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,re=!1,J=!1,H=!1,_;_=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||J||s===y||U||B||re||typeof s=="object"&&s!==null&&(s.$$typeof===g||s.$$typeof===p||s.$$typeof===o||s.$$typeof===l||s.$$typeof===c||s.$$typeof===_||s.getModuleId!==void 0))}function G(s,f,m){var x=s.displayName;if(x)return x;var O=f.displayName||f.name||"";return O!==""?m+"("+O+")":m}function we(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 we(f)+".Consumer";case o:var m=s;return we(m._context)+".Provider";case c:return G(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,ee=0,X,Q,ie,ue,be,q,ne;function se(){}se.__reactDisabledLog=!0;function Ne(){{if(ee===0){X=console.log,Q=console.info,ie=console.warn,ue=console.error,be=console.group,q=console.groupCollapsed,ne=console.groupEnd;var s={configurable:!0,enumerable:!0,value:se,writable:!0};Object.defineProperties(console,{info:s,log:s,warn:s,error:s,group:s,groupCollapsed:s,groupEnd:s})}ee++}}function Fe(){{if(ee--,ee===0){var s={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},s,{value:X}),info:I({},s,{value:Q}),warn:I({},s,{value:ie}),error:I({},s,{value:ue}),group:I({},s,{value:be}),groupCollapsed:I({},s,{value:q}),groupEnd:I({},s,{value:ne})})}ee<0&&P("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Se=N.ReactCurrentDispatcher,ke;function pe(s,f,m){{if(ke===void 0)try{throw Error()}catch(O){var x=O.stack.trim().match(/\n( *(at )?)/);ke=x&&x[1]||""}return`
|
|
18
|
-
`+ke+s}}var Ee=!1,ge;{var Ct=typeof WeakMap=="function"?WeakMap:Map;ge=new Ct}function qe(s,f){if(!s||Ee)return"";{var m=ge.get(s);if(m!==void 0)return m}var x;Ee=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var E;E=Se.current,Se.current=null,Ne();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(Z){x=Z}Reflect.construct(s,[],w)}else{try{w.call()}catch(Z){x=Z}s.call(w.prototype)}}else{try{throw Error()}catch(Z){x=Z}s()}}catch(Z){if(Z&&x&&typeof Z.stack=="string"){for(var R=Z.stack.split(`
|
|
19
|
-
`),F=x.stack.split(`
|
|
20
|
-
`),j=R.length-1,D=F.length-1;j>=1&&D>=0&&R[j]!==F[D];)D--;for(;j>=1&&D>=0;j--,D--)if(R[j]!==F[D]){if(j!==1||D!==1)do if(j--,D--,D<0||R[j]!==F[D]){var K=`
|
|
21
|
-
`+R[j].replace(" at new "," at ");return s.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",s.displayName)),typeof s=="function"&&ge.set(s,K),K}while(j>=1&&D>=0);break}}}finally{Ee=!1,Se.current=E,Fe(),Error.prepareStackTrace=O}var te=s?s.displayName||s.name:"",W=te?pe(te):"";return typeof s=="function"&&ge.set(s,W),W}function jt(s,f,m){return qe(s,!1)}function Tt(s){var f=s.prototype;return!!(f&&f.isReactComponent)}function me(s,f,m){if(s==null)return"";if(typeof s=="function")return qe(s,Tt(s));if(typeof s=="string")return pe(s);switch(s){case d:return pe("Suspense");case h:return pe("SuspenseList")}if(typeof s=="object")switch(s.$$typeof){case c:return jt(s.render);case p:return me(s.type,f,m);case g:{var x=s,O=x._payload,E=x._init;try{return me(E(O),f,m)}catch{}}}return""}var oe=Object.prototype.hasOwnProperty,Ke={},Je=N.ReactDebugCurrentFrame;function ye(s){if(s){var f=s._owner,m=me(s.type,s._source,f?f.type:null);Je.setExtraStackFrame(m)}else Je.setExtraStackFrame(null)}function Nt(s,f,m,x,O){{var E=Function.call.bind(oe);for(var w in s)if(E(s,w)){var R=void 0;try{if(typeof s[w]!="function"){var F=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 F.name="Invariant Violation",F}R=s[w](f,w,x,m,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(j){R=j}R&&!(R instanceof Error)&&(ye(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),ye(null)),R instanceof Error&&!(R.message in Ke)&&(Ke[R.message]=!0,ye(O),P("Failed %s type: %s",m,R.message),ye(null))}}}var Ft=Array.isArray;function Oe(s){return Ft(s)}function Dt(s){{var f=typeof Symbol=="function"&&Symbol.toStringTag,m=f&&s[Symbol.toStringTag]||s.constructor.name||"Object";return m}}function _t(s){try{return ct(s),!1}catch{return!0}}function ct(s){return""+s}function Ze(s){if(_t(s))return P("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Dt(s)),ct(s)}var dt=N.ReactCurrentOwner,$t={key:!0,ref:!0,__self:!0,__source:!0},Ye,Xe;function Mt(s){if(oe.call(s,"ref")){var f=Object.getOwnPropertyDescriptor(s,"ref").get;if(f&&f.isReactWarning)return!1}return s.ref!==void 0}function At(s){if(oe.call(s,"key")){var f=Object.getOwnPropertyDescriptor(s,"key").get;if(f&&f.isReactWarning)return!1}return s.key!==void 0}function It(s,f){typeof s.ref=="string"&&dt.current}function Vt(s,f){{var m=function(){Ye||(Ye=!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 Ht(s,f){{var m=function(){Xe||(Xe=!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 Ut=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 Ge(s,f,m,x,O){{var E,w={},R=null,F=null;m!==void 0&&(Ze(m),R=""+m),At(f)&&(Ze(f.key),R=""+f.key),Mt(f)&&(F=f.ref,It(f,O));for(E in f)oe.call(f,E)&&!$t.hasOwnProperty(E)&&(w[E]=f[E]);if(s&&s.defaultProps){var j=s.defaultProps;for(E in j)w[E]===void 0&&(w[E]=j[E])}if(R||F){var D=typeof s=="function"?s.displayName||s.name||"Unknown":s;R&&Vt(w,D),F&&Ht(w,D)}return Ut(s,R,F,O,x,dt.current,w)}}var De=N.ReactCurrentOwner,ve=N.ReactDebugCurrentFrame;function ce(s){if(s){var f=s._owner,m=me(s.type,s._source,f?f.type:null);ve.setExtraStackFrame(m)}else ve.setExtraStackFrame(null)}var Pe;Pe=!1;function _e(s){return typeof s=="object"&&s!==null&&s.$$typeof===e}function ft(){{if(De.current){var s=M(De.current.type);if(s)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+s+"`."}return""}}function ht(s){return""}var pt={};function gt(s){{var f=ft();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 Qe(s,f){{if(!s._store||s._store.validated||s.key!=null)return;s._store.validated=!0;var m=gt(f);if(pt[m])return;pt[m]=!0;var x="";s&&s._owner&&s._owner!==De.current&&(x=" It was passed a child from "+M(s._owner.type)+"."),ce(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),ce(null)}}function mt(s,f){{if(typeof s!="object")return;if(Oe(s))for(var m=0;m<s.length;m++){var x=s[m];_e(x)&&Qe(x,f)}else if(_e(s))s._store&&(s._store.validated=!0);else if(s){var O=T(s);if(typeof O=="function"&&O!==s.entries)for(var E=O.call(s),w;!(w=E.next()).done;)_e(w.value)&&Qe(w.value,f)}}}function Bt(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);Nt(m,s.props,"prop",x,s)}else if(f.PropTypes!==void 0&&!Pe){Pe=!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 yt(s){{for(var f=Object.keys(s.props),m=0;m<f.length;m++){var x=f[m];if(x!=="children"&&x!=="key"){ce(s),P("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",x),ce(null);break}}s.ref!==null&&(ce(s),P("Invalid attribute `ref` supplied to `React.Fragment`."),ce(null))}}var et={};function vt(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 F=ht();F?R+=F:R+=ft();var j;s===null?j="null":Oe(s)?j="array":s!==void 0&&s.$$typeof===e?(j="<"+(M(s.type)||"Unknown")+" />",R=" Did you accidentally export a JSX literal instead of a component?"):j=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",j,R)}var D=Ge(s,f,m,O,E);if(D==null)return D;if(w){var K=f.children;if(K!==void 0)if(x)if(Oe(K)){for(var te=0;te<K.length;te++)mt(K[te],s);Object.freeze&&Object.freeze(K)}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 mt(K,s)}if(oe.call(f,"key")){var W=M(s),Z=Object.keys(f).filter(function(li){return li!=="key"}),tt=Z.length>0?"{key: someKey, "+Z.join(": ..., ")+": ...}":"{key: someKey}";if(!et[W+tt]){var Kt=Z.length>0?"{"+Z.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} />`,tt,W,Kt,W),et[W+tt]=!0}}return s===r?yt(D):Bt(D),D}}function Wt(s,f,m){return vt(s,f,m,!0)}function zt(s,f,m){return vt(s,f,m,!1)}var qt=zt,u=Wt;Me.Fragment=r,Me.jsx=qt,Me.jsxs=u}()),Me}var ar;function gn(){return ar||(ar=1,process.env.NODE_ENV==="production"?rt.exports=hn():rt.exports=pn()),rt.exports}var S=gn();const mn=({step:a,form:e,formState:t,onDismiss:r,onNextStep:n,onPreviousStep:i,onUpdateResponse:o})=>{const{t:l}=St(),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:T,optOutButtonText:N}=d.transition;return S.jsx(_n,{title:h,description:p,icon:e.icon,image:g,quitText:y?T?N: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:T}=d.transition;return S.jsx(Dn,{title:h,description:p,icon:e.icon,image:g,quitText:y?v:l("Done"),onQuit:n,externalLink:k?T: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:T}=h,N=t.responses[h.id]||[],P=(k?N.length<=k||k===4:!0)&&(T?N.length>0:!0);return S.jsx(Tn,{title:p,description:g,image:y,alternatives:v,onPrevious:i,onNext:n,icon:e.icon,maxAlternatives:k,onQuit:()=>r(t),selectedAlternatives:N,onAlternativeSelect:A=>{if(k>1){const B=N,re=B.includes(A)?B.filter(J=>J!==A):k&&B.length>=k&&k!=4?B:[...B,A];o(h.id,re)}else N.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:T}=h,N=t.responses[h.id]||"",P=(k&&v?N.length<=v:!0)&&(T?N.length>0:!0);return S.jsx(Fn,{title:p,icon:e.icon,description:g,onNext:n,onPrevious:i,onQuit:()=>r(t),image:y,maxCharacters:k?v:void 0,inputText:N,setInputText:A=>{k&&v&&A.length>v||o(h.id,A)},isValid:P})}}return null},yn=({form:a,onDismiss:e,onComplete:t})=>{const n=(a.startTransition?1:0)+a.questions.length+(a.endTransition?1:0)-1,[i,o]=C.useState({responses:{},currentStep:0,startedAt:new Date}),l=C.useCallback((p,g)=>{o(y=>({...y,responses:{...y.responses,[p]:g}}))},[]),c=C.useCallback(p=>{o(g=>({...g,currentStep:p}))},[]),d=C.useCallback(()=>{if(i.currentStep<n)c(i.currentStep+1);else{const p={...i,completedAt:new Date};t(p)}},[i,n,c,t]),h=C.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(mn,{step:i.currentStep,form:a,formState:i,onDismiss:e,onNextStep:d,onPreviousStep:h,onUpdateResponse:l})})},vn=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"}))]]),bn=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"}))]]),xn=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"}))]]),wn=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"}))]]),ir=C.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),Ae=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(ir);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))});Ae.displayName="IconBase";const sr=b.forwardRef((a,e)=>b.createElement(Ae,{ref:e,...a,weights:vn}));sr.displayName="ArrowSquareOutIcon";const or=b.forwardRef((a,e)=>b.createElement(Ae,{ref:e,...a,weights:bn}));or.displayName="CaretLeftIcon";const lr=b.forwardRef((a,e)=>b.createElement(Ae,{ref:e,...a,weights:xn}));lr.displayName="CaretRightIcon";const nt=b.forwardRef((a,e)=>b.createElement(Ae,{ref:e,...a,weights:wn}));nt.displayName="XIcon";var kt={exports:{}},Ie={};/**
|
|
9
|
+
*/var De;function Gt(){if(De)return Y;De=1;var i=b,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(o,c,l){var u,d={},h=null,f=null;l!==void 0&&(h=""+l),c.key!==void 0&&(h=""+c.key),c.ref!==void 0&&(f=c.ref);for(u in c)n.call(c,u)&&!s.hasOwnProperty(u)&&(d[u]=c[u]);if(o&&o.defaultProps)for(u in c=o.defaultProps,c)d[u]===void 0&&(d[u]=c[u]);return{$$typeof:e,type:o,key:h,ref:f,props:d,_owner:r.current}}return Y.Fragment=t,Y.jsx=a,Y.jsxs=a,Y}var Ae;function Yt(){return Ae||(Ae=1,ve.exports=Gt()),ve.exports}var m=Yt();const Xt=({step:i,form:e,formState:t,onDismiss:n,onNextStep:r,onPreviousStep:s,onUpdateResponse:a})=>{const{t:o}=we(),l=(u=>{let d=0;if(e.startTransition){if(u===d)return{type:"start",transition:e.startTransition};d++}const h=u-d;return h>=0&&h<e.questions.length?{type:"question",questionIndex:h,question:e.questions[h]}:(d+=e.questions.length,e.endTransition&&u===d?{type:"end",transition:e.endTransition}:null)})(i);if((l==null?void 0:l.type)==="start"){const{title:u,description:d,image:h,includeOptOut:f,customStartButton:g,startButtonText:y,customOptOutButton:w,optOutButtonText:v}=l.transition;return m.jsx(yn,{title:u,description:d,icon:e.icon,image:h,quitText:f?w?v:o("Quit"):void 0,onQuit:f?()=>n(t):void 0,startText:g?y:o("Start"),onStart:r})}if((l==null?void 0:l.type)==="end"){const{title:u,description:d,image:h,customEndButton:f,endButtonText:g,customEndButtonLink:y,endButtonLink:w}=l.transition;return m.jsx(mn,{title:u,description:d,icon:e.icon,image:h,quitText:f?g:o("Done"),onQuit:r,externalLink:y?w:void 0})}if((l==null?void 0:l.type)==="question"){const{question:u}=l;if(u.questionType==="choice"){const{title:d,description:h,image:f,alternatives:g,maxSelections:y,required:w}=u,v=t.responses[u.id]||[],L=(y?v.length<=y||y===4:!0)&&(w?v.length>0:!0);return m.jsx(fn,{title:d,description:h,image:f,alternatives:g,onPrevious:s,onNext:r,icon:e.icon,maxAlternatives:y,onQuit:()=>n(t),selectedAlternatives:v,onAlternativeSelect:O=>{if(y>1){const j=v,z=j.includes(O)?j.filter(R=>R!==O):y&&j.length>=y&&y!=4?j:[...j,O];a(u.id,z)}else v.includes(O)?a(u.id,[]):a(u.id,[O])},isValid:L})}if(u.questionType==="text"){const{title:d,description:h,image:f,maxChars:g,limited:y,required:w}=u,v=t.responses[u.id]||"",L=(y&&g?v.length<=g:!0)&&(w?v.length>0:!0);return m.jsx(pn,{title:d,icon:e.icon,description:h,onNext:r,onPrevious:s,onQuit:()=>n(t),image:f,maxCharacters:y?g:void 0,inputText:v,setInputText:O=>{y&&g&&O.length>g||a(u.id,O)},isValid:L})}}return null},Qt=({form:i,onDismiss:e,onComplete:t})=>{const r=(i.startTransition?1:0)+i.questions.length+(i.endTransition?1:0)-1,[s,a]=b.useState({responses:{},currentStep:0,startedAt:new Date}),o=b.useCallback((d,h)=>{a(f=>({...f,responses:{...f.responses,[d]:h}}))},[]),c=b.useCallback(d=>{a(h=>({...h,currentStep:d}))},[]),l=b.useCallback(()=>{if(s.currentStep<r)c(s.currentStep+1);else{const d={...s,completedAt:new Date};t(d)}},[s,r,c,t]),u=b.useCallback(()=>{s.currentStep>0&&c(s.currentStep-1)},[s.currentStep,c]);return m.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:m.jsx(Xt,{step:s.currentStep,form:i,formState:s,onDismiss:e,onNextStep:l,onPreviousStep:u,onUpdateResponse:o})})},en=new Map([["bold",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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"}),p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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"}))]]),tn=new Map([["bold",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.createElement("path",{d:"M160,48V208L80,128Z",opacity:"0.2"}),p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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"}))]]),nn=new Map([["bold",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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"}))]]),rn=new Map([["bold",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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"}),p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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",p.createElement(p.Fragment,null,p.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"}))]]),Ve=b.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),X=p.forwardRef((i,e)=>{const{alt:t,color:n,size:r,weight:s,mirrored:a,children:o,weights:c,...l}=i,{color:u="currentColor",size:d,weight:h="regular",mirrored:f=!1,...g}=p.useContext(Ve);return p.createElement("svg",{ref:e,xmlns:"http://www.w3.org/2000/svg",width:r??d,height:r??d,fill:n??u,viewBox:"0 0 256 256",transform:a||f?"scale(-1, 1)":void 0,...g,...l},!!t&&p.createElement("title",null,t),o,c.get(s??h))});X.displayName="IconBase";const Ie=p.forwardRef((i,e)=>p.createElement(X,{ref:e,...i,weights:en}));Ie.displayName="ArrowSquareOutIcon";const He=p.forwardRef((i,e)=>p.createElement(X,{ref:e,...i,weights:tn}));He.displayName="CaretLeftIcon";const Be=p.forwardRef((i,e)=>p.createElement(X,{ref:e,...i,weights:nn}));Be.displayName="CaretRightIcon";const ce=p.forwardRef((i,e)=>p.createElement(X,{ref:e,...i,weights:rn}));ce.displayName="XIcon";var qe={exports:{}},Q={};/**
|
|
31
10
|
* @license React
|
|
32
11
|
* react-jsx-runtime.production.min.js
|
|
33
12
|
*
|
|
@@ -35,34 +14,13 @@ React keys must be passed directly to JSX without using spread:
|
|
|
35
14
|
*
|
|
36
15
|
* This source code is licensed under the MIT license found in the
|
|
37
16
|
* LICENSE file in the root directory of this source tree.
|
|
38
|
-
*/var
|
|
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 cr;function kn(){return cr||(cr=1,process.env.NODE_ENV!=="production"&&function(){var a=C,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 T(u){if(u===null||typeof u!="object")return null;var s=v&&u[v]||u[k];return typeof s=="function"?s:null}var N=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=N.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,re=!1,J=!1,H=!1,_;_=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||J||u===y||U||B||re||typeof u=="object"&&u!==null&&(u.$$typeof===g||u.$$typeof===p||u.$$typeof===o||u.$$typeof===l||u.$$typeof===c||u.$$typeof===_||u.getModuleId!==void 0))}function G(u,s,f){var m=u.displayName;if(m)return m;var x=s.displayName||s.name||"";return x!==""?f+"("+x+")":f}function we(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 we(s)+".Consumer";case o:var f=u;return we(f._context)+".Provider";case c:return G(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,ee=0,X,Q,ie,ue,be,q,ne;function se(){}se.__reactDisabledLog=!0;function Ne(){{if(ee===0){X=console.log,Q=console.info,ie=console.warn,ue=console.error,be=console.group,q=console.groupCollapsed,ne=console.groupEnd;var u={configurable:!0,enumerable:!0,value:se,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}ee++}}function Fe(){{if(ee--,ee===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},u,{value:X}),info:I({},u,{value:Q}),warn:I({},u,{value:ie}),error:I({},u,{value:ue}),group:I({},u,{value:be}),groupCollapsed:I({},u,{value:q}),groupEnd:I({},u,{value:ne})})}ee<0&&P("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Se=N.ReactCurrentDispatcher,ke;function pe(u,s,f){{if(ke===void 0)try{throw Error()}catch(x){var m=x.stack.trim().match(/\n( *(at )?)/);ke=m&&m[1]||""}return`
|
|
47
|
-
`+ke+u}}var Ee=!1,ge;{var Ct=typeof WeakMap=="function"?WeakMap:Map;ge=new Ct}function qe(u,s){if(!u||Ee)return"";{var f=ge.get(u);if(f!==void 0)return f}var m;Ee=!0;var x=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var O;O=Se.current,Se.current=null,Ne();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
|
-
`),F=w.length-1,j=R.length-1;F>=1&&j>=0&&w[F]!==R[j];)j--;for(;F>=1&&j>=0;F--,j--)if(w[F]!==R[j]){if(F!==1||j!==1)do if(F--,j--,j<0||w[F]!==R[j]){var D=`
|
|
50
|
-
`+w[F].replace(" at new "," at ");return u.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",u.displayName)),typeof u=="function"&&ge.set(u,D),D}while(F>=1&&j>=0);break}}}finally{Ee=!1,Se.current=O,Fe(),Error.prepareStackTrace=x}var K=u?u.displayName||u.name:"",te=K?pe(K):"";return typeof u=="function"&&ge.set(u,te),te}function jt(u,s,f){return qe(u,!1)}function Tt(u){var s=u.prototype;return!!(s&&s.isReactComponent)}function me(u,s,f){if(u==null)return"";if(typeof u=="function")return qe(u,Tt(u));if(typeof u=="string")return pe(u);switch(u){case d:return pe("Suspense");case h:return pe("SuspenseList")}if(typeof u=="object")switch(u.$$typeof){case c:return jt(u.render);case p:return me(u.type);case g:{var m=u,x=m._payload,O=m._init;try{return me(O(x))}catch{}}}return""}var oe=Object.prototype.hasOwnProperty,Ke={},Je=N.ReactDebugCurrentFrame;function ye(u){if(u){var s=me(u.type);Je.setExtraStackFrame(s)}else Je.setExtraStackFrame(null)}function Nt(u,s,f,m,x){{var O=Function.call.bind(oe);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(F){w=F}w&&!(w instanceof Error)&&(ye(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),ye(null)),w instanceof Error&&!(w.message in Ke)&&(Ke[w.message]=!0,ye(x),P("Failed %s type: %s",f,w.message),ye(null))}}}var Ft=Array.isArray;function Oe(u){return Ft(u)}function Dt(u){{var s=typeof Symbol=="function"&&Symbol.toStringTag,f=s&&u[Symbol.toStringTag]||u.constructor.name||"Object";return f}}function _t(u){try{return!1}catch{return!0}}function ct(u){return""+u}function Ze(u){if(_t())return P("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Dt(u)),ct(u)}var dt=N.ReactCurrentOwner,$t={key:!0,ref:!0,__self:!0,__source:!0},Ye,Xe;function Mt(u){if(oe.call(u,"ref")){var s=Object.getOwnPropertyDescriptor(u,"ref").get;if(s&&s.isReactWarning)return!1}return u.ref!==void 0}function At(u){if(oe.call(u,"key")){var s=Object.getOwnPropertyDescriptor(u,"key").get;if(s&&s.isReactWarning)return!1}return u.key!==void 0}function It(u,s){{var f=function(){Ye||(Ye=!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 Vt(u,s){{var f=function(){Xe||(Xe=!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 Ht=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 Ut(u,s,f,m,x){{var O,E={},w=null,R=null;f!==void 0&&(Ze(f),w=""+f),At(s)&&(Ze(s.key),w=""+s.key),Mt(s)&&(R=s.ref);for(O in s)oe.call(s,O)&&!$t.hasOwnProperty(O)&&(E[O]=s[O]);if(u&&u.defaultProps){var F=u.defaultProps;for(O in F)E[O]===void 0&&(E[O]=F[O])}if(w||R){var j=typeof u=="function"?u.displayName||u.name||"Unknown":u;w&&It(E,j),R&&Vt(E,j)}return Ht(u,w,R,x,m,dt.current,E)}}var Ge=N.ReactCurrentOwner,De=N.ReactDebugCurrentFrame;function ve(u){if(u){var s=me(u.type);De.setExtraStackFrame(s)}else De.setExtraStackFrame(null)}var ce;ce=!1;function Pe(u){return typeof u=="object"&&u!==null&&u.$$typeof===e}function _e(){{if(Ge.current){var u=M(Ge.current.type);if(u)return`
|
|
51
|
-
|
|
52
|
-
Check the render method of \``+u+"`."}return""}}function ft(u){return""}var ht={};function pt(u){{var s=_e();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 gt(u,s){{if(!u._store||u._store.validated||u.key!=null)return;u._store.validated=!0;var f=pt(s);if(ht[f])return;ht[f]=!0;var m="";u&&u._owner&&u._owner!==Ge.current&&(m=" It was passed a child from "+M(u._owner.type)+"."),ve(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),ve(null)}}function Qe(u,s){{if(typeof u!="object")return;if(Oe(u))for(var f=0;f<u.length;f++){var m=u[f];Pe(m)&>(m,s)}else if(Pe(u))u._store&&(u._store.validated=!0);else if(u){var x=T(u);if(typeof x=="function"&&x!==u.entries)for(var O=x.call(u),E;!(E=O.next()).done;)Pe(E.value)&>(E.value,s)}}}function mt(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);Nt(f,u.props,"prop",m,u)}else if(s.PropTypes!==void 0&&!ce){ce=!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 Bt(u){{for(var s=Object.keys(u.props),f=0;f<s.length;f++){var m=s[f];if(m!=="children"&&m!=="key"){ve(u),P("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",m),ve(null);break}}u.ref!==null&&(ve(u),P("Invalid attribute `ref` supplied to `React.Fragment`."),ve(null))}}var yt={};function et(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=ft();R?w+=R:w+=_e();var F;u===null?F="null":Oe(u)?F="array":u!==void 0&&u.$$typeof===e?(F="<"+(M(u.type)||"Unknown")+" />",w=" Did you accidentally export a JSX literal instead of a component?"):F=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",F,w)}var j=Ut(u,s,f,x,O);if(j==null)return j;if(E){var D=s.children;if(D!==void 0)if(m)if(Oe(D)){for(var K=0;K<D.length;K++)Qe(D[K],u);Object.freeze&&Object.freeze(D)}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 Qe(D,u)}if(oe.call(s,"key")){var te=M(u),W=Object.keys(s).filter(function(Kt){return Kt!=="key"}),Z=W.length>0?"{key: someKey, "+W.join(": ..., ")+": ...}":"{key: someKey}";if(!yt[te+Z]){var tt=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} />`,Z,te,tt,te),yt[te+Z]=!0}}return u===r?Bt(j):mt(j),j}}function vt(u,s,f){return et(u,s,f,!0)}function Wt(u,s,f){return et(u,s,f,!1)}var zt=Wt,qt=vt;at.Fragment=r,at.jsx=zt,at.jsxs=qt}()),at}var dr;function En(){return dr||(dr=1,process.env.NODE_ENV==="production"?kt.exports=Sn():kt.exports=kn()),kt.exports}var it=En();const de=({variant:a="primary",size:e="medium",text:t,iconBefore:r,iconAfter:n,className:i,disabled:o=!1,...l})=>it.jsx("button",{className:ae("flex gap-2 justify-center items-center rounded-lg disabled:pointer-events-none",On(a),Pn(e),i),disabled:o,...l,children:it.jsxs(ir.Provider,{value:{size:e==="xsmall"?8:16,weight:"regular",className:ae(fr(a,o))},children:[r&&r,t&&it.jsx("span",{className:ae(fr(a,o),Rn(e)),children:t}),n&&n]})}),On=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"}},fr=(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"}},Pn=a=>{switch(a){case"xsmall":return"p-1";case"small":return"p-2";case"medium":return"p-3"}},Rn=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 hr(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=hr(a[e]))&&(r&&(r+=" "),r+=t)}else for(t in a)a[t]&&(r&&(r+=" "),r+=t);return r}function Ln(){for(var a,e,t=0,r="",n=arguments.length;t<n;t++)(a=arguments[t])&&(e=hr(a))&&(r&&(r+=" "),r+=e);return r}const ae=Ln,fe=({children:a,className:e,variant:t="B1",significance:r="primary",as:n})=>{const i=n??Cn[t],o=pr[t];return it.jsx(i,{className:ae("font-sans",jn[r],e,o),children:a})},pr={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]"},Cn={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"},jn={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"},gr=({title:a,icon:e,description:t,image:r,children:n,onPrevious:i,onNext:o,onQuit:l,isValid:c})=>{const{t:d}=St();return S.jsxs("div",{className:ae("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:ae("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(fe,{variant:"H2",children:a}),t&&t.trim().replace(/\n{3,}/g,`
|
|
17
|
+
*/var ze;function sn(){if(ze)return Q;ze=1;var i=b,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(o,c,l){var u,d={},h=null,f=null;l!==void 0&&(h=""+l),c.key!==void 0&&(h=""+c.key),c.ref!==void 0&&(f=c.ref);for(u in c)n.call(c,u)&&!s.hasOwnProperty(u)&&(d[u]=c[u]);if(o&&o.defaultProps)for(u in c=o.defaultProps,c)d[u]===void 0&&(d[u]=c[u]);return{$$typeof:e,type:o,key:h,ref:f,props:d,_owner:r.current}}return Q.Fragment=t,Q.jsx=a,Q.jsxs=a,Q}var Ue;function an(){return Ue||(Ue=1,qe.exports=sn()),qe.exports}var ue=an();const H=({variant:i="primary",size:e="medium",text:t,iconBefore:n,iconAfter:r,className:s,disabled:a=!1,...o})=>ue.jsx("button",{className:M("flex gap-2 justify-center items-center rounded-lg disabled:pointer-events-none",on(i),ln(e),s),disabled:a,...o,children:ue.jsxs(Ve.Provider,{value:{size:e==="xsmall"?8:16,weight:"regular",className:M(_e(i,a))},children:[n&&n,t&&ue.jsx("span",{className:M(_e(i,a),cn(e)),children:t}),r&&r]})}),on=i=>{switch(i){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"}},_e=(i,e)=>{if(e)return"text-label-tertiary-light dark:text-label-tertiary-dark";switch(i){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"}},ln=i=>{switch(i){case"xsmall":return"p-1";case"small":return"p-2";case"medium":return"p-3"}},cn=i=>{switch(i){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 Ke(i){var e,t,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(e=0;e<r;e++)i[e]&&(t=Ke(i[e]))&&(n&&(n+=" "),n+=t)}else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function un(){for(var i,e,t=0,n="",r=arguments.length;t<r;t++)(i=arguments[t])&&(e=Ke(i))&&(n&&(n+=" "),n+=e);return n}const M=un,B=({children:i,className:e,variant:t="B1",significance:n="primary",as:r})=>{const s=r??dn[t],a=We[t];return ue.jsx(s,{className:M("font-sans",hn[n],e,a),children:i})},We={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]"},dn={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"},hn={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"},Ze=({title:i,icon:e,description:t,image:n,children:r,onPrevious:s,onNext:a,onQuit:o,isValid:c})=>{const{t:l}=we();return m.jsxs("div",{className:M("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]",n?"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:[m.jsxs("div",{className:"flex flex-col justify-between order-2 md:order-1",children:[m.jsxs("div",{className:"flex flex-col",children:[m.jsxs("div",{className:"flex flex-col gap-1 md:gap-2 pb-3",children:[e&&m.jsx("div",{className:M("h-8 w-8 rounded-lg overflow-hidden mb-1 md:mb-2",n?"hidden md:block":"block"),children:m.jsx("img",{className:"w-full h-full object-cover",src:e,alt:"icon"})}),m.jsx(B,{variant:"H2",children:i}),t&&t.trim().replace(/\n{3,}/g,`
|
|
60
18
|
|
|
61
19
|
`).split(`
|
|
62
20
|
|
|
63
|
-
`).map((
|
|
21
|
+
`).map((u,d)=>m.jsx(B,{significance:"secondary",children:u.trim()},d))]}),r]}),m.jsxs("div",{className:"flex justify-end pt-4 gap-2",children:[m.jsx(H,{variant:"subtle",onClick:s,iconBefore:m.jsx(He,{}),disabled:!s,text:l("Previous")}),m.jsx(H,{variant:"subtle",onClick:a,iconAfter:m.jsx(Be,{}),disabled:!a||!c,text:l("Next")})]}),o&&m.jsx(H,{className:"absolute top-0 right-1 md:top-1",variant:"subtle",size:"small",onClick:o,iconAfter:m.jsx(ce,{}),"aria-label":"quit"})]}),n&&m.jsx("div",{className:"flex flex-col justify-center order-1 md:order-2",children:m.jsx("div",{className:"rounded-lg overflow-hidden mb-6 md:mb-0",children:m.jsx("img",{className:"w-full h-full object-cover aspect-video md:aspect-square",src:n,alt:"image"})})})]})},fn=({title:i,icon:e,description:t,image:n,onPrevious:r,onNext:s,onQuit:a,alternatives:o=[],onAlternativeSelect:c,selectedAlternatives:l,maxAlternatives:u,isValid:d})=>m.jsx(Ze,{title:i,icon:e,description:t,image:n,onPrevious:r,onNext:s,onQuit:a,isValid:d,children:m.jsx("div",{className:"flex flex-col max-h-[272px] md:max-h-full overflow-y-auto",children:u===1?m.jsx("div",{className:"flex flex-col py-3 md:py-4 gap-2 items-end md:items-start",children:o.map(h=>m.jsxs("button",{onClick:()=>c(h.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:[m.jsx(B,{variant:"B1Button",children:h.text}),m.jsx(gn,{size:20,selected:l.includes(h.id)})]},h.id))}):m.jsx("div",{className:"flex py-3 md:py-4 gap-2 justify-end md:justify-start flex-wrap",children:o.map(h=>m.jsx("button",{onClick:()=>c(h.id),className:M("flex items-center gap-2 p-3 justify-end rounded-lg border",l.includes(h.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:m.jsx(B,{variant:"B1Button",significance:l.includes(h.id)?"quaternary":"primary",children:h.text})},h.id))})})}),gn=({size:i=16,strokeColor:e="currentColor",fillColor:t="none",selected:n=!1})=>{const r=i+1,s=r/2,a=(i-2)/2;return m.jsxs("svg",{width:i,height:i,viewBox:`0 0 ${r} ${r}`,fill:n?t:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("circle",{cx:s,cy:s,r:a,stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n&&m.jsx("circle",{cx:s,cy:s,r:a-3,fill:e})]})},pn=({title:i,icon:e,description:t,image:n,onPrevious:r,onNext:s,onQuit:a,inputText:o,setInputText:c,maxCharacters:l,isValid:u})=>{const{t:d}=we();return m.jsx(Ze,{title:i,icon:e,description:t,image:n,onPrevious:r,onNext:s,onQuit:a,isValid:u,children:m.jsxs("div",{className:"flex flex-col py-3 gap-2",children:[l&&m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx(B,{significance:"secondary",children:d("Max {{maxCharacters}} characters",{maxCharacters:l})}),m.jsx(B,{significance:"secondary",children:`${o.length}/${l}`})]}),m.jsxs("div",{className:"flex flex-col relative",children:[m.jsx(B,{as:"div",className:M("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:o}),m.jsx("textarea",{id:"primary",placeholder:d("Type your answer here"),className:M("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",We.B1),value:o,onChange:h=>c(h.target.value)})]})]})})},Je=({title:i,icon:e,description:t,image:n,children:r,wrapperClassName:s})=>m.jsxs("div",{className:M("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]",n?"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",s),children:[m.jsxs("div",{className:"flex flex-col justify-between gap-6 md:gap-8 order-2 md:order-1",children:[m.jsxs("div",{className:"flex flex-col gap-6 md:gap-8",children:[m.jsxs("div",{className:"flex flex-col gap-2 md:gap-4",children:[e&&m.jsx("div",{className:M("h-8 w-8 rounded-lg overflow-hidden",n?"hidden md:block":"block"),children:m.jsx("img",{className:"w-full h-full object-cover",src:e,alt:"icon"})}),m.jsx(B,{variant:"H2",children:i})]}),t&&t.trim().replace(/\n{3,}/g,`
|
|
64
22
|
|
|
65
23
|
`).split(`
|
|
66
24
|
|
|
67
|
-
`).map((o,l)=>S.jsx(fe,{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"})})})]}),Dn=({title:a,icon:e,description:t,image:r,quitText:n,onQuit:i,externalLink:o})=>S.jsxs(mr,{title:a,icon:e,description:t,image:r,children:[S.jsx("div",{className:"flex justify-end gap-2",children:o?S.jsx(de,{variant:"secondary",text:n,iconAfter:S.jsx(sr,{}),onClick:()=>{window.open(o,"_blank"),i==null||i()}}):S.jsx(de,{variant:"secondary",onClick:i,text:n})}),i&&S.jsx(de,{className:"absolute -top-2 -right-2 md:-top-4 md:-right-4",variant:"secondary",size:"small",onClick:i,iconAfter:S.jsx(nt,{}),"aria-label":"quit"})]}),_n=({title:a,icon:e,description:t,image:r,quitText:n,onQuit:i,startText:o,onStart:l})=>S.jsxs(mr,{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(de,{variant:"subtle",text:n,onClick:i}),S.jsx(de,{variant:"secondary",text:o,onClick:l})]}),i&&S.jsx(de,{className:"absolute top-0 right-1 md:top-1",variant:"subtle",size:"small",onClick:i,iconAfter:S.jsx(nt,{}),"aria-label":"quit"})]});let yr={};function $n(){return yr}function Mn(a){yr=a}const An={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"}},In=(a,e,t)=>{let r;const n=An[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 Et(a){return(e={})=>{const t=e.width?String(e.width):a.defaultWidth;return a.formats[t]||a.formats[a.defaultWidth]}}const Vn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Hn=(a,e,t,r)=>Vn[a];function Ve(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 Un={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Bn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Wn={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"]},zn={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"]},qn={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"}},Kn={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"}},Jn={ordinalNumber:(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"},era:Ve({values:Un,defaultWidth:"wide"}),quarter:Ve({values:Bn,defaultWidth:"wide",argumentCallback:a=>a-1}),month:Ve({values:Wn,defaultWidth:"wide"}),day:Ve({values:zn,defaultWidth:"wide"}),dayPeriod:Ve({values:qn,defaultWidth:"wide",formattingValues:Kn,defaultFormattingWidth:"wide"})};function He(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)?Yn(l,p=>p.test(o)):Zn(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 Zn(a,e){for(const t in a)if(Object.prototype.hasOwnProperty.call(a,t)&&e(a[t]))return t}function Yn(a,e){for(let t=0;t<a.length;t++)if(e(a[t]))return t}function Xn(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 Gn=/^(\d+)(th|st|nd|rd)?/i,Qn=/\d+/i,ea={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},ta={any:[/^b/i,/^(a|c)/i]},ra={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},na={any:[/1/i,/2/i,/3/i,/4/i]},aa={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},ia={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]},sa={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},oa={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]},la={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},ua={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}},ca={ordinalNumber:Xn({matchPattern:Gn,parsePattern:Qn,valueCallback:a=>parseInt(a,10)}),era:He({matchPatterns:ea,defaultMatchWidth:"wide",parsePatterns:ta,defaultParseWidth:"any"}),quarter:He({matchPatterns:ra,defaultMatchWidth:"wide",parsePatterns:na,defaultParseWidth:"any",valueCallback:a=>a+1}),month:He({matchPatterns:aa,defaultMatchWidth:"wide",parsePatterns:ia,defaultParseWidth:"any"}),day:He({matchPatterns:sa,defaultMatchWidth:"wide",parsePatterns:oa,defaultParseWidth:"any"}),dayPeriod:He({matchPatterns:la,defaultMatchWidth:"any",parsePatterns:ua,defaultParseWidth:"any"})};function da(a){const e={},t=$n();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]);Mn(e)}const fa={full:"EEEE, d MMMM yyyy",long:"d MMMM yyyy",medium:"d MMM yyyy",short:"dd/MM/yyyy"},ha={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},pa={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ga={date:Et({formats:fa,defaultWidth:"full"}),time:Et({formats:ha,defaultWidth:"full"}),dateTime:Et({formats:pa,defaultWidth:"full"})},ma={code:"en-GB",formatDistance:In,formatLong:ga,formatRelative:Hn,localize:Jn,match:ca,options:{weekStartsOn:1,firstWeekContainsDate:4}},L=a=>typeof a=="string",Ue=()=>{let a,e;const t=new Promise((r,n)=>{a=r,e=n});return t.resolve=a,t.reject=e,t},vr=a=>a==null?"":""+a,ya=(a,e,t)=>{a.forEach(r=>{e[r]&&(t[r]=e[r])})},va=/###/g,br=a=>a&&a.indexOf("###")>-1?a.replace(va,"."):a,xr=a=>!a||L(a),Be=(a,e,t)=>{const r=L(e)?e.split("."):e;let n=0;for(;n<r.length-1;){if(xr(a))return{};const i=br(r[n]);!a[i]&&t&&(a[i]=new t),Object.prototype.hasOwnProperty.call(a,i)?a=a[i]:a={},++n}return xr(a)?{}:{obj:a,k:br(r[n])}},wr=(a,e,t)=>{const{obj:r,k:n}=Be(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=Be(a,o,Object);for(;l.obj===void 0&&o.length;)i=`${o[o.length-1]}.${i}`,o=o.slice(0,o.length-1),l=Be(a,o,Object),l!=null&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=t},ba=(a,e,t,r)=>{const{obj:n,k:i}=Be(a,e,Object);n[i]=n[i]||[],n[i].push(t)},st=(a,e)=>{const{obj:t,k:r}=Be(a,e);if(t&&Object.prototype.hasOwnProperty.call(t,r))return t[r]},xa=(a,e,t)=>{const r=st(a,t);return r!==void 0?r:st(e,t)},Sr=(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]):Sr(a[r],e[r],t):a[r]=e[r]);return a},Ce=a=>a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var wa={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Sa=a=>L(a)?a.replace(/[&<>"'\/]/g,e=>wa[e]):a;class ka{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 Ea=[" ",",","?","!",";"],Oa=new ka(20),Pa=(a,e,t)=>{e=e||"",t=t||"";const r=Ea.filter(o=>e.indexOf(o)<0&&t.indexOf(o)<0);if(r.length===0)return!0;const n=Oa.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},Ot=(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},We=a=>a==null?void 0:a.replace("_","-"),Ra={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 La=class Jt{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Ra,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 Jt(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Jt(this.logger,e)}};var le=new La;class ot{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 kr extends ot{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=st(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:Ot((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),wr(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=st(this.data,l)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),n?Sr(c,r,i):c={...c,...r},wr(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 Er={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 Or={},Pr=a=>!L(a)&&typeof a!="boolean"&&typeof a!="number";class lt extends ot{constructor(e,t={}){super(),ya(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=le.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&&!Pa(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,T=(y==null?void 0:y.exactUsedKey)||l,N=["[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=lt.hasDefaultValue(n),re=U?this.pluralResolver.getSuffix(p,n.count,n):"",J=n.ordinal&&U?this.pluralResolver.getSuffix(p,n.count,{ordinal:!1}):"",H=U&&!n.ordinal&&n.count===0,_=H&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${re}`]||n[`defaultValue${J}`]||n.defaultValue;let $=v;A&&!v&&B&&($=_);const G=Pr($),we=Object.prototype.toString.apply($);if(A&&$&&G&&N.indexOf(we)<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?[]:{},ee=M?T:k;for(const X in $)if(Object.prototype.hasOwnProperty.call($,X)){const Q=`${ee}${o}${X}`;B&&!v?I[X]=this.translate(Q,{...n,defaultValue:Pr(_)?_[X]:void 0,joinArrays:!1,ns:c}):I[X]=this.translate(Q,{...n,joinArrays:!1,ns:c}),I[X]===Q&&(I[X]=$[X])}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=_),this.isValidLookup(v)||(I=!0,v=l);const X=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&I?void 0:v,Q=B&&_!==v&&this.options.updateMissing;if(I||M||Q){if(this.logger.log(Q?"updateKey":"missingKey",p,d,l,Q?_:v),o){const q=this.resolve(l,{...n,keySeparator:!1});q&&q.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 ie=[];const ue=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ue&&ue[0])for(let q=0;q<ue.length;q++)ie.push(ue[q]);else this.options.saveMissingTo==="all"?ie=this.languageUtils.toResolveHierarchy(n.lng||this.language):ie.push(n.lng||this.language);const be=(q,ne,se)=>{var Fe;const Ne=B&&se!==v?se:X;this.options.missingKeyHandler?this.options.missingKeyHandler(q,d,ne,Ne,Q,n):(Fe=this.backendConnector)!=null&&Fe.saveMissing&&this.backendConnector.saveMissing(q,d,ne,Ne,Q,n),this.emit("missingKey",q,d,ne,v)};this.options.saveMissing&&(this.options.saveMissingPlurals&&U?ie.forEach(q=>{const ne=this.pluralResolver.getSuffixes(q,n);H&&n[`defaultValue${this.options.pluralSeparator}zero`]&&ne.indexOf(`${this.options.pluralSeparator}zero`)<0&&ne.push(`${this.options.pluralSeparator}zero`),ne.forEach(se=>{be([q],l+se,n[`defaultValue${se}`]||_)})}):be(ie,l,_))}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=Er.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(T=>{var N,P;this.isValidLookup(r)||(l=T,!Or[`${k[0]}-${T}`]&&((N=this.utils)!=null&&N.hasLoadedNamespace)&&!((P=this.utils)!=null&&P.hasLoadedNamespace(l))&&(Or[`${k[0]}-${T}`]=!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 re;if(this.isValidLookup(r))return;o=A;const U=[h];if((re=this.i18nFormat)!=null&&re.addLookupKeys)this.i18nFormat.addLookupKeys(U,h,A,T,t);else{let J;g&&(J=this.pluralResolver.getSuffix(A,t.count,t));const H=`${this.options.pluralSeparator}zero`,_=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(U.push(h+J),t.ordinal&&J.indexOf(_)===0&&U.push(h+J.replace(_,this.options.pluralSeparator)),y&&U.push(h+H)),v){const $=`${h}${this.options.contextSeparator}${t.context}`;U.push($),g&&(U.push($+J),t.ordinal&&J.indexOf(_)===0&&U.push($+J.replace(_,this.options.pluralSeparator)),y&&U.push($+H))}}let B;for(;B=U.pop();)this.isValidLookup(r)||(i=B,r=this.getResource(A,T,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 Rr{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=le.create("languageUtils")}getScriptPartFromCode(e){if(e=We(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=We(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 Lr={zero:0,one:1,two:2,few:3,many:4,other:5},Cr={select:a=>a===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Ca{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=le.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const r=We(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!"),Cr;if(!e.match(/-|_/))return Cr;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)=>Lr[n]-Lr[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 jr=(a,e,t,r=".",n=!0)=>{let i=xa(a,e,t);return!i&&n&&L(t)&&(i=Ot(a,t,r),i===void 0&&(i=Ot(e,t,r))),i},Pt=a=>a.replace(/\$/g,"$$$$");class ja{constructor(e={}){var t;this.logger=le.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:T,maxReplaces:N,alwaysFormat:P}=e.interpolation;this.escape=t!==void 0?t:Sa,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=n!==void 0?n:!1,this.prefix=i?Ce(i):o||"{{",this.suffix=l?Ce(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=h?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=g?Ce(g):y||Ce("$t("),this.nestingSuffix=v?Ce(v):k||Ce(")"),this.nestingOptionsSeparator=T||",",this.maxReplaces=N||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=jr(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),T=k.shift().trim(),N=k.join(this.formatSeparator).trim();return this.format(jr(t,c,T,this.options.keySeparator,this.options.ignoreJSONStructure),N,r,{...n,...t,interpolationkey:T})};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=>Pt(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?Pt(this.escape(v)):Pt(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 N=h(e,i,n);o=L(N)?N:""}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=vr(o));const T=v.safeValue(o);if(e=e.replace(i[0],T),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=vr(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 Ta=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}},Tr=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(We(r),n),e[o]=l),l(t)}},Na=a=>(e,t,r)=>a(We(t),r)(e);class Fa{constructor(e={}){this.logger=le.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const r=t.cacheInBuiltFormats?Tr:Na;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()]=Tr(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}=Ta(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 Da=(a,e)=>{a.pending[e]!==void 0&&(delete a.pending[e],a.pendingCount--)};class _a extends ot{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=le.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=>{ba(c.loaded,[i],o),Da(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(T=>l(null,T)).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 Nr=()=>({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}),Fr=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},ut=()=>{},$a=a=>{Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(t=>{typeof a[t]=="function"&&(a[t]=a[t].bind(a))})};class ze extends ot{constructor(e={},t){if(super(),this.options=Fr(e),this.services={},this.logger=le,this.modules={external:[]},$a(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=Nr();this.options={...r,...this.options,...Fr(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?le.init(n(this.modules.logger),this.options):le.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:d=Fa;const h=new Rr(this.options);this.store=new kr(this.options.resources,this.options);const p=this.services;p.logger=le,p.resourceStore=this.store,p.languageUtils=h,p.pluralResolver=new Ca(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 ja(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new _a(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 lt(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=ut),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=Ue(),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=ut){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=Ue();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=ut),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"&&Er.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=Ue();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=Ue();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=Ue();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 Rr(Nr());return t.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new ze(e,t)}cloneInstance(e={},t=ut){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const n={...this.options,...e,isClone:!0},i=new ze(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 kr(l,n),i.services.resourceStore=i.store}return i.translator=new lt(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 Y=ze.createInstance();Y.createInstance=ze.createInstance,Y.createInstance,Y.dir,Y.init,Y.loadResources,Y.reloadResources,Y.use,Y.changeLanguage,Y.getFixedT,Y.t,Y.exists,Y.setDefaultNamespace,Y.hasLoadedNamespace,Y.loadNamespaces,Y.loadLanguages;const{slice:Ma,forEach:Aa}=[];function Ia(a){return Aa.call(Ma.call(arguments,1),e=>{if(e)for(const t in e)a[t]===void 0&&(a[t]=e[t])}),a}function Va(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 Dr=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Ha=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(!Dr.test(r.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${r.domain}`}if(r.path){if(!Dr.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},_r={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=Ha(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 Ua={name:"cookie",lookup(a){let{lookupCookie:e}=a;if(e&&typeof document<"u")return _r.read(e)||void 0},cacheUserLanguage(a,e){let{lookupCookie:t,cookieMinutes:r,cookieDomain:n,cookieOptions:i}=e;t&&typeof document<"u"&&_r.create(t,a,r,n,i)}},Ba={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}},Wa={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 je=null;const $r=()=>{if(je!==null)return je;try{if(je=typeof window<"u"&&window.localStorage!==null,!je)return!1;const a="i18next.translate.boo";window.localStorage.setItem(a,"foo"),window.localStorage.removeItem(a)}catch{je=!1}return je};var za={name:"localStorage",lookup(a){let{lookupLocalStorage:e}=a;if(e&&$r())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(a,e){let{lookupLocalStorage:t}=e;t&&$r()&&window.localStorage.setItem(t,a)}};let Te=null;const Mr=()=>{if(Te!==null)return Te;try{if(Te=typeof window<"u"&&window.sessionStorage!==null,!Te)return!1;const a="i18next.translate.boo";window.sessionStorage.setItem(a,"foo"),window.sessionStorage.removeItem(a)}catch{Te=!1}return Te};var qa={name:"sessionStorage",lookup(a){let{lookupSessionStorage:e}=a;if(e&&Mr())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(a,e){let{lookupSessionStorage:t}=e;t&&Mr()&&window.sessionStorage.setItem(t,a)}},Ka={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}},Ja={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}},Za={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}},Ya={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 Xa=()=>({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=Ia(t,this.options||{},Xa()),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(Ua),this.addDetector(Ba),this.addDetector(za),this.addDetector(qa),this.addDetector(Ka),this.addDetector(Ja),this.addDetector(Za),this.addDetector(Ya),this.addDetector(Wa)}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&&!Va(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},Ga={Previous:"Previous",Next:"Next","Type your answer here":"Type your answer here","Max {{maxCharacters}} characters":"Max {{maxCharacters}} characters"},Qa={};da({locale:ma}),Y.use(Vr).use(ln).init({debug:Hr.debug,fallbackLng:"en",interpolation:{escapeValue:!1},resources:{en:{translation:Ga},nb:{tranlation:Qa}}});const Ur={debug:0,info:1,warn:2,error:3};class Rt{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&&Ur[e]>=Ur[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 Rt({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 Br=new Rt,Wr=Br.child("network"),ei=3e4,ti=(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()},he={async request(a,e={}){const{method:t="GET",headers:r={},body:n,params:i,timeout:o=ei}=e,l=ti(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 T=await g.text();try{y=JSON.parse(T)}catch{y=T}}const k={data:y,status:g.status,statusText:g.statusText,headers:g.headers,ok:g.ok};if(g.ok)k.ok=!0;else{const T=`Request failed with status ${g.status}: ${g.statusText}`;Wr.error(T,{url:l,method:t,status:g.status,data:k.data}),k.ok=!1,k.error={message:T,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},Wr.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 ri{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 he.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=Yr.createRoot(n),o=C.createElement(fn,{i18n:Y},C.createElement(yn,{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 he.post(`/external/forms/${e.slug}`,t,{headers:this.headers});this.logger.info("Form response posted",r.data)}}class ni{constructor(e,t){V(this,"logger");V(this,"headers");V(this,"formManager");V(this,"deliveries",[]);this.logger=e,this.headers=t,this.formManager=new ri(e,t)}async loadDeliveries(){try{this.logger.debug("Loading deliveries");const e=await he.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 he.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 he.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 he.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 ai{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 he.post("/external/trackings/track",t,{headers:this.headers})}else await he.post("/external/trackings/batch",e,{headers:this.headers})}}class Lt{constructor(e){V(this,"clientKey");V(this,"userIdentifier");V(this,"initialized",!1);V(this,"clientLogger",Br.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 he.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 ni(this.clientLogger,this.headers),n=new ai({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 ii=a=>new Lt(a),zr=C.createContext(void 0),si=({clientKey:a,config:e,children:t})=>{const[r,n]=C.useState(null),[i,o]=C.useState(!1),[l,c]=C.useState(null);C.useEffect(()=>{let h=null,p=!1;const g=async()=>{try{const y=new Lt(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(zr.Provider,{value:d,children:t})},qr=()=>{const a=C.useContext(zr);if(a===void 0)throw new Error("useNemmeContext must be used within a NemmeProvider");return a},oi=()=>{const{client:a,isInitialized:e,error:t}=qr(),r=C.useCallback(async i=>{if(!a||!e){console.warn("Nemme client not initialized");return}return a.track(i)},[a,e]),n=C.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}},Kr=a=>ii(a);z.NemmeClient=Lt,z.NemmeProvider=si,z.NemmeSDK=Kr,z.default=Kr,z.useNemme=oi,z.useNemmeContext=qr,Object.defineProperties(z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
25
|
+
`).map((a,o)=>m.jsx(B,{children:a.trim()},o))]}),r]}),n&&m.jsx("div",{className:"flex flex-col justify-center order-1 md:order-2",children:m.jsx("div",{className:"rounded-lg overflow-hidden mb-6 md:mb-0",children:m.jsx("img",{className:"w-full h-full object-cover aspect-video md:aspect-square",src:n,alt:"image"})})})]}),mn=({title:i,icon:e,description:t,image:n,quitText:r,onQuit:s,externalLink:a})=>m.jsxs(Je,{title:i,icon:e,description:t,image:n,children:[m.jsx("div",{className:"flex justify-end gap-2",children:a?m.jsx(H,{variant:"secondary",text:r,iconAfter:m.jsx(Ie,{}),onClick:()=>{window.open(a,"_blank"),s==null||s()}}):m.jsx(H,{variant:"secondary",onClick:s,text:r})}),s&&m.jsx(H,{className:"absolute -top-2 -right-2 md:-top-4 md:-right-4",variant:"secondary",size:"small",onClick:s,iconAfter:m.jsx(ce,{}),"aria-label":"quit"})]}),yn=({title:i,icon:e,description:t,image:n,quitText:r,onQuit:s,startText:a,onStart:o})=>m.jsxs(Je,{title:i,icon:e,description:t,image:n,wrapperClassName:"relative",children:[m.jsxs("div",{className:"flex justify-end gap-2",children:[s&&r&&m.jsx(H,{variant:"subtle",text:r,onClick:s}),m.jsx(H,{variant:"secondary",text:a,onClick:o})]}),s&&m.jsx(H,{className:"absolute top-0 right-1 md:top-1",variant:"subtle",size:"small",onClick:s,iconAfter:m.jsx(ce,{}),"aria-label":"quit"})]});let Ge={};function xn(){return Ge}function bn(i){Ge=i}const wn={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"}},vn=(i,e,t)=>{let n;const r=wn[i];return typeof r=="string"?n=r:e===1?n=r.one:n=r.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Se(i){return(e={})=>{const t=e.width?String(e.width):i.defaultWidth;return i.formats[t]||i.formats[i.defaultWidth]}}const Sn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},kn=(i,e,t,n)=>Sn[i];function ee(i){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let r;if(n==="formatting"&&i.formattingValues){const a=i.defaultFormattingWidth||i.defaultWidth,o=t!=null&&t.width?String(t.width):a;r=i.formattingValues[o]||i.formattingValues[a]}else{const a=i.defaultWidth,o=t!=null&&t.width?String(t.width):i.defaultWidth;r=i.values[o]||i.values[a]}const s=i.argumentCallback?i.argumentCallback(e):e;return r[s]}}const Ln={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},On={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},En={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"]},Pn={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"]},Cn={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"}},Nn={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"}},jn={ordinalNumber:(i,e)=>{const t=Number(i),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:ee({values:Ln,defaultWidth:"wide"}),quarter:ee({values:On,defaultWidth:"wide",argumentCallback:i=>i-1}),month:ee({values:En,defaultWidth:"wide"}),day:ee({values:Pn,defaultWidth:"wide"}),dayPeriod:ee({values:Cn,defaultWidth:"wide",formattingValues:Nn,defaultFormattingWidth:"wide"})};function te(i){return(e,t={})=>{const n=t.width,r=n&&i.matchPatterns[n]||i.matchPatterns[i.defaultMatchWidth],s=e.match(r);if(!s)return null;const a=s[0],o=n&&i.parsePatterns[n]||i.parsePatterns[i.defaultParseWidth],c=Array.isArray(o)?Rn(o,d=>d.test(a)):Tn(o,d=>d.test(a));let l;l=i.valueCallback?i.valueCallback(c):c,l=t.valueCallback?t.valueCallback(l):l;const u=e.slice(a.length);return{value:l,rest:u}}}function Tn(i,e){for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&e(i[t]))return t}function Rn(i,e){for(let t=0;t<i.length;t++)if(e(i[t]))return t}function Fn(i){return(e,t={})=>{const n=e.match(i.matchPattern);if(!n)return null;const r=n[0],s=e.match(i.parsePattern);if(!s)return null;let a=i.valueCallback?i.valueCallback(s[0]):s[0];a=t.valueCallback?t.valueCallback(a):a;const o=e.slice(r.length);return{value:a,rest:o}}}const Mn=/^(\d+)(th|st|nd|rd)?/i,$n=/\d+/i,Dn={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},An={any:[/^b/i,/^(a|c)/i]},Vn={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},In={any:[/1/i,/2/i,/3/i,/4/i]},Hn={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},Bn={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]},qn={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},zn={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]},Un={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},_n={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}},Kn={ordinalNumber:Fn({matchPattern:Mn,parsePattern:$n,valueCallback:i=>parseInt(i,10)}),era:te({matchPatterns:Dn,defaultMatchWidth:"wide",parsePatterns:An,defaultParseWidth:"any"}),quarter:te({matchPatterns:Vn,defaultMatchWidth:"wide",parsePatterns:In,defaultParseWidth:"any",valueCallback:i=>i+1}),month:te({matchPatterns:Hn,defaultMatchWidth:"wide",parsePatterns:Bn,defaultParseWidth:"any"}),day:te({matchPatterns:qn,defaultMatchWidth:"wide",parsePatterns:zn,defaultParseWidth:"any"}),dayPeriod:te({matchPatterns:Un,defaultMatchWidth:"any",parsePatterns:_n,defaultParseWidth:"any"})};function Wn(i){const e={},t=xn();for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);for(const n in i)Object.prototype.hasOwnProperty.call(i,n)&&(i[n]===void 0?delete e[n]:e[n]=i[n]);bn(e)}const Zn={full:"EEEE, d MMMM yyyy",long:"d MMMM yyyy",medium:"d MMM yyyy",short:"dd/MM/yyyy"},Jn={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Gn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Yn={date:Se({formats:Zn,defaultWidth:"full"}),time:Se({formats:Jn,defaultWidth:"full"}),dateTime:Se({formats:Gn,defaultWidth:"full"})},Xn={code:"en-GB",formatDistance:vn,formatLong:Yn,formatRelative:kn,localize:jn,match:Kn,options:{weekStartsOn:1,firstWeekContainsDate:4}},x=i=>typeof i=="string",ne=()=>{let i,e;const t=new Promise((n,r)=>{i=n,e=r});return t.resolve=i,t.reject=e,t},Ye=i=>i==null?"":""+i,Qn=(i,e,t)=>{i.forEach(n=>{e[n]&&(t[n]=e[n])})},er=/###/g,Xe=i=>i&&i.indexOf("###")>-1?i.replace(er,"."):i,Qe=i=>!i||x(i),re=(i,e,t)=>{const n=x(e)?e.split("."):e;let r=0;for(;r<n.length-1;){if(Qe(i))return{};const s=Xe(n[r]);!i[s]&&t&&(i[s]=new t),Object.prototype.hasOwnProperty.call(i,s)?i=i[s]:i={},++r}return Qe(i)?{}:{obj:i,k:Xe(n[r])}},et=(i,e,t)=>{const{obj:n,k:r}=re(i,e,Object);if(n!==void 0||e.length===1){n[r]=t;return}let s=e[e.length-1],a=e.slice(0,e.length-1),o=re(i,a,Object);for(;o.obj===void 0&&a.length;)s=`${a[a.length-1]}.${s}`,a=a.slice(0,a.length-1),o=re(i,a,Object),o!=null&&o.obj&&typeof o.obj[`${o.k}.${s}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${s}`]=t},tr=(i,e,t,n)=>{const{obj:r,k:s}=re(i,e,Object);r[s]=r[s]||[],r[s].push(t)},de=(i,e)=>{const{obj:t,k:n}=re(i,e);if(t&&Object.prototype.hasOwnProperty.call(t,n))return t[n]},nr=(i,e,t)=>{const n=de(i,t);return n!==void 0?n:de(e,t)},tt=(i,e,t)=>{for(const n in e)n!=="__proto__"&&n!=="constructor"&&(n in i?x(i[n])||i[n]instanceof String||x(e[n])||e[n]instanceof String?t&&(i[n]=e[n]):tt(i[n],e[n],t):i[n]=e[n]);return i},Z=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var rr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const ir=i=>x(i)?i.replace(/[&<>"'\/]/g,e=>rr[e]):i;class sr{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 n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}const ar=[" ",",","?","!",";"],or=new sr(20),lr=(i,e,t)=>{e=e||"",t=t||"";const n=ar.filter(a=>e.indexOf(a)<0&&t.indexOf(a)<0);if(n.length===0)return!0;const r=or.getRegExp(`(${n.map(a=>a==="?"?"\\?":a).join("|")})`);let s=!r.test(i);if(!s){const a=i.indexOf(t);a>0&&!r.test(i.substring(0,a))&&(s=!0)}return s},ke=(i,e,t=".")=>{if(!i)return;if(i[e])return Object.prototype.hasOwnProperty.call(i,e)?i[e]:void 0;const n=e.split(t);let r=i;for(let s=0;s<n.length;){if(!r||typeof r!="object")return;let a,o="";for(let c=s;c<n.length;++c)if(c!==s&&(o+=t),o+=n[c],a=r[o],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&c<n.length-1)continue;s+=c-s+1;break}r=a}return r},ie=i=>i==null?void 0:i.replace("_","-"),cr={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,e){var t,n;(n=(t=console==null?void 0:console[i])==null?void 0:t.apply)==null||n.call(t,console,e)}};let ur=class Ce{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||cr,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,n,r){return r&&!this.debug?null:(x(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Ce(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Ce(this.logger,e)}};var A=new ur;class he{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);const r=this.observers[n].get(t)||0;this.observers[n].set(t,r+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(([r,s])=>{for(let a=0;a<s;a++)r(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([r,s])=>{for(let a=0;a<s;a++)r.apply(r,[e,...t])})}}class nt extends he{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,n,r={}){var l,u;const s=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):x(n)&&s?o.push(...n.split(s)):o.push(n)));const c=de(this.data,o);return!c&&!t&&!n&&e.indexOf(".")>-1&&(e=o[0],t=o[1],n=o.slice(2).join(".")),c||!a||!x(n)?c:ke((u=(l=this.data)==null?void 0:l[e])==null?void 0:u[t],n,s)}addResource(e,t,n,r,s={silent:!1}){const a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(".")>-1&&(o=e.split("."),r=t,t=o[1]),this.addNamespaces(t),et(this.data,o,r),s.silent||this.emit("added",e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(const s in n)(x(n[s])||Array.isArray(n[s]))&&this.addResource(e,t,s,n[s],{silent:!0});r.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,r,s,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),r=n,n=t,t=o[1]),this.addNamespaces(t);let c=de(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?tt(c,n,s):c={...c,...n},et(this.data,o,c),a.silent||this.emit("added",e,t,n)}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(r=>t[r]&&Object.keys(t[r]).length>0)}toJSON(){return this.data}}var rt={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,e,t,n,r){return i.forEach(s=>{var a;e=((a=this.processors[s])==null?void 0:a.process(e,t,n,r))??e}),e}};const it=Symbol("i18next/PATH_KEY");function dr(){const i=[],e=Object.create(null);let t;return e.get=(n,r)=>{var s;return(s=t==null?void 0:t.revoke)==null||s.call(t),r===it?i:(i.push(r),t=Proxy.revocable(n,e),t.proxy)},Proxy.revocable(Object.create(null),e).proxy}function Le(i,e){const{[it]:t}=i(dr());return t.join((e==null?void 0:e.keySeparator)??".")}const st={},at=i=>!x(i)&&typeof i!="boolean"&&typeof i!="number";class fe extends he{constructor(e,t={}){super(),Qn(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=A.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const n={...t};if(e==null)return!1;const r=this.resolve(e,n);return(r==null?void 0:r.res)!==void 0}extractFromKey(e,t){let n=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");const r=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let s=t.ns||this.options.defaultNS||[];const a=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!lr(e,n,r);if(a&&!o){const c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:x(s)?[s]:s};const l=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(l[0])>-1)&&(s=l.shift()),e=l.join(r)}return{key:e,namespaces:x(s)?[s]:s}}translate(e,t,n){let r=typeof t=="object"?{...t}:t;if(typeof r!="object"&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),typeof r=="object"&&(r={...r}),r||(r={}),e==null)return"";typeof e=="function"&&(e=Le(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]);const s=r.returnDetails!==void 0?r.returnDetails:this.options.returnDetails,a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,{key:o,namespaces:c}=this.extractFromKey(e[e.length-1],r),l=c[c.length-1];let u=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");const d=r.lng||this.language,h=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((d==null?void 0:d.toLowerCase())==="cimode")return h?s?{res:`${l}${u}${o}`,usedKey:o,exactUsedKey:o,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:`${l}${u}${o}`:s?{res:o,usedKey:o,exactUsedKey:o,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:o;const f=this.resolve(e,r);let g=f==null?void 0:f.res;const y=(f==null?void 0:f.usedKey)||o,w=(f==null?void 0:f.exactUsedKey)||o,v=["[object Number]","[object Function]","[object RegExp]"],L=r.joinArrays!==void 0?r.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject,N=r.count!==void 0&&!x(r.count),j=fe.hasDefaultValue(r),z=N?this.pluralResolver.getSuffix(d,r.count,r):"",R=r.ordinal&&N?this.pluralResolver.getSuffix(d,r.count,{ordinal:!1}):"",P=N&&!r.ordinal&&r.count===0,E=P&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${z}`]||r[`defaultValue${R}`]||r.defaultValue;let k=g;O&&!g&&j&&(k=E);const $=at(k),_r=Object.prototype.toString.apply(k);if(O&&k&&$&&v.indexOf(_r)<0&&!(x(L)&&Array.isArray(k))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const V=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,k,{...r,ns:c}):`key '${o} (${this.language})' returned an object instead of string.`;return s?(f.res=V,f.usedParams=this.getUsedParamsDetails(r),f):V}if(a){const V=Array.isArray(k),D=V?[]:{},Ct=V?w:y;for(const I in k)if(Object.prototype.hasOwnProperty.call(k,I)){const U=`${Ct}${a}${I}`;j&&!g?D[I]=this.translate(U,{...r,defaultValue:at(E)?E[I]:void 0,joinArrays:!1,ns:c}):D[I]=this.translate(U,{...r,joinArrays:!1,ns:c}),D[I]===U&&(D[I]=k[I])}g=D}}else if(O&&x(L)&&Array.isArray(g))g=g.join(L),g&&(g=this.extendTranslation(g,e,r,n));else{let V=!1,D=!1;!this.isValidLookup(g)&&j&&(V=!0,g=E),this.isValidLookup(g)||(D=!0,g=o);const I=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&D?void 0:g,U=j&&E!==g&&this.options.updateMissing;if(D||V||U){if(this.logger.log(U?"updateKey":"missingKey",d,l,o,U?E:g),a){const F=this.resolve(o,{...r,keySeparator:!1});F&&F.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 ae=[];const me=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if(this.options.saveMissingTo==="fallback"&&me&&me[0])for(let F=0;F<me.length;F++)ae.push(me[F]);else this.options.saveMissingTo==="all"?ae=this.languageUtils.toResolveHierarchy(r.lng||this.language):ae.push(r.lng||this.language);const Nt=(F,K,oe)=>{var Tt;const jt=j&&oe!==g?oe:I;this.options.missingKeyHandler?this.options.missingKeyHandler(F,l,K,jt,U,r):(Tt=this.backendConnector)!=null&&Tt.saveMissing&&this.backendConnector.saveMissing(F,l,K,jt,U,r),this.emit("missingKey",F,l,K,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&N?ae.forEach(F=>{const K=this.pluralResolver.getSuffixes(F,r);P&&r[`defaultValue${this.options.pluralSeparator}zero`]&&K.indexOf(`${this.options.pluralSeparator}zero`)<0&&K.push(`${this.options.pluralSeparator}zero`),K.forEach(oe=>{Nt([F],o+oe,r[`defaultValue${oe}`]||E)})}):Nt(ae,o,E))}g=this.extendTranslation(g,e,r,f,n),D&&g===o&&this.options.appendNamespaceToMissingKey&&(g=`${l}${u}${o}`),(D||V)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${o}`:o,V?g:void 0,r))}return s?(f.res=g,f.usedParams=this.getUsedParamsDetails(r),f):g}extendTranslation(e,t,n,r,s){var c,l;if((c=this.i18nFormat)!=null&&c.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const u=x(e)&&(((l=n==null?void 0:n.interpolation)==null?void 0:l.skipOnVariables)!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const f=e.match(this.interpolator.nestingRegexp);d=f&&f.length}let h=n.replace&&!x(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(h={...this.options.interpolation.defaultVariables,...h}),e=this.interpolator.interpolate(e,h,n.lng||this.language||r.usedLng,n),u){const f=e.match(this.interpolator.nestingRegexp),g=f&&f.length;d<g&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...f)=>(s==null?void 0:s[0])===f[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${t[0]}`),null):this.translate(...f,t),n)),n.interpolation&&this.interpolator.reset()}const a=n.postProcess||this.options.postProcess,o=x(a)?[a]:a;return e!=null&&(o!=null&&o.length)&&n.applyPostProcessor!==!1&&(e=rt.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,s,a,o;return x(e)&&(e=[e]),e.forEach(c=>{if(this.isValidLookup(n))return;const l=this.extractFromKey(c,t),u=l.key;r=u;let d=l.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const h=t.count!==void 0&&!x(t.count),f=h&&!t.ordinal&&t.count===0,g=t.context!==void 0&&(x(t.context)||typeof t.context=="number")&&t.context!=="",y=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);d.forEach(w=>{var v,L;this.isValidLookup(n)||(o=w,!st[`${y[0]}-${w}`]&&((v=this.utils)!=null&&v.hasLoadedNamespace)&&!((L=this.utils)!=null&&L.hasLoadedNamespace(o))&&(st[`${y[0]}-${w}`]=!0,this.logger.warn(`key "${r}" for languages "${y.join(", ")}" won't get resolved as namespace "${o}" 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!!!")),y.forEach(O=>{var z;if(this.isValidLookup(n))return;a=O;const N=[u];if((z=this.i18nFormat)!=null&&z.addLookupKeys)this.i18nFormat.addLookupKeys(N,u,O,w,t);else{let R;h&&(R=this.pluralResolver.getSuffix(O,t.count,t));const P=`${this.options.pluralSeparator}zero`,E=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(t.ordinal&&R.indexOf(E)===0&&N.push(u+R.replace(E,this.options.pluralSeparator)),N.push(u+R),f&&N.push(u+P)),g){const k=`${u}${this.options.contextSeparator||"_"}${t.context}`;N.push(k),h&&(t.ordinal&&R.indexOf(E)===0&&N.push(k+R.replace(E,this.options.pluralSeparator)),N.push(k+R),f&&N.push(k+P))}}let j;for(;j=N.pop();)this.isValidLookup(n)||(s=j,n=this.getResource(O,w,j,t))}))})}),{res:n,usedKey:r,exactUsedKey:s,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,n,r={}){var s;return(s=this.i18nFormat)!=null&&s.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!x(e.replace);let r=n?e.replace:e;if(n&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(const s of t)delete r[s]}return r}static hasDefaultValue(e){const t="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&e[n]!==void 0)return!0;return!1}}class ot{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=A.create("languageUtils")}getScriptPartFromCode(e){if(e=ie(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=ie(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(x(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(n=>{if(t)return;const r=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(r))&&(t=r)}),!t&&this.options.supportedLngs&&e.forEach(n=>{if(t)return;const r=this.getScriptPartFromCode(n);if(this.isSupportedCode(r))return t=r;const s=this.getLanguagePartFromCode(n);if(this.isSupportedCode(s))return t=s;t=this.options.supportedLngs.find(a=>{if(a===s)return a;if(!(a.indexOf("-")<0&&s.indexOf("-")<0)&&(a.indexOf("-")>0&&s.indexOf("-")<0&&a.substring(0,a.indexOf("-"))===s||a.indexOf(s)===0&&s.length>1))return a})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),x(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],s=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return x(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):x(e)&&s(this.formatLanguageCode(e)),n.forEach(a=>{r.indexOf(a)<0&&s(this.formatLanguageCode(a))}),r}}const lt={zero:0,one:1,two:2,few:3,many:4,other:5},ct={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class hr{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=A.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const n=ie(e==="dev"?"en":e),r=t.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:n,type:r});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),ct;if(!e.match(/-|_/))return ct;const c=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(c,t)}return this.pluralRulesCache[s]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),(n==null?void 0:n.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(r=>`${t}${r}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?n.resolvedOptions().pluralCategories.sort((r,s)=>lt[r]-lt[s]).map(r=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${r}`):[]}getSuffix(e,t,n={}){const r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,n))}}const ut=(i,e,t,n=".",r=!0)=>{let s=nr(i,e,t);return!s&&r&&x(t)&&(s=ke(i,t,n),s===void 0&&(s=ke(e,t,n))),s},Oe=i=>i.replace(/\$/g,"$$$$");class fr{constructor(e={}){var t;this.logger=A.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(n=>n),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:s,prefixEscaped:a,suffix:o,suffixEscaped:c,formatSeparator:l,unescapeSuffix:u,unescapePrefix:d,nestingPrefix:h,nestingPrefixEscaped:f,nestingSuffix:g,nestingSuffixEscaped:y,nestingOptionsSeparator:w,maxReplaces:v,alwaysFormat:L}=e.interpolation;this.escape=t!==void 0?t:ir,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=s?Z(s):a||"{{",this.suffix=o?Z(o):c||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=h?Z(h):f||Z("$t("),this.nestingSuffix=g?Z(g):y||Z(")"),this.nestingOptionsSeparator=w||",",this.maxReplaces=v||1e3,this.alwaysFormat=L!==void 0?L:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,n)=>(t==null?void 0:t.source)===n?(t.lastIndex=0,t):new RegExp(n,"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,n,r){var f;let s,a,o;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=g=>{if(g.indexOf(this.formatSeparator)<0){const L=ut(t,c,g,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(L,void 0,n,{...r,...t,interpolationkey:g}):L}const y=g.split(this.formatSeparator),w=y.shift().trim(),v=y.join(this.formatSeparator).trim();return this.format(ut(t,c,w,this.options.keySeparator,this.options.ignoreJSONStructure),v,n,{...r,...t,interpolationkey:w})};this.resetRegExp();const u=(r==null?void 0:r.missingInterpolationHandler)||this.options.missingInterpolationHandler,d=((f=r==null?void 0:r.interpolation)==null?void 0:f.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:g=>Oe(g)},{regex:this.regexp,safeValue:g=>this.escapeValue?Oe(this.escape(g)):Oe(g)}].forEach(g=>{for(o=0;s=g.regex.exec(e);){const y=s[1].trim();if(a=l(y),a===void 0)if(typeof u=="function"){const v=u(e,s,r);a=x(v)?v:""}else if(r&&Object.prototype.hasOwnProperty.call(r,y))a="";else if(d){a=s[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${e}`),a="";else!x(a)&&!this.useRawValueToEscape&&(a=Ye(a));const w=g.safeValue(a);if(e=e.replace(s[0],w),d?(g.regex.lastIndex+=a.length,g.regex.lastIndex-=s[0].length):g.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,s,a;const o=(c,l)=>{const u=this.nestingOptionsSeparator;if(c.indexOf(u)<0)return c;const d=c.split(new RegExp(`${u}[ ]*{`));let h=`{${d[1]}`;c=d[0],h=this.interpolate(h,a);const f=h.match(/'/g),g=h.match(/"/g);(((f==null?void 0:f.length)??0)%2===0&&!g||g.length%2!==0)&&(h=h.replace(/'/g,'"'));try{a=JSON.parse(h),l&&(a={...l,...a})}catch(y){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,y),`${c}${u}${h}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;r=this.nestingRegexp.exec(e);){let c=[];a={...n},a=a.replace&&!x(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const l=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(l!==-1&&(c=r[1].slice(l).split(this.formatSeparator).map(u=>u.trim()).filter(Boolean),r[1]=r[1].slice(0,l)),s=t(o.call(this,r[1].trim(),a),a),s&&r[0]===e&&!x(s))return s;x(s)||(s=Ye(s)),s||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),s=""),c.length&&(s=c.reduce((u,d)=>this.format(u,d,n.lng,{...n,interpolationkey:r[1].trim()}),s.trim())),e=e.replace(r[0],s),this.regexp.lastIndex=0}return e}}const gr=i=>{let e=i.toLowerCase().trim();const t={};if(i.indexOf("(")>-1){const n=i.split("(");e=n[0].toLowerCase().trim();const r=n[1].substring(0,n[1].length-1);e==="currency"&&r.indexOf(":")<0?t.currency||(t.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?t.range||(t.range=r.trim()):r.split(";").forEach(a=>{if(a){const[o,...c]=a.split(":"),l=c.join(":").trim().replace(/^'+|'+$/g,""),u=o.trim();t[u]||(t[u]=l),l==="false"&&(t[u]=!1),l==="true"&&(t[u]=!0),isNaN(l)||(t[u]=parseInt(l,10))}})}return{formatName:e,formatOptions:t}},dt=i=>{const e={};return(t,n,r)=>{let s=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(s={...s,[r.interpolationkey]:void 0});const a=n+JSON.stringify(s);let o=e[a];return o||(o=i(ie(n),r),e[a]=o),o(t)}},pr=i=>(e,t,n)=>i(ie(t),n)(e);class mr{constructor(e={}){this.logger=A.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const n=t.cacheInBuiltFormats?dt:pr;this.formats={number:n((r,s)=>{const a=new Intl.NumberFormat(r,{...s});return o=>a.format(o)}),currency:n((r,s)=>{const a=new Intl.NumberFormat(r,{...s,style:"currency"});return o=>a.format(o)}),datetime:n((r,s)=>{const a=new Intl.DateTimeFormat(r,{...s});return o=>a.format(o)}),relativetime:n((r,s)=>{const a=new Intl.RelativeTimeFormat(r,{...s});return o=>a.format(o,s.range||"day")}),list:n((r,s)=>{const a=new Intl.ListFormat(r,{...s});return o=>a.format(o)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=dt(t)}format(e,t,n,r={}){const s=t.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(o=>o.indexOf(")")>-1)){const o=s.findIndex(c=>c.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,o)].join(this.formatSeparator)}return s.reduce((o,c)=>{var d;const{formatName:l,formatOptions:u}=gr(c);if(this.formats[l]){let h=o;try{const f=((d=r==null?void 0:r.formatParams)==null?void 0:d[r.interpolationkey])||{},g=f.locale||f.lng||r.locale||r.lng||n;h=this.formats[l](o,g,{...u,...r,...f})}catch(f){this.logger.warn(f)}return h}else this.logger.warn(`there was no format function for ${l}`);return o},e)}}const yr=(i,e)=>{i.pending[e]!==void 0&&(delete i.pending[e],i.pendingCount--)};class xr extends he{constructor(e,t,n,r={}){var s,a;super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=A.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],(a=(s=this.backend)==null?void 0:s.init)==null||a.call(s,n,r.backend,r)}queueLoad(e,t,n,r){const s={},a={},o={},c={};return e.forEach(l=>{let u=!0;t.forEach(d=>{const h=`${l}|${d}`;!n.reload&&this.store.hasResourceBundle(l,d)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?a[h]===void 0&&(a[h]=!0):(this.state[h]=1,u=!1,a[h]===void 0&&(a[h]=!0),s[h]===void 0&&(s[h]=!0),c[d]===void 0&&(c[d]=!0)))}),u||(o[l]=!0)}),(Object.keys(s).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(s),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(c)}}loaded(e,t,n){const r=e.split("|"),s=r[0],a=r[1];t&&this.emit("failedLoading",s,a,t),!t&&n&&this.store.addResourceBundle(s,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const o={};this.queue.forEach(c=>{tr(c.loaded,[s],a),yr(c,e),t&&c.errors.push(t),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(l=>{o[l]||(o[l]={});const u=c.loaded[l];u.length&&u.forEach(d=>{o[l][d]===void 0&&(o[l][d]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(c=>!c.done)}read(e,t,n,r=0,s=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:s,callback:a});return}this.readingCalls++;const o=(l,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(l&&u&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,n,r+1,s*2,a)},s);return}a(l,u)},c=this.backend[n].bind(this.backend);if(c.length===2){try{const l=c(e,t);l&&typeof l.then=="function"?l.then(u=>o(null,u)).catch(o):o(null,l)}catch(l){o(l)}return}return c(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();x(e)&&(e=this.languageUtils.toResolveHierarchy(e)),x(t)&&(t=[t]);const s=this.queueLoad(e,t,n,r);if(!s.toLoad.length)return s.pending.length||r(),null;s.toLoad.forEach(a=>{this.loadOne(a)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=""){const n=e.split("|"),r=n[0],s=n[1];this.read(r,s,"read",void 0,void 0,(a,o)=>{a&&this.logger.warn(`${t}loading namespace ${s} for language ${r} failed`,a),!a&&o&&this.logger.log(`${t}loaded namespace ${s} for language ${r}`,o),this.loaded(e,a,o)})}saveMissing(e,t,n,r,s,a={},o=()=>{}){var c,l,u,d,h;if((l=(c=this.services)==null?void 0:c.utils)!=null&&l.hasLoadedNamespace&&!((d=(u=this.services)==null?void 0:u.utils)!=null&&d.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${n}" 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(!(n==null||n==="")){if((h=this.backend)!=null&&h.create){const f={...a,isUpdate:s},g=this.backend.create.bind(this.backend);if(g.length<6)try{let y;g.length===5?y=g(e,t,n,r,f):y=g(e,t,n,r),y&&typeof y.then=="function"?y.then(w=>o(null,w)).catch(o):o(null,y)}catch(y){o(y)}else g(e,t,n,r,o,f)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}}const ht=()=>({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:i=>{let e={};if(typeof i[1]=="object"&&(e=i[1]),x(i[1])&&(e.defaultValue=i[1]),x(i[2])&&(e.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const t=i[3]||i[2];Object.keys(t).forEach(n=>{e[n]=t[n]})}return e},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ft=i=>{var e,t;return x(i.ns)&&(i.ns=[i.ns]),x(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),x(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),((t=(e=i.supportedLngs)==null?void 0:e.indexOf)==null?void 0:t.call(e,"cimode"))<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i},ge=()=>{},br=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(t=>{typeof i[t]=="function"&&(i[t]=i[t].bind(i))})};class se extends he{constructor(e={},t){if(super(),this.options=ft(e),this.services={},this.logger=A,this.modules={external:[]},br(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&&(x(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const n=ht();this.options={...n,...this.options,...ft(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const r=l=>l?typeof l=="function"?new l:l:null;if(!this.options.isClone){this.modules.logger?A.init(r(this.modules.logger),this.options):A.init(null,this.options);let l;this.modules.formatter?l=this.modules.formatter:l=mr;const u=new ot(this.options);this.store=new nt(this.options.resources,this.options);const d=this.services;d.logger=A,d.resourceStore=this.store,d.languageUtils=u,d.pluralResolver=new hr(u,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),l&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(d.formatter=r(l),d.formatter.init&&d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new fr(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new xr(r(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",(f,...g)=>{this.emit(f,...g)}),this.modules.languageDetector&&(d.languageDetector=r(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=r(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new fe(this.services,this.options),this.translator.on("*",(f,...g)=>{this.emit(f,...g)}),this.modules.external.forEach(f=>{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,t||(t=ge),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&l[0]!=="dev"&&(this.options.lng=l[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(l=>{this[l]=(...u)=>this.store[l](...u)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(l=>{this[l]=(...u)=>(this.store[l](...u),this)});const o=ne(),c=()=>{const l=(u,d)=>{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),o.resolve(d),t(u,d)};if(this.languages&&!this.isInitialized)return l(null,this.t.bind(this));this.changeLanguage(this.options.lng,l)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),o}loadResources(e,t=ge){var s,a;let n=t;const r=x(e)?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if((r==null?void 0:r.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const o=[],c=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(d=>{d!=="cimode"&&o.indexOf(d)<0&&o.push(d)})};r?c(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(u=>c(u)),(a=(s=this.options.preload)==null?void 0:s.forEach)==null||a.call(s,l=>c(l)),this.services.backendConnector.load(o,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(l)})}else n(null)}reloadResources(e,t,n){const r=ne();return typeof e=="function"&&(n=e,e=void 0),typeof t=="function"&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=ge),this.services.backendConnector.reload(e,t,s=>{r.resolve(),n(s)}),r}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"&&rt.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 n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;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 n=ne();this.emit("languageChanging",e);const r=o=>{this.language=o,this.languages=this.services.languageUtils.toResolveHierarchy(o),this.resolvedLanguage=void 0,this.setResolvedLanguage(o)},s=(o,c)=>{c?this.isLanguageChangingTo===e&&(r(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,n.resolve((...l)=>this.t(...l)),t&&t(o,(...l)=>this.t(...l))},a=o=>{var u,d;!e&&!o&&this.services.languageDetector&&(o=[]);const c=x(o)?o:o&&o[0],l=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(x(o)?[o]:o);l&&(this.language||r(l),this.translator.language||this.translator.changeLanguage(l),(d=(u=this.services.languageDetector)==null?void 0:u.cacheUserLanguage)==null||d.call(u,l)),this.loadResources(l,h=>{s(h,l)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n){const r=(s,a,...o)=>{let c;typeof a!="object"?c=this.options.overloadTranslationOptionHandler([s,a].concat(o)):c={...a},c.lng=c.lng||r.lng,c.lngs=c.lngs||r.lngs,c.ns=c.ns||r.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||n||r.keyPrefix);const l=this.options.keySeparator||".";let u;return c.keyPrefix&&Array.isArray(s)?u=s.map(d=>(typeof d=="function"&&(d=Le(d,{...this.options,...a})),`${c.keyPrefix}${l}${d}`)):(typeof s=="function"&&(s=Le(s,{...this.options,...a})),u=c.keyPrefix?`${c.keyPrefix}${l}${s}`:s),this.t(u,c)};return x(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}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 n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const a=(o,c)=>{const l=this.services.backendConnector.state[`${o}|${c}`];return l===-1||l===0||l===2};if(t.precheck){const o=t.precheck(this,a);if(o!==void 0)return o}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(s,e)))}loadNamespaces(e,t){const n=ne();return this.options.ns?(x(e)&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{n.resolve(),t&&t(r)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=ne();x(e)&&(e=[e]);const r=this.options.preload||[],s=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return s.length?(this.options.preload=r.concat(s),this.loadResources(a=>{n.resolve(),t&&t(a)}),n):(t&&t(),Promise.resolve())}dir(e){var r,s;if(e||(e=this.resolvedLanguage||(((r=this.languages)==null?void 0:r.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const a=new Intl.Locale(e);if(a&&a.getTextInfo){const o=a.getTextInfo();if(o&&o.direction)return o.direction}}catch{}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"],n=((s=this.services)==null?void 0:s.languageUtils)||new ot(ht());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new se(e,t)}cloneInstance(e={},t=ge){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},s=new se(r);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(o=>{s[o]=this[o]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},n){const o=Object.keys(this.store.data).reduce((c,l)=>(c[l]={...this.store.data[l]},c[l]=Object.keys(c[l]).reduce((u,d)=>(u[d]={...c[l][d]},u),c[l]),c),{});s.store=new nt(o,r),s.services.resourceStore=s.store}return s.translator=new fe(s.services,r),s.translator.on("*",(o,...c)=>{s.emit(o,...c)}),s.init(r,t),s.translator.options=r,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const T=se.createInstance();T.createInstance=se.createInstance,T.createInstance,T.dir,T.init,T.loadResources,T.reloadResources,T.use,T.changeLanguage,T.getFixedT,T.t,T.exists,T.setDefaultNamespace,T.hasLoadedNamespace,T.loadNamespaces,T.loadLanguages;const{slice:wr,forEach:vr}=[];function Sr(i){return vr.call(wr.call(arguments,1),e=>{if(e)for(const t in e)i[t]===void 0&&(i[t]=e[t])}),i}function kr(i){return typeof i!="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(i))}const gt=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Lr=function(i,e){const n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},r=encodeURIComponent(e);let s=`${i}=${r}`;if(n.maxAge>0){const a=n.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(a)}`}if(n.domain){if(!gt.test(n.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${n.domain}`}if(n.path){if(!gt.test(n.path))throw new TypeError("option path is invalid");s+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(s+="; HttpOnly"),n.secure&&(s+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(s+="; Partitioned"),s},pt={create(i,e,t,n){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};t&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+t*60*1e3)),n&&(r.domain=n),document.cookie=Lr(i,e,r)},read(i){const e=`${i}=`,t=document.cookie.split(";");for(let n=0;n<t.length;n++){let r=t[n];for(;r.charAt(0)===" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return r.substring(e.length,r.length)}return null},remove(i,e){this.create(i,"",-1,e)}};var Or={name:"cookie",lookup(i){let{lookupCookie:e}=i;if(e&&typeof document<"u")return pt.read(e)||void 0},cacheUserLanguage(i,e){let{lookupCookie:t,cookieMinutes:n,cookieDomain:r,cookieOptions:s}=e;t&&typeof document<"u"&&pt.create(t,i,n,r,s)}},Er={name:"querystring",lookup(i){var n;let{lookupQuerystring:e}=i,t;if(typeof window<"u"){let{search:r}=window.location;!window.location.search&&((n=window.location.hash)==null?void 0:n.indexOf("?"))>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));const a=r.substring(1).split("&");for(let o=0;o<a.length;o++){const c=a[o].indexOf("=");c>0&&a[o].substring(0,c)===e&&(t=a[o].substring(c+1))}}return t}},Pr={name:"hash",lookup(i){var r;let{lookupHash:e,lookupFromHashIndex:t}=i,n;if(typeof window<"u"){const{hash:s}=window.location;if(s&&s.length>2){const a=s.substring(1);if(e){const o=a.split("&");for(let c=0;c<o.length;c++){const l=o[c].indexOf("=");l>0&&o[c].substring(0,l)===e&&(n=o[c].substring(l+1))}}if(n)return n;if(!n&&t>-1){const o=s.match(/\/([a-zA-Z-]*)/g);return Array.isArray(o)?(r=o[typeof t=="number"?t:0])==null?void 0:r.replace("/",""):void 0}}}return n}};let J=null;const mt=()=>{if(J!==null)return J;try{if(J=typeof window<"u"&&window.localStorage!==null,!J)return!1;const i="i18next.translate.boo";window.localStorage.setItem(i,"foo"),window.localStorage.removeItem(i)}catch{J=!1}return J};var Cr={name:"localStorage",lookup(i){let{lookupLocalStorage:e}=i;if(e&&mt())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(i,e){let{lookupLocalStorage:t}=e;t&&mt()&&window.localStorage.setItem(t,i)}};let G=null;const yt=()=>{if(G!==null)return G;try{if(G=typeof window<"u"&&window.sessionStorage!==null,!G)return!1;const i="i18next.translate.boo";window.sessionStorage.setItem(i,"foo"),window.sessionStorage.removeItem(i)}catch{G=!1}return G};var Nr={name:"sessionStorage",lookup(i){let{lookupSessionStorage:e}=i;if(e&&yt())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(i,e){let{lookupSessionStorage:t}=e;t&&yt()&&window.sessionStorage.setItem(t,i)}},jr={name:"navigator",lookup(i){const e=[];if(typeof navigator<"u"){const{languages:t,userLanguage:n,language:r}=navigator;if(t)for(let s=0;s<t.length;s++)e.push(t[s]);n&&e.push(n),r&&e.push(r)}return e.length>0?e:void 0}},Tr={name:"htmlTag",lookup(i){let{htmlTag:e}=i,t;const n=e||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(t=n.getAttribute("lang")),t}},Rr={name:"path",lookup(i){var r;let{lookupFromPathIndex:e}=i;if(typeof window>"u")return;const t=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?(r=t[typeof e=="number"?e:0])==null?void 0:r.replace("/",""):void 0}},Fr={name:"subdomain",lookup(i){var r,s;let{lookupFromSubdomainIndex:e}=i;const t=typeof e=="number"?e+1:1,n=typeof window<"u"&&((s=(r=window.location)==null?void 0:r.hostname)==null?void 0:s.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(n)return n[t]}};let xt=!1;try{document.cookie,xt=!0}catch{}const bt=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];xt||bt.splice(1,1);const Mr=()=>({order:bt,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:i=>i});class wt{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]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=Sr(t,this.options||{},Mr()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=r=>r.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Or),this.addDetector(Er),this.addDetector(Cr),this.addDetector(Nr),this.addDetector(jr),this.addDetector(Tr),this.addDetector(Rr),this.addDetector(Fr),this.addDetector(Pr)}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(n=>{if(this.detectors[n]){let r=this.detectors[n].lookup(this.options);r&&typeof r=="string"&&(r=[r]),r&&(t=t.concat(r))}}),t=t.filter(n=>n!=null&&!kr(n)).map(n=>this.options.convertDetectedLanguage(n)),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(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(e,this.options)}))}}wt.type="languageDetector";const vt={apiBaseUrl:"https://api.nemme.io",debug:!1},$r={Previous:"Previous",Next:"Next","Type your answer here":"Type your answer here","Max {{maxCharacters}} characters":"Max {{maxCharacters}} characters"},Dr={};Wn({locale:Xn}),T.use(wt).use(_t).init({debug:vt.debug,fallbackLng:"en",interpolation:{escapeValue:!1},resources:{en:{translation:$r},nb:{tranlation:Dr}}});const St={debug:0,info:1,warn:2,error:3};class Ee{constructor(e={}){S(this,"prefix");S(this,"enabled");S(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&&St[e]>=St[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 Ee({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 kt=new Ee,Lt=kt.child("network"),Ar=3e4,Vr=(i,e)=>{const t=new URL(i,vt.apiBaseUrl);return e&&Object.entries(e).forEach(([n,r])=>{r!=null&&t.searchParams.append(n,String(r))}),t.toString()},q={async request(i,e={}){const{method:t="GET",headers:n={},body:r,params:s,timeout:a=Ar}=e,o=Vr(i,s),c={"Content-Type":"application/json",Accept:"application/json",...n},l={method:t,headers:c,body:r?JSON.stringify(r):void 0},u=new AbortController,d=setTimeout(()=>u.abort(),a);l.signal=u.signal;try{const h=await fetch(o,l);let f;const g=h.headers.get("content-type");if(g&&g.includes("application/json"))f=await h.json();else{const w=await h.text();try{f=JSON.parse(w)}catch{f=w}}const y={data:f,status:h.status,statusText:h.statusText,headers:h.headers,ok:h.ok};if(h.ok)y.ok=!0;else{const w=`Request failed with status ${h.status}: ${h.statusText}`;Lt.error(w,{url:o,method:t,status:h.status,data:y.data}),y.ok=!1,y.error={message:w,details:y.data}}return y}catch(h){let f="Network request failed",g={};return h instanceof DOMException&&h.name==="AbortError"?(f=`Request timeout after ${a}ms`,g={timeout:a,url:o}):g={message:h instanceof Error?h.message:String(h),url:o,method:t},Lt.error(f,g),{data:{},status:0,statusText:f,headers:new Headers,ok:!1,error:{message:f,details:g}}}finally{clearTimeout(d)}},async get(i,e={}){return this.request(i,{...e,method:"GET"})},async post(i,e,t={}){return this.request(i,{...t,method:"POST",body:e})},async put(i,e,t={}){return this.request(i,{...t,method:"PUT",body:e})},async patch(i,e,t={}){return this.request(i,{...t,method:"PATCH",body:e})},async delete(i,e={}){return this.request(i,{...e,method:"DELETE"})}};class Ir{constructor(e,t){S(this,"logger");S(this,"headers");this.logger=e,this.headers=t}async fetchAndDisplayForm(e,t,n){this.logger.debug(`Fetching form config for: ${e}`);try{const r=await q.get(`/external/forms/${e}`,{headers:this.headers});r.ok&&r.data?(this.logger.info(`Form config loaded for: ${e}`,r.data),this.displayForm(r.data,t,n)):this.logger.warn(`No form config found for: ${e}`)}catch(r){this.logger.error(`Failed to fetch form config for: ${e}`,r)}}displayForm(e,t,n){const r=document.createElement("div");r.id="nm",document.body.appendChild(r);const s=Mt.createRoot(r),a=b.createElement(Jt,{i18n:T},b.createElement(Qt,{form:e,onDismiss:async o=>{await t(),await this.postFormResponse(e,o),s.unmount(),r.remove(),this.logger.info("Form dismissed",o)},onComplete:async o=>{await n(),await this.postFormResponse(e,o),s.unmount(),r.remove(),this.logger.info("Form completed",o)}}));s.render(a)}async postFormResponse(e,t){this.logger.info("Posting form response",t);const n=await q.post(`/external/forms/${e.slug}`,t,{headers:this.headers});this.logger.info("Form response posted",n.data)}}class Hr{constructor(e,t){S(this,"logger");S(this,"headers");S(this,"formManager");S(this,"deliveries",[]);this.logger=e,this.headers=t,this.formManager=new Ir(e,t)}async loadDeliveries(){try{this.logger.debug("Loading deliveries");const e=await q.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 n of t.triggers)if(this.shouldTriggerDelivery(n,e)){if(!await this.isDeliveryValid(t)){this.logger.debug(`Delivery ${t.id} is not valid, skipping`);continue}await this.executeDelivery(t,n);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 r=await this.createDeliveryResponse(e);await this.formManager.fetchAndDisplayForm(e.productSlug,async()=>{this.logger.debug(`Form for delivery: ${e.productSlug} was cancelled`),r&&await this.updateDeliveryResponse(e.id,r.id,!0)},async()=>{this.logger.debug(`Form for delivery: ${e.productSlug} was completed`),r&&await this.updateDeliveryResponse(e.id,r.id,!1,!0)})}catch(r){this.logger.error(`Failed to load form for delivery: ${e.productSlug}`,r)}}}matchesUrlPattern(e,t){let n;try{n=new URL(e).pathname}catch{n=e.startsWith("/")?e:`/${e}`}const r=t.replace(/\*\*/g,"§DOUBLE_STAR§").replace(/\*/g,"[^/]*").replace(/§DOUBLE_STAR§/g,".*").replace(/\?/g,"."),a=new RegExp(`^${r}$`).test(n);return this.logger.debug("URL pattern matching",{originalUrl:e,pathname:n,pattern:t,regexPattern:r,matches:a}),a}async createDeliveryResponse(e){try{return(await q.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,n=!1,r=!1){try{await q.patch(`/external/deliveries/${e}/responses/${t}`,{wasDismissed:n,wasCompleted:r},{headers:this.headers})}catch(s){this.logger.error(`Failed to update delivery response: ${t} for delivery: ${e}`,s)}}async isDeliveryValid(e){try{return(await q.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 Br{constructor({logger:e,headers:t,sessionId:n,eventDefinitions:r,batchConfig:s,onPageView:a}){S(this,"logger");S(this,"headers");S(this,"sessionId");S(this,"eventDefinitions",[]);S(this,"onPageView");S(this,"backlog",[]);S(this,"flushTimeout",null);S(this,"batchConfig",{enabled:!0,size:10,delayMs:1e4,sendOnUnload:!0});S(this,"originalHistoryMethods",null);S(this,"EVENT_PAGE_VIEW","page_view");this.logger=e,this.headers=t,this.sessionId=n,this.eventDefinitions=r,this.onPageView=a,this.flushEvents=this.flushEvents.bind(this),this.handlePopState=this.handlePopState.bind(this),this.handleVisibilityChange=this.handleVisibilityChange.bind(this),this.setupBatching(s)}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(...n)=>{e.apply(history,n),await this.trackPageView()};const t=history.replaceState;history.replaceState=async(...n)=>{t.apply(history,n),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:n={}}=e;this.logger.debug("Tracking event",{eventKey:t,data:n});const r={sessionId:this.sessionId,eventKey:t,data:n||{},timestamp:new Date().toISOString(),page:window.location.href};this.validateEvent(r),this.batchConfig.enabled?(this.backlog.push(r),this.scheduleFlush()):await this.sendEvents([r])}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(s=>s.eventKey===e.eventKey);if(!t){this.logger.warn(`Event ${e.eventKey} is not registered`);return}const n=t.properties,r=e.data;if(r)for(const s of Object.keys(r)){const a=r[s],o=n.find(c=>c.name===s);if(!o){this.logger.warn(`Property ${s} is not registered for event ${e.eventKey}`);return}o.type==="string"&&typeof a!="string"&&this.logger.warn(`Property ${o.name} has type ${o.type} but value is of type ${typeof a}`),o.type==="boolean"&&typeof a!="boolean"&&this.logger.warn(`Property ${o.name} has type ${o.type} but value is of type ${typeof a}`),o.type==="number"&&typeof a!="number"&&this.logger.warn(`Property ${o.name} has type ${o.type} but value is of type ${typeof a}`)}}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 q.post("/external/trackings/track",t,{headers:this.headers})}else await q.post("/external/trackings/batch",e,{headers:this.headers})}}class pe{constructor(e){S(this,"clientKey");S(this,"userIdentifier");S(this,"initialized",!1);S(this,"clientLogger",kt.child("client"));S(this,"headers",{});S(this,"trackingManager");this.clientKey=e}async init({userIdentifier:e,debug:t=!1,batch:n}){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 r=await this.initializeSession();await this.initializeManagers(r,n),this.initialized=!0,this.clientLogger.info("Nemme client initialized",{clientKey:this.clientKey,userIdentifier:this.userIdentifier})}catch(r){this.clientLogger.error("Error during initialization:",r)}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 q.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 n=new Hr(this.clientLogger,this.headers),r=new Br({logger:this.clientLogger,headers:this.headers,sessionId:e.sessionId,eventDefinitions:e.eventDefinitions,batchConfig:t,onPageView:async s=>{await n.evaluateDeliveryTriggers({url:s})}});await n.loadDeliveries(),typeof window<"u"&&(await r.setupPageViewTracking(),await r.trackPageView(),await r.flush()),this.trackingManager=r}}const Ot=i=>new pe(i),Et=b.createContext(void 0),qr=({clientKey:i,config:e,children:t})=>{const[n,r]=b.useState(null),[s,a]=b.useState(!1),[o,c]=b.useState(null);b.useEffect(()=>{let u=null,d=!1;const h=async()=>{try{const f=new pe(i);if(await f.init(e),d){f.destroy();return}u=f,r(f),a(!0),c(null)}catch(f){d||(c(f instanceof Error?f.message:"Failed to initialize Nemme client"),a(!1))}};return r(null),a(!1),c(null),h(),()=>{d=!0,u&&u.destroy()}},[i,e]);const l={client:n,isInitialized:s,error:o};return m.jsx(Et.Provider,{value:l,children:t})},Pt=()=>{const i=b.useContext(Et);if(i===void 0)throw new Error("useNemmeContext must be used within a NemmeProvider");return i},zr=()=>{const{client:i,isInitialized:e,error:t}=Pt(),n=b.useCallback(async s=>{if(!i||!e){console.warn("Nemme client not initialized");return}return i.track(s)},[i,e]),r=b.useCallback(async()=>{if(!i||!e){console.warn("Nemme client not initialized");return}return i.flush()},[i,e]);return{track:n,flush:r,isInitialized:e,error:t,client:i}},Ur=i=>Ot(i),Pe=Object.assign(i=>Ur(i),{NemmeClient:pe,init:async i=>{const{clientKey:e,...t}=i;return await Ot(e).init(t)}});typeof window<"u"&&(window.NemmeSDK=Pe),C.NemmeClient=pe,C.NemmeProvider=qr,C.NemmeSDK=Pe,C.default=Pe,C.useNemme=zr,C.useNemmeContext=Pt,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
68
26
|
//# sourceMappingURL=nemme-sdk.umd.js.map
|