import{j as e}from"./components-D518BHYW.js";import{C as q}from"./client-only-d7wKb0Qt.js";import{D as P,U as S}from"./UserProfileRenderer-BAzYQ65A.js";import{n as i,q as B,j as z,r as O,s as Y,u as M,A as G,h as H}from"./TileGroup-C5c5uWgc.js";import{O as W,U as F,L as _,N as J}from"./ObjectStatusRibbon-NVXIXNQl.js";import{P as L,a as A}from"./PodletRenderer-DxVVtO7m.js";import{C as K,V as R}from"./CadastreInfo-D-13ooeo.js";import{G as Q}from"./GridRenderer-D4_Wj__R.js";import{H as C}from"./HtmlTextRenderer-ButeDhZ1.js";import{S as X}from"./ShowProspectusInfo-BYb42C8t.js";import{V as Z}from"./VideoAnd360-BGFos5GH.js";import $ from"https://assets.finn.no/npm/react/v18/react.production.min.js";import{Button as D}from"https://assets.finn.no/pkg/@warp-ds/react/v1/warp-react-18.js";import{E as ee}from"./EnergyLabeler-CpSvGy99.js";import{P as ae}from"./PlotAreaTile-NwgJkA51.js";import{f as se,p as te}from"./dateHelpers-CQCBTeRC.js";import{t as p,p as ie,a as le}from"./priceHelpers-BGIVWcB8.js";const re=({ad:a,lang:t,children:l,hasChildContent:s,trackerVertical:d})=>{var m,o,y,E,w,N,x,f,u,j,h,g,k,I,V,v,b,U,T;const[n,c]=$.useState(!1),r=(m=a.acquisition)!=null&&m.fromIso?se(te(a.acquisition.fromIso)):void 0;return e.jsxs("section",{"aria-labelledby":"keyinfo-heading",className:"mt-40 pb-16 border-b","data-testid":"key-info",children:[e.jsx("h2",{className:"h3",id:"keyinfo-heading",children:t.realEstate.headings.keyInfo}),e.jsxs("dl",{className:"grid md:grid-cols-3 grid-cols-2 pb-8 gap-16 m-0",children:[e.jsx(i,{displayText:t.realEstate.keyInfo.situation,displayValue:a.situation,displayValueUnit:"",testId:"info-situation"}),e.jsx(i,{displayText:t.realEstate.keyInfo.propertyType,displayValue:a.propertyType,displayValueUnit:"",testId:"info-property-type"}),e.jsx(i,{displayText:t.realEstate.keyInfo.ownershipType,displayValue:a.ownershipType,displayValueUnit:"",testId:"info-ownership-type"}),e.jsx(i,{displayText:t.realEstate.keyInfo.bedrooms,displayValue:(o=a.bedrooms)==null?void 0:o.toString(),displayValueUnit:"",testId:"info-bedrooms"}),e.jsx(i,{displayText:t.realEstate.keyInfo.primaryArea,displayValue:p((y=a.size)==null?void 0:y.primary),displayValueUnit:" m\xB2",testId:"info-primary-area"}),e.jsx(i,{displayText:t.realEstate.keyInfo.usableArea,displayValue:p((E=a.size)==null?void 0:E.usable),displayValueUnit:" m\xB2",testId:"info-usable-area"}),e.jsx(i,{displayText:t.realEstate.keyInfo.grossArea,displayValue:p((w=a.size)==null?void 0:w.gross),displayValueUnit:" m\xB2",testId:"info-gross-area"}),e.jsx(i,{displayText:t.realEstate.keyInfo.floorArea,displayValue:p((N=a.size)==null?void 0:N.floor),displayValueUnit:" m\xB2",testId:"info-floor-area"}),e.jsx(i,{displayText:t.realEstate.keyInfo.livingArea,displayValue:p((x=a.size)==null?void 0:x.living),displayValueUnit:" m\xB2",testId:"info-living-area"}),e.jsx(i,{displayText:t.realEstate.keyInfo.leaseholdYear,displayValue:(u=(f=a.plot)==null?void 0:f.leaseholdYear)==null?void 0:u.toString(),displayValueUnit:"",testId:"info-leasehold-year"}),e.jsx(ae,{plot:a.plot,lang:t}),e.jsx(i,{displayText:t.realEstate.keyInfo.constructionYear,displayValue:(j=a.constructionYear)==null?void 0:j.toString(),displayValueUnit:"",testId:"info-construction-year"}),e.jsx(i,{displayText:t.realEstate.keyInfo.renovatedYear,displayValue:(h=a.renovatedYear)==null?void 0:h.toString(),displayValueUnit:"",testId:"info-renovated-year"}),e.jsx(ee,{energyLabel:a.energyLabel}),e.jsx(i,{displayText:t.realEstate.keyInfo.room,displayValue:(g=a.rooms)==null?void 0:g.toString(),displayValueUnit:"",testId:"info-rooms"}),e.jsx(i,{displayText:t.realEstate.keyInfo.beds,displayValue:(k=a.beds)==null?void 0:k.toString(),displayValueUnit:"",testId:"info-beds"}),e.jsx(i,{displayText:t.realEstate.keyInfo.parkingSpots,displayValue:(I=a.parkingSpots)==null?void 0:I.toString(),displayValueUnit:"",testId:"info-parking-spots"}),e.jsx(i,{displayText:t.realEstate.keyInfo.metersAboveSeaLevel,displayValue:(V=a.metersAboveSeaLevel)==null?void 0:V.toString(),displayValueUnit:"",testId:"info-meters-above-sea-level"}),e.jsx("div",{className:((v=a.acquisition)==null?void 0:v.note)!==void 0&&a.acquisition.note.length>25?"col-span-full":"",children:e.jsx(i,{displayText:t.realEstate.keyInfo.acquisition,displayValue:r&&((b=a.acquisition)!=null&&b.note)?r+". "+((U=a.acquisition)==null?void 0:U.note):r??((T=a.acquisition)==null?void 0:T.note)??null,displayValueUnit:"",testId:"info-acquisition"})})]}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"hide-more-div",className:"finn-legacy-browser-support "+(n?"visible":"hidden"),children:[l,e.jsxs(D,{link:!0,className:"flex! items-center",onClick:()=>c(!1),"data-preview-dont-disable":"true","data-testid":"hide-more-button",children:[e.jsx(B,{}),"\xA0",t.realEstate.keyInfo.showLess]})]}),e.jsxs(D,{link:!0,className:"items-center "+(n?"hidden":"flex!"),onClick:()=>{z({name:"View more keyinfo",objectId:"view-more-keyinfo",elementType:"",intent:"View",trackerVertical:d}),c(!0)},"data-preview-dont-disable":"true","data-testid":"show-more-button",children:[e.jsx(O,{}),"\xA0",t.realEstate.keyInfo.showMore]})]})]})},de=({priceData:a,sharedCost:t,lang:l,pfFinanceLinks:s,leaseholdFee:d,owned:n})=>{const c=ie(a==null?void 0:a.currency),r=le(a==null?void 0:a.currency);return a||t?e.jsxs("section",{"aria-label":"Prisdetaljer",className:"mt-40 sm:mt-64 pb-16 border-b hide-if-empty","data-testid":"pricing-details",children:[(a==null?void 0:a.suggestion)&&e.jsxs("div",{"data-testid":"pricing-indicative-price",children:[e.jsx("span",{className:"text-16 block",children:l.realEstate.price.indicativePrice}),e.jsx("span",{className:"text-28 font-bold",children:c+p(a==null?void 0:a.suggestion)+r})]}),((a==null?void 0:a.collectiveDebt)!==void 0||(t==null?void 0:t.amount)!==void 0||(a==null?void 0:a.collectiveAssets)!==void 0||(a==null?void 0:a.taxValue)!==void 0)&&e.jsxs("dl",{className:"pt-24 grid md:grid-cols-3 grid-cols-2 gap-16 m-0 hide-if-empty",children:[e.jsx(i,{displayText:l.realEstate.price.jointDebt,displayValue:p(a==null?void 0:a.collectiveDebt),displayValueUnit:r,testId:"pricing-joint-debt"}),e.jsx(i,{displayText:l.realEstate.price.commonMonthlyCost,displayValue:p(t==null?void 0:t.amount),displayValueUnit:r,testId:"pricing-common-monthly-cost"}),e.jsx(i,{displayText:l.realEstate.price.collectiveAssets,displayValue:p(a==null?void 0:a.collectiveAssets),displayValueUnit:r,testId:"pricing-collective-assets"}),e.jsx(i,{displayText:l.realEstate.price.taxValue,displayValue:p(a==null?void 0:a.taxValue),displayValueUnit:r,testId:"pricing-tax-value"}),n!==!0&&e.jsx(i,{displayText:l.realEstate.keyInfo.leaseholdFee,displayValue:p(d),displayValueUnit:r,testId:"info-leasehold-fee"})]}),s?e.jsx("div",{className:"grid md:grid-cols-3 grid-cols-2 pt-24 gap-16 ","data-testid":"pricing-links",children:e.jsx("div",{className:"col-span-3","data-testid":"pf-finance-link",children:e.jsx("div",{style:{margin:"-16px 0 0 -16px"},children:L(s)})})}):null]}):e.jsx("section",{className:"-ml-16 pt-8 sm:pt-20",children:L(s)})},ne=({adId:a,userOwner:t,lang:l,objectData:s,objectAddress:d,favoriteBaseURL:n,userId:c,podlets:r,isPreview:m,trackerVertical:o})=>{var x,f,u,j,h,g,k,I,V,v,b,U,T;const y=(j=(u=(f=(x=s.ad.location)==null?void 0:x.position)==null?void 0:f.links)==null?void 0:u.finnvector)==null?void 0:j.uri,E=s.ad.prospectusView,w=s.ad.prospectusDownload,N=E||w;return e.jsxs("div",{className:"u-word-break","data-testid":"object-details",children:[e.jsx(Y,{adId:a,title:s.ad.title,isPreview:m,userId:c,favoriteBaseURL:n,trackerVertical:o,children:e.jsx(Z,{videoUrl:s.ad.videoUrl,virtualViewingUrl:s.ad.virtualViewingUrl,trackerVertical:o})}),e.jsx(W,{disposed:s.ad.disposed,disposedText:s.ad.disposedText,mode:s.meta.mode}),e.jsx(M,{localAreaName:s.ad.localAreaName,title:s.ad.title,objectAddress:d,mapUrl:y,trackerVertical:o}),e.jsx(de,{adId:s.meta.adId,priceData:s.ad.price,sharedCost:s.ad.sharedCost,lang:l,leaseholdFee:(h=s.ad.plot)==null?void 0:h.leaseholdFee,owned:(g=s.ad.plot)==null?void 0:g.owned,pfFinanceLinks:r==null?void 0:r.pfFinanceLinks}),e.jsx(e.Fragment,{children:(r==null?void 0:r.blinkEffect)&&e.jsx("div",{className:"mt-8 sm:mt-32",style:{marginBottom:"-8px"},children:L(r.blinkEffect)})}),e.jsx(re,{ad:s.ad,lang:l,hasChildContent:!!((k=s.ad.cadastres)!=null&&k[0])||!!((I=s.ad.size)!=null&&I.descriptionUnsafe),trackerVertical:o,children:e.jsxs(e.Fragment,{children:[e.jsx(C,{headingId:"area-description",headingText:"Arealbeskrivelse",htmlText:(V=s.ad.size)==null?void 0:V.descriptionUnsafe}),e.jsx(C,{headingId:"common-cost",headingText:"Felleskostnader inkluderer",htmlText:(v=s.ad.sharedCost)==null?void 0:v.includesUnsafe}),e.jsx(C,{headingId:"sales-costs",headingText:l.realEstate.headings.salesCost,htmlText:(U=(b=s.ad)==null?void 0:b.price)==null?void 0:U.salesCostIncludesUnsafe}),e.jsx(K,{cadastres:s.ad.cadastres||[],lang:l})]})}),e.jsx(Q,{itemList:s.ad.facilities,heading:l.realEstate.headings.facilities,gridName:"facilities"}),e.jsx("div",{className:"block sm:hidden",children:e.jsx(R,{headingId:"viewing-header-2",viewingData:s.ad.viewings,moreInfoLinks:s.ad.moreInfoLinks,adId:s.meta.adId.toString(),sold:s.ad.disposed,lang:l,trackerVertical:o})}),e.jsx(G,{aboutInfo:s.ad.propertyInfo,adId:a,trackerVertical:o}),e.jsx(P,{id:"board_1",className:"mt-24",mobileOnly:!0}),e.jsx(X,{lang:l,url:N,trackerVertical:o,isPrivateSeller:t,isThirdPartySeller:!1,countryName:(T=s.ad.location)==null?void 0:T.countryName}),e.jsx("div",{className:"block sm:hidden",children:e.jsx(F,{headingId:"useful-links-1",moreInfoLinks:s.ad.moreInfoLinks,documents:s.ad.documents,lang:l,salesReportUrl:s.ad.salesReportUrl,technicalReportUrl:s.ad.technicalReportUrl,trackerVertical:o})}),e.jsx(_,{location:s.ad.location,objectAddress:d,lang:l,mapUrl:y,trackerVertical:o})]})},oe=({adId:a,configUrl:t,isPreview:l,lang:s,objectData:d,podlets:n,trackerVertical:c,userId:r,userOwner:m})=>e.jsxs(e.Fragment,{children:[e.jsxs("section",{"aria-label":"Detaljert informasjon om bolig",className:"md:grid md:grid-cols-3 pt-16 mb-8 sm:mb-20",children:[e.jsx(e.Fragment,{children:!m&&n.companyProfileMobile&&e.jsx("div",{className:"mb-16 sm:hidden block",children:e.jsx(A,{content:n.companyProfileMobile,noCss:!0})})}),e.jsxs("div",{className:"md:col-span-2 md:pr-32",children:[e.jsx(ne,{adId:a,userOwner:m,lang:s,objectData:d,userId:r,objectAddress:H(d.ad.location),favoriteBaseURL:t.favoriteBaseURL,podlets:{blinkEffect:n.blinkEffect,pfFinanceLinks:n.pfFinanceLinks},isPreview:!1,trackerVertical:c}),!l&&e.jsx(q,{children:()=>e.jsx(J,{endpoint:t.finnWidgetEndpointURL+d.meta.adId,trackerVertical:c})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"sm:block hidden",children:[m?e.jsx(S,{userProfile:n.userProfile,contactButton:n.contactButton}):e.jsx(A,{content:n.companyProfile,noCss:!0}),e.jsx(R,{headingId:"viewing-header-1",viewingData:d.ad.viewings,moreInfoLinks:d.ad.moreInfoLinks,adId:a.toString(),sold:d.ad.disposed,lang:s,trackerVertical:c}),e.jsx(F,{headingId:"useful-links-2",moreInfoLinks:d.ad.moreInfoLinks,documents:d.ad.documents,salesReportUrl:d.ad.salesReportUrl,technicalReportUrl:d.ad.technicalReportUrl,lang:s,trackerVertical:c})]}),e.jsx(P,{id:"contentboard",className:"mt-24",desktopOnly:!0})]})]}),e.jsx("div",{className:"mt-16 block sm:hidden",children:m?e.jsx(S,{userProfile:n.userProfile,contactButton:n.contactButton}):e.jsx(A,{content:n.companyProfile,noCss:!0})})]});export{oe as A};
