PageSourceSearch

https://www.newspapers.com/_next/static/chunks/app/products/%5Bsub…/%5Blocale%5D/layout-0e890d04cd0b7e7d.js

js newspapers.com collected 2026-10-01 08:44:31 UTC 46,597 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7396],{1085:(e,t,r)=>{"use strict";r.d(t,{DetectShadyBehaviors:()=>s});var n=r(89247),a=r(7620);function s(){let e=(0,a.useRef)({initialized:!1});if(e.current&&!e.current.initialized){if(e.current.initialized=!0,window.location.pathname.startsWith("/embed/")||window.location.pathname.startsWith("/clippings/embed_clipping"))return;if(window.parent!==window.self){let e=(0,n.sI)(),t=0;console.log(`shady behavior detected: unexpected parent frame at ${window.location.href}`),e("framed-page",{href:window.location.href}),window.addEventListener("message",r=>{if(r.source===window.parent){let n=r.origin;Math.log2(++t)%1==0&&(console.log(`shady behavior detected: received message from parent frame at ${window.location.href}. origin: ${n}`,r.data),e("parent-frame-postmessage",{parentOrigin:n,data:r.data}))}})}}return null}},4815:e=>{e.exports={chatContainer:"ChatBot_chatContainer__UXJC4",chatButton:"ChatBot_chatButton__T679N",buttonShrink:"ChatBot_buttonShrink__21rN_",chatBox:"ChatBot_chatBox__Gp0tk",boxGrow:"ChatBot_boxGrow__9HfTv",noAnimation:"ChatBot_noAnimation__FiYQv",header:"ChatBot_header__amaMw",resizeHandle:"ChatBot_resizeHandle__4lcNU",mobileDragHandle:"ChatBot_mobileDragHandle__wpHFI",dragBar:"ChatBot_dragBar__eNgrb",headerTitle:"ChatBot_headerTitle__zTiFU",convID:"ChatBot_convID__KbX1K",closeButton:"ChatBot_closeButton__HC4dg",errorBanner:"ChatBot_errorBanner__49tdA",messagesArea:"ChatBot_messagesArea__xGFvW",welcomeMessage:"ChatBot_welcomeMessage__IzYRP",message:"ChatBot_message__uY2sM",user:"ChatBot_user__WepkY",ai:"ChatBot_ai__2DcDU",feedbackContainer:"ChatBot_feedbackContainer__Sw9Pl",suggestedCriteria:"ChatBot_suggestedCriteria__5gaK4",criteriaButton:"ChatBot_criteriaButton__wHE6H",selected:"ChatBot_selected__qfA_o",resultItem:"ChatBot_resultItem__riXsq",loadingMessage:"ChatBot_loadingMessage__0JyTr",thinkingDots:"ChatBot_thinkingDots__LRUmV",dot:"ChatBot_dot__9xhAd",thinking:"ChatBot_thinking__cdo16",thinkingPaper:"ChatBot_thinkingPaper__g5o_v",page:"ChatBot_page__bM_Os",page1:"ChatBot_page1__Xr2xW",flipPage:"ChatBot_flipPage__xIGf_",page2:"ChatBot_page2__rbliR",page3:"ChatBot_page3__l9GRs","page-1":"ChatBot_page-1__3YD5H",pulseFade:"ChatBot_pulseFade__FfPIe","page-2":"ChatBot_page-2__34frg","page-3":"ChatBot_page-3__GOtPa",inputArea:"ChatBot_inputArea__itEDT",inputWrapper:"ChatBot_inputWrapper___bmpv",input:"ChatBot_input__RyXqz",aiNote:"ChatBot_aiNote__1JpbW",charCounter:"ChatBot_charCounter__zeqZ3",askButton:"ChatBot_askButton__yOVoO",enabled:"ChatBot_enabled__eQqTD",disabled:"ChatBot_disabled___ODY_"}},6172:(e,t,r)=>{"use strict";r.d(t,{l:()=>n});let n=["accident_and_emergency_incident","advertisement","arts_culture","club_and_association","conflict_war","disaster","economy_business","education","environment","health","human_interest","horoscope","info_wanted","labor","law_and_justice","lifestyle_other","military","politics","recipes","religion","science_and_technology","society","sport","weather"]},7207:(e,t,r)=>{"use strict";r.d(t,{default:()=>i});var n=r(79748),a=r(7620),s=r(46439),o=r(70014);function i(e){let{product:t}=e,r=(0,o.Jd3)(),i=(0,n.usePathname)(),l=(0,n.useSearchParams)(),c=(0,o.zno)();return(0,a.useEffect)(()=>{!i||i.startsWith("/embed/")||((0,s.$b)(r?.id,c?.global?.subscription??"",c?.global?.institution?.id,t.id,t.name,c?.global?.sources?.xid,c?.global?.sources?.iid),(0,s.r3)(i+(l?.toString()??""),document.title,c?.global?.subscription??"",r?.id,c?.global?.country_code))},[i,l]),null}},7549:()=>{},19714:e=>{e.exports={toast:"ToastProvider_toast__IJrLV"}},21604:(e,t,r)=>{Promise.resolve().then(r.bind(r,49709)),Promise.resolve().then(r.bind(r,98814)),Promise.resolve().then(r.bind(r,34278)),Promise.resolve().then(r.bind(r,88974)),Promise.resolve().then(r.bind(r,80806)),Promise.resolve().then(r.bind(r,7207)),Promise.resolve().then(r.t.bind(r,7549,23)),Promise.resolve().then(r.bind(r,34568)),Promise.resolve().then(r.bind(r,65158)),Promise.resolve().then(r.bind(r,1085)),Promise.resolve().then(r.bind(r,77982)),Promise.resolve().then(r.bind(r,9339)),Promise.resolve().then(r.t.bind(r,65587,23)),Promise.resolve().then(r.t.bind(r,74007,23)),Promise.resolve().then(r.t.bind(r,91053,23)),Promise.resolve().then(r.t.bind(r,25545,23)),Promise.resolve().then(r.t.bind(r,44614,23)),Promise.resolve().then(r.bind(r,1099)),Promise.resolve().then(r.bind(r,66454)),Promise.resolve().then(r.bind(r,76407)),Promise.resolve().then(r.bind(r,76944)),Promise.resolve().then(r.t.bind(r,14089,23)),Promise.resolve().then(r.bind(r,92427)),Promise.resolve().then(r.bind(r,23896)),Promise.resolve().then(r.bind(r,1628)),Promise.resolve().then(r.bind(r,11363)),Promise.resolve().then(r.t.bind(r,78208,23)),Promise.resolve().then(r.t.bind(r,90552,23)),Promise.resolve().then(r.bind(r,71398)),Promise.resolve().then(r.bind(r,22054)),Promise.resolve().then(r.t.bind(r,12702,23)),Promise.resolve().then(r.t.bind(r,20998,23)),Promise.resolve().then(r.bind(r,50020)),Promise.resolve().then(r.bind(r,73078)),Promise.resolve().then(r.bind(r,18494)),Promise.resolve().then(r.bind(r,59576)),Promise.resolve().then(r.bind(r,62460)),Promise.resolve().then(r.bind(r,47010)),Promise.resolve().then(r.bind(r,62444)),Promise.resolve().then(r.bind(r,22661)),Promise.resolve().then(r.bind(r,17098)),Promise.resolve().then(r.t.bind(r,86939,23)),Promise.resolve().then(r.bind(r,23595)),Promise.resolve().then(r.t.bind(r,78232,23)),Promise.resolve().then(r.bind(r,44183)),Promise.resolve().then(r.bind(r,35858)),Promise.resolve().then(r.bind(r,86452)),Promise.resolve().then(r.bind(r,11421)),Promise.resolve().then(r.bind(r,95007)),Promise.resolve().then(r.bind(r,77884)),Promise.resolve().then(r.bind(r,39248)),Promise.resolve().then(r.bind(r,76681)),Promise.resolve().then(r.bind(r,84128)),Promise.resolve().then(r.t.bind(r,89181,23)),Promise.resolve().then(r.bind(r,7314)),Promise.resolve().then(r.bind(r,9802)),Promise.resolve().then(r.bind(r,17966)),Promise.resolve().then(r.bind(r,87163)),Promise.resolve().then(r.bind(r,44232)),Promise.resolve().then(r.bind(r,95584)),Promise.resolve().then(r.bind(r,60345)),Promise.resolve().then(r.bind(r,2213)),Promise.resolve().then(r.t.bind(r,66172,23)),Promise.resolve().then(r.bind(r,37289)),Promise.resolve().then(r.bind(r,87427)),Promise.resolve().then(r.bind(r,61755)),Promise.resolve().then(r.bind(r,97556)),Promise.resolve().then(r.bind(r,36146)),Promise.resolve().then(r.bind(r,64079)),Promise.resolve().then(r.bind(r,60085)),Promise.resolve().then(r.bind(r,14090)),Promise.resolve().then(r.bind(r,24385)),Promise.resolve().then(r.bind(r,51771)),Promise.resolve().then(r.bind(r,32437)),Promise.resolve().then(r.bind(r,52385)),Promise.resolve().then(r.bind(r,81409)),Promise.resolve().then(r.bind(r,51100)),Promise.resolve().then(r.bind(r,66905)),Promise.resolve().then(r.bind(r,68574)),Promise.resolve().then(r.bind(r,96443)),Promise.resolve().then(r.bind(r,67623)),Promise.resolve().then(r.bind(r,25917)),Promise.resolve().then(r.bind(r,83019)),Promise.resolve().then(r.bind(r,35513)),Promise.resolve().then(r.bind(r,6064)),Promise.resolve().then(r.bind(r,56740)),Promise.resolve().then(r.bind(r,36443)),Promise.resolve().then(r.bind(r,27431)),Promise.resolve().then(r.bind(r,11392)),Promise.resolve().then(r.bind(r,21336)),Promise.resolve().then(r.bind(r,30136)),Promise.resolve().then(r.bind(r,88341)),Promise.resolve().then(r.bind(r,53445)),Promise.resolve().then(r.bind(r,64747)),Promise.resolve().then(r.bind(r,44603)),Promise.resolve().then(r.bind(r,71609)),Promise.resolve().then(r.bind(r,53727)),Promise.resolve().then(r.bind(r,72964)),Promise.resolve().then(r.bind(r,41103)),Promise.resolve().then(r.bind(r,91791)),Promise.resolve().then(r.bind(r,42498)),Promise.resolve().then(r.t.bind(r,49976,23)),Promise.resolve().then(r.t.bind(r,6,23))},33202:e=>{e.exports={Message:"ConfirmLocaleModal_Message__kObc0",Disclosure:"ConfirmLocaleModal_Disclosure__2T_69",Footer:"ConfirmLocaleModal_Footer__BVc8X"}},33521:e=>{e.exports={Container:"ErrorModal_Container__JuYz8",Content:"ErrorModal_Content__PHRGn"}},34278:(e,t,r)=>{"use strict";
1r.d(t,{ChatBotVisibilityProvider:()=>o,z:()=>i});var n=r(54568),a=r(7620);let s=(0,a.createContext)({isVisible:!1,setChatBotVisible:()=>{}});function o(e){let{children:t}=e,[r,o]=(0,a.useState)(!1),i=(0,a.useCallback)(e=>{o(e)},[]);return(0,n.jsx)(s.Provider,{value:{isVisible:r,setChatBotVisible:i},children:t})}function i(){return(0,a.useContext)(s)}},34568:(e,t,r)=>{"use strict";r.d(t,{default:()=>h});var n=r(54568),a=r(65158),s=r(27137),o=r(79748),i=r(7620),l=r(38557),c=r(70014),u=r(33202),d=r.n(u);function h(e){let{selectedLocale:t}=e,r=(0,o.useRouter)(),u=(0,a.useModalContext)(),h=(0,o.usePathname)(),[g,m]=(0,i.useState)(!1),[_,p]=(0,i.useState)(!1),b=(0,c.FVj)("confirm-lang-change.loading","Please wait…"),f=(0,c.FVj)("confirm-lang-change.title","Default Language"),v=async()=>{m(!0);try{(await fetch("/api/client/preferred-locale/",{method:"POST",body:JSON.stringify({locale:t})})).ok?h.includes("/account/info")?r.refresh():u.hide():p(!0)}catch(e){p(!0)}};return _?(0,n.jsx)(l.A,{}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.NewsModalHeader,{id:"confirm-lang-modal-header",closeButton:!0,children:(0,n.jsx)(a.NewsModalTitle,{children:f})}),(0,n.jsx)(a.NewsModalBody,{className:d().Footer,children:(0,n.jsx)(c.EYj,{token:"confirm-lang-change.message",className:d().Message,hasHtml:!0,template:"Would you like to change your default language to <b>{language}</b>?",parameters:{language:s.kf[t]}})}),(0,n.jsxs)(a.NewsModalFooter,{className:d().Footer,children:[(0,n.jsx)(c.IpI,{variant:"primary",onClick:v,disabled:g,loading:g,loadingText:b,children:(0,n.jsx)(c.EYj,{token:"confirm-lang-change.yes",template:"Yes, change to {language}",parameters:{language:s.kf[t]}})}),!g&&(0,n.jsx)(c.IpI,{variant:"secondary",onClick:()=>u.hide(),children:(0,n.jsx)(c.EYj,{token:"button.no",children:"No"})})]}),(0,n.jsx)("div",{className:d().Footer,children:(0,n.jsx)(c.EYj,{className:d().Disclosure,token:"confirm-lang-change.disclosure",hasHtml:!0})})]})}},38557:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(54568),a=r(65158),s=r(70014),o=r(33521),i=r.n(o);function l(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.NewsModalHeader,{id:"cancel-free-trial-offer-header",closeButton:!0}),(0,n.jsx)("div",{className:i().Content,children:(0,n.jsx)("div",{className:i().Container,children:(0,n.jsx)(s.FcD,{type:"danger",children:(0,n.jsx)(s.EYj,{hasHtml:!0,token:"cancel-free-trial.offer.error",template:'We\'re sorry, there was a problem with submitting your request. Please <a href="">refresh</a> the page and try again.'})})})})]})}},49709:(e,t,r)=>{"use strict";r.d(t,{M:()=>l,SearchResultsAnalysisProvider:()=>i});var n=r(54568),a=r(7620),s=r(72674);let o=(0,a.createContext)(void 0);function i(e){let{children:t}=e,[r,i]=(0,a.useState)([]),[l,c]=(0,a.useState)([]),[u,d]=(0,a.useState)(null),h=(0,a.useCallback)(e=>{if(!u||!u.suggestionSelectedAt||!u.suggestionId)return;let t=r.findIndex(t=>t.id===e);if(-1===t)return;let n=u.suggestionSelectedAt;(0,s.c)({conversation_id:u.conversationId,result_clicked:{suggestion_id:u.suggestionId,page_id:e,position_in_list:t,time_to_click_ms:Date.now()-n,search_criteria:u.searchCriteria||{}}})},[u,r]),g=(0,a.useMemo)(()=>({searchResultsAnalysis:r,setSearchResultsAnalysis:i,pendingPageIds:l,setPendingPageIds:c,trackSuggestedSearchResultClick:h,currentResponse:u,setCurrentResponse:d}),[r,l,h,u]);return(0,n.jsx)(o.Provider,{value:g,children:t})}function l(){let e=(0,a.useContext)(o);return void 0===e?{searchResultsAnalysis:[],setSearchResultsAnalysis:()=>{},pendingPageIds:[],setPendingPageIds:()=>{},trackSuggestedSearchResultClick:()=>{},currentResponse:null,setCurrentResponse:()=>{}}:e}},58463:(e,t,r)=>{"use strict";r.d(t,{f:()=>a});var n=r(5974);let a=(0,n.createServerReference)("60e2dd2d200a24a26e7b0cc5c2ec8cfe20d37d0e19",n.callServer,void 0,n.findSourceMapURL,"logErrorAction")},65158:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Modal:()=>m,ModalContext:()=>b,ModalTrigger:()=>_,NewsModalBody:()=>h,NewsModalFooter:()=>g,NewsModalHeader:()=>u,NewsModalTitle:()=>d,useModalContext:()=>p});var n=r(54568),a=r(7620),s=r(97509),o=r(70014),i=r(87532),l=r.n(i);let c=(0,a.forwardRef)((e,t)=>(0,n.jsx)(o.QWc,{variant:"secondary",ref:t,type:"button",className:l().CloseButton,"aria-label":"Close Dialog",...e,children:(0,n.jsx)(o.Int,{name:"CloseIcon"})}));c.displayName="ModalCloseButton";let u=(0,a.forwardRef)((e,t)=>{let{className:r,children:s,closeButton:i,...u}=e,d=p(),h=a.Children.count(s),g=(0,o.FVj)("button.close","Close");return(0,n.jsxs)("div",{className:(0,o.cs)(l().NewsModalHeader,0===h&&l().noTitle,r),ref:t,...u,children:[s,i&&(0,n.jsx)(c,{onClick:()=>{d?.hide()},"aria-label":g})]})});function d(e){let{children:t,className:r,...a}=e;return(0,n.jsx)("h1",{id:"modal-title",className:(0,o.cs)(l().NewsModalTitle,r),...a,children:t})}function h(e){let{className:t,...r}=e;return(0,n.jsx)("div",{className:(0,o.cs)(l().NewsModalBody,t),...r})}function g(e){let{className:t,...r}=e;return(0,n.jsx)("div",{className:(0,o.cs)(l().NewsModalFooter,t),...r})}
1u.displayName="NewsModalHeader";let m=(0,a.forwardRef)((e,t)=>{let{modal:r,showOnInit:i,large:c,showAtBottom:u,showAtTop:d,center:h,onHide:g,noHide:m,noBackdrop:_}=e,[p,f]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1),C=(0,a.useRef)(null),w=(0,a.useRef)(null),P=(0,o.DEC)(),x=(0,a.useMemo)(()=>({hide:()=>{f(!1),setTimeout(()=>{g&&g(),y(!1)},300)},show:()=>{C.current=document.activeElement,y(!0)}}),[]);function k(e){if(!w.current)return;let t=w.current.querySelectorAll(o.mrL.join(", "));for(let r=0;r<t.length;r+=1)if(t[r]===e.target)return;t.length>0&&(e.preventDefault(),e.stopPropagation(),t[0].focus())}return(0,a.useEffect)(()=>{P&&i&&x.show()},[P,i,x]),(0,a.useEffect)(()=>{if(setTimeout(()=>{f(v)},0),v){document.addEventListener("focus",k,!0),document.body.style.overflow="hidden";let e=w.current?.querySelectorAll(o.mrL.join(", "))[0];e?.focus()}return v||(document.removeEventListener("focus",k,!0),C.current?.focus(),document.body.style.overflow="auto"),()=>{document.removeEventListener("focus",k,!0),document.body.style.overflow="auto"}},[v]),(0,a.useImperativeHandle)(t,()=>({hide(){x.hide()},show(){x.show()}})),(0,n.jsx)(n.Fragment,{children:v&&(0,s.createPortal)((0,n.jsxs)(b.Provider,{value:x,children:[!_&&(0,n.jsx)("div",{className:(0,o.cs)(l().ModalBackdrop,p&&l().transition)}),(0,n.jsx)("div",{"aria-labelledby":"modal-title","aria-modal":"true",className:(0,o.cs)(l().Dialog,c&&l().large,p&&l().transition,u&&l().bottom,d&&l().top,h&&l().center),role:"dialog",ref:w,tabIndex:-1,onClick:m?void 0:()=>{x?.hide()},children:(0,n.jsx)("div",{onKeyDown:m?void 0:function(e){"Escape"===e.key&&(g&&g(),y(!1))},className:(0,o.cs)(l().Modal,c&&l().large,u&&l().bottom,d&&l().top,_&&l().shadow),onClick:e=>{e.stopPropagation()},children:r})})]}),document.body)})});m.displayName="NewsModal";let _=(0,a.forwardRef)((e,t)=>{let{children:r,modal:s,large:o,showAtBottom:i}=e,l=(0,a.useRef)(null);return(0,a.useImperativeHandle)(t,()=>({hide(){l?.current?.hide()},show(){l?.current?.show()}})),(0,n.jsxs)(n.Fragment,{children:[a.Children.map(r,e=>(0,a.cloneElement)(e,{onClick:()=>{l?.current?.show()}})),(0,n.jsx)(m,{modal:s,large:o,ref:l,showAtBottom:i})]})});_.displayName="NewsModalTrigger";let p=()=>(0,a.useContext)(b),b=(0,a.createContext)({hide(){},show(){}})},72674:(e,t,r)=>{"use strict";r.d(t,{c:()=>a});var n=r(5974);let a=(0,n.createServerReference)("406b07172091550cafee324e724ff8a802879a1bba",n.callServer,void 0,n.findSourceMapURL,"chatFeedbackAction")},77982:(e,t,r)=>{"use strict";r.d(t,{default:()=>i});var n=r(54568),a=r(66888),s=r(19714),o=r.n(s);function i(e){let{children:t}=e;return(0,n.jsxs)(n.Fragment,{children:[t,(0,n.jsx)(a.l$,{position:"bottom-center",richColors:!0,closeButton:!0,className:o().toast})]})}},80806:(e,t,r)=>{"use strict";r.d(t,{SearchFormBridgeProvider:()=>o,x:()=>i});var n=r(54568),a=r(7620);let s=(0,a.createContext)(null);function o(e){let{children:t}=e,r=(0,a.useRef)(null),o=(0,a.useCallback)(e=>{r.current=e},[]),i=(0,a.useCallback)(()=>{r.current=null},[]),l=(0,a.useCallback)((e,t,n)=>{r.current?.(e,t,n)},[]);return(0,n.jsx)(s.Provider,{value:{register:o,unregister:i,syncDateFields:l},children:t})}function i(){let e=(0,a.useContext)(s);if(!e)throw Error("useSearchFormBridge must be used within SearchFormBridgeProvider");return e}},87532:e=>{e.exports={NewsModalHeader:"Modal_NewsModalHeader__bSAse",noTitle:"Modal_noTitle__LPzpE",NewsModalBody:"Modal_NewsModalBody__O9R2X",NewsModalTitle:"Modal_NewsModalTitle__pTwhQ",CloseButton:"Modal_CloseButton__NwQn5",NewsModalFooter:"Modal_NewsModalFooter__i_XI8",Dialog:"Modal_Dialog__2n_XE",center:"Modal_center__r_d0v",bottom:"Modal_bottom__a6IFA",top:"Modal_top__atgN4",transition:"Modal_transition__3pvRs",Modal:"Modal_Modal__DRDFT",large:"Modal_large__mWsOP",shadow:"Modal_shadow__VjcGW",ModalBackdrop:"Modal_ModalBackdrop__E7954"}},88974:(e,t,r)=>{"use strict";r.d(t,{ChatBotWrapper:()=>E});var n=r(54568),a=r(70014),s=r(34278),o=r(79748),i=r(7620),l=r(72674),c=r(98814),u=r(80806),d=r(6172),h=r(39248),g=r(4815),m=r.n(g),_=r(49709),p=r(91026),b=r(40343),f=r(58463),v=r(86141).hp;async function y(e,t,r){let n=async t=>(0,b.x6)("/api/client/search-assistant/",{method:"POST",body:JSON.stringify({csrfToken:t,payload:e}),timeout:45e3}),a=await t();if(!a)return null;let s=await n(a);if(s.success)return s.value;if(403===s.error.status&&s.error.data?.error==="invalid_csrf"){let e=await t(!0);if(!e)return null;if((s=await n(e)).success)return s.value}return 403===s.error.status&&s.error.data?.blocked?"blocked":429===s.error.status?"rate_limited":((e,t)=>{if(504===e)return!0;
1if(0!==e)return!1;let r=t?.name;return"TimeoutError"===r||"AbortError"===r})(s.error.status??0,s.error.cause)?"timeout":(r?.({status:s.error.status??0,message:s.error.message,url:s.error.url}),null)}var C=r(86141).hp;let w=e=>e?`transport=${0===e.status} status=${e.status} err=${JSON.stringify(e.message)}`:"reachedServer=true emptyResponse=true",P=e=>e?JSON.stringify({keywords:e.keywords||"",city:e.city||"",country:e.country||"",county:e.county||"",date:e.date||"",date_start:e.date_start||"",date_end:e.date_end||"",categories:e.categories||"",collections:e.collections||"",entity_types:e.entity_types||"",regions:Array.isArray(e.regions)?e.regions.sort().join(","):"",sort:e.sort||"",page_number:e.page_number||"",publication_ids:e.publication_ids||"",days_of_week:e.days_of_week||"",added_since:e.added_since||""}):"empty",x=e=>{let t={...e};return t.entity_types&&(5===(Array.isArray(t.entity_types)?t.entity_types:t.entity_types.split(",")).length||"page"===t.entity_types)&&delete t.entity_types,delete t.publication_ids,delete t.days_of_week,delete t.added_since,t},k=(e,t)=>{let r={page_id:e.page.id,page_date:e.page.date,publication_name:e.publication.name,publication_location:e.publication.location};if("page"!==e.type){let t=e[e.type];if(t){let{id:n,rectangle:a,pageNumber:s,...o}=t;Object.keys(o).length>0&&(r.entity={entityType:e.type,...o})}}let n=t[e.page.id];return n?.compressedParagraphs&&(r.ocr_list=(function(e){if(!e)return[];let t=new Uint8Array(v.from(e,"base64"));return JSON.parse(p.Ay.inflateRaw(t,{to:"string"}))})(n.compressedParagraphs).map(e=>e.text).filter(Boolean)),r},j=e=>{let t=JSON.stringify({search_results:{records:e,total_results:e.length}}),r=p.Ay.deflate(t,{raw:!0});return C.from(r).toString("base64")},S={status:"idle",lastSentPageCount:0,criteriaKey:null,inFlightCallCount:0};function M(e,t){switch(t.type){case"CRITERIA_CHANGED":if("blocked"===e.status)return e;return{...e,status:"loading",lastSentPageCount:0,criteriaKey:t.criteriaKey};case"CALL_STARTED":return{...e,status:"loading",inFlightCallCount:e.inFlightCallCount+1};case"CALL_COMPLETED":{let r=Math.max(0,e.inFlightCallCount-1);return{...e,status:r>0?"loading":"ready",inFlightCallCount:r,lastSentPageCount:Math.max(e.lastSentPageCount,t.pageCount)}}case"CALL_FAILED":{let r=Math.max(0,e.inFlightCallCount-1);return{...e,status:r>0?"loading":"ready",inFlightCallCount:r,lastSentPageCount:Math.max(e.lastSentPageCount,t.pageCount)}}case"NO_RESULTS":return{...e,status:"no-results"};case"CANCELLED":return{...e,status:"ready",inFlightCallCount:0,lastSentPageCount:t.pageCount};case"RESUMED":return{...e,status:"ready"};case"RESET":if("blocked"===e.status)return e;return{...S};case"USER_BLOCKED":return{...e,status:"blocked"}}}let N=e=>{let{text:t,keywords:r}=e,a=(0,i.useMemo)(()=>{if(!r)return[t];let e=r.trim().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=RegExp(`(${e})`,"gi");return t.split(n)},[t,r]);return r?(0,n.jsx)(n.Fragment,{children:a.map((e,t)=>e.toLowerCase()===r.toLowerCase()?(0,n.jsx)("strong",{children:e},t):e)}):(0,n.jsx)(n.Fragment,{children:t})};function B(e){let t,r,s,{visible:g}=e,p=(0,o.useRouter)(),v=(0,o.usePathname)(),C=(t=(0,o.useSearchParams)(),r=(0,a.Bjx)(),s=(0,o.usePathname)(),(0,i.useMemo)(()=>{if(!s.includes("/search/results"))return;let e={};if(t.forEach((t,r)=>{e[r]=t}),0===Object.keys(e).length)return;let n={product:r?.id??0,lnd:""},o=(0,a.ArQ)((0,a.vmv)(e,n)),{request:i}=(0,a.zvL)(o,n),l={};if(i.keyword&&(l.keywords=i.keyword),i.city&&(l.city=i.city),i.region&&(l.regions=[i.region]),i.country&&(l.country=i.country),i.county&&(l.county=i.county),i["date-start"]&&(l.date_start=i["date-start"]),i["date-end"]&&(l.date_end=i["date-end"]),i.date&&(l.date=i.date),i.tags){let e=i.tags.split(",").filter(e=>d.l.includes(e)).join(",");e&&(l.categories=e)}return i.product&&710===i.product&&(l.collections="black history"),i["entity-types"]&&(l.entity_types=i["entity-types"]),i.sort&&(l.sort=i.sort),i["page-number"]&&(l.page_number=parseInt(i["page-number"])),i["publication-ids"]&&(l.publication_ids=i["publication-ids"]),i["days-of-week"]&&(l.days_of_week=i["days-of-week"]),i["added-since"]&&(l.added_since=i["added-since"]),Object.keys(l).length>0?l:void 0},[t,r,s])),{allSearchData:B,searchFetchComplete:E,resetSearchData:A,allHitsLoaded:R,allHitsData:D,resetHits:I}=(0,c._)(),{syncDateFields:F}=(0,u.x)(),L=(0,a.FVj)("chatbot.error-connection","Unable to connect to Search Assist. Please try again."),$=(0,a.FVj)("chatbot.error-send","Oops, there was an issue on our end. Please try again."),T=(0,a.FVj)("chatbot.no-results","It looks like the search didn't match any records from our archive. It may have been too specific—try removing a keyword or filter the date instead or ask me to modify the search."),O=(0,a.FVj)("chatbot.welcome","Ask me anything about people, places, or events that could be found in our newspapers."),V=(0,a.FVj)("chatbot.open-button-label","Open AI Assist chat"),H=(0,a.FVj)("chatbot.disclaimer","AI may make mistakes."),z=(0,a.FVj)("chatbot.ask","Ask"),K=(0,a.FVj)("chatbot.assist-title","Search Assist"),U=(0,a.FVj)("chatbot.dialog-label","AI Assist chat"),W=(0,a.FVj)("chatbot.resize-mobile-label","Select to resize"),Y=(0,a.FVj)("chatbot.resize-handle-label","Resize chat window"),J=(0,a.FVj)("chatbot.close-label","Close chat"),q=(0,a.FVj)("chatbot.dismiss-error-label","Dismiss error"),G=(0,a.FVj)("chatbot.thinking-label","AI is thinking"),X=(0,a.FVj)("chatbot.over-limit","over limit"),Q=(0,a.FVj)("chatbot.placeholder","Type your message..."),Z=(0,a.FVj)("chatbot.input-label","Chat message input"),ee=(0,a.FVj)("chatbot.send-label","Send message"),et=(0,a.FVj)("chatbot.blocked","The Search Assist is taking a quick pause. Please try again later."),er=(0,a.FVj)("chatbot.cancel","Cancel"),en=(0,a.FVj)("chatbot.cancel-label","Cancel request"),ea=(0,a.FVj)("chatbot.loading-1","Newspapering…"),es=(0,a.FVj)("chatbot.loading-2","Thinking…"),eo=(0,a.FVj)("chatbot.loading-3","Analyzing papers…"),ei=(0,a.FVj)("chatbot.loading-4","Chasing the lead…"),el=(0,a.FVj)("chatbot.loading-5","Dispatching the newsies…"),ec=(0,a.FVj)("chatbot.show-more-loading-1","Chasing new results…"),eu=(0,a.FVj)("chatbot.show-more-loading-2","Newspapering on new results…"),ed=(0,a.FVj)("chatbot.show-more-loading-3","Thinking about new results…"),eh=(0,a.FVj)("chatbot.show-more-loading-4","Analyzing new results…"),eg=(0,a.FVj)("chatbot.loading-open","Just a moment while we gather summaries and new search ideas…"),[em,e_]=(0,i.useState)(""),ep=(0,i.useRef)(null),[eb,ef]=(0,i.useState)(!1),ev=(0,i.useRef)(null),ey=(0,i.useRef)(null),eC=(0,i.useRef)(0),[ew,eP]=(0,i.useState)([]),[ex,ek]=(0,i.useState)(!1),[ej,eS]=(0,i.useState)(null),[eM,eN]=(0,i.useState)({width:320,height:0}),[eB,eE]=(0,i.useState)(!1),[eA,eR]=(0,i.useState)(null),[eD,eI]=(0,i.useState)(""),{handleSend:eF,cancelRequest:eL,resumePipeline:e$,pipeline:eT,getConversationId:eO,recordSuggestionSelected:eV}=function(e){let{searchCriteria:t,pathname:r,allSearchData:n,searchFetchComplete:a,allHitsLoaded:s,allHitsData:o,errorText:l,errorSendText:c,noResultsText:u,blockedText:d,inputRef:h,setCurrentLoadingText:g,pickers:m,setMessages:p,isOpen:v,setIsOpen:C,setSelectedSuggestion:N,setErrorMessage:B,resetSearchData:E,resetHits:A}=e,{setCurrentResponse:R,setSearchResultsAnalysis:D,searchResultsAnalysis:I,setPendingPageIds:F}=(0,_.M)(),[L,$]=(0,i.useReducer)(M,S),T=(0,i.useRef)(I);T.current=I;let O=(0,i.useRef)(new Map),V=(0,i.useRef)([]),H=(0,i.useRef)(null),z=(0,i.useRef)(!1),K=(0,i.useRef)(m);K.current=m;let[U,W]=(0,i.useState)(null),Y=(0,i.useRef)(null);Y.current=U;let J=(0,i.useRef)(null),q=(0,i.useRef)(null),G=(0,i.useRef)(t);G.current=t;let X=(0,i.useRef)(n);X.current=n;let Q=(0,i.useRef)(s);Q.current=s;let Z=(0,i.useRef)(v);Z.current=v;let ee=(0,i.useRef)(null),et=(0,i.useRef)(0),er=(0,i.useRef)(!1),en=(0,i.useCallback)(()=>{let e=H.current,t=V.current;(e||0!==t.length)&&(H.current=null,V.current=[],p(r=>{let n=r;return e&&(n=[...n,e]),t.length>0&&(n=function(e,t){let r=new Set(e.flatMap(e=>e.suggested_search_criteria?.map(e=>e.label)??[])),n=t.filter(e=>!r.has(e.label));if(0===n.length)return e;let a=-1;for(let t=e.length-1;t>=0;t--)if(e[t].isShowMore){a=t;break}if(-1!==a){let t=[...e];return t[a]={...t[a],suggested_search_criteria:[...t[a].suggested_search_criteria??[],...n]},t}return[...e,{type:"ai",content:"",isShowMore:!0,suggested_search_criteria:n}]}(n,t)),n}))},[]),ea=(0,i.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=Y.current,n=G.current;!r&&e.conversation_id&&W(e.conversation_id);let a=!1;if(!t&&null!==ee.current){let t=ee.current;ee.current=null,Z.current&&(eg({conversation_id:(e.conversation_id??Y.current)||void 0,search_criteria:x(t.searchCriteria),search_results:j(t.records)},t.pageCount,!0,t.records.map(e=>e.page_id)),a=!0)}if(e.conversation_id){let t={conversationId:e.conversation_id,searchCriteria:n,suggestionSelectedAt:J.current??void 0,suggestionId:q.current??void 0};J.current=null,q.current=null,R(t)}
1if(e.search_results_analysis){let r;if(t){let t=T.current,n=new Set(t.map(e=>e.id));r=[...t,...e.search_results_analysis.filter(e=>!n.has(e.id))]}else r=e.search_results_analysis;D(r)}if(t){if(e.suggested_search_criteria?.length){let t=e.suggested_search_criteria.map(e=>{let t={...e.search_parameters};return"categories"in t&&(t.tags=t.categories,delete t.categories),"collections"in t&&("black history"===t.collections&&(t.product=710),delete t.collections),{...e,search_parameters:t}});V.current=[...V.current,...t]}}else if(e.message||e?.suggested_search_criteria){let t=e.suggested_search_criteria;t&&(t=t.map(e=>{let t={...e.search_parameters};return"categories"in t&&(t.tags=t.categories,delete t.categories),"collections"in t&&("black history"===t.collections&&(t.product=710),delete t.collections),{...e,search_parameters:t}}));let r={type:"ai",content:e.message||"",suggested_search_criteria:t,receivedAt:Date.now()};es()&&!a?H.current=r:p(e=>[...e,r])}},[]),es=()=>{for(let e of O.current.values())if(e.isMerge)return!0;return!1},eo=()=>{let e=new Set;for(let t of O.current.values())t.pendingPageIds.forEach(t=>e.add(t));return Array.from(e)},ei=(0,i.useCallback)(()=>{for(let e of O.current.values())e.abortController.abort();O.current.clear(),V.current=[],H.current=null,z.current=!1,ee.current=null,g(""),F([])},[]),el=e=>{O.current.delete(e),0===O.current.size?(g(""),F([]),et.current>0&&((0,f.f)("chatbot: connection error banner shown",{name:"ChatBotConnectionBanner",message:`[failedInBatch=${et.current}]`,pathname:window.location.pathname}).catch(()=>{}),B(l),et.current=0)):(F(eo()),g(es()?K.current.loadingShowMore():K.current.loadingNewSearch())),es()||en()},ec=(0,i.useRef)(null),eu=(0,i.useRef)(null),ed=(0,i.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!e&&ec.current)return ec.current;if(eu.current)return eu.current;let t=(async()=>{let t=await (0,b.x6)("/api/csrf",{method:"POST"});return t.success?(ec.current=t.value.token,ec.current):((0,f.f)("chatbot: csrf token fetch failed",{name:"ChatBotCsrfError",message:`[forceRefresh=${e} status=${t.error.status??0}] ${t.error.message}`,pathname:window.location.pathname,url:t.error.url}).catch(()=>{}),null)})().finally(()=>{eu.current=null});return eu.current=t,t},[]),eh=(0,i.useCallback)((e,t)=>y(e,ed,t),[ed]),eg=(0,i.useCallback)((e,t,r,n,a)=>{0===O.current.size&&(B(null),et.current=0);let s=`${r?"merge":"initial"}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,o=new AbortController;O.current.set(s,{id:s,abortController:o,isMerge:r,pageCount:t,pendingPageIds:n,startTime:Date.now()}),$({type:"CALL_STARTED"}),r||(z.current=!0),g(a??(r?K.current.loadingShowMore():K.current.loadingNewSearch())),F(eo());let i=Date.now(),l=null;eh(e,e=>{l=e}).then(n=>{if(!o.signal.aborted){if(n)if("blocked"===n){V.current=[],H.current=null,$({type:"USER_BLOCKED"});let e={type:"ai",content:d,isError:!0};p(t=>[...t,e])}else if("rate_limited"===n||"timeout"===n)r||(ee.current=null,D([]),R(null)),et.current+=1,$({type:"CALL_FAILED",pageCount:t});else try{ea(n,r),et.current=0,$({type:"CALL_COMPLETED",pageCount:t})}catch(e){(0,f.f)("chatbot: response processing failed",{name:e?.name??"ChatBotResponseProcessingError",message:`[callId=${s} merge=${r}] ${e?.message??String(e)}`,stack:e?.stack}).catch(()=>{}),r||(ee.current=null,D([]),R(null)),et.current+=1,$({type:"CALL_FAILED",pageCount:t})}else{let n=l;(0,f.f)("chatbot: search-assistant returned null",{name:"ChatBotNullResponse",message:`[callId=${s} merge=${r} durationMs=${Date.now()-i} payloadBytes=${e.search_results?.length??0} ${w(n)}]`,pathname:window.location.pathname,url:n?.url}).catch(()=>{}),r||(ee.current=null,D([]),R(null)),et.current+=1,$({type:"CALL_FAILED",pageCount:t})}el(s)}}).catch(n=>{if(o.signal.aborted)return;let a=Date.now();(0,f.f)("chatbot: search-assistant call failed",{name:n?.name??"ChatBotCallError",message:`[callId=${s} merge=${r} durationMs=${a-i} payloadBytes=${e.search_results?.length??0}] ${n?.message??String(n)}`,stack:n?.stack,digest:n?.digest,pathname:window.location.pathname}).catch(()=>{}),r||(ee.current=null,D([]),R(null)),et.current+=1,$({type:"CALL_FAILED",pageCount:t}),el(s)}).finally(()=>{o.signal.aborted?el(s):O.current.delete(s)})},[]);(0,i.useEffect)(()=>{let e=P(t);if(e!==L.criteriaKey){if(!t){if(null===L.criteriaKey||r.includes("/search/results")||r.includes("/image"))return;ei(),p([]),W(null),C(!1),N(null),D([]),R(null),J.current=null,q.current=null,B(null),$({type:"RESET"});return}ei(),E(),Q.current&&null!==L.criteriaKey&&(er.current=!0),A(),D([]),R(null),B(null),$({type:"CRITERIA_CHANGED",criteriaKey:e})}},[t,r,E,A]),(0,i.useEffect)(()=>{s||(er.current=!1)},[s]),(0,i.useEffect)(()=>
1{if("loading"===L.status&&a&&!(n.length>0)&&!er.current&&!(O.current.size>0)&&t&&0!==Object.keys(t).length&&(g(""),$({type:"NO_RESULTS"}),v)){let e={type:"ai",content:u,isNoResults:!0};p(t=>[...t,e]),C(!0)}},[L.status,a,n,t,v]),(0,i.useEffect)(()=>{if("loading"!==L.status||!a||!s||er.current||O.current.size>0||0===n.length||!v)return;let e=n.length,r=n[e-1],i=r?.records??[];if(e>=2){let r=n[e-2],a=(r?.records??[]).map(e=>k(e,o)),s=i.map(e=>k(e,o)),l=[...a.map(e=>e.page_id),...s.map(e=>e.page_id)];ee.current={records:s,pageCount:e,searchCriteria:t},eg({conversation_id:Y.current||void 0,search_criteria:x(t),search_results:j(a)},e,!1,l,K.current.loadingOpenChat())}else{let r=i.map(e=>k(e,o));eg({conversation_id:Y.current||void 0,search_criteria:x(t),search_results:j(r)},e,!1,r.map(e=>e.page_id),K.current.loadingOpenChat())}},[L.status,a,s,o,v]),(0,i.useEffect)(()=>{if("idle"===L.status||"no-results"===L.status||"blocked"===L.status||null===L.criteriaKey||!s||!a||er.current)return;let e=X.current;if(e.length<=L.lastSentPageCount||!z.current||!Z.current||P(t)!==L.criteriaKey)return;let r=e.length,n=L.lastSentPageCount;for(let e of O.current.values())e.pageCount>n&&(n=e.pageCount);if(n>=r)return;let i=n+1,l=e[n],c=l?.records??[];if(0===c.length){$({type:"CALL_STARTED"}),$({type:"CALL_COMPLETED",pageCount:i});return}let u=j(c.map(e=>k(e,o)));eg({conversation_id:Y.current||void 0,search_criteria:x(t),search_results:u},i,!0,c.map(e=>e.page.id))},[L.status,L.criteriaKey,s,a,n.length]),(0,i.useEffect)(()=>{var e,r;if(!v)return;if("no-results"===L.status)return void p(e=>e.some(e=>e.isNoResults)?e:[...e,{type:"ai",content:u,isNoResults:!0}]);if("blocked"===L.status||"loading"===L.status||!s||!a||er.current||!t||O.current.size>0)return;let n=(e=X.current,r=L.lastSentPageCount,e.length<=r?[]:e.slice(r).slice(-2).map(e=>(e?.records??[]).map(e=>k(e,o))).filter(e=>e.length>0));if(0===n.length)return;let i=Y.current;if(1===n.length){let e=!!i;eg({conversation_id:i||void 0,search_criteria:x(t),search_results:j(n[0])},X.current.length,e,n[0].map(e=>e.page_id),K.current.loadingOpenChat())}else if(i){let e={conversation_id:i,search_criteria:x(t),search_results:j(n[0])},r={conversation_id:i,search_criteria:x(t),search_results:j(n[1])};eg(e,X.current.length,!0,n[0].map(e=>e.page_id),K.current.loadingOpenChat()),eg(r,X.current.length,!0,n[1].map(e=>e.page_id),K.current.loadingOpenChat())}else ee.current={records:n[1],pageCount:X.current.length,searchCriteria:t},eg({conversation_id:void 0,search_criteria:x(t),search_results:j(n[0])},X.current.length,!1,n[0].map(e=>e.page_id),K.current.loadingOpenChat())},[v,L.status,L.criteriaKey,s,a,n.length]);let em=(0,i.useCallback)(async e=>{let t=e.trim().slice(0,300);if(!t||"blocked"===L.status)return;let r={type:"user",content:t};p(e=>[...e,r]),g(K.current.loadingNewSearch()),O.current.size>0&&ei(),B(null);let n=`user-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,a=new AbortController;O.current.set(n,{id:n,abortController:a,isMerge:!1,pageCount:0,pendingPageIds:[],startTime:Date.now()});let s=Date.now(),o=!1,i=!1,l=null;try{let e={conversation_id:Y.current??void 0,user_message:t,search_criteria:(e=>{if(e)return x(e)})(G.current)},r=await eh(e,e=>{l=e});if(a.signal.aborted)return;if(r)if("blocked"===r){o=!0,$({type:"USER_BLOCKED"});let e={type:"ai",content:d,isError:!0};p(t=>[...t,e])}else if("rate_limited"===r||"timeout"===r)B(c),i=!0;else try{ea(r)}catch(e){(0,f.f)("chatbot: response processing failed",{name:e?.name??"ChatBotResponseProcessingError",message:`[callId=${n} merge=false] ${e?.message??String(e)}`,stack:e?.stack,pathname:window.location.pathname}).catch(()=>{}),B(c),i=!0}else{let e=l;(0,f.f)("chatbot: user-message returned null",{name:"ChatBotSendNullResponse",message:`[callId=${n} durationMs=${Date.now()-s} msgLen=${t.length} ${w(e)}]`,pathname:window.location.pathname,url:e?.url}).catch(()=>{}),B(c),i=!0}}catch(e){if(a.signal.aborted)return;(0,f.f)("chatbot: user-message call failed",{name:e?.name??"ChatBotSendCallError",message:`[callId=${n} durationMs=${Date.now()-s} msgLen=${t.length}] ${e?.message??String(e)}`,stack:e?.stack,digest:e?.digest,pathname:window.location.pathname}).catch(()=>{}),B(c),i=!0}
1finally{O.current.delete(n),!a.signal.aborted&&(g(""),h.current?.focus(),o||(i?$({type:"CANCELLED",pageCount:X.current.length}):$({type:"RESUMED"})))}},[L.status]),e_=(0,i.useCallback)(()=>{ei(),$({type:"CANCELLED",pageCount:X.current.length})},[ei]),ep=(0,i.useCallback)(()=>{$({type:"RESUMED"})},[]);return{handleSend:em,cancelRequest:e_,resumePipeline:ep,pipeline:L,getConversationId:(0,i.useCallback)(()=>Y.current,[]),recordSuggestionSelected:(0,i.useCallback)((e,t)=>{J.current=e,q.current=t},[])}}({searchCriteria:C,pathname:v,allSearchData:B,searchFetchComplete:E,allHitsLoaded:R,allHitsData:D,errorText:L,errorSendText:$,noResultsText:T,blockedText:et,inputRef:ev,setCurrentLoadingText:eI,pickers:{loadingNewSearch:()=>{let e=[ea,es,eo,ei,el];return e[Math.floor(Math.random()*e.length)]},loadingShowMore:()=>{let e=[ec,eu,ed,eh];return e[Math.floor(Math.random()*e.length)]},loadingOpenChat:()=>eg},setMessages:eP,isOpen:ex,setIsOpen:ek,setSelectedSuggestion:eR,setErrorMessage:eS,resetSearchData:A,resetHits:I});if((0,i.useEffect)(()=>{ef(!0)},[]),(0,i.useEffect)(()=>{if(!eb||!g||0===ew.length)return;let e=requestAnimationFrame(()=>{ep.current&&(ep.current.scrollTop=eC.current)});return()=>cancelAnimationFrame(e)},[g,eb,ew.length]),(0,i.useEffect)(()=>{ep.current&&(ep.current.scrollTop=ep.current.scrollHeight)},[ew,eD]),(0,i.useEffect)(()=>{if(ev.current){ev.current.style.height="38px";let e=ev.current.scrollHeight;ev.current.style.height=Math.min(e,120)+"px"}},[em]),(0,i.useEffect)(()=>{if(!ex)return;let e=e=>{if("Escape"===e.key&&ek(!1),"Tab"===e.key){let t=ey.current?.querySelectorAll("button:not([disabled]), input:not([disabled]), textarea:not([disabled])");if(!t?.length)return;let r=t[0],n=t[t.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),n.focus()):e.shiftKey||document.activeElement!==n||(e.preventDefault(),r.focus())}};return document.addEventListener("keydown",e),ev.current?.focus(),()=>document.removeEventListener("keydown",e)},[ex]),(0,i.useEffect)(()=>{if(!eB)return;let e=e=>{if(!ey.current)return;let t=ey.current.getBoundingClientRect();eN({width:Math.max(320,Math.min(800,t.right-e.clientX)),height:Math.max(200,Math.min(window.innerHeight-100,t.bottom-e.clientY))})},t=e=>{if(!ey.current||!e.touches[0])return;let t=ey.current.getBoundingClientRect(),r=e.touches[0],n=Math.max(200,Math.min(window.innerHeight-50,t.bottom-r.clientY));eN(e=>({...e,height:n}))},r=()=>eE(!1);return document.addEventListener("mousemove",e),document.addEventListener("mouseup",r),document.addEventListener("touchmove",t),document.addEventListener("touchend",r),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),document.removeEventListener("touchmove",t),document.removeEventListener("touchend",r)}},[eB]),!eb||!g)return null;let eH=async e=>{let t=[ea,es,eo,ei,el];eI(t[Math.floor(Math.random()*t.length)]),e$(),eR(e.label),eP([...ew,{type:"user",content:e.label}]);let r=new URLSearchParams,n=e.search_parameters;n.keywords&&r.set("keyword",n.keywords),n.regions?.length&&r.set("region",n.regions.join(",")),n.city&&r.set("city",n.city),n.country&&r.set("country",n.country),n.county&&r.set("county",n.county),n.date_start&&r.set("date-start",n.date_start),n.date_end&&r.set("date-end",n.date_end),n.date&&r.set("date",n.date),n.tags&&r.set("tags",n.tags),n.product&&r.set("product",n.product.toString()),n.entity_types&&r.set("entity-types",n.entity_types),n.sort&&r.set("sort",n.sort),n.page_number&&r.set("page-number",n.page_number.toString());let a=`/search/results?${r.toString()}`,s=ew[ew.length-1],o=eO();if(o&&s?.receivedAt){let t=s.suggested_search_criteria?.findIndex(t=>t.label===e.label)??-1;if(t>=0){let r=s.receivedAt,n=Date.now();(0,l.c)({conversation_id:o,suggestion_selected:{suggestion_id:e.suggestion_id,index:t,criteria:e.search_parameters,time_to_select_ms:n-r}}),eV(n,e.suggestion_id)}}F(n.date??"",n.date_start??"",n.date_end??""),p.push(a)};return(0,n.jsxs)("div",{className:m().chatContainer,children:[!ex&&(0,n.jsxs)("button",{onClick:()=>{eS(null),ek(!0)},className:`${m().chatButton} position-relative`,type:"button","aria-label":V,"aria-expanded":"false","aria-haspopup":"dialog","aria-controls":"chatBox",
1id:"chatButtonCTA",children:[(0,n.jsx)(h.Icon,{name:"AiNewSmIcon"})," ",(0,n.jsxs)("span",{className:"d-none d-sm-inline",children:[z," ",K]}),(0,n.jsx)("span",{className:"position-absolute top-0 start-100 translate-middle badge rounded-pill bg-primary text-uppercase",children:"Beta"})]}),ex&&(0,n.jsxs)("div",{className:`${m().chatBox}`,ref:ey,id:"chatBox",role:"dialog","aria-label":U,style:{width:window.innerWidth>576?`${eM.width}px`:"100vw",height:eM.height>0?`${eM.height}px`:window.innerWidth>576?"50vh":"33vh"},children:[(0,n.jsx)("button",{className:m().mobileDragHandle,onTouchStart:e=>{e.preventDefault(),eE(!0)},"aria-label":W,tabIndex:-1,type:"button",children:(0,n.jsx)("div",{className:m().dragBar})}),(0,n.jsx)("button",{className:m().resizeHandle,type:"button",onTouchStart:e=>{e.preventDefault(),eE(!0)},onMouseDown:e=>{e.preventDefault(),eE(!0)},onKeyDown:e=>{if("ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();let t="ArrowUp"===e.key?1:-1;eN(e=>({...e,height:Math.max(200,Math.min(window.innerHeight-100,e.height+50*t))}))}else if("ArrowLeft"===e.key||"ArrowRight"===e.key){e.preventDefault();let t="ArrowRight"===e.key?1:-1;eN(e=>({...e,width:Math.max(320,Math.min(800,e.width+50*t))}))}},"aria-label":Y,tabIndex:0}),(0,n.jsxs)("div",{className:m().header,children:[(0,n.jsxs)("div",{className:m().headerTitle,children:[(0,n.jsx)(h.Icon,{name:"AiNewSmIcon"}),(0,n.jsx)("h3",{className:"text-nowrap",children:K})]}),(0,n.jsx)("button",{type:"button",onClick:()=>ek(!1),className:m().closeButton,"aria-label":J,children:(0,n.jsx)(h.Icon,{name:"CloseIcon",style:{fill:"var(--ui-mutedText)"}})})]}),ej&&(0,n.jsxs)("div",{className:m().errorBanner,role:"alert",children:[(0,n.jsx)(h.Icon,{name:"WarningCircleIcon",style:{fill:"var(--alert-danger)"}}),(0,n.jsx)("span",{children:ej}),(0,n.jsx)("button",{onClick:()=>eS(null),"aria-label":q,type:"button",children:(0,n.jsx)(h.Icon,{name:"CloseIcon",style:{fill:"var(--alert-danger)"}})})]}),(0,n.jsxs)("div",{ref:ep,className:m().messagesArea,role:"log","aria-live":"polite","aria-atomic":"false",onScroll:()=>{eC.current=ep.current?.scrollTop??0},children:[0!==ew.length||eD?ew.map((e,t)=>(0,n.jsxs)("div",{className:`${m().message} ${"user"===e.type?m().user:m().ai}`,children:[e.isError&&(0,n.jsx)(h.Icon,{name:"WarningCircleIcon",style:{fill:"var(--alert-danger)",marginRight:"8px"}}),e.content&&(0,n.jsx)("span",{children:(0,n.jsx)(N,{text:e.content,keywords:C?.keywords})}),e.suggested_search_criteria&&(0,n.jsx)("div",{className:m().suggestedCriteria,children:e.suggested_search_criteria.map((e,t)=>(0,n.jsxs)("button",{type:"button",className:`${m().criteriaButton} ${eA===e.label?m().selected:""}`,onClick:()=>eH(e),disabled:!!eD,children:[(0,n.jsx)(h.Icon,{name:"SearchIcon",className:"me-1"}),(0,n.jsx)("span",{children:(0,n.jsx)(N,{text:e.label,keywords:C?.keywords})})]},t))})]},t)):(0,n.jsx)("div",{className:m().welcomeMessage,children:O}),!!eD&&(0,n.jsxs)("div",{className:`${m().loadingMessage} d-flex align-items-center`,role:"status","aria-live":"polite","aria-label":G,children:[(0,n.jsxs)("div",{className:m().thinkingPaper,children:[(0,n.jsx)(h.Icon,{name:"NewspaperIcon",className:`${m().page} ${m().page1}`}),(0,n.jsx)(h.Icon,{name:"NewspaperIcon",className:`${m().page} ${m().page2}`}),(0,n.jsx)(h.Icon,{name:"NewspaperIcon",className:`${m().page} ${m().page3}`})]}),(0,n.jsx)("p",{className:"mb-0",children:eD})]})]}),(0,n.jsxs)("div",{className:m().inputArea,children:[(0,n.jsx)("p",{id:"charCounter",className:`flex-shrink-1 ms-auto mb-0 ${m().charCounter}`,"aria-live":"polite",children:em.length>0&&(0,n.jsxs)("span",{className:em.length>300?"text-danger":"text-muted",children:[em.length,"/",300,(0,n.jsx)("strong",{children:em.length>300&&` (${em.length-300} ${X})`})]})}),(0,n.jsxs)("div",{className:m().inputWrapper,children:[(0,n.jsx)("textarea",{placeholder:Q,value:em,onChange:e=>{let t=e.target.value.replace(/[^\p{L}\p{N}\s.,'"\-()?!:&]/gu,"");t.length<=500&&e_(t)},onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),!eD&&em.trim()&&em.length<=300&&(e_(""),eF(em).catch(()=>{})))},disabled:!!eD||"blocked"===eT.status,className:m().input,ref:ev,"aria-label":Z,"aria-describedby":"
1charCounter",rows:1}),(0,n.jsx)("button",{onClick:()=>{eD?eL():em.trim()&&em.length<=300&&(e_(""),eF(em).catch(()=>{}))},disabled:"blocked"===eT.status||!eD&&(!em.trim()||em.length>300),className:`${m().askButton} ${"blocked"===eT.status||!eD&&(!em.trim()||em.length>300)?m().disabled:m().enabled}`,type:"button","aria-label":eD?en:ee,children:eD?er:z})]}),(0,n.jsxs)("p",{className:m().aiNote,children:[(0,n.jsx)(h.Icon,{name:"AiSimpleIcon"}),H," ",(0,n.jsx)("span",{className:"badge rounded-pill text-muted border border-primary text-uppercase",children:"Beta"})]})]})]})]})}function E(e){let{enableChatbot:t}=e,r=(0,a.Jd3)(),{isVisible:o}=(0,s.z)();return t&&r?.isExtraSubscriber?(0,n.jsx)(B,{visible:o}):null}},98814:(e,t,r)=>{"use strict";r.d(t,{ChatBotDataProvider:()=>i,_:()=>o});var n=r(54568),a=r(7620);let s=(0,a.createContext)({allSearchData:[],searchFetchComplete:!1,setSearchResults:()=>{},resetSearchData:()=>{},allHitsData:{},allHitsLoaded:!1,registerHitsCall:()=>{},updateHitsData:()=>{},resetHits:()=>{}});function o(){return(0,a.useContext)(s)}function i(e){let{children:t}=e,[r,o]=(0,a.useState)([]),[i,l]=(0,a.useState)(!1),[c,u]=(0,a.useState)(new Set),[d,h]=(0,a.useState)({}),[g,m]=(0,a.useState)(!1),_=(0,a.useRef)(null);(0,a.useEffect)(()=>(_.current=setTimeout(()=>{0!==c.size||0!==Object.keys(d).length||g||m(!0)},3e3),()=>{_.current&&clearTimeout(_.current)}),[]);let p=(0,a.useCallback)(e=>{o(e||[]),void 0!==e&&l(!0)},[]),b=(0,a.useCallback)(()=>{o([]),l(!1)},[]),f=(0,a.useCallback)(e=>{let t=e.join(",");_.current&&clearTimeout(_.current),u(e=>new Set(e).add(t))},[]),v=(0,a.useCallback)(e=>{if(!Array.isArray(e))return;let t=e.reduce((e,t)=>{let r=t.imageId?.toString()??"";return e.length>0?`${e},${r}`:r},""),r=e.reduce((e,t)=>(e[t.imageId.toString()]=t,e),{});h(e=>({...e,...r})),u(e=>{let r=new Set(e);return r.delete(t),r})},[]),y=(0,a.useCallback)(()=>{_.current&&clearTimeout(_.current),u(new Set),h({}),m(!1),_.current=setTimeout(()=>{m(!0)},3e3)},[]),C=0===c.size&&(Object.keys(d).length>0||g);return(0,n.jsx)(s.Provider,{value:{allSearchData:r,searchFetchComplete:i,setSearchResults:p,resetSearchData:b,allHitsData:d,allHitsLoaded:C,registerHitsCall:f,updateHitsData:v,resetHits:y},children:t})}}},e=>{e.O(0,[1368,5263,3896,4879,5264,9249,5355,8162,6888,8098,7633,6439,9247,587,1968,7358],()=>e(e.s=21604)),_N_E=e.O()}]);
2//# sourceMappingURL=layout-0e890d04cd0b7e7d.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.