1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7195],{61250:function(e,t,i){"use strict";i.d(t,{JY:function(){return o},MK:function(){return d},Q4:function(){return u},cq:function(){return l},e3:function(){return s},o3:function(){return c},x6:function(){return a}});var n=i(36808),r=i.n(n);function a(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function s(e){return e.replace(/^(.{120}[^\s]*).*/,"$1")+"..."}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e);return"NO_DECIMAL"===t?i.substring(0,i.indexOf(".")):i}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).format(e/100);return"NO_DECIMAL"===t?i.substring(0,i.indexOf(".")):i}function u(e){return parseFloat(e.toFixed(1))}var c=function(e){return e.req?e.req.csrfToken():r().get("_csrf")},d=function(){return new Promise(function(e,t){navigator.geolocation.getCurrentPosition(e,t)})}},34517:function(e,t,i){"use strict";i.r(t),i.d(t,{building_style:function(){return k},building_type:function(){return w},default:function(){return b},garage_type:function(){return Z},heat_source:function(){return P},heat_type:function(){return L},water_supply:function(){return C}});var n,r=i(50029),a=i(92777),s=i(82262),l=i(10748),o=i(45959),u=i(63553),c=i(37247),d=i(59499),f=i(64687),m=i.n(f),p=i(94332),h=i(67294),g=i(15973),_=i(87066),v=i(47041),x=i(61250),y=i(85893),S=i(34155),b=function(e){(0,o.Z)(n,e);var t,i=(t=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,i=(0,c.Z)(n);return e=t?Reflect.construct(i,arguments,(0,c.Z)(this).constructor):i.apply(this,arguments),(0,u.Z)(this,e)});function n(e){var t;return(0,a.Z)(this,n),t=i.call(this,e),(0,d.Z)((0,l.Z)(t),"componentDidMount",function(){}),(0,d.Z)((0,l.Z)(t),"setActiveTab",function(e){t.state.activeTab!==e&&t.setState({activeTab:e})}),(0,d.Z)((0,l.Z)(t),"isAdmin",function(){var e=t.state.currentUser;if("SuperAdmin"===e.subtype)return!0;var i=!1;return e.groups_users.map(function(e){return"Brokerage"===e.subtype&&!0===e.is_admin&&(i=!0),i}),i}),(0,d.Z)((0,l.Z)(t),"profileLookup",function(e){var i=e.target.value;t.setState({profileSearch:i},function(){if(i.length<3)return t.setState({profilesFound:""}),"";g.Z.request("profiles?filter[name][like]=".concat(i,"&filter[is_external][eq]=0")).then(function(e){var i=e.map(function(e){return{id:e.id,name:e.name,profileable_type:e.profileable_type}});t.setState({profilesFound:i})})})}),(0,d.Z)((0,l.Z)(t),"selectProfile",function(e){var i=t.state.listing;i.profile_id=e.id;var n="Team"===e.profileable_type;t.setState({listing:i,profileSearch:"",profilesFound:[],selectedProfile:e,isTeamProfile:n})}),(0,d.Z)((0,l.Z)(t),"clearSelectedProfile",function(){var e=t.state.listing;e.profile_id=null,t.setState({listing:e,selectedProfile:"",isTeamProfile:!1})}),(0,d.Z)((0,l.Z)(t),"showProfileList",function(){var e=t.state,i=e.profilesFound,n=e.profileSearch;return n&&(0,y.jsxs)("div",{className:"profile-list",children:[n.length<3&&(0,y.jsx)("p",{className:"profile-option",disabled:!0,children:"Continue typing..."}),n.length>=3&&0===i.length&&(0,y.jsx)("p",{className:"profile-option",disabled:!0,children:"No results found"}),i&&i.map(function(e){return(0,y.jsx)("p",{className:"profile-option",onClick:function(){return t.selectProfile(e)},children:e.name},e.name)})]})}),(0,d.Z)((0,l.Z)(t),"showAllowableProfiles",function(){var e=t.state,i=e.allowableProfiles,n=e.selectedProfile;if(1===i.length)return(0,y.jsx)("input",{id:"profile_id",className:"form-control",value:i[0].name,readOnly:!0,required:!0});var r="";return n&&"id"in n&&(r=n.id),(0,y.jsxs)("select",{id:"profile_id",className:"form-control",defaultValue:r,onChange:function(e){return t.selectProfile({id:e.target.value})},required:!0,children:[(0,y.jsx)("option",{value:"",disabled:!0,children:"Select a profile"},"placeholder"),i.map(function(e){return(0,y.jsx)("option",{value:"".concat(e.id),children:e.name},e.id)})]})}),(0,d.Z)((0,l.Z)(t),"showAllProfiles",function(){var e=t.state,i=e.profileSearch,n=e.selectedProfile,r=[];return n?r.push((0,y.jsxs)("span",{className:"input-container",children:[(0,y.jsx)("span",{className:"icon",onClick:t.clearSelectedProfile,children:(0,y.jsxs)("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",fill:"none",children:[(0,y.jsx)("g",{strokeWidth:"0"}),(0,y.jsx)("g",{strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("g",{children:(0,y.jsx)("path",{d:"M20.7457 3.32851C20.3552 2.93798 19.722 2.93798 19.3315 3.32851L12.0371 10.6229L4.74275 3.32851C4.35223 2.93798 3.71906 2.93798 3.32854 3.32851C2.93801 3.71903 2.93801 4.3522 3.32854 4.74272L10.6229 12.0371L3.32856 19.3314C2.93803
119.722 2.93803 20.3551 3.32856 20.7457C3.71908 21.1362 4.35225 21.1362 4.74277 20.7457L12.0371 13.4513L19.3315 20.7457C19.722 21.1362 20.3552 21.1362 20.7457 20.7457C21.1362 20.3551 21.1362 19.722 20.7457 19.3315L13.4513 12.0371L20.7457 4.74272C21.1362 4.3522 21.1362 3.71903 20.7457 3.32851Z",fill:"#000000"})})]})}),(0,y.jsx)("input",{type:"text",id:"profile_id",value:n.name,readOnly:!0,className:"form-control selected"})]})):r.push((0,y.jsx)("input",{type:"text",id:"profile_id",onChange:t.profileLookup,value:i,className:"form-control",placeholder:"Begin typing the Agent's name..."})),r.push(t.showProfileList()),r}),(0,d.Z)((0,l.Z)(t),"getLocation",function(){var e=t.state.listing,i=e.address,n=e.city;if(""===n||""===i)return!1;var r=encodeURIComponent("".concat(i," ").concat(n," ON"));_.Z.get("".concat("https://maps.googleapis.com/maps/api/geocode/json?address=").concat(r,"&key=").concat("AIzaSyBl9TRJionJYvyxm4ZMNJzw9LZVcq3n-Fc")).then(function(i){var n="";"OK"===i.data.status&&i.data.results.length>0&&(n=i.data.results[0].geometry.location,e.latitude=n.lat,e.longitude=n.lng,t.setState({listing:e}))})}),(0,d.Z)((0,l.Z)(t),"onDelete",function(){window.confirm("Are you sure you want to delete this?")&&g.Z.request("".concat(t.endpoint,"/").concat(t.id),{method:"DELETE"}).then(function(e){401===e.status?t.setState({error:"You are not authorized to delete this listing."}):t.setState({redirect:t.path,error:null,message:"Deleted successfully."})}).catch(function(e){t.setState({error:e,message:null})})}),(0,d.Z)((0,l.Z)(t),"handleSubmit",function(){var e=t.state,i=e.allowableProfiles,n=e.imagesToDelete,r=e.isTeamProfile,a=e.listing,s=e.listing_images,l=e.rooms,o=e.selectedProfile;1===i.length&&(a.profile_id=i[0].id);var u=[];if(["address","building_style_id","city","description","is_residential","is_rental","latitude","longitude","postal_code","price"].forEach(function(e){null===a[e]||void 0===a[e]||""===a[e]?u.push(e):"string"==typeof a[e]&&(0===a[e].length||0===a[e].trim().length)&&u.push(e)}),null===o&&u.push("profile"),!0!==r||"emails"in a&&null!==a.emails&&""!==a.emails.trim()||u.push("emails"),u.length>0)return t.setState({error:"Please fill in all required fields.",missingFields:u}),!1;var c={},d={};s.forEach(function(e,t){t+=1,"id"in e&&"image_url"in e?d["image-"+t.toString()]={id:e.id,list_order:t,status:"exists"}:d["image-"+t.toString()]={list_order:t,status:"new"},c["image-".concat(t.toString())]=e}),a["list-images"]=d,a.delete_image_ids=n,a.rooms=l,!1===r&&(a.emails=""),t.id?g.Z.update("exclusive_listings",t.id,a,c).then(function(e){if(401===e.status){t.setState({error:"You are not authorized to modify this listing."});return}t.setState({error:null,message:"Saved successfully."},function(){g.Z.request("exclusive_listings/".concat(t.id)).then(function(e){t.setState({listing_images:e.images,rooms:e.rooms,imagesToDelete:[]})}).catch(function(e){t.setState({redirect:t.path,error:e})})})}):g.Z.create("exclusive_listings",t.state.listing).then(function(e){t.setState({redirect:"".concat(t.path,"/").concat(e.id,"/edit"),error:null,message:"Created successfully."})})}),(0,d.Z)((0,l.Z)(t),"showDeleteButton",function(){if(t.id){if(t.isAdmin())return!0;var e=t.state,i=e.currentUser,n=e.selectedProfile;if(i.profile_id===n.id||"team"in i&&i.team.profile_id===n.id&&!0===i.team.is_admin)return!0}return!1}),t.state={activeTab:"details",allowAllProfiles:!1,allowableProfiles:[],buildingTypes:[],currentUser:null,editingRoom:null,error:null,imagesToDelete:[],isTeamProfile:!1,listing:{},listing_images:[],missingFields:[],profileSearch:"",profilesFound:[],redirect:!1,rooms:[],selectedProfile:null,showRoomModal:!1,url:""},t}return(0,s.Z)(n,[{key:"render",value:function(){if(this.id&&Object.keys(this.state.listing).length<=1)return null;var e=this.state,t=(e.allowAllProfiles,e.buildingTypes,e.error,e.listing_images,e.listing);return e.missingFields,e.rooms,e.selectedProfile,!1===t.has_central_air||null===t.has_central_air||t.has_central_air,!1===t.is_rental||t.is_rental,!1===t.is_residential||t.is_residential,(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(p.Z,{text:"Save",type:"submit",onClick:this.handleSubmit}),this.showDeleteButton()&&(0,y.jsx)(p.Z,{color:"danger",text:"Delete",onClick:this.onDelete}),(0,y.jsx)(ExclusiveListingForm,{profile:this.props})]})}}]),n}(h.Component);b.getInitialProps=(n=(0,r.Z)(m().mark(function e(t){var i,n,r,a,s,l,o,u,c,d,f,p,h;return m().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.query.profile,r=null,!(0,v.hasCookie)("token",t)){e.next=8;break}return a=jwtDecode(getCookie("token",t)),e.next=6,g.Z.request("users/auth?auth0_id=".concat(a.sub),t);case 6:(s=e.sent).user&&(r=s.user);case 8:return e.prev=8,o=["groups","languages","locations","social_links","social_links.social_media_network","specialties","widgets"],u=["fields[social_link]=social_media_network,url","fields[listing]=address,image_url,city,province,mls_id,num_bathrooms,num_bedrooms,price,square_footage,url","fields[widget]=subtype,list_order,settings,records"],c="profiles?filter[permalink][eq]=".concat(n,"&filter[is_external][eq]=0&filter[active][eq]=1&include=").concat(o.join(","),"&").concat(u.join("&")),e.next=14,g.Z.request(c,t);case 14:(l=e.sent).length>0?l=l[0]:(i={statusCode:404},t.res.status(404)),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(8),i=e.t0;case 21:if(d=null,d=t.req?t.req.headers["user-agent"]:navigator.userAgent,f=!1,!(null!=d)){e.next=34;break}
1p=[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i],h=0;case 27:if(!(h<p.length)){e.next=34;break}if(!d.match(p[h])){e.next=31;break}return f=!0,e.abrupt("break",34);case 31:h++,e.next=27;break;case 34:return e.abrupt("return",{appUrl:S.env.APP_URL,csrfToken:(0,x.o3)(t),currentUser:r,err:i,profile:l,ssrIsMobile:f});case 35:case"end":return e.stop()}},e,null,[[8,18]])})),function(e){return n.apply(this,arguments)});var k=[{id:"1.5 Storey",name:"1.5 Storey"},{id:"2 Storey",name:"2 Storey"},{id:"2.5 Storey",name:"2.5 Storey"},{id:"3 Storey",name:"3 Storey"},{id:"Backsplit",name:"Backsplit"},{id:"Bungalow",name:"Bungalow"},{id:"Raised Bungalow",name:"Raised Bungalow"},{id:"Sidesplit",name:"Sidesplit"},{id:"Loft",name:"Loft"},{id:"Apartment Style",name:"Apartment Style"},{id:"3 Level Backsplit",name:"3 Level Backsplit"},{id:"4 Level Backsplit",name:"4 Level Backsplit"},{id:"5 Level Backsplit",name:"5 Level Backsplit"},{id:"3 Level Sidesplit",name:"3 Level Sidesplit"},{id:"4 Level Sidesplit",name:"4 Level Sidesplit"},{id:"Other",name:"Other"}],w=[{id:"Detached",name:"Detached"},{id:"Semi-Detached",name:"Semi-Detached"},{id:"Apartment",name:"Apartment"},{id:"Row / Townhouse",name:"Row / Townhouse"},{id:"Mobile / Trailer",name:"Mobile / Trailer"},{id:"Duplex",name:"Duplex"},{id:"Triplex",name:"Triplex"},{id:"Fourplex",name:"Fourplex"},{id:"Residential Commercial Mix",name:"Residential Commercial Mix"},{id:"Office",name:"Office"},{id:"Retail",name:"Retail"},{id:"Warehouse",name:"Warehouse"},{id:"Industrial",name:"Industrial"},{id:"Parking",name:"Parking"},{id:"Land",name:"Land"},{id:"Other",name:"Other"}],Z=[{id:"Attached",name:"Attached"},{id:"Detached",name:"Detached"},{id:"Underground",name:"Underground"},{id:"Off-site",name:"Off-site"}],P=[{id:"Natural Gas",name:"Natural Gas"},{id:"Propane",name:"Propane"},{id:"Electric",name:"Electric"},{id:"Oil",name:"Oil"},{id:"Wood",name:"Wood"},{id:"Solar",name:"Solar"},{id:"Other",name:"Other"}],L=[{id:"Forced Air",name:"Forced Air"},{id:"Baseboard",name:"Baseboard"},{id:"Wood Stove",name:"Wood Stove"},{id:"Fireplace",name:"Fireplace"},{id:"Heat Pump",name:"Heat Pump"},{id:"Other",name:"Other"}],C=[{id:"Municipal",name:"Municipal"},{id:"Well",name:"Well"},{id:"Cistern",name:"Cistern"},{id:"Other",name:"Other"}]},16704:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/[profile]/exclusive-listings/new1",function(){return i(34517)}])}},function(e){e.O(0,[2518,5059,8911,5973,2888,9774,179],function(){return e(e.s=16704)}),_N_E=e.O()}]);
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.