@nizza/core 0.5.3 → 0.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";var Fr=Object.defineProperty;var Ar=(t,e,n)=>e in t?Fr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var T=(t,e,n)=>(Ar(t,typeof e!="symbol"?e+"":e,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("react"),Er=require("react-dom"),Cr=require("react/jsx-runtime");function Tr(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const X=Tr($);var K={NZ_AWS_REGION:"us-east-1",NZ_VTEX_PROJECT:"/Users/jbermudez/TODO/PROJECTS/live-shopping",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};let xr=0;function Rr(t,e){const n=`atom${++xr}`,i={toString:()=>n};return typeof t=="function"?i.read=t:(i.init=t,i.read=Dr,i.write=Lr),e&&(i.write=e),i}function Dr(t){return t(this)}function Lr(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}const qt=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,Wt=t=>"init"in t,Jt=t=>!!t.write,bt=new WeakMap,Pr=(t,e)=>{bt.set(t,e),t.catch(()=>{}).finally(()=>bt.delete(t))},zn=(t,e)=>{const n=bt.get(t);n&&(bt.delete(t),n(e))},Kn=(t,e)=>{t.status="fulfilled",t.value=e},Gn=(t,e)=>{t.status="rejected",t.reason=e},Ir=t=>typeof(t==null?void 0:t.then)=="function",$e=(t,e)=>!!t&&"v"in t&&"v"in e&&Object.is(t.v,e.v),Qn=(t,e)=>!!t&&"e"in t&&"e"in e&&Object.is(t.e,e.e),we=t=>!!t&&"v"in t&&t.v instanceof Promise,Vr=(t,e)=>"v"in t&&"v"in e&&t.v.orig&&t.v.orig===e.v.orig,dt=t=>{if("e"in t)throw t.e;return t.v},Li=()=>{const t=new WeakMap,e=new WeakMap,n=new Map;let i,a;(K?"production":void 0)!=="production"&&(i=new Set,a=new Set);const r=m=>t.get(m),s=(m,y)=>{(K?"production":void 0)!=="production"&&Object.freeze(y);const S=r(m);if(t.set(m,y),n.has(m)||n.set(m,S),we(S)){const h="v"in y?y.v instanceof Promise?y.v:Promise.resolve(y.v):Promise.reject(y.e);S.v!==h&&zn(S.v,h)}},o=(m,y,S,h)=>{const b=new Map(h?y.d:null);let F=!1;S.forEach((p,A)=>{!p&&qt(m,A)&&(p=y),p?(b.set(A,p),y.d.get(A)!==p&&(F=!0)):(K?"production":void 0)!=="production"&&console.warn("[Bug] atom state not found")}),(F||y.d.size!==b.size)&&(y.d=b)},l=(m,y,S,h)=>{const b=r(m),F={d:(b==null?void 0:b.d)||new Map,v:y};if(S&&o(m,F,S,h),$e(b,F)&&b.d===F.d)return b;if(we(b)&&we(F)&&Vr(b,F)){if(b.d===F.d)return b;F.v=b.v}return s(m,F),F},u=(m,y,S,h)=>{if(Ir(y)){let b;const F=()=>{const A=r(m);if(!we(A)||A.v!==p)return;const U=l(m,p,S);e.has(m)&&A.d!==U.d&&C(m,U,A.d)},p=new Promise((A,U)=>{let D=!1;y.then(x=>{D||(D=!0,Kn(p,x),A(x),F())},x=>{D||(D=!0,Gn(p,x),U(x),F())}),b=x=>{D||(D=!0,x.then(B=>Kn(p,B),B=>Gn(p,B)),A(x))}});return p.orig=y,p.status="pending",Pr(p,A=>{A&&b(A),h==null||h()}),l(m,p,S,!0)}return l(m,y,S)},d=(m,y,S)=>{const h=r(m),b={d:(h==null?void 0:h.d)||new Map,e:y};return S&&o(m,b,S),Qn(h,b)&&h.d===b.d?h:(s(m,b),b)},f=(m,y)=>{const S=r(m);if(!y&&S&&(e.has(m)||Array.from(S.d).every(([D,x])=>{if(D===m)return!0;const B=f(D);return B===x||$e(B,x)})))return S;const h=new Map;let b=!0;const F=D=>{if(qt(m,D)){const B=r(D);if(B)return h.set(D,B),dt(B);if(Wt(D))return h.set(D,void 0),D.init;throw new Error("no atom init")}const x=f(D);return h.set(D,x),dt(x)};let p,A;const U={get signal(){return p||(p=new AbortController),p.signal},get setSelf(){return(K?"production":void 0)!=="production"&&!Jt(m)&&console.warn("setSelf function cannot be used with read-only atom"),!A&&Jt(m)&&(A=(...D)=>{if((K?"production":void 0)!=="production"&&b&&console.warn("setSelf function cannot be called in sync"),!b)return R(m,...D)}),A}};try{const D=m.read(F,U);return u(m,D,h,()=>p==null?void 0:p.abort())}catch(D){return d(m,D,h)}finally{b=!1}},c=m=>dt(f(m)),_=m=>{let y=e.get(m);return y||(y=P(m)),y},O=(m,y)=>!y.l.size&&(!y.t.size||y.t.size===1&&y.t.has(m)),g=m=>{const y=e.get(m);y&&O(m,y)&&w(m)},k=m=>{const y=p=>{var A;const U=new Set((A=e.get(p))==null?void 0:A.t);return n.forEach((D,x)=>{var B;(B=r(x))!=null&&B.d.has(p)&&U.add(x)}),U},S=new Array,h=new Set,b=p=>{if(!h.has(p)){h.add(p);for(const A of y(p))p!==A&&b(A);S.push(p)}};b(m);const F=new Set([m]);for(let p=S.length-1;p>=0;--p){const A=S[p],U=r(A);if(!U)continue;let D=!1;for(const x of U.d.keys())if(x!==A&&F.has(x)){D=!0;break}if(D){const x=f(A,!0);$e(U,x)||F.add(A)}}},N=(m,...y)=>{let S=!0;const h=p=>dt(f(p)),b=(p,...A)=>{let U;if(qt(m,p)){if(!Wt(p))throw new Error("atom not writable");const D=r(p),x=u(p,A[0]);$e(D,x)||k(p)}else U=N(p,...A);if(!S){const D=I();(K?"production":void 0)!=="production"&&i.forEach(x=>x({type:"async-write",flushed:D}))}return U},F=m.write(h,b,...y);return S=!1,F},R=(m,...y)=>{const S=N(m,...y),h=I();return(K?"production":void 0)!=="production"&&i.forEach(b=>b({type:"write",flushed:h})),S},P=(m,y,S)=>{var h;const b=S||[];(h=r(m))==null||h.d.forEach((p,A)=>{const U=e.get(A);U?U.t.add(m):A!==m&&P(A,m,b)}),f(m);const F={t:new Set(y&&[y]),l:new Set};if(e.set(m,F),(K?"production":void 0)!=="production"&&a.add(m),Jt(m)&&m.onMount){const{onMount:p}=m;b.push(()=>{const A=p((...U)=>R(m,...U));A&&(F.u=A)})}return S||b.forEach(p=>p()),F},w=m=>{var y;const S=(y=e.get(m))==null?void 0:y.u;S&&S(),e.delete(m),(K?"production":void 0)!=="production"&&a.delete(m);const h=r(m);h?(we(h)&&zn(h.v),h.d.forEach((b,F)=>{if(F!==m){const p=e.get(F);p&&(p.t.delete(m),O(F,p)&&w(F))}})):(K?"production":void 0)!=="production"&&console.warn("[Bug] could not find atom state to unmount",m)},C=(m,y,S)=>{const h=new Set(y.d.keys()),b=new Set;S==null||S.forEach((F,p)=>{if(h.has(p)){h.delete(p);return}b.add(p);const A=e.get(p);A&&A.t.delete(m)}),h.forEach(F=>{const p=e.get(F);p?p.t.add(m):e.has(m)&&P(F,m)}),b.forEach(F=>{const p=e.get(F);p&&O(F,p)&&w(F)})},I=()=>{let m;for((K?"production":void 0)!=="production"&&(m=new Set);n.size;){const y=Array.from(n);n.clear(),y.forEach(([S,h])=>{const b=r(S);if(b){const F=e.get(S);F&&b.d!==(h==null?void 0:h.d)&&C(S,b,h==null?void 0:h.d),F&&!(!we(h)&&($e(h,b)||Qn(h,b)))&&(F.l.forEach(p=>p()),(K?"production":void 0)!=="production"&&m.add(S))}else(K?"production":void 0)!=="production"&&console.warn("[Bug] no atom state to flush")})}if((K?"production":void 0)!=="production")return m},j=(m,y)=>{const S=_(m),h=I(),b=S.l;return b.add(y),(K?"production":void 0)!=="production"&&i.forEach(F=>F({type:"sub",flushed:h})),()=>{b.delete(y),g(m),(K?"production":void 0)!=="production"&&i.forEach(F=>F({type:"unsub"}))}};return(K?"production":void 0)!=="production"?{get:c,set:R,sub:j,dev_subscribe_store:(m,y)=>{if(y!==2)throw new Error("The current StoreListener revision is 2.");return i.add(m),()=>{i.delete(m)}},dev_get_mounted_atoms:()=>a.values(),dev_get_atom_state:m=>t.get(m),dev_get_mounted:m=>e.get(m),dev_restore_atoms:m=>{for(const[S,h]of m)Wt(S)&&(u(S,h),k(S));const y=I();i.forEach(S=>S({type:"restore",flushed:y}))}}:{get:c,set:R,sub:j}};let Zt;(K?"production":void 0)!=="production"&&(typeof globalThis.__NUMBER_OF_JOTAI_INSTANCES__=="number"?++globalThis.__NUMBER_OF_JOTAI_INSTANCES__:globalThis.__NUMBER_OF_JOTAI_INSTANCES__=1);const jr=()=>(Zt||((K?"production":void 0)!=="production"&&globalThis.__NUMBER_OF_JOTAI_INSTANCES__!==1&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"),Zt=Li()),Zt);var Ur={NZ_AWS_REGION:"us-east-1",NZ_VTEX_PROJECT:"/Users/jbermudez/TODO/PROJECTS/live-shopping",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Mr=$.createContext(void 0),Pi=t=>{const e=$.useContext(Mr);return(t==null?void 0:t.store)||e||jr()},$r=t=>typeof(t==null?void 0:t.then)=="function",Br=$.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t)});function zr(t,e){const n=Pi(e),[[i,a,r],s]=$.useReducer(u=>{const d=n.get(t);return Object.is(u[0],d)&&u[1]===n&&u[2]===t?u:[d,n,t]},void 0,()=>[n.get(t),n,t]);let o=i;(a!==n||r!==t)&&(s(),o=n.get(t));const l=e==null?void 0:e.delay;return $.useEffect(()=>{const u=n.sub(t,()=>{if(typeof l=="number"){setTimeout(s,l);return}s()});return s(),u},[n,t,l]),$.useDebugValue(o),$r(o)?Br(o):o}function Kr(t,e){const n=Pi(e);return $.useCallback((...a)=>{if((Ur?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...a)},[n,t])}function Gr(t,e){return[zr(t,e),Kr(t,e)]}const Pt=Rr(null);Pt.debugLabel="accountAtom";var Qr={NZ_AWS_REGION:"us-east-1",NZ_VTEX_PROJECT:"/Users/jbermudez/TODO/PROJECTS/live-shopping",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{NZ_AWS_REGION:Hr,NZ_BACKOFFICE_BACK_URL:qr,NZ_CORE_SERVICES_GRAPHQL_URL:Wr,NZ_CORE_SERVICES_REST_URL:Jr}=Qr,Zr={AWS:{region:Hr,cognito:{userPoolId:"us-east-1_EZ7wuZ4ig",userPoolWebClientId:"2jok7cst8ebf6ppscrhji57gvr"}},apiUrls:{restV1:qr||"https://b133h34s56.execute-api.us-east-1.amazonaws.com",restV2:Jr||"https://core-services-prod.nizza.com/api",graphql:Wr||"https://core-services-prod.nizza.com/graphql",corsProxy:"https://3hvqfl2xcg.execute-api.us-east-1.amazonaws.com"},publicUrls:{platformSite:"https://platform.nizza.com",nizzaCdn:"https://cdn.nizza.com",bundleSite:"https://bundle.nizza.com",wssIVSChat:"wss://edge.ivschat.us-east-1.amazonaws.com"}};async function Nn(t){const{url:e,method:n="GET",body:i,raw:a=!1,contentTypeJson:r=!0,timeout:s,...o}=t,l=r&&!t.headers?new Headers({"content-type":"application/json"}):t.headers;try{const u=new AbortController,{signal:d}=u;let f;const c=fetch(e,{method:n,headers:l,body:i,signal:d,...o});s&&(f=setTimeout(()=>{u.abort()},s));const _=await c;if(a)return _;const O=await _.json();if(clearTimeout(f),!_.ok){const g=O?JSON.stringify(O):_.statusText;throw new Error(g)}return O}catch(u){throw console.error("[CustomFetch] ",u),u}}const Xr=t=>Nn({...t,contentTypeJson:!1,raw:!1});function Yr(t,e,n){fetch(e).then(i=>i.blob()).then(i=>Ii(i,`${t}.${n}`))}const Ii=(t,e,n)=>{const i=[t],a=new Blob(i,{type:n!=null?n:"application/octet-stream"});if(typeof window.navigator.msSaveBlob!="undefined")return window.navigator.msSaveBlob(a,e);const r=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(a):window.webkitURL.createObjectURL(a),s=document.createElement("a");return s.style.display="none",s.href=r,s.setAttribute("download",e),typeof s.download=="undefined"&&s.setAttribute("target","_blank"),document.body.appendChild(s),s.click(),setTimeout(()=>{document.body.removeChild(s),window.URL.revokeObjectURL(r)},200)};function L(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];throw new Error(typeof t=="number"?"[MobX] minified error nr: "+t+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+t)}var es={};function On(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:es}var Vi=Object.assign,St=Object.getOwnPropertyDescriptor,re=Object.defineProperty,It=Object.prototype,sn=[];Object.freeze(sn);var ji={};Object.freeze(ji);var ts=typeof Proxy!="undefined",ns=Object.toString();function Ui(){ts||L("Proxy not available")}function Mi(t){var e=!1;return function(){if(!e)return e=!0,t.apply(this,arguments)}}var Te=function(){};function te(t){return typeof t=="function"}function ge(t){var e=typeof t;switch(e){case"string":case"symbol":case"number":return!0}return!1}function Vt(t){return t!==null&&typeof t=="object"}function he(t){if(!Vt(t))return!1;var e=Object.getPrototypeOf(t);if(e==null)return!0;var n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n.toString()===ns}function $i(t){var e=t==null?void 0:t.constructor;return e?e.name==="GeneratorFunction"||e.displayName==="GeneratorFunction":!1}function jt(t,e,n){re(t,e,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Bi(t,e,n){re(t,e,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Se(t,e){var n="isMobX"+t;return e.prototype[n]=!0,function(i){return Vt(i)&&i[n]===!0}}function Ie(t){return t instanceof Map}function it(t){return t instanceof Set}var zi=typeof Object.getOwnPropertySymbols!="undefined";function is(t){var e=Object.keys(t);if(!zi)return e;var n=Object.getOwnPropertySymbols(t);return n.length?[].concat(e,n.filter(function(i){return It.propertyIsEnumerable.call(t,i)})):e}var Ut=typeof Reflect!="undefined"&&Reflect.ownKeys?Reflect.ownKeys:zi?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames;function Ki(t){return t===null?null:typeof t=="object"?""+t:t}function de(t,e){return It.hasOwnProperty.call(t,e)}var as=Object.getOwnPropertyDescriptors||function(e){var n={};return Ut(e).forEach(function(i){n[i]=St(e,i)}),n};function Hn(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,os(i.key),i)}}function wn(t,e,n){return e&&Hn(t.prototype,e),n&&Hn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ke(){return ke=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},ke.apply(this,arguments)}function Gi(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,on(t,e)}function on(t,e){return on=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,a){return i.__proto__=a,i},on(t,e)}function Xt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rs(t,e){if(t){if(typeof t=="string")return qn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qn(t,e)}}function qn(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function xe(t,e){var n=typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=rs(t))||e&&t&&typeof t.length=="number"){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ss(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function os(t){var e=ss(t,"string");return typeof e=="symbol"?e:String(e)}var ie=Symbol("mobx-stored-annotations");function se(t){function e(n,i){if(at(i))return t.decorate_20223_(n,i);Ve(n,i,t)}return Object.assign(e,t)}function Ve(t,e,n){de(t,ie)||jt(t,ie,ke({},t[ie])),vs(n)||(t[ie][e]=n)}function ls(t){return de(t,ie)||jt(t,ie,ke({},t[ie])),t[ie]}function at(t){return typeof t=="object"&&typeof t.kind=="string"}var E=Symbol("mobx administration"),rt=function(){function t(n){n===void 0&&(n="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=V.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var e=t.prototype;return e.onBO=function(){this.onBOL&&this.onBOL.forEach(function(i){return i()})},e.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(i){return i()})},e.reportObserved=function(){return da(this)},e.reportChanged=function(){J(),ca(this),Z()},e.toString=function(){return this.name_},t}(),Fn=Se("Atom",rt);function Qi(t,e,n){e===void 0&&(e=Te),n===void 0&&(n=Te);var i=new rt(t);return e!==Te&&bo(i,e),n!==Te&&ga(i,n),i}function us(t,e){return t===e}function ds(t,e){return Dn(t,e)}function cs(t,e){return Dn(t,e,1)}function fs(t,e){return Object.is?Object.is(t,e):t===e?t!==0||1/t===1/e:t!==t&&e!==e}var _t={identity:us,structural:ds,default:fs,shallow:cs};function ye(t,e,n){return Sa(t)?t:Array.isArray(t)?z.array(t,{name:n}):he(t)?z.object(t,void 0,{name:n}):Ie(t)?z.map(t,{name:n}):it(t)?z.set(t,{name:n}):typeof t=="function"&&!zt(t)&&!Ze(t)?$i(t)?De(t):Je(n,t):t}function ms(t,e,n){if(t==null||Xe(t)||Kt(t)||Ne(t)||je(t))return t;if(Array.isArray(t))return z.array(t,{name:n,deep:!1});if(he(t))return z.object(t,void 0,{name:n,deep:!1});if(Ie(t))return z.map(t,{name:n,deep:!1});if(it(t))return z.set(t,{name:n,deep:!1})}function Mt(t){return t}function hs(t,e){return Dn(t,e)?e:t}var ps="override";function vs(t){return t.annotationType_===ps}function st(t,e){return{annotationType_:t,options_:e,make_:gs,extend_:ks,decorate_20223_:ys}}function gs(t,e,n,i){var a;if((a=this.options_)!=null&&a.bound)return this.extend_(t,e,n,!1)===null?0:1;if(i===t.target_)return this.extend_(t,e,n,!1)===null?0:2;if(zt(n.value))return 1;var r=Hi(t,this,e,n,!1);return re(i,e,r),2}function ks(t,e,n,i){var a=Hi(t,this,e,n);return t.defineProperty_(e,a,i)}function ys(t,e){var n=e.kind,i=e.name,a=e.addInitializer,r=this,s=function(u){var d,f,c,_;return be((d=(f=r.options_)==null?void 0:f.name)!=null?d:i.toString(),u,(c=(_=r.options_)==null?void 0:_.autoAction)!=null?c:!1)};if(n=="field"){a(function(){Ve(this,i,r)});return}if(n=="method"){var o;return zt(t)||(t=s(t)),(o=this.options_)!=null&&o.bound&&a(function(){var l=this,u=l[i].bind(l);u.isMobxAction=!0,l[i]=u}),t}L("Cannot apply '"+r.annotationType_+"' to '"+String(i)+"' (kind: "+n+"):"+(`
3
3
  '`+r.annotationType_+"' can only be used on properties with a function value."))}function bs(t,e,n,i){e.annotationType_,i.value}function Hi(t,e,n,i,a){var r,s,o,l,u,d,f;a===void 0&&(a=v.safeDescriptors),bs(t,e,n,i);var c=i.value;if((r=e.options_)!=null&&r.bound){var _;c=c.bind((_=t.proxy_)!=null?_:t.target_)}return{value:be((s=(o=e.options_)==null?void 0:o.name)!=null?s:n.toString(),c,(l=(u=e.options_)==null?void 0:u.autoAction)!=null?l:!1,(d=e.options_)!=null&&d.bound?(f=t.proxy_)!=null?f:t.target_:void 0),configurable:a?t.isPlainObject_:!0,enumerable:!1,writable:!a}}function qi(t,e){return{annotationType_:t,options_:e,make_:Ss,extend_:_s,decorate_20223_:Ns}}function Ss(t,e,n,i){var a;if(i===t.target_)return this.extend_(t,e,n,!1)===null?0:2;if((a=this.options_)!=null&&a.bound&&(!de(t.target_,e)||!Ze(t.target_[e]))&&this.extend_(t,e,n,!1)===null)return 0;if(Ze(n.value))return 1;var r=Wi(t,this,e,n,!1,!1);return re(i,e,r),2}function _s(t,e,n,i){var a,r=Wi(t,this,e,n,(a=this.options_)==null?void 0:a.bound);return t.defineProperty_(e,r,i)}function Ns(t,e){var n,i=e.name,a=e.addInitializer;return Ze(t)||(t=De(t)),(n=this.options_)!=null&&n.bound&&a(function(){var r=this,s=r[i].bind(r);s.isMobXFlow=!0,r[i]=s}),t}function Os(t,e,n,i){e.annotationType_,i.value}function Wi(t,e,n,i,a,r){r===void 0&&(r=v.safeDescriptors),Os(t,e,n,i);var s=i.value;if(Ze(s)||(s=De(s)),a){var o;s=s.bind((o=t.proxy_)!=null?o:t.target_),s.isMobXFlow=!0}return{value:s,configurable:r?t.isPlainObject_:!0,enumerable:!1,writable:!r}}function An(t,e){return{annotationType_:t,options_:e,make_:ws,extend_:Fs,decorate_20223_:As}}function ws(t,e,n){return this.extend_(t,e,n,!1)===null?0:1}function Fs(t,e,n,i){return Es(t,this,e,n),t.defineComputedProperty_(e,ke({},this.options_,{get:n.get,set:n.set}),i)}function As(t,e){var n=this,i=e.name,a=e.addInitializer;return a(function(){var r=Ue(this)[E],s=ke({},n.options_,{get:t,context:this});s.name||(s.name="ObservableObject."+i.toString()),r.values_.set(i,new Re(s))}),function(){return this[E].getObservablePropValue_(i)}}function Es(t,e,n,i){e.annotationType_,i.get}function $t(t,e){return{annotationType_:t,options_:e,make_:Cs,extend_:Ts,decorate_20223_:xs}}function Cs(t,e,n){return this.extend_(t,e,n,!1)===null?0:1}function Ts(t,e,n,i){var a,r;return Rs(t,this),t.defineObservableProperty_(e,n.value,(a=(r=this.options_)==null?void 0:r.enhancer)!=null?a:ye,i)}function xs(t,e){var n=this,i=e.kind,a=e.name,r=new WeakSet;function s(o,l){var u,d,f=Ue(o)[E],c=new ve(l,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:ye,"ObservableObject."+a.toString(),!1);f.values_.set(a,c),r.add(o)}if(i=="accessor")return{get:function(){return r.has(this)||s(this,t.get.call(this)),this[E].getObservablePropValue_(a)},set:function(l){return r.has(this)||s(this,l),this[E].setObservablePropValue_(a,l)},init:function(l){return r.has(this)||s(this,l),l}}}function Rs(t,e,n,i){e.annotationType_}var Ds="true",Ls=Ji();function Ji(t){return{annotationType_:Ds,options_:t,make_:Ps,extend_:Is,decorate_20223_:Vs}}function Ps(t,e,n,i){var a,r;if(n.get)return pe.make_(t,e,n,i);if(n.set){var s=be(e.toString(),n.set);return i===t.target_?t.defineProperty_(e,{configurable:v.safeDescriptors?t.isPlainObject_:!0,set:s})===null?0:2:(re(i,e,{configurable:!0,set:s}),2)}if(i!==t.target_&&typeof n.value=="function"){var o;if($i(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?De.bound:De;return u.make_(t,e,n,i)}var d=(o=this.options_)!=null&&o.autoBind?Je.bound:Je;return d.make_(t,e,n,i)}var f=((a=this.options_)==null?void 0:a.deep)===!1?z.ref:z;if(typeof n.value=="function"&&(r=this.options_)!=null&&r.autoBind){var c;n.value=n.value.bind((c=t.proxy_)!=null?c:t.target_)}return f.make_(t,e,n,i)}function Is(t,e,n,i){var a,r;if(n.get)return pe.extend_(t,e,n,i);if(n.set)return t.defineProperty_(e,{configurable:v.safeDescriptors?t.isPlainObject_:!0,set:be(e.toString(),n.set)},i);if(typeof n.value=="function"&&(a=this.options_)!=null&&a.autoBind){var s;n.value=n.value.bind((s=t.proxy_)!=null?s:t.target_)}var o=((r=this.options_)==null?void 0:r.deep)===!1?z.ref:z;return o.extend_(t,e,n,i)}function Vs(t,e){L("'"+this.annotationType_+"' cannot be used as a decorator")}var js="observable",Us="observable.ref",Ms="observable.shallow",$s="observable.struct",Zi={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Zi);function ct(t){return t||Zi}var ln=$t(js),Bs=$t(Us,{enhancer:Mt}),zs=$t(Ms,{enhancer:ms}),Ks=$t($s,{enhancer:hs}),Xi=se(ln);function ft(t){return t.deep===!0?ye:t.deep===!1?Mt:Qs(t.defaultDecorator)}function Gs(t){var e;return t?(e=t.defaultDecorator)!=null?e:Ji(t):void 0}function Qs(t){var e,n;return t&&(e=(n=t.options_)==null?void 0:n.enhancer)!=null?e:ye}function Yi(t,e,n){if(at(e))return ln.decorate_20223_(t,e);if(ge(e)){Ve(t,e,ln);return}return Sa(t)?t:he(t)?z.object(t,e,n):Array.isArray(t)?z.array(t,e):Ie(t)?z.map(t,e):it(t)?z.set(t,e):typeof t=="object"&&t!==null?t:z.box(t,e)}Vi(Yi,Xi);var Hs={box:function(e,n){var i=ct(n);return new ve(e,ft(i),i.name,!0,i.equals)},array:function(e,n){var i=ct(n);return(v.useProxies===!1||i.proxy===!1?Ko:Lo)(e,ft(i),i.name)},map:function(e,n){var i=ct(n);return new Fa(e,ft(i),i.name)},set:function(e,n){var i=ct(n);return new Ca(e,ft(i),i.name)},object:function(e,n,i){return Oe(function(){return Oo(v.useProxies===!1||(i==null?void 0:i.proxy)===!1?Ue({},i):xo({},i),e,n)})},ref:se(Bs),shallow:se(zs),deep:Xi,struct:se(Ks)},z=Vi(Yi,Hs),ea="computed",qs="computed.struct",un=An(ea),Ws=An(qs,{equals:_t.structural}),pe=function(e,n){if(at(n))return un.decorate_20223_(e,n);if(ge(n))return Ve(e,n,un);if(he(e))return se(An(ea,e));var i=he(n)?n:{};return i.get=e,i.name||(i.name=e.name||""),new Re(i)};Object.assign(pe,un);pe.struct=se(Ws);var Wn,Jn,Nt=0,Js=1,Zs=(Wn=(Jn=St(function(){},"name"))==null?void 0:Jn.configurable)!=null?Wn:!1,Zn={value:"action",configurable:!0,writable:!1,enumerable:!1};function be(t,e,n,i){n===void 0&&(n=!1);function a(){return ta(t,n,e,i||this,arguments)}return a.isMobxAction=!0,a.toString=function(){return e.toString()},Zs&&(Zn.value=t,re(a,"name",Zn)),a}function ta(t,e,n,i,a){var r=Xs(t,e);try{return n.apply(i,a)}catch(s){throw r.error_=s,s}finally{Ys(r)}}function Xs(t,e,n,i){var a=!1,r=0,s=v.trackingDerivation,o=!e||!s;J();var l=v.allowStateChanges;o&&(_e(),l=En(!0));var u=Tn(!0),d={runAsAction_:o,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:a,startTime_:r,actionId_:Js++,parentActionId_:Nt};return Nt=d.actionId_,d}function Ys(t){Nt!==t.actionId_&&L(30),Nt=t.parentActionId_,t.error_!==void 0&&(v.suppressReactionErrors=!0),Cn(t.prevAllowStateChanges_),Qe(t.prevAllowStateReads_),Z(),t.runAsAction_&&ce(t.prevDerivation_),v.suppressReactionErrors=!1}function En(t){var e=v.allowStateChanges;return v.allowStateChanges=t,e}function Cn(t){v.allowStateChanges=t}var na;na=Symbol.toPrimitive;var ve=function(t){Gi(e,t);function e(i,a,r,s,o){var l;return r===void 0&&(r="ObservableValue"),o===void 0&&(o=_t.default),l=t.call(this,r)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=a,l.name_=r,l.equals=o,l.value_=a(i,void 0,r),l}var n=e.prototype;return n.dehanceValue=function(a){return this.dehancer!==void 0?this.dehancer(a):a},n.set=function(a){this.value_,a=this.prepareNewValue_(a),a!==v.UNCHANGED&&this.setNewValue_(a)},n.prepareNewValue_=function(a){if(q(this)){var r=W(this,{object:this,type:oe,newValue:a});if(!r)return v.UNCHANGED;a=r.newValue}return a=this.enhancer(a,this.value_,this.name_),this.equals(this.value_,a)?v.UNCHANGED:a},n.setNewValue_=function(a){var r=this.value_;this.value_=a,this.reportChanged(),Y(this)&&ee(this,{type:oe,object:this,newValue:a,oldValue:r})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(a){return ot(this,a)},n.observe_=function(a,r){return r&&a({observableKind:"value",debugObjectName:this.name_,object:this,type:oe,newValue:this.value_,oldValue:void 0}),lt(this,a)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return Ki(this.get())},n[na]=function(){return this.valueOf()},e}(rt),ia;ia=Symbol.toPrimitive;var Re=function(){function t(n){this.dependenciesState_=V.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=V.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new wt(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Ot.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||L(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=be("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?_t.structural:_t.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var e=t.prototype;return e.onBecomeStale_=function(){ao(this)},e.onBO=function(){this.onBOL&&this.onBOL.forEach(function(i){return i()})},e.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(i){return i()})},e.get=function(){if(this.isComputing_&&L(32,this.name_,this.derivation),v.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)dn(this)&&(this.warnAboutUntrackedRead_(),J(),this.value_=this.computeValue_(!1),Z());else if(da(this),dn(this)){var i=v.trackingContext;this.keepAlive_&&!i&&(v.trackingContext=this),this.trackAndCompute()&&io(this),v.trackingContext=i}var a=this.value_;if(vt(a))throw a.cause;return a},e.set=function(i){if(this.setter_){this.isRunningSetter_&&L(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,i)}finally{this.isRunningSetter_=!1}}else L(34,this.name_)},e.trackAndCompute=function(){var i=this.value_,a=this.dependenciesState_===V.NOT_TRACKING_,r=this.computeValue_(!0),s=a||vt(i)||vt(r)||!this.equals_(i,r);return s&&(this.value_=r),s},e.computeValue_=function(i){this.isComputing_=!0;var a=En(!1),r;if(i)r=aa(this,this.derivation,this.scope_);else if(v.disableErrorBoundaries===!0)r=this.derivation.call(this.scope_);else try{r=this.derivation.call(this.scope_)}catch(s){r=new wt(s)}return Cn(a),this.isComputing_=!1,r},e.suspend_=function(){this.keepAlive_||(cn(this),this.value_=void 0)},e.observe_=function(i,a){var r=this,s=!0,o=void 0;return po(function(){var l=r.get();if(!s||a){var u=_e();i({observableKind:"computed",debugObjectName:r.name_,type:oe,object:r,newValue:l,oldValue:o}),ce(u)}s=!1,o=l})},e.warnAboutUntrackedRead_=function(){},e.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},e.valueOf=function(){return Ki(this.get())},e[ia]=function(){return this.valueOf()},t}(),Bt=Se("ComputedValue",Re),V;(function(t){t[t.NOT_TRACKING_=-1]="NOT_TRACKING_",t[t.UP_TO_DATE_=0]="UP_TO_DATE_",t[t.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",t[t.STALE_=2]="STALE_"})(V||(V={}));var Ot;(function(t){t[t.NONE=0]="NONE",t[t.LOG=1]="LOG",t[t.BREAK=2]="BREAK"})(Ot||(Ot={}));var wt=function(e){this.cause=void 0,this.cause=e};function vt(t){return t instanceof wt}function dn(t){switch(t.dependenciesState_){case V.UP_TO_DATE_:return!1;case V.NOT_TRACKING_:case V.STALE_:return!0;case V.POSSIBLY_STALE_:{for(var e=Tn(!0),n=_e(),i=t.observing_,a=i.length,r=0;r<a;r++){var s=i[r];if(Bt(s)){if(v.disableErrorBoundaries)s.get();else try{s.get()}catch{return ce(n),Qe(e),!0}if(t.dependenciesState_===V.STALE_)return ce(n),Qe(e),!0}}return sa(t),ce(n),Qe(e),!1}}}function aa(t,e,n){var i=Tn(!0);sa(t),t.newObserving_=new Array(t.observing_.length+100),t.unboundDepsCount_=0,t.runId_=++v.runId;var a=v.trackingDerivation;v.trackingDerivation=t,v.inBatch++;var r;if(v.disableErrorBoundaries===!0)r=e.call(n);else try{r=e.call(n)}catch(s){r=new wt(s)}return v.inBatch--,v.trackingDerivation=a,eo(t),Qe(i),r}function eo(t){for(var e=t.observing_,n=t.observing_=t.newObserving_,i=V.UP_TO_DATE_,a=0,r=t.unboundDepsCount_,s=0;s<r;s++){var o=n[s];o.diffValue_===0&&(o.diffValue_=1,a!==s&&(n[a]=o),a++),o.dependenciesState_>i&&(i=o.dependenciesState_)}for(n.length=a,t.newObserving_=null,r=e.length;r--;){var l=e[r];l.diffValue_===0&&la(l,t),l.diffValue_=0}for(;a--;){var u=n[a];u.diffValue_===1&&(u.diffValue_=0,no(u,t))}i!==V.UP_TO_DATE_&&(t.dependenciesState_=i,t.onBecomeStale_())}function cn(t){var e=t.observing_;t.observing_=[];for(var n=e.length;n--;)la(e[n],t);t.dependenciesState_=V.NOT_TRACKING_}function ra(t){var e=_e();try{return t()}finally{ce(e)}}function _e(){var t=v.trackingDerivation;return v.trackingDerivation=null,t}function ce(t){v.trackingDerivation=t}function Tn(t){var e=v.allowStateReads;return v.allowStateReads=t,e}function Qe(t){v.allowStateReads=t}function sa(t){if(t.dependenciesState_!==V.UP_TO_DATE_){t.dependenciesState_=V.UP_TO_DATE_;for(var e=t.observing_,n=e.length;n--;)e[n].lowestObserverState_=V.UP_TO_DATE_}}var gt=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},kt=!0,oa=!1,v=function(){var t=On();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(kt=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==new gt().version&&(kt=!1),kt?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new gt):(setTimeout(function(){oa||L(35)},1),new gt)}();function to(){if((v.pendingReactions.length||v.inBatch||v.isRunningReactions)&&L(36),oa=!0,kt){var t=On();--t.__mobxInstanceCount===0&&(t.__mobxGlobals=void 0),v=new gt}}function no(t,e){t.observers_.add(e),t.lowestObserverState_>e.dependenciesState_&&(t.lowestObserverState_=e.dependenciesState_)}function la(t,e){t.observers_.delete(e),t.observers_.size===0&&ua(t)}function ua(t){t.isPendingUnobservation_===!1&&(t.isPendingUnobservation_=!0,v.pendingUnobservations.push(t))}function J(){v.inBatch++}function Z(){if(--v.inBatch===0){fa();for(var t=v.pendingUnobservations,e=0;e<t.length;e++){var n=t[e];n.isPendingUnobservation_=!1,n.observers_.size===0&&(n.isBeingObserved_&&(n.isBeingObserved_=!1,n.onBUO()),n instanceof Re&&n.suspend_())}v.pendingUnobservations=[]}}function da(t){var e=v.trackingDerivation;return e!==null?(e.runId_!==t.lastAccessedBy_&&(t.lastAccessedBy_=e.runId_,e.newObserving_[e.unboundDepsCount_++]=t,!t.isBeingObserved_&&v.trackingContext&&(t.isBeingObserved_=!0,t.onBO())),t.isBeingObserved_):(t.observers_.size===0&&v.inBatch>0&&ua(t),!1)}function ca(t){t.lowestObserverState_!==V.STALE_&&(t.lowestObserverState_=V.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===V.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=V.STALE_}))}function io(t){t.lowestObserverState_!==V.STALE_&&(t.lowestObserverState_=V.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===V.POSSIBLY_STALE_?e.dependenciesState_=V.STALE_:e.dependenciesState_===V.UP_TO_DATE_&&(t.lowestObserverState_=V.UP_TO_DATE_)}))}function ao(t){t.lowestObserverState_===V.UP_TO_DATE_&&(t.lowestObserverState_=V.POSSIBLY_STALE_,t.observers_.forEach(function(e){e.dependenciesState_===V.UP_TO_DATE_&&(e.dependenciesState_=V.POSSIBLY_STALE_,e.onBecomeStale_())}))}var We=function(){function t(n,i,a,r){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=V.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ot.NONE,this.name_=n,this.onInvalidate_=i,this.errorHandler_=a,this.requiresObservable_=r}var e=t.prototype;return e.onBecomeStale_=function(){this.schedule_()},e.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,v.pendingReactions.push(this),fa())},e.isScheduled=function(){return this.isScheduled_},e.runReaction_=function(){if(!this.isDisposed_){J(),this.isScheduled_=!1;var i=v.trackingContext;if(v.trackingContext=this,dn(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(a){this.reportExceptionInDerivation_(a)}}v.trackingContext=i,Z()}},e.track=function(i){if(!this.isDisposed_){J(),this.isRunning_=!0;var a=v.trackingContext;v.trackingContext=this;var r=aa(this,i,void 0);v.trackingContext=a,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&cn(this),vt(r)&&this.reportExceptionInDerivation_(r.cause),Z()}},e.reportExceptionInDerivation_=function(i){var a=this;if(this.errorHandler_){this.errorHandler_(i,this);return}if(v.disableErrorBoundaries)throw i;var r="[mobx] uncaught error in '"+this+"'";v.suppressReactionErrors||console.error(r,i),v.globalReactionErrorHandlers.forEach(function(s){return s(i,a)})},e.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(J(),cn(this),Z()))},e.getDisposer_=function(i){var a=this,r=function s(){a.dispose(),i==null||i.removeEventListener==null||i.removeEventListener("abort",s)};return i==null||i.addEventListener==null||i.addEventListener("abort",r),r[E]=this,r},e.toString=function(){return"Reaction["+this.name_+"]"},e.trace=function(i){},t}(),ro=100,fn=function(e){return e()};function fa(){v.inBatch>0||v.isRunningReactions||fn(so)}function so(){v.isRunningReactions=!0;for(var t=v.pendingReactions,e=0;t.length>0;){++e===ro&&(console.error("[mobx] cycle in reaction: "+t[0]),t.splice(0));for(var n=t.splice(0),i=0,a=n.length;i<a;i++)n[i].runReaction_()}v.isRunningReactions=!1}var Ft=Se("Reaction",We);function oo(t){var e=fn;fn=function(i){return t(function(){return e(i)})}}function He(){return!1}function lo(t){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var ma="action",uo="action.bound",ha="autoAction",co="autoAction.bound",pa="<unnamed action>",mn=st(ma),fo=st(uo,{bound:!0}),hn=st(ha,{autoAction:!0}),mo=st(co,{autoAction:!0,bound:!0});function va(t){var e=function(i,a){if(te(i))return be(i.name||pa,i,t);if(te(a))return be(i,a,t);if(at(a))return(t?hn:mn).decorate_20223_(i,a);if(ge(a))return Ve(i,a,t?hn:mn);if(ge(i))return se(st(t?ha:ma,{name:i,autoAction:t}))};return e}var fe=va(!1);Object.assign(fe,mn);var Je=va(!0);Object.assign(Je,hn);fe.bound=se(fo);Je.bound=se(mo);function ho(t){return ta(t.name||pa,!1,t,this,void 0)}function zt(t){return te(t)&&t.isMobxAction===!0}function po(t,e){var n,i,a,r,s;e===void 0&&(e=ji);var o=(n=(i=e)==null?void 0:i.name)!=null?n:"Autorun",l=!e.scheduler&&!e.delay,u;if(l)u=new We(o,function(){this.track(c)},e.onError,e.requiresObservable);else{var d=go(e),f=!1;u=new We(o,function(){f||(f=!0,d(function(){f=!1,u.isDisposed_||u.track(c)}))},e.onError,e.requiresObservable)}function c(){t(u)}return(a=e)!=null&&(r=a.signal)!=null&&r.aborted||u.schedule_(),u.getDisposer_((s=e)==null?void 0:s.signal)}var vo=function(e){return e()};function go(t){return t.scheduler?t.scheduler:t.delay?function(e){return setTimeout(e,t.delay)}:vo}var ko="onBO",yo="onBUO";function bo(t,e,n){return ka(ko,t,e,n)}function ga(t,e,n){return ka(yo,t,e,n)}function ka(t,e,n,i){var a=typeof i=="function"?Le(e,n):Le(e),r=te(i)?i:n,s=t+"L";return a[s]?a[s].add(r):a[s]=new Set([r]),function(){var o=a[s];o&&(o.delete(r),o.size===0&&delete a[s])}}var So="never",mt="always",_o="observed";function No(t){t.isolateGlobalState===!0&&to();var e=t.useProxies,n=t.enforceActions;if(e!==void 0&&(v.useProxies=e===mt?!0:e===So?!1:typeof Proxy!="undefined"),e==="ifavailable"&&(v.verifyProxies=!0),n!==void 0){var i=n===mt?mt:n===_o;v.enforceActions=i,v.allowStateChanges=!(i===!0||i===mt)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(a){a in t&&(v[a]=!!t[a])}),v.allowStateReads=!v.observableRequiresReaction,t.reactionScheduler&&oo(t.reactionScheduler)}function Oo(t,e,n,i){var a=as(e);return Oe(function(){var r=Ue(t,i)[E];Ut(a).forEach(function(s){r.extend_(s,a[s],n&&s in n?n[s]:!0)})}),t}function wo(t,e){return ya(Le(t,e))}function ya(t){var e={name:t.name_};return t.observing_&&t.observing_.length>0&&(e.dependencies=Fo(t.observing_).map(ya)),e}function Fo(t){return Array.from(new Set(t))}var Ao=0;function ba(){this.message="FLOW_CANCELLED"}ba.prototype=Object.create(Error.prototype);var Yt=qi("flow"),Eo=qi("flow.bound",{bound:!0}),De=Object.assign(function(e,n){if(at(n))return Yt.decorate_20223_(e,n);if(ge(n))return Ve(e,n,Yt);var i=e,a=i.name||"<unnamed flow>",r=function(){var o=this,l=arguments,u=++Ao,d=fe(a+" - runid: "+u+" - init",i).apply(o,l),f,c=void 0,_=new Promise(function(O,g){var k=0;f=g;function N(w){c=void 0;var C;try{C=fe(a+" - runid: "+u+" - yield "+k++,d.next).call(d,w)}catch(I){return g(I)}P(C)}function R(w){c=void 0;var C;try{C=fe(a+" - runid: "+u+" - yield "+k++,d.throw).call(d,w)}catch(I){return g(I)}P(C)}function P(w){if(te(w==null?void 0:w.then)){w.then(P,g);return}return w.done?O(w.value):(c=Promise.resolve(w.value),c.then(N,R))}N(void 0)});return _.cancel=fe(a+" - runid: "+u+" - cancel",function(){try{c&&Xn(c);var O=d.return(void 0),g=Promise.resolve(O.value);g.then(Te,Te),Xn(g),f(new ba)}catch(k){f(k)}}),_};return r.isMobXFlow=!0,r},Yt);De.bound=se(Eo);function Xn(t){te(t.cancel)&&t.cancel()}function Ze(t){return(t==null?void 0:t.isMobXFlow)===!0}function Co(t,e){return t?e!==void 0?Xe(t)?t[E].values_.has(e):!1:Xe(t)||!!t[E]||Fn(t)||Ft(t)||Bt(t):!1}function Sa(t){return Co(t)}function le(t,e){e===void 0&&(e=void 0),J();try{return t.apply(e)}finally{Z()}}function Fe(t){return t[E]}var To={has:function(e,n){return Fe(e).has_(n)},get:function(e,n){return Fe(e).get_(n)},set:function(e,n,i){var a;return ge(n)?(a=Fe(e).set_(n,i,!0))!=null?a:!0:!1},deleteProperty:function(e,n){var i;return ge(n)?(i=Fe(e).delete_(n,!0))!=null?i:!0:!1},defineProperty:function(e,n,i){var a;return(a=Fe(e).defineProperty_(n,i))!=null?a:!0},ownKeys:function(e){return Fe(e).ownKeys_()},preventExtensions:function(e){L(13)}};function xo(t,e){var n,i;return Ui(),t=Ue(t,e),(i=(n=t[E]).proxy_)!=null?i:n.proxy_=new Proxy(t,To)}function q(t){return t.interceptors_!==void 0&&t.interceptors_.length>0}function ot(t,e){var n=t.interceptors_||(t.interceptors_=[]);return n.push(e),Mi(function(){var i=n.indexOf(e);i!==-1&&n.splice(i,1)})}function W(t,e){var n=_e();try{for(var i=[].concat(t.interceptors_||[]),a=0,r=i.length;a<r&&(e=i[a](e),e&&!e.type&&L(14),!!e);a++);return e}finally{ce(n)}}function Y(t){return t.changeListeners_!==void 0&&t.changeListeners_.length>0}function lt(t,e){var n=t.changeListeners_||(t.changeListeners_=[]);return n.push(e),Mi(function(){var i=n.indexOf(e);i!==-1&&n.splice(i,1)})}function ee(t,e){var n=_e(),i=t.changeListeners_;if(i){i=i.slice();for(var a=0,r=i.length;a<r;a++)i[a](e);ce(n)}}function _a(t,e,n){return Oe(function(){var i,a=Ue(t,n)[E];(i=e)!=null||(e=ls(t)),Ut(e).forEach(function(r){return a.make_(r,e[r])})}),t}var Yn="splice",oe="update",Ro=1e4,Do={get:function(e,n){var i=e[E];return n===E?i:n==="length"?i.getArrayLength_():typeof n=="string"&&!isNaN(n)?i.get_(parseInt(n)):de(At,n)?At[n]:e[n]},set:function(e,n,i){var a=e[E];return n==="length"&&a.setArrayLength_(i),typeof n=="symbol"||isNaN(n)?e[n]=i:a.set_(parseInt(n),i),!0},preventExtensions:function(){L(15)}},xn=function(){function t(n,i,a,r){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=a,this.legacyMode_=r,this.atom_=new rt(n),this.enhancer_=function(s,o){return i(s,o,"ObservableArray[..]")}}var e=t.prototype;return e.dehanceValue_=function(i){return this.dehancer!==void 0?this.dehancer(i):i},e.dehanceValues_=function(i){return this.dehancer!==void 0&&i.length>0?i.map(this.dehancer):i},e.intercept_=function(i){return ot(this,i)},e.observe_=function(i,a){return a===void 0&&(a=!1),a&&i({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lt(this,i)},e.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},e.setArrayLength_=function(i){(typeof i!="number"||isNaN(i)||i<0)&&L("Out of range: "+i);var a=this.values_.length;if(i!==a)if(i>a){for(var r=new Array(i-a),s=0;s<i-a;s++)r[s]=void 0;this.spliceWithArray_(a,0,r)}else this.spliceWithArray_(i,a-i)},e.updateArrayLength_=function(i,a){i!==this.lastKnownLength_&&L(16),this.lastKnownLength_+=a,this.legacyMode_&&a>0&&Da(i+a+1)},e.spliceWithArray_=function(i,a,r){var s=this;this.atom_;var o=this.values_.length;if(i===void 0?i=0:i>o?i=o:i<0&&(i=Math.max(0,o+i)),arguments.length===1?a=o-i:a==null?a=0:a=Math.max(0,Math.min(a,o-i)),r===void 0&&(r=sn),q(this)){var l=W(this,{object:this.proxy_,type:Yn,index:i,removedCount:a,added:r});if(!l)return sn;a=l.removedCount,r=l.added}if(r=r.length===0?r:r.map(function(f){return s.enhancer_(f,void 0)}),this.legacyMode_){var u=r.length-a;this.updateArrayLength_(o,u)}var d=this.spliceItemsIntoValues_(i,a,r);return(a!==0||r.length!==0)&&this.notifyArraySplice_(i,r,d),this.dehanceValues_(d)},e.spliceItemsIntoValues_=function(i,a,r){if(r.length<Ro){var s;return(s=this.values_).splice.apply(s,[i,a].concat(r))}else{var o=this.values_.slice(i,i+a),l=this.values_.slice(i+a);this.values_.length+=r.length-a;for(var u=0;u<r.length;u++)this.values_[i+u]=r[u];for(var d=0;d<l.length;d++)this.values_[i+r.length+d]=l[d];return o}},e.notifyArrayChildUpdate_=function(i,a,r){var s=!this.owned_&&He(),o=Y(this),l=o||s?{observableKind:"array",object:this.proxy_,type:oe,debugObjectName:this.atom_.name_,index:i,newValue:a,oldValue:r}:null;this.atom_.reportChanged(),o&&ee(this,l)},e.notifyArraySplice_=function(i,a,r){var s=!this.owned_&&He(),o=Y(this),l=o||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Yn,index:i,removed:r,added:a,removedCount:r.length,addedCount:a.length}:null;this.atom_.reportChanged(),o&&ee(this,l)},e.get_=function(i){if(this.legacyMode_&&i>=this.values_.length){console.warn("[mobx] Out of bounds read: "+i);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[i])},e.set_=function(i,a){var r=this.values_;if(this.legacyMode_&&i>r.length&&L(17,i,r.length),i<r.length){this.atom_;var s=r[i];if(q(this)){var o=W(this,{type:oe,object:this.proxy_,index:i,newValue:a});if(!o)return;a=o.newValue}a=this.enhancer_(a,s);var l=a!==s;l&&(r[i]=a,this.notifyArrayChildUpdate_(i,a,s))}else{for(var u=new Array(i+1-r.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=a,this.spliceWithArray_(r.length,0,u)}},t}();function Lo(t,e,n,i){return n===void 0&&(n="ObservableArray"),i===void 0&&(i=!1),Ui(),Oe(function(){var a=new xn(n,e,i,!1);Bi(a.values_,E,a);var r=new Proxy(a.values_,Do);return a.proxy_=r,t&&t.length&&a.spliceWithArray_(0,0,t),r})}var At={clear:function(){return this.splice(0)},replace:function(e){var n=this[E];return n.spliceWithArray_(0,n.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,n){for(var i=arguments.length,a=new Array(i>2?i-2:0),r=2;r<i;r++)a[r-2]=arguments[r];var s=this[E];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(e);case 2:return s.spliceWithArray_(e,n)}return s.spliceWithArray_(e,n,a)},spliceWithArray:function(e,n,i){return this[E].spliceWithArray_(e,n,i)},push:function(){for(var e=this[E],n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e.spliceWithArray_(e.values_.length,0,i),e.values_.length},pop:function(){return this.splice(Math.max(this[E].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[E],n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e.spliceWithArray_(0,0,i),e.values_.length},reverse:function(){return v.trackingDerivation&&L(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){v.trackingDerivation&&L(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var n=this[E],i=n.dehanceValues_(n.values_).indexOf(e);return i>-1?(this.splice(i,1),!0):!1}};M("at",H);M("concat",H);M("flat",H);M("includes",H);M("indexOf",H);M("join",H);M("lastIndexOf",H);M("slice",H);M("toString",H);M("toLocaleString",H);M("toSorted",H);M("toSpliced",H);M("with",H);M("every",ne);M("filter",ne);M("find",ne);M("findIndex",ne);M("findLast",ne);M("findLastIndex",ne);M("flatMap",ne);M("forEach",ne);M("map",ne);M("some",ne);M("toReversed",ne);M("reduce",Na);M("reduceRight",Na);function M(t,e){typeof Array.prototype[t]=="function"&&(At[t]=e(t))}function H(t){return function(){var e=this[E];e.atom_.reportObserved();var n=e.dehanceValues_(e.values_);return n[t].apply(n,arguments)}}function ne(t){return function(e,n){var i=this,a=this[E];a.atom_.reportObserved();var r=a.dehanceValues_(a.values_);return r[t](function(s,o){return e.call(n,s,o,i)})}}function Na(t){return function(){var e=this,n=this[E];n.atom_.reportObserved();var i=n.dehanceValues_(n.values_),a=arguments[0];return arguments[0]=function(r,s,o){return a(r,s,o,e)},i[t].apply(i,arguments)}}var Po=Se("ObservableArrayAdministration",xn);function Kt(t){return Vt(t)&&Po(t[E])}var Oa,wa,Io={},me="add",Et="delete";Oa=Symbol.iterator;wa=Symbol.toStringTag;var Fa=function(){function t(n,i,a){var r=this;i===void 0&&(i=ye),a===void 0&&(a="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[E]=Io,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=i,this.name_=a,te(Map)||L(18),Oe(function(){r.keysAtom_=Qi("ObservableMap.keys()"),r.data_=new Map,r.hasMap_=new Map,n&&r.merge(n)})}var e=t.prototype;return e.has_=function(i){return this.data_.has(i)},e.has=function(i){var a=this;if(!v.trackingDerivation)return this.has_(i);var r=this.hasMap_.get(i);if(!r){var s=r=new ve(this.has_(i),Mt,"ObservableMap.key?",!1);this.hasMap_.set(i,s),ga(s,function(){return a.hasMap_.delete(i)})}return r.get()},e.set=function(i,a){var r=this.has_(i);if(q(this)){var s=W(this,{type:r?oe:me,object:this,newValue:a,name:i});if(!s)return this;a=s.newValue}return r?this.updateValue_(i,a):this.addValue_(i,a),this},e.delete=function(i){var a=this;if(this.keysAtom_,q(this)){var r=W(this,{type:Et,object:this,name:i});if(!r)return!1}if(this.has_(i)){var s=He(),o=Y(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:Et,object:this,oldValue:this.data_.get(i).value_,name:i}:null;return le(function(){var u;a.keysAtom_.reportChanged(),(u=a.hasMap_.get(i))==null||u.setNewValue_(!1);var d=a.data_.get(i);d.setNewValue_(void 0),a.data_.delete(i)}),o&&ee(this,l),!0}return!1},e.updateValue_=function(i,a){var r=this.data_.get(i);if(a=r.prepareNewValue_(a),a!==v.UNCHANGED){var s=He(),o=Y(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:oe,object:this,oldValue:r.value_,name:i,newValue:a}:null;r.setNewValue_(a),o&&ee(this,l)}},e.addValue_=function(i,a){var r=this;this.keysAtom_,le(function(){var u,d=new ve(a,r.enhancer_,"ObservableMap.key",!1);r.data_.set(i,d),a=d.value_,(u=r.hasMap_.get(i))==null||u.setNewValue_(!0),r.keysAtom_.reportChanged()});var s=He(),o=Y(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:me,object:this,name:i,newValue:a}:null;o&&ee(this,l)},e.get=function(i){return this.has(i)?this.dehanceValue_(this.data_.get(i).get()):this.dehanceValue_(void 0)},e.dehanceValue_=function(i){return this.dehancer!==void 0?this.dehancer(i):i},e.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},e.values=function(){var i=this,a=this.keys();return Ye({next:function(){var s=a.next(),o=s.done,l=s.value;return{done:o,value:o?void 0:i.get(l)}}})},e.entries=function(){var i=this,a=this.keys();return Ye({next:function(){var s=a.next(),o=s.done,l=s.value;return{done:o,value:o?void 0:[l,i.get(l)]}}})},e[Oa]=function(){return this.entries()},e.forEach=function(i,a){for(var r=xe(this),s;!(s=r()).done;){var o=s.value,l=o[0],u=o[1];i.call(a,u,l,this)}},e.merge=function(i){var a=this;return Ne(i)&&(i=new Map(i)),le(function(){he(i)?is(i).forEach(function(r){return a.set(r,i[r])}):Array.isArray(i)?i.forEach(function(r){var s=r[0],o=r[1];return a.set(s,o)}):Ie(i)?(i.constructor!==Map&&L(19,i),i.forEach(function(r,s){return a.set(s,r)})):i!=null&&L(20,i)}),this},e.clear=function(){var i=this;le(function(){ra(function(){for(var a=xe(i.keys()),r;!(r=a()).done;){var s=r.value;i.delete(s)}})})},e.replace=function(i){var a=this;return le(function(){for(var r=Vo(i),s=new Map,o=!1,l=xe(a.data_.keys()),u;!(u=l()).done;){var d=u.value;if(!r.has(d)){var f=a.delete(d);if(f)o=!0;else{var c=a.data_.get(d);s.set(d,c)}}}for(var _=xe(r.entries()),O;!(O=_()).done;){var g=O.value,k=g[0],N=g[1],R=a.data_.has(k);if(a.set(k,N),a.data_.has(k)){var P=a.data_.get(k);s.set(k,P),R||(o=!0)}}if(!o)if(a.data_.size!==s.size)a.keysAtom_.reportChanged();else for(var w=a.data_.keys(),C=s.keys(),I=w.next(),j=C.next();!I.done;){if(I.value!==j.value){a.keysAtom_.reportChanged();break}I=w.next(),j=C.next()}a.data_=s}),this},e.toString=function(){return"[object ObservableMap]"},e.toJSON=function(){return Array.from(this)},e.observe_=function(i,a){return lt(this,i)},e.intercept_=function(i){return ot(this,i)},wn(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:wa,get:function(){return"Map"}}]),t}(),Ne=Se("ObservableMap",Fa);function Vo(t){if(Ie(t)||Ne(t))return t;if(Array.isArray(t))return new Map(t);if(he(t)){var e=new Map;for(var n in t)e.set(n,t[n]);return e}else return L(21,t)}var Aa,Ea,jo={};Aa=Symbol.iterator;Ea=Symbol.toStringTag;var Ca=function(){function t(n,i,a){var r=this;i===void 0&&(i=ye),a===void 0&&(a="ObservableSet"),this.name_=void 0,this[E]=jo,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=a,te(Set)||L(22),this.enhancer_=function(s,o){return i(s,o,a)},Oe(function(){r.atom_=Qi(r.name_),n&&r.replace(n)})}var e=t.prototype;return e.dehanceValue_=function(i){return this.dehancer!==void 0?this.dehancer(i):i},e.clear=function(){var i=this;le(function(){ra(function(){for(var a=xe(i.data_.values()),r;!(r=a()).done;){var s=r.value;i.delete(s)}})})},e.forEach=function(i,a){for(var r=xe(this),s;!(s=r()).done;){var o=s.value;i.call(a,o,o,this)}},e.add=function(i){var a=this;if(this.atom_,q(this)){var r=W(this,{type:me,object:this,newValue:i});if(!r)return this}if(!this.has(i)){le(function(){a.data_.add(a.enhancer_(i,void 0)),a.atom_.reportChanged()});var s=!1,o=Y(this),l=o||s?{observableKind:"set",debugObjectName:this.name_,type:me,object:this,newValue:i}:null;o&&ee(this,l)}return this},e.delete=function(i){var a=this;if(q(this)){var r=W(this,{type:Et,object:this,oldValue:i});if(!r)return!1}if(this.has(i)){var s=!1,o=Y(this),l=o||s?{observableKind:"set",debugObjectName:this.name_,type:Et,object:this,oldValue:i}:null;return le(function(){a.atom_.reportChanged(),a.data_.delete(i)}),o&&ee(this,l),!0}return!1},e.has=function(i){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(i))},e.entries=function(){var i=0,a=Array.from(this.keys()),r=Array.from(this.values());return Ye({next:function(){var o=i;return i+=1,o<r.length?{value:[a[o],r[o]],done:!1}:{done:!0}}})},e.keys=function(){return this.values()},e.values=function(){this.atom_.reportObserved();var i=this,a=0,r=Array.from(this.data_.values());return Ye({next:function(){return a<r.length?{value:i.dehanceValue_(r[a++]),done:!1}:{done:!0}}})},e.replace=function(i){var a=this;return je(i)&&(i=new Set(i)),le(function(){Array.isArray(i)?(a.clear(),i.forEach(function(r){return a.add(r)})):it(i)?(a.clear(),i.forEach(function(r){return a.add(r)})):i!=null&&L("Cannot initialize set from "+i)}),this},e.observe_=function(i,a){return lt(this,i)},e.intercept_=function(i){return ot(this,i)},e.toJSON=function(){return Array.from(this)},e.toString=function(){return"[object ObservableSet]"},e[Aa]=function(){return this.values()},wn(t,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Ea,get:function(){return"Set"}}]),t}(),je=Se("ObservableSet",Ca),ei=Object.create(null),ti="remove",Ta=function(){function t(n,i,a,r){i===void 0&&(i=new Map),r===void 0&&(r=Ls),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=i,this.name_=a,this.defaultAnnotation_=r,this.keysAtom_=new rt("ObservableObject.keys"),this.isPlainObject_=he(this.target_)}var e=t.prototype;return e.getObservablePropValue_=function(i){return this.values_.get(i).get()},e.setObservablePropValue_=function(i,a){var r=this.values_.get(i);if(r instanceof Re)return r.set(a),!0;if(q(this)){var s=W(this,{type:oe,object:this.proxy_||this.target_,name:i,newValue:a});if(!s)return null;a=s.newValue}if(a=r.prepareNewValue_(a),a!==v.UNCHANGED){var o=Y(this),l=!1,u=o||l?{type:oe,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:r.value_,name:i,newValue:a}:null;r.setNewValue_(a),o&&ee(this,u)}return!0},e.get_=function(i){return v.trackingDerivation&&!de(this.target_,i)&&this.has_(i),this.target_[i]},e.set_=function(i,a,r){return r===void 0&&(r=!1),de(this.target_,i)?this.values_.has(i)?this.setObservablePropValue_(i,a):r?Reflect.set(this.target_,i,a):(this.target_[i]=a,!0):this.extend_(i,{value:a,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,r)},e.has_=function(i){if(!v.trackingDerivation)return i in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var a=this.pendingKeys_.get(i);return a||(a=new ve(i in this.target_,Mt,"ObservableObject.key?",!1),this.pendingKeys_.set(i,a)),a.get()},e.make_=function(i,a){if(a===!0&&(a=this.defaultAnnotation_),a!==!1){if(!(i in this.target_)){var r;if((r=this.target_[ie])!=null&&r[i])return;L(1,a.annotationType_,this.name_+"."+i.toString())}for(var s=this.target_;s&&s!==It;){var o=St(s,i);if(o){var l=a.make_(this,i,o,s);if(l===0)return;if(l===1)break}s=Object.getPrototypeOf(s)}ii(this,a,i)}},e.extend_=function(i,a,r,s){if(s===void 0&&(s=!1),r===!0&&(r=this.defaultAnnotation_),r===!1)return this.defineProperty_(i,a,s);var o=r.extend_(this,i,a,s);return o&&ii(this,r,i),o},e.defineProperty_=function(i,a,r){r===void 0&&(r=!1),this.keysAtom_;try{J();var s=this.delete_(i);if(!s)return s;if(q(this)){var o=W(this,{object:this.proxy_||this.target_,name:i,type:me,newValue:a.value});if(!o)return null;var l=o.newValue;a.value!==l&&(a=ke({},a,{value:l}))}if(r){if(!Reflect.defineProperty(this.target_,i,a))return!1}else re(this.target_,i,a);this.notifyPropertyAddition_(i,a.value)}finally{Z()}return!0},e.defineObservableProperty_=function(i,a,r,s){s===void 0&&(s=!1),this.keysAtom_;try{J();var o=this.delete_(i);if(!o)return o;if(q(this)){var l=W(this,{object:this.proxy_||this.target_,name:i,type:me,newValue:a});if(!l)return null;a=l.newValue}var u=ni(i),d={configurable:v.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(s){if(!Reflect.defineProperty(this.target_,i,d))return!1}else re(this.target_,i,d);var f=new ve(a,r,"ObservableObject.key",!1);this.values_.set(i,f),this.notifyPropertyAddition_(i,f.value_)}finally{Z()}return!0},e.defineComputedProperty_=function(i,a,r){r===void 0&&(r=!1),this.keysAtom_;try{J();var s=this.delete_(i);if(!s)return s;if(q(this)){var o=W(this,{object:this.proxy_||this.target_,name:i,type:me,newValue:void 0});if(!o)return null}a.name||(a.name="ObservableObject.key"),a.context=this.proxy_||this.target_;var l=ni(i),u={configurable:v.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(r){if(!Reflect.defineProperty(this.target_,i,u))return!1}else re(this.target_,i,u);this.values_.set(i,new Re(a)),this.notifyPropertyAddition_(i,void 0)}finally{Z()}return!0},e.delete_=function(i,a){if(a===void 0&&(a=!1),this.keysAtom_,!de(this.target_,i))return!0;if(q(this)){var r=W(this,{object:this.proxy_||this.target_,name:i,type:ti});if(!r)return null}try{var s,o;J();var l=Y(this),u=!1,d=this.values_.get(i),f=void 0;if(!d&&(l||u)){var c;f=(c=St(this.target_,i))==null?void 0:c.value}if(a){if(!Reflect.deleteProperty(this.target_,i))return!1}else delete this.target_[i];if(d&&(this.values_.delete(i),d instanceof ve&&(f=d.value_),ca(d)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(o=s.get(i))==null||o.set(i in this.target_),l||u){var _={type:ti,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:f,name:i};l&&ee(this,_)}}finally{Z()}return!0},e.observe_=function(i,a){return lt(this,i)},e.intercept_=function(i){return ot(this,i)},e.notifyPropertyAddition_=function(i,a){var r,s,o=Y(this),l=!1;if(o||l){var u=o||l?{type:me,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:i,newValue:a}:null;o&&ee(this,u)}(r=this.pendingKeys_)==null||(s=r.get(i))==null||s.set(!0),this.keysAtom_.reportChanged()},e.ownKeys_=function(){return this.keysAtom_.reportObserved(),Ut(this.target_)},e.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},t}();function Ue(t,e){var n;if(de(t,E))return t;var i=(n=e==null?void 0:e.name)!=null?n:"ObservableObject",a=new Ta(t,new Map,String(i),Gs(e));return jt(t,E,a),t}var Uo=Se("ObservableObjectAdministration",Ta);function ni(t){return ei[t]||(ei[t]={get:function(){return this[E].getObservablePropValue_(t)},set:function(n){return this[E].setObservablePropValue_(t,n)}})}function Xe(t){return Vt(t)?Uo(t[E]):!1}function ii(t,e,n){var i;(i=t.target_[ie])==null||delete i[n]}var Mo=Ra(0),$o=function(){var t=!1,e={};return Object.defineProperty(e,"0",{set:function(){t=!0}}),Object.create(e)[0]=1,t===!1}(),en=0,xa=function(){};function Bo(t,e){Object.setPrototypeOf?Object.setPrototypeOf(t.prototype,e):t.prototype.__proto__!==void 0?t.prototype.__proto__=e:t.prototype=e}Bo(xa,Array.prototype);var Rn=function(t,e,n){Gi(i,t);function i(r,s,o,l){var u;return o===void 0&&(o="ObservableArray"),l===void 0&&(l=!1),u=t.call(this)||this,Oe(function(){var d=new xn(o,s,l,!0);d.proxy_=Xt(u),Bi(Xt(u),E,d),r&&r.length&&u.spliceWithArray(0,0,r),$o&&Object.defineProperty(Xt(u),"0",Mo)}),u}var a=i.prototype;return a.concat=function(){this[E].atom_.reportObserved();for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];return Array.prototype.concat.apply(this.slice(),o.map(function(u){return Kt(u)?u.slice():u}))},a[n]=function(){var r=this,s=0;return Ye({next:function(){return s<r.length?{value:r[s++],done:!1}:{done:!0,value:void 0}}})},wn(i,[{key:"length",get:function(){return this[E].getArrayLength_()},set:function(s){this[E].setArrayLength_(s)}},{key:e,get:function(){return"Array"}}]),i}(xa,Symbol.toStringTag,Symbol.iterator);Object.entries(At).forEach(function(t){var e=t[0],n=t[1];e!=="concat"&&jt(Rn.prototype,e,n)});function Ra(t){return{enumerable:!1,configurable:!0,get:function(){return this[E].get_(t)},set:function(n){this[E].set_(t,n)}}}function zo(t){re(Rn.prototype,""+t,Ra(t))}function Da(t){if(t>en){for(var e=en;e<t+100;e++)zo(e);en=t}}Da(1e3);function Ko(t,e,n){return new Rn(t,e,n)}function Le(t,e){if(typeof t=="object"&&t!==null){if(Kt(t))return e!==void 0&&L(23),t[E].atom_;if(je(t))return t.atom_;if(Ne(t)){if(e===void 0)return t.keysAtom_;var n=t.data_.get(e)||t.hasMap_.get(e);return n||L(25,e,pn(t)),n}if(Xe(t)){if(!e)return L(26);var i=t[E].values_.get(e);return i||L(27,e,pn(t)),i}if(Fn(t)||Bt(t)||Ft(t))return t}else if(te(t)&&Ft(t[E]))return t[E];L(28)}function La(t,e){if(t||L(29),e!==void 0)return La(Le(t,e));if(Fn(t)||Bt(t)||Ft(t)||Ne(t)||je(t))return t;if(t[E])return t[E];L(24,t)}function pn(t,e){var n;if(e!==void 0)n=Le(t,e);else{if(zt(t))return t.name;Xe(t)||Ne(t)||je(t)?n=La(t):n=Le(t)}return n.name_}function Oe(t){var e=_e(),n=En(!0);J();try{return t()}finally{Z(),Cn(n),ce(e)}}var ai=It.toString;function Dn(t,e,n){return n===void 0&&(n=-1),vn(t,e,n)}function vn(t,e,n,i,a){if(t===e)return t!==0||1/t===1/e;if(t==null||e==null)return!1;if(t!==t)return e!==e;var r=typeof t;if(r!=="function"&&r!=="object"&&typeof e!="object")return!1;var s=ai.call(t);if(s!==ai.call(e))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!=+t?+e!=+e:+t==0?1/+t===1/e:+t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object Symbol]":return typeof Symbol!="undefined"&&Symbol.valueOf.call(t)===Symbol.valueOf.call(e);case"[object Map]":case"[object Set]":n>=0&&n++;break}t=ri(t),e=ri(e);var o=s==="[object Array]";if(!o){if(typeof t!="object"||typeof e!="object")return!1;var l=t.constructor,u=e.constructor;if(l!==u&&!(te(l)&&l instanceof l&&te(u)&&u instanceof u)&&"constructor"in t&&"constructor"in e)return!1}if(n===0)return!1;n<0&&(n=-1),i=i||[],a=a||[];for(var d=i.length;d--;)if(i[d]===t)return a[d]===e;if(i.push(t),a.push(e),o){if(d=t.length,d!==e.length)return!1;for(;d--;)if(!vn(t[d],e[d],n-1,i,a))return!1}else{var f=Object.keys(t),c;if(d=f.length,Object.keys(e).length!==d)return!1;for(;d--;)if(c=f[d],!(de(e,c)&&vn(t[c],e[c],n-1,i,a)))return!1}return i.pop(),a.pop(),!0}function ri(t){return Kt(t)?t.slice():Ie(t)||Ne(t)||it(t)||je(t)?Array.from(t.entries()):t}function Ye(t){return t[Symbol.iterator]=Go,t}function Go(){return this}["Symbol","Map","Set"].forEach(function(t){var e=On();typeof e[t]=="undefined"&&L("MobX requires global '"+t+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:lo,extras:{getDebugName:pn},$mobx:E});class Pa{constructor(e){T(this,"channel");T(this,"listeners",new Map);T(this,"eventQueue",new Map);try{this.channel=new BroadcastChannel(e),this.channel.onmessage=n=>this.handleMessage(n),this.channel.onmessageerror=n=>ue.error("NizzaBroadcastChannel:",n)}catch(n){throw ue.error("Failed to create NizzaBroadcastChannel:",n),n}}on(e,n){return this.subscribeToEvent(e,n),{off:()=>this.unsubscribeFromEvent(e,n)}}emit(e,n,i={}){this.emitEvent(e,n,i)}handleMessage(e){const n=e.data,{name:i}=n;for(const[a,r]of this.listeners.entries())this.matchWildcard(a,i)&&r.forEach(s=>s({...n,wildcard:a}))}subscribeToEvent(e,n){if(typeof e!="string"||typeof n!="function"){const i=new Error("Invalid arguments");throw ue.error(i),i}for(const[i,a]of this.listeners.entries())if(this.matchWildcard(i,e)){a.add(n);const r=this.eventQueue.get(i);r&&(r.forEach(s=>{n({...s,wildcard:i})}),this.eventQueue.delete(i));return}this.listeners.set(e,new Set([n]))}emitEvent(e,n,i){if(typeof e!="string"){const s=new Error("Invalid arguments");throw ue.error(s),s}const a={name:e,data:n,attrs:i},r=Array.from(this.getMatchingListeners(e));if(r.length)for(const[s,o]of r)o({...a,wildcard:s});else this.eventQueue.has(e)||this.eventQueue.set(e,[]),this.eventQueue.get(e).push(a);this.channel.postMessage(a)}*getMatchingListeners(e){for(const[n,i]of this.listeners.entries())if(this.matchWildcard(n,e))for(const a of i)yield[n,a]}unsubscribeFromEvent(e,n){if(this.listeners.has(e)){const i=this.listeners.get(e);i.delete(n),i.size===0&&this.listeners.delete(e)}}matchWildcard(e,n){const i=e.replace(/\*/g,"[^:]*").replace(/\*\*/g,".*");return new RegExp(`^${i}$`).test(n)}}let Qo=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,n)=>(n&=63,n<36?e+=n.toString(36):n<62?e+=(n-26).toString(36).toUpperCase():n>62?e+="-":e+="_",e),"");const Ia=(t=8)=>Qo(t),Ho=t=>{const e=Object.entries(t).reduce((n,[i,a])=>a!==void 0?`${n}${n?"&":""}${i}=${a}`:n,"");return e?`?${e}`:""};function qo(){const t=new Error().stack.split(`
4
- `);return t.length<3?"":t[2].trim().substring(3)}var Va=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function ja(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ua={exports:{}};(function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(Va,function(){var e=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"],r={},s=null;function o(g,k){var N=g[k];if(typeof N.bind=="function")return N.bind(g);try{return Function.prototype.bind.call(N,g)}catch{return function(){return Function.prototype.apply.apply(N,[g,arguments])}}}function l(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(g){return g==="debug"&&(g="log"),typeof console===n?!1:g==="trace"&&i?l:console[g]!==void 0?o(console,g):console.log!==void 0?o(console,"log"):e}function d(){for(var g=this.getLevel(),k=0;k<a.length;k++){var N=a[k];this[N]=k<g?e:this.methodFactory(N,g,this.name)}if(this.log=this.debug,typeof console===n&&g<this.levels.SILENT)return"No console available for logging"}function f(g){return function(){typeof console!==n&&(d.call(this),this[g].apply(this,arguments))}}function c(g,k,N){return u(g)||f.apply(this,arguments)}function _(g,k){var N=this,R,P,w,C="loglevel";typeof g=="string"?C+=":"+g:typeof g=="symbol"&&(C=void 0);function I(h){var b=(a[h]||"silent").toUpperCase();if(!(typeof window===n||!C)){try{window.localStorage[C]=b;return}catch{}try{window.document.cookie=encodeURIComponent(C)+"="+b+";"}catch{}}}function j(){var h;if(!(typeof window===n||!C)){try{h=window.localStorage[C]}catch{}if(typeof h===n)try{var b=window.document.cookie,F=encodeURIComponent(C),p=b.indexOf(F+"=");p!==-1&&(h=/^([^;]+)/.exec(b.slice(p+F.length+1))[1])}catch{}return N.levels[h]===void 0&&(h=void 0),h}}function m(){if(!(typeof window===n||!C)){try{window.localStorage.removeItem(C)}catch{}try{window.document.cookie=encodeURIComponent(C)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function y(h){var b=h;if(typeof b=="string"&&N.levels[b.toUpperCase()]!==void 0&&(b=N.levels[b.toUpperCase()]),typeof b=="number"&&b>=0&&b<=N.levels.SILENT)return b;throw new TypeError("log.setLevel() called with invalid level: "+h)}N.name=g,N.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},N.methodFactory=k||c,N.getLevel=function(){return w!=null?w:P!=null?P:R},N.setLevel=function(h,b){return w=y(h),b!==!1&&I(w),d.call(N)},N.setDefaultLevel=function(h){P=y(h),j()||N.setLevel(h,!1)},N.resetLevel=function(){w=null,m(),d.call(N)},N.enableAll=function(h){N.setLevel(N.levels.TRACE,h)},N.disableAll=function(h){N.setLevel(N.levels.SILENT,h)},N.rebuild=function(){if(s!==N&&(R=y(s.getLevel())),d.call(N),s===N)for(var h in r)r[h].rebuild()},R=y(s?s.getLevel():"WARN");var S=j();S!=null&&(w=y(S)),d.call(N)}s=new _,s.getLogger=function(k){if(typeof k!="symbol"&&typeof k!="string"||k==="")throw new TypeError("You must supply a name when creating a logger.");var N=r[k];return N||(N=r[k]=new _(k,s.methodFactory)),N};var O=typeof window!==n?window.log:void 0;return s.noConflict=function(){return typeof window!==n&&window.log===s&&(window.log=O),s},s.getLoggers=function(){return r},s.default=s,s})})(Ua);var Ma=Ua.exports;const ht=ja(Ma);var $a={exports:{}};(function(t){(function(e,n){t.exports?t.exports=n():e.prefix=n(e)})(Va,function(e){var n=function(d){for(var f=1,c=arguments.length,_;f<c;f++)for(_ in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],_)&&(d[_]=arguments[f][_]);return d},i={template:"[%t] %l:",levelFormatter:function(d){return d.toUpperCase()},nameFormatter:function(d){return d||"root"},timestampFormatter:function(d){return d.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},a,r={},s=function(d){if(!d||!d.getLogger)throw new TypeError("Argument is not a root logger");a=d},o=function(d,f){if(!d||!d.setLevel)throw new TypeError("Argument is not a logger");var c=d.methodFactory,_=d.name||"",O=r[_]||r[""]||i;function g(k,N,R){var P=c(k,N,R),w=r[R]||r[""],C=w.template.indexOf("%t")!==-1,I=w.template.indexOf("%l")!==-1,j=w.template.indexOf("%n")!==-1;return function(){for(var m="",y=arguments.length,S=Array(y),h=0;h<y;h++)S[h]=arguments[h];if(_||!r[R]){var b=w.timestampFormatter(new Date),F=w.levelFormatter(k),p=w.nameFormatter(R);w.format?m+=w.format(F,p,b):(m+=w.template,C&&(m=m.replace(/%t/,b)),I&&(m=m.replace(/%l/,F)),j&&(m=m.replace(/%n/,p))),S.length&&typeof S[0]=="string"?S[0]=m+" "+S[0]:S.unshift(m)}P.apply(void 0,S)}}return r[_]||(d.methodFactory=g),f=f||{},f.template&&(f.format=void 0),r[_]=n({},O,f),d.setLevel(d.getLevel()),a||d.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),d},l={reg:s,apply:o},u;return e&&(u=e.prefix,l.noConflict=function(){return e.prefix===l&&(e.prefix=u),l}),l})})($a);var Wo=$a.exports;const si=ja(Wo);let Ba=class{constructor(e){T(this,"defaultLevel",Ma.levels.INFO);T(this,"namePrefix");this.namePrefix=e?`${e}-`:"",ht.setDefaultLevel(this.defaultLevel),si.reg(ht),si.apply(ht,{template:"[%t] %l (%n)",nameFormatter:n=>{var i;return(i=n==null?void 0:n.toLowerCase())!=null?i:""},timestampFormatter:()=>new Date().toTimeString().slice(0,8)})}createLogger(e){const n=this.namePrefix+e.toLowerCase(),i=ht.getLogger(n),a=localStorage.getItem(`loglevel:${n}`);return a?i.setLevel(a):i.setLevel(this.defaultLevel),i}};const Q=class Q{constructor(){T(this,"instanceId",Ia());T(this,"_config",null);T(this,"_account");T(this,"_productDataSource");T(this,"_eventBus",new Pa("nizza"));T(this,"log",new Ba("nz"));_a(this,{_config:z,_account:z,_productDataSource:z,config:pe,account:pe,accountName:pe,configure:fe,setProductDataSource:fe},{name:"NizzaStore",autoBind:!0})}static instance(){var i,a;const e=!!window.nizza,n=Number(Q.version)>(Number((i=window.nizza)==null?void 0:i.version)||0);if(console.log("🚀 ~ NizzaStore ~ instance ~ shouldUpdateWindowInstance:",n,e,Number(Q.version),Number((a=window.nizza)==null?void 0:a.version)||0),e)if(n){const r=new Q;console.log("🚀 ~ NizzaStore ~ migrating..."),r.migrateFrom(window.nizza),Q._instance=r,window.nizza=r,window.nz=r}else e&&!Q._instance&&(console.log("🚀 ~ NizzaStore ~ instance ~ usando window.nizza"),Q._instance=window.nizza);else{console.log("🚀 ~ NizzaStore ~ FIRST instance");const r=new Q;Q._instance=r,window.nizza=r,window.nz=r}return Q._instance}migrateFrom(e){console.log("🚀 ~ NizzaStore ~ migrateFrom ~ oldInstance:",e,e._productDataSource),ho(()=>{console.log("🚀 ~ NizzaStore ~ runInAction"),this._config=e._config,this._account=e._account,this._productDataSource=e._productDataSource}),this._eventBus=e._eventBus}async configure(e){var n;try{const i=(n=this._config)==null?void 0:n.account;if(this._config=e,i!==e.account){const a=await lr(e.account);this.setAccount(a)}if(e.getProductDataSource){const a=await e.getProductDataSource();this.setProductDataSource(a)}}catch(i){console.error("Error configuring NizzaStore:",i)}}setAccount(e){this._account=e}setProductDataSource(e){this._productDataSource=e}get version(){return Q.version}get config(){return this._config}get account(){return this._account}get accountName(){var e;return(e=this._config)==null?void 0:e.account}get productDataSource(){return this._productDataSource}get eventBus(){return this._eventBus}};T(Q,"version","2"),T(Q,"_instance");let et=Q;const Ln=()=>et.instance(),za=Ln(),Jo=za.log.createLogger("main"),ue=za.log.createLogger("core");function Ce(t){return t!=null&&typeof t=="object"&&t["@@functional/placeholder"]===!0}function yt(t){return function e(n){return arguments.length===0||Ce(n)?e:t.apply(this,arguments)}}function Pn(t){return function e(n,i){switch(arguments.length){case 0:return e;case 1:return Ce(n)?e:yt(function(a){return t(n,a)});default:return Ce(n)&&Ce(i)?e:Ce(n)?yt(function(a){return t(a,i)}):Ce(i)?yt(function(a){return t(n,a)}):t(n,i)}}}const Zo=Number.isInteger||function(e){return e<<0===e};function Xo(t){return Object.prototype.toString.call(t)==="[object String]"}var Yo=Pn(function(e,n){var i=e<0?n.length+e:e;return Xo(n)?n.charAt(i):n[i]}),el=yt(function(e){return e==null}),tl=Pn(function(e,n){return e.map(function(i){for(var a=n,r=0,s;r<i.length;){if(a==null)return;s=i[r],a=Zo(s)?Yo(s,a):a[s],r+=1}return a})}),nl=Pn(function(e,n){return tl([e],n)[0]});class ut extends Error{constructor(e,n,i){super(n),this.value=i,this.name=e}toDTO(){return{name:this.name,message:this.message,...this.value&&{value:this.value}}}}class Ka extends ut{constructor(e){super("RESOURCE_NOT_FOUND_ERROR",`Resource with id '${e}' not found.`,e)}}class Ga extends ut{constructor(e){var n;super("APP_UNEXPECTED_ERROR",(n=e.message)!=null?n:"An unexpected error occurred.",e)}}class il extends ut{constructor(){super("APP_ACCOUNT_INVALID_ERROR","Account not defined")}}class Qa extends ut{constructor(e){super("INVALID_NIZZA_GLOBAL_OBJECT_ERROR",`
4
+ `);return t.length<3?"":t[2].trim().substring(3)}var Va=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function ja(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ua={exports:{}};(function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(Va,function(){var e=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"],r={},s=null;function o(g,k){var N=g[k];if(typeof N.bind=="function")return N.bind(g);try{return Function.prototype.bind.call(N,g)}catch{return function(){return Function.prototype.apply.apply(N,[g,arguments])}}}function l(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(g){return g==="debug"&&(g="log"),typeof console===n?!1:g==="trace"&&i?l:console[g]!==void 0?o(console,g):console.log!==void 0?o(console,"log"):e}function d(){for(var g=this.getLevel(),k=0;k<a.length;k++){var N=a[k];this[N]=k<g?e:this.methodFactory(N,g,this.name)}if(this.log=this.debug,typeof console===n&&g<this.levels.SILENT)return"No console available for logging"}function f(g){return function(){typeof console!==n&&(d.call(this),this[g].apply(this,arguments))}}function c(g,k,N){return u(g)||f.apply(this,arguments)}function _(g,k){var N=this,R,P,w,C="loglevel";typeof g=="string"?C+=":"+g:typeof g=="symbol"&&(C=void 0);function I(h){var b=(a[h]||"silent").toUpperCase();if(!(typeof window===n||!C)){try{window.localStorage[C]=b;return}catch{}try{window.document.cookie=encodeURIComponent(C)+"="+b+";"}catch{}}}function j(){var h;if(!(typeof window===n||!C)){try{h=window.localStorage[C]}catch{}if(typeof h===n)try{var b=window.document.cookie,F=encodeURIComponent(C),p=b.indexOf(F+"=");p!==-1&&(h=/^([^;]+)/.exec(b.slice(p+F.length+1))[1])}catch{}return N.levels[h]===void 0&&(h=void 0),h}}function m(){if(!(typeof window===n||!C)){try{window.localStorage.removeItem(C)}catch{}try{window.document.cookie=encodeURIComponent(C)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function y(h){var b=h;if(typeof b=="string"&&N.levels[b.toUpperCase()]!==void 0&&(b=N.levels[b.toUpperCase()]),typeof b=="number"&&b>=0&&b<=N.levels.SILENT)return b;throw new TypeError("log.setLevel() called with invalid level: "+h)}N.name=g,N.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},N.methodFactory=k||c,N.getLevel=function(){return w!=null?w:P!=null?P:R},N.setLevel=function(h,b){return w=y(h),b!==!1&&I(w),d.call(N)},N.setDefaultLevel=function(h){P=y(h),j()||N.setLevel(h,!1)},N.resetLevel=function(){w=null,m(),d.call(N)},N.enableAll=function(h){N.setLevel(N.levels.TRACE,h)},N.disableAll=function(h){N.setLevel(N.levels.SILENT,h)},N.rebuild=function(){if(s!==N&&(R=y(s.getLevel())),d.call(N),s===N)for(var h in r)r[h].rebuild()},R=y(s?s.getLevel():"WARN");var S=j();S!=null&&(w=y(S)),d.call(N)}s=new _,s.getLogger=function(k){if(typeof k!="symbol"&&typeof k!="string"||k==="")throw new TypeError("You must supply a name when creating a logger.");var N=r[k];return N||(N=r[k]=new _(k,s.methodFactory)),N};var O=typeof window!==n?window.log:void 0;return s.noConflict=function(){return typeof window!==n&&window.log===s&&(window.log=O),s},s.getLoggers=function(){return r},s.default=s,s})})(Ua);var Ma=Ua.exports;const ht=ja(Ma);var $a={exports:{}};(function(t){(function(e,n){t.exports?t.exports=n():e.prefix=n(e)})(Va,function(e){var n=function(d){for(var f=1,c=arguments.length,_;f<c;f++)for(_ in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],_)&&(d[_]=arguments[f][_]);return d},i={template:"[%t] %l:",levelFormatter:function(d){return d.toUpperCase()},nameFormatter:function(d){return d||"root"},timestampFormatter:function(d){return d.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},a,r={},s=function(d){if(!d||!d.getLogger)throw new TypeError("Argument is not a root logger");a=d},o=function(d,f){if(!d||!d.setLevel)throw new TypeError("Argument is not a logger");var c=d.methodFactory,_=d.name||"",O=r[_]||r[""]||i;function g(k,N,R){var P=c(k,N,R),w=r[R]||r[""],C=w.template.indexOf("%t")!==-1,I=w.template.indexOf("%l")!==-1,j=w.template.indexOf("%n")!==-1;return function(){for(var m="",y=arguments.length,S=Array(y),h=0;h<y;h++)S[h]=arguments[h];if(_||!r[R]){var b=w.timestampFormatter(new Date),F=w.levelFormatter(k),p=w.nameFormatter(R);w.format?m+=w.format(F,p,b):(m+=w.template,C&&(m=m.replace(/%t/,b)),I&&(m=m.replace(/%l/,F)),j&&(m=m.replace(/%n/,p))),S.length&&typeof S[0]=="string"?S[0]=m+" "+S[0]:S.unshift(m)}P.apply(void 0,S)}}return r[_]||(d.methodFactory=g),f=f||{},f.template&&(f.format=void 0),r[_]=n({},O,f),d.setLevel(d.getLevel()),a||d.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),d},l={reg:s,apply:o},u;return e&&(u=e.prefix,l.noConflict=function(){return e.prefix===l&&(e.prefix=u),l}),l})})($a);var Wo=$a.exports;const si=ja(Wo);let Ba=class{constructor(e){T(this,"defaultLevel",Ma.levels.INFO);T(this,"namePrefix");this.namePrefix=e?`${e}-`:"",ht.setDefaultLevel(this.defaultLevel),si.reg(ht),si.apply(ht,{template:"[%t] %l (%n)",nameFormatter:n=>{var i;return(i=n==null?void 0:n.toLowerCase())!=null?i:""},timestampFormatter:()=>new Date().toTimeString().slice(0,8)})}createLogger(e){const n=this.namePrefix+e.toLowerCase(),i=ht.getLogger(n),a=localStorage.getItem(`loglevel:${n}`);return a?i.setLevel(a):i.setLevel(this.defaultLevel),i}};const Q=class Q{constructor(){T(this,"instanceId",Ia());T(this,"_config",null);T(this,"_account");T(this,"_productDataSource");T(this,"_eventBus",new Pa("nizza"));T(this,"log",new Ba("nz"));_a(this,{_config:z,_account:z,_productDataSource:z,config:pe,account:pe,accountName:pe,configure:fe,setProductDataSource:fe},{name:"NizzaStore",autoBind:!0})}static instance(){var i,a;const e=!!window.nizza,n=Number(Q.version)>(Number((i=window.nizza)==null?void 0:i.version)||0);if(console.log("🚀 ~ NizzaStore ~ instance ~ shouldUpdateWindowInstance:",n,e,Number(Q.version),Number((a=window.nizza)==null?void 0:a.version)||0),e)if(n){const r=new Q;console.log("🚀 ~ NizzaStore ~ migrating..."),r.migrateFrom(window.nizza),Q._instance=r,window.nizza=r,window.nz=r}else e&&(console.log("🚀 ~ NizzaStore ~ instance ~ usando window.nizza"),Q._instance=window.nizza);else{console.log("🚀 ~ NizzaStore ~ FIRST instance");const r=new Q;Q._instance=r,window.nizza=r,window.nz=r}return Q._instance}migrateFrom(e){console.log("🚀 ~ NizzaStore ~ migrateFrom ~ oldInstance:",e,e._productDataSource),ho(()=>{console.log("🚀 ~ NizzaStore ~ runInAction"),this._config=e._config,this._account=e._account,this._productDataSource=e._productDataSource}),this._eventBus=e._eventBus}async configure(e){var n;try{const i=(n=this._config)==null?void 0:n.account;if(this._config=e,i!==e.account){const a=await lr(e.account);this.setAccount(a)}if(e.getProductDataSource){const a=await e.getProductDataSource();this.setProductDataSource(a)}}catch(i){console.error("Error configuring NizzaStore:",i)}}setAccount(e){this._account=e}setProductDataSource(e){this._productDataSource=e}get version(){return Q.version}get config(){return this._config}get account(){return this._account}get accountName(){var e;return(e=this._config)==null?void 0:e.account}get productDataSource(){return this._productDataSource}get eventBus(){return this._eventBus}};T(Q,"version","2"),T(Q,"_instance");let et=Q;const Ln=()=>et.instance(),za=Ln(),Jo=za.log.createLogger("main"),ue=za.log.createLogger("core");function Ce(t){return t!=null&&typeof t=="object"&&t["@@functional/placeholder"]===!0}function yt(t){return function e(n){return arguments.length===0||Ce(n)?e:t.apply(this,arguments)}}function Pn(t){return function e(n,i){switch(arguments.length){case 0:return e;case 1:return Ce(n)?e:yt(function(a){return t(n,a)});default:return Ce(n)&&Ce(i)?e:Ce(n)?yt(function(a){return t(a,i)}):Ce(i)?yt(function(a){return t(n,a)}):t(n,i)}}}const Zo=Number.isInteger||function(e){return e<<0===e};function Xo(t){return Object.prototype.toString.call(t)==="[object String]"}var Yo=Pn(function(e,n){var i=e<0?n.length+e:e;return Xo(n)?n.charAt(i):n[i]}),el=yt(function(e){return e==null}),tl=Pn(function(e,n){return e.map(function(i){for(var a=n,r=0,s;r<i.length;){if(a==null)return;s=i[r],a=Zo(s)?Yo(s,a):a[s],r+=1}return a})}),nl=Pn(function(e,n){return tl([e],n)[0]});class ut extends Error{constructor(e,n,i){super(n),this.value=i,this.name=e}toDTO(){return{name:this.name,message:this.message,...this.value&&{value:this.value}}}}class Ka extends ut{constructor(e){super("RESOURCE_NOT_FOUND_ERROR",`Resource with id '${e}' not found.`,e)}}class Ga extends ut{constructor(e){var n;super("APP_UNEXPECTED_ERROR",(n=e.message)!=null?n:"An unexpected error occurred.",e)}}class il extends ut{constructor(){super("APP_ACCOUNT_INVALID_ERROR","Account not defined")}}class Qa extends ut{constructor(e){super("INVALID_NIZZA_GLOBAL_OBJECT_ERROR",`
5
5
  Configuration property invalid: "${e}".
6
6
 
7
7
  It looks like you are trying to use a configuration property that is required but is "undefined", make sure you have initialized the global object "nizza".
package/dist/index.mjs CHANGED
@@ -3389,7 +3389,7 @@ const G = class G {
3389
3389
  const r = new G();
3390
3390
  console.log("🚀 ~ NizzaStore ~ migrating..."), r.migrateFrom(window.nizza), G._instance = r, window.nizza = r, window.nz = r;
3391
3391
  } else
3392
- e && !G._instance && (console.log("🚀 ~ NizzaStore ~ instance ~ usando window.nizza"), G._instance = window.nizza);
3392
+ e && (console.log("🚀 ~ NizzaStore ~ instance ~ usando window.nizza"), G._instance = window.nizza);
3393
3393
  else {
3394
3394
  console.log("🚀 ~ NizzaStore ~ FIRST instance");
3395
3395
  const r = new G();
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/core",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.cjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/core",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.cjs",