al-quran.reflectslight.io/build/al-quran/js/loaders/surah-index-loader.js
2024-09-18 16:06:29 -03:00

1 line
No EOL
2.8 KiB
JavaScript

(()=>{"use strict";const e=(e,t)=>({priority:1,group:"fonts",requestId:"font",href:t,fontFamily:e}),t=(e,t)=>({priority:4,group:"scripts",requestId:"script",href:e,props:t}),r=e=>e,n={font(e){const{fontFamily:t,href:r}=e;return new FontFace(t,r).load()},script(e,t={}){const{href:r}=e;return fetch(r,t).then((e=>e.text())).then((t=>({type:"application/javascript",text:t,...e.props}))).then((e=>Object.assign(document.createElement("script"),e)))},css(e,t={}){const{href:r}=e;return fetch(r,t).then((e=>e.text())).then((e=>({innerText:e}))).then((e=>Object.assign(document.createElement("style"),e)))},image(e){const{href:t}=e;return new Promise(((e,r)=>{const n=document.createElement("img");n.onload=()=>e(n),n.onerror=r,n.src=t}))},json(e,t={}){const{href:r}=e;return fetch(r,t).then((e=>e.text())).then((e=>({type:"application/json",text:e}))).then((t=>Object.assign(t,e.props||{}))).then((e=>Object.assign(document.createElement("script"),e)))}};var o=Object.defineProperty,s=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,i=(e,t,r)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;!function(){const o=document.documentElement,u=o.querySelector("meta[name='revision']").getAttribute("content"),l={name:o.lang,direction:o.dir,displayName:""},p=o.querySelector(".postman.loader"),m=o.querySelector(".css.postman"),f=p.querySelector("progress"),h=p.querySelector(".percentage");(function(...e){const t=Object.create(null),r={fonts:[],images:[],css:[],scripts:[],json:[]},[o,s]=function(e){const t=[];let r=e=>e;return e.forEach((e=>{"function"==typeof e?r=e:t.push(e)})),[t,r]}(e);o.sort(((e,t)=>e.priority>=t.priority?1:-1));let c=0;const a=e=>(c++,c<=o.length&&s(c/o.length*100),e);return t.fetch=async()=>(await Promise.all((()=>{const e=o.map((e=>{if("fontFamily"in e)return(0,n.font)(e).then((e=>a(e))).then((e=>r.fonts.push(e))).then((()=>r));if("font"!==e.requestId&&"fonts"!==e.group){const t=n[e.requestId],o=r[e.group];return t(e).then((e=>a(e))).then((e=>o.push(e))).then((()=>r))}return null}));return e})()),r),t})(t(`/js/main/vendor.js?v=${u}`,{id:"0"}),t(`/js/main/surah-index.js?v=${u}`,{id:"1"}),e("Amiri Quran Regular","url(/fonts/amiri-quran-regular.ttf)"),e("Kanit Regular","url(/fonts/kanit-regular.ttf)"),r((e=>{f.value=e,h.innerText=function(e,t,r={}){const n="ar"===e.name?"ar-SA":e.name;return new Intl.NumberFormat(n,((e,t)=>{for(var r in t||(t={}))c.call(t,r)&&i(e,r,t[r]);if(s)for(var r of s(t))a.call(t,r)&&i(e,r,t[r]);return e})({maximumFractionDigits:1},r)).format(t)}(l,Number(e.toFixed(0)))}))).fetch().then((e=>{[p,m].forEach((e=>e.remove())),e.fonts.forEach((e=>document.fonts.add(e))),e.css.forEach((e=>document.head.appendChild(e))),e.scripts.sort(((e,t)=>Number(e.id)-Number(t.id))).forEach((e=>{document.body.removeChild(document.body.appendChild(e))}))}))}()})();