PageSourceSearch

https://git-hub-new-api.hf.space/static/js/async/2502.e84d80ee17.js

js git-hub-new-api.hf.space collected 2026-10-03 16:53:51 UTC 22,485 bytes, 2 lines download raw bytes

1/*! LICENSE: 2502.e84d80ee17.js.LICENSE.txt */
2"use strict";(self.rspackChunknewapi_web=self.rspackChunknewapi_web||[]).push([[2502],{41645(e,t,a){var s=a(79015),n=a(47801);function i(e){return(0,s.jsx)("span",{className:(0,n.cn)("text-muted-foreground inline-block font-mono tabular-nums",e.className),children:e.value})}a.d(t,{C:()=>i})},10625(e,t,a){var s=a(65311);let n="page-size";function i(e){let{search:t,navigate:a,pagination:i,globalFilter:l,columnFilters:r=[]}=e,o=i?.pageKey??"page",d=i?.pageSizeKey??"pageSize",c=i?.defaultPage??1,u=i?.defaultPageSize??20,m=l?.key??"filter",x=l?.enabled??!0,p=l?.trim??!0,h=(0,s.useMemo)(()=>{let e=[];for(let a of r){let s=t[a.searchKey],n=a.deserialize??(e=>e);if("string"===a.type){let t=n(s)??"";"string"==typeof t&&""!==t.trim()&&e.push({id:a.columnId,value:t})}else{let t=n(s)??[];Array.isArray(t)&&t.length>0&&e.push({id:a.columnId,value:t})}}return e},[r,t]),[j,g]=(0,s.useState)(h);(0,s.useEffect)(()=>{g(h)},[t]);let f=(0,s.useMemo)(()=>{let e=t[o],a=t[d];return{pageIndex:Math.max(0,("number"==typeof e?e:c)-1),pageSize:"number"==typeof a?a:function(){try{let e=parseInt(localStorage.getItem(n)??"",10);return e>0?e:void 0}catch{return}}()??u}},[t,o,d,c,u]),[y,v]=(0,s.useState)(()=>{if(!x)return;let e=t[m];return"string"==typeof e?e:""}),b=x?e=>{let t="function"==typeof e?e(y??""):e,s=p?t.trim():t;v(s),a({search:e=>({...e,[o]:void 0,[m]:s||void 0})})}:void 0;return{globalFilter:x?y??"":void 0,onGlobalFilterChange:b,columnFilters:j,onColumnFiltersChange:e=>{let t="function"==typeof e?e(j):e;g(t);let s={};for(let e of r){let a=t.find(t=>t.id===e.columnId),n=e.serialize??(e=>e);if("string"===e.type){let t="string"==typeof a?.value?a.value:"";s[e.searchKey]=""!==t.trim()?n(t):void 0}else{let t=Array.isArray(a?.value)?a.value:[];s[e.searchKey]=t.length>0?n(t):void 0}}a({search:e=>({...e,[o]:void 0,...s})})},pagination:f,onPaginationChange:e=>{let t="function"==typeof e?e(f):e,s=t.pageIndex+1,i=t.pageSize;i!==f.pageSize&&function(e){try{localStorage.setItem(n,String(e))}catch{}}(i),a({search:e=>({...e,[o]:s<=c?void 0:s,[d]:i})})},ensurePageInRange:function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{resetTo:"first"},n=t[o],i="number"==typeof n?n:c;e>0&&i>e&&a({replace:!0,search:t=>({...t,[o]:"last"===s.resetTo?e:void 0})})}}}a.d(t,{c:()=>i})},21861(e,t,a){a.r(t),a.d(t,{component:()=>ev});var s=a(79015),n=a(89077),i=a(51571),l=a(65311),r=a(26028),o=a(41521),d=a(63228);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="",status:a="",p:s=1,page_size:n=10}=e,i=new URLSearchParams;return i.set("keyword",t),a&&i.set("status",a),i.set("p",String(s)),i.set("page_size",String(n)),(await d.FH.get(`/api/redemption/search?${i.toString()}`)).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 f=a(6704),y=a(77477);let v=l.createContext(null);function b(e){let{children:t}=e,[a,n]=(0,y.Ay)(null),[i,r]=(0,l.useState)(null),[o,d]=(0,l.useState)(0);return(0,s.jsx)(v,{value:{open:a,setOpen:n,currentRow:i,setCurrentRow:r,refreshTrigger:o,triggerRefresh:()=>d(e=>e+1)},children:t})}let N=()=>{let e=l.useContext(v);if(!e)throw Error("useRedemptions has to be used within <RedemptionsProvider>");return e};function w(){let{t:e}=(0,n.Bd)(),{open:t,setOpen:a,currentRow:i,triggerRefresh:d}=N(),[c,u]=(0,l.useState)(!1),m=async()=>{if(i){u(!0);try{(await j(i.id)).success&&(r.oR.success(e(f.PL.REDEMPTION_DELETED)),a(null),d())}finally{u(!1)}}};return(0,s.jsx)(o.Lt,{open:"delete"===t,onOpenChange:e=>!e&&a(null),children:(0,s.jsxs)(o.EO,{children:[(0,s.jsxs)(o.wd,{children:[(0,s.jsx)(o.r7,{children:e("Are you sure?")}),(0,s.jsxs)(o.$v,{children:[e("This will permanently delete redemption code")," ",(0,s.jsx)("span",{className:"font-semibold",children:i?.name}),e(". This action cannot be undone.")]})]}
2),(0,s.jsxs)(o.ck,{children:[(0,s.jsx)(o.Zr,{disabled:c,children:e("Cancel")}),(0,s.jsx)(o.Rx,{onClick:m,disabled:c,variant:"destructive",children:c?e("Deleting..."):e("Delete")})]})]})})}var C=a(99435),_=a(27606),k=a(77296),E=a(49583),S=a(73178),I=a(1996),D=a(62724),A=a(9273),z=a(78373),R=a(77577),L=a(80295);function F(e){return 0!==e&&e<Date.now()/1e3}function T(e,t){return 1===t&&F(e)}var M=a(25589);let V={name:"",quota_dollars:10,expired_time:void 0,count:1};function q(e){let t,{open:a,onOpenChange:i,currentRow:o}=e,{t:d}=(0,n.Bd)(),c=!!o,{triggerRefresh:u}=N(),[h,j]=(0,l.useState)(!1),g=(0,_.mN)({resolver:(0,C.u)((t=(0,f.Wv)(d),M.Ik({name:M.Yj().min(f.oG.NAME_MIN_LENGTH,t.NAME_LENGTH_INVALID).max(f.oG.NAME_MAX_LENGTH,t.NAME_LENGTH_INVALID),quota_dollars:M.ai().min(0,d("Quota must be a positive number")),expired_time:M.p6().optional(),count:M.ai().min(f.oG.COUNT_MIN,t.COUNT_INVALID).max(f.oG.COUNT_MAX,t.COUNT_INVALID).optional()}))),defaultValues:V});(0,l.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,R.Sh)(t.quota),expired_time:t.expired_time>0?new Date(1e3*t.expired_time):void 0,count:1})}):a&&!c&&g.reset(V)},[a,c,o,g]);let y=async e=>{j(!0);try{let t={name:e.name,quota:(0,R.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(f.PL.REDEMPTION_UPDATED)),i(!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(f.PL.REDEMPTION_CREATED)),i(!1),u()}}}finally{j(!1)}},v=(e,t,a)=>{let s=(0,L.U7)(e,t,a);g.setValue("expired_time",s)},{meta:b}=(0,z.cw)(),w=(0,z.yz)(),F="tokens"===b.kind,T=d("Quota ({{currency}})",{currency:w}),q=F?d("Enter quota in tokens"):d("Enter quota in {{currency}}",{currency:w});return(0,s.jsx)(A.cj,{open:a,onOpenChange:e=>{i(e),e||g.reset()},children:(0,s.jsxs)(A.h,{className:(0,E.jW)("sm:max-w-[600px]"),children:[(0,s.jsxs)(A.Fm,{className:(0,E.Dt)(),children:[(0,s.jsx)(A.qp,{children:c?d("Update Redemption Code"):d("Create Redemption Code")}),(0,s.jsxs)(A.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,s.jsx)(I.lV,{...g,children:(0,s.jsx)("form",{id:"redemption-form",onSubmit:e=>{if(!c){let e=g.getValues("name");if(!e?.trim()){let e=(0,R.dD)(g.getValues("quota_dollars"));g.setValue("name",(0,R.eN)(e),{shouldValidate:!0})}}g.handleSubmit(y)(e)},className:(0,E.e)(),children:(0,s.jsxs)(E.y5,{children:[(0,s.jsx)(I.zB,{control:g.control,name:"name",render:e=>{let{field:t}=e;return(0,s.jsxs)(I.eI,{children:[(0,s.jsx)(I.lR,{children:d("Name")}),(0,s.jsx)(I.MJ,{children:(0,s.jsx)(D.p,{...t,placeholder:d("Enter a name")})}),(0,s.jsx)(I.Rr,{children:d("Name for this redemption code (1-20 characters)")}),(0,s.jsx)(I.C5,{})]})}}),(0,s.jsx)(I.zB,{control:g.control,name:"quota_dollars",render:e=>{let{field:t}=e;return(0,s.jsxs)(I.eI,{children:[(0,s.jsx)(I.lR,{children:T}),(0,s.jsx)(I.MJ,{children:(0,s.jsx)(D.p,{...t,type:"number",step:F?1:.01,placeholder:q,onChange:e=>t.onChange(parseFloat(e.target.value)||0)})}),(0,s.jsx)(I.Rr,{children:F?d("Enter the quota amount in tokens"):d("Enter the quota amount in {{currency}}",{currency:w})}),(0,s.jsx)(I.C5,{})]})}}),(0,s.jsx)(I.zB,{control:g.control,name:"expired_time",render:e=>{let{field:t}=e;return(0,s.jsxs)(I.eI,{children:[(0,s.jsx)(I.lR,{children:d("Expiration Time")}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(I.MJ,{children:(0,s.jsx)(k.K,{value:t.value,onChange:t.onChange,placeholder:d("Never expires")})}),(0,s.jsxs)("div",{className:"grid grid-cols-4 gap-1.5 sm:flex sm:gap-2",children:[(0,s.jsx)(S.$,{type:"button",variant:"outline",size:"sm",onClick:()=>v(0,0,0),children:d("Never")}),(0,s.jsx)(S.$,{type:"button",variant:"outline",size:"sm",onClick:()=>v(1,0,0),children:d("1M")}),(0,s.jsx)(S.$,{type:"button",variant:"outline",size:"sm",onClick:()=>v(0,7,0),children:d("1W")}),(0,s.jsx)(S.$,{type:"button",variant:"outline",size:"sm",onClick:()=>v(0,1,0),children:d("1 Day")})]})]}),(0,s.jsx)(I.Rr,{children:d("Leave empty for never expires")}),(0,s.jsx)(I.C5,{})]})}}),!c&&(0,s.jsx)(I.zB,{control:g.control,name:"count",render:e=>{let{field:t}=e;return(0,s.jsxs)(I.eI,{children:[(0,s.jsx)(I.lR,{children:d("Quantity")}),(0,s.jsx)(I.MJ,{children:(0,s.jsx)(D.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,s.jsx)(I.Rr,{children:d("Create multiple redemption codes at once (1-100)")}),(0,s.jsx)(I.C5,{})]})}})]})})}),(0,s.jsxs)(A.XW,{className:(0,E.Jx)(),children:[(0,s.jsx)(A.kN,{render:(0,s.jsx)(S.$,{variant:"outline"}),children:d("Close")}),(0,s.jsx)(S.$,{form:"redemption-form",type:"submit",disabled:h,children:h?d("Saving..."):d("Save changes")}
2)]})]})})}function P(){let{open:e,setOpen:t,currentRow:a}=N(),n="update"===e;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(q,{open:"create"===e||n,onOpenChange:e=>!e&&t(null),currentRow:n&&a||void 0}),(0,s.jsx)(w,{})]})}var $=a(30935),B=a(57736),K=a(73406);function H(){let{t:e}=(0,n.Bd)(),{setOpen:t,triggerRefresh:a}=N(),[i,o]=(0,l.useState)(!1),[d,c]=(0,l.useState)(!1),u=async()=>{c(!0);try{let t=await g();if(t.success){let s=t.data||0;r.oR.success(e("Successfully deleted {{count}} invalid redemption codes",{count:s})),a(),o(!1)}else r.oR.error(t.message||e(f.UU.DELETE_INVALID_FAILED))}finally{c(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)(S.$,{size:"sm",variant:"outline",onClick:()=>o(!0),children:[(0,s.jsx)($.A,{className:"text-destructive h-4 w-4"}),e("Delete Invalid")]}),(0,s.jsxs)(S.$,{size:"sm",onClick:()=>t("create"),children:[(0,s.jsx)(B.A,{className:"h-4 w-4"}),e("Create Code")]})]}),(0,s.jsx)(K.T,{destructive:!0,open:i,onOpenChange:o,handleConfirm:u,isLoading:d,className:"max-w-md",title:e("Delete Invalid Redemption Codes?"),desc:(0,s.jsxs)(s.Fragment,{children:[e("This will delete all")," ",(0,s.jsx)("strong",{children:e("used")}),","," ",(0,s.jsx)("strong",{children:e("disabled")}),e(", and")," ",(0,s.jsx)("strong",{children:e("expired")}
2)," ",e("redemption codes."),(0,s.jsx)("br",{}),e("This action cannot be undone.")]}),confirmText:e("Delete Invalid")})]})}var U=a(43866),O=a(28585),W=a(13595),G=a(70085),J=a(10625),Q=a(20143);function Z(e){let{table:t}=e,{t:a}=(0,n.Bd)(),i=t.getSelectedRowModel().rows,r=(0,l.useMemo)(()=>i.map(e=>{let t=e.original;return`${t.name}	${t.key}`}).join("\n"),[i]);return(0,s.jsx)(W.Of,{table:t,entityName:a("redemption code"),children:(0,s.jsx)(Q.i,{value:r,variant:"outline",size:"icon",className:"size-8",tooltip:a("Copy selected codes"),successTooltip:a("Codes copied!"),"aria-label":a("Copy selected codes")})})}var Y=a(7803);function X(e){return(0,s.jsxs)("div",{className:"flex max-w-full min-w-0 items-center",children:[(0,s.jsxs)(Y.AM,{children:[(0,s.jsx)(Y.Wv,{render:(0,s.jsx)(S.$,{variant:"ghost",size:"sm",className:"h-7 max-w-full min-w-0 justify-start truncate px-0 font-mono hover:bg-transparent aria-expanded:bg-transparent"}),children:(0,s.jsx)("span",{className:"truncate",children:e.maskedValue})}),(0,s.jsx)(Y.hl,{className:"w-auto max-w-[min(90vw,28rem)]",align:"start",children:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("p",{className:"text-muted-foreground text-xs",children:e.label}),(0,s.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,s.jsx)(Q.i,{value:e.fullValue,className:"size-7",iconClassName:"size-3.5",tooltip:e.copyTooltip,"aria-label":e.copyAriaLabel})]})}var ee=a(32483),et=a(41645),ea=a(95085),es=a(52909),en=a(60991),ei=a(68815),el=a(48531),er=a(63408),eo=a(30218);let ed=M.Ik({id:M.ai(),user_id:M.ai(),name:M.Yj(),key:M.Yj(),status:M.ai(),quota:M.ai(),created_time:M.ai(),redeemed_time:M.ai(),expired_time:M.ai(),used_user_id:M.ai()});function ec(e){let{row:t}=e,{t:a}=(0,n.Bd)(),i=ed.parse(t.original),{setOpen:l,setCurrentRow:o,triggerRefresh:d}=N(),c=i.status===f.Dq.ENABLED,u=i.status===f.Dq.USED,m=T(i.expired_time,i.status),x=async()=>{let e=c?f.Dq.DISABLED:f.Dq.ENABLED;if((await h(i.id,e)).success){let e=c?a(f.PL.REDEMPTION_DISABLED):a(f.PL.REDEMPTION_ENABLED);r.oR.success(e),d()}},p=!u&&!m;return(0,s.jsxs)("div",{className:"-ml-1.5 flex items-center gap-1",children:[(0,s.jsxs)(es.m_,{children:[(0,s.jsx)(es.k$,{render:(0,s.jsx)(S.$,{variant:"ghost",size:"icon-sm",onClick:()=>{o(i),l("update")},disabled:!(c&&!m),"aria-label":a("Edit")}),children:(0,s.jsx)(en.A,{})}),(0,s.jsx)(es.ZI,{children:a("Edit")})]}),(0,s.jsxs)(er.C,{ariaLabel:a("Open menu"),modal:!1,children:[p&&(0,s.jsx)(eo._2,{onClick:x,children:c?(0,s.jsxs)(s.Fragment,{children:[a("Disable"),(0,s.jsx)(eo.V0,{children:(0,s.jsx)(ei.A,{size:16})})]}):(0,s.jsxs)(s.Fragment,{children:[a("Enable"),(0,s.jsx)(eo.V0,{children:(0,s.jsx)(el.A,{size:16})})]})}),p&&(0,s.jsx)(eo.mB,{}),(0,s.jsxs)(eo._2,{onClick:()=>{o(i),l("delete")},className:"text-destructive focus:text-destructive",children:[a("Delete"),(0,s.jsx)(eo.V0,{children:(0,s.jsx)($.A,{size:16})})]})]})]})}var eu=a(77871),em=a(36543),ex=a(93539),ep=a(47801);let eh=["redemption-mobile-skeleton-1","redemption-mobile-skeleton-2","redemption-mobile-skeleton-3","redemption-mobile-skeleton-4","redemption-mobile-skeleton-5"];function ej(){return(0,s.jsx)("div",{className:"divide-border overflow-hidden rounded-lg border",children:eh.map(e=>(0,s.jsxs)("div",{className:"space-y-2 border-b px-3 py-2.5 last:border-b-0",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(ex.E,{className:"h-4 w-32"}),(0,s.jsx)(ex.E,{className:"h-5 w-16 rounded-md"})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)(ex.E,{className:"h-7 w-44"}),(0,s.jsx)(ex.E,{className:"h-8 w-16"})]}),(0,s.jsx)(ex.E,{className:"h-3 w-28"})]},e))})}function eg(e){let{t}=(0,n.Bd)(),a=e.table.getRowModel().rows;return e.isLoading?(0,s.jsx)(ej,{}):a.length?(0,s.jsx)("div",{className:"divide-border overflow-hidden rounded-lg border",children:a.map(e=>{let a=e.original,n=T(a.expired_time,a.status),i=f.pz[a.status],l=`${a.key.slice(0,8)}******${a.key.slice(-8)}`;return(0,s.jsxs)("div",{className:(0,ep.cn)("bg-card space-y-2.5 border-b px-3 py-2.5 last:border-b-0",n||a.status!==f.Dq.ENABLED?W.Z0:void 0),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("div",{className:"truncate text-sm font-semibold",children:a.name}),(0,s.jsx)("div",{className:"text-muted-foreground text-[11px]",children:t("Redemption Code")})]}),n?(0,s.jsx)(ee.Wh,{label:t("Expired"),variant:"warning",copyable:!1}):i&&(0,s.jsx)(ee.Wh,{label:t(i.labelKey),variant:i.variant,copyable:!1})]}),(0,s.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[(0,s.jsx)("div",{className:"min-w-0 flex-1 [&_button:first-child]:max-w-full [&_button:first-child]:truncate [&_button:first-child]:px-0",children:(0,s.jsx)(X,{label:t("Full Code"),fullValue:a.key,maskedValue:l,copyTooltip:t("Copy code"),copyAriaLabel:t("Copy redemption code")})}),(0,s.jsx)(ec,{row:e})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:t("Quota")}),(0,s.jsx)("span",{className:"font-medium tabular-nums",children:(0,R.eN)(a.quota)})]})]},e.id)})}):(0,s.jsx)("div",{className:"rounded-lg border p-8",children:(0,s.jsx)(em.Sv,{className:"border-none p-0",children:(0,s.jsxs)(em.FT,{children:[(0,s.jsx)(em.Kr,{variant:"icon",children:(0,s.jsx)(eu.A,{className:"size-6"})}),(0,s.jsx)(em.cz,{children:t("No Redemption Codes Found")}),(0,s.jsx)(em.Ou,{children:t("No redemption codes available. Create your first redemption code to get started.")})]})})})}let ef=(0,O.GY)("/_authenticated/redemption-codes/");function ey(){let{t:e}=(0,n.Bd)(),t=function(){let{t:e}=(0,n.Bd)();return[{id:"select",header:t=>{let{table:a}=t;return(0,s.jsx)(ea.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,s.jsx)(ea.S,{checked:a.getIsSelected(),onCheckedChange:e=>a.toggleSelected(!!e),"aria-label":e("Select row"),className:"translate-y-[2px]"})},enableSorting:!1,enableHiding:!1,size:40},{accessorKey:"id",header:e("ID"),meta:{mobileHidden:!0},cell:e=>{let{row:t}=e;return(0,s.jsx)(et.C,{value:t.getValue("id"),className:"w-[60px]"})},size:80},{accessorKey:"name",header:e("Name"),meta:{mobileTitle:!0},cell:e=>{let{row:t}=e;return(0,s.jsx)("span",{className:"font-medium",children:t.getValue("name")}
2)},size:180},{accessorKey:"status",header:e("Status"),meta:{mobileBadge:!0},cell:t=>{let{row:a}=t,n=a.original,i=a.getValue("status");if(T(n.expired_time,i))return(0,s.jsx)(ee.Wh,{label:e("Expired"),variant:"warning",copyable:!1,className:"-ml-1.5"});let l=f.pz[i];return l?(0,s.jsx)(ee.Wh,{label:e(l.labelKey),variant:l.variant,copyable:!1,className:"-ml-1.5"}):null},filterFn:(e,t,a)=>{let s=e.original,n=e.getValue(t);return!!(a.includes(f.Z0)&&T(s.expired_time,n))||a.includes(String(n))},size:120},{id:"code",accessorKey:"key",header:e("Code"),cell:function(t){let{row:a}=t,n=a.original.key,i=`${n.slice(0,8)}${"*".repeat(16)}${n.slice(-8)}`;return(0,s.jsx)(X,{label:e("Full Code"),fullValue:n,maskedValue:i,copyTooltip:e("Copy code"),copyAriaLabel:e("Copy redemption code")})},enableSorting:!1,size:320},{accessorKey:"quota",header:e("Quota"),cell:e=>{let{row:t}=e,a=t.getValue("quota");return(0,s.jsx)(ee.Wh,{label:(0,R.eN)(a),variant:"neutral",copyable:!1,className:"-ml-1.5"})},size:120},{accessorKey:"created_time",header:e("Created"),meta:{mobileHidden:!0},cell:e=>{let{row:t}=e;return(0,s.jsx)("div",{className:"min-w-[160px] font-mono text-sm",children:(0,R.fk)(t.getValue("created_time"))})},size:180},{accessorKey:"expired_time",header:e("Expires"),meta:{mobileHidden:!0},cell:t=>{let{row:a}=t,n=a.getValue("expired_time");if(0===n)return(0,s.jsx)(ee.Wh,{label:e("Never"),variant:"neutral",copyable:!1,className:"-ml-1.5"});let i=F(n);return(0,s.jsx)("div",{className:`min-w-[160px] font-mono text-sm ${i?"text-destructive":""}`,children:(0,R.fk)(n)})},size:180},{accessorKey:"used_user_id",header:e("Redeemed By"),meta:{mobileHidden:!0},cell:t=>{let{row:a}=t,n=a.getValue("used_user_id"),i=a.original;return 0===n?(0,s.jsx)("span",{className:"text-muted-foreground text-sm",children:"-"}):(0,s.jsxs)(es.m_,{children:[(0,s.jsx)(es.k$,{render:(0,s.jsx)(ee.Wh,{label:e("User {{id}}",{id:n}),variant:"neutral",copyable:!1,className:"cursor-help"})}),(0,s.jsx)(es.ZI,{children:(0,s.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,s.jsxs)("div",{children:[e("User ID:")," ",n]}),i.redeemed_time>0&&(0,s.jsxs)("div",{children:[e("Redeemed:")," ",(0,R.fk)(i.redeemed_time)]})]})})]})},size:140},{id:"actions",header:()=>e("Actions"),cell:e=>{let{row:t}=e;return(0,s.jsx)(ec,{row:t})},meta:{pinned:"right"}}]}(),{refreshTrigger:a}=N(),i=(0,G.Ub)("(max-width: 640px)"),{globalFilter:o,onGlobalFilterChange:d,columnFilters:m,onColumnFiltersChange:x,pagination:p,onPaginationChange:h,ensurePageInRange:j}=(0,J.c)({search:ef.useSearch(),navigate:ef.useNavigate(),pagination:{defaultPage:1,defaultPageSize:i?10:20},globalFilter:{enabled:!0,key:"filter"}
2,columnFilters:[{columnId:"status",searchKey:"status",type:"array"}]}),g=(m.find(e=>"status"===e.id)?.value??[])[0]??"",{data:y,isLoading:v,isFetching:b}=(0,U.I)({queryKey:["redemptions",p.pageIndex+1,p.pageSize,o,g,a],queryFn:async()=>{let t=o?.trim(),a=""!==g,s={p:p.pageIndex+1,page_size:p.pageSize},n=t||a?await u({...s,keyword:o,status:g}):await c(s);return n.success?{items:n.data?.items||[],total:n.data?.total||0}:(r.oR.error(n.message||e(t||a?f.UU.SEARCH_FAILED:f.UU.LOAD_FAILED)),{items:[],total:0})},placeholderData:e=>e}),w=y?.items||[],{table:C}=(0,W.uI)({data:w,columns:t,enableRowSelection:!0,columnFilters:m,globalFilter:o,pagination:p,globalFilterFn:(e,t,a)=>{let s=String(e.getValue("name")).toLowerCase(),n=String(e.getValue("id")),i=String(a).toLowerCase();return s.includes(i)||n.includes(i)},onPaginationChange:h,onGlobalFilterChange:d,onColumnFiltersChange:x,manualPagination:!0,manualFiltering:!0,totalCount:y?.total||0,ensurePageInRange:j}),_=(0,l.useMemo)(()=>(0,f.gg)(e),[e]);return(0,s.jsx)(W.cx,{table:C,columns:t,isLoading:v,isFetching:b,emptyTitle:e("No Redemption Codes Found"),emptyDescription:e("No redemption codes available. Create your first redemption code to get started."),skeletonKeyPrefix:"redemptions-skeleton",applyHeaderSize:!0,toolbarProps:{searchPlaceholder:e("Filter by name or ID..."),filters:[{columnId:"status",title:e("Status"),options:_,singleSelect:!0}]},mobile:(0,s.jsx)(eg,{table:C,isLoading:v}),getRowClassName:(e,t)=>{var a;let{isMobile:s}=t;if((a=e.original).status!==f.Dq.ENABLED||T(a.expired_time,a.status))return s?W.Z0:W.JM},bulkActions:(0,s.jsx)(Z,{table:C})})}let ev=function(){let{t:e}=(0,n.Bd)();return(0,s.jsxs)(b,{children:[(0,s.jsxs)(i.Ni,{fixedContent:!0,children:[(0,s.jsx)(i.Ni.Title,{children:e("Redemption Codes")}),(0,s.jsx)(i.Ni.Actions,{children:(0,s.jsx)(H,{})}),(0,s.jsx)(i.Ni.Content,{children:(0,s.jsx)(ey,{})})]}),(0,s.jsx)(P,{})]})}},68815(e,t,a){let s=(0,a(40946).A)("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);a.d(t,{},{A:s})},48531(e,t,a){let s=(0,a(40946).A)("power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);a.d(t,{},{A:s})}}]);

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.