"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[13],{458:(t,e,n)=>{n.r(e),n.d(e,{CART_EVENT_TYPES:()=>l,MIDDLEWARE_TYPES:()=>h,OutsmartlyCart:()=>v,SYSTEM_EVENT_TYPES:()=>u});var i=n(101),r=n.n(i),o=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{d(i.next(t))}catch(t){o(t)}}function s(t){try{d(i.throw(t))}catch(t){o(t)}}function d(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}d((i=i.apply(t,e||[])).next())}))};function a(t,e=undefined){return new Promise(((n,i)=>{!function(){var r;o(this,void 0,void 0,(function*(){try{let o;if("function"==typeof(null===(r=window.__APP_CONFIG__)||void 0===r?void 0:r.fetchCartJSON))o=yield window.__APP_CONFIG__.fetchCartJSON(t,e);else{const n=yield fetch(t,e);o=yield n.json()}"Cart Error"==o.message&&i(o),n(o)}catch(t){i(t)}}))}()}))}const s=()=>a("/cart.json",{credentials:"include",headers:new Headers({"Content-Type":"application/json","x-requested-with":"XMLHttpRequest"})}),d=t=>a("/cart/update.js",{method:"POST",body:JSON.stringify({updates:t}),headers:new Headers({"Content-Type":"application/json","x-requested-with":"XMLHttpRequest"}),credentials:"include"}),c=t=>a("/cart/change.js",{method:"POST",body:JSON.stringify(t),headers:new Headers({"Content-Type":"application/json","x-requested-with":"XMLHttpRequest"}),credentials:"include"}),l={onInit:"onInit",onAddToCart:"onAddToCart",onChangeCart:"onChangeCart",onUpdateCart:"onUpdateCart",onAddDiscount:"onAddDiscount"},u={onSyncCartStart:"onSyncCartStart",onSyncCartError:"onSyncCartError",onSyncCartSuccess:"onSyncCartSuccess"},h={onBeforeInit:"onBeforeInit",onAfterInit:"onAfterInit",onBeforeChangeCart:"onBeforeChangeCart",onAfterChangeCart:"onAfterChangeCart",onBeforeUpdateCart:"onAfterUpdateCart",onAfterUpdateCart:"onAfterUpdateCart",onBeforeAddToCart:"onBeforeAddToCart",onAfterAddToCart:"onAfterAddToCart",onBeforeAddDiscount:"onBeforeAddDiscount",onAfterAddDiscount:"onAfterAddDiscount",onAfterPageLoad:"onAfterPageLoad",onPageLoad:"onPageLoad"};class f{constructor(){this._timer=NaN,this.prevActionStateUpdateShouldBeCanceled=!1,this._clearTimer=()=>{clearTimeout(this._timer),this._timer=NaN},this.runDelayed=(t,e=1333)=>(this.prevActionStateUpdateShouldBeCanceled=!0,this._clearTimer(),new Promise(((n,i)=>{this._timer=setTimeout((()=>{return e=this,r=void 0,a=function*(){try{this._clearTimer();const e=yield t();n(e)}catch(t){i(t)}finally{this.prevActionStateUpdateShouldBeCanceled=!1}},new((o=void 0)||(o=Promise))((function(t,n){function i(t){try{d(a.next(t))}catch(t){n(t)}}function s(t){try{d(a.throw(t))}catch(t){n(t)}}function d(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(i,s)}d((a=a.apply(e,r||[])).next())}));var e,r,o,a}),e)})))}}class y{constructor(t){this.logs=[],this.debugMode=!0,this.addLog=t=>{this.debugMode&&this.logs.push(Object.assign(Object.assign({},t),{timestamp:Number(new Date)}))},this.readAllLogs=t=>{this.debugMode?t?console.log("Logger.readAllLogs",this.logs.filter((e=>e.invokerName==t))):console.log("Logger.readAllLogs",this.logs):console.log("Logger.debugMode off")},this.debugMode=t}}class p{constructor(){this._cacheForCombinedPayload=new Map,this.addPayload=(t,e=!1)=>{const n=this._cacheForCombinedPayload.get(String(t.id));if(n&&e){const e=Object.assign(Object.assign({},t),{quantity:n.quantity+t.quantity});this._cacheForCombinedPayload.set(String(t.id),e)}else this._cacheForCombinedPayload.set(String(t.id),t)},this.clearPayloads=()=>{this._cacheForCombinedPayload.clear()},this.getCombinedPayload=()=>[...this._cacheForCombinedPayload.values()]}}const _=({cart:t,cleanedPayload:e})=>{const n=t.items.reduce(((t,e)=>{if("--instant-cart-placeholder"==e.handle){const n=function({quantity:t,final_price:e}){return{quantity:t,final_price:e*t,discount:0,original_price:e}}(e);return t.item_count+=n.quantity,t.total_price+=n.final_price,t.total_discount+=n.discount,t.original_total_price+=n.original_price,t}const n=function({quantity:t,final_price:e,line_level_total_discount:n,original_price:i}){return{quantity:t,final_price:e*t,discount:n,original_price:i}}(e);return t.item_count+=n.quantity,t.total_price+=n.final_price,t.total_discount+=n.discount,t.original_total_price+=n.original_price,t}),{item_count:0,total_price:0,total_discount:0,original_total_price:0});return t.item_count=n.item_count,t.total_price=n.total_price,t.total_discount=n.total_discount,t.original_total_price=n.original_total_price,{cart:t,cleanedPayload:e}};function g(t){if(!("image"in t)||!("product_title"in t))throw"A makeCartItemPlaceholder payload does not contain required fields";const e=t;return void 0!==e.selling_plan?Object.assign(Object.assign({},e),{title:e.product_title,handle:"--instant-cart-placeholder",sku:"--instant-cart-placeholder",product_type:"--instant-cart-placeholder",variant_id:Number(e.id),key:`${e.id}`,selling_plan_allocation:{selling_plan:{id:e.selling_plan}}}):Object.assign(Object.assign({},e),{title:e.product_title,handle:"--instant-cart-placeholder",sku:"--instant-cart-placeholder",product_type:"--instant-cart-placeholder",variant_id:Number(e.id),key:`${e.id}`})}const m={token:"...",note:"",attributes:{},original_total_price:0,total_price:0,total_discount:0,total_weight:0,item_count:0,items:[],requires_shipping:!0,currency:"$",items_subtotal_price:0,cart_level_discount_applications:[]};var C=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{d(i.next(t))}catch(t){o(t)}}function s(t){try{d(i.throw(t))}catch(t){o(t)}}function d(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}d((i=i.apply(t,e||[])).next())}))};class v{constructor(t=!0,e=1333){this.emitter=r()(),this.middlewares=[],this.custom={},this.delay=1333,this._setter=null,this._getter=null,this._newActionInvoked=!1,this._cart=m,this._delayerForAdd=new f,this._delayerForUpdate=new f,this._delayerForChange=new f,this._cacheForPayloads=new p,this.logger=null,this.connectWithState=(t,e)=>{this._setter=t,this._getter=e},this.getLastState=()=>this._cart,this.addMiddleware=(t,e)=>{this.middlewares.push({onEvent:t,action:e})},this._runAllMiddlewaresFor=(t,e,n)=>C(this,void 0,void 0,(function*(){if(n)return;const i=this.middlewares.filter((e=>e.onEvent==t)).map((({action:t})=>t));if(0!=i.length)for(const t of i)yield t(e)})),this.init=(t=!1)=>C(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";try{yield this._runAllMiddlewaresFor(h.onBeforeInit,{ref:this},t),this._emitStart(null,"onInit");const e=yield s();this._cart=e,this._setter((()=>({cart:e}))),this._emitDone(null,"onInit"),yield this._runAllMiddlewaresFor(h.onAfterInit,{ref:this},t)}catch(t){this._emitError(t,null,"onInit")}})),this._instantAddToCart=t=>{const e=this.getLastState();if(!e)throw"No-op case - cart is not initialized";if(!this.logger)throw"No-op case - Logger not initialized";const{logger:n}=this;let i={};return{cleanedPayload:{items:t.items.map((t=>{const{cart:r,cleanedPayload:o}=function(t,e,n){const i="image"in e;if(!t)throw"A no-op problem in cart library! - cart not exist";if(!("id"in e))throw"A no-op problem in cart library! - payload dont have id";const{id:r,quantity:o,properties:a,selling_plan:s}=e,d={id:r,quantity:o,properties:a,selling_plan:s},c=t.items.findIndex(((t,e)=>n=>{const{id:i}=t,r=String(n.id)==String(i),o=n.variant_title==e,a=function(t,e){const{selling_plan_allocation:n}=e,i=void 0!==n,r=void 0!==t.selling_plan;if(!i&&!r)return!0;if(!i)return!1;if(!r)return!1;const{selling_plan:o}=n;return t.selling_plan==o.id}(t,n);return!!r&&!!o&&a})(d,e.variant_title)),l=-1==c;return n.addLog({invokerName:"instantAddSingleItem.isNewItemInCart",payload:{foundIndex:c,isNewItemInCart:l,itemIds:[...t.items.map((({key:t})=>String(t)))],cleanedPayload:d,isInInstantMode:i}}),l?i?(t.items.unshift(g(e)),n.addLog({invokerName:"instantAddSingleItem.isNewItemInCart.isInInstantMode",payload:{foundIndex:c,isNewItemInCart:l,itemIds:[...t.items.map((({key:t})=>String(t)))],cleanedPayload:d,isInInstantMode:i}}),_({cart:t,cleanedPayload:d})):_({cart:t,cleanedPayload:e}):(t.items=t.items.reduce(((t,e,n)=>(n==c&&(e.quantity=e.quantity+Number(o)),[...t,e])),[]),n.addLog({invokerName:"instantAddSingleItem.!isNewItemInCart",payload:{foundIndex:c,isNewItemInCart:l,itemIds:[...t.items.map((({variant_id:t})=>String(t)))],cleanedPayload:d,isInInstantMode:i}}),_({cart:t,cleanedPayload:d}))}(e,t,n);return this._cacheForPayloads.addPayload(o,!0),i=r,o}))},instantCart:i}},this.addToCart=(t,e=!1)=>C(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";if(!this._getter)throw"No-op case - you should add zustand getter first";const n=Object.assign({},this._cart);this._newActionInvoked=!0;try{yield this._runAllMiddlewaresFor(h.onBeforeAddToCart,{payload:t,ref:this},e),this._emitStart(t,"onAddToCart");const{instantCart:n}=this._instantAddToCart(t);this._setter((()=>({cart:n})));const i=()=>C(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";const n=this._cacheForPayloads.getCombinedPayload();if(this._cacheForPayloads.clearPayloads(),0==n.length)return;this._newActionInvoked=!1,yield(t=>o(void 0,void 0,void 0,(function*(){return a("/cart/add.js",{method:"POST",body:JSON.stringify(t),headers:new Headers({"Content-Type":"application/json","x-requested-with":"XMLHttpRequest"}),credentials:"include"})})))({items:n});const i=yield s();this._newActionInvoked||(this._cart=i,this._setter((()=>({cart:this._cart}))),this._emitDone(t,"onAddToCart"),yield this._runAllMiddlewaresFor(h.onAfterAddToCart,{payload:t,ref:this},e))}));yield this._delayerForAdd.runDelayed(i,this.delay)}catch(e){this._emitError(e,t,"onAddToCart"),this._setter((()=>({cart:n})))}})),this._instantChangeCart=t=>{const e=this.getLastState();if(!e)throw"No-op case - cart is not initialized";if(!this.logger)throw"No-op case - Logger not initialized";const{logger:n}=this,{cleanedPayload:i,cart:r}=function(t,e,n){const i="image"in e;if(!t)throw"A no-op problem in cart library! - cart not exist";if(!("id"in e))throw"A no-op problem in cart library! - payload dont have id";const{id:r,quantity:o,line:a,properties:s}=e,d={id:r,quantity:o,line:a,properties:s},c=t.items.findIndex((({key:t})=>t==String(r))),l=-1!=c;if(n.addLog({invokerName:"instantChangeSingleItem.init",payload:{foundIndex:c,isItemInCart:l,itemIds:[...t.items.map((({key:t})=>t))],cleanedPayload:d,isInInstantMode:i}}),!l)return _({cart:t,cleanedPayload:d});const u=0==o;return t.items=t.items.reduce(((t,e)=>{if(e.key==String(r)){if(u)return[...t];e.quantity=Number(o)}return[...t,e]}),[]),n.addLog({invokerName:"instantChangeSingleItem.isItemInCart",payload:{foundIndex:c,isItemInCart:l,itemIds:[...t.items.map((({key:t})=>t))],cleanedPayload:d,isInInstantMode:i,removeMode:u}}),_({cart:t,cleanedPayload:d})}(e,t,n);return{cleanedPayload:i,instantCart:r}},this.changeCart=(t,e=!1)=>C(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!0;try{yield this._runAllMiddlewaresFor(h.onBeforeChangeCart,{payload:t,ref:this},e),this._emitStart(t,"onChangeCart");const{cleanedPayload:n,instantCart:i}=this._instantChangeCart(t);this._setter((()=>({cart:i}))),this._cacheForPayloads.addPayload(n,!1);const r=()=>C(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";let n=null;const i=this._cacheForPayloads.getCombinedPayload();if(this._cacheForPayloads.clearPayloads(),this._newActionInvoked=!1,1==i.length){const[t]=i;n=yield c(t)}else{const t=i.reduce(((t,{id:e,quantity:n})=>Object.assign(Object.assign({},t),{[e]:n})),{});n=yield d(t)}this._newActionInvoked||(this._cart=n,this._setter((()=>({cart:Object.assign({},this._cart)}))),this._emitDone(t,"onChangeCart"),yield this._runAllMiddlewaresFor(h.onAfterChangeCart,{payload:t,ref:this},e))}));yield this._delayerForChange.runDelayed(r,this.delay)}catch(e){this._emitError(e,t,"onChangeCart")}})),this.changeSellingPlan=(t,e=!1)=>C(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!0;try{yield this._runAllMiddlewaresFor(h.onBeforeChangeCart,{payload:t,ref:this},e),this._emitStart(t,"onChangeSellingPlan");const{quantity:n,line:i,selling_plan:r}=t,o={quantity:n,line:i,selling_plan:r},a=yield c(o);return this._cart=a,this._setter((()=>({cart:Object.assign({},this._cart)}))),this._emitDone(t,"onChangeSellingPlan"),void(yield this._runAllMiddlewaresFor(h.onAfterChangeCart,{payload:t,ref:this},e))}catch(e){this._emitError(e,t,"onChangeSellingPlan")}})),this._instantUpdateCart=t=>{const e=this.getLastState();if(!e)throw"No-op case - cart is not initialized";if(!this.logger)throw"No-op case - Logger not initialized";const{logger:n}=this;let i={};const r=Object.entries(t).reduce(((t,[r,o])=>{const{cleanedPayload:a,cart:s}=function(t,e,n,i){const r="number"!=typeof n,o=[];if(!t)throw"A no-op problem in cart library! - cart not exist";const a=t.items.findIndex((({key:t})=>t==String(e))),s=-1!=a;if(i.addLog({invokerName:"instantUpdateSingleItem.isItemInCart",payload:{foundIndex:a,isItemInCart:s,itemIds:[...t.items.map((({key:t})=>t))],isInInstantMode:r,itemExtraFields:n,id:e}}),!r){const d=n,c=0==d;return i.addLog({invokerName:"instantChangeSingleItem.!isInInstantMode",payload:{foundIndex:a,isItemInCart:s,itemIds:[...t.items.map((({key:t})=>t))],itemExtraFields:n,isInInstantMode:r,removeMode:c,id:e}}),s?(t.items=t.items.reduce(((t,n)=>{if(n.key==String(e)){if(c)return[...t];n.quantity=Number(d)}return[...t,n]}),o),i.addLog({invokerName:"instantChangeSingleItem.!isInInstantMode.isItemInCart",payload:{foundIndex:a,isItemInCart:s,itemIds:[...t.items.map((({key:t})=>t))],itemExtraFields:n,isInInstantMode:r,removeMode:c,id:e}}),_({cart:t,cleanedPayload:{[String(e)]:d}})):_({cart:t,cleanedPayload:{[String(e)]:d}})}const{quantity:d}=n,c=0==d;if(i.addLog({invokerName:"instantChangeSingleItem.isInInstantMode",payload:{foundIndex:a,isItemInCart:s,itemIds:[...t.items.map((({key:t})=>t))],itemExtraFields:n,isInInstantMode:r,removeMode:c,id:e}}),!s){const o=Object.assign({id:String(e)},n);return t.items.unshift(g(o)),i.addLog({invokerName:"instantChangeSingleItem.isInInstantMode.!isItemInCart",payload:{foundIndex:a,isItemInCart:s,itemIds:[...t.items.map((({variant_id:t})=>String(t)))],itemExtraFields:n,isInInstantMode:r,removeMode:c,id:e}}),_({cart:t,cleanedPayload:{[String(e)]:d}})}return t.items=t.items.reduce(((t,n)=>{if(n.key==String(e)){if(c)return[...t];n.quantity=Number(d)}return[...t,n]}),o),i.addLog({invokerName:"instantChangeSingleItem.isInInstantMode.isItemInCart",payload:{foundIndex:a,isItemInCart:s,itemIds:[...t.items.map((({variant_id:t})=>String(t)))],itemExtraFields:n,isInInstantMode:r,removeMode:c,id:e}}),_({cart:t,cleanedPayload:{[String(e)]:d}})}(e,r,o,n);return i=s,Object.assign(Object.assign({},t),a)}),{});return{cleanedPayload:r,instantCart:i}},this.updateCart=(t,e=!1)=>C(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!0;try{if(yield this._runAllMiddlewaresFor(h.onBeforeChangeCart,{payload:t,ref:this},e),this._emitStart(t,"onUpdateCart"),0==Object.keys(t).length)throw"updateCart payload is not valid";const{instantCart:n,cleanedPayload:i}=this._instantUpdateCart(t);this._setter((()=>({cart:n})));const r=()=>C(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!1;const n=yield d(i);this._newActionInvoked||(this._cart=n,this._setter((()=>({cart:n}))),this._emitDone(t,"onUpdateCart"),yield this._runAllMiddlewaresFor(h.onAfterChangeCart,{payload:t,ref:this},e))}));yield this._delayerForUpdate.runDelayed(r,this.delay)}catch(e){this._emitError(e,t,"onUpdateCart")}})),this.updateCartAttributes=(t,e=!1)=>C(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!0;try{if(yield this._runAllMiddlewaresFor(h.onBeforeChangeCart,{payload:t,ref:this},e),this._emitStart(t,"onUpdateCart"),0==Object.keys(t).length)throw"updateCart payload is not valid";if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!1;const n=yield(t=>a("/cart/update.js",{method:"POST",body:JSON.stringify({attributes:t}),headers:new Headers({"Content-Type":"application/json","x-requested-with":"XMLHttpRequest"}),credentials:"include"}))(t);if(this._newActionInvoked)return;this._cart=n,this._setter((()=>({cart:n}))),this._emitDone(t,"onUpdateCart"),yield this._runAllMiddlewaresFor(h.onAfterChangeCart,{payload:t,ref:this},e)}catch(e){this._emitError(e,t,"onUpdateCart")}})),this.addDiscount=(t,e=!1)=>C(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!0;try{yield this._runAllMiddlewaresFor(h.onBeforeAddDiscount,{payload:t,ref:this},e),this._emitStart(t,"onAddDiscount"),this._newActionInvoked=!1,yield(n=t,fetch(`/discount/${n}`));const i=yield s();if(this._newActionInvoked)return;this._cart=i,this._setter((()=>({cart:i}))),this._emitDone(t,"onAddDiscount"),yield this._runAllMiddlewaresFor(h.onAfterAddDiscount,{payload:t,ref:this},e)}catch(e){this._emitError(e,t,"onAddDiscount")}var n})),this.setCustom=t=>{this.custom=Object.assign(Object.assign({},this.custom),t(this.custom))},this.getCustom=t=>t(this.custom),this.applyFixesForUI=t=>{if(void 0===t)return;if(!this._setter||!this._getter)throw"OutsmartlyCart.applyFixesForUI not connected to state";const e=t=>{t.persisted&&this.init()};t.addEventListener("pageshow",(t=>{e(t)}))},this.registerOnPageLoadActions=t=>{if(void 0===t)return;if(!this._setter||!this._getter)throw"OutsmartlyCart.registerOnPageLoadActions not connected to state";const e=()=>C(this,void 0,void 0,(function*(){try{yield this._runAllMiddlewaresFor(h.onAfterPageLoad,{ref:this},!1)}catch(t){this._emitError(t,null,"onPageLoad")}}));t.document.addEventListener("DOMContentLoaded",(()=>{e(),t.__cart__=this}))},this.logger=new y(t),this.delay=e}_emitError(t,e,n){this.emitter.emit("onSyncCartError",{error:t,ref:this});const i={payload:e,error:t,ref:this};this.emitter.emit(n,i)}_emitDone(t,e){this.emitter.emit(u.onSyncCartSuccess,{payload:t,ref:this}),this.emitter.emit(e,{payload:t,ref:this})}_emitStart(t,e){this.emitter.emit(u.onSyncCartStart,{ref:this,payload:t}),this.emitter.emit(e,{payload:t,ref:this})}normalizeNativeShopifyPriceFormat(t){return Number((t/100).toFixed(2))}}},326:(t,e,n)=>{var i=n(124),r=n(327),o=n(331),a=n(339),s=n(340);(t.exports=function(t,e){var n,r,d,c,l;return arguments.length<2||"string"!=typeof t?(c=e,e=t,t=null):c=arguments[2],i(t)?(n=s.call(t,"c"),r=s.call(t,"e"),d=s.call(t,"w")):(n=d=!0,r=!1),l={value:e,configurable:n,enumerable:r,writable:d},c?o(a(c),l):l}).gs=function(t,e,n){var d,c,l,u;return"string"!=typeof t?(l=n,n=e,e=t,t=null):l=arguments[3],i(e)?r(e)?i(n)?r(n)||(l=n,n=void 0):n=void 0:(l=e,e=n=void 0):e=void 0,i(t)?(d=s.call(t,"c"),c=s.call(t,"e")):(d=!0,c=!1),u={get:e,set:n,configurable:d,enumerable:c},l?o(a(l),u):u}},337:t=>{t.exports=function(){}},331:(t,e,n)=>{t.exports=n(332)()?Object.assign:n(333)},332:t=>{t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},333:(t,e,n)=>{var i=n(334),r=n(338),o=Math.max;t.exports=function(t,e){var n,a,s,d=o(arguments.length,2);for(t=Object(r(t)),s=function(i){try{t[i]=e[i]}catch(t){n||(n=t)}},a=1;a{var i=n(337)();t.exports=function(t){return t!==i&&null!==t}},334:(t,e,n)=>{t.exports=n(335)()?Object.keys:n(336)},335:t=>{t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},336:(t,e,n)=>{var i=n(78),r=Object.keys;t.exports=function(t){return r(i(t)?Object(t):t)}},339:(t,e,n)=>{var i=n(78),r=Array.prototype.forEach,o=Object.create;t.exports=function(t){var e=o(null);return r.call(arguments,(function(t){i(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)})),e}},343:t=>{t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},338:(t,e,n)=>{var i=n(78);t.exports=function(t){if(!i(t))throw new TypeError("Cannot use null or undefined");return t}},340:(t,e,n)=>{t.exports=n(341)()?String.prototype.contains:n(342)},341:t=>{var e="razdwatrzy";t.exports=function(){return"function"==typeof e.contains&&!0===e.contains("dwa")&&!1===e.contains("foo")}},342:t=>{var e=String.prototype.indexOf;t.exports=function(t){return e.call(this,t,arguments[1])>-1}},101:(t,e,n)=>{var i,r,o,a,s,d,c,l=n(326),u=n(343),h=Function.prototype.apply,f=Function.prototype.call,y=Object.create,p=Object.defineProperty,_=Object.defineProperties,g=Object.prototype.hasOwnProperty,m={configurable:!0,enumerable:!1,writable:!0};r=function(t,e){var n,r;return u(e),r=this,i.call(this,t,n=function(){o.call(r,t,n),h.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:i=function(t,e){var n;return u(e),g.call(this,"__ee__")?n=this.__ee__:(n=m.value=y(null),p(this,"__ee__",m),m.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:r,off:o=function(t,e){var n,i,r,o;if(u(e),!g.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(i=n[t]))for(o=0;r=i[o];++o)r!==e&&r.__eeOnceListener__!==e||(2===i.length?n[t]=i[o?0:1]:i.splice(o,1));else i!==e&&i.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,i,r,o;if(g.call(this,"__ee__")&&(r=this.__ee__[t]))if("object"==typeof r){for(n=arguments.length,o=new Array(n-1),e=1;e{var i=n(329);t.exports=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(t){return!1}return!i(t)}},330:(t,e,n)=>{var i=n(124),r={object:!0,function:!0,undefined:!0};t.exports=function(t){return!!i(t)&&hasOwnProperty.call(r,typeof t)}},327:(t,e,n)=>{var i=n(328),r=/^\s*class[\s{/}]/,o=Function.prototype.toString;t.exports=function(t){return!!i(t)&&!r.test(o.call(t))}},329:(t,e,n)=>{var i=n(330);t.exports=function(t){if(!i(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},124:t=>{t.exports=function(t){return null!=t}},31:(t,e,n)=>{n.r(e),n.d(e,{default:()=>o});var i=n(2);const r="undefined"==typeof window||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?i.useEffect:i.useLayoutEffect;function o(t){const e="function"==typeof t?function(t){let e;const n=new Set,i=(t,i)=>{const r="function"==typeof t?t(e):t;if(r!==e){const t=e;e=i?r:Object.assign({},e,r),n.forEach((n=>n(e,t)))}},r=()=>e,o={setState:i,getState:r,subscribe:(t,i,o)=>i||o?((t,i=r,o=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let a=i(e);function s(){const n=i(e);if(!o(a,n)){const e=a;t(a=n,e)}}return n.add(s),()=>n.delete(s)})(t,i,o):(n.add(t),()=>n.delete(t)),destroy:()=>n.clear()};return e=t(i,r,o),o}(t):t,n=(t=e.getState,n=Object.is)=>{const[,o]=(0,i.useReducer)((t=>t+1),0),a=e.getState(),s=(0,i.useRef)(a),d=(0,i.useRef)(t),c=(0,i.useRef)(n),l=(0,i.useRef)(!1),u=(0,i.useRef)();let h;void 0===u.current&&(u.current=t(a));let f=!1;(s.current!==a||d.current!==t||c.current!==n||l.current)&&(h=t(a),f=!n(u.current,h)),r((()=>{f&&(u.current=h),s.current=a,d.current=t,c.current=n,l.current=!1}));const y=(0,i.useRef)(a);r((()=>{const t=()=>{try{const t=e.getState(),n=d.current(t);c.current(u.current,n)||(s.current=t,u.current=n,o())}catch(t){l.current=!0,o()}},n=e.subscribe(t);return e.getState()!==y.current&&t(),n}),[]);const p=f?h:u.current;return(0,i.useDebugValue)(p),p};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const t=[n,e];return{next(){const e=t.length<=0;return{value:t.shift(),done:e}}}},n}}}]);