UNPKG

@stratusjs/idx

Version:

AngularJS idx/property Service and Components bundle to be used as an add on to StratusJS

1 lines 45.2 kB
System.register(["lodash","@stratusjs/runtime/stratus","angular","@stratusjs/angularjs/services/model","@stratusjs/angularjs/services/collection","@stratusjs/core/misc","@stratusjs/core/environment","@stratusjs/idx/listTrac"],function(exports_1,context_1){"use strict";var lodash_1,stratus_1,angular_1,model_1,collection_1,misc_1,environment_1,angularJsService;context_1&&context_1.id;return{setters:[function(lodash_1_1){lodash_1=lodash_1_1},function(stratus_1_1){stratus_1=stratus_1_1},function(angular_1_1){angular_1=angular_1_1},function(model_1_1){model_1=model_1_1},function(collection_1_1){collection_1=collection_1_1},function(misc_1_1){misc_1=misc_1_1},function(environment_1_1){environment_1=environment_1_1},function(_1){}],execute:function(){"3.13.0",angularJsService=($http,$mdToast,$q,$rootScope,$window,ListTrac,orderByFilter)=>{const sharedValues={contactUrl:null,contactCommentVariable:null,contact:null,integrations:{analytics:{},maps:{}}},defaultWhereOptions={City:[],eCity:[],UnparsedAddress:[],StreetAddress:[],eStreetAddress:[],Location:"",eLocation:"",Status:[],ListingId:[],ListingType:[],CountyOrParish:[],eCountyOrParish:[],MLSAreaMajor:[],eMLSAreaMajor:[],MLSAreaMinor:[],eMLSAreaMinor:[],SubdivisionName:[],eSubdivisionName:[],Neighborhood:[],eNeighborhood:[],PostalCode:[],CityRegion:[],eCityRegion:[],AgentLicense:[],OfficeNumber:[],OfficeName:[]};let refreshLoginTimer,defaultPageTitle,idxServicesEnabled=[],tokenRefreshURL="/ajax/request?class=property.token_auth&method=getToken",sessionInitialized=!1;const instance={disclaimer:{},map:{},member:{details:{},list:{},search:{}},office:{details:{},list:{},search:{}},property:{details:{},list:{},search:{}}},instanceLink={Disclaimer:{},List:{},Map:{},Search:{}},instanceOnEmitters={},session={services:[],lastCreated:new Date,lastTtl:0,contacts:[]},urlOptions={Listing:{},Search:{}},lastQueries={whereFilter:{},pages:[],perPage:0,time:null};function emitManual(emitterName,uid,$scope,var1,var2,var3){Object.prototype.hasOwnProperty.call(instanceOnEmitters,uid)&&Object.prototype.hasOwnProperty.call(instanceOnEmitters[uid],emitterName)&&Object.values(instanceOnEmitters[uid][emitterName]).forEach(emitter=>{try{emitter($scope,var1,var2,var3)}catch(e){console.error(e,"issue sending back emitter on",uid,emitterName,emitter)}}),"init"===emitterName&&(instanceOnEmitters[uid]??={},instanceOnEmitters[uid][emitterName]??={})}function getIdxServices(){return idxServicesEnabled}function setIdxServices(services){idxServicesEnabled=services}function tokenKeepAuth(keepAlive=!1){return $q(async(resolve,reject)=>{try{Object.keys(session.services).length<1||session.expires<new Date(Date.now()+5e3)?(await tokenRefresh(keepAlive,!0),resolve()):resolve()}catch(err){console.error("tokenKeepAuth Error:",err),reject(err)}})}function tokenRefresh(keepAlive=!1,cacheReset=!1){return $q((resolve,reject)=>{let additionalQueries="&apiVersion=3.13.0";0!==idxServicesEnabled.length&&idxServicesEnabled.forEach(service=>{additionalQueries+=`&service[]=${service}`}),cacheReset&&(additionalQueries+="&cacheReset=true"),$http({method:"GET",url:tokenRefreshURL+additionalQueries}).then(response=>{"object"==typeof response&&Object.prototype.hasOwnProperty.call(response,"data")&&Object.prototype.hasOwnProperty.call(response.data,"services")&&Object.prototype.hasOwnProperty.call(response.data.services,"length")?(!function(response,keepAlive=!1){session.services={},response.data.services.forEach(service=>{Object.prototype.hasOwnProperty.call(service,"id")&&(Object.prototype.hasOwnProperty.call(service,"fetchTime")||(service.fetchTime={Property:null,Media:null,Member:null,Office:null,OpenHouse:null}),Object.prototype.hasOwnProperty.call(service,"analyticsEnabled")&&null!==service.analyticsEnabled||(service.analyticsEnabled=[]),Object.prototype.hasOwnProperty.call(service,"logo")&&null!==service.logo||(service.logo={default:null}),Object.prototype.hasOwnProperty.call(service,"mandatoryLogo")&&null!==service.mandatoryLogo||(service.mandatoryLogo=[]),session.services[service.id]=service,session.lastCreated=new Date(service.created),session.lastTtl=service.ttl,session.expires=new Date(session.lastCreated.getTime()+1e3*(session.lastTtl-15)))}),Object.prototype.hasOwnProperty.call(response.data,"contactUrl")&&""!==response.data.contactUrl&&(sharedValues.contactUrl=response.data.contactUrl);Object.prototype.hasOwnProperty.call(response.data,"contactCommentVariable")&&""!==response.data.contactCommentVariable&&(sharedValues.contactCommentVariable=response.data.contactCommentVariable);Object.prototype.hasOwnProperty.call(response.data,"contact")&&(sharedValues.contact={name:"",emails:{},locations:{},phones:{},socialUrls:{},urls:{}},Object.prototype.hasOwnProperty.call(response.data,"site")&&lodash_1.isString(response.data.site)&&""!==response.data.site&&(sharedValues.contact.name=response.data.site),Object.prototype.hasOwnProperty.call(response.data,"contactName")&&lodash_1.isString(response.data.contactName)&&""!==response.data.site&&(sharedValues.contact.name=response.data.contactName),Object.prototype.hasOwnProperty.call(response.data,"contact")&&lodash_1.isPlainObject(response.data.contact)&&(Object.prototype.hasOwnProperty.call(response.data.contact,"emails")&&lodash_1.isPlainObject(response.data.contact.emails)&&(sharedValues.contact.emails=response.data.contact.emails),Object.prototype.hasOwnProperty.call(response.data.contact,"locations")&&lodash_1.isPlainObject(response.data.contact.locations)&&(sharedValues.contact.locations=response.data.contact.locations),Object.prototype.hasOwnProperty.call(response.data.contact,"phones")&&lodash_1.isPlainObject(response.data.contact.phones)&&(sharedValues.contact.phones=response.data.contact.phones),Object.prototype.hasOwnProperty.call(response.data.contact,"socialUrls")&&lodash_1.isPlainObject(response.data.contact.socialUrls)&&(sharedValues.contact.socialUrls=response.data.contact.socialUrls),Object.prototype.hasOwnProperty.call(response.data.contact,"urls")&&lodash_1.isPlainObject(response.data.contact.urls)&&(sharedValues.contact.urls=response.data.contact.urls)));Object.prototype.hasOwnProperty.call(response.data,"integrations")&&(Object.prototype.hasOwnProperty.call(response.data.integrations,"analytics")&&(Object.prototype.hasOwnProperty.call(response.data.integrations.analytics,"googleAnalytics")&&Object.prototype.hasOwnProperty.call(response.data.integrations.analytics.googleAnalytics,"accountId")&&lodash_1.isString(response.data.integrations.analytics.googleAnalytics.accountId)&&""!==response.data.integrations.analytics.googleAnalytics.accountId&&(sharedValues.integrations.analytics.googleAnalytics={accountId:response.data.integrations.analytics.googleAnalytics.accountId}),Object.prototype.hasOwnProperty.call(response.data.integrations.analytics,"listTrac")&&Object.prototype.hasOwnProperty.call(response.data.integrations.analytics.listTrac,"accountId")&&lodash_1.isString(response.data.integrations.analytics.listTrac.accountId)&&""!==response.data.integrations.analytics.listTrac.accountId&&(sharedValues.integrations.analytics.listTrac={accountId:response.data.integrations.analytics.listTrac.accountId},ListTrac.setAccountId(sharedValues.integrations.analytics.listTrac.accountId))),Object.prototype.hasOwnProperty.call(response.data.integrations,"maps")&&Object.prototype.hasOwnProperty.call(response.data.integrations.maps,"googleMaps")&&Object.prototype.hasOwnProperty.call(response.data.integrations.maps.googleMaps,"publicKey")&&lodash_1.isString(response.data.integrations.maps.googleMaps.publicKey)&&""!==response.data.integrations.maps.googleMaps.publicKey&&(sharedValues.integrations.maps.googleMaps={publicKey:response.data.integrations.maps.googleMaps.publicKey}));sessionInitialized||emitManual("sessionInit","Idx",null);emitManual("sessionRefresh","Idx",null),sessionInitialized=!0,keepAlive&&(clearTimeout(refreshLoginTimer),refreshLoginTimer=setTimeout(async()=>{await tokenRefresh()},1e3*(session.lastTtl-15)))}(response,keepAlive),resolve()):reject(tokenHandleBadResponse(response))},response=>{reject(tokenHandleBadResponse(response))})})}function tokenHandleBadResponse(response){let errorMessage="Token supplied is invalid or blank";return"object"==typeof response&&Object.prototype.hasOwnProperty.call(response,"data")&&Object.prototype.hasOwnProperty.call(response.data,"errors")&&Object.prototype.hasOwnProperty.call(response.data.errors,"length")&&(errorMessage=response.data.errors),$mdToast.show($mdToast.simple().textContent("Unable to authorize Idx feed!").toastClass("errorMessage").position("top right").hideDelay(5e3)),errorMessage}function updateFetchTime(apiFetch,modelName,serviceId){const fetchTime=apiFetch.header.get("x-fetch-time");if(fetchTime){const oldTime=session.services[serviceId].fetchTime[modelName];session.services[serviceId].fetchTime[modelName]=new Date(fetchTime),lodash_1.isDate(oldTime)&&lodash_1.isDate(session.services[serviceId].fetchTime[modelName])&&oldTime.getTime()===session.services[serviceId].fetchTime[modelName].getTime()||emitManual("fetchTimeUpdate","Idx",null,serviceId,modelName,session.services[serviceId].fetchTime[modelName])}}function modelInjectProperty(modelDatas,properties){return $q.all(modelDatas.map(modelData=>{lodash_1.extend(modelData,properties)}))}function compileGenericWhereFilter(where,searchPossibilities){const whereQuery={},andStatement=[],searchFunctions={valueEquals:(searchObject,value)=>{whereQuery[searchObject.apiField]=value},stringLike:(searchObject,value)=>{lodash_1.isEmpty(value)||(whereQuery[searchObject.apiField]={like:value,options:"i"})},stringLikeArray:(searchObject,value)=>{if((value="string"==typeof value?[value]:value).length>1){const stringLikeArrayOrStatement=[];value.forEach(requestedValue=>{lodash_1.isEmpty(requestedValue)||stringLikeArrayOrStatement.push({[searchObject.apiField]:{like:requestedValue,options:"i"}})}),lodash_1.isEmpty(stringLikeArrayOrStatement)||andStatement.push({or:stringLikeArrayOrStatement})}else 1===value.length&&(lodash_1.isEmpty(value[0])||(whereQuery[searchObject.apiField]={like:value[0],options:"i"}))},stringIncludesArray:(searchObject,value)=>{(value="string"==typeof value?[value]:value).length>1?whereQuery[searchObject.apiField]={inq:value}:1===value.length&&(whereQuery[searchObject.apiField]=value[0])},stringIncludesArrayAlternative:(searchObject,value)=>{(value="string"==typeof value?[value]:value).length>1?whereQuery[searchObject.apiField]={in:value}:1===value.length&&(whereQuery[searchObject.apiField]=value[0])},numberEqualGreater:(searchObject,value)=>{value&&0!==value&&(Object.prototype.hasOwnProperty.call(whereQuery,searchObject.apiField)&&Object.prototype.hasOwnProperty.call(whereQuery[searchObject.apiField],"lte")?whereQuery[searchObject.apiField]={between:[parseInt(value,10),parseInt(lodash_1.get(whereQuery[searchObject.apiField],"lte"),10)]}:whereQuery[searchObject.apiField]={gte:parseInt(value,10)})},numberEqualLess:(searchObject,value)=>{value&&0!==value&&(Object.prototype.hasOwnProperty.call(whereQuery,searchObject.apiField)&&Object.prototype.hasOwnProperty.call(whereQuery[searchObject.apiField],"gte")?whereQuery[searchObject.apiField]={between:[parseInt(lodash_1.get(whereQuery[searchObject.apiField],"gte"),10),parseInt(value,10)]}:whereQuery[searchObject.apiField]={lte:parseInt(value,10)})},andOr:(searchObject,value)=>{if(Object.prototype.hasOwnProperty.call(searchObject,"andOr")){const andOrOrStatement=[];searchObject.andOr.forEach(orObject=>{"valueEquals"===orObject.type?andOrOrStatement.push({[orObject.apiField]:value}):"stringLike"===orObject.type?lodash_1.isEmpty(value)||andOrOrStatement.push({[orObject.apiField]:{like:value,options:"i"}}):"stringLikeArray"===orObject.type?(value="string"==typeof value?[value]:value).length>1?value.forEach(requestedValue=>{lodash_1.isEmpty(requestedValue)||andOrOrStatement.push({[orObject.apiField]:{like:requestedValue,options:"i"}})}):1===value.length&&(lodash_1.isEmpty(value[0])||andOrOrStatement.push({[orObject.apiField]:{like:value[0],options:"i"}})):"stringIncludesArray"===orObject.type&&((value="string"==typeof value?[value]:value).length>1?andOrOrStatement.push({[orObject.apiField]:{inq:value}}):1===value.length&&andOrOrStatement.push({[orObject.apiField]:value[0]}))}),lodash_1.isEmpty(andOrOrStatement)||(andOrOrStatement.length>1?andStatement.push({or:andOrOrStatement}):1===andOrOrStatement.length&&andStatement.push(andOrOrStatement[0]))}}};for(const[widgetField,searchObject]of Object.entries(searchPossibilities))Object.prototype.hasOwnProperty.call(searchObject,"apiField")||(searchObject.apiField=widgetField),Object.prototype.hasOwnProperty.call(searchFunctions,searchObject.type)&&Object.prototype.hasOwnProperty.call(where,widgetField)&&""!==where[widgetField]&&searchFunctions[searchObject.type](searchObject,where[widgetField]);return lodash_1.isEmpty(andStatement)||(whereQuery.and=andStatement),whereQuery}function compilePropertyWhereFilter(where){return compileGenericWhereFilter(where,{ListingKey:{type:"valueEquals"},ListingId:{type:"stringIncludesArray"},ListingType:{type:"stringIncludesArray"},Status:{type:"stringIncludesArray"},ListPriceMin:{type:"numberEqualGreater",apiField:"_BestPrice"},ListPriceMax:{type:"numberEqualLess",apiField:"_BestPrice"},Bathrooms:{type:"numberEqualGreater"},Bedrooms:{type:"numberEqualGreater",apiField:"BedroomsTotal"},AgentLicense:{type:"stringIncludesArray"},OfficeNumber:{type:"stringIncludesArray"},OfficeName:{type:"stringIncludesArray"},OpenHouseOnly:{type:"valueEquals"},UnparsedAddress:{type:"stringLikeArray"},StreetAddress:{apiField:"_StreetAddress",type:"stringLikeArray"},eStreetAddress:{apiField:"_StreetAddress",type:"stringIncludesArray"},City:{type:"stringLikeArray"},eCity:{apiField:"City",type:"stringIncludesArray"},PostalCode:{type:"stringIncludesArray"},CountyOrParish:{type:"stringLikeArray"},eCountyOrParish:{apiField:"CountyOrParish",type:"stringIncludesArray"},SubdivisionName:{type:"stringLikeArray"},eSubdivisionName:{apiField:"SubdivisionName",type:"stringIncludesArray"},MLSAreaMajor:{type:"stringLikeArray"},eMLSAreaMajor:{apiField:"MLSAreaMajor",type:"stringIncludesArray"},MLSAreaMinor:{type:"stringLikeArray"},eMLSAreaMinor:{apiField:"MLSAreaMinor",type:"stringIncludesArray"},CityRegion:{type:"stringLikeArray"},eCityRegion:{apiField:"CityRegion",type:"stringIncludesArray"},Location:{type:"andOr",andOr:[{apiField:"City",type:"stringLikeArray"},{apiField:"CityRegion",type:"stringLikeArray"},{apiField:"CountyOrParish",type:"stringLikeArray"},{apiField:"SubdivisionName",type:"stringLikeArray"},{apiField:"MLSAreaMajor",type:"stringLikeArray"},{apiField:"MLSAreaMinor",type:"stringLikeArray"},{apiField:"PostalCode",type:"stringLikeArray"},{apiField:"UnparsedAddress",type:"stringLikeArray"},{apiField:"ListingId",type:"stringIncludesArray"}]},eLocation:{type:"andOr",andOr:[{apiField:"City",type:"stringIncludesArray"},{apiField:"CityRegion",type:"stringIncludesArray"},{apiField:"CountyOrParish",type:"stringIncludesArray"},{apiField:"SubdivisionName",type:"stringIncludesArray"},{apiField:"MLSAreaMajor",type:"stringIncludesArray"},{apiField:"MLSAreaMinor",type:"stringIncludesArray"},{apiField:"PostalCode",type:"stringIncludesArray"},{apiField:"ListingId",type:"stringIncludesArray"}]},Neighborhood:{type:"andOr",andOr:[{apiField:"CityRegion",type:"stringLikeArray"},{apiField:"SubdivisionName",type:"stringLikeArray"},{apiField:"MLSAreaMajor",type:"stringLikeArray"},{apiField:"MLSAreaMinor",type:"stringLikeArray"}]},eNeighborhood:{type:"andOr",andOr:[{apiField:"CityRegion",type:"stringIncludesArray"},{apiField:"SubdivisionName",type:"stringIncludesArray"},{apiField:"MLSAreaMajor",type:"stringIncludesArray"},{apiField:"MLSAreaMinor",type:"stringIncludesArray"}]}})}function compileMemberWhereFilter(where){return compileGenericWhereFilter(where,{MemberKey:{type:"valueEquals"},MemberStateLicense:{type:"valueEquals"},MemberNationalAssociationId:{type:"valueEquals"},MemberStatus:{type:"valueEquals"},MemberFullName:{type:"stringLike"}})}function compileOfficeWhereFilter(where){return compileGenericWhereFilter(where,{OfficeKey:{type:"valueEquals"},OfficeNationalAssociationId:{type:"valueEquals"},OfficeStatus:{type:"valueEquals"},OfficeNumber:{type:"stringIncludesArray"},OfficeName:{type:"stringLikeArray"}})}function compileGenericFilter(options,filterFunction){options.perPage||(options.perPage=20);let activeServices=0;"number"!=typeof options.service&&"string"!=typeof options.service||(options.service=[options.service]),options.service.forEach(serviceId=>{Object.prototype.hasOwnProperty.call(session.services,serviceId)&&activeServices++}),activeServices=activeServices>=1?activeServices:1;let skip=0;options.page&&(skip=(options.page-1)*options.perPage/activeServices);const filterQuery={where:filterFunction(options.where),limit:options.perPage,skip};options.fields&&(filterQuery.fields=options.fields),options.order&&options.order.length>0&&(filterQuery.order=function(orderUnparsed){"string"==typeof orderUnparsed&&(orderUnparsed=orderUnparsed.split(","));const orderQuery=[];return orderUnparsed.forEach(orderName=>{let direction="ASC";"-"===orderName.charAt(0)&&(orderName=orderName.substring(1,orderName.length),direction="DESC"),orderQuery.push(orderName+" "+direction)}),orderQuery}(options.order));const includes=[];return Object.entries({images:{relation:"Images",scope:{order:"Order",fields:["MediaURL"]}},openhouses:{relation:"OpenHouses",scope:{order:"OpenHouseStartTime",fields:["OpenHouseStartTime","OpenHouseEndTime"]}},office:{relation:"Office",scope:{fields:["OfficeName","OfficeKey"]}},managingBroker:{relation:"Member",scope:{fields:["MemberFullName","MemberStateLicense","MemberKey"]}},members:{relation:"Member",scope:{fields:["MemberFullName","MemberStateLicense","MemberKey"]}}}).forEach(([optionName,includeItem])=>{if(Object.prototype.hasOwnProperty.call(options,optionName)){const option=options[optionName];"object"==typeof option&&(Object.prototype.hasOwnProperty.call(option,"fields")?"*"===option.fields?delete includeItem.scope.fields:includeItem.scope.fields=option.fields:Object.prototype.hasOwnProperty.call(option,"limit")&&lodash_1.isNumber(option.limit)&&(includeItem.scope.limit=option.limit)),!1!==option&&includes.push(includeItem)}}),1===includes.length?filterQuery.include=includes[0]:includes.length>1&&(filterQuery.include=includes),filterQuery.fields.length<=0&&delete filterQuery.fields,filterQuery}function compilePropertyFilter(options){return compileGenericFilter(options,compilePropertyWhereFilter)}function compileMemberFilter(options){return compileGenericFilter(options,compileMemberWhereFilter)}function compileOfficeFilter(options){return compileGenericFilter(options,compileOfficeWhereFilter)}function getUrlOptionsPath(defaultOptions){defaultOptions??={};let path="";const searchOptionNames=Object.keys(urlOptions.Search);if(searchOptionNames.length>0){let searchPath="";searchOptionNames.forEach(searchOptionName=>{if(Object.prototype.hasOwnProperty.call(urlOptions.Search,searchOptionName)&&null!==urlOptions.Search[searchOptionName]){let defaultValue=defaultOptions[searchOptionName];const compareValue=urlOptions.Search[searchOptionName];!lodash_1.isArray(defaultValue)&&lodash_1.isArray(compareValue)&&(defaultValue=[defaultValue]),lodash_1.isEqual(defaultValue,compareValue)||(searchPath+=searchOptionName+"/"+compareValue+"/")}}),""!==searchPath&&(path+="Search/"+searchPath)}return Object.prototype.hasOwnProperty.call(urlOptions.Listing,"service")&&Object.prototype.hasOwnProperty.call(urlOptions.Listing,"ListingKey")&&!isNaN(urlOptions.Listing.service)&&urlOptions.Listing.ListingKey&&(path+="Listing/"+urlOptions.Listing.service+"/"+urlOptions.Listing.ListingKey+"/",Object.prototype.hasOwnProperty.call(urlOptions.Listing,"address")&&urlOptions.Listing.address&&"string"==typeof urlOptions.Listing.address&&(path+=urlOptions.Listing.address.replace(/ /g,"-")+"/")),path.length&&(path="/"+path),path}function getSingularApiModelName(name){let apiModelSingular="Property";switch(name){case"Properties":apiModelSingular="Property";break;case"Members":apiModelSingular="Member";break;case"Offices":apiModelSingular="Office";break;case"OpenHouses":apiModelSingular="OpenHouse"}return apiModelSingular}async function genericSearchCollection(uid,collectionVarName,options={},refresh=!1,moduleName,apiModel,compileFilterFunction){options.service??=[],options.where??={},options.order??=[],options.page??=1,options.perPage??=10,options.images||=!1,options.fields??=["_id"],"string"==typeof options.order&&(options.order=options.order.split(",")),"number"==typeof options.service&&(options.service=[options.service]),0===options.service.length&&(options.service=[0]);const apiModelSingular=getSingularApiModelName(apiModel),collection=function(uid,moduleName,scopedCollectionVarName){let collection;return Object.keys(instance[moduleName].list).forEach(listName=>{!collection&&listName===uid&&Object.prototype.hasOwnProperty.call(instance[moduleName].list,listName)&&Object.prototype.hasOwnProperty.call(instance[moduleName].list[listName],scopedCollectionVarName)&&instance[moduleName].list[listName][scopedCollectionVarName]instanceof collection_1.Collection&&(collection=instance[moduleName].list[listName][scopedCollectionVarName])}),collection||(collection=new collection_1.Collection),Object.keys(instance[moduleName].list).forEach(listName=>{listName!==uid||Object.prototype.hasOwnProperty.call(instance[moduleName].list[listName],scopedCollectionVarName)&&instance[moduleName].list[listName][scopedCollectionVarName]===collection||(instance[moduleName].list[listName][scopedCollectionVarName]=collection)},this),collection}(uid,moduleName,collectionVarName),filterQuery=compileFilterFunction(options),collections=[];if(!lodash_1.isEqual(lastQueries.whereFilter,filterQuery.where)||lastQueries.order!==options.order||lastQueries.perPage!==options.perPage||refresh?(collection.models.splice(0,collection.models.length),refresh=!0,lastQueries.pages=[],filterQuery.count=!0):refresh=!1,collection.models.length<options.page*options.perPage){if(collection.pending=!0,Object.keys(instance[moduleName].list).forEach(listName=>{instance[moduleName].list[listName].$applyAsync()}),options.page>1&&!lastQueries.pages.includes(options.page-1,options.page-2)){filterQuery.limit=options.perPage*options.page,filterQuery.skip=0;for(let addPage=1;addPage<options.page;addPage++)lastQueries.pages.push(addPage)}if(0!==options.service.length?setIdxServices(options.service):options.service=getIdxServices(),await tokenKeepAuth(),0===options.service.length&&(options.service=Object.keys(session.services)),options.service.forEach(serviceId=>{if(Object.prototype.hasOwnProperty.call(session.services,serviceId)){const filterQueryCustom=lodash_1.clone(filterQuery);refresh||(filterQueryCustom.skip=lodash_1.get(collection.meta,`data.recordCounts[${serviceId}]`)??0);const request={serviceId,urlRoot:session.services[serviceId].host,target:apiModel+"/search",api:{filter:filterQueryCustom,meta:{action:"search",format:"reso"},route:{controller:apiModelSingular}}};collections.push(function(request){request.direct=!0,request.api&&(request.api.apiVersion="3.13.0");const collection=new collection_1.Collection(request);return request.api&&collection.meta.set("api",misc_1.isJSON(request.api)?JSON.parse(request.api):request.api),collection}(request))}}),await async function(originalCollection,collections,modelName,append=!1){originalCollection.pending=!0,originalCollection.completed=!1;let maxCount=0,totalCount=0;const fetchPromises=[];return collections.forEach(collection=>{const options={};null!==session.services[collection.serviceId].token&&(options.headers={Authorization:session.services[collection.serviceId].token}),fetchPromises.push($q(async resolve=>{await collection.fetch("POST",null,options),await modelInjectProperty(collection.models,{_ServiceId:collection.serviceId}),updateFetchTime(collection,modelName,collection.serviceId);const maxRecords=collection.header.get("x-max-count"),countRecords=collection.header.get("x-total-count");maxRecords&&(maxCount+=parseInt(maxRecords,10)),countRecords&&(totalCount+=parseInt(countRecords,10),maxRecords||(maxCount+=parseInt(countRecords,10))),resolve(collection.models)}))}),append||originalCollection.models.splice(0,originalCollection.models.length),$q.all(fetchPromises).then(async fetchedData=>(await $q.all(fetchedData.map(models=>{lodash_1.isArray(models)&&originalCollection.models.push(...models)})),originalCollection)).then(()=>(originalCollection.header.set("x-max-count",maxCount),originalCollection.header.set("x-total-count",totalCount),originalCollection.meta.set("fetchDate",new Date),originalCollection.pending=!1,originalCollection.completed=!0,originalCollection.filtering=!1,originalCollection.paginate=!1,originalCollection))}(collection,collections,apiModelSingular,!refresh),refresh){const maxRecords=collection.header.get("x-max-count")||0,totalRecords=collection.header.get("x-total-count")||0;collection.meta.set("maxRecords",maxRecords),collection.meta.set("totalRecords",totalRecords),collection.meta.set("totalPages",Math.ceil((maxRecords||totalRecords)/options.perPage))}!function(collection,propertyNames,reverse=!1){if(propertyNames){const orderPropertyNames=lodash_1.isArray(propertyNames)?lodash_1.clone(propertyNames):[lodash_1.clone(propertyNames)];orderPropertyNames.forEach((item,index)=>{"BestPrice"===item?orderPropertyNames[index]="_BestPrice":"-BestPrice"===item&&(orderPropertyNames[index]="-_BestPrice"),"Status"===item?orderPropertyNames[index]="_Status":"-Status"===item&&(orderPropertyNames[index]="-_Status")}),collection.models=orderByFilter(collection.models,orderPropertyNames,reverse)}}(collection,options.order),collection.models.length>options.page*options.perPage&&collection.models.splice(options.page*options.perPage,collection.models.length);const recordCounts={};await $q.all(collection.models.map(model=>{recordCounts[model._ServiceId]??=0,recordCounts[model._ServiceId]++})),collection.meta.set("recordCounts",recordCounts),Object.keys(instance[moduleName].list).forEach(listName=>{instance[moduleName].list[listName].$applyAsync()})}return lastQueries.whereFilter=lodash_1.clone(filterQuery.where),lastQueries.order=options.order,lastQueries.perPage=options.perPage,lastQueries.pages.push(options.page),lastQueries.time=new Date,collection}async function genericSearchModel($scope,modelVarName,options={},apiModel,compileFilterFunction){await tokenKeepAuth(),options.service??=0,options.where??={},options.images||=!1,options.fields??=[],options.perPage=1,lodash_1.isArray(options.service)&&(options.service=options.service[0]);const apiModelSingular=getSingularApiModelName(apiModel);let model;if(Object.prototype.hasOwnProperty.call($scope,modelVarName)&&(model=$scope[modelVarName]),model||(model=new model_1.Model),Object.prototype.hasOwnProperty.call($scope,modelVarName)&&$scope[modelVarName]===model||($scope[modelVarName]=model),Object.prototype.hasOwnProperty.call(session.services,options.service)){const tempModel=function(request){request.api&&!lodash_1.isString(request.api)&&(request.api.apiVersion="3.13.0");const model=new model_1.Model(request);return Object.prototype.hasOwnProperty.call(request,"api")&&request.api&&model.meta.set("api",misc_1.isJSON(request.api)?JSON.parse(request.api):request.api),Object.prototype.hasOwnProperty.call(request,"serviceId")&&(model.serviceId=request.serviceId),model}({serviceId:options.service,urlRoot:session.services[options.service].host,target:apiModel+"/search",api:{filter:compileFilterFunction(options),meta:{action:"search",format:"reso"},route:{controller:apiModelSingular}}});(async function(originalModel,newModel,modelName){originalModel.pending=!0,originalModel.completed=!1;const fetchPromises=[],options={};null!==session.services[newModel.serviceId].token&&(options.headers={Authorization:session.services[newModel.serviceId].token}),fetchPromises.push($q(async resolve=>{await newModel.fetch("POST",null,options),await modelInjectProperty([newModel.data],{_ServiceId:newModel.serviceId}),updateFetchTime(newModel,modelName,newModel.serviceId),resolve(newModel.data)}));const fetchedData=await $q.all(fetchPromises);return await $q.all(fetchedData.map(data=>{originalModel.data=data})),originalModel.meta.set("fetchDate",new Date),originalModel.pending=!1,originalModel.completed=!0,originalModel})(model,tempModel,apiModelSingular).then(()=>{$scope.$applyAsync()})}return lastQueries.time=new Date,$scope[modelVarName]}function getFriendlyStatus(property,preferredStatus="Closed"){let statusName="";if(Object.prototype.hasOwnProperty.call(property,"MlsStatus")&&""!==property.MlsStatus?statusName=property.MlsStatus:Object.prototype.hasOwnProperty.call(property,"StandardStatus")&&""!==property.StandardStatus&&(statusName=property.StandardStatus),""!==statusName)switch(statusName){case"Act Cont Release":case"Act Cont Show":case"Contingent - Release":case"Contingent - Show":case"Contingent-Release":case"Contingent-Show":statusName="Contingent";break;default:statusName=getFriendlyClosedStatus(property,statusName,preferredStatus)}return statusName}function getFriendlyClosedStatus(property,statusName,preferredStatus="Closed"){if(""!==statusName)if("Closed"===preferredStatus)switch(statusName){case"Sold":case"Leased/Option":case"Leased/Rented":statusName="Closed"}else switch(statusName){case"Closed":case"Sold":statusName="Sold",Object.prototype.hasOwnProperty.call(property,"_IsRental")&&property._IsRental&&(statusName=preferredStatus);break;case"Leased/Option":case"Leased/Rented":statusName=preferredStatus}return statusName}function getStreetAddress(property){if(Object.prototype.hasOwnProperty.call(property,"StreetName")&&""!==property.StreetName||!Object.prototype.hasOwnProperty.call(property,"UnparsedAddress")||""===property.UnparsedAddress){const addressParts=[];return Object.prototype.hasOwnProperty.call(property,"StreetNumberNumeric")&&lodash_1.isNumber(property.StreetNumberNumeric)&&property.StreetNumberNumeric>0?addressParts.push(property.StreetNumberNumeric.toString()):Object.prototype.hasOwnProperty.call(property,"StreetNumber")&&""!==property.StreetNumber&&addressParts.push(property.StreetNumber),["StreetDirPrefix","StreetName","StreetSuffix","StreetSuffixModifier","StreetDirSuffix","UnitNumber"].forEach(addressPart=>{Object.prototype.hasOwnProperty.call(property,addressPart)&&("StreetSuffix"===addressPart&&"None"===property[addressPart]&&(property[addressPart]=""),"UnitNumber"===addressPart&&addressParts.push("Unit"),lodash_1.isEmpty(property[addressPart])||addressParts.push(property[addressPart]))}),addressParts.join(" ")}return property.UnparsedAddress||""}function getNestedPathValue(currentNest,pathPieces){const currentPiece=pathPieces.shift();return pathPieces[0]?getNestedPathValue(currentNest[currentPiece],pathPieces):Object.prototype.hasOwnProperty.call(currentNest,currentPiece)?currentNest[currentPiece]:null}async function updateNestedPathValue(currentNest,pathPieces,value){const currentPiece=pathPieces.shift();return currentPiece?pathPieces[0]?updateNestedPathValue(currentNest[currentPiece],pathPieces,value):Object.prototype.hasOwnProperty.call(currentNest,currentPiece)&&!lodash_1.isArray(currentNest[currentPiece])&&lodash_1.isArray(value)?void console.warn("updateNestedPathValue couldn't connect",currentPiece," as value given is array, but value stored is not: ",lodash_1.clone(currentNest),"It may need to be initialized first (as an array)"):(!lodash_1.isArray(currentNest[currentPiece])||lodash_1.isArray(value)||misc_1.isJSON(value)||(value=""===value?[]:value.split(",")),lodash_1.isArray(value)||!lodash_1.isObject(currentNest[currentPiece])&&!misc_1.isJSON(value)?currentNest[currentPiece]=lodash_1.clone(value):currentNest[currentPiece]=JSON.parse(value),value):(console.warn("updateNestedPathValue couldn't find",currentPiece,"in",lodash_1.clone(currentNest),"It may need to be initialized first"),null)}return{apiVersion:"3.13.0",fetchMembers:async function(uid,collectionVarName,options={},refresh=!1){return options.service??=[],options.where??={},options.order??=[],options.page??=1,options.perPage??=10,options.images||=!1,options.office||=!1,options.fields??=["_id","MemberKey","MemberStateLicense","MemberNationalAssociationId","MemberFirstName","MemberLastName","MemberFullName","MemberStatus","MemberMlsAccessYN","MemberType","MemberAOR","OfficeKey","OfficeMlsId","OfficeName","OriginatingSystemName","SourceSystemName"],genericSearchCollection(uid,collectionVarName,options,refresh,"member","Members",compileMemberFilter)},fetchOffices:async function(uid,collectionVarName,options={},refresh=!1){return options.service??=[],options.where??={},options.order??=[],options.page??=1,options.perPage??=10,options.images||=!1,options.managingBroker||=!1,options.members||=!1,options.fields??=["_id","OfficeKey","OfficeMlsId","OfficeName","OfficeNationalAssociationId","OfficeStatus","OfficePhone","OfficeAddress1","OfficeCity","OfficePostalCode","OfficeBrokerKey"],refresh||=!1,genericSearchCollection(uid,collectionVarName,options,refresh,"office","Offices",compileOfficeFilter)},fetchProperties:async function(uid,collectionVarName,options={},refresh=!1){if(options.service??=[],!options.where&&!lodash_1.isEmpty(urlOptions.Search)){const whereReAssign=urlOptions.Search;delete urlOptions.Search.Page,delete urlOptions.Search.Order,options.where=whereReAssign}return options.where??={},options.order??=urlOptions.Search.Order||[],options.page??=urlOptions.Search.Page||1,options.perPage??=10,options.images||=!1,options.fields??=["_id","_Class","MlsStatus","PropertyType","PropertySubType","UnparsedAddress","StreetNumber","StreetNumberNumeric","StreetName","StreetSuffix","UnitNumber","City","CityRegion","MLSAreaMajor","MLSAreaMinor","CountyOrParish","StateOrProvince","Latitude","Longitude","ListPrice","ClosePrice","ListingId","ListingKey","BathroomsTotalInteger","BathroomsFull","BathroomsHalf","BathroomsOneQuarter","BathroomsThreeQuarter","BathroomsPartial","BedroomsTotal"],Object.prototype.hasOwnProperty.call(options.where,"OpenHouseOnly")&&lodash_1.isString(options.where.OpenHouseOnly)&&(options.where.OpenHouseOnly="true"===options.where.OpenHouseOnly),Object.prototype.hasOwnProperty.call(options.where,"OpenHouseOnly")&&options.where.OpenHouseOnly&&(options.openhouses=!0),lodash_1.isEmpty(options.where.Neighborhood)&&lodash_1.isEmpty(options.where.eNeighborhood)&&lodash_1.isEmpty(options.where.Location)&&lodash_1.isEmpty(options.where.eLocation)&&lodash_1.isEmpty(options.where.AgentLicense)&&lodash_1.isEmpty(options.where.OfficeNumber)&&lodash_1.isEmpty(options.where.City)&&lodash_1.isEmpty(options.where.eCity)&&lodash_1.isEmpty(options.where.CityRegion)&&lodash_1.isEmpty(options.where.eCityRegion)&&lodash_1.isEmpty(options.where.CountyOrParish)&&lodash_1.isEmpty(options.where.eCountyOrParish)&&lodash_1.isEmpty(options.where.MLSAreaMajor)&&lodash_1.isEmpty(options.where.eMLSAreaMajor)&&lodash_1.isEmpty(options.where.MLSAreaMinor)&&lodash_1.isEmpty(options.where.eMLSAreaMinor)&&lodash_1.isEmpty(options.where.PostalCode)&&lodash_1.isEmpty(options.where.UnparsedAddress)&&(options.openhouses=!1,delete options.where.OpenHouseOnly),genericSearchCollection(uid,collectionVarName,options,refresh,"property","Properties",compilePropertyFilter)},fetchProperty:async function($scope,modelVarName,options={}){return options.service??=null,options.where??={},options.images||=!1,options.openhouses||=!1,options.fields??=[],genericSearchModel($scope,modelVarName,options,"Properties",compilePropertyFilter)},clearFieldInput:function(ev){ev&&ev.hasOwnProperty("target")&&ev.target&&ev.target.hasOwnProperty("value")&&(ev.target.value=null)},countArraysNotEmpty:function(arrayList){return arrayList.filter(e=>e.length).length},devLog:function(...items){environment_1.cookie("env")&&console.log(...items)},emit:function(emitterName,$scope,var1,var2,var3){emitManual(emitterName,$scope.elementId,$scope,var1,var2,var3)},emitManual,ensureItemsAreArrays:function(itemParent,itemNames){itemNames.forEach(itemName=>{itemParent.hasOwnProperty(itemName)&&!lodash_1.isArray(itemParent[itemName])&&(itemParent[itemName]=lodash_1.isEmpty(itemParent[itemName])?[]:[itemParent[itemName]])})},getContactVariables:function(){return session.contacts},getDefaultWhereOptions:function(){return lodash_1.clone(defaultWhereOptions)},getDisclaimerInstance:function(disclaimerUid){return disclaimerUid?Object.prototype.hasOwnProperty.call(instance.disclaimer,disclaimerUid)?{[instance.disclaimer[disclaimerUid].elementId]:instance.disclaimer[disclaimerUid]}:null:instance.disclaimer},getFriendlyPriceLabel:function(property){let priceLabel="List";if(property.hasOwnProperty("ClosePrice")){switch(getFriendlyStatus(property)){case"Closed":default:priceLabel="Sale";break;case"Leased":priceLabel="Lease";break;case"Rented":priceLabel="Rent"}}return priceLabel+=" Price",priceLabel},getFriendlyStatus,getFullAddress:function(property,encode){const address=getStreetAddress(property)+", "+property.City+" "+property.StateOrProvince;return encode?encodeURIComponent(address):address},getFullStatus:function(property,preferredStatus="Closed"){let statusName="";return Object.prototype.hasOwnProperty.call(property,"MlsStatus")&&""!==property.MlsStatus?statusName=property.MlsStatus:Object.prototype.hasOwnProperty.call(property,"StandardStatus")&&""!==property.StandardStatus&&(statusName=property.StandardStatus),""!==statusName&&(statusName=getFriendlyClosedStatus(property,statusName,preferredStatus)),statusName},getGoogleMapsKey:function(){let googleMapsKey=null;return sharedValues.integrations&&Object.prototype.hasOwnProperty.call(sharedValues.integrations,"maps")&&Object.prototype.hasOwnProperty.call(sharedValues.integrations.maps,"googleMaps")&&Object.prototype.hasOwnProperty.call(sharedValues.integrations.maps.googleMaps,"publicKey")&&""!==sharedValues.integrations.maps.googleMaps.publicKey&&(googleMapsKey=sharedValues.integrations.maps.googleMaps.publicKey),googleMapsKey},getIdxServices,getInput:function(elementId){return angular_1.element(document.getElementById(elementId))},getScopeValuePath:function(scope,scopeVarPath){return getNestedPathValue(scope,scopeVarPath.split("."))},getLastQueryTime:function(){return lastQueries.time},getLastSessionTime:function(){return session.lastCreated},getListInstance:function(listUid,moduleName="property"){return Object.prototype.hasOwnProperty.call(instanceLink.List,listUid)?instance[moduleName].list[listUid]:null},getListInstanceLinks:function(listUid,moduleName="property"){const linkedSearches=[];return Object.prototype.hasOwnProperty.call(instanceLink.List,listUid)&&instanceLink.List[listUid].forEach(searchUid=>{Object.prototype.hasOwnProperty.call(instance[moduleName].list,searchUid)&&linkedSearches.push(instance[moduleName].list[searchUid])}),linkedSearches},getMLSVariables:function(serviceIds){const serviceList=[];return serviceIds&&lodash_1.isArray(serviceIds)?serviceIds.forEach(serviceId=>{Object.prototype.hasOwnProperty.call(session.services,serviceId)&&serviceList.push({id:session.services[serviceId].id,name:session.services[serviceId].name,disclaimer:session.services[serviceId].disclaimer,fetchTime:session.services[serviceId].fetchTime,analyticsEnabled:session.services[serviceId].analyticsEnabled,logo:session.services[serviceId].logo,mandatoryLogo:session.services[serviceId].mandatoryLogo})}):Object.values(session.services).forEach(service=>{lodash_1.isEmpty(service)||serviceList.push({id:service.id,name:service.name,disclaimer:service.disclaimer,fetchTime:service.fetchTime,analyticsEnabled:service.analyticsEnabled,logo:service.logo,mandatoryLogo:service.mandatoryLogo})}),serviceList},getNestedPathValue,getOptionsFromUrl:function(){let hash=misc_1.getHashBangParam("#!");return hash=function(path){const regex=/\/Listing\/(\d{1,3})\/([^/\s]+)(\/?[\w\-_]*\/?)?/,matches=regex.exec(path);path=path.replace(regex,""),null!==matches&&matches[1]&&matches[2]&&(urlOptions.Listing.service=matches[1],urlOptions.Listing.ListingKey=matches[2]);return path}(hash),function(path){let regex=/\/Search\/(.*)?\/?/,matches=regex.exec(path);if(path=path.replace(regex,""),null!==matches&&matches[1]){const rawSearchOptions=matches[1];regex=/([^/]+)\/([^/]*)/g;const whileLoopAssignmentBypass=(regexp,value)=>(matches=regexp.exec(value),matches);for(;null!=whileLoopAssignmentBypass(regex,rawSearchOptions);)matches[1]&&(matches[2]&&matches[2].includes(",")?urlOptions.Search[matches[1]]=matches[2].split(","):urlOptions.Search[matches[1]]=matches[2])}Object.prototype.hasOwnProperty.call(urlOptions.Search,"Page")&&lodash_1.isString(urlOptions.Search.Page)&&(urlOptions.Search.Page=parseInt(urlOptions.Search.Page,10))}(hash),urlOptions},getSearchInstanceLinks:function(searchUid,moduleName="property"){const linkedLists=[];return Object.prototype.hasOwnProperty.call(instanceLink.Search,searchUid)&&instanceLink.Search[searchUid].forEach(listUid=>{Object.prototype.hasOwnProperty.call(instance[moduleName].list,listUid)&&linkedLists.push(instance[moduleName].list[listUid])}),linkedLists},getStreetAddress,getUrlOptions:function(listingOrSearch){return urlOptions[listingOrSearch]},getUrlOptionsPath,getWebsiteMainContact:function(){const contact={name:null,email:null,phone:null};return lodash_1.isPlainObject(sharedValues.contact)&&(contact.name=lodash_1.clone(sharedValues.contact.name),sharedValues.contact.emails.hasOwnProperty("Main")&&(contact.email=lodash_1.clone(sharedValues.contact.emails.Main)),sharedValues.contact.phones.hasOwnProperty("Main")&&(contact.phone=lodash_1.clone(sharedValues.contact.phones.Main))),lodash_1.isString(contact.name)&&""!==contact.name?contact:null},on:function(uid,emitterName,callback){if("init"===emitterName&&Object.prototype.hasOwnProperty.call(instanceOnEmitters,uid)&&Object.prototype.hasOwnProperty.call(instanceOnEmitters[uid],emitterName)&&Object.prototype.hasOwnProperty.call(stratus_1.Stratus.Instances,uid))return void callback(stratus_1.Stratus.Instances[uid]);if("Idx"===uid&&"sessionInit"===emitterName&&sessionInitialized)return void callback(null);Object.prototype.hasOwnProperty.call(instanceOnEmitters,uid)||(instanceOnEmitters[uid]={}),Object.prototype.hasOwnProperty.call(instanceOnEmitters[uid],emitterName)||(instanceOnEmitters[uid][emitterName]={});const onId=lodash_1.uniqueId();return instanceOnEmitters[uid][emitterName][onId]=callback,()=>{!function(emitterName,emitterId,onId){Object.prototype.hasOwnProperty.call(instanceOnEmitters,emitterId)&&Object.prototype.hasOwnProperty.call(instanceOnEmitters[emitterId],emitterName)&&Object.prototype.hasOwnProperty.call(instanceOnEmitters[emitterId][emitterName],onId)&&delete instanceOnEmitters[emitterId][emitterName][onId]}(uid,emitterName,onId)}},registerDetailsInstance:function(uid,moduleName,$scope){instance[moduleName].details[uid]=$scope},registerDisclaimerInstance:function(uid,$scope){Object.prototype.hasOwnProperty.call(instance,"disclaimer")||(instance.disclaimer={}),instance.disclaimer[uid]=$scope,Object.prototype.hasOwnProperty.call(instanceLink.Disclaimer,uid)||(instanceLink.Disclaimer[uid]=[])},registerListInstance:function(uid,moduleName,$scope){Object.prototype.hasOwnProperty.call(instance,moduleName)||(instance[moduleName].list={}),instance[moduleName].list[uid]=$scope,Object.prototype.hasOwnProperty.call(instanceLink.List,uid)||(instanceLink.List[uid]=[])},registerMapInstance:function(uid,$scope){Object.prototype.hasOwnProperty.call(instance,"map")||(instance.map={}),instance.map[uid]=$scope,Object.prototype.hasOwnProperty.call(instanceLink.Map,uid)||(instanceLink.Map[uid]=[])},registerSearchInstance:function(uid,moduleName,$scope,listUid){instance[moduleName].search[uid]=$scope,Object.prototype.hasOwnProperty.call(instanceLink.Search,uid)||(instanceLink.Search[uid]=[]),listUid&&(instanceLink.Search[uid].push(listUid),Object.prototype.hasOwnProperty.call(instanceLink.List,listUid)||(instanceLink.List[listUid]=[]),instanceLink.List[listUid].push(uid))},setIdxServices,setPageTitle:function(title){defaultPageTitle||(defaultPageTitle=JSON.parse(JSON.stringify($window.document.title))),$window.document.title=title||defaultPageTitle},setTokenURL:function(url){tokenRefreshURL=url},setUrlOptions:function(listingOrSearch,options){urlOptions[listingOrSearch]=options||{}},sharedValues,tokenKeepAuth,refreshUrlOptions:function(defaultOptions){var path;path=getUrlOptionsPath(defaultOptions),$rootScope.$applyAsync(()=>{misc_1.setHashBangParam(path,"#!")})},updateNestedPathValue,updateScopeValuePath:async function(scope,scopeVarPath,value){return null!=value&&"null"!==value&&""!==value&&updateNestedPathValue(scope,scopeVarPath.split("."),value)},unregisterDetailsInstance:function(uid,moduleName){if(Object.prototype.hasOwnProperty.call(instance[moduleName].details,uid)){const detailUid=instance[moduleName].details[uid].elementId;delete instance[moduleName].details[uid],stratus_1.Stratus.Instances.Clean(detailUid)}}}},stratus_1.Stratus.Services.Idx=["$provide",$provide=>{$provide.factory("Idx",angularJsService)}]}}});