Files
product-slip/slips/static/slips/vendor/jalalidatepicker/jalalidatepicker.min.js
2026-11-21 13:44:08 +03:30

1 line
26 KiB
JavaScript

!function(t){"use strict";var e=function(t){return void 0===t},n=function(t){return"function"==typeof t},i=function(t){return"string"==typeof t},o=function(t){return JSON.parse(JSON.stringify(t))},a=function(t){if(null===(e=t)||"object"!=typeof e)return!0;var e;try{return"{}"===JSON.stringify(t)}catch(t){return!1}},r=function(t,e){for(var n in e)if(e.hasOwnProperty(n)){var i=e[n],o=t[n];i&&"object"==typeof i&&!Array.isArray(i)?t[n]=r(o&&"object"==typeof o?o:{},i):t[n]=i}return t},s=function(t,e){return window.Math.abs(t-e*window.Math.floor(t/e))},u=function(t,n){if(void 0===n&&(n=2),e(t))return t;var i=String(Math.abs(t)),o=i.length,a="";for(t<0&&(a+="-");o<n;)o+=1,a+="0";return a+i},d=function(t){for(var e,n=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],i=n.length,o=0,a=n[0],r=1;r<i;r+=1){var u=n[r];if(o=u-a,t<u)break;a=u}var d=t-a;return o-d<6&&(d=d-o+33*~~((o+4)/33)),-1===(e=s(s(d+1,33)-1,4))&&(e=4),0===e},h=function(){var t=new Date;return function(t,e,n){var i,o;t>1600?(i=979,t-=1600):(i=0,t-=621);var a=e>2?t+1:t;return o=365*t+Math.floor((a+3)/4)-Math.floor((a+99)/100)+Math.floor((a+399)/400)-80+n+[0,31,59,90,120,151,181,212,243,273,304,334][e-1],i+=33*Math.floor(o/12053),o%=12053,i+=4*Math.floor(o/1461),(o%=1461)>365&&(i+=Math.floor((o-1)/365),o=(o-1)%365),{year:i,month:o<186?1+Math.floor(o/31):7+Math.floor((o-186)/30),day:1+(o<186?o%31:(o-186)%30)}}(t.getFullYear(),t.getMonth()+1,t.getDate())},l=function(t,e,n){var i=function(t,e){return t<8?31*(t-1)+e:186+30*(t-7)+e};return s(function(t,e,n,o,a,r){for(var s=i(a,r)-i(e,n),u=t<o?o:t,h=t<o?t:o;h<u;h++)d(h)?s+=t<o?366:-366:s+=t<o?365:-365;return s}(1392,3,25,t,e,n),7)},p=function(t,e){return[0,31,31,31,31,31,31,30,30,30,30,30,d(t)?30:29][e]},c=function(t,e,n){var i=t<=979?621:1600,o=365*(t-=t<=979?0:979)+8*Math.floor(t/33)+Math.floor((t%33+3)/4)+78+n+(e<7?31*(e-1):30*(e-7)+186);i+=400*Math.floor(o/146097),(o%=146097)>36524&&(i+=100*Math.floor(--o/36524),(o%=36524)>=365&&o++),i+=4*Math.floor(o/1461),(o%=1461)>365&&(i+=Math.floor((o-1)/365),o=(o-1)%365);var a,r=o+1,s=[0,31,i%4==0&&i%100!=0||i%400==0?29:28,31,30,31,30,31,31,30,31,30,31];for(a=0;a<13;a++){var u=s[a];if(r<=u)break;r-=u}return{year:i,month:a,day:r}},m=function(t){return 1e4*t.year+100*t.month+t.day},f=function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},v=function(t){return 8+2*t.options.separatorChars.date.length},y=function(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n].length!==e[n])return!1;return!0},g=function(t,e,n){var i=r(e||{},n||{}),o=function(t){return t._initDate?t._initDate:t.options.initDate&&"object"==typeof t.options.initDate?t.options.initDate:t.today}(t),a=t.options.maxDate,s=t.options.minDate,u=function(t){return!isNaN(t)&&t>=1e3&&t<=1999}(i.year)?i.year:o.year,d=function(t){return!isNaN(t)&&t>=1&&t<=12}(i.month)?i.month:o.month,h=!isNaN(i.day)&&i.day>=1?i.day:o.day,l=p(u,d);h>l&&(h=l);var c={year:u,month:d,day:h};return s&&m(c)<m(s)?s:a&&m(c)>m(a)?a:c},D=function(t,e,n){var i=r(e||{},n||{}),o=function(t){return t._initTime?t._initTime:t.options.initTime&&"object"==typeof t.options.initTime?t.options.initTime:{hour:0,minute:0,second:0}}(t),a=t.options.maxTime,s=t.options.minTime,u=i.hour,d=i.minute,h=i.second;return isNaN(u)||u<0||u>23?u=o.hour:s&&u<s.hour?u=s.hour:a&&u>a.hour&&(u=a.hour),isNaN(d)||d<0||d>59?d=o.minute:s&&u<=s.hour&&d<s.minute?d=s.minute:a&&u>=a.hour&&d>a.minute&&(d=a.minute),isNaN(h)||h<0||h>59?h=o.second:s&&u<=s.hour&&d<=s.minute&&h<s.second?h=s.second:a&&u>=a.hour&&d>=a.minute&&h>a.second&&(h=a.second),{hour:u,minute:d,second:h}},w=function(t,e,n,i){var o=m({year:e,month:n,day:i}),r=o,s=o,u=t.options.maxDate,d=t.options.minDate;return a(d)||(s=m(d)),a(u)||(r=m(u)),o<=r&&o>=s},T=function(t,e){return t.options.date?e.substr(0,v(t)).split(t.options.separatorChars.date):[]},b=function(t,e){var n=t.options.separatorChars;if(t.options.date){var i=v(t)+n.between.length;return t.options.time&&e.length>i?e.substr(i).split(n.time):[]}return e.split(n.time)},S=function(t,e){return y(t,e?[2,2,2]:[2,2])},_=function(t,e){var n=T(t,e),i=b(t,e);return{year:parseInt(n[0],10),month:parseInt(n[1],10),day:parseInt(n[2],10),hour:parseInt(i[0],10)||0,minute:parseInt(i[1],10)||0,second:parseInt(i[2],10)||0}},C=function(t,e,n){var i=t.options,o=i.separatorChars,a=n?o.targetDate:o.date,r=n?o.targetTime:o.time,s=n?o.targetBetween:o.between,d=i.date?""+e.year+a+u(e.month)+a+u(e.day):"",h=i.time?""+u(e.hour)+r+u(e.minute)+(i.hasSecond?r+u(e.second):""):"";return d+(d&&h?s:"")+h},M=function(t,e){return m(t)===m(e)},x=function(t){return t.slice().sort(function(t,e){var n=m(t),i=m(e);return n<i?-1:n>i?1:0})},E=function(t,e,n){if(!e.length)return"";var i=t.options.mode||"single",o="range"===i?x(e).slice(0,2):e,a="range"===i?t.options.rangeSeparator:t.options.multipleSeparator;return o.map(function(e){return function(t,e,n){var i=n?t.options.separatorChars.targetDate:t.options.separatorChars.date;return""+e.year+i+u(e.month)+i+u(e.day)}(t,e,n)}).join(a)},I=function(t,e){var n=t.options.mode||"single";if(!e||"single"===n)return[];for(var i="range"===n?t.options.rangeSeparator:t.options.multipleSeparator,o=e.split(i),a=[],r=0;r<o.length;r++){var s=o[r].trim();if(V(t,s)){var u=_(t,s);a.push({year:u.year,month:u.month,day:u.day})}}return"range"===n?x(a).slice(0,2):a},V=function(t,e){return!!e&&y(T(t,e),[4,2,2])},A=function(t,e){return!!e&&S(b(t,e),t.options.hasSecond)},N=function(t){var e,n=null==(e=t.input)?void 0:e.value;if(!n)return"";if(t.options.targetValueType){if("single"!==(t.options.mode||"single")){var i=I(t,n);if("gregorian"===t.options.targetValueType){var o=i.map(function(t){return r(t,c(t.year,t.month,t.day))});return E(t,o,!0)}return n}var a=_(t,n);if("gregorian"===t.options.targetValueType){var s=c(a.year,a.month,a.day);return C(t,r(a,s),!0)}}return n},H="jdp",B="div."+H,Y=H+"-container",O=H+"-overlay",L=B+"-years",P=B+"-year",k=B+"-months",R=B+"-month",j=B+"-days",z=B+"-days-header",W=B+"-day",q=B+"-day.not-in-month",J=B+"-day.disabled-day",U=q+".disabled-day",$=B+"-day-name",F=B+"-icon-plus",X=B+"-icon-minus",G=B+"-footer",K=B+"-btn-today",Q=B+"-btn-empty",Z=B+"-btn-close",tt=B+"-time-container",et=B+"-time",nt="selected",it="not-in-range",ot="holiday-day",at=H+":change",rt="change",st=rt,ut="click",dt="focusin",ht="keydown",lt="today",pt="attr",ct="data-jdp-",mt=ct+"target-value-input",ft=ct+"target-value-type",vt=ct+"mode",yt=ct+"only-date",gt=ct+"only-time",Dt=["ش","ی","د","س","چ","پ","ج"],wt=["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],Tt={date:"/",between:" ",time:":",targetDate:"-",targetBetween:" ",targetTime:":"},bt=["initDate","minDate","maxDate"],St={initDate:ct+"init-date",minDate:ct+"min-date",maxDate:ct+"max-date",minTime:ct+"min-time",maxTime:ct+"max-time",targetValueInput:mt,targetValueType:ft,mode:vt,hasSecond:ct+"has-second"},_t=["minTime","maxTime"],Ct=["single","range","multiple"],Mt="visible",xt="block",Et="none",It=function(t){if(["html","body","#document"].indexOf((t.nodeName||"").toLowerCase())>=0)return window;if(t instanceof HTMLElement){var e=window.getComputedStyle(t),n=e.overflow,i=e.overflowX,o=e.overflowY;if(/auto|scroll|overlay/.test(n+o+i))return t}return It(t.parentNode)},Vt=function(t){var e=document.createEvent("Event");return e.initEvent(t,!0,!0),e},At=function(t,e){t&&(t.dispatchEvent(Vt(e)),t.dispatchEvent(Vt("change")),t.dispatchEvent(Vt("input")))},Nt=function(t,e){t.innerHTML=e},Ht=function(t,n,o,a,r,s){void 0===s&&(s="text");var u=t.split(".");t=u.shift()||"div";var d=u,h=window.document.createElement(t);if(i(n)){var l=window.document.querySelector(n);if(!l)throw new Error("Parent element not found: "+n);l.appendChild(h)}else n.appendChild(h);return d.length&&(h.className=d.join(" ")),o&&a&&function(t,e,n){for(var i=e.split(" "),o=0,a=i.length;o<a;o++)t.addEventListener(i[o],n,!1)}(h,o,a),e(r)||("html"===s?Nt(h,r):h.textContent=r),h},Bt=function(t,e){return e?t.toString().replace(/\d/g,function(t){return"۰۱۲۳۴۵۶۷۸۹"[parseInt(t,10)]}):t},Yt=function(t,e,n){var i=[];(!n||n<=0)&&(n=1);for(var o=t;o<=e;o+=n)i.push(u(o));return i},Ot=function(t,e,n){var i=Ht(et,e),o=Ht("select",i,st,function(e){var i;t.setValue(D(t,t.initTime,((i={})[n]=function(t){return Number(t.target.value)}(e),i)))});o.tabIndex=-1;for(var a,s,u=(a=function(t){return r({hour:0,minute:0,second:0},t.options.minTime||{})}(t),s=function(t){return r({hour:23,minute:59,second:59},t.options.maxTime||{})}(t),"hour"===n?Yt(a.hour,s.hour,t.options.hourIncrement):"minute"===n?function(t,e,n){return e.hour===n.hour?Yt(e.minute,n.minute,t.options.minuteIncrement):t.initTime.hour===e.hour?Yt(e.minute,59,t.options.minuteIncrement):t.initTime.hour===n.hour?Yt(0,n.minute,t.options.minuteIncrement):Yt(0,59,t.options.minuteIncrement)}(t,a,s):function(t,e,n){return e.hour===n.hour&&e.minute===n.minute?Yt(e.second,n.second):t.initTime.hour===e.hour&&t.initTime.minute===e.minute?Yt(e.second,59):t.initTime.hour===n.hour&&t.initTime.minute===n.minute?Yt(0,n.second):Yt(0,59)}(t,a,s)),d=0;d<u.length;d++){var h=u[d],l=Ht("option",o);l.value=h.toString(),l.text=Bt(h,t.options.persianDigits).toString(),l.selected=parseInt(h)===Number(t.getValue[n]||t.initTime[n])}},Lt=function(t){return 6===t?".last-week."+ot:""},Pt=function(t,e){var n,i,o,a,r,s=function(t){return{year:t.year,month:t.month,day:t.day}}(e),u=t.options.mode||"single";if("single"===u)return t.inputValue.day===e.day&&t.inputValue.year===e.year&&t.inputValue.month===e.month?"."+nt:"";if("multiple"===u){for(var d=0;d<t.selectedDates.length;d++)if(M(s,t.selectedDates[d]))return"."+nt;return""}return t.selectedDates.length?M(s,t.selectedDates[0])?"."+nt+".range-start":2===t.selectedDates.length&&M(s,t.selectedDates[1])?"."+nt+".range-end":2===t.selectedDates.length&&(n=s,i=t.selectedDates[0],o=t.selectedDates[1],a=m(n),r=x([i,o]),a>m(r[0])&&a<m(r[1]))?".in-range":"":""},kt=function(t,e,n,i){var o,a,r,s,u="PLUS"===i,d="",h=u?F:X,l=u&&(null==(o=t.options.maxDate)?void 0:o.year)===t.initDate.year,p=u&&(null==(a=t.options.maxDate)?void 0:a.month)===t.initDate.month,c=!u&&(null==(r=t.options.minDate)?void 0:r.year)===t.initDate.year,m=!u&&(null==(s=t.options.minDate)?void 0:s.month)===t.initDate.month,f=u?t.options.plusHtml:t.options.minusHtml;n?(l||c)&&(d=it):(l&&p||c&&m)&&(d=it),Ht(h+"."+d,e,ut,function(){n?u?t.increaseYear():t.decreaseYear():u?t.increaseMonth():t.decreaseMonth()},f,"html")},Rt=function(t,e,n){kt(t,e,n,"PLUS")},jt=function(t,e,n){kt(t,e,n,"MINUS")},zt=function(t){return t.target.value},Wt=function(t){var e,n=Ht(L,t.dpContainer);Rt(t,n,!0);var i=Ht(P,n);jt(t,n,!0);var o=null!=(e=t.options.useDropdownYears)?e:t.options.useDropDownYears,a=Ht(o?"select":"input",i,"keyup change",function(e){var n=Number(zt(e));n<1e3||n>2e3||t.yearChange(n)});if(o){a.setAttribute("tabindex","-1");for(var r=function(t){var e,n;function i(t){return 100*Math.round(t/100)}var o=t.initDate.year;return{min:(null==(e=t.options.minDate)?void 0:e.year)||i(o-200),max:(null==(n=t.options.maxDate)?void 0:n.year)||i(o+200)}}(t),s=r.min;s<=r.max;s++){var u=Ht("option",a);u.value=s.toString(),u.text=Bt(s,t.options.persianDigits).toString(),u.selected=s===t.initDate.year}}else a.tabIndex=-1,a.value=t.initDate.year.toString(),a.type="number"},qt=function(t){Wt(t),function(t){var e=Ht(k,t.dpContainer);Rt(t,e,!1);var n=Ht(R,e);jt(t,e,!1);var i=Ht("select",n,rt,function(e){t.monthChange(Number(zt(e)))});i.tabIndex=-1;for(var o=function(t){var e=t.initDate.year,n=t.options.minDate,i=t.options.maxDate,o=[],a=1,r=12;e===(null==n?void 0:n.year)?(a=n.month,e===(null==i?void 0:i.year)&&(r=i.month)):e===(null==i?void 0:i.year)&&(a=1,r=i.month);for(var s=a;s<=r;s++)o.push(s);return o}(t),a=t.options.months,r=0;r<o.length;r++){var s=Ht("option",i);s.value=o[r].toString(),s.text=Bt(a[o[r]-1],t.options.persianDigits).toString(),s.selected=o[r]===t.initDate.month}}(t),function(t){for(var e=Ht(z,t.dpContainer),i=Ht(j,t.dpContainer),o=0;o<7;o++)Ht($+Lt(o),e,void 0,void 0,Bt(t.options.days[o],t.options.persianDigits).toString());for(var a=function(e){return!e.day||e.inBeforeMonth?e.day=1:e.day+=1,e.inBeforeMonth=!1,e.inAfterMonth=!1,e.isValid=!1,e.isHoliday=!1,e.isHollyDay=!1,e.className="",e.year=t.initDate.year,e.month=t.initDate.month,e.weekDay=l(e.year,e.month,e.day),e},s=a({}),u=p(s.year,s.month),d=s.weekDay,h=7*Math.ceil((d+u)/7)-1,c=1===s.month?12:s.month-1,m=12===s.month?1:s.month+1,f=12===c?s.year-1:s.year,v=1===m?s.year+1:s.year,y=(1===s.month?p(s.year-1,c):p(s.year,c))-d,g=0,D=function(){s.inBeforeMonth=s.day<=d&&T<d,s.inAfterMonth=T>=u+d,(s.inBeforeMonth||s.inAfterMonth)&&(s.inBeforeMonth?(y++,s.day=y,s.year=f,s.month=c):(g++,s.day=g,s.year=v,s.month=m),s.weekDay=l(s.year,s.month,s.day)),s.isValid=w(t,s.year,s.month,s.day),s.className=Lt(l(s.year,s.month,s.day)),s.className+=Pt(t,s),t.today.day===s.day&&t.today.year===s.year&&t.today.month===s.month&&(s.className+=".today"),n(t.options.dayRendering)&&r(s,t.options.dayRendering(s,t.input)),(s.isHoliday||s.isHollyDay)&&(s.className+="."+ot);var e=s.isValid?W:J;(s.inBeforeMonth||s.inAfterMonth)&&(e=q,s.isValid||(e=U));var o=Ht(e+s.className,i,void 0,void 0,Bt(s.day,t.options.persianDigits).toString());o.day=s.day,o.month=s.month,o.year=s.year,s.isValid&&o.addEventListener(ut,function(){t.setValue({year:o.year,month:o.month,day:o.day})}),a(s)},T=0;T<=h;T++)D()}(t)},Jt=function(t){var e,n=Ht(G,t.dpContainer,void 0,void 0,void 0);if(t.options.showTodayBtn&&t.options.date){var i=function(t){return w(t,t.today.year,t.today.month,t.today.day)}(t);Ht(K+(i?"":".disabled-btn"),n,ut,function(){i&&t.setValue(t.today)},"امروز")}t.options.date||!t.options.time||null!=(e=t.input)&&e.value&&!t.options.showSelectTimeBtnAlways||Ht(K,n,ut,function(){t.setValue(t.initTime),t.hide()},"انتخاب"),t.options.showEmptyBtn&&Ht(Q,n,ut,function(){t.cleanValue(),t.options.hideAfterChange&&t.hide()},"خالی"),t.options.showCloseBtn&&Ht(Z,n,ut,function(){t.hide()},"بستن")},Ut=function(t){Nt(t.dpContainer,""),t.options.date&&qt(t),t.options.time&&function(t){var e=tt+(t.options.time&&!t.options.date?".jdp-only-time":""),n=Ht(e,t.dpContainer);t.options.hasSecond&&Ot(t,n,"second"),Ot(t,n,"minute"),Ot(t,n,"hour")}(t),Jt(t)};var $t=/iphone|ipod|android|ie|blackberry|fennec/.test(null==(t=window.navigator)||null==(t=t.userAgent)?void 0:t.toLowerCase()),Ft=function(t,e){return n=e.split(t.options.separatorChars.time),i=t.options.hasSecond,S(n,i)?{hour:parseInt(n[0],10),minute:parseInt(n[1],10),second:parseInt(n[2],10)||0}:null;var n,i},Xt=function(t,e,a){var r=function(n,i){var o,a=t[n],r=e[n],s=bt.indexOf(n)>-1&&a===lt?e.today:a,u=Object.getOwnPropertyDescriptor(e,n);null!=u&&u.get&&!u.set&&delete e[n],e[n]=null!=(o=null!=s?s:r)?o:i},s=function(t){if("targetValueInput"===t)return function(){var t;return null==(t=a.input)?void 0:t.getAttribute(mt)};if("targetValueType"===t)return function(){var t;return null==(t=a.input)?void 0:t.getAttribute(ft)};if("mode"===t)return function(){var t,e;return(e=null==(t=a.input)?void 0:t.getAttribute(vt))&&Ct.indexOf(e)>-1?e:"single"};if("hasSecond"===t)return function(){var t,e,n;return e=null==(t=a.input)?void 0:t.getAttribute(St.hasSecond),n=!0,null==e||""===e?n:"false"!==e};var e=St[t],n=_t.indexOf(t)>-1;return function(){return function(t,e){var n,r=null==(n=a.input)?void 0:n.getAttribute(t);if(!e&&r===lt)return o(a.today);if(!i(r))return{};try{r=document.querySelector(r).value}catch(t){}return e?A(a,r)?_(a,r):Ft(a,r)||{}:V(a,r)?_(a,r):{}}(e,n)}};function u(n){if(t[n]===pt||"date"===n||"time"===n){"date"!==n&&"time"!==n&&delete e[n];var i=function(){return{}};if("date"===n){var o,u=null!=(o=t.date)?o:e.date;delete e[n],i=function(){var t,e;return!(null!=(t=a.input)&&t.hasAttribute(gt))&&(u||(null==(e=a.input)?void 0:e.hasAttribute(yt)))}}else if("time"===n){var d,h=null!=(d=t.time)?d:e.time;delete e[n],i=function(){var t,e;return!(null!=(t=a.input)&&t.hasAttribute(yt))&&(h||(null==(e=a.input)?void 0:e.hasAttribute(gt)))}}else i=s(n);window.Object.defineProperty(e,n,{get:i,enumerable:!0,configurable:!0})}else{var l=e[n];delete e[n],r(n,l)}return e}return r("container","body"),r("selector","input[data-jdp]"),r("zIndex",1e3),r("autoShow",!0),r("autoHide",!0),r("autoReadOnlyInput",$t),r("topSpace",0),r("bottomSpace",0),r("overflowSpace",-10),r("hideAfterChange",!0),r("hideAfterChangeWithTime",!1),r("changeMonthRotateYear",!1),r("showTodayBtn",!0),r("showEmptyBtn",!0),r("showCloseBtn",$t),r("showSelectTimeBtnAlways",!1),r("hasSecond",!0),r("date",!0),r("time",!1),r("days",Dt),r("months",wt),r("separatorChars",Tt),r("persianDigits",!1),r("plusHtml",'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-256v256h-84v-256h-256v-84h256v-256h84v256h256v84z"></path></g></svg>'),r("minusHtml",'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-596v-84h596v84z"></path></g></svg>'),void 0!==t.useDropDownYears&&void 0===t.useDropdownYears&&(e.useDropdownYears=t.useDropDownYears),r("useDropdownYears",!0),e.useDropDownYears=e.useDropdownYears,r("today",h()),r("position","left"),r("minuteIncrement",1),r("hourIncrement",1),r("mode","single"),r("rangeSeparator"," - "),r("multipleSeparator",", "),n(t.dayRendering)&&(e.dayRendering=t.dayRendering),t.initTime&&t.initTime!==lt&&t.initTime!==pt&&(e.initTime=t.initTime),t.initDate===lt&&(e.initDate=e.today),t.minDate===lt&&(e.minDate=e.today),t.maxDate===lt&&(e.maxDate=e.today),e=u("time"),e=u("date"),e=u("initDate"),e=u("minDate"),e=u("maxDate"),e=u("minTime"),e=u("maxTime"),e=u("targetValueInput"),e=u("targetValueType"),e=u("mode"),e=u("hasSecond")},Gt=function(){function t(t,e){this.container=void 0,this.selector=void 0,this.zIndex=void 0,this.autoShow=void 0,this.autoHide=void 0,this.autoReadOnlyInput=void 0,this.topSpace=void 0,this.bottomSpace=void 0,this.overflowSpace=void 0,this.hideAfterChange=void 0,this.hideAfterChangeWithTime=void 0,this.changeMonthRotateYear=void 0,this.showTodayBtn=void 0,this.showEmptyBtn=void 0,this.showCloseBtn=void 0,this.showSelectTimeBtnAlways=void 0,this.dayRendering=void 0,this.minDate=void 0,this.maxDate=void 0,this.initDate=void 0,this.minTime=void 0,this.maxTime=void 0,this.initTime=void 0,this.date=void 0,this.time=void 0,this.today=void 0,this.hasSecond=void 0,this.targetValueInput=void 0,this.targetValueType=void 0,this.days=void 0,this.months=void 0,this.separatorChars=void 0,this.persianDigits=void 0,this.plusHtml=void 0,this.minusHtml=void 0,this.useDropdownYears=void 0,this.useDropDownYears=void 0,this.position=void 0,this.minuteIncrement=void 0,this.hourIncrement=void 0,this.mode=void 0,this.rangeSeparator=void 0,this.multipleSeparator=void 0,Xt(t||{},a(e.options)?this:e.options,e)}return t.prototype.update=function(t,e){Xt(t||{},this,e)},t}(),Kt={init:function(t){this.updateOptions(t),Element.prototype.matches=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,window.removeEventListener("resize",ne),window.addEventListener("resize",ne),document.body.removeEventListener("click",oe),document.body.addEventListener("click",oe),function(t){if(document.body.removeEventListener(dt,ie),!t)return;document.body.addEventListener(dt,ie)}(this.options.selector)},updateOptions:function(t){a(this.options)?this.options=new Gt(t,this):this.options.update(t,this),Zt()},options:{},input:null,isTransitioning:!1,get dpContainer(){return this._dpContainer&&this._dpContainer.isConnected||(this._dpContainer=Ht(Y,this.options.container||document.body),this._dpContainer.setAttribute("tabindex","-1")),this.overlayElement&&this.overlayElement.isConnected||(this.overlayElement=Ht(O,this.options.container||document.body)),Zt(),this._dpContainer},get today(){return this._today=this._today||this.options.today||h(),this._today},get inputValue(){var t,e=(null==(t=this.input)?void 0:t.value)||"";return function(t,e){if(!e)return!1;var n=t.options.separatorChars,i=f(n.date),o=f(n.time),a=f(n.between),r=t.options.date?"\\d{4}"+i+"\\d{2}"+i+"\\d{2}":"",s=t.options.time?"\\d{2}"+o+"\\d{2}"+(t.options.hasSecond?o+"\\d{2}":""):"";return new RegExp("^"+r+(r&&s?a:"")+s+"$").test(e)}(this,e)||V(this,e)?_(this,e):{}},get initDate(){return this.options.initDate?this.options.initDate:(this._initDate||(this._initDate=g(this,function(t){var e,n=(null==(e=t.input)?void 0:e.value)||"";if(!n)return t.options.initDate||o(t.today);if(V(t,n))return _(t,n);return o(t.today)}(this))),this._initDate)},get initTime(){return this._initTime||(this._initTime=D(this,function(t){var e,n=(a=new Date,{hour:a.getHours(),minute:a.getMinutes(),second:0}),o=(null==(e=t.input)?void 0:e.value)||t.options.initTime||n;var a;if(!i(o))return o;if(A(t,o))return _(t,o);return n}(this))),this._initTime},_draw:function(){Ut(this)},show:function(t){var e,n=this;(e=this)._initDate=null,e._initTime=null,e._value=null,e.selectedDates=[],this.input=t,function(t){var e;if("single"===(t.options.mode||"single"))return;t.selectedDates=I(t,(null==(e=t.input)?void 0:e.value)||"")}(this),this._draw(),function(t,e){e.autoReadOnlyInput&&!t.readOnly&&(t.setAttribute("readonly","readonly"),t.readOnly=!0)}(t,this.options),this.isTransitioning=!0,Qt(this,!0),setTimeout(function(){Qt(n,!0),n.isShow=!0,n.isTransitioning=!1},300),this.setPosition(),function(t){ee(),Kt._scrollParent=It(t),Kt._scrollHandler=te,Kt._scrollParent.addEventListener("scroll",Kt._scrollHandler,!1)}(t),document.addEventListener(ht,ae)},hide:function(){Qt(this,!1),this.isShow=!1,ee(),document.removeEventListener(ht,ae)},setPosition:function(){if(this.input&&this.dpContainer.style.visibility===Mt){var t=this.input.getBoundingClientRect(),e=t.height,n=t.left,i=t.top+e;this.options.topSpace&&(i+=this.options.topSpace);var o=window.document.body.offsetWidth,a=this.dpContainer.offsetWidth,r=this.dpContainer.offsetHeight,s=this.options.position;"right"===s?(n=n+t.width-a)+a>=o&&(n-=n+a-(o+(this.options.overflowSpace||0))):"center"===s&&(n=n+t.width/2-a/2)+a>=o&&(n-=n+a-(o+(this.options.overflowSpace||0))),n+a>=o&&(n-=n+a-(o+(this.options.overflowSpace||0))),n<0&&(n=0),i-e>=r&&i+r>=window.innerHeight&&(i-=r+e+(this.options.bottomSpace||0)+(this.options.topSpace||0)),this.dpContainer.style.position="fixed",this.dpContainer.style.left=n+"px",this.dpContainer.style.top=i+"px"}},get getValue(){return this._value=this._value||this.inputValue||{},this._value},setValue:function(t){var e,n,i;this.options.date&&"single"!==(this.options.mode||"single")&&"number"==typeof(e=t).year&&"number"==typeof e.month&&"number"==typeof e.day?function(t,e){"range"===(t.options.mode||"single")?function(t,e){if(!t.selectedDates.length||2===t.selectedDates.length)return void(t.selectedDates=[e]);t.selectedDates=x([t.selectedDates[0],e])}(t,e):function(t,e){for(var n=[],i=!0,o=0;o<t.selectedDates.length;o++)M(t.selectedDates[o],e)?i=!1:n.push(t.selectedDates[o]);i&&n.push(e);t.selectedDates=x(n)}(t,e);!function(t){t.input&&(t.input.value=E(t,t.selectedDates),At(t.input,at));t.setTargetValue(),"range"===(t.options.mode||"single")&&2===t.selectedDates.length&&t.options.hideAfterChange?t.hide():t._draw()}(t)}(this,t):(this._value=r({year:this.today.year,month:this.today.month,day:this.today.day,hour:this.initTime.hour,minute:this.initTime.minute,second:this.initTime.second},r(this._value||{},t)),this._initTime=null,this.input&&(this.input.value=(n=this,i=this._value,C(n,i)),At(this.input,at)),this.setTargetValue(),!this.options.hideAfterChange||this.options.time&&!this.options.hideAfterChangeWithTime?this._draw():this.hide())},cleanValue:function(){this.selectedDates=[],this.input&&(this.input.value="",At(this.input,at)),this.setTargetValue()},setTargetValue:function(){if(this.options.targetValueInput){var t=this.options.targetValueInput instanceof HTMLElement?[this.options.targetValueInput]:document.querySelectorAll(this.options.targetValueInput);if(t&&t.length)for(var e=0;e<t.length;e++){t[e].value=N(this)}}},increaseMonth:function(){if(this._initDate){var t=12===this._initDate.month;this.options.changeMonthRotateYear&&t&&this.increaseYear(),this.monthChange(t?1:this._initDate.month+1)}},decreaseMonth:function(){if(this._initDate){var t=1===this._initDate.month;this.options.changeMonthRotateYear&&t&&this.decreaseYear(),this.monthChange(t?12:this._initDate.month-1)}},monthChange:function(t){this._initDate&&(this._initDate=g(this,this._initDate,{month:t}),this._draw())},increaseYear:function(){this._initDate&&this.yearChange(this._initDate.year+1)},decreaseYear:function(){this._initDate&&this.yearChange(this._initDate.year-1)},yearChange:function(t){this._initDate&&(this._initDate=g(this,this._initDate,{year:t}),this._draw())},_dpContainer:void 0,overlayElement:void 0,_scrollParent:void 0,_scrollHandler:void 0,_today:void 0,_initDate:null,_initTime:null,_value:null,selectedDates:[],isShow:!1};function Qt(t,e){t.dpContainer.style.visibility=e?Mt:"hidden",t.dpContainer.style.display=e?xt:Et,t.overlayElement&&(t.overlayElement.style.display=e?xt:Et)}function Zt(){var t,e,n=Kt.options.zIndex;"number"==typeof n&&(null!=(t=Kt._dpContainer)&&t.isConnected&&(Kt._dpContainer.style.zIndex=String(n)),null!=(e=Kt.overlayElement)&&e.isConnected&&(Kt.overlayElement.style.zIndex=String(n-1)))}function te(){Kt.setPosition()}function ee(){Kt._scrollParent&&Kt._scrollHandler&&(Kt._scrollParent.removeEventListener("scroll",Kt._scrollHandler),Kt._scrollParent=void 0,Kt._scrollHandler=void 0)}function ne(){Kt.setPosition()}var ie=function(t){Kt.options.autoShow&&t.target&&t.target.matches(Kt.options.selector)&&Kt.show(t.target)};var oe=function(t){var e,i,o,a=(e=Kt.dpContainer,(o=(i=t).path||i.composedPath&&i.composedPath()||!1)?-1!==o.indexOf(e):e.outerHTML.indexOf(i.target.outerHTML)>-1),r=function(t){try{return n(t.composedPath)?t.composedPath()[0]:t.target}catch(e){return t.target}}(t)===Kt.input;Kt.options.autoHide&&Kt.isShow&&!a&&!r&&Kt.hide()};function ae(t){var e;"Escape"===t.key&&(Kt.isTransitioning||(null==(e=Kt.input)||null==e.blur||e.blur(),Kt.hide()))}window.jalaliDatepicker={startWatch:function(t){void 0===t&&(t={}),Kt.init(t)},show:function(t){Kt.show(t)},hide:function(){Kt.hide()},updateOptions:function(t){Kt.updateOptions(t)}}}();