PageSourceSearch

https://cdn.vialibri.net/static/assets/WantsManager-BAYrKgSC.js

js vialibri.net collected 2026-09-24 09:38:55 UTC 13,089 bytes, 2 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="75235b13-fcff-4314-af81-be481a413f09",e._sentryDebugIdIdentifier="sentry-dbid-75235b13-fcff-4314-af81-be481a413f09")}catch(e){}}();import"./_sentry-release-injection-file-SYOkQ1Km.js";import{a as e}from"./rolldown-runtime-BBzOAo5_.js";import{t}from"./react-DuV36FPs.js";import{g as s}from"./_arrayPush-DSp2RZw1.js";import{s as a}from"./_baseUnset-D3G1PSyW.js";import{t as r}from"./_baseIteratee-eVLGECgX.js";import{n}from"./_baseEach-tH7yOdeo.js";import{t as i}from"./useDateDisplay-CpNnMNz1.js";import{t as l}from"./orderBy-CTRVAZRF.js";import{t as o}from"./prop-types-Ccm1EFGL.js";import{n as c,r as u,t as d}from"./EmptyList-DBru4o3z.js";import{t as m}from"./useLocalStorage-CLkwt2cY.js";import{A as h,I as x,K as j,R as p,T as f,at as _,b,j as g,l as v,n as y,nt as w,r as N,ut as T,w as k,y as C}from"./index-CRc22cjs.js";import{t as A}from"./Input-DyTKUKsx.js";import{t as D}from"./Pagination-CY9Njkbo.js";import{t as W}from"./Checkbox-BhDCB8Uo.js";import{t as q}from"./usePageLayout-CkXFEI4G.js";import{t as S}from"./IconHint-DOfKtO8V.js";import{t as P}from"./useHistoryState-BS8mbuNX.js";import{t as E}from"./Select-BRUKOrs_.js";import{t as L}from"./useFormatMoney-DH_K-_Ya.js";var U="Expected a function";function F(e,t){return T(e,function(e){if("function"!=typeof e)throw new TypeError(U);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}(r(t)))}var I=e(t()),M=_(),$=j(),Z=["author","title","all_text"],K=(0,M.withTranslators)((({query:e,countries:t,t:i})=>{const{formatMoney:l}=L();let{author:o,title:c,all_text:u,publisher:d,listing_type:m,year_min:h,year_max:x,price_min:j,price_max:p,first_edition:_,dust_jacket:b,has_image:g,exclude_paperbacks:v,signed:y,exclude_pods:w,exclude_isbns:N,dealer_country_code:T}=e,C={...o&&{author:o},...c&&{title:c},...u&&{all_text:u},...d&&{publisher:d}};j&&p?C.price=`${l(j,"USD")} - ${l(p,"USD")}`:(j&&(C.price_min=l(j,"USD")),p&&(C.price_max=l(p,"USD"))),h&&x?C.year=`${h} - ${x}`:(h&&(C.year_min=h),x&&(C.year_max=x));const A={author_and_title:i("Author and Title:"),author:i("Author:"),title:i("Title:"),all_text:i("Keywords:"),publisher:i("Publisher:"),dealer_country_code:k(e,i,t),year_min:i("Year from:"),year_max:i("Year up to:"),price_min:i("Price from:"),price_max:i("Price to:"),year:i("Year:"),price:i("Price:"),first_edition:i("First Edition"),dust_jacket:i("Dust jacket"),has_image:i("With image"),signed:i("Signed"),exclude_paperbacks:i("Paperbacks"),exclude_pods:i("PoDs"),exclude_isbns:i("ISBNs"),exclude_auctions:i("Auctions"),features:i("Filters:"),exclude:i("Excluding:")},D=e=>{if(!e.author&&!e.title&&!e.all_text)return!1;const t={};if(Object.keys(e).filter((e=>Z.includes(e))).forEach((s=>{const a=e[s].match(/\[(.*?)]/g);a&&a.length&&(t[s]=a.map((e=>e.replace(/[[\]']+/g,""))))})),e.author&&e.title&&e.author.length&&e.title.length){const e=[t.title,t.author].filter((s=new Set,e=>s.has(e)||!s.add(e))).filter((e=>e));e&&e.length&&(t.author_and_title=e,t.title=t.title.filter((t=>!e.includes(t))),t.author=t.author.filter((t=>!e.includes(t))))}var s;const a=Object.keys(t).filter((e=>t&&t[e].length)).map((e=>`${f(t[e].map((e=>`“${e}”`)),i("and"),!0).replace(/[[\]']+/g,"")} from ${A[e].replace(":","")}`)).filter((e=>e));return!!a.length&&a};var W,q,S;return void 0===_&&void 0===b&&void 0===g&&void 0===y&&void 0===T||(C.features=[_?A.first_edition:null,b?A.dust_jacket:null,g?A.has_image:null,y?A.signed:null,T?A.dealer_country_code:null].filter((e=>null!==e)).join(", ")),void 0===v&&void 0===w&&void 0===N||(C.exclude=[v?A.exclude_paperbacks:null,w?A.exclude_pods:null,N?A.exclude_isbns:null,m&&!m.includes("auction")?A.exclude_auctions:null]),D(e)&&(C.exclude=[...D(e),...C.exclude||[]]),C.exclude&&C.exclude.length&&(C.exclude=C.exclude.f
1ilter((e=>e))),Object.keys(C).filter((e=>Z.includes(e))).forEach((e=>{var t;C[e]="string"!=typeof(t=C[e])?t:t.split("[")[0].trim()})),W=C,S={},q=r(q=(e,t)=>A[t]||t,3),n(W,(function(e,t,s){a(S,q(e,t,s),e)})),C=S,C=F(C,(e=>!e)),(0,$.jsx)("div",{className:"value-table value-table--inline",children:Object.entries(C).filter((([,e])=>e)).map((([e,t],a)=>(0,$.jsxs)(I.Fragment,{children:[(0,$.jsx)("div",{className:"value-table__key",children:e}),(0,$.jsx)("div",{className:"value-table__value",children:s(t)?t.join(", "):t})]},a)))})})),Y=e(w()),B=(0,M.withTranslators)((({item:e,number:t,updateWantNotifications:s,deleteWant:a,currentUrl:r,t:n})=>{const i="/wants/"+e.id+"?"+Y.default.stringify({"return-to":r});return(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{className:"want-number",children:t}),(0,$.jsx)(W,{label:n("Notifications"),onChange:t=>s(e.id,t.target.checked),checked:e.notifications,largeText:!0}),(0,$.jsx)("a",{className:"margin-left action action--delete",onClick:g(n("Are you sure you want to delete this want?"),(()=>a(e.id))),children:(0,$.jsx)(M.T,{message:"Delete"})}),(0,$.jsx)("a",{href:i,className:"margin-left action action--edit",children:(0,$.jsx)(M.T,{message:"Edit"})})]})})),H=({item:e})=>{const{formatDate:t}=i();return(0,$.jsxs)("div",{className:"value-table",children:[(0,$.jsx)("div",{className:"value-table__key",children:(0,$.jsx)(M.T,{message:"Last search:"})}),(0,$.jsx)("div",{className:"value-table__value nowrap",children:t(e.last_search)}),(0,$.jsx)("div",{className:"value-table__key",children:(0,$.jsx)(M.T,{message:"Last Libribot search:"})}),(0,$.jsx)("div",{className:"value-table__value nowrap",children:t(e.last_full_bot_search,"time")||"N/A"})]})},O=e(o()),R=I.memo((function({id:e}){return(0,$.jsxs)("div",{children:[(0,$.jsx)("a",{href:`/wants/${e}/matches`,className:"button button--outline button--grey button--small",children:(0,$.jsx)(M.T,{message:"Libribot matches"})}),(0,$.jsx)("a",{href:`/wants/${e}/search?include=new`,className:"button button--outline button--grey button--small margin-left--quarter",children:(0,$.jsx)(M.T,{message:"New matches"})}),(0,$.jsx)("a",{href:`/wants/${e}/search?include=all`,className:"button button--outline button--small margin-left--quarter",children:(0,$.jsx)(M.T,{message:"All matches"})})]})}));R.propTypes={id:O.default.number.isRequired};var Q=({value:e,t:t,onChange:s})=>{const[a,r]=(0,I.useState)(e),[n,i]=(0,I.useState)(!1),l=()=>{i(!1),r(e)};return(0,$.jsx)("div",{className:"want-note-editor",children:n?(0,$.jsxs)("form",{onSubmit:e=>{e.preventDefault(),s(a),i(!1)},children:[(0,$.jsx)(A,{autofocus:!0,value:a,variant:"small",onChange:e=>r(e.target.value),onEscape:()=>l()}),(0,$.jsx)("button",{type:"submit",value:a,className:"button button--small",children:t("Save")}),(0,$.jsx)("button",{type:"button",className:"button button--small button--notice",onClick:l,children:t("Cancel")})]}):(0,$.jsxs)($.Fragment,{children:[e?(0,$.jsxs)($.Fragment,{children:[t("Note:")," ",e," "]}):null,(0,$.jsx)("span",{onClick:()=>{i(!0)},children:e?`(${t("Edit")})`:t("Add note")})]})})};Q.propTypes={value:O.default.string,onChange:O.default.func.isRequired};var z=(0,M.withTranslators)(Q),G=(0,M.withTranslators)((({item:e,number:t,updateWantNote:s,deleteWant:a,updateWantNotifications:r,currentUrl:n,countries:i})=>(0,$.jsxs)("div",{className:"want-list-item",children:[(0,$.jsxs)("div",{className:"want-list-item__info",children:[(0,$.jsx)("div",{className:"want-list-item__info-column",children:(0,$.jsx)(K,{query:e.query,countries:i})}),(0,$.jsx)("div",{className:"want-list-item__info-column",children:(0,$.jsx)(H,{item:e})}),(0,$.jsx)("div",{className:"want-list-item__notes",children:(0,$.jsx)(z,{value:e.note,onChange:t=>s(e.id,t)})})]}),(0,$.jsx)("div",{className:"want-list-item__footer",children:(0,$.jsxs)("div",{className:"control-bar",children:[(0,$.jsx)(R,{id:e.id}),(0,$.jsx)(B,{item:e,number:t,deleteWant:a,updateWantNotifications:r,currentUrl:n})]})})]}))),J=()=>(0,$.jsx)("span",{className:"muted",children:"-"}),V=I.memo((function({item:e,number:t,updateWantNote:s,deleteWant:a,updateWantNotifications:r,currentUrl:n,countries:l,t:o}){const{formatDate:c}=i(),{formatMoney:u}=L();return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)("div",{className:"wants-table__row-top",children:[(0,$.jsx)("div",{children:e.query.author||(0,$.jsx)(J,{})}),(0,$.jsx)("div",{children:e.query.title||(0,$.jsx)(J,{})}),(0,$.jsx)("div",{children:e.query.publisher||(0,$.jsx)(J,{})}),(0,$.jsx)("div",{children:e.query.all_text||(0,$.jsx)(J,{})}),(0,$.jsx)("div",{children:e.query.price_min&&u(e.query.price_min,"USD")||(0,$.jsx)(J,{})}),(0,$.jsx)("div",{children:e.query.price_max&&u(e.query.price_max,"USD")||(0,$.jsx)(J,{})}),(0,$.jsx)("div",{children:e.query.year_min||(0,$.jsx)(J,{})}),(0,$.jsx)("div",{children:e.query.year_max||(0,$.jsx)(J,{})}),(0,$.jsx)("div",{children:h(e.query,o,l)||(0,$.jsx)(J,{})}),(0,$.jsx)("div",{className:"nowrap",children:c(e.last_search)}),(0,$.jsx)("div",{className:"nowrap",children:c(e.last_full_bot_search,"time")||"N
1/A"})]}),(0,$.jsxs)("div",{className:"wants-table__row-bottom",children:[(0,$.jsx)(R,{id:e.id}),(0,$.jsx)(z,{value:e.note,onChange:t=>s(e.id,t)}),(0,$.jsx)(B,{item:e,number:t,deleteWant:a,updateWantNotifications:r,currentUrl:n})]})]})})),X=(0,M.withTranslators)(V),ee=(0,M.withTranslators)((({t:e,countries:t,wantsAllowance:s,processingDays:a})=>{const[r,n]=m("wants-sort","created_at.desc"),i=((e="header")=>{const[t,s]=(0,I.useState)(null);return(0,I.useEffect)((()=>{const a=()=>{const a=document.getElementById(e)?.clientHeight;a&&t!==a&&s(a)};return window.addEventListener("scroll",a),()=>{window.removeEventListener("scroll",a)}}),[t,e]),t})(),{columnCount:o}=q(),h=y((e=>e.wants)),j=h.length,f=N(),_=(0,I.useCallback)((e=>f(v(e))),[f]),g=(0,I.useCallback)(((e,t)=>f(C(e,t))),[f]),w=(0,I.useCallback)(((e,t)=>f(b(e,t))),[f]),T=o<3,{state:{filter:k,page:A},updateState:W,url:L}=P({page:1,filter:""}),U=parseInt(A,10),F=50*(U-1),Z=e=>W({filter:e,page:1},e&&k),K=e=>W({page:e}),Y=(0,I.useMemo)((()=>{const e=r.split(".");return l(h,[t=>(t=>e[0].includes("created_at")||e[0].includes("last_search")?t[e[0]]:t.query[e[0]]?t.query[e[0]].toLowerCase():"desc"===e[1]?"-":void 0)(t),"created_at"],[e[1]])}),[h,r]),B=(0,I.useMemo)((()=>{const e=u(k);return Y.filter((t=>u(x(t.query)).includes(e)))}),[Y,k]),H=(0,I.useMemo)((()=>B.slice(F,F+50)),[B,F]),O=Math.ceil(B.length/50),R={"created_at.desc":e("Date created (most recent first)"),"created_at.asc":e("Date created (earliest first)"),"author.asc":e("Author (A to Z)"),"author.desc":e("Author (Z to A)"),"title.asc":e("Title (A to Z)"),"title.desc":e("Title (Z to A)"),"publisher.asc":e("Publisher (A to Z)"),"publisher.desc":e("Publisher (Z to A)"),"all_text.asc":e("Keywords (A to Z)"),"all_text.desc":e("Keywords (Z to A)"),"last_search.desc":e("Last search (most recent first)"),"last_search.asc":e("Last search (earliest first)")};let Q;return Q=T?H.map(((e,s)=>(0,$.jsx)(G,{item:e,number:F+s+1,deleteWant:_,updateWantNote:g,updateWantNotifications:w,currentUrl:L,countries:t},e.id))):(0,$.jsxs)("div",{className:"wants-table",children:[(0,$.jsx)("div",{className:"wants-table__header",children:[e("Author"),e("Title"),e("Publisher"),e("Keywords"),e("Min. Price"),e("Max. Price"),e("Min. Year"),e("Max. Year"),e("Filters"),e("Last search"),e("Last Libribot search")].map((e=>(0,$.jsx)("div",{style:{position:"sticky",top:`${i}px`},children:e},e)))}),H.map(((e,s)=>(0,$.jsx)(X,{item:e,number:F+s+1,deleteWant:_,updateWantNote:g,updateWantNotifications:w,currentUrl:L,countries:t},e.id)))]}),H.length||k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)("div",{className:"control-bar margin-bottom",children:[(0,$.jsxs)("div",{className:"control-bar__subsection",children:[(0,$.jsx)(D,{page:U,pageCount:O,onPageChange:K,inline:!0,extraPagesToShow:2}),(0,$.jsxs)("div",{children:[(0,$.jsx)("span",{children:(0,$.jsx)(M.T,{message:"{{ count }} want ({{ wantsAllowance }} searched per day)",messagePlural:"{{ countWithComma }} wants ({{ wantsAllowance }} searched per day)",count:j,countWithComma:p(j),wantsAllowance:p(s)})}),(0,$.jsx)(S,{hintKey:"wants_allowance",closePopoverManually:!0,args:{processingDays:a}})]})]}),(0,$.jsxs)("div",{className:"control-bar__subsection",children:[(0,$.jsx)(c,{placeholder:e("Find wants"),value:k,onChange:Z}),(0,$.jsxs)("div",{children:[(0,$.jsx)(M.T,{message:"Sort by:"})," ",(0,$.jsx)(E,{onChange:e=>{n(e.target.value),W({page:1})},value:r,options:R})]})]})]}),H.length?(0,$.jsxs)($.Fragment,{children:[Q,(0,$.jsx)(D,{page:U,pageCount:O,onPageChange:K,extraPagesToShow:2})]}):(0,$.jsx)("div",{className:"box",children:(0,$.jsx)(d,{onClearFilter:()=>Z(""),children:(0,$.jsx)(M.T,{message:'None of your wants match "{{ filterText }}".',filterText:k})})})]}):(0,$.jsx)("div",{className:"box",children:(0,$.jsx)(M.T,{message:"No Wants found."})})}));export{ee as default};
2//# sourceMappingURL=WantsManager-BAYrKgSC.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.