@orderingstack/front-components-product-configurator 0.0.8 → 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 +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Rs=Object.defineProperty,Js=Object.defineProperties;var Ys=Object.getOwnPropertyDescriptors;var Li=Object.getOwnPropertySymbols;var Zs=Object.prototype.hasOwnProperty,Xs=Object.prototype.propertyIsEnumerable;var Fi=(X,y,h)=>y in X?Rs(X,y,{enumerable:!0,configurable:!0,writable:!0,value:h}):X[y]=h,se=(X,y)=>{for(var h in y||(y={}))Zs.call(y,h)&&Fi(X,h,y[h]);if(Li)for(var h of Li(y))Xs.call(y,h)&&Fi(X,h,y[h]);return X},Re=(X,y)=>Js(X,Ys(y));(function(X,y){typeof exports=="object"&&typeof module!="undefined"?y(exports,require("react"),require("react/jsx-runtime"),require("react-spring"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react/jsx-runtime","react-spring","react-dom"],y):(X=typeof globalThis!="undefined"?globalThis:X||self,y(X.ProductConfigurator={},X.React,X.jsxRuntime,X.reactSpring,X.reactDom))})(this,function(X,y,h,Nr,Ai){"use strict";function ji(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var pe=ji(y),eu="",tu="",nt=e=>e.type==="checkbox",Je=e=>e instanceof Date,ce=e=>e==null;const kr=e=>typeof e=="object";var ae=e=>!ce(e)&&!Array.isArray(e)&&kr(e)&&!Je(e),Ti=e=>ae(e)&&e.target?nt(e.target)?e.target.checked:e.target.value:e,Mi=e=>e.substring(0,e.search(/.\d/))||e,Di=(e,r)=>[...e].some(t=>Mi(r)===t),bt=e=>e.filter(Boolean),ie=e=>e===void 0,F=(e,r,t)=>{if(!r||!ae(e))return t;const i=bt(r.split(/[,[\].]+?/)).reduce((n,a)=>ce(n)?n:n[a],e);return ie(i)||i===e?ie(e[r])?t:e[r]:i};const Er={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ye={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ae={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};var Ot=(e,r)=>{const t=Object.assign({},e);return delete t[r],t};const Lr=pe.default.createContext(null),it=()=>pe.default.useContext(Lr),Ii=e=>pe.default.createElement(Lr.Provider,{value:Ot(e,"children")},e.children);var _i=(e,r,t,i=!0)=>{const n={};for(const a in e)Object.defineProperty(n,a,{get:()=>{const o=a;return r[o]!==ye.all&&(r[o]=!i||ye.all),t&&(t[o]=!0),e[o]}});return n},de=e=>ae(e)&&!Object.keys(e).length,Vi=(e,r,t)=>{const i=Ot(e,"name");return de(i)||Object.keys(i).length>=Object.keys(r).length||Object.keys(i).find(n=>r[n]===(!t||ye.all))},Rt=e=>Array.isArray(e)?e:[e];function $i(e){const r=pe.default.useRef(e);r.current=e,pe.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 Ce=e=>typeof e=="string",Ui=(e,r,t,i)=>{const n=Array.isArray(e);return Ce(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)},St=e=>typeof e=="function",Fr=e=>{for(const r in e)if(St(e[r]))return!0;return!1},Hi=(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})}):{},Jt=e=>/^\w*$/.test(e),Ar=e=>bt(e.replace(/["|']|\]/g,"").split(/\.|\[/));function ee(e,r,t){let i=-1;const n=Jt(r)?[r]:Ar(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 Yt=(e,r,t)=>{for(const i of t||Object.keys(e)){const n=F(e,i);if(n){const a=n._f,o=Ot(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 ae(o)&&Yt(o,r)}}};var jr=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));function Ye(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(St(e[i])){r=e;break}r[i]=Ye(e[i])}}else return e;return r}function Zt(){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 wt=e=>ce(e)||!kr(e);function Ze(e,r){if(wt(e)||wt(r))return e===r;if(Je(e)&&Je(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(Je(a)&&Je(o)||ae(a)&&ae(o)||Array.isArray(a)&&Array.isArray(o)?!Ze(a,o):a!==o)return!1}}return!0}var Tr=e=>({isOnSubmit:!e||e===ye.onSubmit,isOnBlur:e===ye.onBlur,isOnChange:e===ye.onChange,isOnAll:e===ye.all,isOnTouch:e===ye.onTouched}),at=e=>typeof e=="boolean",Xt=e=>e.type==="file",er=e=>e instanceof HTMLElement,Mr=e=>e.type==="select-multiple",tr=e=>e.type==="radio",Bi=e=>tr(e)||nt(e),Dr=typeof window!="undefined"&&typeof window.HTMLElement!="undefined"&&typeof document!="undefined",rr=e=>er(e)&&e.isConnected;function Wi(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=Jt(r)?[r]:Ar(r),i=t.length==1?e:Wi(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)||at(d)).length)&&(a?delete a[l]:delete e[l]),a=u}}return e}function xt(e,r={}){const t=Array.isArray(e);if(ae(e)||t)for(const i in e)Array.isArray(e[i])||ae(e[i])&&!Fr(e[i])?(r[i]=Array.isArray(e[i])?[]:{},xt(e[i],r[i])):ce(e[i])||(r[i]=!0);return r}function Ir(e,r,t){const i=Array.isArray(e);if(ae(e)||i)for(const n in e)Array.isArray(e[n])||ae(e[n])&&!Fr(e[n])?ie(r)||wt(t[n])?t[n]=Array.isArray(e[n])?xt(e[n],[]):Object.assign({},xt(e[n])):Ir(e[n],ce(r)?{}:r[n],t[n]):t[n]=!Ze(e[n],r[n]);return t}var _r=(e,r)=>Ir(e,r,xt(r));const Vr={value:!1,isValid:!1},$r={value:!0,isValid:!0};var Ur=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},Hr=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:i})=>ie(e)?e:r?e===""?NaN:+e:t&&Ce(e)?new Date(e):i?i(e):e;const Br={isValid:!1,value:null};var Wr=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,Br):Br;function nr(e){const r=e.ref;if(!(e.refs?e.refs.every(t=>t.disabled):r.disabled))return Xt(r)?r.files:tr(r)?Wr(e.refs).value:Mr(r)?[...r.selectedOptions].map(({value:t})=>t):nt(r)?Ur(e.refs).value:Hr(ie(r.value)?e.ref.value:r.value,e)}var zi=(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}},Ct=e=>e instanceof RegExp,ot=e=>ie(e)?void 0:Ct(e)?e.source:ae(e)?Ct(e.value)?e.value.source:e.value:e,qi=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function zr(e,r,t){const i=F(e,t);if(i||Jt(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 Gi=(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,Ki=(e,r)=>!bt(F(e,r)).length&&le(e,r),Pt=e=>Ce(e)||pe.default.isValidElement(e);function qr(e,r,t="validate"){if(Pt(e)||Array.isArray(e)&&e.every(Pt)||at(e)&&!e)return{type:t,message:Pt(e)?e:"",ref:r}}var Xe=e=>ae(e)&&!Ct(e)?e:{value:e,message:""},Gr=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:O,disabled:w}=e._f;if(!O||w)return{};const m=a?a[0]:n,x=k=>{i&&m.reportValidity&&(m.setCustomValidity(at(k)?"":k||" "),m.reportValidity())},P={},N=tr(n),T=nt(n),D=N||T,I=(v||Xt(n))&&!n.value||r===""||Array.isArray(r)&&!r.length,V=Hi.bind(null,g,t,P),M=(k,L,_,G=Ae.maxLength,U=Ae.minLength)=>{const J=k?L:_;P[g]=Object.assign({type:k?G:U,message:J,ref:n},V(k?G:U,J))};if(o&&(!D&&(I||ce(r))||at(r)&&!r||T&&!Ur(a).isValid||N&&!Wr(a).isValid)){const{value:k,message:L}=Pt(o)?{value:!!o,message:o}:Xe(o);if(k&&(P[g]=Object.assign({type:Ae.required,message:L,ref:m},V(Ae.required,L)),!t))return x(L),P}if(!I&&(!ce(c)||!ce(f))){let k,L;const _=Xe(f),G=Xe(c);if(isNaN(r)){const U=n.valueAsDate||new Date(r);Ce(_.value)&&(k=U>new Date(_.value)),Ce(G.value)&&(L=U<new Date(G.value))}else{const U=n.valueAsNumber||+r;ce(_.value)||(k=U>_.value),ce(G.value)||(L=U<G.value)}if((k||L)&&(M(!!k,_.message,G.message,Ae.max,Ae.min),!t))return x(P[g].message),P}if((s||u)&&!I&&Ce(r)){const k=Xe(s),L=Xe(u),_=!ce(k.value)&&r.length>k.value,G=!ce(L.value)&&r.length<L.value;if((_||G)&&(M(_,k.message,L.message),!t))return x(P[g].message),P}if(l&&!I&&Ce(r)){const{value:k,message:L}=Xe(l);if(Ct(k)&&!r.match(k)&&(P[g]=Object.assign({type:Ae.pattern,message:L,ref:n},V(Ae.pattern,L)),!t))return x(L),P}if(d){if(St(d)){const k=await d(r),L=qr(k,m);if(L&&(P[g]=Object.assign(Object.assign({},L),V(Ae.validate,L.message)),!t))return x(L.message),P}else if(ae(d)){let k={};for(const L in d){if(!de(k)&&!t)break;const _=qr(await d[L](r),m,L);_&&(k=Object.assign(Object.assign({},_),V(L,_.message)),x(_.message),t&&(P[g]=k))}if(!de(k)&&(P[g]=Object.assign({ref:m},k),!t))return P}}return x(!0),P};const Qi={mode:ye.onSubmit,reValidateMode:ye.onChange,shouldFocusError:!0};function Ri(e={}){let r=Object.assign(Object.assign({},Qi),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?{}:Ye(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:Zt(),array:Zt(),state:Zt()},g=Tr(r.mode),v=Tr(r.reValidateMode),O=r.criteriaMode===ye.all,w=(p,b)=>(...S)=>{clearTimeout(c),c=window.setTimeout(()=>p(...S),b)},m=async p=>{let b=!1;return l.isValid&&(b=r.resolver?de((await I()).errors):await M(i,!0),!p&&b!==t.isValid&&(t.isValid=b,d.state.next({isValid:b}))),b},x=(p,b=[],S,E,A=!0,C=!0)=>{if(E&&S){if(o.action=!0,C&&Array.isArray(F(i,p))){const j=S(F(i,p),E.argA,E.argB);A&&ee(i,p,j)}if(l.errors&&C&&Array.isArray(F(t.errors,p))){const j=S(F(t.errors,p),E.argA,E.argB);A&&ee(t.errors,p,j),Ki(t.errors,p)}if(l.touchedFields&&Array.isArray(F(t.touchedFields,p))){const j=S(F(t.touchedFields,p),E.argA,E.argB);A&&ee(t.touchedFields,p,j)}l.dirtyFields&&(t.dirtyFields=_r(n,a)),d.state.next({isDirty:L(p,b),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else ee(a,p,b)},P=(p,b)=>(ee(t.errors,p,b),d.state.next({errors:t.errors})),N=(p,b,S,E)=>{const A=F(i,p);if(A){const C=F(a,p,ie(S)?F(n,p):S);ie(C)||E&&E.defaultChecked||b?ee(a,p,b?C:nr(A._f)):U(p,C),o.mount&&m()}},T=(p,b,S,E,A)=>{let C=!1;const j={name:p},q=F(t.touchedFields,p);if(l.isDirty){const We=t.isDirty;t.isDirty=j.isDirty=L(),C=We!==j.isDirty}if(l.dirtyFields&&(!S||E)){const We=F(t.dirtyFields,p);Ze(F(n,p),b)?le(t.dirtyFields,p):ee(t.dirtyFields,p,!0),j.dirtyFields=t.dirtyFields,C=C||We!==F(t.dirtyFields,p)}return S&&!q&&(ee(t.touchedFields,p,S),j.touchedFields=t.touchedFields,C=C||l.touchedFields&&q!==S),C&&A&&d.state.next(j),C?j:{}},D=async(p,b,S,E,A)=>{const C=F(t.errors,b),j=l.isValid&&t.isValid!==S;if(e.delayError&&E?(u=u||w(P,e.delayError),u(b,E)):(clearTimeout(c),E?ee(t.errors,b,E):le(t.errors,b)),((E?!Ze(C,E):C)||!de(A)||j)&&!p){const q=Object.assign(Object.assign(Object.assign({},A),j?{isValid:S}:{}),{errors:t.errors,name:b});t=Object.assign(Object.assign({},t),q),d.state.next(q)}f[b]--,l.isValidating&&!Object.values(f).some(q=>q)&&(d.state.next({isValidating:!1}),f={})},I=async p=>r.resolver?await r.resolver(Object.assign({},a),r.context,zi(p||s.mount,i,r.criteriaMode,r.shouldUseNativeValidation)):{},V=async p=>{const{errors:b}=await I();if(p)for(const S of p){const E=F(b,S);E?ee(t.errors,S,E):le(t.errors,S)}else t.errors=b;return b},M=async(p,b,S={valid:!0})=>{for(const E in p){const A=p[E];if(A){const C=A._f,j=Ot(A,"_f");if(C){const q=await Gr(A,F(a,C.name),O,r.shouldUseNativeValidation);if(q[C.name]&&(S.valid=!1,b))break;b||(q[C.name]?ee(t.errors,C.name,q[C.name]):le(t.errors,C.name))}j&&await M(j,b,S)}}return S.valid},k=()=>{for(const p of s.unMount){const b=F(i,p);b&&(b._f.refs?b._f.refs.every(S=>!rr(S)):!rr(b._f.ref))&&H(p)}s.unMount=new Set},L=(p,b)=>(p&&b&&ee(a,p,b),!Ze(ne(),n)),_=(p,b,S)=>{const E=Object.assign({},o.mount?a:ie(b)?n:Ce(p)?{[p]:b}:b);return Ui(p,s,E,S)},G=p=>bt(F(o.mount?a:n,p,e.shouldUnregister?F(n,p,[]):[])),U=(p,b,S={})=>{const E=F(i,p);let A=b;if(E){const C=E._f;C&&(!C.disabled&&ee(a,p,Hr(b,C)),A=Dr&&er(C.ref)&&ce(b)?"":b,Mr(C.ref)?[...C.ref.options].forEach(j=>j.selected=A.includes(j.value)):C.refs?nt(C.ref)?C.refs.length>1?C.refs.forEach(j=>j.checked=Array.isArray(A)?!!A.find(q=>q===j.value):A===j.value):C.refs[0]&&(C.refs[0].checked=!!A):C.refs.forEach(j=>j.checked=j.value===A):Xt(C.ref)?C.ref.value="":(C.ref.value=A,C.ref.type||d.watch.next({name:p})))}(S.shouldDirty||S.shouldTouch)&&T(p,A,S.shouldTouch,S.shouldDirty,!0),S.shouldValidate&&Z(p)},J=(p,b,S)=>{for(const E in b){const A=b[E],C=`${p}.${E}`,j=F(i,C);(s.array.has(p)||!wt(A)||j&&!j._f)&&!Je(A)?J(C,A,S):U(C,A,S)}},re=(p,b,S={})=>{const E=F(i,p),A=s.array.has(p),C=Ye(b);ee(a,p,C),A?(d.array.next({name:p,values:a}),(l.isDirty||l.dirtyFields)&&S.shouldDirty&&(t.dirtyFields=_r(n,a),d.state.next({name:p,dirtyFields:t.dirtyFields,isDirty:L(p,C)}))):E&&!E._f&&!ce(C)?J(p,C,S):U(p,C,S),jr(p,s)&&d.state.next({}),d.watch.next({name:p})},z=async p=>{const b=p.target;let S=b.name;const E=F(i,S);if(E){let A,C;const j=b.type?nr(E._f):Ti(p),q=p.type===Er.BLUR||p.type===Er.FOCUS_OUT,We=!qi(E._f)&&!r.resolver&&!F(t.errors,S)&&!E._f.deps||Gi(q,F(t.touchedFields,S),t.isSubmitted,v,g),Qt=jr(S,s,q);ee(a,S,j),q?E._f.onBlur&&E._f.onBlur(p):E._f.onChange&&E._f.onChange(p);const Pr=T(S,j,q,!1),Ks=!de(Pr)||Qt;if(!q&&d.watch.next({name:S,type:p.type}),We)return Ks&&d.state.next(Object.assign({name:S},Qt?{}:Pr));if(!q&&Qt&&d.state.next({}),f[S]=(f[S],1),d.state.next({isValidating:!0}),r.resolver){const{errors:ki}=await I([S]),Qs=zr(t.errors,i,S),Ei=zr(ki,i,Qs.name||S);A=Ei.error,S=Ei.name,C=de(ki)}else A=(await Gr(E,F(a,S),O,r.shouldUseNativeValidation))[S],C=await m(!0);E._f.deps&&Z(E._f.deps),D(!1,S,C,A,Pr)}},Z=async(p,b={})=>{let S,E;const A=Rt(p);if(d.state.next({isValidating:!0}),r.resolver){const C=await V(ie(p)?p:A);S=de(C),E=p?!A.some(j=>F(C,j)):S}else p?(E=(await Promise.all(A.map(async C=>{const j=F(i,C);return await M(j&&j._f?{[C]:j}:j)}))).every(Boolean),!(!E&&!t.isValid)&&m()):E=S=await M(i);return d.state.next(Object.assign(Object.assign(Object.assign({},!Ce(p)||l.isValid&&S!==t.isValid?{}:{name:p}),r.resolver?{isValid:S}:{}),{errors:t.errors,isValidating:!1})),b.shouldFocus&&!E&&Yt(i,C=>F(t.errors,C),p?A:s.mount),E},ne=p=>{const b=Object.assign(Object.assign({},n),o.mount?a:{});return ie(p)?b:Ce(p)?F(b,p):p.map(S=>F(b,S))},te=(p,b)=>({invalid:!!F((b||t).errors,p),isDirty:!!F((b||t).dirtyFields,p),isTouched:!!F((b||t).touchedFields,p),error:F((b||t).errors,p)}),W=p=>{p?Rt(p).forEach(b=>le(t.errors,b)):t.errors={},d.state.next({errors:t.errors})},K=(p,b,S)=>{const E=(F(i,p,{_f:{}})._f||{}).ref;ee(t.errors,p,Object.assign(Object.assign({},b),{ref:E})),d.state.next({name:p,errors:t.errors,isValid:!1}),S&&S.shouldFocus&&E&&E.focus&&E.focus()},$=(p,b)=>St(p)?d.watch.subscribe({next:S=>p(_(void 0,b),S)}):_(p,b,!0),H=(p,b={})=>{for(const S of p?Rt(p):s.mount)s.mount.delete(S),s.array.delete(S),F(i,S)&&(b.keepValue||(le(i,S),le(a,S)),!b.keepError&&le(t.errors,S),!b.keepDirty&&le(t.dirtyFields,S),!b.keepTouched&&le(t.touchedFields,S),!r.shouldUnregister&&!b.keepDefaultValue&&le(n,S));d.watch.next({}),d.state.next(Object.assign(Object.assign({},t),b.keepDirty?{isDirty:L()}:{})),!b.keepIsValid&&m()},B=(p,b={})=>{let S=F(i,p);const E=at(b.disabled);return ee(i,p,{_f:Object.assign(Object.assign(Object.assign({},S&&S._f?S._f:{ref:{name:p}}),{name:p,mount:!0}),b)}),s.mount.add(p),S?E&&ee(a,p,b.disabled?void 0:F(a,p,nr(S._f))):N(p,!0,b.value),Object.assign(Object.assign(Object.assign({},E?{disabled:b.disabled}:{}),r.shouldUseNativeValidation?{required:!!b.required,min:ot(b.min),max:ot(b.max),minLength:ot(b.minLength),maxLength:ot(b.maxLength),pattern:ot(b.pattern)}:{}),{name:p,onChange:z,onBlur:z,ref:A=>{if(A){B(p,b),S=F(i,p);const C=ie(A.value)&&A.querySelectorAll&&A.querySelectorAll("input,select,textarea")[0]||A,j=Bi(C),q=S._f.refs||[];if(j?q.find(We=>We===C):C===S._f.ref)return;ee(i,p,{_f:Object.assign(Object.assign({},S._f),j?{refs:q.concat(C).filter(rr),ref:{type:C.type,name:p}}:{ref:C})}),N(p,!1,void 0,C)}else S=F(i,p,{}),S._f&&(S._f.mount=!1),(r.shouldUnregister||b.shouldUnregister)&&!(Di(s.array,p)&&o.action)&&s.unMount.add(p)}})};return{control:{register:B,unregister:H,getFieldState:te,_executeSchema:I,_getWatch:_,_getDirty:L,_updateValid:m,_removeUnmounted:k,_updateFieldArray:x,_getFieldArray:G,_subjects:d,_proxyFormState:l,get _fields(){return i},get _formValues(){return a},get _stateFlags(){return o},set _stateFlags(p){o=p},get _defaultValues(){return n},get _names(){return s},set _names(p){s=p},get _formState(){return t},set _formState(p){t=p},get _options(){return r},set _options(p){r=Object.assign(Object.assign({},r),p)}},trigger:Z,register:B,handleSubmit:(p,b)=>async S=>{S&&(S.preventDefault&&S.preventDefault(),S.persist&&S.persist());let E=!0,A=Ye(a);d.state.next({isSubmitting:!0});try{if(r.resolver){const{errors:C,values:j}=await I();t.errors=C,A=j}else await M(i);de(t.errors)&&Object.keys(t.errors).every(C=>F(A,C))?(d.state.next({errors:{},isSubmitting:!0}),await p(A,S)):(b&&await b(Object.assign({},t.errors),S),r.shouldFocusError&&Yt(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:de(t.errors)&&E,submitCount:t.submitCount+1,errors:t.errors})}},watch:$,setValue:re,getValues:ne,reset:(p,b={})=>{const S=p||n,E=Ye(S),A=p&&!de(p)?E:n;if(b.keepDefaultValues||(n=S),!b.keepValues){if(Dr&&ie(p))for(const C of s.mount){const j=F(i,C);if(j&&j._f){const q=Array.isArray(j._f.refs)?j._f.refs[0]:j._f.ref;try{er(q)&&q.closest("form").reset();break}catch{}}}a=e.shouldUnregister?b.keepDefaultValues?Ye(n):{}:E,i={},d.array.next({values:A}),d.watch.next({values:A})}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?!Ze(p,n):!1,isSubmitted:b.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:b.keepDirty?t.dirtyFields:b.keepDefaultValues&&p?Object.entries(p).reduce((C,[j,q])=>Object.assign(Object.assign({},C),{[j]:q!==F(n,j)}),{}):{},touchedFields:b.keepTouched?t.touchedFields:{},errors:b.keepErrors?t.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},resetField:(p,b={})=>{F(i,p)&&(ie(b.defaultValue)?re(p,F(n,p)):(re(p,b.defaultValue),ee(n,p,b.defaultValue)),b.keepTouched||le(t.touchedFields,p),b.keepDirty||(le(t.dirtyFields,p),t.isDirty=b.defaultValue?L(p,F(n,p)):L()),b.keepError||(le(t.errors,p),l.isValid&&m()),d.state.next(Object.assign({},t)))},clearErrors:W,unregister:H,setError:K,setFocus:(p,b={})=>{const S=F(i,p)._f,E=S.refs?S.refs[0]:S.ref;b.shouldSelect?E.select():E.focus()},getFieldState:te}}function Ji(e={}){const r=pe.default.useRef(),[t,i]=pe.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({},Ri(e)),{formState:t});const n=r.current.control,a=pe.default.useCallback(o=>{Vi(o,n._proxyFormState,!0)&&(n._formState=Object.assign(Object.assign({},n._formState),o),i(Object.assign({},n._formState)))},[n]);return $i({subject:n._subjects.state,callback:a}),pe.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=_i(t,n._proxyFormState),r.current}function Te(e){return Te=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},Te(e)}function Pe(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 Kr(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&&Kr(e.prototype,r),t&&Kr(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 Rr(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){Pe(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 ir={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0},Jr,Yi=pe.default.createContext();function Zi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ir=Rr(Rr({},ir),e)}function Xi(){return ir}var ea=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 ta(e){Jr=e}function ra(){return Jr}var na={type:"3rdParty",init:function(r){Zi(r.options.react),ta(r)}};function ia(){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 Yr={};function ar(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];typeof r[0]=="string"&&Yr[r[0]]||(typeof r[0]=="string"&&(Yr[r[0]]=new Date),ia.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 aa(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!r.languages||!r.languages.length)return ar("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 Xr(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 en(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 tn(e,r){if(!!e){if(typeof e=="string")return en(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 en(e,r)}}function rn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sa(e,r){return Xr(e)||oa(e,r)||tn(e,r)||rn()}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 or(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){Pe(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 Nt(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=r.i18n,i=y.useContext(Yi)||{},n=i.i18n,a=i.defaultNS,o=t||n||ra();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new ea),!o){ar("You will need to pass in an i18next instance by using initReactI18next");var s=function(I){return Array.isArray(I)?I[I.length-1]:I},u=[s,{},!1];return u.t=s,u.i18n={},u.ready=!1,u}o.options.react&&o.options.react.wait!==void 0&&ar("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var c=or(or(or({},Xi()),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(D){return aa(D,o,c)});function v(){return o.getFixedT(null,c.nsMode==="fallback"?d:d[0],l)}var O=y.useState(v),w=sa(O,2),m=w[0],x=w[1],P=y.useRef(!0);y.useEffect(function(){var D=c.bindI18n,I=c.bindI18nStore;P.current=!0,!g&&!f&&Zr(o,d,function(){P.current&&x(v)});function V(){P.current&&x(v)}return D&&o&&o.on(D,V),I&&o&&o.store.on(I,V),function(){P.current=!1,D&&o&&D.split(" ").forEach(function(M){return o.off(M,V)}),I&&o&&I.split(" ").forEach(function(M){return o.store.off(M,V)})}},[o,d.join()]);var N=y.useRef(!0);y.useEffect(function(){P.current&&!N.current&&x(v),N.current=!1},[o]);var T=[m,o,g];if(T.t=m,T.i18n=o,T.ready=g,g||!g&&!f)return T;throw new Promise(function(D){Zr(o,d,function(){D()})})}function Me(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sr(e,r){return sr=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},sr(e,r)}function kt(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&&sr(e,r)}function st(e,r){if(r&&(Te(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Me(e)}function Ne(e){return Ne=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ne(e)}function ua(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function la(e){return Xr(e)||ua(e)||tn(e)||rn()}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 on(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){Pe(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 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)}},fa=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,on(on({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}}]),e}(),ke=new fa,De=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 ut(){var e,r,t=new Promise(function(i,n){e=i,r=n});return t.resolve=e,t.reject=r,t}function sn(e){return e==null?"":""+e}function da(e,r,t){e.forEach(function(i){r[i]&&(t[i]=r[i])})}function ur(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 un(e,r,t){var i=ur(e,r,Object),n=i.obj,a=i.k;n[a]=t}function ga(e,r,t,i){var n=ur(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 Et(e,r){var t=ur(e,r),i=t.obj,n=t.k;if(!!i)return i[n]}function ln(e,r,t){var i=Et(e,t);return i!==void 0?i:Et(r,t)}function cn(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]):cn(e[i],r[i],t):e[i]=r[i]);return e}function et(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var ha={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function pa(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,function(r){return ha[r]}):e}var Lt=typeof window!="undefined"&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,va=[" ",",","?","!",";"];function ma(e,r,t){r=r||"",t=t||"";var i=va.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 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 Ft(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){Pe(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 ya(e){var r=ba();return function(){var i=Ne(e),n;if(r){var a=Ne(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return st(this,n)}}function ba(){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 dn(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?dn(u,c,t):void 0}n=n[i[a]]}return n}}var Oa=function(e){kt(t,e);var r=ya(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),Lt&&De.call(Me(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=Et(this.data,f);return l||!c||typeof o!="string"?l:dn(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),un(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=Et(this.data,f)||{};s?cn(l,o,u):l=Ft(Ft({},l),o),un(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"?Ft(Ft({},{}),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}(De),gn={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 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 ge(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){Pe(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 Sa(e){var r=wa();return function(){var i=Ne(e),n;if(r){var a=Ne(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return st(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}}var pn={},vn=function(e){kt(t,e);var r=Sa(t);function t(i){var n,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ve(this,t),n=r.call(this),Lt&&De.call(Me(n)),da(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],i,Me(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&&!ma(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(Te(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 O=a.nsSeparator||this.options.nsSeparator;return d+O+f}return f}var w=this.resolve(n,a),m=w&&w.res,x=w&&w.usedKey||f,P=w&&w.exactUsedKey||f,N=Object.prototype.toString.apply(m),T=["[object Number]","[object Function]","[object RegExp]"],D=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,I=!this.i18nFormat||this.i18nFormat.handleAsObject,V=typeof m!="string"&&typeof m!="boolean"&&typeof m!="number";if(I&&m&&V&&T.indexOf(N)<0&&!(typeof D=="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,m,ge(ge({},a),{},{ns:l})):"key '".concat(f," (").concat(this.language,")' returned an object instead of string.");if(u){var M=N==="[object Array]",k=M?[]:{},L=M?P:x;for(var _ in m)if(Object.prototype.hasOwnProperty.call(m,_)){var G="".concat(L).concat(u).concat(_);k[_]=this.translate(G,ge(ge({},a),{joinArrays:!1,ns:l})),k[_]===G&&(k[_]=m[_])}m=k}}else if(I&&typeof D=="string"&&N==="[object Array]")m=m.join(D),m&&(m=this.extendTranslation(m,n,a,o));else{var U=!1,J=!1,re=a.count!==void 0&&typeof a.count!="string",z=t.hasDefaultValue(a),Z=re?this.pluralResolver.getSuffix(g,a.count,a):"",ne=a["defaultValue".concat(Z)]||a.defaultValue;!this.isValidLookup(m)&&z&&(U=!0,m=ne),this.isValidLookup(m)||(J=!0,m=f);var te=a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,W=te&&J?void 0:m,K=z&&ne!==m&&this.options.updateMissing;if(J||U||K){if(this.logger.log(K?"updateKey":"missingKey",g,d,f,K?ne:m),u){var $=this.resolve(f,ge(ge({},a),{},{keySeparator:!1}));$&&$.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 xe=0;xe<B.length;xe++)H.push(B[xe]);else this.options.saveMissingTo==="all"?H=this.languageUtils.toResolveHierarchy(a.lng||this.language):H.push(a.lng||this.language);var Cr=function(Qe,p,b){var S=z&&b!==m?b:W;s.options.missingKeyHandler?s.options.missingKeyHandler(Qe,d,p,S,K,a):s.backendConnector&&s.backendConnector.saveMissing&&s.backendConnector.saveMissing(Qe,d,p,S,K,a),s.emit("missingKey",Qe,d,p,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&re?H.forEach(function(Kt){s.pluralResolver.getSuffixes(Kt).forEach(function(Qe){Cr([Kt],f+Qe,a["defaultValue".concat(Qe)]||ne)})}):Cr(H,f,ne))}m=this.extendTranslation(m,n,a,w,o),J&&m===f&&this.options.appendNamespaceToMissingKey&&(m="".concat(d,":").concat(f)),(J||U)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?m=this.options.parseMissingKeyHandler(f,U?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(ge(ge({},o),{interpolation:ge(ge({},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=ge(ge({},this.options.interpolation.defaultVariables),g)),n=this.interpolator.interpolate(n,g,o.lng||this.language,o),f){var v=n.match(this.interpolator.nestingRegexp),O=v&&v.length;l<O&&(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,m=typeof w=="string"?[w]:w;return n!=null&&m&&m.length&&o.applyPostProcessor!==!1&&(n=gn.handle(m,n,a,this.options&&this.options.postProcessPassResolved?ge({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 O=g.namespaces;a.options.fallbackNS&&(O=O.concat(a.options.fallbackNS));var w=o.count!==void 0&&typeof o.count!="string",m=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);O.forEach(function(N){a.isValidLookup(s)||(l=N,!pn["".concat(P[0],"-").concat(N)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(l)&&(pn["".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(T){if(!a.isValidLookup(s)){f=T;var D=[v];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(D,v,T,N,o);else{var I;w&&(I=a.pluralResolver.getSuffix(T,o.count,o));var V="_zero";if(w&&(D.push(v+I),m&&D.push(v+V)),x){var M="".concat(v).concat(a.options.contextSeparator).concat(o.context);D.push(M),w&&(D.push(M+I),m&&D.push(M+V))}}for(var k;k=D.pop();)a.isValidLookup(s)||(c=k,s=a.getResource(T,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}(De);function lr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var xa=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]=lr(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]=lr(n[1].toLowerCase())),i.indexOf(n[2].toLowerCase())>-1&&(n[2]=lr(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}(),Ca=[{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}],Pa={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)}},Na=["v1","v2","v3"],mn={zero:0,one:1,two:2,few:3,many:4,other:5};function ka(){var e={};return Ca.forEach(function(r){r.lngs.forEach(function(t){e[t]={numbers:r.nr,plurals:Pa[r.fc]}})}),e}var Ea=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=ka()}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 mn[o]-mn[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!Na.includes(this.options.compatibilityJSON)}}]),e}();function yn(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?yn(Object(t),!0).forEach(function(i){Pe(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):yn(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}var La=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:pa,this.escapeValue=i.escapeValue!==void 0?i.escapeValue:!0,this.useRawValueToEscape=i.useRawValueToEscape!==void 0?i.useRawValueToEscape:!1,this.prefix=i.prefix?et(i.prefix):i.prefixEscaped||"{{",this.suffix=i.suffix?et(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?et(i.nestingPrefix):i.nestingPrefixEscaped||et("$t("),this.nestingSuffix=i.nestingSuffix?et(i.nestingSuffix):i.nestingSuffixEscaped||et(")"),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(m){if(m.indexOf(o.formatSeparator)<0){var x=ln(i,f,m);return o.alwaysFormat?o.format(x,void 0,n,be(be(be({},a),i),{},{interpolationkey:m})):x}var P=m.split(o.formatSeparator),N=P.shift().trim(),T=P.join(o.formatSeparator).trim();return o.format(ln(i,f,N),T,n,be(be(be({},a),i),{},{interpolationkey:N}))};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,O=[{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 O.forEach(function(w){for(c=0;s=w.regex.exec(t);){var m=s[1].trim();if(u=d(m),u===void 0)if(typeof g=="function"){var x=g(t,s,a);u=typeof x=="string"?x:""}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=sn(u));var P=w.safeValue(u);if(t=t.replace(s[0],P),v?(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,v){var O=this.nestingOptionsSeparator;if(g.indexOf(O)<0)return g;var w=g.split(new RegExp("".concat(O,"[ ]*{"))),m="{".concat(w[1]);g=w[0],m=this.interpolate(m,u),m=m.replace(/'/g,'"');try{u=JSON.parse(m),v&&(u=be(be({},v),u))}catch(x){return this.logger.warn("failed parsing options string in nesting for key ".concat(g),x),"".concat(g).concat(O).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=sn(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,be(be({},a),{},{interpolationkey:o[1].trim()}))},s.trim())),t=t.replace(o[0],s),this.regexp.lastIndex=0}return t}}]),e}();function bn(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 Ie(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?bn(Object(t),!0).forEach(function(i){Pe(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):bn(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}function Fa(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=la(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 Aa=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,Ie(Ie({},a),{},{style:"currency"})).format(i)},datetime:function(i,n,a){return new Intl.DateTimeFormat(n,Ie({},a)).format(i)},relativetime:function(i,n,a){return new Intl.RelativeTimeFormat(n,Ie({},a)).format(i,a.range||"day")},list:function(i,n,a){return new Intl.ListFormat(n,Ie({},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=Fa(f),d=l.formatName,g=l.formatOptions;if(o.formats[d]){var v=c;try{var O=a&&a.formatParams&&a.formatParams[a.interpolationkey]||{},w=O.locale||O.lng||a.locale||a.lng||n;v=o.formats[d](c,w,Ie(Ie(Ie({},g),a),O))}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 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 Sn(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){Pe(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 ja(e){var r=Ta();return function(){var i=Ne(e),n;if(r){var a=Ne(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return st(this,n)}}function Ta(){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 Ma(e,r){for(var t=e.indexOf(r);t!==-1;)e.splice(t,1),t=e.indexOf(r)}var Da=function(e){kt(t,e);var r=ja(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),Lt&&De.call(Me(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 v=!0;a.forEach(function(O){var w="".concat(g,"|").concat(O);!o.reload&&u.store.hasResourceBundle(g,O)?u.state[w]=2:u.state[w]<0||(u.state[w]===1?f.indexOf(w)<0&&f.push(w):(u.state[w]=1,v=!1,f.indexOf(w)<0&&f.push(w),c.indexOf(w)<0&&c.push(w),d.indexOf(O)<0&&d.push(O)))}),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){ga(l.loaded,[u],c),Ma(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,Sn(Sn({},c),{},{isUpdate:u})),!(!n||!n[0])&&this.store.addResource(n[0],a,o,s))}}]),t}(De);function Ia(){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(Te(r[1])==="object"&&(t=r[1]),typeof r[1]=="string"&&(t.defaultValue=r[1]),typeof r[2]=="string"&&(t.tDescription=r[2]),Te(r[2])==="object"||Te(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 wn(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 xn(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 Ee(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?xn(Object(t),!0).forEach(function(i){Pe(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):xn(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=Ne(e),n;if(r){var a=Ne(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return st(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 At(){}function $a(e){var r=Object.getOwnPropertyNames(Object.getPrototypeOf(e));r.forEach(function(t){typeof e[t]=="function"&&(e[t]=e[t].bind(e))})}var jt=function(e){kt(t,e);var r=_a(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),Lt&&De.call(Me(i)),i.options=wn(n),i.services={},i.logger=ke,i.modules={external:[]},$a(Me(i)),a&&!i.isInitialized&&!n.isClone){if(!i.options.initImmediate)return i.init(n,a),st(i,Me(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=Ia();this.options=Ee(Ee(Ee({},s),this.options),wn(a)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Ee(Ee({},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?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=Aa);var f=new xa(this.options);this.store=new Oa(this.options.resources,this.options);var l=this.services;l.logger=ke,l.resourceStore=this.store,l.languageUtils=f,l.pluralResolver=new Ea(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 La(this.options),l.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},l.backendConnector=new Da(u(this.modules.backend),l.resourceStore,l,this.options),l.backendConnector.on("*",function(m){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,[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 vn(this.services,this.options),this.translator.on("*",function(m){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,[m].concat(P))}),this.modules.external.forEach(function(m){m.init&&m.init(n)})}if(this.format=this.options.interpolation.format,o||(o=At),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 x;return(x=n.store)[m].apply(x,arguments)}});var v=["addResource","addResources","addResourceBundle","removeResourceBundle"];v.forEach(function(m){n[m]=function(){var x;return(x=n.store)[m].apply(x,arguments),n}});var O=ut(),w=function(){var x=function(N,T){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),O.resolve(T),o(N,T)};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),O}},{key:"loadResources",value:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:At,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(O){c.indexOf(O)<0&&c.push(O)})}};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=ut();return n||(n=this.languages),a||(a=this.options.ns),o||(o=At),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"&&gn.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=ut();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(Te(l)!=="object"){for(var g=arguments.length,v=new Array(g>2?g-2:0),O=2;O<g;O++)v[O-2]=arguments[O];d=s.options.overloadTranslationOptionHandler([f,l].concat(v))}else d=Ee({},l);d.lng=d.lng||c.lng,d.lngs=d.lngs||c.lngs,d.ns=d.ns||c.ns;var w=s.options.keySeparator||".",m=o?"".concat(o).concat(w).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 O=a.services.backendConnector.state["".concat(g,"|").concat(v)];return O===-1||O===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=ut();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=ut();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]:At,s=Ee(Ee(Ee({},this.options),a),{isClone:!0}),u=new t(s),c=["store","services","language"];return c.forEach(function(f){u[f]=n[f]}),u.services=Ee({},this.services),u.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},u.translator=new vn(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}(De);Pe(jt,"createInstance",function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return new jt(e,r)});var oe=jt.createInstance();oe.createInstance=jt.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 Cn=[],Ua=Cn.forEach,Ha=Cn.slice;function Ba(e){return Ua.call(Ha.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]+$/,Wa=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},Nn={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=Wa(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)}},za={name:"cookie",lookup:function(r){var t;if(r.lookupCookie&&typeof document!="undefined"){var i=Nn.read(r.lookupCookie);i&&(t=i)}return t},cacheUserLanguage:function(r,t){t.lookupCookie&&typeof document!="undefined"&&Nn.create(t.lookupCookie,r,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},qa={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}},lt=null,kn=function(){if(lt!==null)return lt;try{lt=window!=="undefined"&&window.localStorage!==null;var r="i18next.translate.boo";window.localStorage.setItem(r,"foo"),window.localStorage.removeItem(r)}catch{lt=!1}return lt},Ga={name:"localStorage",lookup:function(r){var t;if(r.lookupLocalStorage&&kn()){var i=window.localStorage.getItem(r.lookupLocalStorage);i&&(t=i)}return t},cacheUserLanguage:function(r,t){t.lookupLocalStorage&&kn()&&window.localStorage.setItem(t.lookupLocalStorage,r)}},ct=null,En=function(){if(ct!==null)return ct;try{ct=window!=="undefined"&&window.sessionStorage!==null;var r="i18next.translate.boo";window.sessionStorage.setItem(r,"foo"),window.sessionStorage.removeItem(r)}catch{ct=!1}return ct},Ka={name:"sessionStorage",lookup:function(r){var t;if(r.lookupSessionStorage&&En()){var i=window.sessionStorage.getItem(r.lookupSessionStorage);i&&(t=i)}return t},cacheUserLanguage:function(r,t){t.lookupSessionStorage&&En()&&window.sessionStorage.setItem(t.lookupSessionStorage,r)}},Qa={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}},Ra={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}},Ja={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}},Ya={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 Za(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var Ln=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=Ba(i,this.options||{},Za()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(za),this.addDetector(qa),this.addDetector(Ga),this.addDetector(Ka),this.addDetector(Qa),this.addDetector(Ra),this.addDetector(Ja),this.addDetector(Ya)}},{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}();Ln.type="languageDetector";const Xa={"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"},eo={"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"},to={"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"},ro={"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(Ln).use(na).init({resources:{pl:{translation:Xa},en:{translation:eo},de:{translation:to},cs:{translation:ro}}});var Fn=(e=>(e.SELECT="selCtx",e.FILTER="fltCtx",e))(Fn||{}),ze=(e=>(e.OPTIONS="3e/group/options",e.CONFIG="3e/group/config",e.PRODUCT="3e/product",e))(ze||{}),Oe=(e=>(e.OK="OK",e.TOO_MUCH="TOO_MUCH",e.NOT_ENOUGHT="NOT_ENOUGHT",e.IGNORE="IGNORE",e))(Oe||{});const cr=(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]},no=(e,r)=>{const{selCtx:t,attrs:i={}}=e,{qtyMin:n,qtyMax:a}=i,{t:o}=Nt(),[s,u]=cr(t,r,e.items),{status:c,information:f}=io(n,a,u,o);return{chosenQtyCnt:u,qtyMin:n,qtyMax:a,walidationStatus:c,informationText:f}},io=(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=Oe.NOT_ENOUGHT)),s>0&&(n+=` ${i("OS.ProductConfigurator.Quantity.Message.UpTo")} ${s}`,s<t&&(a=Oe.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=Oe.IGNORE),t>=o&&t<=s&&(a=Oe.OK),{information:n,status:a}},ao=(e,r)=>{const{selCtx:t,attrs:i={}}=e,{selMin:n,selMax:a}=i,{t:o}=Nt(),[s,u]=cr(t,r,e.items),{status:c,information:f}=oo(n,a,s,o);return{chosenSelCnt:s,selMin:n,selMax:a,walidationStatus:c,informationText:f}},oo=(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=Oe.NOT_ENOUGHT)),s>0&&(n+=` ${i("OS.ProductConfigurator.Selected.Message.UpTo")} ${s}`,s<t&&(a=Oe.TOO_MUCH)),o>=0||s>=0?(n=`${i("OS.ProductConfigurator.Selected.Message.Choose")}${n}`,n+=` ${i("OS.ProductConfigurator.Selected.Message.Options")}`):(n="",a=Oe.IGNORE),o===1&&s===1&&(n=`${i("OS.ProductConfigurator.Selected.Message.OneOption")}`),t>=o&&t<=s&&(a=Oe.OK),{information:n,status:a}},so=(e,r,t)=>{if(e==="selected"||e==="filter")return[];if(t[r]===e)return[t];let i=jn(e,r,t.items);return(i==null?void 0:i.length)||(i=An(e,r,t.items),i.length===0),i},An=(e,r,t)=>{const i=uo(t),n=jn(e,r,i);return(n==null?void 0:n.length)?n:(i==null?void 0:i.length)?An(e,r,i):[]},uo=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)},jn=(e,r,t)=>{let i=[];return Array.isArray(t)&&(i=t.filter(n=>{if(n&&n[r]===e)return!0})),i},lo=(e,r,t,i)=>{const n=so(r,t,i),a=co(e,n).filter(o=>o!==null&&typeof o!="undefined");return a.length?a[0]:null},co=(e,r)=>{let t=[];return Array.isArray(r)&&r.length&&(t=r.map(i=>fo(e,i))),t},fo=(e,r)=>{if(r.id===e)return r;let t=Mn(e,r.items);return t.length?(t.length>1&&console.error(`More than one ${e} in context ${r.id}`),t[0]):(t=Tn(e,r.items),t.length?(t.length>1&&console.error(`More than one ${e} in context ${r.id}`),t[0]):null)},Tn=(e,r)=>{const t=go(r),i=Mn(e,t);return(i==null?void 0:i.length)?i:(t==null?void 0:t.length)?Tn(e,t):[]},go=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)},Mn=(e,r)=>Array.isArray(r)?r.filter(i=>{if(i&&i.id===e)return!0}):[],fr=(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=lo(a,i,Fn.SELECT,r);s&&(s==null?void 0:s.price)&&(t+=parseFloat(s.price)*o)}}return t};function Dn(e){const{isOkk:r,isErr:t,info:i}=e;return h.jsxs("p",{className:`${r?"text-green-600":t&&"text-red-600"} ml-1 flex`,children:[r&&ho,t&&po,i]})}const ho=h.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:h.jsx("polyline",{points:"20 6 9 17 4 12"})}),po=h.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:h.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 vo={defaultAmount:0,defaultCurrency:"USD",defaultPrecision:2},mo={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 ft(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ft=function(r){return typeof r}:ft=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ft(e)}function In(e){return yo(e)||bo(e)||Oo(e)||So()}function yo(e){if(Array.isArray(e))return e}function bo(e){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(e))return Array.from(e)}function Oo(e,r){if(!!e){if(typeof e=="string")return _n(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 _n(e,r)}}function _n(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 So(){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 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=In(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=In(r),i=t[0],n=t.slice(1),a=i;return n.forEach(function(o){a=a.greaterThan(o)?a:o}),a}};function Vn(e){return!isNaN(parseInt(e))&&isFinite(e)}function xo(e){return Vn(e)&&e<=100&&e>=0}function Co(e){return e.length>0&&e.every(function(r){return r>=0})&&e.some(function(r){return r>0})}function $n(e){return e%2===0}function Un(e){return Vn(e)&&!Number.isInteger(e)}function Po(){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 dt(e){return Math.abs(e)%1===.5}function No(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),ko(n,r.headers),n.send()})}function ko(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 gt(e){return typeof e=="undefined"}function Hn(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:".",t={};return Object.entries(e).forEach(function(i){if(ft(i[1])==="object"){var n=Hn(i[1]);Object.entries(n).forEach(function(a){t[i[0]+r+a[0]]=a[1]})}else t[i[0]]=i[1]}),t}function Eo(e){return Boolean(e)&&(ft(e)==="object"||typeof e=="function")&&typeof e.then=="function"}function Bn(){var e=function(i,n){var a=function(u){return Math.pow(10,Po(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 dt(i)&&$n(n)?n-1:n},HALF_EVEN:function(i){var n=Math.round(i);return dt(i)?$n(n)?n:n-1:n},HALF_UP:function(i){return Math.round(i)},HALF_DOWN:function(i){return dt(i)?Math.floor(i):Math.round(i)},HALF_TOWARDS_ZERO:function(i){return dt(i)?Math.sign(i)*Math.floor(Math.abs(i)):Math.round(i)},HALF_AWAY_FROM_ZERO:function(i){return dt(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 Un(i)||Un(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 Lo=Bn();function Fo(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!gt(i)}):[]},getMinimumFractionDigits:function(){var i=function(a){return a==="."};return gt(this.getMatches().find(i))?0:this.getMatches()[Lo.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 gt(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!gt(this.getMatches().find(function(i){return i===","}))}}}function Ao(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 No(r(e.endpoint,{from:n,to:a}),{headers:e.headers})};return{getExchangeRate:function(n,a){return(Eo(e.endpoint)?e.endpoint:t(n,a)).then(function(o){return Hn(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 jo(e){ht(xo(e),"You must provide a numeric value between 0 and 100.",RangeError)}function To(e){ht(Co(e),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}function dr(e){ht(Number.isInteger(e),"You must provide an integer.",TypeError)}var Q=Bn(),Mo=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;dr(i),dr(a);var o=e.globalLocale,s=e.globalFormat,u=e.globalRoundingMode,c=e.globalFormatRoundingMode,f=Object.assign({},e.globalExchangeRatesApi),l=function(v){var O=Object.assign({},Object.assign({},{amount:i,currency:n,precision:a},v),Object.assign({},{locale:this.locale},v));return Object.assign(e({amount:O.amount,currency:O.currency,precision:O.precision}),{locale:O.locale})},d=function(v){ht(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 O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;dr(v);var w=this.getPrecision(),m=v>w,x=m?Q.multiply:Q.divide,P=m?[v,w]:[w,v],N=Math.pow(10,Q.subtract.apply(Q,P));return l.call(this,{amount:Q.round(x(this.getAmount(),N),O),precision:v})},add:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return l.call(this,{amount:Q.add(O[0].getAmount(),O[1].getAmount()),precision:O[0].getPrecision()})},subtract:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return l.call(this,{amount:Q.subtract(O[0].getAmount(),O[1].getAmount()),precision:O[0].getPrecision()})},multiply:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return l.call(this,{amount:Q.round(Q.multiply(this.getAmount(),v),O)})},divide:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return l.call(this,{amount:Q.round(Q.divide(this.getAmount(),v),O)})},percentage:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return jo(v),this.multiply(Q.divide(v,100),O)},allocate:function(v){var O=this;To(v);for(var w=v.reduce(function(N,T){return Q.add(N,T)}),m=this.getAmount(),x=v.map(function(N){var T=Math.floor(Q.divide(Q.multiply(O.getAmount(),N),w));return m=Q.subtract(m,T),l.call(O,{amount:T})}),P=0;m>0;)v[P]>0&&(x[P]=x[P].add(l.call(this,{amount:1})),m=Q.subtract(m,1)),P+=1;return x},convert:function(v){var O=this,w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=w.endpoint,x=m===void 0?f.endpoint:m,P=w.propertyPath,N=P===void 0?f.propertyPath||"rates.{{to}}":P,T=w.headers,D=T===void 0?f.headers:T,I=w.roundingMode,V=I===void 0?u:I,M=Object.assign({},{endpoint:x,propertyPath:N,headers:D,roundingMode:V});return Ao(M).getExchangeRate(this.getCurrency(),v).then(function(k){return ht(!gt(k),'No rate was found for the destination currency "'.concat(v,'".'),TypeError),l.call(O,{amount:Q.round(Q.multiply(O.getAmount(),parseFloat(k)),M.roundingMode),currency:v})})},equalsTo:function(v){return this.hasSameAmount(v)&&this.hasSameCurrency(v)},lessThan:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return O[0].getAmount()<O[1].getAmount()},lessThanOrEqual:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return O[0].getAmount()<=O[1].getAmount()},greaterThan:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return O[0].getAmount()>O[1].getAmount()},greaterThanOrEqual:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return O[0].getAmount()>=O[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(v){return this.getCurrency()===v.getCurrency()},hasSameAmount:function(v){var O=e.normalizePrecision([this,v]);return O[0].getAmount()===O[1].getAmount()},toFormat:function(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:s,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c,w=Fo(v);return this.toRoundedUnit(w.getMinimumFractionDigits(),O).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(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c,w=Math.pow(10,v);return Q.divide(Q.round(Q.multiply(this.toUnit(),w),O),w)},toObject:function(){return{amount:i,currency:n,precision:a}},toJSON:function(){return this.toObject()}}},Do=Object.assign(Mo,vo,mo,wo);const Tt=(e,r="PLN")=>{e=e.toString();const t=e.replace(",","."),i=Number(t)*100;return isNaN(i)?"0.00":Do({amount:Math.floor(i),currency:r}).toFormat("0,0.00")},Io=(e,r,t=1)=>{const i=parseFloat(e.toString());let n=!1,a=Tt(`${t*i}`);const o=`${Tt(`${a}`)}`;return i<parseFloat(r)&&(n=!0,a=`${Tt(`${r}`)}`),{displayPriceFrom:n,formattedEndPriceWithPriceMin:a,formattedEndPrice:o}};function Mt(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=Tt(`${u}`);return!r&&n===!1?null:t?h.jsxs("span",{style:{visibility:`${!r&&o?"hidden":"visible"}`},className:"",children:["\xA0",`+${c}`]}):r<s?h.jsxs("span",{className:"",children:["\xA0",`od ${c}`]}):h.jsx("span",{className:"",children:c})}const _o=(e,r,t)=>e==="1"&&r==="1"&&!t?"radio":t?"counter":"checkbox",Vo=e=>{const r=document.getElementById(e);r?r.scrollIntoView({behavior:"smooth"}):console.warn(`Error: scrollToId: id: ${e} not found in html structure`)},Wn=e=>`group--${e}`;function $o(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 O=d;c(d=v,O)}}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 zn=typeof window=="undefined"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?y.useEffect:y.useLayoutEffect;function Uo(e){const r=typeof e=="function"?$o(e):e,t=(i=r.getState,n=Object.is)=>{const[,a]=y.useReducer(w=>w+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)),zn(()=>{g&&(l.current=d),s.current=o,u.current=i,c.current=n,f.current=!1});const v=y.useRef(o);zn(()=>{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()}},m=r.subscribe(w);return r.getState()!==v.current&&w(),m},[]);const O=g?d:l.current;return y.useDebugValue(O),O};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 Ho=(e,r)=>({filter:{},unseenGroupsByFilter:[],setInitialFilter:t=>{e(()=>({filter:se({},t),unseenGroupsByFilter:[]}))},setFilter:(t,i)=>{e(({filter:n})=>({filter:Re(se({},n),{[t]:se(se({},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 O;const{selCtx:l,id:d,items:g=[]}=f,v=(O=s[l])==null?void 0:O[d];v&&o(`selected.${l}.${d}`,v.toString()),g.length>0&&u(g)})};u(i)}}),Bo=(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}))}}),Wo=(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:Re(se({},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!==ze.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!==ze.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!==ze.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}}),zo=(e,r)=>({expanded:{},toggleExpanded:(t,i,n)=>{const a=r().expanded[t+i+n];e(()=>({expanded:Re(se({},r().expanded),{[t+i+n]:a!==void 0?!a:!1})}))},resetExpanded:()=>{e(()=>({expanded:{}}))}}),Y=Uo((e,r)=>se(se(se(se({},Ho(e,r)),Bo(e)),Wo(e,r)),zo(e,r))),qo=(e,r,t,i)=>{const n=i[e+r+t];return n!==void 0?n:!0},Go=e=>{const{productItem:r,selected:t,parentCtx:i,nestedLvl:n,parentKind:a}=e,{walidationStatus:o,informationText:s}=ao(r,t),{walidationStatus:u,informationText:c}=no(r,t),{watch:f,setValue:l}=it(),[d,g]=y.useState([]),{items:v,selCtx:O,attrs:w={},details:m={},filter:x,fltCtx:P,id:N}=r,{name:T,description:D}=m.literals,I=Y($=>$.filter),V=Y($=>$.validateFilter),M=Y($=>$.uncheckFilteredProducts),k=Y($=>$.expanded),L=y.useMemo(()=>qo(O,N,i,k),[O,N,i,k]),_=Y($=>$.toggleExpanded),G=Y($=>$.checkFilteredProducts);y.useEffect(()=>{const $=V(x,P);M(x,v,$,f,l),G(x,v,$,f,l),g($)},[I]);const U=Y($=>$.setGroupsValidation),J=Y($=>$.isOnSubmitted),[re,z]=cr(r.selCtx,t,v),Z=x&&Object.keys(x).length>0&&d.length===0;U(i,O,w,z,re,a,n,!Z);const ne=o===Oe.OK,te=u===Oe.OK,W=!ne&&J&&!!s,K=!te&&J&&!!c;return Z?null:h.jsxs("div",{className:"pt-1 mb-3 configuration-group",id:Wn(O),children:[h.jsxs("div",{className:"flex text-xl font-semibold",children:[h.jsx("p",{className:"",children:T}),T&&T!==" "&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"ml-auto",children:h.jsx(Mt,{price:fr(t,r)})}),h.jsx("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:()=>_(O,N,i),children:h.jsx("polyline",{points:"18 15 12 9 6 15"})})]})]}),h.jsx("p",{className:`${D&&"mb-2"}`,children:D}),h.jsx("div",{className:"flex",children:h.jsxs("div",{children:[h.jsx(Dn,{isOkk:ne,isErr:W,info:s}),h.jsx(Dn,{isOkk:te,isErr:K,info:c})]})}),L&&h.jsx(hr,{productItems:v,nestedLvl:n+1,context:r})]})};function qn(e){const{value:r=0,add:t,subtract:i,disabledSubtract:n,disabledAdd:a,size:o="md"}=e;return h.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:[h.jsx("button",{type:"button",className:"quantity-button small",onClick:i,disabled:n,children:h.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:[h.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"}),h.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),h.jsx("span",{className:"font-semibold text-gray-700 product-quantity-value",children:r}),h.jsx("button",{className:"quantity-button small",type:"button",onClick:t,disabled:a,children:h.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:[h.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"}),h.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),h.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})})]})}function Gn(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 h.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:[h.jsx("input",Re(se({type:"checkbox",className:`simple-checkbox checkbox-${i} mr-4`,id:d},s(`selected.${o}.${a}`,{onChange:g=>{u(g)}})),{disabled:f,value:"1"})),l&&h.jsx("div",{className:"flex mr-2 w-20 max-h-24",children:h.jsx("img",{alt:"Product image",className:"max-w-full h-auto",src:l})}),h.jsx("label",{htmlFor:d,className:"flex justify-between items-center w-full",children:h.jsxs("div",{className:"relative",children:[h.jsx("p",{className:"w-full text-lg font-semibold",children:r}),h.jsx("p",{className:"text-sm text-gray-600",children:n})]})}),h.jsx("div",{className:"ml-auto",children:c}),h.jsx("label",{htmlFor:d,children:h.jsx(Mt,{price:parseFloat(t),addPlusBefore:!0,showIfPriceZero:!0,hiddenIfPriceZero:!0})})]})}function Kn(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 h.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:[h.jsx("input",Re(se({type:"radio",className:`simple-radio radio-${i} mr-4`,id:v},s(`radio.${v}`,{onChange:O=>{u(O)}})),{value:a,checked:c,disabled:l,readOnly:d})),g&&h.jsx("div",{className:"flex mr-2 w-20 max-h-24",children:h.jsx("img",{alt:"Product image",className:"max-w-full h-auto",src:g})}),h.jsx("label",{htmlFor:v,className:"flex justify-between items-center w-full",children:h.jsxs("div",{className:"relative",children:[h.jsx("p",{className:"w-full text-lg font-semibold",children:r}),h.jsx("p",{className:"text-sm text-gray-600",children:n})]})}),h.jsx("div",{className:"ml-auto",children:f}),h.jsx("label",{htmlFor:v,children:h.jsx(Mt,{price:parseFloat(t),addPlusBefore:!0,showIfPriceZero:!0,hiddenIfPriceZero:!0})})]})}const Ko=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:O,watch:w}=it(),m=w(`selected.${u}.${s}`);let x=0;m&&!isNaN(m)&&(x=Number(m));const P=Y(L=>L.isAddDisabled),N=Y(L=>L.isInputDisabled),T=()=>{O(`selected.${u}.${s}`,`${x+1}`)},D=()=>{O(`selected.${u}.${s}`,`${x-1}`)},I=Number(m)===0||!m,V=h.jsx(qn,{value:x,add:T,subtract:D,disabledSubtract:I,disabledAdd:P(u,m,l==null?void 0:l.qtyMax)||N(u)&&!m}),{selMin:M="",selMax:k=""}=d;return h.jsx("div",{children:M==="1"&&k==="1"?h.jsx(Kn,{description:o,productName:r,price:n,productId:s,selCtx:u,state:t,items:i,register:v,handleOnChange:f,checked:g,isDisabled:!1,children:V}):h.jsx(Gn,{description:o,productName:r,price:n,productId:s,selCtx:u,state:t,items:i,register:v,handleOnChange:c,isDisabled:N(u)&&!m||P(u,m,l==null?void 0:l.qtyMax)&&!m,children:V})})},Qn=(e,r)=>{Object.keys(e).forEach(t=>{r(`selected.${t}`,e[t])})},Rn=(e,r,t)=>{const i=r(`selected.${e}`);t(`selected.${e}`,Object.keys(i).reduce((n,a)=>(n[a]=!1,n),{}))},Jn=(e,r,t,i,n)=>{const{target:{checked:a}}=i,{selected:o={}}=n;if(a){Qn(o,e);const s=u=>{!Array.isArray(u)||u.map(c=>{if(c.state&&"selected"in c.state){const{state:{selected:f}}=c;Qn(f,e)}Array.isArray(c.items)&&s(c.items)})};s(t)}else{Object.keys(o).forEach(u=>{Rn(u,r,e)});const s=u=>{!Array.isArray(u)||u.map(c=>{const{selCtx:f}=c;r(`selected.${f}`)&&Rn(f,r,e),s(c.items)})};s(t)}},Qo=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}},Ro=e=>{var re;const{productItem:r,contextAttrs:t,selected:i,nestedLvl:n}=e,{register:a,watch:o,setValue:s,getValues:u}=it(),{items:c,id:f,selCtx:l,state:d={},attrs:g={},emit:v={},fltCtx:O,details:{media:w=[],literals:m},price:x=""}=r,P=Qo(r),{name:N,description:T}=m,D=Y(z=>z.isInputDisabled),I=Y(z=>z.setFilter),V=i[l]&&i[l][r.id]&&Number(i[l][r.id])>0,M=w.find(z=>z.name==="MAIN_IMG")||w[0]||{},k=z=>{Jn(s,u,c,z,d)},L=z=>{Jn(s,u,c,z,d);const{target:Z}=z,ne=Z.name,te=Z.defaultValue,W="selected."+ne.replace("radio.","").split("---")[0];s(W,{[te]:"1"})},_=o(`selected.${l}.${f}`);y.useEffect(()=>{_&&Object.keys(v).length!==0&&I(O,v)},[_]);const G=Nr.useTransition(Array.isArray(r.items)&&r.items.length>0&&_,{from:{opacity:0,transform:"translateY(-10px)"},enter:{opacity:1,transform:"translateY(0)"}});if(!r)return null;let U=x;(!U||parseFloat(U||"1")===0)&&((re=r==null?void 0:r.state)==null?void 0:re.selected)&&(U=`${fr(r.state.selected,r)||"0"}`);const J=()=>{switch(_o(t==null?void 0:t.selMin,t==null?void 0:t.selMax,t==null?void 0:t.allowMultiple)){case"counter":return h.jsx(Ko,{description:T,productName:N,price:U,productId:f,selCtx:l,state:d,items:c,handleOnChangeCheckBox:k,handleOnChangeRadio:L,checked:!!V,contextAttrs:t,productAttrs:P});case"radio":return h.jsx(Kn,{description:T,productName:N,price:U,productId:f,selCtx:l,state:d,items:c,register:a,handleOnChange:L,checked:!!V,isDisabled:!1,imgSrc:(M==null?void 0:M.url)||""});case"checkbox":return h.jsx(Gn,{description:T,productName:N,price:U,productId:f,selCtx:l,state:d,items:c,register:a,handleOnChange:k,isDisabled:D(l)&&!_,imgSrc:(M==null?void 0:M.url)||""});default:return null}};return h.jsxs(h.Fragment,{children:[J(),G((z,Z)=>Z&&h.jsx(Nr.animated.div,{className:`border-l-[2px] border-gray-300 ${n>1&&"ml-4 pl-4"}`,style:z,children:h.jsx(hr,{productItems:c,nestedLvl:n+1,context:r})},n+1))]})};function Jo(e){var f,l;const{productItem:r,nestedLvl:t,context:{attrs:i={},selCtx:n,kind:a}}=e,{kind:o}=r,{getValues:s}=it(),{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 ze.OPTIONS:case ze.CONFIG:return h.jsx(Go,{productItem:r,parentCtx:n,selected:u,nestedLvl:t,parentKind:a});case ze.PRODUCT:return h.jsx(Ro,{productItem:r,selected:u,nestedLvl:t,contextAttrs:i});default:return null}}const gr=99,Yn=3;function hr(e){const{productItems:r,nestedLvl:t=1,context:i}=e,n=i.kind!=="3e/product",[a,o]=y.useState(n?Yn:gr),{t:s}=Nt(),u=()=>{o(gr)},c=()=>{o(Yn)};return h.jsx("div",{children:r.map((f,l)=>{if(l<a)return h.jsxs("div",{children:[h.jsx(Jo,{productItem:f,nestedLvl:t,context:i},`${i.id}--${f.id}--${l}`),a===gr&&n&&r.length===l+1&&Zn(s("OS.ProductConfigurator.ShowLess"),c,!1)]},`${i.id}--${f.id}--${l}`);if(l===a)return Zn(s("OS.ProductConfigurator.ShowMore"),u,!0)})})}const Zn=(e,r,t)=>h.jsx("div",{className:"flex justify-center w-full",children:h.jsxs("button",{className:"flex px-2 text-lg font-semibold text-black",onClick:r,children:[e,h.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:[h.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"})," ",h.jsx("polyline",{points:"7 7 12 12 17 7"})," ",h.jsx("polyline",{points:"7 13 12 18 17 13"})]})]})},`${e}`),Yo=["id","selCtx","fltCtx"],Xn=".",ei="#dot",Zo=e=>e.replaceAll(Xn,ei),Xo=e=>e.replaceAll(ei,Xn),es=(e,r)=>ti(e,r,Zo),ts=(e,r)=>ti(e,r,Xo),ti=(e,r,t)=>{let i=r;if(Yo.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},ri=(e,r)=>(Object.keys(e).forEach(t=>{const i=e[t];e[t]=r(t,i),typeof i=="object"&&i!==null&&ri(i,r)}),e),rs=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=>ts("selected",e),is=()=>{const{watch:e}=it(),r=e("selected");return console.log("selected",r),h.jsxs("div",{className:"flex flex-col items-center py-4",children:[h.jsx("h2",{className:"mb-4 text-2xl font-bold tracking-wide",children:"Selected State"}),Object.keys(r).map(t=>h.jsx("div",{children:Object.values(r[t]).filter(i=>i).length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:"text-lg font-semibold",children:[t,":"]}),Object.keys(r[t]).map(i=>h.jsx(pe.default.Fragment,{children:r[t][i]&&h.jsxs("p",{children:[i,":",r[t][i].toString()]})},i))]})},t))]})};function ni(e){const{finalPrice:r,isBackIcon:t=!0,handleGoBack:i,displayPriceFrom:n=!1}=e,{t:a}=Nt(),o=Y(c=>c.mainProductCount),s=Y(c=>c.increaseCount),u=Y(c=>c.decreaseCount);return h.jsxs("div",{className:"flex justify-around items-center px-4 w-full h-16",children:[t&&h.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:[h.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:[h.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"}),h.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),h.jsx("line",{x1:"5",y1:"12",x2:"11",y2:"18"}),h.jsx("line",{x1:"5",y1:"12",x2:"11",y2:"6"})]}),h.jsx("span",{className:"uppercase",children:`${a("OS.ProductConfigurator.Back")}`})]}),h.jsx("div",{className:"px-3",children:h.jsx(qn,{value:o,add:s,subtract:u,disabledSubtract:o===1,size:"lg"})}),h.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:[h.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:[h.jsx("circle",{cx:"9",cy:"21",r:"1"})," ",h.jsx("circle",{cx:"20",cy:"21",r:"1"}),h.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?h.jsx("span",{children:`${a("OS.ProductConfigurator.Selected.Message.From")} ${r}`}):h.jsx("span",{className:"uppercase",children:`${a("OS.ProductConfigurator.Add")} ${r}`})]})]})}const Dt=640,ii=e=>{const{isModal:r=!1}=e,[t,i]=y.useState(window.innerWidth),[n,a]=y.useState(window.innerHeight),[o,s]=y.useState(window.innerWidth<=Dt),[u,c]=y.useState(window.innerWidth>Dt&&!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>Dt&&!r),s(window.innerWidth<=Dt)},[t,e,r]),{isSm:u,isMobile:o,width:t,windowHeight:n}};function ai(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=ai(e[r]))&&(i&&(i+=" "),i+=t);else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function pt(){for(var e=0,r,t,i="";e<arguments.length;)(r=arguments[e++])&&(t=ai(r))&&(i&&(i+=" "),i+=t);return i}function as(e){var te,W,K,$;const{product:r,handleAddToBasket:t,isModal:i,handleGoBack:n,showDebugState:a=!1}=e,{state:{selected:o={}}={},price:s,minPrice:u="0"}=r,c=Ji({defaultValues:{selected:o}}),{handleSubmit:f,getValues:l}=c,d=Y(H=>H.setIsOnSubmittedOnTrue),[g,v]=y.useState("auto"),[O,w]=y.useState(0),m=Y(H=>H.mainProductCount),x=Y(H=>H.getInvalidContextNames),P=Y(H=>H.filter);y.useEffect(()=>{w(1);const H=setTimeout(()=>{L||w(2)},250);return()=>{clearTimeout(H)}},[]),y.useEffect(()=>{console.log("filter",P)},[P]);const N=parseFloat(s)+fr(l("selected"),r),{displayPriceFrom:T,formattedEndPrice:D}=Io(N,u,m),I=H=>{d();const B=x();if(B.length)Vo(Wn(B[0])),console.log(B);else{console.log(l("selected"));const xe=ns(rs(l("selected")));console.log("decodedCleanedSelected: ",xe),t({price:N/m,quantity:m,selected:xe,filter:P})}},V=y.useRef(),M=y.useRef(),{isSm:k,isMobile:L,windowHeight:_}=ii({isModal:i}),G=h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:pt("px-4 w-full",k&&"sm:sticky sm:top-0 sm:w-2/5"),ref:V,children:[r.details.media&&r.details.media[0].url&&h.jsx("img",{className:pt("mx-auto mt-2 mb-6 max-h-[250px]",k&&"max-h-[450px]"),alt:r.details.literals.name,src:(te=r.details)==null?void 0:te.media[0].url}),h.jsx("div",{className:pt(!a&&"hidden"),children:h.jsx(is,{})})]}),h.jsxs("div",{className:pt("w-full",k&&"sm:w-3/5"),ref:M,children:[h.jsxs("div",{className:"items-center p-4 w-full",children:[h.jsxs("div",{className:"flex justify-between mb-4 w-full text-2xl font-semibold",children:[h.jsxs("span",{className:"",children:[r.details.literals.name," "]}),h.jsx(Mt,{price:N,minPrice:u})]}),h.jsx("span",{className:"text-gray-600",children:(W=r.details.literals)==null?void 0:W.description})]}),h.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)&&h.jsx(hr,{productItems:r.items,context:r}),h.jsx("div",{className:"sm:h-[64px]"})]}),k&&h.jsx("div",{className:"-mt-5 mb-2 bg-gray-100",children:h.jsx(ni,{finalPrice:D,isBackIcon:!1,handleGoBack:n,displayPriceFrom:T})})]})]}),U=(K=V==null?void 0:V.current)==null?void 0:K.clientHeight,J=($=M==null?void 0:M.current)==null?void 0:$.clientHeight,re=U+J;re>window.innerHeight*.8||isNaN(re)?g!=="80vh"&&v("80vh"):g!=="auto"&&v("auto"),console.log({height:U,height2:J,modalContentHeight:re,modalSizeStage:O});const z=`${_-64-56}px`,Z=!k,ne={"--mobile-submit-row-top":`${_-64-80}px`};return h.jsx(Ii,Re(se({},c),{children:h.jsxs("form",{id:"product-configurator-view",className:"w-full h-full",style:{overflow:"hidden",textAlign:"left"},onSubmit:f(I),children:[h.jsx("div",{className:pt("flex relative flex-col items-start w-full form-body stretch",!Z&&"sm:flex-row-reverse sm:pb-0",!L&&"mobile-scrollbar"),style:{height:`${L?z:g}`,minHeight:"400px",overflowY:`${i?"scroll":"visible"}`},children:G}),Z&&h.jsx("div",{className:`w-full h-16 bg-white sm:fixed sm:bottom-0 ${L?"submit-row-mobile":"submit-row"}`,style:ne,children:h.jsx(ni,{handleGoBack:n,finalPrice:D,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 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 os(e,r){if(!!e){if(typeof e=="string")return oi(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 oi(e,r)}}function oi(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=os(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.
|
|
3
|
+
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=In(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=In(r),i=t[0],n=t.slice(1),a=i;return n.forEach(function(o){a=a.greaterThan(o)?a:o}),a}};function Vn(e){return!isNaN(parseInt(e))&&isFinite(e)}function xo(e){return Vn(e)&&e<=100&&e>=0}function Co(e){return e.length>0&&e.every(function(r){return r>=0})&&e.some(function(r){return r>0})}function $n(e){return e%2===0}function Un(e){return Vn(e)&&!Number.isInteger(e)}function Po(){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 dt(e){return Math.abs(e)%1===.5}function No(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),ko(n,r.headers),n.send()})}function ko(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 gt(e){return typeof e=="undefined"}function Hn(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:".",t={};return Object.entries(e).forEach(function(i){if(ft(i[1])==="object"){var n=Hn(i[1]);Object.entries(n).forEach(function(a){t[i[0]+r+a[0]]=a[1]})}else t[i[0]]=i[1]}),t}function Eo(e){return Boolean(e)&&(ft(e)==="object"||typeof e=="function")&&typeof e.then=="function"}function Bn(){var e=function(i,n){var a=function(u){return Math.pow(10,Po(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 dt(i)&&$n(n)?n-1:n},HALF_EVEN:function(i){var n=Math.round(i);return dt(i)?$n(n)?n:n-1:n},HALF_UP:function(i){return Math.round(i)},HALF_DOWN:function(i){return dt(i)?Math.floor(i):Math.round(i)},HALF_TOWARDS_ZERO:function(i){return dt(i)?Math.sign(i)*Math.floor(Math.abs(i)):Math.round(i)},HALF_AWAY_FROM_ZERO:function(i){return dt(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 Un(i)||Un(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 Lo=Bn();function Fo(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!gt(i)}):[]},getMinimumFractionDigits:function(){var i=function(a){return a==="."};return gt(this.getMatches().find(i))?0:this.getMatches()[Lo.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 gt(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!gt(this.getMatches().find(function(i){return i===","}))}}}function Ao(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 No(r(e.endpoint,{from:n,to:a}),{headers:e.headers})};return{getExchangeRate:function(n,a){return(Eo(e.endpoint)?e.endpoint:t(n,a)).then(function(o){return Hn(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 jo(e){ht(xo(e),"You must provide a numeric value between 0 and 100.",RangeError)}function To(e){ht(Co(e),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}function dr(e){ht(Number.isInteger(e),"You must provide an integer.",TypeError)}var Q=Bn(),Mo=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;dr(i),dr(a);var o=e.globalLocale,s=e.globalFormat,u=e.globalRoundingMode,c=e.globalFormatRoundingMode,f=Object.assign({},e.globalExchangeRatesApi),l=function(v){var O=Object.assign({},Object.assign({},{amount:i,currency:n,precision:a},v),Object.assign({},{locale:this.locale},v));return Object.assign(e({amount:O.amount,currency:O.currency,precision:O.precision}),{locale:O.locale})},d=function(v){ht(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 O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;dr(v);var w=this.getPrecision(),m=v>w,x=m?Q.multiply:Q.divide,P=m?[v,w]:[w,v],N=Math.pow(10,Q.subtract.apply(Q,P));return l.call(this,{amount:Q.round(x(this.getAmount(),N),O),precision:v})},add:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return l.call(this,{amount:Q.add(O[0].getAmount(),O[1].getAmount()),precision:O[0].getPrecision()})},subtract:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return l.call(this,{amount:Q.subtract(O[0].getAmount(),O[1].getAmount()),precision:O[0].getPrecision()})},multiply:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return l.call(this,{amount:Q.round(Q.multiply(this.getAmount(),v),O)})},divide:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return l.call(this,{amount:Q.round(Q.divide(this.getAmount(),v),O)})},percentage:function(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return jo(v),this.multiply(Q.divide(v,100),O)},allocate:function(v){var O=this;To(v);for(var w=v.reduce(function(N,T){return Q.add(N,T)}),m=this.getAmount(),x=v.map(function(N){var T=Math.floor(Q.divide(Q.multiply(O.getAmount(),N),w));return m=Q.subtract(m,T),l.call(O,{amount:T})}),P=0;m>0;)v[P]>0&&(x[P]=x[P].add(l.call(this,{amount:1})),m=Q.subtract(m,1)),P+=1;return x},convert:function(v){var O=this,w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=w.endpoint,x=m===void 0?f.endpoint:m,P=w.propertyPath,N=P===void 0?f.propertyPath||"rates.{{to}}":P,T=w.headers,D=T===void 0?f.headers:T,I=w.roundingMode,V=I===void 0?u:I,M=Object.assign({},{endpoint:x,propertyPath:N,headers:D,roundingMode:V});return Ao(M).getExchangeRate(this.getCurrency(),v).then(function(k){return ht(!gt(k),'No rate was found for the destination currency "'.concat(v,'".'),TypeError),l.call(O,{amount:Q.round(Q.multiply(O.getAmount(),parseFloat(k)),M.roundingMode),currency:v})})},equalsTo:function(v){return this.hasSameAmount(v)&&this.hasSameCurrency(v)},lessThan:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return O[0].getAmount()<O[1].getAmount()},lessThanOrEqual:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return O[0].getAmount()<=O[1].getAmount()},greaterThan:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return O[0].getAmount()>O[1].getAmount()},greaterThanOrEqual:function(v){d.call(this,v);var O=e.normalizePrecision([this,v]);return O[0].getAmount()>=O[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(v){return this.getCurrency()===v.getCurrency()},hasSameAmount:function(v){var O=e.normalizePrecision([this,v]);return O[0].getAmount()===O[1].getAmount()},toFormat:function(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:s,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c,w=Fo(v);return this.toRoundedUnit(w.getMinimumFractionDigits(),O).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(v){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c,w=Math.pow(10,v);return Q.divide(Q.round(Q.multiply(this.toUnit(),w),O),w)},toObject:function(){return{amount:i,currency:n,precision:a}},toJSON:function(){return this.toObject()}}},Do=Object.assign(Mo,vo,mo,wo);const Tt=(e,r="PLN")=>{e=e.toString();const t=e.replace(",","."),i=Number(t)*100;return isNaN(i)?"0.00":Do({amount:Math.round(i),currency:r}).toFormat("0,0.00")},Io=(e,r,t=1)=>{const i=parseFloat(e.toString());let n=!1,a=Tt(`${t*i}`);const o=`${Tt(`${a}`)}`;return i<parseFloat(r)&&(n=!0,a=`${Tt(`${r}`)}`),{displayPriceFrom:n,formattedEndPriceWithPriceMin:a,formattedEndPrice:o}};function Mt(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=Tt(`${u}`);return!r&&n===!1?null:t?h.jsxs("span",{style:{visibility:`${!r&&o?"hidden":"visible"}`},className:"",children:["\xA0",`+${c}`]}):r<s?h.jsxs("span",{className:"",children:["\xA0",`od ${c}`]}):h.jsx("span",{className:"",children:c})}const _o=(e,r,t)=>e==="1"&&r==="1"&&!t?"radio":t?"counter":"checkbox",Vo=e=>{const r=document.getElementById(e);r?r.scrollIntoView({behavior:"smooth"}):console.warn(`Error: scrollToId: id: ${e} not found in html structure`)},Wn=e=>`group--${e}`;function $o(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 O=d;c(d=v,O)}}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 zn=typeof window=="undefined"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?y.useEffect:y.useLayoutEffect;function Uo(e){const r=typeof e=="function"?$o(e):e,t=(i=r.getState,n=Object.is)=>{const[,a]=y.useReducer(w=>w+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)),zn(()=>{g&&(l.current=d),s.current=o,u.current=i,c.current=n,f.current=!1});const v=y.useRef(o);zn(()=>{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()}},m=r.subscribe(w);return r.getState()!==v.current&&w(),m},[]);const O=g?d:l.current;return y.useDebugValue(O),O};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 Ho=(e,r)=>({filter:{},unseenGroupsByFilter:[],setInitialFilter:t=>{e(()=>({filter:se({},t),unseenGroupsByFilter:[]}))},setFilter:(t,i)=>{e(({filter:n})=>({filter:Re(se({},n),{[t]:se(se({},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 O;const{selCtx:l,id:d,items:g=[]}=f,v=(O=s[l])==null?void 0:O[d];v&&o(`selected.${l}.${d}`,v.toString()),g.length>0&&u(g)})};u(i)}}),Bo=(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}))}}),Wo=(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:Re(se({},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!==ze.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!==ze.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!==ze.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}}),zo=(e,r)=>({expanded:{},toggleExpanded:(t,i,n)=>{const a=r().expanded[t+i+n];e(()=>({expanded:Re(se({},r().expanded),{[t+i+n]:a!==void 0?!a:!1})}))},resetExpanded:()=>{e(()=>({expanded:{}}))}}),Y=Uo((e,r)=>se(se(se(se({},Ho(e,r)),Bo(e)),Wo(e,r)),zo(e,r))),qo=(e,r,t,i)=>{const n=i[e+r+t];return n!==void 0?n:!0},Go=e=>{const{productItem:r,selected:t,parentCtx:i,nestedLvl:n,parentKind:a}=e,{walidationStatus:o,informationText:s}=ao(r,t),{walidationStatus:u,informationText:c}=no(r,t),{watch:f,setValue:l}=it(),[d,g]=y.useState([]),{items:v,selCtx:O,attrs:w={},details:m={},filter:x,fltCtx:P,id:N}=r,{name:T,description:D}=m.literals,I=Y($=>$.filter),V=Y($=>$.validateFilter),M=Y($=>$.uncheckFilteredProducts),k=Y($=>$.expanded),L=y.useMemo(()=>qo(O,N,i,k),[O,N,i,k]),_=Y($=>$.toggleExpanded),G=Y($=>$.checkFilteredProducts);y.useEffect(()=>{const $=V(x,P);M(x,v,$,f,l),G(x,v,$,f,l),g($)},[I]);const U=Y($=>$.setGroupsValidation),J=Y($=>$.isOnSubmitted),[re,z]=cr(r.selCtx,t,v),Z=x&&Object.keys(x).length>0&&d.length===0;U(i,O,w,z,re,a,n,!Z);const ne=o===Oe.OK,te=u===Oe.OK,W=!ne&&J&&!!s,K=!te&&J&&!!c;return Z?null:h.jsxs("div",{className:"pt-1 mb-3 configuration-group",id:Wn(O),children:[h.jsxs("div",{className:"flex text-xl font-semibold",children:[h.jsx("p",{className:"",children:T}),T&&T!==" "&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"ml-auto",children:h.jsx(Mt,{price:fr(t,r)})}),h.jsx("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:()=>_(O,N,i),children:h.jsx("polyline",{points:"18 15 12 9 6 15"})})]})]}),h.jsx("p",{className:`${D&&"mb-2"}`,children:D}),h.jsx("div",{className:"flex",children:h.jsxs("div",{children:[h.jsx(Dn,{isOkk:ne,isErr:W,info:s}),h.jsx(Dn,{isOkk:te,isErr:K,info:c})]})}),L&&h.jsx(hr,{productItems:v,nestedLvl:n+1,context:r})]})};function qn(e){const{value:r=0,add:t,subtract:i,disabledSubtract:n,disabledAdd:a,size:o="md"}=e;return h.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:[h.jsx("button",{type:"button",className:"quantity-button small",onClick:i,disabled:n,children:h.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:[h.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"}),h.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),h.jsx("span",{className:"font-semibold text-gray-700 product-quantity-value",children:r}),h.jsx("button",{className:"quantity-button small",type:"button",onClick:t,disabled:a,children:h.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:[h.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"}),h.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),h.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})})]})}function Gn(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 h.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:[h.jsx("input",Re(se({type:"checkbox",className:`simple-checkbox checkbox-${i} mr-4`,id:d},s(`selected.${o}.${a}`,{onChange:g=>{u(g)}})),{disabled:f,value:"1"})),l&&h.jsx("div",{className:"flex mr-2 w-20 max-h-24",children:h.jsx("img",{alt:"Product image",className:"max-w-full h-auto",src:l})}),h.jsx("label",{htmlFor:d,className:"flex justify-between items-center w-full",children:h.jsxs("div",{className:"relative",children:[h.jsx("p",{className:"w-full text-lg font-semibold",children:r}),h.jsx("p",{className:"text-sm text-gray-600",children:n})]})}),h.jsx("div",{className:"ml-auto",children:c}),h.jsx("label",{htmlFor:d,children:h.jsx(Mt,{price:parseFloat(t),addPlusBefore:!0,showIfPriceZero:!0,hiddenIfPriceZero:!0})})]})}function Kn(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 h.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:[h.jsx("input",Re(se({type:"radio",className:`simple-radio radio-${i} mr-4`,id:v},s(`radio.${v}`,{onChange:O=>{u(O)}})),{value:a,checked:c,disabled:l,readOnly:d})),g&&h.jsx("div",{className:"flex mr-2 w-20 max-h-24",children:h.jsx("img",{alt:"Product image",className:"max-w-full h-auto",src:g})}),h.jsx("label",{htmlFor:v,className:"flex justify-between items-center w-full",children:h.jsxs("div",{className:"relative",children:[h.jsx("p",{className:"w-full text-lg font-semibold",children:r}),h.jsx("p",{className:"text-sm text-gray-600",children:n})]})}),h.jsx("div",{className:"ml-auto",children:f}),h.jsx("label",{htmlFor:v,children:h.jsx(Mt,{price:parseFloat(t),addPlusBefore:!0,showIfPriceZero:!0,hiddenIfPriceZero:!0})})]})}const Ko=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:O,watch:w}=it(),m=w(`selected.${u}.${s}`);let x=0;m&&!isNaN(m)&&(x=Number(m));const P=Y(L=>L.isAddDisabled),N=Y(L=>L.isInputDisabled),T=()=>{O(`selected.${u}.${s}`,`${x+1}`)},D=()=>{O(`selected.${u}.${s}`,`${x-1}`)},I=Number(m)===0||!m,V=h.jsx(qn,{value:x,add:T,subtract:D,disabledSubtract:I,disabledAdd:P(u,m,l==null?void 0:l.qtyMax)||N(u)&&!m}),{selMin:M="",selMax:k=""}=d;return h.jsx("div",{children:M==="1"&&k==="1"?h.jsx(Kn,{description:o,productName:r,price:n,productId:s,selCtx:u,state:t,items:i,register:v,handleOnChange:f,checked:g,isDisabled:!1,children:V}):h.jsx(Gn,{description:o,productName:r,price:n,productId:s,selCtx:u,state:t,items:i,register:v,handleOnChange:c,isDisabled:N(u)&&!m||P(u,m,l==null?void 0:l.qtyMax)&&!m,children:V})})},Qn=(e,r)=>{Object.keys(e).forEach(t=>{r(`selected.${t}`,e[t])})},Rn=(e,r,t)=>{const i=r(`selected.${e}`);t(`selected.${e}`,Object.keys(i).reduce((n,a)=>(n[a]=!1,n),{}))},Jn=(e,r,t,i,n)=>{const{target:{checked:a}}=i,{selected:o={}}=n;if(a){Qn(o,e);const s=u=>{!Array.isArray(u)||u.map(c=>{if(c.state&&"selected"in c.state){const{state:{selected:f}}=c;Qn(f,e)}Array.isArray(c.items)&&s(c.items)})};s(t)}else{Object.keys(o).forEach(u=>{Rn(u,r,e)});const s=u=>{!Array.isArray(u)||u.map(c=>{const{selCtx:f}=c;r(`selected.${f}`)&&Rn(f,r,e),s(c.items)})};s(t)}},Qo=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}},Ro=e=>{var re;const{productItem:r,contextAttrs:t,selected:i,nestedLvl:n}=e,{register:a,watch:o,setValue:s,getValues:u}=it(),{items:c,id:f,selCtx:l,state:d={},attrs:g={},emit:v={},fltCtx:O,details:{media:w=[],literals:m},price:x=""}=r,P=Qo(r),{name:N,description:T}=m,D=Y(z=>z.isInputDisabled),I=Y(z=>z.setFilter),V=i[l]&&i[l][r.id]&&Number(i[l][r.id])>0,M=w.find(z=>z.name==="MAIN_IMG")||w[0]||{},k=z=>{Jn(s,u,c,z,d)},L=z=>{Jn(s,u,c,z,d);const{target:Z}=z,ne=Z.name,te=Z.defaultValue,W="selected."+ne.replace("radio.","").split("---")[0];s(W,{[te]:"1"})},_=o(`selected.${l}.${f}`);y.useEffect(()=>{_&&Object.keys(v).length!==0&&I(O,v)},[_]);const G=Nr.useTransition(Array.isArray(r.items)&&r.items.length>0&&_,{from:{opacity:0,transform:"translateY(-10px)"},enter:{opacity:1,transform:"translateY(0)"}});if(!r)return null;let U=x;(!U||parseFloat(U||"1")===0)&&((re=r==null?void 0:r.state)==null?void 0:re.selected)&&(U=`${fr(r.state.selected,r)||"0"}`);const J=()=>{switch(_o(t==null?void 0:t.selMin,t==null?void 0:t.selMax,t==null?void 0:t.allowMultiple)){case"counter":return h.jsx(Ko,{description:T,productName:N,price:U,productId:f,selCtx:l,state:d,items:c,handleOnChangeCheckBox:k,handleOnChangeRadio:L,checked:!!V,contextAttrs:t,productAttrs:P});case"radio":return h.jsx(Kn,{description:T,productName:N,price:U,productId:f,selCtx:l,state:d,items:c,register:a,handleOnChange:L,checked:!!V,isDisabled:!1,imgSrc:(M==null?void 0:M.url)||""});case"checkbox":return h.jsx(Gn,{description:T,productName:N,price:U,productId:f,selCtx:l,state:d,items:c,register:a,handleOnChange:k,isDisabled:D(l)&&!_,imgSrc:(M==null?void 0:M.url)||""});default:return null}};return h.jsxs(h.Fragment,{children:[J(),G((z,Z)=>Z&&h.jsx(Nr.animated.div,{className:`border-l-[2px] border-gray-300 ${n>1&&"ml-4 pl-4"}`,style:z,children:h.jsx(hr,{productItems:c,nestedLvl:n+1,context:r})},n+1))]})};function Jo(e){var f,l;const{productItem:r,nestedLvl:t,context:{attrs:i={},selCtx:n,kind:a}}=e,{kind:o}=r,{getValues:s}=it(),{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 ze.OPTIONS:case ze.CONFIG:return h.jsx(Go,{productItem:r,parentCtx:n,selected:u,nestedLvl:t,parentKind:a});case ze.PRODUCT:return h.jsx(Ro,{productItem:r,selected:u,nestedLvl:t,contextAttrs:i});default:return null}}const gr=99,Yn=3;function hr(e){const{productItems:r,nestedLvl:t=1,context:i}=e,n=i.kind!=="3e/product",[a,o]=y.useState(n?Yn:gr),{t:s}=Nt(),u=()=>{o(gr)},c=()=>{o(Yn)};return h.jsx("div",{children:r.map((f,l)=>{if(l<a)return h.jsxs("div",{children:[h.jsx(Jo,{productItem:f,nestedLvl:t,context:i},`${i.id}--${f.id}--${l}`),a===gr&&n&&r.length===l+1&&Zn(s("OS.ProductConfigurator.ShowLess"),c,!1)]},`${i.id}--${f.id}--${l}`);if(l===a)return Zn(s("OS.ProductConfigurator.ShowMore"),u,!0)})})}const Zn=(e,r,t)=>h.jsx("div",{className:"flex justify-center w-full",children:h.jsxs("button",{className:"flex px-2 text-lg font-semibold text-black",onClick:r,children:[e,h.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:[h.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"})," ",h.jsx("polyline",{points:"7 7 12 12 17 7"})," ",h.jsx("polyline",{points:"7 13 12 18 17 13"})]})]})},`${e}`),Yo=["id","selCtx","fltCtx"],Xn=".",ei="#dot",Zo=e=>e.replaceAll(Xn,ei),Xo=e=>e.replaceAll(ei,Xn),es=(e,r)=>ti(e,r,Zo),ts=(e,r)=>ti(e,r,Xo),ti=(e,r,t)=>{let i=r;if(Yo.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},ri=(e,r)=>(Object.keys(e).forEach(t=>{const i=e[t];e[t]=r(t,i),typeof i=="object"&&i!==null&&ri(i,r)}),e),rs=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=>ts("selected",e),is=()=>{const{watch:e}=it(),r=e("selected");return console.log("selected",r),h.jsxs("div",{className:"flex flex-col items-center py-4",children:[h.jsx("h2",{className:"mb-4 text-2xl font-bold tracking-wide",children:"Selected State"}),Object.keys(r).map(t=>h.jsx("div",{children:Object.values(r[t]).filter(i=>i).length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:"text-lg font-semibold",children:[t,":"]}),Object.keys(r[t]).map(i=>h.jsx(pe.default.Fragment,{children:r[t][i]&&h.jsxs("p",{children:[i,":",r[t][i].toString()]})},i))]})},t))]})};function ni(e){const{finalPrice:r,isBackIcon:t=!0,handleGoBack:i,displayPriceFrom:n=!1}=e,{t:a}=Nt(),o=Y(c=>c.mainProductCount),s=Y(c=>c.increaseCount),u=Y(c=>c.decreaseCount);return h.jsxs("div",{className:"flex justify-around items-center px-4 w-full h-16",children:[t&&h.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:[h.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:[h.jsx("path",{stroke:"none",d:"M0 0h24v24H0z"}),h.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),h.jsx("line",{x1:"5",y1:"12",x2:"11",y2:"18"}),h.jsx("line",{x1:"5",y1:"12",x2:"11",y2:"6"})]}),h.jsx("span",{className:"uppercase",children:`${a("OS.ProductConfigurator.Back")}`})]}),h.jsx("div",{className:"px-3",children:h.jsx(qn,{value:o,add:s,subtract:u,disabledSubtract:o===1,size:"lg"})}),h.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:[h.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:[h.jsx("circle",{cx:"9",cy:"21",r:"1"})," ",h.jsx("circle",{cx:"20",cy:"21",r:"1"}),h.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?h.jsx("span",{children:`${a("OS.ProductConfigurator.Selected.Message.From")} ${r}`}):h.jsx("span",{className:"uppercase",children:`${a("OS.ProductConfigurator.Add")} ${r}`})]})]})}const Dt=640,ii=e=>{const{isModal:r=!1}=e,[t,i]=y.useState(window.innerWidth),[n,a]=y.useState(window.innerHeight),[o,s]=y.useState(window.innerWidth<=Dt),[u,c]=y.useState(window.innerWidth>Dt&&!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>Dt&&!r),s(window.innerWidth<=Dt)},[t,e,r]),{isSm:u,isMobile:o,width:t,windowHeight:n}};function ai(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=ai(e[r]))&&(i&&(i+=" "),i+=t);else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function pt(){for(var e=0,r,t,i="";e<arguments.length;)(r=arguments[e++])&&(t=ai(r))&&(i&&(i+=" "),i+=t);return i}function as(e){var te,W,K,$;const{product:r,handleAddToBasket:t,isModal:i,handleGoBack:n,showDebugState:a=!1}=e,{state:{selected:o={}}={},price:s,minPrice:u="0"}=r,c=Ji({defaultValues:{selected:o}}),{handleSubmit:f,getValues:l}=c,d=Y(H=>H.setIsOnSubmittedOnTrue),[g,v]=y.useState("auto"),[O,w]=y.useState(0),m=Y(H=>H.mainProductCount),x=Y(H=>H.getInvalidContextNames),P=Y(H=>H.filter);y.useEffect(()=>{w(1);const H=setTimeout(()=>{L||w(2)},250);return()=>{clearTimeout(H)}},[]),y.useEffect(()=>{console.log("filter",P)},[P]);const N=parseFloat(s)+fr(l("selected"),r),{displayPriceFrom:T,formattedEndPrice:D}=Io(N,u,m),I=H=>{d();const B=x();if(B.length)Vo(Wn(B[0])),console.log(B);else{console.log(l("selected"));const xe=ns(rs(l("selected")));console.log("decodedCleanedSelected: ",xe),t({price:N/m,quantity:m,selected:xe,filter:P})}},V=y.useRef(),M=y.useRef(),{isSm:k,isMobile:L,windowHeight:_}=ii({isModal:i}),G=h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:pt("px-4 w-full",k&&"sm:sticky sm:top-0 sm:w-2/5"),ref:V,children:[r.details.media&&r.details.media[0].url&&h.jsx("img",{className:pt("mx-auto mt-2 mb-6 max-h-[250px]",k&&"max-h-[450px]"),alt:r.details.literals.name,src:(te=r.details)==null?void 0:te.media[0].url}),h.jsx("div",{className:pt(!a&&"hidden"),children:h.jsx(is,{})})]}),h.jsxs("div",{className:pt("w-full",k&&"sm:w-3/5"),ref:M,children:[h.jsxs("div",{className:"items-center p-4 w-full",children:[h.jsxs("div",{className:"flex justify-between mb-4 w-full text-2xl font-semibold",children:[h.jsxs("span",{className:"",children:[r.details.literals.name," "]}),h.jsx(Mt,{price:N,minPrice:u})]}),h.jsx("span",{className:"text-gray-600",children:(W=r.details.literals)==null?void 0:W.description})]}),h.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)&&h.jsx(hr,{productItems:r.items,context:r}),h.jsx("div",{className:"sm:h-[64px]"})]}),k&&h.jsx("div",{className:"-mt-5 mb-2 bg-gray-100",children:h.jsx(ni,{finalPrice:D,isBackIcon:!1,handleGoBack:n,displayPriceFrom:T})})]})]}),U=(K=V==null?void 0:V.current)==null?void 0:K.clientHeight,J=($=M==null?void 0:M.current)==null?void 0:$.clientHeight,re=U+J;re>window.innerHeight*.8||isNaN(re)?g!=="80vh"&&v("80vh"):g!=="auto"&&v("auto"),console.log({height:U,height2:J,modalContentHeight:re,modalSizeStage:O});const z=`${_-64-56}px`,Z=!k,ne={"--mobile-submit-row-top":`${_-64-80}px`};return h.jsx(Ii,Re(se({},c),{children:h.jsxs("form",{id:"product-configurator-view",className:"w-full h-full",style:{overflow:"hidden",textAlign:"left"},onSubmit:f(I),children:[h.jsx("div",{className:pt("flex relative flex-col items-start w-full form-body stretch",!Z&&"sm:flex-row-reverse sm:pb-0",!L&&"mobile-scrollbar"),style:{height:`${L?z:g}`,minHeight:"400px",overflowY:`${i?"scroll":"visible"}`},children:G}),Z&&h.jsx("div",{className:`w-full h-16 bg-white sm:fixed sm:bottom-0 ${L?"submit-row-mobile":"submit-row"}`,style:ne,children:h.jsx(ni,{handleGoBack:n,finalPrice:D,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 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 os(e,r){if(!!e){if(typeof e=="string")return oi(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 oi(e,r)}}function oi(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=os(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
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 Le(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,Le),o}var _e;(function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"})(_e||(_e={}));var he;(function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"})(he||(he={}));function Ve(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 It(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=qe(r,["static"]);if(f)return It(l,t,i,s)}if(u&_e.RenderStrategy){var d,g=r.unmount,v=g===void 0?!0:g,O=qe(r,["unmount"]),w=v?he.Unmount:he.Hidden;return Le(w,(d={},d[he.Unmount]=function(){return null},d[he.Hidden]=function(){return It(Se({},O,{hidden:!0,style:{display:"none"}}),t,i,s)},d))}return It(r,t,i,s)}function It(e,r,t,i){var n;r===void 0&&(r={});var a=pr(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===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
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(`
|
|
6
6
|
`)].join(`
|