@lockerverse/react 0.2.126-dev.1 → 0.2.129-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { n as useLockerverseAuctions, t as UseLockerverseAuctionsResult } from "./use-lockerverse-auctions.js";
1
+ import { n as useLockerverseAuctions, r as AuctionRefreshOptions, t as UseLockerverseAuctionsResult } from "./use-lockerverse-auctions.js";
2
2
  import { CreateLockerverseAuctionOptions, LockerverseAuction, LockerverseAuctionClient, LockerverseSdkError } from "@lockerverse/sdk/auctions";
3
3
  //#region src/use-lockerverse-auction.d.ts
4
4
  type UseLockerverseAuctionResult = {
@@ -10,7 +10,7 @@ type UseLockerverseAuctionResult = {
10
10
  refresh: () => void;
11
11
  };
12
12
  /** Load one auction by slug without requesting the community auction list. */
13
- declare function useLockerverseAuction(options: CreateLockerverseAuctionOptions, auctionSlug: string): UseLockerverseAuctionResult;
13
+ declare function useLockerverseAuction(options: CreateLockerverseAuctionOptions, auctionSlug: string, refreshOptions?: AuctionRefreshOptions): UseLockerverseAuctionResult;
14
14
  //#endregion
15
- export { type UseLockerverseAuctionResult, type UseLockerverseAuctionsResult, useLockerverseAuction, useLockerverseAuctions };
15
+ export { type AuctionRefreshOptions, type UseLockerverseAuctionResult, type UseLockerverseAuctionsResult, useLockerverseAuction, useLockerverseAuctions };
16
16
  //# sourceMappingURL=auction-data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auction-data.d.ts","names":[],"sources":["../src/use-lockerverse-auction.ts"],"mappings":";;;KAUY;EACV,QAAQ;;EAER,SAAS;EACT;EACA,OAAO;EACP;;;iBAIc,sBACd,SAAS,iCACT,sBACC"}
1
+ {"version":3,"file":"auction-data.d.ts","names":[],"sources":["../src/use-lockerverse-auction.ts"],"mappings":";;;KAcY;EACV,QAAQ;;EAER,SAAS;EACT;EACA,OAAO;EACP;;;iBAIc,sBACd,SAAS,iCACT,qBACA,iBAAgB,wBACf"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./immutable-resource-identity.js";import{t}from"./use-lockerverse-auctions.js";import{useCallback as n,useEffect as r,useRef as i,useState as a}from"react";import{createLockerverseAuctionClient as o}from"@lockerverse/sdk/auctions";function s(t,s){e(`auction`,{apiBaseUrl:t.apiBaseUrl,communitySlug:t.communitySlug,environment:t.environment,mediaBaseUrl:t.mediaBaseUrl,slug:s});let c=i(t.onError);c.current=t.onError;let[l]=a(()=>o({...t,onError:e=>c.current?.(e)})),u=i(0),[d,f]=a(0),[p,m]=a({auction:null,error:null,loading:!0});r(()=>{let e=!0,t=u.current;return l.load(s).then(n=>{e&&t===u.current&&m({auction:n,error:null,loading:!1})},n=>{e&&t===u.current&&m(e=>({...e,error:n,loading:!1}))}),()=>{e=!1}},[l,s,d]);let h=n(()=>{u.current+=1,m(e=>({...e,error:null,loading:!0})),f(e=>e+1)},[]);return{...p,client:l,refresh:h}}export{s as useLockerverseAuction,t as useLockerverseAuctions};
1
+ import{t as e}from"./immutable-resource-identity.js";import{n as t,t as n}from"./use-lockerverse-auctions.js";import{useCallback as r,useEffect as i,useRef as a,useState as o}from"react";import{createLockerverseAuctionClient as s}from"@lockerverse/sdk/auctions";function c(n,c,l={}){e(`auction`,{apiBaseUrl:n.apiBaseUrl,communitySlug:n.communitySlug,environment:n.environment,mediaBaseUrl:n.mediaBaseUrl,slug:c});let u=a(n.onError);u.current=n.onError;let[d]=o(()=>s({...n,onError:e=>u.current?.(e)})),f=a(0),[p,m]=o(0),[h,g]=o({auction:null,error:null,loading:!0}),_=r(()=>{f.current+=1,g(e=>({...e,error:null,loading:!0})),m(e=>e+1)},[]),v=t(_,l);return i(()=>{let e=!0,t=f.current,n=v();return d.load(c).then(n=>{e&&t===f.current&&g({auction:n,error:null,loading:!1})},n=>{e&&t===f.current&&g(e=>({...e,error:n,loading:!1}))}).finally(n),()=>{e=!1}},[d,c,p,v]),{...h,client:d,refresh:_}}export{c as useLockerverseAuction,n as useLockerverseAuctions};
2
2
  //# sourceMappingURL=auction-data.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auction-data.js","names":[],"sources":["../src/use-lockerverse-auction.ts"],"sourcesContent":["import {\n type CreateLockerverseAuctionOptions,\n createLockerverseAuctionClient,\n type LockerverseAuction,\n type LockerverseAuctionClient,\n type LockerverseSdkError,\n} from \"@lockerverse/sdk/auctions\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useImmutableResourceIdentity } from \"./immutable-resource-identity.ts\";\n\nexport type UseLockerverseAuctionResult = {\n client: LockerverseAuctionClient;\n /** Last successful snapshot, retained during refresh and refresh errors. */\n auction: LockerverseAuction | null;\n loading: boolean;\n error: LockerverseSdkError | null;\n refresh: () => void;\n};\n\n/** Load one auction by slug without requesting the community auction list. */\nexport function useLockerverseAuction(\n options: CreateLockerverseAuctionOptions,\n auctionSlug: string\n): UseLockerverseAuctionResult {\n useImmutableResourceIdentity(\"auction\", {\n apiBaseUrl: options.apiBaseUrl,\n communitySlug: options.communitySlug,\n environment: options.environment,\n mediaBaseUrl: options.mediaBaseUrl,\n slug: auctionSlug,\n });\n const onErrorRef = useRef(options.onError);\n onErrorRef.current = options.onError;\n const [client] = useState(() =>\n createLockerverseAuctionClient({\n ...options,\n onError: (error) => onErrorRef.current?.(error),\n })\n );\n const generation = useRef(0);\n const [revision, setRevision] = useState(0);\n const [state, setState] = useState<\n Pick<UseLockerverseAuctionResult, \"auction\" | \"loading\" | \"error\">\n >({ auction: null, error: null, loading: true });\n\n useEffect(() => {\n let active = true;\n const requestGeneration = generation.current;\n client.load(auctionSlug).then(\n (auction) => {\n if (active && requestGeneration === generation.current) {\n setState({ auction, error: null, loading: false });\n }\n },\n (error: LockerverseSdkError) => {\n if (active && requestGeneration === generation.current) {\n setState((current) => ({ ...current, error, loading: false }));\n }\n }\n );\n return () => {\n active = false;\n };\n }, [client, auctionSlug, revision]);\n\n const refresh = useCallback(() => {\n generation.current += 1;\n setState((current) => ({ ...current, error: null, loading: true }));\n setRevision((current) => current + 1);\n }, []);\n\n return { ...state, client, refresh };\n}\n"],"mappings":"0PAoBA,SAAgB,EACd,EACA,EAC6B,CAC7B,EAA6B,UAAW,CACtC,WAAY,EAAQ,WACpB,cAAe,EAAQ,cACvB,YAAa,EAAQ,YACrB,aAAc,EAAQ,aACtB,KAAM,CACR,CAAC,EACD,IAAM,EAAa,EAAO,EAAQ,OAAO,EACzC,EAAW,QAAU,EAAQ,QAC7B,GAAM,CAAC,GAAU,MACf,EAA+B,CAC7B,GAAG,EACH,QAAU,GAAU,EAAW,UAAU,CAAK,CAChD,CAAC,CACH,EACM,EAAa,EAAO,CAAC,EACrB,CAAC,EAAU,GAAe,EAAS,CAAC,EACpC,CAAC,EAAO,GAAY,EAExB,CAAE,QAAS,KAAM,MAAO,KAAM,QAAS,EAAK,CAAC,EAE/C,MAAgB,CACd,IAAI,EAAS,GACP,EAAoB,EAAW,QAarC,OAZA,EAAO,KAAK,CAAW,CAAC,CAAC,KACtB,GAAY,CACP,GAAU,IAAsB,EAAW,SAC7C,EAAS,CAAE,UAAS,MAAO,KAAM,QAAS,EAAM,CAAC,CAErD,EACC,GAA+B,CAC1B,GAAU,IAAsB,EAAW,SAC7C,EAAU,IAAa,CAAE,GAAG,EAAS,QAAO,QAAS,EAAM,EAAE,CAEjE,CACF,MACa,CACX,EAAS,EACX,CACF,EAAG,CAAC,EAAQ,EAAa,CAAQ,CAAC,EAElC,IAAM,EAAU,MAAkB,CAChC,EAAW,SAAW,EACtB,EAAU,IAAa,CAAE,GAAG,EAAS,MAAO,KAAM,QAAS,EAAK,EAAE,EAClE,EAAa,GAAY,EAAU,CAAC,CACtC,EAAG,CAAC,CAAC,EAEL,MAAO,CAAE,GAAG,EAAO,SAAQ,SAAQ,CACrC"}
1
+ {"version":3,"file":"auction-data.js","names":[],"sources":["../src/use-lockerverse-auction.ts"],"sourcesContent":["import {\n type CreateLockerverseAuctionOptions,\n createLockerverseAuctionClient,\n type LockerverseAuction,\n type LockerverseAuctionClient,\n type LockerverseSdkError,\n} from \"@lockerverse/sdk/auctions\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useImmutableResourceIdentity } from \"./immutable-resource-identity.ts\";\nimport {\n type AuctionRefreshOptions,\n useAuctionReturnRefresh,\n} from \"./use-auction-return-refresh.ts\";\n\nexport type UseLockerverseAuctionResult = {\n client: LockerverseAuctionClient;\n /** Last successful snapshot, retained during refresh and refresh errors. */\n auction: LockerverseAuction | null;\n loading: boolean;\n error: LockerverseSdkError | null;\n refresh: () => void;\n};\n\n/** Load one auction by slug without requesting the community auction list. */\nexport function useLockerverseAuction(\n options: CreateLockerverseAuctionOptions,\n auctionSlug: string,\n refreshOptions: AuctionRefreshOptions = {}\n): UseLockerverseAuctionResult {\n useImmutableResourceIdentity(\"auction\", {\n apiBaseUrl: options.apiBaseUrl,\n communitySlug: options.communitySlug,\n environment: options.environment,\n mediaBaseUrl: options.mediaBaseUrl,\n slug: auctionSlug,\n });\n const onErrorRef = useRef(options.onError);\n onErrorRef.current = options.onError;\n const [client] = useState(() =>\n createLockerverseAuctionClient({\n ...options,\n onError: (error) => onErrorRef.current?.(error),\n })\n );\n const generation = useRef(0);\n const [revision, setRevision] = useState(0);\n const [state, setState] = useState<\n Pick<UseLockerverseAuctionResult, \"auction\" | \"loading\" | \"error\">\n >({ auction: null, error: null, loading: true });\n\n const refresh = useCallback(() => {\n generation.current += 1;\n setState((current) => ({ ...current, error: null, loading: true }));\n setRevision((current) => current + 1);\n }, []);\n const startRead = useAuctionReturnRefresh(refresh, refreshOptions);\n\n useEffect(() => {\n let active = true;\n const requestGeneration = generation.current;\n const settleRead = startRead();\n client\n .load(auctionSlug)\n .then(\n (auction) => {\n if (active && requestGeneration === generation.current) {\n setState({ auction, error: null, loading: false });\n }\n },\n (error: LockerverseSdkError) => {\n if (active && requestGeneration === generation.current) {\n setState((current) => ({ ...current, error, loading: false }));\n }\n }\n )\n .finally(settleRead);\n return () => {\n active = false;\n };\n }, [client, auctionSlug, revision, startRead]);\n\n return { ...state, client, refresh };\n}\n"],"mappings":"sQAwBA,SAAgB,EACd,EACA,EACA,EAAwC,CAAC,EACZ,CAC7B,EAA6B,UAAW,CACtC,WAAY,EAAQ,WACpB,cAAe,EAAQ,cACvB,YAAa,EAAQ,YACrB,aAAc,EAAQ,aACtB,KAAM,CACR,CAAC,EACD,IAAM,EAAa,EAAO,EAAQ,OAAO,EACzC,EAAW,QAAU,EAAQ,QAC7B,GAAM,CAAC,GAAU,MACf,EAA+B,CAC7B,GAAG,EACH,QAAU,GAAU,EAAW,UAAU,CAAK,CAChD,CAAC,CACH,EACM,EAAa,EAAO,CAAC,EACrB,CAAC,EAAU,GAAe,EAAS,CAAC,EACpC,CAAC,EAAO,GAAY,EAExB,CAAE,QAAS,KAAM,MAAO,KAAM,QAAS,EAAK,CAAC,EAEzC,EAAU,MAAkB,CAChC,EAAW,SAAW,EACtB,EAAU,IAAa,CAAE,GAAG,EAAS,MAAO,KAAM,QAAS,EAAK,EAAE,EAClE,EAAa,GAAY,EAAU,CAAC,CACtC,EAAG,CAAC,CAAC,EACC,EAAY,EAAwB,EAAS,CAAc,EA0BjE,OAxBA,MAAgB,CACd,IAAI,EAAS,GACP,EAAoB,EAAW,QAC/B,EAAa,EAAU,EAgB7B,OAfA,EACG,KAAK,CAAW,CAAC,CACjB,KACE,GAAY,CACP,GAAU,IAAsB,EAAW,SAC7C,EAAS,CAAE,UAAS,MAAO,KAAM,QAAS,EAAM,CAAC,CAErD,EACC,GAA+B,CAC1B,GAAU,IAAsB,EAAW,SAC7C,EAAU,IAAa,CAAE,GAAG,EAAS,QAAO,QAAS,EAAM,EAAE,CAEjE,CACF,CAAC,CACA,QAAQ,CAAU,MACR,CACX,EAAS,EACX,CACF,EAAG,CAAC,EAAQ,EAAa,EAAU,CAAS,CAAC,EAEtC,CAAE,GAAG,EAAO,SAAQ,SAAQ,CACrC"}
@@ -17,6 +17,8 @@ type LockerverseAuctionItemProps = {
17
17
  itemId: string;
18
18
  /** Host navigation; the SDK does not depend on a router. */
19
19
  onBack?: (() => void) | undefined;
20
+ /** Item URL for a fresh page visit from the completed result. */
21
+ returnToItemHref?: string | undefined;
20
22
  /** Disable host navigation/reset while submitting or resolving an uncertain operation.
21
23
  * This callback can run after unmount when a sent request resolves. */
22
24
  onInteractionLockChange?: (locked: boolean) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"auction-item.d.ts","names":[],"sources":["../src/auction-item-types.ts","../src/lockerverse-auction-item.tsx"],"mappings":";;;;;KAaY;EACV;EACA;EACA,MAAM;EACN,SAAS,YAAY;EACrB,SAAS;EACT,YAAY;;KAGF;EACV,SAAS;EACT,QAAQ;EACR;;EAEA;;;EAGA,2BAA2B;EAC3B;EACA;EACA,QAAQ;EACR,QAAQ;EACR,eAAe;;EAEf,kBAAkB,QAAQ;;EAE1B,sBAAsB,QAAQ;EAC9B,4BACE,UAAU;EAEZ,eAAe;;EAEf,iBAAiB;;;;iBC0XH,uBAAuB,OAAO,8CAA2B,IAAA"}
1
+ {"version":3,"file":"auction-item.d.ts","names":[],"sources":["../src/auction-item-types.ts","../src/lockerverse-auction-item.tsx"],"mappings":";;;;;KAaY;EACV;EACA;EACA,MAAM;EACN,SAAS,YAAY;EACrB,SAAS;EACT,YAAY;;KAGF;EACV,SAAS;EACT,QAAQ;EACR;;EAEA;;EAEA;;;EAGA,2BAA2B;EAC3B;EACA;EACA,QAAQ;EACR,QAAQ;EACR,eAAe;;EAEf,kBAAkB,QAAQ;;EAE1B,sBAAsB,QAAQ;EAC9B,4BACE,UAAU;EAEZ,eAAe;;EAEf,iBAAiB;;;;iBC4XH,uBAAuB,OAAO,8CAA2B,IAAA"}
@@ -1,2 +1,2 @@
1
- import{a as e,c as t,i as n,n as r,r as i,s as a,t as o}from"./use-auction-boundary.js";import{d as s,f as c,i as l,m as u,n as d,r as f,t as p}from"./host-callback.js";import{i as m,n as h,t as g}from"./stripe-loader.js";import{t as _}from"./auction-result2.js";import{ArrowRight as v,ChevronDown as y,ChevronLeft as b,ChevronRight as x,Clock3 as S,Gavel as C,Pause as w,Play as ee,ShieldCheck as T,TimerReset as E,X as D}from"lucide-react";import{useCallback as O,useEffect as k,useId as A,useMemo as j,useRef as M,useState as N}from"react";import{Fragment as P,jsx as F,jsxs as I}from"react/jsx-runtime";import{LockerverseSdkError as L,calculateLockerverseAuctionPricing as R,getLockerverseAuctionMinimumBid as z}from"@lockerverse/sdk/auctions";import{AddressElement as B,Elements as V,PaymentElement as H,useElements as te,useStripe as U}from"@stripe/react-stripe-js";import{Dialog as W}from"@base-ui/react/dialog";import G from"embla-carousel-autoplay";import K from"embla-carousel-react";function q(e){return{business:{name:`Lockerverse`},fields:{billingDetails:{address:`never`,email:`never`,name:`never`,phone:`never`}},terms:{applePay:e?`auto`:`never`,auBecsDebit:`never`,bancontact:`never`,card:`always`,cashapp:`never`,googlePay:`never`,ideal:`never`,paypal:e?`auto`:`never`,sepaDebit:`never`,sofort:`never`,usBankAccount:`never`},wallets:{applePay:e?`auto`:`never`,googlePay:`never`}}}function ne(e){let{isPurchase:t,item:r,pricing:i,id:a}=e;return I(`form`,{className:`lockerverse-auctions__checkout`,noValidate:!0,onSubmit:e.onSubmit,children:[I(`div`,{className:`lockerverse-auctions__checkout-header`,children:[I(`div`,{className:`lockerverse-auctions__checkout-navigation`,children:[F(`button`,{"aria-label":`Back`,className:`lockerverse-auctions__checkout-back`,disabled:!e.onBack,onClick:e.onBack,type:`button`,children:F(b,{"aria-hidden":`true`,size:20})}),I(`div`,{children:[F(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Step 2 of 2`}),F(`p`,{children:t?`Secure checkout`:`Secure payment method`})]})]}),F(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:e.communityName}),F(`h2`,{children:t?`Finalize your purchase.`:`Finalize your bid authorization.`}),F(`p`,{className:`lockerverse-auctions__checkout-summary`,children:t?I(P,{children:[`Pay `,F(`strong`,{children:n(i.totalCents)}),` for`,` `,e.quantity,` `,e.quantity===1?`item`:`items`,` of`,` `,F(`strong`,{children:r.name}),`. Your card is charged immediately once checkout succeeds.`]}):I(P,{children:[`Authorize a payment method for your bid of`,` `,F(`strong`,{children:n(i.subtotalCents)}),` on`,` `,F(`strong`,{children:r.name}),`. Your card is only charged if this bid wins the item.`]})}),r.collectShippingAddress&&I(`div`,{className:`lockerverse-auctions__checkout-physical`,children:[F(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Physical item`}),F(`p`,{children:`This item requires a delivery address. Billing details are used by default, and you can switch to a separate delivery address below if needed.`})]})]}),I(`div`,{className:`lockerverse-auctions__checkout-body`,children:[e.showFields&&I(`fieldset`,{disabled:e.locked,children:[I(`div`,{className:`lockerverse-auctions__checkout-contact`,children:[F(c,{error:e.contactErrors.email,id:`${a}-email`,label:`Email`,name:`email`,onChange:t=>e.onEmailChange(t.target.value),required:!0,value:e.email}),F(u,{error:e.contactErrors.phone,id:`${a}-phone`,label:`Phone`,children:F(d,{country:e.phoneCountry,error:e.contactErrors.phone,errorId:`${a}-phone-error`,id:`${a}-phone`,name:`phone`,onChange:e.onPhoneChange,required:!0,value:e.phone})})]}),I(`section`,{"aria-label":`Payment Information`,className:`lockerverse-auctions__checkout-section`,children:[I(`div`,{className:`lockerverse-auctions__checkout-section-heading`,children:[F(`h3`,{children:`Payment Information`}),F(`p`,{children:t?`Processed securely and charged immediately for this purchase.`:`Stored securely and charged only if your bid finishes on top.`})]}),F(H,{onLoadError:e.onPaymentLoadError,options:q(t)})]}),I(`section`,{"aria-label":`Billing Details`,className:`lockerverse-auctions__checkout-section`,children:[F(`h3`,{children:`Billing Details`}),F(B,{onChange:e.onBillingChange,options:{mode:`billing`}}),F(`p`,{children:t?`Use your full name here. We use the email and phone above for purchase confirmation and fulfillment updates.`:`Use the bidder's full name here. We use the email and phone above to contact you if this bid is outbid or wins.`})]}),r.collectShippingAddress&&I(`section`,{"aria-label":`Delivery Details`,className:`lockerverse-auctions__checkout-section`,children:[I(`label`,{className:`lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery`,htmlFor:`${a}-delivery-same-as-billing`,children:[F(s,{checked:e.sameAsBilling,id:`${a}-delivery-same-as-billing`,onChange:t=>e.onSameAsBillingChange(t.target.checked)}),I(`span`,{children:[F(`strong`,{children:`Delivery address is the same as billing`}),F(`span`,{children:`Leave this on for the fastest flow. Turn it off only if the delivery address should differ from the billing details above.`})]})]}),!e.sameAsBilling&&I(P,{children:[F(`h3`,{children:`Delivery Address`}),F(B,{onChange:e.onShippingChange,options:{mode:`shipping`}})]})]}),e.serviceFeeEnabled&&F(J,{...e})]}),e.message&&F(`p`,{"aria-live":`polite`,className:`lockerverse-auctions__notice`,role:`status`,children:e.message}),!e.isTerminal&&I(`div`,{className:`lockerverse-auctions__checkout-footer`,children:[I(`p`,{children:[t?`By continuing, you agree to be charged for this purchase.`:`By continuing, you agree to have this payment method stored for item settlement if your bid is the winning offer.`,r.collectShippingAddress?` Your delivery details are stored with the ${t?`order`:`bid`} so the seller can fulfill the item after payment.`:``]}),I(`button`,{className:`lockerverse-auctions__button lockerverse-auctions__checkout-submit`,disabled:e.submitDisabled,type:`submit`,children:[e.buttonText,F(v,{"aria-hidden":`true`,size:16})]})]})]})]})}function J(e){let{isPurchase:t,pricing:r}=e;return F(`section`,{"aria-label":`Processing fees`,className:`lockerverse-auctions__checkout-section`,children:e.onIncludeServiceFeeChange?I(`label`,{className:`lockerverse-auctions__checkout-checkbox`,htmlFor:`${e.id}-service-fee`,children:[F(s,{checked:e.includeServiceFee,id:`${e.id}-service-fee`,onChange:t=>e.onIncludeServiceFeeChange?.(t.target.checked)}),I(`span`,{children:[I(`strong`,{children:[t?`Add`:`If I win, add`,` `,n(e.serviceFeeCents),` to help cover processing fees`]}),I(`span`,{children:[t?`Total`:`Total if I win`,`:`,` `,n(r.totalCents)]})]})]}):I(`p`,{children:[t?`Total`:`Total if I win`,`:`,` `,n(r.totalCents)]})})}function Y(e,t,n){return R(e,t.saleMode===`buy_now`?(t.buyNowPriceAmount??0)*n.quantity:n.amount,n.includeServiceFee)}function re(t,n,r){if(e(t,n)!==`active`)return`This item is not accepting bids or purchases.`;if(n.saleMode===`hybrid`)return`This item type is not supported for checkout.`;if(n.saleMode===`buy_now`){if(n.isSoldOut||n.availableQuantity===0)return`This item is sold out.`;if(!(n.buyNowPriceAmount&&Number.isSafeInteger(r.quantity))||r.quantity<1||n.availableQuantity!==null&&r.quantity>n.availableQuantity)return`Select an available quantity.`}else if(!Number.isSafeInteger(r.amount)||r.amount%100!=0||r.amount<z(n))return`Enter a whole-dollar bid at or above the minimum bid.`;return null}function ie(e,t,n,r,i){return e.payment?.publishableKey!==t.payment?.publishableKey||e.payment?.connectedAccountId!==t.payment?.connectedAccountId||e.serviceFeeEnabled!==t.serviceFeeEnabled||n.saleMode!==r.saleMode||n.collectShippingAddress!==r.collectShippingAddress||JSON.stringify(Y(e,n,i))!==JSON.stringify(Y(t,r,i))}function ae(e){return{expectedServiceFeeCents:e.serviceFeeCents,expectedSubtotalCents:e.subtotalCents,expectedTotalCents:e.totalCents}}async function oe({stripe:e,elements:t,email:n,phone:r,billing:i,shipping:a,collectShippingAddress:o}){if(!(i?.complete&&i.value.name.trim()))throw Error(`Complete your billing name and address.`);if(o&&!(a?.complete&&a.value.name.trim()))throw Error(`Complete your shipping name and address.`);let s=await t.submit();if(s.error)throw Error(s.error.message??`Check your payment details.`);let c=await e.createConfirmationToken({elements:t,params:{payment_method_data:{allow_redisplay:`always`,billing_details:{address:i.value.address,email:n,name:i.value.name,phone:r}},return_url:window.location.href,...o&&a?{shipping:{address:a.value.address,name:a.value.name,phone:r}}:void 0}});if(c.error||!c.confirmationToken)throw Error(c.error?.message??`Unable to prepare payment details.`);return c.confirmationToken.id}async function se(e,t){if(!t.requiresAction)return;if(!t.clientSecret)throw Error(`Payment confirmation is incomplete. Check its status before trying again.`);let n=await e.handleNextAction({clientSecret:t.clientSecret});if(n.error)throw Error(n.error.message??`Payment confirmation is incomplete.`)}function ce(e,t,n){return e===`busy`?n?`Processing...`:`Authorizing...`:e===`retry`?`Retry original purchase`:t?`Check purchase status`:n?`Buy Now`:`Authorize Bid`}function X(e){let{auction:t,item:n,selection:r,client:i,onReview:a,onBack:o}=e,s=U(),c=te(),u=A(),[d,h]=N(e.contact?.email??``),[g,_]=N(e.contact?.phone??``),[v,y]=N(()=>l(e.contact?.phone??``)),[b,x]=N({}),[S,C]=N(!0),[w,ee]=N(null),[T,E]=N(null),[D,O]=N(e.resumePurchase??null),[j,P]=N(e.resumePurchase?`pending`:`ready`),[I,R]=N(null),z=M(e.resumePurchase?.submission.clientRequestId??null),B=j===`complete`||j===`uncertain`,V=M(!1),H=M(!0),W=M(e);W.current=e;let G=M(!1);function K(e){H.current&&P(e),p(W.current.onInteractionLockChange,e!==`ready`&&e!==`complete`)}function q(e){H.current&&R(e)}function J(e){K(e===`bid`?`uncertain`:`pending`),q(e===`bid`?`We could not confirm your bid. Do not submit another bid until you check your email or contact the auction organizer.`:`We could not confirm the purchase result. Check its status using the same purchase request.`),G.current||(G.current=!0,p(W.current.onUncertain,e))}k(()=>(H.current=!0,()=>{H.current=!1}),[]);let X=!!(D??e.resumePurchase)||n.saleMode===`buy_now`,Z=D?.pricing??e.resumePurchase?.pricing??Y(t,n,r),le=D?.payment??e.resumePurchase?.payment??t.payment;function Q(e){H.current&&O(e),p(W.current.onPurchaseRecoveryChange,e)}function ue(e){e.status===`paid`?(z.current=null,Q(null),K(`complete`),p(W.current.onResult,{kind:`purchase`,purchaseId:e.purchaseId,quantity:e.quantity,serviceFeeCents:e.serviceFeeCents,status:`paid`,subtotalCents:e.subtotalCents,totalCents:e.totalCents,unitAmountCents:e.subtotalCents/e.quantity}),G.current||(G.current=!0,p(W.current.onPurchaseComplete,e))):e.status===`pending_payment`?(K(`pending`),q(`Your purchase is pending. Check its status before making another payment.`)):(z.current=null,Q(null),K(`ready`),q(`This purchase is ${e.status.replaceAll(`_`,` `)}. You can start a new purchase.`))}function de(){let e=f(g,v),t=m({email:d,phone:e},!0);return x(t.errors),t.value?{email:t.value.email,phone:e}:(document.getElementById(`${u}-${t.errors.email?`email`:`phone`}`)?.focus(),null)}async function fe(e){if(!e)throw Error(`Check the contact fields below.`);if(!(s&&c&&t.payment))throw Error(`Payment details are still loading.`);let o=await i.load(t.slug);if(!H.current)return null;let l=o.items.find(e=>e.id===n.id);if(!l)return a(o,`This item is no longer available.`),null;let u=re(o,l,r);if(u||ie(t,o,n,l,r))return a(o,u??`The checkout details changed. Review them before continuing.`),null;let d=await oe({billing:w,collectShippingAddress:n.collectShippingAddress,elements:c,email:e.email,phone:e.phone,shipping:S?w:T,stripe:s});return H.current?{confirmationToken:d,email:e.email,includeServiceFee:r.includeServiceFee,phone:e.phone,...ae(Z)}:null}async function pe(e){let a=await i.createBid(t.slug,n.id,{...e,amount:r.amount});if(a.requiresAction){if(!(H.current&&s)){J(`bid`);return}await se(s,a)}K(`complete`),p(W.current.onResult,{amountCents:a.subtotalCents,kind:`bid`}),G.current||(G.current=!0,p(W.current.onBidSubmitted,a))}async function $(e,r){if(e.requiresAction){if(!(H.current&&s)){J(`purchase`);return}await se(s,e);let a=await i.getPurchaseStatus(t.slug,n.id,r.submission.clientRequestId);a?ue(a):(K(`pending`),q(`Payment status is not available yet. Check again shortly.`));return}ue(e),!H.current&&e.status===`pending_payment`&&J(`purchase`)}async function me(e){let r=await i.getPurchaseStatus(t.slug,n.id,e.submission.clientRequestId);if(r)await $(r,e);else{if(!H.current){J(`purchase`);return}K(`retry`),q(`No purchase is recorded yet. You can retry the original purchase with the same request ID.`)}}async function he(e,r){let a=await i.getPurchaseStatus(t.slug,n.id,r.submission.clientRequestId);if(a){await $(a,r);return}Q(null),K(`ready`),q(`The purchase was rejected. Review the item and payment details before trying again. (${e.status??`validation`})`)}async function ge(e,t,n,r){let i=t&&(!(e instanceof L)||e.recoveryRecommended);if(q(e instanceof Error?e.message:`Unable to complete this request.`),X&&n){if(!r&&e instanceof L&&!e.recoveryRecommended)try{await he(e,n);return}catch{}J(`purchase`)}else i?J(`bid`):K(`ready`)}function _e(){return z.current??=globalThis.crypto.randomUUID(),z.current}function ve(){return H.current?!0:(D||(Q(null),K(`ready`)),!1)}async function ye(e,r){if(r){await me(e);return}ve()&&await $(await i.createPurchase(t.slug,n.id,e.submission),e)}let be=s&&c&&le;function xe(){if(V.current||B)return null;if(!be)return q(`Payment details are still loading.`),null;let e=D?null:de();return D||e?{checkoutPayment:be,contact:e,retryOriginal:j===`retry`}:null}async function Se(e){e.preventDefault();let i=xe();if(!i)return;let{contact:a,checkoutPayment:o,retryOriginal:s}=i;V.current=!0,G.current=!1,K(`busy`),q(null);let c=!1,l=D;try{if(!l){let e=await fe(a);if(!(e&&H.current)){K(`ready`);return}if(!X){c=!0,await pe(e);return}l=Object.freeze({auctionId:t.id,item:n,itemId:n.id,payment:Object.freeze({...o}),pricing:Z,submission:Object.freeze({...e,clientRequestId:_e(),paymentMethodTypes:Object.freeze([`card`]),quantity:r.quantity})}),Q(l)}c=!0,await ye(l,!!D&&!s)}catch(e){await ge(e,c,l,D!==null&&!s)}finally{V.current=!1}}let Ce=ce(j,D!==null,X),we=j!==`ready`;return F(ne,{buttonText:Ce,communityName:e.communityName??t.name,contactErrors:b,email:d,id:u,includeServiceFee:r.includeServiceFee,isPurchase:X,isTerminal:B,item:n,locked:we,message:I,onBack:j===`ready`?o:void 0,onBillingChange:ee,onEmailChange:t=>{h(t),e.onContactChange?.({email:t,phone:f(g,v)})},onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPaymentLoadError:()=>q(`Unable to load payment form.`),onPhoneChange:({value:t,country:n})=>{_(t),y(n),e.onContactChange?.({email:d,phone:f(t,n)})},onSameAsBillingChange:C,onShippingChange:E,onSubmit:Se,phone:g,phoneCountry:v,pricing:Z,quantity:r.quantity,sameAsBilling:S,serviceFeeCents:D?Z.serviceFeeCents:Y(t,n,{...r,includeServiceFee:t.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:t.serviceFeeEnabled,showFields:!(D||B),submitDisabled:j===`busy`||!s||!c})}const Z=6e3;function le(e,t){let n=M(Z),r=M(null),[i,a]=N(Z),o=j(()=>G({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=K({duration:t?0:25,loop:!0},[o]),l=O(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/Z})`)},[]),u=O(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(Z,e))),o.stop(),l()},[o,l]),d=O(()=>{n.current=Z,a(Z),o.reset(),l()},[o,l]);return k(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),k(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(Z,i)),l(),t=requestAnimationFrame(r))},i=()=>{cancelAnimationFrame(t),e&&(t=requestAnimationFrame(r))},a=()=>cancelAnimationFrame(t),s=()=>{e&&o.play()};return c.on(`select`,d).on(`reInit`,s).on(`autoplay:timerset`,i).on(`autoplay:timerstopped`,a),l(),i(),()=>{a(),c.off(`select`,d).off(`reInit`,s).off(`autoplay:timerset`,i).off(`autoplay:timerstopped`,a)}},[c,o,e,n,d,l]),{embla:c,freeze:u,progressRef:r,reset:d,viewportRef:s}}function Q({photos:e,name:t,selected:n,paused:i=!1,photoButtonRef:a,onSelect:o,onExpand:s}){let c=M(null),l=M(null),u=M([]),[d,f]=N(!0),[p,m]=N(!1),[h,g]=N(!1),[_,v]=N(!1),[y,S]=N(!1),{ref:C,visible:T}=r(),[E,D]=N(!1),[O,A]=N(!0),j=M(null),L=`lockerverse-auction-gallery__control ${O||E||h?`is-visible`:``}`,R=()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>D(!1),2e3)},z=e=>{if(e.pointerType!==`mouse`){A(!0);return}D(!0),j.current&&clearTimeout(j.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||R()};k(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>A(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(j.current??void 0)}},[]);let B=!(i||d||p||h||_||y)&&T,V=e.length,H=V?(n%V+V)%V:0,{viewportRef:te,embla:U,progressRef:W,freeze:G,reset:K}=le(B&&V>1,d);k(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>f(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),k(()=>{if(!U)return;let e=()=>o(U.selectedScrollSnap());return U.on(`select`,e).on(`reInit`,e),()=>{U.off(`select`,e).off(`reInit`,e)}},[U,o]),k(()=>{U&&U.selectedScrollSnap()!==H&&U.scrollTo(H,!0)},[U,H]),k(()=>{let e=()=>{document.hidden&&G()},t=()=>S(!1);return e(),document.addEventListener(`visibilitychange`,e,!0),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{document.removeEventListener(`visibilitychange`,e,!0),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[G]);let q=e=>{U?.scrollTo((e+V)%V,d),K()};return k(()=>{let e=l.current;l.current=null,e&&document.activeElement===e&&C.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[H,C]),k(()=>{let e=c.current,t=u.current[H];if(!(e&&t))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.left<n.left?e.scrollLeft-=n.left-r.left:r.right>n.right&&(e.scrollLeft+=r.right-n.right)},[H,V]),I(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||g(!1)},onFocusCapture:e=>g(e.target.matches(`:focus-visible`)),onKeyDown:e=>{V<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),e.target instanceof HTMLButtonElement&&e.target.classList.contains(`lockerverse-auction-gallery__photo`)&&(l.current=e.target),q(H+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&m(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&m(!1)},ref:C,children:[V?I(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:z,onPointerLeave:R,onPointerMove:z,children:[F(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{G(),S(!0)},ref:te,children:F(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,n)=>F(`div`,{"aria-hidden":n!==H,className:`lockerverse-auction-gallery__slide`,children:F(`button`,{"aria-label":`View photo ${n+1} of ${t} at full size`,className:`lockerverse-auction-gallery__photo`,onClick:()=>{s(n)},ref:n===H?a:void 0,tabIndex:n===H?0:-1,type:`button`,children:F(`img`,{alt:`${t}, ${n+1} of ${V}`,className:`lockerverse-auction-gallery__image`,draggable:!1,height:900,loading:n===0||n===H||n===(H+1)%V?`eager`:`lazy`,sizes:`(max-width: 1280px) 100vw, 45vw`,src:e,width:1200})})},`${e}-${n}`))})}),V>1&&!d&&I(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[F(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:F(`div`,{className:`lockerverse-auction-gallery__progress`,ref:W,style:{transform:`scaleX(0)`}})}),F(`button`,{"aria-label":_?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${L}`,"data-gallery-control":!0,onClick:()=>v(e=>!e),title:_?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:F(_?ee:w,{"aria-hidden":`true`,size:13})})]}),V>1&&I(P,{children:[F(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${L}`,"data-gallery-control":!0,onClick:()=>q(H-1),type:`button`,children:F(b,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),F(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${L}`,"data-gallery-control":!0,onClick:()=>q(H+1),type:`button`,children:F(x,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):F(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),V>1&&F(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:c,children:F(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>F(`button`,{"aria-label":`Show photo ${t+1} of ${V}`,"aria-pressed":H===t,className:`lockerverse-auction-gallery__thumbnail ${H===t?`is-selected`:``}`,onClick:()=>q(t),ref:e=>{u.current[t]=e},type:`button`,children:F(`img`,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function ue({images:e,fallbackImage:t,name:n}){let r=[...new Set(e.filter(Boolean))];!r.length&&t&&r.push(t);let[i,a]=N(0),[o,s]=N(!1),c=M(null),l=M(null),u=r.length,d=u?(i%u+u)%u:0;return I(P,{children:[F(Q,{name:n,onExpand:e=>{a(e),s(!0)},onSelect:a,paused:o,photoButtonRef:c,photos:r,selected:d}),u>0&&F(W.Root,{onOpenChange:s,open:o,children:I(W.Portal,{children:[F(W.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),I(W.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:c,onKeyDown:e=>{u<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),a((d+(e.key===`ArrowRight`?1:-1)+u)%u))},children:[I(W.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,d+1,` of `,u]}),I(`div`,{className:`lockerverse-auction-gallery__full-image`,onTouchCancel:()=>{l.current=null},onTouchEnd:e=>{let t=l.current;l.current=null;let n=e.changedTouches.item(0);if(!(t&&n)||u<2)return;let r=n.clientX-t.x,i=n.clientY-t.y;Math.abs(r)>=45&&Math.abs(r)>Math.abs(i)*1.3&&a((d+(r<0?1:-1)+u)%u)},onTouchMove:e=>{e.touches.length!==1&&(l.current=null)},onTouchStart:e=>{let t=e.touches.item(0);l.current=e.touches.length===1&&t?{x:t.clientX,y:t.clientY}:null},children:[F(`img`,{alt:`${n}, ${d+1} of ${u}`,height:900,src:r[d],width:1200}),o&&u>1&&F(`img`,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,src:r[(d+1)%u],width:1200})]}),F(W.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:F(D,{"aria-hidden":`true`,size:22})}),u>1&&I(P,{children:[F(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>a((d-1+u)%u),type:`button`,children:F(b,{"aria-hidden":`true`,size:28})}),F(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>a((d+1)%u),type:`button`,children:F(x,{"aria-hidden":`true`,size:28})})]})]})]})})]})}function de(e){return F(e===`Buy Now`?T:e===`Available`||e===`Increment`?E:C,{"aria-hidden":`true`,size:16})}function fe(e,t){return e.saleMode===`buy_now`?[[`Buy Now`,n(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:t===`finished`?[[`Final bid`,e.maxBidAmount?n(e.maxBidAmount):`No bids`]]:[[`Current bid`,n(e.maxBidAmount??0)],[`Floor`,n(e.minBidAmount??0)],[`Increment`,n(e.bidIncrementAmount??100)]]}function pe({auction:r,item:a}){o(a.startAt??r.startAt,a.endAt??r.endAt);let[s,c]=N(!1),l=A(),u=e(r,a),d={active:`Closes`,draft:`Opens`,finished:`Closed`}[u],f=i(r,u,a),p=a.saleMode===`buy_now`,m=(a.description??``).trim().length>240,h=fe(a,u);return I(`section`,{className:`lockerverse-auctions__item-summary`,children:[F(ue,{fallbackImage:a.image??r.configuration.image??r.community?.banner??r.community?.thumbnail??null,images:a.images,name:a.name}),I(`div`,{className:`lockerverse-auctions__item-copy`,children:[F(`h2`,{children:a.name}),a.description?I(`div`,{className:`lockerverse-auctions__item-description`,children:[F(t,{className:!s&&m?`lockerverse-auctions__description-clamped`:void 0,description:a.description,id:l}),m?I(`button`,{"aria-controls":l,"aria-expanded":s,className:`lockerverse-auctions__description-toggle`,onClick:()=>c(!s),type:`button`,children:[s?`Hide description`:`Read full description`,` `,F(y,{"aria-hidden":`true`,size:16,style:{transform:s?`rotate(180deg)`:void 0}})]}):null]}):null,I(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[h.map(([e,t])=>I(`div`,{className:`lockerverse-auctions__stat-row`,children:[I(`dt`,{children:[de(e),e]}),F(`dd`,{children:t})]},e)),I(`div`,{className:`lockerverse-auctions__stat-row`,children:[I(`dt`,{children:[F(S,{"aria-hidden":`true`,size:16}),d]}),F(`dd`,{className:`lockerverse-auctions__stat-date`,children:f})]}),!p&&u===`finished`?I(`div`,{className:`lockerverse-auctions__stat-footer`,children:[I(`div`,{children:[F(`dt`,{children:`Floor`}),F(`dd`,{children:n(a.minBidAmount??0)})]}),I(`div`,{children:[F(`dt`,{children:`Bid increment`}),F(`dd`,{children:n(a.bidIncrementAmount??100)})]})]}):null]})]})]})}const $=/^\d+$/;function me(e,t){return $.test(e)&&Number.isSafeInteger(Number(e)*t)?`Total: ${n(Number(e)*t)}`:`Enter a whole-number quantity.`}function he(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function ge(e,t){return a(e)?`This item is sold out.`:t===`draft`?`This item is not open yet.`:t===`finished`?e.saleMode===`buy_now`?`Purchases are closed for this item.`:`Bidding is closed for this item.`:`This item is not available.`}function _e(e,t,n){return a(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${i(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function ve(e,t,n,r){return{amount:t?0:Number(r)*100,includeServiceFee:n?n.includeServiceFee:e.serviceFeeEnabled&&e.serviceFeeDefaultChecked,quantity:t?Number(r):1}}function ye({auction:t,item:r,initialSelection:i,onContinue:s,onError:c,onBack:l}){let u=r.saleMode===`buy_now`,d=Math.ceil(z(r)/100),[f,p]=N(he(u,i,d)),[m,h]=N(null),g=A();o(r.startAt??t.startAt,r.endAt??t.endAt);let _=e(t,r),y=_===`active`&&!a(r)&&r.saleMode!==`hybrid`;function b(e){if(e.preventDefault(),!$.test(f)){h(u?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let n=ve(t,u,i,f),a=re(t,r,n);if(a){h(a),c(a);return}try{Y(t,r,n)}catch{h(`Enter a valid amount or quantity.`);return}s(n)}return y?I(`form`,{className:`lockerverse-auctions__selection`,onSubmit:b,children:[F(be,{buyNow:u,item:r,minimum:d}),I(`div`,{className:`lockerverse-auctions__selection-body`,children:[I(`label`,{className:`lockerverse-auctions__field`,htmlFor:g,children:[u?`Quantity`:`Your bid amount`,I(`span`,{className:`lockerverse-auctions__amount-control`,children:[u?null:F(`span`,{"aria-hidden":`true`,children:`$`}),F(`input`,{"aria-describedby":`${g}-help`,"aria-invalid":!!m,autoComplete:`off`,id:g,inputMode:`numeric`,onChange:e=>{p(e.target.value),h(null)},placeholder:u?`1`:String(d),required:!0,value:f})]})]}),m?F(`p`,{role:`alert`,children:m}):null,F(`p`,{id:`${g}-help`,children:u?me(f,r.buyNowPriceAmount??0):`Enter a whole-dollar bid of at least ${n(d*100)}. Bid increment: ${n(r.bidIncrementAmount??100)}.`}),I(`div`,{className:`lockerverse-auctions__selection-footer`,children:[F(`p`,{children:u?`Continuing moves you into secure checkout where your payment is processed immediately.`:`Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.`}),I(`button`,{className:`lockerverse-auctions__button`,disabled:!t.payment,type:`submit`,children:[u?`Continue to Checkout`:`Continue to Payment`,` `,F(v,{"aria-hidden":`true`,size:16})]})]}),t.payment?null:F(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):I(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[F(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),F(`h3`,{children:ge(r,_)}),F(`p`,{children:_e(t,r,_)}),l?I(`button`,{className:`lockerverse-auctions__button`,onClick:l,type:`button`,children:[`Browse auction items `,F(v,{"aria-hidden":`true`,size:16})]}):null]})}function be({item:e,buyNow:t,minimum:r}){return I(`div`,{className:`lockerverse-auctions__selection-header`,children:[F(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),F(`h3`,{children:t?`Buy this item now.`:`Place your bid.`}),F(`p`,{children:t?`Choose how many you want, then complete the secure checkout.`:`Enter the bid amount you want to place for this item. You are only charged if this bid wins after bidding closes.`}),I(`p`,{children:[t?`Price: `:`Minimum qualifying bid: `,F(`strong`,{children:n(t?e.buyNowPriceAmount??0:r*100)})]}),t&&e.availableQuantity!==null?I(`p`,{children:[e.availableQuantity,` available`]}):null,e.collectShippingAddress?F(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function xe(e){let{auction:t,item:n,selection:r,theme:i=`dark`,stripeLoader:a=g,style:o,onBack:s,resumePurchase:c}=e,[l,u]=N(null),[d,f]=N(!1),[p,m]=N(0),_=h(e.appearanceRoot,i,o,e.interactionLocked),v=c?.payment??t.payment;if(k(()=>{let e=!0;if(!v){f(!0);return}return Promise.resolve().then(()=>a(v.publishableKey,v.connectedAccountId?{stripeAccount:v.connectedAccountId}:void 0)).then(t=>{e&&(u(t),f(!t))},()=>{e&&f(!0)}),()=>{e=!1}},[v,a,p]),d)return I(`div`,{children:[F(`p`,{role:`alert`,children:`Payment details could not load.`}),c?null:F(`button`,{onClick:s,type:`button`,children:`Back to item`}),F(`button`,{onClick:()=>{f(!1),u(null),m(e=>e+1)},type:`button`,children:`Try again`})]});if(!(l&&_))return I(`div`,{children:[F(`p`,{role:`status`,children:`Loading secure payment details…`}),c?null:F(`button`,{onClick:s,type:`button`,children:`Back to item`})]});let y={mode:`setup`,setupFutureUsage:`off_session`};c?y={amount:c.pricing.totalCents,currency:`usd`,mode:`payment`}:n.saleMode===`buy_now`&&(y={amount:Y(t,n,r).totalCents,currency:`usd`,mode:`payment`});let b={...y,appearance:_,currency:`usd`,paymentMethodTypes:[`card`],syncAddressCheckbox:`none`};return F(V,{options:b,stripe:l,children:F(X,{...e})})}function Se({buyNow:e}){return I(`div`,{className:`lockerverse-auctions__progress`,children:[I(`span`,{children:[F(e?T:C,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),I(`span`,{children:[F(T,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),I(`span`,{children:[F(E,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}function Ce(e){let{auction:t,item:n,outcome:r}=e;return F(_,{auctionName:t.name,className:e.className,closesAtLabel:i(t,`active`,n),communityName:e.communityName??t.community?.name,focusHeading:!0,imageUrl:n.image??n.images[0]??t.configuration.image??void 0,itemName:n.name,outcome:r,primaryAction:e.onBack?{label:`View auction items`,onClick:e.onBack}:void 0,style:{"--lockerverse-accent":t.community?.color??`#6f8f6d`,...e.style},theme:e.theme})}function we(t){let{auction:n,itemId:r,resumePurchase:i,className:a,theme:s=`dark`,style:c}=t,l=M(null),[u,d]=N(n),f=M(n),m=u.items.find(e=>e.id===r)??i?.item;o(m?.startAt??u.startAt,m?.endAt??u.endAt);let[h,g]=N(()=>i?{amount:0,includeServiceFee:i.submission.includeServiceFee??!1,quantity:i.submission.quantity}:null),[_,y]=N(!!i),x=M(!0),S=M(t);S.current=t;let C=M(null),w=O(e=>{x.current&&y(e),C.current!==e&&(C.current=e,p(S.current.onInteractionLockChange,e))},[]),ee=!!i;k(()=>(x.current=!0,w(ee),()=>{x.current=!1}),[ee,w]);let[T,E]=N({email:``,phone:``}),[D,A]=N(!!i),[j,P]=N(null),[L,R]=N(null);k(()=>{!(D||_||i)&&f.current!==n&&(f.current=n,d(n))},[n,D,_,i]);function z(e,t){w(!1),f.current=S.current.auction,d(e),g(null),A(!1),P(t)}function B(e){P(null),g(e),A(!0)}return m?L?F(Ce,{...t,auction:u,item:m,outcome:L}):I(`section`,{className:[`lockerverse-auctions`,a].filter(Boolean).join(` `),"data-lockerverse-theme":s,ref:l,style:{"--lockerverse-accent":u.community?.color??`#6f8f6d`,...c},children:[t.onBack&&!_?I(`button`,{className:`lockerverse-auctions__back`,onClick:t.onBack,type:`button`,children:[F(b,{"aria-hidden":`true`,size:16}),` All items`]}):null,I(`div`,{className:`lockerverse-auctions__detail`,children:[F(pe,{auction:u,item:m}),I(`div`,{className:`lockerverse-auctions__transaction`,children:[e(u,m)===`active`?F(Se,{buyNow:m.saleMode===`buy_now`}):null,j?F(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:j}):null,D&&h?F(xe,{...t,appearanceRoot:l,auction:u,communityName:t.communityName??u.community?.name,contact:T,interactionLocked:_,item:m,onBack:()=>A(!1),onContactChange:E,onIncludeServiceFeeChange:e=>g(t=>t&&{...t,includeServiceFee:u.serviceFeeEnabled&&e}),onInteractionLockChange:w,onResult:R,onReview:z,selection:h}):F(ye,{auction:u,initialSelection:h,item:m,onBack:t.onBack,onContinue:B,onError:P}),t.onBack&&!_?I(`button`,{className:`lockerverse-auctions__footer-back`,onClick:t.onBack,type:`button`,children:[`Back to auction items `,F(v,{"aria-hidden":`true`,size:16})]}):null]})]})]}):I(`div`,{children:[F(`p`,{role:`alert`,children:`This auction item is no longer available.`}),t.onBack?F(`button`,{onClick:t.onBack,type:`button`,children:`Back to auction items`}):null]})}function Te(e){let t=M({auctionId:e.auction.id,client:e.client,itemId:e.itemId});if(t.current.client!==e.client||t.current.auctionId!==e.auction.id||t.current.itemId!==e.itemId)throw TypeError(`Auction item identity cannot change. Remount with a new React key.`);if(e.resumePurchase&&(e.resumePurchase.auctionId!==e.auction.id||e.resumePurchase.itemId!==e.itemId||e.resumePurchase.item.id!==e.itemId||e.resumePurchase.item.auctionId!==e.auction.id))throw TypeError(`The purchase recovery record belongs to a different auction item.`);return F(we,{...e})}export{Te as LockerverseAuctionItem};
1
+ import{a as e,c as t,i as n,n as r,r as i,s as a,t as o}from"./use-auction-boundary.js";import{d as s,f as c,i as l,m as u,n as d,r as f,t as p}from"./host-callback.js";import{i as m,n as h,t as g}from"./stripe-loader.js";import{t as _}from"./auction-result2.js";import{ArrowRight as v,ChevronDown as y,ChevronLeft as b,ChevronRight as x,Clock3 as S,Gavel as C,Pause as w,Play as ee,ShieldCheck as T,TimerReset as E,X as D}from"lucide-react";import{useCallback as O,useEffect as k,useId as A,useMemo as j,useRef as M,useState as N}from"react";import{Fragment as P,jsx as F,jsxs as I}from"react/jsx-runtime";import{LockerverseSdkError as L,calculateLockerverseAuctionPricing as R,getLockerverseAuctionMinimumBid as z}from"@lockerverse/sdk/auctions";import{AddressElement as B,Elements as V,PaymentElement as H,useElements as te,useStripe as U}from"@stripe/react-stripe-js";import{Dialog as W}from"@base-ui/react/dialog";import G from"embla-carousel-autoplay";import K from"embla-carousel-react";function q(e){return{business:{name:`Lockerverse`},fields:{billingDetails:{address:`never`,email:`never`,name:`never`,phone:`never`}},terms:{applePay:e?`auto`:`never`,auBecsDebit:`never`,bancontact:`never`,card:`always`,cashapp:`never`,googlePay:`never`,ideal:`never`,paypal:e?`auto`:`never`,sepaDebit:`never`,sofort:`never`,usBankAccount:`never`},wallets:{applePay:e?`auto`:`never`,googlePay:`never`}}}function ne(e){let{isPurchase:t,item:r,pricing:i,id:a}=e;return I(`form`,{className:`lockerverse-auctions__checkout`,noValidate:!0,onSubmit:e.onSubmit,children:[I(`div`,{className:`lockerverse-auctions__checkout-header`,children:[I(`div`,{className:`lockerverse-auctions__checkout-navigation`,children:[F(`button`,{"aria-label":`Back`,className:`lockerverse-auctions__checkout-back`,disabled:!e.onBack,onClick:e.onBack,type:`button`,children:F(b,{"aria-hidden":`true`,size:20})}),I(`div`,{children:[F(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Step 2 of 2`}),F(`p`,{children:t?`Secure checkout`:`Secure payment method`})]})]}),F(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:e.communityName}),F(`h2`,{children:t?`Finalize your purchase.`:`Finalize your bid authorization.`}),F(`p`,{className:`lockerverse-auctions__checkout-summary`,children:t?I(P,{children:[`Pay `,F(`strong`,{children:n(i.totalCents)}),` for`,` `,e.quantity,` `,e.quantity===1?`item`:`items`,` of`,` `,F(`strong`,{children:r.name}),`. Your card is charged immediately once checkout succeeds.`]}):I(P,{children:[`Authorize a payment method for your bid of`,` `,F(`strong`,{children:n(i.subtotalCents)}),` on`,` `,F(`strong`,{children:r.name}),`. Your card is only charged if this bid wins the item.`]})}),r.collectShippingAddress&&I(`div`,{className:`lockerverse-auctions__checkout-physical`,children:[F(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Physical item`}),F(`p`,{children:`This item requires a delivery address. Billing details are used by default, and you can switch to a separate delivery address below if needed.`})]})]}),I(`div`,{className:`lockerverse-auctions__checkout-body`,children:[e.showFields&&I(`fieldset`,{disabled:e.locked,children:[I(`div`,{className:`lockerverse-auctions__checkout-contact`,children:[F(c,{error:e.contactErrors.email,id:`${a}-email`,label:`Email`,name:`email`,onChange:t=>e.onEmailChange(t.target.value),required:!0,value:e.email}),F(u,{error:e.contactErrors.phone,id:`${a}-phone`,label:`Phone`,children:F(d,{country:e.phoneCountry,error:e.contactErrors.phone,errorId:`${a}-phone-error`,id:`${a}-phone`,name:`phone`,onChange:e.onPhoneChange,required:!0,value:e.phone})})]}),I(`section`,{"aria-label":`Payment Information`,className:`lockerverse-auctions__checkout-section`,children:[I(`div`,{className:`lockerverse-auctions__checkout-section-heading`,children:[F(`h3`,{children:`Payment Information`}),F(`p`,{children:t?`Processed securely and charged immediately for this purchase.`:`Stored securely and charged only if your bid finishes on top.`})]}),F(H,{onLoadError:e.onPaymentLoadError,options:q(t)})]}),I(`section`,{"aria-label":`Billing Details`,className:`lockerverse-auctions__checkout-section`,children:[F(`h3`,{children:`Billing Details`}),F(B,{onChange:e.onBillingChange,options:{mode:`billing`}}),F(`p`,{children:t?`Use your full name here. We use the email and phone above for purchase confirmation and fulfillment updates.`:`Use the bidder's full name here. We use the email and phone above to contact you if this bid is outbid or wins.`})]}),r.collectShippingAddress&&I(`section`,{"aria-label":`Delivery Details`,className:`lockerverse-auctions__checkout-section`,children:[I(`label`,{className:`lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery`,htmlFor:`${a}-delivery-same-as-billing`,children:[F(s,{checked:e.sameAsBilling,id:`${a}-delivery-same-as-billing`,onChange:t=>e.onSameAsBillingChange(t.target.checked)}),I(`span`,{children:[F(`strong`,{children:`Delivery address is the same as billing`}),F(`span`,{children:`Leave this on for the fastest flow. Turn it off only if the delivery address should differ from the billing details above.`})]})]}),!e.sameAsBilling&&I(P,{children:[F(`h3`,{children:`Delivery Address`}),F(B,{onChange:e.onShippingChange,options:{mode:`shipping`}})]})]}),e.serviceFeeEnabled&&F(J,{...e})]}),e.message&&F(`p`,{"aria-live":`polite`,className:`lockerverse-auctions__notice`,role:`status`,children:e.message}),!e.isTerminal&&I(`div`,{className:`lockerverse-auctions__checkout-footer`,children:[I(`p`,{children:[t?`By continuing, you agree to be charged for this purchase.`:`By continuing, you agree to have this payment method stored for item settlement if your bid is the winning offer.`,r.collectShippingAddress?` Your delivery details are stored with the ${t?`order`:`bid`} so the seller can fulfill the item after payment.`:``]}),I(`button`,{className:`lockerverse-auctions__button lockerverse-auctions__checkout-submit`,disabled:e.submitDisabled,type:`submit`,children:[e.buttonText,F(v,{"aria-hidden":`true`,size:16})]})]})]})]})}function J(e){let{isPurchase:t,pricing:r}=e;return F(`section`,{"aria-label":`Processing fees`,className:`lockerverse-auctions__checkout-section`,children:e.onIncludeServiceFeeChange?I(`label`,{className:`lockerverse-auctions__checkout-checkbox`,htmlFor:`${e.id}-service-fee`,children:[F(s,{checked:e.includeServiceFee,id:`${e.id}-service-fee`,onChange:t=>e.onIncludeServiceFeeChange?.(t.target.checked)}),I(`span`,{children:[I(`strong`,{children:[t?`Add`:`If I win, add`,` `,n(e.serviceFeeCents),` to help cover processing fees`]}),I(`span`,{children:[t?`Total`:`Total if I win`,`:`,` `,n(r.totalCents)]})]})]}):I(`p`,{children:[t?`Total`:`Total if I win`,`:`,` `,n(r.totalCents)]})})}function Y(e,t,n){return R(e,t.saleMode===`buy_now`?(t.buyNowPriceAmount??0)*n.quantity:n.amount,n.includeServiceFee)}function re(t,n,r){if(e(t,n)!==`active`)return`This item is not accepting bids or purchases.`;if(n.saleMode===`hybrid`)return`This item type is not supported for checkout.`;if(n.saleMode===`buy_now`){if(n.isSoldOut||n.availableQuantity===0)return`This item is sold out.`;if(!(n.buyNowPriceAmount&&Number.isSafeInteger(r.quantity))||r.quantity<1||n.availableQuantity!==null&&r.quantity>n.availableQuantity)return`Select an available quantity.`}else if(!Number.isSafeInteger(r.amount)||r.amount%100!=0||r.amount<z(n))return`Enter a whole-dollar bid at or above the minimum bid.`;return null}function ie(e,t,n,r,i){return e.payment?.publishableKey!==t.payment?.publishableKey||e.payment?.connectedAccountId!==t.payment?.connectedAccountId||e.serviceFeeEnabled!==t.serviceFeeEnabled||n.saleMode!==r.saleMode||n.collectShippingAddress!==r.collectShippingAddress||JSON.stringify(Y(e,n,i))!==JSON.stringify(Y(t,r,i))}function ae(e){return{expectedServiceFeeCents:e.serviceFeeCents,expectedSubtotalCents:e.subtotalCents,expectedTotalCents:e.totalCents}}async function oe({stripe:e,elements:t,email:n,phone:r,billing:i,shipping:a,collectShippingAddress:o}){if(!(i?.complete&&i.value.name.trim()))throw Error(`Complete your billing name and address.`);if(o&&!(a?.complete&&a.value.name.trim()))throw Error(`Complete your shipping name and address.`);let s=await t.submit();if(s.error)throw Error(s.error.message??`Check your payment details.`);let c=await e.createConfirmationToken({elements:t,params:{payment_method_data:{allow_redisplay:`always`,billing_details:{address:i.value.address,email:n,name:i.value.name,phone:r}},return_url:window.location.href,...o&&a?{shipping:{address:a.value.address,name:a.value.name,phone:r}}:void 0}});if(c.error||!c.confirmationToken)throw Error(c.error?.message??`Unable to prepare payment details.`);return c.confirmationToken.id}async function se(e,t){if(!t.requiresAction)return;if(!t.clientSecret)throw Error(`Payment confirmation is incomplete. Check its status before trying again.`);let n=await e.handleNextAction({clientSecret:t.clientSecret});if(n.error)throw Error(n.error.message??`Payment confirmation is incomplete.`)}function ce(e,t,n){return e===`busy`?n?`Processing...`:`Authorizing...`:e===`retry`?`Retry original purchase`:t?`Check purchase status`:n?`Buy Now`:`Authorize Bid`}function X(e){let{auction:t,item:n,selection:r,client:i,onReview:a,onBack:o}=e,s=U(),c=te(),u=A(),[d,h]=N(e.contact?.email??``),[g,_]=N(e.contact?.phone??``),[v,y]=N(()=>l(e.contact?.phone??``)),[b,x]=N({}),[S,C]=N(!0),[w,ee]=N(null),[T,E]=N(null),[D,O]=N(e.resumePurchase??null),[j,P]=N(e.resumePurchase?`pending`:`ready`),[I,R]=N(null),z=M(e.resumePurchase?.submission.clientRequestId??null),B=j===`complete`||j===`uncertain`,V=M(!1),H=M(!0),W=M(e);W.current=e;let G=M(!1);function K(e){H.current&&P(e),p(W.current.onInteractionLockChange,e!==`ready`&&e!==`complete`)}function q(e){H.current&&R(e)}function J(e){K(e===`bid`?`uncertain`:`pending`),q(e===`bid`?`We could not confirm your bid. Do not submit another bid until you check your email or contact the auction organizer.`:`We could not confirm the purchase result. Check its status using the same purchase request.`),G.current||(G.current=!0,p(W.current.onUncertain,e))}k(()=>(H.current=!0,()=>{H.current=!1}),[]);let X=!!(D??e.resumePurchase)||n.saleMode===`buy_now`,Z=D?.pricing??e.resumePurchase?.pricing??Y(t,n,r),le=D?.payment??e.resumePurchase?.payment??t.payment;function Q(e){H.current&&O(e),p(W.current.onPurchaseRecoveryChange,e)}function ue(e){e.status===`paid`?(z.current=null,Q(null),K(`complete`),p(W.current.onResult,{kind:`purchase`,purchaseId:e.purchaseId,quantity:e.quantity,serviceFeeCents:e.serviceFeeCents,status:`paid`,subtotalCents:e.subtotalCents,totalCents:e.totalCents,unitAmountCents:e.subtotalCents/e.quantity}),G.current||(G.current=!0,p(W.current.onPurchaseComplete,e))):e.status===`pending_payment`?(K(`pending`),q(`Your purchase is pending. Check its status before making another payment.`)):(z.current=null,Q(null),K(`ready`),q(`This purchase is ${e.status.replaceAll(`_`,` `)}. You can start a new purchase.`))}function de(){let e=f(g,v),t=m({email:d,phone:e},!0);return x(t.errors),t.value?{email:t.value.email,phone:e}:(document.getElementById(`${u}-${t.errors.email?`email`:`phone`}`)?.focus(),null)}async function fe(e){if(!e)throw Error(`Check the contact fields below.`);if(!(s&&c&&t.payment))throw Error(`Payment details are still loading.`);let o=await i.load(t.slug);if(!H.current)return null;let l=o.items.find(e=>e.id===n.id);if(!l)return a(o,`This item is no longer available.`),null;let u=re(o,l,r);if(u||ie(t,o,n,l,r))return a(o,u??`The checkout details changed. Review them before continuing.`),null;let d=await oe({billing:w,collectShippingAddress:n.collectShippingAddress,elements:c,email:e.email,phone:e.phone,shipping:S?w:T,stripe:s});return H.current?{confirmationToken:d,email:e.email,includeServiceFee:r.includeServiceFee,phone:e.phone,...ae(Z)}:null}async function pe(e){let a=await i.createBid(t.slug,n.id,{...e,amount:r.amount});if(a.requiresAction){if(!(H.current&&s)){J(`bid`);return}await se(s,a)}K(`complete`),p(W.current.onResult,{amountCents:a.subtotalCents,kind:`bid`}),G.current||(G.current=!0,p(W.current.onBidSubmitted,a))}async function $(e,r){if(e.requiresAction){if(!(H.current&&s)){J(`purchase`);return}await se(s,e);let a=await i.getPurchaseStatus(t.slug,n.id,r.submission.clientRequestId);a?ue(a):(K(`pending`),q(`Payment status is not available yet. Check again shortly.`));return}ue(e),!H.current&&e.status===`pending_payment`&&J(`purchase`)}async function me(e){let r=await i.getPurchaseStatus(t.slug,n.id,e.submission.clientRequestId);if(r)await $(r,e);else{if(!H.current){J(`purchase`);return}K(`retry`),q(`No purchase is recorded yet. You can retry the original purchase with the same request ID.`)}}async function he(e,r){let a=await i.getPurchaseStatus(t.slug,n.id,r.submission.clientRequestId);if(a){await $(a,r);return}Q(null),K(`ready`),q(`The purchase was rejected. Review the item and payment details before trying again. (${e.status??`validation`})`)}async function ge(e,t,n,r){let i=t&&(!(e instanceof L)||e.recoveryRecommended);if(q(e instanceof Error?e.message:`Unable to complete this request.`),X&&n){if(!r&&e instanceof L&&!e.recoveryRecommended)try{await he(e,n);return}catch{}J(`purchase`)}else i?J(`bid`):K(`ready`)}function _e(){return z.current??=globalThis.crypto.randomUUID(),z.current}function ve(){return H.current?!0:(D||(Q(null),K(`ready`)),!1)}async function ye(e,r){if(r){await me(e);return}ve()&&await $(await i.createPurchase(t.slug,n.id,e.submission),e)}let be=s&&c&&le;function xe(){if(V.current||B)return null;if(!be)return q(`Payment details are still loading.`),null;let e=D?null:de();return D||e?{checkoutPayment:be,contact:e,retryOriginal:j===`retry`}:null}async function Se(e){e.preventDefault();let i=xe();if(!i)return;let{contact:a,checkoutPayment:o,retryOriginal:s}=i;V.current=!0,G.current=!1,K(`busy`),q(null);let c=!1,l=D;try{if(!l){let e=await fe(a);if(!(e&&H.current)){K(`ready`);return}if(!X){c=!0,await pe(e);return}l=Object.freeze({auctionId:t.id,item:n,itemId:n.id,payment:Object.freeze({...o}),pricing:Z,submission:Object.freeze({...e,clientRequestId:_e(),paymentMethodTypes:Object.freeze([`card`]),quantity:r.quantity})}),Q(l)}c=!0,await ye(l,!!D&&!s)}catch(e){await ge(e,c,l,D!==null&&!s)}finally{V.current=!1}}let Ce=ce(j,D!==null,X),we=j!==`ready`;return F(ne,{buttonText:Ce,communityName:e.communityName??t.name,contactErrors:b,email:d,id:u,includeServiceFee:r.includeServiceFee,isPurchase:X,isTerminal:B,item:n,locked:we,message:I,onBack:j===`ready`?o:void 0,onBillingChange:ee,onEmailChange:t=>{h(t),e.onContactChange?.({email:t,phone:f(g,v)})},onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPaymentLoadError:()=>q(`Unable to load payment form.`),onPhoneChange:({value:t,country:n})=>{_(t),y(n),e.onContactChange?.({email:d,phone:f(t,n)})},onSameAsBillingChange:C,onShippingChange:E,onSubmit:Se,phone:g,phoneCountry:v,pricing:Z,quantity:r.quantity,sameAsBilling:S,serviceFeeCents:D?Z.serviceFeeCents:Y(t,n,{...r,includeServiceFee:t.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:t.serviceFeeEnabled,showFields:!(D||B),submitDisabled:j===`busy`||!s||!c})}const Z=6e3;function le(e,t){let n=M(Z),r=M(null),[i,a]=N(Z),o=j(()=>G({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=K({duration:t?0:25,loop:!0},[o]),l=O(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/Z})`)},[]),u=O(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(Z,e))),o.stop(),l()},[o,l]),d=O(()=>{n.current=Z,a(Z),o.reset(),l()},[o,l]);return k(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),k(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(Z,i)),l(),t=requestAnimationFrame(r))},i=()=>{cancelAnimationFrame(t),e&&(t=requestAnimationFrame(r))},a=()=>cancelAnimationFrame(t),s=()=>{e&&o.play()};return c.on(`select`,d).on(`reInit`,s).on(`autoplay:timerset`,i).on(`autoplay:timerstopped`,a),l(),i(),()=>{a(),c.off(`select`,d).off(`reInit`,s).off(`autoplay:timerset`,i).off(`autoplay:timerstopped`,a)}},[c,o,e,n,d,l]),{embla:c,freeze:u,progressRef:r,reset:d,viewportRef:s}}function Q({photos:e,name:t,selected:n,paused:i=!1,photoButtonRef:a,onSelect:o,onExpand:s}){let c=M(null),l=M(null),u=M([]),[d,f]=N(!0),[p,m]=N(!1),[h,g]=N(!1),[_,v]=N(!1),[y,S]=N(!1),{ref:C,visible:T}=r(),[E,D]=N(!1),[O,A]=N(!0),j=M(null),L=`lockerverse-auction-gallery__control ${O||E||h?`is-visible`:``}`,R=()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>D(!1),2e3)},z=e=>{if(e.pointerType!==`mouse`){A(!0);return}D(!0),j.current&&clearTimeout(j.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||R()};k(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>A(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(j.current??void 0)}},[]);let B=!(i||d||p||h||_||y)&&T,V=e.length,H=V?(n%V+V)%V:0,{viewportRef:te,embla:U,progressRef:W,freeze:G,reset:K}=le(B&&V>1,d);k(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>f(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),k(()=>{if(!U)return;let e=()=>o(U.selectedScrollSnap());return U.on(`select`,e).on(`reInit`,e),()=>{U.off(`select`,e).off(`reInit`,e)}},[U,o]),k(()=>{U&&U.selectedScrollSnap()!==H&&U.scrollTo(H,!0)},[U,H]),k(()=>{let e=()=>{document.hidden&&G()},t=()=>S(!1);return e(),document.addEventListener(`visibilitychange`,e,!0),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{document.removeEventListener(`visibilitychange`,e,!0),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[G]);let q=e=>{U?.scrollTo((e+V)%V,d),K()};return k(()=>{let e=l.current;l.current=null,e&&document.activeElement===e&&C.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[H,C]),k(()=>{let e=c.current,t=u.current[H];if(!(e&&t))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.left<n.left?e.scrollLeft-=n.left-r.left:r.right>n.right&&(e.scrollLeft+=r.right-n.right)},[H,V]),I(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||g(!1)},onFocusCapture:e=>g(e.target.matches(`:focus-visible`)),onKeyDown:e=>{V<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),e.target instanceof HTMLButtonElement&&e.target.classList.contains(`lockerverse-auction-gallery__photo`)&&(l.current=e.target),q(H+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&m(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&m(!1)},ref:C,children:[V?I(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:z,onPointerLeave:R,onPointerMove:z,children:[F(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{G(),S(!0)},ref:te,children:F(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,n)=>F(`div`,{"aria-hidden":n!==H,className:`lockerverse-auction-gallery__slide`,children:F(`button`,{"aria-label":`View photo ${n+1} of ${t} at full size`,className:`lockerverse-auction-gallery__photo`,onClick:()=>{s(n)},ref:n===H?a:void 0,tabIndex:n===H?0:-1,type:`button`,children:F(`img`,{alt:`${t}, ${n+1} of ${V}`,className:`lockerverse-auction-gallery__image`,draggable:!1,height:900,loading:n===0||n===H||n===(H+1)%V?`eager`:`lazy`,sizes:`(max-width: 1280px) 100vw, 45vw`,src:e,width:1200})})},`${e}-${n}`))})}),V>1&&!d&&I(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[F(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:F(`div`,{className:`lockerverse-auction-gallery__progress`,ref:W,style:{transform:`scaleX(0)`}})}),F(`button`,{"aria-label":_?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${L}`,"data-gallery-control":!0,onClick:()=>v(e=>!e),title:_?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:F(_?ee:w,{"aria-hidden":`true`,size:13})})]}),V>1&&I(P,{children:[F(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${L}`,"data-gallery-control":!0,onClick:()=>q(H-1),type:`button`,children:F(b,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),F(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${L}`,"data-gallery-control":!0,onClick:()=>q(H+1),type:`button`,children:F(x,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):F(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),V>1&&F(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:c,children:F(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>F(`button`,{"aria-label":`Show photo ${t+1} of ${V}`,"aria-pressed":H===t,className:`lockerverse-auction-gallery__thumbnail ${H===t?`is-selected`:``}`,onClick:()=>q(t),ref:e=>{u.current[t]=e},type:`button`,children:F(`img`,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function ue({images:e,fallbackImage:t,name:n}){let r=[...new Set(e.filter(Boolean))];!r.length&&t&&r.push(t);let[i,a]=N(0),[o,s]=N(!1),c=M(null),l=M(null),u=r.length,d=u?(i%u+u)%u:0;return I(P,{children:[F(Q,{name:n,onExpand:e=>{a(e),s(!0)},onSelect:a,paused:o,photoButtonRef:c,photos:r,selected:d}),u>0&&F(W.Root,{onOpenChange:s,open:o,children:I(W.Portal,{children:[F(W.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),I(W.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:c,onKeyDown:e=>{u<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),a((d+(e.key===`ArrowRight`?1:-1)+u)%u))},children:[I(W.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,d+1,` of `,u]}),I(`div`,{className:`lockerverse-auction-gallery__full-image`,onTouchCancel:()=>{l.current=null},onTouchEnd:e=>{let t=l.current;l.current=null;let n=e.changedTouches.item(0);if(!(t&&n)||u<2)return;let r=n.clientX-t.x,i=n.clientY-t.y;Math.abs(r)>=45&&Math.abs(r)>Math.abs(i)*1.3&&a((d+(r<0?1:-1)+u)%u)},onTouchMove:e=>{e.touches.length!==1&&(l.current=null)},onTouchStart:e=>{let t=e.touches.item(0);l.current=e.touches.length===1&&t?{x:t.clientX,y:t.clientY}:null},children:[F(`img`,{alt:`${n}, ${d+1} of ${u}`,height:900,src:r[d],width:1200}),o&&u>1&&F(`img`,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,src:r[(d+1)%u],width:1200})]}),F(W.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:F(D,{"aria-hidden":`true`,size:22})}),u>1&&I(P,{children:[F(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>a((d-1+u)%u),type:`button`,children:F(b,{"aria-hidden":`true`,size:28})}),F(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>a((d+1)%u),type:`button`,children:F(x,{"aria-hidden":`true`,size:28})})]})]})]})})]})}function de(e){return F(e===`Buy Now`?T:e===`Available`||e===`Increment`?E:C,{"aria-hidden":`true`,size:16})}function fe(e,t){return e.saleMode===`buy_now`?[[`Buy Now`,n(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:t===`finished`?[[`Final bid`,e.maxBidAmount?n(e.maxBidAmount):`No bids`]]:[[`Current bid`,n(e.maxBidAmount??0)],[`Floor`,n(e.minBidAmount??0)],[`Increment`,n(e.bidIncrementAmount??100)]]}function pe({auction:r,item:a}){o(a.startAt??r.startAt,a.endAt??r.endAt);let[s,c]=N(!1),l=A(),u=e(r,a),d={active:`Closes`,draft:`Opens`,finished:`Closed`}[u],f=i(r,u,a),p=a.saleMode===`buy_now`,m=(a.description??``).trim().length>240,h=fe(a,u);return I(`section`,{className:`lockerverse-auctions__item-summary`,children:[F(ue,{fallbackImage:a.image??r.configuration.image??r.community?.banner??r.community?.thumbnail??null,images:a.images,name:a.name}),I(`div`,{className:`lockerverse-auctions__item-copy`,children:[F(`h2`,{children:a.name}),a.description?I(`div`,{className:`lockerverse-auctions__item-description`,children:[F(t,{className:!s&&m?`lockerverse-auctions__description-clamped`:void 0,description:a.description,id:l}),m?I(`button`,{"aria-controls":l,"aria-expanded":s,className:`lockerverse-auctions__description-toggle`,onClick:()=>c(!s),type:`button`,children:[s?`Hide description`:`Read full description`,` `,F(y,{"aria-hidden":`true`,size:16,style:{transform:s?`rotate(180deg)`:void 0}})]}):null]}):null,I(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[h.map(([e,t])=>I(`div`,{className:`lockerverse-auctions__stat-row`,children:[I(`dt`,{children:[de(e),e]}),F(`dd`,{children:t})]},e)),I(`div`,{className:`lockerverse-auctions__stat-row`,children:[I(`dt`,{children:[F(S,{"aria-hidden":`true`,size:16}),d]}),F(`dd`,{className:`lockerverse-auctions__stat-date`,children:f})]}),!p&&u===`finished`?I(`div`,{className:`lockerverse-auctions__stat-footer`,children:[I(`div`,{children:[F(`dt`,{children:`Floor`}),F(`dd`,{children:n(a.minBidAmount??0)})]}),I(`div`,{children:[F(`dt`,{children:`Bid increment`}),F(`dd`,{children:n(a.bidIncrementAmount??100)})]})]}):null]})]})]})}const $=/^\d+$/;function me(e,t){return $.test(e)&&Number.isSafeInteger(Number(e)*t)?`Total: ${n(Number(e)*t)}`:`Enter a whole-number quantity.`}function he(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function ge(e,t){return a(e)?`This item is sold out.`:t===`draft`?`This item is not open yet.`:t===`finished`?e.saleMode===`buy_now`?`Purchases are closed for this item.`:`Bidding is closed for this item.`:`This item is not available.`}function _e(e,t,n){return a(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${i(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function ve(e,t,n,r){return{amount:t?0:Number(r)*100,includeServiceFee:n?n.includeServiceFee:e.serviceFeeEnabled&&e.serviceFeeDefaultChecked,quantity:t?Number(r):1}}function ye({auction:t,item:r,initialSelection:i,onContinue:s,onError:c,onBack:l}){let u=r.saleMode===`buy_now`,d=Math.ceil(z(r)/100),[f,p]=N(he(u,i,d)),[m,h]=N(null),g=A();o(r.startAt??t.startAt,r.endAt??t.endAt);let _=e(t,r),y=_===`active`&&!a(r)&&r.saleMode!==`hybrid`;function b(e){if(e.preventDefault(),!$.test(f)){h(u?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let n=ve(t,u,i,f),a=re(t,r,n);if(a){h(a),c(a);return}try{Y(t,r,n)}catch{h(`Enter a valid amount or quantity.`);return}s(n)}return y?I(`form`,{className:`lockerverse-auctions__selection`,onSubmit:b,children:[F(be,{buyNow:u,item:r,minimum:d}),I(`div`,{className:`lockerverse-auctions__selection-body`,children:[I(`label`,{className:`lockerverse-auctions__field`,htmlFor:g,children:[u?`Quantity`:`Your bid amount`,I(`span`,{className:`lockerverse-auctions__amount-control`,children:[u?null:F(`span`,{"aria-hidden":`true`,children:`$`}),F(`input`,{"aria-describedby":`${g}-help`,"aria-invalid":!!m,autoComplete:`off`,id:g,inputMode:`numeric`,onChange:e=>{p(e.target.value),h(null)},placeholder:u?`1`:String(d),required:!0,value:f})]})]}),m?F(`p`,{role:`alert`,children:m}):null,F(`p`,{id:`${g}-help`,children:u?me(f,r.buyNowPriceAmount??0):`Enter a whole-dollar bid of at least ${n(d*100)}. Bid increment: ${n(r.bidIncrementAmount??100)}.`}),I(`div`,{className:`lockerverse-auctions__selection-footer`,children:[F(`p`,{children:u?`Continuing moves you into secure checkout where your payment is processed immediately.`:`Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.`}),I(`button`,{className:`lockerverse-auctions__button`,disabled:!t.payment,type:`submit`,children:[u?`Continue to Checkout`:`Continue to Payment`,` `,F(v,{"aria-hidden":`true`,size:16})]})]}),t.payment?null:F(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):I(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[F(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),F(`h3`,{children:ge(r,_)}),F(`p`,{children:_e(t,r,_)}),l?I(`button`,{className:`lockerverse-auctions__button`,onClick:l,type:`button`,children:[`Browse auction items `,F(v,{"aria-hidden":`true`,size:16})]}):null]})}function be({item:e,buyNow:t,minimum:r}){return I(`div`,{className:`lockerverse-auctions__selection-header`,children:[F(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),F(`h3`,{children:t?`Buy this item now.`:`Place your bid.`}),F(`p`,{children:t?`Choose how many you want, then complete the secure checkout.`:`Enter the bid amount you want to place for this item. You are only charged if this bid wins after bidding closes.`}),I(`p`,{children:[t?`Price: `:`Minimum qualifying bid: `,F(`strong`,{children:n(t?e.buyNowPriceAmount??0:r*100)})]}),t&&e.availableQuantity!==null?I(`p`,{children:[e.availableQuantity,` available`]}):null,e.collectShippingAddress?F(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function xe(e){let{auction:t,item:n,selection:r,theme:i=`dark`,stripeLoader:a=g,style:o,onBack:s,resumePurchase:c}=e,[l,u]=N(null),[d,f]=N(!1),[p,m]=N(0),_=h(e.appearanceRoot,i,o,e.interactionLocked),v=c?.payment??t.payment;if(k(()=>{let e=!0;if(!v){f(!0);return}return Promise.resolve().then(()=>a(v.publishableKey,v.connectedAccountId?{stripeAccount:v.connectedAccountId}:void 0)).then(t=>{e&&(u(t),f(!t))},()=>{e&&f(!0)}),()=>{e=!1}},[v,a,p]),d)return I(`div`,{children:[F(`p`,{role:`alert`,children:`Payment details could not load.`}),c?null:F(`button`,{onClick:s,type:`button`,children:`Back to item`}),F(`button`,{onClick:()=>{f(!1),u(null),m(e=>e+1)},type:`button`,children:`Try again`})]});if(!(l&&_))return I(`div`,{children:[F(`p`,{role:`status`,children:`Loading secure payment details…`}),c?null:F(`button`,{onClick:s,type:`button`,children:`Back to item`})]});let y={mode:`setup`,setupFutureUsage:`off_session`};c?y={amount:c.pricing.totalCents,currency:`usd`,mode:`payment`}:n.saleMode===`buy_now`&&(y={amount:Y(t,n,r).totalCents,currency:`usd`,mode:`payment`});let b={...y,appearance:_,currency:`usd`,paymentMethodTypes:[`card`],syncAddressCheckbox:`none`};return F(V,{options:b,stripe:l,children:F(X,{...e})})}function Se({buyNow:e}){return I(`div`,{className:`lockerverse-auctions__progress`,children:[I(`span`,{children:[F(e?T:C,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),I(`span`,{children:[F(T,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),I(`span`,{children:[F(E,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}function Ce(e){let{auction:t,item:n,outcome:r}=e,a=e.onBack?{label:`View auction items`,onClick:e.onBack}:void 0;return F(_,{auctionName:t.name,className:e.className,closesAtLabel:i(t,`active`,n),communityName:e.communityName??t.community?.name,focusHeading:!0,imageUrl:n.image??n.images[0]??t.configuration.image??void 0,itemName:n.name,outcome:r,primaryAction:e.returnToItemHref?{href:e.returnToItemHref,label:`Return to item`}:a,secondaryAction:e.returnToItemHref?a:void 0,style:{"--lockerverse-accent":t.community?.color??`#6f8f6d`,...e.style},theme:e.theme})}function we(t){let{auction:n,itemId:r,resumePurchase:i,className:a,theme:s=`dark`,style:c}=t,l=M(null),[u,d]=N(n),f=M(n),m=u.items.find(e=>e.id===r)??i?.item;o(m?.startAt??u.startAt,m?.endAt??u.endAt);let[h,g]=N(()=>i?{amount:0,includeServiceFee:i.submission.includeServiceFee??!1,quantity:i.submission.quantity}:null),[_,y]=N(!!i),x=M(!0),S=M(t);S.current=t;let C=M(null),w=O(e=>{x.current&&y(e),C.current!==e&&(C.current=e,p(S.current.onInteractionLockChange,e))},[]),ee=!!i;k(()=>(x.current=!0,w(ee),()=>{x.current=!1}),[ee,w]);let[T,E]=N({email:``,phone:``}),[D,A]=N(!!i),[j,P]=N(null),[L,R]=N(null);k(()=>{!(D||_||i)&&f.current!==n&&(f.current=n,d(n))},[n,D,_,i]);function z(e,t){w(!1),f.current=S.current.auction,d(e),g(null),A(!1),P(t)}function B(e){P(null),g(e),A(!0)}return m?L?F(Ce,{...t,auction:u,item:m,outcome:L}):I(`section`,{className:[`lockerverse-auctions`,a].filter(Boolean).join(` `),"data-lockerverse-theme":s,ref:l,style:{"--lockerverse-accent":u.community?.color??`#6f8f6d`,...c},children:[t.onBack&&!_?I(`button`,{className:`lockerverse-auctions__back`,onClick:t.onBack,type:`button`,children:[F(b,{"aria-hidden":`true`,size:16}),` All items`]}):null,I(`div`,{className:`lockerverse-auctions__detail`,children:[F(pe,{auction:u,item:m}),I(`div`,{className:`lockerverse-auctions__transaction`,children:[e(u,m)===`active`?F(Se,{buyNow:m.saleMode===`buy_now`}):null,j?F(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:j}):null,D&&h?F(xe,{...t,appearanceRoot:l,auction:u,communityName:t.communityName??u.community?.name,contact:T,interactionLocked:_,item:m,onBack:()=>A(!1),onContactChange:E,onIncludeServiceFeeChange:e=>g(t=>t&&{...t,includeServiceFee:u.serviceFeeEnabled&&e}),onInteractionLockChange:w,onResult:R,onReview:z,selection:h}):F(ye,{auction:u,initialSelection:h,item:m,onBack:t.onBack,onContinue:B,onError:P}),t.onBack&&!_?I(`button`,{className:`lockerverse-auctions__footer-back`,onClick:t.onBack,type:`button`,children:[`Back to auction items `,F(v,{"aria-hidden":`true`,size:16})]}):null]})]})]}):I(`div`,{children:[F(`p`,{role:`alert`,children:`This auction item is no longer available.`}),t.onBack?F(`button`,{onClick:t.onBack,type:`button`,children:`Back to auction items`}):null]})}function Te(e){let t=M({auctionId:e.auction.id,client:e.client,itemId:e.itemId});if(t.current.client!==e.client||t.current.auctionId!==e.auction.id||t.current.itemId!==e.itemId)throw TypeError(`Auction item identity cannot change. Remount with a new React key.`);if(e.resumePurchase&&(e.resumePurchase.auctionId!==e.auction.id||e.resumePurchase.itemId!==e.itemId||e.resumePurchase.item.id!==e.itemId||e.resumePurchase.item.auctionId!==e.auction.id))throw TypeError(`The purchase recovery record belongs to a different auction item.`);return F(we,{...e})}export{Te as LockerverseAuctionItem};
2
2
  //# sourceMappingURL=auction-item.js.map