@orderingstack/front-components-product-configurator 0.0.7 → 0.0.9

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/dist/index.cjs.js CHANGED
@@ -1,19 +1,8 @@
1
- "use strict";var $i=Object.defineProperty,Ui=Object.defineProperties;var Hi=Object.getOwnPropertyDescriptors;var Fr=Object.getOwnPropertySymbols;var Bi=Object.prototype.hasOwnProperty,Wi=Object.prototype.propertyIsEnumerable;var Ar=(e,r,t)=>r in e?$i(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ae=(e,r)=>{for(var t in r||(r={}))Bi.call(r,t)&&Ar(e,t,r[t]);if(Fr)for(var t of Fr(r))Wi.call(r,t)&&Ar(e,t,r[t]);return e},ze=(e,r)=>Ui(e,Hi(r));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var m=require("react"),Rr=require("react-spring"),zi=require("react-dom");function qi(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var he=qi(m);var vt=e=>e.type==="checkbox",et=e=>e instanceof Date,fe=e=>e==null;const Hn=e=>typeof e=="object";var oe=e=>!fe(e)&&!Array.isArray(e)&&Hn(e)&&!et(e),Gi=e=>oe(e)&&e.target?vt(e.target)?e.target.checked:e.target.value:e,Ki=e=>e.substring(0,e.search(/.\d/))||e,Qi=(e,r)=>[...e].some(t=>Ki(r)===t),$t=e=>e.filter(Boolean),ie=e=>e===void 0,F=(e,r,t)=>{if(!r||!oe(e))return t;const i=$t(r.split(/[,[\].]+?/)).reduce((n,a)=>fe(n)?n:n[a],e);return ie(i)||i===e?ie(e[r])?t:e[r]:i};const Tr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Oe={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Fe={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};var Ut=(e,r)=>{const t=Object.assign({},e);return delete t[r],t};const Bn=he.default.createContext(null),mt=()=>he.default.useContext(Bn),Ji=e=>he.default.createElement(Bn.Provider,{value:Ut(e,"children")},e.children);var Yi=(e,r,t,i=!0)=>{const n={};for(const a in e)Object.defineProperty(n,a,{get:()=>{const o=a;return r[o]!==Oe.all&&(r[o]=!i||Oe.all),t&&(t[o]=!0),e[o]}});return n},ge=e=>oe(e)&&!Object.keys(e).length,Zi=(e,r,t)=>{const i=Ut(e,"name");return ge(i)||Object.keys(i).length>=Object.keys(r).length||Object.keys(i).find(n=>r[n]===(!t||Oe.all))},er=e=>Array.isArray(e)?e:[e];function Xi(e){const r=he.default.useRef(e);r.current=e,he.default.useEffect(()=>{const t=n=>{n&&n.unsubscribe()},i=!e.disabled&&r.current.subject.subscribe({next:r.current.callback});return()=>t(i)},[e.disabled])}var Ne=e=>typeof e=="string",ea=(e,r,t,i)=>{const n=Array.isArray(e);return Ne(e)?(i&&r.watch.add(e),F(t,e)):n?e.map(a=>(i&&r.watch.add(a),F(t,a))):(i&&(r.watchAll=!0),t)},Ht=e=>typeof e=="function",Wn=e=>{for(const r in e)if(Ht(e[r]))return!0;return!1},ta=(e,r,t,i,n)=>r?Object.assign(Object.assign({},t[e]),{types:Object.assign(Object.assign({},t[e]&&t[e].types?t[e].types:{}),{[i]:n||!0})}):{},yr=e=>/^\w*$/.test(e),zn=e=>$t(e.replace(/["|']|\]/g,"").split(/\.|\[/));function te(e,r,t){let i=-1;const n=yr(r)?[r]:zn(r),a=n.length,o=a-1;for(;++i<a;){const s=n[i];let u=t;if(i!==o){const c=e[s];u=oe(c)||Array.isArray(c)?c:isNaN(+n[i+1])?{}:[]}e[s]=u,e=e[s]}return e}const dr=(e,r,t)=>{for(const i of t||Object.keys(e)){const n=F(e,i);if(n){const a=n._f,o=Ut(n,"_f");if(a&&r(a.name)){if(a.ref.focus&&ie(a.ref.focus()))break;if(a.refs){a.refs[0].focus();break}}else oe(o)&&dr(o,r)}}};var Mr=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));function Xe(e){let r;const t=Array.isArray(e);if(e instanceof Date)r=new Date(e);else if(e instanceof Set)r=new Set(e);else if(t||oe(e)){r=t?[]:{};for(const i in e){if(Ht(e[i])){r=e;break}r[i]=Xe(e[i])}}else return e;return r}function tr(){let e=[];return{get observers(){return e},next:n=>{for(const a of e)a.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(a=>a!==n)}}),unsubscribe:()=>{e=[]}}}var jt=e=>fe(e)||!Hn(e);function tt(e,r){if(jt(e)||jt(r))return e===r;if(et(e)&&et(r))return e.getTime()===r.getTime();const t=Object.keys(e),i=Object.keys(r);if(t.length!==i.length)return!1;for(const n of t){const a=e[n];if(!i.includes(n))return!1;if(n!=="ref"){const o=r[n];if(et(a)&&et(o)||oe(a)&&oe(o)||Array.isArray(a)&&Array.isArray(o)?!tt(a,o):a!==o)return!1}}return!0}var Dr=e=>({isOnSubmit:!e||e===Oe.onSubmit,isOnBlur:e===Oe.onBlur,isOnChange:e===Oe.onChange,isOnAll:e===Oe.all,isOnTouch:e===Oe.onTouched}),gt=e=>typeof e=="boolean",br=e=>e.type==="file",gr=e=>e instanceof HTMLElement,qn=e=>e.type==="select-multiple",Or=e=>e.type==="radio",ra=e=>Or(e)||vt(e),Ir=typeof window!="undefined"&&typeof window.HTMLElement!="undefined"&&typeof document!="undefined",rr=e=>gr(e)&&e.isConnected;function na(e,r){const t=r.slice(0,-1).length;let i=0;for(;i<t;)e=ie(e)?i++:e[r[i++]];return e}function le(e,r){const t=yr(r)?[r]:zn(r),i=t.length==1?e:na(e,t),n=t[t.length-1];let a;i&&delete i[n];for(let o=0;o<t.slice(0,-1).length;o++){let s=-1,u;const c=t.slice(0,-(o+1)),f=c.length-1;for(o>0&&(a=e);++s<c.length;){const l=c[s];u=u?u[l]:e[l],f===s&&(oe(u)&&ge(u)||Array.isArray(u)&&!u.filter(d=>oe(d)&&!ge(d)||gt(d)).length)&&(a?delete a[l]:delete e[l]),a=u}}return e}function Ft(e,r={}){const t=Array.isArray(e);if(oe(e)||t)for(const i in e)Array.isArray(e[i])||oe(e[i])&&!Wn(e[i])?(r[i]=Array.isArray(e[i])?[]:{},Ft(e[i],r[i])):fe(e[i])||(r[i]=!0);return r}function Gn(e,r,t){const i=Array.isArray(e);if(oe(e)||i)for(const n in e)Array.isArray(e[n])||oe(e[n])&&!Wn(e[n])?ie(r)||jt(t[n])?t[n]=Array.isArray(e[n])?Ft(e[n],[]):Object.assign({},Ft(e[n])):Gn(e[n],fe(r)?{}:r[n],t[n]):t[n]=!tt(e[n],r[n]);return t}var _r=(e,r)=>Gn(e,r,Ft(r));const Vr={value:!1,isValid:!1},$r={value:!0,isValid:!0};var Kn=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ie(e[0].attributes.value)?ie(e[0].value)||e[0].value===""?$r:{value:e[0].value,isValid:!0}:$r:Vr}return Vr},Qn=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:i})=>ie(e)?e:r?e===""?NaN:+e:t&&Ne(e)?new Date(e):i?i(e):e;const Ur={isValid:!1,value:null};var Jn=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,Ur):Ur;function nr(e){const r=e.ref;if(!(e.refs?e.refs.every(t=>t.disabled):r.disabled))return br(r)?r.files:Or(r)?Jn(e.refs).value:qn(r)?[...r.selectedOptions].map(({value:t})=>t):vt(r)?Kn(e.refs).value:Qn(ie(r.value)?e.ref.value:r.value,e)}var ia=(e,r,t,i)=>{const n={};for(const a of e){const o=F(r,a);o&&te(n,a,o._f)}return{criteriaMode:t,names:[...e],fields:n,shouldUseNativeValidation:i}},At=e=>e instanceof RegExp,it=e=>ie(e)?void 0:At(e)?e.source:oe(e)?At(e.value)?e.value.source:e.value:e,aa=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Hr(e,r,t){const i=F(e,t);if(i||yr(t))return{error:i,name:t};const n=t.split(".");for(;n.length;){const a=n.join("."),o=F(r,a),s=F(e,a);if(o&&!Array.isArray(o)&&t!==a)return{name:t};if(s&&s.type)return{name:a,error:s};n.pop()}return{name:t}}var oa=(e,r,t,i,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(r||e):(t?i.isOnBlur:n.isOnBlur)?!e:(t?i.isOnChange:n.isOnChange)?e:!0,sa=(e,r)=>!$t(F(e,r)).length&&le(e,r),Et=e=>Ne(e)||he.default.isValidElement(e);function Br(e,r,t="validate"){if(Et(e)||Array.isArray(e)&&e.every(Et)||gt(e)&&!e)return{type:t,message:Et(e)?e:"",ref:r}}var Je=e=>oe(e)&&!At(e)?e:{value:e,message:""},Wr=async(e,r,t,i)=>{const{ref:n,refs:a,required:o,maxLength:s,minLength:u,min:c,max:f,pattern:l,validate:d,name:g,valueAsNumber:p,mount:b,disabled:w}=e._f;if(!b||w)return{};const v=a?a[0]:n,x=k=>{i&&v.reportValidity&&(v.setCustomValidity(gt(k)?"":k||" "),v.reportValidity())},P={},N=Or(n),R=vt(n),M=N||R,D=(p||br(n))&&!n.value||r===""||Array.isArray(r)&&!r.length,_=ta.bind(null,g,t,P),T=(k,L,I,G=Fe.maxLength,U=Fe.minLength)=>{const Y=k?L:I;P[g]=Object.assign({type:k?G:U,message:Y,ref:n},_(k?G:U,Y))};if(o&&(!M&&(D||fe(r))||gt(r)&&!r||R&&!Kn(a).isValid||N&&!Jn(a).isValid)){const{value:k,message:L}=Et(o)?{value:!!o,message:o}:Je(o);if(k&&(P[g]=Object.assign({type:Fe.required,message:L,ref:v},_(Fe.required,L)),!t))return x(L),P}if(!D&&(!fe(c)||!fe(f))){let k,L;const I=Je(f),G=Je(c);if(isNaN(r)){const U=n.valueAsDate||new Date(r);Ne(I.value)&&(k=U>new Date(I.value)),Ne(G.value)&&(L=U<new Date(G.value))}else{const U=n.valueAsNumber||+r;fe(I.value)||(k=U>I.value),fe(G.value)||(L=U<G.value)}if((k||L)&&(T(!!k,I.message,G.message,Fe.max,Fe.min),!t))return x(P[g].message),P}if((s||u)&&!D&&Ne(r)){const k=Je(s),L=Je(u),I=!fe(k.value)&&r.length>k.value,G=!fe(L.value)&&r.length<L.value;if((I||G)&&(T(I,k.message,L.message),!t))return x(P[g].message),P}if(l&&!D&&Ne(r)){const{value:k,message:L}=Je(l);if(At(k)&&!r.match(k)&&(P[g]=Object.assign({type:Fe.pattern,message:L,ref:n},_(Fe.pattern,L)),!t))return x(L),P}if(d){if(Ht(d)){const k=await d(r),L=Br(k,v);if(L&&(P[g]=Object.assign(Object.assign({},L),_(Fe.validate,L.message)),!t))return x(L.message),P}else if(oe(d)){let k={};for(const L in d){if(!ge(k)&&!t)break;const I=Br(await d[L](r),v,L);I&&(k=Object.assign(Object.assign({},I),_(L,I.message)),x(I.message),t&&(P[g]=k))}if(!ge(k)&&(P[g]=Object.assign({ref:v},k),!t))return P}}return x(!0),P};const ua={mode:Oe.onSubmit,reValidateMode:Oe.onChange,shouldFocusError:!0};function la(e={}){let r=Object.assign(Object.assign({},ua),e),t={isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}},i={},n=r.defaultValues||{},a=r.shouldUnregister?{}:Xe(n),o={action:!1,mount:!1,watch:!1},s={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,c=0,f={};const l={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={watch:tr(),array:tr(),state:tr()},g=Dr(r.mode),p=Dr(r.reValidateMode),b=r.criteriaMode===Oe.all,w=(h,y)=>(...S)=>{clearTimeout(c),c=window.setTimeout(()=>h(...S),y)},v=async h=>{let y=!1;return l.isValid&&(y=r.resolver?ge((await D()).errors):await T(i,!0),!h&&y!==t.isValid&&(t.isValid=y,d.state.next({isValid:y}))),y},x=(h,y=[],S,E,j=!0,C=!0)=>{if(E&&S){if(o.action=!0,C&&Array.isArray(F(i,h))){const A=S(F(i,h),E.argA,E.argB);j&&te(i,h,A)}if(l.errors&&C&&Array.isArray(F(t.errors,h))){const A=S(F(t.errors,h),E.argA,E.argB);j&&te(t.errors,h,A),sa(t.errors,h)}if(l.touchedFields&&Array.isArray(F(t.touchedFields,h))){const A=S(F(t.touchedFields,h),E.argA,E.argB);j&&te(t.touchedFields,h,A)}l.dirtyFields&&(t.dirtyFields=_r(n,a)),d.state.next({isDirty:L(h,y),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else te(a,h,y)},P=(h,y)=>(te(t.errors,h,y),d.state.next({errors:t.errors})),N=(h,y,S,E)=>{const j=F(i,h);if(j){const C=F(a,h,ie(S)?F(n,h):S);ie(C)||E&&E.defaultChecked||y?te(a,h,y?C:nr(j._f)):U(h,C),o.mount&&v()}},R=(h,y,S,E,j)=>{let C=!1;const A={name:h},q=F(t.touchedFields,h);if(l.isDirty){const Re=t.isDirty;t.isDirty=A.isDirty=L(),C=Re!==A.isDirty}if(l.dirtyFields&&(!S||E)){const Re=F(t.dirtyFields,h);tt(F(n,h),y)?le(t.dirtyFields,h):te(t.dirtyFields,h,!0),A.dirtyFields=t.dirtyFields,C=C||Re!==F(t.dirtyFields,h)}return S&&!q&&(te(t.touchedFields,h,S),A.touchedFields=t.touchedFields,C=C||l.touchedFields&&q!==S),C&&j&&d.state.next(A),C?A:{}},M=async(h,y,S,E,j)=>{const C=F(t.errors,y),A=l.isValid&&t.isValid!==S;if(e.delayError&&E?(u=u||w(P,e.delayError),u(y,E)):(clearTimeout(c),E?te(t.errors,y,E):le(t.errors,y)),((E?!tt(C,E):C)||!ge(j)||A)&&!h){const q=Object.assign(Object.assign(Object.assign({},j),A?{isValid:S}:{}),{errors:t.errors,name:y});t=Object.assign(Object.assign({},t),q),d.state.next(q)}f[y]--,l.isValidating&&!Object.values(f).some(q=>q)&&(d.state.next({isValidating:!1}),f={})},D=async h=>r.resolver?await r.resolver(Object.assign({},a),r.context,ia(h||s.mount,i,r.criteriaMode,r.shouldUseNativeValidation)):{},_=async h=>{const{errors:y}=await D();if(h)for(const S of h){const E=F(y,S);E?te(t.errors,S,E):le(t.errors,S)}else t.errors=y;return y},T=async(h,y,S={valid:!0})=>{for(const E in h){const j=h[E];if(j){const C=j._f,A=Ut(j,"_f");if(C){const q=await Wr(j,F(a,C.name),b,r.shouldUseNativeValidation);if(q[C.name]&&(S.valid=!1,y))break;y||(q[C.name]?te(t.errors,C.name,q[C.name]):le(t.errors,C.name))}A&&await T(A,y,S)}}return S.valid},k=()=>{for(const h of s.unMount){const y=F(i,h);y&&(y._f.refs?y._f.refs.every(S=>!rr(S)):!rr(y._f.ref))&&H(h)}s.unMount=new Set},L=(h,y)=>(h&&y&&te(a,h,y),!tt(ne(),n)),I=(h,y,S)=>{const E=Object.assign({},o.mount?a:ie(y)?n:Ne(h)?{[h]:y}:y);return ea(h,s,E,S)},G=h=>$t(F(o.mount?a:n,h,e.shouldUnregister?F(n,h,[]):[])),U=(h,y,S={})=>{const E=F(i,h);let j=y;if(E){const C=E._f;C&&(!C.disabled&&te(a,h,Qn(y,C)),j=Ir&&gr(C.ref)&&fe(y)?"":y,qn(C.ref)?[...C.ref.options].forEach(A=>A.selected=j.includes(A.value)):C.refs?vt(C.ref)?C.refs.length>1?C.refs.forEach(A=>A.checked=Array.isArray(j)?!!j.find(q=>q===A.value):j===A.value):C.refs[0]&&(C.refs[0].checked=!!j):C.refs.forEach(A=>A.checked=A.value===j):br(C.ref)?C.ref.value="":(C.ref.value=j,C.ref.type||d.watch.next({name:h})))}(S.shouldDirty||S.shouldTouch)&&R(h,j,S.shouldTouch,S.shouldDirty,!0),S.shouldValidate&&X(h)},Y=(h,y,S)=>{for(const E in y){const j=y[E],C=`${h}.${E}`,A=F(i,C);(s.array.has(h)||!jt(j)||A&&!A._f)&&!et(j)?Y(C,j,S):U(C,j,S)}},re=(h,y,S={})=>{const E=F(i,h),j=s.array.has(h),C=Xe(y);te(a,h,C),j?(d.array.next({name:h,values:a}),(l.isDirty||l.dirtyFields)&&S.shouldDirty&&(t.dirtyFields=_r(n,a),d.state.next({name:h,dirtyFields:t.dirtyFields,isDirty:L(h,C)}))):E&&!E._f&&!fe(C)?Y(h,C,S):U(h,C,S),Mr(h,s)&&d.state.next({}),d.watch.next({name:h})},z=async h=>{const y=h.target;let S=y.name;const E=F(i,S);if(E){let j,C;const A=y.type?nr(E._f):Gi(h),q=h.type===Tr.BLUR||h.type===Tr.FOCUS_OUT,Re=!aa(E._f)&&!r.resolver&&!F(t.errors,S)&&!E._f.deps||oa(q,F(t.touchedFields,S),t.isSubmitted,p,g),wt=Mr(S,s,q);te(a,S,A),q?E._f.onBlur&&E._f.onBlur(h):E._f.onChange&&E._f.onChange(h);const Xt=R(S,A,q,!1),_i=!ge(Xt)||wt;if(!q&&d.watch.next({name:S,type:h.type}),Re)return _i&&d.state.next(Object.assign({name:S},wt?{}:Xt));if(!q&&wt&&d.state.next({}),f[S]=(f[S],1),d.state.next({isValidating:!0}),r.resolver){const{errors:Lr}=await D([S]),Vi=Hr(t.errors,i,S),jr=Hr(Lr,i,Vi.name||S);j=jr.error,S=jr.name,C=ge(Lr)}else j=(await Wr(E,F(a,S),b,r.shouldUseNativeValidation))[S],C=await v(!0);E._f.deps&&X(E._f.deps),M(!1,S,C,j,Xt)}},X=async(h,y={})=>{let S,E;const j=er(h);if(d.state.next({isValidating:!0}),r.resolver){const C=await _(ie(h)?h:j);S=ge(C),E=h?!j.some(A=>F(C,A)):S}else h?(E=(await Promise.all(j.map(async C=>{const A=F(i,C);return await T(A&&A._f?{[C]:A}:A)}))).every(Boolean),!(!E&&!t.isValid)&&v()):E=S=await T(i);return d.state.next(Object.assign(Object.assign(Object.assign({},!Ne(h)||l.isValid&&S!==t.isValid?{}:{name:h}),r.resolver?{isValid:S}:{}),{errors:t.errors,isValidating:!1})),y.shouldFocus&&!E&&dr(i,C=>F(t.errors,C),h?j:s.mount),E},ne=h=>{const y=Object.assign(Object.assign({},n),o.mount?a:{});return ie(h)?y:Ne(h)?F(y,h):h.map(S=>F(y,S))},ee=(h,y)=>({invalid:!!F((y||t).errors,h),isDirty:!!F((y||t).dirtyFields,h),isTouched:!!F((y||t).touchedFields,h),error:F((y||t).errors,h)}),W=h=>{h?er(h).forEach(y=>le(t.errors,y)):t.errors={},d.state.next({errors:t.errors})},K=(h,y,S)=>{const E=(F(i,h,{_f:{}})._f||{}).ref;te(t.errors,h,Object.assign(Object.assign({},y),{ref:E})),d.state.next({name:h,errors:t.errors,isValid:!1}),S&&S.shouldFocus&&E&&E.focus&&E.focus()},V=(h,y)=>Ht(h)?d.watch.subscribe({next:S=>h(I(void 0,y),S)}):I(h,y,!0),H=(h,y={})=>{for(const S of h?er(h):s.mount)s.mount.delete(S),s.array.delete(S),F(i,S)&&(y.keepValue||(le(i,S),le(a,S)),!y.keepError&&le(t.errors,S),!y.keepDirty&&le(t.dirtyFields,S),!y.keepTouched&&le(t.touchedFields,S),!r.shouldUnregister&&!y.keepDefaultValue&&le(n,S));d.watch.next({}),d.state.next(Object.assign(Object.assign({},t),y.keepDirty?{isDirty:L()}:{})),!y.keepIsValid&&v()},B=(h,y={})=>{let S=F(i,h);const E=gt(y.disabled);return te(i,h,{_f:Object.assign(Object.assign(Object.assign({},S&&S._f?S._f:{ref:{name:h}}),{name:h,mount:!0}),y)}),s.mount.add(h),S?E&&te(a,h,y.disabled?void 0:F(a,h,nr(S._f))):N(h,!0,y.value),Object.assign(Object.assign(Object.assign({},E?{disabled:y.disabled}:{}),r.shouldUseNativeValidation?{required:!!y.required,min:it(y.min),max:it(y.max),minLength:it(y.minLength),maxLength:it(y.maxLength),pattern:it(y.pattern)}:{}),{name:h,onChange:z,onBlur:z,ref:j=>{if(j){B(h,y),S=F(i,h);const C=ie(j.value)&&j.querySelectorAll&&j.querySelectorAll("input,select,textarea")[0]||j,A=ra(C),q=S._f.refs||[];if(A?q.find(Re=>Re===C):C===S._f.ref)return;te(i,h,{_f:Object.assign(Object.assign({},S._f),A?{refs:q.concat(C).filter(rr),ref:{type:C.type,name:h}}:{ref:C})}),N(h,!1,void 0,C)}else S=F(i,h,{}),S._f&&(S._f.mount=!1),(r.shouldUnregister||y.shouldUnregister)&&!(Qi(s.array,h)&&o.action)&&s.unMount.add(h)}})};return{control:{register:B,unregister:H,getFieldState:ee,_executeSchema:D,_getWatch:I,_getDirty:L,_updateValid:v,_removeUnmounted:k,_updateFieldArray:x,_getFieldArray:G,_subjects:d,_proxyFormState:l,get _fields(){return i},get _formValues(){return a},get _stateFlags(){return o},set _stateFlags(h){o=h},get _defaultValues(){return n},get _names(){return s},set _names(h){s=h},get _formState(){return t},set _formState(h){t=h},get _options(){return r},set _options(h){r=Object.assign(Object.assign({},r),h)}},trigger:X,register:B,handleSubmit:(h,y)=>async S=>{S&&(S.preventDefault&&S.preventDefault(),S.persist&&S.persist());let E=!0,j=Xe(a);d.state.next({isSubmitting:!0});try{if(r.resolver){const{errors:C,values:A}=await D();t.errors=C,j=A}else await T(i);ge(t.errors)&&Object.keys(t.errors).every(C=>F(j,C))?(d.state.next({errors:{},isSubmitting:!0}),await h(j,S)):(y&&await y(Object.assign({},t.errors),S),r.shouldFocusError&&dr(i,C=>F(t.errors,C),s.mount))}catch(C){throw E=!1,C}finally{t.isSubmitted=!0,d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ge(t.errors)&&E,submitCount:t.submitCount+1,errors:t.errors})}},watch:V,setValue:re,getValues:ne,reset:(h,y={})=>{const S=h||n,E=Xe(S),j=h&&!ge(h)?E:n;if(y.keepDefaultValues||(n=S),!y.keepValues){if(Ir&&ie(h))for(const C of s.mount){const A=F(i,C);if(A&&A._f){const q=Array.isArray(A._f.refs)?A._f.refs[0]:A._f.ref;try{gr(q)&&q.closest("form").reset();break}catch{}}}a=e.shouldUnregister?y.keepDefaultValues?Xe(n):{}:E,i={},d.array.next({values:j}),d.watch.next({values:j})}s={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!l.isValid||!!y.keepIsValid,o.watch=!!e.shouldUnregister,d.state.next({submitCount:y.keepSubmitCount?t.submitCount:0,isDirty:y.keepDirty?t.isDirty:y.keepDefaultValues?!tt(h,n):!1,isSubmitted:y.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:y.keepDirty?t.dirtyFields:y.keepDefaultValues&&h?Object.entries(h).reduce((C,[A,q])=>Object.assign(Object.assign({},C),{[A]:q!==F(n,A)}),{}):{},touchedFields:y.keepTouched?t.touchedFields:{},errors:y.keepErrors?t.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},resetField:(h,y={})=>{F(i,h)&&(ie(y.defaultValue)?re(h,F(n,h)):(re(h,y.defaultValue),te(n,h,y.defaultValue)),y.keepTouched||le(t.touchedFields,h),y.keepDirty||(le(t.dirtyFields,h),t.isDirty=y.defaultValue?L(h,F(n,h)):L()),y.keepError||(le(t.errors,h),l.isValid&&v()),d.state.next(Object.assign({},t)))},clearErrors:W,unregister:H,setError:K,setFocus:(h,y={})=>{const S=F(i,h)._f,E=S.refs?S.refs[0]:S.ref;y.shouldSelect?E.select():E.focus()},getFieldState:ee}}function ca(e={}){const r=he.default.useRef(),[t,i]=he.default.useState({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}});r.current?r.current.control._options=e:r.current=Object.assign(Object.assign({},la(e)),{formState:t});const n=r.current.control,a=he.default.useCallback(o=>{Zi(o,n._proxyFormState,!0)&&(n._formState=Object.assign(Object.assign({},n._formState),o),i(Object.assign({},n._formState)))},[n]);return Xi({subject:n._subjects.state,callback:a}),he.default.useEffect(()=>{n._stateFlags.mount||(n._proxyFormState.isValid&&n._updateValid(),n._stateFlags.mount=!0),n._stateFlags.watch&&(n._stateFlags.watch=!1,n._subjects.state.next({})),n._removeUnmounted()}),r.current.formState=Yi(t,n._proxyFormState),r.current}function Ie(e){return Ie=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ie(e)}function je(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ve(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function zr(e,r){for(var t=0;t<r.length;t++){var i=r[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function me(e,r,t){return r&&zr(e.prototype,r),t&&zr(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function qr(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function Gr(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?qr(Object(t),!0).forEach(function(i){je(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):qr(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}var hr={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0},Yn,fa=he.default.createContext();function da(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hr=Gr(Gr({},hr),e)}function ga(){return hr}var ha=function(){function e(){ve(this,e),this.usedNamespaces={}}return me(e,[{key:"addUsedNamespaces",value:function(t){var i=this;t.forEach(function(n){i.usedNamespaces[n]||(i.usedNamespaces[n]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),e}();function pa(e){Yn=e}function va(){return Yn}var ma={type:"3rdParty",init:function(r){da(r.options.react),pa(r)}};function ya(){if(console&&console.warn){for(var e,r=arguments.length,t=new Array(r),i=0;i<r;i++)t[i]=arguments[i];typeof t[0]=="string"&&(t[0]="react-i18next:: ".concat(t[0])),(e=console).warn.apply(e,t)}}var Kr={};function pr(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];typeof r[0]=="string"&&Kr[r[0]]||(typeof r[0]=="string"&&(Kr[r[0]]=new Date),ya.apply(void 0,r))}function Qr(e,r,t){e.loadNamespaces(r,function(){if(e.isInitialized)t();else{var i=function n(){setTimeout(function(){e.off("initialized",n)},0),t()};e.on("initialized",i)}})}function ba(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!r.languages||!r.languages.length)return pr("i18n.languages were undefined or empty",r.languages),!0;var i=r.languages[0],n=r.options?r.options.fallbackLng:!1,a=r.languages[r.languages.length-1];if(i.toLowerCase()==="cimode")return!0;var o=function(u,c){var f=r.services.backendConnector.state["".concat(u,"|").concat(c)];return f===-1||f===2};return t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!o(r.isLanguageChangingTo,e)?!1:!!(r.hasResourceBundle(i,e)||!r.services.backendConnector.backend||o(i,e)&&(!n||o(a,e)))}function Zn(e){if(Array.isArray(e))return e}function Oa(e,r){var t=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var i=[],n=!0,a=!1,o,s;try{for(t=t.call(e);!(n=(o=t.next()).done)&&(i.push(o.value),!(r&&i.length===r));n=!0);}catch(u){a=!0,s=u}finally{try{!n&&t.return!=null&&t.return()}finally{if(a)throw s}}return i}}function Jr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,i=new Array(r);t<r;t++)i[t]=e[t];return i}function Xn(e,r){if(!!e){if(typeof e=="string")return Jr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Jr(e,r)}}function ei(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sa(e,r){return Zn(e)||Oa(e,r)||Xn(e,r)||ei()}function Yr(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function ir(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Yr(Object(t),!0).forEach(function(i){je(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Yr(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function Bt(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=r.i18n,i=m.useContext(fa)||{},n=i.i18n,a=i.defaultNS,o=t||n||va();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new ha),!o){pr("You will need to pass in an i18next instance by using initReactI18next");var s=function(D){return Array.isArray(D)?D[D.length-1]:D},u=[s,{},!1];return u.t=s,u.i18n={},u.ready=!1,u}o.options.react&&o.options.react.wait!==void 0&&pr("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var c=ir(ir(ir({},ga()),o.options.react),r),f=c.useSuspense,l=c.keyPrefix,d=e||a||o.options&&o.options.defaultNS;d=typeof d=="string"?[d]:d||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(d);var g=(o.isInitialized||o.initializedStoreOnce)&&d.every(function(M){return ba(M,o,c)});function p(){return o.getFixedT(null,c.nsMode==="fallback"?d:d[0],l)}var b=m.useState(p),w=Sa(b,2),v=w[0],x=w[1],P=m.useRef(!0);m.useEffect(function(){var M=c.bindI18n,D=c.bindI18nStore;P.current=!0,!g&&!f&&Qr(o,d,function(){P.current&&x(p)});function _(){P.current&&x(p)}return M&&o&&o.on(M,_),D&&o&&o.store.on(D,_),function(){P.current=!1,M&&o&&M.split(" ").forEach(function(T){return o.off(T,_)}),D&&o&&D.split(" ").forEach(function(T){return o.store.off(T,_)})}},[o,d.join()]);var N=m.useRef(!0);m.useEffect(function(){P.current&&!N.current&&x(p),N.current=!1},[o]);var R=[v,o,g];if(R.t=v,R.i18n=o,R.ready=g,g||!g&&!f)return R;throw new Promise(function(M){Qr(o,d,function(){M()})})}function _e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vr(e,r){return vr=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},vr(e,r)}function Wt(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&vr(e,r)}function yt(e,r){if(r&&(Ie(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _e(e)}function Le(e){return Le=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Le(e)}function wa(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function xa(e){return Zn(e)||wa(e)||Xn(e)||ei()}function Zr(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function Xr(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Zr(Object(t),!0).forEach(function(i){je(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Zr(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}var Ca={type:"logger",log:function(r){this.output("log",r)},warn:function(r){this.output("warn",r)},error:function(r){this.output("error",r)},output:function(r,t){console&&console[r]&&console[r].apply(console,t)}},Pa=function(){function e(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ve(this,e),this.init(r,t)}return me(e,[{key:"init",value:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=i.prefix||"i18next:",this.logger=t||Ca,this.options=i,this.debug=i.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return this.forward(i,"log","",!0)}},{key:"warn",value:function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return this.forward(i,"warn","",!0)}},{key:"error",value:function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return this.forward(i,"error","")}},{key:"deprecate",value:function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return this.forward(i,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(t,i,n,a){return a&&!this.debug?null:(typeof t[0]=="string"&&(t[0]="".concat(n).concat(this.prefix," ").concat(t[0])),this.logger[i](t))}},{key:"create",value:function(t){return new e(this.logger,Xr(Xr({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}}]),e}(),ke=new Pa,He=function(){function e(){ve(this,e),this.observers={}}return me(e,[{key:"on",value:function(t,i){var n=this;return t.split(" ").forEach(function(a){n.observers[a]=n.observers[a]||[],n.observers[a].push(i)}),this}},{key:"off",value:function(t,i){if(!!this.observers[t]){if(!i){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(function(n){return n!==i})}}},{key:"emit",value:function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];if(this.observers[t]){var o=[].concat(this.observers[t]);o.forEach(function(u){u.apply(void 0,n)})}if(this.observers["*"]){var s=[].concat(this.observers["*"]);s.forEach(function(u){u.apply(u,[t].concat(n))})}}}]),e}();function at(){var e,r,t=new Promise(function(i,n){e=i,r=n});return t.resolve=e,t.reject=r,t}function en(e){return e==null?"":""+e}function Na(e,r,t){e.forEach(function(i){r[i]&&(t[i]=r[i])})}function Sr(e,r,t){function i(s){return s&&s.indexOf("###")>-1?s.replace(/###/g,"."):s}function n(){return!e||typeof e=="string"}for(var a=typeof r!="string"?[].concat(r):r.split(".");a.length>1;){if(n())return{};var o=i(a.shift());!e[o]&&t&&(e[o]=new t),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={}}return n()?{}:{obj:e,k:i(a.shift())}}function tn(e,r,t){var i=Sr(e,r,Object),n=i.obj,a=i.k;n[a]=t}function ka(e,r,t,i){var n=Sr(e,r,Object),a=n.obj,o=n.k;a[o]=a[o]||[],i&&(a[o]=a[o].concat(t)),i||a[o].push(t)}function Rt(e,r){var t=Sr(e,r),i=t.obj,n=t.k;if(!!i)return i[n]}function rn(e,r,t){var i=Rt(e,t);return i!==void 0?i:Rt(r,t)}function ti(e,r,t){for(var i in r)i!=="__proto__"&&i!=="constructor"&&(i in e?typeof e[i]=="string"||e[i]instanceof String||typeof r[i]=="string"||r[i]instanceof String?t&&(e[i]=r[i]):ti(e[i],r[i],t):e[i]=r[i]);return e}function Ye(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Ea={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function La(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,function(r){return Ea[r]}):e}var zt=typeof window!="undefined"&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,ja=[" ",",","?","!",";"];function Fa(e,r,t){r=r||"",t=t||"";var i=ja.filter(function(s){return r.indexOf(s)<0&&t.indexOf(s)<0});if(i.length===0)return!0;var n=new RegExp("(".concat(i.map(function(s){return s==="?"?"\\?":s}).join("|"),")")),a=!n.test(e);if(!a){var o=e.indexOf(t);o>0&&!n.test(e.substring(0,o))&&(a=!0)}return a}function nn(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function xt(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?nn(Object(t),!0).forEach(function(i){je(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):nn(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function Aa(e){var r=Ra();return function(){var i=Le(e),n;if(r){var a=Le(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return yt(this,n)}}function Ra(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ri(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!!e){if(e[r])return e[r];for(var i=r.split(t),n=e,a=0;a<i.length;++a){if(!n||typeof n[i[a]]=="string"&&a+1<i.length)return;if(n[i[a]]===void 0){for(var o=2,s=i.slice(a,a+o).join(t),u=n[s];u===void 0&&i.length>a+o;)o++,s=i.slice(a,a+o).join(t),u=n[s];if(u===void 0)return;if(r.endsWith(s)){if(typeof u=="string")return u;if(s&&typeof u[s]=="string")return u[s]}var c=i.slice(a+o).join(t);return c?ri(u,c,t):void 0}n=n[i[a]]}return n}}var Ta=function(e){Wt(t,e);var r=Aa(t);function t(i){var n,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return ve(this,t),n=r.call(this),zt&&He.call(_e(n)),n.data=i||{},n.options=a,n.options.keySeparator===void 0&&(n.options.keySeparator="."),n.options.ignoreJSONStructure===void 0&&(n.options.ignoreJSONStructure=!0),n}return me(t,[{key:"addNamespaces",value:function(n){this.options.ns.indexOf(n)<0&&this.options.ns.push(n)}},{key:"removeNamespaces",value:function(n){var a=this.options.ns.indexOf(n);a>-1&&this.options.ns.splice(a,1)}},{key:"getResource",value:function(n,a,o){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},u=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,c=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure,f=[n,a];o&&typeof o!="string"&&(f=f.concat(o)),o&&typeof o=="string"&&(f=f.concat(u?o.split(u):o)),n.indexOf(".")>-1&&(f=n.split("."));var l=Rt(this.data,f);return l||!c||typeof o!="string"?l:ri(this.data&&this.data[n]&&this.data[n][a],o,u)}},{key:"addResource",value:function(n,a,o,s){var u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},c=this.options.keySeparator;c===void 0&&(c=".");var f=[n,a];o&&(f=f.concat(c?o.split(c):o)),n.indexOf(".")>-1&&(f=n.split("."),s=a,a=f[1]),this.addNamespaces(a),tn(this.data,f,s),u.silent||this.emit("added",n,a,o,s)}},{key:"addResources",value:function(n,a,o){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var u in o)(typeof o[u]=="string"||Object.prototype.toString.apply(o[u])==="[object Array]")&&this.addResource(n,a,u,o[u],{silent:!0});s.silent||this.emit("added",n,a,o)}},{key:"addResourceBundle",value:function(n,a,o,s,u){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},f=[n,a];n.indexOf(".")>-1&&(f=n.split("."),s=o,o=a,a=f[1]),this.addNamespaces(a);var l=Rt(this.data,f)||{};s?ti(l,o,u):l=xt(xt({},l),o),tn(this.data,f,l),c.silent||this.emit("added",n,a,o)}},{key:"removeResourceBundle",value:function(n,a){this.hasResourceBundle(n,a)&&delete this.data[n][a],this.removeNamespaces(a),this.emit("removed",n,a)}},{key:"hasResourceBundle",value:function(n,a){return this.getResource(n,a)!==void 0}},{key:"getResourceBundle",value:function(n,a){return a||(a=this.options.defaultNS),this.options.compatibilityAPI==="v1"?xt(xt({},{}),this.getResource(n,a)):this.getResource(n,a)}},{key:"getDataByLanguage",value:function(n){return this.data[n]}},{key:"hasLanguageSomeTranslations",value:function(n){var a=this.getDataByLanguage(n),o=a&&Object.keys(a)||[];return!!o.find(function(s){return a[s]&&Object.keys(a[s]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),t}(He),ni={processors:{},addPostProcessor:function(r){this.processors[r.name]=r},handle:function(r,t,i,n,a){var o=this;return r.forEach(function(s){o.processors[s]&&(t=o.processors[s].process(t,i,n,a))}),t}};function an(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function de(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?an(Object(t),!0).forEach(function(i){je(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):an(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function Ma(e){var r=Da();return function(){var i=Le(e),n;if(r){var a=Le(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return yt(this,n)}}function Da(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var on={},sn=function(e){Wt(t,e);var r=Ma(t);function t(i){var n,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ve(this,t),n=r.call(this),zt&&He.call(_e(n)),Na(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],i,_e(n)),n.options=a,n.options.keySeparator===void 0&&(n.options.keySeparator="."),n.logger=ke.create("translator"),n}return me(t,[{key:"changeLanguage",value:function(n){n&&(this.language=n)}},{key:"exists",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(n==null)return!1;var o=this.resolve(n,a);return o&&o.res!==void 0}},{key:"extractFromKey",value:function(n,a){var o=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");var s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,u=a.ns||this.options.defaultNS||[],c=o&&n.indexOf(o)>-1,f=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!Fa(n,o,s);if(c&&!f){var l=n.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:n,namespaces:u};var d=n.split(o);(o!==s||o===s&&this.options.ns.indexOf(d[0])>-1)&&(u=d.shift()),n=d.join(s)}return typeof u=="string"&&(u=[u]),{key:n,namespaces:u}}},{key:"translate",value:function(n,a,o){var s=this;if(Ie(a)!=="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),a||(a={}),n==null)return"";Array.isArray(n)||(n=[String(n)]);var u=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=this.extractFromKey(n[n.length-1],a),f=c.key,l=c.namespaces,d=l[l.length-1],g=a.lng||this.language,p=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(g&&g.toLowerCase()==="cimode"){if(p){var b=a.nsSeparator||this.options.nsSeparator;return d+b+f}return f}var w=this.resolve(n,a),v=w&&w.res,x=w&&w.usedKey||f,P=w&&w.exactUsedKey||f,N=Object.prototype.toString.apply(v),R=["[object Number]","[object Function]","[object RegExp]"],M=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,D=!this.i18nFormat||this.i18nFormat.handleAsObject,_=typeof v!="string"&&typeof v!="boolean"&&typeof v!="number";if(D&&v&&_&&R.indexOf(N)<0&&!(typeof M=="string"&&N==="[object Array]")){if(!a.returnObjects&&!this.options.returnObjects)return this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,v,de(de({},a),{},{ns:l})):"key '".concat(f," (").concat(this.language,")' returned an object instead of string.");if(u){var T=N==="[object Array]",k=T?[]:{},L=T?P:x;for(var I in v)if(Object.prototype.hasOwnProperty.call(v,I)){var G="".concat(L).concat(u).concat(I);k[I]=this.translate(G,de(de({},a),{joinArrays:!1,ns:l})),k[I]===G&&(k[I]=v[I])}v=k}}else if(D&&typeof M=="string"&&N==="[object Array]")v=v.join(M),v&&(v=this.extendTranslation(v,n,a,o));else{var U=!1,Y=!1,re=a.count!==void 0&&typeof a.count!="string",z=t.hasDefaultValue(a),X=re?this.pluralResolver.getSuffix(g,a.count,a):"",ne=a["defaultValue".concat(X)]||a.defaultValue;!this.isValidLookup(v)&&z&&(U=!0,v=ne),this.isValidLookup(v)||(Y=!0,v=f);var ee=a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,W=ee&&Y?void 0:v,K=z&&ne!==v&&this.options.updateMissing;if(Y||U||K){if(this.logger.log(K?"updateKey":"missingKey",g,d,f,K?ne:v),u){var V=this.resolve(f,de(de({},a),{},{keySeparator:!1}));V&&V.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.")}var H=[],B=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&B&&B[0])for(var ye=0;ye<B.length;ye++)H.push(B[ye]);else this.options.saveMissingTo==="all"?H=this.languageUtils.toResolveHierarchy(a.lng||this.language):H.push(a.lng||this.language);var Zt=function(We,h,y){var S=z&&y!==v?y:W;s.options.missingKeyHandler?s.options.missingKeyHandler(We,d,h,S,K,a):s.backendConnector&&s.backendConnector.saveMissing&&s.backendConnector.saveMissing(We,d,h,S,K,a),s.emit("missingKey",We,d,h,v)};this.options.saveMissing&&(this.options.saveMissingPlurals&&re?H.forEach(function(St){s.pluralResolver.getSuffixes(St).forEach(function(We){Zt([St],f+We,a["defaultValue".concat(We)]||ne)})}):Zt(H,f,ne))}v=this.extendTranslation(v,n,a,w,o),Y&&v===f&&this.options.appendNamespaceToMissingKey&&(v="".concat(d,":").concat(f)),(Y||U)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?v=this.options.parseMissingKeyHandler(f,U?v:void 0):v=this.options.parseMissingKeyHandler(v))}return v}},{key:"extendTranslation",value:function(n,a,o,s,u){var c=this;if(this.i18nFormat&&this.i18nFormat.parse)n=this.i18nFormat.parse(n,o,s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init(de(de({},o),{interpolation:de(de({},this.options.interpolation),o.interpolation)}));var f=typeof n=="string"&&(o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),l;if(f){var d=n.match(this.interpolator.nestingRegexp);l=d&&d.length}var g=o.replace&&typeof o.replace!="string"?o.replace:o;if(this.options.interpolation.defaultVariables&&(g=de(de({},this.options.interpolation.defaultVariables),g)),n=this.interpolator.interpolate(n,g,o.lng||this.language,o),f){var p=n.match(this.interpolator.nestingRegexp),b=p&&p.length;l<b&&(o.nest=!1)}o.nest!==!1&&(n=this.interpolator.nest(n,function(){for(var x=arguments.length,P=new Array(x),N=0;N<x;N++)P[N]=arguments[N];return u&&u[0]===P[0]&&!o.context?(c.logger.warn("It seems you are nesting recursively key: ".concat(P[0]," in key: ").concat(a[0])),null):c.translate.apply(c,P.concat([a]))},o)),o.interpolation&&this.interpolator.reset()}var w=o.postProcess||this.options.postProcess,v=typeof w=="string"?[w]:w;return n!=null&&v&&v.length&&o.applyPostProcessor!==!1&&(n=ni.handle(v,n,a,this.options&&this.options.postProcessPassResolved?de({i18nResolved:s},o):o,this)),n}},{key:"resolve",value:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s,u,c,f,l;return typeof n=="string"&&(n=[n]),n.forEach(function(d){if(!a.isValidLookup(s)){var g=a.extractFromKey(d,o),p=g.key;u=p;var b=g.namespaces;a.options.fallbackNS&&(b=b.concat(a.options.fallbackNS));var w=o.count!==void 0&&typeof o.count!="string",v=w&&!o.ordinal&&o.count===0&&a.pluralResolver.shouldUseIntlApi(),x=o.context!==void 0&&(typeof o.context=="string"||typeof o.context=="number")&&o.context!=="",P=o.lngs?o.lngs:a.languageUtils.toResolveHierarchy(o.lng||a.language,o.fallbackLng);b.forEach(function(N){a.isValidLookup(s)||(l=N,!on["".concat(P[0],"-").concat(N)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(l)&&(on["".concat(P[0],"-").concat(N)]=!0,a.logger.warn('key "'.concat(u,'" for languages "').concat(P.join(", "),`" won't get resolved as namespace "`).concat(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!!!")),P.forEach(function(R){if(!a.isValidLookup(s)){f=R;var M=[p];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(M,p,R,N,o);else{var D;w&&(D=a.pluralResolver.getSuffix(R,o.count,o));var _="_zero";if(w&&(M.push(p+D),v&&M.push(p+_)),x){var T="".concat(p).concat(a.options.contextSeparator).concat(o.context);M.push(T),w&&(M.push(T+D),v&&M.push(T+_))}}for(var k;k=M.pop();)a.isValidLookup(s)||(c=k,s=a.getResource(R,N,k,o))}}))})}}),{res:s,usedKey:u,exactUsedKey:c,usedLng:f,usedNS:l}}},{key:"isValidLookup",value:function(n){return n!==void 0&&!(!this.options.returnNull&&n===null)&&!(!this.options.returnEmptyString&&n==="")}},{key:"getResource",value:function(n,a,o){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(n,a,o,s):this.resourceStore.getResource(n,a,o,s)}}],[{key:"hasDefaultValue",value:function(n){var a="defaultValue";for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o)&&a===o.substring(0,a.length)&&n[o]!==void 0)return!0;return!1}}]),t}(He);function ar(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ia=function(){function e(r){ve(this,e),this.options=r,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ke.create("languageUtils")}return me(e,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var i=t.split("-");return i.length===2||(i.pop(),i[i.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(i.join("-"))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var i=t.split("-");return this.formatLanguageCode(i[0])}},{key:"formatLanguageCode",value:function(t){if(typeof t=="string"&&t.indexOf("-")>-1){var i=["hans","hant","latn","cyrl","cans","mong","arab"],n=t.split("-");return this.options.lowerCaseLng?n=n.map(function(a){return a.toLowerCase()}):n.length===2?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),i.indexOf(n[1].toLowerCase())>-1&&(n[1]=ar(n[1].toLowerCase()))):n.length===3&&(n[0]=n[0].toLowerCase(),n[1].length===2&&(n[1]=n[1].toUpperCase()),n[0]!=="sgn"&&n[2].length===2&&(n[2]=n[2].toUpperCase()),i.indexOf(n[1].toLowerCase())>-1&&(n[1]=ar(n[1].toLowerCase())),i.indexOf(n[2].toLowerCase())>-1&&(n[2]=ar(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isSupportedCode",value:function(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var i=this;if(!t)return null;var n;return t.forEach(function(a){if(!n){var o=i.formatLanguageCode(a);(!i.options.supportedLngs||i.isSupportedCode(o))&&(n=o)}}),!n&&this.options.supportedLngs&&t.forEach(function(a){if(!n){var o=i.getLanguagePartFromCode(a);if(i.isSupportedCode(o))return n=o;n=i.options.supportedLngs.find(function(s){if(s.indexOf(o)===0)return s})}}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}},{key:"getFallbackCodes",value:function(t,i){if(!t)return[];if(typeof t=="function"&&(t=t(i)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!i)return t.default||[];var n=t[i];return n||(n=t[this.getScriptPartFromCode(i)]),n||(n=t[this.formatLanguageCode(i)]),n||(n=t[this.getLanguagePartFromCode(i)]),n||(n=t.default),n||[]}},{key:"toResolveHierarchy",value:function(t,i){var n=this,a=this.getFallbackCodes(i||this.options.fallbackLng||[],t),o=[],s=function(c){!c||(n.isSupportedCode(c)?o.push(c):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(c)))};return typeof t=="string"&&t.indexOf("-")>-1?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):typeof t=="string"&&s(this.formatLanguageCode(t)),a.forEach(function(u){o.indexOf(u)<0&&s(n.formatLanguageCode(u))}),o}}]),e}(),_a=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Va={1:function(r){return Number(r>1)},2:function(r){return Number(r!=1)},3:function(r){return 0},4:function(r){return Number(r%10==1&&r%100!=11?0:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?1:2)},5:function(r){return Number(r==0?0:r==1?1:r==2?2:r%100>=3&&r%100<=10?3:r%100>=11?4:5)},6:function(r){return Number(r==1?0:r>=2&&r<=4?1:2)},7:function(r){return Number(r==1?0:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?1:2)},8:function(r){return Number(r==1?0:r==2?1:r!=8&&r!=11?2:3)},9:function(r){return Number(r>=2)},10:function(r){return Number(r==1?0:r==2?1:r<7?2:r<11?3:4)},11:function(r){return Number(r==1||r==11?0:r==2||r==12?1:r>2&&r<20?2:3)},12:function(r){return Number(r%10!=1||r%100==11)},13:function(r){return Number(r!==0)},14:function(r){return Number(r==1?0:r==2?1:r==3?2:3)},15:function(r){return Number(r%10==1&&r%100!=11?0:r%10>=2&&(r%100<10||r%100>=20)?1:2)},16:function(r){return Number(r%10==1&&r%100!=11?0:r!==0?1:2)},17:function(r){return Number(r==1||r%10==1&&r%100!=11?0:1)},18:function(r){return Number(r==0?0:r==1?1:2)},19:function(r){return Number(r==1?0:r==0||r%100>1&&r%100<11?1:r%100>10&&r%100<20?2:3)},20:function(r){return Number(r==1?0:r==0||r%100>0&&r%100<20?1:2)},21:function(r){return Number(r%100==1?1:r%100==2?2:r%100==3||r%100==4?3:0)},22:function(r){return Number(r==1?0:r==2?1:(r<0||r>10)&&r%10==0?2:3)}},$a=["v1","v2","v3"],un={zero:0,one:1,two:2,few:3,many:4,other:5};function Ua(){var e={};return _a.forEach(function(r){r.lngs.forEach(function(t){e[t]={numbers:r.nr,plurals:Va[r.fc]}})}),e}var Ha=function(){function e(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ve(this,e),this.languageUtils=r,this.options=t,this.logger=ke.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl=="undefined"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Ua()}return me(e,[{key:"addRule",value:function(t,i){this.rules[t]=i}},{key:"getRule",value:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(t,{type:i.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=this.getRule(t,i);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,n).map(function(a){return"".concat(i).concat(a)})}},{key:"getSuffixes",value:function(t){var i=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.getRule(t,n);return a?this.shouldUseIntlApi()?a.resolvedOptions().pluralCategories.sort(function(o,s){return un[o]-un[s]}).map(function(o){return"".concat(i.options.prepend).concat(o)}):a.numbers.map(function(o){return i.getSuffix(t,o,n)}):[]}},{key:"getSuffix",value:function(t,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=this.getRule(t,n);return a?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(a.select(i)):this.getSuffixRetroCompatible(a,i):(this.logger.warn("no plural rule found for: ".concat(t)),"")}},{key:"getSuffixRetroCompatible",value:function(t,i){var n=this,a=t.noAbs?t.plurals(i):t.plurals(Math.abs(i)),o=t.numbers[a];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));var s=function(){return n.options.prepend&&o.toString()?n.options.prepend+o.toString():o.toString()};return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?"_plural_".concat(o.toString()):s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?s():this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString()}},{key:"shouldUseIntlApi",value:function(){return!$a.includes(this.options.compatibilityJSON)}}]),e}();function ln(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function be(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?ln(Object(t),!0).forEach(function(i){je(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ln(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}var Ba=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ve(this,e),this.logger=ke.create("interpolator"),this.options=r,this.format=r.interpolation&&r.interpolation.format||function(t){return t},this.init(r)}return me(e,[{key:"init",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var i=t.interpolation;this.escape=i.escape!==void 0?i.escape:La,this.escapeValue=i.escapeValue!==void 0?i.escapeValue:!0,this.useRawValueToEscape=i.useRawValueToEscape!==void 0?i.useRawValueToEscape:!1,this.prefix=i.prefix?Ye(i.prefix):i.prefixEscaped||"{{",this.suffix=i.suffix?Ye(i.suffix):i.suffixEscaped||"}}",this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||",",this.unescapePrefix=i.unescapeSuffix?"":i.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":i.unescapeSuffix||"",this.nestingPrefix=i.nestingPrefix?Ye(i.nestingPrefix):i.nestingPrefixEscaped||Ye("$t("),this.nestingSuffix=i.nestingSuffix?Ye(i.nestingSuffix):i.nestingSuffixEscaped||Ye(")"),this.nestingOptionsSeparator=i.nestingOptionsSeparator?i.nestingOptionsSeparator:i.nestingOptionsSeparator||",",this.maxReplaces=i.maxReplaces?i.maxReplaces:1e3,this.alwaysFormat=i.alwaysFormat!==void 0?i.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var i="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(i,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(t,i,n,a){var o=this,s,u,c,f=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function l(w){return w.replace(/\$/g,"$$$$")}var d=function(v){if(v.indexOf(o.formatSeparator)<0){var x=rn(i,f,v);return o.alwaysFormat?o.format(x,void 0,n,be(be(be({},a),i),{},{interpolationkey:v})):x}var P=v.split(o.formatSeparator),N=P.shift().trim(),R=P.join(o.formatSeparator).trim();return o.format(rn(i,f,N),R,n,be(be(be({},a),i),{},{interpolationkey:N}))};this.resetRegExp();var g=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,p=a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,b=[{regex:this.regexpUnescape,safeValue:function(v){return l(v)}},{regex:this.regexp,safeValue:function(v){return o.escapeValue?l(o.escape(v)):l(v)}}];return b.forEach(function(w){for(c=0;s=w.regex.exec(t);){var v=s[1].trim();if(u=d(v),u===void 0)if(typeof g=="function"){var x=g(t,s,a);u=typeof x=="string"?x:""}else if(a&&a.hasOwnProperty(v))u="";else if(p){u=s[0];continue}else o.logger.warn("missed to pass in variable ".concat(v," for interpolating ").concat(t)),u="";else typeof u!="string"&&!o.useRawValueToEscape&&(u=en(u));var P=w.safeValue(u);if(t=t.replace(s[0],P),p?(w.regex.lastIndex+=P.length,w.regex.lastIndex-=s[0].length):w.regex.lastIndex=0,c++,c>=o.maxReplaces)break}}),t}},{key:"nest",value:function(t,i){var n=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,s,u=be({},a);u.applyPostProcessor=!1,delete u.defaultValue;function c(g,p){var b=this.nestingOptionsSeparator;if(g.indexOf(b)<0)return g;var w=g.split(new RegExp("".concat(b,"[ ]*{"))),v="{".concat(w[1]);g=w[0],v=this.interpolate(v,u),v=v.replace(/'/g,'"');try{u=JSON.parse(v),p&&(u=be(be({},p),u))}catch(x){return this.logger.warn("failed parsing options string in nesting for key ".concat(g),x),"".concat(g).concat(b).concat(v)}return delete u.defaultValue,g}for(;o=this.nestingRegexp.exec(t);){var f=[],l=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){var d=o[1].split(this.formatSeparator).map(function(g){return g.trim()});o[1]=d.shift(),f=d,l=!0}if(s=i(c.call(this,o[1].trim(),u),u),s&&o[0]===t&&typeof s!="string")return s;typeof s!="string"&&(s=en(s)),s||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),s=""),l&&(s=f.reduce(function(g,p){return n.format(g,p,a.lng,be(be({},a),{},{interpolationkey:o[1].trim()}))},s.trim())),t=t.replace(o[0],s),this.regexp.lastIndex=0}return t}}]),e}();function cn(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function Te(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?cn(Object(t),!0).forEach(function(i){je(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):cn(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function Wa(e){var r=e.toLowerCase().trim(),t={};if(e.indexOf("(")>-1){var i=e.split("(");r=i[0].toLowerCase().trim();var n=i[1].substring(0,i[1].length-1);if(r==="currency"&&n.indexOf(":")<0)t.currency||(t.currency=n.trim());else if(r==="relativetime"&&n.indexOf(":")<0)t.range||(t.range=n.trim());else{var a=n.split(";");a.forEach(function(o){if(!!o){var s=o.split(":"),u=xa(s),c=u[0],f=u.slice(1),l=f.join(":");l.trim()==="false"&&(t[c.trim()]=!1),l.trim()==="true"&&(t[c.trim()]=!0),isNaN(l.trim())||(t[c.trim()]=parseInt(l.trim(),10)),t[c.trim()]||(t[c.trim()]=l.trim())}})}}return{formatName:r,formatOptions:t}}var za=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ve(this,e),this.logger=ke.create("formatter"),this.options=r,this.formats={number:function(i,n,a){return new Intl.NumberFormat(n,a).format(i)},currency:function(i,n,a){return new Intl.NumberFormat(n,Te(Te({},a),{},{style:"currency"})).format(i)},datetime:function(i,n,a){return new Intl.DateTimeFormat(n,Te({},a)).format(i)},relativetime:function(i,n,a){return new Intl.RelativeTimeFormat(n,Te({},a)).format(i,a.range||"day")},list:function(i,n,a){return new Intl.ListFormat(n,Te({},a)).format(i)}},this.init(r)}return me(e,[{key:"init",value:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},n=i.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(t,i){this.formats[t.toLowerCase().trim()]=i}},{key:"format",value:function(t,i,n,a){var o=this,s=i.split(this.formatSeparator),u=s.reduce(function(c,f){var l=Wa(f),d=l.formatName,g=l.formatOptions;if(o.formats[d]){var p=c;try{var b=a&&a.formatParams&&a.formatParams[a.interpolationkey]||{},w=b.locale||b.lng||a.locale||a.lng||n;p=o.formats[d](c,w,Te(Te(Te({},g),a),b))}catch(v){o.logger.warn(v)}return p}else o.logger.warn("there was no format function for ".concat(d));return c},t);return u}}]),e}();function fn(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function dn(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?fn(Object(t),!0).forEach(function(i){je(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):fn(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function qa(e){var r=Ga();return function(){var i=Le(e),n;if(r){var a=Le(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return yt(this,n)}}function Ga(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ka(e,r){for(var t=e.indexOf(r);t!==-1;)e.splice(t,1),t=e.indexOf(r)}var Qa=function(e){Wt(t,e);var r=qa(t);function t(i,n,a){var o,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return ve(this,t),o=r.call(this),zt&&He.call(_e(o)),o.backend=i,o.store=n,o.services=a,o.languageUtils=a.languageUtils,o.options=s,o.logger=ke.create("backendConnector"),o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(a,s.backend,s),o}return me(t,[{key:"queueLoad",value:function(n,a,o,s){var u=this,c=[],f=[],l=[],d=[];return n.forEach(function(g){var p=!0;a.forEach(function(b){var w="".concat(g,"|").concat(b);!o.reload&&u.store.hasResourceBundle(g,b)?u.state[w]=2:u.state[w]<0||(u.state[w]===1?f.indexOf(w)<0&&f.push(w):(u.state[w]=1,p=!1,f.indexOf(w)<0&&f.push(w),c.indexOf(w)<0&&c.push(w),d.indexOf(b)<0&&d.push(b)))}),p||l.push(g)}),(c.length||f.length)&&this.queue.push({pending:f,loaded:{},errors:[],callback:s}),{toLoad:c,pending:f,toLoadLanguages:l,toLoadNamespaces:d}}},{key:"loaded",value:function(n,a,o){var s=n.split("|"),u=s[0],c=s[1];a&&this.emit("failedLoading",u,c,a),o&&this.store.addResourceBundle(u,c,o),this.state[n]=a?-1:2;var f={};this.queue.forEach(function(l){ka(l.loaded,[u],c),Ka(l.pending,n),a&&l.errors.push(a),l.pending.length===0&&!l.done&&(Object.keys(l.loaded).forEach(function(d){f[d]||(f[d]=[]),l.loaded[d].length&&l.loaded[d].forEach(function(g){f[d].indexOf(g)<0&&f[d].push(g)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",f),this.queue=this.queue.filter(function(l){return!l.done})}},{key:"read",value:function(n,a,o){var s=this,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:350,f=arguments.length>5?arguments[5]:void 0;return n.length?this.backend[o](n,a,function(l,d){if(l&&d&&u<5){setTimeout(function(){s.read.call(s,n,a,o,u+1,c*2,f)},c);return}f(l,d)}):f(null,{})}},{key:"prepareLoading",value:function(n,a){var o=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),u&&u();typeof n=="string"&&(n=this.languageUtils.toResolveHierarchy(n)),typeof a=="string"&&(a=[a]);var c=this.queueLoad(n,a,s,u);if(!c.toLoad.length)return c.pending.length||u(),null;c.toLoad.forEach(function(f){o.loadOne(f)})}},{key:"load",value:function(n,a,o){this.prepareLoading(n,a,{},o)}},{key:"reload",value:function(n,a,o){this.prepareLoading(n,a,{reload:!0},o)}},{key:"loadOne",value:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",s=n.split("|"),u=s[0],c=s[1];this.read(u,c,"read",void 0,void 0,function(f,l){f&&a.logger.warn("".concat(o,"loading namespace ").concat(c," for language ").concat(u," failed"),f),!f&&l&&a.logger.log("".concat(o,"loaded namespace ").concat(c," for language ").concat(u),l),a.loaded(n,f,l)})}},{key:"saveMissing",value:function(n,a,o,s,u){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(a)){this.logger.warn('did not save key "'.concat(o,'" as the namespace "').concat(a,'" 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}o==null||o===""||(this.backend&&this.backend.create&&this.backend.create(n,a,o,s,null,dn(dn({},c),{},{isUpdate:u})),!(!n||!n[0])&&this.store.addResource(n[0],a,o,s))}}]),t}(He);function Ja(){return{debug:!1,initImmediate:!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:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(r){var t={};if(Ie(r[1])==="object"&&(t=r[1]),typeof r[1]=="string"&&(t.defaultValue=r[1]),typeof r[2]=="string"&&(t.tDescription=r[2]),Ie(r[2])==="object"||Ie(r[3])==="object"){var i=r[3]||r[2];Object.keys(i).forEach(function(n){t[n]=i[n]})}return t},interpolation:{escapeValue:!0,format:function(r,t,i,n){return r},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function gn(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function hn(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function Ce(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?hn(Object(t),!0).forEach(function(i){je(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):hn(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function Ya(e){var r=Za();return function(){var i=Le(e),n;if(r){var a=Le(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return yt(this,n)}}function Za(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ct(){}function Xa(e){var r=Object.getOwnPropertyNames(Object.getPrototypeOf(e));r.forEach(function(t){typeof e[t]=="function"&&(e[t]=e[t].bind(e))})}var Tt=function(e){Wt(t,e);var r=Ya(t);function t(){var i,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;if(ve(this,t),i=r.call(this),zt&&He.call(_e(i)),i.options=gn(n),i.services={},i.logger=ke,i.modules={external:[]},Xa(_e(i)),a&&!i.isInitialized&&!n.isClone){if(!i.options.initImmediate)return i.init(n,a),yt(i,_e(i));setTimeout(function(){i.init(n,a)},0)}return i}return me(t,[{key:"init",value:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;typeof a=="function"&&(o=a,a={}),!a.defaultNS&&a.ns&&(typeof a.ns=="string"?a.defaultNS=a.ns:a.ns.indexOf("translation")<0&&(a.defaultNS=a.ns[0]));var s=Ja();this.options=Ce(Ce(Ce({},s),this.options),gn(a)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Ce(Ce({},s.interpolation),this.options.interpolation)),a.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=a.keySeparator),a.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=a.nsSeparator);function u(v){return v?typeof v=="function"?new v:v:null}if(!this.options.isClone){this.modules.logger?ke.init(u(this.modules.logger),this.options):ke.init(null,this.options);var c;this.modules.formatter?c=this.modules.formatter:typeof Intl!="undefined"&&(c=za);var f=new Ia(this.options);this.store=new Ta(this.options.resources,this.options);var l=this.services;l.logger=ke,l.resourceStore=this.store,l.languageUtils=f,l.pluralResolver=new Ha(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(l.formatter=u(c),l.formatter.init(l,this.options),this.options.interpolation.format=l.formatter.format.bind(l.formatter)),l.interpolator=new Ba(this.options),l.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},l.backendConnector=new Qa(u(this.modules.backend),l.resourceStore,l,this.options),l.backendConnector.on("*",function(v){for(var x=arguments.length,P=new Array(x>1?x-1:0),N=1;N<x;N++)P[N-1]=arguments[N];n.emit.apply(n,[v].concat(P))}),this.modules.languageDetector&&(l.languageDetector=u(this.modules.languageDetector),l.languageDetector.init(l,this.options.detection,this.options)),this.modules.i18nFormat&&(l.i18nFormat=u(this.modules.i18nFormat),l.i18nFormat.init&&l.i18nFormat.init(this)),this.translator=new sn(this.services,this.options),this.translator.on("*",function(v){for(var x=arguments.length,P=new Array(x>1?x-1:0),N=1;N<x;N++)P[N-1]=arguments[N];n.emit.apply(n,[v].concat(P))}),this.modules.external.forEach(function(v){v.init&&v.init(n)})}if(this.format=this.options.interpolation.format,o||(o=Ct),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var 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");var g=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];g.forEach(function(v){n[v]=function(){var x;return(x=n.store)[v].apply(x,arguments)}});var p=["addResource","addResources","addResourceBundle","removeResourceBundle"];p.forEach(function(v){n[v]=function(){var x;return(x=n.store)[v].apply(x,arguments),n}});var b=at(),w=function(){var x=function(N,R){n.isInitialized&&!n.initializedStoreOnce&&n.logger.warn("init: i18next is already initialized. You should call init just once!"),n.isInitialized=!0,n.options.isClone||n.logger.log("initialized",n.options),n.emit("initialized",n.options),b.resolve(R),o(N,R)};if(n.languages&&n.options.compatibilityAPI!=="v1"&&!n.isInitialized)return x(null,n.t.bind(n));n.changeLanguage(n.options.lng,x)};return this.options.resources||!this.options.initImmediate?w():setTimeout(w,0),b}},{key:"loadResources",value:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ct,s=o,u=typeof n=="string"?n:this.language;if(typeof n=="function"&&(s=n),!this.options.resources||this.options.partialBundledLanguages){if(u&&u.toLowerCase()==="cimode")return s();var c=[],f=function(g){if(!!g){var p=a.services.languageUtils.toResolveHierarchy(g);p.forEach(function(b){c.indexOf(b)<0&&c.push(b)})}};if(u)f(u);else{var l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.forEach(function(d){return f(d)})}this.options.preload&&this.options.preload.forEach(function(d){return f(d)}),this.services.backendConnector.load(c,this.options.ns,s)}else s(null)}},{key:"reloadResources",value:function(n,a,o){var s=at();return n||(n=this.languages),a||(a=this.options.ns),o||(o=Ct),this.services.backendConnector.reload(n,a,function(u){s.resolve(),o(u)}),s}},{key:"use",value:function(n){if(!n)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!n.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return n.type==="backend"&&(this.modules.backend=n),(n.type==="logger"||n.log&&n.warn&&n.error)&&(this.modules.logger=n),n.type==="languageDetector"&&(this.modules.languageDetector=n),n.type==="i18nFormat"&&(this.modules.i18nFormat=n),n.type==="postProcessor"&&ni.addPostProcessor(n),n.type==="formatter"&&(this.modules.formatter=n),n.type==="3rdParty"&&this.modules.external.push(n),this}},{key:"changeLanguage",value:function(n,a){var o=this;this.isLanguageChangingTo=n;var s=at();this.emit("languageChanging",n);var u=function(d){if(o.language=d,o.languages=o.services.languageUtils.toResolveHierarchy(d),o.resolvedLanguage=void 0,!(["cimode","dev"].indexOf(d)>-1))for(var g=0;g<o.languages.length;g++){var p=o.languages[g];if(!(["cimode","dev"].indexOf(p)>-1)&&o.store.hasLanguageSomeTranslations(p)){o.resolvedLanguage=p;break}}},c=function(d,g){g?(u(g),o.translator.changeLanguage(g),o.isLanguageChangingTo=void 0,o.emit("languageChanged",g),o.logger.log("languageChanged",g)):o.isLanguageChangingTo=void 0,s.resolve(function(){return o.t.apply(o,arguments)}),a&&a(d,function(){return o.t.apply(o,arguments)})},f=function(d){!n&&!d&&o.services.languageDetector&&(d=[]);var g=typeof d=="string"?d:o.services.languageUtils.getBestMatchFromCodes(d);g&&(o.language||u(g),o.translator.language||o.translator.changeLanguage(g),o.services.languageDetector&&o.services.languageDetector.cacheUserLanguage(g)),o.loadResources(g,function(p){c(p,g)})};return!n&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!n&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(f):f(n),s}},{key:"getFixedT",value:function(n,a,o){var s=this,u=function c(f,l){var d;if(Ie(l)!=="object"){for(var g=arguments.length,p=new Array(g>2?g-2:0),b=2;b<g;b++)p[b-2]=arguments[b];d=s.options.overloadTranslationOptionHandler([f,l].concat(p))}else d=Ce({},l);d.lng=d.lng||c.lng,d.lngs=d.lngs||c.lngs,d.ns=d.ns||c.ns;var w=s.options.keySeparator||".",v=o?"".concat(o).concat(w).concat(f):f;return s.t(v,d)};return typeof n=="string"?u.lng=n:u.lngs=n,u.ns=a,u.keyPrefix=o,u}},{key:"t",value:function(){var n;return this.translator&&(n=this.translator).translate.apply(n,arguments)}},{key:"exists",value:function(){var n;return this.translator&&(n=this.translator).exists.apply(n,arguments)}},{key:"setDefaultNamespace",value:function(n){this.options.defaultNS=n}},{key:"hasLoadedNamespace",value:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};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;var s=this.resolvedLanguage||this.languages[0],u=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;var f=function(g,p){var b=a.services.backendConnector.state["".concat(g,"|").concat(p)];return b===-1||b===2};if(o.precheck){var l=o.precheck(this,f);if(l!==void 0)return l}return!!(this.hasResourceBundle(s,n)||!this.services.backendConnector.backend||f(s,n)&&(!u||f(c,n)))}},{key:"loadNamespaces",value:function(n,a){var o=this,s=at();return this.options.ns?(typeof n=="string"&&(n=[n]),n.forEach(function(u){o.options.ns.indexOf(u)<0&&o.options.ns.push(u)}),this.loadResources(function(u){s.resolve(),a&&a(u)}),s):(a&&a(),Promise.resolve())}},{key:"loadLanguages",value:function(n,a){var o=at();typeof n=="string"&&(n=[n]);var s=this.options.preload||[],u=n.filter(function(c){return s.indexOf(c)<0});return u.length?(this.options.preload=s.concat(u),this.loadResources(function(c){o.resolve(),a&&a(c)}),o):(a&&a(),Promise.resolve())}},{key:"dir",value:function(n){if(n||(n=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!n)return"rtl";var a=["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"];return a.indexOf(this.services.languageUtils.getLanguagePartFromCode(n))>-1||n.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ct,s=Ce(Ce(Ce({},this.options),a),{isClone:!0}),u=new t(s),c=["store","services","language"];return c.forEach(function(f){u[f]=n[f]}),u.services=Ce({},this.services),u.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},u.translator=new sn(u.services,u.options),u.translator.on("*",function(f){for(var l=arguments.length,d=new Array(l>1?l-1:0),g=1;g<l;g++)d[g-1]=arguments[g];u.emit.apply(u,[f].concat(d))}),u.init(s,o),u.translator.options=u.options,u.translator.backendConnector.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},u}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),t}(He);je(Tt,"createInstance",function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return new Tt(e,r)});var se=Tt.createInstance();se.createInstance=Tt.createInstance;se.createInstance;se.init;se.loadResources;se.reloadResources;se.use;se.changeLanguage;se.getFixedT;se.t;se.exists;se.setDefaultNamespace;se.hasLoadedNamespace;se.loadNamespaces;se.loadLanguages;var ii=[],eo=ii.forEach,to=ii.slice;function ro(e){return eo.call(to.call(arguments,1),function(r){if(r)for(var t in r)e[t]===void 0&&(e[t]=r[t])}),e}var pn=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,no=function(r,t,i){var n=i||{};n.path=n.path||"/";var a=encodeURIComponent(t),o=r+"="+a;if(n.maxAge>0){var s=n.maxAge-0;if(isNaN(s))throw new Error("maxAge should be a Number");o+="; Max-Age="+Math.floor(s)}if(n.domain){if(!pn.test(n.domain))throw new TypeError("option domain is invalid");o+="; Domain="+n.domain}if(n.path){if(!pn.test(n.path))throw new TypeError("option path is invalid");o+="; Path="+n.path}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(o+="; HttpOnly"),n.secure&&(o+="; Secure"),n.sameSite){var u=typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite;switch(u){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},vn={create:function(r,t,i,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};i&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+i*60*1e3)),n&&(a.domain=n),document.cookie=no(r,encodeURIComponent(t),a)},read:function(r){for(var t=r+"=",i=document.cookie.split(";"),n=0;n<i.length;n++){for(var a=i[n];a.charAt(0)===" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return a.substring(t.length,a.length)}return null},remove:function(r){this.create(r,"",-1)}},io={name:"cookie",lookup:function(r){var t;if(r.lookupCookie&&typeof document!="undefined"){var i=vn.read(r.lookupCookie);i&&(t=i)}return t},cacheUserLanguage:function(r,t){t.lookupCookie&&typeof document!="undefined"&&vn.create(t.lookupCookie,r,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},ao={name:"querystring",lookup:function(r){var t;if(typeof window!="undefined")for(var i=window.location.search.substring(1),n=i.split("&"),a=0;a<n.length;a++){var o=n[a].indexOf("=");if(o>0){var s=n[a].substring(0,o);s===r.lookupQuerystring&&(t=n[a].substring(o+1))}}return t}},ot=null,mn=function(){if(ot!==null)return ot;try{ot=window!=="undefined"&&window.localStorage!==null;var r="i18next.translate.boo";window.localStorage.setItem(r,"foo"),window.localStorage.removeItem(r)}catch{ot=!1}return ot},oo={name:"localStorage",lookup:function(r){var t;if(r.lookupLocalStorage&&mn()){var i=window.localStorage.getItem(r.lookupLocalStorage);i&&(t=i)}return t},cacheUserLanguage:function(r,t){t.lookupLocalStorage&&mn()&&window.localStorage.setItem(t.lookupLocalStorage,r)}},st=null,yn=function(){if(st!==null)return st;try{st=window!=="undefined"&&window.sessionStorage!==null;var r="i18next.translate.boo";window.sessionStorage.setItem(r,"foo"),window.sessionStorage.removeItem(r)}catch{st=!1}return st},so={name:"sessionStorage",lookup:function(r){var t;if(r.lookupSessionStorage&&yn()){var i=window.sessionStorage.getItem(r.lookupSessionStorage);i&&(t=i)}return t},cacheUserLanguage:function(r,t){t.lookupSessionStorage&&yn()&&window.sessionStorage.setItem(t.lookupSessionStorage,r)}},uo={name:"navigator",lookup:function(r){var t=[];if(typeof navigator!="undefined"){if(navigator.languages)for(var i=0;i<navigator.languages.length;i++)t.push(navigator.languages[i]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},lo={name:"htmlTag",lookup:function(r){var t,i=r.htmlTag||(typeof document!="undefined"?document.documentElement:null);return i&&typeof i.getAttribute=="function"&&(t=i.getAttribute("lang")),t}},co={name:"path",lookup:function(r){var t;if(typeof window!="undefined"){var i=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(i instanceof Array)if(typeof r.lookupFromPathIndex=="number"){if(typeof i[r.lookupFromPathIndex]!="string")return;t=i[r.lookupFromPathIndex].replace("/","")}else t=i[0].replace("/","")}return t}},fo={name:"subdomain",lookup:function(r){var t;if(typeof window!="undefined"){var i=window.location.href.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/gi);i instanceof Array&&(typeof r.lookupFromSubdomainIndex=="number"?t=i[r.lookupFromSubdomainIndex].replace("http://","").replace("https://","").replace(".",""):t=i[0].replace("http://","").replace("https://","").replace(".",""))}return t}};function go(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var ai=function(){function e(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ve(this,e),this.type="languageDetector",this.detectors={},this.init(r,t)}return me(e,[{key:"init",value:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=ro(i,this.options||{},go()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(io),this.addDetector(ao),this.addDetector(oo),this.addDetector(so),this.addDetector(uo),this.addDetector(lo),this.addDetector(co),this.addDetector(fo)}},{key:"addDetector",value:function(t){this.detectors[t.name]=t}},{key:"detect",value:function(t){var i=this;t||(t=this.options.order);var n=[];return t.forEach(function(a){if(i.detectors[a]){var o=i.detectors[a].lookup(i.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}},{key:"cacheUserLanguage",value:function(t,i){var n=this;i||(i=this.options.caches),!!i&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||i.forEach(function(a){n.detectors[a]&&n.detectors[a].cacheUserLanguage(t,n.options)}))}}]),e}();ai.type="languageDetector";const ho={"OS.ProductConfigurator.Selected.Message.From":"od","OS.ProductConfigurator.Selected.Message.UpTo":"do","OS.ProductConfigurator.Selected.Message.Choose":"Wybierz","OS.ProductConfigurator.Selected.Message.Options":"opcji","OS.ProductConfigurator.Selected.Message.OneOption":"Wybierz 1 opcj\u0119","OS.ProductConfigurator.Quantity.Message.UpTo":"do","OS.ProductConfigurator.Quantity.Message.From":"od","OS.ProductConfigurator.Quantity.Message.Max":"maksymalnie","OS.ProductConfigurator.Quantity.Message.Quantity":"ilo\u015Bci","OS.ProductConfigurator.Quantity.Message.OneOption":"Wybierz maksymalnie jedn\u0105 opcj\u0119","OS.ProductConfigurator.Add":"Dodaj","OS.ProductConfigurator.Back":"Wr\xF3\u0107","OS.ProductConfigurator.ShowMore":"Poka\u017C wi\u0119cej","OS.ProductConfigurator.ShowLess":"Poka\u017C mniej"},po={"OS.ProductConfigurator.Selected.Message.From":"from","OS.ProductConfigurator.Selected.Message.UpTo":"up to","OS.ProductConfigurator.Selected.Message.Choose":"Choose","OS.ProductConfigurator.Selected.Message.Options":"options","OS.ProductConfigurator.Selected.Message.OneOption":"Choose one option","OS.ProductConfigurator.Quantity.Message.UpTo":"up to","OS.ProductConfigurator.Quantity.Message.From":"from","OS.ProductConfigurator.Quantity.Message.Max":"max","OS.ProductConfigurator.Quantity.Message.Quantity":"quantity","OS.ProductConfigurator.Quantity.Message.OneOption":"Choose maximum one option","OS.ProductConfigurator.Add":"Add","OS.ProductConfigurator.Back":"Back","OS.ProductConfigurator.ShowMore":"Show more","OS.ProductConfigurator.ShowLess":"Show less"},vo={"OS.ProductConfigurator.Selected.Message.From":"ab","OS.ProductConfigurator.Selected.Message.UpTo":"bis","OS.ProductConfigurator.Selected.Message.Choose":"W\xE4hle","OS.ProductConfigurator.Selected.Message.Options":"Optionen","OS.ProductConfigurator.Selected.Message.OneOption":"W\xE4hle eine Option","OS.ProductConfigurator.Quantity.Message.UpTo":"ab","OS.ProductConfigurator.Quantity.Message.From":"aus","OS.ProductConfigurator.Quantity.Message.Max":"max","OS.ProductConfigurator.Quantity.Message.Quantity":"Menge","OS.ProductConfigurator.Quantity.Message.OneOption":"W\xE4hle bis zu 1 Option aus","OS.ProductConfigurator.Add":"Hinzuf\xFCgen","OS.ProductConfigurator.Back":"Zur\xFCck","OS.ProductConfigurator.ShowMore":"Zeig mehr","OS.ProductConfigurator.ShowLess":"Zeig weniger"},mo={"OS.ProductConfigurator.Selected.Message.From":"from","OS.ProductConfigurator.Selected.Message.UpTo":"up to","OS.ProductConfigurator.Selected.Message.Choose":"Choose","OS.ProductConfigurator.Selected.Message.Options":"options","OS.ProductConfigurator.Selected.Message.OneOption":"Choose one option","OS.ProductConfigurator.Quantity.Message.UpTo":"up to","OS.ProductConfigurator.Quantity.Message.From":"from","OS.ProductConfigurator.Quantity.Message.Max":"max","OS.ProductConfigurator.Quantity.Message.Quantity":"quantity","OS.ProductConfigurator.Quantity.Message.OneOption":"Choose maximum one option","OS.ProductConfigurator.Add":"Add","OS.ProductConfigurator.Back":"Back","OS.ProductConfigurator.ShowMore":"Show more","OS.ProductConfigurator.ShowLess":"Show less"};se.use(ai).use(ma).init({resources:{pl:{translation:ho},en:{translation:po},de:{translation:vo},cs:{translation:mo}}});var oi=(e=>(e.SELECT="selCtx",e.FILTER="fltCtx",e))(oi||{}),Ge=(e=>(e.OPTIONS="3e/group/options",e.CONFIG="3e/group/config",e.PRODUCT="3e/product",e))(Ge||{}),Se=(e=>(e.OK="OK",e.TOO_MUCH="TOO_MUCH",e.NOT_ENOUGHT="NOT_ENOUGHT",e.IGNORE="IGNORE",e))(Se||{});const wr=(e,r,t)=>{const i=r[e];let n=0,a=0;if(i)for(let[o,s]of Object.entries(i))parseInt(s)>0&&(n+=1,a+=Number(s));else t&&t.forEach(o=>{if(r[o.selCtx])for(let[s,u]of Object.entries(r[o.selCtx]))parseInt(u)>0&&(n+=1,a+=Number(u))});return[n,a]},yo=(e,r)=>{const{selCtx:t,attrs:i={}}=e,{qtyMin:n,qtyMax:a}=i,{t:o}=Bt(),[s,u]=wr(t,r,e.items),{status:c,information:f}=bo(n,a,u,o);return{chosenQtyCnt:u,qtyMin:n,qtyMax:a,walidationStatus:c,informationText:f}},bo=(e,r,t,i)=>{let n="",a="";const o=Number(e),s=Number(r);return o>0&&(n+=` ${i("OS.ProductConfigurator.Quantity.Message.From")} ${o}`,o>t&&(a=Se.NOT_ENOUGHT)),s>0&&(n+=` ${i("OS.ProductConfigurator.Quantity.Message.UpTo")} ${s}`,s<t&&(a=Se.TOO_MUCH)),o>=0||s>=0&&t<o?(n=`${i("OS.ProductConfigurator.Quantity.Message.Max")}${n}`,n+=` ${i("OS.ProductConfigurator.Quantity.Message.Quantity")}`):o===1&&o===1?n=`${i("OS.ProductConfigurator.Quantity.Message.OneOption")}`:(n="",a=Se.IGNORE),t>=o&&t<=s&&(a=Se.OK),{information:n,status:a}},Oo=(e,r)=>{const{selCtx:t,attrs:i={}}=e,{selMin:n,selMax:a}=i,{t:o}=Bt(),[s,u]=wr(t,r,e.items),{status:c,information:f}=So(n,a,s,o);return{chosenSelCnt:s,selMin:n,selMax:a,walidationStatus:c,informationText:f}},So=(e,r,t,i)=>{let n="",a="";const o=parseInt(e||"-1"),s=parseInt(r||"-1");return o>0&&(n+=` ${i("OS.ProductConfigurator.Selected.Message.From")} ${o}`,o>t&&(a=Se.NOT_ENOUGHT)),s>0&&(n+=` ${i("OS.ProductConfigurator.Selected.Message.UpTo")} ${s}`,s<t&&(a=Se.TOO_MUCH)),o>=0||s>=0?(n=`${i("OS.ProductConfigurator.Selected.Message.Choose")}${n}`,n+=` ${i("OS.ProductConfigurator.Selected.Message.Options")}`):(n="",a=Se.IGNORE),o===1&&s===1&&(n=`${i("OS.ProductConfigurator.Selected.Message.OneOption")}`),t>=o&&t<=s&&(a=Se.OK),{information:n,status:a}},wo=(e,r,t)=>{if(e==="selected"||e==="filter")return[];if(t[r]===e)return[t];let i=ui(e,r,t.items);return(i==null?void 0:i.length)||(i=si(e,r,t.items),i.length===0),i},si=(e,r,t)=>{const i=xo(t),n=ui(e,r,i);return(n==null?void 0:n.length)?n:(i==null?void 0:i.length)?si(e,r,i):[]},xo=e=>{let r=[];return Array.isArray(e)&&(r=e.map(t=>{if(Array.isArray(t==null?void 0:t.items))return t.items}).filter(t=>t!==void 0)),r.flat(1)},ui=(e,r,t)=>{let i=[];return Array.isArray(t)&&(i=t.filter(n=>{if(n&&n[r]===e)return!0})),i},Co=(e,r,t,i)=>{const n=wo(r,t,i),a=Po(e,n).filter(o=>o!==null&&typeof o!="undefined");return a.length?a[0]:null},Po=(e,r)=>{let t=[];return Array.isArray(r)&&r.length&&(t=r.map(i=>No(e,i))),t},No=(e,r)=>{if(r.id===e)return r;let t=ci(e,r.items);return t.length?(t.length>1&&console.error(`More than one ${e} in context ${r.id}`),t[0]):(t=li(e,r.items),t.length?(t.length>1&&console.error(`More than one ${e} in context ${r.id}`),t[0]):null)},li=(e,r)=>{const t=ko(r),i=ci(e,t);return(i==null?void 0:i.length)?i:(t==null?void 0:t.length)?li(e,t):[]},ko=e=>{let r=[];return Array.isArray(e)&&(r=e.map(t=>{if(Array.isArray(t==null?void 0:t.items))return t.items}).filter(t=>t!==void 0)),r.flat(1)},ci=(e,r)=>Array.isArray(r)?r.filter(i=>{if(i&&i.id===e)return!0}):[],xr=(e,r)=>{let t=0;for(const[i,n]of Object.entries(e))if(n){for(const[a,o]of Object.entries(n))if(o){const s=Co(a,i,oi.SELECT,r);s&&(s==null?void 0:s.price)&&(t+=parseFloat(s.price)*o)}}return t};var qt={exports:{}},bt={};/*
3
- object-assign
4
- (c) Sindre Sorhus
5
- @license MIT
6
- */var bn=Object.getOwnPropertySymbols,Eo=Object.prototype.hasOwnProperty,Lo=Object.prototype.propertyIsEnumerable;function jo(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function Fo(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;var i=Object.getOwnPropertyNames(r).map(function(a){return r[a]});if(i.join("")!=="0123456789")return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(a){n[a]=a}),Object.keys(Object.assign({},n)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Fo();/** @license React v17.0.2
7
- * react-jsx-runtime.production.min.js
8
- *
9
- * Copyright (c) Facebook, Inc. and its affiliates.
10
- *
11
- * This source code is licensed under the MIT license found in the
12
- * LICENSE file in the root directory of this source tree.
13
- */var Ao=he.default,fi=60103;bt.Fragment=60107;if(typeof Symbol=="function"&&Symbol.for){var On=Symbol.for;fi=On("react.element"),bt.Fragment=On("react.fragment")}var Ro=Ao.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,To=Object.prototype.hasOwnProperty,Mo={key:!0,ref:!0,__self:!0,__source:!0};function di(e,r,t){var i,n={},a=null,o=null;t!==void 0&&(a=""+t),r.key!==void 0&&(a=""+r.key),r.ref!==void 0&&(o=r.ref);for(i in r)To.call(r,i)&&!Mo.hasOwnProperty(i)&&(n[i]=r[i]);if(e&&e.defaultProps)for(i in r=e.defaultProps,r)n[i]===void 0&&(n[i]=r[i]);return{$$typeof:fi,type:e,key:a,ref:o,props:n,_owner:Ro.current}}bt.jsx=di;bt.jsxs=di;qt.exports=bt;const O=qt.exports.jsx,$=qt.exports.jsxs,nt=qt.exports.Fragment;function Sn(e){const{isOkk:r,isErr:t,info:i}=e;return $("p",{className:`${r?"text-green-600":t&&"text-red-600"} ml-1 flex`,children:[r&&Do,t&&Io,i]})}const Do=O("svg",{className:"w-6 h-6 text-green-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","data-testid":"form-check-mark",children:O("polyline",{points:"20 6 9 17 4 12"})}),Io=O("svg",{className:"w-6 h-6 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","data-testid":"form-exclamation-mark",children:O("path",{strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})});var _o={defaultAmount:0,defaultCurrency:"USD",defaultPrecision:2},Vo={globalLocale:"en-US",globalFormat:"$0,0.00",globalRoundingMode:"HALF_EVEN",globalFormatRoundingMode:"HALF_AWAY_FROM_ZERO",globalExchangeRatesApi:{endpoint:void 0,headers:void 0,propertyPath:void 0}};function dt(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?dt=function(r){return typeof r}:dt=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},dt(e)}function wn(e){return $o(e)||Uo(e)||Ho(e)||Bo()}function $o(e){if(Array.isArray(e))return e}function Uo(e){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(e))return Array.from(e)}function Ho(e,r){if(!!e){if(typeof e=="string")return xn(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return xn(e,r)}}function xn(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,i=new Array(r);t<r;t++)i[t]=e[t];return i}function Bo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
14
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Wo={normalizePrecision:function(r){var t=r.reduce(function(i,n){return Math.max(i.getPrecision(),n.getPrecision())});return r.map(function(i){return i.getPrecision()!==t?i.convertPrecision(t):i})},minimum:function(r){var t=wn(r),i=t[0],n=t.slice(1),a=i;return n.forEach(function(o){a=a.lessThan(o)?a:o}),a},maximum:function(r){var t=wn(r),i=t[0],n=t.slice(1),a=i;return n.forEach(function(o){a=a.greaterThan(o)?a:o}),a}};function gi(e){return!isNaN(parseInt(e))&&isFinite(e)}function zo(e){return gi(e)&&e<=100&&e>=0}function qo(e){return e.length>0&&e.every(function(r){return r>=0})&&e.some(function(r){return r>0})}function Cn(e){return e%2===0}function Pn(e){return gi(e)&&!Number.isInteger(e)}function Go(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=e.toString();if(r.indexOf("e-")>0)return parseInt(r.split("e-")[1]);var t=r.split(".")[1];return t?t.length:0}function ut(e){return Math.abs(e)%1===.5}function Ko(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(t,i){var n=Object.assign(new XMLHttpRequest,{onreadystatechange:function(){n.readyState===4&&(n.status>=200&&n.status<400?t(JSON.parse(n.responseText)):i(new Error(n.statusText)))},onerror:function(){i(new Error("Network error"))}});n.open("GET",e,!0),Qo(n,r.headers),n.send()})}function Qo(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(var t in r)e.setRequestHeader(t,r[t]);return e}function ft(e){return typeof e=="undefined"}function hi(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:".",t={};return Object.entries(e).forEach(function(i){if(dt(i[1])==="object"){var n=hi(i[1]);Object.entries(n).forEach(function(a){t[i[0]+r+a[0]]=a[1]})}else t[i[0]]=i[1]}),t}function Jo(e){return Boolean(e)&&(dt(e)==="object"||typeof e=="function")&&typeof e.then=="function"}function pi(){var e=function(i,n){var a=function(u){return Math.pow(10,Go(u))},o=Math.max(a(i),a(n));return Math.round(i*o)*Math.round(n*o)/(o*o)},r={HALF_ODD:function(i){var n=Math.round(i);return ut(i)&&Cn(n)?n-1:n},HALF_EVEN:function(i){var n=Math.round(i);return ut(i)?Cn(n)?n:n-1:n},HALF_UP:function(i){return Math.round(i)},HALF_DOWN:function(i){return ut(i)?Math.floor(i):Math.round(i)},HALF_TOWARDS_ZERO:function(i){return ut(i)?Math.sign(i)*Math.floor(Math.abs(i)):Math.round(i)},HALF_AWAY_FROM_ZERO:function(i){return ut(i)?Math.sign(i)*Math.ceil(Math.abs(i)):Math.round(i)},DOWN:function(i){return Math.floor(i)}};return{add:function(i,n){return i+n},subtract:function(i,n){return i-n},multiply:function(i,n){return Pn(i)||Pn(n)?e(i,n):i*n},divide:function(i,n){return i/n},modulo:function(i,n){return i%n},round:function(i){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"HALF_EVEN";return r[n](i)}}}var Yo=pi();function Zo(e){var r=/^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(e);return{getMatches:function(){return r!==null?r.slice(1).filter(function(i){return!ft(i)}):[]},getMinimumFractionDigits:function(){var i=function(a){return a==="."};return ft(this.getMatches().find(i))?0:this.getMatches()[Yo.add(this.getMatches().findIndex(i),1)].split("").length},getCurrencyDisplay:function(){var i={USD:"code",dollar:"name",$:"symbol"};return i[this.getMatches().find(function(n){return n==="USD"||n==="dollar"||n==="$"})]},getStyle:function(){return ft(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!ft(this.getMatches().find(function(i){return i===","}))}}}function Xo(e){var r=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0;for(var o in a)n=n.replace("{{".concat(o,"}}"),a[o]);return n},t=function(n,a){return Ko(r(e.endpoint,{from:n,to:a}),{headers:e.headers})};return{getExchangeRate:function(n,a){return(Jo(e.endpoint)?e.endpoint:t(n,a)).then(function(o){return hi(o)[r(e.propertyPath,{from:n,to:a})]})}}}function ht(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Error;if(!e)throw new t(r)}function es(e){ht(zo(e),"You must provide a numeric value between 0 and 100.",RangeError)}function ts(e){ht(qo(e),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}function or(e){ht(Number.isInteger(e),"You must provide an integer.",TypeError)}var Q=pi(),rs=function e(r){var t=Object.assign({},{amount:e.defaultAmount,currency:e.defaultCurrency,precision:e.defaultPrecision},r),i=t.amount,n=t.currency,a=t.precision;or(i),or(a);var o=e.globalLocale,s=e.globalFormat,u=e.globalRoundingMode,c=e.globalFormatRoundingMode,f=Object.assign({},e.globalExchangeRatesApi),l=function(p){var b=Object.assign({},Object.assign({},{amount:i,currency:n,precision:a},p),Object.assign({},{locale:this.locale},p));return Object.assign(e({amount:b.amount,currency:b.currency,precision:b.precision}),{locale:b.locale})},d=function(p){ht(this.hasSameCurrency(p),"You must provide a Dinero instance with the same currency.",TypeError)};return{getAmount:function(){return i},getCurrency:function(){return n},getLocale:function(){return this.locale||o},setLocale:function(p){return l.call(this,{locale:p})},getPrecision:function(){return a},convertPrecision:function(p){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;or(p);var w=this.getPrecision(),v=p>w,x=v?Q.multiply:Q.divide,P=v?[p,w]:[w,p],N=Math.pow(10,Q.subtract.apply(Q,P));return l.call(this,{amount:Q.round(x(this.getAmount(),N),b),precision:p})},add:function(p){d.call(this,p);var b=e.normalizePrecision([this,p]);return l.call(this,{amount:Q.add(b[0].getAmount(),b[1].getAmount()),precision:b[0].getPrecision()})},subtract:function(p){d.call(this,p);var b=e.normalizePrecision([this,p]);return l.call(this,{amount:Q.subtract(b[0].getAmount(),b[1].getAmount()),precision:b[0].getPrecision()})},multiply:function(p){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return l.call(this,{amount:Q.round(Q.multiply(this.getAmount(),p),b)})},divide:function(p){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return l.call(this,{amount:Q.round(Q.divide(this.getAmount(),p),b)})},percentage:function(p){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return es(p),this.multiply(Q.divide(p,100),b)},allocate:function(p){var b=this;ts(p);for(var w=p.reduce(function(N,R){return Q.add(N,R)}),v=this.getAmount(),x=p.map(function(N){var R=Math.floor(Q.divide(Q.multiply(b.getAmount(),N),w));return v=Q.subtract(v,R),l.call(b,{amount:R})}),P=0;v>0;)p[P]>0&&(x[P]=x[P].add(l.call(this,{amount:1})),v=Q.subtract(v,1)),P+=1;return x},convert:function(p){var b=this,w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=w.endpoint,x=v===void 0?f.endpoint:v,P=w.propertyPath,N=P===void 0?f.propertyPath||"rates.{{to}}":P,R=w.headers,M=R===void 0?f.headers:R,D=w.roundingMode,_=D===void 0?u:D,T=Object.assign({},{endpoint:x,propertyPath:N,headers:M,roundingMode:_});return Xo(T).getExchangeRate(this.getCurrency(),p).then(function(k){return ht(!ft(k),'No rate was found for the destination currency "'.concat(p,'".'),TypeError),l.call(b,{amount:Q.round(Q.multiply(b.getAmount(),parseFloat(k)),T.roundingMode),currency:p})})},equalsTo:function(p){return this.hasSameAmount(p)&&this.hasSameCurrency(p)},lessThan:function(p){d.call(this,p);var b=e.normalizePrecision([this,p]);return b[0].getAmount()<b[1].getAmount()},lessThanOrEqual:function(p){d.call(this,p);var b=e.normalizePrecision([this,p]);return b[0].getAmount()<=b[1].getAmount()},greaterThan:function(p){d.call(this,p);var b=e.normalizePrecision([this,p]);return b[0].getAmount()>b[1].getAmount()},greaterThanOrEqual:function(p){d.call(this,p);var b=e.normalizePrecision([this,p]);return b[0].getAmount()>=b[1].getAmount()},isZero:function(){return this.getAmount()===0},isPositive:function(){return this.getAmount()>=0},isNegative:function(){return this.getAmount()<0},hasSubUnits:function(){return Q.modulo(this.getAmount(),Math.pow(10,a))!==0},hasCents:function(){return Q.modulo(this.getAmount(),Math.pow(10,a))!==0},hasSameCurrency:function(p){return this.getCurrency()===p.getCurrency()},hasSameAmount:function(p){var b=e.normalizePrecision([this,p]);return b[0].getAmount()===b[1].getAmount()},toFormat:function(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:s,b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c,w=Zo(p);return this.toRoundedUnit(w.getMinimumFractionDigits(),b).toLocaleString(this.getLocale(),{currencyDisplay:w.getCurrencyDisplay(),useGrouping:w.getUseGrouping(),minimumFractionDigits:w.getMinimumFractionDigits(),style:w.getStyle(),currency:this.getCurrency()})},toUnit:function(){return Q.divide(this.getAmount(),Math.pow(10,a))},toRoundedUnit:function(p){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c,w=Math.pow(10,p);return Q.divide(Q.round(Q.multiply(this.toUnit(),w),b),w)},toObject:function(){return{amount:i,currency:n,precision:a}},toJSON:function(){return this.toObject()}}},ns=Object.assign(rs,_o,Vo,Wo);const Lt=(e,r="PLN")=>{e=e.toString();const t=e.replace(",","."),i=Number(t)*100;return isNaN(i)?"0.00":ns({amount:Math.floor(i),currency:r}).toFormat("0,0.00")},is=(e,r,t=1)=>{const i=parseFloat(e.toString());let n=!1,a=Lt(`${t*i}`);const o=`${Lt(`${a}`)}`;return i<parseFloat(r)&&(n=!0,a=`${Lt(`${r}`)}`),{displayPriceFrom:n,formattedEndPriceWithPriceMin:a,formattedEndPrice:o}};function Gt(e){const{price:r,addPlusBefore:t=!1,size:i="md",showIfPriceZero:n=!1,minPrice:a="0.00",hiddenIfPriceZero:o=!1}=e,s=parseFloat(a),u=r>s?r:a,c=Lt(`${u}`);return!r&&n===!1?null:t?$("span",{style:{visibility:`${!r&&o?"hidden":"visible"}`},className:"",children:["\xA0",`+${c}`]}):r<s?$("span",{className:"",children:["\xA0",`od ${c}`]}):O("span",{className:"",children:c})}const as=(e,r,t)=>e==="1"&&r==="1"&&!t?"radio":t?"counter":"checkbox",os=e=>{const r=document.getElementById(e);r?r.scrollIntoView({behavior:"smooth"}):console.warn(`Error: scrollToId: id: ${e} not found in html structure`)},vi=e=>`group--${e}`;function ss(e){let r;const t=new Set,i=(c,f)=>{const l=typeof c=="function"?c(r):c;if(l!==r){const d=r;r=f?l:Object.assign({},r,l),t.forEach(g=>g(r,d))}},n=()=>r,a=(c,f=n,l=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let d=f(r);function g(){const p=f(r);if(!l(d,p)){const b=d;c(d=p,b)}}return t.add(g),()=>t.delete(g)},u={setState:i,getState:n,subscribe:(c,f,l)=>f||l?a(c,f,l):(t.add(c),()=>t.delete(c)),destroy:()=>t.clear()};return r=e(i,n,u),u}const us=typeof window=="undefined"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),Nn=us?m.useEffect:m.useLayoutEffect;function ls(e){const r=typeof e=="function"?ss(e):e,t=(i=r.getState,n=Object.is)=>{const[,a]=m.useReducer(w=>w+1,0),o=r.getState(),s=m.useRef(o),u=m.useRef(i),c=m.useRef(n),f=m.useRef(!1),l=m.useRef();l.current===void 0&&(l.current=i(o));let d,g=!1;(s.current!==o||u.current!==i||c.current!==n||f.current)&&(d=i(o),g=!n(l.current,d)),Nn(()=>{g&&(l.current=d),s.current=o,u.current=i,c.current=n,f.current=!1});const p=m.useRef(o);Nn(()=>{const w=()=>{try{const x=r.getState(),P=u.current(x);c.current(l.current,P)||(s.current=x,l.current=P,a())}catch{f.current=!0,a()}},v=r.subscribe(w);return r.getState()!==p.current&&w(),v},[]);const b=g?d:l.current;return m.useDebugValue(b),b};return Object.assign(t,r),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,r];return{next(){const n=i.length<=0;return{value:i.shift(),done:n}}}},t}const cs=(e,r)=>({filter:{},unseenGroupsByFilter:[],setInitialFilter:t=>{e(()=>({filter:ae({},t),unseenGroupsByFilter:[]}))},setFilter:(t,i)=>{e(({filter:n})=>({filter:ze(ae({},n),{[t]:ae(ae({},n[t]),i)})}))},validateFilter:(t,i)=>{const n=r().filter;return t&&n[i]?Object.keys(n[i]).filter(o=>Object.keys(t).includes(o)&&t[o].includes(n[i][o])):[]},uncheckFilteredProducts:(t,i,n,a,o)=>{r().initialSelectedState;const s=u=>{t&&Object.keys(t).length>0&&n.length===0&&u.forEach(c=>{const{selCtx:f,id:l,items:d=[]}=c;o(`selected.${f}.${l}`,!1),d.length>0&&s(d)})};s(i)},checkFilteredProducts:(t,i,n,a,o)=>{const s=r().initialSelectedState,u=c=>{t&&Object.keys(t).length>0&&n.length!==0&&c.forEach(f=>{var b;const{selCtx:l,id:d,items:g=[]}=f,p=(b=s[l])==null?void 0:b[d];p&&o(`selected.${l}.${d}`,p.toString()),g.length>0&&u(g)})};u(i)}}),fs=(e,r)=>({initialSelectedState:{},mainProductCount:1,setInitialSelectedState:t=>{e(()=>({initialSelectedState:t,mainProductCount:1}))},increaseCount:()=>{e(({mainProductCount:t})=>({mainProductCount:t+1}))},decreaseCount:()=>{e(({mainProductCount:t})=>({mainProductCount:t-1}))}}),ds=(e,r)=>({groupsValidation:{},isOnSubmitted:!1,setInitialValidate:()=>{e(()=>({groupsValidation:{},isOnSubmitted:!1}))},setGroupsValidation:(t,i,n,a,o,s,u,c)=>{((n==null?void 0:n.qtyMax)||(n==null?void 0:n.selMax))&&e(({groupsValidation:f})=>({groupsValidation:ze(ae({},f),{[i]:{parentContext:t,disableAddCounter:a===Number(n==null?void 0:n.qtyMax),disableInput:o===Number(n==null?void 0:n.selMax),parentKind:s,nestedLvl:u,isValid:a>=(Number(n==null?void 0:n.qtyMin)||0)&&o>=(Number(n==null?void 0:n.selMin)||0),isPassedFiltering:c,debug:{qtyCnt:a,selCnt:o,productAttrs:n,productSelCtx:i}}})}))},getParentsCtxValidation:(t,i)=>{const n=r().groupsValidation,a=r().getParentsCtxValidation;let o=!1;const s=n[t].parentContext,u=n[s];return Object.keys(n).map(c=>{u?o=Boolean(u==null?void 0:u[i]):o=!1,u&&!u[i]&&u.parentKind!==Ge.PRODUCT&&t!==t&&a(c,i)}),o},getCtxValidation:(t,i)=>{const n=r().groupsValidation;return n[t]?n[t][i]:!1},validateSingleProductQty:(t,i)=>t&&i?Number(t)===Number(i):!1,isAddDisabled:(t,i,n)=>{const a=r().groupsValidation;return a&&a[t]&&a[t].parentKind!==Ge.PRODUCT?r().getCtxValidation(t,"disableAddCounter")||r().getParentsCtxValidation(t,"disableAddCounter")||r().validateSingleProductQty(i,n):r().getCtxValidation(t,"disableAddCounter")||r().validateSingleProductQty(i,n)},isInputDisabled:t=>{const i=r().groupsValidation;return i&&i[t]&&i[t].parentKind!==Ge.PRODUCT&&r().getParentsCtxValidation(t,"disableInput")||r().getCtxValidation(t,"disableInput")},setIsOnSubmittedOnTrue:()=>{console.log("isOnSubmitted"),e(()=>({isOnSubmitted:!0}))},getInvalidContextNames:()=>{var n;const t=r().groupsValidation,i=[];for(const[a,o]of Object.entries(t))t[a].isValid===!1&&t[a].isPassedFiltering===!0&&(console.log("inValidGroup debug"),console.log((n=t[a])==null?void 0:n.debug),i.push(a));return i}}),gs=(e,r)=>({expanded:{},toggleExpanded:(t,i,n)=>{const a=r().expanded[t+i+n];e(()=>({expanded:ze(ae({},r().expanded),{[t+i+n]:a!==void 0?!a:!1})}))},resetExpanded:()=>{e(()=>({expanded:{}}))}}),Z=ls((e,r)=>ae(ae(ae(ae({},cs(e,r)),fs(e)),ds(e,r)),gs(e,r))),hs=(e,r,t,i)=>{const n=i[e+r+t];return n!==void 0?n:!0},ps=e=>{const{productItem:r,selected:t,parentCtx:i,nestedLvl:n,parentKind:a}=e,{walidationStatus:o,informationText:s}=Oo(r,t),{walidationStatus:u,informationText:c}=yo(r,t),{watch:f,setValue:l}=mt(),[d,g]=m.useState([]),{items:p,selCtx:b,attrs:w={},details:v={},filter:x,fltCtx:P,id:N}=r,{name:R,description:M}=v.literals,D=Z(V=>V.filter),_=Z(V=>V.validateFilter),T=Z(V=>V.uncheckFilteredProducts),k=Z(V=>V.expanded),L=m.useMemo(()=>hs(b,N,i,k),[b,N,i,k]),I=Z(V=>V.toggleExpanded),G=Z(V=>V.checkFilteredProducts);m.useEffect(()=>{const V=_(x,P);T(x,p,V,f,l),G(x,p,V,f,l),g(V)},[D]);const U=Z(V=>V.setGroupsValidation),Y=Z(V=>V.isOnSubmitted),[re,z]=wr(r.selCtx,t,p),X=x&&Object.keys(x).length>0&&d.length===0;U(i,b,w,z,re,a,n,!X);const ne=o===Se.OK,ee=u===Se.OK,W=!ne&&Y&&!!s,K=!ee&&Y&&!!c;return X?null:$("div",{className:"pt-1 mb-3 configuration-group",id:vi(b),children:[$("div",{className:"flex text-xl font-semibold",children:[O("p",{className:"",children:R}),R&&R!==" "&&$(nt,{children:[O("div",{className:"ml-auto",children:O(Gt,{price:xr(t,r)})}),O("svg",{className:`w-8 h-8 ml-2 text-black cursor-pointer ${!L&&"rotate-180"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",onClick:()=>I(b,N,i),children:O("polyline",{points:"18 15 12 9 6 15"})})]})]}),O("p",{className:`${M&&"mb-2"}`,children:M}),O("div",{className:"flex",children:$("div",{children:[O(Sn,{isOkk:ne,isErr:W,info:s}),O(Sn,{isOkk:ee,isErr:K,info:c})]})}),L&&O(Cr,{productItems:p,nestedLvl:n+1,context:r})]})};function mi(e){const{value:r=0,add:t,subtract:i,disabledSubtract:n,disabledAdd:a,size:o="md"}=e;return $("div",{className:`counter counter-${o} flex flex-row justify-center items-center p-1 border-[1px] rounded-md border-[rgba(229,231,235,255)] product-quantity`,children:[O("button",{type:"button",className:"quantity-button small",onClick:i,disabled:n,children:$("svg",{className:"w-4 h-4 text-black",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[O("path",{stroke:"none",d:"M0 0h24v24H0z"}),O("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),O("span",{className:"font-semibold text-gray-700 product-quantity-value",children:r}),O("button",{className:"quantity-button small",type:"button",onClick:t,disabled:a,children:$("svg",{className:"w-4 h-4 text-green-600 ",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[O("path",{stroke:"none",d:"M0 0h24v24H0z"}),O("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),O("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})})]})}function yi(e){const{productName:r,price:t,size:i="lg",description:n="",productId:a,selCtx:o,register:s,handleOnChange:u,children:c,isDisabled:f=!1,imgSrc:l=""}=e,d=`${o}---${a}`;return $("div",{className:`flex items-center justify-center p-2 pl-3 my-1 rounded-lg bg-white border-2 border-gray-200 ${f&&"opacity-50"}`,children:[O("input",ze(ae({type:"checkbox",className:`simple-checkbox checkbox-${i} mr-4`,id:d},s(`selected.${o}.${a}`,{onChange:g=>{u(g)}})),{disabled:f,value:"1"})),l&&O("div",{className:"flex mr-2 w-20 max-h-24",children:O("img",{alt:"Product image",className:"max-w-full h-auto",src:l})}),O("label",{htmlFor:d,className:"flex justify-between items-center w-full",children:$("div",{className:"relative",children:[O("p",{className:"w-full text-lg font-semibold",children:r}),O("p",{className:"text-sm text-gray-600",children:n})]})}),O("div",{className:"ml-auto",children:c}),O("label",{htmlFor:d,children:O(Gt,{price:parseFloat(t),addPlusBefore:!0,showIfPriceZero:!0,hiddenIfPriceZero:!0})})]})}function bi(e){const{productName:r,price:t,size:i="lg",description:n="",productId:a,selCtx:o,register:s,handleOnChange:u,checked:c,children:f,isDisabled:l,readOnly:d=!1,imgSrc:g=""}=e,p=`${o}---${a}`;return $("div",{className:`flex items-center justify-between p-2 pl-3 mt-1 mb-1 bg-white rounded-xl border-2 border-gray-200 ${l&&"opacity-50"}`,children:[O("input",ze(ae({type:"radio",className:`simple-radio radio-${i} mr-4`,id:p},s(`radio.${o}`,{onChange:b=>{u(b)}})),{value:a,checked:c,disabled:l,readOnly:d})),g&&O("div",{className:"flex mr-2 w-20 max-h-24",children:O("img",{alt:"Product image",className:"max-w-full h-auto",src:g})}),O("label",{htmlFor:p,className:"flex justify-between items-center w-full",children:$("div",{className:"relative",children:[O("p",{className:"w-full text-lg font-semibold",children:r}),O("p",{className:"text-sm text-gray-600",children:n})]})}),O("div",{className:"ml-auto",children:f}),O("label",{htmlFor:p,children:O(Gt,{price:parseFloat(t),addPlusBefore:!0,showIfPriceZero:!0,hiddenIfPriceZero:!0})})]})}const vs=e=>{const{productName:r,state:t,items:i,price:n,size:a="lg",description:o="",productId:s,selCtx:u,handleOnChangeCheckBox:c,handleOnChangeRadio:f,productAttrs:l,contextAttrs:d,checked:g}=e,{register:p,setValue:b,watch:w}=mt(),v=w(`selected.${u}.${s}`);let x=0;v&&!isNaN(v)&&(x=Number(v));const P=Z(L=>L.isAddDisabled),N=Z(L=>L.isInputDisabled),R=()=>{b(`selected.${u}.${s}`,`${x+1}`)},M=()=>{b(`selected.${u}.${s}`,`${x-1}`)},D=Number(v)===0||!v,_=O(mi,{value:x,add:R,subtract:M,disabledSubtract:D,disabledAdd:P(u,v,l==null?void 0:l.qtyMax)||N(u)&&!v}),{selMin:T="",selMax:k=""}=d;return O("div",{children:T==="1"&&k==="1"?O(bi,{description:o,productName:r,price:n,productId:s,selCtx:u,state:t,items:i,register:p,handleOnChange:f,checked:g,isDisabled:!1,children:_}):O(yi,{description:o,productName:r,price:n,productId:s,selCtx:u,state:t,items:i,register:p,handleOnChange:c,isDisabled:N(u)&&!v||P(u,v,l==null?void 0:l.qtyMax)&&!v,children:_})})},kn=(e,r)=>{Object.keys(e).forEach(t=>{r(`selected.${t}`,e[t])})},En=(e,r,t)=>{const i=r(`selected.${e}`);t(`selected.${e}`,Object.keys(i).reduce((n,a)=>(n[a]=!1,n),{}))},Ln=(e,r,t,i,n)=>{const{target:{checked:a}}=i,{selected:o={}}=n;if(a){kn(o,e);const s=u=>{!Array.isArray(u)||u.map(c=>{if(c.state&&"selected"in c.state){const{state:{selected:f}}=c;kn(f,e)}Array.isArray(c.items)&&s(c.items)})};s(t)}else{Object.keys(o).forEach(u=>{En(u,r,e)});const s=u=>{!Array.isArray(u)||u.map(c=>{const{selCtx:f}=c;r(`selected.${f}`)&&En(f,r,e),s(c.items)})};s(t)}},ms=e=>{const{attrs:r}=e;if(r)return r;{const t=["selMin","selMax","qtyMin","qtyMax","vital","allowMultiple","hidden"],i={};return Object.keys(e).forEach(n=>{t.includes(n)&&(i[n]=e[n])}),i}},ys=e=>{var re;const{productItem:r,contextAttrs:t,selected:i,nestedLvl:n}=e,{register:a,watch:o,setValue:s,getValues:u}=mt(),{items:c,id:f,selCtx:l,state:d={},attrs:g={},emit:p={},fltCtx:b,details:{media:w=[],literals:v},price:x=""}=r,P=ms(r),{name:N,description:R}=v,M=Z(z=>z.isInputDisabled),D=Z(z=>z.setFilter),_=i[l]&&i[l][r.id]&&Number(i[l][r.id])>0,T=w.find(z=>z.name==="MAIN_IMG")||w[0]||{},k=z=>{Ln(s,u,c,z,d)},L=z=>{Ln(s,u,c,z,d);const{target:X}=z,ne=X.name,ee=X.defaultValue,W="selected."+ne.replace("radio.","");s(W,{[ee]:"1"})},I=o(`selected.${l}.${f}`);m.useEffect(()=>{I&&Object.keys(p).length!==0&&D(b,p)},[I]);const G=Rr.useTransition(Array.isArray(r.items)&&r.items.length>0&&I,{from:{opacity:0,transform:"translateY(-10px)"},enter:{opacity:1,transform:"translateY(0)"}});if(!r)return null;let U=x;return(!U||parseFloat(U||"1")===0)&&((re=r==null?void 0:r.state)==null?void 0:re.selected)&&(U=`${xr(r.state.selected,r)||"0"}`),$(nt,{children:[(()=>{switch(as(t==null?void 0:t.selMin,t==null?void 0:t.selMax,t==null?void 0:t.allowMultiple)){case"counter":return O(vs,{description:R,productName:N,price:U,productId:f,selCtx:l,state:d,items:c,handleOnChangeCheckBox:k,handleOnChangeRadio:L,checked:!!_,contextAttrs:t,productAttrs:P});case"radio":return O(bi,{description:R,productName:N,price:U,productId:f,selCtx:l,state:d,items:c,register:a,handleOnChange:L,checked:!!_,isDisabled:!1,imgSrc:(T==null?void 0:T.url)||""});case"checkbox":return O(yi,{description:R,productName:N,price:U,productId:f,selCtx:l,state:d,items:c,register:a,handleOnChange:k,isDisabled:M(l)&&!I,imgSrc:(T==null?void 0:T.url)||""});default:return null}})(),G((z,X)=>X&&O(Rr.animated.div,{className:`border-l-[2px] border-gray-300 ${n>1&&"ml-4 pl-4"}`,style:z,children:O(Cr,{productItems:c,nestedLvl:n+1,context:r})},n+1))]})};function bs(e){var f,l;const{productItem:r,nestedLvl:t,context:{attrs:i={},selCtx:n,kind:a}}=e,{kind:o}=r,{getValues:s}=mt(),{selected:u={}}=s();if(((f=r==null?void 0:r.attrs)==null?void 0:f.hidden)===!0||((l=r==null?void 0:r._)==null?void 0:l.hidden)==="true")return null;switch(o){case Ge.OPTIONS:case Ge.CONFIG:return O(ps,{productItem:r,parentCtx:n,selected:u,nestedLvl:t,parentKind:a});case Ge.PRODUCT:return O(ys,{productItem:r,selected:u,nestedLvl:t,contextAttrs:i});default:return null}}const sr=99,jn=3;function Cr(e){const{productItems:r,nestedLvl:t=1,context:i}=e,n=i.kind!=="3e/product",[a,o]=m.useState(n?jn:sr),{t:s}=Bt(),u=()=>{o(sr)},c=()=>{o(jn)};return O("div",{children:r.map((f,l)=>{if(l<a)return $("div",{children:[O(bs,{productItem:f,nestedLvl:t,context:i},`${i.id}--${f.id}--${l}`),a===sr&&n&&r.length===l+1&&Fn(s("OS.ProductConfigurator.ShowLess"),c,!1)]},`${i.id}--${f.id}--${l}`);if(l===a)return Fn(s("OS.ProductConfigurator.ShowMore"),u,!0)})})}const Fn=(e,r,t)=>O("div",{className:"flex justify-center w-full",children:$("button",{className:"flex px-2 text-lg font-semibold text-black",onClick:r,children:[e,$("svg",{className:`-mr-2 w-7 h-7 ${!t&&"rotate-180"}`,width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[O("path",{stroke:"none",d:"M0 0h24v24H0z"})," ",O("polyline",{points:"7 7 12 12 17 7"})," ",O("polyline",{points:"7 13 12 18 17 13"})]})]})},`${e}`),Os=["id","selCtx","fltCtx"],Oi=".",Si="#dot",Ss=e=>e.replaceAll(Oi,Si),ws=e=>e.replaceAll(Si,Oi),xs=(e,r)=>wi(e,r,Ss),Cs=(e,r)=>wi(e,r,ws),wi=(e,r,t)=>{let i=r;if(Os.includes(e)&&(typeof r=="string"||r instanceof String)&&(i=t(r)),e==="selected"||e==="filter"){const n=JSON.stringify(r),a=t(n);i=JSON.parse(a)}return i},xi=(e,r)=>(Object.keys(e).forEach(t=>{const i=e[t];e[t]=r(t,i),typeof i=="object"&&i!==null&&xi(i,r)}),e),Ps=e=>{const r=JSON.parse(JSON.stringify(e));for(const[t,i]of Object.entries(r))if(i){const n=r[t];for(const[a,o]of Object.entries(n))o===!1&&delete n[a];Object.keys(n).length===0&&delete r[t]}else delete r[t];return r},Ns=e=>Cs("selected",e),ks=()=>{const{watch:e}=mt(),r=e("selected");return console.log("selected",r),$("div",{className:"flex flex-col items-center py-4",children:[O("h2",{className:"mb-4 text-2xl font-bold tracking-wide",children:"Selected State"}),Object.keys(r).map(t=>O("div",{children:Object.values(r[t]).filter(i=>i).length>0&&$(nt,{children:[$("p",{className:"text-lg font-semibold",children:[t,":"]}),Object.keys(r[t]).map(i=>O(he.default.Fragment,{children:r[t][i]&&$("p",{children:[i,":",r[t][i].toString()]})},i))]})},t))]})};function An(e){const{finalPrice:r,isBackIcon:t=!0,handleGoBack:i,displayPriceFrom:n=!1}=e,{t:a}=Bt(),o=Z(c=>c.mainProductCount),s=Z(c=>c.increaseCount),u=Z(c=>c.decreaseCount);return $("div",{className:"flex justify-around items-center px-4 w-full h-16",children:[t&&$("button",{className:"inline-flex items-center py-1 px-2 font-bold text-red-600 hover:bg-red-200 rounded border-2 border-red-600 border-solid",onClick:i,children:[$("svg",{className:"w-5 h-5 text-red-600",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[O("path",{stroke:"none",d:"M0 0h24v24H0z"}),O("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),O("line",{x1:"5",y1:"12",x2:"11",y2:"18"}),O("line",{x1:"5",y1:"12",x2:"11",y2:"6"})]}),O("span",{className:"uppercase",children:`${a("OS.ProductConfigurator.Back")}`})]}),O("div",{className:"px-3",children:O(mi,{value:o,add:s,subtract:u,disabledSubtract:o===1,size:"lg"})}),$("button",{type:"submit",className:"flex justify-center items-center py-1 px-2 w-2/4 font-bold text-white bg-green-600 hover:bg-green-800 rounded border-2 border-green-600 border-solid sm:w-3/5",style:{opacity:`${n?"0.4":"1"}`},disabled:n,children:[$("svg",{className:"mr-2 w-5 h-5 text-white",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[O("circle",{cx:"9",cy:"21",r:"1"})," ",O("circle",{cx:"20",cy:"21",r:"1"}),O("path",{d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"})]}),n?O("span",{children:`${a("OS.ProductConfigurator.Selected.Message.From")} ${r}`}):O("span",{className:"uppercase",children:`${a("OS.ProductConfigurator.Add")} ${r}`})]})]})}const Pt=640,Ci=e=>{const{isModal:r=!1}=e,[t,i]=m.useState(window.innerWidth),[n,a]=m.useState(window.innerHeight),[o,s]=m.useState(window.innerWidth<=Pt),[u,c]=m.useState(window.innerWidth>Pt&&!r);function f(){i(window.innerWidth),a(window.innerHeight)}return m.useEffect(()=>(window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}),[]),m.useEffect(()=>{c(window.innerWidth>Pt&&!r),s(window.innerWidth<=Pt)},[t,e,r]),{isSm:u,isMobile:o,width:t,windowHeight:n}};function Pi(e){var r,t,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e))for(r=0;r<e.length;r++)e[r]&&(t=Pi(e[r]))&&(i&&(i+=" "),i+=t);else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function lt(){for(var e=0,r,t,i="";e<arguments.length;)(r=arguments[e++])&&(t=Pi(r))&&(i&&(i+=" "),i+=t);return i}function Es(e){var ee,W,K,V;const{product:r,handleAddToBasket:t,isModal:i,handleGoBack:n,showDebugState:a=!1}=e,{state:{selected:o={}}={},price:s,minPrice:u="0"}=r,c=ca({defaultValues:{selected:o}}),{handleSubmit:f,getValues:l}=c,d=Z(H=>H.setIsOnSubmittedOnTrue),[g,p]=m.useState("auto"),[b,w]=m.useState(0),v=Z(H=>H.mainProductCount),x=Z(H=>H.getInvalidContextNames),P=Z(H=>H.filter);m.useEffect(()=>{w(1);const H=setTimeout(()=>{L||w(2)},250);return()=>{clearTimeout(H)}},[]),m.useEffect(()=>{console.log("filter",P)},[P]);const N=parseFloat(s)+xr(l("selected"),r),{displayPriceFrom:R,formattedEndPrice:M}=is(N,u,v),D=H=>{d();const B=x();if(B.length)os(vi(B[0])),console.log(B);else{console.log(l("selected"));const ye=Ns(Ps(l("selected")));console.log("decodedCleanedSelected: ",ye),t({price:N/v,quantity:v,selected:ye,filter:P})}},_=m.useRef(),T=m.useRef(),{isSm:k,isMobile:L,windowHeight:I}=Ci({isModal:i}),G=$(nt,{children:[$("div",{className:lt("px-4 w-full",k&&"sm:sticky sm:top-0 sm:w-2/5"),ref:_,children:[r.details.media&&r.details.media[0].url&&O("img",{className:lt("mx-auto mt-2 mb-6 max-h-[250px]",k&&"max-h-[450px]"),alt:r.details.literals.name,src:(ee=r.details)==null?void 0:ee.media[0].url}),O("div",{className:lt(!a&&"hidden"),children:O(ks,{})})]}),$("div",{className:lt("w-full",k&&"sm:w-3/5"),ref:T,children:[$("div",{className:"items-center p-4 w-full",children:[$("div",{className:"flex justify-between mb-4 w-full text-2xl font-semibold",children:[$("span",{className:"",children:[r.details.literals.name," "]}),O(Gt,{price:N,minPrice:u})]}),O("span",{className:"text-gray-600",children:(W=r.details.literals)==null?void 0:W.description})]}),$("div",{className:`items-center justify-center w-full px-4 product-configuration ${(r==null?void 0:r.items)&&"py-2 bg-gray-100"}`,children:[(r==null?void 0:r.items)&&O(Cr,{productItems:r.items,context:r}),O("div",{className:"sm:h-[64px]"})]}),k&&O("div",{className:"-mt-5 mb-2 bg-gray-100",children:O(An,{finalPrice:M,isBackIcon:!1,handleGoBack:n,displayPriceFrom:R})})]})]}),U=(K=_==null?void 0:_.current)==null?void 0:K.clientHeight,Y=(V=T==null?void 0:T.current)==null?void 0:V.clientHeight,re=U+Y;re>window.innerHeight*.8||isNaN(re)?g!=="80vh"&&p("80vh"):g!=="auto"&&p("auto"),console.log({height:U,height2:Y,modalContentHeight:re,modalSizeStage:b});const z=`${I-64-56}px`,X=!k,ne={"--mobile-submit-row-top":`${I-64-80}px`};return O(Ji,ze(ae({},c),{children:$("form",{id:"product-configurator-view",className:"w-full h-full",style:{overflow:"hidden",textAlign:"left"},onSubmit:f(D),children:[O("div",{className:lt("flex relative flex-col items-start w-full form-body stretch",!X&&"sm:flex-row-reverse sm:pb-0",!L&&"mobile-scrollbar"),style:{height:`${L?z:g}`,minHeight:"400px",overflowY:`${i?"scroll":"visible"}`},children:G}),X&&O("div",{className:`w-full h-16 bg-white sm:fixed sm:bottom-0 ${L?"submit-row-mobile":"submit-row"}`,style:ne,children:O(An,{handleGoBack:n,finalPrice:M,isBackIcon:!1})})]})}))}function xe(){return xe=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},xe.apply(this,arguments)}function Qe(e,r){if(e==null)return{};var t={},i=Object.keys(e),n,a;for(a=0;a<i.length;a++)n=i[a],!(r.indexOf(n)>=0)&&(t[n]=e[n]);return t}function Ls(e,r){if(!!e){if(typeof e=="string")return Rn(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Rn(e,r)}}function Rn(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,i=new Array(r);t<r;t++)i[t]=e[t];return i}function we(e,r){var t;if(typeof Symbol=="undefined"||e[Symbol.iterator]==null){if(Array.isArray(e)||(t=Ls(e))||r&&e&&typeof e.length=="number"){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
15
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return t=e[Symbol.iterator](),t.next.bind(t)}function Ee(e,r){if(e in r){for(var t=r[e],i=arguments.length,n=new Array(i>2?i-2:0),a=2;a<i;a++)n[a-2]=arguments[a];return typeof t=="function"?t.apply(void 0,n):t}var o=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(r).map(function(s){return'"'+s+'"'}).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(o,Ee),o}var Ve;(function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"})(Ve||(Ve={}));var pe;(function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"})(pe||(pe={}));function Be(e){var r=e.props,t=e.slot,i=e.defaultTag,n=e.features,a=e.visible,o=a===void 0?!0:a,s=e.name;if(o)return Nt(r,t,i,s);var u=n!=null?n:Ve.None;if(u&Ve.Static){var c=r.static,f=c===void 0?!1:c,l=Qe(r,["static"]);if(f)return Nt(l,t,i,s)}if(u&Ve.RenderStrategy){var d,g=r.unmount,p=g===void 0?!0:g,b=Qe(r,["unmount"]),w=p?pe.Unmount:pe.Hidden;return Ee(w,(d={},d[pe.Unmount]=function(){return null},d[pe.Hidden]=function(){return Nt(xe({},b,{hidden:!0,style:{display:"none"}}),t,i,s)},d))}return Nt(r,t,i,s)}function Nt(e,r,t,i){var n;r===void 0&&(r={});var a=ur(e,["unmount","static"]),o=a.as,s=o===void 0?t:o,u=a.children,c=a.refName,f=c===void 0?"ref":c,l=Qe(a,["as","children","refName"]),d=e.ref!==void 0?(n={},n[f]=e.ref,n):{},g=typeof u=="function"?u(r):u;if(l.className&&typeof l.className=="function"&&(l.className=l.className(r)),s===m.Fragment&&Object.keys(l).length>0){if(!m.isValidElement(g)||Array.isArray(g)&&g.length>1)throw new Error(['Passing props on "Fragment"!',"","The current component <"+i+' /> is rendering a "Fragment".',"However we need to passthrough the following props:",Object.keys(l).map(function(p){return" - "+p}).join(`
16
- `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(function(p){return" - "+p}).join(`
1
+ "use strict";var Ai=Object.defineProperty,Ri=Object.defineProperties;var Ti=Object.getOwnPropertyDescriptors;var Nr=Object.getOwnPropertySymbols;var Mi=Object.prototype.hasOwnProperty,Di=Object.prototype.propertyIsEnumerable;var kr=(e,r,t)=>r in e?Ai(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ie=(e,r)=>{for(var t in r||(r={}))Mi.call(r,t)&&kr(e,t,r[t]);if(Nr)for(var t of Nr(r))Di.call(r,t)&&kr(e,t,r[t]);return e},We=(e,r)=>Ri(e,Ti(r));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var y=require("react"),p=require("react/jsx-runtime"),Er=require("react-spring"),Ii=require("react-dom");function _i(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var he=_i(y);var ht=e=>e.type==="checkbox",Xe=e=>e instanceof Date,ce=e=>e==null;const Dn=e=>typeof e=="object";var ae=e=>!ce(e)&&!Array.isArray(e)&&Dn(e)&&!Xe(e),Vi=e=>ae(e)&&e.target?ht(e.target)?e.target.checked:e.target.value:e,$i=e=>e.substring(0,e.search(/.\d/))||e,Ui=(e,r)=>[...e].some(t=>$i(r)===t),It=e=>e.filter(Boolean),ne=e=>e===void 0,F=(e,r,t)=>{if(!r||!ae(e))return t;const i=It(r.split(/[,[\].]+?/)).reduce((n,a)=>ce(n)?n:n[a],e);return ne(i)||i===e?ne(e[r])?t:e[r]:i};const Lr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},be={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Le={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};var _t=(e,r)=>{const t=Object.assign({},e);return delete t[r],t};const In=he.default.createContext(null),pt=()=>he.default.useContext(In),Hi=e=>he.default.createElement(In.Provider,{value:_t(e,"children")},e.children);var Bi=(e,r,t,i=!0)=>{const n={};for(const a in e)Object.defineProperty(n,a,{get:()=>{const o=a;return r[o]!==be.all&&(r[o]=!i||be.all),t&&(t[o]=!0),e[o]}});return n},de=e=>ae(e)&&!Object.keys(e).length,Wi=(e,r,t)=>{const i=_t(e,"name");return de(i)||Object.keys(i).length>=Object.keys(r).length||Object.keys(i).find(n=>r[n]===(!t||be.all))},Jt=e=>Array.isArray(e)?e:[e];function zi(e){const r=he.default.useRef(e);r.current=e,he.default.useEffect(()=>{const t=n=>{n&&n.unsubscribe()},i=!e.disabled&&r.current.subject.subscribe({next:r.current.callback});return()=>t(i)},[e.disabled])}var Pe=e=>typeof e=="string",qi=(e,r,t,i)=>{const n=Array.isArray(e);return Pe(e)?(i&&r.watch.add(e),F(t,e)):n?e.map(a=>(i&&r.watch.add(a),F(t,a))):(i&&(r.watchAll=!0),t)},Vt=e=>typeof e=="function",_n=e=>{for(const r in e)if(Vt(e[r]))return!0;return!1},Gi=(e,r,t,i,n)=>r?Object.assign(Object.assign({},t[e]),{types:Object.assign(Object.assign({},t[e]&&t[e].types?t[e].types:{}),{[i]:n||!0})}):{},hr=e=>/^\w*$/.test(e),Vn=e=>It(e.replace(/["|']|\]/g,"").split(/\.|\[/));function ee(e,r,t){let i=-1;const n=hr(r)?[r]:Vn(r),a=n.length,o=a-1;for(;++i<a;){const s=n[i];let u=t;if(i!==o){const c=e[s];u=ae(c)||Array.isArray(c)?c:isNaN(+n[i+1])?{}:[]}e[s]=u,e=e[s]}return e}const ur=(e,r,t)=>{for(const i of t||Object.keys(e)){const n=F(e,i);if(n){const a=n._f,o=_t(n,"_f");if(a&&r(a.name)){if(a.ref.focus&&ne(a.ref.focus()))break;if(a.refs){a.refs[0].focus();break}}else ae(o)&&ur(o,r)}}};var Fr=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));function Ze(e){let r;const t=Array.isArray(e);if(e instanceof Date)r=new Date(e);else if(e instanceof Set)r=new Set(e);else if(t||ae(e)){r=t?[]:{};for(const i in e){if(Vt(e[i])){r=e;break}r[i]=Ze(e[i])}}else return e;return r}function Yt(){let e=[];return{get observers(){return e},next:n=>{for(const a of e)a.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(a=>a!==n)}}),unsubscribe:()=>{e=[]}}}var Nt=e=>ce(e)||!Dn(e);function et(e,r){if(Nt(e)||Nt(r))return e===r;if(Xe(e)&&Xe(r))return e.getTime()===r.getTime();const t=Object.keys(e),i=Object.keys(r);if(t.length!==i.length)return!1;for(const n of t){const a=e[n];if(!i.includes(n))return!1;if(n!=="ref"){const o=r[n];if(Xe(a)&&Xe(o)||ae(a)&&ae(o)||Array.isArray(a)&&Array.isArray(o)?!et(a,o):a!==o)return!1}}return!0}var Ar=e=>({isOnSubmit:!e||e===be.onSubmit,isOnBlur:e===be.onBlur,isOnChange:e===be.onChange,isOnAll:e===be.all,isOnTouch:e===be.onTouched}),ft=e=>typeof e=="boolean",pr=e=>e.type==="file",lr=e=>e instanceof HTMLElement,$n=e=>e.type==="select-multiple",vr=e=>e.type==="radio",Ki=e=>vr(e)||ht(e),Rr=typeof window!="undefined"&&typeof window.HTMLElement!="undefined"&&typeof document!="undefined",Zt=e=>lr(e)&&e.isConnected;function Qi(e,r){const t=r.slice(0,-1).length;let i=0;for(;i<t;)e=ne(e)?i++:e[r[i++]];return e}function ue(e,r){const t=hr(r)?[r]:Vn(r),i=t.length==1?e:Qi(e,t),n=t[t.length-1];let a;i&&delete i[n];for(let o=0;o<t.slice(0,-1).length;o++){let s=-1,u;const c=t.slice(0,-(o+1)),f=c.length-1;for(o>0&&(a=e);++s<c.length;){const l=c[s];u=u?u[l]:e[l],f===s&&(ae(u)&&de(u)||Array.isArray(u)&&!u.filter(d=>ae(d)&&!de(d)||ft(d)).length)&&(a?delete a[l]:delete e[l]),a=u}}return e}function kt(e,r={}){const t=Array.isArray(e);if(ae(e)||t)for(const i in e)Array.isArray(e[i])||ae(e[i])&&!_n(e[i])?(r[i]=Array.isArray(e[i])?[]:{},kt(e[i],r[i])):ce(e[i])||(r[i]=!0);return r}function Un(e,r,t){const i=Array.isArray(e);if(ae(e)||i)for(const n in e)Array.isArray(e[n])||ae(e[n])&&!_n(e[n])?ne(r)||Nt(t[n])?t[n]=Array.isArray(e[n])?kt(e[n],[]):Object.assign({},kt(e[n])):Un(e[n],ce(r)?{}:r[n],t[n]):t[n]=!et(e[n],r[n]);return t}var Tr=(e,r)=>Un(e,r,kt(r));const Mr={value:!1,isValid:!1},Dr={value:!0,isValid:!0};var Hn=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ne(e[0].attributes.value)?ne(e[0].value)||e[0].value===""?Dr:{value:e[0].value,isValid:!0}:Dr:Mr}return Mr},Bn=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:i})=>ne(e)?e:r?e===""?NaN:+e:t&&Pe(e)?new Date(e):i?i(e):e;const Ir={isValid:!1,value:null};var Wn=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,Ir):Ir;function Xt(e){const r=e.ref;if(!(e.refs?e.refs.every(t=>t.disabled):r.disabled))return pr(r)?r.files:vr(r)?Wn(e.refs).value:$n(r)?[...r.selectedOptions].map(({value:t})=>t):ht(r)?Hn(e.refs).value:Bn(ne(r.value)?e.ref.value:r.value,e)}var Ji=(e,r,t,i)=>{const n={};for(const a of e){const o=F(r,a);o&&ee(n,a,o._f)}return{criteriaMode:t,names:[...e],fields:n,shouldUseNativeValidation:i}},Et=e=>e instanceof RegExp,rt=e=>ne(e)?void 0:Et(e)?e.source:ae(e)?Et(e.value)?e.value.source:e.value:e,Yi=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function _r(e,r,t){const i=F(e,t);if(i||hr(t))return{error:i,name:t};const n=t.split(".");for(;n.length;){const a=n.join("."),o=F(r,a),s=F(e,a);if(o&&!Array.isArray(o)&&t!==a)return{name:t};if(s&&s.type)return{name:a,error:s};n.pop()}return{name:t}}var Zi=(e,r,t,i,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(r||e):(t?i.isOnBlur:n.isOnBlur)?!e:(t?i.isOnChange:n.isOnChange)?e:!0,Xi=(e,r)=>!It(F(e,r)).length&&ue(e,r),Pt=e=>Pe(e)||he.default.isValidElement(e);function Vr(e,r,t="validate"){if(Pt(e)||Array.isArray(e)&&e.every(Pt)||ft(e)&&!e)return{type:t,message:Pt(e)?e:"",ref:r}}var Qe=e=>ae(e)&&!Et(e)?e:{value:e,message:""},$r=async(e,r,t,i)=>{const{ref:n,refs:a,required:o,maxLength:s,minLength:u,min:c,max:f,pattern:l,validate:d,name:g,valueAsNumber:v,mount:x,disabled:S}=e._f;if(!x||S)return{};const m=a?a[0]:n,w=N=>{i&&m.reportValidity&&(m.setCustomValidity(ft(N)?"":N||" "),m.reportValidity())},P={},j=vr(n),R=ht(n),M=j||R,D=(v||pr(n))&&!n.value||r===""||Array.isArray(r)&&!r.length,_=Gi.bind(null,g,t,P),T=(N,E,I,q=Le.maxLength,$=Le.minLength)=>{const Q=N?E:I;P[g]=Object.assign({type:N?q:$,message:Q,ref:n},_(N?q:$,Q))};if(o&&(!M&&(D||ce(r))||ft(r)&&!r||R&&!Hn(a).isValid||j&&!Wn(a).isValid)){const{value:N,message:E}=Pt(o)?{value:!!o,message:o}:Qe(o);if(N&&(P[g]=Object.assign({type:Le.required,message:E,ref:m},_(Le.required,E)),!t))return w(E),P}if(!D&&(!ce(c)||!ce(f))){let N,E;const I=Qe(f),q=Qe(c);if(isNaN(r)){const $=n.valueAsDate||new Date(r);Pe(I.value)&&(N=$>new Date(I.value)),Pe(q.value)&&(E=$<new Date(q.value))}else{const $=n.valueAsNumber||+r;ce(I.value)||(N=$>I.value),ce(q.value)||(E=$<q.value)}if((N||E)&&(T(!!N,I.message,q.message,Le.max,Le.min),!t))return w(P[g].message),P}if((s||u)&&!D&&Pe(r)){const N=Qe(s),E=Qe(u),I=!ce(N.value)&&r.length>N.value,q=!ce(E.value)&&r.length<E.value;if((I||q)&&(T(I,N.message,E.message),!t))return w(P[g].message),P}if(l&&!D&&Pe(r)){const{value:N,message:E}=Qe(l);if(Et(N)&&!r.match(N)&&(P[g]=Object.assign({type:Le.pattern,message:E,ref:n},_(Le.pattern,E)),!t))return w(E),P}if(d){if(Vt(d)){const N=await d(r),E=Vr(N,m);if(E&&(P[g]=Object.assign(Object.assign({},E),_(Le.validate,E.message)),!t))return w(E.message),P}else if(ae(d)){let N={};for(const E in d){if(!de(N)&&!t)break;const I=Vr(await d[E](r),m,E);I&&(N=Object.assign(Object.assign({},I),_(E,I.message)),w(I.message),t&&(P[g]=N))}if(!de(N)&&(P[g]=Object.assign({ref:m},N),!t))return P}}return w(!0),P};const ea={mode:be.onSubmit,reValidateMode:be.onChange,shouldFocusError:!0};function ta(e={}){let r=Object.assign(Object.assign({},ea),e),t={isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}},i={},n=r.defaultValues||{},a=r.shouldUnregister?{}:Ze(n),o={action:!1,mount:!1,watch:!1},s={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,c=0,f={};const l={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={watch:Yt(),array:Yt(),state:Yt()},g=Ar(r.mode),v=Ar(r.reValidateMode),x=r.criteriaMode===be.all,S=(h,b)=>(...O)=>{clearTimeout(c),c=window.setTimeout(()=>h(...O),b)},m=async h=>{let b=!1;return l.isValid&&(b=r.resolver?de((await D()).errors):await T(i,!0),!h&&b!==t.isValid&&(t.isValid=b,d.state.next({isValid:b}))),b},w=(h,b=[],O,k,L=!0,C=!0)=>{if(k&&O){if(o.action=!0,C&&Array.isArray(F(i,h))){const A=O(F(i,h),k.argA,k.argB);L&&ee(i,h,A)}if(l.errors&&C&&Array.isArray(F(t.errors,h))){const A=O(F(t.errors,h),k.argA,k.argB);L&&ee(t.errors,h,A),Xi(t.errors,h)}if(l.touchedFields&&Array.isArray(F(t.touchedFields,h))){const A=O(F(t.touchedFields,h),k.argA,k.argB);L&&ee(t.touchedFields,h,A)}l.dirtyFields&&(t.dirtyFields=Tr(n,a)),d.state.next({isDirty:E(h,b),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else ee(a,h,b)},P=(h,b)=>(ee(t.errors,h,b),d.state.next({errors:t.errors})),j=(h,b,O,k)=>{const L=F(i,h);if(L){const C=F(a,h,ne(O)?F(n,h):O);ne(C)||k&&k.defaultChecked||b?ee(a,h,b?C:Xt(L._f)):$(h,C),o.mount&&m()}},R=(h,b,O,k,L)=>{let C=!1;const A={name:h},z=F(t.touchedFields,h);if(l.isDirty){const Ae=t.isDirty;t.isDirty=A.isDirty=E(),C=Ae!==A.isDirty}if(l.dirtyFields&&(!O||k)){const Ae=F(t.dirtyFields,h);et(F(n,h),b)?ue(t.dirtyFields,h):ee(t.dirtyFields,h,!0),A.dirtyFields=t.dirtyFields,C=C||Ae!==F(t.dirtyFields,h)}return O&&!z&&(ee(t.touchedFields,h,O),A.touchedFields=t.touchedFields,C=C||l.touchedFields&&z!==O),C&&L&&d.state.next(A),C?A:{}},M=async(h,b,O,k,L)=>{const C=F(t.errors,b),A=l.isValid&&t.isValid!==O;if(e.delayError&&k?(u=u||S(P,e.delayError),u(b,k)):(clearTimeout(c),k?ee(t.errors,b,k):ue(t.errors,b)),((k?!et(C,k):C)||!de(L)||A)&&!h){const z=Object.assign(Object.assign(Object.assign({},L),A?{isValid:O}:{}),{errors:t.errors,name:b});t=Object.assign(Object.assign({},t),z),d.state.next(z)}f[b]--,l.isValidating&&!Object.values(f).some(z=>z)&&(d.state.next({isValidating:!1}),f={})},D=async h=>r.resolver?await r.resolver(Object.assign({},a),r.context,Ji(h||s.mount,i,r.criteriaMode,r.shouldUseNativeValidation)):{},_=async h=>{const{errors:b}=await D();if(h)for(const O of h){const k=F(b,O);k?ee(t.errors,O,k):ue(t.errors,O)}else t.errors=b;return b},T=async(h,b,O={valid:!0})=>{for(const k in h){const L=h[k];if(L){const C=L._f,A=_t(L,"_f");if(C){const z=await $r(L,F(a,C.name),x,r.shouldUseNativeValidation);if(z[C.name]&&(O.valid=!1,b))break;b||(z[C.name]?ee(t.errors,C.name,z[C.name]):ue(t.errors,C.name))}A&&await T(A,b,O)}}return O.valid},N=()=>{for(const h of s.unMount){const b=F(i,h);b&&(b._f.refs?b._f.refs.every(O=>!Zt(O)):!Zt(b._f.ref))&&U(h)}s.unMount=new Set},E=(h,b)=>(h&&b&&ee(a,h,b),!et(re(),n)),I=(h,b,O)=>{const k=Object.assign({},o.mount?a:ne(b)?n:Pe(h)?{[h]:b}:b);return qi(h,s,k,O)},q=h=>It(F(o.mount?a:n,h,e.shouldUnregister?F(n,h,[]):[])),$=(h,b,O={})=>{const k=F(i,h);let L=b;if(k){const C=k._f;C&&(!C.disabled&&ee(a,h,Bn(b,C)),L=Rr&&lr(C.ref)&&ce(b)?"":b,$n(C.ref)?[...C.ref.options].forEach(A=>A.selected=L.includes(A.value)):C.refs?ht(C.ref)?C.refs.length>1?C.refs.forEach(A=>A.checked=Array.isArray(L)?!!L.find(z=>z===A.value):L===A.value):C.refs[0]&&(C.refs[0].checked=!!L):C.refs.forEach(A=>A.checked=A.value===L):pr(C.ref)?C.ref.value="":(C.ref.value=L,C.ref.type||d.watch.next({name:h})))}(O.shouldDirty||O.shouldTouch)&&R(h,L,O.shouldTouch,O.shouldDirty,!0),O.shouldValidate&&Z(h)},Q=(h,b,O)=>{for(const k in b){const L=b[k],C=`${h}.${k}`,A=F(i,C);(s.array.has(h)||!Nt(L)||A&&!A._f)&&!Xe(L)?Q(C,L,O):$(C,L,O)}},te=(h,b,O={})=>{const k=F(i,h),L=s.array.has(h),C=Ze(b);ee(a,h,C),L?(d.array.next({name:h,values:a}),(l.isDirty||l.dirtyFields)&&O.shouldDirty&&(t.dirtyFields=Tr(n,a),d.state.next({name:h,dirtyFields:t.dirtyFields,isDirty:E(h,C)}))):k&&!k._f&&!ce(C)?Q(h,C,O):$(h,C,O),Fr(h,s)&&d.state.next({}),d.watch.next({name:h})},W=async h=>{const b=h.target;let O=b.name;const k=F(i,O);if(k){let L,C;const A=b.type?Xt(k._f):Vi(h),z=h.type===Lr.BLUR||h.type===Lr.FOCUS_OUT,Ae=!Yi(k._f)&&!r.resolver&&!F(t.errors,O)&&!k._f.deps||Zi(z,F(t.touchedFields,O),t.isSubmitted,v,g),bt=Fr(O,s,z);ee(a,O,A),z?k._f.onBlur&&k._f.onBlur(h):k._f.onChange&&k._f.onChange(h);const Qt=R(O,A,z,!1),Li=!de(Qt)||bt;if(!z&&d.watch.next({name:O,type:h.type}),Ae)return Li&&d.state.next(Object.assign({name:O},bt?{}:Qt));if(!z&&bt&&d.state.next({}),f[O]=(f[O],1),d.state.next({isValidating:!0}),r.resolver){const{errors:Pr}=await D([O]),Fi=_r(t.errors,i,O),jr=_r(Pr,i,Fi.name||O);L=jr.error,O=jr.name,C=de(Pr)}else L=(await $r(k,F(a,O),x,r.shouldUseNativeValidation))[O],C=await m(!0);k._f.deps&&Z(k._f.deps),M(!1,O,C,L,Qt)}},Z=async(h,b={})=>{let O,k;const L=Jt(h);if(d.state.next({isValidating:!0}),r.resolver){const C=await _(ne(h)?h:L);O=de(C),k=h?!L.some(A=>F(C,A)):O}else h?(k=(await Promise.all(L.map(async C=>{const A=F(i,C);return await T(A&&A._f?{[C]:A}:A)}))).every(Boolean),!(!k&&!t.isValid)&&m()):k=O=await T(i);return d.state.next(Object.assign(Object.assign(Object.assign({},!Pe(h)||l.isValid&&O!==t.isValid?{}:{name:h}),r.resolver?{isValid:O}:{}),{errors:t.errors,isValidating:!1})),b.shouldFocus&&!k&&ur(i,C=>F(t.errors,C),h?L:s.mount),k},re=h=>{const b=Object.assign(Object.assign({},n),o.mount?a:{});return ne(h)?b:Pe(h)?F(b,h):h.map(O=>F(b,O))},X=(h,b)=>({invalid:!!F((b||t).errors,h),isDirty:!!F((b||t).dirtyFields,h),isTouched:!!F((b||t).touchedFields,h),error:F((b||t).errors,h)}),B=h=>{h?Jt(h).forEach(b=>ue(t.errors,b)):t.errors={},d.state.next({errors:t.errors})},G=(h,b,O)=>{const k=(F(i,h,{_f:{}})._f||{}).ref;ee(t.errors,h,Object.assign(Object.assign({},b),{ref:k})),d.state.next({name:h,errors:t.errors,isValid:!1}),O&&O.shouldFocus&&k&&k.focus&&k.focus()},V=(h,b)=>Vt(h)?d.watch.subscribe({next:O=>h(I(void 0,b),O)}):I(h,b,!0),U=(h,b={})=>{for(const O of h?Jt(h):s.mount)s.mount.delete(O),s.array.delete(O),F(i,O)&&(b.keepValue||(ue(i,O),ue(a,O)),!b.keepError&&ue(t.errors,O),!b.keepDirty&&ue(t.dirtyFields,O),!b.keepTouched&&ue(t.touchedFields,O),!r.shouldUnregister&&!b.keepDefaultValue&&ue(n,O));d.watch.next({}),d.state.next(Object.assign(Object.assign({},t),b.keepDirty?{isDirty:E()}:{})),!b.keepIsValid&&m()},H=(h,b={})=>{let O=F(i,h);const k=ft(b.disabled);return ee(i,h,{_f:Object.assign(Object.assign(Object.assign({},O&&O._f?O._f:{ref:{name:h}}),{name:h,mount:!0}),b)}),s.mount.add(h),O?k&&ee(a,h,b.disabled?void 0:F(a,h,Xt(O._f))):j(h,!0,b.value),Object.assign(Object.assign(Object.assign({},k?{disabled:b.disabled}:{}),r.shouldUseNativeValidation?{required:!!b.required,min:rt(b.min),max:rt(b.max),minLength:rt(b.minLength),maxLength:rt(b.maxLength),pattern:rt(b.pattern)}:{}),{name:h,onChange:W,onBlur:W,ref:L=>{if(L){H(h,b),O=F(i,h);const C=ne(L.value)&&L.querySelectorAll&&L.querySelectorAll("input,select,textarea")[0]||L,A=Ki(C),z=O._f.refs||[];if(A?z.find(Ae=>Ae===C):C===O._f.ref)return;ee(i,h,{_f:Object.assign(Object.assign({},O._f),A?{refs:z.concat(C).filter(Zt),ref:{type:C.type,name:h}}:{ref:C})}),j(h,!1,void 0,C)}else O=F(i,h,{}),O._f&&(O._f.mount=!1),(r.shouldUnregister||b.shouldUnregister)&&!(Ui(s.array,h)&&o.action)&&s.unMount.add(h)}})};return{control:{register:H,unregister:U,getFieldState:X,_executeSchema:D,_getWatch:I,_getDirty:E,_updateValid:m,_removeUnmounted:N,_updateFieldArray:w,_getFieldArray:q,_subjects:d,_proxyFormState:l,get _fields(){return i},get _formValues(){return a},get _stateFlags(){return o},set _stateFlags(h){o=h},get _defaultValues(){return n},get _names(){return s},set _names(h){s=h},get _formState(){return t},set _formState(h){t=h},get _options(){return r},set _options(h){r=Object.assign(Object.assign({},r),h)}},trigger:Z,register:H,handleSubmit:(h,b)=>async O=>{O&&(O.preventDefault&&O.preventDefault(),O.persist&&O.persist());let k=!0,L=Ze(a);d.state.next({isSubmitting:!0});try{if(r.resolver){const{errors:C,values:A}=await D();t.errors=C,L=A}else await T(i);de(t.errors)&&Object.keys(t.errors).every(C=>F(L,C))?(d.state.next({errors:{},isSubmitting:!0}),await h(L,O)):(b&&await b(Object.assign({},t.errors),O),r.shouldFocusError&&ur(i,C=>F(t.errors,C),s.mount))}catch(C){throw k=!1,C}finally{t.isSubmitted=!0,d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:de(t.errors)&&k,submitCount:t.submitCount+1,errors:t.errors})}},watch:V,setValue:te,getValues:re,reset:(h,b={})=>{const O=h||n,k=Ze(O),L=h&&!de(h)?k:n;if(b.keepDefaultValues||(n=O),!b.keepValues){if(Rr&&ne(h))for(const C of s.mount){const A=F(i,C);if(A&&A._f){const z=Array.isArray(A._f.refs)?A._f.refs[0]:A._f.ref;try{lr(z)&&z.closest("form").reset();break}catch{}}}a=e.shouldUnregister?b.keepDefaultValues?Ze(n):{}:k,i={},d.array.next({values:L}),d.watch.next({values:L})}s={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!l.isValid||!!b.keepIsValid,o.watch=!!e.shouldUnregister,d.state.next({submitCount:b.keepSubmitCount?t.submitCount:0,isDirty:b.keepDirty?t.isDirty:b.keepDefaultValues?!et(h,n):!1,isSubmitted:b.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:b.keepDirty?t.dirtyFields:b.keepDefaultValues&&h?Object.entries(h).reduce((C,[A,z])=>Object.assign(Object.assign({},C),{[A]:z!==F(n,A)}),{}):{},touchedFields:b.keepTouched?t.touchedFields:{},errors:b.keepErrors?t.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},resetField:(h,b={})=>{F(i,h)&&(ne(b.defaultValue)?te(h,F(n,h)):(te(h,b.defaultValue),ee(n,h,b.defaultValue)),b.keepTouched||ue(t.touchedFields,h),b.keepDirty||(ue(t.dirtyFields,h),t.isDirty=b.defaultValue?E(h,F(n,h)):E()),b.keepError||(ue(t.errors,h),l.isValid&&m()),d.state.next(Object.assign({},t)))},clearErrors:B,unregister:U,setError:G,setFocus:(h,b={})=>{const O=F(i,h)._f,k=O.refs?O.refs[0]:O.ref;b.shouldSelect?k.select():k.focus()},getFieldState:X}}function ra(e={}){const r=he.default.useRef(),[t,i]=he.default.useState({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}});r.current?r.current.control._options=e:r.current=Object.assign(Object.assign({},ta(e)),{formState:t});const n=r.current.control,a=he.default.useCallback(o=>{Wi(o,n._proxyFormState,!0)&&(n._formState=Object.assign(Object.assign({},n._formState),o),i(Object.assign({},n._formState)))},[n]);return zi({subject:n._subjects.state,callback:a}),he.default.useEffect(()=>{n._stateFlags.mount||(n._proxyFormState.isValid&&n._updateValid(),n._stateFlags.mount=!0),n._stateFlags.watch&&(n._stateFlags.watch=!1,n._subjects.state.next({})),n._removeUnmounted()}),r.current.formState=Bi(t,n._proxyFormState),r.current}function De(e){return De=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},De(e)}function Ee(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function pe(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function Ur(e,r){for(var t=0;t<r.length;t++){var i=r[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function ve(e,r,t){return r&&Ur(e.prototype,r),t&&Ur(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hr(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function Br(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Hr(Object(t),!0).forEach(function(i){Ee(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Hr(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}var cr={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0},zn,na=he.default.createContext();function ia(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};cr=Br(Br({},cr),e)}function aa(){return cr}var oa=function(){function e(){pe(this,e),this.usedNamespaces={}}return ve(e,[{key:"addUsedNamespaces",value:function(t){var i=this;t.forEach(function(n){i.usedNamespaces[n]||(i.usedNamespaces[n]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),e}();function sa(e){zn=e}function ua(){return zn}var la={type:"3rdParty",init:function(r){ia(r.options.react),sa(r)}};function ca(){if(console&&console.warn){for(var e,r=arguments.length,t=new Array(r),i=0;i<r;i++)t[i]=arguments[i];typeof t[0]=="string"&&(t[0]="react-i18next:: ".concat(t[0])),(e=console).warn.apply(e,t)}}var Wr={};function fr(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];typeof r[0]=="string"&&Wr[r[0]]||(typeof r[0]=="string"&&(Wr[r[0]]=new Date),ca.apply(void 0,r))}function zr(e,r,t){e.loadNamespaces(r,function(){if(e.isInitialized)t();else{var i=function n(){setTimeout(function(){e.off("initialized",n)},0),t()};e.on("initialized",i)}})}function fa(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!r.languages||!r.languages.length)return fr("i18n.languages were undefined or empty",r.languages),!0;var i=r.languages[0],n=r.options?r.options.fallbackLng:!1,a=r.languages[r.languages.length-1];if(i.toLowerCase()==="cimode")return!0;var o=function(u,c){var f=r.services.backendConnector.state["".concat(u,"|").concat(c)];return f===-1||f===2};return t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!o(r.isLanguageChangingTo,e)?!1:!!(r.hasResourceBundle(i,e)||!r.services.backendConnector.backend||o(i,e)&&(!n||o(a,e)))}function qn(e){if(Array.isArray(e))return e}function da(e,r){var t=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var i=[],n=!0,a=!1,o,s;try{for(t=t.call(e);!(n=(o=t.next()).done)&&(i.push(o.value),!(r&&i.length===r));n=!0);}catch(u){a=!0,s=u}finally{try{!n&&t.return!=null&&t.return()}finally{if(a)throw s}}return i}}function qr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,i=new Array(r);t<r;t++)i[t]=e[t];return i}function Gn(e,r){if(!!e){if(typeof e=="string")return qr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return qr(e,r)}}function Kn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ga(e,r){return qn(e)||da(e,r)||Gn(e,r)||Kn()}function Gr(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function er(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Gr(Object(t),!0).forEach(function(i){Ee(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Gr(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function $t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=r.i18n,i=y.useContext(na)||{},n=i.i18n,a=i.defaultNS,o=t||n||ua();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new oa),!o){fr("You will need to pass in an i18next instance by using initReactI18next");var s=function(D){return Array.isArray(D)?D[D.length-1]:D},u=[s,{},!1];return u.t=s,u.i18n={},u.ready=!1,u}o.options.react&&o.options.react.wait!==void 0&&fr("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var c=er(er(er({},aa()),o.options.react),r),f=c.useSuspense,l=c.keyPrefix,d=e||a||o.options&&o.options.defaultNS;d=typeof d=="string"?[d]:d||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(d);var g=(o.isInitialized||o.initializedStoreOnce)&&d.every(function(M){return fa(M,o,c)});function v(){return o.getFixedT(null,c.nsMode==="fallback"?d:d[0],l)}var x=y.useState(v),S=ga(x,2),m=S[0],w=S[1],P=y.useRef(!0);y.useEffect(function(){var M=c.bindI18n,D=c.bindI18nStore;P.current=!0,!g&&!f&&zr(o,d,function(){P.current&&w(v)});function _(){P.current&&w(v)}return M&&o&&o.on(M,_),D&&o&&o.store.on(D,_),function(){P.current=!1,M&&o&&M.split(" ").forEach(function(T){return o.off(T,_)}),D&&o&&D.split(" ").forEach(function(T){return o.store.off(T,_)})}},[o,d.join()]);var j=y.useRef(!0);y.useEffect(function(){P.current&&!j.current&&w(v),j.current=!1},[o]);var R=[m,o,g];if(R.t=m,R.i18n=o,R.ready=g,g||!g&&!f)return R;throw new Promise(function(M){zr(o,d,function(){M()})})}function Ie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dr(e,r){return dr=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},dr(e,r)}function Ut(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&dr(e,r)}function vt(e,r){if(r&&(De(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ie(e)}function ke(e){return ke=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ke(e)}function ha(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function pa(e){return qn(e)||ha(e)||Gn(e)||Kn()}function Kr(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function Qr(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Kr(Object(t),!0).forEach(function(i){Ee(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Kr(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}var va={type:"logger",log:function(r){this.output("log",r)},warn:function(r){this.output("warn",r)},error:function(r){this.output("error",r)},output:function(r,t){console&&console[r]&&console[r].apply(console,t)}},ma=function(){function e(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};pe(this,e),this.init(r,t)}return ve(e,[{key:"init",value:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=i.prefix||"i18next:",this.logger=t||va,this.options=i,this.debug=i.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return this.forward(i,"log","",!0)}},{key:"warn",value:function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return this.forward(i,"warn","",!0)}},{key:"error",value:function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return this.forward(i,"error","")}},{key:"deprecate",value:function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return this.forward(i,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(t,i,n,a){return a&&!this.debug?null:(typeof t[0]=="string"&&(t[0]="".concat(n).concat(this.prefix," ").concat(t[0])),this.logger[i](t))}},{key:"create",value:function(t){return new e(this.logger,Qr(Qr({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}}]),e}(),je=new ma,Ue=function(){function e(){pe(this,e),this.observers={}}return ve(e,[{key:"on",value:function(t,i){var n=this;return t.split(" ").forEach(function(a){n.observers[a]=n.observers[a]||[],n.observers[a].push(i)}),this}},{key:"off",value:function(t,i){if(!!this.observers[t]){if(!i){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(function(n){return n!==i})}}},{key:"emit",value:function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];if(this.observers[t]){var o=[].concat(this.observers[t]);o.forEach(function(u){u.apply(void 0,n)})}if(this.observers["*"]){var s=[].concat(this.observers["*"]);s.forEach(function(u){u.apply(u,[t].concat(n))})}}}]),e}();function nt(){var e,r,t=new Promise(function(i,n){e=i,r=n});return t.resolve=e,t.reject=r,t}function Jr(e){return e==null?"":""+e}function ya(e,r,t){e.forEach(function(i){r[i]&&(t[i]=r[i])})}function mr(e,r,t){function i(s){return s&&s.indexOf("###")>-1?s.replace(/###/g,"."):s}function n(){return!e||typeof e=="string"}for(var a=typeof r!="string"?[].concat(r):r.split(".");a.length>1;){if(n())return{};var o=i(a.shift());!e[o]&&t&&(e[o]=new t),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={}}return n()?{}:{obj:e,k:i(a.shift())}}function Yr(e,r,t){var i=mr(e,r,Object),n=i.obj,a=i.k;n[a]=t}function ba(e,r,t,i){var n=mr(e,r,Object),a=n.obj,o=n.k;a[o]=a[o]||[],i&&(a[o]=a[o].concat(t)),i||a[o].push(t)}function Lt(e,r){var t=mr(e,r),i=t.obj,n=t.k;if(!!i)return i[n]}function Zr(e,r,t){var i=Lt(e,t);return i!==void 0?i:Lt(r,t)}function Qn(e,r,t){for(var i in r)i!=="__proto__"&&i!=="constructor"&&(i in e?typeof e[i]=="string"||e[i]instanceof String||typeof r[i]=="string"||r[i]instanceof String?t&&(e[i]=r[i]):Qn(e[i],r[i],t):e[i]=r[i]);return e}function Je(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var xa={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function Oa(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,function(r){return xa[r]}):e}var Ht=typeof window!="undefined"&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Sa=[" ",",","?","!",";"];function wa(e,r,t){r=r||"",t=t||"";var i=Sa.filter(function(s){return r.indexOf(s)<0&&t.indexOf(s)<0});if(i.length===0)return!0;var n=new RegExp("(".concat(i.map(function(s){return s==="?"?"\\?":s}).join("|"),")")),a=!n.test(e);if(!a){var o=e.indexOf(t);o>0&&!n.test(e.substring(0,o))&&(a=!0)}return a}function Xr(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function xt(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Xr(Object(t),!0).forEach(function(i){Ee(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Xr(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function Ca(e){var r=Pa();return function(){var i=ke(e),n;if(r){var a=ke(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return vt(this,n)}}function Pa(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Jn(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!!e){if(e[r])return e[r];for(var i=r.split(t),n=e,a=0;a<i.length;++a){if(!n||typeof n[i[a]]=="string"&&a+1<i.length)return;if(n[i[a]]===void 0){for(var o=2,s=i.slice(a,a+o).join(t),u=n[s];u===void 0&&i.length>a+o;)o++,s=i.slice(a,a+o).join(t),u=n[s];if(u===void 0)return;if(r.endsWith(s)){if(typeof u=="string")return u;if(s&&typeof u[s]=="string")return u[s]}var c=i.slice(a+o).join(t);return c?Jn(u,c,t):void 0}n=n[i[a]]}return n}}var ja=function(e){Ut(t,e);var r=Ca(t);function t(i){var n,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return pe(this,t),n=r.call(this),Ht&&Ue.call(Ie(n)),n.data=i||{},n.options=a,n.options.keySeparator===void 0&&(n.options.keySeparator="."),n.options.ignoreJSONStructure===void 0&&(n.options.ignoreJSONStructure=!0),n}return ve(t,[{key:"addNamespaces",value:function(n){this.options.ns.indexOf(n)<0&&this.options.ns.push(n)}},{key:"removeNamespaces",value:function(n){var a=this.options.ns.indexOf(n);a>-1&&this.options.ns.splice(a,1)}},{key:"getResource",value:function(n,a,o){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},u=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,c=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure,f=[n,a];o&&typeof o!="string"&&(f=f.concat(o)),o&&typeof o=="string"&&(f=f.concat(u?o.split(u):o)),n.indexOf(".")>-1&&(f=n.split("."));var l=Lt(this.data,f);return l||!c||typeof o!="string"?l:Jn(this.data&&this.data[n]&&this.data[n][a],o,u)}},{key:"addResource",value:function(n,a,o,s){var u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},c=this.options.keySeparator;c===void 0&&(c=".");var f=[n,a];o&&(f=f.concat(c?o.split(c):o)),n.indexOf(".")>-1&&(f=n.split("."),s=a,a=f[1]),this.addNamespaces(a),Yr(this.data,f,s),u.silent||this.emit("added",n,a,o,s)}},{key:"addResources",value:function(n,a,o){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var u in o)(typeof o[u]=="string"||Object.prototype.toString.apply(o[u])==="[object Array]")&&this.addResource(n,a,u,o[u],{silent:!0});s.silent||this.emit("added",n,a,o)}},{key:"addResourceBundle",value:function(n,a,o,s,u){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},f=[n,a];n.indexOf(".")>-1&&(f=n.split("."),s=o,o=a,a=f[1]),this.addNamespaces(a);var l=Lt(this.data,f)||{};s?Qn(l,o,u):l=xt(xt({},l),o),Yr(this.data,f,l),c.silent||this.emit("added",n,a,o)}},{key:"removeResourceBundle",value:function(n,a){this.hasResourceBundle(n,a)&&delete this.data[n][a],this.removeNamespaces(a),this.emit("removed",n,a)}},{key:"hasResourceBundle",value:function(n,a){return this.getResource(n,a)!==void 0}},{key:"getResourceBundle",value:function(n,a){return a||(a=this.options.defaultNS),this.options.compatibilityAPI==="v1"?xt(xt({},{}),this.getResource(n,a)):this.getResource(n,a)}},{key:"getDataByLanguage",value:function(n){return this.data[n]}},{key:"hasLanguageSomeTranslations",value:function(n){var a=this.getDataByLanguage(n),o=a&&Object.keys(a)||[];return!!o.find(function(s){return a[s]&&Object.keys(a[s]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),t}(Ue),Yn={processors:{},addPostProcessor:function(r){this.processors[r.name]=r},handle:function(r,t,i,n,a){var o=this;return r.forEach(function(s){o.processors[s]&&(t=o.processors[s].process(t,i,n,a))}),t}};function en(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function fe(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?en(Object(t),!0).forEach(function(i){Ee(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):en(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function Na(e){var r=ka();return function(){var i=ke(e),n;if(r){var a=ke(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return vt(this,n)}}function ka(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var tn={},rn=function(e){Ut(t,e);var r=Na(t);function t(i){var n,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return pe(this,t),n=r.call(this),Ht&&Ue.call(Ie(n)),ya(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],i,Ie(n)),n.options=a,n.options.keySeparator===void 0&&(n.options.keySeparator="."),n.logger=je.create("translator"),n}return ve(t,[{key:"changeLanguage",value:function(n){n&&(this.language=n)}},{key:"exists",value:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(n==null)return!1;var o=this.resolve(n,a);return o&&o.res!==void 0}},{key:"extractFromKey",value:function(n,a){var o=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");var s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,u=a.ns||this.options.defaultNS||[],c=o&&n.indexOf(o)>-1,f=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!wa(n,o,s);if(c&&!f){var l=n.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:n,namespaces:u};var d=n.split(o);(o!==s||o===s&&this.options.ns.indexOf(d[0])>-1)&&(u=d.shift()),n=d.join(s)}return typeof u=="string"&&(u=[u]),{key:n,namespaces:u}}},{key:"translate",value:function(n,a,o){var s=this;if(De(a)!=="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),a||(a={}),n==null)return"";Array.isArray(n)||(n=[String(n)]);var u=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=this.extractFromKey(n[n.length-1],a),f=c.key,l=c.namespaces,d=l[l.length-1],g=a.lng||this.language,v=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(g&&g.toLowerCase()==="cimode"){if(v){var x=a.nsSeparator||this.options.nsSeparator;return d+x+f}return f}var S=this.resolve(n,a),m=S&&S.res,w=S&&S.usedKey||f,P=S&&S.exactUsedKey||f,j=Object.prototype.toString.apply(m),R=["[object Number]","[object Function]","[object RegExp]"],M=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,D=!this.i18nFormat||this.i18nFormat.handleAsObject,_=typeof m!="string"&&typeof m!="boolean"&&typeof m!="number";if(D&&m&&_&&R.indexOf(j)<0&&!(typeof M=="string"&&j==="[object Array]")){if(!a.returnObjects&&!this.options.returnObjects)return this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,m,fe(fe({},a),{},{ns:l})):"key '".concat(f," (").concat(this.language,")' returned an object instead of string.");if(u){var T=j==="[object Array]",N=T?[]:{},E=T?P:w;for(var I in m)if(Object.prototype.hasOwnProperty.call(m,I)){var q="".concat(E).concat(u).concat(I);N[I]=this.translate(q,fe(fe({},a),{joinArrays:!1,ns:l})),N[I]===q&&(N[I]=m[I])}m=N}}else if(D&&typeof M=="string"&&j==="[object Array]")m=m.join(M),m&&(m=this.extendTranslation(m,n,a,o));else{var $=!1,Q=!1,te=a.count!==void 0&&typeof a.count!="string",W=t.hasDefaultValue(a),Z=te?this.pluralResolver.getSuffix(g,a.count,a):"",re=a["defaultValue".concat(Z)]||a.defaultValue;!this.isValidLookup(m)&&W&&($=!0,m=re),this.isValidLookup(m)||(Q=!0,m=f);var X=a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,B=X&&Q?void 0:m,G=W&&re!==m&&this.options.updateMissing;if(Q||$||G){if(this.logger.log(G?"updateKey":"missingKey",g,d,f,G?re:m),u){var V=this.resolve(f,fe(fe({},a),{},{keySeparator:!1}));V&&V.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.")}var U=[],H=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&H&&H[0])for(var me=0;me<H.length;me++)U.push(H[me]);else this.options.saveMissingTo==="all"?U=this.languageUtils.toResolveHierarchy(a.lng||this.language):U.push(a.lng||this.language);var Kt=function(Be,h,b){var O=W&&b!==m?b:B;s.options.missingKeyHandler?s.options.missingKeyHandler(Be,d,h,O,G,a):s.backendConnector&&s.backendConnector.saveMissing&&s.backendConnector.saveMissing(Be,d,h,O,G,a),s.emit("missingKey",Be,d,h,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&te?U.forEach(function(yt){s.pluralResolver.getSuffixes(yt).forEach(function(Be){Kt([yt],f+Be,a["defaultValue".concat(Be)]||re)})}):Kt(U,f,re))}m=this.extendTranslation(m,n,a,S,o),Q&&m===f&&this.options.appendNamespaceToMissingKey&&(m="".concat(d,":").concat(f)),(Q||$)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?m=this.options.parseMissingKeyHandler(f,$?m:void 0):m=this.options.parseMissingKeyHandler(m))}return m}},{key:"extendTranslation",value:function(n,a,o,s,u){var c=this;if(this.i18nFormat&&this.i18nFormat.parse)n=this.i18nFormat.parse(n,o,s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init(fe(fe({},o),{interpolation:fe(fe({},this.options.interpolation),o.interpolation)}));var f=typeof n=="string"&&(o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),l;if(f){var d=n.match(this.interpolator.nestingRegexp);l=d&&d.length}var g=o.replace&&typeof o.replace!="string"?o.replace:o;if(this.options.interpolation.defaultVariables&&(g=fe(fe({},this.options.interpolation.defaultVariables),g)),n=this.interpolator.interpolate(n,g,o.lng||this.language,o),f){var v=n.match(this.interpolator.nestingRegexp),x=v&&v.length;l<x&&(o.nest=!1)}o.nest!==!1&&(n=this.interpolator.nest(n,function(){for(var w=arguments.length,P=new Array(w),j=0;j<w;j++)P[j]=arguments[j];return u&&u[0]===P[0]&&!o.context?(c.logger.warn("It seems you are nesting recursively key: ".concat(P[0]," in key: ").concat(a[0])),null):c.translate.apply(c,P.concat([a]))},o)),o.interpolation&&this.interpolator.reset()}var S=o.postProcess||this.options.postProcess,m=typeof S=="string"?[S]:S;return n!=null&&m&&m.length&&o.applyPostProcessor!==!1&&(n=Yn.handle(m,n,a,this.options&&this.options.postProcessPassResolved?fe({i18nResolved:s},o):o,this)),n}},{key:"resolve",value:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s,u,c,f,l;return typeof n=="string"&&(n=[n]),n.forEach(function(d){if(!a.isValidLookup(s)){var g=a.extractFromKey(d,o),v=g.key;u=v;var x=g.namespaces;a.options.fallbackNS&&(x=x.concat(a.options.fallbackNS));var S=o.count!==void 0&&typeof o.count!="string",m=S&&!o.ordinal&&o.count===0&&a.pluralResolver.shouldUseIntlApi(),w=o.context!==void 0&&(typeof o.context=="string"||typeof o.context=="number")&&o.context!=="",P=o.lngs?o.lngs:a.languageUtils.toResolveHierarchy(o.lng||a.language,o.fallbackLng);x.forEach(function(j){a.isValidLookup(s)||(l=j,!tn["".concat(P[0],"-").concat(j)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(l)&&(tn["".concat(P[0],"-").concat(j)]=!0,a.logger.warn('key "'.concat(u,'" for languages "').concat(P.join(", "),`" won't get resolved as namespace "`).concat(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!!!")),P.forEach(function(R){if(!a.isValidLookup(s)){f=R;var M=[v];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(M,v,R,j,o);else{var D;S&&(D=a.pluralResolver.getSuffix(R,o.count,o));var _="_zero";if(S&&(M.push(v+D),m&&M.push(v+_)),w){var T="".concat(v).concat(a.options.contextSeparator).concat(o.context);M.push(T),S&&(M.push(T+D),m&&M.push(T+_))}}for(var N;N=M.pop();)a.isValidLookup(s)||(c=N,s=a.getResource(R,j,N,o))}}))})}}),{res:s,usedKey:u,exactUsedKey:c,usedLng:f,usedNS:l}}},{key:"isValidLookup",value:function(n){return n!==void 0&&!(!this.options.returnNull&&n===null)&&!(!this.options.returnEmptyString&&n==="")}},{key:"getResource",value:function(n,a,o){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(n,a,o,s):this.resourceStore.getResource(n,a,o,s)}}],[{key:"hasDefaultValue",value:function(n){var a="defaultValue";for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o)&&a===o.substring(0,a.length)&&n[o]!==void 0)return!0;return!1}}]),t}(Ue);function tr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ea=function(){function e(r){pe(this,e),this.options=r,this.supportedLngs=this.options.supportedLngs||!1,this.logger=je.create("languageUtils")}return ve(e,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var i=t.split("-");return i.length===2||(i.pop(),i[i.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(i.join("-"))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var i=t.split("-");return this.formatLanguageCode(i[0])}},{key:"formatLanguageCode",value:function(t){if(typeof t=="string"&&t.indexOf("-")>-1){var i=["hans","hant","latn","cyrl","cans","mong","arab"],n=t.split("-");return this.options.lowerCaseLng?n=n.map(function(a){return a.toLowerCase()}):n.length===2?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),i.indexOf(n[1].toLowerCase())>-1&&(n[1]=tr(n[1].toLowerCase()))):n.length===3&&(n[0]=n[0].toLowerCase(),n[1].length===2&&(n[1]=n[1].toUpperCase()),n[0]!=="sgn"&&n[2].length===2&&(n[2]=n[2].toUpperCase()),i.indexOf(n[1].toLowerCase())>-1&&(n[1]=tr(n[1].toLowerCase())),i.indexOf(n[2].toLowerCase())>-1&&(n[2]=tr(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isSupportedCode",value:function(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var i=this;if(!t)return null;var n;return t.forEach(function(a){if(!n){var o=i.formatLanguageCode(a);(!i.options.supportedLngs||i.isSupportedCode(o))&&(n=o)}}),!n&&this.options.supportedLngs&&t.forEach(function(a){if(!n){var o=i.getLanguagePartFromCode(a);if(i.isSupportedCode(o))return n=o;n=i.options.supportedLngs.find(function(s){if(s.indexOf(o)===0)return s})}}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}},{key:"getFallbackCodes",value:function(t,i){if(!t)return[];if(typeof t=="function"&&(t=t(i)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!i)return t.default||[];var n=t[i];return n||(n=t[this.getScriptPartFromCode(i)]),n||(n=t[this.formatLanguageCode(i)]),n||(n=t[this.getLanguagePartFromCode(i)]),n||(n=t.default),n||[]}},{key:"toResolveHierarchy",value:function(t,i){var n=this,a=this.getFallbackCodes(i||this.options.fallbackLng||[],t),o=[],s=function(c){!c||(n.isSupportedCode(c)?o.push(c):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(c)))};return typeof t=="string"&&t.indexOf("-")>-1?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):typeof t=="string"&&s(this.formatLanguageCode(t)),a.forEach(function(u){o.indexOf(u)<0&&s(n.formatLanguageCode(u))}),o}}]),e}(),La=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Fa={1:function(r){return Number(r>1)},2:function(r){return Number(r!=1)},3:function(r){return 0},4:function(r){return Number(r%10==1&&r%100!=11?0:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?1:2)},5:function(r){return Number(r==0?0:r==1?1:r==2?2:r%100>=3&&r%100<=10?3:r%100>=11?4:5)},6:function(r){return Number(r==1?0:r>=2&&r<=4?1:2)},7:function(r){return Number(r==1?0:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?1:2)},8:function(r){return Number(r==1?0:r==2?1:r!=8&&r!=11?2:3)},9:function(r){return Number(r>=2)},10:function(r){return Number(r==1?0:r==2?1:r<7?2:r<11?3:4)},11:function(r){return Number(r==1||r==11?0:r==2||r==12?1:r>2&&r<20?2:3)},12:function(r){return Number(r%10!=1||r%100==11)},13:function(r){return Number(r!==0)},14:function(r){return Number(r==1?0:r==2?1:r==3?2:3)},15:function(r){return Number(r%10==1&&r%100!=11?0:r%10>=2&&(r%100<10||r%100>=20)?1:2)},16:function(r){return Number(r%10==1&&r%100!=11?0:r!==0?1:2)},17:function(r){return Number(r==1||r%10==1&&r%100!=11?0:1)},18:function(r){return Number(r==0?0:r==1?1:2)},19:function(r){return Number(r==1?0:r==0||r%100>1&&r%100<11?1:r%100>10&&r%100<20?2:3)},20:function(r){return Number(r==1?0:r==0||r%100>0&&r%100<20?1:2)},21:function(r){return Number(r%100==1?1:r%100==2?2:r%100==3||r%100==4?3:0)},22:function(r){return Number(r==1?0:r==2?1:(r<0||r>10)&&r%10==0?2:3)}},Aa=["v1","v2","v3"],nn={zero:0,one:1,two:2,few:3,many:4,other:5};function Ra(){var e={};return La.forEach(function(r){r.lngs.forEach(function(t){e[t]={numbers:r.nr,plurals:Fa[r.fc]}})}),e}var Ta=function(){function e(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};pe(this,e),this.languageUtils=r,this.options=t,this.logger=je.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl=="undefined"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Ra()}return ve(e,[{key:"addRule",value:function(t,i){this.rules[t]=i}},{key:"getRule",value:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(t,{type:i.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=this.getRule(t,i);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,n).map(function(a){return"".concat(i).concat(a)})}},{key:"getSuffixes",value:function(t){var i=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.getRule(t,n);return a?this.shouldUseIntlApi()?a.resolvedOptions().pluralCategories.sort(function(o,s){return nn[o]-nn[s]}).map(function(o){return"".concat(i.options.prepend).concat(o)}):a.numbers.map(function(o){return i.getSuffix(t,o,n)}):[]}},{key:"getSuffix",value:function(t,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=this.getRule(t,n);return a?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(a.select(i)):this.getSuffixRetroCompatible(a,i):(this.logger.warn("no plural rule found for: ".concat(t)),"")}},{key:"getSuffixRetroCompatible",value:function(t,i){var n=this,a=t.noAbs?t.plurals(i):t.plurals(Math.abs(i)),o=t.numbers[a];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));var s=function(){return n.options.prepend&&o.toString()?n.options.prepend+o.toString():o.toString()};return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?"_plural_".concat(o.toString()):s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?s():this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString()}},{key:"shouldUseIntlApi",value:function(){return!Aa.includes(this.options.compatibilityJSON)}}]),e}();function an(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function ye(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?an(Object(t),!0).forEach(function(i){Ee(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):an(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}var Ma=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pe(this,e),this.logger=je.create("interpolator"),this.options=r,this.format=r.interpolation&&r.interpolation.format||function(t){return t},this.init(r)}return ve(e,[{key:"init",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var i=t.interpolation;this.escape=i.escape!==void 0?i.escape:Oa,this.escapeValue=i.escapeValue!==void 0?i.escapeValue:!0,this.useRawValueToEscape=i.useRawValueToEscape!==void 0?i.useRawValueToEscape:!1,this.prefix=i.prefix?Je(i.prefix):i.prefixEscaped||"{{",this.suffix=i.suffix?Je(i.suffix):i.suffixEscaped||"}}",this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||",",this.unescapePrefix=i.unescapeSuffix?"":i.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":i.unescapeSuffix||"",this.nestingPrefix=i.nestingPrefix?Je(i.nestingPrefix):i.nestingPrefixEscaped||Je("$t("),this.nestingSuffix=i.nestingSuffix?Je(i.nestingSuffix):i.nestingSuffixEscaped||Je(")"),this.nestingOptionsSeparator=i.nestingOptionsSeparator?i.nestingOptionsSeparator:i.nestingOptionsSeparator||",",this.maxReplaces=i.maxReplaces?i.maxReplaces:1e3,this.alwaysFormat=i.alwaysFormat!==void 0?i.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var i="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(i,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(t,i,n,a){var o=this,s,u,c,f=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function l(S){return S.replace(/\$/g,"$$$$")}var d=function(m){if(m.indexOf(o.formatSeparator)<0){var w=Zr(i,f,m);return o.alwaysFormat?o.format(w,void 0,n,ye(ye(ye({},a),i),{},{interpolationkey:m})):w}var P=m.split(o.formatSeparator),j=P.shift().trim(),R=P.join(o.formatSeparator).trim();return o.format(Zr(i,f,j),R,n,ye(ye(ye({},a),i),{},{interpolationkey:j}))};this.resetRegExp();var g=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,v=a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,x=[{regex:this.regexpUnescape,safeValue:function(m){return l(m)}},{regex:this.regexp,safeValue:function(m){return o.escapeValue?l(o.escape(m)):l(m)}}];return x.forEach(function(S){for(c=0;s=S.regex.exec(t);){var m=s[1].trim();if(u=d(m),u===void 0)if(typeof g=="function"){var w=g(t,s,a);u=typeof w=="string"?w:""}else if(a&&a.hasOwnProperty(m))u="";else if(v){u=s[0];continue}else o.logger.warn("missed to pass in variable ".concat(m," for interpolating ").concat(t)),u="";else typeof u!="string"&&!o.useRawValueToEscape&&(u=Jr(u));var P=S.safeValue(u);if(t=t.replace(s[0],P),v?(S.regex.lastIndex+=P.length,S.regex.lastIndex-=s[0].length):S.regex.lastIndex=0,c++,c>=o.maxReplaces)break}}),t}},{key:"nest",value:function(t,i){var n=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,s,u=ye({},a);u.applyPostProcessor=!1,delete u.defaultValue;function c(g,v){var x=this.nestingOptionsSeparator;if(g.indexOf(x)<0)return g;var S=g.split(new RegExp("".concat(x,"[ ]*{"))),m="{".concat(S[1]);g=S[0],m=this.interpolate(m,u),m=m.replace(/'/g,'"');try{u=JSON.parse(m),v&&(u=ye(ye({},v),u))}catch(w){return this.logger.warn("failed parsing options string in nesting for key ".concat(g),w),"".concat(g).concat(x).concat(m)}return delete u.defaultValue,g}for(;o=this.nestingRegexp.exec(t);){var f=[],l=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){var d=o[1].split(this.formatSeparator).map(function(g){return g.trim()});o[1]=d.shift(),f=d,l=!0}if(s=i(c.call(this,o[1].trim(),u),u),s&&o[0]===t&&typeof s!="string")return s;typeof s!="string"&&(s=Jr(s)),s||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),s=""),l&&(s=f.reduce(function(g,v){return n.format(g,v,a.lng,ye(ye({},a),{},{interpolationkey:o[1].trim()}))},s.trim())),t=t.replace(o[0],s),this.regexp.lastIndex=0}return t}}]),e}();function on(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function Re(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?on(Object(t),!0).forEach(function(i){Ee(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):on(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function Da(e){var r=e.toLowerCase().trim(),t={};if(e.indexOf("(")>-1){var i=e.split("(");r=i[0].toLowerCase().trim();var n=i[1].substring(0,i[1].length-1);if(r==="currency"&&n.indexOf(":")<0)t.currency||(t.currency=n.trim());else if(r==="relativetime"&&n.indexOf(":")<0)t.range||(t.range=n.trim());else{var a=n.split(";");a.forEach(function(o){if(!!o){var s=o.split(":"),u=pa(s),c=u[0],f=u.slice(1),l=f.join(":");l.trim()==="false"&&(t[c.trim()]=!1),l.trim()==="true"&&(t[c.trim()]=!0),isNaN(l.trim())||(t[c.trim()]=parseInt(l.trim(),10)),t[c.trim()]||(t[c.trim()]=l.trim())}})}}return{formatName:r,formatOptions:t}}var Ia=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pe(this,e),this.logger=je.create("formatter"),this.options=r,this.formats={number:function(i,n,a){return new Intl.NumberFormat(n,a).format(i)},currency:function(i,n,a){return new Intl.NumberFormat(n,Re(Re({},a),{},{style:"currency"})).format(i)},datetime:function(i,n,a){return new Intl.DateTimeFormat(n,Re({},a)).format(i)},relativetime:function(i,n,a){return new Intl.RelativeTimeFormat(n,Re({},a)).format(i,a.range||"day")},list:function(i,n,a){return new Intl.ListFormat(n,Re({},a)).format(i)}},this.init(r)}return ve(e,[{key:"init",value:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},n=i.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(t,i){this.formats[t.toLowerCase().trim()]=i}},{key:"format",value:function(t,i,n,a){var o=this,s=i.split(this.formatSeparator),u=s.reduce(function(c,f){var l=Da(f),d=l.formatName,g=l.formatOptions;if(o.formats[d]){var v=c;try{var x=a&&a.formatParams&&a.formatParams[a.interpolationkey]||{},S=x.locale||x.lng||a.locale||a.lng||n;v=o.formats[d](c,S,Re(Re(Re({},g),a),x))}catch(m){o.logger.warn(m)}return v}else o.logger.warn("there was no format function for ".concat(d));return c},t);return u}}]),e}();function sn(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function un(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?sn(Object(t),!0).forEach(function(i){Ee(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):sn(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function _a(e){var r=Va();return function(){var i=ke(e),n;if(r){var a=ke(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return vt(this,n)}}function Va(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function $a(e,r){for(var t=e.indexOf(r);t!==-1;)e.splice(t,1),t=e.indexOf(r)}var Ua=function(e){Ut(t,e);var r=_a(t);function t(i,n,a){var o,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return pe(this,t),o=r.call(this),Ht&&Ue.call(Ie(o)),o.backend=i,o.store=n,o.services=a,o.languageUtils=a.languageUtils,o.options=s,o.logger=je.create("backendConnector"),o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(a,s.backend,s),o}return ve(t,[{key:"queueLoad",value:function(n,a,o,s){var u=this,c=[],f=[],l=[],d=[];return n.forEach(function(g){var v=!0;a.forEach(function(x){var S="".concat(g,"|").concat(x);!o.reload&&u.store.hasResourceBundle(g,x)?u.state[S]=2:u.state[S]<0||(u.state[S]===1?f.indexOf(S)<0&&f.push(S):(u.state[S]=1,v=!1,f.indexOf(S)<0&&f.push(S),c.indexOf(S)<0&&c.push(S),d.indexOf(x)<0&&d.push(x)))}),v||l.push(g)}),(c.length||f.length)&&this.queue.push({pending:f,loaded:{},errors:[],callback:s}),{toLoad:c,pending:f,toLoadLanguages:l,toLoadNamespaces:d}}},{key:"loaded",value:function(n,a,o){var s=n.split("|"),u=s[0],c=s[1];a&&this.emit("failedLoading",u,c,a),o&&this.store.addResourceBundle(u,c,o),this.state[n]=a?-1:2;var f={};this.queue.forEach(function(l){ba(l.loaded,[u],c),$a(l.pending,n),a&&l.errors.push(a),l.pending.length===0&&!l.done&&(Object.keys(l.loaded).forEach(function(d){f[d]||(f[d]=[]),l.loaded[d].length&&l.loaded[d].forEach(function(g){f[d].indexOf(g)<0&&f[d].push(g)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",f),this.queue=this.queue.filter(function(l){return!l.done})}},{key:"read",value:function(n,a,o){var s=this,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:350,f=arguments.length>5?arguments[5]:void 0;return n.length?this.backend[o](n,a,function(l,d){if(l&&d&&u<5){setTimeout(function(){s.read.call(s,n,a,o,u+1,c*2,f)},c);return}f(l,d)}):f(null,{})}},{key:"prepareLoading",value:function(n,a){var o=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),u&&u();typeof n=="string"&&(n=this.languageUtils.toResolveHierarchy(n)),typeof a=="string"&&(a=[a]);var c=this.queueLoad(n,a,s,u);if(!c.toLoad.length)return c.pending.length||u(),null;c.toLoad.forEach(function(f){o.loadOne(f)})}},{key:"load",value:function(n,a,o){this.prepareLoading(n,a,{},o)}},{key:"reload",value:function(n,a,o){this.prepareLoading(n,a,{reload:!0},o)}},{key:"loadOne",value:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",s=n.split("|"),u=s[0],c=s[1];this.read(u,c,"read",void 0,void 0,function(f,l){f&&a.logger.warn("".concat(o,"loading namespace ").concat(c," for language ").concat(u," failed"),f),!f&&l&&a.logger.log("".concat(o,"loaded namespace ").concat(c," for language ").concat(u),l),a.loaded(n,f,l)})}},{key:"saveMissing",value:function(n,a,o,s,u){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(a)){this.logger.warn('did not save key "'.concat(o,'" as the namespace "').concat(a,'" 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}o==null||o===""||(this.backend&&this.backend.create&&this.backend.create(n,a,o,s,null,un(un({},c),{},{isUpdate:u})),!(!n||!n[0])&&this.store.addResource(n[0],a,o,s))}}]),t}(Ue);function Ha(){return{debug:!1,initImmediate:!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:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(r){var t={};if(De(r[1])==="object"&&(t=r[1]),typeof r[1]=="string"&&(t.defaultValue=r[1]),typeof r[2]=="string"&&(t.tDescription=r[2]),De(r[2])==="object"||De(r[3])==="object"){var i=r[3]||r[2];Object.keys(i).forEach(function(n){t[n]=i[n]})}return t},interpolation:{escapeValue:!0,format:function(r,t,i,n){return r},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function ln(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function cn(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function we(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?cn(Object(t),!0).forEach(function(i){Ee(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):cn(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function Ba(e){var r=Wa();return function(){var i=ke(e),n;if(r){var a=ke(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return vt(this,n)}}function Wa(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ot(){}function za(e){var r=Object.getOwnPropertyNames(Object.getPrototypeOf(e));r.forEach(function(t){typeof e[t]=="function"&&(e[t]=e[t].bind(e))})}var Ft=function(e){Ut(t,e);var r=Ba(t);function t(){var i,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;if(pe(this,t),i=r.call(this),Ht&&Ue.call(Ie(i)),i.options=ln(n),i.services={},i.logger=je,i.modules={external:[]},za(Ie(i)),a&&!i.isInitialized&&!n.isClone){if(!i.options.initImmediate)return i.init(n,a),vt(i,Ie(i));setTimeout(function(){i.init(n,a)},0)}return i}return ve(t,[{key:"init",value:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;typeof a=="function"&&(o=a,a={}),!a.defaultNS&&a.ns&&(typeof a.ns=="string"?a.defaultNS=a.ns:a.ns.indexOf("translation")<0&&(a.defaultNS=a.ns[0]));var s=Ha();this.options=we(we(we({},s),this.options),ln(a)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=we(we({},s.interpolation),this.options.interpolation)),a.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=a.keySeparator),a.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=a.nsSeparator);function u(m){return m?typeof m=="function"?new m:m:null}if(!this.options.isClone){this.modules.logger?je.init(u(this.modules.logger),this.options):je.init(null,this.options);var c;this.modules.formatter?c=this.modules.formatter:typeof Intl!="undefined"&&(c=Ia);var f=new Ea(this.options);this.store=new ja(this.options.resources,this.options);var l=this.services;l.logger=je,l.resourceStore=this.store,l.languageUtils=f,l.pluralResolver=new Ta(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(l.formatter=u(c),l.formatter.init(l,this.options),this.options.interpolation.format=l.formatter.format.bind(l.formatter)),l.interpolator=new Ma(this.options),l.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},l.backendConnector=new Ua(u(this.modules.backend),l.resourceStore,l,this.options),l.backendConnector.on("*",function(m){for(var w=arguments.length,P=new Array(w>1?w-1:0),j=1;j<w;j++)P[j-1]=arguments[j];n.emit.apply(n,[m].concat(P))}),this.modules.languageDetector&&(l.languageDetector=u(this.modules.languageDetector),l.languageDetector.init(l,this.options.detection,this.options)),this.modules.i18nFormat&&(l.i18nFormat=u(this.modules.i18nFormat),l.i18nFormat.init&&l.i18nFormat.init(this)),this.translator=new rn(this.services,this.options),this.translator.on("*",function(m){for(var w=arguments.length,P=new Array(w>1?w-1:0),j=1;j<w;j++)P[j-1]=arguments[j];n.emit.apply(n,[m].concat(P))}),this.modules.external.forEach(function(m){m.init&&m.init(n)})}if(this.format=this.options.interpolation.format,o||(o=Ot),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var 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");var g=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];g.forEach(function(m){n[m]=function(){var w;return(w=n.store)[m].apply(w,arguments)}});var v=["addResource","addResources","addResourceBundle","removeResourceBundle"];v.forEach(function(m){n[m]=function(){var w;return(w=n.store)[m].apply(w,arguments),n}});var x=nt(),S=function(){var w=function(j,R){n.isInitialized&&!n.initializedStoreOnce&&n.logger.warn("init: i18next is already initialized. You should call init just once!"),n.isInitialized=!0,n.options.isClone||n.logger.log("initialized",n.options),n.emit("initialized",n.options),x.resolve(R),o(j,R)};if(n.languages&&n.options.compatibilityAPI!=="v1"&&!n.isInitialized)return w(null,n.t.bind(n));n.changeLanguage(n.options.lng,w)};return this.options.resources||!this.options.initImmediate?S():setTimeout(S,0),x}},{key:"loadResources",value:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ot,s=o,u=typeof n=="string"?n:this.language;if(typeof n=="function"&&(s=n),!this.options.resources||this.options.partialBundledLanguages){if(u&&u.toLowerCase()==="cimode")return s();var c=[],f=function(g){if(!!g){var v=a.services.languageUtils.toResolveHierarchy(g);v.forEach(function(x){c.indexOf(x)<0&&c.push(x)})}};if(u)f(u);else{var l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.forEach(function(d){return f(d)})}this.options.preload&&this.options.preload.forEach(function(d){return f(d)}),this.services.backendConnector.load(c,this.options.ns,s)}else s(null)}},{key:"reloadResources",value:function(n,a,o){var s=nt();return n||(n=this.languages),a||(a=this.options.ns),o||(o=Ot),this.services.backendConnector.reload(n,a,function(u){s.resolve(),o(u)}),s}},{key:"use",value:function(n){if(!n)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!n.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return n.type==="backend"&&(this.modules.backend=n),(n.type==="logger"||n.log&&n.warn&&n.error)&&(this.modules.logger=n),n.type==="languageDetector"&&(this.modules.languageDetector=n),n.type==="i18nFormat"&&(this.modules.i18nFormat=n),n.type==="postProcessor"&&Yn.addPostProcessor(n),n.type==="formatter"&&(this.modules.formatter=n),n.type==="3rdParty"&&this.modules.external.push(n),this}},{key:"changeLanguage",value:function(n,a){var o=this;this.isLanguageChangingTo=n;var s=nt();this.emit("languageChanging",n);var u=function(d){if(o.language=d,o.languages=o.services.languageUtils.toResolveHierarchy(d),o.resolvedLanguage=void 0,!(["cimode","dev"].indexOf(d)>-1))for(var g=0;g<o.languages.length;g++){var v=o.languages[g];if(!(["cimode","dev"].indexOf(v)>-1)&&o.store.hasLanguageSomeTranslations(v)){o.resolvedLanguage=v;break}}},c=function(d,g){g?(u(g),o.translator.changeLanguage(g),o.isLanguageChangingTo=void 0,o.emit("languageChanged",g),o.logger.log("languageChanged",g)):o.isLanguageChangingTo=void 0,s.resolve(function(){return o.t.apply(o,arguments)}),a&&a(d,function(){return o.t.apply(o,arguments)})},f=function(d){!n&&!d&&o.services.languageDetector&&(d=[]);var g=typeof d=="string"?d:o.services.languageUtils.getBestMatchFromCodes(d);g&&(o.language||u(g),o.translator.language||o.translator.changeLanguage(g),o.services.languageDetector&&o.services.languageDetector.cacheUserLanguage(g)),o.loadResources(g,function(v){c(v,g)})};return!n&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!n&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(f):f(n),s}},{key:"getFixedT",value:function(n,a,o){var s=this,u=function c(f,l){var d;if(De(l)!=="object"){for(var g=arguments.length,v=new Array(g>2?g-2:0),x=2;x<g;x++)v[x-2]=arguments[x];d=s.options.overloadTranslationOptionHandler([f,l].concat(v))}else d=we({},l);d.lng=d.lng||c.lng,d.lngs=d.lngs||c.lngs,d.ns=d.ns||c.ns;var S=s.options.keySeparator||".",m=o?"".concat(o).concat(S).concat(f):f;return s.t(m,d)};return typeof n=="string"?u.lng=n:u.lngs=n,u.ns=a,u.keyPrefix=o,u}},{key:"t",value:function(){var n;return this.translator&&(n=this.translator).translate.apply(n,arguments)}},{key:"exists",value:function(){var n;return this.translator&&(n=this.translator).exists.apply(n,arguments)}},{key:"setDefaultNamespace",value:function(n){this.options.defaultNS=n}},{key:"hasLoadedNamespace",value:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};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;var s=this.resolvedLanguage||this.languages[0],u=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;var f=function(g,v){var x=a.services.backendConnector.state["".concat(g,"|").concat(v)];return x===-1||x===2};if(o.precheck){var l=o.precheck(this,f);if(l!==void 0)return l}return!!(this.hasResourceBundle(s,n)||!this.services.backendConnector.backend||f(s,n)&&(!u||f(c,n)))}},{key:"loadNamespaces",value:function(n,a){var o=this,s=nt();return this.options.ns?(typeof n=="string"&&(n=[n]),n.forEach(function(u){o.options.ns.indexOf(u)<0&&o.options.ns.push(u)}),this.loadResources(function(u){s.resolve(),a&&a(u)}),s):(a&&a(),Promise.resolve())}},{key:"loadLanguages",value:function(n,a){var o=nt();typeof n=="string"&&(n=[n]);var s=this.options.preload||[],u=n.filter(function(c){return s.indexOf(c)<0});return u.length?(this.options.preload=s.concat(u),this.loadResources(function(c){o.resolve(),a&&a(c)}),o):(a&&a(),Promise.resolve())}},{key:"dir",value:function(n){if(n||(n=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!n)return"rtl";var a=["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"];return a.indexOf(this.services.languageUtils.getLanguagePartFromCode(n))>-1||n.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ot,s=we(we(we({},this.options),a),{isClone:!0}),u=new t(s),c=["store","services","language"];return c.forEach(function(f){u[f]=n[f]}),u.services=we({},this.services),u.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},u.translator=new rn(u.services,u.options),u.translator.on("*",function(f){for(var l=arguments.length,d=new Array(l>1?l-1:0),g=1;g<l;g++)d[g-1]=arguments[g];u.emit.apply(u,[f].concat(d))}),u.init(s,o),u.translator.options=u.options,u.translator.backendConnector.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},u}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),t}(Ue);Ee(Ft,"createInstance",function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return new Ft(e,r)});var oe=Ft.createInstance();oe.createInstance=Ft.createInstance;oe.createInstance;oe.init;oe.loadResources;oe.reloadResources;oe.use;oe.changeLanguage;oe.getFixedT;oe.t;oe.exists;oe.setDefaultNamespace;oe.hasLoadedNamespace;oe.loadNamespaces;oe.loadLanguages;var Zn=[],qa=Zn.forEach,Ga=Zn.slice;function Ka(e){return qa.call(Ga.call(arguments,1),function(r){if(r)for(var t in r)e[t]===void 0&&(e[t]=r[t])}),e}var fn=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Qa=function(r,t,i){var n=i||{};n.path=n.path||"/";var a=encodeURIComponent(t),o=r+"="+a;if(n.maxAge>0){var s=n.maxAge-0;if(isNaN(s))throw new Error("maxAge should be a Number");o+="; Max-Age="+Math.floor(s)}if(n.domain){if(!fn.test(n.domain))throw new TypeError("option domain is invalid");o+="; Domain="+n.domain}if(n.path){if(!fn.test(n.path))throw new TypeError("option path is invalid");o+="; Path="+n.path}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(o+="; HttpOnly"),n.secure&&(o+="; Secure"),n.sameSite){var u=typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite;switch(u){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},dn={create:function(r,t,i,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};i&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+i*60*1e3)),n&&(a.domain=n),document.cookie=Qa(r,encodeURIComponent(t),a)},read:function(r){for(var t=r+"=",i=document.cookie.split(";"),n=0;n<i.length;n++){for(var a=i[n];a.charAt(0)===" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return a.substring(t.length,a.length)}return null},remove:function(r){this.create(r,"",-1)}},Ja={name:"cookie",lookup:function(r){var t;if(r.lookupCookie&&typeof document!="undefined"){var i=dn.read(r.lookupCookie);i&&(t=i)}return t},cacheUserLanguage:function(r,t){t.lookupCookie&&typeof document!="undefined"&&dn.create(t.lookupCookie,r,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},Ya={name:"querystring",lookup:function(r){var t;if(typeof window!="undefined")for(var i=window.location.search.substring(1),n=i.split("&"),a=0;a<n.length;a++){var o=n[a].indexOf("=");if(o>0){var s=n[a].substring(0,o);s===r.lookupQuerystring&&(t=n[a].substring(o+1))}}return t}},it=null,gn=function(){if(it!==null)return it;try{it=window!=="undefined"&&window.localStorage!==null;var r="i18next.translate.boo";window.localStorage.setItem(r,"foo"),window.localStorage.removeItem(r)}catch{it=!1}return it},Za={name:"localStorage",lookup:function(r){var t;if(r.lookupLocalStorage&&gn()){var i=window.localStorage.getItem(r.lookupLocalStorage);i&&(t=i)}return t},cacheUserLanguage:function(r,t){t.lookupLocalStorage&&gn()&&window.localStorage.setItem(t.lookupLocalStorage,r)}},at=null,hn=function(){if(at!==null)return at;try{at=window!=="undefined"&&window.sessionStorage!==null;var r="i18next.translate.boo";window.sessionStorage.setItem(r,"foo"),window.sessionStorage.removeItem(r)}catch{at=!1}return at},Xa={name:"sessionStorage",lookup:function(r){var t;if(r.lookupSessionStorage&&hn()){var i=window.sessionStorage.getItem(r.lookupSessionStorage);i&&(t=i)}return t},cacheUserLanguage:function(r,t){t.lookupSessionStorage&&hn()&&window.sessionStorage.setItem(t.lookupSessionStorage,r)}},eo={name:"navigator",lookup:function(r){var t=[];if(typeof navigator!="undefined"){if(navigator.languages)for(var i=0;i<navigator.languages.length;i++)t.push(navigator.languages[i]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},to={name:"htmlTag",lookup:function(r){var t,i=r.htmlTag||(typeof document!="undefined"?document.documentElement:null);return i&&typeof i.getAttribute=="function"&&(t=i.getAttribute("lang")),t}},ro={name:"path",lookup:function(r){var t;if(typeof window!="undefined"){var i=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(i instanceof Array)if(typeof r.lookupFromPathIndex=="number"){if(typeof i[r.lookupFromPathIndex]!="string")return;t=i[r.lookupFromPathIndex].replace("/","")}else t=i[0].replace("/","")}return t}},no={name:"subdomain",lookup:function(r){var t;if(typeof window!="undefined"){var i=window.location.href.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/gi);i instanceof Array&&(typeof r.lookupFromSubdomainIndex=="number"?t=i[r.lookupFromSubdomainIndex].replace("http://","").replace("https://","").replace(".",""):t=i[0].replace("http://","").replace("https://","").replace(".",""))}return t}};function io(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var Xn=function(){function e(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};pe(this,e),this.type="languageDetector",this.detectors={},this.init(r,t)}return ve(e,[{key:"init",value:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=Ka(i,this.options||{},io()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Ja),this.addDetector(Ya),this.addDetector(Za),this.addDetector(Xa),this.addDetector(eo),this.addDetector(to),this.addDetector(ro),this.addDetector(no)}},{key:"addDetector",value:function(t){this.detectors[t.name]=t}},{key:"detect",value:function(t){var i=this;t||(t=this.options.order);var n=[];return t.forEach(function(a){if(i.detectors[a]){var o=i.detectors[a].lookup(i.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}},{key:"cacheUserLanguage",value:function(t,i){var n=this;i||(i=this.options.caches),!!i&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||i.forEach(function(a){n.detectors[a]&&n.detectors[a].cacheUserLanguage(t,n.options)}))}}]),e}();Xn.type="languageDetector";const ao={"OS.ProductConfigurator.Selected.Message.From":"od","OS.ProductConfigurator.Selected.Message.UpTo":"do","OS.ProductConfigurator.Selected.Message.Choose":"Wybierz","OS.ProductConfigurator.Selected.Message.Options":"opcji","OS.ProductConfigurator.Selected.Message.OneOption":"Wybierz 1 opcj\u0119","OS.ProductConfigurator.Quantity.Message.UpTo":"do","OS.ProductConfigurator.Quantity.Message.From":"od","OS.ProductConfigurator.Quantity.Message.Max":"maksymalnie","OS.ProductConfigurator.Quantity.Message.Quantity":"ilo\u015Bci","OS.ProductConfigurator.Quantity.Message.OneOption":"Wybierz maksymalnie jedn\u0105 opcj\u0119","OS.ProductConfigurator.Add":"Dodaj","OS.ProductConfigurator.Back":"Wr\xF3\u0107","OS.ProductConfigurator.ShowMore":"Poka\u017C wi\u0119cej","OS.ProductConfigurator.ShowLess":"Poka\u017C mniej"},oo={"OS.ProductConfigurator.Selected.Message.From":"from","OS.ProductConfigurator.Selected.Message.UpTo":"up to","OS.ProductConfigurator.Selected.Message.Choose":"Choose","OS.ProductConfigurator.Selected.Message.Options":"options","OS.ProductConfigurator.Selected.Message.OneOption":"Choose one option","OS.ProductConfigurator.Quantity.Message.UpTo":"up to","OS.ProductConfigurator.Quantity.Message.From":"from","OS.ProductConfigurator.Quantity.Message.Max":"max","OS.ProductConfigurator.Quantity.Message.Quantity":"quantity","OS.ProductConfigurator.Quantity.Message.OneOption":"Choose maximum one option","OS.ProductConfigurator.Add":"Add","OS.ProductConfigurator.Back":"Back","OS.ProductConfigurator.ShowMore":"Show more","OS.ProductConfigurator.ShowLess":"Show less"},so={"OS.ProductConfigurator.Selected.Message.From":"ab","OS.ProductConfigurator.Selected.Message.UpTo":"bis","OS.ProductConfigurator.Selected.Message.Choose":"W\xE4hle","OS.ProductConfigurator.Selected.Message.Options":"Optionen","OS.ProductConfigurator.Selected.Message.OneOption":"W\xE4hle eine Option","OS.ProductConfigurator.Quantity.Message.UpTo":"ab","OS.ProductConfigurator.Quantity.Message.From":"aus","OS.ProductConfigurator.Quantity.Message.Max":"max","OS.ProductConfigurator.Quantity.Message.Quantity":"Menge","OS.ProductConfigurator.Quantity.Message.OneOption":"W\xE4hle bis zu 1 Option aus","OS.ProductConfigurator.Add":"Hinzuf\xFCgen","OS.ProductConfigurator.Back":"Zur\xFCck","OS.ProductConfigurator.ShowMore":"Zeig mehr","OS.ProductConfigurator.ShowLess":"Zeig weniger"},uo={"OS.ProductConfigurator.Selected.Message.From":"from","OS.ProductConfigurator.Selected.Message.UpTo":"up to","OS.ProductConfigurator.Selected.Message.Choose":"Choose","OS.ProductConfigurator.Selected.Message.Options":"options","OS.ProductConfigurator.Selected.Message.OneOption":"Choose one option","OS.ProductConfigurator.Quantity.Message.UpTo":"up to","OS.ProductConfigurator.Quantity.Message.From":"from","OS.ProductConfigurator.Quantity.Message.Max":"max","OS.ProductConfigurator.Quantity.Message.Quantity":"quantity","OS.ProductConfigurator.Quantity.Message.OneOption":"Choose maximum one option","OS.ProductConfigurator.Add":"Add","OS.ProductConfigurator.Back":"Back","OS.ProductConfigurator.ShowMore":"Show more","OS.ProductConfigurator.ShowLess":"Show less"};oe.use(Xn).use(la).init({resources:{pl:{translation:ao},en:{translation:oo},de:{translation:so},cs:{translation:uo}}});var ei=(e=>(e.SELECT="selCtx",e.FILTER="fltCtx",e))(ei||{}),qe=(e=>(e.OPTIONS="3e/group/options",e.CONFIG="3e/group/config",e.PRODUCT="3e/product",e))(qe||{}),xe=(e=>(e.OK="OK",e.TOO_MUCH="TOO_MUCH",e.NOT_ENOUGHT="NOT_ENOUGHT",e.IGNORE="IGNORE",e))(xe||{});const yr=(e,r,t)=>{const i=r[e];let n=0,a=0;if(i)for(let[o,s]of Object.entries(i))parseInt(s)>0&&(n+=1,a+=Number(s));else t&&t.forEach(o=>{if(r[o.selCtx])for(let[s,u]of Object.entries(r[o.selCtx]))parseInt(u)>0&&(n+=1,a+=Number(u))});return[n,a]},lo=(e,r)=>{const{selCtx:t,attrs:i={}}=e,{qtyMin:n,qtyMax:a}=i,{t:o}=$t(),[s,u]=yr(t,r,e.items),{status:c,information:f}=co(n,a,u,o);return{chosenQtyCnt:u,qtyMin:n,qtyMax:a,walidationStatus:c,informationText:f}},co=(e,r,t,i)=>{let n="",a="";const o=Number(e),s=Number(r);return o>0&&(n+=` ${i("OS.ProductConfigurator.Quantity.Message.From")} ${o}`,o>t&&(a=xe.NOT_ENOUGHT)),s>0&&(n+=` ${i("OS.ProductConfigurator.Quantity.Message.UpTo")} ${s}`,s<t&&(a=xe.TOO_MUCH)),o>=0||s>=0&&t<o?(n=`${i("OS.ProductConfigurator.Quantity.Message.Max")}${n}`,n+=` ${i("OS.ProductConfigurator.Quantity.Message.Quantity")}`):o===1&&o===1?n=`${i("OS.ProductConfigurator.Quantity.Message.OneOption")}`:(n="",a=xe.IGNORE),t>=o&&t<=s&&(a=xe.OK),{information:n,status:a}},fo=(e,r)=>{const{selCtx:t,attrs:i={}}=e,{selMin:n,selMax:a}=i,{t:o}=$t(),[s,u]=yr(t,r,e.items),{status:c,information:f}=go(n,a,s,o);return{chosenSelCnt:s,selMin:n,selMax:a,walidationStatus:c,informationText:f}},go=(e,r,t,i)=>{let n="",a="";const o=parseInt(e||"-1"),s=parseInt(r||"-1");return o>0&&(n+=` ${i("OS.ProductConfigurator.Selected.Message.From")} ${o}`,o>t&&(a=xe.NOT_ENOUGHT)),s>0&&(n+=` ${i("OS.ProductConfigurator.Selected.Message.UpTo")} ${s}`,s<t&&(a=xe.TOO_MUCH)),o>=0||s>=0?(n=`${i("OS.ProductConfigurator.Selected.Message.Choose")}${n}`,n+=` ${i("OS.ProductConfigurator.Selected.Message.Options")}`):(n="",a=xe.IGNORE),o===1&&s===1&&(n=`${i("OS.ProductConfigurator.Selected.Message.OneOption")}`),t>=o&&t<=s&&(a=xe.OK),{information:n,status:a}},ho=(e,r,t)=>{if(e==="selected"||e==="filter")return[];if(t[r]===e)return[t];let i=ri(e,r,t.items);return(i==null?void 0:i.length)||(i=ti(e,r,t.items),i.length===0),i},ti=(e,r,t)=>{const i=po(t),n=ri(e,r,i);return(n==null?void 0:n.length)?n:(i==null?void 0:i.length)?ti(e,r,i):[]},po=e=>{let r=[];return Array.isArray(e)&&(r=e.map(t=>{if(Array.isArray(t==null?void 0:t.items))return t.items}).filter(t=>t!==void 0)),r.flat(1)},ri=(e,r,t)=>{let i=[];return Array.isArray(t)&&(i=t.filter(n=>{if(n&&n[r]===e)return!0})),i},vo=(e,r,t,i)=>{const n=ho(r,t,i),a=mo(e,n).filter(o=>o!==null&&typeof o!="undefined");return a.length?a[0]:null},mo=(e,r)=>{let t=[];return Array.isArray(r)&&r.length&&(t=r.map(i=>yo(e,i))),t},yo=(e,r)=>{if(r.id===e)return r;let t=ii(e,r.items);return t.length?(t.length>1&&console.error(`More than one ${e} in context ${r.id}`),t[0]):(t=ni(e,r.items),t.length?(t.length>1&&console.error(`More than one ${e} in context ${r.id}`),t[0]):null)},ni=(e,r)=>{const t=bo(r),i=ii(e,t);return(i==null?void 0:i.length)?i:(t==null?void 0:t.length)?ni(e,t):[]},bo=e=>{let r=[];return Array.isArray(e)&&(r=e.map(t=>{if(Array.isArray(t==null?void 0:t.items))return t.items}).filter(t=>t!==void 0)),r.flat(1)},ii=(e,r)=>Array.isArray(r)?r.filter(i=>{if(i&&i.id===e)return!0}):[],br=(e,r)=>{let t=0;for(const[i,n]of Object.entries(e))if(n){for(const[a,o]of Object.entries(n))if(o){const s=vo(a,i,ei.SELECT,r);s&&(s==null?void 0:s.price)&&(t+=parseFloat(s.price)*o)}}return t};function pn(e){const{isOkk:r,isErr:t,info:i}=e;return p.jsxs("p",{className:`${r?"text-green-600":t&&"text-red-600"} ml-1 flex`,children:[r&&xo,t&&Oo,i]})}const xo=p.jsx("svg",{className:"w-6 h-6 text-green-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","data-testid":"form-check-mark",children:p.jsx("polyline",{points:"20 6 9 17 4 12"})}),Oo=p.jsx("svg",{className:"w-6 h-6 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","data-testid":"form-exclamation-mark",children:p.jsx("path",{strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})});var So={defaultAmount:0,defaultCurrency:"USD",defaultPrecision:2},wo={globalLocale:"en-US",globalFormat:"$0,0.00",globalRoundingMode:"HALF_EVEN",globalFormatRoundingMode:"HALF_AWAY_FROM_ZERO",globalExchangeRatesApi:{endpoint:void 0,headers:void 0,propertyPath:void 0}};function ct(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ct=function(r){return typeof r}:ct=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ct(e)}function vn(e){return Co(e)||Po(e)||jo(e)||No()}function Co(e){if(Array.isArray(e))return e}function Po(e){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(e))return Array.from(e)}function jo(e,r){if(!!e){if(typeof e=="string")return mn(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return mn(e,r)}}function mn(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,i=new Array(r);t<r;t++)i[t]=e[t];return i}function No(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ko={normalizePrecision:function(r){var t=r.reduce(function(i,n){return Math.max(i.getPrecision(),n.getPrecision())});return r.map(function(i){return i.getPrecision()!==t?i.convertPrecision(t):i})},minimum:function(r){var t=vn(r),i=t[0],n=t.slice(1),a=i;return n.forEach(function(o){a=a.lessThan(o)?a:o}),a},maximum:function(r){var t=vn(r),i=t[0],n=t.slice(1),a=i;return n.forEach(function(o){a=a.greaterThan(o)?a:o}),a}};function ai(e){return!isNaN(parseInt(e))&&isFinite(e)}function Eo(e){return ai(e)&&e<=100&&e>=0}function Lo(e){return e.length>0&&e.every(function(r){return r>=0})&&e.some(function(r){return r>0})}function yn(e){return e%2===0}function bn(e){return ai(e)&&!Number.isInteger(e)}function Fo(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=e.toString();if(r.indexOf("e-")>0)return parseInt(r.split("e-")[1]);var t=r.split(".")[1];return t?t.length:0}function ot(e){return Math.abs(e)%1===.5}function Ao(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(t,i){var n=Object.assign(new XMLHttpRequest,{onreadystatechange:function(){n.readyState===4&&(n.status>=200&&n.status<400?t(JSON.parse(n.responseText)):i(new Error(n.statusText)))},onerror:function(){i(new Error("Network error"))}});n.open("GET",e,!0),Ro(n,r.headers),n.send()})}function Ro(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(var t in r)e.setRequestHeader(t,r[t]);return e}function lt(e){return typeof e=="undefined"}function oi(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:".",t={};return Object.entries(e).forEach(function(i){if(ct(i[1])==="object"){var n=oi(i[1]);Object.entries(n).forEach(function(a){t[i[0]+r+a[0]]=a[1]})}else t[i[0]]=i[1]}),t}function To(e){return Boolean(e)&&(ct(e)==="object"||typeof e=="function")&&typeof e.then=="function"}function si(){var e=function(i,n){var a=function(u){return Math.pow(10,Fo(u))},o=Math.max(a(i),a(n));return Math.round(i*o)*Math.round(n*o)/(o*o)},r={HALF_ODD:function(i){var n=Math.round(i);return ot(i)&&yn(n)?n-1:n},HALF_EVEN:function(i){var n=Math.round(i);return ot(i)?yn(n)?n:n-1:n},HALF_UP:function(i){return Math.round(i)},HALF_DOWN:function(i){return ot(i)?Math.floor(i):Math.round(i)},HALF_TOWARDS_ZERO:function(i){return ot(i)?Math.sign(i)*Math.floor(Math.abs(i)):Math.round(i)},HALF_AWAY_FROM_ZERO:function(i){return ot(i)?Math.sign(i)*Math.ceil(Math.abs(i)):Math.round(i)},DOWN:function(i){return Math.floor(i)}};return{add:function(i,n){return i+n},subtract:function(i,n){return i-n},multiply:function(i,n){return bn(i)||bn(n)?e(i,n):i*n},divide:function(i,n){return i/n},modulo:function(i,n){return i%n},round:function(i){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"HALF_EVEN";return r[n](i)}}}var Mo=si();function Do(e){var r=/^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(e);return{getMatches:function(){return r!==null?r.slice(1).filter(function(i){return!lt(i)}):[]},getMinimumFractionDigits:function(){var i=function(a){return a==="."};return lt(this.getMatches().find(i))?0:this.getMatches()[Mo.add(this.getMatches().findIndex(i),1)].split("").length},getCurrencyDisplay:function(){var i={USD:"code",dollar:"name",$:"symbol"};return i[this.getMatches().find(function(n){return n==="USD"||n==="dollar"||n==="$"})]},getStyle:function(){return lt(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!lt(this.getMatches().find(function(i){return i===","}))}}}function Io(e){var r=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0;for(var o in a)n=n.replace("{{".concat(o,"}}"),a[o]);return n},t=function(n,a){return Ao(r(e.endpoint,{from:n,to:a}),{headers:e.headers})};return{getExchangeRate:function(n,a){return(To(e.endpoint)?e.endpoint:t(n,a)).then(function(o){return oi(o)[r(e.propertyPath,{from:n,to:a})]})}}}function dt(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Error;if(!e)throw new t(r)}function _o(e){dt(Eo(e),"You must provide a numeric value between 0 and 100.",RangeError)}function Vo(e){dt(Lo(e),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}function rr(e){dt(Number.isInteger(e),"You must provide an integer.",TypeError)}var K=si(),$o=function e(r){var t=Object.assign({},{amount:e.defaultAmount,currency:e.defaultCurrency,precision:e.defaultPrecision},r),i=t.amount,n=t.currency,a=t.precision;rr(i),rr(a);var o=e.globalLocale,s=e.globalFormat,u=e.globalRoundingMode,c=e.globalFormatRoundingMode,f=Object.assign({},e.globalExchangeRatesApi),l=function(v){var x=Object.assign({},Object.assign({},{amount:i,currency:n,precision:a},v),Object.assign({},{locale:this.locale},v));return Object.assign(e({amount:x.amount,currency:x.currency,precision:x.precision}),{locale:x.locale})},d=function(v){dt(this.hasSameCurrency(v),"You must provide a Dinero instance with the same currency.",TypeError)};return{getAmount:function(){return i},getCurrency:function(){return n},getLocale:function(){return this.locale||o},setLocale:function(v){return l.call(this,{locale:v})},getPrecision:function(){return a},convertPrecision:function(v){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;rr(v);var S=this.getPrecision(),m=v>S,w=m?K.multiply:K.divide,P=m?[v,S]:[S,v],j=Math.pow(10,K.subtract.apply(K,P));return l.call(this,{amount:K.round(w(this.getAmount(),j),x),precision:v})},add:function(v){d.call(this,v);var x=e.normalizePrecision([this,v]);return l.call(this,{amount:K.add(x[0].getAmount(),x[1].getAmount()),precision:x[0].getPrecision()})},subtract:function(v){d.call(this,v);var x=e.normalizePrecision([this,v]);return l.call(this,{amount:K.subtract(x[0].getAmount(),x[1].getAmount()),precision:x[0].getPrecision()})},multiply:function(v){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return l.call(this,{amount:K.round(K.multiply(this.getAmount(),v),x)})},divide:function(v){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return l.call(this,{amount:K.round(K.divide(this.getAmount(),v),x)})},percentage:function(v){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return _o(v),this.multiply(K.divide(v,100),x)},allocate:function(v){var x=this;Vo(v);for(var S=v.reduce(function(j,R){return K.add(j,R)}),m=this.getAmount(),w=v.map(function(j){var R=Math.floor(K.divide(K.multiply(x.getAmount(),j),S));return m=K.subtract(m,R),l.call(x,{amount:R})}),P=0;m>0;)v[P]>0&&(w[P]=w[P].add(l.call(this,{amount:1})),m=K.subtract(m,1)),P+=1;return w},convert:function(v){var x=this,S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=S.endpoint,w=m===void 0?f.endpoint:m,P=S.propertyPath,j=P===void 0?f.propertyPath||"rates.{{to}}":P,R=S.headers,M=R===void 0?f.headers:R,D=S.roundingMode,_=D===void 0?u:D,T=Object.assign({},{endpoint:w,propertyPath:j,headers:M,roundingMode:_});return Io(T).getExchangeRate(this.getCurrency(),v).then(function(N){return dt(!lt(N),'No rate was found for the destination currency "'.concat(v,'".'),TypeError),l.call(x,{amount:K.round(K.multiply(x.getAmount(),parseFloat(N)),T.roundingMode),currency:v})})},equalsTo:function(v){return this.hasSameAmount(v)&&this.hasSameCurrency(v)},lessThan:function(v){d.call(this,v);var x=e.normalizePrecision([this,v]);return x[0].getAmount()<x[1].getAmount()},lessThanOrEqual:function(v){d.call(this,v);var x=e.normalizePrecision([this,v]);return x[0].getAmount()<=x[1].getAmount()},greaterThan:function(v){d.call(this,v);var x=e.normalizePrecision([this,v]);return x[0].getAmount()>x[1].getAmount()},greaterThanOrEqual:function(v){d.call(this,v);var x=e.normalizePrecision([this,v]);return x[0].getAmount()>=x[1].getAmount()},isZero:function(){return this.getAmount()===0},isPositive:function(){return this.getAmount()>=0},isNegative:function(){return this.getAmount()<0},hasSubUnits:function(){return K.modulo(this.getAmount(),Math.pow(10,a))!==0},hasCents:function(){return K.modulo(this.getAmount(),Math.pow(10,a))!==0},hasSameCurrency:function(v){return this.getCurrency()===v.getCurrency()},hasSameAmount:function(v){var x=e.normalizePrecision([this,v]);return x[0].getAmount()===x[1].getAmount()},toFormat:function(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:s,x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c,S=Do(v);return this.toRoundedUnit(S.getMinimumFractionDigits(),x).toLocaleString(this.getLocale(),{currencyDisplay:S.getCurrencyDisplay(),useGrouping:S.getUseGrouping(),minimumFractionDigits:S.getMinimumFractionDigits(),style:S.getStyle(),currency:this.getCurrency()})},toUnit:function(){return K.divide(this.getAmount(),Math.pow(10,a))},toRoundedUnit:function(v){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c,S=Math.pow(10,v);return K.divide(K.round(K.multiply(this.toUnit(),S),x),S)},toObject:function(){return{amount:i,currency:n,precision:a}},toJSON:function(){return this.toObject()}}},Uo=Object.assign($o,So,wo,ko);const jt=(e,r="PLN")=>{e=e.toString();const t=e.replace(",","."),i=Number(t)*100;return isNaN(i)?"0.00":Uo({amount:Math.round(i),currency:r}).toFormat("0,0.00")},Ho=(e,r,t=1)=>{const i=parseFloat(e.toString());let n=!1,a=jt(`${t*i}`);const o=`${jt(`${a}`)}`;return i<parseFloat(r)&&(n=!0,a=`${jt(`${r}`)}`),{displayPriceFrom:n,formattedEndPriceWithPriceMin:a,formattedEndPrice:o}};function Bt(e){const{price:r,addPlusBefore:t=!1,size:i="md",showIfPriceZero:n=!1,minPrice:a="0.00",hiddenIfPriceZero:o=!1}=e,s=parseFloat(a),u=r>s?r:a,c=jt(`${u}`);return!r&&n===!1?null:t?p.jsxs("span",{style:{visibility:`${!r&&o?"hidden":"visible"}`},className:"",children:["\xA0",`+${c}`]}):r<s?p.jsxs("span",{className:"",children:["\xA0",`od ${c}`]}):p.jsx("span",{className:"",children:c})}const Bo=(e,r,t)=>e==="1"&&r==="1"&&!t?"radio":t?"counter":"checkbox",Wo=e=>{const r=document.getElementById(e);r?r.scrollIntoView({behavior:"smooth"}):console.warn(`Error: scrollToId: id: ${e} not found in html structure`)},ui=e=>`group--${e}`;function zo(e){let r;const t=new Set,i=(c,f)=>{const l=typeof c=="function"?c(r):c;if(l!==r){const d=r;r=f?l:Object.assign({},r,l),t.forEach(g=>g(r,d))}},n=()=>r,a=(c,f=n,l=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let d=f(r);function g(){const v=f(r);if(!l(d,v)){const x=d;c(d=v,x)}}return t.add(g),()=>t.delete(g)},u={setState:i,getState:n,subscribe:(c,f,l)=>f||l?a(c,f,l):(t.add(c),()=>t.delete(c)),destroy:()=>t.clear()};return r=e(i,n,u),u}const qo=typeof window=="undefined"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),xn=qo?y.useEffect:y.useLayoutEffect;function Go(e){const r=typeof e=="function"?zo(e):e,t=(i=r.getState,n=Object.is)=>{const[,a]=y.useReducer(S=>S+1,0),o=r.getState(),s=y.useRef(o),u=y.useRef(i),c=y.useRef(n),f=y.useRef(!1),l=y.useRef();l.current===void 0&&(l.current=i(o));let d,g=!1;(s.current!==o||u.current!==i||c.current!==n||f.current)&&(d=i(o),g=!n(l.current,d)),xn(()=>{g&&(l.current=d),s.current=o,u.current=i,c.current=n,f.current=!1});const v=y.useRef(o);xn(()=>{const S=()=>{try{const w=r.getState(),P=u.current(w);c.current(l.current,P)||(s.current=w,l.current=P,a())}catch{f.current=!0,a()}},m=r.subscribe(S);return r.getState()!==v.current&&S(),m},[]);const x=g?d:l.current;return y.useDebugValue(x),x};return Object.assign(t,r),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,r];return{next(){const n=i.length<=0;return{value:i.shift(),done:n}}}},t}const Ko=(e,r)=>({filter:{},unseenGroupsByFilter:[],setInitialFilter:t=>{e(()=>({filter:ie({},t),unseenGroupsByFilter:[]}))},setFilter:(t,i)=>{e(({filter:n})=>({filter:We(ie({},n),{[t]:ie(ie({},n[t]),i)})}))},validateFilter:(t,i)=>{const n=r().filter;return t&&n[i]?Object.keys(n[i]).filter(o=>Object.keys(t).includes(o)&&t[o].includes(n[i][o])):[]},uncheckFilteredProducts:(t,i,n,a,o)=>{r().initialSelectedState;const s=u=>{t&&Object.keys(t).length>0&&n.length===0&&u.forEach(c=>{const{selCtx:f,id:l,items:d=[]}=c;o(`selected.${f}.${l}`,!1),d.length>0&&s(d)})};s(i)},checkFilteredProducts:(t,i,n,a,o)=>{const s=r().initialSelectedState,u=c=>{t&&Object.keys(t).length>0&&n.length!==0&&c.forEach(f=>{var x;const{selCtx:l,id:d,items:g=[]}=f,v=(x=s[l])==null?void 0:x[d];v&&o(`selected.${l}.${d}`,v.toString()),g.length>0&&u(g)})};u(i)}}),Qo=(e,r)=>({initialSelectedState:{},mainProductCount:1,setInitialSelectedState:t=>{e(()=>({initialSelectedState:t,mainProductCount:1}))},increaseCount:()=>{e(({mainProductCount:t})=>({mainProductCount:t+1}))},decreaseCount:()=>{e(({mainProductCount:t})=>({mainProductCount:t-1}))}}),Jo=(e,r)=>({groupsValidation:{},isOnSubmitted:!1,setInitialValidate:()=>{e(()=>({groupsValidation:{},isOnSubmitted:!1}))},setGroupsValidation:(t,i,n,a,o,s,u,c)=>{((n==null?void 0:n.qtyMax)||(n==null?void 0:n.selMax))&&e(({groupsValidation:f})=>({groupsValidation:We(ie({},f),{[i]:{parentContext:t,disableAddCounter:a===Number(n==null?void 0:n.qtyMax),disableInput:o===Number(n==null?void 0:n.selMax),parentKind:s,nestedLvl:u,isValid:a>=(Number(n==null?void 0:n.qtyMin)||0)&&o>=(Number(n==null?void 0:n.selMin)||0),isPassedFiltering:c,debug:{qtyCnt:a,selCnt:o,productAttrs:n,productSelCtx:i}}})}))},getParentsCtxValidation:(t,i)=>{const n=r().groupsValidation,a=r().getParentsCtxValidation;let o=!1;const s=n[t].parentContext,u=n[s];return Object.keys(n).map(c=>{u?o=Boolean(u==null?void 0:u[i]):o=!1,u&&!u[i]&&u.parentKind!==qe.PRODUCT&&t!==t&&a(c,i)}),o},getCtxValidation:(t,i)=>{const n=r().groupsValidation;return n[t]?n[t][i]:!1},validateSingleProductQty:(t,i)=>t&&i?Number(t)===Number(i):!1,isAddDisabled:(t,i,n)=>{const a=r().groupsValidation;return a&&a[t]&&a[t].parentKind!==qe.PRODUCT?r().getCtxValidation(t,"disableAddCounter")||r().getParentsCtxValidation(t,"disableAddCounter")||r().validateSingleProductQty(i,n):r().getCtxValidation(t,"disableAddCounter")||r().validateSingleProductQty(i,n)},isInputDisabled:t=>{const i=r().groupsValidation;return i&&i[t]&&i[t].parentKind!==qe.PRODUCT&&r().getParentsCtxValidation(t,"disableInput")||r().getCtxValidation(t,"disableInput")},setIsOnSubmittedOnTrue:()=>{console.log("isOnSubmitted"),e(()=>({isOnSubmitted:!0}))},getInvalidContextNames:()=>{var n;const t=r().groupsValidation,i=[];for(const[a,o]of Object.entries(t))t[a].isValid===!1&&t[a].isPassedFiltering===!0&&(console.log("inValidGroup debug"),console.log((n=t[a])==null?void 0:n.debug),i.push(a));return i}}),Yo=(e,r)=>({expanded:{},toggleExpanded:(t,i,n)=>{const a=r().expanded[t+i+n];e(()=>({expanded:We(ie({},r().expanded),{[t+i+n]:a!==void 0?!a:!1})}))},resetExpanded:()=>{e(()=>({expanded:{}}))}}),Y=Go((e,r)=>ie(ie(ie(ie({},Ko(e,r)),Qo(e)),Jo(e,r)),Yo(e,r))),Zo=(e,r,t,i)=>{const n=i[e+r+t];return n!==void 0?n:!0},Xo=e=>{const{productItem:r,selected:t,parentCtx:i,nestedLvl:n,parentKind:a}=e,{walidationStatus:o,informationText:s}=fo(r,t),{walidationStatus:u,informationText:c}=lo(r,t),{watch:f,setValue:l}=pt(),[d,g]=y.useState([]),{items:v,selCtx:x,attrs:S={},details:m={},filter:w,fltCtx:P,id:j}=r,{name:R,description:M}=m.literals,D=Y(V=>V.filter),_=Y(V=>V.validateFilter),T=Y(V=>V.uncheckFilteredProducts),N=Y(V=>V.expanded),E=y.useMemo(()=>Zo(x,j,i,N),[x,j,i,N]),I=Y(V=>V.toggleExpanded),q=Y(V=>V.checkFilteredProducts);y.useEffect(()=>{const V=_(w,P);T(w,v,V,f,l),q(w,v,V,f,l),g(V)},[D]);const $=Y(V=>V.setGroupsValidation),Q=Y(V=>V.isOnSubmitted),[te,W]=yr(r.selCtx,t,v),Z=w&&Object.keys(w).length>0&&d.length===0;$(i,x,S,W,te,a,n,!Z);const re=o===xe.OK,X=u===xe.OK,B=!re&&Q&&!!s,G=!X&&Q&&!!c;return Z?null:p.jsxs("div",{className:"pt-1 mb-3 configuration-group",id:ui(x),children:[p.jsxs("div",{className:"flex text-xl font-semibold",children:[p.jsx("p",{className:"",children:R}),R&&R!==" "&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"ml-auto",children:p.jsx(Bt,{price:br(t,r)})}),p.jsx("svg",{className:`w-8 h-8 ml-2 text-black cursor-pointer ${!E&&"rotate-180"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",onClick:()=>I(x,j,i),children:p.jsx("polyline",{points:"18 15 12 9 6 15"})})]})]}),p.jsx("p",{className:`${M&&"mb-2"}`,children:M}),p.jsx("div",{className:"flex",children:p.jsxs("div",{children:[p.jsx(pn,{isOkk:re,isErr:B,info:s}),p.jsx(pn,{isOkk:X,isErr:G,info:c})]})}),E&&p.jsx(xr,{productItems:v,nestedLvl:n+1,context:r})]})};function li(e){const{value:r=0,add:t,subtract:i,disabledSubtract:n,disabledAdd:a,size:o="md"}=e;return p.jsxs("div",{className:`counter counter-${o} flex flex-row justify-center items-center p-1 border-[1px] rounded-md border-[rgba(229,231,235,255)] product-quantity`,children:[p.jsx("button",{type:"button",className:"quantity-button small",onClick:i,disabled:n,children:p.jsxs("svg",{className:"w-4 h-4 text-black",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"}),p.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),p.jsx("span",{className:"font-semibold text-gray-700 product-quantity-value",children:r}),p.jsx("button",{className:"quantity-button small",type:"button",onClick:t,disabled:a,children:p.jsxs("svg",{className:"w-4 h-4 text-green-600 ",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"}),p.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),p.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})})]})}function ci(e){const{productName:r,price:t,size:i="lg",description:n="",productId:a,selCtx:o,register:s,handleOnChange:u,children:c,isDisabled:f=!1,imgSrc:l=""}=e,d=`${o}---${a}`;return p.jsxs("div",{className:`flex items-center justify-center p-2 pl-3 my-1 rounded-lg bg-white border-2 border-gray-200 ${f&&"opacity-50"}`,children:[p.jsx("input",We(ie({type:"checkbox",className:`simple-checkbox checkbox-${i} mr-4`,id:d},s(`selected.${o}.${a}`,{onChange:g=>{u(g)}})),{disabled:f,value:"1"})),l&&p.jsx("div",{className:"flex mr-2 w-20 max-h-24",children:p.jsx("img",{alt:"Product image",className:"max-w-full h-auto",src:l})}),p.jsx("label",{htmlFor:d,className:"flex justify-between items-center w-full",children:p.jsxs("div",{className:"relative",children:[p.jsx("p",{className:"w-full text-lg font-semibold",children:r}),p.jsx("p",{className:"text-sm text-gray-600",children:n})]})}),p.jsx("div",{className:"ml-auto",children:c}),p.jsx("label",{htmlFor:d,children:p.jsx(Bt,{price:parseFloat(t),addPlusBefore:!0,showIfPriceZero:!0,hiddenIfPriceZero:!0})})]})}function fi(e){const{productName:r,price:t,size:i="lg",description:n="",productId:a,selCtx:o,register:s,handleOnChange:u,checked:c,children:f,isDisabled:l,readOnly:d=!1,imgSrc:g=""}=e,v=`${o}---${a}`;return p.jsxs("div",{className:`flex items-center justify-between p-2 pl-3 mt-1 mb-1 bg-white rounded-xl border-2 border-gray-200 ${l&&"opacity-50"}`,children:[p.jsx("input",We(ie({type:"radio",className:`simple-radio radio-${i} mr-4`,id:v},s(`radio.${v}`,{onChange:x=>{u(x)}})),{value:a,checked:c,disabled:l,readOnly:d})),g&&p.jsx("div",{className:"flex mr-2 w-20 max-h-24",children:p.jsx("img",{alt:"Product image",className:"max-w-full h-auto",src:g})}),p.jsx("label",{htmlFor:v,className:"flex justify-between items-center w-full",children:p.jsxs("div",{className:"relative",children:[p.jsx("p",{className:"w-full text-lg font-semibold",children:r}),p.jsx("p",{className:"text-sm text-gray-600",children:n})]})}),p.jsx("div",{className:"ml-auto",children:f}),p.jsx("label",{htmlFor:v,children:p.jsx(Bt,{price:parseFloat(t),addPlusBefore:!0,showIfPriceZero:!0,hiddenIfPriceZero:!0})})]})}const es=e=>{const{productName:r,state:t,items:i,price:n,size:a="lg",description:o="",productId:s,selCtx:u,handleOnChangeCheckBox:c,handleOnChangeRadio:f,productAttrs:l,contextAttrs:d,checked:g}=e,{register:v,setValue:x,watch:S}=pt(),m=S(`selected.${u}.${s}`);let w=0;m&&!isNaN(m)&&(w=Number(m));const P=Y(E=>E.isAddDisabled),j=Y(E=>E.isInputDisabled),R=()=>{x(`selected.${u}.${s}`,`${w+1}`)},M=()=>{x(`selected.${u}.${s}`,`${w-1}`)},D=Number(m)===0||!m,_=p.jsx(li,{value:w,add:R,subtract:M,disabledSubtract:D,disabledAdd:P(u,m,l==null?void 0:l.qtyMax)||j(u)&&!m}),{selMin:T="",selMax:N=""}=d;return p.jsx("div",{children:T==="1"&&N==="1"?p.jsx(fi,{description:o,productName:r,price:n,productId:s,selCtx:u,state:t,items:i,register:v,handleOnChange:f,checked:g,isDisabled:!1,children:_}):p.jsx(ci,{description:o,productName:r,price:n,productId:s,selCtx:u,state:t,items:i,register:v,handleOnChange:c,isDisabled:j(u)&&!m||P(u,m,l==null?void 0:l.qtyMax)&&!m,children:_})})},On=(e,r)=>{Object.keys(e).forEach(t=>{r(`selected.${t}`,e[t])})},Sn=(e,r,t)=>{const i=r(`selected.${e}`);t(`selected.${e}`,Object.keys(i).reduce((n,a)=>(n[a]=!1,n),{}))},wn=(e,r,t,i,n)=>{const{target:{checked:a}}=i,{selected:o={}}=n;if(a){On(o,e);const s=u=>{!Array.isArray(u)||u.map(c=>{if(c.state&&"selected"in c.state){const{state:{selected:f}}=c;On(f,e)}Array.isArray(c.items)&&s(c.items)})};s(t)}else{Object.keys(o).forEach(u=>{Sn(u,r,e)});const s=u=>{!Array.isArray(u)||u.map(c=>{const{selCtx:f}=c;r(`selected.${f}`)&&Sn(f,r,e),s(c.items)})};s(t)}},ts=e=>{const{attrs:r}=e;if(r)return r;{const t=["selMin","selMax","qtyMin","qtyMax","vital","allowMultiple","hidden"],i={};return Object.keys(e).forEach(n=>{t.includes(n)&&(i[n]=e[n])}),i}},rs=e=>{var te;const{productItem:r,contextAttrs:t,selected:i,nestedLvl:n}=e,{register:a,watch:o,setValue:s,getValues:u}=pt(),{items:c,id:f,selCtx:l,state:d={},attrs:g={},emit:v={},fltCtx:x,details:{media:S=[],literals:m},price:w=""}=r,P=ts(r),{name:j,description:R}=m,M=Y(W=>W.isInputDisabled),D=Y(W=>W.setFilter),_=i[l]&&i[l][r.id]&&Number(i[l][r.id])>0,T=S.find(W=>W.name==="MAIN_IMG")||S[0]||{},N=W=>{wn(s,u,c,W,d)},E=W=>{wn(s,u,c,W,d);const{target:Z}=W,re=Z.name,X=Z.defaultValue,B="selected."+re.replace("radio.","").split("---")[0];s(B,{[X]:"1"})},I=o(`selected.${l}.${f}`);y.useEffect(()=>{I&&Object.keys(v).length!==0&&D(x,v)},[I]);const q=Er.useTransition(Array.isArray(r.items)&&r.items.length>0&&I,{from:{opacity:0,transform:"translateY(-10px)"},enter:{opacity:1,transform:"translateY(0)"}});if(!r)return null;let $=w;(!$||parseFloat($||"1")===0)&&((te=r==null?void 0:r.state)==null?void 0:te.selected)&&($=`${br(r.state.selected,r)||"0"}`);const Q=()=>{switch(Bo(t==null?void 0:t.selMin,t==null?void 0:t.selMax,t==null?void 0:t.allowMultiple)){case"counter":return p.jsx(es,{description:R,productName:j,price:$,productId:f,selCtx:l,state:d,items:c,handleOnChangeCheckBox:N,handleOnChangeRadio:E,checked:!!_,contextAttrs:t,productAttrs:P});case"radio":return p.jsx(fi,{description:R,productName:j,price:$,productId:f,selCtx:l,state:d,items:c,register:a,handleOnChange:E,checked:!!_,isDisabled:!1,imgSrc:(T==null?void 0:T.url)||""});case"checkbox":return p.jsx(ci,{description:R,productName:j,price:$,productId:f,selCtx:l,state:d,items:c,register:a,handleOnChange:N,isDisabled:M(l)&&!I,imgSrc:(T==null?void 0:T.url)||""});default:return null}};return p.jsxs(p.Fragment,{children:[Q(),q((W,Z)=>Z&&p.jsx(Er.animated.div,{className:`border-l-[2px] border-gray-300 ${n>1&&"ml-4 pl-4"}`,style:W,children:p.jsx(xr,{productItems:c,nestedLvl:n+1,context:r})},n+1))]})};function ns(e){var f,l;const{productItem:r,nestedLvl:t,context:{attrs:i={},selCtx:n,kind:a}}=e,{kind:o}=r,{getValues:s}=pt(),{selected:u={}}=s();if(((f=r==null?void 0:r.attrs)==null?void 0:f.hidden)===!0||((l=r==null?void 0:r._)==null?void 0:l.hidden)==="true")return null;switch(o){case qe.OPTIONS:case qe.CONFIG:return p.jsx(Xo,{productItem:r,parentCtx:n,selected:u,nestedLvl:t,parentKind:a});case qe.PRODUCT:return p.jsx(rs,{productItem:r,selected:u,nestedLvl:t,contextAttrs:i});default:return null}}const nr=99,Cn=3;function xr(e){const{productItems:r,nestedLvl:t=1,context:i}=e,n=i.kind!=="3e/product",[a,o]=y.useState(n?Cn:nr),{t:s}=$t(),u=()=>{o(nr)},c=()=>{o(Cn)};return p.jsx("div",{children:r.map((f,l)=>{if(l<a)return p.jsxs("div",{children:[p.jsx(ns,{productItem:f,nestedLvl:t,context:i},`${i.id}--${f.id}--${l}`),a===nr&&n&&r.length===l+1&&Pn(s("OS.ProductConfigurator.ShowLess"),c,!1)]},`${i.id}--${f.id}--${l}`);if(l===a)return Pn(s("OS.ProductConfigurator.ShowMore"),u,!0)})})}const Pn=(e,r,t)=>p.jsx("div",{className:"flex justify-center w-full",children:p.jsxs("button",{className:"flex px-2 text-lg font-semibold text-black",onClick:r,children:[e,p.jsxs("svg",{className:`-mr-2 w-7 h-7 ${!t&&"rotate-180"}`,width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"})," ",p.jsx("polyline",{points:"7 7 12 12 17 7"})," ",p.jsx("polyline",{points:"7 13 12 18 17 13"})]})]})},`${e}`),is=["id","selCtx","fltCtx"],di=".",gi="#dot",as=e=>e.replaceAll(di,gi),os=e=>e.replaceAll(gi,di),ss=(e,r)=>hi(e,r,as),us=(e,r)=>hi(e,r,os),hi=(e,r,t)=>{let i=r;if(is.includes(e)&&(typeof r=="string"||r instanceof String)&&(i=t(r)),e==="selected"||e==="filter"){const n=JSON.stringify(r),a=t(n);i=JSON.parse(a)}return i},pi=(e,r)=>(Object.keys(e).forEach(t=>{const i=e[t];e[t]=r(t,i),typeof i=="object"&&i!==null&&pi(i,r)}),e),ls=e=>{const r=JSON.parse(JSON.stringify(e));for(const[t,i]of Object.entries(r))if(i){const n=r[t];for(const[a,o]of Object.entries(n))o===!1&&delete n[a];Object.keys(n).length===0&&delete r[t]}else delete r[t];return r},cs=e=>us("selected",e),fs=()=>{const{watch:e}=pt(),r=e("selected");return console.log("selected",r),p.jsxs("div",{className:"flex flex-col items-center py-4",children:[p.jsx("h2",{className:"mb-4 text-2xl font-bold tracking-wide",children:"Selected State"}),Object.keys(r).map(t=>p.jsx("div",{children:Object.values(r[t]).filter(i=>i).length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("p",{className:"text-lg font-semibold",children:[t,":"]}),Object.keys(r[t]).map(i=>p.jsx(he.default.Fragment,{children:r[t][i]&&p.jsxs("p",{children:[i,":",r[t][i].toString()]})},i))]})},t))]})};function jn(e){const{finalPrice:r,isBackIcon:t=!0,handleGoBack:i,displayPriceFrom:n=!1}=e,{t:a}=$t(),o=Y(c=>c.mainProductCount),s=Y(c=>c.increaseCount),u=Y(c=>c.decreaseCount);return p.jsxs("div",{className:"flex justify-around items-center px-4 w-full h-16",children:[t&&p.jsxs("button",{className:"inline-flex items-center py-1 px-2 font-bold text-red-600 hover:bg-red-200 rounded border-2 border-red-600 border-solid",onClick:i,children:[p.jsxs("svg",{className:"w-5 h-5 text-red-600",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"}),p.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),p.jsx("line",{x1:"5",y1:"12",x2:"11",y2:"18"}),p.jsx("line",{x1:"5",y1:"12",x2:"11",y2:"6"})]}),p.jsx("span",{className:"uppercase",children:`${a("OS.ProductConfigurator.Back")}`})]}),p.jsx("div",{className:"px-3",children:p.jsx(li,{value:o,add:s,subtract:u,disabledSubtract:o===1,size:"lg"})}),p.jsxs("button",{type:"submit",className:"flex justify-center items-center py-1 px-2 w-2/4 font-bold text-white bg-green-600 hover:bg-green-800 rounded border-2 border-green-600 border-solid sm:w-3/5",style:{opacity:`${n?"0.4":"1"}`},disabled:n,children:[p.jsxs("svg",{className:"mr-2 w-5 h-5 text-white",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"9",cy:"21",r:"1"})," ",p.jsx("circle",{cx:"20",cy:"21",r:"1"}),p.jsx("path",{d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"})]}),n?p.jsx("span",{children:`${a("OS.ProductConfigurator.Selected.Message.From")} ${r}`}):p.jsx("span",{className:"uppercase",children:`${a("OS.ProductConfigurator.Add")} ${r}`})]})]})}const St=640,vi=e=>{const{isModal:r=!1}=e,[t,i]=y.useState(window.innerWidth),[n,a]=y.useState(window.innerHeight),[o,s]=y.useState(window.innerWidth<=St),[u,c]=y.useState(window.innerWidth>St&&!r);function f(){i(window.innerWidth),a(window.innerHeight)}return y.useEffect(()=>(window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}),[]),y.useEffect(()=>{c(window.innerWidth>St&&!r),s(window.innerWidth<=St)},[t,e,r]),{isSm:u,isMobile:o,width:t,windowHeight:n}};function mi(e){var r,t,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e))for(r=0;r<e.length;r++)e[r]&&(t=mi(e[r]))&&(i&&(i+=" "),i+=t);else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function st(){for(var e=0,r,t,i="";e<arguments.length;)(r=arguments[e++])&&(t=mi(r))&&(i&&(i+=" "),i+=t);return i}function ds(e){var X,B,G,V;const{product:r,handleAddToBasket:t,isModal:i,handleGoBack:n,showDebugState:a=!1}=e,{state:{selected:o={}}={},price:s,minPrice:u="0"}=r,c=ra({defaultValues:{selected:o}}),{handleSubmit:f,getValues:l}=c,d=Y(U=>U.setIsOnSubmittedOnTrue),[g,v]=y.useState("auto"),[x,S]=y.useState(0),m=Y(U=>U.mainProductCount),w=Y(U=>U.getInvalidContextNames),P=Y(U=>U.filter);y.useEffect(()=>{S(1);const U=setTimeout(()=>{E||S(2)},250);return()=>{clearTimeout(U)}},[]),y.useEffect(()=>{console.log("filter",P)},[P]);const j=parseFloat(s)+br(l("selected"),r),{displayPriceFrom:R,formattedEndPrice:M}=Ho(j,u,m),D=U=>{d();const H=w();if(H.length)Wo(ui(H[0])),console.log(H);else{console.log(l("selected"));const me=cs(ls(l("selected")));console.log("decodedCleanedSelected: ",me),t({price:j/m,quantity:m,selected:me,filter:P})}},_=y.useRef(),T=y.useRef(),{isSm:N,isMobile:E,windowHeight:I}=vi({isModal:i}),q=p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:st("px-4 w-full",N&&"sm:sticky sm:top-0 sm:w-2/5"),ref:_,children:[r.details.media&&r.details.media[0].url&&p.jsx("img",{className:st("mx-auto mt-2 mb-6 max-h-[250px]",N&&"max-h-[450px]"),alt:r.details.literals.name,src:(X=r.details)==null?void 0:X.media[0].url}),p.jsx("div",{className:st(!a&&"hidden"),children:p.jsx(fs,{})})]}),p.jsxs("div",{className:st("w-full",N&&"sm:w-3/5"),ref:T,children:[p.jsxs("div",{className:"items-center p-4 w-full",children:[p.jsxs("div",{className:"flex justify-between mb-4 w-full text-2xl font-semibold",children:[p.jsxs("span",{className:"",children:[r.details.literals.name," "]}),p.jsx(Bt,{price:j,minPrice:u})]}),p.jsx("span",{className:"text-gray-600",children:(B=r.details.literals)==null?void 0:B.description})]}),p.jsxs("div",{className:`items-center justify-center w-full px-4 product-configuration ${(r==null?void 0:r.items)&&"py-2 bg-gray-100"}`,children:[(r==null?void 0:r.items)&&p.jsx(xr,{productItems:r.items,context:r}),p.jsx("div",{className:"sm:h-[64px]"})]}),N&&p.jsx("div",{className:"-mt-5 mb-2 bg-gray-100",children:p.jsx(jn,{finalPrice:M,isBackIcon:!1,handleGoBack:n,displayPriceFrom:R})})]})]}),$=(G=_==null?void 0:_.current)==null?void 0:G.clientHeight,Q=(V=T==null?void 0:T.current)==null?void 0:V.clientHeight,te=$+Q;te>window.innerHeight*.8||isNaN(te)?g!=="80vh"&&v("80vh"):g!=="auto"&&v("auto"),console.log({height:$,height2:Q,modalContentHeight:te,modalSizeStage:x});const W=`${I-64-56}px`,Z=!N,re={"--mobile-submit-row-top":`${I-64-80}px`};return p.jsx(Hi,We(ie({},c),{children:p.jsxs("form",{id:"product-configurator-view",className:"w-full h-full",style:{overflow:"hidden",textAlign:"left"},onSubmit:f(D),children:[p.jsx("div",{className:st("flex relative flex-col items-start w-full form-body stretch",!Z&&"sm:flex-row-reverse sm:pb-0",!E&&"mobile-scrollbar"),style:{height:`${E?W:g}`,minHeight:"400px",overflowY:`${i?"scroll":"visible"}`},children:q}),Z&&p.jsx("div",{className:`w-full h-16 bg-white sm:fixed sm:bottom-0 ${E?"submit-row-mobile":"submit-row"}`,style:re,children:p.jsx(jn,{handleGoBack:n,finalPrice:M,isBackIcon:!1})})]})}))}function Se(){return Se=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Se.apply(this,arguments)}function Ke(e,r){if(e==null)return{};var t={},i=Object.keys(e),n,a;for(a=0;a<i.length;a++)n=i[a],!(r.indexOf(n)>=0)&&(t[n]=e[n]);return t}function gs(e,r){if(!!e){if(typeof e=="string")return Nn(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Nn(e,r)}}function Nn(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,i=new Array(r);t<r;t++)i[t]=e[t];return i}function Oe(e,r){var t;if(typeof Symbol=="undefined"||e[Symbol.iterator]==null){if(Array.isArray(e)||(t=gs(e))||r&&e&&typeof e.length=="number"){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return t=e[Symbol.iterator](),t.next.bind(t)}function Ne(e,r){if(e in r){for(var t=r[e],i=arguments.length,n=new Array(i>2?i-2:0),a=2;a<i;a++)n[a-2]=arguments[a];return typeof t=="function"?t.apply(void 0,n):t}var o=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(r).map(function(s){return'"'+s+'"'}).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(o,Ne),o}var _e;(function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"})(_e||(_e={}));var ge;(function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"})(ge||(ge={}));function He(e){var r=e.props,t=e.slot,i=e.defaultTag,n=e.features,a=e.visible,o=a===void 0?!0:a,s=e.name;if(o)return wt(r,t,i,s);var u=n!=null?n:_e.None;if(u&_e.Static){var c=r.static,f=c===void 0?!1:c,l=Ke(r,["static"]);if(f)return wt(l,t,i,s)}if(u&_e.RenderStrategy){var d,g=r.unmount,v=g===void 0?!0:g,x=Ke(r,["unmount"]),S=v?ge.Unmount:ge.Hidden;return Ne(S,(d={},d[ge.Unmount]=function(){return null},d[ge.Hidden]=function(){return wt(Se({},x,{hidden:!0,style:{display:"none"}}),t,i,s)},d))}return wt(r,t,i,s)}function wt(e,r,t,i){var n;r===void 0&&(r={});var a=ir(e,["unmount","static"]),o=a.as,s=o===void 0?t:o,u=a.children,c=a.refName,f=c===void 0?"ref":c,l=Ke(a,["as","children","refName"]),d=e.ref!==void 0?(n={},n[f]=e.ref,n):{},g=typeof u=="function"?u(r):u;if(l.className&&typeof l.className=="function"&&(l.className=l.className(r)),s===y.Fragment&&Object.keys(l).length>0){if(!y.isValidElement(g)||Array.isArray(g)&&g.length>1)throw new Error(['Passing props on "Fragment"!',"","The current component <"+i+' /> is rendering a "Fragment".',"However we need to passthrough the following props:",Object.keys(l).map(function(v){return" - "+v}).join(`
5
+ `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(function(v){return" - "+v}).join(`
17
6
  `)].join(`
18
- `));return m.cloneElement(g,Object.assign({},js(Fs(ur(l,["ref"])),g.props,["onClick"]),d))}return m.createElement(s,Object.assign({},ur(l,["ref"]),s!==m.Fragment&&d),g)}function js(e,r,t){for(var i=Object.assign({},e),n=function(){var u=o.value;if(e[u]!==void 0&&r[u]!==void 0){var c;Object.assign(i,(c={},c[u]=function(f){f.defaultPrevented||e[u](f),f.defaultPrevented||r[u](f)},c))}},a=we(t),o;!(o=a()).done;)n();return i}function Ni(e){var r;return Object.assign(m.forwardRef(e),{displayName:(r=e.displayName)!=null?r:e.name})}function Fs(e){var r=Object.assign({},e);for(var t in r)r[t]===void 0&&delete r[t];return r}function ur(e,r){r===void 0&&(r=[]);for(var t=Object.assign({},e),i=we(r),n;!(n=i()).done;){var a=n.value;a in t&&delete t[a]}return t}var $e=typeof window!="undefined"?m.useLayoutEffect:m.useEffect,lr={serverHandoffComplete:!1};function Kt(){var e=m.useState(lr.serverHandoffComplete),r=e[0],t=e[1];return m.useEffect(function(){r!==!0&&t(!0)},[r]),m.useEffect(function(){lr.serverHandoffComplete===!1&&(lr.serverHandoffComplete=!0)},[]),r}var ki=m.createContext(!1);function As(){return m.useContext(ki)}function Tn(e){return O(ki.Provider,{value:e.force,children:e.children})}function Rs(){var e=As(),r=m.useContext(Ei),t=m.useState(function(){if(!e&&r!==null||typeof window=="undefined")return null;var a=document.getElementById("headlessui-portal-root");if(a)return a;var o=document.createElement("div");return o.setAttribute("id","headlessui-portal-root"),document.body.appendChild(o)}),i=t[0],n=t[1];return m.useEffect(function(){i!==null&&(document.body.contains(i)||document.body.appendChild(i))},[i]),m.useEffect(function(){e||r!==null&&n(r.current)},[r,n,e]),i}var Ts=m.Fragment;function mr(e){var r=e,t=Rs(),i=m.useState(function(){return typeof window=="undefined"?null:document.createElement("div")}),n=i[0],a=Kt();return $e(function(){if(!!t&&!!n)return t.appendChild(n),function(){if(!!t&&!!n&&(t.removeChild(n),t.childNodes.length<=0)){var o;(o=t.parentElement)==null||o.removeChild(t)}}},[t,n]),a?!t||!n?null:zi.createPortal(Be({props:r,defaultTag:Ts,name:"Portal"}),n):null}var Ms=m.Fragment,Ei=m.createContext(null);function Ds(e){var r=e.target,t=Qe(e,["target"]);return O(Ei.Provider,{value:r,children:Be({props:t,defaultTag:Ms,name:"Popover.Group"})})}mr.Group=Ds;function Li(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var i=m.useRef(r);return m.useEffect(function(){i.current=r},[r]),m.useCallback(function(n){for(var a=we(i.current),o;!(o=a()).done;){var s=o.value;s!=null&&(typeof s=="function"?s(n):s.current=n)}},[i])}var Mt;(function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"})(Mt||(Mt={}));function Is(e){for(var r,t,i=e.parentElement,n=null;i&&!(i instanceof HTMLFieldSetElement);)i instanceof HTMLLegendElement&&(n=i),i=i.parentElement;var a=(r=((t=i)==null?void 0:t.getAttribute("disabled"))==="")!=null?r:!1;return a&&_s(n)?!1:a}function _s(e){if(!e)return!1;for(var r=e.previousElementSibling;r!==null;){if(r instanceof HTMLLegendElement)return!1;r=r.previousElementSibling}return!0}var Vs=0;function Mn(){return++Vs}function Ot(){var e=Kt(),r=m.useState(e?Mn:null),t=r[0],i=r[1];return $e(function(){t===null&&i(Mn())},[t]),t!=null?""+t:void 0}function Dt(e,r,t){var i=m.useRef(r);i.current=r,m.useEffect(function(){function n(a){i.current.call(window,a)}return window.addEventListener(e,n,t),function(){return window.removeEventListener(e,n,t)}},[e,t])}var $s=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(function(e){return e+":not([tabindex='-1'])"}).join(","),ue;(function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"})(ue||(ue={}));var De;(function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"})(De||(De={}));var It;(function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"})(It||(It={}));function Us(e){return e===void 0&&(e=document.body),e==null?[]:Array.from(e.querySelectorAll($s))}var Dn;(function(e){e[e.Strict=0]="Strict",e[e.Loose=1]="Loose"})(Dn||(Dn={}));function ct(e){e==null||e.focus({preventScroll:!0})}function In(e,r){var t=Array.isArray(e)?e.slice().sort(function(d,g){var p=d.compareDocumentPosition(g);return p&Node.DOCUMENT_POSITION_FOLLOWING?-1:p&Node.DOCUMENT_POSITION_PRECEDING?1:0}):Us(e),i=document.activeElement,n=function(){if(r&(ue.First|ue.Next))return It.Next;if(r&(ue.Previous|ue.Last))return It.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),a=function(){if(r&ue.First)return 0;if(r&ue.Previous)return Math.max(0,t.indexOf(i))-1;if(r&ue.Next)return Math.max(0,t.indexOf(i))+1;if(r&ue.Last)return t.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),o=r&ue.NoScroll?{preventScroll:!0}:{},s=0,u=t.length,c=void 0;do{var f;if(s>=u||s+u<=0)return De.Error;var l=a+s;if(r&ue.WrapAround)l=(l+u)%u;else{if(l<0)return De.Underflow;if(l>=u)return De.Overflow}c=t[l],(f=c)==null||f.focus(o),s+=n}while(c!==document.activeElement);return c.hasAttribute("tabindex")||c.setAttribute("tabindex","0"),De.Success}function ji(){var e=m.useRef(!1);return m.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e}var Pe;(function(e){e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All"})(Pe||(Pe={}));function Hs(e,r,t){r===void 0&&(r=Pe.All);var i=t===void 0?{}:t,n=i.initialFocus,a=i.containers,o=m.useRef(typeof window!="undefined"?document.activeElement:null),s=m.useRef(null),u=ji(),c=Boolean(r&Pe.RestoreFocus),f=Boolean(r&Pe.InitialFocus);m.useEffect(function(){!c||(o.current=document.activeElement)},[c]),m.useEffect(function(){if(!!c)return function(){ct(o.current),o.current=null}},[c]),m.useEffect(function(){if(!!f&&!!e.current){var l=document.activeElement;if(n==null?void 0:n.current){if((n==null?void 0:n.current)===l){s.current=l;return}}else if(e.current.contains(l)){s.current=l;return}(n==null?void 0:n.current)?ct(n.current):In(e.current,ue.First)===De.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),s.current=document.activeElement}},[e,n,f]),Dt("keydown",function(l){!(r&Pe.TabLock)||!e.current||l.key===Mt.Tab&&(l.preventDefault(),In(e.current,(l.shiftKey?ue.Previous:ue.Next)|ue.WrapAround)===De.Success&&(s.current=document.activeElement))}),Dt("focus",function(l){if(!!(r&Pe.FocusLock)){var d=new Set(a==null?void 0:a.current);if(d.add(e),!!d.size){var g=s.current;if(!!g&&!!u.current){var p=l.target;p&&p instanceof HTMLElement?Bs(d,p)?(s.current=p,ct(p)):(l.preventDefault(),l.stopPropagation(),ct(g)):ct(s.current)}}}},!0)}function Bs(e,r){for(var t=we(e),i;!(i=t()).done;){var n,a=i.value;if((n=a.current)==null?void 0:n.contains(r))return!0}return!1}var Ze=new Set,Me=new Map;function _n(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function Vn(e){var r=Me.get(e);!r||(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert)}function Ws(e,r){r===void 0&&(r=!0),$e(function(){if(!!r&&!!e.current){var t=e.current;Ze.add(t);for(var i=we(Me.keys()),n;!(n=i()).done;){var a=n.value;a.contains(t)&&(Vn(a),Me.delete(a))}return document.querySelectorAll("body > *").forEach(function(o){if(o instanceof HTMLElement){for(var s=we(Ze),u;!(u=s()).done;){var c=u.value;if(o.contains(c))return}Ze.size===1&&(Me.set(o,{"aria-hidden":o.getAttribute("aria-hidden"),inert:o.inert}),_n(o))}}),function(){if(Ze.delete(t),Ze.size>0)document.querySelectorAll("body > *").forEach(function(c){if(c instanceof HTMLElement&&!Me.has(c)){for(var f=we(Ze),l;!(l=f()).done;){var d=l.value;if(c.contains(d))return}Me.set(c,{"aria-hidden":c.getAttribute("aria-hidden"),inert:c.inert}),_n(c)}});else for(var o=we(Me.keys()),s;!(s=o()).done;){var u=s.value;Vn(u),Me.delete(u)}}}},[r])}var Fi=m.createContext(null);function Ai(){var e=m.useContext(Fi);if(e===null){var r=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Ai),r}return e}function zs(){var e=m.useState([]),r=e[0],t=e[1];return[r.length>0?r.join(" "):void 0,m.useMemo(function(){return function(n){var a=m.useCallback(function(s){return t(function(u){return[].concat(u,[s])}),function(){return t(function(u){var c=u.slice(),f=c.indexOf(s);return f!==-1&&c.splice(f,1),c})}},[]),o=m.useMemo(function(){return{register:a,slot:n.slot,name:n.name,props:n.props}},[a,n.slot,n.name,n.props]);return O(Fi.Provider,{value:o,children:n.children})}},[t])]}var qs="p";function Gs(e){var r=Ai(),t="headlessui-description-"+Ot();$e(function(){return r.register(t)},[t,r.register]);var i=e,n=xe({},r.props,{id:t});return Be({props:xe({},i,n),slot:r.slot||{},defaultTag:qs,name:r.name||"Description"})}var Pr=m.createContext(null);Pr.displayName="OpenClosedContext";var Ae;(function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"})(Ae||(Ae={}));function Nr(){return m.useContext(Pr)}function Ks(e){var r=e.value,t=e.children;return O(Pr.Provider,{value:r,children:t})}var kr=m.createContext(function(){});kr.displayName="StackContext";var rt;(function(e){e[e.Add=0]="Add",e[e.Remove=1]="Remove"})(rt||(rt={}));function Qs(){return m.useContext(kr)}function Js(e){var r=e.children,t=e.onUpdate,i=e.type,n=e.element,a=Qs(),o=m.useCallback(function(){for(var s=arguments.length,u=new Array(s),c=0;c<s;c++)u[c]=arguments[c];t==null||t.apply(void 0,u),a.apply(void 0,u)},[a,t]);return $e(function(){return o(rt.Add,i,n),function(){return o(rt.Remove,i,n)}},[o,i,n]),O(kr.Provider,{value:o,children:r})}var cr,ce;(function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"})(ce||(ce={}));var _t;(function(e){e[e.SetTitleId=0]="SetTitleId"})(_t||(_t={}));var Ys=(cr={},cr[_t.SetTitleId]=function(e,r){return e.titleId===r.id?e:xe({},e,{titleId:r.id})},cr),Vt=m.createContext(null);Vt.displayName="DialogContext";function Er(e){var r=m.useContext(Vt);if(r===null){var t=new Error("<"+e+" /> is missing a parent <"+pt.displayName+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Er),t}return r}function Zs(e,r){return Ee(r.type,Ys,e,r)}var Xs="div",eu=Ve.RenderStrategy|Ve.Static,tu=Ni(function(r,t){var i=r.open,n=r.onClose,a=r.initialFocus,o=Qe(r,["open","onClose","initialFocus"]),s=m.useState(0),u=s[0],c=s[1],f=Nr();if(i===void 0&&f!==null){var l;i=Ee(f,(l={},l[Ae.Open]=!0,l[Ae.Closed]=!1,l))}var d=m.useRef(new Set),g=m.useRef(null),p=Li(g,t),b=r.hasOwnProperty("open")||f!==null,w=r.hasOwnProperty("onClose");if(!b&&!w)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!b)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!w)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(typeof i!="boolean")throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+i);if(typeof n!="function")throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+n);var v=i?ce.Open:ce.Closed,x=function(){return f!==null?f===Ae.Open:v===ce.Open}(),P=m.useReducer(Zs,{titleId:null,descriptionId:null}),N=P[0],R=P[1],M=m.useCallback(function(){return n(!1)},[n]),D=m.useCallback(function(W){return R({type:_t.SetTitleId,id:W})},[R]),_=Kt(),T=_&&v===ce.Open,k=u>1,L=m.useContext(Vt)!==null,I=k?"parent":"leaf";Hs(g,T?Ee(I,{parent:Pe.RestoreFocus,leaf:Pe.All}):Pe.None,{initialFocus:a,containers:d}),Ws(g,k?T:!1),Dt("mousedown",function(W){var K,V=W.target;v===ce.Open&&(k||((K=g.current)==null?void 0:K.contains(V))||M())}),Dt("keydown",function(W){W.key===Mt.Escape&&v===ce.Open&&(k||(W.preventDefault(),W.stopPropagation(),M()))}),m.useEffect(function(){if(v===ce.Open&&!L){var W=document.documentElement.style.overflow,K=document.documentElement.style.paddingRight,V=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=V+"px",function(){document.documentElement.style.overflow=W,document.documentElement.style.paddingRight=K}}},[v,L]),m.useEffect(function(){if(v===ce.Open&&!!g.current){var W=new IntersectionObserver(function(K){for(var V=we(K),H;!(H=V()).done;){var B=H.value;B.boundingClientRect.x===0&&B.boundingClientRect.y===0&&B.boundingClientRect.width===0&&B.boundingClientRect.height===0&&M()}});return W.observe(g.current),function(){return W.disconnect()}}},[v,g,M]);var G=zs(),U=G[0],Y=G[1],re="headlessui-dialog-"+Ot(),z=m.useMemo(function(){return[{dialogState:v,close:M,setTitleId:D},N]},[v,N,M,D]),X=m.useMemo(function(){return{open:v===ce.Open}},[v]),ne={ref:p,id:re,role:"dialog","aria-modal":v===ce.Open?!0:void 0,"aria-labelledby":N.titleId,"aria-describedby":U,onClick:function(K){K.stopPropagation()}},ee=o;return O(Js,{type:"Dialog",element:g,onUpdate:m.useCallback(function(W,K,V){var H;K==="Dialog"&&Ee(W,(H={},H[rt.Add]=function(){d.current.add(V),c(function(B){return B+1})},H[rt.Remove]=function(){d.current.add(V),c(function(B){return B-1})},H))},[]),children:O(Tn,{force:!0,children:O(mr,{children:O(Vt.Provider,{value:z,children:O(mr.Group,{target:g,children:O(Tn,{force:!1,children:O(Y,{slot:X,name:"Dialog.Description",children:Be({props:xe({},ee,ne),slot:X,defaultTag:Xs,features:eu,visible:x,name:"Dialog"})})})})})})})})}),ru="div",nu=Ni(function e(r,t){var i=Er([pt.displayName,e.name].join(".")),n=i[0],a=n.dialogState,o=n.close,s=Li(t),u="headlessui-dialog-overlay-"+Ot(),c=m.useCallback(function(g){if(g.target===g.currentTarget){if(Is(g.currentTarget))return g.preventDefault();g.preventDefault(),g.stopPropagation(),o()}},[o]),f=m.useMemo(function(){return{open:a===ce.Open}},[a]),l={ref:s,id:u,"aria-hidden":!0,onClick:c},d=r;return Be({props:xe({},d,l),slot:f,defaultTag:ru,name:"Dialog.Overlay"})}),iu="h2";function Ri(e){var r=Er([pt.displayName,Ri.name].join(".")),t=r[0],i=t.dialogState,n=t.setTitleId,a="headlessui-dialog-title-"+Ot();m.useEffect(function(){return n(a),function(){return n(null)}},[a,n]);var o=m.useMemo(function(){return{open:i===ce.Open}},[i]),s={id:a},u=e;return Be({props:xe({},u,s),slot:o,defaultTag:iu,name:"Dialog.Title"})}var pt=Object.assign(tu,{Overlay:nu,Title:Ri,Description:Gs});function Ti(){var e=[],r={requestAnimationFrame:function(t){function i(){return t.apply(this,arguments)}return i.toString=function(){return t.toString()},i}(function(){var t=requestAnimationFrame.apply(void 0,arguments);r.add(function(){return cancelAnimationFrame(t)})}),nextFrame:function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];r.requestAnimationFrame(function(){r.requestAnimationFrame.apply(r,n)})},setTimeout:function(t){function i(){return t.apply(this,arguments)}return i.toString=function(){return t.toString()},i}(function(){var t=setTimeout.apply(void 0,arguments);r.add(function(){return clearTimeout(t)})}),add:function(i){e.push(i)},dispose:function(){for(var i=we(e.splice(0)),n;!(n=i()).done;){var a=n.value;a()}}};return r}function au(){var e=m.useRef(!0);return m.useEffect(function(){e.current=!1},[]),e.current}function ou(e){var r={called:!1};return function(){if(!r.called)return r.called=!0,e.apply(void 0,arguments)}}function fr(e){for(var r,t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];e&&i.length>0&&(r=e.classList).add.apply(r,i)}function kt(e){for(var r,t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];e&&i.length>0&&(r=e.classList).remove.apply(r,i)}var Ue;(function(e){e.Finished="finished",e.Cancelled="cancelled"})(Ue||(Ue={}));function su(e,r){var t=Ti();if(!e)return t.dispose;var i=getComputedStyle(e),n=i.transitionDuration,a=i.transitionDelay,o=[n,a].map(function(c){var f=c.split(",").filter(Boolean).map(function(g){return g.includes("ms")?parseFloat(g):parseFloat(g)*1e3}).sort(function(g,p){return p-g}),l=f[0],d=l===void 0?0:l;return d}),s=o[0],u=o[1];return s!==0?t.setTimeout(function(){r(Ue.Finished)},s+u):r(Ue.Finished),t.add(function(){return r(Ue.Cancelled)}),t.dispose}function $n(e,r,t,i,n,a){var o=Ti(),s=a!==void 0?ou(a):function(){};return kt.apply(void 0,[e].concat(n)),fr.apply(void 0,[e].concat(r,t)),o.nextFrame(function(){kt.apply(void 0,[e].concat(t)),fr.apply(void 0,[e].concat(i)),o.add(su(e,function(u){return kt.apply(void 0,[e].concat(i,r)),fr.apply(void 0,[e].concat(n)),s(u)}))}),o.add(function(){return kt.apply(void 0,[e].concat(r,t,i,n))}),o.add(function(){return s(Ue.Cancelled)}),o.dispose}function qe(e){return e===void 0&&(e=""),m.useMemo(function(){return e.split(" ").filter(function(r){return r.trim().length>1})},[e])}var Qt=m.createContext(null);Qt.displayName="TransitionContext";var J;(function(e){e.Visible="visible",e.Hidden="hidden"})(J||(J={}));function uu(){var e=m.useContext(Qt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function lu(){var e=m.useContext(Jt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}var Jt=m.createContext(null);Jt.displayName="NestingContext";function Yt(e){return"children"in e?Yt(e.children):e.current.filter(function(r){var t=r.state;return t===J.Visible}).length>0}function Mi(e){var r=m.useRef(e),t=m.useRef([]),i=ji();m.useEffect(function(){r.current=e},[e]);var n=m.useCallback(function(o,s){var u;s===void 0&&(s=pe.Hidden);var c=t.current.findIndex(function(f){var l=f.id;return l===o});c!==-1&&(Ee(s,(u={},u[pe.Unmount]=function(){t.current.splice(c,1)},u[pe.Hidden]=function(){t.current[c].state=J.Hidden},u)),!Yt(t)&&i.current&&(r.current==null||r.current()))},[r,i,t]),a=m.useCallback(function(o){var s=t.current.find(function(u){var c=u.id;return c===o});return s?s.state!==J.Visible&&(s.state=J.Visible):t.current.push({id:o,state:J.Visible}),function(){return n(o,pe.Unmount)}},[t,n]);return m.useMemo(function(){return{children:t,register:a,unregister:n}},[a,n,t])}function cu(){}var fu=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Un(e){for(var r={},t=we(fu),i;!(i=t()).done;){var n,a=i.value;r[a]=(n=e[a])!=null?n:cu}return r}function du(e){var r=m.useRef(Un(e));return m.useEffect(function(){r.current=Un(e)},[e]),r}var gu="div",Di=Ve.RenderStrategy;function Ii(e){var r,t=e.beforeEnter,i=e.afterEnter,n=e.beforeLeave,a=e.afterLeave,o=e.enter,s=e.enterFrom,u=e.enterTo,c=e.entered,f=e.leave,l=e.leaveFrom,d=e.leaveTo,g=Qe(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","entered","leave","leaveFrom","leaveTo"]),p=m.useRef(null),b=m.useState(J.Visible),w=b[0],v=b[1],x=g.unmount?pe.Unmount:pe.Hidden,P=uu(),N=P.show,R=P.appear,M=P.initial,D=lu(),_=D.register,T=D.unregister,k=Ot(),L=m.useRef(!1),I=Mi(function(){L.current||(v(J.Hidden),T(k),ee.current.afterLeave())});$e(function(){if(!!k)return _(k)},[_,k]),$e(function(){var B;if(x===pe.Hidden&&!!k){if(N&&w!==J.Visible){v(J.Visible);return}Ee(w,(B={},B[J.Hidden]=function(){return T(k)},B[J.Visible]=function(){return _(k)},B))}},[w,k,_,T,N,x]);var G=qe(o),U=qe(s),Y=qe(u),re=qe(c),z=qe(f),X=qe(l),ne=qe(d),ee=du({beforeEnter:t,afterEnter:i,beforeLeave:n,afterLeave:a}),W=Kt();m.useEffect(function(){if(W&&w===J.Visible&&p.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[p,w,W]);var K=M&&!R;$e(function(){var B=p.current;if(!!B&&!K)return L.current=!0,N&&ee.current.beforeEnter(),N||ee.current.beforeLeave(),N?$n(B,G,U,Y,re,function(ye){L.current=!1,ye===Ue.Finished&&ee.current.afterEnter()}):$n(B,z,X,ne,re,function(ye){L.current=!1,ye===Ue.Finished&&(Yt(I)||(v(J.Hidden),T(k),ee.current.afterLeave()))})},[ee,k,L,T,I,p,K,N,G,U,Y,z,X,ne]);var V={ref:p},H=g;return O(Jt.Provider,{value:I,children:O(Ks,{value:Ee(w,(r={},r[J.Visible]=Ae.Open,r[J.Hidden]=Ae.Closed,r)),children:Be({props:xe({},H,V),defaultTag:gu,features:Di,visible:w===J.Visible,name:"Transition.Child"})})})}function Ke(e){var r=e.show,t=e.appear,i=t===void 0?!1:t,n=e.unmount,a=Qe(e,["show","appear","unmount"]),o=Nr();if(r===void 0&&o!==null){var s;r=Ee(o,(s={},s[Ae.Open]=!0,s[Ae.Closed]=!1,s))}if(![!0,!1].includes(r))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var u=m.useState(r?J.Visible:J.Hidden),c=u[0],f=u[1],l=Mi(function(){f(J.Hidden)}),d=au(),g=m.useMemo(function(){return{show:r,appear:i||!d,initial:d}},[r,i,d]);m.useEffect(function(){r?f(J.Visible):Yt(l)||f(J.Hidden)},[r,l]);var p={unmount:n};return O(Jt.Provider,{value:l,children:O(Qt.Provider,{value:g,children:Be({props:xe({},p,{as:m.Fragment,children:O(Ii,ae({},Object.assign({},p,a)))}),defaultTag:m.Fragment,features:Di,visible:c===J.Visible,name:"Transition"})})})}Ke.Child=function(r){var t=m.useContext(Qt)!==null,i=Nr()!==null;return!t&&i?O(Ke,ae({},Object.assign({},r))):O(Ii,ae({},Object.assign({},r)))};Ke.Root=Ke;function hu(e){const{children:r,isModalOpen:t,handleCloseModal:i}=e,{isMobile:n}=Ci({isModal:!0});return O(nt,{children:O(Ke,{appear:!0,show:t,as:m.Fragment,children:O(pt,{as:"div",className:"overflow-y-auto fixed inset-0 z-10",style:{backgroundColor:"rgba(0,0,0,.75)"},onClose:i,children:$("div",{className:"min-h-screen text-center sm:px-4",children:[O(Ke.Child,{as:m.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:O(pt.Overlay,{className:"fixed inset-0"})}),O("span",{className:"inline-block h-screen align-middle","aria-hidden":"true",children:"\u200B"}),O(Ke.Child,{as:m.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:$("div",{id:"modal-content",className:"inline-block overflow-hidden sm:rounded-2xl align-middle transition-all transform bg-white sm:shadow-xl h-[100vh] sm:h-auto sm:max-h-[90vh] w-full sm:w-[640px]",children:[O("div",{className:"flex sticky top-0 z-10 items-center px-3 w-full h-14 text-lg font-medium leading-6 text-gray-900 bg-white modal-header",children:O("div",{className:"",children:$("svg",{className:"w-8 h-8 text-black cursor-pointer",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",onClick:i,children:[O("path",{stroke:"none",d:"M0 0h24v24H0z"})," ",O("line",{x1:"5",y1:"12",x2:"19",y2:"12"})," ",O("line",{x1:"5",y1:"12",x2:"11",y2:"18"})," ",O("line",{x1:"5",y1:"12",x2:"11",y2:"6"})]})})}),O("div",{className:"w-full",style:{height:`${n?"calc(100% - 56px)":"auto"}`},children:r})]})})]})})})})}function pu(e){const{product:r,primaryColor:t,lang:i="en",handleAddToBasket:n,handleGoBack:a,isModal:o=!1,isModalOpen:s=!0,showDebugState:u=!1,handleCloseModal:c=()=>alert("ERROR: handleCloseModal not implemented")}=e,f=Z(x=>x.setInitialFilter),l=Z(x=>x.setInitialSelectedState),d=Z(x=>x.setInitialValidate),g=Z(x=>x.resetExpanded),p=xi(r,xs),{state:{filter:b={},selected:w={}}={}}=p;m.useEffect(()=>{console.log("cleared"),d(),f(b),l(w),g(),se.changeLanguage(i)},[r]),m.useEffect(()=>{console.log("lang: ",i),se.changeLanguage(i)},[i]),m.useEffect(()=>{t&&document.documentElement.style.setProperty("--color-primary",t)},[t]);const v=O(Es,{product:p,handleAddToBasket:n,handleGoBack:a,isModal:o,showDebugState:u});return O(nt,{children:o===!0?O(hu,{isModalOpen:s,handleCloseModal:c,children:v}):v})}exports.ProductConfigurator=pu;
7
+ `));return y.cloneElement(g,Object.assign({},hs(ps(ir(l,["ref"])),g.props,["onClick"]),d))}return y.createElement(s,Object.assign({},ir(l,["ref"]),s!==y.Fragment&&d),g)}function hs(e,r,t){for(var i=Object.assign({},e),n=function(){var u=o.value;if(e[u]!==void 0&&r[u]!==void 0){var c;Object.assign(i,(c={},c[u]=function(f){f.defaultPrevented||e[u](f),f.defaultPrevented||r[u](f)},c))}},a=Oe(t),o;!(o=a()).done;)n();return i}function yi(e){var r;return Object.assign(y.forwardRef(e),{displayName:(r=e.displayName)!=null?r:e.name})}function ps(e){var r=Object.assign({},e);for(var t in r)r[t]===void 0&&delete r[t];return r}function ir(e,r){r===void 0&&(r=[]);for(var t=Object.assign({},e),i=Oe(r),n;!(n=i()).done;){var a=n.value;a in t&&delete t[a]}return t}var Ve=typeof window!="undefined"?y.useLayoutEffect:y.useEffect,ar={serverHandoffComplete:!1};function Wt(){var e=y.useState(ar.serverHandoffComplete),r=e[0],t=e[1];return y.useEffect(function(){r!==!0&&t(!0)},[r]),y.useEffect(function(){ar.serverHandoffComplete===!1&&(ar.serverHandoffComplete=!0)},[]),r}var bi=y.createContext(!1);function vs(){return y.useContext(bi)}function kn(e){return p.jsx(bi.Provider,{value:e.force,children:e.children})}function ms(){var e=vs(),r=y.useContext(xi),t=y.useState(function(){if(!e&&r!==null||typeof window=="undefined")return null;var a=document.getElementById("headlessui-portal-root");if(a)return a;var o=document.createElement("div");return o.setAttribute("id","headlessui-portal-root"),document.body.appendChild(o)}),i=t[0],n=t[1];return y.useEffect(function(){i!==null&&(document.body.contains(i)||document.body.appendChild(i))},[i]),y.useEffect(function(){e||r!==null&&n(r.current)},[r,n,e]),i}var ys=y.Fragment;function gr(e){var r=e,t=ms(),i=y.useState(function(){return typeof window=="undefined"?null:document.createElement("div")}),n=i[0],a=Wt();return Ve(function(){if(!!t&&!!n)return t.appendChild(n),function(){if(!!t&&!!n&&(t.removeChild(n),t.childNodes.length<=0)){var o;(o=t.parentElement)==null||o.removeChild(t)}}},[t,n]),a?!t||!n?null:Ii.createPortal(He({props:r,defaultTag:ys,name:"Portal"}),n):null}var bs=y.Fragment,xi=y.createContext(null);function xs(e){var r=e.target,t=Ke(e,["target"]);return p.jsx(xi.Provider,{value:r,children:He({props:t,defaultTag:bs,name:"Popover.Group"})})}gr.Group=xs;function Oi(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var i=y.useRef(r);return y.useEffect(function(){i.current=r},[r]),y.useCallback(function(n){for(var a=Oe(i.current),o;!(o=a()).done;){var s=o.value;s!=null&&(typeof s=="function"?s(n):s.current=n)}},[i])}var At;(function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"})(At||(At={}));function Os(e){for(var r,t,i=e.parentElement,n=null;i&&!(i instanceof HTMLFieldSetElement);)i instanceof HTMLLegendElement&&(n=i),i=i.parentElement;var a=(r=((t=i)==null?void 0:t.getAttribute("disabled"))==="")!=null?r:!1;return a&&Ss(n)?!1:a}function Ss(e){if(!e)return!1;for(var r=e.previousElementSibling;r!==null;){if(r instanceof HTMLLegendElement)return!1;r=r.previousElementSibling}return!0}var ws=0;function En(){return++ws}function mt(){var e=Wt(),r=y.useState(e?En:null),t=r[0],i=r[1];return Ve(function(){t===null&&i(En())},[t]),t!=null?""+t:void 0}function Rt(e,r,t){var i=y.useRef(r);i.current=r,y.useEffect(function(){function n(a){i.current.call(window,a)}return window.addEventListener(e,n,t),function(){return window.removeEventListener(e,n,t)}},[e,t])}var Cs=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(function(e){return e+":not([tabindex='-1'])"}).join(","),se;(function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"})(se||(se={}));var Me;(function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"})(Me||(Me={}));var Tt;(function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"})(Tt||(Tt={}));function Ps(e){return e===void 0&&(e=document.body),e==null?[]:Array.from(e.querySelectorAll(Cs))}var Ln;(function(e){e[e.Strict=0]="Strict",e[e.Loose=1]="Loose"})(Ln||(Ln={}));function ut(e){e==null||e.focus({preventScroll:!0})}function Fn(e,r){var t=Array.isArray(e)?e.slice().sort(function(d,g){var v=d.compareDocumentPosition(g);return v&Node.DOCUMENT_POSITION_FOLLOWING?-1:v&Node.DOCUMENT_POSITION_PRECEDING?1:0}):Ps(e),i=document.activeElement,n=function(){if(r&(se.First|se.Next))return Tt.Next;if(r&(se.Previous|se.Last))return Tt.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),a=function(){if(r&se.First)return 0;if(r&se.Previous)return Math.max(0,t.indexOf(i))-1;if(r&se.Next)return Math.max(0,t.indexOf(i))+1;if(r&se.Last)return t.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),o=r&se.NoScroll?{preventScroll:!0}:{},s=0,u=t.length,c=void 0;do{var f;if(s>=u||s+u<=0)return Me.Error;var l=a+s;if(r&se.WrapAround)l=(l+u)%u;else{if(l<0)return Me.Underflow;if(l>=u)return Me.Overflow}c=t[l],(f=c)==null||f.focus(o),s+=n}while(c!==document.activeElement);return c.hasAttribute("tabindex")||c.setAttribute("tabindex","0"),Me.Success}function Si(){var e=y.useRef(!1);return y.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e}var Ce;(function(e){e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All"})(Ce||(Ce={}));function js(e,r,t){r===void 0&&(r=Ce.All);var i=t===void 0?{}:t,n=i.initialFocus,a=i.containers,o=y.useRef(typeof window!="undefined"?document.activeElement:null),s=y.useRef(null),u=Si(),c=Boolean(r&Ce.RestoreFocus),f=Boolean(r&Ce.InitialFocus);y.useEffect(function(){!c||(o.current=document.activeElement)},[c]),y.useEffect(function(){if(!!c)return function(){ut(o.current),o.current=null}},[c]),y.useEffect(function(){if(!!f&&!!e.current){var l=document.activeElement;if(n==null?void 0:n.current){if((n==null?void 0:n.current)===l){s.current=l;return}}else if(e.current.contains(l)){s.current=l;return}(n==null?void 0:n.current)?ut(n.current):Fn(e.current,se.First)===Me.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),s.current=document.activeElement}},[e,n,f]),Rt("keydown",function(l){!(r&Ce.TabLock)||!e.current||l.key===At.Tab&&(l.preventDefault(),Fn(e.current,(l.shiftKey?se.Previous:se.Next)|se.WrapAround)===Me.Success&&(s.current=document.activeElement))}),Rt("focus",function(l){if(!!(r&Ce.FocusLock)){var d=new Set(a==null?void 0:a.current);if(d.add(e),!!d.size){var g=s.current;if(!!g&&!!u.current){var v=l.target;v&&v instanceof HTMLElement?Ns(d,v)?(s.current=v,ut(v)):(l.preventDefault(),l.stopPropagation(),ut(g)):ut(s.current)}}}},!0)}function Ns(e,r){for(var t=Oe(e),i;!(i=t()).done;){var n,a=i.value;if((n=a.current)==null?void 0:n.contains(r))return!0}return!1}var Ye=new Set,Te=new Map;function An(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function Rn(e){var r=Te.get(e);!r||(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert)}function ks(e,r){r===void 0&&(r=!0),Ve(function(){if(!!r&&!!e.current){var t=e.current;Ye.add(t);for(var i=Oe(Te.keys()),n;!(n=i()).done;){var a=n.value;a.contains(t)&&(Rn(a),Te.delete(a))}return document.querySelectorAll("body > *").forEach(function(o){if(o instanceof HTMLElement){for(var s=Oe(Ye),u;!(u=s()).done;){var c=u.value;if(o.contains(c))return}Ye.size===1&&(Te.set(o,{"aria-hidden":o.getAttribute("aria-hidden"),inert:o.inert}),An(o))}}),function(){if(Ye.delete(t),Ye.size>0)document.querySelectorAll("body > *").forEach(function(c){if(c instanceof HTMLElement&&!Te.has(c)){for(var f=Oe(Ye),l;!(l=f()).done;){var d=l.value;if(c.contains(d))return}Te.set(c,{"aria-hidden":c.getAttribute("aria-hidden"),inert:c.inert}),An(c)}});else for(var o=Oe(Te.keys()),s;!(s=o()).done;){var u=s.value;Rn(u),Te.delete(u)}}}},[r])}var wi=y.createContext(null);function Ci(){var e=y.useContext(wi);if(e===null){var r=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Ci),r}return e}function Es(){var e=y.useState([]),r=e[0],t=e[1];return[r.length>0?r.join(" "):void 0,y.useMemo(function(){return function(n){var a=y.useCallback(function(s){return t(function(u){return[].concat(u,[s])}),function(){return t(function(u){var c=u.slice(),f=c.indexOf(s);return f!==-1&&c.splice(f,1),c})}},[]),o=y.useMemo(function(){return{register:a,slot:n.slot,name:n.name,props:n.props}},[a,n.slot,n.name,n.props]);return p.jsx(wi.Provider,{value:o,children:n.children})}},[t])]}var Ls="p";function Fs(e){var r=Ci(),t="headlessui-description-"+mt();Ve(function(){return r.register(t)},[t,r.register]);var i=e,n=Se({},r.props,{id:t});return He({props:Se({},i,n),slot:r.slot||{},defaultTag:Ls,name:r.name||"Description"})}var Or=y.createContext(null);Or.displayName="OpenClosedContext";var Fe;(function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"})(Fe||(Fe={}));function Sr(){return y.useContext(Or)}function As(e){var r=e.value,t=e.children;return p.jsx(Or.Provider,{value:r,children:t})}var wr=y.createContext(function(){});wr.displayName="StackContext";var tt;(function(e){e[e.Add=0]="Add",e[e.Remove=1]="Remove"})(tt||(tt={}));function Rs(){return y.useContext(wr)}function Ts(e){var r=e.children,t=e.onUpdate,i=e.type,n=e.element,a=Rs(),o=y.useCallback(function(){for(var s=arguments.length,u=new Array(s),c=0;c<s;c++)u[c]=arguments[c];t==null||t.apply(void 0,u),a.apply(void 0,u)},[a,t]);return Ve(function(){return o(tt.Add,i,n),function(){return o(tt.Remove,i,n)}},[o,i,n]),p.jsx(wr.Provider,{value:o,children:r})}var or,le;(function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"})(le||(le={}));var Mt;(function(e){e[e.SetTitleId=0]="SetTitleId"})(Mt||(Mt={}));var Ms=(or={},or[Mt.SetTitleId]=function(e,r){return e.titleId===r.id?e:Se({},e,{titleId:r.id})},or),Dt=y.createContext(null);Dt.displayName="DialogContext";function Cr(e){var r=y.useContext(Dt);if(r===null){var t=new Error("<"+e+" /> is missing a parent <"+gt.displayName+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Cr),t}return r}function Ds(e,r){return Ne(r.type,Ms,e,r)}var Is="div",_s=_e.RenderStrategy|_e.Static,Vs=yi(function(r,t){var i=r.open,n=r.onClose,a=r.initialFocus,o=Ke(r,["open","onClose","initialFocus"]),s=y.useState(0),u=s[0],c=s[1],f=Sr();if(i===void 0&&f!==null){var l;i=Ne(f,(l={},l[Fe.Open]=!0,l[Fe.Closed]=!1,l))}var d=y.useRef(new Set),g=y.useRef(null),v=Oi(g,t),x=r.hasOwnProperty("open")||f!==null,S=r.hasOwnProperty("onClose");if(!x&&!S)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!x)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!S)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(typeof i!="boolean")throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+i);if(typeof n!="function")throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+n);var m=i?le.Open:le.Closed,w=function(){return f!==null?f===Fe.Open:m===le.Open}(),P=y.useReducer(Ds,{titleId:null,descriptionId:null}),j=P[0],R=P[1],M=y.useCallback(function(){return n(!1)},[n]),D=y.useCallback(function(B){return R({type:Mt.SetTitleId,id:B})},[R]),_=Wt(),T=_&&m===le.Open,N=u>1,E=y.useContext(Dt)!==null,I=N?"parent":"leaf";js(g,T?Ne(I,{parent:Ce.RestoreFocus,leaf:Ce.All}):Ce.None,{initialFocus:a,containers:d}),ks(g,N?T:!1),Rt("mousedown",function(B){var G,V=B.target;m===le.Open&&(N||((G=g.current)==null?void 0:G.contains(V))||M())}),Rt("keydown",function(B){B.key===At.Escape&&m===le.Open&&(N||(B.preventDefault(),B.stopPropagation(),M()))}),y.useEffect(function(){if(m===le.Open&&!E){var B=document.documentElement.style.overflow,G=document.documentElement.style.paddingRight,V=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=V+"px",function(){document.documentElement.style.overflow=B,document.documentElement.style.paddingRight=G}}},[m,E]),y.useEffect(function(){if(m===le.Open&&!!g.current){var B=new IntersectionObserver(function(G){for(var V=Oe(G),U;!(U=V()).done;){var H=U.value;H.boundingClientRect.x===0&&H.boundingClientRect.y===0&&H.boundingClientRect.width===0&&H.boundingClientRect.height===0&&M()}});return B.observe(g.current),function(){return B.disconnect()}}},[m,g,M]);var q=Es(),$=q[0],Q=q[1],te="headlessui-dialog-"+mt(),W=y.useMemo(function(){return[{dialogState:m,close:M,setTitleId:D},j]},[m,j,M,D]),Z=y.useMemo(function(){return{open:m===le.Open}},[m]),re={ref:v,id:te,role:"dialog","aria-modal":m===le.Open?!0:void 0,"aria-labelledby":j.titleId,"aria-describedby":$,onClick:function(G){G.stopPropagation()}},X=o;return p.jsx(Ts,{type:"Dialog",element:g,onUpdate:y.useCallback(function(B,G,V){var U;G==="Dialog"&&Ne(B,(U={},U[tt.Add]=function(){d.current.add(V),c(function(H){return H+1})},U[tt.Remove]=function(){d.current.add(V),c(function(H){return H-1})},U))},[]),children:p.jsx(kn,{force:!0,children:p.jsx(gr,{children:p.jsx(Dt.Provider,{value:W,children:p.jsx(gr.Group,{target:g,children:p.jsx(kn,{force:!1,children:p.jsx(Q,{slot:Z,name:"Dialog.Description",children:He({props:Se({},X,re),slot:Z,defaultTag:Is,features:_s,visible:w,name:"Dialog"})})})})})})})})}),$s="div",Us=yi(function e(r,t){var i=Cr([gt.displayName,e.name].join(".")),n=i[0],a=n.dialogState,o=n.close,s=Oi(t),u="headlessui-dialog-overlay-"+mt(),c=y.useCallback(function(g){if(g.target===g.currentTarget){if(Os(g.currentTarget))return g.preventDefault();g.preventDefault(),g.stopPropagation(),o()}},[o]),f=y.useMemo(function(){return{open:a===le.Open}},[a]),l={ref:s,id:u,"aria-hidden":!0,onClick:c},d=r;return He({props:Se({},d,l),slot:f,defaultTag:$s,name:"Dialog.Overlay"})}),Hs="h2";function Pi(e){var r=Cr([gt.displayName,Pi.name].join(".")),t=r[0],i=t.dialogState,n=t.setTitleId,a="headlessui-dialog-title-"+mt();y.useEffect(function(){return n(a),function(){return n(null)}},[a,n]);var o=y.useMemo(function(){return{open:i===le.Open}},[i]),s={id:a},u=e;return He({props:Se({},u,s),slot:o,defaultTag:Hs,name:"Dialog.Title"})}var gt=Object.assign(Vs,{Overlay:Us,Title:Pi,Description:Fs});function ji(){var e=[],r={requestAnimationFrame:function(t){function i(){return t.apply(this,arguments)}return i.toString=function(){return t.toString()},i}(function(){var t=requestAnimationFrame.apply(void 0,arguments);r.add(function(){return cancelAnimationFrame(t)})}),nextFrame:function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];r.requestAnimationFrame(function(){r.requestAnimationFrame.apply(r,n)})},setTimeout:function(t){function i(){return t.apply(this,arguments)}return i.toString=function(){return t.toString()},i}(function(){var t=setTimeout.apply(void 0,arguments);r.add(function(){return clearTimeout(t)})}),add:function(i){e.push(i)},dispose:function(){for(var i=Oe(e.splice(0)),n;!(n=i()).done;){var a=n.value;a()}}};return r}function Bs(){var e=y.useRef(!0);return y.useEffect(function(){e.current=!1},[]),e.current}function Ws(e){var r={called:!1};return function(){if(!r.called)return r.called=!0,e.apply(void 0,arguments)}}function sr(e){for(var r,t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];e&&i.length>0&&(r=e.classList).add.apply(r,i)}function Ct(e){for(var r,t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];e&&i.length>0&&(r=e.classList).remove.apply(r,i)}var $e;(function(e){e.Finished="finished",e.Cancelled="cancelled"})($e||($e={}));function zs(e,r){var t=ji();if(!e)return t.dispose;var i=getComputedStyle(e),n=i.transitionDuration,a=i.transitionDelay,o=[n,a].map(function(c){var f=c.split(",").filter(Boolean).map(function(g){return g.includes("ms")?parseFloat(g):parseFloat(g)*1e3}).sort(function(g,v){return v-g}),l=f[0],d=l===void 0?0:l;return d}),s=o[0],u=o[1];return s!==0?t.setTimeout(function(){r($e.Finished)},s+u):r($e.Finished),t.add(function(){return r($e.Cancelled)}),t.dispose}function Tn(e,r,t,i,n,a){var o=ji(),s=a!==void 0?Ws(a):function(){};return Ct.apply(void 0,[e].concat(n)),sr.apply(void 0,[e].concat(r,t)),o.nextFrame(function(){Ct.apply(void 0,[e].concat(t)),sr.apply(void 0,[e].concat(i)),o.add(zs(e,function(u){return Ct.apply(void 0,[e].concat(i,r)),sr.apply(void 0,[e].concat(n)),s(u)}))}),o.add(function(){return Ct.apply(void 0,[e].concat(r,t,i,n))}),o.add(function(){return s($e.Cancelled)}),o.dispose}function ze(e){return e===void 0&&(e=""),y.useMemo(function(){return e.split(" ").filter(function(r){return r.trim().length>1})},[e])}var zt=y.createContext(null);zt.displayName="TransitionContext";var J;(function(e){e.Visible="visible",e.Hidden="hidden"})(J||(J={}));function qs(){var e=y.useContext(zt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Gs(){var e=y.useContext(qt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}var qt=y.createContext(null);qt.displayName="NestingContext";function Gt(e){return"children"in e?Gt(e.children):e.current.filter(function(r){var t=r.state;return t===J.Visible}).length>0}function Ni(e){var r=y.useRef(e),t=y.useRef([]),i=Si();y.useEffect(function(){r.current=e},[e]);var n=y.useCallback(function(o,s){var u;s===void 0&&(s=ge.Hidden);var c=t.current.findIndex(function(f){var l=f.id;return l===o});c!==-1&&(Ne(s,(u={},u[ge.Unmount]=function(){t.current.splice(c,1)},u[ge.Hidden]=function(){t.current[c].state=J.Hidden},u)),!Gt(t)&&i.current&&(r.current==null||r.current()))},[r,i,t]),a=y.useCallback(function(o){var s=t.current.find(function(u){var c=u.id;return c===o});return s?s.state!==J.Visible&&(s.state=J.Visible):t.current.push({id:o,state:J.Visible}),function(){return n(o,ge.Unmount)}},[t,n]);return y.useMemo(function(){return{children:t,register:a,unregister:n}},[a,n,t])}function Ks(){}var Qs=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Mn(e){for(var r={},t=Oe(Qs),i;!(i=t()).done;){var n,a=i.value;r[a]=(n=e[a])!=null?n:Ks}return r}function Js(e){var r=y.useRef(Mn(e));return y.useEffect(function(){r.current=Mn(e)},[e]),r}var Ys="div",ki=_e.RenderStrategy;function Ei(e){var r,t=e.beforeEnter,i=e.afterEnter,n=e.beforeLeave,a=e.afterLeave,o=e.enter,s=e.enterFrom,u=e.enterTo,c=e.entered,f=e.leave,l=e.leaveFrom,d=e.leaveTo,g=Ke(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","entered","leave","leaveFrom","leaveTo"]),v=y.useRef(null),x=y.useState(J.Visible),S=x[0],m=x[1],w=g.unmount?ge.Unmount:ge.Hidden,P=qs(),j=P.show,R=P.appear,M=P.initial,D=Gs(),_=D.register,T=D.unregister,N=mt(),E=y.useRef(!1),I=Ni(function(){E.current||(m(J.Hidden),T(N),X.current.afterLeave())});Ve(function(){if(!!N)return _(N)},[_,N]),Ve(function(){var H;if(w===ge.Hidden&&!!N){if(j&&S!==J.Visible){m(J.Visible);return}Ne(S,(H={},H[J.Hidden]=function(){return T(N)},H[J.Visible]=function(){return _(N)},H))}},[S,N,_,T,j,w]);var q=ze(o),$=ze(s),Q=ze(u),te=ze(c),W=ze(f),Z=ze(l),re=ze(d),X=Js({beforeEnter:t,afterEnter:i,beforeLeave:n,afterLeave:a}),B=Wt();y.useEffect(function(){if(B&&S===J.Visible&&v.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,S,B]);var G=M&&!R;Ve(function(){var H=v.current;if(!!H&&!G)return E.current=!0,j&&X.current.beforeEnter(),j||X.current.beforeLeave(),j?Tn(H,q,$,Q,te,function(me){E.current=!1,me===$e.Finished&&X.current.afterEnter()}):Tn(H,W,Z,re,te,function(me){E.current=!1,me===$e.Finished&&(Gt(I)||(m(J.Hidden),T(N),X.current.afterLeave()))})},[X,N,E,T,I,v,G,j,q,$,Q,W,Z,re]);var V={ref:v},U=g;return p.jsx(qt.Provider,{value:I,children:p.jsx(As,{value:Ne(S,(r={},r[J.Visible]=Fe.Open,r[J.Hidden]=Fe.Closed,r)),children:He({props:Se({},U,V),defaultTag:Ys,features:ki,visible:S===J.Visible,name:"Transition.Child"})})})}function Ge(e){var r=e.show,t=e.appear,i=t===void 0?!1:t,n=e.unmount,a=Ke(e,["show","appear","unmount"]),o=Sr();if(r===void 0&&o!==null){var s;r=Ne(o,(s={},s[Fe.Open]=!0,s[Fe.Closed]=!1,s))}if(![!0,!1].includes(r))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var u=y.useState(r?J.Visible:J.Hidden),c=u[0],f=u[1],l=Ni(function(){f(J.Hidden)}),d=Bs(),g=y.useMemo(function(){return{show:r,appear:i||!d,initial:d}},[r,i,d]);y.useEffect(function(){r?f(J.Visible):Gt(l)||f(J.Hidden)},[r,l]);var v={unmount:n};return p.jsx(qt.Provider,{value:l,children:p.jsx(zt.Provider,{value:g,children:He({props:Se({},v,{as:y.Fragment,children:p.jsx(Ei,ie({},Object.assign({},v,a)))}),defaultTag:y.Fragment,features:ki,visible:c===J.Visible,name:"Transition"})})})}Ge.Child=function(r){var t=y.useContext(zt)!==null,i=Sr()!==null;return!t&&i?p.jsx(Ge,ie({},Object.assign({},r))):p.jsx(Ei,ie({},Object.assign({},r)))};Ge.Root=Ge;function Zs(e){const{children:r,isModalOpen:t,handleCloseModal:i}=e,{isMobile:n}=vi({isModal:!0});return p.jsx(p.Fragment,{children:p.jsx(Ge,{appear:!0,show:t,as:y.Fragment,children:p.jsx(gt,{as:"div",className:"overflow-y-auto fixed inset-0 z-10",style:{backgroundColor:"rgba(0,0,0,.75)"},onClose:i,children:p.jsxs("div",{className:"min-h-screen text-center sm:px-4",children:[p.jsx(Ge.Child,{as:y.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:p.jsx(gt.Overlay,{className:"fixed inset-0"})}),p.jsx("span",{className:"inline-block h-screen align-middle","aria-hidden":"true",children:"\u200B"}),p.jsx(Ge.Child,{as:y.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:p.jsxs("div",{id:"modal-content",className:"inline-block overflow-hidden sm:rounded-2xl align-middle transition-all transform bg-white sm:shadow-xl h-[100vh] sm:h-auto sm:max-h-[90vh] w-full sm:w-[640px]",children:[p.jsx("div",{className:"flex sticky top-0 z-10 items-center px-3 w-full h-14 text-lg font-medium leading-6 text-gray-900 bg-white modal-header",children:p.jsx("div",{className:"",children:p.jsxs("svg",{className:"w-8 h-8 text-black cursor-pointer",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",onClick:i,children:[p.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"})," ",p.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})," ",p.jsx("line",{x1:"5",y1:"12",x2:"11",y2:"18"})," ",p.jsx("line",{x1:"5",y1:"12",x2:"11",y2:"6"})]})})}),p.jsx("div",{className:"w-full",style:{height:`${n?"calc(100% - 56px)":"auto"}`},children:r})]})})]})})})})}function Xs(e){const{product:r,primaryColor:t,lang:i="en",handleAddToBasket:n,handleGoBack:a,isModal:o=!1,isModalOpen:s=!0,showDebugState:u=!1,handleCloseModal:c=()=>alert("ERROR: handleCloseModal not implemented")}=e,f=Y(w=>w.setInitialFilter),l=Y(w=>w.setInitialSelectedState),d=Y(w=>w.setInitialValidate),g=Y(w=>w.resetExpanded),v=pi(r,ss),{state:{filter:x={},selected:S={}}={}}=v;y.useEffect(()=>{console.log("cleared"),d(),f(x),l(S),g(),oe.changeLanguage(i)},[r]),y.useEffect(()=>{console.log("lang: ",i),oe.changeLanguage(i)},[i]),y.useEffect(()=>{t&&document.documentElement.style.setProperty("--color-primary",t)},[t]);const m=p.jsx(ds,{product:v,handleAddToBasket:n,handleGoBack:a,isModal:o,showDebugState:u});return p.jsx(p.Fragment,{children:o===!0?p.jsx(Zs,{isModalOpen:s,handleCloseModal:c,children:m}):m})}exports.ProductConfigurator=Xs;
19
8
  //# sourceMappingURL=index.cjs.js.map