import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t}from"./vendor-html-parser-DOJ8foyv.js";import{n,t as r}from"./vendor-react-BREUBCH4.js";import{g as i,m as a}from"./vendor-react-router-C-6Wf3r1.js";import{$t as o,Et as s,Lt as c,P as l,q as u}from"./errorBoundary-Dd5IQF9g.js";import{t as d}from"./src-CNseDMio.js";import{t as f}from"./src-ncxLImPM.js";var p=e(t()),m=r(),h=n(),g=(0,c.cn)(`ChangeLocationBar`),_=e=>{let t=(0,m.c)(15),{variant:n,classNames:r,classNameButton:i,onSubmit:a,submitText:s,children:c,oneInformaEnabled:l}=e,u;t[0]!==r?.wrapper||t[1]!==n?(u=g({variant:o(n)},[r?.wrapper]),t[0]=r?.wrapper,t[1]=n,t[2]=u):u=t[2];let p;t[3]===a?p=t[4]:(p=e=>{e.preventDefault(),a?.()},t[3]=a,t[4]=p);let _;t[5]!==i||t[6]!==r?.searchBtn||t[7]!==l||t[8]!==s?(_=l?(0,h.jsx)(d,{className:g(`Button`,[r?.searchBtn,i,`Button`]),size:`medium`,variant:`primary-filled`,"arial-label":`ChangeLocation`,type:`submit`,children:s}):(0,h.jsx)(`button`,{className:g(`SearchButton`,[r?.searchBtn,i,`Button`]),type:`submit`,"aria-label":`ChangeLocation`,"data-component":`button`,children:s}),t[5]=i,t[6]=r?.searchBtn,t[7]=l,t[8]=s,t[9]=_):_=t[9];let v;return t[10]!==c||t[11]!==u||t[12]!==p||t[13]!==_?(v=(0,h.jsxs)(f,{className:u,"data-component":`search-bar`,method:`get`,onSubmit:p,children:[c,_]}),t[10]=c,t[11]=u,t[12]=p,t[13]=_,t[14]=v):v=t[14],v},v={title:`Zip code must be number`,type:`text`,minLength:3,required:!0,"data-testid":`input-field`},y=e=>{let t=(0,m.c)(28),{weatherZipcode:n}=u.useAuth(),{widgets:r}=u.useLayout(),a=i(),o=(0,p.useRef)(null),[c,d]=(0,p.useState)(``),{oneInformaEnabled:f}=u.useFeatureToggles(),y;t[0]!==n||t[1]!==r.invalidWeatherZipcode?(y=()=>{d(r.invalidWeatherZipcode||n),o.current?.focus()},t[0]=n,t[1]=r.invalidWeatherZipcode,t[2]=y):y=t[2];let b;t[3]===n?b=t[4]:(b=[n],t[3]=n,t[4]=b),(0,p.useEffect)(y,b);let x;t[5]!==a||t[6]!==e||t[7]!==c?(x=()=>{e.handleChangeLocation?.(),s()?.zipCode?a(`/weather?zipCode=${c}`):(l.updateWidgets({invalidWeatherZipcode:void 0}),l.changeZipcode({weatherZipcode:c}))},t[5]=a,t[6]=e,t[7]=c,t[8]=x):x=t[8];let S=x,C=e.classNames?.container,w=e.classNames?.input,T;t[9]===w?T=t[10]:(T=g(`Input`,[w]),t[9]=w,t[10]=T);let E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>d(e.target.value),t[11]=E):E=t[11];let D;t[12]!==e.placeholderText||t[13]!==T||t[14]!==c?(D=(0,h.jsx)(`input`,{ref:o,className:T,placeholder:e.placeholderText,"aria-label":e.placeholderText,onChange:E,value:c,pattern:`^\\d+$`,...v}),t[12]=e.placeholderText,t[13]=T,t[14]=c,t[15]=D):D=t[15];let O;t[16]!==S||t[17]!==f||t[18]!==e||t[19]!==D?(O=(0,h.jsx)(_,{...e,onSubmit:S,oneInformaEnabled:f,children:D}),t[16]=S,t[17]=f,t[18]=e,t[19]=D,t[20]=O):O=t[20];let k;t[21]!==c||t[22]!==r.invalidWeatherZipcode?(k=c&&r.invalidWeatherZipcode===c?(0,h.jsx)(`span`,{className:g(`Error`),children:`Invalid zip code`}):null,t[21]=c,t[22]=r.invalidWeatherZipcode,t[23]=k):k=t[23];let A;return t[24]!==C||t[25]!==O||t[26]!==k?(A=(0,h.jsxs)(`div`,{"data-testid":`change-location-bar`,className:C,children:[O,k]}),t[24]=C,t[25]=O,t[26]=k,t[27]=A):A=t[27],A},b=e=>{let t=(0,m.c)(19),{cgbZipcode:n}=u.useAuth(),r=i(),o=(0,p.useRef)(null),[c,d]=(0,p.useState)(``),f=a(),y,b;t[0]===n?(y=t[1],b=t[2]):(y=()=>{d(n)},b=[n],t[0]=n,t[1]=y,t[2]=b),(0,p.useEffect)(y,b);let x;t[3]!==f.pathname||t[4]!==r||t[5]!==e||t[6]!==c?(x=()=>{e.handleChangeLocation?.();let t=!f.pathname.includes(`/commodities/cash-grain-bids`);s()?.zipCode||t?r(`/commodities/cash-grain-bids?zipCode=${c}`):l.changeZipcode({cgbZipcode:c})},t[3]=f.pathname,t[4]=r,t[5]=e,t[6]=c,t[7]=x):x=t[7];let S=x,C=e.classNames?.input,w;t[8]===C?w=t[9]:(w=g(`Input`,[C]),t[8]=C,t[9]=w);let T;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>d(e.target.value),t[10]=T):T=t[10];let E;t[11]!==e.placeholderText||t[12]!==w||t[13]!==c?(E=(0,h.jsx)(`input`,{ref:o,className:w,placeholder:e.placeholderText,"aria-label":e.placeholderText,onChange:T,value:c,pattern:`^\\d+$`,...v}),t[11]=e.placeholderText,t[12]=w,t[13]=c,t[14]=E):E=t[14];let D;return t[15]!==S||t[16]!==e||t[17]!==E?(D=(0,h.jsx)(_,{...e,onSubmit:S,children:E}),t[15]=S,t[16]=e,t[17]=E,t[18]=D):D=t[18],D};export{y as n,b as t}; //# sourceMappingURL=src-TrwGNFtC2.js.map

AltStyle によって変換されたページ (->オリジナル) /