1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s=(new e.Error).stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="47bf7871-0528-4ae5-9dec-f82a35a6387f",e._sentryDebugIdIdentifier="sentry-dbid-47bf7871-0528-4ae5-9dec-f82a35a6387f")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3580],{32887:(e,s,t)=>{t.d(s,{A:()=>x});var l=t(15039),n=t.n(l),o=t(69723),r=t(14232),a=t(23840),i=t(54644),d=t(14307);let c=function(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return s.filter(e=>null!=e).reduce((e,s)=>{if("function"!=typeof s)throw Error("Invalid Argument Type, must only provide functions, undefined, or null.");return null===e?s:function(){for(var t=arguments.length,l=Array(t),n=0;n<t;n++)l[n]=arguments[n];e.apply(this,l),s.apply(this,l)}},null)};var m=t(57368),u=t(45949),h=t(37876);let b={height:["marginTop","marginBottom"],width:["marginLeft","marginRight"]};function f(e,s){let t=s[`offset${e[0].toUpperCase()}${e.slice(1)}`],l=b[e];return t+parseInt((0,o.A)(s,l[0]),10)+parseInt((0,o.A)(s,l[1]),10)}let p={[a.kp]:"collapse",[a.ze]:"collapsing",[a.ns]:"collapsing",[a._K]:"collapse show"},x=r.forwardRef((e,s)=>{let{onEnter:t,onEntering:l,onEntered:o,onExit:a,onExiting:b,className:x,children:g,dimension:j="height",in:k=!1,timeout:v=300,mountOnEnter:N=!1,unmountOnExit:_=!1,appear:y=!1,getDimensionValue:w=f,...C}=e,A="function"==typeof j?j():j,$=(0,r.useMemo)(()=>c(e=>{e.style[A]="0"},t),[A,t]),E=(0,r.useMemo)(()=>c(e=>{let s=`scroll${A[0].toUpperCase()}${A.slice(1)}`;e.style[A]=`${e[s]}px`},l),[A,l]),M=(0,r.useMemo)(()=>c(e=>{e.style[A]=null},o),[A,o]),S=(0,r.useMemo)(()=>c(e=>{e.style[A]=`${w(A,e)}px`,(0,m.A)(e)},a),[a,w,A]),I=(0,r.useMemo)(()=>c(e=>{e.style[A]=null},b),[A,b]);return(0,h.jsx)(u.A,{ref:s,addEndListener:d.A,...C,"aria-expanded":C.role?k:null,onEnter:$,onEntering:E,onEntered:M,onExit:S,onExiting:I,childRef:(0,i.am)(g),in:k,timeout:v,mountOnEnter:N,unmountOnExit:_,appear:y,children:(e,s)=>r.cloneElement(g,{...s,className:n()(x,g.props.className,p[e],"width"===A&&"collapse-horizontal")})})})},40050:(e,s,t)=>{t.d(s,{A:()=>g});var l=t(37876),n=t(14232),o=t(62808),r=t(32887),a=t(12212),i=t(57142),d=t(57911),c=t(34924),m=t(65892),u=t(25117),h=t(32435),b=t(79881),f=t(21468),p=t(40898);let x=e=>{let{bookstore:s,isChecked:t,onChange:n,showDistance:o=!1,distance:r}=e,a=o&&r?` (${r.toFixed(1)} km)`:"";return(0,l.jsxs)("label",{className:"radio-checkbox mb-3 radio-checkbox--fullwidth col-sm-6 pe-2",children:[(0,l.jsx)("input",{type:"checkbox",name:"bookstores",value:s.id,checked:t,onChange:n}),(0,l.jsxs)("span",{children:[(0,l.jsxs)("strong",{children:[s.name,a]}),(0,l.jsx)("br",{}),s.address.street_address,", ",s.address.city]})]})},g=(0,n.memo)(e=>{let{isOpen:s,onOpenChange:t,selectedBookstoreIds:g=[],provinceId:j,regionId:k,postalCode:v=null,onSave:N,isEditing:_=!1,geoObj:y}=e,{t:w}=(0,a.B)(),{allBookstores:C}=(0,u.Z)(),[A,$]=(0,n.useState)([...g]),[E,M]=(0,n.useState)(!1),[S,I]=(0,n.useState)(!1),[O,D]=(0,n.useState)(0),[z,B]=(0,n.useState)(!1),[F,L]=(0,n.useState)(null),[K,P]=(0,n.useState)(""),[R,T]=(0,n.use
1State)(null),V=(0,n.useMemo)(()=>C?.filter(e=>e.certified)||[],[C]),Z=(0,n.useMemo)(()=>{if(!j||!V.length)return[];let e=[...V],s=y?.provinces?.find(e=>e.id===j);return e=s?.code==="QC"&&k?e.filter(e=>e.address.region.id===k):e.filter(e=>e.address.province.id===j),e=R?e.map(e=>({...e,distance:(0,h.K)({lat:e.address.latitude,lng:e.address.longitude},R)})).sort((e,s)=>e.distance-s.distance):e.sort((e,s)=>e.name.localeCompare(s.name))},[j,k,V,R,y]);(0,n.useEffect)(()=>{s&&($([...g]),B(!1),M(0===Z.length),I(!1),D(0))},[s,g,Z.length]),(0,n.useEffect)(()=>{s&&v&&(0,m.Kz)(v)&&(async()=>{try{let e=(0,m.h7)(v),s=await (0,i.V)(e);s&&s.latitude&&s.longitude&&T({lat:s.latitude,lng:s.longitude})}catch(e){(0,c.vV)("Geocoding","Failed to geocode institution postal code",e,{postalCode:normalizedCode})}})()},[s,v]);let Q=K?F:V,U=e=>{$(s=>s.includes(e)?s.filter(s=>s!==e):[...s,e]),B(!1)},q=()=>{if(!j)return"";let e=y?.provinces?.find(e=>e.id===j);if(!e)return"";if("QC"===e.code&&k){let s=y?.regions?.find(e=>e.id===k);if(s)return`${e.name}, ${s.name}`}return e.name},G=S?Z:Z.slice(0,12),H=(0,n.useMemo)(()=>(0,d.CV)(V,R),[V,R]),J=(0,n.useMemo)(()=>{if(0===g.length||!V.length)return{};let e=V.filter(e=>g.includes(e.id));return(0,d.vZ)(e,R)},[g,V,R]),W=(0,n.useMemo)(()=>{if(!E||!V.length)return{};let e=K?Q:V;return O&&0!==O&&(e=e.filter(e=>e.address.province.id===O)),(0,d.vZ)(e,R)},[E,K,Q,V,O,R]),X=(0,n.useMemo)(()=>Object.values(W).reduce((e,s)=>e+s.length,0),[W]);return C?(0,l.jsx)(b.A,{isOpen:s,onOpenChange:t,isDismissable:!1,className:"modal-wrapper--large modal-wrapper--tall",children:(0,l.jsxs)(b.A.Content,{title:w("forms.bookstore_modal.title",{mode:_?"edit":"create"}),children:[(0,l.jsxs)("div",{className:"institutional-bookstore-modal",children:[Object.keys(J).length>0&&(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsxs)("h4",{className:"headline headline--block mb-3",children:[(0,l.jsx)(f.A,{value:"pinmarker"})," ",w("forms.bookstore_modal.selections_header",{mode:_?"edit":"create"})]}),Object.entries(J).map(e=>{let[s,t]=e;return(0,l.jsxs)("div",{className:"mb-3",children:[(0,l.jsx)("strong",{className:"d-block mb-2 strong--c-tomato",children:s}),(0,l.jsx)("div",{className:"d-flex flex-wrap",children:t.map(e=>(0,l.jsx)(x,{bookstore:e,isChecked:A.includes(e.id),onChange:()=>U(e.id)},e.id))})]},s)}),(0,l.jsx)("hr",{className:"my-4"})]}),(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsxs)("h4",{className:"headline headline--block mb-3",children:[(0,l.jsx)(f.A,{value:"pinmarker"})," ",w("forms.bookstore_modal.suggestions_for",{location:q()})]}),0===G.length?(0,l.jsx)("p",{className:"text-muted",children:w("forms.bookstore_modal.no_bookstores")}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"d-flex flex-wrap mb-2",children:G.map(e=>(0,l.jsx)(x,{bookstore:e,isChecked:A.includes(e.id),onChange:()=>U(e.id),showDistance:!!R&&!!e.distance,distance:e.distance},e.id))}),!S&&Z.length>12&&(0,l.jsx)("button",{type:"button",className:"btn btn-link p-0 mb-2",onClick:()=>I(!0),children:w("forms.bookstore_modal.view_more",{location:q()})})]})]}),(0,l.jsx)("div",{className:"text-center my-3",children:(0,l.jsxs)("span",{className:"text-muted",children:["âââ ",w("utils.or")," âââ"]})}),(0,l.jsxs)("div",{className:"mb-3",children:[(0,l.jsxs)("button",{type:"button",className:"btn btn-link p-0 d-flex align-items-center gap-2",onClick:()=>M(!E),"aria-controls":"browse-all-bookstores","aria-expanded":E,children:[(0,l.jsx)(f.A,{value:E?"chevron-down":"chevron-right"}),(0,l.jsx)("span",{children:w("forms.bookstore_modal.browse_all")})]}),(0,l.jsx)(r.A,{in:E,children:(0,l.jsxs)("div",{id:"browse-all-bookstores",className:"mt-3",children:[(0,l.jsx)("div",{className:"mb-3",children:(0,l.jsx)(p.A,{bookstores:V,onBookstoreSelect:()=>{},onPositionChange:e=>{T(e)},onSearchChange:(e,s,t)=>{L(e),P(s||"")},showAutocomplete:!1,placeholder:w("forms.bookstore_modal.search_placeholder")})}),(0,l.jsx)("div",{className:"mb-3",children:(0,l.jsxs)("div",{className:"catalog-grid__toolbar__sorter",children:[(0,l.jsx)("label",{htmlFor:"province-filter",className:"d-inline-block me-2",children:(0,l.jsxs)("strong",{children:[w("forms.bookstore_modal.filter_province"),w("utils.colon")]})}),(0,l.jsxs)("select",{id:"province-filter",className:"select select--sortby",value:O,onChange:e=>D(parseInt(e.target.value)),children:[(0,l.jsx)("option",{value:0,children:w("staticpages.all_provinces")}),H.map(e=>(0,l.jsxs)("option",{value:e.id,children:[e.name," (",e.count,")"]},e.id))]})]})}),X>0&&(0,l.jsx)("p",{className:"text-muted mb-3",children:w("forms.bookstore_modal.results_count",{count:X})}),(0,l.jsx)("div",{children:0===Object.entries(W).length?(0,l.jsx)("p",{className:"text-muted",children:w("forms.bookstore_modal.no_bookstores")}):Object.entries(W).map(e=>{let[s,t]=e;return(0,l.jsxs)("div",{className:"mb-3",children:[(0,l.jsx)("strong",{className:"d-block mb-2 strong--c-tomato",children:s}),(0,l.jsx)("div",{className:"d-flex flex-wrap",children:t.map(e=>(0,l.jsx)(x,{bookstore:e,isChecked:A.includes(e.id),onChange:()=>U(e.id),showDistance:!!R&&!!e.distance,distance:e.distance},e.id))})]},s)})})]})})]}),z&&(0,l.jsx)("div",{className:"alert alert-danger mt-3",children:w("forms.bookstore_modal.error_required")})]}),(0,l.jsxs)(b.A.Buttons,{className:"d-flex justify-content-end gap-2 mt-4",children:[(0,l.jsx)(o.$,{onPress:()=>{t(!1)},className:"btn btn--outline btn--small btn--outline--forest",children:w("forms.bookstore_modal.cancel")}),(0,l.jsx)(o.$,{onPress:()=>
1{if(0===A.length)return void B(!0);N(A),t(!1)},className:"btn btn--raised btn--small btn--raised--tomato",children:w("forms.bookstore_modal.confirm",{count:A.length})})]})]})}):null})},41791:(e,s,t)=>{t.d(s,{A:()=>r});var l=t(37876),n=t(14232),o=t(39185);let r=(0,n.memo)(e=>{let{bookstores:s,columns:t=2,className:r="",displayMode:a="full",interactionMode:i="static",selectedIds:d=[],onSelect:c,radioName:m,showLinkToSubdomain:u=!1,showDistance:h=!1,subdomain:b=null,headingLevel:f="h3",emptyMessage:p}=e,x=(0,n.useMemo)(()=>{let e="mb-2";return 1===t?`${e} col-12`:3===t?`${e} col-lg-4`:`${e} col-sm-6`},[t]),g=(0,n.useMemo)(()=>{let e="radio"===i?"d-flex flex-wrap":"row";return`${e} ${r}`.trim()},[i,r]),j=(0,n.useCallback)(e=>d.includes(e),[d]);return s&&0!==s.length?(0,l.jsx)("div",{className:g,children:s.map(e=>(0,l.jsx)("div",{className:x,children:(0,l.jsx)(o.A,{bookstore:e,displayMode:a,interactionMode:i,isSelected:j(e.id),onSelect:c,name:m,showLinkToSubdomain:u,showDistance:h,distance:e.distance,headingLevel:f,subdomain:b})},`bookstore-${e.id}`))}):p?(0,l.jsx)("p",{className:"text-muted",children:p}):null})}}]);
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.