1import{r as l,j as e}from"./react-vendor-AbT4BmHZ.js";import{M as Is}from"./ManageBoardContainer.component-Bpc8rUMF.js";import{N as ks}from"./Board.page-DzDqH2MC.js";import{u as ie,k as y}from"./redux-vendor-D6tsYLgP.js";import{S as Ue}from"./skeleton-C7mniHiI.js";import{b as L,lJ as k,mr as As,M as Ne,ms as rs,mt as ls,mu as as,mv as Ts,mw as cs,mx as Ls,my as Es,mz as Fs,c5 as Us,gE as Ps,mA as Ke,mB as Ms,i as He}from"./index-Zz13HMKG.js";import{B as F,t as te,D as ke,f as Ae,g as Te,h as je,i as Ie,o as Rs,c as Bs}from"./App-tN5SdoE9.js";import{S as Re,C as H,c as _s,d as qs,e as Hs,b as zs}from"./checkbox-DqKGSW3s.js";import{T as Be,a as _e,b as ce,c as oe}from"./tabs-DWzXtYrR.js";import{C as Gs,a as Os,b as Vs,c as $s,d as Ws}from"./carousel-DzQN9drj.js";import{I as ne}from"./FlatInput-Ct8mcwLD.js";import{L as Z,S as os}from"./label-CvFzyiNL.js";import{T as Qs}from"./textarea-DC8bG-u4.js";import{L as Le,E as ds,p as Zs,Z as Ys,K as ze,M as Ge,bq as Ks,a as Js,br as Xs,b8 as Je,X as Ds,C as Ce,bs as et,bt as st,w as tt,J as nt,bu as us,bv as it,k as rt,h as lt,bj as at,P as ct,bm as ot}from"./lucide-D97_elQA.js";import{A as xs,b as ms,c as hs,d as ps,e as gs,f as fs,g as bs,h as js}from"./alert-dialog-BOu9qSwU.js";import{M as dt}from"./multi-select-BUHBF9rC.js";import{R as ut,a as xt}from"./radio-group-CH2jSpbF.js";import{S as de,a as ue,b as xe,c as me,e as he,d as _}from"./select-C0e-Scuu.js";import{S as mt}from"./switch-CSu9sZ7l.js";import{A as pe,a as ge}from"./alert-BQN2fR0z.js";import{d as q}from"./index-obPoDw8p.js";import{S as ve}from"./spinner-CyVnZ5VX.js";import{M as ht,T as pt,C as gt,a as ft,u as bt,L as vs,b as jt}from"./maps-Bn23KU-K.js";import{M as vt,a as Nt}from"./mapTiles-BErEY_xI.js";import{T as yt,a as wt,b as St,c as Ct}from"./tooltip-dxBtPCpt.js";import{F as It}from"./FeatureGating-gbeWPvKN.js";import"./BackToBoardButton-CG6vqJu0.js";import"./LinkNav.component-DCvMKrhb.js";import"./helmet-7sOH0HJN.js";import"./tours-DNlFWm7f.js";import"./ui-vendor-CEz_DxgW.js";import"./index-BhcuvC37.js";import"./HootDisplay.page-CFWvHWIH.js";import"./index-B3B6QNqD.js";import"./Map-Jfy_Soal.js";import"./immer-CgiGShya.js";import"./charts-BxwOLyBT.js";import"./select-D_QHZO8r.js";import"./editor-PO597bpM.js";import"./colorpicker-MRQ2Ga09.js";import"./datepicker-DwchCrV0.js";import"./date-utils-TpC3Vao7.js";import"./share-B2rj7Cgs.js";import"./index-CfDcEeyL.js";import"./Divider.component-BXdg1w45.js";import"./FlatSelector-DU6sY-xl.js";import"./Pin-C0-2Sw8F.js";import"./mentions-C7wXW33F.js";import"./google-maps-Cfky1JHI.js";import"./gallery-b_cIbNoD.js";import"./react-icons-aT43gldt.js";import"./logo-small-D4k6WZmi.js";import"./EngagementPayWall-Dfwt7Xke.js";import"./inboxBus-CSdnFHjc.js";import"./index-BD1Nqb0_.js";import"./login.index-Rg0cmUm9.js";import"./EyeOpen-CZkGInyj.js";import"./PasswordStrengthChecker-B89x3qfc.js";import"./avatar-Bhcoz7W5.js";import"./CaretDown-B85b6PDi.js";import"./CreateBoard.page-DNE7rayO.js";import"./index-CxXIpaRR.js";import"./useAutoCreateHoot-cTfeZkLw.js";import"./filestack-CLcfot1_.js";import"./phone-input-CsdZPsc5.js";import"./index-CiDmXwfP.js";import"./analytics-D9fFn5Ey.js";import"./socket-CDWkPsom.js";import"./carousel-CfXhsGjX.js";import"./Menu-CPadOmnB.js";const kt=({integrationName:s,onSubmit:t})=>{const[i,r]=l.useState({email:"",requirements:""}),[n,c]=l.useState(!1),a=async d=>{if(d.preventDefault(),!(!i.email||!i.requirements)){c(!0);try{await(t==null?void 0:t({...i,integrationName:s})),r({email:"",requirements:""})}catch(o){console.error("failed to submit custom integration request",o)}finally{c(!1)}}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold text-neutral-900",children:["Get Started with ",s," Integration"," "]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Tell us about your requirements and we'll get back to you soon."})]}),e.jsx(Re,{}),e.jsxs("form",{onSubmit:a,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex flex-col gap-1",children:[e.jsx(Z,{htmlFor:"email",className:"text-sm font-semibold",children:"Email Address"}),e.jsx(Z,{className:"text-neutral-500",children:"We'll use this email to reach out about your integration setup"})]}),e.jsx(ne,{id:"email",type:"email",value:i.email,onChange:d=>r(o=>({...o,email:d.target.value})),placeholder:"[email protected]",required:!0,className:"mt-1.5"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex flex-col gap-1",children:[e.jsx(Z,{htmlFor:"requirements",className:"text-sm font-semibold",children:"Requirements & Use Case"}),e.jsx(Z,{className:"text-neutral-500",children:"Tell us about your specific needs so we can prepare for our discussion"})]}),e.jsx(Qs,{id:"requirements",value:i.requirements,onChange:d=>r(o=>({...o,requirements:d.target.value})),placeholder:"Describe how you'd like to use this integration, any specific requirements, or questions you have...",rows:4,required:!0,className:"mt-1.5"})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx(F,{type:"submit",disabled:n||!i.email||!i.requirements,className:"min-w-32",children:n?e.jsxs(e.Fragment,{children:[e.jsx(Le,{className:"mr-2 h-4 w-4 animate-spin"}),"Submitting..."]}):"Submit Request"})})]})]})},At=({steps:s})=>e.jsx("div",{className:"space-y-4",children:s.map((t,i)=>e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border-2 border-primary/20 bg-primary/5",children:e.jsx("span",{className:"text-sm font-semibold text-primary",children:i+1})}),e.jsx("div",{className:"flex-1 pt-1",children:e.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:t})}),i<s.length-1&&e.jsx("div",{className:"absolute ml-4 mt-8 h-4 w-px bg-border"})]},i))}
1),Tt=["Schedule a call with our team to discuss your requirements","Our accounts team reviews the scope and finalizes pricing with you","Our developers work on the integration to fit your required use case","We review the integration with you for feedback and adjustments","We complete the integration and install it on your board"],Lt=["Open this integration in Cityguide Admin","Add your provider credentials and feed URL","Map your source categories and click Sync now"];function Et(s){var n;const t=As;if(!t)return null;const i=(n=s.id)==null?void 0:n.split("-")[0];return!i||!new Set(["tempest","simpleview","overture"]).has(i)?null:`${t.replace(/\/$/,"")}/admin/integrations/${i}`}const Ft=({customIntegration:s,setShowCustomIntegrationDialog:t})=>{var p;const i=ie(),r=y(j=>j.integrations.sendCustomIntegrationStatus),[n,c]=l.useState("process"),a=j=>{j||t(null)},d=({email:j,integrationName:g,requirements:u})=>{i(k.sendCustomIntegrationRequest({email:j,integration:g,requirements:u}))};if(l.useEffect(()=>{r===L.FULFILLED&&(te({title:`Custom Integration Request for ${s==null?void 0:s.name} is sent successfully!`,description:"Our Team will get back to you soon."}),i(k.resetSendCustomIntegrationRequest()),a(!1))},[r,s==null?void 0:s.name]),!s)return null;const o=s.provisioningMode==="managed",x=o?Et(s):null,N=o?Lt:Tt;return e.jsx(ke,{defaultOpen:!0,onOpenChange:a,children:e.jsxs(Ae,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(Te,{className:"space-y-0",children:s.bannerImages&&((p=s.bannerImages)==null?void 0:p.length)>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"relative -mx-6 -mt-6 mb-6",children:e.jsxs(Gs,{className:"w-full",opts:{loop:!0},children:[e.jsx(Os,{children:s.bannerImages.map((j,g)=>e.jsx(Vs,{children:e.jsx("div",{className:"relative aspect-[21/8] w-full overflow-hidden bg-gradient-to-br from-neutral-100 to-neutral-50",children:e.jsx("img",{src:j,alt:`${s.name} preview ${g+1}`,className:"h-full w-full object-cover"})})},j))}),s.bannerImages.length>1&&e.jsxs(e.Fragment,{children:[e.jsx($s,{className:"left-4 h-10 w-10 border-2 bg-white/95 shadow-lg hover:bg-white"}),e.jsx(Ws,{className:"right-4 h-10 w-10 border-2 bg-white/95 shadow-lg hover:bg-white"})]})]})}),e.jsxs("div",{className:"flex items-start gap-3 px-2",children:[e.jsx("img",{src:s.icon,alt:s.name,className:"h-16 w-16 flex-shrink-0 rounded-2xl -mt-12 z-10 border-2 border-white object-cover shadow-sm"}),e.jsxs("div",{className:"min-w-0 flex-1 -space-y-1.5 -mt-5 mb-2",children:[e.jsx(je,{className:"text-2xl font-semibold text-black",children:s.name}),e.jsx(Ie,{className:"text-base leading-relaxed text-muted-foreground",children:s.description})]})]}),e.jsx(Re,{})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("img",{src:s.icon,alt:s.name,className:"mt-1.5 h-14 w-14 flex-shrink-0 rounded-lg border border-neutral-200 object-cover"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-0.5",children:[e.jsx(je,{className:"text-xl",children:s.name}),e.jsx(Ie,{className:"text-sm leading-4 text-muted-foreground",children:s.description})]})]}),e.jsx(Re,{})]})}),e.jsxs(Be,{value:n,onValueChange:j=>c(j),className:"w-full",children:[e.jsxs(_e,{className:"grid w-full grid-cols-2",children:[e.jsx(ce,{value:"process",children:o?"How to set up":"Integration Process"}),e.jsx(ce,{value:"contact",children:"Talk to our Team"})]}),e.jsxs(oe,{value:"process",className:"mt-4 space-y-5 focus-visible:ring-0 focus-visible:ring-offset-0",children:[o?e.jsx("div",{className:"rounded-md border border-emerald-200 bg-emerald-50 px-4 py-2 text-sm font-semibold leading-5 text-emerald-950",children:"This integration is ready â finish setup in Cityguide Admin by adding your credentials and feed details."}):e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-100 px-4 py-2 text-sm font-semibold leading-5 text-amber-950",children:"This is a custom integration that requires HootBoard Developers assistance. Our team will work with you to build and configure this integration specifically for your needs."}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"mb-1 font-semibold",children:"How it works"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.howItWorks})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"mb-4 font-semibold",children:o?"How to set up":"Integration Process"}),e.jsx(At,{steps:N})]})]}),e.jsx("div",{className:"flex justify-end gap-3 border-t pt-4",children:o&&x?e.jsxs(e.Fragment,{children:[e.jsx(F,{variant:"outline",onClick:()=>c("contact"),children:"Talk to our Team"}),e.jsx(F,{asChild:!0,children:e.jsxs("a",{href:x,target:"_blank",rel:"noopener noreferrer",children:["Open in Cityguide Admin",e.jsx(ds,{className:"ml-2 h-4 w-4"})]})})]}):e.jsx(F,{onClick:()=>c("contact"),children:"Talk to our Team"})})]}),e.jsx(oe,{value:"contact",className:"mt-6",children:e.jsx(kt,{integrationName:s.name,onSubmit:d})})]})]})})},Ns=(s,t)=>{const i=s.fields.find(n=>n.type==="hootCollectionsSelector");if(!i)return!0;const r=t[i.id];return!r||r.length===0?(te({variant:"destructive",title:"Collection Required",description:"Please select at least one collection to continue."}),!1):!0},Ut=({dialogContent:s,setShowNewConnectionDialog:t,integration:i})=>e.jsx(ke,{defaultOpen:!0,onOpenChange:r=>!r&&t(!1),children:e.jsx(Ae,{className:"flex max-h-[calc(100vh-4rem)] max-w-2xl flex-col gap-0 overflow-hidden p-0",onInteractOutside:r=>{r.composedPath().some(c=>"classList"in c?Array.from(c.classList).includes("pac-container"):!1)&&r.preventDefault()},children:e.jsxs("div",{className:"flex flex-col gap-2 overflow-y-auto p-6",children:[e.jsxs(Te,{className:"border-b border-neutral-200 pb-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl border border-neutral-200 bg-white shadow-sm",children:e.jsx("img",{src:i.icon,className:"rounded-lg",alt:i.name})}),e.jsx("h1",{className:"text-xl font-semibold leading-7 text-neutral-900",children:i.name})]}),e.jsx(je,{children:"Add new Connection"})]}),s]})})}),Pt=({setShowNewConnectionDialog:s})=>e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"cursor-pointer rounded-xl border border-dashed border-neutral-300 bg-neutral-50 transition-colors hover:bg-neutral-100",onClick:()=>s(!0),children:e.jsx("div",{className:"flex items-center justify-center px-16 py-7",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-2 flex h-12 w-12 items-center justify-center rounded-full border border-neutral-200 bg-white",children:e.jsx(Zs,{size:24,className:"text-neutral-600"})}),e.jsx("p",{className:"text-sm font-medium text-neutral-600",children:"Add Connection"})]})})})}),qe=({isEditingTabName:s,configName:t,setConfigName:i,setIsEditingTabName:r})=>e.jsx("div",{className:"flex items-center space-x-2 border-b border-neutral-400 pb-2.5 text-sm text-hb-brand-blue",children:s?e.jsx("input",{type:"text",value:t,onChange:n=>i(n.target.value),onBlur:()=>{t.trim()===""&&i("My New Connection"),r(!1)},onKeyDown:n=>{n.key==="Enter"&&(t.trim()===""&&i("My New Connection"),r(!1))},className:"font-inherit w-auto min-w-0 border-none bg-transparent text-inherit outline-none",autoFocus:!0,style:{width:`${Math.max(t==null?void 0:t.length,5)}ch`}}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"font-semibold mb-0.5",children:t}),e.jsx("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),r(!0)},className:"text-neutral-600 transition-colors hover:text-neutral-600",children:e.jsxs("div",{className:"flex items-center gap-1 rounded-full border border-neutral-300 px-2 py-0.5 text-xs",children:[e.jsx(Ys,{size:12,strokeWidth:2}),"Rename"]})})]})}),Mt=({integrationName:s,integrationId:t,showDeleteConfirm:i,setShowDeleteConfirm:r,onDeleteConfirm:n})=>{const c=ie(),a=l.useContext(Ne),d=y(o=>o.integrations.uninstallIntegrationApiStatus);return l.useEffect(()=>{d===L.FULFILLED&&(c(k.updateIntegrationAfterUninstall({integrationId:t})),te({title:"Integration Uninstalled Successfully",description:"Associated connections have also been removed."}),a.trackUninstalledAnIntegration({context:"Integrations & Services",integrationName:s}),c(k.resetUninstallStates()))},[d,t]),e.jsx(xs,{open:i,onOpenChange:()=>r(!1),children:e.jsxs(ms,{children:[e.jsxs(hs,{children:[e.jsxs(ps,{children:["Are you sure you want to uninstall ",s,"?"]}),e.jsxs(gs,{children:["This will permanently remove all saved setups for ",s,". This action cannot be undone."]})]}),e.jsxs(fs,{children:[e.jsx(bs,{onClick:n,children:d===L.PENDING?"Uninstalling...":"Uninstall"}),e.jsx(js,{onClick:()=>r(!1),children:"Cancel"})]})]})})},Rt=vs.divIcon({className:"gtfs-service-area-center",iconSize:[22,22],iconAnchor:[11,11],html:`<div style=" 2 width:22px;height:22px;border-radius:9999px; 3 background:#059669;border:3px solid #fff; 4 box-shadow:0 1px 5px rgba(15,23,42,0.4);cursor:grab; 5 "></div>`}),Bt=({lat:s,lng:t,radiusMeters:i})=>{const r=bt(),n=l.useRef(null);return l.useEffect(()=>{n.current!==i&&(n.current=i,r.fitBounds(vs.latLng(s,t).toBounds(i*2.2),{padding:[20,20]}))},[r,s,t,i]),null},_t=({onCenterChange:s})=>(jt({click:t=>s(t.latlng.lat,t.latlng.lng)}),null),qt=({lat:s,lng:t,radiusMeters:i,onCenterChange:r})=>{const n=l.useMemo(()=>[s,t],[s,t]);return e.jsx("div",{className:"overflow-hidden rounded-lg border border-neutral-200",children:e.jsxs(ht,{center:n,zoom:11,scrollWheelZoom:!1,className:"h-[280px] w-full",children:[e.jsx(pt,{attribution:Nt,url:vt}),e.jsx(Bt,{lat:s,lng:t,radiusMeters:i}),e.jsx(_t,{onCenterChange:r}),e.jsx(gt,{center:n,radius:i,pathOptions:{color:"#059669",fillColor:"#059669",fillOpacity:.08,weight:2}}),e.jsx(ft,{position:n,icon:Rt,draggable:!0,eventHandlers:{dragend:c=>{const a=c.target.getLatLng();r(a.lat,a.lng)}}})]})})},we="__all__",Xe=1e-4,Ht=({formData:s,handleInputChange:t})=>{var I;const i=y(f=>{var v,E;
5return(E=(v=f.activeBoard)==null?void 0:v.boardDetails)==null?void 0:E.boardId}),r=y(f=>{var O,ee,le;const v=(le=(ee=(O=f.activeBoard)==null?void 0:O.boardDetails)==null?void 0:ee.locations)==null?void 0:le[0],E=Number(v==null?void 0:v.latitude),W=Number(v==null?void 0:v.longitude);return!Number.isFinite(E)||!Number.isFinite(W)||E===0&&W===0?null:{lat:E,lng:W}}),[n,c]=l.useState(s!=null&&s.mdbFeedId?"catalog":s!=null&&s.feedUrl?"custom":"catalog"),[a,d]=l.useState([]),[o,x]=l.useState("US"),[N,p]=l.useState([]),[j,g]=l.useState(we),[u,m]=l.useState(""),[S,A]=l.useState(""),[T,U]=l.useState([]),[w,z]=l.useState(!1),[G,M]=l.useState(null),[X,Y]=l.useState(!1),[K,V]=l.useState(null),P=s==null?void 0:s.mdbFeedId,J=s==null?void 0:s.feedUrl,fe=s==null?void 0:s.agencyName,R=l.useRef(null);l.useEffect(()=>(R.current&&clearTimeout(R.current),R.current=setTimeout(()=>A(u.trim()),350),()=>{R.current&&clearTimeout(R.current)}),[u]),l.useEffect(()=>{!i||n!=="catalog"||rs(i).then(d).catch(f=>M(f.message||"Failed to load countries"))},[i,n]),l.useEffect(()=>{if(!i||n!=="catalog"||!P){V(null);return}let f=!1;return ls(i,P).then(v=>{f||(V(v),typeof(s==null?void 0:s.serviceLat)!="number"&&typeof(s==null?void 0:s.serviceLng)!="number"&&(r?(t("serviceLat",r.lat),t("serviceLng",r.lng)):v.boundingBox&&(t("serviceLat",(v.boundingBox.minLat+v.boundingBox.maxLat)/2),t("serviceLng",(v.boundingBox.minLng+v.boundingBox.maxLng)/2))),typeof(s==null?void 0:s.serviceRadiusMeters)!="number"&&t("serviceRadiusMeters",1e4))}).catch(()=>{f||V(null)}),()=>{f=!0}},[i,n,P]),l.useEffect(()=>{!i||n!=="catalog"||!o||(Y(!0),p([]),g(we),as(i,o).then(f=>p(f)).catch(()=>p([])).finally(()=>Y(!1)))},[i,o,n]),l.useEffect(()=>{!i||n!=="catalog"||!o||(z(!0),M(null),Ts(i,{country:o,subdivision:j===we?void 0:j,q:S||void 0,limit:50}).then(f=>U(f.items)).catch(f=>{M(f.message||"Failed to search feeds"),U([])}).finally(()=>z(!1)))},[i,o,j,S,n]);function re(f){var E;const v=((E=f.latestDataset)==null?void 0:E.hostedUrl)||"";t("mdbFeedId",f.id),t("feedUrl",v),t("agencyName",f.provider||f.feedName||""),t("agencyId",""),typeof(s==null?void 0:s.serviceLat)!="number"&&typeof(s==null?void 0:s.serviceLng)!="number"&&(r?(t("serviceLat",r.lat),t("serviceLng",r.lng)):f.boundingBox&&(t("serviceLat",(f.boundingBox.minLat+f.boundingBox.maxLat)/2),t("serviceLng",(f.boundingBox.minLng+f.boundingBox.maxLng)/2))),typeof(s==null?void 0:s.serviceRadiusMeters)!="number"&&t("serviceRadiusMeters",1e4)}function $(){c("custom"),t("mdbFeedId","")}function D(){c("catalog")}const b=l.useMemo(()=>T.find(f=>f.id===P)??K??void 0,[T,P,K]);return n==="custom"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(ne,{type:"url",placeholder:"https://example.transit.org/gtfs/latest.zip",value:(s==null?void 0:s.feedUrl)||"",onChange:f=>t("feedUrl",f.target.value),required:!0}),e.jsxs("p",{className:"text-sm text-neutral-500",children:["Paste a direct link to a GTFS .zip. Use this only if the agency isn't listed in the Mobility Database."," ",e.jsx("button",{type:"button",onClick:D,className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"Search the catalog instead"})]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[e.jsxs(de,{value:o,onValueChange:x,children:[e.jsx(ue,{children:e.jsx(xe,{placeholder:"Country"})}),e.jsx(me,{children:e.jsx(he,{children:a.map(f=>e.jsx(_,{value:f.code,children:f.name},f.code))})})]}),e.jsxs(de,{value:j,onValueChange:g,disabled:X,children:[e.jsx(ue,{children:e.jsx(xe,{placeholder:X?"Loading regionsâ¦":"All regions"})}),e.jsx(me,{children:e.jsxs(he,{children:[e.jsx(_,{value:we,children:"All regions"}),N.map(f=>e.jsx(_,{value:f,children:f},f))]})})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ze,{className:"absolute left-2 top-1/2 size-4 -translate-y-1/2 text-neutral-400"}),e.jsx(ne,{className:"pl-8",placeholder:"Search agency or city (e.g. VIA, San Antonio)",value:u,onChange:f=>m(f.target.value)})]}
5),P&&e.jsxs(H,{className:"border-emerald-200 bg-emerald-50 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{variant:"secondary",className:"bg-emerald-200/60 text-emerald-900",children:"Selected"}),e.jsx("span",{className:"text-sm font-semibold text-neutral-900",children:fe||(b==null?void 0:b.provider)||P})]}),((b==null?void 0:b.municipality)||(b==null?void 0:b.subdivision))&&e.jsxs("div",{className:"inline-flex items-center gap-1 text-sm text-neutral-600",children:[e.jsx(Ge,{className:"size-3","aria-hidden":!0}),[b==null?void 0:b.municipality,b==null?void 0:b.subdivision].filter(Boolean).join(", ")]}),e.jsxs("div",{className:"text-sm text-neutral-500",children:[P," · last dataset"," ",(I=b==null?void 0:b.latestDataset)!=null&&I.downloadedAt?new Date(b.latestDataset.downloadedAt).toLocaleDateString():"â"]})]}),e.jsx(F,{type:"button",variant:"ghost",size:"sm",onClick:()=>{t("mdbFeedId",""),t("feedUrl",""),t("agencyName","")},children:"Change"})]}),e.jsxs("div",{className:"mt-3 border-t border-emerald-200 pt-3",children:[e.jsx(Z,{className:"text-sm font-semibold text-neutral-700",children:"Service area"}),e.jsx("p",{className:"mt-1 text-sm text-neutral-600",children:"We keep every stop within this distance of the center below and skip the rest. Smaller is faster and uses less storage."}),e.jsxs("div",{className:"mt-2",children:[e.jsxs(de,{value:String((s==null?void 0:s.serviceRadiusMeters)??1e4),onValueChange:f=>t("serviceRadiusMeters",Number(f)),children:[e.jsx(ue,{className:"max-w-xs",children:e.jsx(xe,{placeholder:"Service area"})}),e.jsx(me,{children:e.jsxs(he,{children:[e.jsx(_,{value:"5000",children:"5 km â single neighborhood"}),e.jsx(_,{value:"10000",children:"10 km â small city / tourism (recommended)"}),e.jsx(_,{value:"25000",children:"25 km â metro area"}),e.jsx(_,{value:"50000",children:"50 km â region"}),e.jsx(_,{value:"100000",children:"100 km â large region"}),e.jsx(_,{value:"0",children:"All stops, no live times (heavy â large agencies may take minutes)"})]})})]}),(()=>{const f=Number((s==null?void 0:s.serviceRadiusMeters)??1e4),v=typeof(s==null?void 0:s.serviceLat)=="number"&&typeof(s==null?void 0:s.serviceLng)=="number";if(f<=0)return e.jsxs("p",{className:"mt-2 text-sm text-amber-700",children:["Every stop is kept, but"," ",e.jsx("span",{className:"font-medium",children:"live departure times are turned off"})," ","for this option. Choose a distance above to show live times for stops near a center."]});if(!v)return null;const E=s.serviceLat,W=s.serviceLng,O=!!r&&Math.abs(E-r.lat)<Xe&&Math.abs(W-r.lng)<Xe;return e.jsxs("div",{className:"mt-3 space-y-1.5",children:[e.jsxs("p",{className:"text-sm text-neutral-600",children:[O?"Centered on your board's location.":"Centered on a custom point."," ","Drag the pin or click the map to move it â for example, to sit between two kiosks."]}),e.jsx(qt,{lat:E,lng:W,radiusMeters:f,onCenterChange:(ee,le)=>{t("serviceLat",ee),t("serviceLng",le)}}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 text-sm text-neutral-500",children:[e.jsxs("span",{children:["Center: ",E.toFixed(4),", ",W.toFixed(4)]}),r&&!O&&e.jsx("button",{type:"button",onClick:()=>{t("serviceLat",r.lat),t("serviceLng",r.lng)},className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"Reset to board location"})]})]})})()]})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-neutral-500",children:[e.jsx(ve,{})," Loading feedsâ¦"]}),G&&e.jsx(pe,{variant:"destructive",children:e.jsx(ge,{children:G})}),!w&&!G&&T.length===0&&e.jsxs("div",{className:"rounded-md border border-dashed border-neutral-200 bg-neutral-50 p-4 text-sm text-neutral-500",children:["No feeds match these filters. Try a different region or search term â or"," ",e.jsx("button",{type:"button",onClick:$,className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"paste a direct .zip URL instead"}),"."]}),!w&&!G&&T.length>0&&e.jsx("ul",{className:"max-h-[420px] space-y-1 overflow-y-auto rounded-md border border-neutral-200",children:T.map(f=>
5{const v=f.id===P,E=[f.municipality,f.subdivision].filter(Boolean).join(", ");return e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>re(f),className:"block w-full px-3 py-2 text-left transition-colors "+(v?"bg-emerald-50":"hover:bg-neutral-50"),children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-neutral-900",children:f.provider||f.feedName||f.id}),E&&e.jsx("div",{className:"truncate text-sm text-neutral-500",children:E})]}),e.jsx("span",{className:"shrink-0 font-mono text-sm text-neutral-400",children:f.id})]})})},f.id)})}),e.jsxs("div",{className:"text-sm text-neutral-500",children:["Catalog from"," ",e.jsx("a",{href:"https://mobilitydatabase.org",target:"_blank",rel:"noopener noreferrer",className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"Mobility Database"}),". Not finding the agency?"," ",e.jsx("button",{type:"button",onClick:$,className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"Paste a direct .zip URL"}),"."]}),e.jsx("input",{type:"hidden",name:"feedUrl",value:J||""})]})}
5,zt="gtfs-schedule-v1",Se="__all__",be="trip_updates";function Pe(s){switch(s){case"trip_updates":return"Trip Updates";case"vehicle_positions":return"Vehicle Positions";case"service_alerts":return"Service Alerts";default:return s}}const Gt=({formData:s,handleInputChange:t})=>{const i=y(h=>{var B,Q;return(Q=(B=h.activeBoard)==null?void 0:B.boardDetails)==null?void 0:Q.boardId}),[r,n]=l.useState(()=>s!=null&&s.mdbRtFeedId?"auto":s!=null&&s.tripUpdatesUrl?"custom":"auto"),c=s==null?void 0:s.mdbRtFeedId,a=s==null?void 0:s.tripUpdatesUrl,d=s==null?void 0:s.agencyName,o=s==null?void 0:s.linkedScheduleInstanceId,[x,N]=l.useState(null),[p,j]=l.useState(),[g,u]=l.useState(null),[m,S]=l.useState(!1),[A,T]=l.useState(null),[U,w]=l.useState(null);l.useEffect(()=>{if(!i||r!=="auto"||!o){N(null),j(void 0),u(null);return}let h=!1;return S(!0),T(null),(async()=>{try{const Q=(await cs(i,zt)).find(se=>se._id===o)||null;if(h)return;N(Q);const ae=(Q==null?void 0:Q.config)||{},Ee=typeof ae.mdbFeedId=="string"?ae.mdbFeedId:null;if(!Ee){u([]),n("browse");return}let Fe;try{const se=await ls(i,Ee);Fe=se==null?void 0:se.country}catch{}if(h)return;j(Fe);const Ss=await Ls(i,Ee,Fe);if(h)return;const Cs=Ss.filter(se=>se.entityTypes.includes(be));u(Cs)}catch(B){h||T(B.message||"Couldn't look up paired RT feeds")}finally{h||S(!1)}})(),()=>{h=!0}},[i,r,o]),l.useEffect(()=>{if(!i||!c){w(null);return}let h=!1;return Es(i,c).then(B=>{h||w(B)}).catch(()=>{h||w(null)}),()=>{h=!0}},[i,c]);const[z,G]=l.useState([]),[M,X]=l.useState("US"),[Y,K]=l.useState([]),[V,P]=l.useState(Se),[J,fe]=l.useState(""),[R,re]=l.useState(""),[$,D]=l.useState([]),[b,I]=l.useState(!1),[f,v]=l.useState(null),[E,W]=l.useState(!1),O=l.useRef(null);l.useEffect(()=>(O.current&&clearTimeout(O.current),O.current=setTimeout(()=>re(J.trim()),350),()=>{O.current&&clearTimeout(O.current)}),[J]),l.useEffect(()=>{!i||r!=="browse"||rs(i).then(G).catch(h=>v(h.message||"Failed to load countries"))},[i,r]),l.useEffect(()=>{r==="browse"&&p&&X(p)},[r,p]),l.useEffect(()=>{!i||r!=="browse"||!M||(W(!0),K([]),P(Se),as(i,M).then(h=>K(h)).catch(()=>K([])).finally(()=>W(!1)))},[i,M,r]),l.useEffect(()=>{!i||r!=="browse"||!M||(I(!0),v(null),Fs(i,{country:M,subdivision:V===Se?void 0:V,q:R||void 0,entityType:be,limit:50}).then(h=>D(h.items)).catch(h=>{v(h.message||"Failed to search RT feeds"),D([])}).finally(()=>I(!1)))},[i,M,V,R,r]);function ee(h){t("mdbRtFeedId",h.id),t("tripUpdatesUrl",h.liveUrl),t("agencyName",h.provider||h.feedName||"")}function le(){t("mdbRtFeedId",""),t("tripUpdatesUrl",""),t("agencyName","")}function ye(){n("custom"),t("mdbRtFeedId","")}function $e(){n("browse")}function We(){n("auto")}const C=l.useMemo(()=>{if(c)return(g==null?void 0:g.find(h=>h.id===c))||$.find(h=>h.id===c)||U||void 0},[g,$,U,c]),Qe=l.useMemo(()=>{const h=x==null?void 0:x.config;return h&&typeof h.mdbFeedId=="string"?h.mdbFeedId:void 0},[x]),ws=!!Qe&&!!C&&!C.relatedScheduleFeedIds.includes(Qe);if(!o&&r!=="custom")return e.jsx(H,{className:"border-neutral-200 bg-neutral-50 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ks,{className:"mt-0.5 size-5 shrink-0 text-neutral-500","aria-hidden":!0}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm font-semibold text-neutral-900",children:"Pick a GTFS Schedule install above first"}),e.jsx("p",{className:"text-sm text-neutral-700",children:"The realtime feed pairs with your schedule install. We'll auto-suggest the right one once you've picked a schedule above."})]})]})});if(r==="custom")return e.jsxs("div",{className:"space-y-2",children:[e.jsx(ne,{type:"url",placeholder:"https://example.transit.org/gtfs-rt/trip-updates.pb",value:(s==null?void 0:s.tripUpdatesUrl)||"",onChange:h=>t("tripUpdatesUrl",h.target.value),required:!0}),e.jsxs("p",{className:"text-sm text-neutral-500",children:["Paste a direct link to the agency's Trip Updates protocol-buffer feed. Use this only if the agency isn't listed in the Mobility Database."," ",e.jsx("button",{type:"button",onClick:We,className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"Find it in the catalog instead"})]})]});const Ze=ws&&e.jsx(pe,{variant:"destructive",className:"border-amber-300 bg-amber-50 text-amber-900 [&>svg]:text-amber-700",children:e.jsxs(ge,{children:[e.jsx("strong",{children:"Heads up:"})," the realtime feed you selected",C!=null&&C.provider?` (${C.provider})`:""," isn't paired with your GTFS Schedule install in the Mobility Database. Their trip ids won't match, so live overlays won't appear on the kiosk. Pick a different feed or install GTFS Schedule for the matching agency."]})}),Ye=c&&e.jsx(H,{className:"border-emerald-200 bg-emerald-50 p-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(q,{variant:"secondary",className:"bg-emerald-200/60 text-emerald-900",children:[e.jsx(Js,{className:"mr-1 size-3","aria-hidden":!0})," Selected"]}),e.jsx("span",{className:"text-sm font-semibold text-neutral-900",children:d||(C==null?void 0:C.provider)||c})]}),((C==null?void 0:C.municipality)||(C==null?void 0:C.subdivision))&&e.jsxs("div",{className:"inline-flex items-center gap-1 text-sm text-neutral-600",children:[e.jsx(Ge,{className:"size-3","aria-hidden":!0}),[C==null?void 0:C.municipality,C==null?void 0:C.subdivision].filter(
5Boolean).join(", ")]}),e.jsx("div",{className:"text-sm text-neutral-500",children:c}),(C==null?void 0:C.entityTypes)&&C.entityTypes.length>0&&e.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:C.entityTypes.map(h=>e.jsx(q,{variant:"outline",className:h===be?"border-emerald-300 text-emerald-900":"border-neutral-300 text-neutral-600",children:Pe(h)},h))})]}),e.jsx(F,{type:"button",variant:"ghost",size:"sm",onClick:le,children:"Change"})]})});return r==="auto"?e.jsxs("div",{className:"space-y-3",children:[Ze,Ye,!c&&m&&e.jsxs("div",{className:"flex items-center gap-2 py-3 text-sm text-neutral-500",children:[e.jsx(ve,{})," Finding the realtime feed paired with your schedule installâ¦"]}),!c&&A&&e.jsx(pe,{variant:"destructive",children:e.jsx(ge,{children:A})}),!c&&!m&&!A&&g&&g.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-sm text-neutral-700",children:["We found ",g.length===1?"a paired":`${g.length} paired`," ","realtime feed",g.length===1?"":"s"," for"," ",e.jsx("span",{className:"font-semibold",children:x!=null&&x.config&&typeof x.config=="object"&&"agencyName"in x.config?String(x.config.agencyName??"your agency"):"your agency"}),". Pick one to enable live arrivals."]}),e.jsx("ul",{className:"space-y-1 rounded-md border border-neutral-200",children:g.map(h=>e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>ee(h),className:"block w-full px-3 py-2 text-left transition-colors hover:bg-neutral-50",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-neutral-900",children:h.provider||h.feedName||h.id}),e.jsx("div",{className:"mt-0.5 flex flex-wrap gap-1",children:h.entityTypes.map(B=>e.jsx(q,{variant:"outline",className:B===be?"border-emerald-300 text-emerald-900":"border-neutral-300 text-neutral-600",children:Pe(B)},B))})]}),e.jsx("span",{className:"shrink-0 font-mono text-sm text-neutral-400",children:h.id})]})})},h.id))})]}),!c&&!m&&!A&&g&&g.length===0&&e.jsx(H,{className:"border-amber-200 bg-amber-50 p-4",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm font-semibold text-neutral-900",children:"No paired realtime feed found"}),e.jsx("p",{className:"text-sm text-neutral-700",children:"The Mobility Database doesn't list a Trip Updates feed paired with your schedule install. You can browse the full RT catalog or paste the URL directly."}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(F,{type:"button",variant:"outline",size:"sm",onClick:$e,children:"Browse catalog"}),e.jsx(F,{type:"button",variant:"outline",size:"sm",onClick:ye,children:"Paste a URL"})]})]})}),!c&&!m&&e.jsxs("div",{className:"text-sm text-neutral-500",children:["Not the agency you expected?"," ",e.jsx("button",{type:"button",onClick:$e,className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"Browse the catalog"})," ","or"," ",e.jsx("button",{type:"button",onClick:ye,className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"paste a direct URL"}),"."]}),e.jsx("input",{type:"hidden",name:"tripUpdatesUrl",value:a||""})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[e.jsxs(de,{value:M,onValueChange:X,children:[e.jsx(ue,{children:e.jsx(xe,{placeholder:"Country"})}),e.jsx(me,{children:e.jsx(he,{children:z.map(h=>e.jsx(_,{value:h.code,children:h.name},h.code))})})]}),e.jsxs(de,{value:V,onValueChange:P,disabled:E,children:[e.jsx(ue,{children:e.jsx(xe,{placeholder:E?"Loading regionsâ¦":"All regions"})}),e.jsx(me,{children:e.jsxs(he,{children:[e.jsx(_,{value:Se,children:"All regions"}),Y.map(h=>e.jsx(_,{value:h,children:h},h))]})})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ze,{className:"absolute left-2 top-1/2 size-4 -translate-y-1/2 text-neutral-400"}),e.jsx(ne,{className:"pl-8",placeholder:"Search agency or city (e.g. MTA, Boston)",value:J,onChange:h=>fe(h.target.value)})]}),Ze,Ye,b&&e.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-neutral-500",children:[e.jsx(ve,{})," Loading realtime feedsâ¦"]}),f&&e.jsx(pe,{variant:"destructive",children:e.jsx(ge,{children:f})}),!b&&!f&&$.length===0&&e.jsxs("div",{className:"rounded-md border border-dashed border-neutral-200 bg-neutral-50 p-4 text-sm text-neutral-500",children:["No realtime feeds match these filters. Try a different region or search term â or"," ",e.jsx("button",{type:"button",onClick:ye,className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"paste a direct URL instead"}),"."]}),!b&&!f&&$.length>0&&e.jsx("ul",{className:"max-h-[420px] space-y-1 overflow-y-auto rounded-md border border-neutral-200",children:$.map(h=>
5{const B=h.id===c,Q=[h.municipality,h.subdivision].filter(Boolean).join(", ");return e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>ee(h),className:"block w-full px-3 py-2 text-left transition-colors "+(B?"bg-emerald-50":"hover:bg-neutral-50"),children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-neutral-900",children:h.provider||h.feedName||h.id}),Q&&e.jsx("div",{className:"truncate text-sm text-neutral-500",children:Q}),e.jsx("div",{className:"mt-0.5 flex flex-wrap gap-1",children:h.entityTypes.map(ae=>e.jsx(q,{variant:"outline",className:ae===be?"border-emerald-300 text-emerald-900":"border-neutral-300 text-neutral-600",children:Pe(ae)},ae))})]}),e.jsx("span",{className:"shrink-0 font-mono text-sm text-neutral-400",children:h.id})]})})},h.id)})}),e.jsxs("div",{className:"text-sm text-neutral-500",children:["Catalog from"," ",e.jsx("a",{href:"https://mobilitydatabase.org",target:"_blank",rel:"noopener noreferrer",className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"Mobility Database"}),". Not finding the agency?"," ",e.jsx("button",{type:"button",onClick:ye,className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"Paste a direct URL"})," ","or"," ",e.jsx("button",{type:"button",onClick:We,className:"font-medium text-blue-700 underline-offset-2 hover:underline",children:"go back to auto-suggest"}),"."]}),e.jsx("input",{type:"hidden",name:"tripUpdatesUrl",value:a||""})]})},Ot="gtfs-schedule-v1";function Me(s){const t=s.config||{};return{agencyName:typeof t.agencyName=="string"?t.agencyName:void 0,agencyId:typeof t.agencyId=="string"?t.agencyId:void 0,mdbFeedId:typeof t.mdbFeedId=="string"?t.mdbFeedId:void 0,feedUrl:typeof t.feedUrl=="string"?t.feedUrl:void 0}}function De(s,t){return s.agencyName||s.mdbFeedId||t}const Vt=({formData:s,handleInputChange:t})=>{const i=y(g=>{var u,m;return(m=(u=g.activeBoard)==null?void 0:u.boardDetails)==null?void 0:m.boardId}),[r,n]=l.useState([]),[c,a]=l.useState(!1),[d,o]=l.useState(null),x=s==null?void 0:s.linkedScheduleInstanceId;l.useEffect(()=>{i&&(a(!0),o(null),cs(i,Ot).then(g=>{n(g.filter(u=>!u.isDisabled))}).catch(g=>o((g==null?void 0:g.message)||"Failed to load GTFS Schedule installs")).finally(()=>a(!1)))},[i]);const N=l.useMemo(()=>r.find(g=>g._id===x),[r,x]);function p(g){t("linkedScheduleInstanceId",g._id)}function j(){t("linkedScheduleInstanceId","")}return c?e.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-neutral-500",children:[e.jsx(ve,{})," Loading your GTFS Schedule installsâ¦"]}):d?e.jsx(pe,{variant:"destructive",children:e.jsx(ge,{children:d})}):r.length===0?e.jsx(H,{className:"border-amber-200 bg-amber-50 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Xs,{className:"mt-0.5 size-5 shrink-0 text-amber-700","aria-hidden":!0}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm font-semibold text-neutral-900",children:"No GTFS Schedule installs on this board yet"}),e.jsx("p",{className:"text-sm text-neutral-700",children:"GTFS Realtime needs the static schedule to fill in stop names, routes, and service days. Install GTFS Schedule for the agency you want to track first, then come back here to pair the realtime overlay."})]})]})}):e.jsxs("div",{className:"space-y-3",children:[N&&e.jsx(H,{className:"border-emerald-200 bg-emerald-50 p-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{variant:"secondary",className:"bg-emerald-200/60 text-emerald-900",children:"Paired"}),e.jsx("span",{className:"text-sm font-semibold text-neutral-900",children:De(Me(N),N._id)})]}),(()=>{const g=Me(N),u=[g.mdbFeedId,g.agencyId].filter(Boolean);return u.length>0?e.jsx("div",{className:"text-sm text-neutral-500",children:u.join(" · ")}):null})(),e.jsx("div",{className:"font-mono text-xs text-neutral-400",children:N._id})]}),e.jsx(F,{type:"button",variant:"ghost",size:"sm",onClick:j,children:"Change"})]})}),!N&&e.jsx("ul",{className:"max-h-[360px] space-y-1 overflow-y-auto rounded-md border border-neutral-200",children:r.map(g=>
5{const u=Me(g),m=[u.mdbFeedId,u.agencyId].filter(Boolean);return e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>p(g),className:"block w-full px-3 py-2 text-left transition-colors hover:bg-neutral-50",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-neutral-900",children:De(u,g._id)}),m.length>0&&e.jsx("div",{className:"truncate text-sm text-neutral-500",children:m.join(" · ")})]}),e.jsx("span",{className:"shrink-0 font-mono text-xs text-neutral-400",children:g._id.slice(-6)})]})})},g._id)})}),e.jsx("input",{type:"hidden",name:"linkedScheduleInstanceId",value:x||""})]})},$t=({onSelectionChange:s,initialCollections:t=[],placeholder:i="Type collections separated by commas...",disabled:r=!1})=>{const n=y(u=>{var m;return((m=u.activeBoard)==null?void 0:m.boardDetails.boardCollections)||[]}),[c,a]=l.useState(Array.isArray(t)?t:[]),[d,o]=l.useState("");l.useEffect(()=>{const u=Array.isArray(t)?t:[],m=Array.isArray(c)?c:[];if(u.length>0&&m.length===0){const S=u.map(A=>{if(!A)return null;const T=A.startsWith("#")?A:`#${A}`;return n.find(w=>w.collectionName===T)||{collectionId:Date.now()+Math.random(),collectionName:T,price:"0",parentCollection:!0,collectionParentId:0,featured:!1,isNew:!0}}).filter(Boolean);a(S)}},[t,n]),l.useEffect(()=>{if(s&&Array.isArray(c)){const u=c.filter(m=>m&&m.collectionName).map(m=>m.collectionName);s(u)}},[c]);const x=u=>{u=Us(u),!(u&&!/[a-zA-Z0-9]/.test(u))&&(o(u),u.includes(",")&&(u.split(",").map(S=>S.trim()).filter(Boolean).forEach(p),o("")))},N=u=>{u.key==="Enter"&&d.trim()&&(u.preventDefault(),p(d.trim()),o(""))},p=u=>{if(!u)return;const m=u.startsWith("#")?u:`#${u}`;if((Array.isArray(c)?c:[]).some(w=>w&&w.collectionName===m))return;const U=n.find(w=>w&&w.collectionName===m)||{collectionId:Date.now(),collectionName:m,price:"0",parentCollection:!0,collectionParentId:0,featured:!1,isNew:!0};a(w=>[...Array.isArray(w)?w:[],U])},j=u=>{u&&a(m=>(Array.isArray(m)?m:[]).filter(A=>A&&A.collectionId!==u.collectionId))},g=Array.isArray(c)?c:[];return e.jsxs("div",{className:"w-full space-y-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(ne,{value:d,onChange:u=>x(u.target.value),onKeyDown:N,placeholder:i,disabled:r,className:"pr-8"}),e.jsx(Je,{className:"absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 transform text-gray-400"})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:g.filter(u=>u&&u.collectionName).map(u=>e.jsxs(q,{variant:"secondary",className:"flex items-center gap-1 bg-blue-100 px-2 py-1",children:[e.jsx(Je,{className:"h-3 w-3"}),u.collectionName.replace("#",""),u.isNew&&e.jsx("span",{className:"text-xs text-hb-brand-blue",children:"(new)"}),e.jsx("button",{onClick:()=>j(u),className:"ml-1 rounded-full p-0.5 hover:bg-gray-300",disabled:r,children:e.jsx(Ds,{className:"h-3 w-3"})})]},u.collectionId))}),n.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-sm text-neutral-600",children:"Here are some of the existing collections from your board to select:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:n.filter(u=>u&&u.collectionName&&!g.some(m=>m&&m.collectionId===u.collectionId)).map(u=>e.jsx(F,{variant:"outline",size:"sm",onClick:()=>p(u.collectionName),disabled:r,className:"h-6 rounded-full bg-neutral-100 px-3 text-xs",children:u.collectionName},u.collectionId))})]})]})},Wt=({customColors:s,onColorSelect:t,initialColor:i})=>{var d;const[r,n]=l.useState(i);l.useEffect(()=>{i&&i!==r&&n(i)},[i]),l.useEffect(()=>{r&&t&&t(r)},[r]);const c=(o,x="hex")=>{const N=x==="value"?Ke(o):o;N&&(n(N),t==null||t(N))},a=()=>{const o="random";n(o),t==null||t(o)};return e.jsxs("div",{children:[(s==null?void 0:s.length)>0&&e.jsx("ul",{className:"mb-2 flex w-full overflow-auto pr-2 sm:justify-start",children:s.map((o,x)=>e.jsx("li",{className:"ml-2 sm:ml-0 sm:mr-2",children:e.jsx("button",{type:"button",className:"flex h-6 w-6 items-center justify-center rounded-full border border-black border-opacity-10",style:{backgroundColor:o.background},onClick:()=>c(o.background),children:r===o.background&&e.jsx(Ce,{className:`${o.isDark?"text-white":"text-black"} h-3 w-3`})})},x.toString()))}),e.jsxs("ul",{className:"flex w-full justify-between overflow-auto pr-2 sm:justify-start",children:[e.jsx("li",{className:"ml-2 sm:ml-0 sm:mr-2",children:e.jsx(yt,{children:e.jsxs(wt,{children:[e.jsx(St,{asChild:!0,children:e.jsxs("div",{className:"relative flex h-6 w-6 cursor-pointer items-center justify-center overflow-hidden rounded-full",onClick:a,children:[e.jsx("img",{src:"/img/rainbow-color.png",alt:"Rainbow colors",className:"h-full w-full object-cover"}),r==="random"&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20",children:e.jsx(Ce,{className:"h-3 w-3 text-white drop-shadow-lg"})})]})}),e.jsx(Ct,{children:e.jsx("p",{children:"Randomize color for each hoot post"})})]})})}),(d=Ps)==null?void 0:d.map((o,x)=>e.jsx("li",{className:"ml-2 sm:ml-0 sm:mr-2",children:e.jsx("button",{type:"button",className:"flex h-6 w-6 items-center justify-center rounded-full border "+(o.name==="white"?"border-gray-500":"border-black border-opacity-10"),style:{backgroundColor:o.color},onClick:()=>c(o.colorValue,"value"),children:r===Ke(o.colorValue)&&e.jsx(Ce,{className:`${o.name==="white"?"text-black":"text-white"} h-3 w-3`})})},x.toString()))]})]})},Qt=({formData:s,handleInputChange:t})=>{const i=s==null?void 0:s.latitude,r=s==null?void 0:s.longitude,n=s==null?void 0:s.locationLabel,c=!!(i&&r),a=l.useMemo(()=>c?{formattedAddress:n||"",latitude:String(i),longitude:String(r)}:void 0,[c,i,r,n]),d=l.useCallback(x=>{x&&(t("latitude",x.latitude||""),t("longitude",x.longitude||""),t("locationLabel",x.formattedAddress||""),t("locationMode","point"))},[t]),o=n||(c?`${Number(i).toFixed(4)}, ${Number(r).toFixed(4)}`:"");return e.jsxs("div",{className:"space-y-2",children:[e.jsx(os,{showMap:!1,restrictToPlaces:!1,isRequired:!0,value:a,onUp
5date:d,placeholder:"Search for a city, county, or addressâ¦"}),c&&e.jsxs(H,{className:"flex items-start gap-2 border-emerald-200 bg-emerald-50 p-3 text-sm text-emerald-900",children:[e.jsx(Ge,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:o}),e.jsx("div",{className:"text-emerald-800/80",children:"Alerts active for this point will be posted."})]})]})]})},es={Extreme:"bg-red-100 text-red-900 ring-1 ring-red-200",Severe:"bg-orange-100 text-orange-900 ring-1 ring-orange-200",Moderate:"bg-amber-100 text-amber-900 ring-1 ring-amber-200",Minor:"bg-yellow-100 text-yellow-900 ring-1 ring-yellow-200",Unknown:"bg-neutral-100 text-neutral-700 ring-1 ring-neutral-200"};function ss(s){return es[s]??es.Unknown}function Zt(s){return s!=null&&s.latitude&&(s!=null&&s.longitude)?{ok:!0}:s!=null&&s.nwsZone?{ok:!0}:{ok:!1,reason:"Pick a location above first."}}const Yt=({formData:s})=>{const t=y(p=>{var j,g;return(g=(j=p.activeBoard)==null?void 0:j.boardDetails)==null?void 0:g.boardId}),[i,r]=l.useState(!1),[n,c]=l.useState(null),[a,d]=l.useState(null),o=Zt(s),x=async()=>{if(!t){c("Board not loaded yet â try again in a moment.");return}r(!0),c(null),d(null);try{const p=s!=null&&s.latitude&&(s!=null&&s.longitude)?"point":(s==null?void 0:s.locationMode)==="zone"?"zone":"point",j=await Ms(String(t),{locationMode:p,nwsZone:s==null?void 0:s.nwsZone,latitude:s==null?void 0:s.latitude,longitude:s==null?void 0:s.longitude,minSeverity:s==null?void 0:s.minSeverity,categories:Array.isArray(s==null?void 0:s.categories)?s.categories:void 0,excludeTypes:Array.isArray(s==null?void 0:s.excludeTypes)?s.excludeTypes:void 0,includeTestAlerts:!!(s!=null&&s.includeTestAlerts)});d(j)}catch(p){c((p==null?void 0:p.message)||"Preview failed")}finally{r(!1)}},N=a?["Extreme","Severe","Moderate","Minor","Unknown"].map(p=>{var j;return[p,((j=a.bySeverity)==null?void 0:j[p])??0]}).filter(([,p])=>p>0):[];return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(F,{type:"button",variant:"outline",onClick:x,disabled:i||!o.ok,children:i?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(ve,{className:"size-4"})," Checking NWSâ¦"]}):"Preview current alerts"}),!o.ok&&e.jsx("span",{className:"text-sm text-neutral-500",children:o.reason})]}),n&&e.jsx(pe,{variant:"destructive",children:e.jsx(ge,{children:n})}),a&&e.jsxs(H,{className:"space-y-4 border-neutral-200 p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-4 gap-y-1",children:[e.jsx("div",{className:"text-base font-semibold text-neutral-900",children:a.featureCount===0?"No alerts active here right now":`${a.featureCount} active alert${a.featureCount===1?"":"s"}`}),a.featureCount>0&&e.jsxs("div",{className:"text-sm text-neutral-600",children:["With your current filters,"," ",e.jsx("span",{className:"font-semibold text-neutral-900",children:a.wouldPostCount})," ","would post",a.wouldPostCount!==a.featureCount&&e.jsxs(e.Fragment,{children:[" ","(",a.featureCount-a.wouldPostCount," skipped by severity / category)"]}),"."]})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:N.map(([p,j])=>e.jsxs(q,{variant:"outline",className:`${ss(p)} text-sm font-medium`,children:[j," ",p]},p))}),a.sample.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium text-neutral-700",children:"Sample of what's active"}),e.jsx("ul",{className:"space-y-2",children:a.sample.map((p,j)=>e.jsxs("li",{className:"rounded-md border border-neutral-200 bg-neutral-50 p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(q,{variant:"outline",className:`${ss(p.severity)} text-sm`,children:p.severity}),e.jsx("span",{className:"text-sm font-semibold text-neutral-900",children:p.event}),p.category&&e.jsxs("span",{className:"text-sm text-neutral-500",children:["· ",p.category]}),p.wouldPost?e.jsx(q,{variant:"secondary",className:"ml-auto bg-emerald-100 text-emerald-900 ring-1 ring-emerald-200",children:"Would post"}):e.jsx(q,{variant:"outline",className:"ml-auto bg-neutral-100 text-neutral-600 ring-1 ring-neutral-200",children:"Skipped"})]}),p.headline&&e.jsx("div",{className:"mt-1 text-sm text-neutral-600",children:p.headline}),!p.wouldPost&&p.skippedReason&&e.jsx("div",{className:"mt-1 text-sm text-neutral-500 italic",children:p.skippedReason})]},`${p.event}-${j}`))})]}),e.jsxs("div",{className:"text-sm text-neutral-500",children:["Source: National Weather Service · checked"," ",new Date(a.fetchedAt).toLocaleTimeString()]})]})]})},Kt=s=>{if(!s)return!0;const t=s.toLowerCase();return t.includes("rss")||t.includes("feed")||t.includes("atom")||t.includes(".xml")},Jt='URL must contain "rss", "feed", "atom", or ".xml"',Oe=({field:s,handleInputChange:t,initialValue:i,formData:r})=>{const n=y(a=>{var d;
5return(d=a.activeBoard)==null?void 0:d.boardDetails.customHootThemeColors}),c=y(a=>{var d,o;return(o=(d=a.manageBoard)==null?void 0:d.settings)==null?void 0:o.preApproveHoots});if(s.id==="autoApproveHoots"&&c!==!0)return null;switch(s.type){case"select":return e.jsxs(de,{value:i,onValueChange:a=>t(s.id,a),required:s.isRequired,children:[e.jsx(ue,{children:e.jsx(xe,{placeholder:s.placeholder})}),e.jsx(me,{children:e.jsx(he,{children:s.options.map(a=>e.jsx(_,{value:a.value,children:a.label},a.value))})})]});case"radio":return e.jsx(ut,{value:i,onValueChange:a=>t(s.id,a),required:s.isRequired,children:s.options.map(a=>{const d=`${s.id}-${a.value}`;return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(xt,{value:a.value,id:d}),e.jsx(Z,{htmlFor:d,className:"font-normal text-neutral-700",children:a.label})]},a.value)})});case"multiSelect":return e.jsx(dt,{options:s.options,value:Array.isArray(i)?i:[],onChange:a=>t(s.id,a),placeholder:s.placeholder});case"hootColorSelector":return e.jsx(Wt,{customColors:n,initialColor:i,onColorSelect:a=>{t(s.id,a,s.type)}});case"hootCollectionsSelector":return e.jsx($t,{initialCollections:i,onSelectionChange:a=>{t(s.id,a)},placeholder:s.placeholder});case"gtfsCatalogPicker":return e.jsx(Ht,{formData:r,handleInputChange:t});case"gtfsScheduleInstancePicker":return e.jsx(Vt,{formData:r,handleInputChange:t});case"gtfsRealtimeFeedPicker":return e.jsx(Gt,{formData:r,handleInputChange:t});case"nwsLocationPicker":return e.jsx(Qt,{formData:r,handleInputChange:t});case"nwsZonePreview":return e.jsx(Yt,{formData:r});case"locationSelector":return e.jsx(os,{isRequired:s.isRequired,showMap:!1,restrictToPlaces:!0,initialValue:i,onUpdate:a=>t(s.id,a==null?void 0:a.formattedAddress)});case"checkbox":return e.jsx(mt,{checked:i||!1,onCheckedChange:a=>t(s.id,a),required:s.isRequired});default:return e.jsx(ne,{type:s.type,placeholder:s.placeholder,defaultValue:s.defaultValue,value:i,onChange:a=>{const d=a.target.value;if(s.type==="url"&&s.id==="feedUrl"){const o=Kt(d);a.target.setCustomValidity(o?"":Jt)}t(s.id,d)},max:s.max,min:1,required:s.isRequired})}},ts=({handleSubmit:s,setFormData:t})=>{const i=y(c=>c.integrations.selectedIntegration),r=y(c=>c.integrations.installIntegrationApiStatus),n=(c,a,d)=>{t(o=>{const x={...o,[c]:a};return d==="hootColorSelector"&&a&&(x.hootTextColor=He(a)?"#ffffff":"#000000"),x})};return e.jsxs("form",{onSubmit:s,className:"max-w-3xl space-y-6 lg:col-span-2",children:[e.jsx(H,{className:"border-neutral-200 bg-neutral-50 px-5 py-6",children:e.jsx("div",{className:"space-y-6",children:i.existingAccountSetupFields.map(c=>e.jsxs("div",{children:[e.jsx(Z,{className:"mb-2 block text-sm font-semibold text-neutral-700",children:c.label}),e.jsx(Oe,{field:c,handleInputChange:n}),c.info&&e.jsx("p",{className:"px-1 pt-2 text-sm text-neutral-500",children:c.info})]},c.id))})}),e.jsx(F,{type:"submit",disabled:r===L.PENDING,className:"mx-0.5 flex-1 px-4 py-2 font-semibold",children:r===L.PENDING?e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx(Le,{size:18,className:"mt-0.5 animate-spin"}),e.jsx("span",{children:i.isInstalled?"Adding new Configuration...":"Installing Integration..."})]}):i.isInstalled?"Add New Configuration":"Install Integration"})]})},Xt=({integrationName:s,setShowNewConnectionDialog:t,wasFirstInstallation:i})=>{const r=ie(),n=l.useContext(Ne),[c,a]=l.useState(!0);l.useEffect(()=>{i?n.trackInstalledAnIntegration({context:"Integrations & Services",integrationName:s}):n.trackAddedNewConnection({context:"Integrations & Services",integrationName:s})},[s,i,n]),l.useEffect(()=>{t(!1)},[]);const d=()=>{a(!1),r(k.resetInstallIntegrationResponse()),r(k.resetGetPluginIdResponse())};return e.jsx(ke,{open:c,onOpenChange:o=>!o&&d(),children:e.jsxs(Ae,{children:[e.jsxs(Te,{className:"mb-2 space-y-1",children:[e.jsxs(je,{className:"flex flex-col items-center gap-2.5 text-center leading-6",children:[e.jsx("video",{className:"payment-complete-video",src:"/assets/payment-success-animation.webm",autoPlay:!0,muted:!0}
5),i?e.jsxs("span",{children:[s," is installed successfully"]}):e.jsxs("span",{children:["New connection is successfully added to your ",s," Integration"]})]}),e.jsx(Ie,{className:"text-center",children:"Please allow some time for the data to sync and become available."})]}),e.jsx(Rs,{className:"sm:justify-center",children:e.jsx(F,{onClick:d,variant:"outline",children:"Close"})})]})})},Dt=({instanceName:s,showInstanceDeleteConfirm:t,setShowInstanceDeleteConfirm:i,deleteInstance:r,isDeleting:n})=>e.jsx(xs,{open:t,onOpenChange:()=>i(!1),children:e.jsxs(ms,{children:[e.jsxs(hs,{children:[e.jsxs(ps,{children:["Are you sure you want to delete ",s," configuration?"]}),e.jsx(gs,{children:"This will permanently delete this setup. This action cannot be undone."})]}),e.jsxs(fs,{children:[e.jsx(bs,{onClick:()=>i(!1),children:"Cancel"}),e.jsx(js,{onClick:r,disabled:n,children:n?"Deleting...":"Delete"})]})]})}),Ve=(s,t)=>s?Object.entries(s).every(([i,r])=>(t==null?void 0:t[i])===r):!0;function ys(s,t,i={}){if(!Array.isArray(s))return!0;for(const r of s){if(!r||!r.isRequired||r.id==="autoApproveHoots"&&i.requireHootsApproval!==!0||!Ve(r.showIf,t))continue;const n=t==null?void 0:t[r.id];if(r.type==="checkbox"){if(n!==!0)return!1;continue}if(r.type==="multiSelect"){if(!Array.isArray(n)||n.length===0)return!1;continue}if(n==null||typeof n=="string"&&n.trim()===""||Array.isArray(n)&&n.length===0)return!1}return!0}const en=(s,t)=>{if(!s&&!t)return!0;if(!s||!t)return!1;const i=Object.keys(s),r=Object.keys(t),n=new Set([...i,...r]);for(const c of n){const a=s[c],d=t[c];if(a===void 0&&d===void 0||a===null&&d===null)continue;const o=a===void 0?"":a,x=d===void 0?"":d;if(typeof o=="object"&&typeof x=="object"){if(JSON.stringify(o)!==JSON.stringify(x))return!1}else if(o!==x)return!1}return!0},sn=({integration:s,formData:t,setFormData:i,onSubmit:r,isLoading:n,setShowInstanceDeleteConfirm:c,originalInstanceData:a})=>{const[d,o]=l.useState(!1),x=y(u=>{var m,S;return(S=(m=u.manageBoard)==null?void 0:m.settings)==null?void 0:S.preApproveHoots}),N=(u,m,S)=>{i(A=>{const T={...A,[u]:m};return S==="hootColorSelector"&&m&&(T.hootTextColor=He(m)?"#ffffff":"#000000"),T})},p=u=>{u.preventDefault(),Ns(s,t)&&r(t)},j=u=>{i(m=>({...m,configName:u}))},g=n||en(t,a)||!ys(s==null?void 0:s.fields,t,{requireHootsApproval:x===!0});return e.jsxs("form",{onSubmit:p,className:"space-y-4",children:[e.jsxs(H,{
5className:"border-neutral-200 bg-white px-5 pb-6 pt-4",children:[e.jsx(qe,{configName:t.configName||"",setConfigName:j,isEditingTabName:d,setIsEditingTabName:o}),e.jsx("div",{className:"space-y-6 pt-4",children:s.fields.map(u=>u.id==="autoApproveHoots"&&x!==!0||!Ve(u.showIf,t)?null:e.jsxs("div",{children:[e.jsx(Z,{className:"block text-sm font-semibold text-neutral-700",children:u.label}),u.info&&e.jsx("p",{className:"mb-2 text-sm text-neutral-500",children:u.info}),e.jsx(Oe,{field:u,handleInputChange:N,initialValue:t[u.id],formData:t})]},u.id))})]}),e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx(F,{type:"button",onClick:c,variant:"secondary",children:"Delete Connection"}),e.jsx(F,{type:"submit",disabled:g,className:"px-6 font-semibold",children:n?e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx(Le,{size:18,className:"animate-spin"}),e.jsx("span",{children:"Updating..."})]}):"Update Configuration"})]})]})},tn=({instance:s,integration:t,showEditDialog:i,setShowEditDialog:r,boardId:n})=>{var U;const c=ie(),a=l.useContext(Ne),d=y(w=>w.integrations.updateInstanceApiStatus),o=y(w=>w.integrations.deleteInstanceApiStatus),[x,N]=l.useState({}),[p,j]=l.useState(!1),[g,u]=l.useState(null);l.useEffect(()=>{s!=null&&s.config&&N({...s.config})},[s==null?void 0:s._id]),l.useEffect(()=>{d===L.FULFILLED&&(c(k.updateIntegrationAfterInstanceUpdate({integrationId:s.integrationId,instanceId:s._id,updatedConfig:x})),te({title:"Connection Updated Successfully!"}),a.trackUpdatedExistingConnection({context:"Integrations & Services",integrationName:t==null?void 0:t.name}),r(!1),c(k.resetInstanceRelatedStates()))},[d,x,s.integrationId,s._id,r]),l.useEffect(()=>{o===L.FULFILLED&&(c(k.updateIntegrationAfterInstanceDelete({integrationId:s.integrationId,instanceId:s._id})),j(!1),u(null),te({title:"Connection Deleted Successfully!"}),a.trackDeletedExistingConnection({context:"Integrations & Services",integrationName:t==null?void 0:t.name}),c(k.resetDeleteInstanceStates()),r(!1))},[o,s.integrationId,s._id,r]);const m=w=>{const z={...w};c(k.updateInstance({boardId:n,instanceId:s._id,config:z}))},S=()=>{u(s),j(!0)},A=()=>{c(k.deleteInstance({boardId:n,instanceId:s._id}))},T=()=>{r(!1),N({}),j(!1),u(null),c(k.resetInstanceRelatedStates())};return e.jsxs(e.Fragment,{children:[p&&g&&e.jsx(Dt,{instanceName:(U=g==null?void 0:g.config)==null?void 0:U.configName,showInstanceDeleteConfirm:p,setShowInstanceDeleteConfirm:j,deleteInstance:A,isDeleting:o===L.PENDING}),e.jsx(ke,{open:i,onOpenChange:w=>!w&&T(),children:e.jsx(Ae,{className:"flex max-h-[calc(100vh-4rem)] max-w-2xl flex-col gap-0 overflow-hidden p-0",onInteractOutside:w=>{w.composedPath().some(G=>"classList"in G?Array.from(G.classList).includes("pac-container"):!1)&&w.preventDefault()},children:e.jsxs("div",{className:"flex flex-col gap-3 overflow-y-auto p-6",children:[e.jsxs(Te,{children:[e.jsxs("div",{className:"mb-2 flex items-center space-x-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl border border-neutral-200 bg-white shadow-sm",children:e.jsx("img",{src:t.icon,className:"rounded-lg",alt:t.name})}),e.jsx("h1",{className:"text-xl font-semibold leading-7 text-neutral-900",children:t.name})]}),e.jsx(je,{className:"leading-3",children:"Edit Connection"}),e.jsxs(Ie,{children:["Update your integration settings for ",s.config.configName]})]}),e.jsx(sn,{integration:t,formData:x,setFormData:N,onSubmit:m,isLoading:d===L.PENDING,setShowInstanceDeleteConfirm:S,originalInstanceData:s==null?void 0:s.config})]})})})]})},nn=({integration:s})=>{var d,o;const t=y(x=>{var N;return(N=x.activeBoard)==null?void 0:N.boardDetails.boardId}),[i,r]=l.useState(!1),[n,c]=l.useState(null);if(!((d=s==null?void 0:s.instances)!=null&&d.length))return null;const a=x=>{c(x),r(!0)};return e.jsxs(e.Fragment,{children:[i&&n&&e.jsx(tn,{instance:n,integration:s,showEditDialog:i,setShowEditDialog:r,boardId:t}),(o=s==null?void 0:s.instances)==null?void 0:o.map((x,N)=>e.jsxs(H,{className:"min-w-72",children:[e.jsxs(_s,{className:"flex flex-row items-center gap-2 border-b border-neutral-200 pb-3 pt-2",children:[e.jsx("div",{className:"h-fit w-max bg-white",children:e.jsx(et,{size:28,className:"text-slate-600",strokeWidth:1.5})}),e.jsxs("div",{className:"-space-y-0.5",children:[e.jsx(qs,{className:"text-base",children:x.config.configName}),e.jsx(Hs,{children:"Configuration"})]})]}),e.jsx(zs,{className:"lg:px-2 lg:py-3",children:e.jsx(F,{variant:"secondary",className:"w-full font-semibold",onClick:()=>a(x),children:"Edit Connection"})})]},x._id||N))]})},rn={cityguide:"Cityguide kiosk",wayfinding:"Wayfinding","digital-signage":"Digital signage","hootboard-feed":"HootBoard feed","transit-app":"Transit app",mailchimp:"Mailchimp audience"};function ln(s){return rn[s]||s}function an({stream:s}){const t=s.direction==="output",i=s.defaultConsumers||[];return e.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white p-4",children:[e.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold text-neutral-900",children:s.name}),e.jsxs("span",{className:t?"inline-flex items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-800":"inline-flex items-center gap-1 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-800",children:[t?e.jsx(st,{className:"h-3 w-3"}):e.jsx(tt,{className:"h-3 w-3"}),t?"Output":"Input"]})]}),s.defaultEnabled===!1&&e.jsx("span",{className:"rounded-full border border-neutral-200 bg-neutral-50 px-2 py-0.5 text-xs text-neutral-600",children:"Coming soon"})]}),s.description&&e.jsx("p",{className:"mb-3 text-sm text-neutral-600",children:s.description}),i.length>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-neutral-500",children:t?"Sends to:":"Powers:"}),i.map(r=>e.jsx("span",{className:"rounded-full border border-neutral-200 bg-neutral-50 px-2 py-0.5 text-xs text-neutral-700",children:ln(r)},r))]})]})}const cn=({integration:s})=>{const t=Array.isArray(s==null?void 0:s.streams)?s.streams:[];return t.length===0?null:e.jsxs("section",{className:"mb-2 pb-6",children:[e.jsx("h2",{className:"mb-3 text-lg font-semibold text-neutral-900",children:"What you'll get"}),e.jsx("div",{className:"grid max-w-4xl grid-cols-1 gap-3 sm:grid-cols-2",children:t.map(i=>e.jsx(an,{stream:i},i.id))})]})},ns=({handleSubmit:s,formData:t,setFormData:i,configNameInput:r})=>{const n=y(x=>x.integrations.selectedIntegration),c=y(x=>x.integrations.installIntegrationApiStatus),a=y(x=>x.integrations.getYodelPluginIdApiStatus),d=y(x=>{var N,p;return(p=(N=x.manageBoard)==null?void 0:N.settings)==null?void 0:p.preApproveHoots}),o=(x,N,p)=>{i(j=>{const g={...j,[x]:N};return p==="hootColorSelector"&&N&&(g.hootTextColor=He(N)?"#ffffff"
5:"#000000"),g})};return e.jsxs("form",{onSubmit:s,className:"max-w-3xl space-y-3 lg:col-span-2",children:[e.jsxs(H,{className:"border-neutral-200 bg-white px-5 pb-6 pt-4",children:[r,e.jsx("div",{className:"space-y-6 pt-4",children:n.fields.map(x=>x.id==="autoApproveHoots"&&d!==!0||!Ve(x.showIf,t)?null:e.jsxs("div",{children:[e.jsx(Z,{className:"block text-sm font-semibold text-neutral-700",children:x.label}),x.info&&e.jsx("p",{className:"mb-2 text-sm text-neutral-500",children:x.info}),e.jsx(Oe,{field:x,handleInputChange:o,initialValue:t[x.id],formData:t})]},x.id))})]}),e.jsx(F,{type:"submit",disabled:c===L.PENDING||a===L.PENDING||!ys(n==null?void 0:n.fields,t,{requireHootsApproval:d===!0}),className:"mx-0.5 flex-1 px-4 py-2 font-semibold",children:c===L.PENDING||a===L.PENDING?e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx(Le,{size:18,className:"mt-0.5 animate-spin"}),e.jsx("span",{children:n.isInstalled?"Adding new Setup...":"Installing Integration..."})]}):n.isInstalled?"Add New Setup":"Install Integration"})]})},on="hb-local-events-4b0932ef-044b-4c06-bc07-89b969f2584b",dn=({onBack:s,boardId:t})=>{var D;const i=ie(),r=l.useContext(Ne),n=y(b=>b.integrations.selectedIntegration),c=y(b=>b.integrations.getYodelPluginIdResponse),a=y(b=>b.integrations.getYodelPluginIdApiStatus),d=y(b=>b.integrations.installIntegrationResponse),o=y(b=>b.integrations.installIntegrationApiStatus),x=y(b=>{var I,f;return(f=(I=b.manageBoard)==null?void 0:I.settings)==null?void 0:f.preApproveHoots}),N=y(b=>b.integrations.deleteInstanceApiStatus),p=y(b=>b.integrations.uninstallIntegrationApiStatus),j=y(b=>b.integrations.installIntegrationError),g=(n==null?void 0:n.singleInstance)===!0&&Array.isArray(n==null?void 0:n.instances)&&n.instances.length>=1,[u,m]=l.useState({}),[S,A]=l.useState("new-configuration"),[T,U]=l.useState("My New Connection"),[w,z]=l.useState(!1),[G,M]=l.useState(!1),[X,Y]=l.useState(!1),[K,V]=l.useState(!1),P=(b="My New Connection")=>{const I={},f=n.fields.some(v=>v.type==="hootColorSelector");if(n.fields.forEach(v=>{v.id==="autoApproveHoots"&&x!==!0?I[v.id]=!0:v.id==="autoApproveHoots"&&x===!0||v.type==="checkbox"?I[v.id]=v.defaultValue??!1:v.type==="multiSelect"?I[v.id]=v.defaultValue??[]:I[v.id]=v.defaultValue??""}),f){for(const v of n.fields)v.type==="hootColorSelector"&&(I[v.id]===void 0||I[v.id]==="")&&(I[v.id]=v.id==="hootTextColor"?"#ffffff":"random");I.hootBgColor===void 0&&(I.hootBgColor="random"),I.hootTextColor===void 0&&(I.hootTextColor="#ffffff")}return I.configName=b,I};l.useEffect(()=>{n.name&&r.trackViewedIntegrationDetails({context:"Integrations & Services",integrationName:n.name})},[n.name,r]),l.useEffect(()=>{const b=P(T);m(b)},[n.id,n.fields]),l.useEffect(()=>{m(b=>({...b,configName:T}))},[T]),l.useEffect(()=>{if(N===L.FULFILLED||p===L.FULFILLED){const b=P("My New Connection");m(b),U("My New Connection"),A("new-configuration")}},[N,p,n.fields]);const J=()=>n.id===on,fe=()=>{const b=P("My New Connection");m(b),U("My New Connection"),A("new-configuration"),Y(!0)},R=async b=>{if(b.preventDefault(),!Ns(n,u))return;const I=!n.isInstalled;if(V(I),J()){i(k.getYodelPluginId({boardId:t,config:u}));return}i(k.installIntegration({boardId:t,integrationId:n.id,config:u}))};l.useEffect(()=>{c!=null&&c.id&&J()&&(i(k.installIntegration({boardId:t,integrationId:n.id,config:{yodelPluginId:c.id,...u}})),i(k.resetGetPluginIdResponse()))},[c==null?void 0:c.id]),l.useEffect(()=>{if(o===L.FULFILLED&&(d!=null&&d.data)){const b=d==null?void 0:d.data;i(k.updateIntegrationAfterInstall({integrationId:n.id,newInstance:b}))}},[o,d,n.id]);const re=b=>{m({}),A(b)},$=()=>{i(k.uninstallIntegration({boardId:t,integrationId:n.id}))};return l.useEffect(()=>{if(o===L.REJECTED||a===L.REJECTED){const b=(j==null?void 0:j.status)===409;te({variant:"destructive",title:b?"Can't install":"Something went wrong!",description:(j==null?void 0:j.message)||"Please try again later or contact support."})}},[o,a,j]),e.jsxs("div",{className:"min-h-screen rounded-xl border border-neutral-100 bg-neutral-50",children:[e.jsx(Mt,{integrationName:n==null?void 0:n.name,integrationId:n==null?void 0:n.id,showDeleteConfirm:G,setShowDeleteConfirm:M,onDeleteConfirm:$}),o===L.FULFILLED&&e.jsx(Xt,{integrationName:n==null?void 0:n.name,setShowNewConnectionDialog:Y,wasFirstInstallation:K}),e.jsxs("div",{className:"mx-auto max-w-4xl py-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("button",{onClick:s,className:"mb-10 flex items-center space-x-2 text-neutral-600 transition-colors hover:text-neutral-900",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:"Back to integrations"})]}),e.jsxs("div",{className:"flex items-start space-x-4",children:[e.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-xl border border-neutral-200 bg-white shadow-sm",children:e.jsx("img",{src:n.icon,className:"rounded-lg",alt:n.name})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold leading-7 text-neutral-900",children:n.name}),e.jsxs("p",{className:"flex items-center space-x-1 text-sm text-neutral-500",children:[e.jsx("span",{className:"font-semibold",children:"By HootBoard"}),e.jsx(us,{size:18,className:"fill-slate text-white"})]})]})]}),e.jsxs("div",{className:"mb-4 mt-2",children:[e.jsx("p",{className:"text-neutral-500",children:n.description}),n.poweredBy&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ce,{size:16,strokeWidth:4,className:"rounded-full bg-amber-500 p-0.5 text-white"}),e.jsxs("p",{className:"text-sm font-semibold text-neutral-700",children:["Powered by ",n.poweredBy]})]})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[n.isInstalled?e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"pointer-events-none flex items-center justify-center space-x-1.5 rounded-full border border-lime-400 bg-lime-50 px-4 py-1 text-lime-900",children:e.jsx("span",{className:"text-xs font-semibold",children:"Installed"})}),e.jsxs("div",{className:"flex cursor-pointer items-center space-x-1 rounded-lg border border-neutral-300 bg-white px-4 py-1 text-neutral-900",onClick:()=>M(!0),children:[e.jsx(it,{size:13}),e.jsx("span",{className:"pt-0.5 text-xs font-semibold",children:"Uninstall"})]})]}):e.jsxs("div",{className:"pointer-events-none flex items-center space-x-2 rounded-full border border-neutral-200 bg-neutral-100 px-3 py-1 text-neutral-600",children:[e.jsx(rt,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm font-semibold",children:"Not installed"})]}),n.hasManagement&&n.isInstalled&&e.jsxs("div",{className:"flex cursor-pointer items-center space-x-1.5 rounded-full border border-sky-300 bg-sky-50 px-5 py-1 text-sky-800",children:[e.jsx(lt,{size:16}),e.jsx("span",{className:"text-sm font-semibold",children:"Manage Integration"})]})]})]}),e.jsxs("div",{className:"mb-2 pb-6 pt-4",children:[e.jsx("h2",{className:"mb-1 text-lg font-semibold text-neutral-900",children:"How it works"}),e.jsx("p",{className:"leading-relaxed text-neutral-600",children:n.howItWorks}),n.learnMoreUrl&&e.jsx("div",{className:"mt-4",children:e.jsxs("a",{href:n.learnMoreUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-base text-hb-brand-blue hover:underline",children:[n.learnMoreLabel||"Learn More",e.jsx(ds,{className:"h-4 w-4"})]})})]}),e.jsx(cn,{integration:n}),n.instances.length>0&&e.jsxs("section",{children:[e.jsxs("div",{className:"px-1 py-3 font-semibold text-neutral-600",children:["Existing Connections (",(D=n==null?void 0:n.instances)==null?void 0:D.length,")"]}),e.jsxs("div",{className:"grid max-w-6xl grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsx(nn,{integration:n}),!g&&e.jsx(Pt,{setShowNewConnectionDialog:()=>fe()})]}),g&&e.jsxs("p",{className:"mt-3 text-sm text-neutral-500",children:[n.name," can only be installed once per board. Uninstall the existing connection above to create a new one."]})]}),X&&e.jsx(Ut,{integration:n,setShowNewConnectionDialog:Y,dialogContent:e.jsxs(Be,{value:S,className:"w-full",onValueChange:re,children:[n.allowExistingAccountSetup&&e.jsxs(_e,{className:"w-auto",children:[e.jsx(ce,{value:"new-configuration",className:"flex items-center gap-2 px-6 pb-2 font-semibold",children:"New Connection"}),e.jsx(ce,{value:"connect-existing-account",className:"px-8 font-semibold",children:"Connect Existing Account"})]}),e.jsx(oe,{value:"new-configuration",children:e.jsx(ns,{handleSubmit:R,formData:u,setFormData:m,configNameInput:e.jsx(qe,{configName:T,setConfigName:U,isEditingTabName:w,setIsEditingTabName:z})})}),e.jsx(oe,{value:"connect-existing-account",children:e.jsx(ts,{handleSubmit:R,setFormData:m})})]})}),n.instances.length===0&&e.jsxs(Be,{value:S,className:"w-full",onValueChange:re,children:[n.allowExistingAccountSetup&&e.jsxs(_e,{className:"w-auto",children:[e.jsx(ce,{value:"new-configuration",className:"flex items-center gap-2 px-6 pb-2 font-semibold",children:"New Connection"}),e.jsx(ce,{value:"connect-existing-account",className:"px-8 font-semibold",children:"Connect Existing Account"})]}),e.jsx(oe,{value:"new-configuration",children:e.jsx(ns,{handleSubmit:R,formData:u,setFormData:m,configNameInput:e.jsx(qe,{configName:T,setConfigName:U,isEditingTabName:w,setIsEditingTabName:z})})}),e.jsx(oe,{value:"connect-existing-account",children:e.jsx(ts,{handleSubmit:R,setFormData:m})})]})]})]})},un=[{integration:"Mailchimp",featureId:"FB_48"},{integration:"The Events Calendar",featureId:"FB_49"},{integration:"Simpleview",featureId:"FB_53"},{integration:"Tempest",featureId:"FB_54"},{integration:"GTFS Feed",featureId:"FB_169"},{integration:"Curated Local Events",featureId:"FB_191"},{integration:"Localist",featureId:"FB_192"}],is=({integration:s,setShowCustomIntegrationDialog:t})=>{const i=ie(),r=d=>{const o=Array.isArray(d.fields)&&d.fields.length>0,x=d.provisioningMode==="managed"||d.isCustomIntegration&&!o;if(d.isInstalled&&d.isCustomIntegration&&!o&&d.provisioningMode!=="self-serve")return te({title:"This is a Custom Integration!",description:"This integration is custom-built for your board. Please contact HootBoard Support for any modifications or changes."});x&&t?t(d):i(k.setSelectedIntegration(d))},n=un.find(d=>d.integration===s.name),c=n==null?void 0:n.featureId,a=(d=!1,o)=>e.jsxs("div",{className:"relative h-full cursor-pointer rounded-lg border border-neutral-200 bg-neutral-50 p-4 transition-all duration-200 hover:border-neutral-300 hover:bg-neutral-100 hover:shadow-sm",onClick:x=>
5{if(d){x.stopPropagation();return}r(s)},children:[e.jsx("div",{className:"mb-4 flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"flex items-center justify-center rounded-lg bg-neutral-100 transition-colors group-hover:bg-neutral-200",children:e.jsx("img",{src:s.icon,className:"h-10 w-10 rounded-full object-contain",alt:"integration-item"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold leading-5 text-neutral-900 text-nowrap",children:[s.name," ",e.jsx("span",{className:"px-1",children:o})]}),e.jsxs("p",{className:"flex items-center space-x-0.5 text-xs text-neutral-500",children:[e.jsx("span",{children:"By HootBoard"}),e.jsx(us,{size:16,className:"fill-slate text-white"})]})]})]})}),e.jsx("p",{className:"mb-4 text-sm text-neutral-600 antialiased",children:s.description}),e.jsxs("div",{className:"flex gap-2",children:[s.isInstalled&&e.jsx(q,{className:Bs("pointer-events-none border-lime-300 bg-lime-50 text-xs text-lime-900"),children:"Installed"}),e.jsx(q,{className:"pointer-events-none border-amber-200 bg-amber-50 text-xs text-amber-950",children:s.category})]})]});return c?e.jsx(It,{featureId:c,render:d=>{var x;const o=((x=d.constraints)==null?void 0:x.behavior)==="block";return a(o,d.upgradeBadge)}}):a()},xn=()=>{const s=ie(),t=l.useContext(Ne),i=y(m=>{var S;return(S=m.activeBoard)==null?void 0:S.boardDetails.boardId}),r=y(m=>m.integrations.integrationsData),n=y(m=>m.integrations.integrationsApiStatus),c=y(m=>m.integrations.selectedIntegration),a=y(m=>m.integrations.navigateToIntegrationsTab);l.useEffect(()=>{n!==L.FULFILLED&&s(k.fetchIntegrations(i)),t.trackViewedIntegrationsAndServices({context:"Integrations & Services"})},[i]),l.useEffect(()=>(s(k.setSelectedIntegration(null)),()=>{s(k.setSelectedIntegration(null))}),[s]);const[d,o]=l.useState(""),[x,N]=l.useState(null),p=l.useMemo(()=>{const m=d.trim().toLowerCase();return m?r.filter(S=>S.name.toLowerCase().includes(m)||S.description.toLowerCase().includes(m)||(S.category||"").toLowerCase().includes(m)):r},[r,d]),j=l.useMemo(()=>p.filter(m=>m.isInstalled),[p]),g=l.useMemo(()=>p.filter(m=>!m.isInstalled),[p]);if(l.useEffect(()=>{a.status&&a.integrationName&&(o(a.integrationName),s(k.navigateToIntegrationsCompleted()))},[a.status,a.integrationName]),c)return e.jsx(dn,{onBack:()=>s(k.setSelectedIntegration(null)),boardId:i});const u=n===L.PENDING||n===L.IDLE;return e.jsxs("section",{className:"mx-1",children:[e.jsx("p",{className:"mb-6 text-sm text-neutral-500",children:"Connect HootBoard to the tools and data sources your board relies on."}),e.jsx("div",{className:"mb-10",children:e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(ze,{className:"absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-neutral-400"}),e.jsx("input",{type:"text",placeholder:"Search integrations, categories, or descriptions...",value:d,onChange:m=>o(m.target.value),className:"w-full rounded-full border border-neutral-300 py-2.5 pl-10 pr-4 text-sm transition-all placeholder:text-sm placeholder:text-neutral-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-hb-brand-blue/40"})]})}),u?e.jsxs("div",{className:"flex items-center justify-evenly gap-6 rounded-xl",children:[e.jsx(Ue,{className:"h-48 w-full"}),e.jsx(Ue,{className:"h-48 w-full"}),e.jsx(Ue,{className:"h-48 w-full"})]}):e.jsxs(e.Fragment,{children:[j.length>0&&e.jsxs("section",{className:"mb-12",children:[e.jsxs("header",{className:"mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-100 text-green-700",children:e.jsx(at,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold leading-5 text-neutral-900",children:"Installed integrations"}),e.jsxs("p",{className:"text-sm text-neutral-500",children:[j.length," active integration",j.length!==1?"s":""]})]})]}),e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:j.map(m=>e.jsx(is,{integration:m},m.id))})]}),g.length>0&&e.jsxs("section",{className:"mb-12",children:[e.jsxs("header",{className:"mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-blue-100 text-blue-600",children:e.jsx(ct,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold leading-5 text-neutral-900",children:"Available integrations"}),e.jsxs("p",{className:"text-sm text-neutral-500",children:[g.length," integration",g.length!==1?"s":""," to explore"]})]})]}),e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:g.map(m=>e.jsx(is,{integration:m,setShowCustomIntegrationDialog:N},m.id))})]}),p.length===0&&n===L.FULFILLED&&e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 text-center",children:[e.jsx(ot,{className:"h-10 w-10 text-neutral-300"}),e.jsx("div",{className:"text-base font-medium text-neutral-700",children:d?"No integrations match your search":"No integrations are available yet"}),d&&e.jsx("button",{type:"button",onClick:()=>o(""),className:"text-sm text-hb-brand-blue hover:underline",children:"Clear search"})]})]}),x!==null&&e.jsx(Ft,{customIntegration:x,setShowCustomIntegrationDialog:N})]})},Ti=()=>e.jsx(Is,{title:"Integrations",showDeleteBtn:!1,showSaveBtn:!1,children:e.jsx(ks,{children:e.jsx(xn,{})})});export{Ti as default};
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.