PageSourceSearch

https://app.listingview.io/_next/static/chunks/3568.4832492d71c1e04b.js

js listingview.io collected 2026-09-24 14:25:39 UTC 41,388 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3568],{18457:function(e,t,l){l.d(t,{HI:function(){return h},V_:function(){return _},ZP:function(){return W},oO:function(){return w}});var r=l(57437),n=l(2265),i=l(27648),a=l(76865),o=l(33245),s=l(40875),c=l(82431),d=l(52180),u=l(58633),v=l(67136),p=l(43792),x=l(15127),f=l(60577),b=l(46511),m=l(17794),y=l(72823),g=l(81314);let h=Object.freeze(["is_enabled","price_cents","quantity","sku"]),k=Object.freeze({priceMinCents:b.t.price.minCents,priceMaxCents:b.t.price.maxCents,quantityMin:0,quantityMax:b.t.quantity.max,skuMaxLength:b.t.sku.maxLength}),j=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e/100),N=Object.freeze({price_cents:"Price must be ".concat(j(k.priceMinCents),"–").concat(j(k.priceMaxCents)),quantity:"Quantity must be a whole number from ".concat(k.quantityMin," to ").concat(k.quantityMax),sku:"SKU must be ".concat(k.skuMaxLength," characters or fewer")}),w="bulk_edit_pod_rows_edited",_=Object.freeze({GRID:"grid",MATRIX_VIEW:"matrix_view",AXIS_OP:"axis_op"}),C=Object.freeze({root:"pod-bulk-matrix",hint:"pod-bulk-matrix-hint",skeleton:"pod-bulk-matrix-skeleton",axisChip:"pod-bulk-matrix-axis-chip",setAll:"pod-bulk-matrix-set-all",opPanel:"pod-bulk-matrix-op-panel",opApply:"pod-bulk-matrix-op-apply",opCancel:"pod-bulk-matrix-op-cancel",opNotice:"pod-bulk-matrix-op-notice",cellErrors:"pod-bulk-matrix-cell-errors",section:"pod-bulk-matrix-section",sectionToggle:"pod-bulk-matrix-section-toggle",grid:"pod-bulk-matrix-grid",cards:"pod-bulk-matrix-cards",card:"pod-bulk-matrix-card",overCap:"pod-bulk-matrix-over-cap",emptyMatrix:"pod-bulk-matrix-empty",excludedRow:"pod-bulk-matrix-excluded-row"}),M=Object.freeze([{key:"price_cents",label:"Price"},{key:"quantity",label:"Qty"},{key:"sku",label:"SKU"}]),S=Object.freeze([{key:"set",label:"Set"},{key:"delta",label:"+ / −"},{key:"percent",label:"%"}]),A=Object.freeze([{key:"price_cents",label:"Price",kind:"money"},{key:"quantity",label:"Qty",kind:"int"},{key:"sku",label:"SKU",kind:"text"},{key:"is_enabled",label:"Enabled",kind:"bool"}]);function I(e){let t={};if(!e||"object"!=typeof e)return t;for(let l of h)void 0!==e[l]&&(t[l]=e[l]);return t}let O=(e,t)=>"price_cents"===e?t>=k.priceMinCents&&t<=k.priceMaxCents:"quantity"===e&&t>=k.quantityMin&&t<=k.quantityMax;function P(e,t){return"price_cents"===e?Number.isInteger(t)&&O("price_cents",t):"quantity"===e?Number.isInteger(t)&&O("quantity",t):"sku"===e?null===t||"string"==typeof t&&t.length<=k.skuMaxLength:"is_enabled"===e&&"boolean"==typeof t}function Z(e,t){let l=String(null!=t?t:"").trim();if("sku"===e)return 0===l.length?{ok:!0,value:null}:l.length>k.skuMaxLength?{ok:!1,message:N.sku}:{ok:!0,value:l};let r=N[e];if(!r)return{ok:!1,message:"Unsupported field"};if(0===l.length)return{ok:!1,message:r};let n=Number(l);if(!Number.isFinite(n))return{ok:!1,message:r};if("quantity"===e)return Number.isInteger(n)&&O("quantity",n)?{ok:!0,value:n}:{ok:!1,message:r};let i=Math.round(100*n);return O("price_cents",i)?{ok:!0,value:i}:{ok:!1,message:r}}let z=e=>{var t,l;return null!==(l=null!==(t=null==e?void 0:e.listingId)&&void 0!==t?t:null==e?void 0:e.id)&&void 0!==l?l:null};function R(e,t){var l,r,n;let i=I(t),a=(e,t)=>void 0!==i[e]&&P(e,i[e])?i[e]:t;return{price_cents:a("price_cents",null!==(l=null==e?void 0:e.price_cents)&&void 0!==l?l:null),quantity:a("quantity",null!==(r=null==e?void 0:e.saved_qty)&&void 0!==r?r:null),sku:a("sku",null!==(n=null==e?void 0:e.stored_sku)&&void 0!==n?n:null),is_enabled:a("is_enabled",(null==e?void 0:e.is_enabled)!==!1)}}let L=(e,t,l,r)=>{var n,i,a;return null!==(a=null==e?void 0:null===(i=e[t])||void 0===i?void 0:null===(n=i[l])||void 0===n?void 0:n[r])&&void 0!==a?a:null};function q(e,t,l,r,n){var i,a;let o=I(n);if(0===Object.keys(o).length)return null!=e?e:{};let s=null!=e?e:{},c=null!==(i=s[t])&&void 0!==i?i:{},d=null!==(a=c[l])&&void 0!==a?a:{};return{...s,[t]:{...c,[l]:{...d,[r]:{...I(d[r]),...o}}}}}let K=e=>Math.min(k.quantityMax,Math.max(k.quantityMin,Math.round(e)));function E(){let{field:e,mode:t,amount:l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=String(null!=l?l:"").trim();return 0!==r.length&&("sku"===e?"set"===t:("price_cents"===e||"quantity"===e)&&Number.isFinite(Number(r)))}function F(e,t){let{field:l,mode:r,amount:n}=e;if(!E({field:l,mode:r,amount:n}))return;let i=String(n).trim();if("sku"===l){let e=Z("sku",i);return e.ok?e.value:void 0}let a=Number(i),o=Number.isFinite(t)?t:0;if("price_cents"===l){let e;if("set"===r)e=100*a;else if(!P("price_cents",t))return;else if("delta"===r)e=o+100*a;else{if("percent"!==r)return;e=o*(1+a/100)}return O("price_cents",e=Math.round(e))?e:void 0}return"set"===r?K(a):"delta"===r?K(o+a):"percent"===r?K(o*(1+a/100)):void 0}let D=e=>Number.isFinite(e)?(e/100).toFixed(2):"";function V(e){let{field:t,kind:l,value:i,onCommit:a,onValidity:o,ariaLabel:s,inputRef:c,invalid:d,errorId:u,errorMessage:v,tabbable:p=!1,draft:x,onDraft:f}=e,b="money"===l?D(i):null==i?"":String(i),m=(0,n.useRef)(!1),y=void 0!==x?x:b,g=!!(d||v),h=e=>{if(e===b)return f(void 0),null==o||o(null),!0;let l=Z(t,e);return l.ok?(f(void 0),null==o||o(null),a(l.value),!0):(null==o||o(l.message),!1)},k=e=>{var t;let l=null==e?void 0:null===(t=e.closest)||void 0===t?void 0:t.call(e,"[data-cell]");l&&(m.current=!0,l.focus())};return(0,r.jsx)("input",{ref:c,type:"text",inputMode:"text"===l?"text":"decimal",tabIndex:p?void 0:-1,"aria-label":s,"aria-invalid":g||void 0,"aria-describedby":v?u:void 0,value:y,className:"h-lv-control-xs w-full rounded-lv-sm border bg-lv-field px-1.5 text-lv-body text-lv-text-primary outline-none focus-visible:ring-2 focus-visible:ring-lv-focus ".concat(g?"border-lv-error-border bg-lv-error-surface":"border-lv-border-divider"),onFocus:()=>{m.current=!1,void 0===x&&f(b)},onChange:e=>{f(e.target.value),v&&(null==o||o(null))},onBlur:e=>{if(m.current){m.current=!1;return}h(e.target.value)},onKeyDown:e=>{if("Enter"===e.key){e.preventDefault(),e.stopPropagation();let t=e.currentTarget;h(t.value)&&!p&&k(t)}else if("Escape"===e.key){e.stopPropagation();let t=e.currentTarget;f(void 0),null==o||o(null),p||k(t)}else e.key.startsWith("Arrow")&&e.stopPropagation()}})}function T(e){let{entries:t}=e;return 0===t.length?null:(0,r.jsx)("div",{role:"alert","data-testid":C.cellErrors,className:"sticky left-0 border-t border-lv-error-border bg-lv-error-surface px-3 py-2",children:(0,r.jsx)("ul",{className:"flex flex-col gap-0.5 text-lv-caption text-lv-error-strong",children:t.map(e=>{let[t,l]=e;return(0,r.jsxs)("li",{id:l.id,className:"flex items-start gap-1.5",children:[(0,r.jsx)(a.Z,{"aria-hidden":"true",size:13,className:"mt-[1px] shrink-0"}),(0,r.jsxs)("span",{children:[l.label," — ",l.message]})]},t)})})})}function U(e){let{listingLabel:t,rowsWithValues:l,allCellErrors:n,errorBaseId:i,onCellPatch:a,setCellError:s,drafts:c,setDraft:d}=e;return(0,r.jsx)("ul",{role:"list","aria-label":"Variants for ".concat(t),"data-testid":C.cards,className:"flex flex-col gap-2",children:l.map((e,t)=>{let{row:l,values:v}=e,p=l.label||"Row ".concat(t+1);return(0,r.jsxs)("li",{"data-testid":l.editable?C.card:C.excludedRow,"aria-disabled":l.editable?void 0:"true",className:"rounded-lv-md border border-lv-border-divider p-3 ".concat(l.editable?"bg-lv-card":"bg-lv-chip"),children:[(0,r.jsx)("p",{className:"text-lv-strong text-lv-text-primary",children:p}),l.editable?(0,r.jsx)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:A.map(e=>{var o,x;let f="".concat(e.label," for ").concat(p),b="".concat(l.cellKey,"::").concat(e.key),m="".concat(i,"-err-").concat(t,"-").concat(e.key);return(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("span",{className:"text-lv-caption text-lv-text-secondary",children:e.label}),"bool"===e.kind?(0,r.jsx)(u.Z,{checked:v.is_enabled,inputProps:{"aria-label":f},onChange:e=>a(l,{is_enabled:e.target.checked})}):(0,r.jsx)(V,{tabbable:!0,field:e.key,kind:e.kind,ariaLabel:f,invali
1d:"price_cents"===e.key&&v.is_enabled&&!(v.price_cents>0),errorId:m,errorMessage:null!==(x=null===(o=n[b])||void 0===o?void 0:o.message)&&void 0!==x?x:null,draft:c[b],onDraft:e=>d(b,e),onValidity:e=>s(b,e?{id:m,label:f,message:e}:null),value:"price_cents"===e.key?v.price_cents:"quantity"===e.key?v.quantity:v.sku,onCommit:t=>a(l,{[e.key]:t})})]},e.key)})}):(0,r.jsxs)("p",{className:"mt-1 flex items-start gap-1.5 text-lv-caption text-lv-text-tertiary",children:[(0,r.jsx)(o.Z,{"aria-hidden":"true",size:12,className:"mt-[1px] shrink-0"}),(0,r.jsx)("span",{children:l.exclusionReason===g.yL?"".concat(l.exclusionReason,". ").concat(g.Tm):l.exclusionReason})]})]},l.cellKey)})})}function X(e){let{listingId:t,listingLabel:l,matrix:i,value:a,onCellPatch:s}=e,c=(0,n.useRef)(null),[d,v]=(0,n.useState)({row:0,col:0}),[x,b]=(0,n.useState)({}),m=(0,n.useId)(),[y,h]=(0,n.useState)({}),k=(0,n.useCallback)((e,t)=>{h(l=>{if(void 0===t){if(!(e in l))return l;let t={...l};return delete t[e],t}return l[e]===t?l:{...l,[e]:t}})},[]),j=(0,n.useCallback)((e,t)=>{b(l=>{var r;if(!t){if(!l[e])return l;let t={...l};return delete t[e],t}return(null===(r=l[e])||void 0===r?void 0:r.message)===t.message?l:{...l,[e]:t}})},[]),N=(0,f.d)(),w=(0,n.useMemo)(()=>i.rows.map(e=>({row:e,values:R(e,e.editable?L(a,t,e.podProductId,e.matrixKey):null)})),[i.rows,a,t]),_=(0,n.useMemo)(()=>{let e={};return w.forEach((t,l)=>{let{row:r,values:n}=t;r.editable&&n.is_enabled&&!(n.price_cents>0)&&(e["".concat(r.cellKey,"::price_cents")]={id:"".concat(m,"-err-").concat(l,"-price_cents"),label:"Price for ".concat(r.label||"Row ".concat(l+1)),message:"Enabled variant needs a price"})}),e},[w,m]),M=(0,n.useMemo)(()=>({..._,...x}),[_,x]),S=Object.entries(M),I=(0,n.useMemo)(()=>i.axisCount>=2?[i.v1Name||"Option 1",i.v2Name||"Option 2"]:1===i.axisCount?[i.v1Name||"Option"]:["Product"],[i.axisCount,i.v1Name,i.v2Name]),O=(0,n.useMemo)(()=>[...I.map(e=>({key:"axis:".concat(e),label:e,kind:"label"})),...A],[I]),P=I.length,Z=i.rows.length,z=(0,n.useCallback)((e,t)=>{var l;let r=null===(l=c.current)||void 0===l?void 0:l.querySelector('[data-cell="'.concat(e,":").concat(t,'"]'));r&&(v({row:e,col:t}),r.focus())},[]);return N?(0,r.jsxs)("div",{children:[(0,r.jsx)(U,{listingLabel:l,rowsWithValues:w,allCellErrors:M,errorBaseId:m,onCellPatch:s,setCellError:j,drafts:y,setDraft:k}),(0,r.jsx)(T,{entries:S})]}):(0,r.jsxs)("div",{className:"overflow-x-auto",children:[(0,r.jsxs)("div",{ref:c,role:"grid","aria-label":"Variants for ".concat(l),"aria-rowcount":Z+1,"aria-colcount":O.length,"data-testid":C.grid,onKeyDown:e=>{var t,l,r,n,i;let a=null===(t=(l=e.target).closest)||void 0===t?void 0:t.call(l,"[data-cell]"),o="string"==typeof(null==a?void 0:null===(r=a.dataset)||void 0===r?void 0:r.cell)?a.dataset.cell.split(":").map(Number):[],s=Number.isFinite(o[0])?o[0]:d.row,c=Number.isFinite(o[1])?o[1]:d.col,u=O.length-1,v=Math.max(Z-1,0);switch(e.key){case"ArrowRight":e.preventDefault(),z(s,Math.min(c+1,u));break;case"ArrowLeft":e.preventDefault(),z(s,Math.max(c-1,0));break;case"ArrowDown":e.preventDefault(),z(Math.min(s+1,v),c);break;case"ArrowUp":e.preventDefault(),z(Math.max(s-1,0),c);break;case"Home":e.preventDefault(),z(e.ctrlKey?0:s,0);break;case"End":e.preventDefault(),z(e.ctrlKey?v:s,u);break;case"Enter":{let t=null===(n=(i=e.target).closest)||void 0===n?void 0:n.call(i,"[data-cell]"),l=null==t?void 0:t.querySelector("input");if(!l)break;e.preventDefault(),"checkbox"===l.type?l.click():l.focus()}}},className:"min-w-[560px]",children:[(0,r.jsx)("div",{role:"row",className:"flex border-b border-lv-border-divider bg-lv-table-header",children:O.map((e,t)=>(0,r.jsx)("div",{role:"columnheader",className:"px-2 py-1.5 text-lv-caption font-semibold text-lv-text-secondary ".concat(0===t?"sticky left-0 z-lv-sticky bg-lv-table-header":""," ").concat(t<P?"min-w-[112px] flex-1":"w-[104px] shrink-0"),children:e.label},e.key))}),w.map((e,t)=>{var l,n,a,c,x,f;let{row:b,values:h}=e,N=i.axisCount>=2?[null!==(c=null===(l=b.v1)||void 0===l?void 0:l.label)&&void 0!==c?c:"—",null!==(x=null===(n=b.v2)||void 0===n?void 0:n.label)&&void 0!==x?x:"—"]:1===i.axisCount?[null!==(f=null===(a=b.v1)||void 0===a?void 0:a.label)&&void 0!==f?f:"—"]:[b.label||"Product"],w=b.label||"Row ".concat(t+1);return(0,r.jsxs)("div",{role:"row","aria-disabled":b.editable?void 0:"true","data-testid":b.editable?void 0:C.excludedRow,className:"flex border-b border-lv-border-divider ".concat(b.editable?"":"bg-lv-chip"),children:[N.map((e,l)=>
1(0,r.jsx)("div",{role:0===l?"rowheader":"gridcell",tabIndex:d.row===t&&d.col===l?0:-1,"data-cell":"".concat(t,":").concat(l),onFocus:()=>v({row:t,col:l}),className:"min-w-[112px] flex-1 truncate px-2 py-1.5 text-lv-body text-lv-text-primary outline-none focus-visible:ring-2 focus-visible:ring-lv-focus ".concat(0===l?"sticky left-0 z-lv-sticky bg-lv-card":""),children:e},"label-".concat(l))),b.editable?A.map((e,l)=>{var n,i;let a=P+l,o=d.row===t&&d.col===a,c="".concat(e.label," for ").concat(w),p="".concat(b.cellKey,"::").concat(e.key),x="".concat(m,"-err-").concat(t,"-").concat(e.key);return(0,r.jsx)("div",{role:"gridcell",tabIndex:o?0:-1,"data-cell":"".concat(t,":").concat(a),onFocus:()=>v({row:t,col:a}),className:"w-[104px] shrink-0 px-2 py-1.5 outline-none focus-visible:ring-2 focus-visible:ring-lv-focus",children:"bool"===e.kind?(0,r.jsx)(u.Z,{checked:h.is_enabled,inputProps:{"aria-label":c,tabIndex:-1},onChange:e=>s(b,{is_enabled:e.target.checked})}):(0,r.jsx)(V,{field:e.key,kind:e.kind,ariaLabel:c,invalid:"price_cents"===e.key&&h.is_enabled&&!(
1h.price_cents>0),errorId:x,errorMessage:null!==(i=null===(n=M[p])||void 0===n?void 0:n.message)&&void 0!==i?i:null,draft:y[p],onDraft:e=>k(p,e),onValidity:e=>j(p,e?{id:x,label:c,message:e}:null),value:"price_cents"===e.key?h.price_cents:"quantity"===e.key?h.quantity:h.sku,onCommit:t=>s(b,{[e.key]:t})})},e.key)}):(0,r.jsx)("div",{role:"gridcell","aria-colspan":A.length,"aria-label":b.exclusionReason===g.yL?"".concat(b.exclusionReason,". ").concat(g.Tm):b.exclusionReason,tabIndex:d.row===t&&d.col===P?0:-1,"data-cell":"".concat(t,":").concat(P),onFocus:()=>v({row:t,col:P}),className:"flex w-[416px] shrink-0 items-center gap-1 px-2 py-1.5 text-lv-caption text-lv-text-tertiary outline-none focus-visible:ring-2 focus-visible:ring-lv-focus",children:(0,r.jsx)(p.Z,{title:b.exclusionReason===g.yL?g.Tm:b.exclusionReason,children:(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(o.Z,{"aria-hidden":"true",size:12,className:"shrink-0"}),b.exclusionReason]})})})]},b.cellKey)})]}),(0,r.jsx)(T,{entries:S})]})}function Q(){return(0,r.jsxs)("div",{"aria-busy":"true","aria-live":"polite","data-testid":C.skeleton,className:"flex flex-col gap-2 p-3",children:[(0,r.jsx)("span",{className:"sr-only",children:"Loading POD variants…"}),[0,1,2,3].map(e=>(0,r.jsx)("div",{"aria-hidden":"true",className:"h-lv-control-sm w-full animate-pulse rounded-lv-sm bg-lv-chip motion-reduce:animate-none"},e))]})}function W(e){let{listings:t=[],value:l,defaultValue:u,onChange:p,loading:f=!1,source:b=_.MATRIX_VIEW,variantCap:h=100,getListingHref:k=e=>"/dashboard/listing-optimizer/".concat(e),className:j="",stageOperation:A=null,bulkUpdateJobsEnabled:O=!1,canStageOperation:Z=!1}=e,K=void 0!==l,[D,V]=(0,n.useState)(()=>null!=u?u:{}),T=K?l:D,U=(0,n.useId)(),[W,B]=(0,n.useState)(null),[H,$]=(0,n.useState)(null),[G,J]=(0,n.useState)("price_cents"),[Y,ee]=(0,n.use
1State)("set"),[et,el]=(0,n.useState)(""),[er,en]=(0,n.useState)(null),ei=(0,n.useMemo)(()=>(Array.isArray(t)?t:[]).map(e=>{var t,l,r,n;return{listingId:z(e),label:null!==(l=null!==(t=null==e?void 0:e.label)&&void 0!==t?t:null==e?void 0:e.title)&&void 0!==l?l:"Listing ".concat(z(e)),matrix:function(e){let t=Array.isArray(e)?e:[];if(0===t.length)return{rows:[],editable:[],needsResync:!0,axisCount:0,v1Name:null,v2Name:null,v1Options:[],v2Options:[]};let l=(0,m.aI)(t),r=(0,g.Aq)(t,l),n=(0,g.ng)({...r,condition:l}).filter(e=>e.productEnabled).map(e=>{let t=e.hasMatrixEntry&&null!=e.matrixKey&&null!=e.podProductId,l=null;return t||(l=e.hasMatrixEntry?"No saved variant key yet — re-sync the listing":(0,g.Kh)(e,r.axisCount)?g.yL:g.Ji),{...e,editable:t,exclusionReason:l,label:(0,g.j$)(e)}}),i=n.some(e=>e.hasMatrixEntry),a=n.length>0&&n.every(e=>e.exclusionReason===g.yL);return{rows:n,editable:n.filter(e=>e.editable),needsResync:!i&&!a,axisCount:r.axisCount,v1Name:r.v1Name,v2Name:r.v2Name,v1Options:r.v1Options,v2Options:r.v2Options}}(null==e?void 0:e.podProducts),podRouting:null!==(n=null!==(r=null==e?void 0:e.podRouting)&&void 0!==r?r:null==e?void 0:e.pod_routing)&&void 0!==n?n:null}}).filter(e=>null!=e.listingId),[t]),ea=(0,n.useMemo)(()=>{var e,t;let l=new Map,r=new Map;for(let e of ei){for(let t of e.matrix.v1Options)l.has(t.label)||l.set(t.label,t.label);if(e.matrix.axisCount>=2)for(let t of e.matrix.v2Options)r.has(t.label)||r.set(t.label,t.label)}let n=null!==(t=null===(e=ei.find(e=>e.matrix.axisCount>0))||void 0===e?void 0:e.matrix)&&void 0!==t?t:{};return{v1:{name:n.v1Name||"Options",labels:[...l.keys()]},v2:{name:n.v2Name||"Options",labels:[...r.keys()]}}},[ei]),eo=(0,n.useCallback)((e,t)=>{let l=function(e){let t={};if(!e||"object"!=typeof e)return t;for(let[l,r]of Object.entries(e)){if(!r||"object"!=typeof r)continue;let e={};for(let[t,l]of Object.entries(r)){if(!l||"object"!=typeof l)continue;let r={};for(let[e,t]of Object.entries(l)){let l={};for(let[e,r]of Object.entries(I(t)))P(e,r)&&(l[e]=r);Object.keys(l).length>0&&(r[e]=l)}Object.keys(r).length>0&&(e[t]=r)}Object.keys(e).length>0&&(t[l]=e)}return t}(e);K||V(l),null==p||p(l,t)},[K,p]),es=(0,n.useCallback)((e,t,l)=>{let r=q(T,e,t.podProductId,t.matrixKey,l);r!==T&&eo(r,{source:b,listingId:e,podProductId:t.podProductId,matrixKey:t.matrixKey,changedCells:1,changedListings:1})},[eo,T,b]),ec=()=>{$(null),el(""),en(null)},ed=e=>{if(null==e)return null;let t=ea.v1.labels.includes(e),l=ea.v2.labels.includes(e);if(t&&l)return null;let r=String((t?ea.v1.name:l?ea.v2.name:null)||"").trim().toLowerCase();return"color"===r||"colour"===r?"color":"size"===r?"size":null};if(f)return(0,r.jsx)(Q,{});if(0===ei.length)return null;let eu="sku"===G,ev="sku"===G?"SKU":"percent"===Y?"Percent":"price_cents"===G?"Amount":"Quantity",ep=(e,t)=>{let l=(null==H?void 0:H.axisLabel)===t;return(0,r.jsx)("button",{type:"button","aria-pressed":l,"data-testid":null==t?C.setAll:C.axisChip,onClick:()=>{$(l?null:{axisLabel:t}),el(""),en(null)},className:"inline-flex items-center gap-1 rounded-lv-full border px-2 py-[3px] text-lv-btn outline-none focus-visible:ring-2 focus-visible:ring-lv-focus ".concat(l?"border-lv-selected bg-lv-selected-light text-lv-text-primary":"border-lv-border-strong bg-lv-card text-lv-text-secondary hover:text-lv-text-primary"),children:e},null!=t?t:"__all__")};return(0,r.jsxs)("div",{"data-testid":C.root,className:"flex flex-col gap-3 ".concat(j),children:[(0,r.jsxs)("p",{"data-testid":C.hint,className:"flex items-start gap-1.5 text-lv-caption text-lv-text-secondary",children:[(0,r.jsx)(o.Z,{"aria-hidden":"true",size:13,className:"mt-[1px] shrink-0"}),(0,r.jsx)("span",{children:"POD listings price per variant — edit them here"})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[ep("Set all variants",null),ea.v1.labels.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"ml-1 text-lv-caption text-lv-text-tertiary",id:"".concat(U,"-v1"),children:ea.v1.name}),(0,r.jsx)("span",{role:"group","aria-labelledby":"".concat(U,"-v1"),className:"flex flex-wrap gap-1.5",children:ea.v1.labels.map(e=>ep(e,e))})]})]}),ea.v2.labels.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-lv-caption text-lv-text-tertiary",id:"".concat(U,"-v2"),children:ea.v2.name}),(0,r.jsx)("span",{role:"group","aria-labelledby":"".concat(U,"-v2"),className:"flex flex-wrap gap-1.5",children:ea.v2.labels.map(e=>ep(e,e))})]})]}),H&&(0,r.jsxs)("div",{"data-testid":C.opPanel,role:"group","aria-label":null==H.axisLabel?"Set a value on every variant":"Set a value on every ".concat(H.axisLabel," variant"),className:"flex flex-wrap items-end gap-2 rounded-lv-md border border-lv-border-divider bg-lv-card p-2",children:[(0,r.jsx)("span",{role:"group","aria-label":"Field",className:"flex gap-1",children:M.map(e=>(0,r.jsx)("button",{type:"button","aria-pressed":G===e.key,onClick:()=>{J(e.key),en(null),"sku"===e.key&&ee("set")},className:"rounded-lv-btn border px-2 py-1 text-lv-btn outline-none focus-visible:ring-2 focus-visible:ring-lv-focus ".concat(G===e.key?"border-lv-selected bg-lv-selected-light text-lv-text-primary":"border-lv-border-divider bg-lv-card text-lv-text-secondary"),children:e.label},e.key))}),(0,r.jsx)("span",{role:"group","aria-label":"Operation",className:"flex gap-1",children:S.map(e=>(0,r.jsx)("button",{type:"button","aria-pressed":Y===e.key,disabled:eu&&"set"!==e.key,onClick:()=>{ee(e.key),en(null)},className:"rounded-lv-btn border px-2 py-1 text-lv-btn outline-none focus-visible:ring-2 focus-visible:ring-lv-focus disabled:cursor-not-allowed disabled:opacity-50 ".concat(Y===e.key?"border-lv-selected bg-lv-selected-light text-lv-text-primary":"border-lv-border-divider bg-lv-card text-lv-text-secondary"),children:e.label},e.key))}),(0,r.jsx)(v.Z,{size:"sm",label:ev,inputProps:{"aria-label":ev},value:et,onChange:e=>{el(e),en(null)},placeholder:"percent"===Y?"10":"sku"===G?"BS-01":"2"}),(0,r.jsx)(d.Z,{size:"xs",text:"Apply to ".concat(ei.length," listing").
1concat(1===ei.length?"":"s"),"data-testid":C.opApply,onClick:()=>{if(!H)return;let e={field:G,mode:Y,amount:et,axisLabel:H.axisLabel},t="set"===Y?F({field:G,mode:Y,amount:et},void 0):void 0,l=ed(H.axisLabel),r=O&&Z&&A&&void 0!==t?(0,y.Zx)({mode:Y,field:G,value:t,axisLabel:H.axisLabel,axisRole:l}):null;if(r){let e=A(r);if(!e.ok){en(e.error);return}(0,x.Z)(w,{podListings:0,variantCells:0,source:null==H.axisLabel?b:_.AXIS_OP}),ec();return}let{next:n,changedCells:i,changedListings:a,skippedCells:o}=function(e,t,l){let r=null!=e?e:{},n=0,i=0,a=new Set;if(!E(l))return{next:r,changedCells:0,changedListings:0,skippedCells:0};for(let e of Array.isArray(t)?t:[]){var o,s;let t=null==e?void 0:e.listingId;if(null!=t)for(let c of null!==(s=null==e?void 0:null===(o=e.matrix)||void 0===o?void 0:o.editable)&&void 0!==s?s:[]){if(!function(e,t){var l,r;return null==t||(null==e?void 0:null===(l=e.v1)||void 0===l?void 0:l.label)===t||(null==e?void 0:null===(r=e.v2)||void 0===r?void 0:r.label)===t}(c,null==l?void 0:l.axisLabel))continue;let e=R(c,L(r,t,c.podProductId,c.matrixKey)),o="price_cents"===l.field?e.price_cents:e.quantity,s=F(l,o);if(void 0===s){i+=1;continue}r=q(r,t,c.podProductId,c.matrixKey,{[l.field]:s}),n+=1,a.add(String(t))}}return{next:r,changedCells:n,changedListings:a.size,skippedCells:i}}(T,ei,e),s=o>0?"".concat(o," variant").concat(1===o?"":"s"," skipped — ").concat(N[G]):0===i?"Enter a value to apply":null;if(0===i){en(s);return}let c=null==H.axisLabel?b:_.AXIS_OP;if(eo(n,{source:c,op:e,changedCells:i,changedListings:a}),(0,x.Z)(w,{podListings:a,variantCells:i,source:c}),s){en(s);return}ec()}}),(0,r.jsx)(d.Z,{size:"xs",color:"no-background",text:"Cancel","data-testid":C.opCancel,onClick:ec}),er&&(0,r.jsxs)("p",{role:"alert","data-testid":C.opNotice,className:"flex basis-full items-start gap-1.5 text-lv-caption text-lv-error-strong",children:[(0,r.jsx)(a.Z,{"aria-hidden":"true",size:13,className:"mt-[1px] shrink-0"}),(0,r.jsx)("span",{children:er})]})]}),(0,r.jsx)("div",{className:"flex flex-col gap-2",children:ei.map(e=>{let{listingId:t,label:l,matrix:n,podRouting:o}=e,d="".concat(U,"-region-").concat(t),u="".concat(U,"-toggle-").concat(t),v=W===t,p=function(e,t,l){let r=t&&"object"==typeof t&&!Array.isArray(t)?t:null;return(Array.isArray(e)?e:[]).map(e=>{let t=r?r[String(e.podProductId)]:null,n=Number(null==t?void 0:t.variant_cap),i=!!(null==t?void 0:t.routed)&&Number.isFinite(n)&&n>0,a=Number(null==t?void 0:t.split_count);return{...e,cap:i?n:l,routed:i,splitCount:i&&Number.isFinite(a)&&a>0?a:null}}).filter(e=>Number.isFinite(e.cap)&&e.enabled>e.cap)}(function(e,t,l){var r,n;let i=new Map;for(let a of null!==(r=null==e?void 0:e.editable)&&void 0!==r?r:[]){let{is_enabled:e}=R(a,L(l,t,a.podProductId,a.matrixKey)),r=null!==(n=i.get(a.podProductId))&&void 0!==n?n:0;i.set(a.podProductId,r+(e?1:0))}return Array.from(i,e=>{let[t,l]=e;return{podProductId:t,enabled:l}})}(n,t,T),o,h),x=p.length?Math.min(...p.map(e=>e.cap)):h,f=n.needsResync;return(0,r.jsxs)("div",{"data-testid":C.section,className:"rounded-lv-md border border-lv-border-divider bg-lv-card",children:[(0,r.jsxs)("button",{id:u,type:"button","aria-expanded":v,"aria-controls":d,"data-testid":C.sectionToggle,onClick:()=>B(v?null:t),className:"flex w-full items-center justify-between gap-2 rounded-lv-md px-3 py-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-lv-focus",children:[(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,r.jsx)(s.Z,{"aria-hidden":"true",size:14,className:"shrink-0 motion-safe:transition-transform motion-safe:duration-lv motion-safe:ease-lv ".concat(v?"rotate-180":"")}),(0,r.jsx)("span",{className:"truncate text-lv-strong text-lv-text-primary",children:l})]}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[p.length>0&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-lv-full border border-lv-warning-border bg-lv-warning-pill px-2 py-[2px] text-lv-btn text-lv-warning-strong",children:[(0,r.jsx)(a.Z,{"aria-hidden":"true",size:12,className:"shrink-0"}),p.every(e=>e.routed)?"Over the ".concat(x,"-variant routing limit"):"Over Printify's ".concat(x,"-variant cap")]}),(0,r.jsxs)("span",{className:"text-lv-caption text-lv-text-secondary",children:[n.editable.length," variant",1===n.editable.length?"":"s"]})]})]}),v&&(0,r.jsxs)("div",{id:d,role:"region","aria-labelledby":u,className:"border-t border-lv-border-divider",children:[p.map(e=>(0,r.jsxs)("p",{"data-testid":C.overCap,className:"flex items-start gap-1.5 border-b border-lv-warning-border bg-lv-warning-surface px-3 py-2 text-lv-caption text-lv-warning-strong",children:[(0,r.jsx)(a.Z,{"aria-hidden":"true",size:13,className:"mt-[1px] shrink-0"}),(0,r.jsx)("span",{children:function(e){if(null==e?void 0:e.routed){let t=null!=e.splitCount?" across up to ".concat(e.splitCount," Printify product").concat(1===e.splitCount?"":"s"):"";return"".concat(e.enabled," variants are enabled — automatic Printify routing can carry up to ").concat(e.cap).concat(t,". Turn some off before publishing; we never disable them for you.")}return"".concat(e.enabled," variants are enabled — Printify allows ").concat(e.cap," per product. Turn some off before publishing; we never disable them for you.")}(e)})]},e.podProductId)),f?(0,r.jsxs)("p",{"data-testid":C.emptyMatrix,className:"flex items-start gap-1.5 px-3 py-3 text-lv-caption text-lv-text-secondary",children:[(0,r.jsx)(c.Z,{"aria-hidden":"true",size:13,className:"mt-[1px] shrink-0"}),(0,r.jsxs)("span",{children:["This product's variants need a refresh — open the listing to re-sync"," ",(0,r.jsx)(i.default,{href:k(t),className:"text-lv-selected-strong underline outline-none focus-visible:ring-2 focus-visible:ring-lv-focus",children:"Open listing"})]})]}):(0,r.jsx)(X,{listingId:t,listingLabel:l,matrix:n,value:T,onCellPatch:(e,l)=>es(t,e,l)})]})]},t)})})]})}},59785:function(e,t,l){l.d(t,{r:function(){return n}});let r={variations:{title:"Variation",description:"Update variations for multiple listings at once."},price:{title:"Price",description:"Adjust or overwrite listing prices in bulk."},quantity:{title:"Quantity",description:"Update available stock for selected listings."},sku:{title:"SKU",description:"Bulk edit SKU identifiers for your listings."}},n=e=>r[e||"variations"]||r.variations},82347:function(e,t,l){l.d(t,{Z:function(){return o}});var r=l(57437);l(2265);var n=l(76865),i=l(41414),a=l(66848);function o(e){let{listingCount:t=0,onRetry:l}=e;return(0,r.jsxs)("div",{className:"mt-3 flex items-start gap-3 rounded-lv-md border border-lv-error-border bg-lv-error-surface p-3 shadow-lv-status",role:"alert","data-testid":"pod-matrix-failed",children:[(0,r.jsx)(n.Z,{size:16,className:"mt-0.5 shrink-0 text-lv-error","aria-hidden":"true"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("p",{className:"text-lv-strong text-lv-text-primary",children:["Couldn't load variants for ",t.toLocaleStr
1ing()," POD listing",1===t?"":"s"]}),(0,r.jsxs)("p",{className:"text-lv-caption text-lv-text-secondary",children:[1===t?"It's":"They're"," hidden from the matrix until the variants load — nothing about"," ",1===t?"it":"them"," has changed."]})]}),(0,r.jsx)(a.f,{text:"Retry",onClick:l,icon:(0,r.jsx)(i.Z,{size:14,"aria-hidden":"true"}),"data-testid":"pod-matrix-retry"})]})}},94229:function(e,t,l){l.d(t,{Z:function(){return n}});var r=l(57437);function n(e){let{listingCount:t=0}=e;return(0,r.jsxs)("div",{className:"mt-3","data-testid":"pod-matrix-skeleton",children:[(0,r.jsxs)("p",{className:"mb-2 text-lv-caption text-lv-text-secondary",role:"status","aria-live":"polite",children:["Loading variants",t>0?" for ".concat(t.toLocaleString()," POD listing").concat(1===t?"":"s"):"","…"]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2","aria-hidden":"true",children:[(0,r.jsx)("div",{className:"h-9 w-full rounded-lv-md bg-lv-hover animate-pulse motion-reduce:animate-none"}),(0,r.jsx)("div",{className:"h-9 w-full rounded-lv-md bg-lv-hover animate-pulse motion-reduce:animate-none"}),(0,r.jsx)("div",{className:"h-9 w-full rounded-lv-md bg-lv-hover animate-pulse motion-reduce:animate-none"})]})]})}l(2265)},25002:function(e,t,l){l.d(t,{Z:function(){return p}});var r=l(57437),n=l(2265),i=l(2069),a=l(46387),o=l(90740),s=l(33320),c=l(13807),d=l(20099),u=l(41783),v=l(92649);function p(e){let{search:t,onSearchChange:l,availableVariantsAndOptions:p,selectedFilters:x,onSelectedFiltersChange:f,editingCount:b,countLabel:m,searchPlaceholder:y="Search listings..."}=e,[g,h]=(0,n.useState)(!1),k=p||{},j=x||[],N=(0,n.useMemo)(()=>{let e={};return j.forEach(t=>{let{variant:l,option:r}=t;(e[l]=e[l]||[]).push(r)}),e},[j]),w=(0,n.useMemo)(()=>({availableFilters:Object.keys(k).map(e=>({key:e,label:e,type:"select"}))}),[k]),_=Object.keys(k),C=(0,u.IR)(N),M=(e,t)=>{f(j.some(l=>l.variant===e&&l.option===t)?j.filter(l=>!(l.variant===e&&l.option===t)):[...j,{variant:e,option:t}])},S=()=>f([]);return(0,r.jsxs)(s.Z,{shadow:"sm",children:[(0,r.jsxs)(i.Z,{sx:{p:1.5},children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",gap:1,alignItems:"center"},children:[(0,r.jsx)(c.Z,{value:t||"",onChange:l,placeholder:y,fullWidth:!0,size:"sm"}),(0,r.jsxs)("button",{type:"button",onClick:()=>h(e=>!e),"aria-label":"Filter by variant","aria-expanded":g,className:"relative flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-[10px] border transition-colors cursor-pointer ".concat(g?"border-lv-border-strong bg-lv-hover":"border-lv-border bg-lv-card hover:border-lv-border-strong hover:bg-lv-hover"),children:[(0,r.jsx)(o.Z,{size:18,className:g?"text-lv-text-primary":"text-lv-text-secondary"}),C>0&&(0,r.jsx)("span",{className:"absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full bg-lv-selected text-[9px] font-medium text-white",children:C})]})]}),g&&(0,r.jsx)(i.Z,{sx:{mt:1.5,display:"flex",flexWrap:"wrap",gap:1.5,alignItems:"center"},children:0===_.length?(0,r.jsx)(a.Z,{className:"text-xs text-lv-text-secondary",children:"No variants to filter"}):(0,r.jsxs)(r.Fragment,{children:[_.map(e=>(0,r.jsx)(v.Z,{variant:e,options:k[e]||[],selectedOptions:N[e]||[],onToggleOption:M},e)),C>0&&(0,r.jsx)("button",{type:"button",onClick:S,className:"ml-1 inline-flex items-center rounded-lg px-2 py-1 text-xs font-medium text-lv-text-secondary hover:bg-lv-hover hover:text-lv-text-primary cursor-pointer",children:"Clear all"})]})})]}),!g&&C>0&&(0,r.jsx)(i.Z,{sx:{px:1.5,pb:1.5},children:(0,r.jsx)(d.Z,{activeFilters:N,filterDefs:w,onRemove:e=>f(j.filter(t=>t.variant!==e)),onClearAll:S})}),(0,r.jsx)(i.Z,{sx:{px:2,pt:1,pb:1,borderTop:"1px solid var(--lv-border-default)"},children:(0,r.jsx)(a.Z,{variant:"body2",fontWeight:600,children:m||"Editing ".concat(b," listing").concat(1===b?"":"s")})})]})}},55194:function(e,t,l){l.d(t,{FT:function(){return n},VP:function(){return a},dK:function(){return i},lT:function(){return r}});let r=513,n=514;function i(e){let{base:t,axis1:l,axis2:i=null,v1:a,v2:o,axis1PropId:s,axis2PropId:c}=e;return(null==t?void 0:t.property_values)?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return(Array.isArray(e)?e:[]).map(e=>{let{scale_name:t,scale_id:l,value_ids:r,...n}=e||{},i={...n};return"number"==typeof l&&Number.isFinite(l)&&(i.scale_id=l),Array.isArray(r)&&r.length>
10&&(i.value_ids=r),Object.keys(i).forEach(e=>{null==i[e]&&delete i[e]}),i})}(t.property_values):[{property_id:null!=s?s:r,property_name:l,values:[a]},...i?[{property_id:null!=c?c:n,property_name:i,values:[o]}]:[]]}function a(e,t){var l;return(null==e?void 0:null===(l=e.price)||void 0===l?void 0:l.currency_code)||t||"USD"}},72454:function(e,t,l){l.d(t,{Ck:function(){return d},Xl:function(){return o},s7:function(){return s}});var r=l(15111),n=l(78942),i=l(18887),a=l(18457);function o(e,t){return(0,i.d$)(e,t).mode===i.So.MATRIX}function s(e,t,l){return(Array.isArray(e)?e:[]).map(e=>{let n=t(e);return{listingId:n,label:(null==e?void 0:e.title)||"Listing #".concat(n),podProducts:function(e,t){var l,n;let i=Array.isArray(null==e?void 0:e.podProducts)&&e.podProducts||Array.isArray(null==e?void 0:e.pod_products)&&e.pod_products||Array.isArray(null==e?void 0:null===(l=e.catalog)||void 0===l?void 0:l.podProducts)&&e.catalog.podProducts||Array.isArray(null==e?void 0:null===(n=e.catalog)||void 0===n?void 0:n.pod_products)&&e.catalog.pod_products||[],a=[];for(let e of i)if(e&&"object"==typeof e){if((0,r.ZV)(e)){a.push(e);continue}try{a.push((0,r.c9)(e))}catch(e){}}return t?c(a,t):a}(e,function(e,t){var l,r;if(!e||"object"!=typeof e||null==t)return null;let n=null===(r=e[String(t)])||void 0===r?void 0:null===(l=r.podVariantMatrix)||void 0===l?void 0:l.updates;return n&&"object"==typeof n&&Object.keys(n).length>0?n:null}(l,n)),podRouting:function(e){var t;let l=null!==(t=null==e?void 0:e.pod_routing)&&void 0!==t?t:null==e?void 0:e.podRouting;return!l||"object"!=typeof l||Array.isArray(l)?null:l}(e)}}).filter(e=>null!=e.listingId&&""!==String(e.listingId))}function c(e,t){let l=Array.isArray(e)?e:[];return t&&"object"==typeof t?l.map(e=>{let l=(null==e?void 0:e.podProductId)!=null?t[e.podProductId]:null;if(!l||"object"!=typeof l)return e;let r=(Array.isArray(e.rawVariants)?e.rawVariants:[]).map(e=>{let t=(null==e?void 0:e.matrixKey)?l[e.matrixKey]:null;if(!t||"object"!=typeof t)return e;let r={...e};for(let e of a.HI)void 0!==t[e]&&(r[e]=t[e]);return r});return{...e,rawVariants:r}}):l}function d(e){let{listings:t,delta:l,currencyCode:r}=e,a={};for(let e of Array.isArray(t)?t:[]){var o;let t=String(null==e?void 0:e.listingId),s=null!==(o=null==l?void 0:l[t])&&void 0!==o?o:null==l?void 0:l[null==e?void 0:e.listingId];if(!s||0===Object.keys(s).length)continue;let d=function(e){var t;let{podProducts:l,listingId:r,updates:a,currencyCode:o}=e,s=c(l,a),d=(0,n.D3)(s,{currencyCode:o,listingId:Number(r)});if(!(null==d?void 0:null===(t=d.products)||void 0===t?void 0:t.length))return null;let{_capInfo:u,...v}=d,p=(0,i.Uw)(s);return{inventory:v,...Object.keys(p).length>0?{podVariantMatrix:{apply:!0,updates:p}}:{}}}({podProducts:e.podProducts,listingId:e.listingId,updates:s,currencyCode:r});d&&(a[t]=d)}return a}},47113:function(e,t,l){l.d(t,{Z:function(){return n}});var r=l(2265);function n(e){let[t,l]=(0,r.useState)({}),n=(0,r.useRef)({}),i=(0,r.useCallback)((e,t)=>{for(let[r,i]of(l(e||{}),Object.entries(t||{})))(null==i?void 0:i.podVariantMatrix)!==void 0&&(n.current[String(r)]=i.podVariantMatrix)},[]);return(0,r.useEffect)(()=>{var r,i;let a=n.current,o=[];for(let l of new Set([...Object.keys(a),...Object.keys(t)]))(null==e?void 0:null===(r=e[l])||void 0===r?void 0:r.podVariantMatrix)!==a[l]&&o.push(l);for(let r of(o.some(e=>void 0!==t[e])&&l(e=>{let t={...e};return o.forEach(e=>delete t[e]),t}),o)){let t=null==e?void 0:null===(i=e[r])||void 0===i?void 0:i.podVariantMatrix;void 0===t?delete a[r]:a[r]=t}},[e,t]),{value:t,stage:i}}},41491:function(e,t,l){l.d(t,{Z:function(){return d}});var r=l(2265),n=l(17716),i=l(34217);let a=Object.freeze(new Set),o=Object.freeze([]);function s(e,t){if(!e.size)return e;let l=new Set(e),r=!1;for(let e of t)r=l.delete(e)||r;return r?l:e}function c(e,t){if(!t.length)return e;let l=new Set(e);for(let e of t)l.add(e);return l}function d(e){let{fetchPodMatrix:t,needsPodMatrix:l,rowsEpoch:d}=(0,n.rn)()||{},[u,v]=(0,r.useState)(a),[p,x]=(0,r.useState)(a),f=(0,r.useRef)(new Set),b=(0,r.useRef)(new Map),m=(0,r.useRef)(0),y=(0,r.useRef)(!0);(0,r.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]);let g=(0,r.useRef)(d);(0,r.useEffect)(()=>
1{g.current!==d&&(g.current=d,f.current=new Set,b.current=new Map,v(a),x(a))},[d]);let h=(0,r.useRef)(p);h.current=p;let k=(0,r.useCallback)(e=>{if("function"!=typeof t||!e.length)return;let l=g.current,r=()=>y.current&&g.current===l;for(let t of e)f.current.add(t);for(let l of(v(t=>c(t,e)),x(t=>s(t,e)),function(e,t){let l=[];for(let r=0;r<e.length;r+=t)l.push(e.slice(r,r+t));return l}(e,i.r))){let e=m.current+=1;for(let t of l)b.current.set(t,e);let n=()=>l.filter(t=>b.current.get(t)===e),i=e=>{if(!r())return;let t=n();if(!t.length)return;let l=new Set(e),i=t.filter(e=>l.has(e));for(let e of t)b.current.delete(e),l.has(e)&&f.current.delete(e);v(e=>s(e,t)),i.length&&x(e=>c(e,i))};Promise.resolve(t(l)).then(e=>i((null==e?void 0:e.failedIds)||o)).catch(()=>i(l))}},[t]);(0,r.useEffect)(()=>{if("function"!=typeof t||!d)return;let r=[];for(let t of Array.isArray(e)?e:[]){var i;let e=String(null!==(i=(0,n.XQ)(t))&&void 0!==i?i:"");!(!e||f.current.has(e)||h.current.has(e))&&("function"!=typeof l||l(t))&&r.push(e)}r.length&&k(r)},[d,e,t,l,k]);let j=(0,r.useCallback)(()=>{let e=Array.from(h.current);e.length&&k(e)},[k]),N=(0,r.useMemo)(()=>(Array.isArray(e)?e:[]).map(e=>{var t;return String(null!==(t=(0,n.XQ)(e))&&void 0!==t?t:"")}),[e]),w=(0,r.useMemo)(()=>(function(e,t){if(!e.size)return a;let l=new Set;for(let r of t)e.has(r)&&l.add(r);return l.size?l:a})(p,N),[p,N]),_="function"==typeof t&&!!d,C=(0,r.useMemo)(()=>{if(!_||"function"!=typeof l)return a;let t=new Set;for(let i of Array.isArray(e)?e:o){var r;let e=String(null!==(r=(0,n.XQ)(i))&&void 0!==r?r:"");e&&l(i)&&t.add(e)}return t.size?t:a},[e,l,_]),M=(0,r.useMemo)(()=>{let e=new Set;for(let t of N)!w.has(t)&&(u.has(t)||C.has(t))&&e.add(t);return e.size?e:a},[N,u,C,w]),S=(0,r.useMemo)(()=>{let t=Array.isArray(e)?e:o;return M.size||w.size?t.filter(e=>{var t;let l=String(null!==(t=(0,n.XQ)(e))&&void 0!==t?t:"");return!M.has(l)&&!w.has(l)}):t},[e,M,w]),A=(0,r.useCallback)(e=>M.has(String(null!=e?e:"")),[M]),I=(0,r.useCallback)(e=>w.has(String(null!=e?e:"")),[w]);return{pendingIds:M,failedIds:w,isHydratingMatrix:M.size>0,hasFailedMatrices:w.size>0,matrixReadyRows:S,retryFailedMatrices:j,isMatrixPending:A,isMatrixFailed:I}}},20099:function(e,t,l){var r=l(57437);l(2265);var n=l(41217),i=l(75277),a=l(62720),o=l(38866),s=l(55909),c=l(32489),d=l(41783);let u={range:n.Z,text:i.Z,select:a.Z,boolean:o.Z};t.Z=e=>{let{activeFilters:t,filterDefs:l,onRemove:n,onClearAll:i}=e,a=Array.isArray(l)?{availableFilters:l}:l,o=(0,d.Dw)(t,a);return 0===o.length?null:(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 mt-2 px-1",children:[o.map(e=>{var t;let l=u[e.type]||s.Z;return(0,r.jsxs)("span",{className:"inline-flex items-stretch h-8 rounded-lv-lg border border-lv-border-strong bg-lv-input shadow-lv-status overflow-hidden divide-x divide-lv-border-divider",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1 px-2 bg-lv-hover",children:[(0,r.jsx)(l,{size:14,className:"text-lv-text-secondary","aria-hidden":"true"}),(0,r.jsx)("span",{className:"text-lv-caption text-lv-text-secondary whitespace-nowrap",children:null!==(t=e.field)&&void 0!==t?t:e.label})]}),e.operator&&(0,r.jsx)("span",{className:"flex items-center px-2.5 text-lv-btn text-lv-text-tertiary whitespace-nowrap",children:e.operator}),e.value&&(0,r.jsx)("span",{className:"flex items-center px-2.5 text-lv-btn text-lv-text-primary whitespace-nowrap tabular-nums",children:e.value}),(0,r.jsx)("button",{type:"button","aria-label":"Remove ".concat(e.label," filter"),className:"flex items-center justify-center w-7 text-lv-text-tertiary hover:text-lv-text-primary hover:bg-lv-hover cursor-pointer bg-transparent border-none p-0 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-lv-focus",onClick:()=>null==n?void 0:n(e.filterKey),children:(0,r.jsx)(c.Z,{size:14,"aria-hidden":"true"})})]},e.filterKey)}),"function"==typeof i&&(0,r.jsx)("button",{type:"button",className:"inline-flex items-center h-8 px-2.5 rounded-lv-lg text-lv-btn text-lv-text-secondary hover:text-lv-text-primary hover:bg-lv-hover cursor-pointer bg-transparent border-none outline-none focus-visible:ring-2 focus-visible:ring-lv-focus",onClick:()=>i(),children:"Clear all"})]})}}}]);

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.