PageSourceSearch

https://xyc.ai/static/js/async/4211.516cafa221.js

js xyc.ai collected 2026-10-05 14:39:11 UTC 20,405 bytes, 1 lines download raw bytes

1"use strict";(self.rspackChunknewapi_web=self.rspackChunknewapi_web||[]).push([[4211],{92170(e,t,a){a.d(t,{i:()=>c});var n=a(72361),l=a(6702),s=a(61631),i=a(81204),r=a(52606),o=a(46775),d=a(34126);function c(e){let{value:t,children:a,className:c,iconClassName:u,variant:m="ghost",size:x="icon",tooltip:p,successTooltip:h,"aria-label":j}=e,{t:g}=(0,l.Bd)(),{copiedText:y,copyToClipboard:f}=(0,r.C)({notify:!1}),v=y===t,b=p??g("Copy to clipboard"),N=h??g("Copied!"),C=g("Copied"),w=(0,n.jsxs)(o.$,{variant:m,size:x,className:(0,i.cn)("shrink-0",c),onClick:()=>f(t),"aria-label":v?C:j??b,children:[v?(0,n.jsx)(s.Jlk,{className:(0,i.cn)("text-success",u)}):(0,n.jsx)(s.QRo,{className:(0,i.cn)(u)}),a]});return p||h?(0,n.jsxs)(d.m_,{children:[(0,n.jsx)(d.k$,{render:w}),(0,n.jsx)(d.ZI,{children:(0,n.jsx)("p",{children:v?N:b})})]}):w}},21258(e,t,a){a.d(t,{C:()=>s});var n=a(72361),l=a(81204);function s(e){return(0,n.jsx)("span",{className:(0,l.cn)("text-muted-foreground inline-block font-mono tabular-nums",e.className),children:e.value})}},74028(e,t,a){a.d(t,{c:()=>l});var n=a(68413);function l(e){let{search:t,navigate:a,pagination:l,globalFilter:s,columnFilters:i=[]}=e,r=l?.pageKey??"page",o=l?.pageSizeKey??"pageSize",d=l?.defaultPage??1,c=l?.defaultPageSize??20,u=s?.key??"filter",m=s?.enabled??!0,x=s?.trim??!0,p=(0,n.useMemo)(()=>{let e=[];for(let a of i){let n=t[a.searchKey],l=a.deserialize??(e=>e);if("string"===a.type){let t=l(n)??"";"string"==typeof t&&""!==t.trim()&&e.push({id:a.columnId,value:t})}else{let t=l(n)??[];Array.isArray(t)&&t.length>0&&e.push({id:a.columnId,value:t})}}return e},[i,t]),[h,j]=(0,n.useState)(p);(0,n.useEffect)(()=>{j(p)},[t]);let g=(0,n.useMemo)(()=>{let e=t[r],a=t[o];return{pageIndex:Math.max(0,("number"==typeof e?e:d)-1),pageSize:"number"==typeof a?a:c}},[t,r,o,d,c]),[y,f]=(0,n.useState)(()=>{if(!m)return;let e=t[u];return"string"==typeof e?e:""}),v=m?e=>{let t="function"==typeof e?e(y??""):e,n=x?t.trim():t;f(n),a({search:e=>({...e,[r]:void 0,[u]:n||void 0})})}:void 0;return{globalFilter:m?y??"":void 0,onGlobalFilterChange:v,columnFilters:h,onColumnFiltersChange:e=>{let t="function"==typeof e?e(h):e;j(t);let n={};for(let e of i){let a=t.find(t=>t.id===e.columnId),l=e.serialize??(e=>e);if("string"===e.type){let t="string"==typeof a?.value?a.value:"";n[e.searchKey]=""!==t.trim()?l(t):void 0}else{let t=Array.isArray(a?.value)?a.value:[];n[e.searchKey]=t.length>0?l(t):void 0}}a({search:e=>({...e,[r]:void 0,...n})})},pagination:g,onPaginationChange:e=>{let t="function"==typeof e?e(g):e,n=t.pageIndex+1,l=t.pageSize;a({search:e=>({...e,[r]:n<=d?void 0:n,[o]:l})})},ensurePageInRange:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{resetTo:"first"},l=t[r],s="number"==typeof l?l:d;e>0&&s>e&&a({replace:!0,search:t=>({...t,[r]:"last"===n.resetTo?e:void 0})})}}}},98654(e,t,a){a.r(t),a.d(t,{component:()=>ec});var n=a(72361),l=a(6702),s=a(67267),i=a(68413),r=a(20598),o=a(18692),d=a(64577);async function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{p:t=1,page_size:a=10}=e;return(await d.FH.get(`/api/redemption/?p=${t}&page_size=${a}`)).data}async function u(e){let{keyword:t="",p:a=1,page_size:n=10}=e;return(await d.FH.get(`/api/redemption/search?keyword=${t}&p=${a}&page_size=${n}`)).data}async function m(e){return(await d.FH.get(`/api/redemption/${e}`)).data}async function x(e){return(await d.FH.post("/api/redemption/",e)).data}async function p(e){return(await d.FH.put("/api/redemption/",e)).data}async function h(e,t){return(await d.FH.put("/api/redemption/?status_only=true",{id:e,status:t})).data}async function j(e){return(await d.FH.delete(`/api/redemption/${e}/`)).data}async function g(){return(await d.FH.delete("/api/redemption/invalid")).data}var y=a(96665),f=a(23554);let v=i.createContext(null);function b(e){let{children:t}=e,[a,l]=(0,f.Ay)(null),[s,r]=(0,i.useState)(null),[o,d]=(0,i.useState)(0);return(0,n.jsx)(v,{value:{open:a,setOpen:l,currentRow:s,setCurrentRow:r,refreshTrigger:o,triggerRefresh:()=>d(e=>e+1)},children:t})}let N=()=>{let e=i.useContext(v);if(!e)throw Error("useRedemptions has to be used within <RedemptionsProvider>");return e};function C(){let{t:e}=(0,l.Bd)(),{open:t,setOpen:a,currentRow:s,triggerRefresh:d}=N(),[c,u]=(0,i.useState)(!1),m=async()=>
1{if(s){u(!0);try{(await j(s.id)).success&&(r.oR.success(e(y.PL.REDEMPTION_DELETED)),a(null),d())}finally{u(!1)}}};return(0,n.jsx)(o.Lt,{open:"delete"===t,onOpenChange:e=>!e&&a(null),children:(0,n.jsxs)(o.EO,{children:[(0,n.jsxs)(o.wd,{children:[(0,n.jsx)(o.r7,{children:e("Are you sure?")}),(0,n.jsxs)(o.$v,{children:[e("This will permanently delete redemption code")," ",(0,n.jsx)("span",{className:"font-semibold",children:s?.name}),e(". This action cannot be undone.")]})]}),(0,n.jsxs)(o.ck,{children:[(0,n.jsx)(o.Zr,{disabled:c,children:e("Cancel")}),(0,n.jsx)(o.Rx,{onClick:m,disabled:c,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:c?e("Deleting..."):e("Delete")})]})]})})}var w=a(86832),_=a(48367),S=a(52946),k=a(74400),E=a(46775),D=a(97077),R=a(54023),I=a(10998),z=a(25207),T=a(5304);function F(e){return 0!==e&&e<Date.now()/1e3}function M(e,t){return 1===t&&F(e)}var A=a(25732),$=a(3642);let L={name:"",quota_dollars:10,expired_time:void 0,count:1};function V(e){let t,{open:a,onOpenChange:s,currentRow:o}=e,{t:d}=(0,l.Bd)(),c=!!o,{triggerRefresh:u}=N(),[h,j]=(0,i.useState)(!1),g=(0,w.mN)({resolver:(0,_.u)((t=(0,y.Wv)(d),A.Ik({name:A.Yj().min(y.oG.NAME_MIN_LENGTH,t.NAME_LENGTH_INVALID).max(y.oG.NAME_MAX_LENGTH,t.NAME_LENGTH_INVALID),quota_dollars:A.ai().min(0,d("Quota must be a positive number")),expired_time:A.p6().optional(),count:A.ai().min(y.oG.COUNT_MIN,t.COUNT_INVALID).max(y.oG.COUNT_MAX,t.COUNT_INVALID).optional()}))),defaultValues:L});(0,i.useEffect)(()=>{a&&c&&o?m(o.id).then(e=>{var t;e.success&&e.data&&g.reset({name:(t=e.data).name,quota_dollars:(0,$.Sh)(t.quota),expired_time:t.expired_time>0?new Date(1e3*t.expired_time):void 0,count:1})}):a&&!c&&g.reset(L)},[a,c,o,g]);let f=async e=>{j(!0);try{let t={name:e.name,quota:(0,$.dD)(e.quota_dollars),expired_time:e.expired_time?Math.floor(e.expired_time.getTime()/1e3):0,count:e.count||1};if(c&&o)(await p({...t,id:o.id})).success&&(r.oR.success(d(y.PL.REDEMPTION_UPDATED)),s(!1),u());else{let e=await x(t);if(e.success){let t=e.data?.length||0;r.oR.success(t>1?d("Successfully created {{count}} redemption codes",{count:t}):d(y.PL.REDEMPTION_CREATED)),s(!1),u()}}}finally{j(!1)}},v=(e,t,a)=>{let n=(0,k.U7)(e,t,a);g.setValue("expired_time",n)},{meta:b}=(0,S.cw)(),C=(0,S.yz)(),F="tokens"===b.kind,M=d("Quota ({{currency}})",{currency:C}),V=F?d("Enter quota in tokens"):d("Enter quota in {{currency}}",{currency:C});return(0,n.jsx)(I.cj,{open:a,onOpenChange:e=>{s(e),e||g.reset()},children:(0,n.jsxs)(I.h,{className:(0,T.jW)("sm:max-w-[600px]"),children:[(0,n.jsxs)(I.Fm,{className:(0,T.Dt)(),children:[(0,n.jsx)(I.qp,{children:c?d("Update Redemption Code"):d("Create Redemption Code")}),(0,n.jsxs)(I.Qs,{children:[c?d("Update the redemption code by providing necessary info."):d("Add new redemption code(s) by providing necessary info.")," ",d("Click save when you&apos;re done.")]})]}),(0,n.jsx)(D.lV,{...g,children:(0,n.jsx)("form",{id:"redemption-form",onSubmit:g.handleSubmit(f),className:(0,T.e)(),children:(0,n.jsxs)(T.y5,{children:[(0,n.jsx)(D.zB,{control:g.control,name:"name",render:e=>{let{field:t}=e;return(0,n.jsxs)(D.eI,{children:[(0,n.jsx)(D.lR,{children:d("Name")}),(0,n.jsx)(D.MJ,{children:(0,n.jsx)(R.p,{...t,placeholder:d("Enter a name")})}),(0,n.jsx)(D.Rr,{children:d("Name for this redemption code (1-20 characters)")}),(0,n.jsx)(D.C5,{})]})}}),(0,n.jsx)(D.zB,{control:g.control,name:"quota_dollars",render:e=>{let{field:t}=e;return(0,n.jsxs)(D.eI,{children:[(0,n.jsx)(D.lR,{children:M}),(0,n.jsx)(D.MJ,{children:(0,n.jsx)(R.p,{...t,type:"number",step:F?1:.01,placeholder:V,onChange:e=>t.onChange(parseFloat(e.target.value)||0)})}),(0,n.jsx)(D.Rr,{children:F?d("Enter the quota amount in tokens"):d("Enter the quota amount in {{currency}}",{currency:C})}),(0,n.jsx)(D.C5,{})]})}}),(0,n.jsx)(D.zB,{control:g.control,name:"expired_time",render:e=>{let{field:t}=e;return(0,n.jsxs)(D.eI,{children:[(0,n.jsx)(D.lR,{children:d("Expiration Time")}),(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)(D.MJ,{children:(0,n.jsx)(z.K,{value:t.value,onChange:t.onChange,placeholder:d("Never expires")})}),(0,n.jsxs)("div",{className:"grid grid-cols-4 gap-1.5 sm:flex sm:gap-2",children:[(0,n.jsx)(E.$,{type:"button",variant:"outline",size:"sm",onClick:()=>v(0,0,0),children:d("Never")}),(0,n.jsx)(E.$,{type:"button",variant:"outline",size:"sm",onClick:()=>v(1,0,0),children:d("1M")}),(0,n.jsx)(E.$,{type:"button",variant:"outline",size:"sm",onClick:()=>v(0,7,0),children:d("1W")}),(0,n.jsx)(E.$,{type:"button",variant:"outline",size:"sm",onClick:()=>v(0,1,0),children:d("1 Day")})]})]}),(0,n.jsx)(D.Rr,{children:d("Leave empty for never expires")}),(0,n.jsx)(D.C5,{})]})}}),!c&&(0,n.jsx)(D.zB,{control:g.control,name:"count",render:e=>{let{field:t}=e;return(0,n.jsxs)(D.eI,{children:[(0,n.jsx)(D.lR,{children:d("Quantity")}),(0,n.jsx)(D.MJ,{children:(0,n.jsx)(R.p,{...t,type:"number",min:"1",max:"100",placeholder:d("Number of codes to create"),onChange:e=>t.onChange(parseInt(e.target.value,10)||1)})}),(0,n.jsx)(D.Rr,{children:d("Create multiple redemption codes at once (1-100)")}),(0,n.jsx)(D.C5,{})]})}})]})})}),(0,n.jsxs)(I.XW,{className:(0,T.Jx)(),children:[(0,n.jsx)(I.kN,{render:(0,n.jsx)(E.$,{variant:"outline"}),children:d("Close")}),(0,n.jsx)(E.$,{form:"redemption-form",type:"submit",disabled:h,children:h?d("Saving..."):d("Save changes")}
1)]})]})})}function P(){let{open:e,setOpen:t,currentRow:a}=N(),l="update"===e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(V,{open:"create"===e||l,onOpenChange:e=>!e&&t(null),currentRow:l&&a||void 0}),(0,n.jsx)(C,{})]})}var B=a(61631);function q(){let{t:e}=(0,l.Bd)(),{setOpen:t}=N();return(0,n.jsx)("div",{className:"flex gap-2",children:(0,n.jsxs)(E.$,{size:"sm",onClick:()=>t("create"),children:[(0,n.jsx)(B.FWt,{className:"h-4 w-4"}),e("Create Code")]})})}var H=a(53540),K=a(2718),O=a(55581),Z=a(3521),U=a(11564),W=a(74028),G=a(58254),Q=a(34126),J=a(24993),Y=a(92170);function X(e){let{table:t}=e,{t:a}=(0,l.Bd)(),{triggerRefresh:s}=N(),[o,d]=(0,i.useState)(!1),[c,u]=(0,i.useState)(!1),m=t.getFilteredSelectedRowModel().rows,x=(0,i.useMemo)(()=>m.map(e=>{let t=e.original;return`${t.name}	${t.key}`}).join("\n"),[m]),p=async()=>{u(!0);try{let e=await g();if(e.success){let n=e.data||0;r.oR.success(a("Successfully deleted {{count}} invalid redemption codes",{count:n})),t.resetRowSelection(),s(),d(!1)}}finally{u(!1)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(G.Of,{table:t,entityName:a("redemption code"),children:[(0,n.jsx)(Y.i,{value:x,variant:"outline",size:"icon",className:"size-8",tooltip:a("Copy selected codes"),successTooltip:a("Codes copied!"),"aria-label":a("Copy selected codes")}),(0,n.jsxs)(Q.m_,{children:[(0,n.jsxs)(Q.k$,{render:(0,n.jsx)(E.$,{variant:"destructive",size:"icon",onClick:()=>d(!0),className:"size-8","aria-label":a("Delete invalid redemption codes"),title:a("Delete invalid redemption codes")}),children:[(0,n.jsx)(B.TBR,{}),(0,n.jsx)("span",{className:"sr-only",children:a("Delete invalid codes")})]}),(0,n.jsx)(Q.ZI,{children:(0,n.jsx)("p",{children:a("Delete invalid codes (used/disabled/expired)")})})]})]}),(0,n.jsx)(J.T,{destructive:!0,open:o,onOpenChange:d,handleConfirm:p,isLoading:c,className:"max-w-md",title:a("Delete Invalid Redemption Codes?"),desc:(0,n.jsxs)(n.Fragment,{children:[a("This will delete all")," ",(0,n.jsx)("strong",{children:a("used")}),","," ",(0,n.jsx)("strong",{children:a("disabled")}),a(", and")," ",(0,n.jsx)("strong",{children:a("expired")}
1)," ",a("redemption codes."),(0,n.jsx)("br",{}),a("This action cannot be undone.")]}),confirmText:a("Delete Invalid")})]})}var ee=a(33120),et=a(48196);function ea(e){return(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsxs)(et.AM,{children:[(0,n.jsx)(et.Wv,{render:(0,n.jsx)(E.$,{variant:"ghost",size:"sm",className:"h-7 font-mono"}),children:e.maskedValue}),(0,n.jsx)(et.hl,{className:"w-auto max-w-[min(90vw,28rem)]",align:"start",children:(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("p",{className:"text-muted-foreground text-xs",children:e.label}),(0,n.jsx)("pre",{className:"bg-muted/50 max-h-[50vh] overflow-auto rounded-md border px-3 py-2 font-mono text-xs leading-relaxed break-all whitespace-pre-wrap",style:{wordBreak:"break-all"},children:e.fullValue})]})})]}),(0,n.jsx)(Y.i,{value:e.fullValue,className:"size-7",iconClassName:"size-3.5",tooltip:e.copyTooltip,"aria-label":e.copyAriaLabel})]})}var en=a(3088),el=a(21258),es=a(43631);let ei=A.Ik({id:A.ai(),user_id:A.ai(),name:A.Yj(),key:A.Yj(),status:A.ai(),quota:A.ai(),created_time:A.ai(),redeemed_time:A.ai(),expired_time:A.ai(),used_user_id:A.ai()});function er(e){let{row:t}=e,{t:a}=(0,l.Bd)(),s=ei.parse(t.original),{setOpen:i,setCurrentRow:o,triggerRefresh:d}=N(),c=s.status===y.Dq.ENABLED,u=s.status===y.Dq.USED,m=M(s.expired_time,s.status),x=async()=>{let e=c?y.Dq.DISABLED:y.Dq.ENABLED;if((await h(s.id,e)).success){let e=c?a(y.PL.REDEMPTION_DISABLED):a(y.PL.REDEMPTION_ENABLED);r.oR.success(e),d()}};return(0,n.jsxs)(es.rI,{modal:!1,children:[(0,n.jsxs)(es.ty,{render:(0,n.jsx)(E.$,{variant:"ghost",className:"data-popup-open:bg-muted flex h-8 w-8 p-0"}),children:[(0,n.jsx)(B.a4,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:a("Open menu")})]}),(0,n.jsxs)(es.SQ,{align:"end",className:"w-[160px]",children:[(0,n.jsxs)(es._2,{onClick:()=>{o(s),i("update")},disabled:!(c&&!m),children:[a("Edit"),(0,n.jsx)(es.V0,{children:(0,n.jsx)(B.ffu,{size:16})})]}),!u&&!m&&(0,n.jsx)(es._2,{onClick:x,children:c?(0,n.jsxs)(n.Fragment,{children:[a("Disable"),(0,n.jsx)(es.V0,{children:(0,n.jsx)(B.$o3,{size:16})})]}):(0,n.jsxs)(n.Fragment,{children:[a("Enable"),(0,n.jsx)(es.V0,{children:(0,n.jsx)(B.aJd,{size:16})})]})}),(0,n.jsx)(es.mB,{}),(0,n.jsxs)(es._2,{onClick:()=>{o(s),i("delete")},className:"text-destructive focus:text-destructive",children:[a("Delete"),(0,n.jsx)(es.V0,{children:(0,n.jsx)(B.TBR,{size:16})})]})]})]})}let eo=(0,K.GY)("/_authenticated/redemption-codes/");function ed(){let{t:e}=(0,l.Bd)(),t=function(){let{t:e}=(0,l.Bd)();return[{id:"select",meta:{label:e("Select")},header:t=>{let{table:a}=t;return(0,n.jsx)(ee.S,{checked:a.getIsAllPageRowsSelected(),indeterminate:a.getIsSomePageRowsSelected(),onCheckedChange:e=>a.toggleAllPageRowsSelected(!!e),"aria-label":e("Select all"),className:"translate-y-[2px]"})},cell:t=>{let{row:a}=t;return(0,n.jsx)(ee.S,{checked:a.getIsSelected(),onCheckedChange:e=>a.toggleSelected(!!e),"aria-label":e("Select row"),className:"translate-y-[2px]"})},enableSorting:!1,enableHiding:!1},{accessorKey:"id",meta:{label:e("ID"),mobileHidden:!0},header:t=>{let{column:a}=t;return(0,n.jsx)(G.wZ,{column:a,title:e("ID")})},cell:e=>{let{row:t}=e;return(0,n.jsx)(el.C,{value:t.getValue("id"),className:"w-[60px]"})}},{accessorKey:"name",meta:{label:e("Name"),mobileTitle:!0},header:t=>{let{column:a}=t;return(0,n.jsx)(G.wZ,{column:a,title:e("Name")})},cell:e=>{let{row:t}=e;return(0,n.jsx)("div",{className:"max-w-[150px] truncate font-medium",children:t.getValue("name")})}},{accessorKey:"status",meta:{label:e("Status"),mobileBadge:!0},header:t=>{let{column:a}=t;return(0,n.jsx)(G.wZ,{column:a,title:e("Status")})},cell:t=>{let{row:a}=t,l=a.original,s=a.getValue("status");if(M(l.expired_time,s))return(0,n.jsx)(en.Wh,{label:e("Expired"),variant:"warning",copyable:!1});let i=y.pz[s];return i?(0,n.jsx)(en.Wh,{label:e(i.labelKey),variant:i.variant,copyable:!1}):null},filterFn:(e,t,a)=>{let n=e.original,l=e.getValue(t);return!!(a.includes(y.Z0)&&M(n.expired_time,l))||a.includes(String(l))}},{id:"code",accessorKey:"key",meta:{label:e("Code")},header:t=>{let{column:a}=t;return(0,n.jsx)(G.wZ,{column:a,title:e("Code")})},cell:function(t){let{row:a}=t,l=a.original.key,s=`${l.slice(0,8)}${"*".repeat(16)}${l.slice(-8)}`;return(0,n.jsx)(ea,{label:e("Full Code"),fullValue:l,maskedValue:s,copyTooltip:e("Copy code"),copyAriaLabel:e("Copy redemption code")})},enableSorting:!1},{accessorKey:"quota",meta:{label:e("Quota")},header:t=>{let{column:a}=t;return(0,n.jsx)(G.wZ,{column:a,title:e("Quota")})},cell:e=>{let{row:t}=e,a=t.getValue("quota");return(0,n.jsx)(en.Wh,{label:(0,$.eN)(a),variant:"neutral",copyable:!1})}},{accessorKey:"created_time",meta:{label:e("Created"),mobileHidden:!0},header:t=>{let{column:a}=t;return(0,n.jsx)(G.wZ,{column:a,title:e("Created")})},cell:e=>{let{row:t}=e;return(0,n.jsx)("div",{className:"min-w-[140px] font-mono text-sm",children:(0,$.fk)(t.getValue("created_time"))})}},{accessorKey:"expired_time",meta:{label:e("Expires"),mobileHidden:!0},header:t=>{let{column:a}=t;return(0,n.jsx)(G.wZ,{column:a,title:e("Expires")})},cell:t=>{let{row:a}=t,l=a.getValue("expired_time");if(0===l)return(0,n.jsx)(en.Wh,{label:e("Never"),variant:"neutral",copyable:!1});let s=F(l);return(0,n.jsx)("div",{className:`min-w-[140px] font-mono text-sm ${s?"text-destructive":""}`,children:(0,$.fk)(l)})}},{accessorKey:"used_user_id",meta:{label:e("Redeemed By"),mobileHidden:!0},header:t=>{let{column:a}=t;return(0,n.jsx)(G.wZ,{column:a,title:e("Redeemed By")})},cell:t=>{let{row:a}=t,l=a.getValue("used_user_id"),s=a.original;
1return 0===l?(0,n.jsx)("span",{className:"text-muted-foreground text-sm",children:"-"}):(0,n.jsxs)(Q.m_,{children:[(0,n.jsx)(Q.k$,{render:(0,n.jsx)(en.Wh,{label:e("User {{id}}",{id:l}),variant:"neutral",copyable:!1,className:"cursor-help"})}),(0,n.jsx)(Q.ZI,{children:(0,n.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,n.jsxs)("div",{children:[e("User ID:")," ",l]}),s.redeemed_time>0&&(0,n.jsxs)("div",{children:[e("Redeemed:")," ",(0,$.fk)(s.redeemed_time)]})]})})]})}},{id:"actions",cell:e=>{let{row:t}=e;return(0,n.jsx)(er,{row:t})}}]}(),{refreshTrigger:a}=N(),s=(0,U.Ub)("(max-width: 640px)"),[r,o]=(0,i.useState)({}),[d,m]=(0,i.useState)([]),[x,p]=(0,i.useState)({}),{globalFilter:h,onGlobalFilterChange:j,columnFilters:g,onColumnFiltersChange:f,pagination:v,onPaginationChange:b,ensurePageInRange:C}=(0,W.c)({search:eo.useSearch(),navigate:eo.useNavigate(),pagination:{defaultPage:1,defaultPageSize:s?10:20},globalFilter:{enabled:!0,key:"filter"},columnFilters:[{columnId:"status",searchKey:"status",type:"array"}]}),{data:w,isLoading:_,isFetching:S}=(0,H.I)({queryKey:["redemptions",v.pageIndex+1,v.pageSize,h,a],queryFn:async()=>{let e=h?.trim(),t={p:v.pageIndex+1,page_size:v.pageSize},a=e?await u({...t,keyword:h}):await c(t);return{items:a.data?.items||[],total:a.data?.total||0}},placeholderData:e=>e}),k=w?.items||[],E=(0,O.N4)({data:k,columns:t,state:{sorting:d,columnVisibility:x,rowSelection:r,columnFilters:g,globalFilter:h,pagination:v},enableRowSelection:!0,onRowSelectionChange:o,onSortingChange:m,onColumnVisibilityChange:p,globalFilterFn:(e,t,a)=>{let n=String(e.getValue("name")).toLowerCase(),l=String(e.getValue("id")),s=String(a).toLowerCase();return n.includes(s)||l.includes(s)},getCoreRowModel:(0,Z.HT)(),getFilteredRowModel:(0,Z.hM)(),getPaginationRowModel:(0,Z.kW)(),getSortedRowModel:(0,Z.h5)(),getFacetedRowModel:(0,Z.kQ)(),getFacetedUniqueValues:(0,Z.oS)(),onPaginationChange:b,onGlobalFilterChange:j,onColumnFiltersChange:f,manualPagination:!h,pageCount:Math.ceil((w?.total||0)/v.pageSize)}),D=E.getPageCount();(0,i.useEffect)(()=>{C(D)},[D,C]);let R=(0,i.useMemo)(()=>(0,y.gg)(e),[e]);return(0,n.jsx)(G.cx,{table:E,columns:t,isLoading:_,isFetching:S,emptyTitle:e("No Redemption Codes Found"),emptyDescription:e("No redemption codes available. Create your first redemption code to get started."),skeletonKeyPrefix:"redemptions-skeleton",toolbarProps:{searchPlaceholder:e("Filter by name or ID..."),filters:[{columnId:"status",title:e("Status"),options:R,singleSelect:!0}]},getRowClassName:(e,t)=>{var a;let{isMobile:n}=t;return(a=e.original).status!==y.Dq.ENABLED||M(a.expired_time,a.status)?n?G.Z0:G.JM:void 0},bulkActions:(0,n.jsx)(X,{table:E})})}let ec=function(){let{t:e}=(0,l.Bd)();return(0,n.jsxs)(b,{children:[(0,n.jsxs)(s.Ni,{children:[(0,n.jsx)(s.Ni.Title,{children:e("Redemption Codes")}),(0,n.jsx)(s.Ni.Actions,{children:(0,n.jsx)(q,{})}),(0,n.jsx)(s.Ni.Content,{children:(0,n.jsx)(ed,{})})]}),(0,n.jsx)(P,{})]})}}}]);

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.