1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9326],{89326:function(e,n,t){t.r(n),t.d(n,{default:function(){return u}});var l=t(14137),r=t(56782),o=t(92786),a=t(89408),s=t(68495),i=t(45554);function u(e){let{isFiltered:n,handleReset:t,filters:u,updateFilter:c,onSearch:d,searchTerm:p}=e,f=(0,i.useSearchParams)(),[m,v]=(0,s.useState)(()=>{let e=f.get("property");return e?Number(e):void 0});(0,s.useEffect)(()=>{m&&c("property_id",String(m))},[]);let h=(0,s.useRef)(!1);return(0,s.useEffect)(()=>{if(!h.current){h.current=!0;return}(null==u?void 0:u.property_id)||v(void 0)},[null==u?void 0:u.property_id]),(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("div",{className:"relative z-50 mb-4 flex flex-wrap items-end justify-between gap-2.5 @container ",children:[(0,l.jsx)(a.Z,{label:"Properties",value:m,onChange:e=>{if(-1===e){v(void 0),c("property_id","");return}e&&(v(e),c("property_id",String(e)))},allProperties:!0,useSubscriptions:!0,className:"w-full @4xl:w-[250px]"}),n&&(0,l.jsxs)(o.Button,{size:"sm",onClick:t,className:"h-8 w-full bg-gray-200/70 @4xl:w-auto",variant:"flat",children:[(0,l.jsx)(r.PiTrashDuotone,{className:"me-1.5 h-[17px] w-[17px]"})," Clear"]}),(0,l.jsx)(o.Input,{type:"search",placeholder:"Search for companies...",value:p,onClear:()=>d(""),onChange:e=>d(e.target.value),prefix:(0,l.jsx)(r.PiMagnifyingGlassBold,{className:"h-4 w-4"}),rounded:"lg",clearable:!0,className:" w-full @xl:ms-auto @xl:w-auto @4xl:w-[250px] @5xl:w-auto"})]})})}},96432:function(e,n,t){t.d(n,{A:function(){return a},Z:function(){return o}});var l=t(14137),r=t(92786);function o(e){let{onChange:n,displayValue:t,options:o,onClear:a,...s}=e;return(0,l.jsx)(r.Select,{...s,options:o,displayValue:null!=t?t:e=>{if(null==e||""===e)return null;if("object"==typeof e&&"label"in e){var n;return null!==(n=e.label)&&void 0!==n?n:null}let t=(null!=o?o:[]).find(n=>String(n.value)===String(e));return t?t.label:e},onChange:e=>{null==n||n(e)},onClear:e=>{null==a||a(e),null==n||n(void 0)},className:(0,r.cn)("safari-select-wrapper",e.className),dropdownClassName:(0,r.cn)("safari-select-dropdown",e.dropdownClassName),optionClassName:(0,r.cn)("safari-select-option",e.optionClassName)})}function a(e){let{onChange:n,onClear:t,...o}=e;return(0,l.jsx)(r.MultiSelect,{...o,onChange:e=>{null==n||n(null!=e?e:[])},onClear:()=>{null==t||t(),null==n||n([])},className:(0,r.cn)("safari-select-wrapper",e.className),dropdownClassName:(0,r.cn)("safari-select-dropdown",e.dropdownClassName),optionClassName:(0,r.cn)("safari-select-option",e.optionClassName)})}},89408:function(e,n,t){t.d(n,{Z:function(){return c}});var l=t(14137),r=t(68495),o=t(92786),a=t(40309),s=t(96432),i=t(12483),u=t(28153);function c(e){let{value:n,onChange:t,onPropertyChange:c,allProperties:d=!1,myProperties:p=!1,useSubscriptions:f=!1,autoSelectSingle:m=!1,residentialOnly:v=!1,commercialOnly:h=!1,kisiOnly:g=!1,flexOnly:w=!1,fitnessAccessOnly:N=!1,errorString:x,multipleProperties:y,excludedPropertyIds:C,allPropertiesLabel:S="All Properties",emptyPropertyLabel:b="No Properties Found",insuranceRequirementsKey:_,...j}=e,[P,k]=(0,r.useState)([]),[E,A]=(0,r.useState)(null),I=a.E.checkPermission("use-property-subscriptions"),{currentSubdomain:Z}=(0,u.u)();if((0,r.useEffect)(()=>{(async()=>{try{let e;e=_?(e=await i.h.fetchPropertiesWithInsuranceRequirements()).filter(e=>e[_]&&null!=e[_]):f&&I?a.E.getPropertySubscriptions():await i.h.fetchPropertyIds();let l=[];if(d&&l.push({id:-1,property_name:S}),p&&l.push({id:-2,property_name:"My Properties"}),v&&(e=e.filter(e=>e.is_residential)),h&&(e=e.filter(e=>!e.is_residential)),C&&C.length>0&&(e=e.filter(e=>{var n;return!C.includes(null!==(n=null==e?void 0:e.id)&&void 0!==n?n:0)})),g&&(e=e.filter(e=>e.kisi_place_id||e.verkada_group_id)),w&&(e=e.filter(e=>1==e.is_flex)),N&&(e=e.filter(e=>"333 Seymour"==e.property_name||"601 W Hastings"==e.property_name)),l=[...l,...e],k(l),m&&!n&&1===l.length){let e=l[0];e.id&&e.id>0&&(null==t||t(e.id),null==c||c(e))}}catch(e){A("Failed to load properties"),console.error(e)}})()},[f,I,d,p,Z]),E)return(0,l.jsx)("div",{className:"text-red-500",children:E});let B=P.find(e=>e.id===n)||(d||p?P[0]:void 0);return(0,l.jsx)("div",{className:j.className,children:(0,l.jsx)(s.Z,{value:y?y.length>0?"Properties Selected: ".concat(y.length):S:(null==B?void 0:B.property_name)||"",placeholder:0===P.length?b:j.placeholder||"Select a property",dropdownClassName:(0,o.cn)("safari-select-dropdown",j.dropdownClassName),optionClassName:"safari-select-option",options:y?P.filter(e=>!y.some(n=>n.id===e.id)).map(e=>{var n,t;return{value:null!==(t=null===(n=e.id)||void 0===n?void 0:n.toString())&&void 0!==t?t:"",label:e.property_name}}):P.map(e=>{var n,t;return{value:null!==(t=null===(n=e.id)||void 0===n?void 0:n.toString())&&void 0!==t?t:"",label:e.property_name}}),onChange:e=>{let n=parseInt(e.value);if(!isNaN(n)&&(null==t||t(n),c)){let e=P.find(e=>e.id===n);e&&c(e)}},error:x,disabled:j.disabled||0===P.length,...j})})}},28153:function(e,n,t){t.d(n,{u:function(){return a}});
1var l=t(91019),r=t(68495),o=t(9566);let a=()=>{let{data:e,status:n}=(0,l.useSession)(),[t,a]=(0,r.useState)(null),[s,i]=(0,r.useState)(!0),[u,c]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{if("loading"===n){c(!0);return}if("authenticated"===n&&e){let n=(0,o.$H)(e),t=(0,o.Bl)(e);a(n),i(t),t||(console.warn("User does not have access to current tenant, redirecting..."),(0,o.n3)(e))}c(!1)},[e,n]),{session:e,status:n,currentCustomer:t,hasAccess:s,isLoading:u,currentSubdomain:(0,o.YL)(),switchTenant:function(n){var t;let l,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";if(!(null==e?void 0:null===(t=e.user)||void 0===t?void 0:t.customers))return!1;if(n&&!e.user.customers.some(e=>e.firebase_subdomain===n))return console.error("User does not have access to tenant: ".concat(n)),!1;let o=window.location.protocol,a="service.aspenproperties.ca",s=window.location.port?":".concat(window.location.port):"";return l=n?"".concat(o,"//").concat(n,".").concat(a).concat(s).concat(r):"".concat(o,"//").concat(a).concat(s).concat(r),window.location.href=l,!0},debugAuth:()=>{var l;console.log("--- Tenant Auth Debug Info ---"),console.log("Session Status:",n),console.log("Current Subdomain:",(0,o.YL)()),console.log("Current Customer:",t),console.log("Has Access:",s),console.log("User Customers:",null==e?void 0:null===(l=e.user)||void 0===l?void 0:l.customers),(0,o.YN)(),console.log("----------------------------")}}}}}]);
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.