@quranjs/api 3.2.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-BZgqOfA4.d.mts → index-BgoJducH.d.mts} +64 -1
- package/dist/{index-BZgqOfA4.d.ts → index-BgoJducH.d.ts} +64 -1
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.min.mjs +2 -2
- package/dist/index.min.mjs.map +1 -1
- package/dist/public.d.mts +8 -9
- package/dist/public.d.ts +8 -9
- package/dist/public.min.js +2 -2
- package/dist/public.min.js.map +1 -1
- package/dist/public.min.mjs +2 -2
- package/dist/public.min.mjs.map +1 -1
- package/dist/runtime-utils-CpHQzQN3.d.mts +44 -0
- package/dist/runtime-utils-XwV859WP.d.ts +44 -0
- package/dist/server.d.mts +20 -9
- package/dist/server.d.ts +20 -9
- package/dist/server.min.js +2 -2
- package/dist/server.min.js.map +1 -1
- package/dist/server.min.mjs +2 -2
- package/dist/server.min.mjs.map +1 -1
- package/dist/{verses-CFFeqPDX.d.mts → verses-C_LN5-Sn.d.mts} +131 -2
- package/dist/{verses-B5K9Egsa.d.ts → verses-Dw2mFuje.d.ts} +131 -2
- package/package.json +1 -1
- package/dist/runtime-utils-CxjOQDsB.d.mts +0 -3
- package/dist/runtime-utils-CxjOQDsB.d.ts +0 -3
|
@@ -147,6 +147,69 @@ interface OperationRequest {
|
|
|
147
147
|
contentType?: string;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
interface QuranReflectPostReference {
|
|
151
|
+
chapterId: number;
|
|
152
|
+
from: number;
|
|
153
|
+
to: number;
|
|
154
|
+
id?: string;
|
|
155
|
+
}
|
|
156
|
+
interface QuranReflectPostMention {
|
|
157
|
+
marker: string;
|
|
158
|
+
userId: string;
|
|
159
|
+
displayName: string;
|
|
160
|
+
}
|
|
161
|
+
type QuranReflectRoomPostStatus = 0 | 1 | 2;
|
|
162
|
+
interface CreateQuranReflectPostPayload {
|
|
163
|
+
body: string;
|
|
164
|
+
draft: boolean;
|
|
165
|
+
references: QuranReflectPostReference[];
|
|
166
|
+
mentions: QuranReflectPostMention[];
|
|
167
|
+
roomId?: number;
|
|
168
|
+
roomPostStatus?: QuranReflectRoomPostStatus;
|
|
169
|
+
postAsAuthorId?: string;
|
|
170
|
+
publishedAt?: string | Date;
|
|
171
|
+
}
|
|
172
|
+
type UpdateQuranReflectPostPayload = Partial<CreateQuranReflectPostPayload>;
|
|
173
|
+
interface QuranReflectPost {
|
|
174
|
+
id: number | string;
|
|
175
|
+
authorId?: string;
|
|
176
|
+
body?: string;
|
|
177
|
+
commentsCount?: number;
|
|
178
|
+
createdAt?: string;
|
|
179
|
+
discussionId?: number;
|
|
180
|
+
draft?: boolean;
|
|
181
|
+
estimatedReadingTime?: number;
|
|
182
|
+
featuredAt?: string;
|
|
183
|
+
global?: boolean;
|
|
184
|
+
hidden?: boolean;
|
|
185
|
+
languageId?: number;
|
|
186
|
+
languageName?: string;
|
|
187
|
+
likesCount?: number;
|
|
188
|
+
mentions?: QuranReflectPostMention[];
|
|
189
|
+
moderationStatus?: number;
|
|
190
|
+
postTypeId?: number | null;
|
|
191
|
+
postTypeName?: string;
|
|
192
|
+
publishedAt?: string;
|
|
193
|
+
pushedUpAt?: string;
|
|
194
|
+
references?: QuranReflectPostReference[];
|
|
195
|
+
removed?: boolean;
|
|
196
|
+
reported?: boolean;
|
|
197
|
+
reviewedAt?: string;
|
|
198
|
+
roomId?: number | null;
|
|
199
|
+
roomPostStatus?: number;
|
|
200
|
+
toxicityScore?: number;
|
|
201
|
+
updatedAt?: string;
|
|
202
|
+
verified?: boolean;
|
|
203
|
+
views?: number;
|
|
204
|
+
viewsCount?: number;
|
|
205
|
+
}
|
|
206
|
+
interface QuranReflectPostMutationResponse {
|
|
207
|
+
success: boolean;
|
|
208
|
+
data?: QuranReflectPost;
|
|
209
|
+
post?: QuranReflectPost;
|
|
210
|
+
error?: unknown;
|
|
211
|
+
}
|
|
212
|
+
|
|
150
213
|
declare enum Language {
|
|
151
214
|
ARABIC = "ar",
|
|
152
215
|
ENGLISH = "en",
|
|
@@ -225,4 +288,4 @@ type WordField = "v1Page" | "v2Page" | "textUthmani" | "textImlaei" | "textIndop
|
|
|
225
288
|
type TranslationField = "resourceName" | "verseId" | "languageId" | "languageName" | "verseKey" | "chapterId" | "verseNumber" | "juzNumber" | "hizbNumber" | "rubNumber" | "pageNumber";
|
|
226
289
|
type VerseRecitationField = "id" | "chapterId" | "segments" | "format";
|
|
227
290
|
|
|
228
|
-
export { type ApiParams as A, type BaseApiParams as B, type CustomFetcher as C, type HTTPMethod as H, Language as L, type OperationRequest as O, type PaginationParams as P, type QuranClientConfig as Q, type RuntimeMode as R, SearchMode as S, type TranslationField as T, type UserSession as U, type VerseField as V, type WordField as W, QuranFont as a, type VerseRecitationField as b, type BinaryString as c, type SearchParams as d, type QuranFetchClient as e, type ApiService as f, type ServiceEnvironmentConfig as g, type TokenStorage as h, type ServerClientConfig as i, type PublicClientConfig as j, type CachedToken as k, type TokenResponse as l };
|
|
291
|
+
export { type ApiParams as A, type BaseApiParams as B, type CustomFetcher as C, type HTTPMethod as H, Language as L, type OperationRequest as O, type PaginationParams as P, type QuranClientConfig as Q, type RuntimeMode as R, SearchMode as S, type TranslationField as T, type UserSession as U, type VerseField as V, type WordField as W, QuranFont as a, type VerseRecitationField as b, type BinaryString as c, type SearchParams as d, type QuranFetchClient as e, type ApiService as f, type ServiceEnvironmentConfig as g, type TokenStorage as h, type ServerClientConfig as i, type PublicClientConfig as j, type CachedToken as k, type TokenResponse as l, type QuranReflectPostReference as m, type QuranReflectPostMention as n, type QuranReflectRoomPostStatus as o, type CreateQuranReflectPostPayload as p, type UpdateQuranReflectPostPayload as q, type QuranReflectPost as r, type QuranReflectPostMutationResponse as s };
|
|
@@ -147,6 +147,69 @@ interface OperationRequest {
|
|
|
147
147
|
contentType?: string;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
interface QuranReflectPostReference {
|
|
151
|
+
chapterId: number;
|
|
152
|
+
from: number;
|
|
153
|
+
to: number;
|
|
154
|
+
id?: string;
|
|
155
|
+
}
|
|
156
|
+
interface QuranReflectPostMention {
|
|
157
|
+
marker: string;
|
|
158
|
+
userId: string;
|
|
159
|
+
displayName: string;
|
|
160
|
+
}
|
|
161
|
+
type QuranReflectRoomPostStatus = 0 | 1 | 2;
|
|
162
|
+
interface CreateQuranReflectPostPayload {
|
|
163
|
+
body: string;
|
|
164
|
+
draft: boolean;
|
|
165
|
+
references: QuranReflectPostReference[];
|
|
166
|
+
mentions: QuranReflectPostMention[];
|
|
167
|
+
roomId?: number;
|
|
168
|
+
roomPostStatus?: QuranReflectRoomPostStatus;
|
|
169
|
+
postAsAuthorId?: string;
|
|
170
|
+
publishedAt?: string | Date;
|
|
171
|
+
}
|
|
172
|
+
type UpdateQuranReflectPostPayload = Partial<CreateQuranReflectPostPayload>;
|
|
173
|
+
interface QuranReflectPost {
|
|
174
|
+
id: number | string;
|
|
175
|
+
authorId?: string;
|
|
176
|
+
body?: string;
|
|
177
|
+
commentsCount?: number;
|
|
178
|
+
createdAt?: string;
|
|
179
|
+
discussionId?: number;
|
|
180
|
+
draft?: boolean;
|
|
181
|
+
estimatedReadingTime?: number;
|
|
182
|
+
featuredAt?: string;
|
|
183
|
+
global?: boolean;
|
|
184
|
+
hidden?: boolean;
|
|
185
|
+
languageId?: number;
|
|
186
|
+
languageName?: string;
|
|
187
|
+
likesCount?: number;
|
|
188
|
+
mentions?: QuranReflectPostMention[];
|
|
189
|
+
moderationStatus?: number;
|
|
190
|
+
postTypeId?: number | null;
|
|
191
|
+
postTypeName?: string;
|
|
192
|
+
publishedAt?: string;
|
|
193
|
+
pushedUpAt?: string;
|
|
194
|
+
references?: QuranReflectPostReference[];
|
|
195
|
+
removed?: boolean;
|
|
196
|
+
reported?: boolean;
|
|
197
|
+
reviewedAt?: string;
|
|
198
|
+
roomId?: number | null;
|
|
199
|
+
roomPostStatus?: number;
|
|
200
|
+
toxicityScore?: number;
|
|
201
|
+
updatedAt?: string;
|
|
202
|
+
verified?: boolean;
|
|
203
|
+
views?: number;
|
|
204
|
+
viewsCount?: number;
|
|
205
|
+
}
|
|
206
|
+
interface QuranReflectPostMutationResponse {
|
|
207
|
+
success: boolean;
|
|
208
|
+
data?: QuranReflectPost;
|
|
209
|
+
post?: QuranReflectPost;
|
|
210
|
+
error?: unknown;
|
|
211
|
+
}
|
|
212
|
+
|
|
150
213
|
declare enum Language {
|
|
151
214
|
ARABIC = "ar",
|
|
152
215
|
ENGLISH = "en",
|
|
@@ -225,4 +288,4 @@ type WordField = "v1Page" | "v2Page" | "textUthmani" | "textImlaei" | "textIndop
|
|
|
225
288
|
type TranslationField = "resourceName" | "verseId" | "languageId" | "languageName" | "verseKey" | "chapterId" | "verseNumber" | "juzNumber" | "hizbNumber" | "rubNumber" | "pageNumber";
|
|
226
289
|
type VerseRecitationField = "id" | "chapterId" | "segments" | "format";
|
|
227
290
|
|
|
228
|
-
export { type ApiParams as A, type BaseApiParams as B, type CustomFetcher as C, type HTTPMethod as H, Language as L, type OperationRequest as O, type PaginationParams as P, type QuranClientConfig as Q, type RuntimeMode as R, SearchMode as S, type TranslationField as T, type UserSession as U, type VerseField as V, type WordField as W, QuranFont as a, type VerseRecitationField as b, type BinaryString as c, type SearchParams as d, type QuranFetchClient as e, type ApiService as f, type ServiceEnvironmentConfig as g, type TokenStorage as h, type ServerClientConfig as i, type PublicClientConfig as j, type CachedToken as k, type TokenResponse as l };
|
|
291
|
+
export { type ApiParams as A, type BaseApiParams as B, type CustomFetcher as C, type HTTPMethod as H, Language as L, type OperationRequest as O, type PaginationParams as P, type QuranClientConfig as Q, type RuntimeMode as R, SearchMode as S, type TranslationField as T, type UserSession as U, type VerseField as V, type WordField as W, QuranFont as a, type VerseRecitationField as b, type BinaryString as c, type SearchParams as d, type QuranFetchClient as e, type ApiService as f, type ServiceEnvironmentConfig as g, type TokenStorage as h, type ServerClientConfig as i, type PublicClientConfig as j, type CachedToken as k, type TokenResponse as l, type QuranReflectPostReference as m, type QuranReflectPostMention as n, type QuranReflectRoomPostStatus as o, type CreateQuranReflectPostPayload as p, type UpdateQuranReflectPostPayload as q, type QuranReflectPost as r, type QuranReflectPostMutationResponse as s };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Q as QuranClientConfig } from './index-
|
|
2
|
-
export { A as ApiParams, f as ApiService, B as BaseApiParams, c as BinaryString, k as CachedToken, C as CustomFetcher, H as HTTPMethod, L as Language, O as OperationRequest, P as PaginationParams, j as PublicClientConfig, e as QuranFetchClient, a as QuranFont, R as RuntimeMode, S as SearchMode, d as SearchParams, i as ServerClientConfig, g as ServiceEnvironmentConfig, l as TokenResponse, h as TokenStorage, T as TranslationField, U as UserSession, V as VerseField, b as VerseRecitationField, W as WordField } from './index-
|
|
3
|
-
import { T as TranslatedName, Q as QuranChapters, a as
|
|
4
|
-
export { A as
|
|
1
|
+
import { Q as QuranClientConfig } from './index-BgoJducH.mjs';
|
|
2
|
+
export { A as ApiParams, f as ApiService, B as BaseApiParams, c as BinaryString, k as CachedToken, p as CreateQuranReflectPostPayload, C as CustomFetcher, H as HTTPMethod, L as Language, O as OperationRequest, P as PaginationParams, j as PublicClientConfig, e as QuranFetchClient, a as QuranFont, r as QuranReflectPost, n as QuranReflectPostMention, s as QuranReflectPostMutationResponse, m as QuranReflectPostReference, o as QuranReflectRoomPostStatus, R as RuntimeMode, S as SearchMode, d as SearchParams, i as ServerClientConfig, g as ServiceEnvironmentConfig, l as TokenResponse, h as TokenStorage, T as TranslationField, q as UpdateQuranReflectPostPayload, U as UserSession, V as VerseField, b as VerseRecitationField, W as WordField } from './index-BgoJducH.mjs';
|
|
3
|
+
import { T as TranslatedName, Q as QuranChapters, a as QuranAnswers, b as QuranVerses, c as QuranJuzs, d as QuranAudio, e as QuranHadithReferences, f as QuranResources, g as QuranSearch, C as ChapterId, J as JuzNumber, R as RubNumber, H as HizbNumber, P as PageNumber, V as VerseKey } from './verses-C_LN5-Sn.mjs';
|
|
4
|
+
export { A as Answer, j as AnswerCount, k as AnswerCountWithinRangeResponse, h as AnswerQuestion, i as AnswersByAyahResponse, n as AudioResponse, o as Chapter, p as ChapterInfo, _ as ChapterInfoResource, q as ChapterInfoResponse, l as ChapterRecitation, a0 as ChapterReciterResource, F as CharType, a7 as ContentResourceSnapshot, a4 as ContentResourceSnapshotOptions, a5 as ContentSyncMutation, a2 as ContentSyncMutationType, a3 as ContentSyncOptions, a1 as ContentSyncResourceGroup, a6 as ContentSyncResponse, v as Hadith, u as HadithContent, x as HadithCountWithinRangeResponse, t as HadithGrade, r as HadithReference, s as HadithReferencesByAyahResponse, w as HadithsByAyahResponse, G as Juz, Z as LanguageResource, N as NormalizedVerseRecitation, I as Pagination, L as RecitationInfoResource, K as RecitationResource, Y as RecitationStylesResource, a8 as SearchNavigationType, S as SearchResponse, a9 as SearchResult, y as Segment, z as Tafsir, X as TafsirInfoResource, U as TafsirResource, B as Translation, O as TranslationInfoResource, M as TranslationResource, D as Transliteration, E as Verse, $ as VerseMediaResource, m as VerseRecitation, W as Word } from './verses-C_LN5-Sn.mjs';
|
|
5
5
|
|
|
6
6
|
interface Footnote {
|
|
7
7
|
id: number | string;
|
|
@@ -51,6 +51,7 @@ declare class QuranClient {
|
|
|
51
51
|
private config;
|
|
52
52
|
private fetcher;
|
|
53
53
|
readonly chapters: QuranChapters;
|
|
54
|
+
readonly answers: QuranAnswers;
|
|
54
55
|
readonly verses: QuranVerses;
|
|
55
56
|
readonly juzs: QuranJuzs;
|
|
56
57
|
readonly audio: QuranAudio;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Q as QuranClientConfig } from './index-
|
|
2
|
-
export { A as ApiParams, f as ApiService, B as BaseApiParams, c as BinaryString, k as CachedToken, C as CustomFetcher, H as HTTPMethod, L as Language, O as OperationRequest, P as PaginationParams, j as PublicClientConfig, e as QuranFetchClient, a as QuranFont, R as RuntimeMode, S as SearchMode, d as SearchParams, i as ServerClientConfig, g as ServiceEnvironmentConfig, l as TokenResponse, h as TokenStorage, T as TranslationField, U as UserSession, V as VerseField, b as VerseRecitationField, W as WordField } from './index-
|
|
3
|
-
import { T as TranslatedName, Q as QuranChapters, a as
|
|
4
|
-
export { A as
|
|
1
|
+
import { Q as QuranClientConfig } from './index-BgoJducH.js';
|
|
2
|
+
export { A as ApiParams, f as ApiService, B as BaseApiParams, c as BinaryString, k as CachedToken, p as CreateQuranReflectPostPayload, C as CustomFetcher, H as HTTPMethod, L as Language, O as OperationRequest, P as PaginationParams, j as PublicClientConfig, e as QuranFetchClient, a as QuranFont, r as QuranReflectPost, n as QuranReflectPostMention, s as QuranReflectPostMutationResponse, m as QuranReflectPostReference, o as QuranReflectRoomPostStatus, R as RuntimeMode, S as SearchMode, d as SearchParams, i as ServerClientConfig, g as ServiceEnvironmentConfig, l as TokenResponse, h as TokenStorage, T as TranslationField, q as UpdateQuranReflectPostPayload, U as UserSession, V as VerseField, b as VerseRecitationField, W as WordField } from './index-BgoJducH.js';
|
|
3
|
+
import { T as TranslatedName, Q as QuranChapters, a as QuranAnswers, b as QuranVerses, c as QuranJuzs, d as QuranAudio, e as QuranHadithReferences, f as QuranResources, g as QuranSearch, C as ChapterId, J as JuzNumber, R as RubNumber, H as HizbNumber, P as PageNumber, V as VerseKey } from './verses-Dw2mFuje.js';
|
|
4
|
+
export { A as Answer, j as AnswerCount, k as AnswerCountWithinRangeResponse, h as AnswerQuestion, i as AnswersByAyahResponse, n as AudioResponse, o as Chapter, p as ChapterInfo, _ as ChapterInfoResource, q as ChapterInfoResponse, l as ChapterRecitation, a0 as ChapterReciterResource, F as CharType, a7 as ContentResourceSnapshot, a4 as ContentResourceSnapshotOptions, a5 as ContentSyncMutation, a2 as ContentSyncMutationType, a3 as ContentSyncOptions, a1 as ContentSyncResourceGroup, a6 as ContentSyncResponse, v as Hadith, u as HadithContent, x as HadithCountWithinRangeResponse, t as HadithGrade, r as HadithReference, s as HadithReferencesByAyahResponse, w as HadithsByAyahResponse, G as Juz, Z as LanguageResource, N as NormalizedVerseRecitation, I as Pagination, L as RecitationInfoResource, K as RecitationResource, Y as RecitationStylesResource, a8 as SearchNavigationType, S as SearchResponse, a9 as SearchResult, y as Segment, z as Tafsir, X as TafsirInfoResource, U as TafsirResource, B as Translation, O as TranslationInfoResource, M as TranslationResource, D as Transliteration, E as Verse, $ as VerseMediaResource, m as VerseRecitation, W as Word } from './verses-Dw2mFuje.js';
|
|
5
5
|
|
|
6
6
|
interface Footnote {
|
|
7
7
|
id: number | string;
|
|
@@ -51,6 +51,7 @@ declare class QuranClient {
|
|
|
51
51
|
private config;
|
|
52
52
|
private fetcher;
|
|
53
53
|
readonly chapters: QuranChapters;
|
|
54
|
+
readonly answers: QuranAnswers;
|
|
54
55
|
readonly verses: QuranVerses;
|
|
55
56
|
readonly juzs: QuranJuzs;
|
|
56
57
|
readonly audio: QuranAudio;
|
package/dist/index.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var U=require('humps');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var U__default=/*#__PURE__*/_interopDefault(U);var V=(i,e)=>{let t=`${i}:${e}`;if(typeof Buffer<"u")return Buffer.from(t).toString("base64");if(typeof globalThis.btoa=="function")return globalThis.btoa(t);throw new Error("No base64 encoder available for HTTP basic auth.")};var T=async(i,e={retries:3})=>{let t;for(let s=0;s<=e.retries;s++)try{return await i()}catch(n){if(t=n,s===e.retries)throw t;await new Promise(o=>setTimeout(o,Math.pow(2,s)*1e3));}throw t};var g="https://apis.quran.foundation",E={oauth2:"https://oauth2.quran.foundation"};var{decamelize:b}=U__default.default;var B=i=>i.startsWith("/")?i.slice(1):i;var N=["wordFields","translationFields","fields"],S=new Set([...N,...N.map(i=>b(i))]),k=new Set(["navigationalResultsNumber","versesResultsNumber"]),O=(i,e={})=>{if(!i)return "";let t=new URLSearchParams;for(let[s,n]of Object.entries(i)){if(n===void 0)continue;let o=e.preserveCase||k.has(s)?s:b(s);if(S.has(s)||S.has(o)){let x=Object.entries(n).filter(([,R])=>R).map(([R])=>b(R));x.length>0&&t.set(o,x.join(","));continue}typeof n=="string"?t.set(o,n):typeof n=="number"||typeof n=="boolean"?t.set(o,n.toString()):Array.isArray(n)&&t.set(o,n.join(","));}return t.size===0?"":`?${t.toString()}`};var G=(o=>(o.Word="word",o.End="end",o.Pause="pause",o.Sajdah="sajdah",o.RubElHizb="rub-el-hizb",o))(G||{});var z=(p=>(p.SURAH="surah",p.JUZ="juz",p.HIZB="hizb",p.AYAH="ayah",p.RUB_EL_HIZB="rub_el_hizb",p.SEARCH_PAGE="search_page",p.PAGE="page",p.RANGE="range",p.QURAN_RANGE="quran_range",p))(z||{});var K=(t=>(t.Advanced="advanced",t.Quick="quick",t))(K||{});var _=(r=>(r.ARABIC="ar",r.ENGLISH="en",r.URDU="ur",r.BENGALI="bn",r.TURKISH="tr",r.SPANISH="es",r.GERMAN="de",r.BOSNIAN="bs",r.RUSSIAN="ru",r.ALBANIAN_AL="al",r.FRENCH="fr",r.DUTCH="nl",r.TAMIL="ta",r.TAJIK="tg",r.INDONESIAN="id",r.UZBEK="uz",r.VIETNAMESE="vi",r.CHINESE="zh",r.ITALIAN="it",r.JAPANESE="ja",r.MALAYALAM="ml",r.AMHARIC="am",r.KAZAKH="kk",r.PORTUGUESE="pt",r.TAGALOG="tl",r.THAI="th",r.KOREAN="ko",r.HINDI="hi",r.KURDISH="ku",r.HAUSA="ha",r.AZERI="az",r.SWAHILI="sw",r.PERSIAN="fa",r.SERBIAN="sr",r.MARANAO="mrn",r.AMAZIGH="zgh",r.ASSAMESE="as",r.BULGARIAN="bg",r.CHECHEN="ce",r.CZECH="cs",r.DIVEHI="dv",r.FINNISH="fi",r.GUJAARATI="gu",r.HEBREW="he",r.GEORGIAN="ka",r.CENTRAL_KHMER="km",r.GANDA="lg",r.MARATHI="mr",r.YORUBA="yo",r.MALAY="ms",r.NEPALI="ne",r.SWEDISH="sv",r.TELUGU="te",r.TATAR="tt",r.UYGHUR="ug",r.UKRAINIAN="uk",r.NORWEGIAN="no",r.OROMO="om",r.POLISH="pl",r.PASHTO="ps",r.ROMANIAN="ro",r.SINDHI="sd",r.NORTHERN_SAMI="se",r.SINHALA="si",r.SOMALI="so",r.ALBANIAN_SQ="sq",r))(_||{}),$=(s=>(s.MadaniV1="code_v1",s.MadaniV2="code_v2",s.Uthmani="text_uthmani",s))($||{});var c=i=>{let e=typeof i=="number"?i:Number(i);return !(!e||e<=0||e>114)};var A=i=>{let e=typeof i=="number"?i:Number(i);return !(!e||e<=0||e>30)};var I=i=>{let e=typeof i=="number"?i:Number(i);return !(!e||e<=0||e>240)};var v=i=>{let e=typeof i=="number"?i:Number(i);return !(!e||e<=0||e>60)};var P=i=>{let e=typeof i=="number"?i:Number(i);return !(!e||e<=0||e>604)};var H={1:7,2:286,3:200,4:176,5:120,6:165,7:206,8:75,9:129,10:109,11:123,12:111,13:43,14:52,15:99,16:128,17:111,18:110,19:98,20:135,21:112,22:78,23:118,24:64,25:77,26:227,27:93,28:88,29:69,30:60,31:34,32:30,33:73,34:54,35:45,36:83,37:182,38:88,39:75,40:85,41:54,42:53,43:89,44:59,45:37,46:35,47:38,48:29,49:18,50:45,51:60,52:49,53:62,54:55,55:78,56:96,57:29,58:22,59:24,60:13,61:14,62:11,63:11,64:18,65:12,66:12,67:30,68:52,69:52,70:44,71:28,72:28,73:20,74:56,75:40,76:31,77:50,78:40,79:46,80:42,81:29,82:19,83:36,84:25,85:22,86:17,87:19,88:26,89:30,90:20,91:15,92:21,93:11,94:8,95:8,96:19,97:5,98:8,99:8,100:11,101:11,102:8,103:3,104:9,105:5,106:4,107:7,108:3,109:6,110:3,111:5,112:4,113:5,114:6};var a=i=>{let[e,t]=i.trim().split(":");if(!e||!t||!c(e))return false;let s=Number(t),n=H[e];return !(!s||s<=0||s>n)};var Q="https://verses.quran.com";function F(i){return i.map(e=>{let t=e.url.startsWith("http://")||e.url.startsWith("https://")?e.url:`${Q}/${e.url.replace(/^\/+/,"")}`;return {...e,audioUrl:t}})}var h=class{constructor(e){this.fetcher=e;}async findAllChapterRecitations(e,t){let{audioFiles:s}=await this.fetcher.fetch(`/content/api/v4/chapter_recitations/${e}`,t);return s}async findChapterRecitationById(e,t,s){if(!c(t))throw new Error("Invalid chapter id");let{audioFile:n}=await this.fetcher.fetch(`/content/api/v4/chapter_recitations/${e}/${t}`,s);return n}async findVerseRecitationsByChapter(e,t,s){if(!c(e))throw new Error("Invalid chapter id");let n=await this.fetcher.fetch(`/content/api/v4/recitations/${t}/by_chapter/${e}`,s);return {...n,audioFiles:F(n.audioFiles)}}async findVerseRecitationsByKey(e,t,s){if(!a(e))throw new Error("Invalid verse key");let n=await this.fetcher.fetch(`/content/api/v4/recitations/${t}/by_ayah/${e}`,s);return {...n,audioFiles:F(n.audioFiles)}}};var f=class{constructor(e){this.fetcher=e;}async findAll(e){let{chapters:t}=await this.fetcher.fetch("/content/api/v4/chapters",e);return t}async findById(e,t){if(!c(e))throw new Error("Invalid chapter id");let{chapter:s}=await this.fetcher.fetch(`/content/api/v4/chapters/${e}`,t);return s}async findInfoById(e,t){let{chapterInfo:s}=await this.findInfoResponseById(e,t);return s}async findInfoResponseById(e,t){if(!c(e))throw new Error("Invalid chapter id");return this.fetcher.fetch(`/content/api/v4/chapters/${e}/info`,t)}};var l=class{constructor(e){this.fetcher=e;}async findByAyah(e,t){if(!a(e))throw new Error("Invalid verse key");return this.fetcher.fetch(`/content/api/v4/hadith_references/by_ayah/${e}`,t)}async findHadithsByAyah(e,t){if(!a(e))throw new Error("Invalid verse key");return this.fetcher.fetch(`/content/api/v4/hadith_references/by_ayah/${e}/hadiths`,t)}async countWithinRange(e,t,s){if(!a(e)||!a(t))throw new Error("Invalid verse key");return this.fetcher.fetch("/content/api/v4/hadith_references/count_within_range",{...s,from:e,to:t})}};var u=class{constructor(e){this.fetcher=e;}async findAll(){let{juzs:e}=await this.fetcher.fetch("/content/api/v4/juzs");return e}};var d=class{constructor(e){this.fetcher=e;}async findAllRecitations(e){let{recitations:t}=await this.fetcher.fetch("/content/api/v4/resources/recitations",e);return t}async findAllTranslations(e){let{translations:t}=await this.fetcher.fetch("/content/api/v4/resources/translations",e);return t}async findAllTafsirs(e){let{tafsirs:t}=await this.fetcher.fetch("/content/api/v4/resources/tafsirs",e);return t}async findAllLanguages(e){let{languages:t}=await this.fetcher.fetch("/content/api/v4/resources/languages",e);return t}async findRecitationInfo(e,t){let{recitationInfo:s}=await this.fetcher.fetch(`/content/api/v4/resources/recitations/${e}/info`,t);return s}async findTranslationInfo(e,t){let{translationInfo:s}=await this.fetcher.fetch(`/content/api/v4/resources/translations/${e}/info`,t);return s}async findTafsirInfo(e,t){let{tafsirInfo:s}=await this.fetcher.fetch(`/content/api/v4/resources/tafsirs/${e}/info`,t);return s}async findAllChapterInfos(e){let{chapterInfos:t}=await this.fetcher.fetch("/content/api/v4/resources/chapter_infos",e);return t}async findAllChapterReciters(e){let{reciters:t}=await this.fetcher.fetch("/content/api/v4/resources/chapter_reciters",e);return t}async findAllRecitationStyles(e){let{recitationStyles:t}=await this.fetcher.fetch("/content/api/v4/resources/recitation_styles",e);return t}async findVerseMedia(e){let{verseMedia:t}=await this.fetcher.fetch("/content/api/v4/resources/verse_media",e);return t}};var m=class{constructor(e){this.fetcher=e;}async search(e,t){return this.fetcher.fetch("/v1/search",{query:e,size:30,...t})}};var y=class{constructor(e){this.fetcher=e;}async findByKey(e,t){if(!a(e))throw new Error("Invalid verse key");let{verse:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_key/${e}`,{words:false,...t});return s}async findByRange(e,t,s){if(!a(e)||!a(t))throw new Error("Invalid verse key");let{verses:n}=await this.fetcher.fetch("/content/api/v4/verses/by_range",{words:false,...s,from:e,to:t});return n}async findByChapter(e,t){if(!c(e))throw new Error("Invalid chapter id");let{verses:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_chapter/${e}`,{words:false,...t});return s}async findByPage(e,t){if(!P(e))throw new Error("Invalid page number");let{verses:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_page/${e}`,{words:false,...t});return s}async findByJuz(e,t){if(!A(e))throw new Error("Invalid juz");let{verses:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_juz/${e}`,{words:false,...t});return s}async findByHizb(e,t){if(!v(e))throw new Error("Invalid hizb");let{verses:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_hizb/${e}`,{words:false,...t});return s}async findByRub(e,t){if(!I(e))throw new Error("Invalid rub");let{verses:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_rub/${e}`,{words:false,...t});return s}async findRandom(e){let{verse:t}=await this.fetcher.fetch("/content/api/v4/verses/random",{words:false,...e});return t}};var {camelizeKeys:W}=U__default.default,j="content search",C=class{constructor(e){this.config=e;}cachedToken=null;updateConfig(e){this.config=e;}getFetch(){let e=this.config.fetch??globalThis.fetch;if(typeof e!="function")throw new Error("No fetch function available. Please provide a fetch implementation or ensure global fetch is available.");return e}clearCachedToken(){this.cachedToken=null;}async fetch(e,t){let s=await this.getAccessToken(),n=await this.getFetch()(this.makeUrl(e,t),{headers:{"Content-Type":"application/json","x-auth-token":s,"x-client-id":this.config.clientId}});if(!n.ok||n.status>=400)throw new Error(`${n.status} ${n.statusText}`);let o=await n.json();return W(o)}makeUrl(e,t){return `${this.config.contentBaseUrl}/${B(e)}${O({...this.config.defaults,...t})}`}async getAccessToken(){if(this.cachedToken&&this.cachedToken.expiresAt>Date.now()+3e4)return this.cachedToken.value;let e=new URLSearchParams({grant_type:"client_credentials",scope:j}).toString(),t=await T(()=>this.getFetch()(`${this.config.authBaseUrl}/oauth2/token`,{body:e,headers:{Accept:"application/json",Authorization:`Basic ${V(this.config.clientId,this.config.clientSecret)}`,"Content-Type":"application/x-www-form-urlencoded"},method:"POST"}),{retries:3});if(!t.ok)throw new Error(`Token request failed: ${t.statusText}`);let s=await t.json();return this.cachedToken={expiresAt:Date.now()+s.expires_in*1e3,value:s.access_token},this.cachedToken.value}},w=class{config;fetcher;chapters;verses;juzs;audio;hadithReferences;resources;search;constructor(e){this.config={authBaseUrl:E.oauth2,contentBaseUrl:g,...e,defaults:{language:"ar",...e.defaults}},this.fetcher=new C(this.config),this.fetcher.getFetch(),this.chapters=new f(this.fetcher),this.verses=new y(this.fetcher),this.juzs=new u(this.fetcher),this.audio=new h(this.fetcher),this.hadithReferences=new l(this.fetcher),this.resources=new d(this.fetcher),this.search=new m(this.fetcher);}getConfig(){return {...this.config}}updateConfig(e){this.config={...this.config,...e,defaults:{...this.config.defaults,...e.defaults}},this.fetcher.updateConfig(this.config);}clearCachedToken(){this.fetcher.clearCachedToken();}};
|
|
2
|
-
exports.CharType=
|
|
1
|
+
'use strict';var G=require('humps');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var G__default=/*#__PURE__*/_interopDefault(G);var T=(n,e)=>{let t=`${n}:${e}`;if(typeof Buffer<"u")return Buffer.from(t).toString("base64");if(typeof globalThis.btoa=="function")return globalThis.btoa(t);throw new Error("No base64 encoder available for HTTP basic auth.")};var g=async(n,e={retries:3})=>{let t;for(let s=0;s<=e.retries;s++)try{return await n()}catch(i){if(t=i,s===e.retries)throw t;await new Promise(o=>setTimeout(o,Math.pow(2,s)*1e3));}throw t};var S="https://apis.quran.foundation",B={oauth2:"https://oauth2.quran.foundation"};var{decamelize:b}=G__default.default;var N=n=>n.startsWith("/")?n.slice(1):n;var E=["wordFields","translationFields","fields"],O=new Set([...E,...E.map(n=>b(n))]),U=new Set(["navigationalResultsNumber","pageSize","versesResultsNumber"]),_=(n,e={})=>{if(!n)return "";let t=new URLSearchParams;for(let[s,i]of Object.entries(n)){if(i===void 0)continue;let o=e.preserveCase||U.has(s)?s:b(s);if(O.has(s)||O.has(o)){let V=Object.entries(i).filter(([,A])=>A).map(([A])=>b(A));V.length>0&&t.set(o,V.join(","));continue}typeof i=="string"?t.set(o,i):typeof i=="number"||typeof i=="boolean"?t.set(o,i.toString()):Array.isArray(i)&&t.set(o,i.join(","));}return t.size===0?"":`?${t.toString()}`};var z=(o=>(o.Word="word",o.End="end",o.Pause="pause",o.Sajdah="sajdah",o.RubElHizb="rub-el-hizb",o))(z||{});var K=(p=>(p.SURAH="surah",p.JUZ="juz",p.HIZB="hizb",p.AYAH="ayah",p.RUB_EL_HIZB="rub_el_hizb",p.SEARCH_PAGE="search_page",p.PAGE="page",p.RANGE="range",p.QURAN_RANGE="quran_range",p))(K||{});var $=(t=>(t.Advanced="advanced",t.Quick="quick",t))($||{});var H=(r=>(r.ARABIC="ar",r.ENGLISH="en",r.URDU="ur",r.BENGALI="bn",r.TURKISH="tr",r.SPANISH="es",r.GERMAN="de",r.BOSNIAN="bs",r.RUSSIAN="ru",r.ALBANIAN_AL="al",r.FRENCH="fr",r.DUTCH="nl",r.TAMIL="ta",r.TAJIK="tg",r.INDONESIAN="id",r.UZBEK="uz",r.VIETNAMESE="vi",r.CHINESE="zh",r.ITALIAN="it",r.JAPANESE="ja",r.MALAYALAM="ml",r.AMHARIC="am",r.KAZAKH="kk",r.PORTUGUESE="pt",r.TAGALOG="tl",r.THAI="th",r.KOREAN="ko",r.HINDI="hi",r.KURDISH="ku",r.HAUSA="ha",r.AZERI="az",r.SWAHILI="sw",r.PERSIAN="fa",r.SERBIAN="sr",r.MARANAO="mrn",r.AMAZIGH="zgh",r.ASSAMESE="as",r.BULGARIAN="bg",r.CHECHEN="ce",r.CZECH="cs",r.DIVEHI="dv",r.FINNISH="fi",r.GUJAARATI="gu",r.HEBREW="he",r.GEORGIAN="ka",r.CENTRAL_KHMER="km",r.GANDA="lg",r.MARATHI="mr",r.YORUBA="yo",r.MALAY="ms",r.NEPALI="ne",r.SWEDISH="sv",r.TELUGU="te",r.TATAR="tt",r.UYGHUR="ug",r.UKRAINIAN="uk",r.NORWEGIAN="no",r.OROMO="om",r.POLISH="pl",r.PASHTO="ps",r.ROMANIAN="ro",r.SINDHI="sd",r.NORTHERN_SAMI="se",r.SINHALA="si",r.SOMALI="so",r.ALBANIAN_SQ="sq",r))(H||{}),Q=(s=>(s.MadaniV1="code_v1",s.MadaniV2="code_v2",s.Uthmani="text_uthmani",s))(Q||{});var c=n=>{let e=typeof n=="number"?n:Number(n);return !(!e||e<=0||e>114)};var I=n=>{let e=typeof n=="number"?n:Number(n);return !(!e||e<=0||e>30)};var w=n=>{let e=typeof n=="number"?n:Number(n);return !(!e||e<=0||e>240)};var v=n=>{let e=typeof n=="number"?n:Number(n);return !(!e||e<=0||e>60)};var C=n=>{let e=typeof n=="number"?n:Number(n);return !(!e||e<=0||e>604)};var k={1:7,2:286,3:200,4:176,5:120,6:165,7:206,8:75,9:129,10:109,11:123,12:111,13:43,14:52,15:99,16:128,17:111,18:110,19:98,20:135,21:112,22:78,23:118,24:64,25:77,26:227,27:93,28:88,29:69,30:60,31:34,32:30,33:73,34:54,35:45,36:83,37:182,38:88,39:75,40:85,41:54,42:53,43:89,44:59,45:37,46:35,47:38,48:29,49:18,50:45,51:60,52:49,53:62,54:55,55:78,56:96,57:29,58:22,59:24,60:13,61:14,62:11,63:11,64:18,65:12,66:12,67:30,68:52,69:52,70:44,71:28,72:28,73:20,74:56,75:40,76:31,77:50,78:40,79:46,80:42,81:29,82:19,83:36,84:25,85:22,86:17,87:19,88:26,89:30,90:20,91:15,92:21,93:11,94:8,95:8,96:19,97:5,98:8,99:8,100:11,101:11,102:8,103:3,104:9,105:5,106:4,107:7,108:3,109:6,110:3,111:5,112:4,113:5,114:6};var a=n=>{let[e,t]=n.trim().split(":");if(!e||!t||!c(e))return false;let s=Number(t),i=k[e];return !(!s||s<=0||s>i)};var W=n=>Object.fromEntries(Object.entries(n).map(([e,t])=>t.types?[e,{...t,types:Object.fromEntries(Object.entries(t.types).map(([s,i])=>[s.toUpperCase(),i]))}]:[e,t])),h=class{constructor(e){this.fetcher=e;}async findByAyah(e,t){if(!a(e))throw new Error("Invalid verse key");return this.fetcher.fetch(`/content/api/v4/answers/by_ayah/${e}`,t)}async findByQuestionId(e){return this.fetcher.fetch(`/content/api/v4/answers/${e}`)}async countWithinRange(e,t,s){if(!a(e)||!a(t))throw new Error("Invalid verse key");let i=await this.fetcher.fetch("/content/api/v4/answers/count_within_range",{...s,from:e,to:t});return W(i)}};var M="https://verses.quran.com";function F(n){return n.map(e=>{let t=e.url.startsWith("http://")||e.url.startsWith("https://")?e.url:`${M}/${e.url.replace(/^\/+/,"")}`;return {...e,audioUrl:t}})}var f=class{constructor(e){this.fetcher=e;}async findAllChapterRecitations(e,t){let{audioFiles:s}=await this.fetcher.fetch(`/content/api/v4/chapter_recitations/${e}`,t);return s}async findChapterRecitationById(e,t,s){if(!c(t))throw new Error("Invalid chapter id");let{audioFile:i}=await this.fetcher.fetch(`/content/api/v4/chapter_recitations/${e}/${t}`,s);return i}async findVerseRecitationsByChapter(e,t,s){if(!c(e))throw new Error("Invalid chapter id");let i=await this.fetcher.fetch(`/content/api/v4/recitations/${t}/by_chapter/${e}`,s);return {...i,audioFiles:F(i.audioFiles)}}async findVerseRecitationsByKey(e,t,s){if(!a(e))throw new Error("Invalid verse key");let i=await this.fetcher.fetch(`/content/api/v4/recitations/${t}/by_ayah/${e}`,s);return {...i,audioFiles:F(i.audioFiles)}}};var u=class{constructor(e){this.fetcher=e;}async findAll(e){let{chapters:t}=await this.fetcher.fetch("/content/api/v4/chapters",e);return t}async findById(e,t){if(!c(e))throw new Error("Invalid chapter id");let{chapter:s}=await this.fetcher.fetch(`/content/api/v4/chapters/${e}`,t);return s}async findInfoById(e,t){let{chapterInfo:s}=await this.findInfoResponseById(e,t);return s}async findInfoResponseById(e,t){if(!c(e))throw new Error("Invalid chapter id");return this.fetcher.fetch(`/content/api/v4/chapters/${e}/info`,t)}};var l=class{constructor(e){this.fetcher=e;}async findByAyah(e,t){if(!a(e))throw new Error("Invalid verse key");return this.fetcher.fetch(`/content/api/v4/hadith_references/by_ayah/${e}`,t)}async findHadithsByAyah(e,t){if(!a(e))throw new Error("Invalid verse key");return this.fetcher.fetch(`/content/api/v4/hadith_references/by_ayah/${e}/hadiths`,t)}async countWithinRange(e,t,s){if(!a(e)||!a(t))throw new Error("Invalid verse key");return this.fetcher.fetch("/content/api/v4/hadith_references/count_within_range",{...s,from:e,to:t})}};var d=class{constructor(e){this.fetcher=e;}async findAll(){let{juzs:e}=await this.fetcher.fetch("/content/api/v4/juzs");return e}};var m=class{constructor(e){this.fetcher=e;}async findAllRecitations(e){let{recitations:t}=await this.fetcher.fetch("/content/api/v4/resources/recitations",e);return t}async findAllTranslations(e){let{translations:t}=await this.fetcher.fetch("/content/api/v4/resources/translations",e);return t}async findAllTafsirs(e){let{tafsirs:t}=await this.fetcher.fetch("/content/api/v4/resources/tafsirs",e);return t}async findAllLanguages(e){let{languages:t}=await this.fetcher.fetch("/content/api/v4/resources/languages",e);return t}async findRecitationInfo(e,t){let{recitationInfo:s}=await this.fetcher.fetch(`/content/api/v4/resources/recitations/${e}/info`,t);return s}async findTranslationInfo(e,t){let{translationInfo:s}=await this.fetcher.fetch(`/content/api/v4/resources/translations/${e}/info`,t);return s}async findTafsirInfo(e,t){let{tafsirInfo:s}=await this.fetcher.fetch(`/content/api/v4/resources/tafsirs/${e}/info`,t);return s}async findAllChapterInfos(e){let{chapterInfos:t}=await this.fetcher.fetch("/content/api/v4/resources/chapter_infos",e);return t}async findAllChapterReciters(e){let{reciters:t}=await this.fetcher.fetch("/content/api/v4/resources/chapter_reciters",e);return t}async findAllRecitationStyles(e){let{recitationStyles:t}=await this.fetcher.fetch("/content/api/v4/resources/recitation_styles",e);return t}async findVerseMedia(e){let{verseMedia:t}=await this.fetcher.fetch("/content/api/v4/resources/verse_media",e);return t}async sync(e){return this.fetcher.fetch("/content/api/v4/resources/sync",e)}async findSnapshot(e,t,s){return this.fetcher.fetch(`/content/api/v4/resources/snapshots/${e}/${t}`,s)}};var y=class{constructor(e){this.fetcher=e;}async search(e,t){return this.fetcher.fetch("/v1/search",{query:e,size:30,...t})}};var R=class{constructor(e){this.fetcher=e;}async findByKey(e,t){if(!a(e))throw new Error("Invalid verse key");let{verse:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_key/${e}`,{words:false,...t});return s}async findByRange(e,t,s){if(!a(e)||!a(t))throw new Error("Invalid verse key");let{verses:i}=await this.fetcher.fetch("/content/api/v4/verses/by_range",{words:false,...s,from:e,to:t});return i}async findByChapter(e,t){if(!c(e))throw new Error("Invalid chapter id");let{verses:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_chapter/${e}`,{words:false,...t});return s}async findByPage(e,t){if(!C(e))throw new Error("Invalid page number");let{verses:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_page/${e}`,{words:false,...t});return s}async findByJuz(e,t){if(!I(e))throw new Error("Invalid juz");let{verses:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_juz/${e}`,{words:false,...t});return s}async findByHizb(e,t){if(!v(e))throw new Error("Invalid hizb");let{verses:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_hizb/${e}`,{words:false,...t});return s}async findByRub(e,t){if(!w(e))throw new Error("Invalid rub");let{verses:s}=await this.fetcher.fetch(`/content/api/v4/verses/by_rub/${e}`,{words:false,...t});return s}async findRandom(e){let{verse:t}=await this.fetcher.fetch("/content/api/v4/verses/random",{words:false,...e});return t}};var {camelizeKeys:D}=G__default.default,J="content search",P=class{constructor(e){this.config=e;}cachedToken=null;updateConfig(e){this.config=e;}getFetch(){let e=this.config.fetch??globalThis.fetch;if(typeof e!="function")throw new Error("No fetch function available. Please provide a fetch implementation or ensure global fetch is available.");return e}clearCachedToken(){this.cachedToken=null;}async fetch(e,t){let s=await this.getAccessToken(),i=await this.getFetch()(this.makeUrl(e,t),{headers:{"Content-Type":"application/json","x-auth-token":s,"x-client-id":this.config.clientId}});if(!i.ok||i.status>=400)throw new Error(`${i.status} ${i.statusText}`);let o=await i.json();return D(o)}makeUrl(e,t){return `${this.config.contentBaseUrl}/${N(e)}${_({...this.config.defaults,...t})}`}async getAccessToken(){if(this.cachedToken&&this.cachedToken.expiresAt>Date.now()+3e4)return this.cachedToken.value;let e=new URLSearchParams({grant_type:"client_credentials",scope:J}).toString(),t=await g(()=>this.getFetch()(`${this.config.authBaseUrl}/oauth2/token`,{body:e,headers:{Accept:"application/json",Authorization:`Basic ${T(this.config.clientId,this.config.clientSecret)}`,"Content-Type":"application/x-www-form-urlencoded"},method:"POST"}),{retries:3});if(!t.ok)throw new Error(`Token request failed: ${t.statusText}`);let s=await t.json();return this.cachedToken={expiresAt:Date.now()+s.expires_in*1e3,value:s.access_token},this.cachedToken.value}},x=class{config;fetcher;chapters;answers;verses;juzs;audio;hadithReferences;resources;search;constructor(e){this.config={authBaseUrl:B.oauth2,contentBaseUrl:S,...e,defaults:{language:"ar",...e.defaults}},this.fetcher=new P(this.config),this.fetcher.getFetch(),this.answers=new h(this.fetcher),this.chapters=new u(this.fetcher),this.verses=new R(this.fetcher),this.juzs=new d(this.fetcher),this.audio=new f(this.fetcher),this.hadithReferences=new l(this.fetcher),this.resources=new m(this.fetcher),this.search=new y(this.fetcher);}getConfig(){return {...this.config}}updateConfig(e){this.config={...this.config,...e,defaults:{...this.config.defaults,...e.defaults}},this.fetcher.updateConfig(this.config);}clearCachedToken(){this.fetcher.clearCachedToken();}};
|
|
2
|
+
exports.CharType=z;exports.Language=H;exports.QuranClient=x;exports.QuranFont=Q;exports.SearchMode=$;exports.SearchNavigationType=K;exports.isValidChapterId=c;exports.isValidHizb=v;exports.isValidJuz=I;exports.isValidQuranPage=C;exports.isValidRub=w;exports.isValidVerseKey=a;//# sourceMappingURL=index.min.js.map
|
|
3
3
|
//# sourceMappingURL=index.min.js.map
|