1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];if(null!=s)for(var a in s)s.hasOwnProperty(a)&&(e[a]=s[a])}return e}({},e._sentryModuleMetadata[(new e.Error).stack],{"_sentryBundlerPluginAppKey:opencollective-frontend":!0});var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6beb5670-90b5-4ec8-9ba4-b6ba1db02b3c",e._sentryDebugIdIdentifier="sentry-dbid-6beb5670-90b5-4ec8-9ba4-b6ba1db02b3c")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8084],{62:(e,t,s)=>{s.d(t,{H:()=>c});var a=s(14232),n=s(64177),i=s(10611),r=s(62449),l=s(2948),o=s(80207),d=s(11598);function c({host:e,canBeUsedWithAccounts:t,isBeneficiary:s}){let u=(0,r.tz)(),{toast:m}=(0,o.d)(),[x,{loading:p}]=(0,n.n)(d.ug);return{createVendorFromSearch:(0,a.useCallback)(async(a,{onSuccess:n})=>{let r=a.trim();if(r)try{let a=await x({variables:{vendor:{name:r,canBeUsedWithAccounts:t},host:(0,i.A)(e,["id","slug"])}}),l=a.data?.createVendor;if(!l)throw Error("Missing createVendor response");m({variant:"success",message:s?u.formatMessage({defaultMessage:"Beneficiary created",id:"gGYap6"}):u.formatMessage({defaultMessage:"Vendor created",id:"Ra9inC"})}),n(l)}catch(e){m({variant:"error",message:(0,l.Rp)(u,e)})}},[x,e,t,s,u,m]),isCreatingVendor:p}}},2074:(e,t,s)=>{s.d(t,{A:()=>ey});var a=s(37876),n=s(14232),i=s(670),r=s(64177),l=s(14500),o=s(92850),d=s(46525),c=s(28678),u=s(64487),m=s(22405),x=s(57154),p=s(44599),h=s(62449),g=s(5646),f=s(6435),A=s(2038),y=s(38605),j=s(16907),v=s(11046),b=s(60257),C=s(21057),M=s(13487),E=s(87058),T=s(31934),w=s(97146),I=s(46436),N=s(35205),S=s(81904),P=s(62),R=s(15192),F=s(90295),k=s(21092),O=s(30619),_=s(86937),D=s(79707),U=s(84550),L=s(19110),$=s(56593),z=s(2996),H=s(99202),B=s(89908),V=s(69756),W=s(38268),q=s(98263),G=s(47597),Y=s(78027),K=s(90983),J=s(94089),Z=s(51761),X=s(5885),Q=s(68500),ee=s(45409),et=s(58201),es=s(61270),ea=s(23052),en=s(72945),ei=s(83655),er=s(1509),el=s(55573);let eo=(0,g.Ay)(Q.Ay).withConfig({componentId:"sc-2888e309-0"})(["width:100%;max-width:576px;padding:24px 24px 16px 32px;",""],e=>e.$showSuccessModal&&(0,g.AH)(["background-image:url('/static/images/platform-tip-background.png');background-repeat:no-repeat;background-size:100%;background-position:left 0 top 0;"])),ed=({label:e,value:t,currency:s,isLargeAmount:n})=>(0,a.jsxs)(H.so,{justifyContent:"space-between",alignItems:"center",children:[(0,a.jsx)(en.L9,{fontSize:"12px",lineHeight:"18px",fontWeight:"500",children:(0,a.jsx)(h.sA,{id:"withColon",defaultMessage:"{item}:",values:{item:e}})}),(0,a.jsx)(en.L9,{fontSize:n?"18px":"12px",lineHeight:n?"27px":"18px",fontWeight:"500",children:(0,a.jsx)(z.A,{amount:t,currency:s})})]}),ec=(0,v.J1)` 2 fragment AddFundsOrderFields on Order { 3 id 4 description 5 memo 6 processedAt 7 hostFeePercent 8 totalAmount { 9 valueInCents 10 } 11 paymentProcessorFee { 12 valueInCents 13 } 14 taxAmount { 15 valueInCents 16 } 17 transactions { 18 id 19 type 20 kind 21 amount { 22 valueInCents 23 } 24 } 25 fromAccount { 26 id 27 slug 28 name 29 } 30 toAccount { 31 id 32 slug 33 name 34 stats { 35 id 36 balance { 37 valueInCents 38 } 39 } 40 } 41 accountingCategory { 42 id 43 code 44 name 45 kind 46 } 47 balanceAccountingCategory { 48 id 49 code 50 name 51 kind 52 } 53 tier { 54 id 55 legacyId 56 slug 57 name 58 } 59 } 60`,eu=(0,v.J1)` 61 mutation AddFunds( 62 $fromAccount: AccountReferenceInput! 63 $account: AccountReferenceInput! 64 $tier: TierReferenceInput 65 $amount: AmountInput! 66 $paymentProcessorFee: AmountInput 67 $description: String! 68 $memo: String 69 $processedAt: DateTime 70 $hostFeePercent: Float! 71 $invoiceTemplate: String 72 $tax: TaxInput 73 $accountingCategory: AccountingCategoryReferenceInput 74 $balanceAccountingCategory: AccountingCategoryReferenceInput 75 $transactionsImportRow: TransactionsImportRowReferenceInput 76 ) { 77 addFunds( 78 account: $account 79 fromAccount: $fromAccount 80 amount: $amount
81 paymentProcessorFee: $paymentProcessorFee 82 description: $description 83 memo: $memo 84 processedAt: $processedAt 85 hostFeePercent: $hostFeePercent 86 tier: $tier 87 invoiceTemplate: $invoiceTemplate 88 tax: $tax 89 accountingCategory: $accountingCategory 90 balanceAccountingCategory: $balanceAccountingCategory 91 transactionsImportRow: $transactionsImportRow 92 ) { 93 id 94 ...AddFundsOrderFields 95 } 96 } 97 ${ec} 98`,em=(0,v.J1)` 99 mutation EditAddedFunds( 100 $order: OrderReferenceInput! 101 $fromAccount: AccountReferenceInput! 102 $account: AccountReferenceInput! 103 $tier: TierReferenceInput 104 $amount: AmountInput! 105 $paymentProcessorFee: AmountInput 106 $description: String! 107 $memo: String 108 $processedAt: DateTime 109 $hostFeePercent: Float! 110 $invoiceTemplate: String 111 $tax: TaxInput 112 $accountingCategory: AccountingCategoryReferenceInput 113 $balanceAccountingCategory: AccountingCategoryReferenceInput 114 ) { 115 editAddedFunds( 116 order: $order 117 account: $account 118 fromAccount: $fromAccount 119 amount: $amount 120 paymentProcessorFee: $paymentProcessorFee 121 description: $description 122 memo: $memo 123 processedAt: $processedAt 124 hostFeePercent: $hostFeePercent 125 tier: $tier 126 invoiceTemplate: $invoiceTemplate 127 tax: $tax 128 accountingCategory: $accountingCategory 129 balanceAccountingCategory: $balanceAccountingCategory 130 ) { 131 id 132 ...AddFundsOrderFields 133 } 134 } 135 ${ec} 136`,ex=(0,v.J1)` 137 fragment AddFundsTierFields on Tier { 138 id 139 slug 140 legacyId 141 name 142 } 143`,ep=(0,v.J1)` 144 fragment AddFundsAccountQueryHostFields on Host { 145 id 146 type 147 legacyId 148 slug 149 name 150 settings 151 plan { 152 id 153 hostFees 154 } 155 policies { 156 id 157 REQUIRE_2FA_FOR_ADMINS 158 } 159 allowAddFundsFromAllAccounts 160 vendors(forAccount: { slug: $slug }) { 161 nodes { 162 id 163 slug 164 name 165 type 166 description 167 imageUrl(height: 64) 168 } 169 } 170 orderAccountingCategories: accountingCategories(kind: [CONTRIBUTION, ADDED_FUNDS]) { 171 nodes { 172 id 173 code 174 name 175 friendlyName 176 kind 177 appliesTo 178 } 179 } 180 } 181`,eh=(0,v.J1)` 182 query AddFundsAccount($slug: String!) { 183 account(slug: $slug) { 184 id 185 legacyId 186 type 187 isHost 188 name 189 slug 190 currency 191 settings 192 ...AccountHoverCardFields 193 ... on Organization { 194 tiers { 195 nodes { 196 id 197 ...AddFundsTierFields 198 } 199 } 200 host { 201 ...AddFundsAccountQueryHostFields 202 } 203 } 204 ... on AccountWithParent { 205 parent { 206 id 207 slug 208 name 209 imageUrl 210 type 211 settings 212 ...AccountHoverCardFields 213 214 childrenAccounts { 215 nodes { 216 id 217 slug 218 name 219 imageUrl 220 type 221 } 222 } 223 } 224 } 225 childrenAccounts { 226 nodes { 227 id 228 slug 229 name 230 imageUrl 231 type 232 } 233 } 234 ... on Host { 235 ...AddFundsAccountQueryHostFields 236 } 237 ... on AccountWithHost { 238 addedFundsHostFeePercent: hostFeePercent(paymentMethodType: HOST) 239 host { 240 ...AddFundsAccountQueryHostFields 241 } 242 } 243 ... on AccountWithContributions { 244 tiers { 245 nodes { 246 id 247 ...AddFundsTierFields 248 } 249 } 250 } 251 } 252 } 253 ${ex} 254 ${ep} 255 ${R.B} 256`,eg=e=>"string"==typeof e.id?{id:e.id}:{legacyId:e.id},ef=(0,g.Ay)(J.A).attrs({labelFontSize:"16px",labelFontWeight:"700"}).withConfig({componentId:"sc-2888e309-1"})([""]),eA=({collective:e,fundDetails:t,setFundDetails:s,handleClose:g,onSelectOtherAccount:f,initialValues:b,onSuccess:M,editOrderId:w,transactionsImportRow:H})=>{var q,J;let ei,el=(0,h.tz)(),[eo,ec]=n.useState(!!b?.amount),{data:ex,loading:ep,error:eA}=(0,i.IT)(eh,{variables:{slug:e.slug}}),ey=ex?.account,ev=ey?.currency,eb=ey?.isHost&&!ey.host?ey:ey?.host,eC=(q=ey,J=eb,q?(0,l.accountHasVAT)(q,J||q.host)?l.TaxType.VAT:(0,l.accountHasGST)(J||q.host||q)?l.TaxType.GST:void 0:null),eM=!!w,{createVendorFromSearch:eE,isCreatingVendor:eT}=(0,P.H)({host:eb,canBeUsedWithAccounts:e?.slug?[{slug:e.slug}]:[]}),[ew,{error:eI,loading:eN}]=(0,r.n)(eM?em:eu,{refetchQueries:[{query:(0,D.Bf)(!0,!1),variables:(0,D.QJ)(e.slug,!1,eb,ey?.isHost)},{query:_.E,context:v.$V,variables:(0,_.H)(e.slug)}],awaitRefetchQueries:!0}),eS=(0,u.A)(ex,"account.tiers.nodes"),eP=n.useMemo(()=>eS?[{value:null,label:el.formatMessage({defaultMessage:"No tier",id:"ozkv/Y"})},...eS.map(e=>({value:e,label:`#${e.legacyId} - ${e.name}`}))]:[],[el,eS]),eR=(0,F.hc)(eb?.slug,{accountSlug:ey?.slug}),eF=H?.institutionAccount?.balanceAccountingCategory,ek=!!ey?.host&&(ey.parent?ey.host.id!==ey.parent.id:ey.host.id!==ey.id),eO=ey?.addedFundsHostFeePercent,e_=ek?eO:0,eD=eb?.settings?.invoice?.templates,eU=ey?.parent?ey.parent:ey,eL=eU?.childrenAccounts?.nodes||[],e$=[];return(eD?.default?.title?.length>0&&e$.push({value:"default",label:eD?.default?.title}),eD?.alternative?.title?.length>0&&e$.push({value:"alternative",label:eD?.alternative?.title}),ep)?(0,a.jsxs)("div",{className:"space-y-8 py-8",children:[(0,a.jsx)(I.E,{className:"h-16"}),(0,a.jsx)(I.E,{className:"h-16"}),(0,a.jsx)(I.E,{className:"h-16"})]}):eA?(0,a.jsx)(G.A,{my:2,error:eA}):(0,a.jsx)(d.l1,{initialValues:(ei={hostFeePercent:e_,account:ey,...eF?{balanceAccountingCategory:(0,F.ZU)(eF)}:{},...b},{amount:null,paymentProcessorFee:null,hostFeePercent:null,description:"",memo:null,processedAt:(0,y.qF)(),fromAccount:null,tier:null,tax:null,hasHostFee:!!ei.hostFeePercent,hasPaymentProcessorFee:!!ei.paymentProcessorFee,...ei}),enableReinitialize:!0,validate:e=>{let t,s;return t=(0,j.z3)(e,["amount","fromAccount","description","processedAt","add-funds-confirm-checkbox"]),s=(0,ea._)(el,e.tax,{requireTaxIdNumber:!1}),(0,c.A)(s)||(t.tax=s),t},onSubmit:async(e,a)=>{if(t.showSuccessModal)g();else{let t=e$.length>0?e$[0].value:null,n=await ew({variables:{...e,amount:{valueInCents:e.amount,currency:ev},paymentProcessorFee:e.paymentProcessorFee?{valueInCents:e.paymentProcessorFee,currency:ev}:null,platformTip:{valueInCents:0}
256,fromAccount:eg(e.fromAccount),account:eg(e.account),tier:e.tier?{id:e.tier.id}:null,invoiceTemplate:e.invoiceTemplate?.value||t,processedAt:e.processedAt?new Date(e.processedAt):null,tax:e.tax,accountingCategory:e.accountingCategory?{id:e.accountingCategory.id}:null,balanceAccountingCategory:e.balanceAccountingCategory?{id:e.balanceAccountingCategory.value}:null,...eM&&{order:{id:w}}}}),i=n.data.addFunds||n.data.editAddedFunds;eM||(s({showSuccessModal:!0,fundAmount:e.amount,taxAmount:i.taxAmount,hostFeePercent:i.hostFeePercent,paymentProcessorFee:i.transactions.find(e=>"PAYMENT_PROCESSOR_FEE"===e.kind&&"DEBIT"===e.type)?.amount,taxes:i.taxes,description:i.description,memo:i.memo,processedAt:i.processedAt,source:i.fromAccount,tier:i.tier}),a.setValues({amount:e.amount,fromAccount:i.fromAccount,description:i.description,processedAt:i.processedAt})),M?.(i),eM&&g()}},children:e=>{let{values:s,isSubmitting:i}=e,r=isNaN(s.hostFeePercent)?e_:s.hostFeePercent,l=s.tax?.rate?Math.round(s.amount-s.amount/(1+s.tax.rate)):0,c=s.paymentProcessorFee||0,y=Math.round((s.amount-l)*(r/100)),j=eN||i;return t.showSuccessModal?(0,a.jsxs)(d.lV,{children:[(0,a.jsx)(Q.cw,{"data-cy":"funds-added",children:(0,a.jsxs)($.A,{children:[(0,a.jsx)("h3",{className:"mt-4 text-xl text-black",children:(0,a.jsx)(h.sA,{id:"AddFundsModal.FundsAdded",defaultMessage:"Funds Added â
"})}),(0,a.jsxs)($.A,{pb:2,mt:3,children:[(0,a.jsx)(h.sA,{id:"AddFundsModal.YouAdded",defaultMessage:"You added:"}),(0,a.jsxs)("ul",{className:"mt-2 list-inside list-disc pl-3 break-words",children:[(0,a.jsx)("li",{children:(0,a.jsx)("strong",{children:`${t.fundAmount/100} ${ev}`})}),!!t.taxAmount&&(0,a.jsx)("li",{children:(0,a.jsx)(h.sA,{defaultMessage:"Including {amount} {feeType} ({feeRate})",id:"9kR30C",values:{amount:(0,a.jsx)(z.A,{amount:t.taxAmount.valueInCents,currency:ev,showCurrencyCode:!1}),feeType:(0,C.k)(el,(0,u.A)(t.taxes,"0.type")||"Tax","long"),feeRate:`${(0,u.A)(t.taxes,"0.percentage")}%`}})}),!!t.hostFeePercent&&(0,a.jsx)("li",{children:(0,a.jsx)(h.sA,{defaultMessage:"Including {amount} {feeType} ({feeRate})",id:"9kR30C",values:{amount:(0,a.jsx)(z.A,{currency:ev,showCurrencyCode:!1,amount:(t.fundAmount-(t.taxAmount?.valueInCents||0))*(t.hostFeePercent/100)}),feeType:(0,a.jsx)(h.sA,{id:"HostFee",defaultMessage:"Host fee"}),feeRate:`${t.hostFeePercent}%`}})}),!!t.paymentProcessorFee?.valueInCents&&(0,a.jsx)("li",{children:(0,a.jsx)(h.sA,{defaultMessage:"Including {amount} {feeType}",id:"vK8Lti",values:{amount:(0,a.jsx)(z.A,{currency:ev,showCurrencyCode:!1,amount:-t.paymentProcessorFee.valueInCents}),feeType:(0,a.jsx)(h.sA,{id:"contribution.paymentFee",defaultMessage:"Payment processor fee"})}})}),(0,a.jsxs)("li",{children:[(0,a.jsx)(h.sA,{id:"AddFundsModal.FromTheSource",defaultMessage:"From the source"})," ",(0,a.jsx)("strong",{children:(0,a.jsx)(W.A,{collective:t.source})})]}),(0,a.jsxs)("li",{children:[(0,a.jsx)(h.sA,{id:"AddFundsModal.ForThePurpose",defaultMessage:"For the purpose of"})," ",(0,a.jsx)("strong",{children:t.description})]}),t.processedAt&&(0,a.jsxs)("li",{children:[(0,a.jsx)(en.L9,{textTransform:"capitalize",children:(0,a.jsx)(h.sA,{id:"processedAt",defaultMessage:"Fund received date"})}),": ",(0,a.jsx)("strong",{children:el.formatDate(t.processedAt,{timeZone:"UTC"})})]}),t.tier&&(0,a.jsxs)("li",{children:[(0,a.jsx)(h.sA,{defaultMessage:"For the tier",id:"h+1vQB"})," ",(0,a.jsx)(X.A,{as:V.A,openInNewTab:!0,href:`${(0,E.bl)(ey)}/contribute/${t.tier.slug}-${t.tier.legacyId}`,children:(0,a.jsx)("strong",{children:t.tier.name})})]}),t.memo&&(0,a.jsxs)("li",{children:[(0,a.jsx)(h.sA,{id:"withColon",defaultMessage:"{item}:",values:{item:(0,a.jsx)(h.sA,{defaultMessage:"Memo",id:"D5NqQO"})}}),(0,a.jsx)("p",{className:"text-black-600 border-black-200 mt-1 max-h-32 overflow-y-auto rounded border bg-neutral-50 p-2 text-xs break-words whitespace-pre-wrap","data-cy":"add-funds-memo",children:t.memo})]})]})]}),(0,a.jsxs)($.A,{pb:2,mt:2,children:[(0,a.jsx)(h.sA,{id:"AddFundsModal.NeedHelp",defaultMessage:"Need Help?"})," ",(0,a.jsx)(X.A,{href:"/support",buttonStyle:"standard",buttonSize:"tiny",children:(0,a.jsx)(h.sA,{id:"error.contactSupport",defaultMessage:"Contact support"})})]})]})}),(0,a.jsxs)("div",{className:"flex justify-center gap-4",children:[!t.showSuccessModal&&(0,a.jsx)(er.$n,{onClick:g,type:"button",children:(0,a.jsx)(h.sA,{id:"actions.cancel",defaultMessage:"Cancel"})}),(0,a.jsx)(er.$n,{type:"button",onClick:g,"data-cy":"add-platform-tip-btn",loading:j,children:(0,a.jsx)(h.sA,{id:"Finish",defaultMessage:"Finish"})})]})]}):(0,a.jsxs)(d.lV,{"data-cy":"add-funds-form",className:"flex h-full flex-col overflow-y-hidden",children:[f&&(0,a.jsx)("div",{className:"flex",children:(0,a.jsxs)(er.$n,{type:"button",variant:"link",onClick:f,"data-cy":"add-funds-select-other-account",className:"mb-3 p-0",children:[(0,a.jsx)(m.A,{size:16}),(0,a.jsx)(h.sA,{id:"AddFundsModal.selectOtherAccount",defaultMessage:"Select another account"})]})}),(0,a.jsxs)("div",{className:"w-full grow space-y-8 overflow-y-auto pb-4",children:[(0,a.jsxs)(ej,{title:(0,a.jsx)(h.sA,{defaultMessage:"To",id:"To"}),children:[(0,a.jsx)(ef,{name:"collective",htmlFor:"addFunds-collective",label:(0,a.jsx)(h.sA,{defaultMessage:"Collective",id:"Collective"}),mt:3,children:()=>(0,a.jsx)(R.I,{account:eU,trigger:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(O.Ay,{collective:eU,radius:20}),(0,a.jsx)("span",{children:eU.name})]})})}),eL.length>0&&(0,a.jsx)(ef,{name:"account",htmlFor:"addFunds-account",label:(0,a.jsx)(h.sA,{defaultMessage:"Account",id:"TwyMau"}),mt:3,children:({form:e,field:t})=>(0,a.jsx)(U.Ay,{inputId:t.id,"data-cy":"add-funds-recipient",error:t.error,onBlur:()=>e.setFieldTouched(t.name,!0),onChange:({value:s})=>e.setFieldValue(t.name,s),collective:s.account,collectives:[eU,...eL],menuPortalTarget:null,customOptionsPosition:U.JD.TOP,formatOptionLabel:(e,t)=>
256e.value.slug===eU.slug?(0,U.yc)({value:{...e.value,name:el.formatMessage({defaultMessage:"Main account",id:"AccountType.MainAccount"})}},t):(0,U.yc)({value:e.value},t)})}),eP.length>1&&(0,a.jsx)(ef,{name:"tier",htmlFor:"addFunds-tier",label:(0,a.jsx)(h.sA,{defaultMessage:"Tier",id:"b07w+D"}),mt:3,required:!1,children:({form:e,field:t})=>(0,a.jsx)(ee.A,{inputId:t.id,"data-cy":"add-funds-tier",error:t.error,onBlur:()=>e.setFieldTouched(t.name,!0),onChange:({value:s})=>e.setFieldValue(t.name,s),isLoading:j,options:eP,isSearchable:eP.length>10,value:eP.find(e=>s.tier?e.value?.id===s.tier.id:null===e.value)})})]}),(0,a.jsx)(ej,{title:(0,a.jsx)(h.sA,{defaultMessage:"From",id:"dM+p3/"}),children:(0,a.jsx)(ef,{name:"fromAccount",htmlFor:"addFunds-fromAccount",label:eb?.allowAddFundsFromAllAccounts?(0,a.jsx)(h.sA,{defaultMessage:"Source",id:"AddFundsModal.source"}):(0,a.jsx)(h.sA,{defaultMessage:"Vendor",id:"dU1t5Z"}),mt:3,children:({form:e,field:t})=>(0,a.jsx)("div",{children:(0,a.jsx)(L.A,{loading:eT,inputId:t.id,"data-cy":"add-funds-source",types:eb?.allowAddFundsFromAllAccounts?["VENDOR","ORGANIZATION"]:["VENDOR"],error:t.error,onBlur:()=>e.setFieldTouched(t.name,!0),onChange:({value:s})=>{e.setFieldValue(t.name,s)},collective:s.fromAccount,menuPortalTarget:null,includeVendorsForHostId:eb?.legacyId||void 0,vendorVisibleToAccountIds:ey?.legacyId?[ey.legacyId]:void 0,creatable:["VENDOR"],HostCollectiveId:eb?.legacyId,...(0,S._)(eE),formatOptionLabel:(t,s)=>"value"===s.context?(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,U.yc)(t,s),(0,a.jsx)(er.$n,{type:"button",variant:"link",size:"sm",className:"p-0",onMouseDown:t=>{t.stopPropagation(),t.preventDefault(),e.setFieldValue("fromAccount",null)},children:(0,a.jsx)(h.sA,{defaultMessage:"Remove",id:"Remove"})})]}):(0,U.yc)(t,s)})})})}),(0,a.jsxs)(ej,{title:(0,a.jsx)(h.sA,{defaultMessage:"Amounts and fees",id:"bg5yQv"}),children:[(0,a.jsx)(ef,{name:"amount",htmlFor:"addFunds-amount",label:(0,a.jsx)(h.sA,{defaultMessage:"Gross Amount",id:"bwZInO"}),required:!0,flex:"1 1",children:({form:t,field:n})=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex justify-between gap-2 [&>div]:w-full",children:[(0,a.jsx)(B.A,{id:n.id,"data-cy":"add-funds-amount",className:"max-w-full",currency:ev,error:n.error,value:n.value,onChange:e=>t.setFieldValue(n.name,e),onBlur:()=>t.setFieldTouched(n.name,!0),disabled:eo}),!!b?.amount&&(0,a.jsx)(er.$n,{type:"button",variant:"outline",size:"sm",className:"h-[38px]",onClick:()=>ec(e=>!e),disabled:b.amount!==s.amount,"aria-label":eo?"Unlock amount field":"Lock amount field",children:eo?(0,a.jsx)(x.A,{size:18}):(0,a.jsx)(p.A,{size:18})})]}),!!b?.amount&&(eo?(0,a.jsx)("span",{className:"mt-1 text-xs text-gray-500",children:(0,a.jsx)(h.sA,{defaultMessage:"Unlock the field to edit the amount.",id:"hmdkRP"})}):b.amount!==s.amount&&(0,a.jsxs)("span",{className:"mt-1 text-xs text-gray-500",children:[(0,a.jsx)(h.sA,{defaultMessage:"The initial amount was {amount}.",id:"6hEUR9",values:{amount:(0,A.vv)(b.amount,ev,{locale:el.locale})}})," - ",(0,a.jsx)(er.$n,{variant:"link",size:"xs",className:"p-0 text-xs",onClick:()=>{e.setFieldValue("amount",b.amount),ec(!0)},children:(0,a.jsx)(h.sA,{defaultMessage:"Revert",id:"amT0Gh"})})]}))]})}),ek&&(0,a.jsxs)("div",{className:"rounded-md border border-gray-200 bg-white p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("label",{htmlFor:"hasHostFee",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-base font-bold",children:[(0,a.jsx)(h.sA,{defaultMessage:"Host Fee",id:"NJsELs"}),(0,a.jsx)(es.A,{content:()=>(0,a.jsx)(h.sA,{id:"AddFundsModal.hostFee.tooltip",defaultMessage:"The default host fee percentage is set up in your host settings. The host fee is charged by the fiscal host to the collectives for the financial services provided."}),children:(0,a.jsx)(o.d,{size:16})})]}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:(0,a.jsx)(h.sA,{defaultMessage:"Collect host fees",id:"o9dDdX"})})]}),(0,a.jsx)(N.d,{id:"hasHostFee",name:"hostHostFee",checked:e.values.hasHostFee,onCheckedChange:t=>{e.setFieldValue("hasHostFee",t),t?e.setFieldValue("hostFeePercent",e_):e.setFieldValue("hostFeePercent",0)}})]}),e.values.hasHostFee&&(0,a.jsx)(ef,{name:"hostFeePercent",htmlFor:"addFunds-hostFeePercent",className:"mt-4 flex justify-end",children:({form:e,field:t})=>(0,a.jsx)(Z.A,{id:t.id,placeholder:e_,value:t.value,error:t.error,onChange:s=>e.setFieldValue(t.name,s),onBlur:()=>e.setFieldTouched(t.name,!0)})})]}),(0,a.jsxs)("div",{className:"rounded-md border border-gray-200 bg-white p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("label",{htmlFor:"hasPaymentProcessorFee",children:[(0,a.jsx)("div",{className:"flex items-center gap-2 text-base font-bold",children:(0,a.jsx)(h.sA,{defaultMessage:"Payment Processor Fee",id:"pzs6YY"})}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:(0,a.jsx)(h.sA,{defaultMessage:"Deduct fee amount",id:"ue3ZR1"})})]}),(0,a.jsx)(N.d,{id:"hasPaymentProcessorFee",name:"hasPaymentProcessorFee",checked:e.values.hasPaymentProcessorFee,onCheckedChange:t=>{e.setFieldValue("hasPaymentProcessorFee",t),t||e.setFieldValue("paymentProcessorFee",0)}})]}),e.values.hasPaymentProcessorFee&&(0,a.jsx)(ef,{name:"paymentProcessorFee",htmlFor:"addFunds-paymentProcessorFee",flex:"1 1",className:"mt-4 flex justify-end",required:!1,children:({form:e,field:t})=>
256(0,a.jsx)(B.A,{id:t.id,"data-cy":"add-funds-paymentProcessorFee",className:"max-w-full",currency:ev,error:t.error,value:t.value,onChange:s=>e.setFieldValue(t.name,s),onBlur:()=>e.setFieldTouched(t.name,!0)})})]}),eC&&(0,a.jsx)(ea.p,{taxType:eC,formik:e,formikValuePath:"tax",isOptional:!0,dispatchDefaultValueOnMount:!1,labelProps:{fontSize:"16px",fontWeight:"700"},idNumberLabelRenderer:e=>el.formatMessage({defaultMessage:"Source's {taxName} identifier",id:"TNecsq"},{taxName:e})}),(0,a.jsx)("p",{className:"text-md leading-4 font-bold",children:(0,a.jsx)(h.sA,{defaultMessage:"Summary",id:"Summary"})}),(0,a.jsxs)("div",{className:"rounded-lg border border-gray-200 bg-white p-4",children:[(0,a.jsx)(ed,{value:s.amount||0,currency:ev,label:(0,a.jsx)(h.sA,{id:"AddFundsModal.fundingAmount",defaultMessage:"Funding amount"})}),!!s.tax?.rate&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(ed,{value:-l,currency:ev,label:`${(0,C.k)(el,s.tax.type,"long")} (${Math.round(100*s.tax.rate)}%)`}),(0,a.jsx)(Y.A,{my:1,borderColor:"black.200"}),(0,a.jsx)(ed,{value:(s.amount||0)-l,currency:ev,label:(0,a.jsx)(h.sA,{defaultMessage:"Gross amount without {taxName}",id:"dcUpWf",values:{taxName:(0,C.k)(el,s.tax.type,"short")}})}),ek&&(0,a.jsx)(Y.A,{my:1,borderColor:"black.200"})]}),ek&&(0,a.jsx)(ed,{value:y?-y:0,currency:ev,label:(0,a.jsx)(h.sA,{id:"AddFundsModal.hostFees",defaultMessage:"Host fee charged to collective ({hostFees})",values:{hostFees:`${r||0}%`}})}),!!c&&(0,a.jsx)(ed,{value:-c,currency:ev,label:(0,a.jsx)(h.sA,{defaultMessage:"Payment Processor Fee",id:"pzs6YY"})}),(0,a.jsx)(Y.A,{my:2,borderColor:"black.300"}),(0,a.jsx)(ed,{value:s.amount-y-l-(s.paymentProcessorFee||0),currency:ev,label:(0,a.jsx)(h.sA,{id:"AddFundsModal.netAmount",defaultMessage:"Net amount received by collective"}),isLargeAmount:!0})]})]}),(0,a.jsxs)(ej,{title:(0,a.jsx)(h.sA,{defaultMessage:"Accounting",id:"home.accounting"}),children:[(0,a.jsx)(ef,{name:"processedAt",htmlFor:"addFunds-processedAt",inputType:"date",label:(0,a.jsxs)("span",{children:[(0,a.jsx)(h.sA,{defaultMessage:"Effective Date",id:"Gh3Obs"})," ",(0,a.jsx)(es.A,{content:()=>(0,a.jsx)(h.sA,{defaultMessage:"The date funds were cleared on your bank, Wise, PayPal, Stripe or any other external account holding these funds.",id:"s3O6iq"}),children:(0,a.jsx)(o.d,{size:16})})]}),mt:3,children:({field:e})=>(0,a.jsx)(K.A,{"data-cy":"add-funds-processedAt",...e})}),ey?.host?.orderAccountingCategories?.nodes?.length>0&&(0,a.jsx)(ef,{name:"accountingCategory",htmlFor:"addFunds-accountingCategory",required:!1,label:(0,a.jsx)(h.sA,{id:"AddFundsModal.accountingCategory",defaultMessage:"Accounting category"}),mt:3,children:({form:e,field:t})=>(0,a.jsx)(k.Ay,{id:t.id,kind:"CONTRIBUTION",onChange:s=>e.setFieldValue(t.name,s),host:eb,account:ey,selectedCategory:t.value,allowNone:!0,showCode:!0,buttonClassName:"max-w-[auto]"})}),eR.hasPreview&&(eR.enabled||eF)&&(0,a.jsx)(ef,{name:"balanceAccountingCategory",htmlFor:"addFunds-balanceAccountingCategory",required:!1,label:(0,a.jsx)(h.sA,{defaultMessage:"Received in",id:"4Nv47+"}),mt:3,children:({form:e,field:t})=>(0,a.jsxs)("div",{"data-cy":"add-funds-balance-accounting-category",children:[eR.enabled?(0,a.jsx)(F.sz,{hostSlug:eb?.slug,inputId:t.id,value:t.value,disabled:!!eF,context:{accountSlug:e.values.account?.slug},menuPortalTarget:null,onChange:s=>e.setFieldValue(t.name,s)}):eF&&(0,a.jsx)("span",{className:"rounded-lg bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-800",children:`${eF.code} - ${eF.name}`}),!!eF&&(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:(0,a.jsx)(h.sA,{defaultMessage:"This is set by the bank account of the matched transaction. You can change it in the bank connection settings.",id:"blDEUf"})})]})}),(0,a.jsx)(ef,{name:"description",htmlFor:"addFunds-description",label:(0,a.jsx)(h.sA,{id:"Fields.description",defaultMessage:"Description"}),mt:3,children:({field:e})=>(0,a.jsx)(K.A,{"data-cy":"add-funds-description",...e})}),(0,a.jsx)(ef,{name:"memo",htmlFor:"addFunds-memo",isPrivate:!0,label:(0,a.jsx)(h.sA,{defaultMessage:"Memo",id:"D5NqQO"}),required:!1,mt:3,children:({field:e})=>(0,a.jsx)(et.A,{"data-cy":"add-funds-memo",...e})}),e$.length>1&&(0,a.jsx)($.A,{width:"100%",children:(0,a.jsx)(ef,{name:"invoiceTemplate",htmlFor:"addFunds-invoiceTemplate",label:(0,a.jsx)(h.sA,{defaultMessage:"Choose receipt",id:"cyMx/0"}),mt:3,children:({form:e,field:t})=>(0,a.jsx)(ee.A,{id:t.id,options:e$,defaultValue:e$[0],onChange:s=>e.setFieldValue(t.name,s)})})})]}),(0,a.jsx)(en.P,{fontSize:"12px",lineHeight:"18px",color:"black.700",mt:2,children:eM?(0,a.jsx)(ef,{type:"checkbox",id:"add-funds-confirm-checkbox",name:"add-funds-confirm-checkbox",required:!0,"data-cy":"add-funds-confirm-checkbox",children:({field:t})=>(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(T.S,{id:t.id,checked:t.value,onCheckedChange:s=>e.setFieldValue(t.name,!0===s)}
256),(0,a.jsx)("label",{htmlFor:t.id,className:"flex cursor-pointer items-start gap-2 select-none",children:(0,a.jsx)(h.sA,{id:"AddFundsModal.editDisclaimer",defaultMessage:"By clicking edit funds, you're reverting the existing related transactions (including any fees incurred by them) and creating new ones."})})]})}):(0,a.jsx)(ef,{type:"checkbox",id:"add-funds-confirm-checkbox",name:"add-funds-confirm-checkbox",required:!0,"data-cy":"add-funds-confirm-checkbox",children:({field:t})=>(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(T.S,{id:t.id,checked:t.value,onCheckedChange:s=>e.setFieldValue(t.name,!0===s)}),(0,a.jsx)("label",{htmlFor:t.id,className:"flex cursor-pointer items-start gap-2 select-none",children:(0,a.jsx)(h.sA,{defaultMessage:"I confirm that by clicking 'Add Funds', I am responsible for managing {amount} on behalf of this collective",id:"Evxi/Q",values:{amount:(0,A.vv)(s.amount,ev,{locale:el.locale})}})})]})})}),eI&&(0,a.jsx)(G.A,{error:eI,mt:3,fontSize:"13px"})]}),(0,a.jsxs)("div",{className:"border-t-dark-400 flex justify-between gap-4 border-t border-solid pt-4",children:[(0,a.jsx)(er.$n,{onClick:g,type:"button",variant:"outline",children:(0,a.jsx)(h.sA,{id:"actions.cancel",defaultMessage:"Cancel"})}),(0,a.jsxs)(er.$n,{"data-cy":"add-funds-submit-btn",type:"submit",loading:j,children:[eM?(0,a.jsx)(h.sA,{id:"menu.editFunds",defaultMessage:"Edit Funds"}):(0,a.jsx)(h.sA,{id:"menu.addFunds",defaultMessage:"Add Funds"})," "]})]})]})}})},ey=({collective:e=null,host:t=null,initialValues:s=null,onSuccess:i=null,transactionsImportRow:r=null,...l})=>{let o=(0,h.tz)(),{LoggedInUser:d}
256=(0,b.A)(),[c,u]=(0,n.useState)(()=>Array.isArray(e)?1===e.length?e[0]:null:e),[m,x]=(0,n.useState)(!!c),[p,g]=(0,n.useState)({}),A=()=>{g({showSuccessModal:!1}),l.onClose()};return(0,a.jsxs)(eo,{...l,onClose:A,$showSuccessModal:p.showSuccessModal,children:[c&&!l.editOrderId?(0,a.jsx)(Q.rQ,{className:"mb-4",onClose:A,children:(0,a.jsx)(h.sA,{defaultMessage:"Add Funds",id:"menu.addFunds"})}):(0,a.jsx)(Q.rQ,{onClose:A,mb:3,children:l.editOrderId?(0,a.jsx)(h.sA,{id:"menu.editFunds",defaultMessage:"Edit Funds"}):(0,a.jsx)(h.sA,{id:"menu.addFunds",defaultMessage:"Add Funds"})}),r&&(0,a.jsx)(el.H,{transactionsImportRow:r,className:"mb-4"}),d?(0,M.A)(t)&&!d.hasTwoFactorAuth?(0,a.jsx)(ei.y,{borderWidth:0,noTitle:!0}):m?(0,a.jsx)(eA,{collective:c,fundDetails:p,setFundDetails:g,handleClose:A,initialValues:s,onSelectOtherAccount:!e&&(()=>x(!1)),onSuccess:i,transactionsImportRow:r,...l}):t?(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"add-funds-collective-picker",className:"mt-2 text-base font-bold",children:(0,a.jsx)(h.sA,{defaultMessage:"Select an account to add funds to:",id:"addFunds.selectCollective"})}),e?(0,a.jsx)(U.Ay,{inputId:"add-funds-collective-picker",collectives:e,collective:c,mt:2,onChange:({value:e})=>{u(e)}}):(0,a.jsx)(L.A,{inputId:"add-funds-collective-picker",customOptions:[{label:o.formatMessage({defaultMessage:"Fiscal Host",id:"Fiscalhost"}),options:[{value:t,label:(0,a.jsx)(U.yc,{value:t})}]}],mt:2,hostCollectiveIds:(0,f.Sc)(t),types:["COLLECTIVE","PROJECT","EVENT","FUND"],getDefaultOptions:e=>e(c),onChange:({value:e})=>{u(e)}}),(0,a.jsxs)("div",{className:"mt-8 flex justify-between gap-4",children:[(0,a.jsx)(er.$n,{onClick:A,variant:"outline",type:"button",children:(0,a.jsx)(h.sA,{id:"actions.cancel",defaultMessage:"Cancel"})}),(0,a.jsx)(er.$n,{onClick:()=>x(!0),disabled:!c,children:(0,a.jsx)(h.sA,{defaultMessage:"Continue",id:"actions.continue"})})]})]}):(0,a.jsx)(q.A,{type:"error",withIcon:!0,children:(0,a.jsx)(h.sA,{defaultMessage:"Host is required for adding funds",id:"EGiXCI"})}):(0,a.jsx)(q.A,{type:"error",withIcon:!0,children:(0,a.jsx)(h.sA,{defaultMessage:"You need to be logged in to add funds",id:"J37Qbv"})})]},"add-funds-modal")};function ej({title:e,children:t}){return(0,a.jsxs)("div",{className:"rounded-lg",children:[(0,a.jsx)(w.I,{children:e}),(0,a.jsx)("div",{className:"space-y-4",children:t})]})}},4436:(e,t,s)=>{s.d(t,{A:()=>g,e:()=>x});var a=s(37876);s(14232);var n=s(62449),i=s(33123),r=s(61288),l=s(87058),o=s(99202),d=s(33341),c=s(69756),u=s(74143),m=s(61270);let x=e=>{switch(e){case i.Drj.REJECTED:case i.Drj.SPAM:case i.Drj.ERROR:case i.Drj.INVITE_DECLINED:case"OVER
256DUE":return"error";case i.Drj.PENDING:case i.Drj.UNVERIFIED:case"PAYMENT_DUE":case"ON_HOLD":return"warning";case i.Drj.SCHEDULED_FOR_PAYMENT:case i.Drj.APPROVED:return"info";case i.Drj.PAID:case"COMPLETED":return"success"}},p=({children:e,...t})=>(0,a.jsx)(u.A,{...t,background:"white",border:"1px solid",borderColor:"yellow.400",color:"black.700",borderRadius:"0px 4px 4px 0px",ml:"-3px",lineHeight:"100%",children:e}),h=({status:e,...t})=>{let s=(0,n.tz)();return(0,a.jsx)(u.A,{type:x(e),"data-cy":"expense-status-msg",...t,children:(0,r.F8)(s,e)})},g=({status:e,showTaxFormTag:t=!1,payee:s=null,...r})=>{let u={fontWeight:"600",fontSize:"10px",letterSpacing:"0.8px",textTransform:"uppercase",...r};return e===i.Drj.UNVERIFIED?(0,a.jsxs)(o.so,{alignItems:"center",children:[(0,a.jsx)(h,{status:i.Drj.PENDING,...u}),(0,a.jsx)(p,{...u,children:(0,a.jsx)(n.sA,{id:"Unverified",defaultMessage:"Unverified"})})]}):t?s?.isAdmin?(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-y-1",children:[(0,a.jsx)(h,{status:e,...u}),(0,a.jsx)(m.A,{content:()=>(0,a.jsx)(n.sA,{id:"expenseNeedsTaxForm.new.hover",defaultMessage:"We can't pay until we receive your tax info. <Link>Click here</Link> to complete your tax form.",values:{Link:(0,d.lv)({as:c.A,href:(0,l.q5)(s,"tax-information")})}}),children:(0,a.jsx)(p,{fontSize:"10px",children:(0,a.jsx)(n.sA,{defaultMessage:"Tax Form",id:"7TBksX"})})})]}):(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-y-1",children:[(0,a.jsx)(h,{status:e,...u}),(0,a.jsx)(p,{fontSize:"10px",children:(0,a.jsx)(n.sA,{defaultMessage:"Tax Form",id:"7TBksX"})})]}):(0,a.jsx)(h,{status:e,...u})}},7830:(e,t,s)=>{s.d(t,{A:()=>y});var a=s(37876),n=s(14232),i=s(64177),r=s(64487),l=s(62449),o=s(11046),d=s(80207),c=s(99202),u=s(98263),m=s(47597),x=s(68901),p=s(90983),h=s(94019),g=s(58201),f=s(72945);let A=(0,o.J1)` 257 mutation SendMessage($account: AccountReferenceInput!, $message: NonEmptyString!, $subject: String) { 258 sendMessage(account: $account, message: $message, subject: $subject) { 259 success 260 } 261 } 262`,y=({collective:e,isModal:t=!1,onClose:s,onChange:o})=>{let[y,j]=n.useState(""),[v,b]=n.useState(""),[C,M]=n.useState(null),[E,{data:T,loading:w}]=(0,i.n)(A),{toast:I}=(0,d.d)();if(n.useEffect(()=>{o&&o({subject:y,message:v})},[y,v]),(0,r.A)(T,"sendMessage.success")&&!t)return(0,a.jsx)(u.A,{type:"success",withIcon:!0,maxWidth:400,m:"32px auto",children:(0,a.jsx)(l.sA,{id:"MessageSent",defaultMessage:"Message sent"})});let N=(0,a.jsx)(f.L9,{fontWeight:700,children:(0,a.jsx)(l.sA,{id:"Contact.Message",defaultMessage:"Message"})}),S=(0,a.jsx)(l.sA,{id:"OptionalFieldLabel",defaultMessage:"{field} (optional)",values:{field:(0,a.jsx)(f.L9,{fontWeight:700,children:(0,a.jsx)(l.sA,{id:"Contact.Subject",defaultMessage:"Subject"})})}});return(0,a.jsxs)(c.az,{flexDirection:"column",alignItems:["center","flex-start"],maxWidth:1160,m:"0 auto",children:[!t&&(0,a.jsx)(f.H2,{mb:2,fontSize:"40px",children:(0,a.jsx)(l.sA,{id:"ContactCollective",defaultMessage:"Contact {collective}",values:{collective:e.name}})}),(0,a.jsx)(f.P,{mb:4,children:(0,a.jsx)(l.sA,{id:"CollectiveContactForm.Disclaimer",defaultMessage:"Your email address will be shared with the admins who will receive this message."})}),(0,a.jsx)(h.A,{label:S,htmlFor:"subject",mb:4,width:"100%",children:e=>(0,a.jsx)(p.A,{...e,width:"100%",maxWidth:500,maxLength:60,onChange:e=>j(e.target.value),"data-cy":"subject"})}),(0,a.jsx)(h.A,{label:N,htmlFor:"message",width:"100%",maxWidth:800,children:e=>(0,a.jsx)(g.A,{...e,width:"100%",minHeight:200,onChange:e=>b(e.target.value),minLength:10,maxLength:4e3,value:v,showCount:!0,"data-cy":"message"})}),C&&(0,a.jsx)(m.A,{error:C,mt:3}),(0,a.jsx)("p",{className:"mt-2 text-sm",children:(0,a.jsx)(l.sA,{defaultMessage:"Message needs to be at least 10 characters long",id:"322m9e"})}),t&&(0,a.jsx)("hr",{className:"my-5"}),(0,a.jsx)(c.az,{textAlign:t?"right":"",children:(0,a.jsx)(x.A,{mt:4*!t,minWidth:200,buttonStyle:"primary",disabled:v.length<10,loading:w,"data-cy":"submit",onClick:async()=>{try{M(null),await E({variables:{account:{slug:e.slug},subject:y,message:v}}),t&&(I({variant:"success",message:(0,a.jsx)(l.sA,{id:"MessageSent",defaultMessage:"Message sent"})}),s?.())}catch(e){M(e)}},children:(0,a.jsx)(l.sA,{defaultMessage:"Contact Collective",id:"FAYdqn"})})})]})}},8084:(e,t,s)=>{s.d(t,{D:()=>eY,A:()=>eK});var a=s(37876),n=s(14232),i=s(670),r=s(4400),l=s(97746),o=s(92946),d=s(32928),c=s(31927),u=s(79765),m=s(37701),x=s(76362),p=s(21651),h=s(64487),g=s(90281),f=s(53943),A=s(89099),y=s(62449),j=s(5646),v=s(23968),b=s(6435),C=s(72732),M=s(30988),E=s(11046),T=s(77243),w=s(60257),I=s(87058),N=s(78640),S=s(68901);let P=(0,j.Ay)(S.A).attrs({buttonSize:"tiny",padding:"7px 16px",borderRadius:"8px"}).withConfig({componentId:"sc-4b7b156f-0"})(["font-weight:500;font-size:14px;line-height:16px;white-space:nowrap;text-transform:uppercase;border:none;color:",";&,span{letter-spacing:0.01em;}span{vertical-align:middle;}",""],(0,p.y)("colors.primary.800"),e=>e.isSecondary?(0,j.AH)(["&:focus{background:",";}&:hover:not(:active){background:",";box-shadow:0 0 0 2px ",";}&:active{background:",";color:",";box-shadow:none;}"],(0,p.y)("colors.primary.100"),(0,p.y)("colors.primary.100"),(0,p.y)("colors.primary.800"),(0,p.y)("colors.primary.200"),(0,p.y)("colors.primary.800")):(0,j.AH)(["background:",";&:focus{background:",";}&:hover:not(:active){background:",";color:",";}&:active{background:",";color:",";}"],(0,p.y)("colors.primary.100"),(0,p.y)("colors.primary.100"),(0,p.y)("colors.primary.800"),(0,p.y)("colors.white.full"),(0,p.y)("colors.primary.200"),(0,p.y)("colors.primary.800")));var R=s(2074);let F=e=>(0,a.jsx)(S.A,{...e,children:(0,a.jsx)(y.sA,{id:"menu.addFunds",defaultMessage:"Add Funds"})}),k=({children:e=F,collective:t})=>{let[s,i]=n.useState(!1);return(0,a.jsxs)(n.Fragment,{children:[e({onClick:()=>i(!0)}),s&&(0,a.jsx)(R.A,{collective:t,host:t.host,onClose:()=>i(null)})]})};var O=s(95062),_=s.n(O),D=s(97852),U=s(12268);class L extends n.Component{static{this.propTypes={hostSlug:_().string.isRequired,minWidth:_().oneOfType([_().number,_().string]),withoutIcon:_().bool,buttonProps:_().object,buttonRenderer:_().func,router:_().object,isHidden:_().bool}}constructor(e){super(e),this.state={showModal:!1}}componentDidMount(){let{router:e}=this.props;"apply"===e.query.action&&this.setState({showModal:!0})}componentDidUpdate(e){let{router:t}=this.props;"apply"!==t.query.action&&"apply"===e.router.query.action&&this.setState({showModal:!1}),"apply"===t.query.action&&"apply"!==e.router.query.action&&this.setState({showModal:!0})}renderButton(){let{buttonRenderer:e,withoutIcon:t,buttonProps:s,minWidth:i,hostSlug:r,router:l}=this.props;return e?e({onClick:()=>l.push(`${r}/apply`),"data-cy":"host-apply-btn",...s,children:(0,a.jsxs)(n.Fragment,{children:[!t&&(0,a.jsx)(D.r,{size:"1em"}),!t&&" ",(0,a.jsx)("span",{children:(0,a.jsx)(y.sA,{id:"ApplyToHost",defaultMessage:"Apply"})})]})}):(0,a.jsxs)(S.A,{buttonStyle:"secondary",buttonSize:"small",onClick:()=>l.push(`${r}/apply`),minWidth:i,"data-cy":"host-apply-btn",...s,children:[!t&&(0,a.jsx)(D.r,{size:"20px",color:"#304CDC"}),(0,a.jsx)(y.sA,{id:"ApplyToHost",defaultMessage:"Apply"})]})}render(){let{hostSlug:e,router:t,isHidden:s}=this.props;return(0,a.jsxs)(n.Fragment,{children:[this.renderButton(),this.state.showModal&&!s&&(0,a.jsx)(U.A,{hostSlug:e,onClose:()=>t.push(e)})]})}}let $=(0,A.withRouter)(L);var z=s(30619),H=s(44993),B=s(91664),V=s(56593),W=s(96076),q=s(99202),G=s(69756),Y=s(38268),K=s(41955),J=s(51020);let Z=e=>`${(0,I.bl)(e)}/expenses/new`,X=({collective:e,LoggedInUser:t,onOpenSubmitExpenseModalClick:s,linkComponent:n,children:i})=>{let r=Z(e);return t?(0,a.jsx)(n,{as:"button",type:"button",onClick:s,children:i}):(0,a.jsx)(n,{as:G.A,href:r,children:i})},Q=({collective:e,LoggedInUser:t,onOpenSubmitExpenseModalClick:s,children:a})=>{let n=Z(e);return a(t?{onClick:s}:{href:n})};var ee=s(72945),et=s(38600),es=s(15022),ea=s(78027),en=s(5885),ei=s(58649),er=s(75200),el=s(16201);let eo="hasSubmitExpense",ed="hasApply",ec="hasContact",eu="addFunds",em="hasContribute",ex="hasManageSubscriptions",ep="hasRequestGrant",eh=(0,y.YK)({CONTRIBUTE:{id:"SectionContribute.All",defaultMessage:"All ways to contribute"},TRANSACTIONS:{id:"menu.transactions",defaultMessage:"Transactions"},EXPENSES:{id:"Expenses",defaultMessage:"Expenses"},SUBMITTED_EXPENSES:{id:"NpGb+x",defaultMessage:"Submitted Expenses"},UPDATES:{id:"updates",defaultMessage:"Updates"},EVENTS:{id:"Events",defaultMessage:"Events"},PROJECTS:{id:"Projects",defaultMessage:"Projects"},CONNECTED_COLLECTIVES:{id:"ConnectedCollectives",defaultMessage:"Connected Collectives"},CONVERSATIONS:{id:"conversations",defaultMessage:"Conversations"}}),eg=(e,t,s,a,n)=>
262{(0,C.O$)(a,n)&&t.push({route:`/${s.slug}#section-${n}`,title:(0,er.A)(e,n),hide:!0})},ef=(0,j.Ay)("li").withConfig({componentId:"sc-733323fe-0"})(["display:flex;align-items:center;&,a,button{width:100%;text-align:left;font-style:normal;font-weight:500;font-size:13px;line-height:16px;letter-spacing:-0.4px;outline:none;@media (max-width:39.938em){font-size:14px;}&:not(:hover){color:#313233;}&:hover:not(:disabled){background:white;color:",";&:not(:active){background:white;text-decoration:underline;}}&:focus{box-shadow:none;outline:none;background:white;text-shadow:0px 0px 1px black;}&:disabled{color:#8c8c8c;}}a,button{&:not(:active){margin-right:24px;}&:active{outline:1px solid #e8e9eb;margin-left:12px;margin-right:12px;background:white;}}svg{margin-right:8px;fill:",";color:",";}",""],e=>e.theme.colors.black[800],e=>e.theme.colors.primary[600],e=>e.theme.colors.primary[600],e=>e.isHiddenOnMobile&&(0,j.AH)(["@media screen and (min-width:40em){display:none;}"])),eA=(0,j.Ay)(es.ms).withConfig({componentId:"sc-733323fe-1"})(["","{padding:8px 0;}@media screen and (min-width:40em) and (max-width:88em){","{right:50px;}}@media (max-width:39.938em){","{display:none !important;}","{display:block;position:relative;box-shadow:none;border:none;padding-top:0;text-transform:uppercase;button{text-transform:uppercase;}svg{margin-right:16px;}}}",""],es.pm,es.pm,es.PV,es.pm,e=>e.$isHiddenOnNonMobile&&(0,j.AH)(["@media screen and (min-width:39.938em){display:none;}"])),ey=(0,j.Ay)(P).attrs({isSecondary:!0}).withConfig({componentId:"sc-733323fe-2"})(["svg{stroke-width:2;}span{vertical-align:middle;margin-right:4px;}@media (max-width:39.938em){cursor:none;pointer-events:none;}"]),ej=(0,j.Ay)(et.yQ).withConfig({componentId:"sc-733323fe-3"})(["@media (max-width:39.938em){display:none;}"]),ev="11px 14px",eb=({collective:e,callsToAction:t={},hiddenActionForNonMobile:s,LoggedInUser:i,onOpenSubmitExpenseModalClick:r=()=>{}})=>{let m=Object.keys((0,g.A)(t,Boolean)),p=m.length<1,h=1===m.length&&s===m[0];return p?null:(0,a.jsx)(V.A,{display:h?["flex","none"]:"flex",alignItems:"center",order:[-1,0],borderTop:["1px solid #e1e1e1","none"],ml:1,children:(0,a.jsx)(q.az,{px:1,children:(0,a.jsx)(eA,{trigger:"click",$isHiddenOnNonMobile:m.length<=2,children:({triggerProps:m,dropdownProps:p})=>(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)(q.so,{alignItems:"center",children:[(0,a.jsx)(q.az,{display:["block","none"],width:"32px",ml:2,children:(0,a.jsx)(ea.A,{borderStyle:"solid",borderColor:"primary.600"})}),(0,a.jsxs)(ey,{my:2,...m,children:[(0,a.jsx)(ee.L9,{children:(0,a.jsx)(y.sA,{id:"CollectivePage.NavBar.ActionMenu.Actions",defaultMessage:"Actions"})}),(0,a.jsx)(ej,{size:"14px"})]})]}),(0,a.jsxs)("div",{...p,children:[(0,a.jsx)(es.PV,{}),(0,a.jsx)(es.pm,{children:(0,a.jsxs)(q.az,{as:"ul",p:0,m:0,minWidth:184,children:[t.hasSubmitExpense&&(0,a.jsx)(ef,{isHiddenOnMobile:s===eo,children:(0,a.jsx)(X,{collective:e,LoggedInUser:i,onOpenSubmitExpenseModalClick:r,linkComponent:en.A,children:(0,a.jsxs)(V.A,{p:ev,children:[(0,a.jsx)(d.T,{size:"20px"}),(0,a.jsx)(y.sA,{id:"ExpenseForm.Submit",defaultMessage:"Submit expense"})]})})}),t.hasRequestGrant&&(0,a.jsx)(ef,{py:1,isHiddenOnMobile:s===ep,children:(0,a.jsx)(en.A,{as:G.A,href:`${(0,I.bl)(e)}/grants/new`,children:(0,a.jsxs)(V.A,{p:ev,children:[(0,a.jsx)(c.w,{size:"20px"}),(0,a.jsx)(y.sA,{id:"ExpenseForm.Type.Request",defaultMessage:"Request Grant"})]})})}),t.hasManageSubscriptions&&(0,a.jsx)(ef,{isHiddenOnMobile:s===ex,children:(0,a.jsx)(en.A,{as:G.A,href:(0,I.q5)(e,"outgoing-contributions"),children:(0,a.jsxs)(V.A,{p:ev,children:[(0,a.jsx)(x.B,{size:"20px"}),(0,a.jsx)("span",{children:(0,a.jsx)(y.sA,{id:"menu.subscriptions",defaultMessage:"Manage Contributions"})})]})})}),t.hasContribute&&(0,a.jsx)(ef,{py:1,isHiddenOnMobile:s===em,children:(0,a.jsx)(en.A,{as:G.A,href:(0,b.vR)(e),children:(0,a.jsxs)(V.A,{p:ev,children:[(0,a.jsx)(o.r,{size:"20px"}),(0,a.jsx)(y.sA,{id:"menu.contributeMoney",defaultMessage:"Contribute Money"})]})})}),t.addFunds&&(0,a.jsx)(k,{collective:e,children:e=>(0,a.jsx)(ef,{py:1,isHiddenOnMobile:s===eu,children:(0,a.jsxs)(S.A,{borderRadius:0,p:ev,isBorderless:!0,...e,"data-cy":"add-funds-btn",children:[(0,a.jsx)(u.C,{size:"20px"}),(0,a.jsx)(ee.L9,{children:(0,a.jsx)(y.sA,{id:"menu.addFunds",defaultMessage:"Add Funds"})})]})})}),t.hasContact&&(0,a.jsx)(ef,{py:1,isHiddenOnMobile:s===ec,children:(0,a.jsx)(B.A,{collective:e,LoggedInUser:i,children:e=>(0,a.jsxs)(S.A,{...e,borderRadius:0,p:ev,isBorderless:!0,children:[(0,a.jsx)(l.L,{size:"20px"}),(0,a.jsx)(y.sA,{id:"Contact",defaultMessage:"Contact"})]})})}),t.hasApply&&(0,a.jsx)(ef,{py:1,isHiddenOnMobile:s===ed,children:(0,a.jsx)($,{hostSlug:e.slug,isHidden:s===ed,buttonProps:{isBorderless:!0,p:ev}})})]})})]})]})})})})};var eC=s(31823),eM=s(36559);let eE=(0,j.Ay)(V.A).attrs({px:[1,3,0]}).withConfig({componentId:"sc-fd75588d-0"})(["display:block;width:100%;span{font-size:14px;line-height:16px;text-decoration:none;white-space:nowrap;color:",";letter-spacing:0.06em;text-transform:uppercase;font-weight:500;&::after{display:block;content:attr(aria-label);font-weight:700;height:1px;color:transparent;overflow:hidden;visibility:hidden;}}
262&:focus,&:hover,&:focus span,&:hover span{text-decoration:none;font-weight:700;outline:0;color:",";}&::after{content:'';display:block;width:0%;height:3px;background:",";transition:width 0.3s;float:center;opacity:0;}"," @media (max-width:64em){border-top:1px solid #e1e1e1;&::after{display:none;}}"],(0,p.y)("colors.black.800"),(0,p.y)("colors.black.800"),(0,p.y)("colors.primary.500"),e=>e.$isSelected&&(0,j.AH)(["@media (min-width:64em){&::after{width:100%;margin:0 auto;opacity:1;}}"])),eT=(0,j.Ay)("li").withConfig({componentId:"sc-fd75588d-1"})(["display:flex;align-items:center;& > a{padding:12px;@media (max-width:40em){padding-top:4px;}}&,& > a{width:100%;text-align:left;font-style:normal;font-size:13px;font-weight:500;line-height:16px;letter-spacing:-0.4px;outline:none;&:hover,&:focus{text-decoration:underline;}&:not(:hover){color:#313233;}}"]),ew=(0,j.Ay)(es.ms).withConfig({componentId:"sc-fd75588d-2"})(["@media (max-width:64em){","{display:none !important;}","{display:block;position:relative;box-shadow:none;border:none;padding-left:48px;}}"],es.PV,es.pm),eI=({category:e,collective:t})=>{let s=(0,y.tz)(),n=(0,C.Nr)(s,t,e);return(0,a.jsxs)(q.so,{children:[(0,a.jsx)(q.so,{alignItems:"center",minWidth:32,mr:2,children:(0,a.jsx)(eM.A,{width:32,height:32,alt:"",src:n.img||C.UC.CONTRIBUTE})}),(0,a.jsx)(q.so,{alignItems:"center",children:(0,a.jsx)(ee.L9,{textTransform:"uppercase",fontSize:"14px",fontWeight:"500",color:"black.800",letterSpacing:"0.02em","aria-label":n.title,children:n.title})})]})},eN=({useAnchor:e,category:t,children:s})=>e?(0,a.jsx)(eC.Op,{to:`#category-${t}`,children:s}):s,eS=({useAnchor:e,collective:t,category:s,isSelected:i,links:r})=>{let l,o=r.filter(e=>!e.hide);return(0,a.jsxs)(ew,{trigger:"hover",tabIndex:"-1",children:[(0,a.jsx)(eN,{category:s,useAnchor:e,children:(0,a.jsx)(eE,{mr:[0,null,3],$isSelected:i,...(l=`#category-${s}`,e?{href:l}:{as:G.A,href:`/${t.slug}${l}`}),onClick:e=>{document.activeElement?.contains(e.target)&&document.activeElement.blur()},children:(0,a.jsx)(q.so,{pt:"15px",pb:"14px",px:[3,1,3,1],children:(0,a.jsx)(eI,{category:s,collective:t})})})}),o.length>0&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(es.PV,{}),(0,a.jsx)(es.pm,{children:(0,a.jsx)(q.az,{as:"ul",p:0,m:0,minWidth:184,children:o.map(({route:e,title:t})=>(0,a.jsx)(eT,{children:(0,a.jsx)(en.A,{as:G.A,href:e,children:t})},e))})})]})]})},eP=n.lazy(()=>Promise.all([s.e(3337),s.e(5303),s.e(9751),s.e(5398),s.e(321),s.e(5924)]).then(s.bind(s,22628)).then(e=>({default:e.SubmitExpenseFlow}))),eR=(0,j.DU)(["@media (max-width:64em){body{overflow:hidden;}#footer{display:none;}}"]),eF=j.Ay.div.withConfig({componentId:"sc-dab2e8ce-0"})(["position:sticky;top:0;z-index:999;background:white;box-shadow:0px 6px 10px -5px rgba(214,214,214,0.5);"]),ek=(0,j.DU)(["_::-webkit-full-page-media,_:future,:root ","{position:relative;}"],eF),eO=(0,j.Ay)(V.A).withConfig({componentId:"sc-dab2e8ce-1"})(["background:white;display:flex;justify-content:space-between;@media (min-width:40em){align-items:center;}@media (min-width:64em){justify-content:flex-start;}"]),e_=j.Ay.div.withConfig({componentId:"sc-dab2e8ce-2"})(["display:flex;width:auto;flex-direction:column;overflow-y:auto;justify-content:flex-start;@media (min-width:64em){flex-direction:row;width:100%;overflow-y:none;justify-content:center;}"]),eD=(0,j.Ay)(q.az).withConfig({componentId:"sc-dab2e8ce-3"})(["position:relative;&::before{content:'';height:24px;position:absolute;right:0;top:0;bottom:0;margin-top:auto;margin-bottom:auto;border-right:2px solid rgba(214,214,214,1);}"]),eU=j.Ay.div.withConfig({componentId:"sc-dab2e8ce-4"})(["display:flex;@media (min-width:64em){&[data-hide-on-desktop='false']{width:48px;opacity:1;visibility:visible;margin-right:8px;transition:opacity 0.1s ease-out,visibility 0.2s ease-out,margin 0.075s,width 0.075s ease-in-out;}&[data-hide-on-desktop='true']{width:0px;margin-right:0px;visibility:hidden;opacity:0;transition:opacity 0.1s ease-out,visibility 0.2s ease-out,margin 0.075s,width 0.075s ease-in-out;}}"]),eL=(0,j.Ay)(V.A).withConfig({componentId:"sc-dab2e8ce-5"})(["display:flex;align-items:center;justify-content:space-between;min-width:0;"]),e$=(0,j.Ay)(Y.A).attrs({fontSize:["16px","18px"],color:"black.800"}).withConfig({componentId:"sc-dab2e8ce-6"})([""," letter-spacing:-0.8px;margin:8px;min-width:0;text-decoration:none;text-align:center;font-weight:500;line-height:24px;&,a{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;}&:not(:hover){color:#313233;}"],v.Vy),ez=(0,j.Ay)(V.A).withConfig({componentId:"sc-dab2e8ce-7"})(["background-color:#ffffff;max-height:calc(100vh - 70px);flex-shrink:2;flex-grow:1;overflow:auto;@media screen and (max-width:40em){max-height:none;flex-shrink:0;}@media screen and (min-width:40em) and (max-width:64em){border:1px solid rgba(214,214,214,0.3);border-radius:0px 0px 0px 8px;box-shadow:0px 6px 10px -5px rgba(214,214,214,0.5);position:absolute;right:0;top:64px;width:0;visibility:hidden;opacity:0;transition:opacity 0.4s ease-out,visibility 0.4s ease-out,width 0.2s ease-out;","}"],e=>e.isExpanded&&(0,j.AH)(["width:400px;visibility:visible;opacity:1;"])),eH=(0,E.J1)` 263 query AccountPermissions($slug: String!) { 264 account(slug: $slug) { 265 id 266 permissions { 267 id 268 addFunds { 269 allowed 270 reason 271 } 272 } 273 } 274 } 275`,eB=(0,j.Ay)(V.A).attrs({display:["block",null,null,"none"]}).withConfig({componentId:"sc-dab2e8ce-8"})(["animation:"," 0.2s;margin-left:8px;"],J.qG),eV=(0,j.Ay)(r.s).attrs({size:28}).withConfig({componentId:"sc-dab2e8ce-9"})(["cursor:pointer;margin-right:4px;flex:0 0 28px;color:",";&:hover{background:radial-gradient(transparent 14px,white 3px),linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0.8)),linear-gradient(",",",");}&:active{background:radial-gradient("," 14px,white 3px);color:",";}@media (min-width:64em){display:none;}"],(0,p.y)("colors.primary.600"),(0,p.y)("colors.primary.600"),(0,p.y)("colors.primary.600"),(0,p.y)("colors.primary.600"),(0,p.y)("colors.white.full")),eW=(0,j.Ay)(m.b).attrs({size:28}).withConfig({componentId:"sc-dab2e8ce-10"})(["cursor:pointer;margin-right:4px;flex:0 0 28px;color:",";&:hover{background:radial-gradient(transparent 14px,white 3px),linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0.8)),linear-gradient(",",",");}&:active{background:radial-gradient("," 14px,white 3px);color:",";}@media (min-width:64em){display:none;}"],(0,p.y)("colors.primary.600"),(0,p.y)("colors.primary.600"),(0,p.y)("colors.primary.600"),(0,p.y)("colors.primary.600"),(0,p.y)("colors.white.full")),eq=(e,t)=>
275{let s=(0,h.A)(e.features,t);return"ACTIVE"===s||"AVAILABLE"===s},eG=(e,t,s,n=()=>{})=>{if(!e||!t)return null;if(t.includes("hasContribute"))return{type:em,component:(0,a.jsx)(G.A,{href:(0,b.vR)(e),children:(0,a.jsxs)(P,{tabIndex:"-1",children:[(0,a.jsx)(o.r,{size:"1em"}),(0,a.jsx)(ee.L9,{ml:2,children:(0,a.jsx)(y.sA,{id:"menu.contributeMoney",defaultMessage:"Contribute Money"})})]})})};if(t.includes("hasApply"))return{type:ed,component:(0,a.jsx)($,{hostSlug:e.slug,buttonRenderer:e=>(0,a.jsx)(P,{...e})})};if(t.includes("hasRequestGrant"))return{type:ep,component:(0,a.jsx)(G.A,{href:`${(0,I.bl)(e)}/grants/new`,children:(0,a.jsxs)(P,{tabIndex:"-1",children:[(0,a.jsx)(c.w,{size:"1em"}),(0,a.jsx)(ee.L9,{ml:2,children:(0,a.jsx)(y.sA,{id:"ExpenseForm.Type.Request",defaultMessage:"Request Grant"})})]})})};if(t.includes("hasSubmitExpense"))return{type:eo,component:(0,a.jsx)(Q,{collective:e,LoggedInUser:s,onOpenSubmitExpenseModalClick:n,children:e=>{let t=(0,a.jsxs)(P,{tabIndex:"-1",...e.onClick?{onClick:e.onClick}:{},"data-cy":"submit-expense-button",children:[(0,a.jsx)(d.T,{size:"1em"}),(0,a.jsx)(ee.L9,{ml:2,children:(0,a.jsx)(y.sA,{id:"menu.submitExpense",defaultMessage:"Submit Expense"})})]});return e.href?(0,a.jsx)(G.A,{href:e.href,children:t}):t}})};if(t.includes("hasManageSubscriptions"))return{type:ex,component:(0,a.jsx)(G.A,{href:(0,I.q5)(e,"outgoing-contributions"),children:(0,a.jsxs)(P,{tabIndex:"-1",children:[(0,a.jsx)(x.B,{size:"1em"}),(0,a.jsx)(ee.L9,{ml:2,children:(0,a.jsx)(y.sA,{id:"menu.subscriptions",defaultMessage:"Manage Contributions"})})]})})};else if(t.includes("hasContact"))return{type:ec,component:(0,a.jsx)(B.A,{collective:e,LoggedInUser:s,children:e=>(0,a.jsxs)(P,{...e,children:[(0,a.jsx)(l.L,{size:"1em"}),(0,a.jsx)(ee.L9,{ml:2,children:(0,a.jsx)(y.sA,{id:"Contact",defaultMessage:"Contact"})})]})})};else if(t.includes(eu)&&e.host)return{type:eu,component:(0,a.jsx)(k,{collective:e,children:e=>(0,a.jsxs)(P,{...e,children:[(0,a.jsx)(u.C,{size:"1em"}),(0,a.jsx)(ee.L9,{children:(0,a.jsx)(y.sA,{id:"menu.addFunds",defaultMessage:"Add Funds"})})]})})};else return null},eY=[56,64],eK=n.memo(({collective:e,isAdmin:t,isLoading:s=!1,sections:r,selectedCategory:l,callsToAction:o={},onCollectiveClick:d,isInHero:c=!1,onlyInfos:u=!1,useAnchorsForCategories:m=!1,showSelectedCategoryOnMobile:x=!1,onSubmitExpenseModalOpenChange:p})=>{let v,E=(0,A.useRouter)(),S=(0,y.tz)(),[P,R]=n.useState(!1),{LoggedInUser:F}=(0,w.A)();t=t||F?.isAdminOfCollective(e);let k=F?.isHostAdmin(e),{data:O,dataLoading:_}=(0,i.IT)(eH,{variables:{slug:e?.slug},skip:!e?.slug||!F}),[D,U]=n.useState(!1),L=e=>{U(e),p?.(e)},$=s||_,B=!!O?.account?.permissions?.addFunds?.allowed,G=n.useMemo(()=>r||(0,C.rm)(e,t,k),[r,e,t,k]);o={...((e,t,s,a,n,i)=>{if(!e||e.type===M.Td.VENDOR)return{};let{features:r}=e;return{hasContribute:[M.Td.FUND,M.Td.PROJECT].includes(e.type)&&e.isActive&&(0,b.vR)(e)&&(0,C.DF)(t,H.Z_.CONTRIBUTE,s),hasContact:!s&&(i||eq(e,"CONTACT_FORM")),hasApply:eq(e,"RECEIVE_HOST_APPLICATIONS"),hasSubmitExpense:eq(e,"RECEIVE_EXPENSES")&&(0,b.nh)(e,a),hasManageSubscriptions:s&&"ACTIVE"===(0,h.A)(r,"RECURRING_CONTRIBUTIONS")&&(0,b.Lb)(e),hasDashboard:s&&eq(e,"HOST_DASHBOARD"),hasRequestGrant:eq(e,"FUNDS_GRANTS_MANAGEMENT")&&(0,b.nh)(e,a),addFunds:n}})(e,G,t,F,B,k),...o};let J=Object.keys((0,g.A)(o,Boolean)),Z=eG(e,J,F,()=>L(!0)),X=2===J.length&&eG(e,(0,f.A)(J,Z?.type),F,()=>L(!0)),Q=(0,n.useRef)(void 0),ee=(0,n.useRef)(void 0);return(0,T.A)(Q,e=>{!e&&P&&setTimeout(()=>{R(!1)},500)}),(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(ek,{}),(0,a.jsx)(eF,{ref:ee,children:(0,a.jsxs)(eO,{flexDirection:["column","row"],px:[0,3,null,H.Et.PADDING_X[1]],mx:"auto",maxWidth:H.Et.MAX_SECTION_WIDTH,maxHeight:"100vh",minHeight:eY,children:[(0,a.jsxs)(eL,{px:[3,0],py:[2,1],children:[(0,a.jsxs)(q.so,{alignItems:"center",maxWidth:["90%","100%"],flex:"1 1",children:[(0,a.jsx)(eU,{"data-hide-on-desktop":c,children:(0,a.jsx)(eD,{children:(0,a.jsx)(Y.A,{collective:e,onClick:d,children:(0,a.jsx)(V.A,{borderRadius:"25%",mr:2,children:(0,a.jsx)(z.Ay,{collective:e,radius:40})})})})}),(0,a.jsx)(V.A,{display:u?"flex":["flex",null,null,"none"],minWidth:0,children:$?(0,a.jsx)(K.A,{height:14,minWidth:100}):c?(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(e$,{collective:e,display:["block","none"],children:(0,a.jsx)(y.sA,{id:"NavBar.ThisIsCollective",defaultMessage:"This is {collectiveName}'s page",values:{collectiveName:e.name}})}),(0,a.jsx)(e$,{collective:e,display:["none","block"]})]}):l&&x?(0,a.jsx)(eB,{children:(0,a.jsx)(eI,{collective:e,category:l})}):(0,a.jsx)(e$,{collective:e,onClick:d})})]}),!u&&(0,a.jsx)(q.az,{display:["block","none"],flex:"0 0 32px",children:P?(0,a.jsx)(eW,{onClick:()=>R(!P)}):(0,a.jsx)(eV,{onClick:()=>{ee.current?.scrollIntoView(!0),R(!0)}})})]}),!u&&(0,a.jsxs)(e_,{children:[P&&(0,a.jsx)(eR,{}),(0,a.jsx)(ez,{ref:Q,display:P?"flex":["none","flex"],flexDirection:["column",null,null,"row"],justifyContent:["space-between",null,"flex-start"],order:[0,3,0],isExpanded:P,children:$?(0,a.jsx)(K.A,{height:34,minWidth:100,maxWidth:200,my:15}):(v=[],G.forEach(({type:t,name:s})=>{if("CATEGORY"===t){let t,a,n=(t=[],a=(0,I.bl)(e),s===el.q.ABOUT?(eg(S,t,e,G,H.Z_.ABOUT),eg(S,t,e,G,H.Z_.OUR_TEAM),eg(S,t,e,G,H.Z_.GOALS)):s===el.q.CONTRIBUTE?((0,ei.Ay)(e,ei.Gv.RECEIVE_FINANCIAL_CONTRIBUTIONS)&&(0,C.O$)(G,H.Z_.CONTRIBUTE)&&t.pu
275sh({route:`${a}/contribute`,title:S.formatMessage(eh.CONTRIBUTE)}),(0,ei.Ay)(e,ei.Gv.EVENTS)&&(0,C.O$)(G,H.Z_.EVENTS)&&t.push({route:`${a}/events`,title:S.formatMessage(eh.EVENTS)}),(0,ei.Ay)(e,ei.Gv.PROJECTS)&&(0,C.O$)(G,H.Z_.PROJECTS)&&t.push({route:`${a}/projects`,title:S.formatMessage(eh.PROJECTS)}),(0,ei.Ay)(e,ei.Gv.CONNECTED_ACCOUNTS)&&(0,C.O$)(G,H.Z_.CONNECTED_COLLECTIVES)&&t.push({route:`${a}/connected-collectives`,title:S.formatMessage(eh.CONNECTED_COLLECTIVES)}),(0,C.O$)(G,H.Z_.CONTRIBUTORS)&&eg(S,t,e,G,H.Z_.CONTRIBUTORS)):s===el.q.CONTRIBUTIONS?eg(S,t,e,G,H.Z_.CONTRIBUTIONS):s===el.q.BUDGET?(t.push({route:`${a}/transactions`,title:S.formatMessage(eh.TRANSACTIONS)}),(0,b.Lb)(e)&&!e.isHost?t.push({route:`${a}/submitted-expenses`,title:S.formatMessage(eh.SUBMITTED_EXPENSES)}):e.type!==M.Td.VENDOR&&t.push({route:`${a}/expenses`,title:S.formatMessage(eh.EXPENSES)})):s===el.q.CONNECT&&((0,ei.Ay)(e,ei.Gv.UPDATES)&&(0,C.O$)(G,H.Z_.UPDATES)&&t.push({route:`${a}/updates`,title:S.formatMessage(eh.UPDATES)}),(0,ei.Ay)(e,ei.Gv.CONVERSATIONS)&&(0,C.O$)(G,H.Z_.CONVERSATIONS)&&t.push({route:`${a}/conversations`,title:S.formatMessage(eh.CONVERSATIONS)})),t);n.length&&v.push({category:s,links:n})}}),v).map(({category:t,links:s})=>(0,a.jsx)(eS,{collective:e,category:t,links:s,isSelected:l===t,useAnchor:m},t))}),(0,a.jsxs)(V.A,{display:P?"flex":["none","flex"],flexDirection:["column","row"],flexBasis:"fit-content",marginLeft:[0,"auto"],backgroundColor:"#fff",zIndex:1,children:[Z&&(0,a.jsxs)(V.A,{display:["none","flex"],alignItems:"center",children:[Z.component,X?.component?(0,a.jsx)(V.A,{ml:2,children:X?.component}):null]}),!$&&(0,a.jsx)(eb,{onOpenSubmitExpenseModalClick:()=>L(!0),collective:e,callsToAction:o,hiddenActionForNonMobile:Z?.type,LoggedInUser:F}),(0,a.jsx)(V.A,{display:["none","flex",null,null,"none"],alignItems:"center",children:P?(0,a.jsx)(eW,{onClick:()=>R(!P)}):(0,a.jsx)(eV,{onClick:()=>{ee.current?.scrollIntoView(!0),R(!P)}})})]})]})]})}),D&&(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)(W.p,{handleOnClose:()=>L(!1)}),children:(0,a.jsx)(j.NP,{theme:N.A,children:(0,a.jsx)(eP,{onClose:(e,t)=>{L(!1),e&&t&&E.push(`/dashboard/${F.collective.slug}/submitted-expenses`)},submitExpenseTo:e?.slug})})})]})})},8264:(e,t,s)=>{s.d(t,{A:()=>r});var a=s(5646),n=s(56593),i=s(44993);let r=(0,a.I4)(n.A).attrs({maxWidth:i.Et.MAX_SECTION_WIDTH,px:i.Et.PADDING_X,m:"0 auto"}).withConfig({componentId:"sc-7355880b-0"})([""])},9706:(e,t,s)=>{s.d(t,{z:()=>h});var a=s(37876),n=s(14232),i=s(46525),r=s(90281),l=s(62449),o=s(2948),d=s(16907),c=s(20322),u=s(65221),m=s(99271),x=s(28561),p=s(32337);function h({label:e,showError:t=!0,name:s,hint:g,placeholder:f,children:A,error:y,isPrivate:j,privateMessage:v,validate:b,className:C,labelClassName:M,hintClassName:E,errorClassName:T,isFastField:w=!1,...I}){let N=(0,l.tz)(),S=I.htmlFor||`input-${s}`,{schema:P}=(0,n.useContext)(p.Ft),R=w?i.B0:i.D0;return(0,a.jsx)(R,{name:s,validate:b,children:({field:i,form:h,meta:b})=>{let w=!!(b.error&&(b.touched||h.submitCount))||!!y,R=y||b.error,F={...P?(0,p.gS)(P,s):null,...(0,r.A)({...i,name:s||S,id:S,type:I.inputType||I.type,disabled:I.disabled,min:I.min,max:I.max,required:I.required,error:w,placeholder:f,autoFocus:I.autoFocus,autoComplete:I.autoComplete,ref:I.ref,onFocus:I.onFocus,onChange:I.onChange||i.onChange},e=>void 0!==e)};return"required"in F&&!F.required&&b.error&&b.error===N.formatMessage(d.dv.requiredValue)&&(F.required=!0),(0,a.jsxs)("div",{className:(0,c.cn)("flex w-full flex-col gap-1",C),children:[e&&(0,a.jsxs)(x.J,{className:(0,c.cn)("leading-normal",M),htmlFor:S,children:[e," ","required"in F&&!F.required&&(0,a.jsxs)("span",{className:"font-normal text-muted-foreground",children:["(",(0,a.jsx)(l.sA,{defaultMessage:"optional",id:"FormField.optional"}),")"]}),j&&(0,a.jsxs)(n.Fragment,{children:["\xa0",(0,a.jsx)(u.A,{children:v})]})]}),A?A({form:h,meta:b,field:F}):(0,a.jsx)(m.pd,{...F}),g&&(0,a.jsx)("p",{className:(0,c.cn)("text-sm text-muted-foreground",E),children:g}),w&&t&&(0,a.jsx)("p",{className:(0,c.cn)("text-sm text-red-600",T),children:(0,o.nm)(R)?(0,d.p6)(N,R):"string"==typeof R?R:JSON.stringify(R)||"Error"})]})}})}},9832:(e,t,s)=>{s.d(t,{A8:()=>p,gh:()=>u,jU:()=>x});var a=s(37876),n=s(14232),i=s(78248),r=s(62449),l=s(89718),o=s(26843),d=s(11046),c=s(40613);let u="__UNTAGGED",m=(0,r.zR)({defaultMessage:"Untagged",id:"Tags.Untagged"}),x={schema:(0,o.iv)(l.Yj()).optional(),filter:{labelMsg:(0,r.zR)({defaultMessage:"Tag",id:"18HJlm"}),Component:function({meta:e,intl:t,...s}){let{onChange:r,value:l}=s,[o,d]=n.useState([]),[x,{loading:h,data:g}
275]=(0,i._)(p,{fetchPolicy:"cache-first",notifyOnNetworkStatusChange:!0}),f=n.useMemo(()=>e.accountSlug?{account:{slug:e.accountSlug}}:e.hostSlug?{host:{slug:e.hostSlug}}:{},[e.hostSlug,e.accountSlug]),[A,y]=n.useState(!1),j=n.useCallback(e=>{x({variables:{searchTerm:e||void 0,...f}})},[f,x]);n.useEffect(()=>{j("")},[j]);let v=n.useMemo(()=>({label:(0,a.jsx)("span",{className:"text-muted-foreground",children:t.formatMessage(m)}),value:u}),[t]);n.useEffect(()=>{!h&&g?.tagStats?.nodes&&d(g.tagStats.nodes.map(({tag:e})=>({label:e,value:e})))},[h,g]);let b=A?o:[v,...o],C=n.useCallback(e=>{Array.isArray(e)&&!(e.length<=1)&&e.includes(u)?r(Array.isArray(l)&&l.includes(u)?e.filter(e=>e!==u):[u]):r(e)},[r,l]);return(0,a.jsx)(c.A,{isMulti:!0,options:b,loading:h,creatable:!0,searchFunc:j,onInputChange:e=>y(!!e),...s,onChange:C})},valueRenderer:({value:e,intl:t})=>e===u?t.formatMessage(m):e},toVariables:e=>({tags:e.includes(u)?null:e})},p=(0,d.J1)` 276 query ExpenseTags($searchTerm: String, $host: AccountReferenceInput, $account: AccountReferenceInput) { 277 tagStats: expenseTagStats(tagSearchTerm: $searchTerm, host: $host, account: $account) { 278 nodes { 279 id 280 tag 281 } 282 } 283 } 284`},9968:(e,t,s)=>{s.d(t,{Ay:()=>v,TM:()=>y,gy:()=>j});var a=s(37876),n=s(14232),i=s(670),r=s(17738),l=s(62449),o=s(17471),d=s(2038),c=s(11046),u=s(20322),m=s(93182),x=s(99202),p=s(33341),h=s(91345),g=s(98263),f=s(68901),A=s(80207);let y=(0,c.J1)` 285 query ScheduledExpensesBanner($hostSlug: String!, $limit: Int!, $payoutMethodType: PayoutMethodType) { 286 host(slug: $hostSlug) { 287 id 288 currency 289 transferwise { 290 id 291 amountBatched { 292 valueInCents 293 currency 294 } 295 } 296 } 297 expenses( 298 host: { slug: $hostSlug } 299 status: SCHEDULED_FOR_PAYMENT 300 limit: $limit 301 payoutMethodType: $payoutMethodType 302 ) { 303 totalCount 304 offset 305 limit 306 nodes { 307 id 308 } 309 } 310 } 311`,j=e=>({hostSlug:e,limit:100,payoutMethodType:"BANK_ACCOUNT"}),v=({hostSlug:e,onSubmit:t,secondButton:s})=>{let c=(0,i.IT)(y,{variables:j(e)}),{toast:v}=(0,A.d)(),b=(0,l.tz)(),[C,M]=n.useState(!1),E=c.data?.expenses?.totalCount>0,T=c.data?.host?.transferwise?.amountBatched;if(!E||!T)return null;let w=(0,r.create)({mode:r.Mode.PRODUCTION}),I=async()=>{let e=c.data.expenses.nodes.map(e=>e.id);try{await w(`${(0,u.$x)()}/api/services/transferwise/pay-batch`,{method:"POST",body:JSON.stringify({expenseIds:e,hostId:c.data.host.id}),headers:(0,o.D2)()}),M(!1),v({variant:"success",message:(0,a.jsx)(l.sA,{id:"expenses.scheduled.paybatch.success",defaultMessage:"Expenses paid! They're now being processed by Wise."})}),await c.refetch(),t?.()}catch(t){let e=t?.response?await t.response.text():b.formatMessage({defaultMessage:"There was an error trying to process this batch, please <SupportLink>contact support</SupportLink>",id:"MEB9ET"},{SupportLink:p.Ku});v({variant:"error",title:b.formatMessage({defaultMessage:"Batch payment failed",id:"HYFu3j"}),message:e})}};return(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(g.A,{type:"success",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2 align-baseline md:flex-row md:justify-between",children:[(0,a.jsxs)(x.az,{children:[(0,a.jsx)(h.A,{size:"1em",color:"#25B869",mr:2}),(0,a.jsx)(l.sA,{id:"expenses.scheduled.notification",defaultMessage:"You have {count, plural, one {# expense} other {# expenses}} scheduled for payment that will require {amount} in balance.",values:{count:c.data.expenses.totalCount,amount:(0,d.vv)(T.valueInCents,T.currency)}})]}),(0,a.jsxs)("div",{className:"flex justify-between gap-2",children:[s,(0,a.jsx)(f.A,{buttonSize:"tiny",buttonStyle:"successSecondary",onClick:()=>M(!0),children:(0,a.jsx)(l.sA,{id:"expenses.scheduled.paybatch",defaultMessage:"Pay Batch"})})]})]})}),C&&(0,a.jsx)(m.A,{header:(0,a.jsx)(l.sA,{id:"expenses.scheduled.confirmation.title",defaultMessage:"Pay Expenses Batch"}),body:(0,a.jsx)(l.sA,{id:"expenses.scheduled.confirmation.body",defaultMessage:"Are you sure you want to batch and pay {count, plural, one {# expense} other {# expenses}} scheduled for payment?",values:{count:c.data.expenses.totalCount}}),onClose:()=>M(!1),continueLabel:(0,a.jsx)(l.sA,{id:"expense.pay.btn",defaultMessage:"Pay with {paymentMethod}",values:{paymentMethod:"Wise"}}),continueHandler:I,overlayClassName:"z-1000"})]})}},11074:(e,t,s)=>{s.d(t,{A:()=>
311o});var a=s(37876);s(14232);var n=s(62449),i=s(61288),r=s(41955),l=s(74143);let o=({type:e,legacyId:t,isLoading:s=!1,...o})=>{let d=(0,n.tz)();return e||t||!s?(0,a.jsx)(l.A,{variant:"rounded",type:"grey",mr:"10px",textTransform:"uppercase",fontSize:"10px",fontWeight:"600",...o,children:(0,i.z4)(d,e,t)}):(0,a.jsx)(r.A,{height:24,width:73,borderRadius:"12px 2px 2px 12px"})}},11598:(e,t,s)=>{s.d(t,{PP:()=>i,mb:()=>l,ug:()=>r});var a=s(11046),n=s(15192);let i=(0,a.J1)` 312 fragment VendorFields on Vendor { 313 id 314 publicId 315 slug 316 name 317 legalName 318 type 319 hasPublicProfile 320 description 321 tags 322 imageUrl 323 isArchived 324 createdAt 325 features { 326 PUBLIC_PROFILE 327 } 328 settings 329 330 location { 331 id 332 address 333 country 334 name 335 structured 336 } 337 338 createdByAccount { 339 id 340 slug 341 name 342 imageUrl 343 ...AccountHoverCardFields 344 } 345 346 vendorInfo { 347 contact { 348 name 349 email 350 } 351 taxFormUrl 352 taxFormRequired 353 taxType 354 taxId 355 notes 356 } 357 358 payoutMethods { 359 id 360 type 361 name 362 data 363 } 364 365 orders(filter: OUTGOING, limit: 1) { 366 totalCount 367 } 368 369 expenses(status: PAID, direction: SUBMITTED, limit: 1) { 370 totalCount 371 } 372 373 canBeUsedWithAccounts { 374 id 375 type 376 legacyId 377 slug 378 name 379 imageUrl 380 } 381 382 useVendorPolicy 383 } 384 ${n.B} 385`,r=(0,a.J1)` 386 mutation CreateVendor($vendor: VendorCreateInput!, $host: AccountReferenceInput!) { 387 createVendor(host: $host, vendor: $vendor) { 388 id 389 ...VendorFields 390 } 391 } 392 ${i} 393`,l=(0,a.J1)` 394 mutation SetVendorArchive($vendor: VendorEditInput!, $archive: Boolean!) { 395 editVendor(archive: $archive, vendor: $vendor) { 396 id 397 ...VendorFields 398 } 399 } 400 ${i} 401`},13408:(e,t,s)=>{s.d(t,{A:()=>p});var a=s(37876),n=s(14232),i=s(21651),r=s(64487),l=s(5646),o=s(56593),d=s(90983),c=s(72945);let u=(0,l.I4)(o.A).withConfig({componentId:"sc-5a4a69e9-0"})(["&:hover{border-color:",";}&:focus-within{border-color:",";}input{border:none;outline:none;box-shadow:none;}input:focus ~ div svg{color:",";}"],(0,i.y)("colors.primary.300"),(0,i.y)("colors.primary.500"),(0,i.y)("colors.primary.300")),m=({error:e,success:t})=>e?"red.300":t?"green.300":"black.800",x=({error:e,focused:t,success:s,defaultBg:a="black.50"})=>t?"primary.100":e?"red.100":s?"green.100":a,p=({append:e,prepend:t,disabled:s,success:i,error:l,maxWidth:p,containerProps:h,prependProps:g,appendProps:f,innerRef:A,autoFocus:y,overflow:j,...v})=>{let[b,C]=(0,n.useState)(!1);return(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)(u,{bg:s?"black.50":"white.full",maxWidth:p,border:"1px solid",borderColor:(({error:e,focused:t,success:s})=>t?"primary.300":e?"red.500":s?"green.300":"black.300")({error:l,focused:b,success:i}),borderRadius:"4px",display:"flex",alignItems:"center",lineHeight:"1.5",...h,children:[t&&(0,a.jsx)(o.A,{fontSize:"14px",borderRadius:"4px 0 0 4px",p:2,color:m({error:l,success:i}),maxHeight:"100%",whiteSpace:"nowrap",...g,bg:s&&"black.50"||(0,r.A)(g,"bg")||x({error:l,focused:b,success:i}),children:t}),(0,a.jsx)(d.A,{bare:!0,autoFocus:y,color:m({error:l,success:i}),type:"text",overflow:j||"scroll",fontSize:"14px",flex:"1 1 auto",disabled:s,py:"0",px:2,maxHeight:"100%",error:l,minWidth:"0",width:"100%",ref:A,...v,onFocus:e=>{C(!0),v.onFocus&&v.onFocus(e)},onBlur:e=>{C(!1),v.onBlur&&v.onBlur(e)}}),e&&(0,a.jsx)(o.A,{borderRadius:"4px 0 0 4px",p:2,color:m({error:l,success:i}),fontSize:"14px",...f,bg:x({error:l,focused:b,success:i,defaultBg:f?.bg}),children:e})]}),!!l&&"boolean"!=typeof l&&(0,a.jsx)(c.L9,{display:"block",color:"red.500",pt:2,fontSize:"10px",children:l})]})}},14021:(e,t,s)=>{s.d(t,{A:()=>m});var a=s(37876);s(14232);var n=s(40056),i=s(62449),r=s(2948),l=s(11046),o=s(93182),d=s(80207);let c=(0,l.J1)` 402 mutation DeleteExpense($id: String!) { 403 deleteExpense(expense: { id: $id }) { 404 id 405 } 406 } 407`,u=(e,{data:{deleteExpense:t}})=>{e.modify({fields:{expenses:(e,{readField:s})=>e?.nodes?{...e,totalCount:e.totalCount-1,nodes:e.nodes.filter(e=>t.id!==s("id",e))}:e}})},m=({onDelete:e,showDeleteConfirmMoreActions:t,expense:s})=>{let{toast:l}=(0,d.d)(),m=(0,i.tz)();return(0,a.jsx)(n.s,{mutation:c,update:u,children:n=>(0,a.jsx)(o.A,{isDanger:!0,type:"delete",onClose:()=>t(!1),header:(0,a.jsx)(i.sA,{id:"actions.delete",defaultMessage:"Delete"}),continueHandler:async()=>{try{await n({variables:{id:s.id}}),l({variant:"success",message:(0,a.jsx)(i.sA,{id:"delete.successMessage",defaultMessage:"'Expense has been deleted successfully'"})})}catch(e){l({variant:"error",message:(0,r.Rp)(m,e)})}e&&await e(s),t(!1)},children:(0,a.jsx)(i.sA,{id:"Expense.DeleteDetails",defaultMessage:"This will permanently delete the expense and all attachments and comments."})})})}},15022:(e,t,s)=>{s.d(t,{PV:()=>u,ms:()=>m,pm:()=>c});var a=s(37876),n=s(14232),i=s(5646),r=s(23968),l=s(77243),o=s(87881),d=s(56611);let c=i.Ay.div.withConfig({componentId:"sc-ef1e027e-0"})(["display:none;position:absolute;max-width:320px;z-index:1000000;border-radius:4px;font-size:12px;text-transform:initial;white-space:normal;color:white;background:white;box-shadow:0px 4px 8px rgba(20,20,20,0.16);border:1px solid #e2e2e2;"]),u=(0,i.Ay)("div").withConfig({componentId:"sc-ef1e027e-1"})(["position:absolute;font-size:8px;width:3em;height:3em;width:3em;height:1em;z-index:1000001;margin-left:50px;
407margin-top:-7px;display:none;&::before{border-width:0 1.5em 1em 1.5em;border-color:transparent transparent white transparent;filter:drop-shadow(0 0 0 grey);content:'';margin:auto;display:block;width:0;height:0;border-style:solid;}"]),m=(0,i.Ay)(({children:e,trigger:t,...s})=>{let i=(0,n.useRef)(void 0),[r,d]=n.useState(!1),c=n.useCallback(()=>{r&&d(!1)},[r]);return((0,l.A)(i,e=>{e&&r&&setTimeout(()=>{d(!1)},50)}),(0,o.Ay)({callback:c,keyMatch:o.aH}),"function"==typeof e&&"click"===t)?(0,a.jsx)("div",{...s,ref:i,"data-expanded":r,children:e({isDisplayed:r,triggerProps:{onClick:()=>{d(!r)}},dropdownProps:{onClick:()=>setTimeout(c,50),onBlur:()=>setTimeout(()=>{document.activeElement&&i.current?.contains(document.activeElement)||c()},50)}})}):(0,a.jsx)("div",{role:"button",tabIndex:0,trigger:t,...s,onFocus:()=>setTimeout(()=>d(!0),50),onBlur:()=>setTimeout(c,50),onClick:e=>{r&&(document.activeElement?.contains(e.target)?document.activeElement.blur():e.target.blur())},children:e})}).withConfig({shouldForwardProp:(e,t)=>(0,d.x)(e,t)&&!r.pn.propNames.includes(e)}).withConfig({componentId:"sc-ef1e027e-2"})([""," ",""],r.pn,e=>"hover"===e.trigger?(0,i.AH)(["&:hover,&:active,&:focus-within{",",","{display:block;}}"],c,u):(0,i.AH)(["&[data-expanded='true']{",",","{display:block;}}"],c,u))},15114:(e,t,s)=>{s.d(t,{Ky:()=>l,MB:()=>r,dB:()=>o});var a=s(11046),n=s(21092),i=s(84611);let r=(0,a.J1)` 408 mutation EditExpense($expense: ExpenseUpdateInput!, $draftKey: String, $isDraftEdit: Boolean) { 409 editExpense(expense: $expense, draftKey: $draftKey, isDraftEdit: $isDraftEdit) { 410 id 411 ...ExpensePageExpenseFields 412 } 413 } 414 415 ${i.nN} 416`,l=(0,a.J1)` 417 mutation EditExpenseCategory($expenseId: String!, $category: AccountingCategoryReferenceInput) { 418 editExpense(expense: { id: $expenseId, accountingCategory: $category }) { 419 id 420 valuesByRole { 421 id 422 ...ExpenseValuesByRoleFragment 423 } 424 accountingCategory { 425 id 426 ...AccountingCategorySelectFields 427 } 428 } 429 } 430 ${n.Vo} 431 ${i.Sq} 432`,o=(0,a.J1)` 433 mutation MoveExpense($expense: ExpenseReferenceInput!, $destinationAccount: AccountReferenceInput!) { 434 moveExpense(expense: $expense, destinationAccount: $destinationAccount) { 435 id 436 ...ExpensePageExpenseFields 437 } 438 } 439 440 ${i.nN} 441`},15449:(e,t,s)=>{s.d(t,{Gb:()=>m,R3:()=>u,_q:()=>d,av:()=>o,ht:()=>c,lN:()=>l});var a=s(72976),n=s(2587),i=s(29377),r=s(2038);let l=.1,o=e=>!(0,a.A)(e)&&e>=0&&e<=1,d=(e,t)=>Math.round(e*t.rate),c=(e,t,s)=>{let a=(0,r.aJ)(t,s);return a>l?{error:e.formatMessage({defaultMessage:"This exchange rate is too different from the one in our records ({value}) for that date and won't be accepted.",id:"cEI/zq"},{value:(0,n.A)(s.value,7)})}:a>.02?{warning:e.formatMessage({defaultMessage:"This exchange rate is notably different from the one in our records ({value}) for this date.",id:"mLRswr"},{value:(0,n.A)(s.value,7)})}:null},u=(e,t,s)=>{let a=t.every(t=>!!(t.amountV2?.valueInCents&&(t.amountV2.currency===e||t.amountV2.exchangeRate&&t.amountV2.exchangeRate.fromCurrency===t.amountV2.currency&&t.amountV2.exchangeRate.toCurrency===e&&t.amountV2.exchangeRate.value))),n=s?.filter(e=>!e.isDisabled)||[],r=!!n.length,l=!r||n.every(e=>o(e.rate)),c=a?(0,i.A)(t,t=>{let s=t.amountV2.valueInCents;return t.amountV2.currency===e?s:Math.round(s*t.amountV2.exchangeRate.value)}):null,u=(0,i.A)(n,e=>d(c,e)),m=a&&l?c+u:null;return{hasTaxes:r,totalInvoiced:c,totalAmount:m}},m=(e,t)=>e/(1+(0,i.A)(t,"rate"))},16147:(e,t,s)=>{s.d(t,{A:()=>h,m:()=>p});var a=s(37876);s(14232);var n=s(92850),i=s(2587),r=s(62449),l=s(20322),o=s(34679),d=s(2996),c=s(99202),u=s(61270);let m=(0,r.YK)({USER:{id:"Tags.USER",defaultMessage:"User"}}),x={PAYPAL:"PayPal",OPENCOLLECTIVE:"Open Collective",WISE:"Wise"},p=(e,t,{approximateCustomMessage:s,warning:n,error:l}={})=>{let{value:d,date:u,source:p,isApproximate:h,fromCurrency:g,toCurrency:f}=t;return(0,a.jsxs)(c.so,{flexDirection:"column","data-cy":"exchange-rate-info",children:[(0,a.jsx)(r.sA,{defaultMessage:"Exchange rate: 1 {fromCurrency} = {rate} {toCurrency}",id:"PyjGft",values:{rate:(0,i.A)(d,7)||(0,a.jsx)(r.sA,{id:"exch
441angeRate.noneSet",defaultMessage:"Not defined yet"}),fromCurrency:g,toCurrency:f}}),p&&(0,a.jsx)("div",{children:(0,a.jsx)(r.sA,{defaultMessage:"Source: {source}",id:"/gUYR+",values:{source:m[p]?e.formatMessage(m[p]):x[p]||p}})}),u&&"USER"!==p&&(0,a.jsx)("div",{children:(0,a.jsx)(r.sA,{defaultMessage:"Acquired on: {date}",id:"dT6mUk",values:{date:(0,a.jsx)(o.A,{value:u,timeStyle:"short"})}})}),n&&(0,a.jsx)("div",{className:"mt-2 max-w-[300px] whitespace-normal text-yellow-500",children:n}),l&&(0,a.jsx)("div",{className:"mt-2 max-w-[300px] whitespace-normal text-red-400",children:l}),h&&(0,a.jsxs)("div",{className:"mt-2 flex max-w-[300px] gap-1 whitespace-normal",children:[(0,a.jsx)("span",{role:"img","aria-label":"Warning",children:"â ï¸"}),"\xa0",s||(0,a.jsx)(r.sA,{defaultMessage:"This value is an estimate",id:"lpal5V"})]})]})},h=({amount:{exchangeRate:e,currency:t,value:s,valueInCents:i},amountClassName:o=null,showCurrencyCode:m,invertIconPosition:x=!1,warning:h=null,error:g=null,amountWrapperClassName:f,currencyCodeClassName:A})=>{let y=(0,r.tz)();return(0,a.jsx)(u.A,{display:"block",containerVerticalAlign:"middle",noTooltip:!e,content:()=>p(y,e,{warning:h,error:g}),children:(0,a.jsxs)(c.so,{flexWrap:"noWrap",alignItems:"center",flexDirection:x?"row-reverse":"row",gap:"4px",children:[(0,a.jsx)("div",{className:(0,l.cn)("flex flex-row gap-1 whitespace-nowrap",f),children:(0,a.jsx)(d.A,{amount:i??Math.round(100*s),currency:t,precision:2,amountClassName:o||null,showCurrencyCode:m,isApproximate:e?.isApproximate,currencyCodeClassName:A})}),e&&(0,a.jsx)(n.d,{size:"1em",className:(0,l.cn)({"text-yellow-600":h,"text-red-600":g})})]})})}},16240:(e,t,s)=>{s.d(t,{O0:()=>n,UC:()=>a,hp:()=>i});let a={ACCOUNT_BALANCE:"ACCOUNT_BALANCE",BANK_ACCOUNT:"BANK_ACCOUNT",PAYPAL:"PAYPAL",CREDIT_CARD:"CREDIT_CARD",OTHER:"OTHER",STRIPE:"STRIPE"},n="INVITE",i="VIRTUAL_CARD"},20058:(e,t,s)=>{s.d(t,{F:()=>y});var a=s(37876),n=s(14232),i=s(42551),r=s(36944),l=s(62449),o=s(89230),d=s(28678);let c=e=>!(0,o.A)(e)||(0,d.A)(e)?e:Object.entries(e).reduce((e,[t,s])=>{if((0,o.A)(s)&&!Array.isArray(s)){let a=c(s);(0,d.A)(a)||(e[t]=a)}else(0,d.A)(s)||(e[t]=s);return e},{});var u=s(20322),m=s(34679),x=s(2996),p=s(1509),h=s(16255),g=s(83509),f=s(51778),A=s(33883);let y=({matchInfo:e,row:t,transactionsImport:s,collapsible:y,hideBasics:j})=>{let[v,b]=n.useState(!1);return(0,a.jsx)(h.Nt,{open:v||!y,children:(0,a.jsxs)(g.Tr,{className:(0,u.cn)("rounded bg-slate-50 p-4",y&&"pb-1"),children:[!j&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(g.e3,{label:(0,a.jsx)(l.sA,{id:"Fields.amount",defaultMessage:"Amount"}),labelClassName:"basis-1/3 min-w-auto max-w-auto",value:(0,a.jsx)(A.x,{hasMatch:e?.amount,children:(0,a.jsx)(x.A,{amount:t.amount.valueInCents,currency:t.amount.currency})})}),(0,a.jsx)(g.e3,{label:(0,a.jsx)(l.sA,{defaultMessage:"Date",id:"expense.incurredAt"}),labelClassName:"basis-1/3 min-w-auto max-w-auto",value:(0,a.jsx)(A.x,{hasMatch:e?.date,children:(0,a.jsx)(m.A,{value:t.date})})}),(0,a.jsx)(g.e3,{label:(0,a.jsx)(l.sA,{id:"AddFundsModal.source",defaultMessage:"Source"}),value:s.source,itemClassName:"truncate max-w-full",labelClassName:"basis-1/3 min-w-auto max-w-auto",showValueAsItemTitle:!0}),(0,a.jsx)(g.e3,{label:(0,a.jsx)(l.sA,{defaultMessage:"Transaction ID",id:"oK0S4l"}),value:t.sourceId,itemClassName:"truncate max-w-full",labelClassName:"basis-1/3 min-w-auto max-w-auto",showValueAsItemTitle:!0}),(0,a.jsx)(g.e3,{label:(0,a.jsx)(l.sA,{id:"Fields.description",defaultMessage:"Description"}),value:t.description,labelClassName:"basis-1/3 min-w-auto max-w-auto",showValueAsItemTitle:!0})]}),(0,a.jsx)(h.Ke,{className:"flex flex-col gap-2",children:Object.entries(t.rawValue).map(e=>(0,o.A)(e[1])&&!(0,d.A)(e[1])?[e[0],c(e[1])]:e).filter(e=>(([e,t],s)=>{if((0,d.A)(t))return!1;if(s){let{columns:t}=s;if([t.credit.target,t.debit.target,t.date.target].includes(e))return!1}else if(["date","description","amount","name","transaction_id","transactionAmount","remittanceInformationUnstructured","remittanceInformationUnstructuredArray","personal_finance_category","personal_finance_category_icon_url"].includes(e))return!1;return!0})(e,s.csvConfig)).map(([e,t])=>(0,a.jsx)(g.Es,{label:e,itemClassName:"truncate max-w-full",labelClassName:"basis-1/3 min-w-auto max-w-auto",value:t,showValueAsItemTitle:!0},e))}),!!y&&(0,a.jsxs)("div",{className:"mt-2 flex flex-col items-center gap-1",children:[(0,a.jsx)(f.w,{}),(0,a.jsx)(h.R6,{asChild:!0,children:(0,a.jsx)(p.$n,{variant:"ghost",className:"h-auto w-full text-xs font-normal",onClick:()=>{b(!v)},children:v?(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(l.sA,{defaultMessage:"View less",id:"EVF
441ai9"}),(0,a.jsx)(i.A,{size:16})]}):(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(l.sA,{defaultMessage:"View more",id:"34Up+l"}),(0,a.jsx)(r.A,{size:16})]})})})]})]})})}},20422:(e,t,s)=>{s.d(t,{A:()=>p});var a=s(37876),n=s(14232),i=s(62449),r=s(2948),l=s(56615),o=s(98263),d=s(97268),c=s(97569),u=s(80207);let m=(0,i.YK)({reasonPlaceholder:{defaultMessage:"e.g, We never worked with this person.",id:"mpLU2S"},REQUEST_RE_APPROVAL_TITLE:{id:"expense.requestReApproval.btn",defaultMessage:"Request re-approval"},REQUEST_RE_APPROVAL_DESCRIPTION:{defaultMessage:"Please mention the reason why this expense requires re-approval. The reason will be shared with the user and also be documented as a comment under the expense.",id:"jD5/NS"},REQUEST_RE_APPROVAL_CONFIRM_BUTTON:{defaultMessage:"Confirm and request re-approval",id:"UrUS9j"},MARK_AS_INCOMPLETE_TITLE:{defaultMessage:"Mark as incomplete",id:"hu7oaH"},MARK_AS_INCOMPLETE_DESCRIPTION:{defaultMessage:"Please mention the reason why this expense has been marked as incomplete. The reason will be shared with the user and also be documented as a comment under the expense.",id:"x7D8vH"},MARK_AS_INCOMPLETE_CONFIRM_BUTTON:{defaultMessage:"Confirm and mark as incomplete",id:"lNyyJU"},APPROVE_TITLE:{id:"actions.approve",defaultMessage:"Approve"},APPROVE_DESCRIPTION:{defaultMessage:"You may add a note that will be shared with the user and also be documented as a comment under the expense.",id:"xmVXUM"},APPROVE_CONFIRM_BUTTON:{id:"actions.approve",defaultMessage:"Approve"},UNAPPROVE_TITLE:{id:"expense.unapprove.btn",defaultMessage:"Unapprove"},UNAPPROVE_DESCRIPTION:{defaultMessage:"Please mention the reason why this expense has been unapproved. The reason will be shared with the user and also be documented as a comment under the expense.",id:"SREb+h"},UNAPPROVE_CONFIRM_BUTTON:{id:"expense.unapprove.btn",defaultMessage:"Unapprove"},REJECT_TITLE:{id:"actions.reject",defaultMessage:"Reject"},REJECT_DESCRIPTION:{defaultMessage:"Please mention the reason why this expense has been rejected. The reason will be shared with the user and also be documented as a comment under the expense.",id:"aOO6yW"},REJECT_CONFIRM_BUTTON:{id:"actions.reject",defaultMessage:"Reject"},HOLD_TITLE:{defaultMessage:"Put expense on hold",id:"FXOuRH"},HOLD_DESCRIPTION:{defaultMessage:"Expense is still approved but can not be paid out until it is released. Expense is also not displayed in ready to pay.",id:"aE2FPd"},HOLD_CONFIRM_BUTTON:{defaultMessage:"Put on Hold",id:"+pCc8I"},RELEASE_TITLE:{id:"actions.release",defaultMessage:"Release Hold"},RELEASE_DESCRIPTION:{defaultMessage:"Expense can be paid out and is displayed in ready to pay list.",id:"zIsgw6"},RELEASE_CONFIRM_BUTTON:{id:"actions.release",defaultMessage:"Release Hold"},MARK_AS_SPAM_TITLE:{id:"actions.spam",defaultMessage:"Mark as Spam"},MARK_AS_SPAM_DESCRIPTION:{id:"Expense.MarkAsSpamWarning",defaultMessage:"This will prevent the submitter account to post new expenses."},MARK_AS_SPAM_CONFIRM_BUTTON:{id:"actions.spam",defaultMessage:"Mark as Spam"},MARK_AS_SPAM_LABEL:{id:"Expense.MarkAsSpamLabel",defaultMessage:"Why are you marking this expense as spam?"}}),x={REQUEST_RE_APPROVAL:{title:m.REQUEST_RE_APPROVAL_TITLE,description:m.REQUEST_RE_APPROVAL_DESCRIPTION,confirmBtn:m.REQUEST_RE_APPROVAL_CONFIRM_BUTTON},MARK_AS_INCOMPLETE:{title:m.MARK_AS_INCOMPLETE_TITLE,description:m.MARK_AS_INCOMPLETE_DESCRIPTION,confirmBtn:m.MARK_AS_INCOMPLETE_CONFIRM_BUTTON},APPROVE:{title:m.APPROVE_TITLE,description:m.APPROVE_DESCRIPTION,confirmBtn:m.APPROVE_CONFIRM_BUTTON},UNAPPROVE:{title:m.UNAPPROVE_TITLE,description:m.UNAPPROVE_DESCRIPTION,confirmBtn:m.UNAPPROVE_CONFIRM_BUTTON},REJECT:{title:m.REJECT_TITLE,description:m.REJECT_DESCRIPTION,confirmBtn:m.REJECT_CONFIRM_BUTTON},HOLD:{title:m.HOLD_TITLE,description:m.HOLD_DESCRIPTION,confirmBtn:m.HOLD_CONFIRM_BUTTON},RELEASE:{title:m.RELEASE_TITLE,description:m.RELEASE_DESCRIPTION,confirmBtn:m.RELEASE_CONFIRM_BUTTON},MARK_AS_SPAM:{title:m.MARK_AS_SPAM_TITLE,description:m.MARK_AS_SPAM_DESCRIPTION,confirmBtn:m.MARK_AS_SPAM_CONFIRM_BUTTON,label:m.MARK_AS_SPAM_LABEL}};function p({type:e,open:t,setOpen:s,expense:h,onCloseFocusRef:g,onSuccess:f}){let A=(0,i.tz)(),[y,j]=n.useState(),[v,b]=n.useState(!1),C=(0,l.A)({expense:h}),M=n.useCallback(async()=>{try{switch(e){case"MARK_AS_INCOMPLETE":await C.markAsIncomplete({message:y});break;case"REQUEST_RE_APPROVAL":await C.requestReApproval({message:y});break;case"APPROVE":await C.approve({message:y});break;
441case"UNAPPROVE":await C.unapprove({message:y});break;case"REJECT":await C.reject({message:y});break;case"HOLD":await C.hold({message:y});break;case"RELEASE":await C.release({message:y});break;case"MARK_AS_SPAM":await C.markAsSpam({message:y})}}catch(e){(0,u.o)({variant:"error",message:(0,r.Rp)(A,e)});return}s(!1),f?.(e)},[e,y,A,f,C,s]);return(0,a.jsx)(c.Lt,{open:t,onOpenChange:s,children:(0,a.jsxs)(c.EO,{onCloseAutoFocus:e=>{g?.current&&(e.preventDefault(),g.current.focus())},className:"max-w-md",children:[(0,a.jsx)(c.wd,{children:(0,a.jsx)(c.r7,{children:A.formatMessage(x[e].title)})}),(0,a.jsx)(o.A,{lineHeight:"20px",mb:10,type:"warning",withIcon:!0,children:A.formatMessage(x[e].description)}),(0,a.jsxs)("div",{className:"space-y-4",children:[x[e].label&&(0,a.jsx)("label",{htmlFor:"expense-ban-reason",className:"mb-2 block text-sm font-medium text-slate-700",children:A.formatMessage({id:"OptionalFieldLabel",defaultMessage:"{field} (optional)"},{field:A.formatMessage(x[e].label)})}),(0,a.jsx)(d.default,{"data-cy":"confirm-action-text",kind:"COMMENT",version:"simplified",withBorders:!0,editorMinHeight:150,placeholder:A.formatMessage(m.reasonPlaceholder),fontSize:"13px",onChange:e=>j(e.target.value),setUploading:b})]}),(0,a.jsxs)(c.ck,{children:[(0,a.jsx)(c.Zr,{disabled:v||C.loading,children:(0,a.jsx)(i.sA,{id:"actions.cancel",defaultMessage:"Cancel"})}),(0,a.jsx)(c.Rx,{"data-cy":"confirm-action-button",loading:C.loading,disabled:v,onClick:async e=>{e.preventDefault(),await M()},children:A.formatMessage(x[e].confirmBtn)})]})]})})}},22696:(e,t,s)=>{s.d(t,{X:()=>a});let a=(0,s(5646).AH)(["@media (pointer:fine){&::-webkit-scrollbar{height:8px;margin:0 16px;}&::-webkit-scrollbar-thumb{background:#d1d1d3;border-radius:16px;&:hover{background:#aaa;}}&::-webkit-scrollbar-track{background:#f2f3f4;border-radius:20px;}&::-webkit-scrollbar-button{color:white;}}"])},23052:(e,t,s)=>{s.d(t,{_:()=>A,p:()=>j});var a=s(37876),n=s(14232),i=s(14500),r=s(72976),l=s(64487),o=s(2587),d=s(62449),c=s(2948),u=s(16907),m=s(21057),x=s(99202),p=s(90983),h=s(94089),g=s(13408),f=s(45409);let A=(e,t,s={requireTaxIdNumber:!0})=>{switch(t?.type){case i.TaxType.GST:let a;return a={},t.type!==i.TaxType.GST||(t.rate&&!t.idNumber&&s.requireTaxIdNumber?a.idNumber=(0,c.$5)(c.ff.FORM_FIELD_REQUIRED):[0,.15].includes(t.rate)||(a.rate=(0,c.$5)(c.ff.FORM_FIELD_INVALID_VALUE))),a;case i.TaxType.VAT:let n;return n={},t.type!==i.TaxType.VAT||(isNaN(t.rate)||(0,r.A)(t.rate)?n.rate=(0,c.$5)(c.ff.FORM_FIELD_REQUIRED):(0,u.$U)(e,n,t,"rate",0,1,100),t.rate&&(!t.idNumber&&s.requireTaxIdNumber?n.idNumber=(0,c.$5)(c.ff.FORM_FIELD_REQUIRED):t.idNumber&&!(0,i.checkVATNumberFormat)(t.idNumber).isValid&&(n.idNumber=(0,c.$5)(c.ff.FORM_FIELD_PATTERN)))),n;default:return{}}},y=(e,t,s)=>s?`${100*s}%`:e.formatMessage({defaultMessage:"No {taxName}",id:"lTGBvW"},{taxName:(0,m.k)(e,t,"short")}),j=({taxType:e,formik:t,formikValuePath:s,labelProps:c,isOptional:u,requireIdNumber:A,idNumberLabelRenderer:j,dispatchDefaultValueOnMount:v=!0})=>{let b=(0,d.tz)(),C=(0,l.A)(t.values,s),M=((e,t,{requireIdNumber:s}={})=>{switch(e){case i.TaxType.VAT:return{idNumberPlaceholder:"EU000011111",requireIdNumber:(0,r.A)(s)?!!t?.rate:s};case i.TaxType.GST:return{idNumberPlaceholder:"123456789",requireIdNumber:!(0,r.A)(s)&&s,forcedRate:i.GST_RATE_PERCENT/100,possibleRates:[0,i.GST_RATE_PERCENT/100]};default:return null}})(e,C,{requireIdNumber:A}),E=a=>t.setFieldValue(s,{...C,type:e,rate:a});if(n.useEffect(()=>{let t=!u&&!(0,r.A)(M.forcedRate);v&&e&&(C?.type!==e||t&&M.forcedRate!==C?.rate)&&E(M.forcedRate)},[]),!e)return null;let T=(0,m.k)(b,e,"short"),w=!u&&!(0,r.A)(M.forcedRate);return(0,a.jsxs)(x.so,{gap:"8px",children:[(0,a.jsx)(h.A,{name:`${s}.rate`,htmlFor:`input-${e}-rate`,label:b.formatMessage({defaultMessage:"{taxName} rate",id:"Gsyrfa"},{taxName:T}),labelProps:{whiteSpace:"nowrap",...c},inputType:"number",required:!u,children:({field:t})=>w||!M.possibleRates?(0,a.jsx)(g.A,{...t,value:(0,o.A)(100*t.value,2),onChange:e=>E((0,o.A)(e.target.value/100,4)),minWidth:65,append:"%",min:0,max:100,step:"0.01",disabled:w}):(0,a.jsx)(f.A,{inputId:`input-${e}-rate`,value:{value:(0,o.A)(100*t.value,2),label:y(b,e,t.value)},onChange:({value:e})=>E(e),options:M.possibleRates.map(t=>({value:t,label:y(b,e,t)}))})}),(0,a.jsx)(h.A,{name:`${s}.idNumber`,htmlFor:`input-${e}-id-number`,label:j?j(T):b.formatMessage({defaultMessage:"{taxName} identifier",id:"Byg+S/"},{taxName:T}),labelProps:{whiteSpace:"nowrap",...c},required:!u&&M.requireIdNumber,flexGrow:1,mr:2,children:({field:e})=>(0,a.jsx)(p.A,{...e,placeholder:b.formatMessage({id:"examples",defaultMessage:"e.g., {examples}"},{examples:M.idNumberPlaceholder})})})]})}},24991:(e,t,s)=>{s.d(t,{Lj:()=>$,jJ:()=>V,Ay:()=>W,nh:()=>z});var a=s(37876),n=s(14232),i=s(64177),r=s(78248),l=s(92850),o=s(34079),d=s(26543),c=s(93523),u=s(10611),m=s(62449),x=s(5646);
441let p="AUTHOR_CANNOT_APPROVE",h=(0,m.YK)({[p]:{id:"ExpensePermissionReason.AUTHOR_CANNOT_APPROVE",defaultMessage:"You cannot approve expenses you have submitted{amount, select, 0 {.} other { when the expense is above {amount} {currency}.}}"}});var g=s(2948),f=s(11046),A=s(60257),y=s(88808),j=s(33123),v=s(23668),b=s(96812),C=s(9968),M=s(69756),E=s(61270),T=s(1509),w=s(80207),I=s(84611),N=s(47722),S=s(20422),P=s(9271),R=s(72945),F=s(14021);let k=({expense:e,onDelete:t,buttonProps:s,isDisabled:i,onModalToggle:r})=>{let[l,o]=n.useState(!1),d=e=>{o(e),r?.(e)};return(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)(T.$n,{variant:"outlineDestructive","data-cy":"delete-expense-button",disabled:i,...s,onClick:()=>d(!0),children:[(0,a.jsx)(P.T,{size:"1em"}),(0,a.jsx)(R.L9,{ml:"6px",children:(0,a.jsx)(m.sA,{id:"actions.delete",defaultMessage:"Delete"})})]}),l&&(0,a.jsx)(F.A,{onDelete:t,expense:e,showDeleteConfirmMoreActions:d})]})};var O=s(50427);let _=({expense:e,...t})=>{let[s,i]=n.useState(!1);return(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(T.$n,{...t,variant:"outlineDestructive",onClick:()=>
441i(!0),children:(0,a.jsx)(m.sA,{id:"expense.markAsUnpaid.btn",defaultMessage:"Mark as unpaid"})}),(0,a.jsx)(O.A,{expense:e,open:s,setOpen:i})]})};var D=s(44564),U=s(86742);let L=(0,f.J1)` 442 mutation ProcessExpense( 443 $id: String 444 $legacyId: Int 445 $action: ExpenseProcessAction! 446 $paymentParams: ProcessExpensePaymentParams 447 ) { 448 processExpense(expense: { id: $id, legacyId: $legacyId }, action: $action, paymentParams: $paymentParams) { 449 id 450 ...ExpensePageExpenseFields 451 } 452 } 453 454 ${I.nN} 455`,$=x.I4.span.withConfig({componentId:"sc-14f69fa-0"})({marginLeft:6}),z=e=>!!e&&(e.canApprove||e.canUnapprove||e.canReject||e.canPay||e.canMarkAsPaid||e.canMarkAsUnpaid||e.canMarkAsSpam||e.canDelete||e.canUnschedulePayment),H=(0,m.YK)({markAsSpamWarning:{id:"Expense.MarkAsSpamWarning",defaultMessage:"This will prevent the submitter account to post new expenses."}}),B=({icon:e,label:t,permission:s,...n})=>{let i=(0,m.tz)(),r=(0,a.jsxs)(T.$n,{...n,disabled:!s.allowed,children:[s.reason?(0,a.jsx)(l.d,{size:14}):e,t]}),o=s.reason&&i.formatMessage(h[s.reason],s.reasonDetails);return o&&(r=(0,a.jsx)(E.A,{content:o,children:r})),r},V={buttonSize:"small",minWidth:130},W=({expense:e,collective:t,host:s,permissions:l,buttonProps:x=V,onSuccess:h,onModalToggle:E,onDelete:P,isMoreActions:R,displaySecurityChecks:F=!0,isViewingExpenseInHostContext:O=!1,disabled:z,enableKeyboardShortcuts:W})=>{let[q,G]=n.useState(),[Y,K]=n.useState(!1),[J,Z]=n.useState(null),[X,{loading:Q,error:ee}]=(0,i.n)(L),et=(0,m.tz)(),{toast:es}=(0,w.d)(),{LoggedInUser:ea}=(0,A.A)(),[en]=(0,r._)((0,f.J1)` 456 query ProcessExpenseButtonsExpenseStatus($expense: ExpenseReferenceInput!) { 457 expense(expense: $expense) { 458 id 459 legacyId 460 status 461 ...ExpensePageExpenseFields 462 } 463 } 464 465 ${I.nN} 466 `,{}),ei=n.useCallback(async()=>{let t=10;for(;;){if(t--<=0)return;await new Promise(e=>setTimeout(e,3e3));let s=await en({variables:{expense:(0,u.A)(e,["id","legacyId"])}});if(s.error)continue;let a=s.data.expense;if(a.status===j.Drj.PAID||a.status===j.Drj.PROCESSING)return}},[en,e]);n.useEffect(()=>(E?.(!!q),()=>E?.(!1)),[q,E]);let er=async(t,i)=>{if(!Q){Z(t);try{let a={id:e.id,legacyId:e.legacyId,action:t,paymentParams:i},n=[];("SCHEDULE_FOR_PAYMENT"===t||"UNSCHEDULE_PAYMENT"===t)&&n.push({query:C.TM,variables:(0,C.gy)(s.slug)}),(0,b.LN)(t)&&n.push(...(0,b.XH)(s)),await X({variables:a,refetchQueries:n}),"MARK_AS_PAID_WITH_STRIPE"===t&&await ei()}catch(t){let e;return es({variant:"error",...(e=t?.message)&&e.startsWith("Insufficient Paypal balance")?{title:et.formatMessage({defaultMessage:"Insufficient Paypal balance",id:"BmZrOu"}),message:(0,a.jsx)(n.Fragment,{children:(0,a.jsx)(M.A,{href:`/dashboard/${s.slug}/${v.tm.PAY_DISBURSEMENTS}`,children:(0,a.jsx)(m.sA,{id:"PayExpenseModal.RefillBalanceError",defaultMessage:"Refill your balance from the Host dashboard"})})})}:{message:(0,g.Rp)(et,t)}}),!1}return h?.(t),!0}},el=e=>{let t=J===e;return{...x,disabled:z||Q&&!t,loading:Q&&t}};return(0,a.jsxs)(n.Fragment,{children:[!O&&(l.approve.allowed||l.approve.reason===p)&&(0,a.jsx)(B,{...el("APPROVE"),onClick:()=>{(0,y.hK)(t,s)?K(!0):er("APPROVE")},buttonStyle:"secondary","data-cy":"approve-button",icon:(0,a.jsx)(d.J,{size:12}),permission:l.approve,label:(0,a.jsx)($,{children:(0,a.jsx)(m.sA,{id:"actions.approve",defaultMessage:"Approve"})})}),(l.canPay||l.canMarkAsPaid)&&(0,a.jsx)(D.A,{...el("PAY"),onSubmit:er,expense:e,collective:t,host:s,error:ee,enableKeyboardShortcuts:W,canPayWithAutomaticPayment:l.canPay}),l.canReject&&!O&&(0,a.jsxs)(T.$n,{...el("REJECT"),onClick:()=>G("REJECT"),variant:"outlineDestructive","data-cy":"reject-button",children:[(0,a.jsx)(c.F,{size:14}),(0,a.jsx)($,{children:(0,a.jsx)(m.sA,{id:"actions.reject",defaultMessage:"Reject"})})]}),l.canMarkAsSpam&&!R&&(0,a.jsxs)(T.$n,{...el("MARK_AS_SPAM"),variant:"outlineDestructive","data-cy":"spam-button",onClick:()=>{e.createdByAccount.legacyId===ea?.CollectiveId?es({variant:"error",message:et.formatMessage({id:"expense.spam.notAllowed",defaultMessage:"You can't mark your own expenses as spam"})}):confirm(et.formatMessage(H.markAsSpamWarning))&&er("MARK_AS_SPAM")},children:[(0,a.jsx)(c.F,{size:14}),(0,a.jsx)($,{children:(0,a.jsx)(m.sA,{id:"actions.spam",defaultMessage:"Mark as Spam"})})]}),l.canUnapprove&&!O&&(0,a.jsxs)(T.$n,{...el("UNAPPROVE"),onClick:()=>G("UNAPPROVE"),variant:"outlineDestructive","data-cy":"unapprove-button",children:[(0,a.jsx)(o.M,{size:12}),(0,a.jsx)($,{children:(0,a.jsx)(m.sA,{id:"expense.unapprove.btn",defaultMessage:"Unapprove"})})]}),l.canUnapprove&&O&&(0,a.jsxs)(T.$n,{...el("UNAPPROVE"),onClick:()=>G("REQUEST_RE_APPROVAL"),variant:"outlineDestructive","data-cy":"request-re-approval-button",className:"text-nowrap",children:[(0,a.jsx)(o.M,{size:12}),(0,a.jsx)($,{children:(0,a.jsx)(m.sA,{id:"expense.requestReApproval.btn",defaultMessage:"Request re-approval"})})]}),l.canUnschedulePayment&&(0,a.jsxs)(T.$n,{...el("UNSCHEDULE_PAYMENT"),onClick:()=>er("UNSCHEDULE_PAYMENT"),variant:"outlineDestructive","data-cy":"unapprove-button",children:[(0,a.jsx)(o.M,{size:12}),(0,a.jsx)($,{children:(0,a.jsx)(m.sA,{id:"expense.unschedulePayment.btn",defaultMessage:"Unschedule Payment"})})]}),l.canMarkAsUnpaid&&(0,a.jsx)(_,{"data-cy":"mark-as-unpaid-button",expense:e,...el("MARK_AS_UNPAID")}
466),l.canDelete&&!R&&(0,a.jsx)(k,{buttonProps:el(),expense:e,onModalToggle:E,onDelete:P}),F&&e?.securityChecks?.length>0&&(0,a.jsx)(U.MO,{...x,minWidth:0,expense:e,enableKeyboardShortcuts:W}),q&&(0,a.jsx)(S.A,{type:q,open:!!q,setOpen:e=>{e||(G(null),E?.(!1))},expense:e,onSuccess:e=>h?.(e)}),Y&&(0,a.jsx)(N.A,{expense:e,host:s,account:t,onConfirm:()=>er("APPROVE"),onClose:()=>{K(!1),E?.(!1)}})]})}},25510:(e,t,s)=>{s.d(t,{A:()=>eA});var a=s(37876),n=s(14232),i=s(44953),r=s(80181),l=s(64487),o=s(50840),d=s(40125),c=s(62449),u=s(5646),m=s(23968),x=s(96974),p=s(37829),h=s(33123),g=s(60257),f=s(87409),A=s(82344),y=s(87058),j=s(88808),v=s(58649),b=s(65971),C=s(20322),M=s(49294);let E=(0,c.YK)({[h.oPO.PENDING]:{defaultMessage:"KYC Pending",id:"YC8RDd"},[h.oPO.VERIFIED]:{defaultMessage:"KYC Verified",id:"eEXNr4"}}),T=(0,b.F)("rounded-sm px-2 py-0.75 text-[11px] font-bold tracking-wide uppercase",{variants:{status:{[h.oPO.PENDING]:"bg-yellow-100 text-yellow-800",[h.oPO.VERIFIED]:"bg-green-100 text-green-800",[h.oPO.NOT_REQUESTED]:"bg-gray-100 text-gray-800"}}});function w(e){return e.status===h.oPO.NOT_REQUESTED?null:(0,a.jsx)(M.E,{type:"info",className:(0,C.cn)(T({status:e.status}),e.className),children:(0,a.jsx)(c.sA,{...E[e.status]})})}var I=s(15192),N=s(16147),S=s(81317),P=s(30619),R=s(43575),F=s(34679),k=s(56336),O=s(98477),_=s(57288),D=s(93286),U=s(17771),L=s(77243),$=s(87881),z=s(61288),H=s(99202),B=s(68901),V=s(74143),W=s(20422),q=s(4436),G=s(24991);let Y=(0,u.I4)(V.A).withConfig({componentId:"sc-1271993e-0"})(["cursor:pointer;font-weight:bold;font-size:12px;line-height:16px;letter-spacing:0.06em;text-transform:uppercase;"]),K=(0,u.I4)("div").withConfig({componentId:"sc-1271993e-1"})(["z-index:2;border-radius:5px;font-size:12px;text-transform:initial;white-space:normal;
466min-width:200px;background:#ffffff;box-shadow:0px 4px 8px rgba(20,20,20,0.16);svg{display:none;}svg[data-spinner='true']{display:block;margin:auto;}"]),J=(0,u.I4)("div").withConfig({componentId:"sc-1271993e-2"})(["position:absolute;font-size:8px;width:3em;height:3em;top:0;left:0;margin-top:-0.9em;&::before{content:'';margin:auto;display:block;border-style:solid;border-width:0 1.5em 1em 1.5em;border-color:transparent transparent #ffffff transparent;filter:drop-shadow(0px -3px 3px rgba(20,20,20,0.1));}"]),Z=(0,u.I4)(k.y).withConfig({componentId:"sc-1271993e-3"})(["width:15px;height:15px;cursor:pointer;color:inherit;"]),X=({expense:e,host:t,collective:s,...i})=>{let r=(0,c.tz)(),l=n.useRef(void 0),[o,d]=n.useState(!1),[u,m]=n.useState(!0),[x,p]=n.useState(!1),g=e?.status===h.Drj.APPROVED,f={px:2,py:2,isBorderless:!0,width:"100%",textAlign:"left"},A=e.onHold?"ON_HOLD":e.status,y=()=>{d(!0)};return(0,L.A)(l,e=>{e&&u&&o&&!document.getElementById("mark-expense-as-unpaid-modal")&&d(!1)}),(0,$.Ay)({callback:()=>{u&&d(!1)},keyMatch:$.aH}),(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)(_.mS,{children:[(0,a.jsx)(D.O,{children:({ref:e})=>(0,a.jsx)(H.az,{ref:e,onClick:y,children:(0,a.jsx)(Y,{type:(0,q.e)(A),"data-cy":"admin-expense-status-msg",...i,children:(0,a.jsxs)(H.so,{children:[(0,z.F8)(r,A),(0,a.jsx)(Z,{})]})})})}),o&&O.createPortal((0,a.jsx)(U.N,{placement:"bottom",children:({ref:n,style:i,arrowProps:r})=>(0,a.jsxs)(K,{ref:n,style:i,onMouseEnter:y,children:[(0,a.jsxs)(H.so,{alignItems:"center",ref:l,flexDirection:"column",p:2,children:[!g&&(0,a.jsx)(G.Ay,{host:t,buttonProps:f,collective:s,expense:e,permissions:e.permissions,onModalToggle:e=>m(!e),onSuccess:()=>d(!1),displaySecurityChecks:!1}
466),e?.permissions?.canMarkAsIncomplete&&(0,a.jsx)(B.A,{...f,onClick:()=>{p("MARK_AS_INCOMPLETE")},children:(0,a.jsx)(G.Lj,{children:(0,a.jsx)(c.sA,{id:"actions.markAsIncomplete",defaultMessage:"Mark as Incomplete"})})}),e.permissions?.canHold&&(0,a.jsx)(B.A,{...f,onClick:()=>{p("HOLD")},children:(0,a.jsx)(G.Lj,{children:(0,a.jsx)(c.sA,{id:"actions.hold",defaultMessage:"Put On Hold"})})}),e.permissions?.canRelease&&(0,a.jsx)(B.A,{...f,onClick:()=>{p("RELEASE")},children:(0,a.jsx)(G.Lj,{children:(0,a.jsx)(c.sA,{id:"actions.release",defaultMessage:"Release Hold"})})})]}),(0,a.jsx)(J,{ref:r.ref,style:r.style})]})}),document.body)]}),x&&(0,a.jsx)(W.A,{type:x,open:!!x,setOpen:e=>{e||p(null)},expense:e})]})};var Q=s(74820),ee=s(11074),et=s(83244),es=s(65202),ea=s(2996),en=s(617),ei=s(69756),er=s(38268),el=s(41955),eo=s(62715),ed=s(5885),ec=s(58581),eu=s(72945),em=s(89797),ex=s(90628),ep=s(49030);let eh=u.Ay.div.withConfig({componentId:"sc-269e8ece-0"})(["font-style:normal;font-weight:bold;font-size:9px;line-height:14px;letter-spacing:0.6px;text-transform:uppercase;color:#c4c7cc;"]),eg=u.Ay.div.attrs({"data-cy":"expense-actions"}).withConfig({componentId:"sc-269e8ece-1"})(["display:flex;flex-wrap:wrap;margin-top:8px;grid-gap:8px;transition:opacity 0.05s;justify-content:flex-end;@media (max-width:40em){justify-content:center;}& > *:last-child{margin-right:0;}"]),ef=u.Ay.div.withConfig({componentId:"sc-269e8ece-2"})(["outline:none;display:block;width:100%;border:0;background:white;"," transition:background 0.1s;"," ",""],m.xe,e=>e.useDrawer&&(0,u.AH)(["",""],e=>e.selected&&"background: #E5F3FF;"),e=>!e.selected&&(0,u.AH)(["@media (hover:hover){&:not(:hover):not(:focus-within) ","{opacity:0.24;}}"],eg)),eA=({isLoading:e=!1,host:t,isInverted:s=!1,showAmountSign:u=!1,expense:m,showProcessActions:b=!1,view:C="public",onProcess:M,selected:E,expandExpense:T,useDrawer:k=!1})=>{let O=(0,c.tz)(),{LoggedInUser:_}=(0,g.A)(),[D,U]=n.useState(null),L=s?m?.account:m?.payee,$=m?.account&&(0,y.bl)(m.account),z="admin"===C,V="submitter"===C,W=m?.type===x.A.CHARGE&&m?.items?.every(e=>null===e.url),Y=m?.invoiceFile,K=n.useMemo(()=>(0,p.K7)(m,O).filter(e=>!Y||e.url!==Y.url),[m,O,Y]),J=n.useMemo(()=>(0,p.K7)(m,O),[m,O]),Z=z?K.length:0,eg=[h.Drj.REJECTED,h.Drj.PAID].includes(m?.status),eA=(eg||m?.status===h.Drj.APPROVED)&&((0,G.nh)(m.permissions)||m.permissions.canMarkAsIncomplete),ey=m?.amountInAccountCurrency&&m.amountInAccountCurrency?.currency!==m.currency,ej=_?.isAdminOfCollective(t),ev=_?.isAdminOfCollective(m?.account),eb=ej&&!ev,eC=_?.hasPreviewFeatureEnabled(f.bu.KEYBOARD_SHORTCUTS),eM=m?.lastComment?.nodes?.[0],eE=m?.approvedBy?.length>0?m.approvedBy:null;return(0,a.jsxs)(ef,{px:[3,"24px"],py:3,"data-cy":`expense-container-${m?.legacyId}`,selected:E,useDrawer:k,children:[(0,a.jsxs)("div",{className:"mb-5 flex flex-wrap items-start justify-end gap-3",children:[(0,a.jsxs)("div",{className:"flex grow gap-3",children:[(0,a.jsx)(H.az,{children:e?(0,a.jsx)(el.A,{width:40,height:40}):(0,a.jsx)(I.I,{account:L,includeAdminMembership:{accountSlug:m.account?.slug,hostSlug:t?.slug},trigger:(0,a.jsx)("span",{children:(0,a.jsx)(R.Q,{size:40,account:L,secondaryAccount:L.id===m.createdByAccount.id?null:m.createdByAccount})})})}),e?(0,a.jsx)(el.A,{height:60}):(0,a.jsxs)(H.az,{children:[(0,a.jsxs)(ep.m_,{children:[(0,a.jsx)(ep.ZI,{children:k?(0,a.jsx)(c.sA,{id:"Expense.SeeDetails",defaultMessage:"See expense details"}):(0,a.jsx)(c.sA,{id:"Expense.GoToPage",defaultMessage:"Go to expense page"})}),(0,a.jsx)(ep.k$,{asChild:!0,children:(0,a.jsx)("span",{children:(0,a.jsx)(ed.A,{$underlineOnHover:!0,...k?{as:"button",type:"button",onClick:T}:$?{as:ei.A,href:`${$}/expenses/${m.legacyId}`}:{},children:(0,a.jsx)(S.A,{value:m.description,maxLength:255,minFontSizeInPx:12,maxFontSizeInPx:16,lengthThreshold:72,mobileRatio:.875,valueFormatter:A.cl,children:({value:e,fontSize:t})=>(0,a.jsx)(eu.H3,{fontWeight:"500",lineHeight:"1.5em",textDecoration:"none",color:"black.900",fontSize:t,overflowWrap:"anywhere","data-cy":"expense-title",children:e})})})})})]}),(0,j.nK)(_,m,m.account,t)&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-sm font-normal text-neutral-700",children:(0,a.jsx)(c.sA,{id:"expense.accountingCategory",defaultMessage:"Category"})}),(0,a.jsx)(Q.v,{expense:m,host:t,account:m.account,canEdit:(0,v.G7)(t,"CHART_OF_ACCOUNTS")&&(0,l.A)(m,"permissions.canEditAccountingCategory",!1),editPermission:(0,l.A)(m,"permissions.editAccountingCategory"),allowNone:!0,showCodeInSelect:ej})]}),(0,a.jsxs)("div",{className:"mt-1 text-xs text-slate-700",children:[z?(0,a.jsx)(I.I,{account:m.account,trigger:(0,a.jsx)("span",{children:(0,a.jsx)(er.A,{noTitle:!0,className:"text-primary hover:underline",collective:m.account})})}):(0,a.jsx)(c.sA,{defaultMessage:"from {payee} to {account}",id:"B5z1AU",values:{payee:(0,a.jsx)(I.I,{account:m.payee,includeAdminMembership:{accountSlug:m.account?.slug,hostSlug:t?.slug},trigger:(0,a.jsx)("span",{children:(0,a.jsx)(er.A,{noTitle:!0,className:"text-primary hover:underline",collective:m.payee})})}),account:(0,a.jsx)(I.I,{account:m.account,trigger:(0,a.jsx)("span",{children:(0,a.jsx)(er.A,{noTitle:!0,className:"text-primary hover:underline",collective:m.account})})})}})," ⢠",(0,a.jsx)(F.A,{value:m.createdAt}),z&&(0,a.jsxs)(n.Fragment,{children:[" ⢠",(0,a.jsx)(c.sA,{id:"BalanceAmount",defaultMessage:"Balance {balance}",values:{balance:(0,a.jsx)(ea.A,{amount:(0,l.A)(m.account,"stats.balanceWithBlockedFunds.valueInCents",(0,l.A)(m.account,"stats.balanceWithBlockedFunds",0)),currency:m.account.currency})}}),!!m.comments?.totalCount&&(0,a.jsxs)(n.Fragment,{children:[" ⢠",m.comments?.totalCount,"\xa0",(0,a.jsx)(en.A,{size:14,color:"#4D4F51"})]})]})]})]})]}),(0,a.jsxs)("div",{className:"flex w-full flex-col items-end justify-between sm:w-fit",children:[(0,a.jsx)(H.so,{flexDirection:"column",minWidth:100,alignItems:"flex-end","data-cy":"transaction-amount",children:e?(0,a.jsx)(el.A,{height:19,width:120}):(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("div",{children:[u&&(0,a.jsx)(em.A,{isCredit:s}),(0,a.jsx)(ea.A,{amountClassName:"font-bold",amount:m.amount,currency:m.currency,precision:2})]}),ey&&(0,a.jsx)("div",{className:"my-1 text-sm text-muted-foreground",children:(0,a.jsx)(N.A,{amount:m.amountInAccountCurrency})})]})}),e?(0,a.jsx)(el.A,{height:20,width:140}):(0,a.jsxs)(H.so,{children:[(z||V)&&W&&(0,a.jsx)(H.az,{mr:"1px",children:(0,a.jsxs)(ep.m_,{children:[(0,a.jsx)(ep.ZI,{children:(0,a.jsx)(c.sA,{id:"Expense.MissingReceipt",defaultMessage:"Expense is missing its Receipt"})}),(0,a.jsx)(ep.k$,{children:(0,a.jsx)(i.h,{size:18})})]})}),(z||V)&&(0,a.jsx)(ee.A,{type:m.type,legacyId:m.legacyId,mb:0,py:0,mr:"2px",fontSize:"9px"}),eA?(0,a.jsx)(X,{host:t,collective:m.account,expense:m,p:"3px 8px"}):(0,a.jsx)(q.A,{status:m.status,fontSize:"12px",fontWeight:"bold",letterSpacing:"0.06em",lineHeight:"16px",p:"3px 8px",showTaxFormTag:(0,o.A)(m.requiredLegalDocuments,"US_TAX_FORM"),payee:m.payee}),ej&&m.kycStatus?.payee?.status&&(0,a.jsx)(w,{className:"ml-1",status:m.kycStatus?.payee?.status})]})]})]}),(0,a.jsxs)("div",{className:"mt-2 flex flex-wrap items-end justify-end gap-4",children:[(0,a.jsx)("div",{className:"w-full sm:flex sm:w-fit sm:grow",children:z||V?(0,a.jsxs)("div",{className:"mx-4 grid grid-cols-2 gap-x-6 gap-y-1 sm:mx-0 sm:grid-flow-col sm:gap-y-0",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(eh,{children:(0,a.jsx)(c.sA,{id:"expense.payoutMethod",defaultMessage:"payout method"})}),(0,a.jsx)("div",{className:"flex h-6 items-center",children:(0,a.jsx)(et.A,{isLoading:e,type:m.payoutMethod?.type,iconSize:"10px",fontSize:"11px",fontWeight:"normal",color:"black.700"})})]}),!!m.reference&&(0,a.jsxs)("div",{children:[(0,a.jsx)(eh,{children:(0,a.jsx)(c.sA,{id:"Expense.Reference",defaultMessage:"Reference"})}),e?(0,a.jsx)(el.A,{height:15,width:90}):(0,a.jsx)("div",{className:"text-[11px] leading-6",children:(0,a.jsx)(ex.A,{value:m.reference,length:10,truncatePosition:"middle"})})]}),m.invoiceFile&&(0,a.jsxs)("div",{children:[(0,a.jsx)(eh,{children:(0,a.jsx)(c.sA,{defaultMessage:"Invoice",id:"E
466xpense.Type.Invoice"})}),e?(0,a.jsx)(el.A,{height:15,width:90}):(0,a.jsxs)(B.A,{color:"black.700",fontSize:"11px",cursor:"pointer",buttonSize:"tiny",onClick:k?e=>T(e,m.invoiceFile.url):()=>U([m.invoiceFile]),px:2,ml:-2,isBorderless:!0,textAlign:"left",children:[(0,a.jsx)(r.h,{size:10}),"\xa0\xa0",(0,a.jsx)(c.sA,{id:"ExpenseInvoice.count",defaultMessage:"{count, plural, one {# invoice} other {# invoices}}",values:{count:1}})]})]}),Z>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(eh,{children:(0,a.jsx)(c.sA,{id:"Expense.Attachments",defaultMessage:"Attachments"})}),e?(0,a.jsx)(el.A,{height:15,width:90}):(0,a.jsxs)(B.A,{color:"black.700",fontSize:"11px",cursor:"pointer",buttonSize:"tiny",onClick:k?e=>T(e,K[0].url):()=>U(K),px:2,ml:-2,isBorderless:!0,textAlign:"left",children:[(0,a.jsx)(r.h,{size:10}),"\xa0\xa0",(0,a.jsx)(c.sA,{id:"ExepenseAttachments.count",defaultMessage:"{count, plural, one {# attachment} other {# attachments}}",values:{count:Z}})]})]}),eM&&(0,a.jsxs)("div",{children:[(0,a.jsx)(eh,{children:(0,a.jsx)(c.sA,{defaultMessage:"Last Comment",id:"gSNApa"})}),(0,a.jsx)("div",{className:"text-[11px]",children:(0,a.jsxs)(er.A,{collective:eM.fromAccount,className:"flex items-center gap-2 font-medium text-slate-700 hover:text-slate-700 hover:underline",withHoverCard:!0,hoverCardProps:{includeAdminMembership:{accountSlug:eM.fromAccount.slug}},children:[(0,a.jsx)(P.Ay,{collective:eM.fromAccount,radius:24})," ",(0,d.A)(eM.fromAccount.name,{length:40})]})})]}),eE&&m.status===h.Drj.APPROVED&&!m.onHold&&(0,a.jsxs)("div",{children:[(0,a.jsx)(eh,{children:(0,a.jsx)(c.sA,{defaultMessage:"Approved By",id:"JavAWD"})}),(0,a.jsx)("div",{className:"text-[11px]",children:(0,a.jsx)(eo.A,{accounts:eE,imageSize:24,withHoverCard:{includeAdminMembership:!0}})})]})]}):(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)(ec.A,{expense:m,canEdit:(0,l.A)(m,"permissions.canEditTags",!1)})})}),b&&m?.permissions&&!eg&&(0,a.jsx)("div",{"data-cy":"expense-actions",className:"flex w-full flex-col items-stretch gap-2 self-end sm:float-right sm:w-auto sm:flex-row sm:items-end sm:justify-end",children:(0,a.jsx)(G.Ay,{host:t,isViewingExpenseInHostContext:eb,collective:m.account,expense:m,permissions:m.permissions,buttonProps:{...G.jJ,mx:1,py:2},onSuccess:M,enableKeyboardShortcuts:E&&eC})})]}),D&&(0,a.jsx)(es.A,{files:J,parentTitle:O.formatMessage({defaultMessage:"Expense #{expenseId} attachment",id:"At2m8o"},{expenseId:m.legacyId}),onClose:()=>U(null)})]})}},26215:(e,t,s)=>{s.d(t,{A:()=>r});var a=s(62449),n=s(16240);let i=(0,a.YK)({ALL:{id:"PayoutMethod.Type.All",defaultMessage:"All methods"},[n.UC.OTHER]:{id:"PayoutMethod.Type.Other",defaultMessage:"Other"},[n.UC.BANK_ACCOUNT]:{id:"PayoutMethod.Type.BankAccount",defaultMessage:"Bank transfer"},[n.UC.CREDIT_CARD]:{id:"PayoutMethod.Type.VirtualCard",defaultMessage:"Virtual Card"}}),r=(e,t,{aliasBankAccountToTransferWise:s}={})=>{if(!t)return e.formatMessage(i[n.UC.OTHER]);if(t===n.UC.PAYPAL)return"PayPal";if(t===n.UC.BANK_ACCOUNT&&s)return"Wise";if(t===n.UC.ACCOUNT_BALANCE)return`Open Collective - ${e.formatMessage({defaultMessage:"Account Balance",id:"0lwkdV"})}`;if(t===n.UC.STRIPE)return"Stripe";let a=i[t];return a?e.formatMessage(a):t}},26843:(e,t,s)=>{s.d(t,{AB:()=>o,Q:()=>c,cY:()=>l,iv:()=>n,nd:()=>r,wD:()=>i,zM:()=>d});var a=s(89718);function n(e){let t=e.transform(e=>[e]),s=a.YO(e);return a.KC([t,s])}function i(e){return a.KC([a.Yj().refine(e=>"null"===e||""===e).transform(()=>null).pipe(a.ch()),a.me(e)]).default(null)}let r=a.au.number().min(0).int(),l=r.default(0),o=r.default(20),d=a.KC([a.Yj().transform(e=>JSON.parse(e)).pipe(a.zM()),a.zM()]),c=a.Yj().regex(/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/)},33883:(e,t,s)=>{s.d(t,{x:()=>l});var a=s(37876);s(14232);var n=s(97552),i=s(34765),r=s(49294);let l=({children:e,hasMatch:t})=>void 0===t?(0,a.jsx)(r.E,{size:"xs",children:e}):(0,a.jsxs)(r.E,{size:"xs",type:t?"success":"error",children:[(0,a.jsx)("span",{className:"text-slate-700",children:e})," ",t?(0,a.jsx)(n.A,{size:16,className:"ml-1 inline"}):(0,a.jsx)(i.A,{size:16,className:"ml-1 inline"})]})},34350:(e,t,s)=>{s.d(t,{D:()=>j,o:()=>y});var a=s(37876),n=s(14232),i=s(49473),r=s(2587),l=s(54703),o=s(62449),d=s(23188),c=s(21057),u=s(17471),m=s(2038),x=s(38605),p=s(2948),h=s(82564),g=s(87058);let f=(0,o.YK)({hostFee:{id:"expense.hostFeeInCollectiveCurrency",defaultMessage:"host fee"},paymentProcessorFee:{id:"expense.paymentProcessorFeeInCollectiveCurrency",defaultMessage:"payment processor fee"},openCollectiveFee:{id:"transactions.openCollectiveFee",defaultMessage:"Open Collective fee"}}),A=(e,t,s,a,n)=>{if(!e?.valueInCents)return"";let i=e.valueInCents<0?` - ${(0,m.vv)(Math.abs(e.valueInCents),e.currency,{locale:n})}`:` + ${(0,m.vv)(Math.abs(e.valueInCents),e.currency,{locale:n})}`;if(a&&e.currency===t?.currency){let n=Math.abs((0,r.A)(e.valueInCents/t.valueInCents*100,2));if(!0===a||a===n)return`${i} (${n}% ${s})`}return`${i} (${s})`},y=({amount:e,platformFee:t,hostFee:s,paymentProcessorFee:i,netAmount:u,taxAmount:x,taxInfo:p,isCredit:h,hasOrder:g,toAccount:y,fromAccount:j,intl:v,kind:b,expense:C,isRefund:M,paymentProcessorCover:E,relatedTransactions:T})=>{let w=!h&&u?u:e,I=(0,m.vv)(Math.abs(w.valueInCents),w.currency,{locale:v.locale}),N=(0,l.A)(T,{type:"DEBIT",kind:"PAYMENT_PROCESSOR_FEE"})?.netAmount,S=(0,l.A)(T,{type:"CREDIT",kind:"EXPENSE"})?.netAmountInPayeeCurrency,P=N||i,R=A(t,w,v.formatMessage(f.openCollectiveFee),h&&!g?j.platformFeePercent:y.platformFeePercent,v.locale),F=A(s,w,v.formatMessage(f.hostFee),h&&!g?j.hostFeePercent:y.hostFeePercent,v.locale),k=A(P,
466w,v.formatMessage(f.paymentProcessorFee),!1,v.locale);if(b===d.L.EXPENSE){let e=(0,m.vv)(Math.abs(P.valueInCents),P.currency,{locale:v.locale}),t=C?.feesPayer||"COLLECTIVE",s=N?Math.abs(u.valueInCents)+("PAYEE"===t?0:Math.abs(P.valueInCents)):Math.abs(u.valueInCents),i=S?.valueInCents??(N?Math.abs(u.valueInCents)+("PAYEE"!==t?0:-Math.abs(P.valueInCents)):Math.abs(u.valueInCents)),l=(0,m.vv)(s,u.currency,{locale:v.locale}),d=(0,m.vv)(i,S?.currency||u.currency,{locale:v.locale}),h=void 0!==E,g=h?(0,m.vv)(Math.abs(E.netAmount.valueInCents),E.netAmount.currency,{locale:v.locale}):null,f=y.name,A=j.name;return(0,a.jsxs)(n.Fragment,{children:[C&&(0,a.jsx)("p",{children:(0,a.jsx)(o.sA,{defaultMessage:"Amount Paid for Expense: {amountString}",id:"gqiJnQ",values:{amountString:I}})}),(0,a.jsx)("p",{children:0===P.valueInCents||M?(0,a.jsx)(o.sA,{defaultMessage:"{isRefund, select, true {Refunded} other {}} Payment Processor Fee{hasPaymentProcessorCover, select, true { (covered by the Host)} false {} other {}}: {paymentProcessorFee}",id:"vwq8lO",values:{isRefund:M,paymentProcessorFee:h?g:e,hasPaymentProcessorCover:h}}):(0,a.jsx)(o.sA,{defaultMessage:"Payment Processor Fee (paid by {collective}): {expensePaymentProcessorFee}",id:"Yp8Cek",values:{collective:"PAYEE"===t?f:A,expensePaymentProcessorFee:e}})}),x&&p&&(0,a.jsx)(o.sA,{defaultMessage:"Includes {rate}% {taxName} ({amount})",id:"/66Po2",values:{rate:(0,r.A)(100*p.rate,2),taxName:(0,c.k)(v,p.type,"short"),amount:(0,m.vv)(x.valueInCents,x.currency,{locale:v.locale})}}),(0,a.jsx)("p",{children:(0,a.jsx)(o.sA,{defaultMessage:"Net Amount for {collectiveName}: {netExpenseAmount}",id:"6ZJG0I",values:{collectiveName:A,netExpenseAmount:l}})}),j.slug!==y.slug&&(0,a.jsx)("p",{children:(0,a.jsx)(o.sA,{defaultMessage:"Net Amount for {collectiveName}: {netExpenseAmount}",id:"6ZJG0I",values:{collectiveName:f,netExpenseAmount:d}})})]})}{let e=[I,F,R,k];return x&&e.push(A(x,w,p?.id||"Taxes",p?.percentage,v.locale)),e.concat(" ")}},j=async({fromCollectiveSlug:e,toCollectiveSlug:t,transactionUuid:s,expenseId:a,dateFrom:n,dateTo:r,createdAt:l})=>{let o,d=(({fromCollectiveSlug:e,toCollectiveSlug:t,transactionUuid:s,expenseId:a,dateFrom:n,dateTo:i})=>a?(0,g.js)(a):s?(0,g.hR)(s):(0,g.te)(e,t,encodeURI(n),encodeURI(i),"pdf"))({fromCollectiveSlug:e,toCollectiveSlug:t,transactionUuid:s,expenseId:a,dateFrom:n,dateTo:r,createdAt:l}),c={format:"blob",allowExternal:g.BR},m=(0,h.zM)(h.rS.ACCESS_TOKEN);m&&(c.headers={Authorization:`Bearer ${m}`});try{o=await (0,u.Jt)(d,c)}catch{throw(0,p.$5)(p.ff.NETWORK)}if(o?.type!=="application/pdf")throw(0,p.$5)(p.ff.UNKNOWN);let f=(({fromCollectiveSlug:e,transactionUuid:t,toCollectiveSlug:s,dateFrom:a,dateTo:n,createdAt:i})=>{if(t){let e=(0,x.EB)(i?new Date(i):new Date);return`${s||"transaction"}_${e}_${t}.pdf`}{let t=(0,x.EB)(a?new Date(a):new Date),i=(0,x.EB)(n?new Date(n):new Date);return`${e}_${s}_${t}_${i}.pdf`}})({fromCollectiveSlug:e,toCollectiveSlug:t,transactionUuid:s,dateFrom:n,dateTo:r,createdAt:l});return(0,i.saveAs)(o,f)}},34679:(e,t,s)=>{s.d(t,{A:()=>c,g:()=>d});var a=s(37876),n=s(14232),i=s(62449),r=s(38605),l=s(20322);let o=(0,i.zR)({defaultMessage:"Local time: {localTime}{newLine}UTC time: {utcTime}",id:"9kdoVP"}),d=(e,t)=>e.formatMessage(o,{localTime:(0,l.ZH)(e.formatDate(t,{dateStyle:"full",timeStyle:"long"})),utcTime:(0,l.ZH)(e.formatDate(t,{dateStyle:"full",timeStyle:"long",timeZone:"UTC"})),newLine:"\n"}),c=({value:e,dateStyle:t,timeStyle:s,omitTimeIfMidnight:l,...o})=>{let c=(0,i.tz)(),[u,m]=n.useState(),x=n.useMemo(()=>(0,r.gH)(e),[e]);return l&&s&&(s=0===x.getUTCHours()&&0===x.getUTCMinutes()?void 0:s),(0,a.jsx)("time",{...o,title:u,dateTime:x.toISOString(),onMouseEnter:()=>m(d(c,x)),suppressHydrationWarning:!0,children:(0,a.jsx)(i.XU,{dateStyle:t||"long",timeStyle:s,value:x})})}},37293:(e,t,s)=>{s.d(t,{Fc:()=>o,TN:()=>c,XL:()=>d});var a=s(37876),n=s(14232),i=s(65971),r=s(20322);let l=(0,i.F)("relative w-full rounded-lg border p-4 [&>svg]:absolute [&>svg]:top-4 [&>svg]:left-4 [&>svg]:text-foreground [&>svg+div]:translate-y-[-3px] [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",info:"border-blue-200 bg-blue-50"}},defaultVariants:{variant:"default"}}),o=n.forwardRef(({className:e,variant:t,...s},n)=>(0,a.jsx)("div",{ref:n,role:"alert",className:(0,r.cn)(l({variant:t}),e),...s}));o.displayName="Alert";let d=n.forwardRef(({className:e,children:t,...s},n)=>(0,a.jsx)("h5",{ref:n,className:(0,r.cn)("mb-1 leading-none font-medium tracking-tight",e),...s,children:t}));d.displayName="AlertTitle";let c=n.forwardRef(({className:e,...t},s)=>(0,a.jsx)("div",{ref:s,className:(0,r.cn)("text-sm [&_p]:leading-relaxed",e),...t}));c.displayName="AlertDescription"},37829:(e,t,s)=>{s.d(t,{Hn:()=>m,K7:()=>u,OX:()=>x,Qq:()=>c,jO:()=>d});var a=s(64487),n=s(94772),i=s(38333),r=s(30988),l=s(33123);let{ORGANIZATION:o}=r.Td,d=(0,i.A)(e=>{if(!e)return[];{let t=[e];for(let s of(0,a.A)(e,"adminMemberships.nodes",[]))if([o].includes(s.account.type)||s.account.isActive)for(let e of(t.push((0,n.A)(s.account,["childrenAccounts"])),s.account.childrenAccounts.nodes))e.isActive&&t.push({host:s.account.host,...e});return t}}),c={GRANT:!1,INVOICE:!0,RECEIPT:!0},u=(e,t)=>
466{if(!e)return[];let s=[...e.items?.filter(({url:e})=>!!e)||[],...e.attachedFiles||[]];return e.invoiceFile&&s.unshift({id:e.invoiceFile.id,name:e.invoiceFile.name,url:e.invoiceFile.url,info:{...e.invoiceFile}}),e.status===l.Drj.DRAFT&&(s=[...s=[...s,...(e.draft?.items??[]).filter(({url:e})=>!!e)],...(e.draft?.attachedFiles??[]).filter(({url:e})=>!!e)],e.draft?.invoiceFile?.url&&s.unshift({id:e.draft.invoiceFile.id,name:e.draft.invoiceFile.name,url:e.draft.invoiceFile.url,info:{...e.draft.invoiceFile}})),s=(s=s.map(e=>({...e,info:e.info||e.file}))).map((e,a)=>({...e,name:e.description||e.name||e.info?.name||m(t,a,s.length)}))},m=(e,t,s)=>1===s?e.formatMessage({id:"File.AttachedFile",defaultMessage:"Attached file"}):e.formatMessage({defaultMessage:"Attached file {number}",id:"A+AIST"},{number:t+1}),x=e=>e?"string"==typeof e?e.match(/^\d{4}-\d{2}-\d{2}$/)?`${e}T00:00:00Z`:e:e instanceof Date?e.toISOString():void 0:null},40613:(e,t,s)=>{s.d(t,{A:()=>g,f:()=>f});var a=s(37876),n=s(14232),i=s(12815),r=s(47509),l=s(72976),o=s(79847),d=s(7474),c=s(62449),u=s(90020),m=s(20322),x=s(47144);function p({isSelected:e,isMulti:t,value:s,label:n,onSelect:r,valueRenderer:l,keywords:d}){let u=(0,c.tz)();return!n&&l&&(n=l({intl:u,value:s,meta:{inOptionsList:!0}})),"string"!=typeof n||d||(d=[n]),(0,a.jsxs)(x.h_,{onSelect:()=>r(s),className:"h-8 py-0",value:s,keywords:d,"data-cy":"combo-select-option",children:[t?(0,a.jsx)("div",{className:(0,i.$)("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",e?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:(0,a.jsx)(o.A,{className:"h-4 w-4"})}):(0,a.jsx)("div",{className:(0,i.$)("mr-2 flex h-4 w-4 items-center justify-center rounded-full border border-primary",e?"border-primary":"opacity-50"),children:e&&(0,a.jsx)("div",{className:"h-2 w-2 rounded-full bg-primary"})}),(0,a.jsx)("div",{className:"truncate",title:"string"==typeof n?n:void 0,children:n??String(s)})]})}function h({value:e,isMulti:t=!1,options:s=[],groupedOptions:i,onChange:o,labelMsg:m,loading:g,creatable:f,searchFunc:A,valueRenderer:y,onInputChange:j}){let v=(0,c.tz)(),[b,C]=n.useState(""),M=Array.isArray(e)?e:(0,l.A)(e)?[]:[e];(0,u.A)(A,b,{delay:500,noDelayEmpty:!0});let E=e=>{let s=M.some(t=>t===e);t?o(s?M.filter(t=>t!==e):[...M,e]):o(s?void 0:e)},T=!!(s?.length||i?.length||A),w=f||!!A,I=i||function({input:e,selected:t,options:s,creatable:a,isCreatableOrAsync:n}){let i=[];return a&&e&&i.push({value:e}),n&&(i=i.concat(t.filter(e=>!s.some(t=>t.value===e)).reverse().map(e=>({value:e})))),i=i.concat(s),[{label:void 0,options:(0,r.A)(i,"value")}]}({options:s,input:b,selected:M,creatable:f,isCreatableOrAsync:w});return(0,a.jsxs)(x.uB,{shouldFilter:!w,children:[(0,a.jsx)(x.G7,{autoFocus:!0,loading:g,value:b,onValueChange:e=>{C(e),j?.(e)},"data-cy":"combo-select-input",...!T&&{customIcon:d.A},placeholder:T?m?v.formatMessage({defaultMessage:"Filter by {filterLabel}...",id:"sB/JCB"},{filterLabel:v.formatMessage(m)}):v.formatMessage({id:"search.placeholder",defaultMessage:"Search..."}):v.formatMessage(m)}),(0,a.jsxs)(x.oI,{children:[g&&!s.length?(0,a.jsx)(x.Y,{}):(0,a.jsx)(x.xL,{children:T?(0,a.jsx)(c.sA,{defaultMessage:"No results found.",id:"V5JQj+"}):(0,a.jsx)(c.sA,{defaultMessage:"No selection",id:"Select.Placeholder"})}),I?.filter(e=>e.options.length).map((e,s)=>(0,a.jsx)(x.L$,{heading:e.label,children:e.options.map(e=>{let s=M.some(t=>t===e.value);return(0,a.jsx)(p,{isSelected:s,isMulti:t,value:e.value,label:e.label,keywords:e.keywords,valueRenderer:y,onSelect:E},e.value)})},e.label??s))]})]})}let g=n.memo(h);function f(e,t,s){let n="removeDefault"in e?e.removeDefault():e.unwrap(),i="element"in n,r=i?n.element:n;return{schema:i?e.or(r.transform(e=>[e])):e,filter:{labelMsg:t,Component:({intl:e,...t})=>(0,a.jsx)(h,{isMulti:i,options:r.options.map(t=>{let a=e.formatMessage(s[t]);return{value:t,label:a,keywords:[a]}}).sort(m.Db),...t}),valueRenderer:({value:e,intl:t})=>t.formatMessage(s[e])}}}},41607:(e,t,s)=>{s.d(t,{_:()=>n});let a=(0,s(62449).YK)({ADAPTIVE:{id:"PaymentMethod.PayPal.type.Adaptive",defaultMessage:"Adaptive"},ALL:{id:"PaymentMethods.All",defaultMessage:"All"},BACS_DEBIT:{id:"Stripe.PaymentMethod.Label.bacs_debit",defaultMessage:"Bacs Direct Debit"},BANCONTACT:{id:"Stripe.PaymentMethod.Label.bancontact",defaultMessage:"Bancontact"},BANK_TRANSFER:{id:"Aj4Xx4",defaultMessage:"Bank Transfer"},COLLECTIVE:{id:"Balance",defaultMessage:"Balance"},CREDITCARD:{id:"CreditCard",defaultMessage:"Credit Card"},CRYPTO:{id:"Crypto",defaultMessage:"Crypto"},GIFTCARD:{id:"GiftCard",defaultMessage:"Gift Card"},HOST:{defaultMessage:"Added Funds",id:"AccountingCategory.Kind.ADDED_FUNDS"},LINK:{id:"Stripe.PaymentMethod.Label.link",defaultMessage:"Link"}
466,MANUAL:{id:"Payout.Manual",defaultMessage:"Manual"},PAYMENT:{id:"ContributionFlow.Payment",defaultMessage:"Payment"},PAYOUT:{id:"Payout",defaultMessage:"Payout"},PREPAID:{id:"Prepaid",defaultMessage:"Prepaid Card"},SEPA_DEBIT:{id:"Stripe.PaymentMethod.Label.sepa_debit",defaultMessage:"SEPA Direct Debit"},SUBSCRIPTION:{id:"PaymentMethod.Paypal.type.Subscription",defaultMessage:"Subscription"},US_BANK_ACCOUNT:{id:"ACH Debit",defaultMessage:"ACH Debit"},VIRTUAL_CARD:{id:"PayoutMethod.Type.VirtualCard",defaultMessage:"Virtual Card"},SWISH:{id:"Stripe.PaymentMethod.Label.swish",defaultMessage:"Swish"},[null]:{id:"PaymentMethods.None",defaultMessage:"No payment method"}}),n=(e,t)=>a[t]?e.formatMessage(a[t]):t},43095:(e,t,s)=>{function a(e,t){return n(`id/${e}`,t)}function n(e,t){let s=new URL(`https://dashboard.stripe.com/${e}`);return t&&s.searchParams.set("account",t),s.toString()}s.d(t,{Y:()=>a,u:()=>n})},43575:(e,t,s)=>{s.d(t,{Q:()=>c});var a=s(37876);s(14232);var n=s(5646),i=s(21988),r=s(30619),l=s(38268);let o=n.I4.div.withConfig({componentId:"sc-ad0f07dd-0"})(["position:relative;"]),d=n.I4.div.withConfig({componentId:"sc-ad0f07dd-1"})(["position:absolute;background:white;border-radius:6px;display:flex;justify-content:center;align-items:center;bottom:-8px;right:-8px;width:50%;height:50%;border-radius:",";"],({borderRadius:e})=>e),c=({account:e,secondaryAccount:t,size:s,withHoverCard:n})=>{let c=(0,a.jsx)(l.A,{collective:e,withHoverCard:n,children:(0,a.jsx)(r.Ay,{collective:e,radius:s})});return t?(0,a.jsxs)(o,{children:[c,(0,a.jsx)(d,{borderRadius:(0,i.a5)(t.type),children:(0,a.jsx)(l.A,{collective:t,withHoverCard:n,children:(0,a.jsx)(r.Ay,{collective:t,radius:s/2})})})]}):c}},44482:(e,t,s)=>{s.d(t,{A:()=>D,M:()=>F});var a=s(37876),n=s(14232),i=s(670),r=s(62124),l=s(46525),o=s(64487),d=s(13289),c=s(84350),u=s(88894),m=s(62449),x=s(2038),p=s(2948),h=s(16907),g=s(11046),f=s(26214),A=s(67339),y=s(9706),j=s(33341),v=s(91638),b=s(98263),C=s(99271),M=s(51778),E=s(46436);let T=e=>e.map(e=>({label:e,value:e})),w="opencollective",I=(0,m.YK)({fieldRequired:{id:"FieldRequired",defaultMessage:"{name} is required."}}),N=(0,g.J1)` 467 query PayoutBankInformationRequiredFields($slug: String, $currency: String!, $accountDetails: JSON) { 468 host(slug: $slug) { 469 id 470 transferwise { 471 id 472 requiredFields(currency: $currency, accountDetails: $accountDetails) { 473 type 474 title 475 fields { 476 name 477 group { 478 key 479 name 480 type 481 required 482 example 483 minLength 484 maxLength 485 validationRegexp 486 refreshRequirementsOnChange 487 valuesAllowed { 488 key 489 name 490 } 491 } 492 } 493 } 494 } 495 } 496 } 497`,S=(e,t,s)=>s?s=>s?void 0:e.formatMessage(I.fieldRequired,{name:t.name}):void 0,P=(0,m.YK)({"Recipient type":{id:"PayoutBankInformationForm.Field.RecipientType",defaultMessage:"Recipient type"},"Email (Optional)":{id:"tkkyjR",defaultMessage:"Email (Optional)"},"Full name of the account holder":{id:"PayoutBankInformationForm.Field.AccountHolderName",defaultMessage:"Full name of the account holder"},"Date of birth":{id:"PayoutBankInformationForm.Field.DateOfBirth",defaultMessage:"Date of birth"},"Bank code (BIC/SWIFT)":{id:"PayoutBankInformationForm.Field.BankCode",defaultMessage:"Bank code (BIC/SWIFT)"},Country:{id:"collective.country.label",defaultMessage:"Country"},City:{id:"TE4fIS",defaultMessage:"City"},"Recipient address":{id:"524K2a",defaultMessage:"Recipient address"},"Post code":{id:"8BeclW",defaultMessage:"Post code"}}),R=({input:e,getFieldName:t,disabled:s,loading:i,refetch:l,formik:d,labelClassName:c,hintClassName:u,errorClassName:x,fieldClassName:g})=>{let A=(0,m.tz)(),j=t("accountHolderName"===e.key?e.key:`details.${e.key}`),v=!s&&e.required,b=P[e.name]?A.formatMessage(P[e.name]):e.name,M=n.useMemo(()=>{var t;return"radio"===e.type||"select"===e.type?(t=e.valuesAllowed||[],"country"===j.split(".").pop()?t.map(({key:e,name:t})=>({value:e,label:`${(0,r.getEmojiByCountryCode)(e)} ${t}`})):t.map(({key:e,name:t})=>({value:e,label:t}))):[]},[e.type,e.valuesAllowed]),{setFieldValue:E}=d,T=n.useCallback(t=>{E(j,t),e.refreshRequirementsOnChange&&l&&l()},[j,e.refreshRequirementsOnChange,l,E]),w=S(A,e,v);return"text"===e.type?((e.validationRegexp||e.minLength||e.maxLength)&&(w=t=>!t&&v?(0,h.p6)(A,(0,p.$5)(p.ff.FORM_FIELD_REQUIRED)):e.validationRegexp&&!new RegExp(e.validationRegexp).test(t)&&t?e.validationError||(0,h.p6)(A,(0,p.$5)(p.ff.FORM_FIELD_PATTERN)):t&&e.minLength&&t.length<e.minLength?e.validationError||(0,h.p6)(A,(0,p.$5)(p.ff.FORM_FIELD_MIN_LENGTH)):t&&e.maxLength&&t.length>e.maxLength?e.validationError||(0,h.p6)(A,(0,p.$5)(p.ff.FORM_FIELD_MAX_LENGTH)):void 0),(0,a.jsx)("div",{className:g||"mt-2 flex-1",children:(0,a.jsx)(y.z,{disabled:s,name:j,label:b,placeholder:e.example,hint:e.hint,max:e.maxLength,min:e.minLength,validate:w,labelClassName:c,hintClassName:u,errorClassName:x})},e.key)):"date"===e.type?(0,a.jsx)("div",{className:g||"mt-2 flex-1",children:(0,a.jsx)(y.z,{label:b,name:j,hint:e.hint,required:v,disabled:s,validate:w,labelClassName:c,hintClassName:u,errorClassName:x,children:({field:e})=>(0,a.jsx)(C.pd,{type:"date",...e,value:(0,o.A)(d.values,e.name)||""})})},e.key):"radio"===e.type||"select"===e.type?(0,a.jsx)("div",{className:g||"mt-2 flex-1",children:(0,a.jsx)(y.z,{disabled:s,name:j,label:b,hint:e.hint,required:v,validate:w,labelClassName:c,hintClassName:u,errorClassName:x,children:({field:e})=>(0,a.jsx)(f.B,{...e,inputId:e.name,disabled:s,error:e.error,onChange:T,options:M,value:(0,o.A)(d.values,e.name),loading:i&&!M.length})})}):null},F=({field:e,labelClassName:t=null,hintClassName:s=null,errorClassName:n=null,fieldClassName:i=null,...r})=>(0,a.jsx)("div",{className:"flex-1",children:e.group.map(e=>(0,a.jsx)(R,{input:e,labelClassName:t,hintClassName:s,errorClassName:n,fieldClassName:i,...r},e.key))}),k=(0,m.YK)({"Inside Europe":{id:"PayoutBankInformationForm.TransactionType.InsideEurope",defaultMessage:"Inside Europe"},"Outside Europe":{id:"PayoutBankInformationForm.TransactionType.OutsideEurope",defaultMessage:"Outside Europe"},"Local bank account":{id:"PayoutBankInformationForm.TransactionType.LocalBankAccount",defaultMessage:"Local bank account"},ACH:{defaultMessage:"In the US (ACH)",id:"PayoutBankInformationForm.TransactionType.ABA"}
497,Wire:{defaultMessage:"In the US (Wire)",id:"PayoutBankInformationForm.TransactionType.Wire"},SWIFT:{defaultMessage:"Outside the US",id:"PayoutBankInformationForm.TransactionType.SwiftCode"}}),O=({disabled:e,getFieldName:t,onlyDataFields:s,formik:r,host:l,currency:x,alwaysSave:p,sectionHeaderClassName:h,labelClassName:g,hintClassName:A,errorClassName:j,fieldClassName:C})=>{let T=(0,m.tz)(),I=n.useRef(!1),{loading:P,error:R,data:O,refetch:_}=(0,i.IT)(N,{variables:{slug:l?l.slug:w,currency:x}}),D=n.useCallback(()=>{I.current=!0},[]),U=(0,o.A)(r.values,t("data"));n.useEffect(()=>{I.current&&(I.current=!1,_({slug:l?l.slug:w,currency:x,accountDetails:U}))},[x,U,l,_]),(0,n.useEffect)(()=>{_({accountDetails:(0,o.A)(r.values,t("data"))})},[]);let L=n.useMemo(()=>(O?.host?.transferwise?.requiredFields??[]).map(e=>({label:k[e.title]?T.formatMessage(k[e.title]):e.title,value:e.type})),[O?.host?.transferwise?.requiredFields,T]),$=t("data.type"),z=t("data"),{setFieldValue:H}=r,{type:B,currency:V}=(0,o.A)(r.values,z),W=n.useCallback(e=>{H(z,{type:B,currency:V}),H($,e)},[z,H,$,B,V]);if(P&&!O)return(0,a.jsx)(E.E,{className:"mt-2 h-10 w-full"});if(R)return(0,a.jsxs)(b.A,{mt:2,fontSize:"12px",type:"error",children:[(0,a.jsx)(m.sA,{id:"PayoutBankInformationForm.Error.RequiredFields",defaultMessage:"There was an error fetching the required fields"}),R.message&&`: ${R.message}`]});if(!O?.host?.transferwise?.requiredFields)return console.warn("Could not fetch requiredFields through Wise."),null;let q=O.host.transferwise.requiredFields.find(e=>e.type===(0,o.A)(r.values,t("data.type"))),[G,Y]=(0,d.A)(q?.fields,e=>e.group.every(e=>e.key.includes("address."))),K=(0,o.A)(r.values,$),J="USD"===x?T.formatMessage({defaultMessage:"Where's the recipient bank account located?",id:"+xrUEC"}):T.formatMessage({id:"PayoutBankInformationForm.TransactionMethod",defaultMessage:"Transaction Method"});return(0,a.jsxs)("div",{className:"mt-2 flex flex-col",children:[(0,a.jsx)(y.z,{disabled:e||0===L.length,name:$,label:J,validate:S(T,{name:J},!e),labelClassName:g,hintClassName:A,errorClassName:j,children:({field:e})=>(0,a.jsx)(f.B,{...e,inputId:e.id,options:L,onChange:W,value:q?.type??void 0})}),K&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)("div",{className:"mt-6 flex-1",children:(0,a.jsx)("p",{className:h||"text-base font-semibold",children:(0,a.jsx)(m.sA,{id:"PayoutBankInformationForm.AccountInfo",defaultMessage:"Account Information"})})}),Y.map(s=>(0,a.jsx)(F,{currency:x,disabled:e,field:s,formik:r,getFieldName:e=>t((0,c.A)(["data",e]).join(".")),host:l,loading:P,refetch:D,labelClassName:g,hintClassName:A,errorClassName:j,fieldClassName:C},(0,u.A)(s.name)))]}),!!G.length&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("div",{className:"mt-6 flex flex-1 items-center gap-2",children:[(0,a.jsx)("span",{className:h||"text-base font-semibold",children:(0,a.jsx)(m.sA,{id:"PayoutBankInformationForm.RecipientAddress",defaultMessage:"Recipient's Address"})}),(0,a.jsx)(v.$,{children:(0,a.jsx)(m.sA,{id:"PayoutBankInformationForm.HolderAddress",defaultMessage:"Bank account holder address (not the bank address)"})})]}),G.map(s=>(0,a.jsx)(F,{currency:x,disabled:e,field:s,formik:r,getFieldName:e=>t((0,c.A)(["data",e]).join(".")),host:l,loading:P,refetch:D,labelClassName:g,hintClassName:A,errorClassName:j,fieldClassName:C},(0,u.A)(s.name)))]}),K&&p&&!s&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(M.w,{className:"my-6"}),(0,a.jsx)(y.z,{disabled:e,name:t("name"),label:T.formatMessage({defaultMessage:"Alias",id:"PayoutMethod.New.Alias"}),hint:T.formatMessage({defaultMessage:"Give this payout method an alias that will help you identify it",id:"PayoutMethod.New.Alias.hint"}),placeholder:T.formatMessage({defaultMessage:"e.g., Main Bank Account",id:"PayoutMethod.New.Alias.placeholder.bankAccount"}),required:!1})]})]})},_=(0,g.J1)` 498 query PayoutBankInformationAvailableCurrencies($slug: String, $ignoreBlockedCurrencies: Boolean) { 499 host(slug: $slug) { 500 id 501 slug 502 currency 503 transferwise { 504 id 505 availableCurrencies(ignoreBlockedCurrencies: $ignoreBlockedCurrencies) 506 } 507 } 508 } 509`,D=({isNew:e,getFieldName:t,host:s=null,fixedCurrency:r=!1,ignoreBlockedCurrencies:d=!1,optional:c,disabled:u=!1,alwaysSave:p=!1,onlyD
509ataFields:h=!1,sectionHeaderClassName:g=null,labelClassName:f=null,hintClassName:v=null,errorClassName:C=null,fieldClassName:M=null})=>{let{data:I,loading:N}=(0,i.IT)(_,{variables:{slug:w,ignoreBlockedCurrencies:d},skip:!!(r||s?.transferwise?.availableCurrencies)}),S=I?.host||s,P=(0,l.j7)(),{formatMessage:R}=(0,m.tz)(),F=t("data.currency"),k=t("data"),D=(0,o.A)(P.values,F),{setFieldValue:U}=P,L=n.useCallback(e=>{U(k,{}),U(F,e)},[F,U,k]),$=n.useMemo(()=>{let e,t=S?.transferwise?.availableCurrencies;return r?e=T([r]):t&&(e=T(t.map(e=>e.code))),c&&(e=e||[]).unshift({label:"No selection",value:null}),e},[r,c,S?.transferwise?.availableCurrencies]),z=n.useMemo(()=>($||[]).map(e=>e.value).filter(Boolean),[$]),H=n.useCallback(()=>{if(!r&&z&&P?.values?.items?.length>0){let e=P.values.items.reduce((e,t)=>e+(t.amountV2?.valueInCents||t.amount||0),0),t=z.find(e=>e.code===D)?.minInvoiceAmount*100;if(e<t)return R({defaultMessage:"The minimum amount for transferring to {selectedCurrency} is {minAmountForSelectedCurrency}",id:"AzGwgz"},{selectedCurrency:D,minAmountForSelectedCurrency:(0,x.vv)(t,S?.currency)})}},[z,r,R,P.values.items,D,S?.currency]);return N?(0,a.jsx)(E.E,{className:"mt-2 h-10 w-full"}):$?(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(y.z,{name:F,label:(0,a.jsx)(m.sA,{id:"PayoutBankInformationForm.Currency",defaultMessage:"Bank Account Currency"}),disabled:!!(r&&!c)||!e||u,validate:H,labelClassName:f,hintClassName:v,errorClassName:C,children:({field:e})=>(0,a.jsx)(A.A,{...e,inputId:e.id,onChange:L,availableCurrencies:z})}),D&&(0,a.jsx)(O,{currency:D,disabled:!e||u,formik:P,getFieldName:t,host:S,alwaysSave:p,onlyDataFields:h,sectionHeaderClassName:g,labelClassName:f,hintClassName:v,errorClassName:C,fieldClassName:M}),!D&&!$?.length&&(0,a.jsxs)(b.A,{fontSize:"12px",type:"error",mt:2,children:[(0,a.jsx)(m.sA,{id:"PayoutBankInformationForm.Error.AvailableCurrencies",defaultMessage:"There was an error loading available currencies for this host"}),"."]})]}):(0,a.jsx)(b.A,{fontSize:"12px",type:"warning",children:(0,a.jsx)(m.sA,{defaultMessage:"An error occurred while preparing the form for bank accounts. Please contact <I18nSupportLink>support</I18nSupportLink>",id:"fCWfnb",values:{I18nSupportLink:j.Ku}})})}},44564:(e,t,s)=>{s.d(t,{A:()=>b,I:()=>j});var a=s(37876),n=s(14232),i=s(70496),r=s(45817),l=s(64487),o=s(50840),d=s(62449),c=s(16240),u=s(2038),m=s(87881),x=s(96974),p=s(91345),h=s(61270),g=s(72945),f=s(1509),A=s(46828),y=s(86742);let j=(e,t,s,n)=>{let i=(0,u.js)(e.amountInAccountCurrency),r=(0,l.A)(t,"stats.balanceWithBlockedFunds.valueInCents",(0,l.A)(t,"stats.balanceWithBlockedFunds",0));if(!s)return(0,a.jsx)(d.sA,{id:"expense.pay.error.noHost",defaultMessage:"Expenses cannot be paid without a Fiscal Host"});if(![x.A.SETTLEMENT,x.A.PLATFORM_BILLING].includes(e.type)&&r<i)return(0,a.jsx)(d.sA,{id:"expense.pay.error.insufficientBalance",defaultMessage:"Insufficient balance"});if((0,o.A)(e.requiredLegalDocuments,"US_TAX_FORM"))return(0,a.jsx)(d.sA,{id:"TaxForm.DisabledPayment",defaultMessage:"Unable to pay because tax form has not been submitted."});if(!n)return null;if(n.type===c.UC.BANK_ACCOUNT)return null;else if(n.type===c.UC.ACCOUNT_BALANCE){if(!e.payee.host)return(0,a.jsx)(d.sA,{id:"expense.pay.error.payee.noHost",defaultMessage:"Unable to pay because payee Collective does not have a Fiscal Host."});if(e.payee.host.id!==s.id)return(0,a.jsx)(d.sA,{id:"expense.pay.error.payee.sameHost",defaultMessage:"Payer and payee must have the same Fiscal Host to pay this way."})}},v=({type:e,host:t,...s})=>e===c.UC.PAYPAL?(0,a.jsx)(i.c,{...s}):e===c.UC.BANK_ACCOUNT&&t?.transferwise?(0,a.jsx)(p.A,{...s}):(0,a.jsx)(r.t,{...s}),b=({expense:e,collective:t,host:s,disabled:i,onSubmit:r,error:l,canPayWithAutomaticPayment:o,...c})=>{let[u,x]=n.useState(!1),[p,b]=n.useState(!1),C=j(e,t,s,e.payoutMethod),M=(0,y.ak)(e),E=()=>M?b(!0):x(!0);(0,m.Ay)({keyMatch:m.P,callback:e=>{c.enableKeyboardShortcuts&&(e.preventDefault(),E())}});let T=(0,a.jsxs)(f.$n,{variant:"outlineSuccess","data-cy":"pay-button",...c,disabled:!!(i||C),onClick:E,children:[(0,a.jsx)(v,{type:e.payoutMethod?.type,host:s,size:12}),(0,a.jsx)(g.L9,{ml:"6px",children:(0,a.jsx)(d.sA,{id:"actions.goToPay",defaultMessage:"Go to Pay"})})]});return C?(0,a.jsx)(h.A,{content:C,children:T}):u?(0,a.jsxs)(n.Fragment,{children:[T,(0,a.jsx)(A.A,{expense:e,collective:t,host:s,onClose:()=>x(!1),error:l,canPayWithAutomaticPayment:o,onSubmit:async e=>{let{action:t,...s}=e;await r(t,s)&&x(!1)}})]}):p?(0,a.jsxs)(n.Fragment,{children:[T,(0,a.jsx)(y.Ay,{expense:e,onConfirm:()=>{x(!0),b(!1)},onClose:()=>b(!1)})]}):T}},45327:(e,t,s)=>{s.d(t,{s:()=>i});var a=s(11046),n=s(15192);let i=(0,a.J1)` 510 fragment TransactionsQueryCollectionFragment on TransactionCollection { 511 offset 512 limit 513 nodes { 514 id 515 legacyId 516 uuid 517 kind 518 amount { 519 currency 520 valueInCents 521 } 522 netAmount { 523 currency 524 valueInCents 525 } 526 taxAmount { 527 valueInCents 528 currency 529 } 530 taxInfo { 531 id 532 rate 533 type 534 } 535 platformFee { 536 currency 537 valueInCents 538 } 539 paymentProcessorFee { 540 currency 541 valueInCents 542 } 543 hostFee { 544 currency 545 valueInCents 546 } 547 type 548 description 549 createdAt 550 isRefunded 551 isRefund 552 isOrderRejected 553 toAccount { 554 id 555 name 556 slug 557 type 558 imageUrl 559 isIncognito 560 ... on AccountWithParent { 561 parent { 562 id 563 slug 564 } 565 } 566 settings
567 ... on Individual { 568 isGuest 569 } 570 ... on Collective { 571 host { 572 id 573 name 574 slug 575 type 576 } 577 } 578 ... on AccountWithHost { 579 hostFeePercent 580 } 581 ...AccountHoverCardFields 582 } 583 fromAccount { 584 id 585 name 586 slug 587 type 588 imageUrl 589 isIncognito 590 ... on Event { 591 parent { 592 id 593 } 594 } 595 ... on Project { 596 parent { 597 id 598 } 599 } 600 ... on Individual { 601 isGuest 602 } 603 ... on AccountWithHost { 604 hostFeePercent 605 } 606 ...AccountHoverCardFields 607 } 608 host { 609 id 610 name 611 slug 612 type 613 imageUrl 614 } 615 account { 616 id 617 isIncognito 618 } 619 giftCardEmitterAccount { 620 id 621 name 622 slug 623 type 624 imageUrl 625 } 626 permissions { 627 id 628 canRefund 629 canDownloadInvoice 630 canReject 631 } 632 paymentMethod { 633 id 634 type 635 } 636 payoutMethod { 637 id 638 type 639 } 640 order { 641 id 642 legacyId 643 status 644 memo 645 processedAt 646 toAccount { 647 id 648 slug 649 } 650 } 651 expense { 652 id 653 status 654 tags 655 type 656 feesPayer 657 amount 658 currency 659 legacyId 660 # limit: 1 as current best practice to avoid the API fetching entries it doesn't need 661 comments(limit: 1) { 662 totalCount 663 } 664 payoutMethod { 665 id 666 type 667 } 668 account { 669 id 670 slug 671 } 672 createdByAccount { 673 id 674 slug 675 } 676 } 677 relatedTransactions(kind: [HOST_FEE, PAYMENT_PROCESSOR_FEE, PAYMENT_PROCESSOR_COVER, TAX, PLATFORM_TIP]) { 678 id 679 legacyId 680 type 681 kind 682 netAmount { 683 currency 684 valueInCents 685 } 686 } 687 } 688 } 689 ${n.B} 690`},46828:(e,t,s)=>{s.d(t,{A:()=>eM});var a=s(37876),n=s(14232),i=s(670),r=s(48776),l=s(46525),o=s(88894),d=s(96432),c=s(94772),u=s(2587),m=s(6587),x=s(62449),p=s(5646),h=s(23968),g=s(58649),f=s(52170),A=s(16240),y=s(2038),j=s(2948),v=s(11046),b=s(82016),C=s(26215),M=s(21057),E=s(20322),T=s(15449),w=s(90295),I=s(16147),N=s(2996),S=s(99202),P=s(89908),R=s(41955),F=s(98263),k=s(94550),O=s(68901),_=s(62051),D=s(45918),U=s(90983),L=s(94019),$=s(68500),z=s(45409),H=s(61270),B=s(72945),V=s(49030),W=s(88490),q=s(61902),G=s(10611),Y=s(33123),K=s(37788),J=s(59747),Z=s(71984),X=s(65178),Q=s(99596),ee=s(48953),et=s(47597),es=s(1509),ea=s(31934),en=s(29971),ei=s(46436),er=s(80207);function el(e){let t=(0,x.tz)(),[s,r]=n.useState(null),[l,o]=n.useState(!1),[d,c]=n.useState(!1),[u,m]=n.useState(null),[p,h,g,f]=(0,Q.A)({expense:(0,G.A)(e.expense,["id","legacyId"])}),[A,y]=n.useState(!1),[j,v]=n.useState(!1),{loading:b,data:C,error:M}=(0,i.IT)(eo,{variables:{slug:e.expense.account.slug}}),E=!p||g||b,T=f||M,w=n.useMemo(()=>{let e=function(e){if(!e)return()=>!1;let t=[...e.payment_method_types];return t.includes("card")&&t.push("creditcard"),s=>s.service===Y.PYc.STRIPE&&t.includes(s.type.toLowerCase())&&(!s.data?.stripeAccount||s.data?.stripeAccount===e.stripeAccount)}(p);return(C?.account?.paymentMethods??[]).filter(e)},[p,C?.account?.paymentMethods]);n.useEffect(()=>{s||E||r(w?.length?w[0].id:"new-payment-method")},[w,s,E]);let I={clientSecret:p?.client_secret,appearance:{theme:"stripe",variables:{fontFamily:"Inter, sans-serif"}},fonts:[{cssSrc:"https://fonts.googleapis.com/css?family=Inter"}]},N=(p?.payment_method_types??[]).map(e=>(0,X.j)(t,e));N.length>3&&(N=[...N.slice(0,3),"etc"]);let S=e.expense.type===Y.RBD.PLATFORM_BILLING,P=n.useMemo(()=>!("new-payment-method"===s?u?.isCompleted:w.some(e=>e.id===s))||S&&(!A||!j),[s,u?.isCompleted,w,S,A,j]),{onSuccess:R}=e,F=n.useCallback(async()=>{let t=new URL(`${window.location.origin}/${e.expense.account.slug}/expenses/${e.expense.legacyId}`),a=w.find(e=>e.id===s);try{o(!0),await (0,Z.T)(h,p?.client_secret,{returnUrl:t.href,elements:u?.stripeData?.elements,type:"new-payment-method"===s?u?.paymentMethod?.type:a.type,paymentMethodId:"new-payment-method"!==s?a?.data?.stripePaymentMethodId:void 0},{redirect:"if_required"}),c(!0),await R()}catch(e){(0,er.o)({variant:"error",message:e.message})}finally{o(!1),c(!1)}},[h,p,u,s,e.expense.legacyId,e.expense.account.slug,w,R]);if(T)return(0,a.jsx)(et.A,{error:T});if(E)return(0,a.jsx)(ei.E,{className:"h-6 w-full"});let k=(0,a.jsx)(ee.W,{hasSaveCheckBox:!1,defaultIsSaved:!1,onChange:e=>m(e.stepPayment),bilingDetails:{name:"",email:""},stripePaymentIntentId:p.id,paymentIntentClientSecret:p.client_secret});return(0,a.jsxs)(q.Elements,{options:I,stripe:h,children:[d?(0,a.jsx)(ei.E,{className:"h-6 w-full"}):w?.length?(0,a.jsxs)(en.z6,{id:"paymentMethod",value:s,onValueChange:r,children:[w.map(e=>(0,a.jsxs)(en.pE,{value:e.id,children:[(0,a.jsx)("div",{children:(0,J.JV)(e)}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm",children:(0,K.jR)(e)}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,J.pb)(e)})]})]},e.id)),(0,a.jsx)(en.pE,{value:"new-payment-method",showSubcontent:"new-payment-method"===s,subContent:k,children:(0,a.jsx)(x.sA,{defaultMessage:"New: {methods}",id:"paymentMethods.new",values:{methods:N.join(", ")}})})]}):k,S&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(ea.S,{id:"acknowledgeAdditionalUsage",checked:A,disabled:l,onCheckedChange:e=>y(!!e)}),(0,a.jsx)("label",{htmlFor:"acknowledgeAdditionalUsage",className:"text-sm leading-none font-normal peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:(0,a.jsx)(x.sA,{defaultMessage:"I accept that additional charges may apply if I exceed plan limits.",id:"TK5atK"})})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(ea.S,{id:"acknowledgeRenewal",disabled:l,checked:j,onCheckedChange:e=>v(!!e)}),(0,a.jsx)("label",{htmlFor:"acknowledgeRenewal",className:"text-sm leading-none font-normal peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:(0,a.jsx)(x.sA,{defaultMessage:"I accept that my subscription will automatically renew unless I cancel before the renewal date.",id:"iB3QMn"})})]})]}),(0,a.jsx)(es.$n,{onClick:F,variant:"success",className:"mt-4 w-full",loading:l,disabled:P,children:(0,a.jsx)(x.sA,{defaultMessage:"Pay",id:"lD3+8a"})})]},h._stripeObjId)}let eo=(0,W.J1)` 691 query AccountStripePaymentMethods($slug: String) { 692 account(slug: $slug) { 693 id 694 paymentMethods(type: [CREDITCARD, US_BANK_ACCOUNT, SEPA_DEBIT, BACS_DEBIT]) { 695 id 696 name 697 data 698 service 699 type 700 expiryDate 701 providerType 702 limitedToHosts { 703 id 704 legacyId 705 slug 706 } 707 } 708 } 709 } 710`;var ed=s(44482),ec=s(62301),eu=s(83244);let em=(0,v.J1)` 711 query QuoteExpense($id: String!) { 712 expense(expense: { id: $id }) { 713 id 714 currency 715 reference 716 amountInHostCurrency: amountV2(currencySource: HOST) { 717 exchangeRate { 718 value 719 fromCurrency 720 toCurrency 721 } 722 } 723 host { 724 id 725 transferwise { 726 id 727 amountBatched { 728 valueInCents 729 currency 730 } 731 balances { 732 valueInCents 733 currency 734 } 735 } 736 } 737 quote { 738 paymentProcessorFeeAmount { 739 valueInCents 740 currency 741 } 742 sourceAmount { 743 valueInCents 744 currency 745 } 746 estimatedDeliveryAt 747 notices { 748 type 749 text 750 } 751 } 752 } 753 } 754`,ex=(0,v.J1)` 755 query ValidateTransferRequirements($id: String!, $details: JSON) { 756 expense(expense: { id: $id }) { 757 id
758 validateTransferRequirements(details: $details) { 759 type 760 fields { 761 name 762 group { 763 key 764 name 765 type 766 required 767 example 768 minLength 769 maxLength 770 validationRegexp 771 refreshRequirementsOnChange 772 valuesAllowed { 773 key 774 name 775 } 776 } 777 } 778 } 779 } 780 } 781`,ep=({expense:e,setDisabled:t,host:s})=>{let r=(0,l.j7)(),d=s.settings?.transferwise?.generateReference!==!1,{data:c,loading:u,error:m}=(0,i.IT)(ex,{variables:{id:e.id}});return((0,n.useEffect)(()=>{t(u)},[u,t]),(0,n.useEffect)(()=>{let t;if(c?.expense?.validateTransferRequirements?.find(e=>e.fields.find(e=>{let s=e?.group?.find(e=>"reference"===e.key);s&&(t=s)})),t){var s;let a,n=e.reference||(d?(s=t.maxLength,a=e.legacyId.toString(),[e.account.name.replace(/ /g,"").toUpperCase().slice(0,s-1-a.length),a].join(" ")):void 0);n&&r.setFieldValue("transfer.details.reference",(0,E.kU)(n,t.maxLength," "))}},[c]),m)?(0,a.jsxs)(F.A,{fontSize:"12px",type:"error",children:[(0,a.jsx)(x.sA,{id:"PayExpense.Error.TransferDetails",defaultMessage:"There was an error fetching the transfer required details."}),m.message&&` ${m.message}`]}):u?(0,a.jsx)(R.A,{height:"40px"}):c?.expense?.validateTransferRequirements?.map(({fields:e})=>e.map(e=>(0,a.jsx)(ed.M,{field:e,formik:r,getFieldName:e=>`transfer.${e}`,loading:u},(0,o.A)(e.name))))},eh={[A.UC.PAYPAL]:"PAYPAL",[A.UC.BANK_ACCOUNT]:"WISE"},eg=(e,t,s)=>{let a=e?.type;if(a===A.UC.OTHER)return{forceManual:!0,action:"PAY",paymentMethodService:null};if(a===A.UC.BANK_ACCOUNT&&!s.transferwise)return{forceManual:!0,action:"PAY",paymentMethodService:"WISE"};if(!t)return{forceManual:!0,action:"PAY",paymentMethodService:eh[a]||null};{let e="ACTIVE"===s.features[g.Gv.PAYPAL_PAYOUTS]&&a===A.UC.PAYPAL&&s.supportedPayoutMethods?.includes(A.UC.PAYPAL),t=a===A.UC.BANK_ACCOUNT&&s.supportedPayoutMethods?.includes(A.UC.BANK_ACCOUNT)&&(0,g.Ay)(s,g.Gv.TRANSFERWISE_OTT);return{forceManual:!1,action:e||t?"SCHEDULE_FOR_PAYMENT":"PAY",paymentMethodService:null}}},ef=Object.freeze({paymentProcessorFeeInHostCurrency:null,totalAmountPaidInHostCurrency:null,feesPayer:"COLLECTIVE",paymentMethodService:null,balanceAccountingCategory:null}),eA=e=>{let t={};return isNaN(e.paymentProcessorFeeInHostCurrency)&&(t.paymentProcessorFeeInHostCurrency=(0,j.$5)(j.ff.FORM_FIELD_PATTERN)),isNaN(e.totalAmountPaidInHostCurrency)&&(t.totalAmountPaidInHostCurrency=(0,j.$5)(j.ff.FORM_FIELD_PATTERN)),t},ey=(e,t,s,a)=>{if(["SETTLEMENT","PLATFORM_BILLING"].includes(e.type))return!1;let n=[A.UC.BANK_ACCOUNT,A.UC.OTHER].includes(e.payoutMethod?.type),i=e.currency===t?.currency;return!!(n&&i)&&(!s||!!a)},ej=p.I4.div.withConfig({componentId:"sc-9215e7e7-0"})(["display:flex;justify-content:space-between;font-weight:400;padding:9px 0;font-weight:400;line-height:18px;letter-spacing:0em;"," ",""],h.PQ,h.xe),ev=(0,p.I4)(B.L9).withConfig({componentId:"sc-9215e7e7-1"})(["margin-right:4px;flex:0 1 70%;margin-right:8px;line-height:18px;word-break:break-word;color:#4e5052;"," "," font-size:12px;"],h.yW,h.Il),eb=p.I4.span.withConfig({componentId:"sc-9215e7e7-2"})(["flex:1 1 30%;text-align:right;font-size:14px;white-space:nowrap;display:flex;flex-direction:row-reverse;& > *{margin-left:4px;}"]),eC=p.I4.p.withConfig({componentId:"sc-9215e7e7-3"})(["font-size:9px;font-weight:500;color:#4e5052;margin:5px 0;text-transform:uppercase;"]),eM=({onClose:e,onSubmit:t,expense:s,collective:o,host:p,error:h,canPayWithAutomaticPayment:j})=>{let v,E,W=(0,x.tz)(),q=s.payoutMethod?.type||A.UC.OTHER,G=!j||(0,g.r2)(p,g.Gv.TRANSFERWISE),Y=((e,t,s=!1)=>({...ef,...eg(e.payoutMethod,!s,t),balanceAccountingCategory:(0,w.ZU)(e.balanceAccountingCategory),feesPayer:e.feesPayer||ef.feesPayer,expenseAmountInHostCurrency:e.currency===t.currency?e.amount:e.amountInHostCurrency?.valueInCents}))(s,p,G),K=(0,l.Wx)({initialValues:Y,validate:eA,onSubmit:(v=p.currency,E=s.payoutMethod?.type||A.UC.OTHER,async e=>{let s=e.expenseAmountInHostCurrency+(e.paymentProcessorFeeInHostCurrency||0);if(e.forceManual&&e.paymentProcessorFeeInHostCurrency&&e.paymentProcessorFeeInHostCurrency>s/2&&!confirm(W.formatMessage({defaultMessage:"You are about to record a payment for {totalAmount} that includes a {paymentProcessorFeeAmount} payment processor fee. This fee looks unusually high.{newLine}{newLine}Are you sure you want to do this?",id:"UW7XhX"}
781,{totalAmount:(0,y.vv)(e.totalAmountPaidInHostCurrency,v),paymentProcessorFeeAmount:(0,y.vv)(e.paymentProcessorFeeInHostCurrency,v),newLine:"\n"})))return;let a=E===A.UC.OTHER||e.forceManual;return t({...(0,c.A)(e,"expenseAmountInHostCurrency"),totalAmountPaidInHostCurrency:s,balanceAccountingCategory:a&&e.balanceAccountingCategory?{id:e.balanceAccountingCategory.value}:null})})}),J=q===A.UC.OTHER||K.values.forceManual,Z=(0,w.hc)(J?p.slug:void 0,{expenseId:s.id,accountSlug:s.account?.slug}),X=(0,C.A)(W,q,{aliasBankAccountToTransferWise:!0}),Q=q===A.UC.BANK_ACCOUNT&&null===p.transferwise,ee="SCHEDULE_FOR_PAYMENT"===K.values.action,et=j&&![A.UC.OTHER,A.UC.ACCOUNT_BALANCE,A.UC.STRIPE].includes(q),[es,ea]=n.useState(!1),en=p.transferwise&&q===A.UC.BANK_ACCOUNT&&!G,ei=(0,i.IT)(em,{variables:{id:s.id},skip:!en,fetchPolicy:"no-cache"}),er=ei.data?.expense?.quote,eo=(({values:e,expense:t,quote:s,host:a,feesPayer:n})=>{let i=t.amountInHostCurrency;if(e.forceManual){let s={valueInCents:e.expenseAmountInHostCurrency+(e.paymentProcessorFeeInHostCurrency||0),currency:a.currency},n={valueInCents:e.paymentProcessorFeeInHostCurrency,currency:a.currency},r=s.valueInCents-(n.valueInCents||0);return{paymentProcessorFee:n,totalAmount:s,effectiveRate:t.currency!==a.currency&&r/t.amount,expenseAmountInHostCurrency:i}}if(s){let e=t.currency!==a.currency&&s.sourceAmount.valueInCents/t.amount,i=(0,d.A)(s.sourceAmount),r={valueInCents:s.sourceAmount.valueInCents-s.paymentProcessorFeeAmount.valueInCents,currency:s.sourceAmount.currency};return"PAYEE"===n&&(i.valueInCents-=s.paymentProcessorFeeAmount.valueInCents),{paymentProcessorFee:s.paymentProcessorFeeAmount,totalAmount:i,effectiveRate:e,expenseAmountInHostCurrency:r}}{let e=t.currency!==a.currency;return{amountInExpenseCurrency:{valueInCents:t.amount,currency:t.currency},expenseAmountInHostCurrency:i,totalAmount:i,paymentProcessorFee:null,isMultiCurrency:e}}})({values:K.values,expense:s,quote:er,host:p,feesPayer:K.values.feesPayer}),ed=(0,T.Gb)(s.amount,s.taxes),ex=n.useMemo(()=>[{value:null,label:(0,a.jsx)(x.sA,{id:"Other",defaultMessage:"Other"})},...f.nI.map(e=>({value:e,label:(0,b.P)(W,e)}))],[W]),eh=ei.data?.expense.host?.transferwise.amountBatched,eM=ei.data?.expense.host?.transferwise.balances.find(e=>e.currency===eh?.currency),eT=en&&eM&&eh&&eM.valueInCents>=eh.valueInCents+eo.totalAmount?.valueInCents,ew=q===A.UC.STRIPE,eI=n.useCallback(async()=>{await t({action:"MARK_AS_PAID_WITH_STRIPE",paymentMethodService:f.ju.STRIPE})},[t]);return(0,a.jsxs)($.Ay,{onClose:e,width:"100%",minWidth:280,maxWidth:400,"data-cy":"pay-expense-modal",children:[(0,a.jsx)($.rQ,{children:(0,a.jsx)(B.H4,{fontSize:"20px",fontWeight:"700",children:(0,a.jsx)(x.sA,{id:"PayExpenseTitle",defaultMessage:"Pay expense"})})}),(0,a.jsx)($.cw,{mb:0,children:(0,a.jsx)("form",{onSubmit:K.handleSubmit,children:(0,a.jsxs)(l.QI,{value:K,children:[(0,a.jsx)(eC,{children:(0,a.jsx)(x.sA,{id:"ExpenseForm.PayoutOptionLabel",defaultMessage:"Payout method"})}),(0,a.jsx)(S.az,{mb:2,children:(0,a.jsx)(eu.A,{type:q})}),(0,a.jsx)(ec.A,{payoutMethod:s.payoutMethod,showLabel:!1}),et&&!Q&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(_.A,{items:["AUTO","MANUAL"],buttonProps:{width:"50%"},buttonPropsBuilder:({item:e})=>({"data-cy":`pay-type-${e}`}),mt:3,selected:K.values.forceManual?"MANUAL":"AUTO",customBorderRadius:"6px",onChange:e=>{K.setValues({...K.values,...eg(q,"AUTO"===e,p),paymentProcessorFeeInHostCurrency:null,expenseAmountInHostCurrency:s.currency===p.currency?s.amount:s.amountInHostCurrency?.valueInCents,feesPayer:ey(s,o,J,null)?K.values.feesPayer:ef.feesPayer})},children:({item:e})=>"AUTO"===e?(0,a.jsx)(x.sA,{id:"Payout.Automatic",defaultMessage:"Automatic"}):(0,a.jsx)(x.sA,{id:"Payout.Manual",defaultMessage:"Manual"})}),G&&!J&&!ew&&(0,a.jsx)(k.A,{featureKey:g.Gv.TRANSFERWISE,compact:!0,className:"my-4"})]}),J&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(L.A,{name:"expenseAmountInHostCurrency",htmlFor:"expenseAmountInHostCurrency",inputType:"number",error:K.errors.expenseAmountInHostCurrency,required:!0,mt:3,label:(0,a.jsx)(x.sA,{id:"PayExpense.expenseAmountInHostCurrency.Input",defaultMessage:"Amount paid for expense"}),hint:(0,a.jsx)(x.sA,{id:"PayExpense.expenseAmountInHostCurrency.Hint",defaultMessage:"The amount paid for this expense, in host currency, without payment processor fees."}),children:e=>(0,a.jsx)(P.A,{...e,currency:p.currency,currencyDisplay:"FULL",value:K.values.expenseAmountInHostCurrency,"data-cy":"expense-amount-paid",min:10**(2-(0,y.HX)(p.currency)),onChange:e=>K.setFieldValue("expenseAmountInHostCurrency",e)})}),(0,a.jsx)(L.A,{name:"paymentProcessorFeeInHostCurrency",htmlFor:"paymentProcessorFeeInHostCurrency",inputType:"number",error:K.errors.paymentProcessorFeeInHostCurrency,required:!1,mt:3,label:(0,a.jsx)(x.sA,{id:"PayExpense.ProcessorFeesInput",defaultMessage:"Payment processor fees"}),hint:(0,a.jsx)(x.sA,{id:"PayExpense.paymentProcessorFeeInHostCurrency.Hint",defaultMessage:"Amount that was charged in fees. Leave it empty if the payee is paying the fees."}),children:e=>(0,a.jsx)(P.A,{...e,currency:p.currency,currencyDisplay:"FULL",value:K.values.paymentProcessorFeeInHostCurrency,min:0,max:K.values.expenseAmountInHostCurrency||1e8,onChange:e=>K.setFieldValue("paymentProcessorFeeInHostCurrency",e)})}),(0,a.jsx)(L.A,{name:"paymentMethodService",htmlFor:"paymentMethodService",error:K.errors.paymentMethodService,required:!1,mt:3,label:(0,a.jsx)(x.sA,{id:"PayExpense.PaymentMethodService",defaultMessage:"Payment service"}),hint:(0,a.jsx)(x.sA,{id:"PayExpense.paymentMethodService.Hint",defaultMessage:"The payment service used to pay for this expense."}),children:e=>(0,a.jsx)(z.A,{options:ex,minWidth:300,value:K.values.paymentMethodService?ex.find(e=>e.value===K.values.paymentMethodService):void 0,onChange:({value:e})=>K.setFieldValue("paymentMethodService",e),...e})}),Z.enabled&&(0,a.jsx)(L.A,{name:"balanceAccountingCategory",htmlFor:"balanceAccountingCategory",required:!1,mt:3,label:(0,a.jsx)(x.sA,{defaultMessage:"Paid from",id:"jhYP1/"}),hint:(0,a.jsx)(x.sA,{defaultMessage:"The balance or clearing account the funds were paid from.",id:"OfBJ2R"}),children:e=>(0,a.jsx)(w.sz,{hostSlug:p.slug,inputId:e.id||"balanceAccountingCategory",value:K.values.balanceAccountingCategory,context:{expenseId:s.id,accountSlug:s.account?.slug},menuPortalTarget:null,onChange:e=>K.setFieldValue("balanceAccountingCategory",e)})}),(0,a.jsx)(L.A,{name:"clearedAt",htmlFor:"clearedAt",error:K.errors.clearedAt,required:!1,mt:3,label:(0,a.jsx)(x.sA,{defaultMessage:"Effective Date",id:"Gh3Obs"}),hint:(0,a.jsx)(x.sA,{defaultMessage:"The date funds were cleared on your bank, Wise, PayPal, Stripe or any other external account holding these funds.",id:"s3O6iq"}),children:e=>(0,a.jsx)(U.A,{...e,id:"clearedAt",name:"clearedAt",type:"date","data-cy":"clearedAt",defaultValue:K.values.clearedAt,onChange:e=>K.setFieldValue("clearedAt",new Date(e.target.value))})})]}),en&&!J&&(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)(ep,{host:p,expense:s,setDisabled:ea})}),ey(s,o,J,K.values.paymentProcessorFeeInHostCurrency)&&(0,a.jsx)(S.so,{mt:16,children:(0,a.jsx)(H.A,{content:(0,a.jsx)(x.sA,{defaultMessage:"Check this box to have the payee cover the cost of payment processor fees (useful to zero balance)",id:"ewvfiF"}),children:(0,a.jsx)(D.A,{name:"feesPayer",checked:"PAYEE"===K.values.feesPayer,onChange:({checked:e})=>K.setFieldValue("feesPayer",e?"PAYEE":"COLLECTIVE"),label:(0,a.jsx)(B.L9,{fontSize:"12px",children:(0,a.jsx)(x.sA,{defaultMessage:"The payee is covering the fees",id:"zoC8Gb"})})})})}),(0,a.jsxs)(S.az,{mt:19,mb:3,children:[(0,a.jsx)(eC,{children:(0,a.jsx)(x.sA,{id:"PaymentBreakdown",defaultMessage:"Payment breakdown"})}),(0,a.jsxs)(ej,{children:[(0,a.jsx)(ev,{children:(0,a.jsx)(x.sA,{id:"ExpenseAmount",defaultMessage:"Expense amount"})}),(0,a.jsx)(eb,{children:eo.isMultiCurrency?(0,a.jsx)(N.A,{amount:eo.amountInExpenseCurrency?.valueInCents,currency:eo.amountInExpenseCurrency?.currency,amountClassName:"font-medium",currencyCodeClassName:"text-muted-foreground"}):(0,a.jsx)(N.A,{amount:K.values.expenseAmountInHostCurrency,currency:eo.expenseAmountInHostCurrency?.currency,amountClassName:"font-medium",currencyCodeClassName:"text-muted-foreground"})})]}),s.taxes?.map(e=>(0,a.jsxs)(ej,{"data-cy":`tax-${e.type}
781-expense-amount-line`,pt:0,children:[(0,a.jsxs)(ev,{children:[(0,M.k)(W,e.type,"short")," (",(0,u.A)(100*e.rate,2)||0,"%)"]}),"\xa0",(0,a.jsx)(eb,{children:(0,a.jsx)(N.A,{amount:(0,T._q)(ed,e),precision:2,currency:s.currency,amountClassName:"font-medium",showCurrencyCode:!1})})]},e.type)),eo.paymentProcessorFee&&(0,a.jsxs)(ej,{borderTop:"0.8px dashed #9D9FA3",children:[(0,a.jsx)(ev,{children:(0,a.jsx)(x.sA,{id:"PayExpense.ProcessorFeesInput",defaultMessage:"Payment processor fees"})}),(0,a.jsx)(eb,{children:ei.loading?(0,a.jsx)(R.A,{height:"16px"}):(0,a.jsx)(N.A,{amount:eo.paymentProcessorFee.valueInCents,currency:eo.paymentProcessorFee.currency,currencyCodeClassName:"text-muted-foreground",amountClassName:"text-foreground font-medium"})})]}),(0,a.jsxs)(ej,{borderTop:"1px solid #4E5052",pt:11,children:[(0,a.jsx)(ev,{color:"black.900",fontWeight:"600",children:null!==eo.paymentProcessorFee?(0,a.jsx)(x.sA,{id:"TotalAmount",defaultMessage:"Total amount"}):(0,a.jsxs)(V.m_,{children:[(0,a.jsxs)(V.k$,{className:"flex items-center gap-1",children:[(0,a.jsx)(x.sA,{id:"TotalAmountWithoutFee",defaultMessage:"Total amount (without fees)"}),(0,a.jsx)(m.A,{size:16,className:"text-muted-foreground"})]}),(0,a.jsx)(V.ZI,{children:(0,a.jsx)(x.sA,{defaultMessage:"This payment provider doesnât offer a way to calculate the fees in advance.",id:"EC5IZi"})})]})}),(0,a.jsx)(eb,{children:ei.loading?(0,a.jsx)(R.A,{height:"16px"}):eo.isMultiCurrency?(0,a.jsx)(I.A,{amount:eo.expenseAmountInHostCurrency,currencyCodeClassName:"text-muted-foreground",amountWrapperClassName:"flex flex-row-reverse gap-1"}):(0,a.jsx)(N.A,{amount:eo.totalAmount?.valueInCents,currency:eo.totalAmount?.currency,currencyCodeClassName:"text-muted-foreground"})})]}),eo.effectiveRate?(0,a.jsxs)(ej,{py:0,children:[(0,a.jsx)(ev,{color:"black.600",fontWeight:"500",children:(0,a.jsx)(x.sA,{defaultMessage:"Currency exchange rate",id:"jLTPuL"})}),(0,a.jsxs)(B.P,{fontSize:"13px",color:"black.600",whiteSpace:"nowrap",children:["~ ",s.currency," 1 = ",eo.totalAmount?.currency," ",(0,u.A)(eo.effectiveRate,5)]})]}):null]}),!h&&K.values.forceManual&&q!==A.UC.OTHER&&(0,a.jsxs)(F.A,{type:"warning",withIcon:!0,my:3,fontSize:"12px",children:[(0,a.jsx)("strong",{children:(0,a.jsx)(x.sA,{id:"Warning.Important",defaultMessage:"Important"})}),(0,a.jsx)("br",{}),(0,a.jsx)(B.P,{mt:2,fontSize:"12px",lineHeight:"18px",children:(0,a.jsx)(x.sA,{id:"PayExpenseModal.ManualPayoutWarning",defaultMessage:"By clicking below, you acknowledge that this expense has already been paid outside the platform (through Wise, bank transfer or else)."})})]}),er?.notices?.map(e=>(0,a.jsx)(F.A,{type:"INFO"===e.type?"info":"warning",my:3,children:(0,a.jsx)("p",{children:e.text})},e.text)),en&&!1===eT&&(0,a.jsxs)(F.A,{type:"error",withIcon:!0,my:3,fontSize:"12px",children:[(0,a.jsx)("strong",{children:(0,a.jsx)(x.sA,{id:"Warning.NotEnoughFunds",defaultMessage:"Not Enough Funds"})}),(0,a.jsx)("br",{}),(0,a.jsx)(B.P,{mt:2,fontSize:"12px",lineHeight:"18px",children:(0,a.jsx)(x.sA,{id:"PayExpenseModal.NotEnoughFundsOnWise",defaultMessage:"Your Wise {currency} account has insufficient balance to cover the existing batch plus this expense amount. You need {totalNeeded} and you currently only have {available}. Please add funds to your Wise {currency} account.",values:{currency:eM.currency,totalNeeded:(0,y.vv)(eh.valueInCents+eo.totalAmount.valueInCents,eh.currency),available:(0,y.vv)(eM.valueInCents,eM.currency)}})})]}),ew&&(0,a.jsx)(el,{onSuccess:eI,expense:s}),!ew&&(0,a.jsx)(S.so,{flexWrap:"wrap",justifyContent:"space-evenly",children:(0,a.jsx)(O.A,{buttonStyle:"success",width:"100%",m:1,type:"submit",loading:K.isSubmitting,"data-cy":"mark-as-paid-button",disabled:!J&&(G||en&&(ei.loading||!1===eT||es)),children:J?(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(r.J,{size:"1.5em"}),(0,a.jsx)(eE,{ml:1,children:(0,a.jsx)(x.sA,{id:"expense.markAsPaid",defaultMessage:"Mark as paid"})})]}):ee?(0,a.jsx)(x.sA,{id:"expense.schedule.btn",defaultMessage:"Schedule to Pay with {paymentMethod}",values:{paymentMethod:X}}):(0,a.jsx)(x.sA,{id:"expense.pay.btn",defaultMessage:"Pay with {paymentMethod}",values:{paymentMethod:X}})})})]})})})]})};var eE=(0,p.I4)(B.L9).withConfig({componentId:"sc-9215e7e7-4"})({verticalAlign:"middle"})},47722:(e,t,s)=>{s.d(t,{A:()=>p});var a=s(37876),n=s(14232),i=s(64177),r=s(6199),l=s(62449),o=s(2948),d=s(60257),c=s(21092),u=s(93182),m=s(80207),x=s(15114);function p({onClose:e,onConfirm:t,host:s,account:h,expense:g}){let f=(0,l.tz)(),[A]=(0,i.n)(x.Ky),[y,j]=n.useState(g.accountingCategory||void 0),{toast:v}=(0,m.d)(),{LoggedInUser:b}=(0,d.A)(),C=!!b?.isAdminOfCollective(s);return(0,a.jsx)(u.A,{onClose:e,header:(0,a.jsx)(l.sA,{defaultMessage:"Approve Expense",id:"PJNkaW"}),maxWidth:384,disableSubmit:(0,r.A)(y),continueHandler:async()=>{try{y?.id!==g.accountingCategory?.id&&await A({variables:{expenseId:g.id,category:y?{id:y.id}:null}}),await t(),e()}catch(e){v({variant:"error",message:(0,o.Rp)(f,e)})}},children:(0,a.jsxs)("div",{className:"my-4",children:[(0,a.jsx)("label",{htmlFor:"confirm-expense-category",className:"mb-2 text-base font-bold",children:(0,a.jsx)(l.sA,{defaultMessage:"Confirm Expense Category",id:"X5FRNX"})}),(0,a.jsx)(c.Ay,{id:"confirm-expense-category",kind:"EXPENSE",onChange:j,host:s,account:h,expenseType:g.type,expenseValues:g,selectedCategory:y,valuesByRole:g.valuesByRole,allowNone:!1,predictionStyle:"full",selectFirstOptionIfSingle:!0,showCode:C})]})})}},50388:(e,t,s)=>{s.d(t,{A:()=>ei,w:()=>es});var a=s(37876),n=s(14232),i=s(86541),r=s(14241),l=s(67953),o=s(40125),d=s(62449),c=s(5646),u=s(6636),m=s(23188),x=s(2038),p=s(33123),h=s(60257),g=s(9612),f=s(87058),A=s(30619),y=s(93481),j=s(56593),v=s(34679),b=s(89641
781),C=s(4436),M=s(99202),E=s(65221),T=s(69756),w=s(38268),I=s(68901),N=s(5885),S=s(74143),P=s(61270),R=s(58581),F=s(72945),k=s(89797),O=s(63598),_=s(33341);let D=(0,d.YK)({completed:{id:"Order.Status.Completed",defaultMessage:"Completed"},refunded:{id:"Order.Status.Refunded",defaultMessage:"Refunded"},rejected:{id:"expense.rejected",defaultMessage:"Rejected"}}),U=(0,d.YK)({[u.w.PENDING]:{id:"Order.Status.Pending",defaultMessage:"Please follow the payment instructions in the confirmation email to complete your transaction."}}),L=({transaction:e,...t})=>{var s,n;let i=(0,d.tz)(),r=(0,a.jsx)(S.A,{type:e.isRefund?"success":e.isOrderRejected&&e.isRefunded?"error":e.isRefunded?"grey":e.order?.status===u.w.PENDING?"warning":"success",fontWeight:"600",letterSpacing:"0.8px",textTransform:"uppercase","data-cy":"expense-status-msg",...t,children:(s=i,(n=e).isRefund?s.formatMessage(D.completed):n.isOrderRejected&&n.isRefunded?s.formatMessage(D.rejected):n.isRefunded?s.formatMessage(D.refunded):[u.w.PENDING].includes(n.order?.status)?(0,O.l)(s,n.order.status):s.formatMessage(D.completed))});return[u.w.PENDING].includes(e.order?.status)?(0,a.jsx)(P.A,{content:()=>i.formatMessage(U[e.order.status],_.Ay),children:r}):r};var $=s(92850),z=s(55817),H=s(34350),B=s(83244),V=s(2996),W=s(55234),q=s(1509),G=s(49030);let Y=c.Ay.p.withConfig({componentId:"sc-2d42babf-0"})(["margin:8px 8px 4px 8px;color:#76777a;font-weight:500;letter-spacing:0.6px;text-transform:uppercase;font-weight:bold;font-size:11px;"]),K=c.Ay.div.withConfig({componentId:"sc-2d42babf-1"})(["margin:0 8px 12px 8px;font-size:12px;color:#4e5052;letter-spacing:-0.04px;"]),J=(0,c.Ay)(M.so).withConfig({componentId:"sc-2d42babf-2"})(["background:#f7f8fa;font-size:12px;padding:16px 24px;"," @media (max-width:40em){padding:8px;}"],e=>e.isCompact&&(0,c.AH)(["padding:16px 24px 16px 24px;"])),Z=({displayActions:e,transaction:t})=>{let s=(0,d.tz)(),{LoggedInUser:i}=(0,h.A)(),{loading:r,callWith:l}=(0,z.c)(H.D,{useErrorToast:!0}),{legacyId:o,type:c,isRefunded:x,isRefund:g,toAccount:A,fromAccount:y,host:j,uuid:v,platformFee:b,hostFee:C,paymentMethod:I,paymentProcessorFee:S,payoutMethod:R,amount:F,netAmount:k,permissions:O,order:D,expense:U,isOrderRejected:L,kind:Z}=t,X=c===m.E.CREDIT,Q=null!==D,ee=O?.canRefund&&!x,et=O?.canReject&&!L,es=O?.canDownloadInvoice&&y.parent?.id!==A.id&&y.id!==A.host?.id&&(!U||U.type===p.RBD.INVOICE),ea=t.relatedTransactions?.find(e=>e.kind===m.L.HOST_FEE&&e.type===m.E.CREDIT),en=t.relatedTransactions?.find(e=>e.kind===m.L.TAX&&e.type===m.E.CREDIT),ei=t.relatedTransactions?.find(e=>e.kind===m.L.PAYMENT_PROCESSOR_FEE&&e.type===m.E.CREDIT),er=t.relatedTransactions?.find(e=>e.kind===m.L.PAYMENT_PROCESSOR_COVER&&e.type===m.E.CREDIT),el=t.relatedTransactions?.find(e=>e.kind===m.L.PLATFORM_TIP&&e.type===m.E.CREDIT),eo=[u.w.PROCESSING,u.w.PENDING].includes(D?.status),ed=i?.isAdminOfCollective(A),ec=i?.isAdminOfCollective(j);return(0,a.jsxs)(J,{flexWrap:"wrap",alignItems:"flex-start",children:[!eo&&(0,a.jsxs)(M.so,{flexDirection:"column",width:[1,.35],children:[(0,a.jsx)(Y,{children:(0,a.jsx)(d.sA,{id:"transaction.details",defaultMessage:"transaction details"})}),(0,a.jsxs)(K,{children:[(0,H.o)({relatedTransactions:t.relatedTransactions,amount:F,platformFee:b,hostFee:C,paymentProcessorFee:S,netAmount:k,isCredit:X,isRefunded:x,hasOrder:Q,toAccount:A,fromAccount:y,taxAmount:t.taxAmount,taxInfo:t.taxInfo,intl:s,kind:Z,expense:U,isRefund:g,paymentProcessorCover:er}),["CONTRIBUTION","ADDED_FUNDS","EXPENSE"].includes(t.kind)&&(0,a.jsxs)(n.Fragment,{children:[ei&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)("br",{}),(0,a.jsx)(d.sA,{id:"TransactionDetails.PaymentProcessorFee",defaultMessage:"This transaction includes {amount} payment processor fees",values:{amount:(0,a.jsx)(V.A,{amount:ei.netAmount.valueInCents,currency:ei.netAmount.currency,showCurrencyCode:!1})}})]}),ea&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)("br",{}),(0,a.jsx)(d.sA,{id:"TransactionDetails.HostFee",defaultMessage:"This transaction includes {amount} host fees",values:{amount:(0,a.jsx)(V.A,{amount:ea.netAmount.valueInCents,currency:ea.netAmount.currency,showCurrencyCode:!1})}})]}),en&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)("br",{}
781),(0,a.jsx)(d.sA,{id:"TransactionDetails.Tax",defaultMessage:"This transaction includes {amount} {taxName}",values:{taxName:en.taxInfo?.name||"Tax",amount:(0,a.jsx)(V.A,{amount:en.netAmount.valueInCents,currency:en.netAmount.currency,showCurrencyCode:!1})}})]})]})]}),D?.memo&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)(Y,{children:[(0,a.jsx)(d.sA,{defaultMessage:"Memo",id:"D5NqQO"})," ",(0,a.jsx)(E.A,{size:12,children:(0,a.jsx)(d.sA,{defaultMessage:"Visible only to Host admins",id:"JM47p6"})})]}),(0,a.jsx)(K,{children:D.memo})]}),D?.processedAt&&(t.kind===m.L.ADDED_FUNDS||!I&&t.kind===m.L.CONTRIBUTION)&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(Y,{children:(0,a.jsxs)("span",{children:[(0,a.jsx)(d.sA,{id:"expense.incurredAt",defaultMessage:"Date"})," ",(0,a.jsx)(P.A,{content:()=>(0,a.jsx)(d.sA,{defaultMessage:"Date the funds were received.",id:"mqg/wj"}),children:(0,a.jsx)($.d,{size:13})})]})}),(0,a.jsx)(K,{children:s.formatDate(D.processedAt,{dateStyle:"long",timeZone:"UTC"})})]}),el&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(Y,{children:(0,a.jsx)(d.sA,{id:"Sz+Qhv",defaultMessage:"Related Transactions"})}),(0,a.jsx)(K,{children:(0,a.jsx)("ul",{className:"list-inside list-disc",children:(0,a.jsx)("li",{children:(0,a.jsxs)(G.m_,{children:[(0,a.jsx)(G.k$,{children:(0,a.jsx)("div",{className:"underline decoration-slate-400 decoration-dashed underline-offset-2 transition-colors hover:decoration-slate-600",children:(0,a.jsx)(d.sA,{defaultMessage:"{amount} tip to the {WebsiteName} platform",id:"NOCt2A",values:{WebsiteName:_.RS,amount:(0,a.jsx)(V.A,{amount:Math.abs(el.netAmount.valueInCents),currency:el.netAmount.currency,showCurrencyCode:!1})}})})}),(0,a.jsx)(G.ZI,{children:(0,a.jsx)(d.sA,{defaultMessage:"This tip was added by the contributor on top of their contribution to help support the {WebsiteName} platform.",id:"WPiq1H",values:{WebsiteName:_.RS}})})]})})})})]})]}),(0,a.jsx)(M.so,{flexDirection:"column",width:[1,.35],children:(0,a.jsxs)(M.az,{children:[(j||I)&&(0,a.jsxs)(n.Fragment,{children:[j&&(0,a.jsxs)(M.az,{children:[(0,a.jsx)(Y,{children:(0,a.jsx)(d.sA,{id:"Fiscalhost",defaultMessage:"Fiscal Host"})}),(0,a.jsx)(K,{children:(0,a.jsx)(N.A,{as:w.A,collective:j})})]}),I&&(0,a.jsxs)(M.az,{children:[(0,a.jsx)(Y,{children:(0,a.jsx)(d.sA,{id:"PaidWith",defaultMessage:"Paid With"})}),(0,a.jsx)(K,{children:(0,a.jsx)(W.A,{type:I.type,fontSize:11,iconSize:16})})]})]}),R&&(0,a.jsxs)(M.az,{children:[(0,a.jsx)(Y,{children:(0,a.jsx)(d.sA,{id:"PaidWith",defaultMessage:"Paid With"})}),(0,a.jsx)(K,{children:(0,a.jsx)(B.A,{type:R.type,color:"inherit",fontWeight:"inherit",fontSize:"inherit",iconSize:16})})]})]})}),e&&(0,a.jsx)(M.so,{flexDirection:"column",width:[1,.3],children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-start gap-2 md:justify-end",children:[(ee||et)&&(ed||ec)&&(0,a.jsx)(T.A,{href:ec?(0,f.PQ)(j,{openTransactionId:o,account:A.slug}):(0,f.jJ)(A,{openTransactionId:o}),children:(0,a.jsx)(q.$n,{variant:"outline",children:(0,a.jsx)(d.sA,{defaultMessage:"View in Dashboard",id:"OpolXQ"})})}),es&&(0,a.jsxs)(q.$n,{"data-loading":r,loading:r,onClick:l({expenseId:U?.id,transactionUuid:v,toCollectiveSlug:A.slug,createdAt:t.createdAt}),variant:"outline","data-cy":"download-transaction-receipt-btn",children:[U&&(0,a.jsx)(d.sA,{id:"DownloadInvoice",defaultMessage:"Download invoice"}),D&&(0,a.jsx)(d.sA,{id:"DownloadReceipt",defaultMessage:"Download receipt"})]})]})})]})},{CONTRIBUTION:X,ADDED_FUNDS:Q,PLATFORM_TIP:ee}=m.L,et=" ⢠",es=(e,t)=>{let s=e.type===m.E.CREDIT,a=null!==e.order,n=e.kind===m.L.EXPENSE,i=e.fromAccount?.slug===t.slug,r=a&&[u.w.PROCESSING,u.w.PENDING].includes(e.order?.status);if(n)return e.netAmount;if(r)return e.amount;if(s&&a)return e.amount;if(!e.isRefunded)return e.netAmount;if(i&&!e.isRefund||e.isRefund&&s)return e.netAmount;else return e.amount},ea=({expense:e,order:t,children:s})=>e?(0,a.jsx)(P.A,{content:(0,a.jsx)(d.sA,{id:"Expense.GoToPage",defaultMessage:"Go to expense page"}),delayHide:0,children:(0,a.jsx)(N.A,{as:T.A,$underlineOnHover:!0,href:`${(0,f.bl)(e.account)}/expenses/${e.legacyId}`,children:s})}):t?(0,a.jsx)(P.A,{content:(0,a.jsx)(d.sA,{id:"Contribution.GoToPage",defaultMessage:"Go to contribution page"}),delayHide:0,children:(0,a.jsx)(N.A,{as:T.A,$underlineOnHover:!0,href:`${(0,f.bl)(t.toAccount)}/contributions/${t.legacyId}`,children:s})}):(0,a.jsx)(n.Fragment,{children:s}),en=(0,c.I4)(S.A).attrs({variant:"rounded-left",type:"grey",mb:"4px",mr:"10px",textTransform:"uppercase",fontSize:"10px",fontWeight:"600"}).withConfig({componentId:"sc-b4e7b34a-0"}
781)([""]),ei=({displayActions:e,collective:t,transaction:s})=>{let c,{toAccount:f,fromAccount:T,giftCardEmitterAccount:S,order:P,expense:O,type:_,kind:D,description:U,createdAt:$,isRefunded:z,isRefund:H}=s,{LoggedInUser:B}=(0,h.A)(),[V,W]=n.useState(!1),q=(0,d.tz)(),G=null!==P,Y=D===m.L.EXPENSE,K=_===m.E.CREDIT,J=K?y.N:y.u,ei=t.legacyId||t.id,er=B&&B.CollectiveId===ei,el=K?T:f,eo=G&&[u.w.PENDING].includes(P?.status),ed=es(s,t),ec=()=>(0,a.jsx)(I.A,{"data-cy":"transaction-details",buttonSize:"tiny",buttonStyle:"secondary",isBorderless:!0,onClick:()=>W(!V),children:(0,a.jsx)(F.L9,{whiteSpace:"nowrap",children:V?(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(d.sA,{id:"closeDetails",defaultMessage:"Close Details"}),"\xa0",(0,a.jsx)(r.r,{size:"1em"})]}):(0,a.jsx)(n.Fragment,{children:(0,a.jsxs)(F.L9,{whiteSpace:"nowrap",children:[(0,a.jsx)(d.sA,{id:"viewDetails",defaultMessage:"View Details"}),"\xa0",(0,a.jsx)(i.y,{size:"1em"})]})})})});return(0,a.jsxs)(J,{"data-cy":"transaction-item",children:[(0,a.jsxs)(M.az,{px:[16,27],py:16,children:[(0,a.jsxs)(M.so,{flexWrap:"wrap",justifyContent:"space-between",children:[(0,a.jsxs)(M.so,{flex:"1",minWidth:"60%",mr:3,children:[(0,a.jsx)(M.az,{mr:3,children:(0,a.jsx)(w.A,{collective:el,withHoverCard:!0,children:(0,a.jsx)(A.Ay,{collective:el,radius:40})})}),(0,a.jsxs)(M.az,{children:[(0,a.jsxs)(j.A,{"data-cy":"transaction-description",fontWeight:"500",fontSize:["14px",null,null,"16px"],lineHeight:["20px",null,null,"24px"],children:[(0,a.jsx)(ea,{expense:O,order:P,children:(0,a.jsx)(F.L9,{fontSize:["14px",null,null,"16px"],title:U,color:U?"black.900":"black.600",children:U?(0,o.A)(U,{length:60}):(0,a.jsx)(d.sA,{id:"NoDescription",defaultMessage:"No description provided"})})}),er&&s.fromAccount?.isIncognito&&(0,a.jsx)(E.A,{className:"ml-1 align-bottom text-muted-foreground",children:(0,a.jsx)(d.sA,{id:"PrivateTransaction",defaultMessage:"This incognito transaction is only visible to you"})})]}),(0,a.jsxs)(F.P,{mt:"4px",fontSize:"12px",lineHeight:"20px",color:"black.700","data-cy":"transaction-details",children:[(0,g.fO)(q,s.type),"\xa0",(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(d.sA,{id:"Transaction.from",defaultMessage:"from {name}",values:{name:(0,a.jsx)(N.A,{as:w.A,withHoverCard:!0,collective:T},"name")}}),"\xa0"]}),(0,a.jsx)(d.sA,{id:"Transaction.to",defaultMessage:"to {name}",values:{name:(0,a.jsx)(N.A,{as:w.A,withHoverCard:!0,collective:f},"name")}}),S&&(0,a.jsxs)(n.Fragment,{children:["\xa0",(0,a.jsx)(d.sA,{id:"transaction.usingGiftCardFrom",defaultMessage:"using a {giftCard} from {collective}",values:{giftCard:(0,a.jsx)(b.A,{term:b.i.GIFT_CARD,textTransform:"lowercase"},"gift-card"),collective:(0,a.jsx)(N.A,{as:w.A,withHoverCard:!0,collective:S},"collective")}})]}),et,(0,a.jsx)(v.A,{value:$,"data-cy":"transaction-date"}),Y&&O?.comments?.totalCount>0&&(0,a.jsxs)(n.Fragment,{children:[et,(0,a.jsxs)("span",{children:[(0,a.jsx)(l.v,{size:"16px"}),"\xa0",O.comments.totalCount]})]})]})]})]}),(0,a.jsxs)(M.so,{flexDirection:["row","column"],mt:[3,0],flexWrap:"wrap",alignItems:["center","flex-end"],children:[(0,a.jsxs)(j.A,{display:"flex",my:2,mr:[3,0],minWidth:100,justifyContent:"flex-end","data-cy":"transaction-amount",fontSize:"16px",ml:"auto",children:[(0,a.jsx)(k.A,{isCredit:K}),(0,a.jsx)(F.L9,{fontWeight:"bold",color:"black.900",mr:1,fontSize:"16px",children:(0,x.vv)(Math.abs(ed.valueInCents),ed.currency,{locale:q.locale})}),(0,a.jsx)(F.L9,{color:"black.700",textTransform:"uppercase",fontSize:"16px",children:ed.currency})]}),G&&(0,a.jsx)(L,{transaction:s,fontSize:"12px",fontWeight:"bold",lineHeight:"16px",letterSpacing:"0.06em",px:"6px",py:"2px"})," ",Y&&(c=z?"REFUNDED":H?"COMPLETED":O?.status||p.Drj.PAID,(0,a.jsx)(C.A,{status:c,fontSize:"12px",fontWeight:"bold",lineHeight:"16px",letterSpacing:"0.06em",px:"6px",py:"2px"}))]})]}),G&&[X,Q,ee].includes(s.kind)&&(0,a.jsxs)(j.A,{borderTop:["1px solid #E8E9EB","none"],mt:3,pt:[2,0],children:[(0,a.jsxs)(en,{children:[(0,g.Dd)(q,s.kind),!!P?.legacyId&&` #${P.legacyId}`]}),(!eo||s.paymentMethod)&&ec()]}),Y&&(0,a.jsxs)(j.A,{display:"flex",mt:3,pt:[2,0],children:[(0,a.jsx)(R.A,{expense:O}),ec()]}),!Y&&(!G||![X,Q,ee].includes(s.kind))&&(0,a.jsx)(j.A,{mt:3,pt:[2,0],children:(0,a.jsx)(en,{children:(0,g.Dd)(q,s.kind)})})]}),V&&(G||Y)&&(0,a.jsx)(Z,{displayActions:e,transaction:s})]})}},50427:(e,t,s)=>{s.d(t,{A:()=>f});var a=s(37876),n=s(14232),i=s(62449),r=s(2948),l=s(56615),o=s(33123),d=s(61288),c=s(97268),u=s(97569),m=s(31934),x=s(28561),p=s(7585),h=s(80207);let g=(0,i.YK)({reasonPlaceholder:{defaultMessage:"e.g. Failed transfer",id:"mOdpl+"}});function f({expense:e,open:t,setOpen:s,onSuccess:A,onCloseFocusRef:y}){let j=(0,i.tz)(),v=n.useMemo(()=>e.type===o.RBD.CHARGE?[{value:o.Z42.ERROR,label:(0,d.F8)(j,o.Drj.ERROR)}]:[{value:o.Z42.APPROVED,label:(0,d.F8)(j,o.Drj.APPROVED)},{value:o.Z42.INCOMPLETE,label:(0,d.F8)(j,o.Drj.INCOMPLETE)},{value:o.Z42.ERROR,label:(0,d.F8)(j,o.Drj.ERROR)}],[j,e]),[b,C]=n.useState(v[0]),[M,E]=n.useState(!1),[T,w]=n.useState(),[I,N]=n.useState(!0),[S,P]=n.useState(!1),R=(0,l.A)({expense:e}),F=n.useCallback(async()=>
781{try{P(!0),await R.markAsUnpaid({paymentParams:{markAsUnPaidStatus:b.value,shouldRefundPaymentProcessorFee:I},message:T}),A?.(),s(!1)}catch(e){(0,h.o)({variant:"error",message:(0,r.Rp)(j,e)})}finally{P(!1)}},[R,b,I,T,j,A,s]);return(0,a.jsx)(u.Lt,{open:t,onOpenChange:s,children:(0,a.jsxs)(u.EO,{id:"mark-expense-as-unpaid-modal","data-cy":"mark-expense-as-unpaid-modal",onCloseAutoFocus:e=>{y?.current&&(e.preventDefault(),y.current.focus())},className:"max-w-md",children:[(0,a.jsxs)(u.wd,{children:[(0,a.jsx)(u.r7,{children:(0,a.jsx)(i.sA,{id:"Expense.markAsUnpaid",defaultMessage:"Mark expense as unpaid"})}),(0,a.jsx)(u.$v,{children:(0,a.jsx)(i.sA,{id:"Expense.markAsUnpaid.details",defaultMessage:"The amount will be credited back to the Collective balance."})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(x.J,{htmlFor:"new-expense-status",className:"mb-2",children:(0,a.jsx)(i.sA,{id:"Expense.markAsUnpaid.newStatus",defaultMessage:"New status"})}),(0,a.jsxs)(p.l6,{value:b.value,onValueChange:e=>{let t=v.find(t=>t.value===e);t&&C(t)},children:[(0,a.jsx)(p.bq,{id:"new-expense-status",children:(0,a.jsx)(p.yv,{})}),(0,a.jsx)(p.gC,{children:v.map(e=>(0,a.jsx)(p.eb,{value:e.value,children:e.label},e.value))})]})]}),(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(m.S,{id:"processorFeeRefunded",name:"processorFeeRefunded",checked:I,onCheckedChange:e=>N(!!e)}),(0,a.jsx)(x.J,{htmlFor:"processorFeeRefunded",className:"cursor-pointer font-normal",children:(0,a.jsx)(i.sA,{id:"processorFeeRefunded.checkbox.label",defaultMessage:"Also refund payment processor fees?"})})]}),(0,a.jsx)("div",{children:(0,a.jsx)(c.default,{"data-cy":"confirm-action-text",kind:"COMMENT",version:"simplified",withBorders:!0,editorMinHeight:100,placeholder:j.formatMessage(g.reasonPlaceholder),fontSize:"13px",onChange:e=>w(e.target.value),setUploading:E})})]}),(0,a.jsxs)(u.ck,{children:[(0,a.jsx)(u.Zr,{disabled:S||M,children:(0,a.jsx)(i.sA,{id:"actions.cancel",defaultMessage:"Cancel"})}),(0,a.jsx)(u.Rx,{variant:"destructive",loading:S,disabled:M,"data-cy":"confirmation-modal-continue",onClick:async e=>{e.preventDefault(),await F()}
781,children:(0,a.jsx)(i.sA,{id:"expense.markAsUnpaid.btn",defaultMessage:"Mark as unpaid"})})]})]})})}},51761:(e,t,s)=>{s.d(t,{A:()=>l});var a=s(37876);s(14232);var n=s(2587),i=s(6612),r=s(13408);let l=({value:e,onChange:t,onBlur:s=null,clamp:l=!0,...o})=>(0,a.jsx)(r.A,{append:"%",type:"number",min:"0",max:"100",appendProps:{color:"black.600"},fontWeight:"normal",maxWidth:100,step:"0.01",...o,value:isNaN(e)?"":e,onChange:e=>t(parseFloat(e.target.value)),onWheel:e=>{e.preventDefault(),e.target.blur()},onBlur:a=>{let r=(0,n.A)(parseFloat(a.target.value),2),o=l?(0,i.A)(r,0,100):r;t(isNaN(o)?e:o),s&&s(a)}})},53671:(e,t,s)=>{s.d(t,{A:()=>C});var a=s(37876),n=s(14232),i=s(31467),r=s(97133),l=s(46654),o=s(62449),d=s(5646),c=s(23968),u=s(6435),m=s(30988),x=s(2038),p=s(56593),h=s(89641),g=s(2996),f=s(99202),A=s(62939),y=s(72945);let j=(0,d.Ay)(p.A).attrs(e=>({color:e.color||"black.700"})).withConfig({componentId:"sc-25adca4-0"})(["font-size:12px;line-height:16px;font-weight:500;text-transform:uppercase;margin-bottom:8px;display:flex;align-items:center;"]),v=({amount:e,...t})=>(0,a.jsx)(y.P,{fontSize:"16px",lineHeight:"24px",color:"black.700",children:(0,a.jsx)(g.A,{amountClassName:"font-bold",amount:e||null,...t})}),b=d.Ay.div.withConfig({componentId:"sc-25adca4-1"})(["flex:1;padding:16px 32px;svg{margin-right:5px;vertical-align:bottom;}"," border-color:#dcdee0;",""],e=>e.$isMain&&(0,d.AH)(["background:#f7f8fa;"]),c.PQ),C=n.memo(({collective:e,stats:t,horizontal:s})=>{let{locale:d}=(0,o.tz)();if(!t)return null;let c=e.type===m.Td.FUND,g=!e.isHost&&(0,u.Lb)(e),C=["1px solid #dcdee0","none",s?null:"1px solid #dcdee0"];return(0,a.jsx)(A.A,{display:"flex",flex:[null,null,"1 1 300px"],width:"100%",flexDirection:["column","row",s?null:"column"],mb:2,children:g?(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)(b,{"data-cy":"budgetSection-total-contributed",children:[(0,a.jsxs)(j,{children:["â\xa0",(0,a.jsx)(o.sA,{defaultMessage:"Total contributed",id:"RogA5E"})]}),(0,a.jsx)(v,{amount:Math.abs(t.totalAmountSpent.valueInCents),currency:t.totalAmountSpent.currency})]}),(0,a.jsxs)(b,{"data-cy":"budgetSection-total-paid-expenses",borderTop:C,children:[(0,a.jsxs)(j,{children:["â\xa0",(0,a.jsx)(o.sA,{defaultMessage:"Total received with expenses",id:"Nqhan+"})]}),(0,a.jsx)(v,{amount:t.totalPaidExpenses.valueInCents,currency:t.totalPaidExpenses.currency})]})]}):(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)(b,{"data-cy":"budgetSection-today-balance",$isMain:!0,children:[(0,a.jsxs)(j,{children:[(0,a.jsx)(p.A,{display:"inline-block",fontSize:"11px",mr:"5px",fontWeight:"500",width:"12px",textAlign:"center",children:(0,x.Qn)(e.currency)}),[m.Td.PROJECT,m.Td.EVENT].includes(e.type)?(0,a.jsx)(y.L9,{textTransform:"uppercase",color:"black.700",children:(0,a.jsx)(o.sA,{id:"CollectivePage.SectionBudget.Balance",defaultMessage:"Todayâs balance"})}):(0,a.jsx)(h.A,{term:h.i.BALANCE,textTransform:"uppercase",color:"black.700",extraTooltipContent:t.consolidatedBalance&&(0,a.jsx)(n.Fragment,{children:(0,a.jsx)(f.az,{mt:2,children:(0,a.jsx)(o.sA,{id:"budgetSection-balance-consolidated",defaultMessage:"Total consolidated including Projects and Events: {amount}",values:{amount:(0,x.vv)(t.consolidatedBalance.valueInCents||0,e.currency,{locale:d})}})})})})]}),(0,a.jsx)(v,{amount:t.balance.valueInCents,currency:e.currency})]}),(0,a.jsxs)(b,{borderTop:C,children:[(0,a.jsxs)(j,{children:[(0,a.jsx)(r.U,{size:"12px"}),e.isHost?(0,a.jsx)(h.A,{term:h.i.TOTAL_INCOME,textTransform:"uppercase",color:"black.700"}):(0,a.jsx)(h.A,{term:h.i.TOTAL_RAISED,textTransform:"uppercase",color:"black.700",extraTooltipContent:(0,a.jsx)(f.az,{mt:2,children:(0,a.jsx)(o.sA,{id:"budgetSection-raised-total",defaultMessage:"Total contributed before fees: {amount}",values:{amount:(0,x.vv)(t.totalAmountRaised.valueInCents||0,t.totalAmountRaised.currency,{locale:d})}})})})]}),(0,a.jsx)(v,{amount:t.totalNetAmountRaised.valueInCents,currency:t.totalNetAmountRaised.currency})]}),(0,a.jsxs)(b,{borderTop:C,children:[(0,a.jsxs)(j,{children:[(0,a.jsx)(l.A,{size:"12px"}),(0,a.jsx)(o.sA,{id:"budgetSection-disbursed",defaultMessage:"Total disbursed"})]}),(0,a.jsx)(v,{amount:t.totalNetAmountRaised.valueInCents-t.balance.valueInCents,currency:e.currency})]}),!c&&t.totalAmountReceived&&t.yearlyBudget&&t.activeRecurringContributions&&(0,a.jsxs)(b,{"data-cy":"budgetSection-estimated-budget",borderTop:C,children:[(0,a.jsxs)(j,{children:[(0,a.jsx)(i.V,{size:"12px"}),(0,a.jsx)(h.A,{term:h.i.ESTIMATED_BUDGET,textTransform:"uppercase",color:"black.700",extraTooltipContent:(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(f.az,{mt:2,children:(0,a.jsx)(o.sA,{id:"CollectivePage.SectionBudget.MonthlyRecurringAmount",defaultMessage:"Monthly recurring: {amount}",values:{amount:(0,x.vv)((t.activeRecurringContributions?.monthly||0)+(t.activeRecurringContributions?.
781yearly||0)/12,e.currency,{locale:d})}})}),(0,a.jsx)(f.az,{mt:2,children:(0,a.jsx)(o.sA,{id:"CollectivePage.SectionBudget.TotalAmountReceived",defaultMessage:"Total received in the last 12 months: {amount}",values:{amount:(0,x.vv)(t.totalAmountReceived.valueInCents||0,e.currency,{locale:d})}})})]})})]}),(0,a.jsx)(v,{amount:t.yearlyBudget.valueInCents,currency:e.currency})]})]})})})},55234:(e,t,s)=>{s.d(t,{A:()=>A,U:()=>f});var a=s(37876);s(14232);var n=s(70496),i=s(70580),r=s(97075),l=s(18343),o=s(62449),d=s(52170),c=s(41607),u=s(83213),m=s(49030),x=s(99202),p=s(41955),h=s(72945);let g={[d.GG.GIFTCARD]:({color:e,...t})=>(0,a.jsx)(u.A,{color:e||"#9D9FA3",...t}),[d.GG.CREDITCARD]:({color:e,...t})=>(0,a.jsx)(r.y,{color:e||"#9D9FA3",...t}),[d.GG.PAYMENT]:({color:e,...t})=>(0,a.jsx)(n.c,{color:e||"#192f86",...t}),[d.GG.SUBSCRIPTION]:({color:e,...t})=>(0,a.jsx)(n.c,{color:e||"#192f86",...t}),[d.GG.PAYMENT_INTENT]:({color:e,...t})=>(0,a.jsx)(i.p,{color:e||"#6772e5",...t}),OTHER:({color:e,...t})=>(0,a.jsx)(l.D,{color:e||"#9D9FA3",...t})},f=({type:e})=>{let t=(0,o.tz)();return({[d.GG.PAYMENT]:"PayPal",[d.GG.SUBSCRIPTION]:"PayPal",[d.GG.PAYMENT_INTENT]:"Stripe Payment Intent"})[e]||(0,c._)(t,e)||(0,a.jsx)(o.sA,{id:"user.Unknown",defaultMessage:"Unknown"})},A=({isLoading:e,type:t,color:s,iconSize:n=24,iconOnly:i})=>{if(e)return(0,a.jsx)(p.A,{height:15,width:90});let r=g[t]||g.OTHER,l=(0,a.jsx)(f,{type:t});return i?(0,a.jsxs)(m.m_,{children:[(0,a.jsxs)(m.k$,{className:"cursor-help align-middle",children:[(0,a.jsx)(r,{size:n,color:s})," "]}),(0,a.jsx)(m.ZI,{children:l})]}):(0,a.jsxs)(x.so,{alignItems:"center",children:[(0,a.jsx)(r,{size:n,color:s}),(0,a.jsx)(h.L9,{ml:2,children:l})]})}},55573:(e,t,s)=>{s.d(t,{H:()=>d});var a=s(37876);s(14232);var n=s(62449),i=s(33341),r=s(34679),l=s(2996),o=s(20058);let d=({transactionsImportRow:e,className:t})=>(0,a.jsxs)("div",{className:t,children:[(0,a.jsx)("div",{className:"mb-2 text-base font-medium text-slate-700",children:(0,i._W)((0,a.jsx)(n.sA,{defaultMessage:"Based on a {amount} {type, select, DEBIT {debit} other {credit}} from {date}",id:"basedOnImportRow",values:{amount:(0,a.jsx)(l.A,{amount:Math.abs(e.amount.valueInCents),currency:e.amount.currency}),type:e.amount.valueInCents<0?"DEBIT":"CREDIT",date:(0,a.jsx)(r.A,{value:e.date})}}))}),(0,a.jsx)("div",{className:"text-sm",children:(0,a.jsx)(o.F,{row:e,transactionsImport:e.transactionsImport,collapsible:!0})})]})},56615:(e,t,s)=>{s.d(t,{A:()=>o});var a=s(14232),n=s(64177),i=s(84611),r=s(11046);let l=(0,r.J1)` 782 mutation ProcessExpense( 783 $id: String 784 $legacyId: Int 785 $action: ExpenseProcessAction! 786 $message: String 787 $draftKey: String 788 $paymentParams: ProcessExpensePaymentParams 789 ) { 790 processExpense( 791 expense: { id: $id, legacyId: $legacyId } 792 action: $action 793 message: $message 794 paymentParams: $paymentParams 795 draftKey: $draftKey 796 ) { 797 id 798 ...ExpensePageExpenseFields 799 } 800 } 801 802 ${i.nN} 803`;function o(e){let[t,s]=a.useState(null),[i,r]=(0,n.n)(l,{refetchQueries:["ExpensePage"]}),o=a.useMemo(()=>t=>async({paymentParams:a,message:n,draftKey:r}={})=>{s(t);let l={id:e.expense.id,legacyId:e.expense.legacyId,action:t,paymentParams:a,message:n,draftKey:r};try{let e=await i({variables:l});return e.data?.processExpense}finally{s(null)}},[e.expense?.id,e.expense?.legacyId,i]),d=a.useMemo(()=>o("APPROVE"),[o]),c=a.useMemo(()=>o("REJECT"),[o]),u=a.useMemo(()=>o("PAY"),[o]),m=a.useMemo(()=>o("MARK_AS_SPAM"),[o]),x=a.useMemo(()=>o("UNAPPROVE"),[o]),p=a.useMemo(()=>o("MARK_AS_UNPAID"),[o]),h=a.useMemo(()=>o("MARK_AS_INCOMPLETE"),[o]),g=a.useMemo(()=>o("UNSCHEDULE_PAYMENT"),[o]),f=a.useMemo(()=>o("REQUEST_RE_APPROVAL"),[o]),A=a.useMemo(()=>o("HOLD"),[o]),y=a.useMemo(()=>o("RELEASE"),[o]),j=a.useMemo(()=>o("DECLINE_INVITED_EXPENSE"),[o]);return{loading:r.loading,currentAction:t,approve:d,reject:c,pay:u,markAsSpam:m,unapprove:x,markAsUnpaid:p,markAsIncomplete:h,requestReApproval:f,unschedulePayment:g,hold:A,release:y,declineInvitation:j}}},58581:(e,t,s)=>{s.d(t,{A:()=>A});var a=s(37876),n=s(14232),i=s(64177),r=s(62449),l=s(5646),o=s(2948),d=s(11046),c=s(9832),u=s(80207),m=s(96487),x=s(99202),p=s(74143);let h=(0,d.J1)` 804 mutation SetTags($order: OrderReferenceInput, $expense: ExpenseReferenceInput, $tags: [String!]!) { 805 setTags(expense: $expense, order: $order, tags: $tags) { 806 order { 807 id 808 tags 809 } 810 expense { 811 id 812 tags 813 } 814 } 815 } 816`,g=({expense:e,order:t,suggestedTags:s})=>{let[l,{loading:d}]=(0,i.n)(h),x=e?.tags||t?.tags,{toast:p}=(0,u.d)(),g=(0,r.tz)(),f=n.useCallback(async s=>{try{let a=e?{expense:{id:e.id}}:{order:{id:t.id}};await l({variables:{...a,tags:s.map(e=>e.value)}})}catch(e){p({variant:"error",message:(0,o.Rp)(g,e)})}},[e,t]);return e?(0,a.jsx)(m.C,{disabled:d,value:x,query:c.A8,variables:{account:{slug:e?.account?.slug}},onChange:f}):(0,a.jsx)(m.A,{disabled:d,value:x,suggestedTags:s,onChange:f})},f=(0,l.I4)(p.A).attrs({variant:"rounded-right"}).withConfig({componentId:"sc-3e0ac367-0"})([""]),A=({expense:e=null,order:t=null,limit:s=4,getTagProps:i,children:l,canEdit:o=!1,suggestedTags:d,showUntagged:u=!1})=>{let m=(0,r.tz)(),p=e?.tags||t?.tags,h=({tag:e,label:t})=>{let s=i?.(e)||{},n=(0,a.jsx)(f,{"data-cy":"expense-tag",...s,children:t??e},e);return l?l({key:e,tag:e,renderedTag:n,props:s}):n};return(0,a.jsx)(x.so,{flexWrap:"wrap",alignItems:"flex-start",ga
816p:2,children:o?(0,a.jsx)(g,{expense:e,order:t,suggestedTags:d}):p&&(0,a.jsxs)(n.Fragment,{children:[p.slice(0,s).map(e=>h({tag:e})),u&&h({tag:c.gh,label:m.formatMessage((0,r.zR)({defaultMessage:"Untagged",id:"8/OT+O"}))}),p.length>s&&(0,a.jsx)(f,{color:"black.600",title:p.slice(s).join(", "),children:(0,a.jsx)(r.sA,{id:"expenses.countMore",defaultMessage:"+ {count} more",values:{count:p.length-s}})})]})})}},62301:(e,t,s)=>{s.d(t,{A:()=>v});var a=s(37876),n=s(14232),i=s(43647),r=s(64487),l=s(51131),o=s(54282),d=s(61872),c=s(62449),u=s(16240),m=s(4372),x=s(56593),p=s(65221),h=s(41955),g=s(49294),f=s(49030);let A=e=>Object.entries(e).reduce((e,[t,s])=>"object"==typeof s?[...e,...A(s)]:[...e,(0,a.jsxs)("p",{className:"text-sm leading-5 text-ellipsis",children:[(0,a.jsx)(c.sA,{id:"withColon",defaultMessage:"{item}:",values:{item:(0,i.A)(t)}})," ",s]},t)],[]),y="********",j=(e,t,s)=>s?(0,a.jsx)(h.A,{height:15}):(0,r.A)(e,`data.${t}`,y),v=({payoutMethod:e,showLabel:t=!0,isLoading:s=!1})=>{let i=(0,c.tz)();if(s&&!e)return(0,a.jsx)(h.A,{height:24,mb:2});if(!e)return null;switch(e.type){case u.UC.PAYPAL:{let r=e.isVerified,l=e.data?.verifiedAt;return(0,a.jsxs)("div",{children:[s?null:r?(0,a.jsxs)(f.m_,{children:[(0,a.jsx)(f.k$,{asChild:!0,children:(0,a.jsxs)(g.E,{type:"success",size:"xs",className:"mb-2 cursor-help px-2",children:[(0,a.jsx)(o.A,{size:12}),l?(0,a.jsx)(c.sA,{defaultMessage:"Verified on {date}",id:"FJwSTB",values:{date:(0,a.jsx)(c.XU,{value:l,dateStyle:"short"})}}):(0,a.jsx)(c.sA,{defaultMessage:"Verified",id:"Z8971h",values:{service:"PayPal"}})]})}),(0,a.jsx)(f.ZI,{className:"max-w-xs font-normal",children:(0,a.jsx)(c.sA,{defaultMessage:"This user connected their PayPal account, confirming ownership of this email address.",id:"PayoutMethod.PayPal.VerifiedTooltip"})})]}):(0,a.jsxs)(f.m_,{children:[(0,a.jsx)(f.k$,{asChild:!0,children:(0,a.jsxs)(g.E,{type:"warning",size:"xs",className:"mb-2 cursor-help",children:[(0,a.jsx)(d.A,{size:12}),(0,a.jsx)(c.sA,{defaultMessage:"Unverified account",id:"VlBhuE"})]})}),(0,a.jsx)(f.ZI,{className:"max-w-xs font-normal",children:(0,a.jsx)(c.sA,{defaultMessage:"This email has not been verified through PayPal.",id:"PayoutMethod.PayPal.UnverifiedTooltip"})})]}),t&&(0,a.jsxs)(x.A,{fontSize:"14px",fontWeight:"700",mb:2,children:[(0,a.jsx)(c.sA,{defaultMessage:"Account details",id:"utJA9s"}),"\xa0\xa0",(0,a.jsx)(p.A,{})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"overflow-hidden text-sm text-ellipsis text-slate-700",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-slate-700",children:(0,a.jsx)(c.sA,{id:"withColon",defaultMessage:"{item}:",values:{item:(0,a.jsx)(c.sA,{id:"Email",defaultMessage:"Email"})}})}),(0,a.jsx)("div",{className:"text-xs text-slate-700",children:j(e,"email",s)})]}),e.data?.paypalUserInfo&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("div",{className:"overflow-hidden text-sm text-ellipsis text-slate-700",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-slate-700",children:(0,a.jsx)(c.sA,{id:"withColon",defaultMessage:"{item}:",values:{item:(0,a.jsx)(c.sA,{id:"Fields.name",defaultMessage:"Name"})}})}),(0,a.jsx)("div",{className:"text-xs text-slate-700",children:j(e,"paypalUserInfo.name")})]})," ",(0,a.jsxs)("div",{className:"overflow-hidden text-sm text-ellipsis text-slate-700",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-slate-700",children:(0,a.jsx)(c.sA,{id:"withColon",defaultMessage:"{item}:",values:{item:(0,a.jsx)(c.sA,{defaultMessage:"{service} ID",id:"Az5g+0",values:{service:"PayPal"}})}})}),(0,a.jsx)("div",{className:"text-xs text-slate-700",children:j(e,"paypalUserInfo.payer_id")})]}),(0,a.jsxs)("div",{className:"overflow-hidden text-sm text-ellipsis text-slate-700",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-slate-700",children:(0,a.jsx)(c.sA,{id:"withColon",defaultMessage:"{item}:",values:{item:(0,a.jsx)(c.sA,{id:"collective.country.label",defaultMessage:"Country"})}})}),(0,a.jsx)("div",{className:"text-xs text-slate-700",children:e.data.paypalUserInfo.address?.country?(0,a.jsxs)(g.E,{size:"xs",children:[(0,m.tO)(e.data.paypalUserInfo.address.country),"\xa0",(0,m.ob)(i,e.data.paypalUserInfo.address.country)]}):(0,a.jsx)("i",{children:(0,a.jsx)(c.sA,{defaultMessage:"Unknown",id:"Unknown"})})})]})]})]})]})}case u.UC.OTHER:return(0,a.jsxs)("div",{children:[t&&(0,a.jsxs)(x.A,{fontSize:"14px",fontWeight:"700",mb:2,children:[(0,a.jsx)(c.sA,{id:"Details",defaultMessage:"Details"}),"\xa0\xa0",(0,a.jsx)(p.A,{})]}),(0,a.jsx)(x.A,{className:"overflow-hidden text-ellipsis",fontSize:"14px",color:"black.700",children:j(e,"content",s)})]});case u.UC.BANK_ACCOUNT:return(0,a.jsxs)("div",{children:[t&&(0,a.jsxs)(x.A,{fontSize:"14px",fontWeight:"700",mb:2,children:[(0,a.jsx)(c.sA,{id:"Details",defaultMessage:"Details"}),"\xa0\xa0",(0,a.jsx)(p.A,{})]}),e.data?(0,a.jsxs)(x.A,{fontSize:"14px",color:"black.700",children:[(0,a.jsx)(c.sA,{id:"BankInfo.Type",defaultMessage:"Type: {type}",values:{type:(0,l.A)(e.data.type)}}),e.data.accountHolderName&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)("br",{}),(0,a.jsx)(c.sA,{id:"BankInfo.AccountHolder",defaultMessage:"Account Holder: {name}",values:{name:e.data.accountHolderName}})]}),e.data.details&&A(e.data.details)]}):s?(0,a.jsx)(h.A,{height:"1.5em"}):y]});default:return null}}},62715:(e,t,s)=>{s.d(t,{A:()=>
816o});var a=s(37876),n=s(14232),i=s(49030),r=s(30619),l=s(38268);let o=({accounts:e=[],imageSize:t,maxDisplayedAvatars:s=3,maxHiddenToDisplayInTooltip:o=15,withHoverCard:d})=>{let[c,u]=n.useState(!1),m=`${t}px`,x=`-${t/3}px`,p=e.length>s?e.slice(0,s-1):e,h=e.slice(p.length),g=h.slice(0,o);return(0,a.jsxs)("div",{className:"flex items-center",children:[p.map(e=>(0,a.jsx)("div",{className:"flex items-center first:ml-0!",style:{marginLeft:x},children:(0,a.jsx)(l.A,{collective:e,withHoverCard:!!d,hoverCardProps:{includeAdminMembership:"object"==typeof d&&!!d.includeAdminMembership&&e.slug},children:(0,a.jsx)(r.Ay,{collective:e,radius:t,displayTitle:!0,className:"border border-solid border-white"})})},e.id||e.slug)),h.length?(0,a.jsxs)(i.m_,{open:c,onOpenChange:u,children:[(0,a.jsx)(i.k$,{children:(0,a.jsxs)("div",{className:"flex items-center justify-center rounded-full bg-blue-50 text-[11px] font-semibold text-blue-400 first:ml-0",style:{width:m,height:m,marginLeft:x},children:["+",h.length]})}),c&&(0,a.jsx)(i.ZI,{children:(0,a.jsx)("div",{className:"flex max-w-2xs flex-wrap items-center gap-2 py-2",children:g.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(r.Ay,{collective:e,radius:12,className:"mr-1"}),(0,a.jsx)(l.A,{collective:e,noTitle:!0}),t<g.length-1?",":t===h.length-1?".":`, ...${h.length-g.length} more.`]},e.id||e.slug))})})]}):null]})}},63598:(e,t,s)=>{s.d(t,{l:()=>l,n:()=>d});var a=s(62449),n=s(6636),i=s(33123);let r=(0,a.YK)({ALL:{id:"orders.all",defaultMessage:"All"},[n.w.CANCELLED]:{id:"Subscriptions.Cancelled",defaultMessage:"Canceled"},[n.w.DISPUTED]:{id:"order.disputed",defaultMessage:"Disputed"},[n.w.ERROR]:{id:"Error",defaultMessage:"Error"},[n.w.EXPIRED]:{id:"order.expired",defaultMessage:"Expired"},[n.w.IN_REVIEW]:{id:"order.in_review",defaultMessage:"In Review"},[n.w.PAUSED]:{id:"order.paused",defaultMessage:"Paused"},[n.w.PENDING]:{id:"order.pending",defaultMessage:"Pending"},[n.w.NEW]:{id:"order.new",defaultMessage:"New"},[n.w.REQUIRE_CLIENT_CONFIRMATION]:{id:"order.require_client_confirmation",defaultMessage:"Require client confirmation"},[n.w.ACTIVE]:{id:"Subscriptions.Active",defaultMessage:"Active"},[n.w.REFUNDED]:{id:"Order.Status.Refunded",defaultMessage:"Refunded"},[n.w.REJECTED]:{id:"order.rejected",defaultMessage:"Rejected"},[n.w.PAID]:{id:"order.paid",defaultMessage:"Paid"},[n.w.PROCESSING]:{id:"processing",defaultMessage:"Processing"}}),l=(e,t)=>
816{let s=r[t];return s?e.formatMessage(s):t},o=(0,a.YK)({[i.zYj.ONETIME]:{id:"Frequency.OneTime",defaultMessage:"One time"},[i.zYj.MONTHLY]:{id:"Frequency.Monthly",defaultMessage:"Monthly"},[i.zYj.YEARLY]:{id:"Frequency.Yearly",defaultMessage:"Yearly"}}),d=(e,t)=>{let s=o[t];return s?e.formatMessage(s):t}},65202:(e,t,s)=>{s.d(t,{A:()=>R});var a=s(37876),n=s(14232),i=s(62965),r=s(21651),l=s(12815),o=s(23411),d=s(9514),c=s(70382),u=s(72632),m=s(16823),x=s(41616),p=s(18847),h=s.n(p),g=s(62449),f=s(5646),A=s(87881),y=s(21988),j=s(63037),v=s(99202),b=s(41955),C=s(61270),M=s(72945),E=s(64278);let T=h()(()=>Promise.all([s.e(5049),s.e(8233),s.e(5428),s.e(3572)]).then(s.bind(s,23572)),{loadableGenerated:{webpack:()=>[23572]},ssr:!1,loading:()=>(0,a.jsx)(b.A,{})}),w=f.I4.div.withConfig({componentId:"sc-826f1d09-0"})(["position:absolute;top:0;right:0;left:0;z-index:3500;display:flex;align-items:center;justify-content:space-between;color:white;background:linear-gradient(to bottom,rgba(15,23,42,0.8) 0%,transparent 100%);height:74px;padding:16px;"]),I=f.I4.div.withConfig({componentId:"sc-826f1d09-1"})(["max-width:100%;z-index:3000;"]),N=f.I4.button.withConfig({componentId:"sc-826f1d09-2"})(["outline:none;color:white;background:rgba(0,0,0,0.7);border:none;position:absolute;z-index:3002;border-radius:999px;
816height:40px;width:40px;margin:16px;cursor:pointer;justify-content:center;align-items:center;display:",";"," &:hover{background:",";}&:focus{background:",";}"],e=>e.disabled?"none":"flex",e=>e.direction&&(0,f.AH)(["position:absolute;",";"],"left"===e.direction?"left: 0":"right: 0"),(0,r.y)("colors.primary.700"),(0,r.y)("colors.primary.700")),S=f.I4.button.withConfig({componentId:"sc-826f1d09-3"})(["color:white;border:none;outline:none;background:transparent;z-index:3000;padding:8px;border-radius:99px;&:hover{background:black;color:white;}&:focus-visible{background:black;color:white;}cursor:pointer;"]),P=f.I4.a.withConfig({componentId:"sc-826f1d09-4"})(["display:block;color:white;border:none;outline:none;background:transparent;z-index:3000;padding:8px;border-radius:99px;&:hover{background:black;color:white;}&:focus-visible{background:black;color:white;}cursor:pointer;"]);function R({allowOutsideInteraction:e,onClose:t,parentTitle:s,files:r,openFileUrl:p,canDownload:h=!0,canOpenInNewWindow:f=!0,hideCloseButton:b=!1,setOpenFileUrl:F}){let k=(0,g.tz)(),O=p?r?.findIndex(e=>e.url===p):0,[_,D]=(0,n.useState)(O);n.useEffect(()=>{p&&D(r?.findIndex(e=>e.url===p)??0)},[p,r]);let U=n.useCallback(()=>D(e=>{let t=Math.max(e-1,0);return F?.(r?.[t]?.url||""),t}),[r,F]),L=n.useCallback(()=>D(e=>{let t=Math.min(e+1,(r?.length||1)-1);return F?.(r?.[t]?.url||""),t}),[r,F]);(0,A.Ay)({callback:L,keyMatch:A.Zh}),(0,A.Ay)({callback:U,keyMatch:A.ST});let $=r?.length?r?.[_]:null,z=$?.info?.type||$?.type,H=r?.length||0,B=H>1,V=n.useRef(null);return(0,a.jsx)(j.lG,{modal:!e,open:!0,onOpenChange:e=>{e||t()},children:(0,a.jsxs)(i.UC,{className:"fixed top-0 left-0 z-3000 flex h-screen w-screen items-center justify-center xl:w-[calc(100vw-var(--drawer-width,0px))]",onInteractOutside:t=>{e&&t.preventDefault()},children:[e?(0,a.jsx)("div",{className:(0,l.$)("absolute inset-0 z-1500 backdrop-blur-xs",open?"animate-in fade-in-0":"animate-out fade-out-0"),onClick:t}):(0,a.jsx)(j.LC,{onClick:t,className:"absolute z-1500 backdrop-blur-xs"}),(0,a.jsxs)(w,{children:[(0,a.jsx)(v.az,{px:2,children:(0,a.jsxs)(M.L9,{children:[s?(0,a.jsxs)(M.L9,{letterSpacing:"0",opacity:"70%",children:[s," ",B&&(0,a.jsx)(M.L9,{letterSpacing:"0",children:(0,a.jsx)(g.sA,{id:"CountOfTotalCount",defaultMessage:"{count} of {totalCount}",values:{count:_+1,totalCount:H}})})," ","/"," "]}):null,(0,a.jsx)(M.L9,{children:$?.name?(0,o.A)($.name):""})]})}),(0,a.jsxs)(v.so,{alignItems:"center",gridGap:2,children:[h&&(0,a.jsx)(C.A,{containerCursor:"pointer",noArrow:!0,content:k.formatMessage({id:"Download",defaultMessage:"Download"}),delayHide:0,children:(0,a.jsx)(P,{href:(0,y.hM)($?.url),download:!0,target:"_blank",children:(0,a.jsx)(d.A,{size:24})})}),f&&(0,a.jsx)(C.A,{containerCursor:"pointer",noArrow:!0,content:k.formatMessage({defaultMessage:"Open in new window",id:"b2Wfwm"}),delayHide:0,children:(0,a.jsx)(P,{href:$?.url,target:"_blank",children:(0,a.jsx)(c.A,{size:24})})}),!b&&(0,a.jsx)(C.A,{containerCursor:"pointer",noArrow:!0,content:k.formatMessage({id:"Close",defaultMessage:"Close"}),delayHide:0,children:(0,a.jsx)(S,{onClick:t,children:(0,a.jsx)(u.A,{size:"24","aria-hidden":"true"})})})]})]}),B&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(N,{direction:"left",onClick:U,disabled:!_,children:(0,a.jsx)(m.A,{size:24})}),(0,a.jsx)(N,{direction:"right",onClick:L,disabled:!H||_===H-1,children:(0,a.jsx)(x.A,{size:24})})]}),(0,a.jsx)("div",{className:"z-3000 flex max-h-screen w-full justify-center overflow-y-auto px-4 py-16",onClick:e=>{e.target===e.currentTarget&&t()},children:(0,a.jsx)("div",{className:"flex w-full max-w-full justify-center",ref:V,onClick:e=>{e.target===e.currentTarget&&t()},children:$&&(({url:e,name:t},s)=>{let n,i=["text/csv","text/plain"].includes(z),r="application/pdf"===z;return n=i?(0,a.jsx)(E.A,{size:288,url:e,alt:t,showFileName:!0,fileName:t,color:"black.200"}):r?(0,a.jsx)(T,{pdfUrl:e,contentWrapperRef:s}):(0,a.jsx)("img",{src:e,alt:t,className:"h-auto max-h-[calc(100dvh-74px-10rem)] w-auto max-w-full object-contain"}),(0,a.jsx)(I,{children:n})})($,V)})})]})})}},74820:(e,t,s)=>{s.d(t,{v:()=>A});var a=s(37876);s(14232);var n=s(64177),i=s(36944),r=s(62449),l=s(2948),o=s(20322),d=s(21092),c=s(94547),u=s(1509),m=s(49030),x=s(80207),p=s(15114);let h=(0,o.cn)("red rounded-lg bg-neutral-100 px-3 py-1 text-xs font-medium text-neutral-800"),g=e=>e?e?e.friendlyName||e.name:void 0:(0,a.jsx)(r.sA,{id:"accountingCategory.doNotKnow",defaultMessage:"Unknown category"}),f=({expense:e,account:t,host:s,allowNone:m,showCodeInSelect:f})=>{let A=(0,r.tz)(),[y,{loading:j}]=(0,n.n)(p.Ky),{toast:v}=(0,x.d)();return(0,a.jsx)(d.Ay,{id:"expense-summary-category-select",kind:"EXPENSE",host:s,account:t,expenseType:e.type,expenseValues:e,allowNone:m,selectedCategory:e.accountingCategory,values
816ByRole:e.valuesByRole,showCode:f,predictionStyle:"inline-preload",onChange:async t=>{try{await y({variables:{expenseId:e.id,category:t?{id:t.id}:null}})}catch(e){v({variant:"error",message:(0,l.Rp)(A,e)})}},children:(0,a.jsxs)(u.$n,{className:(0,o.cn)(h,"h-auto max-w-full min-w-0 hover:bg-neutral-50 hover:opacity-90"),children:[(0,a.jsx)("span",{className:"mr-1 max-w-40 truncate",children:g(e.accountingCategory)}),j?(0,a.jsx)(c.A,{size:"1em"}):(0,a.jsx)(i.A,{size:"1em"})]})})},A=({expense:e,host:t,account:s,canEdit:n,editPermission:i,allowNone:l,showCodeInSelect:d=!1})=>{if(n&&t)return(0,a.jsx)(f,{expense:e,account:s,host:t,allowNone:l,showCodeInSelect:d});{let s=(0,a.jsx)("div",{className:(0,o.cn)(h,"truncate"),children:g(e.accountingCategory)});return i?.reason==="EXPENSE_BELONGS_TO_DIFFERENT_HOST"?(0,a.jsxs)(m.m_,{children:[(0,a.jsx)(m.k$,{asChild:!0,children:(0,a.jsx)("div",{className:(0,o.cn)(h,"cursor-help truncate"),children:g(e.accountingCategory)})}),(0,a.jsx)(m.ZI,{className:"max-w-lg",children:(0,a.jsx)(r.sA,{id:"expense.accountingCategory.differentHostTooltip",defaultMessage:"This expense was processed by a different host ({hostName}), you don't have permission to recategorize it.",values:{hostName:t?.name||t?.slug}})})]}):s}}},75200:(e,t,s)=>{s.d(t,{A:()=>r});var a=s(62449),n=s(44993);let i=(0,a.YK)({[n.Z_.TOP_FINANCIAL_CONTRIBUTORS]:{id:"SectionContribute.TopContributors",defaultMessage:"Top financial contributors"},[n.Z_.CONNECTED_COLLECTIVES]:{id:"ConnectedCollectives",defaultMessage:"Connected Collectives"},[n.Z_.OUR_TEAM]:{id:"OurTeam",defaultMessage:"Our team"},[n.Z_.GOALS]:{id:"Goals",defaultMessage:"Goals"},[n.Z_.UPDATES]:{id:"updates",defaultMessage:"Updates"},[n.Z_.CONVERSATIONS]:{id:"conversations",defaultMessage:"Conversations"},[n.Z_.TICKETS]:{id:"section.tickets.title",defaultMessage:"Tickets"},[n.Z_.LOCATION]:{id:"SectionLocation.Title",defaultMessage:"Location"},[n.Z_.CONTRIBUTE]:{id:"Contribute",defaultMessage:"Contribute"},[n.Z_.CONTRIBUTIONS]:{id:"Contributions",defaultMessage:"Contributions"},[n.Z_.EVENTS]:{id:"Events",defaultMessage:"Events"},[n.Z_.PROJECTS]:{id:"Projects",defaultMessage:"Projects"},[n.Z_.TRANSACTIONS]:{id:"menu.transactions",defaultMessage:"Transactions"},[n.Z_.BUDGET]:{id:"section.budget.title",defaultMessage:"Budget"},[n.Z_.FINANCIAL_OVERVIEW]:{id:"section.financialOverview.title",defaultMessage:"Financial Overview"},[n.Z_.EXPENSES]:{id:"Expenses",defaultMessage:"Expenses"},[n.Z_.CONTRIBUTORS]:{id:"Contributors",defaultMessage:"Contributors"},[n.Z_.PARTICIPANTS]:{id:"CollectivePage.NavBar.Participants",defaultMessage:"Participants"},[n.Z_.ABOUT]:{id:"collective.about.title",defaultMessage:"About"}}),r=(e,t)=>i[t]?e.formatMessage(i[t]):t},79707:(e,t,s)=>{s.d(t,{Ay:()=>H,Bf:()=>D,QJ:()=>U});var a=s(37876),n=s(14232),i=s(670),r=s(96918),l=s(64487),o=s(62449),d=s(5646),c=s(6435),u=s(23188),m=s(17374),x=s(11046),p=s(87058),h=s(21092),g=s(93481),f=s(25510),A=s(56593),y=s(84611),j=s(99202),v=s(36559),b=s(69756),C=s(41955),M=s(62939),E=s(43682),T=s(72945),w=s(92255),I=s(45327),N=s(50388),S=s(69020),P=s(53671),R=s(8264);let F=(0,x.J1)` 817 fragment BudgetSectionAccountFields on Account { 818 id 819 isHost 820 type 821 ... on AccountWithHost { 822 host { 823 id 824 slug 825 name 826 accountingCategories { 827 nodes { 828 ...AccountingCategorySelectFields 829 } 830 } 831 } 832 } 833 ... on Organization { 834 host { 835 id 836 slug 837 name 838 accountingCategories { 839 nodes { 840 ...AccountingCategorySelectFields 841 } 842 } 843 } 844 } 845 846 stats { 847 # Skip following on Heavy Accounts (low performance vs relevance ratio) 848 id 849 balance { 850 valueInCents 851 currency 852 } 853 consolidatedBalance: balance(includeChildren: true) @skip(if: $heavyAccount) { 854 valueInCents 855 currency 856 } 857 yearlyBudget @skip(if: $heavyAccount) { 858 valueInCents 859 currency 860 } 861 activeRecurringContributions @skip(if: $heavyAccount) 862 totalAmountReceived(periodInMonths: 12) @skip(if: $heavyAccount) { 863 valueInCents 864 currency 865 } 866 totalAmountRaised: totalAmountReceived { 867 valueInCents 868 currency 869 } 870 totalNetAmountRaised: totalAmountReceived(net: true) { 871 valueInCents 872 currency 873 } 874 } 875 } 876 ${h.Vo} 877`,k=(0,x.J1)` 878 query BudgetSection($slug: String!, $limit: Int!, $kind: [TransactionKind], $heavyAccount: Boolean!) { 879 transactions( 880 account: { slug: $slug } 881 limit: $limit 882 kind: $kind 883 includeIncognitoTransactions: true 884 includeGiftCardTransactions: true 885 includeChildrenTransactions: true 886 includeEditedReversedTransactions: false 887 ) { 888 ...TransactionsQueryCollectionFragment 889 } 890 expenses(account: { slug: $slug }, limit: $limit, includeChildrenExpenses: true) { 891 totalCount 892 nodes { 893 id 894 ...ExpensesListFieldsFragment 895 host { 896 id 897 ...ExpenseHostFields 898 } 899 } 900 } 901 account(slug: $slug) { 902 id 903 ...BudgetSectionAccountFields 904 } 905 } 906 ${I.s} 907 ${y.hg} 908 ${y.wJ} 909 ${F} 910`,O=(0,x.J1)` 911 query BudgetSectionForIndividual($slug: String!, $limit: Int!, $kind: [TransactionKind]) { 912 transactions( 913 account: { slug: $slug } 914 limit: $limit 915 kind: $kind 916 includeIncognitoTransactions: true 917 includeGiftCardTransactions: true 918 includeEditedReversedTransactions: false 919 ) { 920 ...TransactionsQueryCollectionFragment 921 } 922 expenses(createdByAccount: { slug: $slug }, limit: $limit) { 923 totalCount 924 nodes { 925 id 926 ...ExpensesListFieldsFragment 927 host { 928 id 929 ...ExpenseHostFields 930 } 931 } 932 } 933 account(slug: $slug) { 934 id 935 isHost 936 type 937 stats { 938 id 939 totalAmountSpent(net: true) { 940 valueInCents 941 currency 942 } 943 totalPaidExpenses { 944 valueInCents 945 currency 946 } 947 } 948 } 949 } 950 ${I.s} 951 ${y.hg} 952 ${y.wJ} 953`,_=(0,x.J1)` 954 query BudgetSectionWithHost( 955 $slug: String! 956 $host: AccountReferenceInput 957 $limit: Int! 958 $kind: [TransactionKind] 959 $heavyAccount: Boolean! 960 ) { 961 transactions( 962 account: { slug: $slug } 963 host: $host 964 limit: $limit 965 kind: $kind 966 includeIncognitoTransactions: true 967 includeGiftCardTransactions: true 968 includeChildrenTransactions: true 969 includeEditedReversedTransactions: false 970 ) { 971 ...TransactionsQueryCollectionFragment 972 } 973 expenses(account: { slug: $slug }, limit: $limit, includeChildrenExpenses: true) { 974 totalCount 975 nodes { 976 id 977 ...ExpensesListFieldsFragment 978 } 979 } 980 account(slug: $slug) { 981 id 982 ...BudgetSectionAccountFields 983 ... on AccountWithHost { 984 host { 985 id 986 ...ExpenseHostFields 987 } 988 } 989 } 990 } 991 ${I.s} 992 ${y.hg} 993 ${y.wJ} 994 ${F} 995`,D=(e,t)=>e?_:t?O:k,U=(e,t,s,a)=>t?{slug:e,limit:3,kind:(0,w.V)().filter(e=>e!==u.L.EXPENSE)}:{slug:e,host:s?{slug:s.slug}:null,limit:3,kind:(0,w.V)({isHost:!!a}),heavyAccount:(0,c.zU)(e)},L=d.Ay.div.withConfig({componentId:"sc-ae82b8ec-0"})(["",""],e=>!e.$isFirst&&(0,d.AH)(["border-top:1px solid #e6e8eb;"])),$=["all","expenses","transactions"],z=({collective:e,filter:t,hasExpenses:s,hasTransactions:n,isIndividual:i})=>{let r="all"===t;return"expenses"===t||r&&s&&!n?(0,a.jsx)(b.A,{href:`${(0,p.bl)(e)}/${i?"submitted-expenses":"expenses"}`,"data-cy":"view-all-expenses-link",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(o.sA,{id:"CollectivePage.SectionBudget.ViewAllExpenses",defaultMessage:"View all expenses"}),"\xa0 â"]})}):r&&i?(0,a.jsxs)(b.A,{href:`${(0,p.bl)(e)}/transactions`,"data-cy":"view-all-transactions-link",children:[(0,a.jsx)(o.sA,{id:"transactions.viewAll",defaultMessage:"View All Transactions"}),"\xa0 â"]}):"transactions"===t||r&&n&&!s?i?(0,a.jsxs)(b.A,{href:`${(0,p.bl)(e)}/transactions?kind=ADDED_FUNDS&kind=CONTRIBUTION&kind=PLATFORM_TIP`,"data-cy":"view-all-transactions-link",children:[(0,a.jsx)(o.sA,{id:"CollectivePage.SectionBudget.ViewAllContributions",defaultMessage:"View all contributions"}),"\xa0 â"]}):(0,a.jsxs)(b.A,{href:`${(0,p.bl)(e)}/transactions`,"data-cy":"view-all-transactions-link",children:[(0,a.jsx)(o.sA,{id:"CollectivePage.SectionBudget.ViewAll",defaultMessage:"View all transactions"})," â"]}):null}
995,H=n.memo((0,S.Cb)(({collective:e,LoggedInUser:t})=>{let[s,d]=n.useState("all"),u=(0,c.Lb)(e)&&!e.isHost,x=(0,i.IT)(D(!!e.host,u),{variables:U(e.slug,u,e.host,e.isHost)}),{data:p,refetch:h}=x,y=(0,l.A)(p,"transactions.nodes")||m.M,b=(0,l.A)(p,"expenses.nodes")||m.M,w=[y,b,s],I=n.useMemo(()=>((e,t,s)=>{if("expenses"===s)return t;{if("transactions"===s)return e;let a=t.map(e=>e.id),n=e.filter(e=>!a.includes(e.expense?.id));return(0,r.A)([...n,...t],"createdAt","desc").slice(0,3)}})(...w),w),S=!I.length&&x.loading,F=!!b.length,k=!!y.length;return n.useEffect(()=>{t&&h()},[t]),(0,a.jsxs)(R.A,{pb:4,children:[(F||k)&&(0,a.jsxs)(j.so,{mb:3,flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",maxWidth:["100%",null,"min(748px, 55vw)"],children:[(0,a.jsx)(E.A,{filters:$,getLabel:e=>((e,t)=>{switch(e){case"all":return(0,a.jsx)(o.sA,{id:"SectionTransactions.All",defaultMessage:"All"});case"expenses":return(0,a.jsx)(o.sA,{id:"Expenses",defaultMessage:"Expenses"});case"transactions":return t?(0,a.jsx)(o.sA,{id:"Contributions",defaultMessage:"Contributions"}):(0,a.jsx)(o.sA,{id:"menu.transactions",defaultMessage:"Transactions"});default:return null}})(e,u),selected:s,onChange:d}),(0,a.jsx)(z,{collective:e,filter:s,hasExpenses:F,hasTransactions:k,isIndividual:u})]}),(0,a.jsxs)(j.so,{flexDirection:["column-reverse",null,"row"],justifyContent:"space-between",alignItems:"flex-start",children:[(0,a.jsx)(A.A,{flex:"10",mb:3,width:"100%",maxWidth:800,children:(0,a.jsx)(M.A,{children:S?(0,a.jsx)(C.A,{height:300}):I.length?I.map((t,s)=>(0,a.jsx)(L,{$isFirst:!s,"data-cy":"single-budget-item",children:"Expense"===t.__typename?(0,a.jsx)(g.u,{children:(0,a.jsx)(f.A,{expense:t,host:t.host||p.account.host,showAmountSign:!0})}):(0,a.jsx)(N.A,{transaction:t,collective:e})},`${t.__typename}-${t.id||s}`)):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center px-1 py-[94px] text-center",children:[(0,a.jsx)(v.A,{src:"/static/images/empty-jars.png",alt:"Empty jars",width:125,height:125}),(0,a.jsx)(T.P,{fontWeight:"500",fontSize:"20px",lineHeight:"28px",children:(0,a.jsx)(o.sA,{id:"Budget.Empty",defaultMessage:"There are no transactions yet."})}),(0,a.jsx)(T.P,{mt:2,fontSize:"16px",lineHeight:"24px",color:"black.600",children:(0,a.jsx)(o.sA,{id:"Budget.EmptyComeBackLater",defaultMessage:"Come back to this section once there is at least one transaction!"})})]})})}),(0,a.jsx)(j.az,{width:"32px",flex:"1"}),S?(0,a.jsx)(C.A,{height:300}):(0,a.jsx)(P.A,{collective:e,stats:p?.account?.stats})]})]})}))},80421:(e,t,s)=>{s.d(t,{A:()=>d});var a=s(37876),n=s(14232),i=s(62449),r=s(7830),l=s(68500),o=s(72945);let d=({collective:e,onClose:t})=>{let[s,d]=n.useState(!1);return(0,a.jsxs)(l.Ay,{role:"alertdialog",onClose:t,hasUnsavedChanges:s,children:[(0,a.jsx)(l.rQ,{children:(0,a.jsx)(o.H2,{mb:2,fontSize:"28px",children:(0,a.jsx)(i.sA,{id:"ContactCollective",defaultMessage:"Contact {collective}",values:{collective:e.name}})})}),(0,a.jsx)(r.A,{collective:e,isModal:!0,onClose:t,onChange:e=>d(Object.values(e).some(Boolean))})]})}},81317:(e,t,s)=>{s.d(t,{A:()=>r});var a=s(37876);s(14232);var n=s(72945);let i=({value:e,fontSize:t})=>(0,a.jsx)(n.L9,{fontSize:`${t}px`,children:e}),r=({children:e=i,value:t,minFontSizeInPx:s,maxFontSizeInPx:a,maxLength:n,lengthThreshold:r,mobileRatio:l,valueFormatter:o})=>{var d,c,u,m,x,p;let h=(c=t,u=s,m=a,x=n,p=r,!c||c.length<p?m:c.length>x?u:Math.round(m-(m-u)*((c.length-p)/(x-p))));return e({value:t,fontSize:(d=l?[Math.round(h*l),null,h]:h,o?Array.isArray(d)?d.map(e=>"number"==typeof e?o(e):e):o(d):d)})}},81904:(e,t,s)=>{s.d(t,{_:()=>c});var a=s(37876);s(14232);var n=s(66717),i=s(62449),r=s(33341),l=s(99202),o=s(72945);function d({searchText:e,isBeneficiary:t}){let s=e.trim();return s.length>0?(0,a.jsxs)(l.so,{alignItems:"center",children:[(0,a.jsx)(l.so,{alignItems:"center",justifyContent:"center",color:"#999",width:"16px",minWidth:"16px",height:"16px",flexShrink:0,children:(0,a.jsx)(n.A,{size:14,strokeWidth:2})}),(0,a.jsx)(l.so,{flexDirection:"column",ml:"8px",textAlign:"left",children:(0,a.jsx)(o.L9,{fontSize:"12px",fontWeight:"500",lineHeight:"18px",color:"black.700",children:t?(0,a.jsx)(i.sA,{defaultMessage:"Create beneficiary: <b>{vendorName}</b>
995",id:"QFO4ll",values:{vendorName:s,b:r.UW}}):(0,a.jsx)(i.sA,{defaultMessage:"Create vendor: <b>{vendorName}</b>",id:"buY7Uz",values:{vendorName:s,b:r.UW}})})})]}):(0,a.jsx)(l.so,{alignItems:"center",children:(0,a.jsx)(o.L9,{fontSize:"12px",lineHeight:"18px",color:"black.500",children:t?(0,a.jsx)(i.sA,{defaultMessage:"Begin typing to create a beneficiary",id:"skcLyR"}):(0,a.jsx)(i.sA,{defaultMessage:"Begin typing to create a vendor",id:"Jx28lM"})})})}function c(e,{isBeneficiary:t}={}){return{renderNewCollectiveOption:function({isBeneficiary:e}={}){return function({searchText:t}){return(0,a.jsx)(d,{searchText:t,isBeneficiary:e})}}({isBeneficiary:t}),onSelectNewCollectiveOption:function({searchText:t,onCreatedCollective:s}){let a=t.trim();a&&e(a,{onSuccess:s})}}}},82016:(e,t,s)=>{s.d(t,{P:()=>o});var a=s(43647),n=s(62449),i=s(33341),r=s(52170);let l=(0,n.YK)({[r.ju.PREPAID]:{id:"Prepaid",defaultMessage:"Prepaid Card"}}),o=(e,t)=>{if(l[t])return e.formatMessage(l[t]);switch(t){case r.ju.PAYPAL:return"PayPal";case r.ju.THEGIVINGBLOCK:return"The Giving Block";case r.ju.OPENCOLLECTIVE:return i.RS;default:return(0,a.A)(t.toLowerCase())}}},83244:(e,t,s)=>{s.d(t,{A:()=>h});var a=s(37876);s(14232);var n=s(70496),i=s(70580),r=s(97075),l=s(18343),o=s(45817),d=s(62449),c=s(16240),u=s(30619),m=s(99202),x=s(41955),p=s(72945);let h=({isLoading:e=!1,type:t,fontSize:s="13px",fontWeight:h="bold",color:g="black.900",iconSize:f=24,name:A})=>{if(e)return(0,a.jsx)(x.A,{height:15,width:90});switch(t){case c.UC.PAYPAL:return(0,a.jsxs)(m.so,{alignItems:"center",children:[(0,a.jsx)(n.c,{size:f,color:"#192f86"}),(0,a.jsx)(p.L9,{ml:2,fontWeight:h,fontSize:s,color:g,children:"PayPal"})]});case c.UC.BANK_ACCOUNT:return(0,a.jsxs)(m.so,{alignItems:"center",children:[(0,a.jsx)(o.t,{size:f,color:"#9D9FA3"}),(0,a.jsx)(p.L9,{ml:2,fontWeight:h,fontSize:s,color:g,children:(0,a.jsx)(d.sA,{id:"BankAccount",defaultMessage:"Bank account"})})]});case c.UC.ACCOUNT_BALANCE:return(0,a.jsxs)(m.so,{alignItems:"center",children:[(0,a.jsx)(l.D,{size:f,color:"#9D9FA3"}),(0,a.jsx)(p.L9,{ml:2,fontWeight:h,fontSize:s,color:g,children:"Open Collective"})]});case c.O0:return(0,a.jsxs)(m.so,{alignItems:"center",children:[(0,a.jsx)(u.Ay,{name:"?",size:f,backgroundColor:"blue.100",color:"blue.400",fontWeight:"500"}),(0,a.jsx)(p.L9,{ml:2,fontWeight:h,fontSize:s,color:g,children:(0,a.jsx)(d.sA,{id:"PayoutMethod.Type.ToBeDefined",defaultMessage:"Not yet set"})})]});case c.hp:return(0,a.jsxs)(m.so,{alignItems:"center",children:[(0,a.jsx)(r.y,{size:f,color:"#9D9FA3"}),(0,a.jsx)(p.L9,{ml:2,fontWeight:h,fontSize:s,color:g,children:A||(0,a.jsx)(d.sA,{id:"PayoutMethod.Type.VirtualCard",defaultMessage:"Virtual Card"})})]});case c.UC.STRIPE:return(0,a.jsxs)(m.so,{alignItems:"center",children:[(0,a.jsx)(i.p,{size:f}),(0,a.jsx)(p.L9,{ml:2,fontWeight:h,fontSize:s,color:g,children:"Stripe"})]});case c.UC.OTHER:default:return(0,a.jsxs)(m.so,{alignItems:"center",children:[(0,a.jsx)(l.D,{size:f,color:"#9D9FA3"}),(0,a.jsx)(p.L9,{ml:2,fontWeight:h,fontSize:s,color:g,children:(0,a.jsx)(d.sA,{id:"PayoutMethod.Type.Other",defaultMessage:"Other"})})]})}}},83509:(e,t,s)=>{s.d(t,{Es:()=>c,Tr:()=>r,e3:()=>d,sn:()=>o,zi:()=>l});var a=s(37876);s(14232);var n=s(89230),i=s(20322);function r({children:e,className:t}){return(0,a.jsx)("dl",{className:(0,i.cn)("flex w-full flex-col gap-3",t),children:e})}function l({children:e,className:t,showValueAsTitle:s}){return(0,a.jsx)("dd",{className:(0,i.cn)("max-w-fit break-words",t),title:s?String(e):void 0,children:e})}function o({children:e,className:t,title:s}){return(0,a.jsx)("dt",{className:(0,i.cn)("max-w-[240px] min-w-[180px] shrink-0 grow-0 basis-1/4 text-muted-foreground",t),title:s,children:e})}function d({children:e,label:t,value:s,className:n,itemClassName:r,labelClassName:c,showValueAsItemTitle:u}){return(0,a.jsxs)("div",{className:(0,i.cn)("relative flex w-full flex-col gap-3 sm:flex-row",n),children:[t&&(0,a.jsx)(o,{className:c,children:t}),s&&(0,a.jsx)(l,{className:r,showValueAsTitle:u,children:s}),e]})}function c({children:e,label:t,value:s,className:r,itemClassName:l,labelClassName:u,showValueAsItemTitle:m}){return(0,n.A)(s)&&null!==s?(0,a.jsxs)("div",{className:r,children:[t&&(0,a.jsxs)(o,{className:u,children:[t,":"]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1 pt-1",children:[Object.entries(s).map(([e,t])=>(0,a.jsx)(c,{label:`- ${e}`,value:t,className:(0,i.cn)("pl-2"),itemClassName:l,labelClassName:(0,i.cn)(u,"truncate"),showValueAsItemTitle:m},e)),e]})]}):(0,a.jsx)(d,{label:t,value:s,className:r,itemClassName:l,labelClassName:u,showValueAsItemTitle:m,children:e})}},86742:(e,t,s)=>{s.d(t,{Ay:()=>U,MO:()=>D,ak:()=>S});var a=s(37876),n=s(14232),i=s(86541),r=s(14241),l=s(21651),o=s(51131),d=s(77820),c=s(49235),u=s(84350),m=s(54703),x=s(61872),p=s(97082),h=s(62449),g=s(5646),f=s(87881),A=s(99202),y=s(68901),j=s(62939),v=s(43682),b=s(5885),C=s(68500),M=s(86095),E=s(74143),T=s(72945);let w=(0,g.I4)(A.so).withConfig({componentId:"sc-1c9a415b-0"})(["justify-content:space-between;min-height:72px;padding:12px 16px;&:not(:last-child){border-bottom:1px solid ",";}"],(0,l.y)("colors.black.300")),I={PASS:"success",HIGH:"error",MEDIUM:"warning",LOW:"info"},N=["HIGH","MEDIUM","LOW","PASS"],S=e=>e?.securityChecks?.filter(e=>"HIGH"===e.level).length>0,P=e=>{let[t,s]=n.useState(!1);return(0,a.jsxs)(w,{children:[(0,a.jsxs)(A.so,{flexDirection:"column",alignItems:"start",children:[(0,a.jsx)(A.az,{children:(0,a.jsx)(E.A,{type:I[e.level],fontWeight:"700",fontSize:"12px",lineHeight:"16px",p:"2px 6px",mb:2,children:(0,o.A)(e.scope)})}),(0,a.jsx)(T.P,{fontWeight:"500",fontSize:"14px",lineHeight:"20px",children:e.message}),t&&(0,a.jsx)(T.P,{mt:2,fontWeight:"500",fontSize:"12px",lineHeight:"20px",children:e.details})]}),e.details&&(0,a.jsx)(A.so,{alignItems:"center",children:(0,a.jsxs)(b.A,{fontWeight:"500",fontSize:"13px",lineHeight:"16px",ml:2,color:"blue.500",onClick:()=>s(!t),minWidth:"max-content",children:[t?(0,a.jsx)(h.sA,{defaultMessage:"Hide Details",id:"jBYmhn"}):(0,a.jsx)(h.sA,{defaultMessage:"Show Details",id:"kRqDOg"}),t?(0,a.jsx)(r.r,{size:"1em"}):(0,a.jsx)(i.y,{size:"1em"})]})})]},e.message)},R=(0,h.YK)({ALL:{id:"SecurityScope.All",defaultMessage:"All Scopes"},PAYEE:{id:"SecurityScope.Payee",defaultMessage:"Payee"},USER:{id:"Tags.USER",defaultMessage:"User"},COLLECTIVE:{id:"Collective",defaultMessage:"Collective"},PAYOUT_METHOD:{id:"PayoutMethod",defaultMessage:"Payout Method"}
995,ATTACHMENTS:{id:"Expense.Attachments",defaultMessage:"Attachments"}}),F=({expense:e,onClose:t,onConfirm:s,...i})=>{let r=(0,h.tz)(),[l,o]=n.useState();return(0,a.jsxs)(C.Ay,{onClose:t,"data-cy":"security-check-modal",...i,children:[(0,a.jsx)(C.rQ,{onClose:t,children:(0,a.jsxs)(A.az,{children:[(0,a.jsx)(T.H1,{color:"black.900",fontSize:"20px",lineHeight:"28px",children:s?(0,a.jsx)(h.sA,{id:"SecurityChecksModal.confirm.title",defaultMessage:"Are you sure you want to pay?"}):(0,a.jsx)(h.sA,{id:"SecurityChecksModal.title",defaultMessage:"Security Checks"})}),(0,a.jsx)(T.P,{mt:2,color:"black.700",fontWeight:"400",fontSize:"14px",lineHeight:"20px",children:(0,a.jsx)(h.sA,{id:"SecurityChecksModal.subtitle",defaultMessage:"Multiple Security Checks have been flagged for this Expense. Please review and proceed with caution."})})]})}),(0,a.jsxs)(C.cw,{mb:0,mt:"24px",children:[(0,a.jsx)(v.A,{p:0,filters:["ALL",...(0,d.A)(e.securityChecks?.map(e=>e.scope))],getLabel:e=>r.formatMessage(R[e]),onChange:e=>"ALL"===e?o():o(e),selected:l}),(0,a.jsx)(j.A,{mt:3,children:e.securityChecks?.filter(e=>!l||e.scope===l).map(e=>(0,a.jsx)(P,{...e},e.message))})]}),s&&(0,a.jsx)(C.jl,{isFullWidth:!0,children:(0,a.jsxs)(A.so,{justifyContent:"space-between",children:[(0,a.jsx)(y.A,{onClick:t,children:(0,a.jsx)(h.sA,{id:"actions.cancel",defaultMessage:"Cancel"})}),(0,a.jsx)(y.A,{buttonStyle:"primary",onClick:s,"data-cy":"pay-button",children:(0,a.jsx)(h.sA,{id:"SecurityChecksModal.confirm.button",defaultMessage:"Yes, Continue to Payment"})})]})})]})},k=g.I4.div.withConfig({componentId:"sc-1c9a415b-1"})(["position:absolute;display:flex;justify-content:center;align-items:center;right:0%;top:-10%;bottom:90%;left:70%;border-radius:50%;color:#fff;padding:9px;border:1px solid #fff;background-color:",";font-size:10px;font-weight:700;"],(0,l.y)("colors.red.500")),O=(0,g.I4)(M.A).withConfig({componentId:"sc-1c9a415b-2"})(["position:relative;margin:0;"]),_={PASS:"successSecondary",HIGH:"dangerSecondary",MEDIUM:"warningSecondary",LOW:"secondary"},D=({expense:e,enableKeyboardShortcuts:t,...s})=>{let[i,r]=n.useState(!1),l=e?.securityChecks?.filter(e=>"HIGH"===e.level).length||0,o=(0,c.A)((0,u.A)(N.map(t=>(0,m.A)(e?.securityChecks,{level:t})))),d=l?x.A:p.A;return(0,f.Ay)({keyMatch:f.S,callback:e=>{t&&(e.preventDefault(),r(!0))}}),(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)(O,{...s,buttonStyle:_[o?.level]||"secondary",onClick:()=>r(!0),children:[l?(0,a.jsx)(k,{children:l}):null,(0,a.jsx)(d,{size:18})]}),i&&(0,a.jsx)(F,{expense:e,onClose:()=>r(!1)})]})},U=F},87881:(e,t,s)=>{s.d(t,{A:()=>v,Ay:()=>r,B:()=>b,H:()=>y,I:()=>j,Ix:()=>i,J:()=>h,K:()=>g,M0:()=>u,P:()=>f,S:()=>A,ST:()=>d,Zh:()=>c,aH:()=>l,av:()=>x,hn:()=>p,jD:()=>o,tt:()=>m});var a=s(14232);let n=["INPUT","TEXTAREA","TRIX-EDITOR"],i=({sequence:e,callback:t,disableOnInput:s})=>{let[i,r]=a.useState(0);a.useEffect(()=>{let a=a=>{if(!1!==s&&n.includes(a.target.tagName))return;let l=!1,o=e[i];"key"in a&&o?.key&&(l=a.key===o.key||a.key===o.keyName),l?(r(i+1),i===e.length-1&&t(a)):r(0)};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}},[t,e])},r=({callback:e,keyMatch:t,disableOnInput:s})=>{a.useEffect(()=>{let a=a=>{!1!==s&&n.includes(a.target.tagName)||("key"in a?a.key===t.key||a.key===t.keyName:a.keyCode===t.keyCode)&&e(a)};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}},[e,t])},l={key:"Escape",keyName:"Esc",keyCode:27},o={key:"Enter",keyName:"Enter",keyCode:13},d={key:"ArrowLeft",keyName:"Left arrow",keyCode:37},c={key:"ArrowRight",keyName:"Right arrow",keyCode:39},u={key:"ArrowUp",keyName:"Up arrow"},m={key:"ArrowDown",keyName:"Down arrow"},x={key:"PageUp",keyName:"Page Up"},p={key:"PageDown",keyName:"Page Down"},h={key:"j",keyName:"J"},g={key:"k",keyName:"K"},f={key:"p",keyName:"P"},A={key:"s",keyName:"S"},y={key:"h",keyName:"H"},j={key:"i",keyName:"I"},v={key:"a",keyName:"A"},b={key:"b",keyName:"B"}},89797:(e,t,s)=>{s.d(t,{A:()=>r});var a=s(37876),n=s(5646);s(14232);var i=s(72945);let r=({isCredit:e})=>(0,a.jsx)(l,{"data-cy":"transaction-sign",color:e?"green.700":"red.700",mr:2,children:e?"+":"-"});var l=(0,n.Ay)(i.L9).withConfig({componentId:"sc-f15b5d30-0"})({verticalAlign:"text-bottom"})},90020:(e,t,s)=>{s.d(t,{A:()=>i});var a=s(14232),n=s(86784);function i(e,t,s){let[i,r]=a.useState(!1),l=a.useRef((0,n.A)(t=>{r(!1),e(t)},s.delay));return a.useEffect(()=>{if(e)return s.noDelayEmpty&&""===t?(l.current.cancel(),e(t),r(!1)):(r(!0),l.current(t)),()=>{l.current.cancel()}},[t,e,s.noDelayEmpty]),{isDebouncing:i}}},90295:(e,t,s)=>{s.d(t,{ZU:()=>f,aq:()=>A,hc:()=>y,jm:()=>b,sz:()=>j});var a=s(37876),n=s(14232),i=s(88490),r=s(670),l=s(64177),o=s(62449),d=s(58649),c=s(2948),u=s(60257),m=s(87409),x=s(42506),p=s(45409),h=s(80207);let g=(0,i.J1)` 996 query BalanceAccountingCategoryPicker( 997 $hostSlug: String! 998 $account: AccountReferenceInput 999 $order: OrderReferenceInput 1000 $expense: ExpenseReferenceInput 1001 ) { 1002 host(slug: $hostSlug) { 1003 id 1004 balanceAccountingCategories: accountingCategories(kind: [BALANCE_ACCOUNT, CLEARING_ACCOUNT]) { 1005 nodes { 1006 id 1007 code 1008 name 1009 friendlyName 1010 kind 1011 } 1012 } 1013 suggestedBalanceAccountingCategories(account: $account, order: $order, expense: $expense) { 1014 id 1015 } 1016 } 1017 } 1018`,f=e=>e?{value:e.id,label:`${e.code} - ${e.name}`}:null,A=()=>{let{LoggedInUser:e}=(0,u.A)();return!!e?.hasPreviewFeatureEnabled(m.bu.BALANCE_ACCOUNTING_CATEGORIES)},y=(e,t)=>{let s=A(),{account:a}
1018=n.useContext(x.C),i=a?(0,d.G7)(a,d.Gv.CHART_OF_ACCOUNTS):null,{data:l,loading:o}=(0,r.IT)(g,{variables:{hostSlug:e,account:t?.accountSlug?{slug:t.accountSlug}:null,order:t?.orderId?{id:t.orderId}:null,expense:t?.expenseId?{id:t.expenseId}:null},skip:!s||!1===i||!e}),c=n.useMemo(()=>(l?.host?.balanceAccountingCategories?.nodes||[]).map(f),[l]),u=s&&!!e&&!1!==i&&(c.length>0||o);return{enabled:u,hasPreview:s,loading:o,options:c,categories:l?.host?.balanceAccountingCategories?.nodes||[],suggestedIds:(l?.host?.suggestedBalanceAccountingCategories||[]).map(e=>e.id)}},j=({hostSlug:e,inputId:t,value:s,onChange:i,disabled:r=!1,fontSize:l,styles:d,menuPortalTarget:c,context:u})=>{let m=(0,o.tz)(),{enabled:x,loading:h,options:g,suggestedIds:f}=y(e,u),A=n.useMemo(()=>f.length?[{label:m.formatMessage({defaultMessage:"Suggested",id:"a0lFbM"}),options:g.filter(e=>f.includes(e.value))},{label:m.formatMessage({defaultMessage:"All Categories",id:"1X6HtI"}),options:g.filter(e=>!f.includes(e.value))}]:g,[m,g,f]);return x?(0,a.jsx)(p.A,{inputId:t,options:A,value:s||null,isClearable:!0,isSearchable:!0,useSearchIcon:!0,isLoading:h,disabled:r,fontSize:l,styles:d,menuPortalTarget:c,menuPosition:"fixed",placeholder:m.formatMessage({defaultMessage:"Select a balance or clearing account",id:"13dqX5"}),onChange:i}):null},v=(0,i.J1)` 1019 mutation SetConnectedAccountBalanceAccountingCategoryFromSettings( 1020 $connectedAccount: ConnectedAccountReferenceInput! 1021 $accountingCategory: AccountingCategoryReferenceInput 1022 ) { 1023 setConnectedAccountBalanceAccountingCategory( 1024 connectedAccount: $connectedAccount 1025 accountingCategory: $accountingCategory 1026 ) { 1027 id 1028 balanceAccountingCategory { 1029 id 1030 code 1031 name 1032 } 1033 } 1034 } 1035`,b=({hostSlug:e,connectedAccount:t,disabled:s=!1})=>{let i=(0,o.tz)(),{toast:r}=(0,h.d)(),{account:u}=n.useContext(x.C),m=A(),[p,{loading:g}]=(0,l.n)(v);return m&&(0,d.G7)(u,d.Gv.CHART_OF_ACCOUNTS)?(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium",htmlFor:`connected-account-balance-category-${t.id}`,children:(0,a.jsx)(o.sA,{defaultMessage:"Balance / clearing account",id:"7XkFoL"})}),(0,a.jsx)("p",{className:"mb-2 text-sm text-muted-foreground",children:(0,a.jsx)(o.sA,{defaultMessage:"Payments processed through this integration will be attributed to the selected account from your chart of accounts.",id:"3aoMDC"})}),(0,a.jsx)("div",{className:"max-w-md",children:(0,a.jsx)(j,{hostSlug:e,inputId:`connected-account-balance-category-${t.id}`,value:f(t.balanceAccountingCategory),disabled:s||g,onChange:async e=>{try{await p({variables:{connectedAccount:{id:t.id},accountingCategory:e?{id:e.value}:null}}),r({variant:"success",message:i.formatMessage({id:"saved",defaultMessage:"Saved"})})}catch(e){r({variant:"error",message:(0,c.Rp)(i,e)})}}})})]}):null}},90628:(e,t,s)=>{s.d(t,{A:()=>l});var a=s(37876);s(14232);var n=s(40125),i=s(20322),r=s(49030);let l=({value:e,cursor:t="help",truncatePosition:s="start",length:l=30})=>e?.length<=l?e:(0,a.jsxs)(r.m_,{children:[(0,a.jsx)(r.k$,{className:(0,i.cn)(t&&`cursor-${t}`),children:"start"===s?(0,n.A)(e,{length:l}):"middle"===s?(0,i.kU)(e,l):"..."}),(0,a.jsx)(r.ZI,{children:e})]})},91345:(e,t,s)=>{s.d(t,{A:()=>i});var a=s(37876);s(14232);var n=s(11814);let i=e=>(0,a.jsx)(n.A,{size:"64",viewBox:"-0.753 -0.753 9.424 9.407",...e,children:(0,a.jsx)("path",{d:"M.7-.76l1.475 2.47L-.42 4.176h4.47l.42-.988H2.004l1.493-1.484L2.625.227h4.068L3.12 8.662h1.224L8.338-.76H.7",fill:"currentColor",strokeWidth:"0.25"})})},91638:(e,t,s)=>{s.d(t,{$:()=>l});var a=s(37876);s(14232);var n=s(42538),i=s(20322),r=s(49030);function l({children:e,className:t,contentClassname:s,size:o=16,side:d,sideOffset:c}){return(0,a.jsxs)(r.m_,{delayDuration:100,children:[(0,a.jsx)(r.k$,{className:"cursor-help",onClick:e=>e.preventDefault(),asChild:!0,children:(0,a.jsx)(n.A,{size:o,className:(0,i.cn)("text-muted-foreground",t)})}),(0,a.jsx)(r.ZI,{side:d,sideOffset:c,className:(0,i.cn)("z-[9999] max-w-xs text-left",s),onPointerDownOutside:e=>e.preventDefault(),children:e})]})}},91664:(e,t,s)=>{s.d(t,{A:()=>c});var a=s(37876),n=s(14232),i=s(89099),r=s(62449),l=s(80421),o=s(68901);let d=e=>(0,a.jsx)(o.A,{...e,children:(0,a.jsx)(r.sA,{id:"Contact",defaultMessage:"Contact"})}),c=({children:e=d,collective:t,LoggedInUser:s})=>{let[r,o]=n.useState(!1),c=(0,i.useRouter)(),u="opencollective"===t.slug;return(0,a.jsxs)(n.Fragment,{children:[e({onClick:()=>u?c.push("/help"):s?o(!0):c.push(`/${t.slug}/contact`)}),r&&(0,a.jsx)(l.A,{collective:t,onClose:()=>o(null)})]})}},92146:(e,t,s)=>{s.d(t,{A:()=>n});var a=s(37876);function n({className:e}){return(0,a.jsx)("svg",{width:"12",height:"16",viewBox:"0 0 12 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.36028 2.02167C3.34937 1.21079 4.72241 0.800049 6.3013 0.800049C7.57934 0.800049 8.85245 1.00008 10.143 1.51156L10.4798 1.64506V6.34298L9.69384 5.92032C8.65426 5.36125 7.33001 5.0462 6.3013 5.0462C5.94323 5.0462 5.7464 5.1001 5.6548 5.15395C5.61783 5.17569 5.60754 5.19175 5.60349 5.19901C5.59885 5.20733 5.58529 5.23561 5.58529 5.30408C5.58529 5.33294 5.58876 5.36715 5.65841 5.43278C5.74331 5.51281 5.89387 5.60464 6.13814 5.70984C6.37774 5.81302 6.66339 5.91115 6.99591 6.02394C7.01064 6.02893 7.02545 6.03395 7.04034 6.039C7.35427 6.14543 7.70172 6.26322 8.05066 6.40181C8.77813 6.69075 9.5665 7.09003 10.1737 7.74311C10.7959 8.41228 11.1959 9.31306 11.2 10.533L11.2 10.5348C11.2 12.0046 10.6033 13.1955 9.56079 14.0055C8.5336 14.8035 7.11693 15.2 5.5076 15.2C4.17436 15.2 2.72092 14.9375 1.28483 14.3217L0.961667 14.1832V9.4456L1.75055 9.87625C2.93569 10.5232 4.40491 10.9832 5.5076 10.9832C5.89025 10.9832 6.13235 10.9288 6.26222 10.8565C6.31835 10.8252 6.34206 10.7969 6.35438 10.776C6.36666 10.7552 6.38529 10.7117 6.38529 10.6228C6.38529 10.5375 6.33685 10.3802 5.81768 10.1343C5.58155 10.0225 5.29816 9.91588 4.96989 9.79708C4.91566 9.77745 4.86026 9.75751 4.80389 9.73722C4.52679 9.63748 4.22628 9.52931 3.92675 9.4087C3.20886 9.11961 2.4271 8.73324 1.8247 8.1172C1.20455 7.48301 0.799988 6.63159 0.799988 5.4799C0.799988 4.03483 1.35912 2.84245 2.36028 2.02167ZM3.03655 2.84656C2.29965 3.45069 1.86665 4.33156 1.86665 5.4799C1.8666
10355 6.3502 2.16025 6.93467 2.58735 7.37145C3.0322 7.82638 3.64676 8.14605 4.32519 8.41924C4.60453 8.53172 4.88291 8.63195 5.15966 8.7316C5.21748 8.75241 5.27523 8.77321 5.33291 8.79408C5.65917 8.91217 5.98667 9.03414 6.27416 9.17027C6.80223 9.42031 7.45196 9.83622 7.45196 10.6228C7.45196 10.8708 7.3971 11.1075 7.27341 11.3175C7.14978 11.5273 6.97506 11.6804 6.78132 11.7883C6.41145 11.9944 5.94804 12.0499 5.5076 12.0499C4.43156 12.0499 3.15504 11.7026 2.02833 11.2016V13.4733C3.21947 13.9353 4.41188 14.1334 5.5076 14.1334C6.95549 14.1334 8.11835 13.7754 8.90638 13.1631C9.67889 12.563 10.1331 11.6882 10.1333 10.5357C10.1299 9.57306 9.82436 8.93382 9.39258 8.46944C8.94568 7.98881 8.33129 7.661 7.65693 7.39315C7.33402 7.2649 7.00982 7.15497 6.69046 7.04668L6.6533 7.03408C6.32906 6.92411 6.00187 6.81253 5.71624 6.68952C5.43528 6.56853 5.14822 6.41769 4.92681 6.20902C4.69015 5.98597 4.51862 5.68547 4.51862 5.30408C4.51862 4.83861 4.72843 4.46122 5.11421 4.23442C5.45253 4.03553 5.88037 3.97954 6.3013 3.97954C7.25396 3.97954 8.38924 4.20373 9.41311 4.61486V2.37735C8.3779 2.01399 7.34956 1.86672 6.3013 1.86672C4.89647 1.86672 3.78552 2.23253 3.03655 2.84656Z",fill:"#344256"})})}s(14232)},92255:(e,t,s)=>{s.d(t,{V:()=>n});var a=s(23188);let n=({isHost:e=!1}={})=>{let t=[a.L.ADDED_FUNDS,a.L.BALANCE_TRANSFER,a.L.CONTRIBUTION,a.L.EXPENSE];return e||t.push(a.L.PLATFORM_TIP),t}},93481:(e,t,s)=>{s.d(t,{N:()=>d,u:()=>
1035o});var a=s(37876);s(14232);var n=s(5646),i=s(51020);let r=n.Ay.div.withConfig({componentId:"sc-f1c5ebbc-0"})(["position:relative;animation:"," 0.15s;"],i.qG),l=n.Ay.div.withConfig({componentId:"sc-f1c5ebbc-1"})(["position:absolute;right:-1px;height:70%;width:2px;margin:14px 0;",""],e=>e.isCredit?(0,n.AH)(["background:linear-gradient( 180deg,#00af2f 0%,rgba(106,255,146,0.354167) 53.65%,rgba(255,255,255,0) 100% );"]):(0,n.AH)(["background:linear-gradient(180deg,rgba(255,255,255,0) 0%,#ffd4df 55.73%,#ff0044 100%);"])),o=({children:e,...t})=>(0,a.jsxs)(r,{...t,children:[(0,a.jsx)(l,{isCredit:!1}),e]}),d=({children:e,...t})=>(0,a.jsxs)(r,{...t,children:[(0,a.jsx)(l,{isCredit:!0}),e]})},94550:(e,t,s)=>{s.d(t,{A:()=>f});var a=s(37876),n=s(14232),i=s(79847),r=s(62449),l=s(58649),o=s(33123),d=s(87058),c=s(20322),u=s(36559),m=s(42506),x=s(69756),p=s(37293),h=s(1509);let g={CHART_OF_ACCOUNTS:{title:(0,r.zR)({id:"UpgradePlanCTA.CHART_OF_ACCOUNTS.title",defaultMessage:"Upgrade your plan to enable chart of accounts."}),benefits:[(0,r.zR)({id:"UpgradePlanCTA.CHART_OF_ACCOUNTS.accountingCategories",defaultMessage:"Setup your accounting categories to mirror your accounting needs."}),(0,r.zR)({id:"UpgradePlanCTA.CHART_OF_ACCOUNTS.categorize",defaultMessage:"Assign expenses and added funds to their correct accounting categories."}),(0,r.zR)({id:"UpgradePlanCTA.CHART_OF_ACCOUNTS.export",defaultMessage:"Include the selected accounting categories in your exports."}),(0,r.zR)({id:"UpgradePlanCTA.CHART_OF_ACCOUNTS.optimize",defaultMessage:"Reduce the accounting costs, workload, and risk of accounting errors."})],learnMoreUrl:"https://documentation.opencollective.com/fiscal-hosts/chart-of-accounts"},TAX_FORMS:{title:(0,r.zR)({id:"UpgradePlanCTA.TAX_FORMS.title",defaultMessage:"Upgrade your plan to collect U.S. compliant tax forms"}),benefits:[(0,r.zR)({id:"UpgradePlanCTA.TAX_FORMS.compliance",defaultMessage:"Stay compliant with US tax laws without manual tracking."}),(0,r.zR)({id:"UpgradePlanCTA.TAX_FORMS.collect",defaultMessage:"Automatically collect required tax forms from payees."}),(0,r.zR)({id:"UpgradePlanCTA.TAX_FORMS.configureThreshold",defaultMessage:"Configure payout thresholds to control when forms are needed."}),(0,r.zR)({id:"UpgradePlanCTA.TAX_FORMS.prompt",defaultMessage:"Prompt payees to submit forms before receiving payments."}),(0,r.zR)({id:"UpgradePlanCTA.TAX_FORMS.preventPayouts",defaultMessage:"Prevent payouts until all required forms are submitted."}),(0,r.zR)({id:"UpgradePlanCTA.TAX_FORMS.sensitiveData",defaultMessage:"Keep sensitive tax data secure and accessible only to admins."}),(0,r.zR)({id:"UpgradePlanCTA.TAX_FORMS.export",defaultMessage:"Export all tax forms at year-end for quick filing."}),(0,r.zR)({id:"UpgradePlanCTA.TAX_FORMS.protect",defaultMessage:"Protect your community by avoiding risky data storage."})],learnMoreUrl:"https://documentation.opencollective.com/expenses-and-getting-paid/understanding-tax-requirements"},AGREEMENTS:{title:(0,r.zR)({id:"UpgradePlanCTA.AGREEMENTS.title",defaultMessage:"Upgrade your plan to upload agreements"}),benefits:[(0,r.zR)({id:"UpgradePlanCTA.AGREEMENTS.compliance",defaultMessage:"Track legal and contractual obligations for proper expense processing."}),(0,r.zR)({id:"UpgradePlanCTA.AGREEMENTS.documentation",defaultMessage:"Store all agreement documents in one centralized location."}),(0,r.zR)({id:"UpgradePlanCTA.AGREEMENTS.expiration",defaultMessage:"Set expiration dates to stay on top of agreement renewals."}),(0,r.zR)({id:"UpgradePlanCTA.AGREEMENTS.review",defaultMessage:"Access relevant agreements when reviewing expenses."})],learnMoreUrl:"https://documentation.opencollective.com/fiscal-hosts/managing-your-collectives/agreements"},OFF_PLATFORM_TRANSACTIONS:{title:(0,r.zR)({id:"UpgradePlanCTA.OFF_PLATFORM_TRANSACTIONS.title",defaultMessage:"Upgrade your plan to import off-platform transactions."}),benefits:[(0,r.zR)({id:"UpgradePlanCTA.OFF_PLATFORM_TRANSACTIONS.offPlatformTransactions",defaultMessage:"Accurately represent your finances on the platform by importing off-platform financial activities"}),(0,r.zR)({id:"UpgradePlanCTA.OFF_PLATFORM_TRANSACTIONS.importing",defaultMessage:"Automatically import transactions from banks and other financial services."}),(0,r.zR)({id:"UpgradePlanCTA.OFF_PLATFORM_TRANSACTIONS.importCSV",defaultMessage:"Manually import transactions with CSV files"}),(0,r.zR)({id:"UpgradePlanCTA.OFF_PLATFORM_TRANSACTIONS.reconcilliation",defaultMessage:"Reconcile and match imported transactions with platform activities."}),(0,r.zR)({id:"UpgradePlanCTA.OFF_PLATFORM_TRANSACTIONS.accounting",defaultMessage:"Provide your accountants with a consolidated transaction exports."})],learnMoreUrl:"https://documentation.opencollective.com/fiscal-hosts/bank-account-synchronization"},TRANSFERWISE:{title:(0,r.zR)({id:"UpgradePlanCTA.AUTOMATED_PAYMENTS.title",defaultMessage:"Upgrade your plan for automated payments."}),benefits:[(0,r.zR)({id:"UpgradePlanCTA.AUTOMATED_PAYMENTS.payOnPlatform",defaultMessage:"Pay with a click of a button."}),(0,r.zR)({id:"UpgradePlanCTA.AUTOMATED_PAYMENTS.ledger",defaultMessage:"Transfer & fee values are automatically recorded."}),(0,r.zR)({id:"UpgradePlanCTA.AUTOMATED_PAYMENTS.reduceErrors",defaultMessage:"Reduce manual data entry errors."}),(0,r.zR)({id:"UpgradePlanCTA.AUTOMATED_PAYMENTS.saveTime",defaultMessage:"Process more expenses in less t
1035ime."})],learnMoreUrl:"https://documentation.opencollective.com/fiscal-hosts/expense-payment/paying-expenses-as-a-fiscal-host"},FUNDS_GRANTS_MANAGEMENT:{title:(0,r.zR)({id:"UpgradePlanCTA.FUNDS_GRANTS_MANAGEMENT.title",defaultMessage:"Upgrade your plan for managing funds & grants."}),learnMoreUrl:"https://documentation.opencollective.com/fiscal-hosts/funds-and-grants"},EXPECTED_FUNDS:{title:(0,r.zR)({id:"UpgradePlanCTA.EXPECTED_FUNDS.title",defaultMessage:"Upgrade your plan to manage expected funds effortlessly."}),benefits:[(0,r.zR)({id:"UpgradePlanCTA.EXPECTED_FUNDS.track",defaultMessage:"Track pending bank transfers and fundraising pledges before the money lands."}),(0,r.zR)({id:"UpgradePlanCTA.EXPECTED_FUNDS.allocate",defaultMessage:"Allocate expected funds to specific Collectives, projects, events, or tiers."}),(0,r.zR)({id:"UpgradePlanCTA.EXPECTED_FUNDS.reconcile",defaultMessage:"Reconcile arrivals faster with pre-filled contribution details and ledger entries."}),(0,r.zR)({id:"UpgradePlanCTA.EXPECTED_FUNDS.notify",defaultMessage:"Automatically notify admins and funders once funds are received and allocated."})],learnMoreUrl:"https://documentation.opencollective.com/fiscal-hosts/receiving-money/expected-funds"},CHARGE_HOSTING_FEES:{title:(0,r.zR)({id:"UpgradePlanCTA.CHARGE_HOSTING_FEES.title",defaultMessage:"Upgrade your plan to enable collecting host fees."}),learnMoreUrl:"https://documentation.opencollective.com/fiscal-hosts/setting-up-a-fiscal-host/setting-your-fiscal-host-fees"}};function f({featureKey:e,className:t,compact:s=!1,hideBenefits:A=!1}){let{account:y}=n.useContext(m.C);if((0,l.G7)(y,e))return null;let j=y.features[e],v=g[e],b=j===o.ZF6.DISABLED?v?.title?(0,a.jsx)(r.sA,{...v.title}):(0,a.jsx)(r.sA,{id:"UpgradePlanCTA.title.DISABLED",defaultMessage:"Upgrade Required"}):j===o.ZF6.UNSUPPORTED?(0,a.jsx)(r.sA,{id:"UpgradePlanCTA.title.UNSUPPORTED",defaultMessage:"Feature not supported for your account"}):null;return s?(0,a.jsx)(p.Fc,{variant:"info",className:(0,c.cn)("p-4",t),children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(u.A,{src:"/static/images/lock.png",alt:"Lock",width:24,height:24,className:"shrink-0"}),(0,a.jsx)("div",{className:"min-w-0 flex-1",children:(0,a.jsx)(p.XL,{className:"mb-0 leading-tight font-semibold text-foreground",children:b})})]}),"DISABLED"===j&&v?.benefits&&!A&&(0,a.jsx)("div",{className:"space-y-1",children:v.benefits.map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-2 text-left",children:[(0,a.jsx)(i.A,{className:"mt-0.5 h-3 w-3 flex-shrink-0 text-green-600"}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,a.jsx)(r.sA,{...e})})]},e.id))}),"DISABLED"===j&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(h.$n,{asChild:!0,size:"sm",className:"",children:(0,a.jsx)(x.A,{href:(0,d.q5)(y,"platform-subscription",{params:new URLSearchParams({feature:e})}),children:(0,a.jsx)(r.sA,{id:"UpgradePlanCTA.upgradeButton",defaultMessage:"Upgrade your plan"})})}),v?.learnMoreUrl&&(0,a.jsx)(h.$n,{asChild:!0,variant:"outline",size:"sm",className:"",children:(0,a.jsx)(x.A,{href:v.learnMoreUrl,target:"_blank",children:(0,a.jsx)(r.sA,{id:"7DIW6+",defaultMessage:"Learn More"})})})]})]})}):(0,a.jsx)(n.Fragment,{children:(0,a.jsx)(p.Fc,{variant:"default",className:(0,c.cn)("px-6 py-8",t),children:(0,a.jsxs)("div",{className:"flex flex-col items-center space-y-6 text-center",children:[(0,a.jsx)("div",{className:"rounded-full bg-muted p-4",children:(0,a.jsx)(u.A,{src:"/static/images/lock.png",alt:"Lock",width:64,height:64,className:""})}),(0,a.jsx)(p.XL,{className:"mb-8 text-center text-2xl font-semibold text-balance text-foreground",children:b}),"DISABLED"===j&&v?.benefits&&!A&&(0,a.jsx)("div",{className:"w-full max-w-xl space-y-3",children:v.benefits.map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-3 text-left",children:[(0,a.jsx)(i.A,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-green-600"}),(0,a.jsx)("span",{className:"text-slate-700",children:(0,a.jsx)(r.sA,{...e})})]},e.id))}),"DISABLED"===j&&(0,a.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,a.jsx)(h.$n,{asChild:!0,size:"sm",children:(0,a.jsx)(x.A,{href:(0,d.q5)(y,"platform-subscription",{params:new URLSearchParams({feature:e})}),children:(0,a.jsx)(r.sA,{id:"UpgradePlanCTA.upgradeButton",defaultMessage:"Upgrade your plan"})})}),v?.learnMoreUrl&&(0,a.jsx)(h.$n,{asChild:!0,variant:"outline",size:"sm",children:(0,a.jsx)(x.A,{href:v.learnMoreUrl,target:"_blank",children:(0,a.jsx)(r.sA,{id:"7DIW6+",defaultMessage:"Learn More"})})})]})]})})})}},96076:(e,t,s)=>{s.d(t,{p:()=>d});var a=s(37876);s(14232);var n=s(72632),i=s(62449),r=s(1509),l=s(63037),o=s(98064);let d=({handleOnClose:e})=>(0,a.jsx)(l.lG,{defaultOpen:!0,onOpenChange:t=>{t||e?.()},children:(0,a.jsx)(l.Cf,{hideCloseButton:!0,overlayClassName:"p-0 sm:p-0",className:"overflow-hidden rounded-none bg-[#F8FAFC]/90 p-0 sm:max-w-screen sm:min-w-screen sm:rou
1035nded-none sm:p-0",onEscapeKeyDown:t=>{t.preventDefault(),open&&e?.()},children:(0,a.jsxs)("div",{className:"flex max-h-screen min-h-screen max-w-screen min-w-screen flex-col overflow-hidden",children:[!!e&&(0,a.jsx)("header",{className:"flex min-w-screen items-center justify-end px-4 py-3",children:(0,a.jsx)(r.$n,{onClick:()=>e(),variant:"ghost",className:"flex cursor-pointer items-center gap-2 px-4 py-3 text-base leading-5 font-medium text-slate-800",asChild:!0,children:(0,a.jsxs)("span",{children:[(0,a.jsx)(i.sA,{id:"Close",defaultMessage:"Close"}),(0,a.jsx)(n.A,{})]})})}),(0,a.jsx)("div",{className:"flex w-full grow items-center justify-center",children:(0,a.jsx)("div",{className:"mt-[-64px]",children:(0,a.jsx)(o.A,{})})})]})})})},96487:(e,t,s)=>{s.d(t,{A:()=>A,C:()=>g});var a=s(37876),n=s(14232),i=s(78248),r=s(47509),l=s(88173),o=s(29198),d=s(62449),c=s(90020),u=s(1509),m=s(47144),x=s(12112),p=s(74143);let h=e=>e&&e.length?e.map(e=>({label:e,value:e})):[],g=({query:e,variables:t,...s})=>{let[r,{loading:l,data:o,previousData:d}
1035]=(0,i._)(e,{fetchPolicy:"cache-first",notifyOnNetworkStatusChange:!0,variables:t}),c=n.useCallback(e=>r({variables:{searchTerm:e}}),[r]),u=(o||d)?.tagStats?.nodes.map(({tag:e})=>e)||[];return(0,a.jsx)(f,{...s,suggestedTags:u,loading:l,searchFunc:c})},f=({suggestedTags:e,loading:t,searchFunc:s,value:i,onChange:g,defaultValue:f,disabled:A,placeholder:y})=>{let j=(0,d.tz)(),[v,b]=n.useState(h(i||f)),[C,M]=n.useState(""),E=!!s,{isDebouncing:T}=(0,c.A)(s,C,{delay:500,noDelayEmpty:!0}),w=e=>{let t;b(t=(0,r.A)([...v,{label:e.toLowerCase(),value:e.toLowerCase()}],"value")),g(t),M("")},I=h(e??[]),N=I?.filter(e=>!i?.includes(e.value)&&e.value!==C),S=N?.length>0||C;return(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[v.map(e=>(0,a.jsx)(p.A,{variant:"rounded-right",color:A?"black.500":"black.700",closeButtonProps:{onClick:()=>{var t;let s;return t=e.value,void(b(s=v.filter(e=>e.value!==t)),g(s))},disabled:A},children:e.label},e.value)),(0,a.jsxs)(x.AM,{children:[(0,a.jsx)(x.Wv,{asChild:!0,children:(0,a.jsxs)(u.$n,{disabled:A,size:"xs",variant:"outline",className:"h-6 gap-1 border-dashed text-xs text-muted-foreground","data-cy":"edit-tags-open",children:[(0,a.jsx)(l.A,{size:16}),(0,a.jsx)("span",{children:y||(0,a.jsx)(d.sA,{defaultMessage:"Add tag",id:"Un1mxZ"})})]})}),(0,a.jsx)(x.hl,{className:"max-w-48 p-0",children:(0,a.jsxs)(m.uB,{children:[(0,a.jsx)(m.G7,{disabled:A,customIcon:E?o.A:l.A,placeholder:j.formatMessage({defaultMessage:"Add tag",id:"Un1mxZ"}),value:C,onValueChange:M,loading:t||T,"data-cy":"edit-tags-input"}),(0,a.jsx)(m.oI,{className:!S&&"border-none",children:S&&(0,a.jsxs)(m.L$,{heading:C.length?void 0:j.formatMessage({defaultMessage:"Suggestions",id:"Hv0XJn"}),children:[C&&(0,a.jsx)(m.h_,{value:C,onSelect:w,disabled:A,children:C.toLowerCase()}),N?.map(e=>(0,a.jsx)(m.h_,{value:e.value,onSelect:w,disabled:A,children:e.label},e.value))]})})]})})]})]})},A=n.memo(f)},96812:(e,t,s)=>{s.d(t,{Ay:()=>_,XH:()=>k,LP:()=>O,LN:()=>F});var a=s(37876),n=s(14232),i=s(670),r=s(90307),l=s(12815),o=s(62449),d=s(11046),c=s(43095),u=s(46436),m=s(2996),x=s(92146),p=s(91345),h=s(47597),g=s(68901),f=s(62939),A=s(5885),y=s(61270),j=s(17738),v=s(17471),b=s(20322),C=s(93182),M=s(33341),E=s(98064),T=s(80207);let w=(0,d.J1)` 1036 query ExpensesScheduledForPayment($hostSlug: String!) { 1037 expenses(host: { slug: $hostSlug }, status: SCHEDULED_FOR_PAYMENT, payoutMethodType: BANK_ACCOUNT, limit: 100) { 1038 totalCount 1039 nodes { 1040 id 1041 } 1042 } 1043 } 1044`;function I(e){let{toast:t}=(0,T.d)(),s=(0,o.tz)(),[r,l]=n.useState(!1),d=(0,i.IT)(w,{variables:{hostSlug:e.host.slug},skip:!r}),c=(0,j.create)({mode:j.Mode.PRODUCTION}),u=async()=>{let n=d.data.expenses.nodes.map(e=>e.id);try{await c(`${(0,b.$x)()}/api/services/transferwise/pay-batch`,{method:"POST",body:JSON.stringify({expenseIds:n,hostId:e.host.id}),headers:(0,v.D2)()}),l(!1),t({variant:"success",message:(0,a.jsx)(o.sA,{id:"expenses.scheduled.paybatch.success",defaultMessage:"Expenses paid! They're now being processed by Wise."})}),e.onSubmit?.()}catch(a){let e=a?.response?await a.response.text():s.formatMessage({defaultMessage:"There was an error trying to process this batch, please <SupportLink>contact support</SupportLink>",id:"MEB9ET"},{SupportLink:M.Ku});t({variant:"error",title:s.formatMessage({defaultMessage:"Batch payment failed",id:"HYFu3j"}),message:e})}};return(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(g.A,{className:e.className,buttonSize:"tiny",buttonStyle:"successSecondary",onClick:()=>l(!0),children:(0,a.jsx)(o.sA,{id:"expenses.scheduled.paybatch",defaultMessage:"Pay Batch"})}),r&&(0,a.jsx)(C.A,{header:(0,a.jsx)(o.sA,{id:"expenses.scheduled.confirmation.title",defaultMessage:"Pay Expenses Batch"}),disableSubmit:!d?.data?.expenses,body:!d.called||d.loading?(0,a.jsx)(E.A,{}):(0,a.jsx)(o.sA,{id:"expenses.scheduled.confirmation.body",defaultMessage:"Are you sure you want to batch and pay {count, plural, one {# expense} other {# expenses}} scheduled for payment?",values:{count:d?.data?.expenses?.totalCount}}),onClose:()=>l(!1),continueLabel:(0,a.jsx)(o.sA,{id:"expense.pay.btn",defaultMessage:"Pay with {paymentMethod}",values:{paymentMethod:"Wise"}}),continueHandler:u,overlayClassName:"z-1000"})]})}let N=({balances:e})=>(0,a.jsx)("div",{children:e.map(({valueInCents:e,currency:t})=>(0,a.jsxs)(n.Fragment,{children:[t,":\xa0",(0,a.jsx)(m.A,{amount:e,currency:t,amountClassName:"text-white font-bold",showCurrencyCode:!1}),(0,a.jsx)("br",{})]},t))}),S=({size:e,balances:t})=>!t||t.length<2?null:(0,a.jsx)(y.A,{content:()=>(0,a.jsx)(N,{balances:t}),children:(0,a.jsx)(r.R,{size:e,color:"#76777A"})}),P=(0,d.J1)` 1045 query ExpensePipelineOverview($hostSlug: String!, $currency: Currency!) { 1046 host(slug: $hostSlug) { 1047 id 1048 slug 1049 currency 1050 transferwise { 1051 id 1052 amountBatched { 1053 valueInCents 1054 currency 1055 } 1056 balances { 1057 valueInCents 1058 currency 1059 } 1060 }
1061 stripe { 1062 issuingBalance { 1063 valueInCents 1064 currency 1065 } 1066 username 1067 } 1068 } 1069 wiseReadyToPay: expenses( 1070 host: { slug: $hostSlug } 1071 limit: 0 1072 status: READY_TO_PAY 1073 payoutMethodType: BANK_ACCOUNT 1074 ) { 1075 totalCount 1076 totalAmount { 1077 amount(currency: $currency) { 1078 valueInCents 1079 currency 1080 } 1081 amountsByCurrency { 1082 valueInCents 1083 currency 1084 } 1085 } 1086 } 1087 wiseScheduledForPayment: expenses( 1088 host: { slug: $hostSlug } 1089 limit: 0 1090 status: SCHEDULED_FOR_PAYMENT 1091 payoutMethodType: BANK_ACCOUNT 1092 ) { 1093 totalCount 1094 totalAmount { 1095 amountsByCurrency { 1096 valueInCents 1097 currency 1098 } 1099 } 1100 } 1101 } 1102`,R=new Set(["APPROVE","UNAPPROVE","REQUEST_RE_APPROVAL","REJECT","SCHEDULE_FOR_PAYMENT","UNSCHEDULE_PAYMENT","PAY","MARK_AS_PAID","MARK_AS_PAID_WITH_STRIPE"]);function F(e){return!!(e&&R.has(e))}function k(e){return e?.slug&&e?.currency?[{query:P,variables:{hostSlug:e.slug,currency:e.currency}}]:[]}function O(e,t){t?.slug&&t?.currency&&e.query({query:P,variables:{hostSlug:t.slug,currency:t.currency},fetchPolicy:"network-only"})}function _(e){let{data:t,loading:s,error:n,refetch:r}=(0,i.IT)(P,{variables:{hostSlug:e.host.slug,currency:e.host.currency}});return s?(0,a.jsx)(u.E,{className:"h-[183.5px]"}):n?(0,a.jsx)(h.A,{error:n}):t?(0,a.jsxs)("div",{className:(0,l.$)("flex flex-col gap-4 sm:flex-row",e.className),children:[(0,a.jsx)(D,{className:"w-full",host:t.host,readyToPayAmount:t.wiseReadyToPay.totalAmount.amount,readyToPayCount:t.wiseReadyToPay.totalCount,readyToPayAmountByCurrency:t.wiseReadyToPay.totalAmount.amountsByCurrency,scheduledForPaymentCount:t.wiseScheduledForPayment.totalCount,scheduledForPaymentAmountByCurrency:t.wiseScheduledForPayment.totalAmount.amountsByCurrency,onBatchPaySuccess:e.onBatchPaySuccess??r}),t.host?.stripe?.issuingBalance&&(0,a.jsx)(U,{className:"w-full",host:t.host})]}):null}function D(e){let t=e.host?.transferwise?.amountBatched,s=n.useMemo(()=>e.host?.transferwise?.balances?.find(t=>t.currency===e.host?.currency),[e.host?.transferwise?.balances,e.host?.currency]),i=t?.valueInCents>0&&s?.valueInCents>=t?.valueInCents,d=e.host?.transferwise?.balances;return(0,a.jsxs)(f.A,{className:(0,l.$)("flex flex-col p-4",e.className),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-700",children:[(0,a.jsx)("div",{children:(0,a.jsx)(o.sA,{defaultMessage:"{service} balance ({currency})",id:"ArU2Ih",values:{service:"Wise",currency:e.host?.currency}})}),(0,a.jsx)(p.A,{size:16})]}),(0,a.jsxs)("div",{className:"mt-2 grow text-2xl font-bold text-slate-900",children:[(0,a.jsx)(m.A,{showCurrencyCode:!1,currency:s?.currency,amount:s?.valueInCents}),(0,a.jsx)(S,{size:16,balances:e.host?.transferwise?.balances})]}),(0,a.jsxs)("div",{className:"mt-3 flex justify-between text-xs text-slate-700",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.sA,{defaultMessage:"Ready to Pay ({count})",id:"xiSbsL",values:{count:e.readyToPayCount??0}}),(0,a.jsxs)("div",{className:"mt-2 flex gap-2 text-base text-slate-900",children:[(0,a.jsx)(m.A,{showCurrencyCode:!1,currency:e.host?.currency,amount:e.readyToPayAmount?.valueInCents}),e.readyToPayAmountByCurrency?.length>0&&(0,a.jsx)(y.A,{content:()=>(0,a.jsx)(N,{balances:e.readyToPayAmountByCurrency}),children:(0,a.jsx)(r.R,{size:16,color:"#76777A"})})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.sA,{defaultMessage:"Total Batched ({count})",id:"Ey7Kn+",values:{count:e.scheduledForPaymentCount??0}}),(0,a.jsxs)("div",{className:"mt-2 flex gap-2 text-base text-slate-900",children:[(0,a.jsx)(m.A,{showCurrencyCode:!1,currency:t?.currency,amount:t?.valueInCents}),e.scheduledForPaymentAmountByCurrency?.length>0&&(0,a.jsx)(y.A,{content:()=>(0,a.jsx)(N,{balances:e.scheduledForPaymentAmountByCurrency}),children:(0,a.jsx)(r.R,{size:16,color:"#76777A"})})]})]})]}),(0,a.jsxs)("div",{className:"mt-2 flex justify-items-stretch gap-3",children:[(0,a.jsx)(A.A,{width:"100%",openInNewTab:!0,href:d?"https://wise.com/user/account":"https://documentation.opencollective.com/fiscal-hosts/expense-payment/paying-expenses-with-wise#connecting-transferwise",children:(0,a.jsx)(g.A,{buttonSize:"tiny",width:"100%",children:d?(0,a.jsx)(o.sA,{defaultMessage:"Refill Balance",id:"dqYT8G"}):(0,a.jsx)(o.sA,{defaultMessage:"Connect {service}",id:"C9HmCs",values:{service:"Wise"}})})}),i&&(0,a.jsx)(I,{className:"w-full",host:e.host,onSubmit:e.onBatchPaySuccess})]})]})}function U(e){return(0,a.jsxs)(f.A,{className:(0,l.$)("flex flex-col p-4",e.className),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-700",children:[(0,a.jsx)(o.sA,{defaultMessage:"{service} balance ({currency})",id:"ArU2Ih",values:{service:"Stripe Issuing",currency:e.host?.stripe?.issu
1102ingBalance?.currency}}),(0,a.jsx)(x.A,{})]}),(0,a.jsx)("div",{className:"mt-2 grow text-2xl font-bold text-slate-900",children:(0,a.jsx)(m.A,{showCurrencyCode:!1,currency:e.host?.stripe?.issuingBalance?.currency,amount:e.host?.stripe?.issuingBalance?.valueInCents})}),(0,a.jsx)("div",{className:"mt-2 flex justify-items-stretch gap-3",children:(0,a.jsx)(A.A,{width:"100%",openInNewTab:!0,href:(0,c.u)("topups",e.host?.stripe?.username),children:(0,a.jsx)(g.A,{buttonSize:"tiny",width:"100%",children:(0,a.jsx)(o.sA,{defaultMessage:"Refill Balance",id:"dqYT8G"})})})})]})}},97146:(e,t,s)=>{s.d(t,{I:()=>r});var a=s(37876);s(14232);var n=s(20322),i=s(51778);function r({children:e,className:t}){return(0,a.jsxs)("div",{className:(0,n.cn)("mb-3 flex items-center gap-3",t),children:[(0,a.jsx)("h3",{className:"text-base leading-6 font-bold whitespace-nowrap text-foreground",children:e}),(0,a.jsx)(i.w,{className:"flex-1"})]})}},97268:(e,t,s)=>{s.r(t),s.d(t,{default:()=>j});var a=s(37876),n=s(14232),i=s(54770),r=s(64487),l=s(5646),o=s(78220),d=s(71321),c=s(17471),u=s(22696),m=s(56593),x=s(64986),p=s(41955),h=s(98263),g=s(74143);let f=l.I4.div.withConfig({componentId:"sc-d3e1b777-0"})([""," trix-editor{border:none;padding:0;margin-top:1px;padding-top:8px;padding-right:4px;outline-offset:0.5em;"," &::-webkit-scrollbar{width:8px;}"," "," &:empty:not(:focus)::before{color:",";}figcaption{display:none;}","}trix-toolbar{min-height:40px;background:",";z-index:2;margin-bottom:8px;"," .trix-button-group{border-radius:6px;border-color:#c4c7cc;margin-bottom:0;background:white;&:not(:first-child){margin-left:min(1.5vw,10px);}}.trix-button{border-bottom:none;display:inline-block;height:auto;&:hover{background:",";}&.trix-active{background:",";}&::before,&.trix-active::before{margin:4px;}}"," @media (max-width:500px){.trix-button--icon-strike,.trix-button--icon-number-list,.trix-button--icon-decrease-nesting-level,.trix-button--icon-increase-nesting-level{display:none;}}"," .trix-button--icon-attach::before{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E\");}.trix-button--video-attach::before{top:8%;bottom:4%;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-video'%3E%3Cpolygon points='23 7 16 12 23 17 23 7'%3E%3C/polygon%3E%3Crect x='1' y='5' width='15' height='14' rx='2' ry='2'%3E%3C/rect%3E%3C/svg%3E\");}}",""],e=>e.withBorders&&(0,i.AH)({border:"1px solid",borderColor:e.error?"red.300":"oklch(92.9% 0.013 255.508)",borderRadius:10,padding:3}),u.X,e=>!!e.editorMaxHeight&&(0,i.AH)({overflowY:"scroll"}),e=>!e.withBorders&&(0,i.AH)({outline:e.error?`1px dashed ${e.theme.colors.red[300]}`:"none","&:focus":{outline:`1px dashed ${e.theme.colors.black[200]}`}}),e=>e.theme.colors.black[400],e=>(0,i.AH)({minHeight:e.editorMinHeight,maxHeight:e.editorMaxHeight}),e=>e.toolbarBackgroundColor,e=>e.withBorders?(0,i.AH)` 1103 min-height: 0px; 1104 margin-bottom: 0; 1105 padding: 0 !important; 1106 `:(0,i.AH)` 1107 box-shadow: 0px 5px 3px -3px rgba(0, 0, 0, 0.1); 1108 `,e=>e.theme.colors.blue[100],e=>e.theme.colors.blue[200],e=>"simplified"===e.version&&(0,i.AH)({...!e.imageUploadEnabled&&{".trix-button-group--file-tools":{display:"none"}},".trix-button-group--block-tools .trix-button:not(.trix-button--icon-number-list):not(.trix-button--icon-bullet-list)":{display:"none"},".trix-button--icon-bullet-list":{borderLeft:"none"}}),e=>e.withStickyToolbar&&(0,i.AH)({position:"sticky",top:e.toolbarTop||0,marginTop:e.toolbarOffsetY,p:"10px"}),e=>e.isDisabled&&(0,i.AH)({pointerEvents:"none",cursor:"not-allowed",background:"#f3f3f3","trix-toolbar,.trix-button-group":{background:"#f3f3f3 !important"}})),A="https://www.youtube-nocookie.com/embed/",y="https://anchor.fm/";class j extends n.Component{static{this.defaultProps={withStickyToolbar:!1,toolbarTop:0,toolbarOffsetY:-62,inputName:"content",toolbarBackgroun
1108dColor:"white",version:"default","data-cy":"RichTextEditor",videoEmbedEnabled:!1}}constructor(e){super(e),this.editorRef=null,this.mainContainerRef=null,this.isReady=!1,this.initialize=async()=>{this.Trix&&this.editorRef.current&&(this.editorRef.current.addEventListener("trix-change",this.handleChange,!1),this.editorRef.current.addEventListener("trix-attachment-add",this.handleAttachmentAdd),this.editorRef.current.addEventListener("trix-file-accept",this.handleFileAccept),this.editorRef.current.addEventListener("trix-action-invoke",this.trixActionInvoke),this.editorRef.current.addEventListener("trix-initialize",this.trixInitialize),this.isReady=!0,this.setState({text:this.editorRef.current.innerText}))},this.trixBeforeInitialize=()=>{this.Trix.config.blockAttributes.heading1={tagName:"h3"},this.Trix.config.attachments.preview.caption={name:!1,size:!1},this.Trix.config.dompurify.ADD_TAGS=["iframe"],this.Trix.config.dompurify.ADD_ATTR=["allow","allowfullscreen","frameborder","referrerpolicy","src","width","height"];let e=this.Trix.HTMLSanitizer.setHTML,t=this.Trix.config.dompurify,s=this.Trix.HTMLSanitizer,a=["dir","language","data-trix-content-type","data-trix-attachment","alt","title","href","name","target","src","allowfullscreen","frameborder","referrerpolicy","autoplay","width","height"];this.Trix.HTMLSanitizer.setHTML=function(n,i,r){(r=r||{}).forbiddenElements=["script","form","noscript"],r.allowedAttributes=a,r.purifyOptions=t,e.apply(s,[n,i,r])}},this.trixInitialize=e=>{if(this.props.videoEmbedEnabled&&this.injectTrixEmbedButton(e),this.mainContainerRef.current){let e=this.mainContainerRef.current.querySelector("[data-trix-input][name='href']");e?.addEventListener("keydown",e=>{"Enter"===e.key&&this.handleLink()});let t=this.mainContainerRef.current.querySelector("[data-trix-method='setAttribute']");t?.addEventListener("click",this.handleLink)}},this.injectTrixEmbedButton=e=>{let t=` 1109 <div class="trix-dialog" data-trix-dialog="video-url" data-trix-dialog-attribute="video"> 1110 <div class="trix-dialog__link-fields"> 1111 <input type="url" name="video-url" class="trix-input trix-input--dialog trix-input--dialog-embed" placeholder="Enter Video URLâ¦" aria-label="Video URL" data-trix-input=""> 1112 <div class="trix-button-group"> 1113 <input data-cy="add-video-submit" type="button" class="trix-button trix-button--dialog" value="Add Video" data-trix-action="x-add-embed"> 1114 </div> 1115 </div> 1116 <strong>Note: Only YouTube links are supported.</strong> 1117 </div>`,{toolbarElement:s}=e.target;s.querySelector("[data-trix-action=attachFiles]").insertAdjacentHTML("afterend",'<button type="button" tabindex="-1" data-trix-action="x-video-dialog-open" title="Attach Video" class="trix-button trix-button--icon trix-button--video-attach">Attach Video</button>'),s.querySelector(".trix-dialog--link").insertAdjacentHTML("afterend",t)},this.trixActionInvoke=e=>{let{toolbarElement:t}=e.target;if("x-video-dialog-open"===e.actionName){let e=t.querySelector("[data-trix-dialog=video-url]"),s=t.querySelector(".trix-input--dialog-embed");""===e.getAttribute("data-trix-active")?e.removeAttribute("data-trix-active"):(e.setAttribute("data-trix-active",""),s.removeAttribute("disabled"))}else if("x-add-embed"===e.actionName){let e=t.querySelector(".trix-input--dialog-embed").value?.trim();if(e){this.embedIframe(e);let s=t.querySelector("[data-trix-dialog=video-url]");s.querySelector(".trix-input--dialog-embed").value="",""===s.getAttribute("data-trix-active")&&s.removeAttribute("data-trix-active")}}},this.constructVideoEmbedURL=(e,t)=>"youtube"===e?`${A}${t}`:"anchorFm"===e?`${y}${t}`:null,this.parseServiceLink=e=>{let t={youtube:RegExp("(?:https?://)?(?:www\\.)?youtu(?:\\.be/|be\\.com/\\S*(?:watch|embed|shorts)(?:(?:(?=/[^&\\s?]+(?!\\S))/)|(?:\\S*v=|v/)))([^&\\s?]+)","i"),anchorFm:/^(http|https)?:\/\/(www\.)?anchor\.fm\/([^/]+)(\/embed)?(\/episodes\/)?([^/]+)?\/?$/};for(let s in t){let a=t[s].exec(e);if(a)if("anchorFm"!==s)return{service:s,id:a[a.length-1]};else{let e=a[3],t=a[6],n=`${e}/embed`;return{service:s,id:t?`${n}/episodes/${t}`:n}}}return{}},this.embedIframe=e=>{let{id:t,service:s}=this.parseServiceLink(e),a=this.constructVideoEmbedURL(s,t),n=this.Trix;if(a){let e,t=a.replace(/["\\]/g,"");e=["youtube","vimeo"].includes(s)?{contentType:"--embed-iframe-video",content:`<iframe src="${t}?showinfo=0" width="100%" height="394" frameborder="0" allowfullscreen referrerpolicy="str
1117ict-origin-when-cross-origin"/>`}:{contentType:`--embed-iframe-${s}`,content:`<iframe src="${t}" width="100%" frameborder="0"/>`},this.getEditor().insertAttachment(new n.Attachment(e))}},this.handleChange=e=>{this.autolink(),this.props.onChange&&this.props.onChange(e),this.state.error&&this.setState({error:null}),this.props.showCount&&this.setState({text:e.target.innerText})},this.handleFileAccept=e=>{/^image\//.test(e.file.type)?e.file.size>4e6&&(alert("This file is too big (max: 4mb)."),e.preventDefault()):(alert("You can only upload images."),e.preventDefault())},this.handleAttachmentAdd=e=>{let{attachment:t}=e,s=(0,r.A)(t,"attachment.attributes.values.content");if(s?.includes(`<iframe src="${A}`)||s?.includes(`<iframe src="${y}`))return;if(t.file){if("simplified"===this.props.version&&!this.props.imageUploadEnabled)return void t.remove()}else{let e=(0,r.A)(t,"attachment.attributes.values.url");/https:\/\/opencollective-(production|staging)\.s3[.-]us-west-1\.amazonaws\.com/.test(e)||t.remove();return}this.props.setUploading?.(!0);let a=e=>{this.props.setUploading?.(!1),t.setAttributes({url:e,href:e})},n=()=>{this.props.setUploading?.(!1),this.setState({error:"File upload failed"}),t.remove()};return(0,c.Lh)(t.file,this.props.kind,{onProgress:e=>t.setUploadProgress(e),onSuccess:a,onFailure:n}),e},this.handleLink=()=>{let e=this.mainContainerRef.current?.querySelector("[data-trix-input][name='href']"),t=e?.value?.trim();t&&(0,d.isURL)(t,{require_protocol:!1})&&!(0,d.isURL)(t,{require_protocol:!0})&&(e.value=`https://${t}`)},this.autolinkDelimiter=e=>{let t=e.length;for(;t>0;){let s,a=t-1,n=e[a];if(")"===n?s="(":"]"===n?s="[":"}"===n?s="{":'"'===n?s='"':"'"===n&&(s="'"),"?!.,:;*_~".includes(e[a]))t--;else if(s){let a=0,i=0;for(let r=0;r<t;r++)e[r]===s?a++:e[r]===n&&i++;if(a>=i)break;t--}else break}return t},this.editorRef=n.createRef(),this.mainContainerRef=n.createRef(),this.state={id:e.id,error:null,value:this.prepareHTML(e.defaultValue),text:""},this.isReady=!1,this.Trix=s(77653).A,document.addEventListener("trix-before-initialize",this.trixBeforeInitialize)}componentDidMount(){this.state.id?this.isReady||this.initialize():this.setState({id:(0,o.A)()})}componentDidUpdate(e){this.isReady?e.reset!==this.props.reset&&this.getEditor().loadHTML(""):this.initialize()}componentWillUnmount(){document.removeEventListener("trix-before-initialize",this.trixBeforeInitialize),this.isReady&&(this.editorRef.current.removeEventListener("trix-change",this.handleChange),this.editorRef.current.removeEventListener("trix-attachment-add",this.handleAttachmentAdd),this.editorRef.current.removeEventListener("trix-attachment-add",this.handleFileAccept),this.editorRef.current.removeEventListener("trix-action-invoke",this.trixActionInvoke),this.editorRef.current.removeEventListener("trix-initialize",this.trixInitialize),this.isReady=!1)}prepareHTML(e){if(!e)return"";let t=new DOMParser().parseFromString(e,"text/html");return t.querySelectorAll('figure[data-trix-content-type="--embed-iframe-video"]').forEach(e=>{let t=e.querySelector("iframe");if(t){let s={content:t.outerHTML,contentType:"--embed-iframe-video"};e.setAttribute("data-trix-attachment",JSON.stringify(s))}}),t.querySelector("body").innerHTML}getEditor(){return this.editorRef.current.editor}autolink(){let e,t=RegExp("(https?://\\S+\\.\\S+)\\s","ig"),s=this.getEditor(),a=s.getDocument().toString();for(;e=t.exec(a);){let t=e[1];if((0,d.isURL)(t)){let a=e.index,n=this.autolinkDelimiter(t),i=[a,a+n],r=s.getDocument().getCommonAttributesAtRange(i).href,l=t.slice(0,n);r!==l&&this.updateInRange(s,i,0,()=>{s.canActivateAttribute("href")&&s.activateAttribute("href",l)})}}}updateInRange(e,t,s=0,a){let n=e.getSelectedRange();e.setSelectedRange(t),a(),e.setSelectedRange([n[0]+s,n[1]+s])}render(){let{withStickyToolbar:e,toolbarTop:t,toolbarOffsetY:s,toolbarBackgroundColor:i,autoFocus:r,placeholder:l,editorMinHeight:o,withBorders:d,inputName:c,disabled:u,error:A,fontSize:y,version:j,showCount:v,maxLength:b,editorMaxHeight:C,imageUploadEnabled:M}=this.props;return this.state.id?(0,a.jsxs)(f,{withStickyToolbar:e,toolbarTop:t,toolbarOffsetY:s,toolbarBackgroun
1117dColor:i,editorMinHeight:o,editorMaxHeight:C,withBorders:d,version:j,imageUploadEnabled:M,isDisabled:u,error:A,"data-cy":this.props["data-cy"],ref:this.mainContainerRef,className:"focus-within:border-ring",children:[this.state.error&&(0,a.jsx)(h.A,{type:"error",mb:"36px",withIcon:!0,children:this.state.error.toString()}),(0,a.jsx)("input",{id:this.state.id,value:this.state.value,type:"hidden",name:c,disabled:u}),(0,a.jsx)(x.Ay,{fontSize:y,children:(0,a.jsxs)("div",{className:"relative [&>_trix-editor]:focus-visible:outline-hidden",children:[n.createElement("trix-editor",{ref:this.editorRef,input:this.state.id,autofocus:!u&&!!r||void 0,placeholder:l,disabled:u,"aria-label":this.props["aria-label"]}),(0,a.jsx)(m.A,{position:"absolute",bottom:"1em",right:"1em",children:v&&!u&&(0,a.jsxs)(g.A,{textTransform:"uppercase",children:[(0,a.jsx)("span",{children:this.state.text.length}),b&&(0,a.jsxs)("span",{children:[" / ",b]})]})})]})})]}):(0,a.jsx)(p.A,{maxHeight:C&&"number"==typeof C?C+56:void 0,height:o&&"number"==typeof o?o+56:200})}}}}]); 1118//# sourceMappingURL=8084-75644f48b0774771.js.map
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.