1import{r as x,j as e}from"./jsx-runtime-kF-aRxYe.js";import{d as P}from"./index-Bqrpnaua.js";import{A as R}from"./AgeVerificationModal-sv9Ywylj.js";import{P as V}from"./ModalHeader-DWiMASWX.js";import{u as q}from"./TrackingPropsContext-D9Tr5upw.js";import{u as B}from"./purchasePromise-DeGboFXJ.js";import{u as D}from"./LoginForm-YrPMrN8c.js";import{u as z}from"./useRequiredCensoring-pIvMUN5C.js";import{l as L}from"./lWrap-Jt5rHUnd.js";import{a as H}from"./userStore-C_dDgx32.js";import{c as W}from"./classArr-BJpvUMjH.js";import{n as j}from"./numberToString-CyEMjXx7.js";import{u as G}from"./useTranslation-vq6sm7dQ.js";const I=[20,50,100,200,500,1e3,0],ie=({children:w,studioId:m,tributeAmount:n,modalTitle:v,definedAmounts:o=I,addButtonTitle:N=L("Add {{amount}} Tip"),customTriggerData:b={},tipChangeOption:C})=>{const{isRequiredCensoring:p,showAgeVerificationModal:h,setShowAgeVerificationModal:u}=z(),[l,g]=x.useState(!1),[s,a]=x.useState(void 0),{trackingPropsForButtons:k}=q(),[i,c]=x.useState(void 0),y={producer_id:m,item_type:"tribute",amount:i},{store:{currency:r}}=H(),S={category:"tip-store",element:"button",location:k.location,custom:{...b,studioid:m,amount:String(y.amount)}},{updateTipFromCart:$,isLoading:T,removeFromCart:A}=B(y,S,void 0,C),{t:d}=G(),M=()=>{if(p)u(!0);else{g(!0),c(n||o[0]),n&&!o.includes(n)&&a(n);const t={category:"tip-store",action:"click",element:"button",location:k.location,custom:{studioid:m,...b}};P.trackEvent(t)}},_=()=>{c(void 0),a(void 0)},f=()=>{g(!1),_()},E=t=>{t&&o.includes(t)&&a(void 0),c(t)},F=t=>{a(t===0?void 0:t),c(t)};return D(l),e.jsxs(e.Fragment,{children:[w(M,T,A),l&&e.jsxs(V,{children:[e.jsx("div",{className:`fixed bg-black left-0 top-0 transition-opacity duration-300 ${l?"opacity-70 h-full w-full":"opacity-0"}`,style:{zIndex:l?102:-10},"aria-label":"overlay",onClick:f}),e.jsxs("div",{className:"bg-white fixed bottom-20 w-full rounded-t-md md:rounded py-5 left-0 md:top-1/2 md:bottom-auto md:left-1/2 md:w-[400px] md:-translate-x-1/2 md:-translate-y-1/2 md:rotate-0 md:skew-x-0 md:skew-y-0 md:scale-100",style:{zIndex:102},children:[e.jsx("button",{type:"button",className:"absolute top-5 right-5",onClick:f,children:e.jsx("i",{className:"icon-x text-2xl text-black"})}),e.jsx("div",{className:"font-medium w-full text-center text-black text-base px-5",children:d(v)}),e.jsx("div",{className:"text-sm w-full text-center text-black/50 px-5 mt-1",children:d("Send your love to this creator")}),e.jsx("hr",{className:"w-full border-black/10 mt-5"}),e.jsx("fieldset",{className:"px-7",children:o.map(t=>e.jsxs("label",{className:"mt-5 flex items-center justify-between",children:[e.jsx("input",{name:"tribute",type:"radio",checked:t===i||!o.includes(i)&&!t,className:W("peer/field","order-2","appearance-none","flex-shrink-0","h-6 w-6","border border-solid border-black rounded-full","bg-transparent","checked:shadow-[inset_0_0_0_4px_#ffffff]","checked:before:bg-c4s-green-primary checked:bg-none checked:bg-c4s-green-primary","hover:checked:bg-c4s-green-primary","focus:checked:bg-c4s-green-primary","transition duration-100","cursor-pointer"),onChange:()=>E(t)}),e.jsx("span",{className:"text-black peer-checked/field:text-c4s-green-primary peer-checked/field:font-normal block text-sm cursor-pointer order-1",children:t?e.jsxs(e.Fragment,{children:[(r==null?void 0:r.symbol)||"$"," ",j(t)]}):e.jsxs("div",{className:"flex",children:[e.jsx("input",{min:5,max:5e3,type:"number",placeholder:d("Between {{min}} and {{max}}",{min:`${(r==null?void 0:r.symbol)||"$"}5`,max:`${(r==null?void 0:r.symbol)||"$"}5,000`}),className:"peer/custom order-2 p-0 ml-1 text-sm focus:outline-none focus:ring-transparent border-0 border-b border-solid border-b-c4s-green-primary focus:border-b-c4s-green-primary invalid:border-b-c4s-red-primary invalid:text-c4s-red-primary [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",style:{width:"175px"},autoFocus:!t,value:s??"",onChange:O=>F(Number(O.target.value))}),e.jsx("span",{className:"order-1 peer-invalid/custom:text-c4s-red-primary",children:(r==null?void 0:r.symbol)||"$"})]})})]},t))}),e.jsx("div",{className:"w-full px-5 mt-7",children:e.jsxs("button",{type:"button",disabled:!i&&typeof s>"u"||typeof s<"u"&&(s<5||s>5e3),className:"bg-c4s-green-primary h-11 flex items-center justify-center rounded-md uppercase whitespace-nowrap w-full text-white disabled:opacity-50 disabled:cursor-not-allowed",onClick:()=>{f(),$()},children:[e.jsx("i",{className:"icon-add-to-cart text-xl"}),d(N,{amount:`${(r==null?void 0:r.symbol)||"$"}${j(i)}`})]})})]})]}),h&&e.jsx(R,{showOnLoad:p&&h,isAgeVerificationRequired:p,hideEnter:!0,onEnter:()=>{u(!1)},onClose:()=>{u(!1)}})]})};export{ie as T};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.