import{r as t,d as s,B as i,h as n,H as o}from"./p-f8363b1b.js";const h=class{constructor(i){t(this,i),this.fireenjinFetch=s(this,"fireenjinFetch",7),this.params={}}async onError(t){var s;if(t.detail.name===this.name){let i=(null===(s=null==t?void 0:t.detail)||void 0===s?void 0:s.data)||null;"function"==typeof this.error&&this.error(i)}}async onSuccess(t){var s;if(t.detail.name===this.name){let i=(null===(s=null==t?void 0:t.detail)||void 0===s?void 0:s.data)||[];if(this.resultsKey)try{i=this.resultsKey.split(".").reduce(((t,s)=>t[s]),t.detail.data)}catch(s){console.log("Error getting results",t.detail,this.resultsKey)}"function"==typeof this.success&&this.success(i)}}async fetch(){this.fireenjinFetch.emit({name:this.name,endpoint:this.endpoint,dataPropsMap:this.dataPropsMap?this.dataPropsMap:null,params:this.params||{}})}componentDidLoad(){(null==i?void 0:i.isBrowser)&&(this.name||(this.name=this.endpoint),this.fetch())}render(){return n(o,null,n("slot",null))}};export{h as fireenjin_query}