1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,390152,e=>{"use strict";var t=e.i(365577);e.s(["Plug",()=>t.default])},395880,211389,12595,621683,902023,193046,894685,622908,447737,752270,463363,460396,798667,e=>{"use strict";var t=e.i(50270),r=e.i(216576);let n=e=>t.z.string().min(1,`${e} is required`).refine(e=>null===(0,r.lintEmbedCode)(e),e=>({message:(0,r.lintEmbedCode)(e)??"Invalid snippet"}));t.z.object({communityId:t.z.string().min(1,"Fortress Property ID is required"),floorplanNameMap:t.z.record(t.z.string()).optional()}),t.z.object({code:n("Script code"),position:t.z.enum(["head","body_start","body_end"]).default("body_end")}),t.z.object({code:n("Embed code")}),t.z.object({html:n("HTML content"),page:t.z.enum(["all","homepage","amenities","floor-plans","gallery","contact"]).default("all")}),t.z.object({}).passthrough(),t.z.object({hubId:t.z.string().min(1,"HubSpot Hub ID is required").optional()}),t.z.object({embedHtml:t.z.string().min(1,"Mailchimp embed code is required").optional()}),t.z.object({measurementId:t.z.string().regex(/^G-[A-Z0-9]+$/,"GA4 Measurement ID looks like G-XXXXXXXXXX").optional()}),t.z.object({pixelId:t.z.string().regex(/^\d+$/,"Meta Pixel ID is numeric").optional()}),t.z.object({countyFips:t.z.string().regex(/^\d{5}$/,"County FIPS code must be 5 digits").optional(),year:t.z.coerce.number().int().min(2020).max(2100).optional()});let a=[{key:"walk_score",comingSoon:!0,label:"Walk Score",description:"Show walk / bike / transit scores on property pages",shortBlurb:"Walkability scores",category:"maps",icon:"Footprints",scope:"both",mode:"server_proxy",defaultRenderPosition:"map_embed",maxPerProperty:1,secretFields:[{key:"apiKey",label:"Walk Score API Key",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",helpText:"Get one free at walkscore.com/professional/api.php",required:!0}]},{key:"hubspot",comingSoon:!0,label:"HubSpot",description:"Connect a HubSpot portal for blog posts and tracking",shortBlurb:"Blog + tracking",category:"marketing",icon:"Megaphone",logoUrl:"https://cdn.simpleicons.org/hubspot",scope:"both",mode:"server_proxy",defaultRenderPosition:"tracking",maxPerProperty:1,secretFields:[{key:"privateAppToken",label:"HubSpot Private App Token",placeholder:"pat-â¢â¢â¢â¢â¢â¢â¢â¢",helpText:"Create a Private App in HubSpot with content + tracking scopes.",required:!0}],propertyDataPoints:[{key:"hubId",type:"text",label:"HubSpot Hub ID",placeholder:"12345678",helpText:"Used by the tracking script. Find in your HubSpot account URL.",required:!0}]},{key:"mailchimp",comingSoon:!0,label:"Mailchimp",description:"Newsletter signup using Mailchimp's official embed",shortBlurb:"Newsletter signup",category:"marketing",icon:"Mail",logoUrl:"https://cdn.simpleicons.org/mailchimp/9F7A00",scope:"property_only",mode:"client_inject",defaultRenderPosition:"newsletter_form",maxPerProperty:1,secretFields:[],propertyDataPoints:[{key:"embedHtml",type:"textarea",label:"Mailchimp embed code",placeholder:'<div id="mc_embed_shell">...</div>',helpText:"In Mailchimp: Audience â Signup forms â Embedded forms â copy the code and paste it here.",required:!0}]},{key:"ga4",comingSoon:!0,label:"Google Analytics 4",description:"Add a GA4 measurement ID to track property visits",shortBlurb:"GA4 tracking",category:"analytics",icon:"BarChart3",logoUrl:"https://cdn.simpleicons.org/googleanalytics",scope:"both",mode:"client_inject",defaultRenderPosition:"tracking",maxPerProperty:1,secretFields:[],propertyDataPoints:[{key:"measurementId",type:"text",label:"Measurement ID",placeholder:"G-XXXXXXXXXX",required:!0}]},{key:"meta_pixel",comingSoon:!0,label:"Meta Pixel",description:"Facebook / Instagram conversion tracking",shortBlurb:"Meta tracking",category:"analytics",icon:"Activity",logoUrl:"https://cdn.simpleicons.org/meta",scope:"both",mode:"client_inject",defaultRenderPosition:"tracking",maxPerProperty:1,secretFields:[],propertyDataPoints:[{key:"pixelId",type:"text",label:"Pixel ID",placeholder:"123456789012345",required:!0}]},{key:"hud_ami",comingSoon:!0,label:"HUD Income Limits (AMI)",description:"Income calculator using HUD's published AMI data",shortBlurb:"AMI / income calculator",category:"affordable_housing",icon:"Calculator",scope:"both",mode:"server_proxy",defaultRenderPosition:"calculator_embed",maxPerProperty:1,secretFields:[{key:"apiToken",label:"HUD User API Token",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",helpText:"Free token at https://www.huduser.gov/portal/dataset/fmr-api.html",required:!0}],propertyDataPoints:[{key:"countyFips",type:"text",label:"County FIPS code",placeholder:"06037",helpText:"5-digit FIPS code for this property's county.",required:!0}]},{key:"custom_script",label:"Custom Script",description:"Inject a custom JavaScript snippet into the page",category:"custom",icon:"Code",scope:"property_only",mode:"client_inject",defaultRenderPosition:"tracking",maxPerProperty:10,secretFields:[],configFields:[{key:"code",type:"textarea",label:"Script Co
1de",placeholder:'<script src="https://example.com/tracker.js"></script>',helpText:"Paste the full <script>...</script> tag(s) provided by your vendor, exactly as given â including any leading comment line. Runs on every page of this property.",required:!0},{key:"position",type:"select",label:"Position",helpText:"Where in the HTML document the script is injected",options:[{value:"head",label:"Head (renders at top of body)"},{value:"body_start",label:"Body Start"},{value:"body_end",label:"Body End (default)"}]}]},{key:"custom_html",label:"Custom HTML",description:"Embed custom HTML content (widgets, iframes, etc.)",category:"custom",icon:"FileCode",scope:"property_only",mode:"client_inject",defaultRenderPosition:"homepage_embed",maxPerProperty:10,secretFields:[],configFields:[{key:"html",type:"textarea",label:"HTML Content",placeholder:"<div>...</div>",helpText:"Renders as-is on the page. Supports iframes, divs, etc.",required:!0},{key:"page",type:"select",label:"Show on Page",helpText:"Which page to display this HTML on",options:[{value:"all",label:"All Pages"},{value:"homepage",label:"Homepage"},{value:"amenities",label:"Amenities"},{value:"floor-plans",label:"Floor Plans"},{value:"gallery",label:"Gallery"},{value:"contact",label:"Contact"}]}]},{key:"tour_embed",label:"Schedule Tour Embed",description:"Replace the built-in tour request form with your provider's widget",shortBlurb:"Tour widget",category:"scheduling",icon:"CalendarClock",scope:"property_only",mode:"client_inject",defaultRenderPosition:"scheduling_embed",maxPerProperty:1,secretFields:[],configFields:[{key:"code",type:"textarea",label:"Embed code",placeholder:'<script src="https://example.com/scheduler.js"></script>',helpText:'Paste the scheduler embed your provider gave you, exactly as given. It replaces the built-in tour form inside the site\'s "Schedule a Tour" popup. Runs isolated in a sandboxed frame, so it cannot read the rest of the page.',required:!0}]},{key:"availability_sync",label:"Unit Availability Sync (Legacy)",description:"Legacy â prefer the CheckAvailability iframe instead",category:"data",icon:"RefreshCw",scope:"property_only",mode:"server_cron",defaultRenderPosition:"data_sync",maxPerProperty:1,secretFields:[],configFields:[{key:"communityId",type:"text",label:"Fortress Property ID",placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",helpText:"Property UUID from your Fortress account (the part after the / in the Portal UUID).",required:!0},{key:"floorplanNameMap",type:"textarea",label:"Floor Plan Name Mapping",placeholder:'{ "API Plan Name": "Local Plan Name" }',helpText:"JSON object mapping ILS floor plan names to local names."}]}];function s(e){return a.find(t=>t.key===e)}e.s(["INTEGRATION_CATALOG",0,a,"getCatalogEntry",0,s],395880);var i=e.i(95187);let o=(0,i.createServerReference)("60a3d8e86f9dbba408ccbf77065a51e3ac6104235c",i.callServer,void 0,i.findSourceMapURL,"createIntegrationAction");e.s(["createIntegrationAction",0,o],211389);let l=(0,i.createServerReference)("701659f1f75074f41e3ceac40117695606f9b49492",i.callServer,void 0,i.findSourceMapURL,"updateIntegrationAction");e.s(["updateIntegrationAction",0,l],12595);let d=(0,i.createServerReference)("605072fedaa0c53eb2b8f9626810c5ec8fd41bc2b0",i.callServer,void 0,i.findSourceMapURL,"deleteIntegrationAction");e.s(["deleteIntegrationAction",0,d],621683);let c=(0,i.createServerReference)("70d0f49a21e4256628fb2ffc6664b32769f50ed548",i.callServer,void 0,i.findSourceMapURL,"toggleIntegrationAction");e.s(["toggleIntegrationAction",0,c],902023);let u=(0,i.createServerReference)("40317583fcef883ee988e2d7051a236e219d53b1dc",i.callServer,void 0,i.findSourceMapURL,"triggerAvailabilitySyncAction");e.s(["triggerAvailabilitySyncAction",0,u],193046);let p=(0,i.createServerReference)("405b1dffcd90c0695629f8c38f1c53716348ec2417",i.callServer,void 0,i.findSourceMapURL,"getAvailabilitySyncStatusAction");e.s(["getAvailabilitySyncStatusAction",0,p],894685);let x=(0,i.createServerReference)("60063831fc24127921d3d3b4eb5b4b2cac0483b27a",i.callServer,void 0,i.findSourceMapURL,"testAvailabilitySyncAction");e.s(["testAvailabilitySyncAction",0,x],622908);let m=(0,i.createServerReference)("402de8a0e1f05e976fa521da01b03a45cebdffe7d2",i.callServer,void 0,i.findSourceMapURL,"checkAllScriptTagsAction");e.s(["checkAllScriptTagsAction",0,m],447737);let b=(0,i.createServerReference)("6001a9ab483b98a6f5f2d4eb8ea1e421a60a5a6acc",i.callServer,void 0,i.findSourceMapURL,"reorderIntegrationsAction");e.s(["reorderIntegrationsAction",0,b],752270);var g=e.i(843476),h=e.i(271645),f=e.i(758472),y=e.i(21218),v=e.i(217923),j=e.i(491423),j=j,N=e.i(81867),N=N,k=e.i(9734),k=k,w=e.i(522562),C=e.i(263488),S=e.i(73526),T=e.i(931091),P=e.i(194983),A=e.i(16715),I=e.i(870273);let R={Activity:y.Activity,BarChart3:v.BarChart3,CalendarClock:j.default,Calculator:N.default,Code:f.Code,FileCode:k.default,Footprints:w.Footprints,Mail:C.Mail,Map:S.Map,Megaphone:T.Megaphone,MessageCircle:P.MessageCircle,RefreshCw:A.RefreshCw,Star:I.Star};function M({iconName:e,logoUrl:t,className:r,alt:n}){let[a,s]=(0,h.useState)(!1);if(t&&!a)return(0,g.jsx)("img",{src:t,alt:n??"",className:r,loading:"lazy",onError:()=>s(!0)});let i=R[e]??f.Code;return(0,g.jsx)(i,{className:r})}e.s(["IntegrationIcon",0,M],463363);var F=e.i(37727);e.s(["CatalogPickerModal",0,function({existingIntegrations:e,onSelect:t,onClose:r}){return(0,g.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:(0,g.jsxs)("div",{className:"w-full max-w-5xl rounded-[16px] border border-border bg-background shadow-xl max-h-[90vh] flex flex-col",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-6 py-4",children:[(0,g.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:"Add Integration"}),(0,g.jsx)("button",{type:"button",onClick:r,className:"cursor-pointer rounded-[6px] p-1.5 text-muted hover:text-foreground hover:bg-surface",children:(0,g.jsx)(F.X,{className:"h-5 w-5"})})]}),(0,g.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:(0,g.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:a.map(r=>{let n=(e||[]).filter(e=>e.integrationType===r.key).length>=r.maxPerProperty,a=!0===r.comingSoon,s=n||a;return(0,g.jsxs)("button",{type:"button",disabled:s,onClick:()=>t(r),className:`relative text-left rounded-[8px] border p-4 transition-colors ${s?"border-border bg-surface cursor-not-allowed":"cursor-pointer border-border bg-background hover:border-primary hover:bg-primary/5"}`,children:[(0,g.jsxs)("div",{className:`flex items-start gap-3 ${s?"opacity-50":""}`,children:[(0,g.jsx)(M,{iconName:r.icon,logoUrl:r.logoUrl,alt:r.label,className:"h-6 w-6 mt-0.5 flex-shrink-0 object-contain text-muted"}),(0,g.jsxs)("div",{children:[(0,g.jsx)("div",{className:"text-sm font-medium text-foreground",children:r.label}),(0,g.jsx)("div",{className:"mt-0.5 text-xs text-muted",children:r.description}
1),n&&!a&&(0,g.jsxs)("div",{className:"mt-1 text-xs text-muted italic",children:["Max ",r.maxPerProperty," reached"]})]})]}),a&&(0,g.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,g.jsx)("span",{className:"rounded-full border border-gray-300 bg-surface px-3 py-1 text-xs font-medium text-muted shadow-sm",children:"Coming Soon"})})]},r.key)})})})]})})}],460396);var _=e.i(531278),L=e.i(643531),$=e.i(878894),U=e.i(871689),q=e.i(952571),D=e.i(964769);let E=new Set(["code","html","embedHtml"]),z="mt-1.5 block w-full rounded-[8px] border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary";function H({htmlFor:e,label:t,required:r,helpText:n}){return(0,g.jsxs)("label",{htmlFor:e,className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:[t,r&&(0,g.jsx)("span",{className:"text-danger ml-0.5",children:"*"}),n&&(0,g.jsxs)("span",{className:"relative group",children:[(0,g.jsx)(q.Info,{className:"h-3.5 w-3.5 text-muted cursor-help"}),(0,g.jsx)("span",{className:"pointer-events-none absolute left-1/2 -translate-x-1/2 bottom-full mb-1.5 hidden group-hover:block w-56 rounded-lg bg-foreground text-background text-xs px-3 py-2 shadow-lg z-50 leading-relaxed",children:n})]})]})}function X({field:e,value:t,onChange:r}){switch(e.type){case"textarea":return(0,g.jsxs)("div",{children:[(0,g.jsx)(H,{htmlFor:`config-field-${e.key}`,label:e.label,required:e.required,helpText:e.helpText}),(0,g.jsx)("textarea",{id:`config-field-${e.key}`,value:t||"",onChange:e=>r(e.target.value),placeholder:e.placeholder,rows:5,className:`${z} resize-y font-mono text-xs`}),E.has(e.key)&&(0,g.jsx)(D.EmbedProblem,{code:t})]});case"number":return(0,g.jsxs)("div",{children:[(0,g.jsx)(H,{htmlFor:`config-field-${e.key}`,label:e.label,required:e.required,helpText:e.helpText}),(0,g.jsx)("input",{id:`config-field-${e.key}`,type:"number",value:t??"",onChange:e=>r(e.target.value?parseInt(e.target.value,10):void 0),placeholder:e.placeholder,className:z})]});case"boolean":return(0,g.jsxs)("div",{className:"flex items-center justify-between rounded-[8px] bg-surface px-4 py-3",children:[(0,g.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,g.jsx)("span",{className:"text-sm font-medium text-foreground",children:e.label}),e.helpText&&(0,g.jsxs)("span",{className:"relative group",children:[(0,g.jsx)(q.Info,{className:"h-3.5 w-3.5 text-muted cursor-help"}),(0,g.jsx)("span",{className:"pointer-events-none absolute left-1/2 -translate-x-1/2 bottom-full mb-1.5 hidden group-hover:block w-56 rounded-lg bg-foreground text-background text-xs px-3 py-2 shadow-lg z-50 leading-relaxed",children:e.helpText})]})]}),(0,g.jsx)("button",{type:"button",role:"switch","aria-checked":!!t,"aria-label":e.label,onClick:()=>r(!t),className:`relative inline-flex h-6 w-11 flex-shrink-0 items-center rounded-full transition-colors cursor-pointer ${t?"bg-[#203089]":"bg-gray-300"}`,children:(0,g.jsx)("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${t?"translate-x-6":"translate-x-1"}`})})]});case"select":return(0,g.jsxs)("div",{children:[(0,g.jsx)(H,{htmlFor:`config-field-${e.key}`,label:e.label,required:e.required,helpText:e.helpText}),(0,g.jsx)("select",{id:`config-field-${e.key}`,value:t||e.options?.[0]?.value||"",onChange:e=>r(e.target.value),className:z,children:(e.options||[]).map(e=>(0,g.jsx)("option",{value:e.value,children:e.label},e.value))})]});default:return(0,g.jsxs)("div",{children:[(0,g.jsx)(H,{htmlFor:`config-field-${e.key}`,label:e.label,required:e.required,helpText:e.helpText}),(0,g.jsx)("input",{id:`config-field-${e.key}`,type:"text",value:t||"",onChange:e=>r(e.target.value),placeholder:e.placeholder,className:z})]})}}e.s(["ConfigFormModal",0,function({integration:e,onChange:t,onSave:r,onClose:n,onBack:a,isPending:i,propertyId:o}){let l=s(e.integrationType),d=l?.category==="custom",c="availability_sync"===e.integrationType,[u,p]=(0,h.useState)(!1),[m,b]=(0,h.useState)(null),[f,y]=(0,h.useState)(null);async function v(){p(!0),b(null),y(null);try{let t=await x(o,e.config);t.error?y(t.error):t.data&&b(t.data)}
1catch{y("Failed to test connection")}finally{p(!1)}}function j(r,n){let a={...e.config,[r]:n};t({...e,config:a}),b(null),y(null)}return(0,g.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:(0,g.jsxs)("div",{className:`w-full rounded-[16px] border border-border bg-background shadow-xl max-h-[90vh] flex flex-col ${c?"max-w-4xl":"max-w-lg"}`,children:[(0,g.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-6 py-4",children:[(0,g.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,g.jsx)("button",{type:"button",onClick:a,className:"cursor-pointer rounded-[6px] p-1.5 text-muted hover:text-foreground hover:bg-surface transition-colors",children:(0,g.jsx)(U.ArrowLeft,{className:"h-5 w-5"})}),(0,g.jsx)(M,{iconName:l?.icon||"Code",logoUrl:l?.logoUrl,alt:l?.label,className:"h-5 w-5 object-contain text-muted"}),(0,g.jsxs)("h3",{className:"text-lg font-semibold text-foreground",children:[e.id?"Edit":"Add"," ",l?.label||e.integrationType]})]}),(0,g.jsx)("button",{type:"button",onClick:n,className:"cursor-pointer rounded-[6px] p-1.5 text-muted hover:text-foreground hover:bg-surface",children:(0,g.jsx)(F.X,{className:"h-5 w-5"})})]}),(0,g.jsx)("div",{className:`flex-1 overflow-y-auto ${c?"":"px-6 py-4 space-y-4"}`,children:c?(0,g.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 divide-y lg:divide-y-0 lg:divide-x divide-border",children:[(0,g.jsxs)("div",{className:"overflow-y-auto px-6 py-4 space-y-4 max-h-[60vh]",children:[(0,g.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted",children:"Configuration"}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{htmlFor:"config-integration-label-sync",className:"block text-sm font-medium text-foreground",children:"Label"}),(0,g.jsx)("input",{id:"config-integration-label-sync",type:"text",value:e.label,onChange:r=>t({...e,label:r.target.value}),placeholder:l?.label,className:"mt-1.5 block w-full rounded-[8px] border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"})]}),(l?.configFields||[]).map(t=>{if(t.visibleWhen){let r=String(e.config[t.visibleWhen.field]??"");if(!t.visibleWhen.values.includes(r))return null}return(0,g.jsx)(X,{field:t,value:e.config[t.key],onChange:e=>j(t.key,e)},t.key)}),(0,g.jsxs)("div",{className:"flex items-center justify-between rounded-[8px] bg-surface px-4 py-3",children:[(0,g.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Enabled"}),(0,g.jsx)("button",{type:"button",role:"switch","aria-checked":e.enabled,"aria-label":"Enabled",onClick:()=>t({...e,enabled:!e.enabled}),className:`relative inline-flex h-6 w-11 flex-shrink-0 items-center rounded-full transition-colors cursor-pointer ${e.enabled?"bg-[#203089]":"bg-gray-300"}`,children:(0,g.jsx)("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${e.enabled?"translate-x-6":"translate-x-1"}`})})]})]}),(0,g.jsxs)("div",{className:"px-6 py-4 space-y-4 max-h-[60vh] overflow-y-auto",children:[(0,g.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted",children:"Test Connection"}),(0,g.jsx)("p",{className:"text-xs text-muted",children:"Verify your API configuration before enabling. Tests the URL, authentication, and response parsing without saving any data."}),(0,g.jsxs)("button",{type:"button",onClick:v,disabled:u,className:"cursor-pointer w-full inline-flex items-center justify-center gap-2 rounded-[8px] border border-border px-4 py-2.5 text-sm font-medium text-foreground hover:bg-surface transition-colors disabled:opacity-50",children:[u?(0,g.jsx)(_.Loader2,{className:"h-4 w-4 animate-spin"}):(0,g.jsx)(A.RefreshCw,{className:"h-4 w-4"}),u?"Testing...":"Test Connection"]}),f&&(0,g.jsx)("div",{className:"rounded-[8px] border border-danger/30 bg-danger/5 px-3 py-2.5 text-xs",children:(0,g.jsxs)("div",{className:"flex items-start gap-1.5 text-danger",children:[(0,g.jsx)($.AlertTriangle,{className:"h-3.5 w-3.5 mt-0.5 flex-shrink-0"}),(0,g.jsx)("span",{children:f})]})}),m&&(0,g.jsx)("div",{className:`rounded-[8px] border px-3 py-2.5 text-xs ${m.success?"border-success/30 bg-success/5":"border-danger/30 bg-danger/5"}`,children:m.success?(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsxs)("div",{className:"flex items-center gap-1.5 font-medium text-success",children:[(0,g.jsx)(L.Check,{className:"h-3.5 w-3.5"}),"Connection successful â ",m.unitCount," unit",1!==m.unitCount?"s":""," found"]}
1),m.preview.length>0&&(0,g.jsxs)("div",{className:"rounded border border-border bg-background overflow-hidden",children:[(0,g.jsxs)("table",{className:"w-full text-xs",children:[(0,g.jsx)("thead",{children:(0,g.jsxs)("tr",{className:"border-b border-border bg-surface text-muted",children:[(0,g.jsx)("th",{className:"px-2 py-1 text-left font-medium",children:"Unit"}),(0,g.jsx)("th",{className:"px-2 py-1 text-left font-medium",children:"Floor Plan"}),(0,g.jsx)("th",{className:"px-2 py-1 text-left font-medium",children:"Status"}),(0,g.jsx)("th",{className:"px-2 py-1 text-right font-medium",children:"Rent"})]})}),(0,g.jsx)("tbody",{children:m.preview.map(e=>(0,g.jsxs)("tr",{className:"border-b border-border last:border-0",children:[(0,g.jsx)("td",{className:"px-2 py-1 text-foreground",children:e.unitNumber}),(0,g.jsx)("td",{className:"px-2 py-1 text-foreground",children:e.floorplanName}),(0,g.jsx)("td",{className:"px-2 py-1",children:(0,g.jsx)("span",{className:`inline-flex rounded-full px-1.5 py-0.5 text-[10px] font-medium ${"available"===e.status?"bg-success/10 text-success":"notice"===e.status?"bg-amber-100 text-amber-700":"bg-gray-100 text-gray-600"}`,children:e.status})}),(0,g.jsx)("td",{className:"px-2 py-1 text-right text-foreground",children:null!=e.rent?`$${e.rent.toLocaleString()}`:"â"})]},e.unitNumber))})]}),m.unitCount>3&&(0,g.jsxs)("div",{className:"px-2 py-1 text-[10px] text-muted border-t border-border",children:["+ ",m.unitCount-3," more unit",m.unitCount-3!=1?"s":""]})]})]}):(0,g.jsxs)("div",{className:"flex items-start gap-1.5 text-danger",children:[(0,g.jsx)($.AlertTriangle,{className:"h-3.5 w-3.5 mt-0.5 flex-shrink-0"}),(0,g.jsx)("span",{children:m.errorMessage})]})}),!m&&!f&&!u&&(0,g.jsxs)("div",{className:"rounded-[8px] border border-dashed border-border px-4 py-8 text-center",children:[(0,g.jsx)(A.RefreshCw,{className:"mx-auto h-8 w-8 text-muted/50"}),(0,g.jsx)("p",{className:"mt-2 text-xs text-muted",children:"Configure your API settings on the left, then click Test Connection to verify."})]})]})]}):(0,g.jsxs)(g.Fragment,{children:[d&&(0,g.jsxs)("div",{className:"flex items-start gap-3 rounded-[8px] bg-amber-50 border border-amber-200 px-4 py-3",children:[(0,g.jsx)($.AlertTriangle,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}),(0,g.jsx)("p",{className:"text-sm text-amber-800",children:"Custom scripts run with full page access. Only use code from trusted sources."})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{htmlFor:"config-integration-label",className:"block text-sm font-medium text-foreground",children:"Label"}),(0,g.jsx)("input",{id:"config-integration-label",type:"text",value:e.label,onChange:r=>t({...e,label:r.target.value}),placeholder:l?.label,className:"mt-1.5 block w-full rounded-[8px] border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"})]}),(l?.configFields||[]).map(t=>{if(t.visibleWhen){let r=String(e.config[t.visibleWhen.field]??"");if(!t.visibleWhen.values.includes(r))return null}return(0,g.jsx)(X,{field:t,value:e.config[t.key],onChange:e=>j(t.key,e)},t.key)}),(0,g.jsxs)("div",{className:"flex items-center justify-between rounded-[8px] bg-surface px-4 py-3",children:[(0,g.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Enabled"}),(0,g.jsx)("button",{type:"button",role:"switch","aria-checked":e.enabled,"aria-label":"Enabled",onClick:()=>t({...e,enabled:!e.enabled}),className:`relative inline-flex h-6 w-11 flex-shrink-0 items-center rounded-full transition-colors cursor-pointer ${e.enabled?"bg-[#203089]":"bg-gray-300"}`,children:(0,g.jsx)("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${e.enabled?"translate-x-6":"translate-x-1"}`})})]})]})}),(0,g.jsxs)("div",{className:"flex justify-end gap-3 border-t border-border px-6 py-4",children:[(0,g.jsx)("button",{type:"button",onClick:n,className:"cursor-pointer rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground hover:bg-surface transition-colors",children:"Cancel"}),(0,g.jsxs)("button",{type:"button",onClick:r,disabled:i,className:"cursor-pointer inline-flex items-center gap-2 rounded-full bg-gradient-accent px-5 py-2 text-sm font-medium text-white shadow-sm transition-all duration-150 hover:-translate-y-0.5 hover:shadow-md disabled:opacity-50 disabled:hover:translate-y-0",children:[i&&(0,g.jsx)(_.Loader2,{className:"h-4 w-4 animate-spin"}),e.id?"Save Changes":"Add Integration"]})]})]})})}],798667)},740130,e=>{"use strict";var t=e.i(843476);e.s(["IntegrationEmbeds",0,function({integrations:e,page:r}){if(!e||0===e.length)return null;let n=e.filter(e=>{if("custom_html"!==e.integrationType||"homepage_embed"!==e.renderPosition&&"contact_page_embed"!==e.renderPosition)return!1;let t=e.config.page||"all";return"all"===t||t===r});return 0===n.length?null:(0,t.jsx)("div",{className:"space-y-8",children:n.map((e,r)=>{let n=e.config.html;return n?(0,t.jsx)("div",{dangerouslySetInnerHTML:{__html:n}},`ch-${r}`):null})})}])},756071,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(618566),a=e.i(531278),s=e.i(643531),i=e.i(107233),o=e.i(727612),l=e.i(788699),d=e.i(878894),c=e.i(758472),u=e.i(16715),p=e.i(655900),x=e.i(664659),m=e.i(952571),b=e.i(395880),g=e.i(211389),h=e.i(12595),f=e.i(621683),y=e.i(902023),v=e.i(193046),j=e.i(894685),N=e.i(622908),k=e.i(447737),w=e.i(752270),C=e.i(463363),S=e.i(460396),T=e.i(798667),P=e.i(871689),A=e.i(390152),I=e.i(774690),I=I,R=e.i(37727),M=e.i(798031),M=M,F=e.i(620976),_=e.i(95187);let L=(0,_.createServerReference)("40781e8c44958e10a75bdbe4640280d2da9fd76c93",_.callServer,void 0,_.findSourceMapURL,"setIntegrationSecretAction"),$=(0,_.createServerReference)("40988dd0c47a98dee742e2bb57b4fee5dfc805c1a7",_.callServer,void 0,_.findSourceMapURL,"deleteIntegrationSecretAction"),U=(0,_.createServerReference)("4049213f1d9764a41d5e4a72a802bf271fb391bfae",_.callServer,void 0,_.findSourceMapURL,"getIntegrationSecretMetadataAction"),q=(0,_.createServerReference)("40ffa3fb3ab0aa011a93f1fae6e3fdfc780e817a46",_.callServer,void 0,_.findSourceMapURL,"testIntegrationConnectionAction");function D(e){let{draft:n,propertyId:s,onChange:i,onSaved:l,onClose:d,onBack:c}
1=e,u=(0,b.getCatalogEntry)(n.integrationType),p=!n.id,x=u?.secretFields.length??0,[m,f]=(0,r.useTransition)(),[y,v]=(0,r.useState)(null),[j,N]=(0,r.useState)(n.verified?"ok":"idle"),[k,w]=(0,r.useState)(n.verified?"Connected":null),[S,T]=(0,r.useState)(null),[M,_]=(0,r.useState)(x>0&&!p),[D,H]=(0,r.useState)(p||0===x),[X,B]=(0,r.useState)(""),[W,G]=(0,r.useState)(!1),[O,K]=(0,r.useState)(!1);if((0,r.useEffect)(()=>{if(!u||0===u.secretFields.length||p)return;let e=!1;return(async()=>{let t=await U({scope:"property",ownerId:s,integrationType:n.integrationType});e||(_(!1),t.data?T(t.data):H(!0))})(),()=>{e=!0}},[u,n.integrationType,s,p]),!u)return null;async function V(){N("checking"),w(null);let e=await q({propertyId:s,integrationType:n.integrationType,draft:{apiKey:D?X.trim():"",dataPoints:n.dataPoints}});if(e.error){N("error"),w(e.error);return}e.data?.ok?(N("ok"),w(e.data.message??"Connected")):(N("error"),w(e.data?.message??"Could not connect"))}async function J(){K(!0);let e=await $({scope:"property",ownerId:s,integrationType:n.integrationType});(K(!1),G(!1),e.error)?v(e.error):(T(null),H(!0),N("idle"),w(null))}return(0,t.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:[(0,t.jsxs)("div",{className:"w-full max-w-lg rounded-[16px] border border-border bg-background shadow-xl max-h-[90vh] flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-6 py-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[c&&(0,t.jsx)("button",{type:"button",onClick:c,className:"cursor-pointer rounded-[6px] p-1.5 text-muted hover:text-foreground hover:bg-surface transition-colors",children:(0,t.jsx)(P.ArrowLeft,{className:"h-5 w-5"})}),(0,t.jsx)(C.IntegrationIcon,{iconName:u.icon,logoUrl:u.logoUrl,alt:u.label,className:"h-6 w-6 object-contain text-muted"}),(0,t.jsxs)("h3",{className:"text-lg font-semibold text-foreground",children:[p?"Connect":"Edit"," ",u.label]})]}),(0,t.jsx)("button",{type:"button",onClick:d,className:"cursor-pointer rounded-[6px] p-1.5 text-muted hover:text-foreground hover:bg-surface",children:(0,t.jsx)(R.X,{className:"h-5 w-5"})})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-5",children:[(0,t.jsx)(E,{kind:j,message:k}),u.secretFields.length>0&&(0,t.jsx)(z,{entry:u,loading:M,metadata:S,editing:D,value:X,onValueChange:e=>{B(e),N("idle"),w(null)},onStartEdit:()=>H(!0),onCancelEdit:()=>{H(!1),B("")},onRemove:function(){S&&G(!0)}}),(u.propertyDataPoints||[]).length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted",children:"For this property"}),(u.propertyDataPoints||[]).map(e=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{htmlFor:`gateway-dp-${e.key}`,className:"block text-sm font-medium text-foreground",children:[e.label,e.required&&(0,t.jsx)("span",{className:"text-danger",children:" *"})]}),(0,t.jsx)("input",{id:`gateway-dp-${e.key}`,type:"number"===e.type?"number":"text",value:String(n.dataPoints[e.key]??""),onChange:t=>{var r,a;return r=e.key,a=t.target.value,void(i({...n,dataPoints:{...n.dataPoints,[r]:a}}),N("idle"),w(null))},placeholder:e.placeholder,className:"mt-1.5 block w-full rounded-[8px] border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"}),e.helpText&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted",children:e.helpText})]},e.key))]}),y&&(0,t.jsxs)("div",{className:"rounded-[8px] border border-danger/30 bg-danger/5 px-3 py-2 text-sm text-danger flex items-start gap-2",children:[(0,t.jsx)(I.default,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),y]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-border px-6 py-4",children:[(0,t.jsxs)("button",{type:"button",onClick:V,disabled:"checking"===j||m,className:"cursor-pointer inline-flex items-center gap-2 rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground hover:bg-surface transition-colors disabled:opacity-50",children:["checking"===j?(0,t.jsx)(a.Loader2,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(A.Plug,{className:"h-4 w-4"}),"Test connection"]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("button",{type:"button",onClick:d,className:"cursor-pointer rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground hover:bg-surface transition-colors",children:"Cancel"}),(0,t.jsxs)("button",{type:"button",onClick:function(){v(null),u&&f(async()=>
1{let e={integrationType:n.integrationType,config:n.dataPoints,enabled:n.enabled,renderPosition:u.defaultRenderPosition},t=n.id?await (0,h.updateIntegrationAction)(s,n.id,e):await (0,g.createIntegrationAction)(s,e);if(t.error)return void v(t.error);if(u.secretFields.length>0&&D&&X.trim().length>0){let e=await L({scope:"property",ownerId:s,integrationType:n.integrationType,plaintext:X.trim()});if(e.error)return void v(e.error);T({last4:e.data?.last4??"",updatedAt:new Date().toISOString()}),B(""),H(!1)}await V(),l()})},disabled:m,className:"cursor-pointer inline-flex items-center gap-2 rounded-full bg-gradient-accent px-5 py-2 text-sm font-medium text-white shadow-sm transition-all duration-150 hover:-translate-y-0.5 hover:shadow-md disabled:opacity-50 disabled:hover:translate-y-0",children:[m&&(0,t.jsx)(a.Loader2,{className:"h-4 w-4 animate-spin"}),p?"Connect":"Save"]})]})]})]}),W&&(0,t.jsx)(F.ConfirmModal,{icon:o.Trash2,iconColor:"from-red-500/10 to-red-400/20 text-red-600",heading:"Remove credential?",description:"The integration will stop working until you add a new credential. This cannot be undone.",confirmLabel:O?"Removingâ¦":"Remove",confirmClassName:"bg-red-600 text-white shadow-sm hover:bg-red-700 hover:shadow-md",isLoading:O,onConfirm:J,onCancel:()=>G(!1)})]})}function E({kind:e,message:r}){return"idle"===e?(0,t.jsx)("div",{className:"rounded-[8px] border border-border bg-surface px-3 py-2 text-sm text-muted",children:"Not connected yet"}):"checking"===e?(0,t.jsxs)("div",{className:"rounded-[8px] border border-border bg-surface px-3 py-2 text-sm text-muted flex items-center gap-2",children:[(0,t.jsx)(a.Loader2,{className:"h-4 w-4 animate-spin"}),"Checkingâ¦"]}):"ok"===e?(0,t.jsxs)("div",{className:"rounded-[8px] border border-success/30 bg-success/10 px-3 py-2 text-sm text-success flex items-center gap-2",children:[(0,t.jsx)(s.Check,{className:"h-4 w-4"}),r??"Connected"]}):(0,t.jsxs)("div",{className:"rounded-[8px] border border-danger/30 bg-danger/10 px-3 py-2 text-sm text-danger flex items-start gap-2",children:[(0,t.jsx)(M.default,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),(0,t.jsx)("span",{children:r??"Connection failed"})]})}function z({entry:e,loading:r,metadata:n,editing:s,value:i,onValueChange:o,onStartEdit:l,onCancelEdit:d,onRemove:c}){let u=e.secretFields[0];return u?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted",children:"Credentials"}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{htmlFor:"gateway-credential",className:"block text-sm font-medium text-foreground",children:[u.label,u.required&&(0,t.jsx)("span",{className:"text-danger",children:" *"})]}),r?(0,t.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 text-sm text-muted",children:[(0,t.jsx)(a.Loader2,{className:"h-4 w-4 animate-spin"})," Loadingâ¦"]}):!s&&n?(0,t.jsxs)("div",{className:"mt-1.5 flex items-center justify-between rounded-[8px] border border-border bg-surface px-3 py-2 text-sm",children:[(0,t.jsxs)("span",{className:"font-mono text-foreground",children:["â¢â¢â¢â¢",n.last4]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:l,className:"cursor-pointer rounded-full border border-border px-3 py-1 text-xs font-medium text-foreground hover:bg-background transition-colors",children:"Replace"}),(0,t.jsx)("button",{type:"button",onClick:c,className:"cursor-pointer rounded-full border border-border px-3 py-1 text-xs font-medium text-danger hover:bg-danger/10 transition-colors",children:"Remove"})]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{id:"gateway-credential",type:"password",value:i,onChange:e=>o(e.target.value),placeholder:u.placeholder,autoComplete:"off",spellCheck:!1,className:"mt-1.5 block w-full rounded-[8px] border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"}),n&&(0,t.jsx)("button",{type:"button",onClick:d,className:"mt-1 text-xs text-muted hover:text-foreground transition-colors cursor-pointer",children:"Cancel â keep saved key"})]}),u.helpText&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted",children:u.helpText})]})]}):null}let H={live:{label:"Working",className:"bg-success/10 text-success",title:"Every script in this snippet loads on the published site, exactly once."},not_sending:{label:"Not working",className:"bg-danger/10 text-danger",title:"A script in this snippet never loads â either it is missing from the published page, or it sits inside another script tag so the browser treats it as text."},duplicated:{label:"Loads twice",className:"bg-danger/10 text-danger",title:"This script loads more than once, usually because a second integration pastes the same vendor snippet. Delete the duplicate or the widget initialises twice."},no_external_tag:{label:"No script to check",className:"bg-surface text-muted",title:"This snippet is inline only â it loads nothing external, so there is nothing to verify."},unchecked:{label:"Checkingâ¦",className:"bg-surface text-muted",title:"Checking the published page."}};function X(e){if(!e)return!1;let t=e.secretFields.length>0,r=(e.propertyDataPoints?.length??0)>0;return t||r}e.s(["IntegrationsSection",0,function({property:e,canEdit:P=!0}){let A,I,R=(0,n.useRouter)(),[M,_]=(0,r.useTransition)(),[L,$]=(0,r.useState)(null),[U,q]=(0,r.useState)(!1),[E,z]=(0,r.useState)(null),[B,W]=(0,r.useState)(null),[G,O]=(0,r.useState)(null),[K,V]=(0,r.useState)({}),[J,Z]=(0,r.useState)({}),[Q,Y]=(0,r.useState)(!1),[ee,et]=(0,r.useState)(null),[er,en]=(0,r.useState)(null),[ea,es]=(0,r.useState)(null),ei=e.integrations||[];function eo(t,r){let n=t+r;if(n<0||n>
1=ei.length)return;let a=ei.map(e=>e.id);[a[t],a[n]]=[a[n],a[t]],_(async()=>{let t=await (0,w.reorderIntegrationsAction)(e.id,a);t.error?$(t.error):R.refresh()})}async function el(t){O(t),$(null);try{let r=await (0,v.triggerAvailabilitySyncAction)(e.id);r.error?$(r.error):(q(!0),setTimeout(()=>q(!1),3e3),ed(t),R.refresh())}finally{O(null)}}async function ed(t){let r=await (0,j.getAvailabilitySyncStatusAction)(e.id);!r.error&&r.data&&V(e=>({...e,[t]:r.data}))}async function ec(t){z(t.id),W(null),$(null);try{let r=await (0,N.testAvailabilitySyncAction)(e.id,t.config);r.error?$(r.error):r.data&&W(r.data)}catch{$("Failed to test connection")}finally{z(null)}}return(0,r.useEffect)(()=>{let t=!1;return ei.map(e=>`${e.id}:${e.enabled}`).join(",")?((0,k.checkAllScriptTagsAction)(e.id).then(e=>{!t&&e.results&&Z(e.results)}),()=>{t=!0}):void Z({})},[e.id,ei.map(e=>`${e.id}:${e.enabled}`).join(",")]),(0,t.jsx)("div",{className:"p-6",children:(0,t.jsxs)("fieldset",{disabled:!P,children:[(0,t.jsxs)("div",{className:"mb-6 flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Integrations"}),(0,t.jsxs)("p",{className:"mt-1 flex items-center gap-1.5 text-sm text-muted",children:["Tracking scripts, custom code, and data syncs for this property.",(0,t.jsx)(m.Info,{className:"h-3.5 w-3.5 flex-shrink-0 cursor-help","aria-label":"Scripts run top to bottom. Use the arrows to reorder. Status badges report whether a script loads on the published site, not whether the vendor feature itself works.",children:(0,t.jsx)("title",{children:"Scripts run top to bottom. Use the arrows to reorder. Status badges report whether a script loads on the published site, not whether the vendor feature itself works."})})]})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>Y(!0),className:"cursor-pointer inline-flex items-center gap-2 rounded-full bg-gradient-accent px-4 py-2 text-sm font-medium text-white shadow-sm transition-all duration-150 hover:-translate-y-0.5 hover:shadow-md",children:[(0,t.jsx)(i.Plus,{className:"h-4 w-4"}),"Add Integration"]})]}),L&&(0,t.jsx)("div",{className:"mb-6 rounded-[8px] bg-danger/10 px-4 py-3 text-sm text-danger",children:L}),U&&(0,t.jsxs)("div",{className:"mb-6 rounded-[8px] bg-success/10 px-4 py-3 text-sm text-success flex items-center gap-2",children:[(0,t.jsx)(s.Check,{className:"h-4 w-4"}),"Integration saved successfully"]}),0===ei.length?(0,t.jsxs)("div",{className:"rounded-[8px] border border-dashed border-border px-6 py-12 text-center",children:[(0,t.jsx)(c.Code,{className:"mx-auto h-10 w-10 text-muted"}),(0,t.jsx)("p",{className:"mt-3 text-sm font-medium text-foreground",children:"No integrations yet"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-muted",children:"Add tracking scripts, embeds, or custom code from the catalog."})]}):(0,t.jsx)("div",{className:"space-y-2",children:ei.map((r,n)=>{let i=(0,b.getCatalogEntry)(r.integrationType),c="availability_sync"===r.integrationType,m="custom_script"===r.integrationType,g=K[r.id],h=m?H[J[r.id]??"unchecked"]:null;return(0,t.jsxs)("div",{className:"rounded-[8px] border border-border bg-background px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(C.IntegrationIcon,{iconName:i?.icon||"Code",logoUrl:i?.logoUrl,alt:i?.label,className:"h-5 w-5 flex-shrink-0 object-contain text-muted"}),(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:r.label||i?.label||r.integrationType}),h?(0,t.jsx)("span",{title:h.title,className:`inline-flex cursor-help items-center rounded-full px-2 py-0.5 text-xs font-medium ${h.className}`,children:h.label}):r.verified?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-success",children:[(0,t.jsx)(s.Check,{className:"h-3 w-3"}),"Connected"]}):X(i)?(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-700",children:"Not connected"}):(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-surface px-2 py-0.5 text-xs text-muted",children:i?.label||r.integrationType})]})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("button",{type:"button",onClick:()=>eo(n,-1),disabled:0===n||M,"aria-label":`Move ${i?.label||r.integrationType} earlier`,className:"cursor-pointer rounded-[4px] px-1 text-muted transition-colors hover:bg-surface hover:text-foreground disabled:cursor-default disabled:opacity-30",children:(0,t.jsx)(p.ChevronUp,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{type:"button",onClick:()=>eo(n,1),disabled:n===ei.length-1||M,"aria-label":`Move ${i?.label||r.integrationType} later`,className:"cursor-pointer rounded-[4px] px-1 text-muted transition-colors hover:bg-surface hover:text-foreground disabled:cursor-default disabled:opacity-30",children:(0,t.jsx)(x.ChevronDown,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)("button",{type:"button",role:"switch","aria-checked":r.enabled,"aria-label":`${i?.label||r.integrationType} enabled`,onClick:()=>{var t,n;return t=r.id,n=!r.enabled,void _(async()=>{let r=await (0,y.toggleIntegrationAction)(e.id,t,n);r.error?$(r.error):R.refresh()})},className:`relative inline-flex h-6 w-11 flex-shrink-0 items-center rounded-full transition-colors cursor-pointer ${r.enabled?"bg-[#203089]":"bg-gray-300"}`,children:(0,t.jsx)("span",{className:`inline-block h-4 w-4 roun
1ded-full bg-white transition-transform ${r.enabled?"translate-x-6":"translate-x-1"}`})}),(0,t.jsx)("button",{type:"button",onClick:()=>{X((0,b.getCatalogEntry)(r.integrationType))?en({id:r.id,integrationType:r.integrationType,enabled:r.enabled,dataPoints:r.config,verified:r.verified}):et({id:r.id,integrationType:r.integrationType,label:r.label||"",config:r.config,enabled:r.enabled,renderPosition:r.renderPosition})},className:"cursor-pointer rounded-[6px] p-1.5 text-muted hover:text-foreground hover:bg-surface transition-colors",children:(0,t.jsx)(l.Pencil,{className:"h-4 w-4"})}),(0,t.jsx)("button",{type:"button",onClick:()=>{es(r.id)},className:"cursor-pointer rounded-[6px] p-1.5 text-muted hover:text-danger hover:bg-danger/10 transition-colors",children:(0,t.jsx)(o.Trash2,{className:"h-4 w-4"})})]})]}),c&&r.enabled&&(0,t.jsxs)("div",{className:"mt-2 pl-8 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted",children:[g?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 font-medium ${"success"===g.lastStatus?"bg-success/10 text-success":"error"===g.lastStatus?"bg-danger/10 text-danger":"bg-amber-100 text-amber-700"}`,children:"success"===g.lastStatus?"Success":"error"===g.lastStatus?"Error":"Partial"}),g.lastSyncAt&&(0,t.jsxs)("span",{children:["Last sync: ",new Date(g.lastSyncAt).toLocaleString()]}),g.unitCount>0&&(0,t.jsxs)("span",{children:[g.unitCount," units"]}),g.unmatchedCount>0&&(0,t.jsxs)("span",{className:"text-amber-600",children:[g.unmatchedCount," unmatched"]})]}):(0,t.jsx)("button",{type:"button",onClick:()=>ed(r.id),className:"cursor-pointer text-xs text-primary hover:underline",children:"Load sync status"}),(0,t.jsxs)("button",{type:"button",onClick:()=>ec(r),disabled:E===r.id,className:"cursor-pointer inline-flex items-center gap-1 rounded-full border border-border px-2.5 py-1 text-xs font-medium text-foreground hover:bg-surface transition-colors disabled:opacity-50",children:[E===r.id?(0,t.jsx)(a.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(s.Check,{className:"h-3 w-3"}),"Test"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>el(r.id),disabled:G===r.id,className:"cursor-pointer inline-flex items-center gap-1 rounded-full border border-border px-2.5 py-1 text-xs font-medium text-foreground hover:bg-surface transition-colors disabled:opacity-50",children:[G===r.id?(0,t.jsx)(a.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(u.RefreshCw,{className:"h-3 w-3"}),"Sync Now"]})]}),B&&(0,t.jsx)("div",{className:`rounded-[8px] border px-3 py-2 text-xs ${B.success?"border-success/30 bg-success/5":"border-danger/30 bg-danger/5"}`,children:B.success?(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 font-medium text-success",children:[(0,t.jsx)(s.Check,{className:"h-3 w-3"}),"Connection successful â ",B.unitCount," unit",1!==B.unitCount?"s":""," found"]}),B.preview.length>0&&(0,t.jsxs)("div",{className:"mt-1 rounded border border-border bg-background overflow-hidden",children:[(0,t.jsxs)("table",{className:"w-full text-xs",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-border bg-surface text-muted",children:[(0,t.jsx)("th",{className:"px-2 py-1 text-left font-medium",children:"Unit"}),(0,t.jsx)("th",{className:"px-2 py-1 text-left font-medium",children:"Floor Plan"}),(0,t.jsx)("th",{className:"px-2 py-1 text-left font-medium",children:"Status"}),(0,t.jsx)("th",{className:"px-2 py-1 text-right font-medium",children:"Rent"})]})}),(0,t.jsx)("tbody",{children:B.preview.map(e=>(0,t.jsxs)("tr",{className:"border-b border-border last:border-0",children:[(0,t.jsx)("td",{className:"px-2 py-1 text-foreground",children:e.unitNumber}),(0,t.jsx)("td",{className:"px-2 py-1 text-foreground",children:e.floorplanName}),(0,t.jsx)("td",{className:"px-2 py-1",children:(0,t.jsx)("span",{className:`inline-flex rounded-full px-1.5 py-0.5 text-[10px] font-medium ${"available"===e.status?"bg-success/10 text-success":"notice"===e.status?"bg-amber-100 text-amber-700":"bg-gray-100 text-gray-600"}`,children:e.status})}),(0,t.jsx)("td",{className:"px-2 py-1 text-right text-foreground",children:null!=e.rent?`$${e.rent.toLocaleStr
1ing()}`:"â"})]},e.unitNumber))})]}),B.unitCount>3&&(0,t.jsxs)("div",{className:"px-2 py-1 text-[10px] text-muted border-t border-border",children:["+ ",B.unitCount-3," more unit",B.unitCount-3!=1?"s":""]})]})]}):(0,t.jsxs)("div",{className:"flex items-start gap-1.5 text-danger",children:[(0,t.jsx)(d.AlertTriangle,{className:"h-3 w-3 mt-0.5 flex-shrink-0"}),(0,t.jsx)("span",{children:B.errorMessage})]})})]})]},r.id)})}),Q&&(0,t.jsx)(S.CatalogPickerModal,{existingIntegrations:ei,onSelect:function(e){(Y(!1),X(e))?en({integrationType:e.key,enabled:!0,dataPoints:{}}):et({integrationType:e.key,label:e.label,config:{},enabled:"availability_sync"!==e.key,renderPosition:e.defaultRenderPosition})},onClose:()=>Y(!1)}),ee&&(0,t.jsx)(T.ConfigFormModal,{integration:ee,onChange:et,onSave:function(){ee&&($(null),q(!1),_(async()=>{let t=ee.id?await (0,h.updateIntegrationAction)(e.id,ee.id,{label:ee.label,config:ee.config,enabled:ee.enabled,renderPosition:ee.renderPosition,integrationType:ee.integrationType}):await (0,g.createIntegrationAction)(e.id,{integrationType:ee.integrationType,label:ee.label,config:ee.config,enabled:ee.enabled,renderPosition:ee.renderPosition});t.error?$(t.error):(q(!0),et(null),R.refresh(),setTimeout(()=>q(!1),3e3))}))},onClose:()=>et(null),onBack:ee.id?void 0:()=>{et(null),Y(!0)},isPending:M,propertyId:e.id}),er&&(0,t.jsx)(D,{draft:er,propertyId:e.id,onChange:en,onSaved:()=>{en(null),R.refresh()},onClose:()=>en(null),onBack:er.id?void 0:()=>{en(null),Y(!0)}}),null!=ea&&(A=ei.find(e=>e.id===ea),I=A?.label?.trim()||(0,b.getCatalogEntry)(A?.integrationType)?.label||"this integration",(0,t.jsx)(F.ConfirmModal,{icon:o.Trash2,iconColor:"from-red-500/10 to-red-400/20 text-red-600",heading:"Delete integration?",description:`"${I}" will be permanently removed and stop running on the public site. This cannot be undone.`,confirmLabel:M?"Deletingâ¦":"Delete",confirmClassName:"bg-red-600 text-white shadow-sm hover:bg-red-700 hover:shadow-md",isLoading:M,onConfirm:function(){null==ea||($(null),_(async()=>{let t=await (0,f.deleteIntegrationAction)(e.id,ea);t.error?$(t.error):R.refresh(),es(null)}))},onCancel:()=>es(null)}))]})})}],756071)},514957,914719,e=>{"use strict";var t=e.i(843476);function r(e,t){return e.propertyDataPoints?.[t]??e.config?.[t]}e.s(["IntegrationScripts",0,function({integrations:e,slot:n}){if(!e||0===e.length)return null;let a="top"===n,s=new Set(["head","body_start"]),i=[];for(let t of e){if("tracking"!==t.renderPosition)continue;let e={config:t.config,propertyDataPoints:t.config},n=null;switch(t.integrationType){case"ga4":if(!a)continue;n=function(e){let t=r(e,"measurementId");return"string"==typeof t&&/^G-[A-Z0-9]+$/.test(t)?`<script async src="https://www.googletagmanager.com/gtag/js?id=${t}"></script> 2<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','${t}');</script>`:null}(e);break;case"meta_pixel":if(!a)continue;n=function(e){let t=r(e,"pixelId");return"string"==typeof t&&/^\d+$/.test(t)?`<script>!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,'script','https://connect.facebook.net/en_US/fbevents.js');fbq('init','${t}');fbq('track','PageView');</script> 3<noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=${t}&ev=PageView&noscript=1"/></noscript>`:null}(e);break;case"hubspot":if(!a)continue;n=function(e){let t=r(e,"hubId");return"string"==typeof t&&t?`<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/${t}.js"></script>`:null}(e);break;case"custom_script":{let e=t.config.position??"body_end";if(s.has(e)!==a)continue;let r=t.config.code;if(!r)break;n=function(e){let t=e.trim();return t?t.startsWith("<")?t:`<script>${t}</script>`:null}(r);break}default:continue}n&&i.push(n)}return 0===i.length?null:(0,t.jsx)("div",{style:{display:"contents"},dangerouslySetInnerHTML:{__html:i.join("\n")}})}],914719),e.i(740130),e.i(756071),e.i(395880),e.s([],514957)}]);
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.