"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[26],{18:function(e,t,n){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(0),o=a(n(1)),s=a(n(34));t.default=function({component:e="p",size:t="normal",color:n="black",children:a}){if(!a)return null;let i,l;switch(n){case"white":i="text-white";break;case"black":i="text-black"}switch(t){case"small":l="text-sm";break;case"normal":l="text-base";break;case"large":l="text-base md:text-lg";break;case"xlarge":l="text-lg md:text-xl"}const u={className:(0,o.default)(i,l,"div"===e&&s.default.divContentStyling)};switch(e){case"p":return(0,r.jsx)("p",Object.assign({},u,{children:a}));case"div":return(0,r.jsx)("div",Object.assign({},u,{children:a}))}}},59:function(e,t,n){var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,r)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&a(t,e,n);return r(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),l=o(n(3)),u=s(n(1)),c=s(n(296)),d=n(47);t.default=function({id:e,size:t="normal",line:n=1,item:a,onChange:r}){var o;const[s,f]=(0,l.useState)(null!==(o=null==a?void 0:a.quantity)&&void 0!==o?o:1);(0,l.useEffect)((()=>{a&&f(a.quantity)}),[a]);const b=e=>{"decrease"===e?s>1?p(s-1):1===s&&p(0):s<1e3&&p(s+1)},[h]=(0,d.useDebounceCallback)(250);function p(e){f(e),h((()=>r(e)))}return(0,i.jsx)("div",Object.assign({className:"flex"},{children:(0,i.jsxs)("div",Object.assign({className:"relative"},{children:[(0,i.jsx)("button",Object.assign({type:"button",className:(0,u.default)("absolute bottom-0 left-0 top-0 p-1 border-r border-gray-200","hover:bg-gray-200"),onClick:()=>b("decrease"),"aria-label":"Decrease quantity"},{children:(0,i.jsx)("svg",Object.assign({"aria-hidden":"true",focusable:"false",role:"presentation",className:"w-2.5 h-2.5 stroke-current",viewBox:"0 0 20 20"},{children:(0,i.jsx)("path",{fill:"#444",d:"M17.543 11.029H2.1A1.032 1.032 0 0 1 1.071 10c0-.566.463-1.029 1.029-1.029h15.443c.566 0 1.029.463 1.029 1.029 0 .566-.463 1.029-1.029 1.029z"})}))})),(0,i.jsx)("label",Object.assign({htmlFor:`Updates_${e}`,className:"hidden"},{children:"Quantity:"})),(0,i.jsx)("input",{type:"text",value:s,className:(0,u.default)("py-3 text-center border border-gray-200 outline-none",c.default.input,"small"===t&&"h-8 w-24","normal"===t&&"h-10 w-32"),onChange:e=>{p(Number(e.target.value))},id:`Updates_${e}`,name:"updates[]",pattern:"[0-9]*","data-line":n,"aria-live":"polite"}),(0,i.jsx)("button",Object.assign({type:"button",className:(0,u.default)("absolute bottom-0 right-0 top-0 p-1 border-l border-r border-gray-200","hover:bg-gray-200"),onClick:()=>b("increase"),"aria-label":"Increase quantity"},{children:(0,i.jsx)("svg",Object.assign({"aria-hidden":"true",focusable:"false",role:"presentation",className:"w-2.5 h-2.5 stroke-current",viewBox:"0 0 20 20"},{children:(0,i.jsx)("path",{fill:"#444",d:"M17.409 8.929h-6.695V2.258c0-.566-.506-1.029-1.071-1.029s-1.071.463-1.071 1.029v6.671H1.967C1.401 8.929.938 9.435.938 10s.463 1.071 1.029 1.071h6.605V17.7c0 .566.506 1.029 1.071 1.029s1.071-.463 1.071-1.029v-6.629h6.695c.566 0 1.029-.506 1.029-1.071s-.463-1.071-1.029-1.071z"})}))}))]}))}))}},297:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dateToColoquial=t.formatDuration=void 0;const n=[{unit:"hour",value:3600},{unit:"minute",value:60},{unit:"second",value:1}];function a(e){if(e<=0)return"just a moment";const t=[];let a=e;for(const{unit:e,value:r}of n){const n=Math.floor(a/r);a-=n*r;const o=n>1||0===n?e+"s":e;t.push(`${n} ${o}`)}if(1===t.length)return t[0];const r=t.pop();return`${t.join(", ")}, and ${r}`}t.formatDuration=a,t.dateToColoquial=function(e){console.log("inputDate",e);let t=new Date;try{t=new Date(e).getTime()}catch(e){console.log("error",e)}const n=(t-(new Date).getTime())/1e3;if(n<=0)return"just a moment";const r=Math.floor(n/86400);if(r<1)return a(n);if(r<30)return`${r} day${r>1?"s":""}`;if(r<365){const e=Math.floor(r/30);return`${e} month${e>1?"s":""}`}return"1 year"}},47:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useDebounceCallback=void 0;const a=n(3);t.useDebounceCallback=function(e=250){const t=(0,a.useRef)(null);return[function(n){window.clearTimeout(t.current),t.current=window.setTimeout(n,e)}]}}}]);