UNPKG

jb-date-input

Version:
1 lines 107 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JBDateInput={})}(this,(function(e){function t(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function n(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}Math.pow(10,8);const a=Symbol.for("constructDateFrom");function i(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&a in e?e[a](t):e instanceof Date?new e.constructor(t):new Date(t)}function r(e,t){return i(t||e,e)}function s(e,t){return r(e,t?.in).getDate()}function o(e,t){return r(e,t?.in).getDay()}function l(e,t){return r(e,t?.in).getMonth()}function c(e){return+r(e)}function h(e,t){return r(e,t?.in).getFullYear()}function u(e,t){return+r(e)===+r(t)}Math.pow(10,8);const d=Symbol.for("constructDateFrom"),p=1948320,m=[0,31,62,93,124,155,186,216,246,276,306,336];function g(e,t,n){return function(e){if(isNaN(e))return{jy:NaN,jm:NaN,jd:NaN};let t,n;const a=e-p;let i=1+v(33*a+3,12053);n=a-(365*(i-1)+v(8*i+21,33)),n<0&&(i--,n=a-(365*(i-1)+v(8*i+21,33)));t=n<216?v(n,31):v(n-6,30);const r=n-m[t]+1;n++;return{jy:i,jm:t+1,jd:r}}(function(e,t,n){const[a,i]=y(e,t);return e=a,t=i,v(1461*(e+4800+v(t-14,12)),4)+v(367*(t-2-12*v(t-14,12)),12)-v(3*v(e+4900+v(t-14,12),100),4)+n-32075}(e,t,n))}function b(e,t,n){return function(e){if(isNaN(e))return{gy:NaN,gm:NaN,gd:NaN};let t=e+68569;const n=v(4*t,146097);t-=v(146097*n+3,4);const a=v(4e3*(t+1),1461001);t=t-v(1461*a,4)+31;const i=v(80*t,2447),r=t-v(2447*i,80);t=v(i,11);return{gy:100*(n-49)+a+t,gm:i+2-12*t,gd:r}}(function(e,t,n){const[a,i]=y(e,t);e=a,t=i;const r=t-1,s=e,o=n;let l=1948319+365*(s-1)+v(8*s+21,33);0!=r&&(l+=m[r]);return l+o}(e,t,n))}function y(e,t){if((t-=1)<0){const a=t;e-=v((t=f(f(t,n=12)+n,n))-a,12)}var n;return t>11&&(e+=v(t,12),t=f(t,12)),[e,t+1]}function v(e,t){return~~(e/t)}function f(e,t){return e-~~(e/t)*t}function w(...e){if(e.length>1){const[t,n,a=1,...i]=e,r=b(t,n+1,a);return new Date(...[r.gy,r.gm-1,r.gd,...i])}return new Date(...e)}function j(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&d in e?e[d](t):e instanceof Date?new e.constructor(t):w(t)}function x(e,t){return j(t||e,e)}function V(e){const t=e.getDate(),n=e.getMonth()+1;return g(e.getFullYear(),n,t).jd}function D(e){const t=e.getDate(),n=e.getMonth()+1;return g(e.getFullYear(),n,t).jm-1}function E(e){const t=e.getDate(),n=e.getMonth()+1;return g(e.getFullYear(),n,t).jy}function N(e,t){return V(x(e,t?.in))}function M(e,t){return x(e,t?.in).getDay()}function S(e,t){const n=x(e,t?.in),a=E(n),i=D(n),r=j(n,0);return function(e,...t){const n=e.getDate(),a=e.getMonth()+1,i=g(e.getFullYear(),a,n),[r,s=i.jm-1,o=i.jd]=t,l=b(r,s+1,o);e.setFullYear(l.gy,l.gm-1,l.gd)}(r,a,i+1,0),r.setHours(0,0,0,0),V(r)}function T(e){return x(e).getMilliseconds()}function A(e,t){return x(e,t?.in).getMinutes()}function L(e,t){return D(x(e,t?.in))}function I(e){return x(e).getSeconds()}function k(e,t){return E(x(e,t?.in))}function C(e,t,n,a=0,i=0,r=0,s=0){return w(e,t,n,a,i,r,s)}function Y(e,t,n,a={}){document.addEventListener(t,(t=>{t.composedPath().includes(e)&&(t.stopPropagation(),t.stopImmediatePropagation(),n(t))}),{capture:!0,...a})}function R(e,t,n){const a={altKey:t.altKey,bubbles:t.bubbles,cancelable:t.cancelable,code:t.code,composed:t.composed,ctrlKey:t.ctrlKey,detail:t.detail,isComposing:t.isComposing,key:t.key,location:t.location,metaKey:t.metaKey,repeat:t.repeat,shiftKey:t.shiftKey,view:t.view,charCode:t.charCode,keyCode:t.keyCode,which:t.which,...n};return new KeyboardEvent(e,a)}function O(e,t,n){const a={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed,detail:t.detail,isComposing:t.isComposing,view:t.view,which:t.which,data:t.data,dataTransfer:t.dataTransfer,inputType:t.inputType,targetRanges:"function"==typeof t.getTargetRanges()?t.getTargetRanges():[],...n};return new InputEvent(e,a)}function _(e,t,n){const a={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed,detail:t.detail,view:t.view,which:t.which,relatedTarget:t.relatedTarget,...n};return new FocusEvent(e,a)}const W=()=>/Mobi/i.test(window.navigator.userAgent);function P(e){return"string"!=typeof e?"":e.replace(/[۰-۹]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)-1728)}))}function B(e){return"string"!=typeof e&&isNaN(e)?"":e.toString().replace(/[0-9]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+1728)}))}var F=class{lightness;chroma;hue;variableName;get value(){return`oklch(${this.lightness} ${this.chroma} ${this.hue})`}constructor(e,t){this.variableName=t,this.lightness=e.lightness,this.chroma=e.chroma,this.hue=e.hue}};function H(e){return new F({lightness:6*(3+1.3*e)*.01,chroma:.001*(14+.09*e),hue:258.36},`--jb-neutral-${e}`)}function $(e){return new F({lightness:e.lightness-.1,chroma:e.chroma-.05,hue:e.hue},`${e.variableName}-pressed`)}function X(e){const t=Math.min(e.lightness+.12*(1-e.lightness),.985),n=e.chroma*(1-.15*(t-e.lightness));return new F({lightness:t,chroma:Number(n.toFixed(3)),hue:e.hue},`${e.variableName}-l`)}function q(e){const t=Math.max(e.lightness-.12*e.lightness,.02),n=e.chroma*(1-.15*(t-e.lightness));return new F({lightness:t,chroma:n,hue:e.hue},`${e.variableName}-d`)}function G(e){const t=Math.min(e.lightness+.65*(1-e.lightness),.93),n=.55*e.chroma*(1-.08*(t-e.lightness)),a=e.hue>=70&&e.hue<=162?5:-3,i=e.hue+a;return new F({lightness:t,chroma:Number(n.toFixed(3)),hue:i},`${e.variableName}-subtle`)}function U(e){const t=Math.max(e.lightness-.35,.22),n=Math.min(1.6*e.chroma,.28);return new F({lightness:Number(t.toFixed(3)),chroma:Number(n.toFixed(3)),hue:e.hue},`${e.variableName}-contrast`)}function J(e){return{main:e,hover:(t=e,new F({lightness:t.lightness+.07,chroma:t.chroma+.07,hue:t.hue},`${t.variableName}-hover`)),pressed:$(e),light:X(e),dark:q(e),subtle:G(e),contrast:U(e)};var t}const z=new F({lightness:.6,chroma:.26,hue:256},"--jb-primary"),Z=new F({lightness:.6,chroma:.26,hue:286},"--jb-secondary"),K=new F({lightness:.75,chroma:.18,hue:70},"--jb-yellow"),Q=new F({lightness:.68,chroma:.1484,hue:162.1},"--jb-green"),ee=new F({lightness:.6,chroma:.22,hue:23.21},"--jb-red"),te={single:{black:new F({lightness:.14,chroma:0,hue:0},"--jb-black"),white:new F({lightness:1,chroma:0,hue:0},"--jb-white"),highlight:new F({lightness:.93,chroma:.2302,hue:125.18},"--jb-highlight")},neutral:[H(0),H(1),H(2),H(3),H(4),H(5),H(6),H(7),H(8),H(9),H(10)],primary:J(z),secondary:J(Z),yellow:J(K),green:J(Q),red:J(ee)};function ne(e){try{const{value:t,...n}=e;window.CSS.registerProperty({...n}),function(e,t){try{t&&(document.documentElement.style.getPropertyValue(e)||document.documentElement.style.setProperty(e,t))}catch(e){}}(e.name,t)}catch(e){}}function ae(e,t){ne({name:t??e.variableName,syntax:"<color>",inherits:!0,initialValue:e.value})}const ie=["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],re=["January","February","March","April","May","June","July","August","September","October","November","December"],se="JALALI";let oe=((le={}).day="DAY",le.month="MONTH",le.year="YEAR",le);var le;const ce=new Date;HTMLElement??console.error("you cant render web component on a server side");var he=class extends HTMLElement{#e={daysWrapper:{startX:null,startY:null},yearsWrapper:{startX:null}};#t={year:null,month:null,day:null};#n=null;#a=se;#i={jalali:{year:k(ce),month:L(ce)+1},gregorian:{year:h(ce),month:l(ce)+1}};#r=ie;#s=re;setMonthList(e,t){if(Array.isArray(t)&&12==t.length){switch(e){case"JALALI":this.#r=t.map((e=>e));break;case"GREGORIAN":this.#s=t}this.#o(),this.#l(this.data.selectedMonth)}else console.error("Invalid Month List",t)}get defaultCalendarData(){return this.#i}set defaultCalendarData(e){this.#i=e}dateRestrictions=new Proxy({min:null,max:null},this.createDateRestrictionHandler());data=new Proxy({selectedYear:0,selectedMonth:0,yearSelectionRange:[0,0]},this.createDataHandler());elements;get value(){return this.#t}set value(e){const{year:t,month:n,day:a}=e;if(t&&n&&a){this.#t.year=t,this.#t.month=n,this.#t.day=a,this.data.selectedYear=t,this.data.selectedMonth=n;const e=this.shadowRoot.querySelector(".--selected");if(null!==e&&e.classList.remove("--selected"),this.data.selectedYear==t&&this.data.selectedMonth==n){const e=this.shadowRoot.querySelector(`.day-wrapper[day-number="${a}"]`);e&&e.classList.add("--selected")}}else console.error("Invalid value. please make sure you have year,month and day")}get activeSection(){return this.#n||oe.day}set activeSection(e){if(e!=this.#n){if(this.#n){const e=this.#n.toLocaleLowerCase();this.elements.selectionSections[e].classList.remove("--show")}"DAY"==e&&(this.elements.selectionSections.day.classList.add("--show"),this.elements.navigatorTitle.month.classList.add("--show"),this.elements.navigatorTitle.year.classList.add("--show"),this.elements.navigatorTitle.yearRange.classList.remove("--show")),"MONTH"==e&&(this.elements.selectionSections.month.classList.add("--show"),this.elements.navigatorTitle.month.classList.remove("--show"),this.elements.navigatorTitle.year.classList.add("--show"),this.elements.navigatorTitle.yearRange.classList.remove("--show")),"YEAR"==e&&(this.elements.selectionSections.year.classList.add("--show"),this.elements.navigatorTitle.month.classList.remove("--show"),this.elements.navigatorTitle.year.classList.remove("--show"),this.elements.navigatorTitle.yearRange.classList.add("--show")),this.#n=e}}get inputType(){return this.#a}set inputType(e){this.#a=e,this.onInputTypeChange()}#c=!1;get showPersianNumber(){return this.#c}set showPersianNumber(e){"boolean"==typeof e?(this.#c=e,this.setCalendarData()):console.error("showPersianNumber must be boolean")}get cssDirection(){return getComputedStyle(this).direction}#h=null;get direction(){return this.#h?this.#h:this.cssDirection}set direction(e){!e||"ltr"!=e&&"rtl"!=e||(this.#h=e),this.setupStyleBaseOnCssDirection()}constructor(){super(),this.initWebComponent(),this.initProps(),this.initCalendar()}connectedCallback(){this.callOnLoadEvent(),this.setupStyleBaseOnCssDirection(),this.initCalendarLayout()}initCalendarLayout(){this.#o(),this.fillDayOfWeek(),this.setCalendarData()}setupStyleBaseOnCssDirection(e=this.direction){"ltr"==e?(this.elements.navigatorTitle.nextButton.classList.add("--css-ltr"),this.elements.navigatorTitle.prevButton.classList.add("--css-ltr"),this.elements.monthDayWrapper.next.classList.add("--css-ltr"),this.elements.monthDayWrapper.prev.classList.add("--css-ltr"),this.elements.yearsWrapper.next.classList.add("--css-ltr"),this.elements.yearsWrapper.prev.classList.add("--css-ltr")):"rtl"==e&&(this.elements.navigatorTitle.nextButton.classList.remove("--css-ltr"),this.elements.navigatorTitle.prevButton.classList.remove("--css-ltr"),this.elements.monthDayWrapper.next.classList.remove("--css-ltr"),this.elements.monthDayWrapper.prev.classList.remove("--css-ltr"),this.elements.yearsWrapper.next.classList.remove("--css-ltr"),this.elements.yearsWrapper.prev.classList.remove("--css-ltr"))}fillDayOfWeek(){const e=this.inputType==se?["ش","ی","د","س","چ","پ","ج"]:["Su","Mo","Tu","We","Th","Fr","Sa"];this.elements.dayOfWeekWrapper.innerHTML="";for(let t=0;t<=6;t++){const n=document.createElement("div");n.classList.add("week-day"),n.innerHTML=e[t],this.elements.dayOfWeekWrapper.appendChild(n)}}setCalendarData(){this.inputType==se?(this.data.selectedYear=this.value.year||this.data.selectedYear||this.#i.jalali.year,this.data.selectedMonth=this.value.month||this.data.selectedMonth||this.#i.jalali.month,this.data.yearSelectionRange=[this.data.selectedYear-4,this.data.selectedYear+7],this.shadowRoot.querySelector(".swipe-up-text").innerHTML="نمایش سال‌ها"):(this.data.selectedYear=this.value.year||this.data.selectedYear||this.#i.gregorian.year,this.data.selectedMonth=this.value.month||this.data.selectedMonth||this.#i.gregorian.month,this.data.yearSelectionRange=[this.data.selectedYear-4,this.data.selectedYear+7],this.shadowRoot.querySelector(".swipe-up-text").innerHTML="show years")}callOnLoadEvent(){const e=new CustomEvent("load",{bubbles:!0,composed:!0});this.dispatchEvent(e)}callOnInitEvent(){const e=new CustomEvent("init",{bubbles:!0,composed:!0});this.dispatchEvent(e)}initWebComponent(){const e=this.attachShadow({mode:"open"});!function(){var e;ne({name:"--jb-radius",inherits:!0,value:"1rem",initialValue:"16px",syntax:"<length-percentage>"}),ne({name:"--jb-radius-xs",inherits:!0,value:"0.5rem",initialValue:"8px",syntax:"<length-percentage>"}),ne({name:"--jb-radius-sm",inherits:!0,value:"0.75rem",initialValue:"12px",syntax:"<length-percentage>"}),ne({name:"--jb-radius-lg",inherits:!0,value:"1.25rem",initialValue:"20px",syntax:"<length-percentage>"}),ne({name:"--jb-radius-xl",inherits:!0,value:"1.5rem",initialValue:"24px",syntax:"<length-percentage>"}),function(e){ae(e.neutral[0],"--jb-neutral"),ae(e.primary.main),ae(e.secondary.main),ae(e.single.black),ae(e.single.white),ae(e.single.highlight),ae(e.yellow.main),ae(e.green.main),ae(e.red.main),ae(e.red.main);for(let t=1;t<=10;t++)ae(e.neutral[t])}(te),ae((e=te).single.black,"--jb-text-primary"),ae(e.neutral[7],"--jb-text-secondary"),ae(e.single.white,"--jb-text-contrast")}();const t=document.createElement("template");t.innerHTML='<style>:host{--arrow-button-border-radius: var(--jb-calendar-arrow-button-border-radius, var(--jb-radius-sm));--day-button-border-radius: var(--jb-calendar-day-button-border-radius, var(--jb-radius-sm));--month-button-border-radius: var(--jb-calendar-month-button-border-radius, var(--jb-radius-sm));--year-button-border-radius: var(--jb-calendar-year-button-border-radius, var(--jb-radius-sm));--color: var(--jb-calendar-color,var(--jb-text-primary));--arrow-button-bgcolor: var(--jb-calendar-arrow-button-bgcolor, var(--jb-neutral-10));--arrow-fill-color: var(--jb-calendar-arrow-fill-color, var(--jb-neutral-6));--day-text-color-disabled: var(--jb-calendar-day-text-color-disabled, var(--jb-neutral-8));--day-text-color-today: var(--jb-calendar-day-text-color-today, var(--jb-green));--day-bgcolor-selected: var(--jb-calendar-day-bgcolor-selected, var(--jb-neutral));--day-color-selected: var(--jb-calendar-day-color-selected, var(--jb-text-contrast));--day-bgcolor-selected-hover: var(--jb-calendar-day-bgcolor-selected-hover, var(--jb-neutral-2));--day-color-selected-hover: var(--jb-calendar-day-color-selected-hover, var(--jb-text-contrast));--day-bgcolor-hover: var(--jb-calendar-day-bgcolor-hover,var(--jb-neutral-10));--day-color-hover: var(--jb-calendar-day-color-hover, var(--jb-text-primary));--day-text-color: var(--jb-calendar-day-text-color, var(--jb-neutral-4));--status-point-bgcolor-today: var(--jb-calendar-status-point-bgcolor-today, var(--jb-green));--status-point-border-color: var(--jb-calendar-status-point-border-color, var(--jb-white));--month-bgcolor-hover: var(--jb-calendar-month-bgcolor-hover, var(--jb-neutral-10));--month-color-hover: var(--jb-calendar-month-color-hover, var(--jb-text-primary));--year-bgcolor-hover: var(--jb-calendar-year-bgcolor-hover, var(--jb-neutral-10));--year-color-hover: var(--jb-calendar-year-color-hover, var(--jb-text-primary));--swipe-up-icon-color: var(--jb-calendar-arrow-fill-color, var(--arrow-fill-color))}.jb-calendar-web-component{width:272px;height:auto;color:var(--color);font-size:16px}.jb-calendar-web-component .navigator-section{height:32px;width:100%;margin-bottom:24px;display:flex;align-items:center;justify-content:space-between;cursor:pointer}.jb-calendar-web-component .navigator-section .arrow-btn{background-color:var(--arrow-button-bgcolor);width:32px;height:32px;border-radius:var(--arrow-button-border-radius);cursor:pointer;display:flex;justify-content:center;align-items:center;user-select:none}.jb-calendar-web-component .navigator-section .arrow-btn.--css-ltr svg{transform:scaleX(-1)}.jb-calendar-web-component .navigator-section .arrow-btn svg{fill:var(--arrow-fill-color)}.jb-calendar-web-component .navigator-section .navigator-title{user-select:none}.jb-calendar-web-component .navigator-section .navigator-title .month{display:none}.jb-calendar-web-component .navigator-section .navigator-title .month.--show{display:inline}.jb-calendar-web-component .navigator-section .navigator-title .month.--show:hover{font-weight:600}.jb-calendar-web-component .navigator-section .navigator-title .year{display:none}.jb-calendar-web-component .navigator-section .navigator-title .year.--show{display:inline}.jb-calendar-web-component .navigator-section .navigator-title .year.--show:hover{font-weight:600}.jb-calendar-web-component .navigator-section .navigator-title .year-range{display:none}.jb-calendar-web-component .navigator-section .navigator-title .year-range.--show{display:inline}.jb-calendar-web-component .calendar-section{height:auto;width:100%;position:relative}.jb-calendar-web-component .calendar-section .day-selection-section{display:none}.jb-calendar-web-component .calendar-section .day-selection-section.--show{display:block}.jb-calendar-web-component .calendar-section .day-selection-section .week-day-wrapper{display:grid;grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr;grid-template-rows:1fr;gap:4px;height:32px;width:100%;margin-bottom:16px}.jb-calendar-web-component .calendar-section .day-selection-section .week-day-wrapper .week-day{height:32px;text-align:center;font-weight:800;font-variation-settings:"wght" 800;font-size:1em;user-select:none}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container{position:relative;width:100%;height:auto;overflow-x:hidden}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper{display:grid;grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr;grid-auto-rows:1fr;gap:4px 4px;height:auto;width:100%;user-select:none}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper.current-month-day-wrapper{position:static}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper.prev-month-day-wrapper{position:absolute;top:0;left:100%;width:100%;height:100%;overflow:hidden}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper.prev-month-day-wrapper.--css-ltr{left:-100%}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper.next-month-day-wrapper{position:absolute;top:0;left:-100%;width:100%;height:100%;overflow:hidden}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper.next-month-day-wrapper.--css-ltr{left:100%}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper{position:relative;height:37px;width:32px;user-select:none;cursor:pointer}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--disable{cursor:not-allowed}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--disable .day-number-wrapper{color:var(--day-text-color-disabled)}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--today .day-number-wrapper{color:var(--day-text-color-today)}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--today .status-point{display:block}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--selected .day-number-wrapper{color:var(--day-color-selected);background-color:var(--day-bgcolor-selected)}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--selected:hover .day-number-wrapper{color:var(--day-color-selected-hover);background-color:var(--day-bgcolor-selected-hover)}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper:hover .day-number-wrapper{background-color:var(--day-bgcolor-hover);color:var(--day-color-hover)}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper .day-number-wrapper{width:32px;height:32px;border-radius:var(--day-button-border-radius);color:var(--day-text-color);display:flex;align-items:center;justify-content:center}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper .day-number-wrapper .day-number{display:flex;align-items:center;justify-content:center}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper .status-point{position:absolute;width:10px;height:10px;background-color:var(--status-point-bgcolor-today);border-radius:6px;bottom:0px;left:calc(50% - 5px);display:none;z-index:1;border:1px solid var(--status-point-border-color);box-sizing:border-box}.jb-calendar-web-component .calendar-section .month-selection-section{display:none;grid-template-columns:1fr 1fr 1fr;grid-template-rows:1fr 1fr 1fr 1fr;gap:12px 8px}.jb-calendar-web-component .calendar-section .month-selection-section.--show{display:grid}.jb-calendar-web-component .calendar-section .month-selection-section .month-wrapper{width:100%;height:32px;cursor:pointer;border-radius:var(--month-button-border-radius);user-select:none}.jb-calendar-web-component .calendar-section .month-selection-section .month-wrapper:hover{background-color:var(--month-bgcolor-hover)}.jb-calendar-web-component .calendar-section .month-selection-section .month-wrapper .month-name{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.jb-calendar-web-component .calendar-section .month-selection-section .month-wrapper .month-name:hover{color:var(--month-color-hover)}.jb-calendar-web-component .calendar-section .year-selection-section{display:none;width:100%;height:100%;position:relative;overflow-x:hidden}.jb-calendar-web-component .calendar-section .year-selection-section.--show{display:block}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper{display:grid;width:100%;height:100%;grid-template-columns:1fr 1fr 1fr;grid-template-rows:1fr 1fr 1fr 1fr;gap:12px 8px;user-select:none}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper.prev-years-wrapper{position:absolute;top:0;left:100%;width:100%;height:100%;overflow:hidden}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper.prev-years-wrapper.--css-ltr{left:-100%}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper.current-years-wrapper{position:static}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper.next-years-wrapper{position:absolute;top:0;left:-100%;width:100%;height:100%;overflow:hidden}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper.next-years-wrapper.--css-ltr{left:100%}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper .year-wrapper{width:100%;height:32px;cursor:pointer;border-radius:var(--year-button-border-radius);user-select:none}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper .year-wrapper:hover{background-color:var(--year-bgcolor-hover)}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper .year-wrapper .year-number{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper .year-wrapper .year-number:hover{color:var(--year-color-hover)}.jb-calendar-web-component .calendar-section .swipe-up-symbol{display:none;position:absolute;bottom:0px;opacity:0;transition:all .1s 0s ease;width:100%;justify-content:center;align-items:center;flex-direction:column}.jb-calendar-web-component .calendar-section .swipe-up-symbol.--show{display:flex}.jb-calendar-web-component .calendar-section .swipe-up-symbol .swipe-up-text{font-size:.8rem}.jb-calendar-web-component .calendar-section .swipe-up-symbol .swipe-up-icon{fill:var(--swipe-up-icon-color)}</style>\n\n <div class="jb-calendar-web-component">\n <section class="navigator-section">\n <div class="prev-btn arrow-btn" title="قبل">\n <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fit=""\n preserveAspectRatio="xMidYMid meet">\n <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path>\n </svg>\n </div>\n <div class="navigator-title">\n <span class="month"></span>\n <span class="year"></span>\n <span class="year-range"></span>\n </div>\n <div class="next-btn arrow-btn" title="بعد">\n <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fit=""\n preserveAspectRatio="xMidYMid meet">\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"></path>\n </svg>\n </div>\n\n </section>\n <section class="calendar-section">\n <div class="day-selection-section">\n <div class="week-day-wrapper">\n </div>\n <div class="month-day-container">\n <div class="prev-month-day-wrapper month-day-wrapper"></div>\n <div class="current-month-day-wrapper month-day-wrapper"></div>\n <div class="next-month-day-wrapper month-day-wrapper"></div>\n </div>\n </div>\n <div class="month-selection-section">\n\n </div>\n <div class="year-selection-section">\n <div class="prev-years-wrapper years-wrapper"></div>\n <div class="current-years-wrapper years-wrapper"></div>\n <div class="next-years-wrapper years-wrapper"></div>\n </div>\n <div class="swipe-up-symbol">\n <svg class="swipe-up-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_403_3281)">\n <path\n d="M23.7101 16.2899L15.5401 8.11994C15.0756 7.65431 14.5239 7.28488 13.9164 7.03281C13.309 6.78075 12.6578 6.651 12.0001 6.651C11.3424 6.651 10.6912 6.78075 10.0838 7.03281C9.47631 7.28488 8.92455 7.65431 8.46009 8.11994L0.290094 16.2899C0.10179 16.4782 -0.0039978 16.7336 -0.0039978 16.9999C-0.0039978 17.2662 0.10179 17.5216 0.290094 17.7099C0.478398 17.8982 0.733792 18.004 1.00009 18.004C1.2664 18.004 1.52179 17.8982 1.71009 17.7099L9.88009 9.53994C10.4426 8.97814 11.2051 8.66258 12.0001 8.66258C12.7951 8.66258 13.5576 8.97814 14.1201 9.53994L22.2901 17.7099C22.3831 17.8037 22.4937 17.8781 22.6155 17.9288C22.7374 17.9796 22.8681 18.0057 23.0001 18.0057C23.1321 18.0057 23.2628 17.9796 23.3847 17.9288C23.5065 17.8781 23.6171 17.8037 23.7101 17.7099C23.8038 17.617 23.8782 17.5064 23.929 17.3845C23.9798 17.2627 24.0059 17.132 24.0059 16.9999C24.0059 16.8679 23.9798 16.7372 23.929 16.6154C23.8782 16.4935 23.8038 16.3829 23.7101 16.2899Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_403_3281">\n <rect width="24" height="24" fill="white" />\n </clipPath>\n </defs>\n </svg>\n <div class="swipe-up-text">\n نمایش سال‌ها\n </div>\n </div>\n </section>\n </div>\n ',e.appendChild(t.content.cloneNode(!0)),this.elements={selectionSections:{day:e.querySelector(".day-selection-section"),month:e.querySelector(".month-selection-section"),year:e.querySelector(".year-selection-section")},monthDayWrapper:{current:e.querySelector(".current-month-day-wrapper"),prev:e.querySelector(".prev-month-day-wrapper"),next:e.querySelector(".next-month-day-wrapper")},yearsWrapper:{current:e.querySelector(".current-years-wrapper"),prev:e.querySelector(".prev-years-wrapper"),next:e.querySelector(".next-years-wrapper")},dayOfWeekWrapper:e.querySelector(".week-day-wrapper"),navigatorTitle:{month:e.querySelector(".navigator-title .month"),year:e.querySelector(".navigator-title .year"),yearRange:e.querySelector(".navigator-title .year-range"),nextButton:e.querySelector(".next-btn"),prevButton:e.querySelector(".prev-btn"),wrapper:e.querySelector(".navigator-title")},swipeupSymbol:e.querySelector(".swipe-up-symbol")},this.registerEventHandlers(),window.matchMedia}registerEventHandlers(){this.elements.navigatorTitle.nextButton.addEventListener("click",this.onNextButtonClicked.bind(this)),this.elements.navigatorTitle.prevButton.addEventListener("click",this.onPrevButtonClicked.bind(this)),this.elements.navigatorTitle.year.addEventListener("click",this.onNavigatorTitleYearClicked.bind(this)),this.elements.navigatorTitle.month.addEventListener("click",this.onNavigatorTitleMonthClicked.bind(this)),this.elements.selectionSections.day.addEventListener("touchstart",this.onDayWrapperTouchStart.bind(this)),this.elements.selectionSections.day.addEventListener("touchmove",this.onDayWrapperTouchMove.bind(this)),this.elements.selectionSections.day.addEventListener("touchend",this.onDayWrapperTouchEnd.bind(this)),this.elements.selectionSections.year.addEventListener("touchstart",this.onYearWrapperTouchStart.bind(this)),this.elements.selectionSections.year.addEventListener("touchmove",this.onYearWrapperTouchMove.bind(this)),this.elements.selectionSections.year.addEventListener("touchend",this.onYearWrapperTouchEnd.bind(this))}onDayWrapperTouchStart(e){this.#e.daysWrapper.startX=e.touches[0].clientX,this.#e.daysWrapper.startY=e.touches[0].clientY}onDayWrapperTouchMove(e){if(null!==this.#e.daysWrapper.startX&&null!==this.#e.daysWrapper.startY){e.preventDefault();const t=e.touches[0].clientX-this.#e.daysWrapper.startX,n=e.touches[0].clientY-this.#e.daysWrapper.startY;if(Math.abs(t)>Math.abs(n))this.elements.swipeupSymbol.classList.remove("--show"),this.elements.swipeupSymbol.style.transform="translateY(0px)",this.elements.swipeupSymbol.style.opacity="0",this.elements.monthDayWrapper.current.style.transform=`translateX(${t}px)`,this.elements.monthDayWrapper.prev.style.transform=`translateX(${t}px)`,this.elements.monthDayWrapper.next.style.transform=`translateX(${t}px)`;else if(this.elements.monthDayWrapper.current.style.transform="translateX(0px)",this.elements.monthDayWrapper.prev.style.transform="translateX(0px)",this.elements.monthDayWrapper.next.style.transform="translateX(0px)",this.elements.monthDayWrapper.current.style.transform=`translateY(${n}px)`,n<0){this.elements.swipeupSymbol.classList.add("--show");const e=Math.abs(n)/70;Math.abs(n)>32?this.elements.swipeupSymbol.style.transform="translateY(0px)":this.elements.swipeupSymbol.style.transform=`translateY(${n+32}px)`,this.elements.swipeupSymbol.style.opacity=`${e}`}}}onDayWrapperTouchEnd(e){if(null!==this.#e.daysWrapper.startX){const t=e.changedTouches[0].clientX-this.#e.daysWrapper.startX;if(this.#e.daysWrapper.startX=null,Math.abs(t)>100){let e=t>0?"next":"prev";"ltr"==this.direction&&(e=t>0?"prev":"next"),"prev"==e?(this.elements.monthDayWrapper.current.style.transform="translateX(0px)",this.elements.monthDayWrapper.prev.style.transform="translateX(0px)",this.elements.monthDayWrapper.next.style.transform="translateX(0px)",this.onPrevButtonClicked()):(this.elements.monthDayWrapper.current.style.transform="translateX(0px)",this.elements.monthDayWrapper.prev.style.transform="translateX(0px)",this.elements.monthDayWrapper.next.style.transform="translateX(0px)",this.onNextButtonClicked())}else this.moveBackToPos(this.elements.monthDayWrapper.current),this.moveBackToPos(this.elements.monthDayWrapper.prev),this.moveBackToPos(this.elements.monthDayWrapper.next)}if(null!==this.#e.daysWrapper.startY){const t=e.changedTouches[0].clientY-this.#e.daysWrapper.startY;this.#e.daysWrapper.startY=null,this.elements.swipeupSymbol.classList.remove("--show"),this.elements.swipeupSymbol.style.transform="translateY(0px)",this.elements.swipeupSymbol.style.opacity="0",Math.abs(t)>70&&(this.activeSection=t>0?oe.month:oe.year)}}onYearWrapperTouchStart(e){this.#e.yearsWrapper.startX=e.touches[0].clientX}onYearWrapperTouchMove(e){null!==this.#e.yearsWrapper.startX&&(this.elements.yearsWrapper.current.style.transform=`translateX(${e.touches[0].clientX-this.#e.yearsWrapper.startX}px)`,this.elements.yearsWrapper.prev.style.transform=`translateX(${e.touches[0].clientX-this.#e.yearsWrapper.startX}px)`,this.elements.yearsWrapper.next.style.transform=`translateX(${e.touches[0].clientX-this.#e.yearsWrapper.startX}px)`)}onYearWrapperTouchEnd(e){if(null!==this.#e.yearsWrapper.startX){const t=e.changedTouches[0].clientX-this.#e.yearsWrapper.startX;this.#e.yearsWrapper.startX=null;let n=t>0?"next":"prev";"ltr"==this.direction&&(n=t>0?"prev":"next"),Math.abs(t)>100?"prev"==n?(this.elements.yearsWrapper.current.style.transform="translateX(0px)",this.elements.yearsWrapper.prev.style.transform="translateX(0px)",this.elements.yearsWrapper.next.style.transform="translateX(0px)",this.onPrevButtonClicked()):(this.elements.yearsWrapper.current.style.transform="translateX(0px)",this.elements.yearsWrapper.prev.style.transform="translateX(0px)",this.elements.yearsWrapper.next.style.transform="translateX(0px)",this.onNextButtonClicked()):(this.moveBackToPos(this.elements.yearsWrapper.current),this.moveBackToPos(this.elements.yearsWrapper.prev),this.moveBackToPos(this.elements.yearsWrapper.next))}}moveBackToPos(e){e&&(e.style.transition="transform 0.3s 0s ease",setTimeout((()=>{e.style.transition=""}),300),e.style.transform="")}#l(e){const t=this.inputType==se?this.#r[e-1]:this.#s[e-1];this.elements.navigatorTitle.month.innerHTML=t}createDataHandler(){const e=(e,t)=>{this.elements.navigatorTitle.year.innerHTML=this.localizeString(e.toString())},t=(e,t)=>{this.#l(e),this.fillMonthDays()},n=e=>{this.elements.navigatorTitle.yearRange.innerHTML=this.localizeString(`${e[0]} - ${e[1]}`),this.fillYearList()};return{set:(a,i,r)=>("selectedYear"==i&&(e(r,a.selectedYear),a[i]=r),"selectedMonth"==i&&(a[i]=r,t(r,a.selectedMonth)),"yearSelectionRange"==i&&Array.isArray(r)&&(a[i]=r,n(r)),!0)}}createDateRestrictionHandler(){return{set:(e,t,n)=>{switch(e[t]=n,t){case"min":case"max":"DAY"==this.activeSection&&this.fillMonthDays()}return!0}}}initProps(){this.callOnInitEvent()}selectToday(){const e=new Date;this.inputType==se?this.select(k(e),L(e)+1,M(e)):this.select(h(e),l(e)+1,o(e))}select(e,t,n){this.value={year:e,month:t,day:n}}initCalendar(){this.#n||(this.activeSection=oe.day)}#u(e){return[2,3,4,5,6,7,1][e]}fillYearList(){this.fillYearListDom(this.data.yearSelectionRange[0],this.data.yearSelectionRange[1],"current"),this.fillYearListDom(this.data.yearSelectionRange[0]-12,this.data.yearSelectionRange[1]-12,"prev"),this.fillYearListDom(this.data.yearSelectionRange[0]+12,this.data.yearSelectionRange[1]+12,"next")}fillYearListDom(e,t,n){this.elements.yearsWrapper[n].innerHTML="";for(let a=e;a<=t;a++){const e=this.createYearDom(a);this.elements.yearsWrapper[n].appendChild(e)}}createYearDom(e){const t=document.createElement("div");t.classList.add("year-wrapper");const n=document.createElement("div");return n.classList.add("year-number"),n.innerHTML=this.localizeString(e.toString()),t.appendChild(n),t.addEventListener("click",(()=>{this.data.selectedYear=e,this.activeSection=oe.month})),t}#o(){this.elements.selectionSections.month.innerHTML="";for(let e=1;e<13;e++){const t=this.#d(e);this.elements.selectionSections.month.appendChild(t)}}#d(e){const t=document.createElement("div");t.classList.add("month-wrapper");const n=document.createElement("div");n.classList.add("month-name");const a=this.inputType==se?this.#r[e-1]:this.#s[e-1];return n.innerHTML=a,t.appendChild(n),t.addEventListener("click",(()=>{this.data.selectedMonth=e,this.activeSection=oe.day})),t}#p(e,t,n){return this.inputType==se?C(e,t-1,n):new Date(e,t-1,n)}#m(e){return this.inputType==se?this.#u(M(e)):o(e)}#g(e){return this.inputType==se?S(e):function(e,t){const n=r(e,t?.in),a=n.getFullYear(),s=n.getMonth(),o=i(n,0);return o.setFullYear(a,s+1,0),o.setHours(0,0,0,0),o.getDate()}(e)}#b(e,t,n){const a=new Date;return this.inputType==se?k(a)==n&&L(a)==t-1&&N(a)==e:h(a)==n&&l(a)==t-1&&s(a)==e}fillMonthDaysDom(e,t,n){const a=this.#p(e,t,1),i=this.#m(a);this.elements.monthDayWrapper[n].innerHTML="";for(let e=1;e<i;e++){const e=this.createEmptyDayDom();this.elements.monthDayWrapper[n].appendChild(e)}const r=this.#g(a);for(let e=1;e<=r;e++){const t=this.#p(this.data.selectedYear,this.data.selectedMonth,e),a=this.#b(e,this.data.selectedMonth,this.data.selectedYear),i=this.value.year==this.data.selectedYear&&this.value.month==this.data.selectedMonth&&this.value.day==e,r=!this.checkIsDayDisable(t).isAllValid,s=this.createDayDom(e,this.data.selectedYear,this.data.selectedMonth,a,i,r);this.elements.monthDayWrapper[n].appendChild(s)}}fillMonthDays(){const e=this.data.selectedMonth,t=this.data.selectedYear;let n,a,i,r;e>1?(n=e-1,a=this.data.selectedYear):(a=this.data.selectedYear-1,n=12),this.fillMonthDaysDom(a,n,"prev"),this.fillMonthDaysDom(t,e,"current"),e<12?(i=e+1,r=this.data.selectedYear):(r=this.data.selectedYear+1,i=1),this.fillMonthDaysDom(r,i,"next")}checkIsDayDisable(e){const t={min:!0,max:!0,get isAllValid(){return this.min&&this.max}};return this.dateRestrictions.min&&(t.min=(n=e,a=this.dateRestrictions.min,+x(n)>+x(a)||u(e,this.dateRestrictions.min))),this.dateRestrictions.max&&(t.max=function(e,t){return+x(e)<+x(t)}(e,this.dateRestrictions.max)||u(e,this.dateRestrictions.max)),t;var n,a}createEmptyDayDom(){const e=document.createElement("div");return e.classList.add("empty-day"),e}createDayDom(e,t,n,a,i,r){const s=document.createElement("div");s.classList.add("day-wrapper"),s.setAttribute("day-number",e.toString()),a&&s.classList.add("--today"),i&&s.classList.add("--selected");const o=document.createElement("div");o.classList.add("day-number-wrapper");const l=document.createElement("div");l.classList.add("day-number"),l.innerHTML=this.localizeString(e.toString());const c=document.createElement("div");return c.classList.add("status-point"),o.appendChild(l),s.appendChild(c),s.appendChild(o),r?s.classList.add("--disable"):s.addEventListener("click",(()=>{this.onDayClicked(t,n,e)})),s}onDayClicked(e,t,n){this.select(e,t,n);const a=new CustomEvent("select");this.dispatchEvent(a)}onNextButtonClicked(){if("DAY"==this.activeSection){const e=this.data.selectedMonth;e<12?this.data.selectedMonth=e+1:(this.data.selectedYear=this.data.selectedYear+1,this.data.selectedMonth=1)}if("MONTH"==this.activeSection&&(this.data.selectedYear=this.data.selectedYear+1),"YEAR"==this.activeSection){const e=this.data.yearSelectionRange[0]+12,t=this.data.yearSelectionRange[1]+12;this.data.yearSelectionRange=[e,t]}}onPrevButtonClicked(){if("DAY"==this.activeSection){const e=this.data.selectedMonth;e>1?this.data.selectedMonth=e-1:(this.data.selectedYear=this.data.selectedYear-1,this.data.selectedMonth=12)}if("MONTH"==this.activeSection&&(this.data.selectedYear=this.data.selectedYear-1),"YEAR"==this.activeSection){const e=this.data.yearSelectionRange[0]-12,t=this.data.yearSelectionRange[1]-12;e>0&&(this.data.yearSelectionRange=[e,t])}}onNavigatorTitleYearClicked(){this.activeSection!=oe.day&&this.activeSection!=oe.month||(this.activeSection=oe.year)}onNavigatorTitleMonthClicked(){this.activeSection==oe.day&&(this.activeSection=oe.month)}onInputTypeChange(){this.setCalendarData(),this.fillDayOfWeek(),this.#o()}localizeString(e){return this.showPersianNumber?B(e):e}};function ue(e,t,n){const a={validationList:[],isAllValid:!0},i=e=>{a.validationList.push(e),e.isValid||(a.isAllValid=!1)},r=e.filter((e=>!0===e.defer)),s=e.filter((e=>!0!==e.defer)),o=[];for(const e of s){const a=de(t,e,n);a instanceof Promise?o.push(a):i(a)}if(a.isAllValid)for(const e of r){const a=de(t,e,n);a instanceof Promise?o.push(a):i(a)}return{syncValidationResult:a,asyncList:o}}function de(e,t,n){let a,i=t.message;if(t.validator instanceof RegExp){const i="string"==typeof e?e:n(e);a=t.validator.test(i),t.validator.lastIndex=0}if("function"==typeof t.validator){const n=function(e,t){function n(e){let t=null;return"string"==typeof e&&e.length>0&&(t=e),{isValid:"string"==typeof e?0==e.length:e,message:t}}const a=e(t);return a instanceof Promise?new Promise((e=>{a.then((t=>{e(n(t))}))})):n(a)}(t.validator,e);if(n instanceof Promise)return new Promise((e=>{n.then((n=>{e({isValid:n.isValid,message:n.message,validation:t})}))}));a=n.isValid,i=n.message??i}return void 0===t.validator&&(a=!1),a?{isValid:!0,message:"",validation:t}:{isValid:!1,message:i,validation:t}}!customElements.get("jb-calendar")&&window.customElements.define("jb-calendar",he);var pe=class{#s=[];#t={isValid:null,message:null};get resultSummary(){return this.#t}result=null;#n={clearValidationError:[],getValue:()=>null,getValidations:[],getValueString:()=>"",setValidationResult:[],showValidationError:[]};get#r(){return[...this.#l(),...this.#s]}constructor(e){this.setCallbacks(e)}setCallbacks(e){Object.keys(e).forEach((t=>{"function"==typeof e[t]&&void 0!==this.#n[t]&&(Array.isArray(this.#n[t])?this.#n[t].push(e[t]):this.#n[t]=e[t])}))}get list(){return this.#s}set list(e){this.#s=e,this.checkValidity({showError:!1})}async checkValidity(e){const t=e?.value||await Promise.resolve(this.#n.getValue()),n=await this.#e(t);return this.#a(n,e),n}checkValiditySync(e){const t=e?.value||this.#n.getValue(),n=this.#o(t);return this.#a(n,e),n}#a(e,t){if(this.#t={isValid:e.isAllValid,message:null},e.isAllValid)this.#n.clearValidationError.forEach((e=>e()));else{const n=e.validationList.find((e=>!e.isValid));this.resultSummary.message=n.message,!1!==t?.showError&&this.#n.showValidationError.forEach((e=>e({message:n.message})))}this.result=e,this.#n.setValidationResult.forEach((t=>t(e)))}addValidationListGetter(e){this.#n.getValidations.push(e)}#l(){const e=[];return this.#n.getValidations.forEach((t=>{"function"==typeof t&&e.push(...t())})),e.flat()}async#e(e){return await async function(e,t,n){const{syncValidationResult:a,asyncList:i}=ue(e,t,n);for(const e of i){const t=await e;a.isAllValid=a.isAllValid&&t.isValid,a.validationList.push(t)}return a}(this.#r,e,this.#n.getValueString)}#o(e){return function(e,t,n){const{syncValidationResult:a}=ue(e,t,n);return a}(this.#r,e,this.#n.getValueString)}},me=class{lightness;chroma;hue;variableName;get value(){return`oklch(${this.lightness} ${this.chroma} ${this.hue})`}constructor(e,t){this.variableName=t,this.lightness=e.lightness,this.chroma=e.chroma,this.hue=e.hue}};function ge(e){return new me({lightness:6*(3+1.3*e)*.01,chroma:.001*(14+.09*e),hue:258.36},`--jb-neutral-${e}`)}function be(e){return new me({lightness:e.lightness-.1,chroma:e.chroma-.05,hue:e.hue},`${e.variableName}-pressed`)}function ye(e){const t=Math.min(e.lightness+.12*(1-e.lightness),.985),n=e.chroma*(1-.15*(t-e.lightness));return new me({lightness:t,chroma:Number(n.toFixed(3)),hue:e.hue},`${e.variableName}-l`)}function ve(e){const t=Math.max(e.lightness-.12*e.lightness,.02),n=e.chroma*(1-.15*(t-e.lightness));return new me({lightness:t,chroma:n,hue:e.hue},`${e.variableName}-d`)}function fe(e){const t=Math.min(e.lightness+.65*(1-e.lightness),.93),n=.55*e.chroma*(1-.08*(t-e.lightness)),a=e.hue>=70&&e.hue<=162?5:-3,i=e.hue+a;return new me({lightness:t,chroma:Number(n.toFixed(3)),hue:i},`${e.variableName}-subtle`)}function we(e){const t=Math.max(e.lightness-.35,.22),n=Math.min(1.6*e.chroma,.28);return new me({lightness:Number(t.toFixed(3)),chroma:Number(n.toFixed(3)),hue:e.hue},`${e.variableName}-contrast`)}function je(e){return{main:e,hover:(t=e,new me({lightness:t.lightness+.07,chroma:t.chroma+.07,hue:t.hue},`${t.variableName}-hover`)),pressed:be(e),light:ye(e),dark:ve(e),subtle:fe(e),contrast:we(e)};var t}const xe=new me({lightness:.6,chroma:.26,hue:256},"--jb-primary"),Ve=new me({lightness:.6,chroma:.26,hue:286},"--jb-secondary"),De=new me({lightness:.75,chroma:.18,hue:70},"--jb-yellow"),Ee=new me({lightness:.68,chroma:.1484,hue:162.1},"--jb-green"),Ne=new me({lightness:.6,chroma:.22,hue:23.21},"--jb-red"),Me={single:{black:new me({lightness:.14,chroma:0,hue:0},"--jb-black"),white:new me({lightness:1,chroma:0,hue:0},"--jb-white"),highlight:new me({lightness:.93,chroma:.2302,hue:125.18},"--jb-highlight")},neutral:[ge(0),ge(1),ge(2),ge(3),ge(4),ge(5),ge(6),ge(7),ge(8),ge(9),ge(10)],primary:je(xe),secondary:je(Ve),yellow:je(De),green:je(Ee),red:je(Ne)};function Se(e){try{const{value:t,...n}=e;window.CSS.registerProperty({...n}),function(e,t){try{t&&(document.documentElement.style.getPropertyValue(e)||document.documentElement.style.setProperty(e,t))}catch(e){}}(e.name,t)}catch(e){}}function Te(e,t){Se({name:t??e.variableName,syntax:"<color>",inherits:!0,initialValue:e.value})}var Ae=class extends HTMLElement{static get formAssociated(){return!0}#e={displayValue:"",value:""};elements;#t=!1;get disabled(){return this.#t}set disabled(e){this.#t=e,this.elements.input.disabled=e,e?this.#s.states?.add("disabled"):this.#s.states?.delete("disabled")}#a=!1;set required(e){this.#a=e,this.#n(!1)}get required(){return this.#a}#s;hasState(e){return this.#s.states.has(e)}get isAutoValidationDisabled(){return""===this.getAttribute("disable-auto-validation")||"true"===this.getAttribute("disable-auto-validation")}#n(e){if(!this.isAutoValidationDisabled)return this.#r.checkValidity({showError:e})}#r=new pe({clearValidationError:()=>this.clearValidationError(),showValidationError:this.showValidationError.bind(this),getValue:()=>this.#e,getValidations:this.#i.bind(this),getValueString:()=>this.#e.displayValue,setValidationResult:this.#o.bind(this)});get validation(){return this.#r}get displayValue(){return this.#e.displayValue}get value(){return this.#e.value}set value(e){this.#l(e,"SET_VALUE")}#l(e,t){e??="";const n=this.standardValue(e,t);this.#g(n)}#g(e){this.#e=e,this.#s&&"function"==typeof this.#s.setFormValue&&this.#s.setFormValue(e.value),this.elements.input.value=e.displayValue}initialValue="";get isDirty(){return this.#e.value!==this.initialValue}get selectionStart(){return this.elements.input.selectionStart}set selectionStart(e){this.elements.input.selectionStart=e}get selectionEnd(){return this.elements.input.selectionEnd}set selectionEnd(e){this.elements.input.selectionEnd=e}get selectionDirection(){return this.elements.input.selectionDirection}set selectionDirection(e){this.elements.input.selectionDirection=e}get name(){return this.getAttribute("name")||""}constructor(){super(),"function"==typeof this.attachInternals&&(this.#s=this.attachInternals()),this.#u()}connectedCallback(){this.#c(),this.initProp(),this.#h()}#c(){const e=new CustomEvent("load",{bubbles:!0,composed:!0});this.dispatchEvent(e)}#h(){const e=new CustomEvent("init",{bubbles:!0,composed:!0});this.dispatchEvent(e)}#u(){const e=this.attachShadow({mode:"open",delegatesFocus:!0});(function(){var e;Se({name:"--jb-radius",inherits:!0,value:"1rem",initialValue:"16px",syntax:"<length-percentage>"}),Se({name:"--jb-radius-xs",inherits:!0,value:"0.5rem",initialValue:"8px",syntax:"<length-percentage>"}),Se({name:"--jb-radius-sm",inherits:!0,value:"0.75rem",initialValue:"12px",syntax:"<length-percentage>"}),Se({name:"--jb-radius-lg",inherits:!0,value:"1.25rem",initialValue:"20px",syntax:"<length-percentage>"}),Se({name:"--jb-radius-xl",inherits:!0,value:"1.5rem",initialValue:"24px",syntax:"<length-percentage>"}),function(e){Te(e.neutral[0],"--jb-neutral"),Te(e.primary.main),Te(e.secondary.main),Te(e.single.black),Te(e.single.white),Te(e.single.highlight),Te(e.yellow.main),Te(e.green.main),Te(e.red.main),Te(e.red.main);for(let t=1;t<=10;t++)Te(e.neutral[t])}(Me),Te((e=Me).single.black,"--jb-text-primary"),Te(e.neutral[7],"--jb-text-secondary"),Te(e.single.white,"--jb-text-contrast")})(),this.#d(),this.elements={input:e.querySelector(".input-box input"),inputBox:e.querySelector(".input-box"),label:e.querySelector("label"),labelValue:e.querySelector("label .label-value"),messageBox:e.querySelector(".message-box"),slots:{startSection:e.querySelector(".jb-input-start-section-wrapper slot"),endSection:e.querySelector(".jb-input-end-section-wrapper slot")}},this.#y()}#d(){const e=document.createElement("template");e.innerHTML='<style>:host{--border-radius:var(--jb-input-border-radius, var(--jb-radius));--border-color:var(--jb-input-border-color, var(--jb-neutral-10));--message-color:var(--jb-input-message-color, var(--jb-text-secondary));--label-color: var(--jb-input-label-color, var(--jb-text-primary));--value-color: var(--jb-input-value-color, var(--jb-text-primary));--placeholder-color: var(--jb-input-placeholder-color, var(--jb-neutral-6));--input-box-bg-color:var(--jb-input-bgcolor, var(--jb-neutral-10))}:host(:state(invalid)){--message-color:var(--jb-input-message-error-color, var(--jb-red))}:host(:focus-within){--border-color:var(--jb-input-border-color-focus, var(--jb-neutral))}:host(:focus),:host(:focus-visible){outline:none}.jb-input-web-component{width:100%;margin:var(--jb-input-margin, 0 0)}.jb-input-web-component:focus-visible{outline:none}.jb-input-web-component label{width:100%;margin:var(--jb-input-label-mar