1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[47307],{26298:(e,a,t)=>{"use strict";t.d(a,{FS:()=>r,Ky:()=>n,eq:()=>s});var l=t(98734);let n=[{value:"AL",label:"Alabama"},{value:"AK",label:"Alaska"},{value:"AZ",label:"Arizona"},{value:"AR",label:"Arkansas"},{value:"CA",label:"California"},{value:"CO",label:"Colorado"},{value:"CT",label:"Connecticut"},{value:"DE",label:"Delaware"},{value:"DC",label:"District of Columbia"},{value:"FL",label:"Florida"},{value:"GA",label:"Georgia"},{value:"HI",label:"Hawaii"},{value:"ID",label:"Idaho"},{value:"IL",label:"Illinois"},{value:"IN",label:"Indiana"},{value:"IA",label:"Iowa"},{value:"KS",label:"Kansas"},{value:"KY",label:"Kentucky"},{value:"LA",label:"Louisiana"},{value:"ME",label:"Maine"},{value:"MD",label:"Maryland"},{value:"MA",label:"Massachusetts"},{value:"MI",label:"Michigan"},{value:"MN",label:"Minnesota"},{value:"MS",label:"Mississippi"},{value:"MO",label:"Missouri"},{value:"MT",label:"Montana"},{value:"NE",label:"Nebraska"},{value:"NV",label:"Nevada"},{value:"NH",label:"New Hampshire"},{value:"NJ",label:"New Jersey"},{value:"NM",label:"New Mexico"},{value:"NY",label:"New York"},{value:"NC",label:"North Carolina"},{value:"ND",label:"North Dakota"},{value:"OH",label:"Ohio"},{value:"OK",label:"Oklahoma"},{value:"OR",label:"Oregon"},{value:"PA",label:"Pennsylvania"},{value:"RI",label:"Rhode Island"},{value:"SC",label:"South Carolina"},{value:"SD",label:"South Dakota"},{value:"TN",label:"Tennessee"},{value:"TX",label:"Texas"},{value:"UT",label:"Utah"},{value:"VT",label:"Vermont"},{value:"VA",label:"Virginia"},{value:"WA",label:"Washington"},{value:"WV",label:"West Virginia"},{value:"WI",label:"Wisconsin"},{value:"WY",label:"Wyoming"},{value:"PR",label:"Puerto Rico"},{value:"GU",label:"Guam"},{value:"VI",label:"U.S. Virgin Islands"},{value:"AS",label:"American Samoa"},{value:"MP",label:"Northern Mariana Islands"}];n.map(e=>e.value);let r=[{value:"US",label:"United States"},{value:"CA",label:"Canada"},{value:"MX",label:"Mexico"},{value:"GB",label:"United Kingdom"},{value:"IE",label:"Ireland"},{value:"FR",label:"France"},{value:"DE",label:"Germany"},{value:"ES",label:"Spain"},{value:"IT",label:"Italy"},{value:"PT",label:"Portugal"},{value:"NL",label:"Netherlands"},{value:"BE",label:"Belgium"},{value:"SE",label:"Sweden"},{value:"NO",label:"Norway"},{value:"FI",label:"Finland"},{value:"DK",label:"Denmark"},{value:"CH",label:"Switzerland"},{value:"AT",label:"Austria"},{value:"PL",label:"Poland"},{value:"CZ",label:"Czechia"},{value:"HU",label:"Hungary"},{value:"GR",label:"Greece"},{value:"RO",label:"Romania"},{value:"BG",label:"Bulgaria"},{value:"EE",label:"Estonia"},{value:"LV",label:"Latvia"},{value:"LT",label:"Lithuania"},{value:"AU",label:"Australia"},{value:"NZ",label:"New Zealand"},{value:"JP",label:"Japan"},{value:"KR",label:"South Korea"},{value:"CN",label:"China"},{value:"SG",label:"Singapore"},{value:"HK",label:"Hong Kong"},{value:"TW",label:"Taiwan"},{value:"IN",label:"India"},{value:"AE",label:"United Arab Emirates"},{value:"SA",label:"Saudi Arabia"},{value:"ZA",label:"South Africa"},{value:"NG",label:"Nigeria"},{value:"EG",label:"Egypt"},{value:"BR",label:"Brazil"},{value:"AR",label:"Argentina"},{value:"CL",label:"Chile"},{value:"CO",label:"Colombia"},{value:"PE",label:"Peru"},{value:"UY",label:"Uruguay"}],i=/^\d{5}(-\d{4})?$/;function s(e){return i.test(e)}l.Yj().trim().toUpperCase().regex(/^[A-Z]{2}$/,"Country must be a 2-letter ISO code")},33628:(e,a,t)=>{"use strict";t.d(a,{U:()=>l});let l={MERCHANT_ID:"merchant.com.apprentice.tattoo",MERCHANT_DISPLAY_NAME:"Apprentice",MOBILE_RETURN_URL:"apprentice://payment/complete",COUNTRY_CODE:"US",CURRENCY_CODE:"USD"}},39560:(e,a,t)=>{"use strict";t.r(a),t.d(a,{PaymentLinkDrawer:()=>O});var l=t(95155),n=t(12115),r=t(44517),i=t(84052),s=t(5917),o=t(65229),c=t(37586),d=t(23664),u=t(20371),m=t(14491),p=t(55157),b=t(99190),h=t(25016);function x(e){let{balanceCents:a,depositCents:t,selected:n,customCents:r,onSelect:i,onCustomChange:s}=e,o="custom"===n&&r>0,c=[{kind:"balance",value:(0,b.vv)(a),subLabel:"balance"},{kind:"deposit",value:(0,b.vv)(t),subLabel:"deposit"},{kind:"custom",value:o?(0,b.vv)(r):"Custom",subLabel:o?"custom"
1:"enter"}];return(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)("div",{className:"flex gap-2",children:c.map(e=>{let a=n===e.kind;return(0,l.jsxs)("button",{type:"button","aria-pressed":a,onClick:()=>i(e.kind),className:(0,h.cn)("min-h-11 flex-1 rounded-lg p-[11px_8px] text-center transition-colors",a?"border-[1.5px] border-accent-500 bg-accent-50 dark:border-accent-400 dark:bg-accent-400/10":"border border-gray-200 bg-white dark:border-gray-600 dark:bg-primary-700"),children:[(0,l.jsx)("p",{className:(0,h.cn)("text-theme-sm tabular-nums",a?"font-bold text-accent-700 dark:text-accent-400":"font-semibold text-gray-700 dark:text-white"),children:e.value}),(0,l.jsx)("p",{className:"mt-0.5 text-caption text-gray-500 dark:text-primary-400",children:e.subLabel})]},e.kind)})}),"custom"===n&&(0,l.jsx)(p.T,{amountCents:r,onChange:s})]})}var v=t(10547),f=t(75426),y=t(12834),g=t(75817);function k(e){let{sentAt:a,openedAt:t,paidAt:n}=e,r=[{key:"sent",label:"Sent",timestamp:a},{key:"opened",label:"Opened",timestamp:t},{key:"paid",label:"Paid",timestamp:n}];return(0,l.jsx)("div",{className:"flex items-center gap-1.5",role:"list","aria-label":"Payment link status",children:r.map((e,a)=>{let t=null!==e.timestamp;return(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("span",{role:"listitem",className:(0,h.cn)("rounded-full p-[4px_10px] text-caption-lg font-semibold",t?"bg-gray-100 text-gray-700 dark:bg-white/10 dark:text-white":"border border-dashed border-gray-300 text-gray-500 dark:border-primary-500 dark:text-primary-400"),children:e.label}),a<r.length-1&&(0,l.jsx)("span",{className:"text-gray-300 dark:text-primary-500","aria-hidden":"true",children:"\xb7"})]},e.key)})})}function N(e){let{payUrl:a,recipientLabel:t,sentAt:r,openedAt:i,paidAt:o,onResend:c,onCancel:d,deliveredVia:u="sms"}=e,[m,p]=(0,n.useState)(!1);async function b(){await (0,g.l)(a,{showToast:!0,successMessage:"Link copied",onSuccess:()=>{p(!0),setTimeout(()=>p(!1),2e3)}})}return(0,l.jsxs)("div",{className:"flex flex-col gap-[18px]",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,l.jsx)("div",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-full bg-success-100 text-success-700 dark:bg-success-500/20 dark:text-success-200",children:(0,l.jsx)(s.A,{className:"h-[17px] w-[17px]",strokeWidth:2,"aria-hidden":"true"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-theme-xl font-extrabold text-primary-500 dark:text-white",children:"Link sent"}),(0,l.jsx)("p",{className:"text-compact-sm text-gray-500 dark:text-primary-400",children:"sms"===u?"".concat(t," got a text. It works for 7 days"):"email"===u?"".concat(t," got an email. It works for 7 days"):"Link is ready. It works for 7 days"})]})]}),(0,l.jsxs)("div",{className:"flex flex-col items-center gap-2 rounded-xl bg-white p-[18px]",children:[(0,l.jsx)(y.QRCodeSVG,{value:a,size:132,title:"QR code for the payment link"}),(0,l.jsx)("p",{className:"text-caption text-gray-700",children:"In the chair? Have them scan it"})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("button",{type:"button",onClick:b,className:"flex min-h-11 items-center justify-center gap-[7px] rounded-md border border-gray-200 p-3 text-sm font-semibold text-ink transition-colors hover:bg-gray-50 dark:border-white/15 dark:text-white dark:hover:bg-white/[0.05]",children:[(0,l.jsx)(f.A,{className:"h-[15px] w-[15px] shrink-0","aria-hidden":"true"}),m?"Copied":"Copy link"]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{type:"button",onClick:c,className:"min-h-11 flex-1 rounded-md text-compact font-medium text-gray-500 transition-colors hover:text-gray-700 dark:text-primary-400 dark:hover:text-primary-300",children:"Resend"}),(0,l.jsx)("button",{type:"button",onClick:d,className:"min-h-11 flex-1 rounded-md text-compact font-medium text-error-600 transition-colors hover:text-error-700 dark:text-error-400 dark:hover:text-error-300",children:"Cancel link"})]})]}),(0,l.jsxs)("div",{className:"rounded-xl border border-gray-200 bg-white p-3 dark:border-white/[0.07] dark:bg-primary-700",children:[(0,l.jsx)("p",{className:"mb-2 text-xs text-gray-500 dark:text-primary-400",children:"You'll see it move on the project"}),(0,l.jsx)(k,{sentAt:r,openedAt:i,paidAt:o})]})]})}var j=t(95838),w=t(72083),C=t(35235),S=t(63892);t(61914),t(263),t(59561),t(38354),t(55643),t(73579),t(26298),t(84461),t(28830),t(19124);var _=t(32949);t(25632),t(89129),t(61583),t(87358);var T=t(94803);t(32352),t(33018),t(70682);var A=t(8525),E=t(1955);let R="dark -m-3 bg-primary-900 p-3 text-white sm:-m-4 sm:p-4";function I(e,a,t){return"custom"===e&&0===a?null:a<1e3?"Minimum payment amount is ".concat((0,b.vv)(1e3)):"custom"===e&&a>t?"Cannot exceed outstanding balance of ".concat((0,b.vv)(t)):null}function M(e){let{icon:a,label:t,selected:n,onToggle:r}=e;return(0,l.jsxs)("button",{type:"button","aria-pressed":n,onClick:r,className:(0,h.cn)("flex min-h-11 items-center justify-between gap-3 rounded-lg p-3 text-left transition-colors",n?"border-[1.5px] border-white bg-primary-700":"border border-white/15"),children:[(0,l.jsxs)("span",{className:"flex items-center gap-2 text-compact font-medium text-white",children:[a,t]}),n?(0,l.jsx)(s.A,{className:"h-4 w-4 shrink-0 text-success-400","aria-hidden":"true"}):(0,l.jsx)("span",{className:"h-4 w-4 shrink-0 rounded-full border border-white/30","aria-hidden":"true"})]})}function P(e,a,t,l){return{kind:"setup",title:e,body:a,primaryAction:{label:"Try again",onClick:t},secondaryAction:l}}function O(e){let{isOpen:a,onClose:t,projectId:s,clientId:p,artistId:f,shopId:y,appointmentId:g,onSuccess:k}=e,O=(0,i.rv)(),F=(0,E.NE)(y,null==O?void 0:O.shops),[D,L]=(0,n.use
1State)("balance"),[U,B]=(0,n.useState)(0),[H,W]=(0,n.useState)(!0),[V,G]=(0,n.useState)(7),[K,Y]=(0,n.useState)(!1),[z,J]=(0,n.useState)([]),[Z,q]=(0,n.useState)(null),[X,$]=(0,n.useState)(null),[Q,ee]=(0,n.useState)(!0),[ea,et]=(0,n.useState)(null),[el,en]=(0,n.useState)(!1),[er,ei]=(0,n.useState)(null),[es,eo]=(0,n.useState)(null),[ec,ed]=(0,n.useState)(null),eu=(0,n.useCallback)(e=>{J(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),em=(0,n.useMemo)(()=>{var e;return Z?(0,b.ob)(null!=(e=Z.deposit_amount)?e:0):0},[Z]),ep=(0,n.useMemo)(()=>Z?(0,T.d)({artist_override_price:Z.artist_override_price,original_calculated_price:Z.original_calculated_price,deposit_amount:Z.deposit_amount,payment_total_received_cents:Z.payment_total_received_cents,refunded_total_cents:Z.refunded_total_cents}):0,[Z]),eb=(0,n.useMemo)(()=>"balance"===D?ep:"deposit"===D?em:U,[D,ep,em,U]),eh=(0,n.useMemo)(()=>I(D,eb,ep),[D,eb,ep]),ex=(0,n.useMemo)(()=>Math.round(20*eb/100),[eb]),ev=(0,n.useMemo)(()=>[null==X?void 0:X.firstName,null==X?void 0:X.lastName].filter(Boolean).join(" ").trim()||(null==X?void 0:X.email)||"Your client",[X]),ef=(0,n.useMemo)(()=>{if(Z)return Z.project_name?"".concat(ev," \xb7 ").concat(Z.project_name):ev},[Z,ev]),ey=(0,n.useCallback)(async()=>{ee(!0),et(null);try{let e=(0,A.getSupabaseClient)(),{data:a,error:t}=await e.from("tattoo_projects").select("*").eq("id",s).single();if(t||!a)return void et("We couldn't load this project's details.");q(a);let{data:l,error:n}=await e.from("user_profiles").select("first_name, last_name, normalized_email, normalized_phone").eq("id",p).single();if(!n&&l){let e=l.normalized_phone||void 0,a=l.normalized_email||void 0;$({firstName:l.first_name||void 0,lastName:l.last_name||void 0,email:a,phone:e}),J(e?["sms"]:a?["email"]:[])}}catch(e){_.vF.error("Failed to fetch payment link data",{error:e}),et("Something went wrong loading this project. Please try again.")}finally{ee(!1)}},[s,p]);(0,n.useEffect)(()=>{if(!a){L("balance"),B(0),W(!0),G(7),Y(!1),ei(null),eo(null),ed(null),en(!1);return}ey()},[a,ey]);let eg=(0,n.useCallback)(async()=>{let e=I(D,eb,ep);if(e)return void r.oR.error(e);en(!0),ei(null);try{let e=await fetch("/api/payment-links/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:s,clientId:p,artistId:f,shopId:y,appointmentId:g,amountType:"custom"===D?"partial":D,amountCents:eb,tipEnabled:H,expiresInDays:V})});if(!e.ok){let a=await (0,E.u_)(e);if((0,E.As)(a))return void ei((0,E.ur)({shopId:y,canManageShopPayments:F,onClose:t,body:"Set up Stripe Connect before you create a payment link."}));_.vF.error("Failed to create payment link",{status:e.status,error:a}),ei(P("We couldn't create this link","Something went wrong before it was created. No money was involved.",()=>void eg(),{label:"Cancel",onClick:t}));return}let a=await e.json();if(eo(a),null==k||k(),z.length>0)try{let e=await fetch("/api/payment-links/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({linkId:a.linkId,channels:z})});if(e.ok)ed(new Date().toISOString());else{let a=await (0,E.u_)(e);if((0,E.As)(a))return void ei((0,E.ur)({shopId:y,canManageShopPayments:F,onClose:t,body:"The link was created. Set up Stripe Connect before you send it."}));_.vF.error("Failed to auto-send payment link",{status:e.status}),r.oR.error("The link was created. Sending failed. You can resend it below.")}}catch(e){_.vF.error("Failed to auto-send payment link",{error:e}),r.oR.error("The link was created. Sending failed. You can resend it below.")}}catch(e){_.vF.error("Failed to create payment link",{error:e}),ei(P("We couldn't create this link","Something went wrong before it was created. No money was involved.",()=>void eg(),{label:"Cancel",onClick:t}))}finally{en(!1)}},[D,eb,ep,s,p,f,y,g,H,V,z,k,t,F]),ek=(0,n.useCallback)(async()=>{if(es)try{let e=z.length>0?z:["email"],a=await fetch("/api/payment-links/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({linkId:es.linkId,channels:e})});if(!a.ok){let e=await (0,E.u_)(a);if((0,E.As)(e))return void ei((0,E.ur)({shopId:y,canManageShopPayments:F,onClose:t,body:"Set up Stripe Connect before you send this payment link."}));_.vF.error("Failed to resend payment link",{status:a.status}),ei(P("That link couldn't be resent","Try again in a moment.",()=>void ek(),{label:"Back",onClick:()=>ei(null)}));return}ed(new Date().toISOString()),r.oR.success("Payment link sent")}catch(e){_.vF.error("Failed to resend payment link",{error:e}),ei(P("That link couldn't be resent","Try again in a moment.",()=>void ek(),{label:"Back",onClick:()=>ei(null)}))}},[es,z,t,y,F]),eN=(0,n.useCallback)(async()=>
1{if(es)try{let e=await fetch("/api/payment-links/cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({linkId:es.linkId})});if(!e.ok){_.vF.error("Failed to cancel payment link",{status:e.status}),ei(P("That link couldn't be cancelled","Try again in a moment.",()=>void eN(),{label:"Back",onClick:()=>ei(null)}));return}r.oR.success("Payment link cancelled"),t()}catch(e){_.vF.error("Failed to cancel payment link",{error:e}),ei(P("That link couldn't be cancelled","Try again in a moment.",()=>void eN(),{label:"Back",onClick:()=>ei(null)}))}},[es,t]),ej=es?"".concat("https://app.useapprentice.com","/pay/").concat(es.token):"",ew=(0,n.useMemo)(()=>ec?z.includes("sms")?"sms":"email":"none",[ec,z]),eC=Q||ea||er||es?void 0:(0,l.jsxs)("div",{className:(0,h.cn)(R,S.oH,"flex-col-reverse sm:flex-row"),children:[(0,l.jsx)(j.A,{type:"button",variant:"outline",onClick:t,disabled:el,className:"w-full sm:w-auto",children:"Cancel"}),(0,l.jsx)(j.A,{type:"button",variant:"primary",onClick:()=>void eg(),disabled:el||!!eh||eb<1e3,className:"w-full sm:w-auto",children:el?"Sending...":"".concat(z.length>0?"Send":"Create"," link \xb7 ").concat((0,b.vv)(eb))})]}),eS=(0,l.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h2",{className:"truncate text-lg font-extrabold leading-tight text-white",children:"Send payment link"}),ef&&(0,l.jsx)("p",{className:"mt-0.5 truncate text-compact text-primary-400",children:ef})]}),(0,l.jsx)("button",{type:"button",onClick:t,disabled:el,"aria-label":"Close Send payment link",className:(0,h.cn)("flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/[0.15] disabled:opacity-50",C.R$),children:(0,l.jsx)(o.A,{className:"h-4 w-4","aria-hidden":"true"})})]});return(0,l.jsx)(u.u,{open:a,onOpenChange:e=>!e&&t(),title:"Send payment link",description:ef,footer:eC,onBeforeClose:()=>!el,mobilePresentation:{mode:"content"},size:"sm",hideHeader:!0,children:(0,l.jsxs)("div",{className:(0,h.cn)(R,"min-h-full"),children:[eS,Q?(0,l.jsx)(w.kL,{variant:"form",sections:4}):ea?(0,l.jsx)(v.R,{kind:"setup",title:"We couldn't load this project",body:ea,primaryAction:{label:"Try again",onClick:()=>void ey()}}):er?(0,l.jsx)(v.R,{...er}):es?(0,l.jsx)(N,{payUrl:ej,recipientLabel:ev,sentAt:ec,openedAt:null,paidAt:null,deliveredVia:ew,onResend:()=>void ek(),onCancel:()=>void eN()}):(0,l.jsxs)("div",{className:"flex flex-col gap-5","data-testid":"payment-link-form",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"mb-2 text-compact font-semibold text-primary-400",children:"Amount"}),(0,l.jsx)(x,{balanceCents:ep,depositCents:em,selected:D,customCents:U,onSelect:L,onCustomChange:B}),eh&&(0,l.jsx)("p",{role:"alert",className:"mt-2 text-compact text-error-300",children:eh})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsx)("p",{className:"text-compact font-semibold text-primary-400",children:"Send to"}),(null==X?void 0:X.phone)&&(0,l.jsx)(M,{icon:(0,l.jsx)(c.A,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),label:"Text message \xb7 ".concat(X.phone),selected:z.includes("sms"),onToggle:()=>eu("sms")}),(0,l.jsx)(M,{icon:(0,l.jsx)(d.A,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),label:(null==X?void 0:X.email)?"Email \xb7 ".concat(X.email):"Email (optional)",selected:z.includes("email"),onToggle:()=>eu("email")})]}),(0,l.jsxs)("div",{className:"rounded-xl border border-white/[0.07] bg-primary-700 p-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("p",{className:"text-compact text-primary-400",children:["Tips ",H?"on":"off"," \xb7 works for ",V," days"]}),(0,l.jsx)("button",{type:"button",onClick:()=>Y(e=>!e),className:"text-compact font-semibold text-accent-300",children:K?"Done":"Change"})]}),K&&(0,l.jsxs)("div",{className:"mt-3 flex flex-col gap-3 border-t border-white/[0.07] pt-3",children:[(0,l.jsxs)("label",{className:"flex min-h-11 cursor-pointer items-center justify-between",children:[(0,l.jsx)("span",{className:"text-compact text-white",children:"Add a tip option"}),(0,l.jsx)(m.A,{id:"tip-enabled",checked:H,onChange:W})]}),H&&eb>0&&(0,l.jsxs)("p",{className:"text-compact-sm text-primary-400",children:["Suggested tip: ",(0,b.vv)(ex)," (",20,"%)"]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{htmlFor:"link-expires-in-days",className:"text-compact text-primary-400",children:"Works for (days)"}),(0,l.jsx)("input",{id:"link-expires-in-days",type:"number",min:1,max:30,value:V,onChange:e=>G(parseInt(e.target.value,10)||7),className:"mt-1 w-full rounded-md border border-white/15 bg-primary-950 p-2 text-sm text-white"})]})]})]})]})]})})}},42634:()=>{},55157:(e,a,t)=>{"use strict";t.d(a,{T:()=>d});
1var l=t(95155),n=t(12115),r=t(50564),i=t(25016);let s=["1","2","3","4","5","6","7","8","9",".","0","delete"];function o(e){let a=Number.isFinite(e)&&e>0?Math.trunc(e):0;return{dollars:String(Math.floor(a/100)),cents:String(a%100).padStart(2,"0")}}function c(e,a){return 100*(parseInt(e||"0",10)||0)+(null===a?0:parseInt(a.padEnd(2,"0"),10)||0)}function d(e){let{amountCents:a,onChange:t,chips:d,selectedChipCents:u,balanceCents:m,"data-testid":p}=e,b=(0,n.useRef)(null),[h,x]=(0,n.useState)(()=>o(a).dollars),[v,f]=(0,n.useState)(null);function y(e,a){let l=c(e,a);b.current=l,x(e),f(a),t(l)}function g(){null===v&&y(h,"")}function k(){if(null!==v)return void y(h,v.length>0?v.slice(0,-1):null);y(h.length>1?h.slice(0,-1):"0",null)}(0,n.useEffect)(()=>{a!==b.current&&(x(o(a).dollars),f(null))},[a]);let N=c(h,v),j=(null!=v?v:"").padEnd(2,"0");return(0,l.jsxs)("div",{className:"flex flex-col gap-5","data-testid":p,children:[(0,l.jsxs)("div",{className:"pt-[26px] text-center",children:[(0,l.jsxs)("p",{className:"text-title-lg font-extrabold leading-none tracking-tight text-primary-500 tabular-nums dark:text-white",children:["$",h.replace(/\B(?=(\d{3})+(?!\d))/g,","),(0,l.jsxs)("span",{className:"text-gray-300 dark:text-primary-400",children:[".",j]})]}),void 0!==m&&N>m&&(0,l.jsx)("p",{className:"mt-2 text-compact font-medium text-error-700 dark:text-error-300",children:"That's more than what's left."})]}),d&&d.length>0&&(0,l.jsx)("div",{className:"flex flex-wrap items-center justify-center gap-2",children:d.map(e=>{let a=u===e.amountCents;return(0,l.jsx)("button",{type:"button","aria-pressed":a,onClick:()=>{y(o(e.amountCents).dollars,null)},className:(0,i.cn)("min-h-11 rounded-full border px-4 py-2 text-sm font-medium transition-colors",a?"border-[1.5px] border-accent-500 bg-accent-50 text-accent-700 dark:border-accent-400 dark:bg-accent-400/10 dark:text-accent-400":"border-gray-200 bg-white text-gray-700 dark:border-gray-600 dark:bg-primary-700 dark:text-gray-300"),children:e.label},e.label)})}),(0,l.jsx)("div",{className:"grid grid-cols-3 gap-1",children:s.map(e=>"delete"===e?(0,l.jsx)("button",{type:"button","aria-label":"Delete",onClick:k,className:"flex h-[52px] min-h-11 items-center justify-center rounded-md text-gray-500 transition-colors hover:bg-gray-50 dark:text-primary-400 dark:hover:bg-white/[0.03]",children:(0,l.jsx)(r.A,{className:"h-6 w-6","aria-hidden":"true"})},e):"."===e?(0,l.jsx)("button",{type:"button",onClick:g,className:"flex h-[52px] min-h-11 items-center justify-center rounded-md text-2xl font-medium text-gray-500 transition-colors hover:bg-gray-50 dark:text-primary-400 dark:hover:bg-white/[0.03]",children:"."},e):(0,l.jsx)("button",{type:"button",onClick:()=>(function(e){if(null!==v){if(v.length>=2)return;y(h,v+e);return}h.length>=7||y("0"===h?e:h+e,null)})(e),className:"flex h-[52px] min-h-11 items-center justify-center rounded-md text-2xl font-medium text-ink transition-colors hover:bg-gray-50 dark:text-white dark:hover:bg-white/[0.03]",children:e},e))})]})}},59561:(e,a,t)=>{"use strict";t.d(a,{oq:()=>n});var l=t(38354);function n(e){var a,t;let{depositCents:n,platformFeeBps:r=l.PREP_CONSTANTS.DEFAULT_PLATFORM_FEE_BPS,feeHandlingMode:i="pass_to_client",paymentChannel:s="online"}=e,o=null!=(a=e.stripeRate)?a:"card_present"===s?l.PREP_CONSTANTS.STRIPE_RATE_CARD_PRESENT:l.PREP_CONSTANTS.STRIPE_RATE,c=null!=(t=e.stripeFixedCents)?t:"card_present"===s?l.PREP_CONSTANTS.STRIPE_FIXED_CENTS_CARD_PRESENT:l.PREP_CONSTANTS.STRIPE_FIXED_CENTS;if(n<=0)throw Error("Deposit amount must be positive");if(!Number.isInteger(n))throw Error("Deposit amount must be an integer (cents)");let d=Math.round(r/1e4*n);if("absorb"===i){let e=Math.ceil(o*n+c),a=n-d-e;if(a<1)throw Error("Absorbed fees must leave at least one cent for the connected account");return{currency:"usd",deposit_cents:n,platform_fee_cents:d,processing_fee_cents:e,total_charge_cents:n,recipient_receives_cents:a,fee_handling_mode:"absorb"}}let u=Math.ceil((c+o*(n+d))/(1-o));return{currency:"usd",deposit_cents:n,platform_fee_cents:d,processing_fee_cents:u,total_charge_cents:n+d+u,recipient_receives_cents:n,fee_handling_mode:"pass_to_client"}}},89129:(e,a,t)=>{"use strict";t.d(a,{H8:()=>n}),t(33628);
1var l=t(87358);function n(e,a,t){var n,r;return!function(){if("force-live"===l.env.STRIPE_TEST_MODE)return!1;if("true"===l.env.STRIPE_TEST_MODE||"preview"===l.env.VERCEL_ENV)return!0;let e="production";return"development"===e||"test"===e}()?null!=(r=null!=a?a:t)?r:void 0:null!=(n=null!=e?e:t)?n:void 0}}}]);
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.