Files
nademitex_user/dist/assets/format-BHJptHdF.js
T

1 line
4.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var e=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],t=e[0],n=e[e.length-1]-1;function r(e,t,n){return e instanceof Date?u(d(e.getFullYear(),e.getMonth()+1,e.getDate())):u(d(e,t,n))}function i(e,t,n){return f(l(e,t,n))}function a(e){return h(e)===0}function o(e,t){return t<=6?31:t<=11||a(e)?30:29}function s(e){let{gy:t,march:n,jump:r,n:i}=p(e);return{leap:m(r,i),gy:t,march:n}}function c(e){let{gy:t,march:n}=p(e);return{gy:t,march:n}}function l(e,t,n){let r=c(e);return d(r.gy,3,r.march)+(t-1)*31-g(t,7)*(t-7)+n-1}function u(e){let t=f(e).gy,n=t-621,r=s(n),i=e-d(t,3,r.march);if(i>=0){if(i<=185)return{jy:n,jm:1+g(i,31),jd:_(i,31)+1};i-=186}else--n,i+=179,r.leap===1&&(i+=1);return{jy:n,jm:7+g(i,30),jd:_(i,30)+1}}function d(e,t,n){let r=g((e+g(t-8,6)+100100)*1461,4)+g(153*_(t+9,12)+2,5)+n-34840408;return r=r-g(g(e+100100+g(t-8,6),100)*3,4)+752,r}function f(e){let t=4*e+139361631;t=t+g(g(4*e+183187720,146097)*3,4)*4-3908;let n=g(_(t,1461),4)*5+308,r=g(_(n,153),5)+1,i=_(g(n,153),12)+1;return{gy:g(t,1461)-100100+g(8-i,6),gm:i,gd:r}}function p(r){if(!Number.isFinite(r)||r<t||r>n)throw RangeError(`Invalid Jalaali year ${r}: must be a finite number between ${t} and ${n} (inclusive)`);let i=r+621,a=-14,o=e[0],s=0,c=0;for(let t=1;t<e.length&&(s=e[t],c=s-o,!(r<s));t+=1)a=a+g(c,33)*8+g(_(c,33),4),o=s;let l=r-o;a=a+g(l,33)*8+g(_(l,33)+3,4),_(c,33)===4&&c-l===4&&(a+=1);let u=g(i,4)-g((g(i,100)+1)*3,4)-150;return{gy:i,march:20+a-u,jump:c,n:l}}function m(e,t){let n=t;e-t<6&&(n=t-e+g(e+4,33)*33);let r=_(_(n+1,33)-1,4);return r===-1&&(r=4),r}function h(r){if(!Number.isFinite(r)||r<t||r>n)throw RangeError(`Invalid Jalaali year ${r}: must be a finite number between ${t} and ${n} (inclusive)`);let i=e[0],a=0,o=0;for(let t=1;t<e.length&&(a=e[t],o=a-i,!(r<a));t+=1)i=a;return m(o,r-i)}function g(e,t){return~~(e/t)}function _(e,t){return e-~~(e/t)*t}var v=`۰۱۲۳۴۵۶۷۸۹`;function y(e){return e.replace(/\d/g,e=>v[Number(e)])}var b=[`فروردین`,`اردیبهشت`,`خرداد`,`تیر`,`مرداد`,`شهریور`,`مهر`,`آبان`,`آذر`,`دی`,`بهمن`,`اسفند`],x=[`ش`,`ی`,`د`,`س`,`چ`,`پ`,`ج`];function S(e){let t=e.trim().match(/^(\d{4})-(\d{2})-(\d{2})/);if(t)return new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));let n=new Date(e);return Number.isNaN(n.getTime())?new Date(NaN):new Date(n.getFullYear(),n.getMonth(),n.getDate())}function C(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function w(e){let{jy:t,jm:n,jd:i}=r(e.getFullYear(),e.getMonth()+1,e.getDate());return{jy:t,jm:n,jd:i}}function T(e,t,n){let{gy:r,gm:a,gd:o}=i(e,t,n);return new Date(r,a-1,o)}function E(e){return e?w(S(e)):null}function D(e,t,n){return C(T(e,t,n))}function O(e,t,n){return`${y(String(n))} ${b[t-1]} ${y(String(e))}`}function k(e,t,n){let{gy:r,gm:a,gd:o}=i(e,t,n);return(new Date(r,a-1,o).getDay()+1)%7}function A(e,t){return o(e,t)}function j(e,t){let n=A(e,t),r=k(e,t,1),i=Array.from({length:r},()=>null);for(let e=1;e<=n;e+=1)i.push(e);for(;i.length%7!=0;)i.push(null);return i}function M(){return w(new Date)}var N=`۰۱۲۳۴۵۶۷۸۹`,P=new Intl.NumberFormat(`fa-IR`,{useGrouping:!0});function F(e){return e.replace(/[۰-۹]/g,e=>String(N.indexOf(e)))}function I(e){return F(e).replace(/[^\d]/g,``)}function L(e){let t=I(e);return t?Number(t):0}function R(e){return Number.isFinite(e)?P.format(e):`—`}function z(e){return`${R(e)} تومان`}function B(e){return`${R(e)} متر`}var V=new Intl.DateTimeFormat(`fa-IR-u-ca-persian`,{year:`numeric`,month:`2-digit`,day:`2-digit`}),H=new Intl.DateTimeFormat(`fa-IR-u-ca-persian`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`});function U(e){let t=F(e.trim()).replace(/-/g,`/`).match(/^(\d{4})\/(\d{1,2})\/(\d{1,2})/);if(!t)return!1;let n=Number(t[1]);return n>=1300&&n<=1500}function W(e){if(typeof e!=`string`)return e;let t=e.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(t))return S(t);let n=new Date(t);return Number.isNaN(n.getTime())?new Date(NaN):n}function G(e){if(!e)return`—`;if(typeof e==`string`&&U(e)){let t=F(e.trim()).replace(/-/g,`/`),n=t.match(/^(\d{4})\/(\d{1,2})\/(\d{1,2})/);if(!n)return q(t);let[,r,i,a]=n;return q(`${r}/${i.padStart(2,`0`)}/${a.padStart(2,`0`)}`)}let t=W(e);return Number.isNaN(t.getTime())?`—`:V.format(t)}function K(e){if(!e)return`—`;if(typeof e==`string`&&U(e)&&!/[T\s]\d/.test(e))return G(e);let t=W(e);return Number.isNaN(t.getTime())?`—`:H.format(t)}function q(e){return e.replace(/\d/g,e=>N[Number(e)])}function J(e){let t=I(e);return t.startsWith(`98`)?t=`0`+t.slice(2):t.startsWith(`9`)&&t.length===10&&(t=`0`+t),t.slice(0,11)}function Y(){return crypto.randomUUID()}export{S as _,B as a,J as c,b as d,x as f,D as g,E as h,K as i,L as l,O as m,z as n,R as o,j as p,G as r,Y as s,I as t,q as u,C as v,M as y};