hijri-datepicker-component
Version:
Forked and enhanced version of datepicker-hijri with additional features. The 'Hijri Datepicker' is a user interface component designed to facilitate the selection and display of Hijri (Islamic) dates in applications. It offers a visual calendar interface
1 lines • 9.83 kB
JavaScript
let e,t,n=0,l=!1;const s=window,r=document,i={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l)},o=(()=>!!r.documentElement.attachShadow)(),c=(()=>{try{return new CSSStyleSheet,!0}catch(e){}return!1})(),a=new WeakMap,u=e=>a.get(e),f=(e,t)=>a.set(t.s=e,t),p=(e,t)=>t in e,d=e=>console.error(e),m=new Map,h=new Map,$=[],y=[],w=[],_=(e,t)=>n=>{e.push(n),l||(l=!0,t&&4&i.t?k(j):i.raf(j))},b=(e,t)=>{let n=0,l=0;for(;n<e.length&&(l=performance.now())<t;)try{e[n++](l)}catch(s){d(s)}n===e.length?e.length=0:0!==n&&e.splice(0,n)},j=()=>{n++,(e=>{for(let n=0;n<e.length;n++)try{e[n](performance.now())}catch(t){d(t)}e.length=0})($);const e=2==(6&i.t)?performance.now()+10*Math.ceil(n*(1/22)):1/0;b(y,e),b(w,e),y.length>0&&(w.push(...y),y.length=0),(l=$.length+y.length+w.length>0)?i.raf(j):n=0},k=e=>Promise.resolve().then(e),g=_(y,!0),v={},S=e=>"object"==(e=typeof e)||"function"===e,M=()=>s.CSS&&s.CSS.supports&&s.CSS.supports("color","var(--c)")?Promise.resolve():__sc_import_datepicker_hijri("./p-d8631f0b.js").then(()=>{i.i=s.__stencil_cssshim}),L=async()=>{i.i=s.__stencil_cssshim;const e=new RegExp("/datepicker-hijri(\\.esm)?\\.js($|\\?|#)"),t=Array.from(r.querySelectorAll("script")).find(t=>e.test(t.src)||"datepicker-hijri"===t.getAttribute("data-stencil-namespace")),n=t["data-opts"];{const e=new URL(".",new URL(t.getAttribute("data-resources-url")||t.src,s.location.href));return O(e.href),window.customElements||await __sc_import_datepicker_hijri("./p-d0882b30.js"),Object.assign(Object.assign({},n),{resourcesUrl:e.href})}},O=e=>{const t=(()=>`__sc_import_${"datepicker-hijri".replace(/\s|-/g,"_")}`)();try{s[t]=new Function("w",`return import(w);//${Math.random()}`)}catch(n){const l=new Map;s[t]=n=>{const i=new URL(n,e).href;let o=l.get(i);if(!o){const e=r.createElement("script");e.type="module",e.src=URL.createObjectURL(new Blob([`import * as m from '${i}'; window.${t}.m = m;`],{type:"application/javascript"})),o=new Promise(n=>{e.onload=()=>{n(s[t].m),e.remove()}}),l.set(i,o),r.head.appendChild(e)}return o}}},R=new WeakMap,U=e=>"sc-"+e,P=(e,t,...n)=>{let l=null,s=null,r=!1,i=!1,o=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((r="function"!=typeof e&&!S(l))&&(l=String(l)),r&&i?o[o.length-1].o+=l:o.push(r?x(null,l):l),i=r)};if(c(n),t){t.key&&(s=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter(t=>e[t]).join(" "))}}const a=x(e,null);return a.u=t,o.length>0&&(a.p=o),a.h=s,a},x=(e,t)=>({t:0,$:e,o:t,_:null,p:null,u:null,h:null}),C={},A=(e,t,n,l,r,o)=>{if(n===l)return;let c=p(e,t),a=t.toLowerCase();if("class"===t){const t=e.classList,s=T(n),r=T(l);t.remove(...s.filter(e=>e&&!r.includes(e))),t.add(...r.filter(e=>e&&!s.includes(e)))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if(c||"o"!==t[0]||"n"!==t[1]){const s=S(l);if((c||s&&null!==l)&&!r)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?c=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(u){}null==l||!1===l?e.removeAttribute(t):(!c||4&o||r)&&!s&&e.setAttribute(t,l=!0===l?"":l)}else t="-"===t[2]?t.slice(3):p(s,a)?a.slice(2):a[2]+t.slice(3),n&&i.rel(e,t,n,!1),l&&i.ael(e,t,l,!1)},E=/\s/,T=e=>e?e.split(E):[],W=(e,t,n,l)=>{const s=11===t._.nodeType&&t._.host?t._.host:t._,r=e&&e.u||v,i=t.u||v;for(l in r)l in i||A(s,l,r[l],void 0,n,t.t);for(l in i)A(s,l,r[l],i[l],n,t.t)},F=(t,n,l)=>{let s,i,o=n.p[l],c=0;if(null!==o.o)s=o._=r.createTextNode(o.o);else if(s=o._=r.createElement(o.$),W(null,o,!1),(e=>null!=e)(e)&&s["s-si"]!==e&&s.classList.add(s["s-si"]=e),o.p)for(c=0;c<o.p.length;++c)(i=F(t,o,c))&&s.appendChild(i);return s},q=(e,n,l,s,r,i)=>{let o,c=e;for(c.shadowRoot&&c.tagName===t&&(c=c.shadowRoot);r<=i;++r)s[r]&&(o=F(null,l,r))&&(s[r]._=o,c.insertBefore(o,n))},B=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l._.remove()},D=(e,t)=>e.$===t.$&&e.h===t.h,H=(e,t)=>{const n=t._=e._,l=e.p,s=t.p;null===t.o?(W(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,r,i=0,o=0,c=0,a=0,u=t.length-1,f=t[0],p=t[u],d=l.length-1,m=l[0],h=l[d];for(;i<=u&&o<=d;)if(null==f)f=t[++i];else if(null==p)p=t[--u];else if(null==m)m=l[++o];else if(null==h)h=l[--d];else if(D(f,m))H(f,m),f=t[++i],m=l[++o];else if(D(p,h))H(p,h),p=t[--u],h=l[--d];else if(D(f,h))H(f,h),e.insertBefore(f._,p._.nextSibling),f=t[++i],h=l[--d];else if(D(p,m))H(p,m),e.insertBefore(p._,f._),p=t[--u],m=l[++o];else{for(c=-1,a=i;a<=u;++a)if(t[a]&&null!==t[a].h&&t[a].h===m.h){c=a;break}c>=0?((r=t[c]).$!==m.$?s=F(t&&t[o],n,c):(H(r,m),t[c]=void 0,s=r._),m=l[++o]):(s=F(t&&t[o],n,o),m=l[++o]),s&&f._.parentNode.insertBefore(s,f._)}i>u?q(e,null==l[d+1]?null:l[d+1]._,n,l,o,d):o>d&&B(t,i,u)})(n,l,t,s):null!==s?(null!==e.o&&(n.textContent=""),q(n,null,t,s,0,s.length-1)):null!==l&&B(l,0,l.length-1)):e.o!==t.o&&(n.data=t.o)},N=(e,t)=>{t&&!e.j&&t["s-p"].push(new Promise(t=>e.j=t))},V=(e,t,n,l)=>{if(t.t|=16,4&t.t)return void(t.t|=512);const s=t.s,r=()=>z(e,t,n,s,l);let i;return N(t,t.k),l&&(t.t|=256,t.g&&(t.g.forEach(([e,t])=>J(s,e,t)),t.g=null),i=J(s,"componentWillLoad")),K(i,()=>g(r))},z=(n,l,s,i,c)=>{const a=n["s-rc"];c&&((e,t)=>{const n=((e,t)=>{let n=U(t.v),l=h.get(n);if(e=11===e.nodeType?e:r,l)if("string"==typeof l){let t,s=R.get(e=e.head||e);s||R.set(e,s=new Set),s.has(n)||((t=r.createElement("style")).innerHTML=l,e.insertBefore(t,e.querySelector("link")),s&&s.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(o&&e.shadowRoot?e.shadowRoot:e.getRootNode(),t);10&t.t&&(e["s-sc"]=n,e.classList.add(n+"-h"))})(n,s);try{((n,l,s,r)=>{t=n.tagName;const i=l.S||x(null,null),o=(e=>e&&e.$===C)(r)?r:P(null,null,r);s.M&&(o.u=o.u||{},s.M.forEach(([e,t])=>o.u[t]=n[e])),o.$=null,o.t|=4,l.S=o,o._=i._=n.shadowRoot||n,e=n["s-sc"],H(i,o)})(n,l,s,i.render())}catch(u){d(u)}l.t&=-17,l.t|=2,a&&(a.forEach(e=>e()),n["s-rc"]=void 0);{const e=n["s-p"],t=()=>G(n,l,s);0===e.length?t():(Promise.all(e).then(t),l.t|=4,e.length=0)}},G=(e,t,n)=>{const l=t.s,s=t.k;64&t.t||(t.t|=64,e.classList.add("hydrated"),J(l,"componentDidLoad"),t.L(e),s||I()),t.j&&(t.j(),t.j=void 0),512&t.t&&k(()=>V(e,t,n,!1)),t.t&=-517},I=()=>{r.documentElement.classList.add("hydrated"),i.t|=2},J=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(l){d(l)}},K=(e,t)=>e&&e.then?e.then(t):t(),Q=(e,t,n)=>{if(t.O){e.watchers&&(t.R=e.watchers);const l=Object.entries(t.O),s=e.prototype;if(l.forEach(([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>u(e).U.get(t))(this,e)},set(n){((e,t,n,l)=>{const s=u(this),r=s.P,i=s.U.get(t),o=s.t,c=s.s;if(!((n=((e,t)=>null==e||S(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?String(e):e)(n,l.O[t][0]))===i||8&o&&void 0!==i)&&(s.U.set(t,n),c)){if(l.R&&128&o){const e=l.R[t];e&&e.forEach(e=>{try{c[e](n,i,t)}catch(l){d(l)}})}2==(18&o)&&V(r,s,l,!1)}})(0,e,n,t)},configurable:!0,enumerable:!0})}),1&n){const n=new Map;s.attributeChangedCallback=function(e,t,l){i.jmp(()=>{const t=n.get(e);this[t]=(null!==l||"boolean"!=typeof this[t])&&l})},e.observedAttributes=l.filter(([e,t])=>15&t[0]).map(([e,l])=>{const s=l[1]||e;return n.set(s,e),512&l[0]&&t.M.push([e,s]),s})}}return e},X=(e,t={})=>{const n=[],l=t.exclude||[],f=r.head,p=s.customElements,$=f.querySelector("meta[charset]"),y=r.createElement("style"),w=[];let _,b=!0;Object.assign(i,t),i.l=new URL(t.resourcesUrl||"./",r.baseURI).href,t.syncQueue&&(i.t|=4),e.forEach(e=>e[1].forEach(t=>{const r={t:t[0],v:t[1],O:t[2],C:t[3]};r.O=t[2],r.C=t[3],r.M=[],r.R={},!o&&1&r.t&&(r.t|=8);const f=r.v,$=class extends HTMLElement{constructor(e){super(e),(e=>{const t={t:0,P:e,U:new Map};t.A=new Promise(e=>t.L=e),e["s-p"]=[],e["s-rc"]=[],a.set(e,t)})(e=this),1&r.t&&(o?e.attachShadow({mode:"open"}):"shadowRoot"in e||(e.shadowRoot=e))}connectedCallback(){_&&(clearTimeout(_),_=null),b?w.push(this):i.jmp(()=>((e,t)=>{if(0==(1&i.t)){const n=()=>{},l=u(e);if(t.C&&(l.T=((e,t,n)=>{t.g=t.g||[];const l=n.map(([n,l,r])=>{const o=((e,t)=>8&t?s:e)(e,n),c=((e,t)=>n=>{256&e.t?e.s[t](n):e.g.push([t,n])})(t,r),a=(e=>({passive:0!=(1&e),capture:0!=(2&e)}))(n);return i.ael(o,l,c,a),()=>i.rel(o,l,c,a)});return()=>l.forEach(e=>e())})(e,l,t.C)),!(1&l.t)){l.t|=1;{let t=e;for(;t=t.parentNode||t.host;)if(t["s-p"]){N(l,l.k=t);break}}t.O&&Object.entries(t.O).forEach(([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}}),k(()=>(async(e,t,n,l,s)=>{if(0==(32&t.t)){t.t|=32;{if((s=(e=>{const t=e.v.replace(/-/g,"_"),n=e.W,l=m.get(n);return l?l[t]:__sc_import_datepicker_hijri(`./${n}.entry.js`).then(e=>(m.set(n,e),e[t]),d)})(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.R=s.watchers,Q(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(o){d(o)}t.t&=-9,t.t|=128,e()}const e=U(n.v);if(!h.has(e)&&s.style){const t=()=>{};let l=s.style;8&n.t&&(l=await __sc_import_datepicker_hijri("./p-affe7c09.js").then(t=>t.scopeCss(l,e,!1))),((e,t,n)=>{let l=h.get(e);c&&n?(l=l||new CSSStyleSheet).replace(t):l=t,h.set(e,l)})(e,l,!!(1&n.t)),t()}}const r=t.k,i=()=>V(e,t,n,!0);r&&r["s-rc"]?r["s-rc"].push(i):i()})(e,l,t))}n()}})(this,r))}disconnectedCallback(){i.jmp(()=>(()=>{if(0==(1&i.t)){const e=u(this);e.T&&(e.T(),e.T=void 0)}})())}"s-hmr"(e){}forceUpdate(){((e,t)=>{{const n=u(e);2==(18&n.t)&&V(e,n,t,!1)}})(this,r)}componentOnReady(){return u(this).A}};r.W=e[0],l.includes(f)||p.get(f)||(n.push(f),p.define(f,Q($,r,1)))})),y.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",y.setAttribute("data-styles",""),f.insertBefore(y,$?$.nextSibling:f.firstChild),b=!1,w.length>0?w.forEach(e=>e.connectedCallback()):i.jmp(()=>_=setTimeout(I,30,"timeout"))};export{M as a,X as b,P as h,L as p,f as r};