PageSourceSearch

https://carregados.com.br/assets/autocomplete-0ZpAUO8t.js

js carregados.com.br collected 2026-10-05 19:02:54 UTC 15,918 bytes, 3 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:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="49e0b1d3-4f56-4a89-8d39-7f088273d799",e._sentryDebugIdIdentifier="sentry-dbid-49e0b1d3-4f56-4a89-8d39-7f088273d799")}catch(e){}}();
2(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`f777207a0f961c32cbc69820b15e81ea9e6e6038`}}catch{}})();import{G as e,J as t}from"./utils-91Vp9uMe.js";import{t as n}from"./jsx-runtime-NE9WiRe8.js";import{t as r}from"./createLucideIcon-CauViC-O.js";import{t as i}from"./check-Y7JtDroC.js";import{t as ee}from"./loader-circle-BO8ByLZk.js";import{t as te}from"./map-pin-BhMC1MhY.js";import{t as ne}from"./navigation-CcXdxGX6.js";import{t as re}from"./x-B5oc75nH.js";import{t as ie}from"./zap-BDpdf81C.js";import{t as a}from"./dist-BAcKUk5u.js";var o={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};o.node;var ae=r(o),s=t(e(),1),c=n();function oe(e){let t=(0,s.useRef)(void 0);return(0,s.useEffect)(()=>{t.current=e},[e]),t.current}var l=e=>typeof e==`string`?e.trim():``,se=e=>e?l(e.label)||l(e.displayName)||l(e.value):``,u={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},d=e=>e.replace(/[&<>"']/g,e=>u[e]??e),ce=(e,t)=>{if(!t)return d(e);let n=e.toLowerCase().indexOf(t.toLowerCase());if(n===-1)return d(e);let r=n+t.length;return`${d(e.slice(0,n))}<strong class="font-semibold text-primary">${d(e.slice(n,r))}</strong>${d(e.slice(r))}`},f=e=>e?(e.kind===`station`?l(e.displayName):``)||se(e):``,le=e=>{let t=l(e.value);return e.kind===`station`?t.replace(/^(?:id\s*|eletroposto\s*#)\d+\s*(?:[·•-]\s*)?/i,``).trim():t},ue=e=>{if(e.kind!==`station`)return null;if(Number.isInteger(e.stationId)&&e.stationId>0)return`ID ${e.stationId}`;let t=e.placeId.match(/^station:(\d+)$/);return t?.[1]?`ID ${t[1]}`:null},de=1200,fe=150,p=({id:e,options:t,placeholder:n,emptyMessage:r,className:o,value:l,onValueChange:u,disabled:p,isLoading:m=!1,query:h,setQuery:pe,clearable:g=!0,required:_=!1,errorMessage:me,noOptionsMessage:he=`Nenhum resultado encontrado.`,maxSuggestions:v=5,minQueryLength:y,allowNumericQueryBelowMinLength:ge=!1,shortQueryMessage:b,usingCachedResults:_e=!1,disableLoading:ve=!1,invalid:ye=!1,aria:x})=>{let S=(0,s.useRef)(null),be=(0,s.useRef)(null),[xe,C]=(0,s.useState)(()=>!1),[w,T]=(0,s.useState)(()=>l),[E,D]=(0,s.useState)(-1),[O,Se]=(0,s.useState)(`keyboard`),k=(0,s.useRef)(`keyboard`),Ce=(0,s.useRef)(!0),[A,j]=(0,s.useState)(()=>h||``),we=(0,s.useDeferredValue)(A),M=(0,s.useRef)(null),N=(0,s.useRef)(null),[Te,Ee]=(0,s.useTransition)(),De=(0,s.useRef)(A),P=(0,s.useRef)(null),Oe=(0,s.useRef)({query:A,selectedPlaceId:l?.placeId}),[F,ke]=(0,s.useState)(!1),I=(0,s.useCallback)(()=>{S.current&&requestAnimationFrame(()=>{S.current?.blur()})},[]),L=(0,s.useCallback)(()=>{P.current!==null&&(window.clearTimeout(P.current),P.current=null),ke(!1)},[]),R=(0,s.useCallback)(()=>{Oe.current={query:A,selectedPlaceId:w?.placeId},P.current!==null&&window.clearTimeout(P.current),ke(!0),P.current=window.setTimeout(()=>{P.current=null,ke(!1)},fe)},[A,w?.placeId]),z=(0,s.useCallback)(()=>{M.current=null,N.current!==null&&(cancelAnimationFrame(N.current),N.current=null)},[]),Ae=(0,s.useCallback)(e=>{M.current=e,N.current===null&&(N.current=requestAnimationFrame(()=>{N.current=null;let e=M.current;M.current=null,e!==null&&Ee(()=>{pe(e)})}))},[pe,Ee]),je=(0,s.useCallback)(()=>{k.current!==`keyboard`&&(k.current=`keyboard`,Se(`keyboard`))},[]),Me=(0,s.useCallback)(()=>{k.current!==`pointer`&&(k.current=`pointer`,Se(`pointer`),D(e=>e===-1?e:-1))},[]),B=A.trim(),Ne=/^\d+$/.test(B),V=B.length>=(y||3)||ge&&Ne,Pe=typeof y==`number`&&y>0&&B.length>
20&&!V,Fe=!!(b&&Pe),[Ie,Le]=(0,s.useState)(()=>!1),[Re,ze]=(0,s.useState)(()=>!1),[H,Be]=(0,s.useState)(()=>!1),U=(0,s.useRef)(H),[Ve,He]=(0,s.useState)(()=>!1),Ue=(0,s.useRef)(!1),W=(0,s.useCallback)(e=>{U.current=e,Be(e)},[]),G=(0,s.useRef)(!1),[We,K]=(0,s.useState)(()=>!1),q=(0,s.useRef)(void 0),J=(0,s.useId)(),Ge=(0,s.useMemo)(()=>`autocomplete-listbox-${J}`,[J]),Ke=(0,s.useMemo)(()=>e??`autocomplete-input-${J}`,[e,J]),qe=(0,s.useMemo)(()=>`autocomplete-description-${J}`,[J]),Je=(0,s.useMemo)(()=>`autocomplete-error-${J}`,[J]),Ye=(0,s.useMemo)(()=>`autocomplete-status-${J}`,[J]),Y=(0,s.useRef)(null),X=(0,s.useCallback)(e=>`autocomplete-option-${J}-${e}`,[J]),Z=(0,s.useMemo)(()=>t.slice(0,v),[t,v]),Xe=t.length>v,Q=m||Te||We,Ze=Ve&&!Fe&&(Q&&A.length>0||H&&Z.length===0&&A.length>0),$=xe||H&&Ve,Qe=(0,s.useCallback)(()=>U.current&&Ue.current||Ze||Q,[Ze,Q]),$e=(0,s.useCallback)((e=!1)=>{(e||!Qe())&&C(!1)},[Qe]);(0,s.useEffect)(()=>{if(A.trim().length===0){if(G.current)return;U.current&&W(!1)}},[A,W]);let et=oe(h),tt=oe(l);(0,s.useEffect)(()=>{_e&&(0,s.startTransition)(()=>{K(!1)})},[_e]),(0,s.useEffect)(()=>{(m||t.length>0)&&(K(!1),q.current&&clearTimeout(q.current))},[m,t.length]),(0,s.useEffect)(()=>{$||F||(D(-1),k.current!==`keyboard`&&(k.current=`keyboard`,Se(`keyboard`)))},[$,F]),(0,s.useEffect)(()=>{D(-1)},[t.length]),(0,s.useEffect)(()=>{$&&Z.length!==0&&D(e=>e===-1?0:e>=Z.length?Z.length-1:e)},[$,Z.length]),(0,s.useEffect)(()=>{t.length>0&&K(!1)},[t.length]);let nt=(0,s.useMemo)(()=>{let e=F?Oe.current.query:we;return Z.map(t=>{let n=se(t),r=le(t);return{labelHtml:ce(n,e),valueHtml:ce(r,e),valueText:r}})},[Z,we,F]),rt=(0,s.useCallback)(e=>typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,`\\$&`),[]);(0,s.useEffect)(()=>{if(!$||E<0||O!==`keyboard`)return;let e=Z[E];if(!e?.placeId)return;let t=requestAnimationFrame(()=>{let t=be.current;if(!t)return;let n=X(e.placeId);t.querySelector(`#${rt(n)}`)?.scrollIntoView({block:`nearest`})});return()=>cancelAnimationFrame(t)},[Z,$,rt,X,O,E]),(0,s.useEffect)(()=>()=>{q.current&&clearTimeout(q.current),z(),L()},[z,L]),(0,s.useEffect)(()=>{De.current=A},[A]),(0,s.useEffect)(()=>{if(Ce.current&&h&&h.length>0){let e=A.length===0,t=!Re&&!Ie&&!G.current;e&&t&&(j(h),De.current=h),Ce.current=!1}},[h,Re,Ie,A]),(0,s.useEffect)(()=>{if(h===et)return;let e=De.current,t=!!S.current?.matches(`:focus`),n=G.current||t,r=typeof h==`string`?h:h===null?``:void 0,i=typeof r==`string`?r:``,ee=typeof r==`string`&&e.length>=i.length&&e.toLowerCase().startsWith(i.toLowerCase())&&e!==i;n&&ee||(typeof r==`string`&&r!==A&&!G.current&&j(r),(r===``||r===void 0)&&!G.current&&j(``))},[h,et,A]),(0,s.useEffect)(()=>{if(T(l),!l){G.current||j(``);return}(tt?.placeId!==l.placeId||f(tt)!==f(l)||!G.current)&&j(f(l))},[l,tt]);let it=(0,s.useCallback)(()=>{L(),z(),j(``),C(!1),W(!1),G.current=!1,q.current&&clearTimeout(q.current),u?.(void 0),(0,s.startTransition)(()=>{T(void 0),K(!1),pe(``)}),requestAnimationFrame(()=>{S.current&&S.current.focus()})},[u,pe,W,z,L]),at=(0,s.useCallback)(e=>{let t=S.current;if(t){if(e.key===`Enter`&&t.value!==``&&$){e.preventDefault();let t=E>=0&&E<Z.length?Z[E]:Z.length>0?Z[0]:void 0;t&&(R(),z(),j(f(t)),C(!1),W(!1),u?.(t),(0,s.startTransition)(()=>{T(t),K(!1)}),G.current=!1,I())}if(e.key===`ArrowDown`&&(e.preventDefault(),je(),!$&&A?(C(!0),D(0)):$&&Z.length>0&&D(e=>e<Z.length-1?e+1:0)),e.key===`ArrowUp`&&(e.preventDefault(),je(),$&&Z.length>0&&D(e=>e>0?e-1:Z.length-1)),e.key===`Tab`){C(!1),W(!1),D(-1);return}e.key===`Escape`&&(C(!1),W(!1),D(-1),!$&&g&&!_&&A?it():requestAnimationFrame(()=>{t.blur()})),e.key===`Backspace`&&t.value===``&&w&&g&&!_&&(it(),D(-1))}},[Z,E,u,$,w,g,_,A,it,I,W,z,je,R]),ot=(0,s.useMemo)(()=>{if(!$||O!==`keyboard`||E<0)return;let e=Z[E];if(e?.placeId)return X(e.placeId)},[Z,$,X,O,E]),st=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),ct=(0,s.useCallback)(e=>{Me()},[Me]),lt=(0,s.useCallback)(e=>{R(),z(),C(!1),W(!1),j(f(e)),G.current=!1,I(),u?.(e),(0,s.startTransition)(()=>{T(e),K(!1),ze(!0)})},[u,I,W,z,R]),ut=(0,s.useCallback)(e=>{L(),w&&e!==(w?.label??``)&&(u?.(void 0),(0,s.startTransition)(()=>{T(void 0)})),G.current=!0,j(e),C(!0),K(!0),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{K(!1)},de);let t=e.trim(),n=t.length>0;if(n&&!U.current&&W(!0),n||W(!1),t.length>0&&t.length<(y||3)&&!(ge&&/^\d+$/.test(t))){Ae(e);return}Ae(e)},[w,u,y,ge,W,Ae,L]),dt=(0,s.useCallback)(()=>{(0,s.startTransition)(()=>{Le(!0)}),L(),Ue.current=!0,He(!0),A.trim().length>0&&(U.current||!w||Z.length>0)&&C(!0)},[A,w,Z.length,L]),ft=(0,s.useCallback)(()=>{Y.current&&cancelAnimationFrame(Y.current),Y.current=requestAnimationFrame(()=>{S.current?.matches(`:focus`)||(Ue.current=!1,He(!1),(0,s.startTransition)(()=>{ze(!0)}),G.current=!1,$e(!0),A&&!w&&_&&l&&(0,s.startTransition)(()=>{j(f(l)),T(l)}
2))})},[A,w,l,_,$e]);(0,s.useEffect)(()=>()=>{Y.current&&cancelAnimationFrame(Y.current)},[]);let pt=!!(me&&(ye||!Ve&&Ie&&Re&&_&&!w)),mt=F?Oe.current.selectedPlaceId:w?.placeId,ht=(0,s.useMemo)(()=>Z.map((e,t)=>{let n=mt===e.placeId,r=O===`keyboard`&&t===E,ee=X(e.placeId),ne=e.kind===`station`,re=e.kind===`coordinates`,o=ne?ie:re?ae:te,s=ue(e),oe=nt[t]?.valueText??le(e);return(0,c.jsx)(`div`,{id:ee,"data-slot":`command-item`,"cmdk-item":``,onPointerDown:st,onMouseDown:st,onPointerEnter:ct,onClick:()=>lt(e),className:`relative flex cursor-default items-center gap-2 rounded-sm px-0 py-0 text-sm outline-hidden select-none aria-selected:bg-transparent data-[selected=true]:bg-transparent data-[selected=true]:text-foreground`,"aria-selected":r,"data-selected":n,role:`option`,children:(0,c.jsxs)(`div`,{className:a(`group/autocomplete-option my-0.5 flex min-h-14 w-full items-start gap-3 rounded-lg bg-background px-3 py-2.5 transition-colors duration-150 ease-out`,n?`bg-blue-50 ring-1 ring-blue-100 dark:bg-blue-950/40 dark:ring-blue-800/60`:r?`bg-accent`:`hover:bg-accent`),children:[(0,c.jsx)(`div`,{className:a(`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors duration-150 ease-out group-hover/autocomplete-option:bg-background`,ne?`bg-blue-100 text-blue-700 dark:bg-blue-950/40 dark:text-blue-300`:`bg-muted text-muted-foreground`,r&&`bg-background`),children:(0,c.jsx)(o,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,c.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(`span`,{"data-slot":`autocomplete-option-label`,className:`min-w-0 flex-1 truncate font-medium`,dangerouslySetInnerHTML:{__html:nt[t]?.labelHtml??d(se(e))}}),s&&(0,c.jsx)(`span`,{className:`shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:s}),n&&(0,c.jsx)(i,{className:`h-4 w-4 shrink-0 text-blue-700 dark:text-blue-300`,"aria-hidden":`true`})]}),oe&&(0,c.jsx)(`span`,{"data-slot":`autocomplete-option-secondary`,className:`mt-0.5 block max-w-full truncate text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:nt[t]?.valueHtml??d(oe)}})]})]})},e.placeId)}),[Z,mt,E,O,lt,ct,st,nt,X]),gt=w?w.kind===`station`?{Icon:ie,className:`text-blue-600 dark:text-blue-400`}:w.kind===`current-location`?{Icon:ne,className:`text-blue-600 dark:text-blue-400`}:w.kind===`coordinates`?{Icon:ae,className:`text-muted-foreground`}:{Icon:te,className:`text-muted-foreground`}:null,_t=gt?.Icon,vt=Fe?b:`${r||he}${B?`: "${A}"`:``}`,yt=(m||Q)&&!ve,bt=!!(g&&A&&!p);return(0,c.jsxs)(`div`,{className:a(`relative w-full min-w-0`,o),children:[(0,c.jsxs)(`div`,{"data-slot":`command`,"cmdk-root":``,onKeyDown:at,className:`relative w-full min-w-0`,children:[(0,c.jsxs)(`div`,{"data-slot":`autocomplete-input`,className:a(`relative flex w-full min-w-0 items-center border-b [&_[data-slot=command-input-wrapper]]:w-full [&_[data-slot=command-input-wrapper]]:border-b-0 [&_[data-slot=command-input-wrapper]]:px-0 [&_[data-slot=command-input-wrapper]>svg]:hidden`,pt?`border-red-500`:`border-input`),children:[_t&&(0,c.jsx)(_t,{className:a(`pointer-events-none absolute left-0 h-4 w-4`,gt.className),"aria-hidden":`true`}),(0,c.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 w-full items-center gap-2 border-b px-3`,children:(0,c.jsx)(`input`,{ref:S,id:Ke,"data-slot":`command-input`,type:`text`,value:A,onChange:e=>ut(e.target.value),onBlur:ft,onFocus:dt,placeholder:n,disabled:p,className:a(`flex h-10 w-full min-w-0 flex-1 rounded-none border-0 bg-transparent py-3 text-sm ring-0 outline-hidden transition-all duration-150 placeholder:text-muted-foreground focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,yt&&bt?`pr-16`:yt||bt?`pr-9`:`pr-1`,gt?`pl-7`:``,p?`cursor-not-allowed opacity-60`:``),"aria-expanded":$,"aria-haspopup":`listbox`,"aria-autocomplete":`list`,"aria-controls":$?Ge:void 0,"aria-activedescendant":ot,"aria-invalid":pt?`true`:`false`,"aria-required":_?`true`:void 0,"aria-busy":Q?`true`:`false`,"aria-label":x?.label,"aria-describedby":a(x?.description?qe:void 0,Ye,pt?Je:void 0),role:`combobox`,spellCheck:`false`,autoComplete:`off`})}),yt&&(0,c.jsx)(`div`,{className:`absolute right-10 flex items-center justify-center`,children:(0,c.jsx)(ee,{className:`h-4 w-4 animate-spin text-muted-foreground
2/50`,"aria-hidden":`true`})}),bt&&(0,c.jsx)(`button`,{type:`button`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{e.preventDefault(),e.stopPropagation(),it()},className:`absolute right-2 flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground hover:bg-muted-foreground/20 focus:ring-2 focus:ring-primary focus:outline-none`,"aria-label":`Limpar campo`,children:(0,c.jsx)(re,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,c.jsx)(`div`,{className:`relative mt-1 w-full min-w-0`,children:(0,c.jsx)(`div`,{"data-slot":`autocomplete-results`,translate:`no`,"aria-hidden":!$,className:a(`notranslate absolute top-0 z-50 w-full min-w-0 overflow-hidden rounded-xl bg-background shadow-md outline-none`,`transition-opacity duration-150 ease-out`,$?`pointer-events-auto opacity-100`:`pointer-events-none opacity-0`),children:(0,c.jsx)(`div`,{id:Ge,ref:be,"data-slot":`command-list`,"cmdk-list":``,role:`listbox`,"aria-label":x?.label,className:`max-h-[300px] w-full min-w-0 scroll-py-1 overflow-x-hidden overflow-y-auto rounded-lg bg-background shadow-lg ring-1 ring-border`,children:(0,c.jsxs)(`div`,{"cmdk-list-sizer":``,children:[Z.length>0&&(0,c.jsxs)(`div`,{"data-slot":`command-group`,"cmdk-group":``,role:`group`,className:(m||Q)&&!ve?`overflow-hidden p-1 text-foreground opacity-50 transition-opacity`:`overflow-hidden p-1 text-foreground`,children:[ht,Xe&&(0,c.jsxs)(`div`,{className:`border-t px-2 py-1.5 text-xs text-muted-foreground`,children:[`+ `,t.length-v,` mais opções disponíveis. Continue digitando para refinar resultados.`]})]}),H&&!m&&!Q&&Z.length===0&&V&&(0,c.jsxs)(`div`,{className:`rounded-sm px-2 py-3 text-center text-sm select-none`,children:[vt,(0,c.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:`Verifique a ortografia ou tente termos diferentes.`})]}),B.length>0&&!V&&(0,c.jsx)(`div`,{className:`p-4 text-center text-sm text-muted-foreground`,children:b||`Digite pelo menos ${y||3} letras...`})]})})})})]}),x?.description&&(0,c.jsx)(`span`,{id:qe,className:`sr-only`,children:x.description}),(0,c.jsx)(`span`,{id:Ye,className:`sr-only`,"aria-live":`polite`,children:Fe?b:Q&&B.length>0?`Buscando sugestões.`:$&&Z.length>0?`${Z.length} sugest${Z.length===1?`ão disponível`:`ões disponíveis`}.`:H&&V&&Z.length===0&&!Q?he:``}),pt&&(0,c.jsx)(`div`,{id:Je,className:`mt-1 min-h-4 text-xs text-foreground-destructive`,children:me})]})};export{p as t};
3//# debugId=49e0b1d3-4f56-4a89-8d39-7f088273d799

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.