PageSourceSearch

https://musaffa.com/chunk-VFV5YEE4.js

js musaffa.com collected 2026-09-24 09:12:21 UTC 5,716 bytes, 1 lines download raw bytes

1import{b as L}from"./chunk-VKYJ6PDM.js";import{b as I,c as x,d as T}from"./chunk-RZWUF2WE.js";import{a as F}from"./chunk-KCEJCXJZ.js";import{d as b}from"./chunk-5BVZXLFA.js";import{a as y}from"./chunk-ARD6OICO.js";import{e as M}from"./chunk-BBHJ2D5U.js";import{a as S}from"./chunk-2P2IIG2U.js";import{b as g,g as R}from"./chunk-J3TYBNDU.js";import{b as O}from"./chunk-4QCSDQDN.js";import{B as E,K as k,ba as A,ea as h,ma as v,n as N,o as f,qa as p,v as l}from"./chunk-H5RMQNTW.js";import{a as C,b as _}from"./chunk-YNC7RVHT.js";var J=(()=>{class u{constructor(t,o,i,e,n,s){this.modal=t,this.http=o,this.collectionCompliance=i,this.authService=e,this.subscriptionService=n,this.firebaseRemoteConfig=s,this.opening=!1}async open(){if(!(this.modalRef||this.opening)){this.opening=!0;try{let{AssetSearchModalComponent:t}=await import("./chunk-4VYSZQVS.js");if(this.modalRef)return;this.modalRef=this.modal.open(t,{size:"lg",animation:!1,windowClass:"stocks-etfs-search-modal",centered:!0}),this.modalRef.result.finally(()=>{this.modalRef=void 0})}finally{this.opening=!1}}}close(){this.modalRef?.close(),this.modalRef=void 0}searchStocksAndEtfs(t,o=[],i=[],e){return t===""?f([]):N(this.firebaseRemoteConfig.getSearchDefaults()).pipe(h(n=>{let s=this.authService.isLoggedIn(),c=I({name:t,stockCountries:o,etfCountries:i,userCountry:e,isLoggedIn:s,enableSearchFilters:n.enableSearchFilters});return this.http.post(S.typeSense.url+"/multi_search",{searches:c}).pipe(h(m=>{let a=m?.results,r=x(a,t,s&&!!e);return this.applyComplianceAccess(r)}),l(m=>(m.sort((a,r)=>(r.textMatch??0)-(a.textMatch??0)),m)))}))}applyComplianceAccess(t){let o=t.filter(e=>e.type==="STOCK").map(e=>T(e)),i=t.filter(e=>e.type==="ETF").map(e=>e.stockName);return E({accessibleStocks:this.collectionCompliance.getAccessibleComplianceSymbols(o,"stocks"),accessibleEtfs:this.collectionCompliance.getAccessibleComplianceSymbols(i,"etfs")}).pipe(l(({accessibleStocks:e,accessibleEtfs:n})=>{let s=b.subscriptionData.getValue()?.role??"ANONYMOUS",c=this.authService.isLoggedIn(),m=s!=="ANONYMOUS"&&s!=="FREEMIUM";return t.map(a=>{let r=a.type==="STOCK"?e.includes(T(a)):n.includes(a.stockName),w=!r&&!c,d=!1;return r||m?d=!1:c?d=a.complianceStatus==="COMPLIANT":d=!0,_(C({},a),{isStatusLocked:w,isRatingLocked:d,isAccessible:r})})}))}getTopStocks(){if(!this._cachedTopStocks$){let t=`${S.typeSense.url}/collections/${y.STOCKS_DATA}/documents/search`,o=new g().set("page","1").set("per_page","20").set("q","*").set("filter_by","$company_profile_collection_new(id:*)&&status:=PUBLISH&&country:=US&&exchange:=[`NYSE`,`NASDAQ`,`XASE`,`BATS`,`ARCX`]&&sharia_compliance:=[`COMPLIANT`,`NON_COMPLIANT`,`QUESTIONABLE`]").set("sort_by","usdMarketCap:desc");this._cachedTopStocks$=this.http.get(t,{params:o}).pipe(l(i=>this.mapTopStocks(i)),A({bufferSize:1,refCount:!0}))}return this._cachedTopStocks$.pipe(h(t=>this.applyComplianceAccess(t)))}mapTopStocks(t){return t?.hits?.length?t.hits.map(o=>{let i=o.document;return{stockName:i.company_profile_collection_new.ticker,companyName:i.company_profile_collection_new.name,type:"STOCK",exchange:i.company_profile_collection_new.exchange,logo:i.company_profile_collection_new.logo,countryCode:"US",countryName:"United States",flag:"us",complianceStatus:i.company_profile_collection_new.shariahCompliantStatus??"",complianceRating:i.company_profile_collection_new.ranking_v2??"",textMatch:0}}):[]}getTopETFs(){if(!this._cachedTopEtfs$){let t=`${S.typeSense.url}/collections/${y.ETFS_DATA}/documents/search`,o=new g().set("page","1").set("per_page","20").set("q","*").set("filter_by","domicile:=US&&exchange:=[`NYSE`,`NYSE ARCA`,`NASDAQ`,`BATS`]&&shariahCompliantStatus:=[`COMPLIANT`,`NON_COMPLIANT`,`QUESTIONABLE`]").set("sort_by","aum:desc");this._cachedTopEtfs$=this.http.get(t,{params:o}).pipe(l(i=>this.mapTopETFs(i)),h(i=>{if(!i.length)return f([]);let e=i.map(n=>n.stockName);return this.getEtfDataFromSymbols(e).pipe(l(n=>i.map(s=>{let c=n[s.stockName];return _(C({},s),{companyName:c?.name??s.companyName,complianceStatus:String(c?.shariahStates??s.complianceStatus??""),complianceRating:c?.ranking??s.complianceRating??""})})))}),A({bufferSize:1,refCount:!0}))}return this._cachedTopEtfs$.pipe(h(t=>this.applyComplianceAccess(t)))}mapTopETFs(t){return t?.hits?.length?t.hits.map(o=>{let i=o.document;return{stockName:i.symbol,companyName:i.name,type:"ETF",exchange:i.exchange,countryCode:"US",countryName:"United States",logo:i.logo,flag:"us",complianceStatus:String(i.shariahStates??""),complianceRating:i.ranking,textMatch:0}}):[]}getEtfDataFromSymbols(t){if(!t.length)return f({});let o=`${S.typeSense.url}/collections/${y.ETF_PROFILE}/documents/search`,i=new g().set("q","*").set("per_page","250").set("filter_by",`symbol:=[${t.join(",")}]`);return this.http.get(o,{params:i}).pipe(l(e=>this.mapProfilesBySymbol(e)),k(e=>(console.error("[ETF profile error]",e),f({}))))}mapProfilesBySymbol(t){let o={};for(let i of t?.hits??[]){let e=i.document;
1o[e.symbol]={id:e.id,symbol:e.symbol,name:e.name,exchange:e.exchange,domicile:e.domicile,aum:e.aum,nav:e.nav,navCurrency:e.navCurrency,expenseRatio:e.expenseRatio,assetClass:e.assetClass,etfCompany:e.etfCompany,inceptionDate:e.inceptionDate,numberOfHoldings:e.numberOfHoldings,trackingIndex:e.trackingIndex,halal:e.halal,notHalal:e.notHalal,avoid:e.avoid,unCovered:e.unCovered,cusip:e.cusip,isin:e.isin,identifier:e.identifier,mainSymbol:e.mainSymbol,shariahStates:e.shariahStates,investmentSegment:e.investmentSegment,ranking:e.ranking,description:e.description}}return o}static{this.\u0275fac=function(o){return new(o||u)(p(O),p(R),p(L),p(M),p(b),p(F))}}static{this.\u0275prov=v({token:u,factory:u.\u0275fac,providedIn:"root"})}}return u})();export{J as a};

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.