').attr({id:'overlay'}))}).on('click','#overlay',function(){let anim=$('#mobile').data('animate') || '';$('#sidebar').css({top:''}).removeClass([anim,'block']).closest('body').css({overflow:''});$(this).remove()});$(window).on('scroll',function(){let pbar=$('#pbar'),riser=$('#riser');if (pbar.length){let pos=pbar.data('position') || 'top',height=$(document).height() - $(window).height(),value=($(window).scrollTop() / height*100) + '%',attr=(pos==='top' || pos==='bottom') ? 'width':'height';pbar.css({[attr]:value})}if (riser.length){let align=riser.data('align') || 'right',delay=riser.data('delay') || 100,offset=riser.data('offset') || 100;riser.css({[align]:'1rem'});$(this).scrollTop()>offset ? riser.fadeIn(delay):riser.fadeOut(delay)}});const aos=document.querySelectorAll('[class^="aos-"]');const obs=new IntersectionObserver((entries,observer)=>{entries.forEach(entry=>{const className=Array.from(entry.target.classList).find(cls=>cls.startsWith('aos-'));const anim=`${className}-in`;const timer=Array.from(entry.target.classList).find(cls=>cls.startsWith('aos-timer-'));const delay=timer ? parseInt(timer.split('-').pop())*1000:0;if (entry.isIntersecting){setTimeout(()=>{entry.target.classList.add(anim);if (entry.target.classList.contains('aos-once')) observer.unobserve(entry.target)},delay)}else{if (!entry.target.classList.contains('aos-once'))entry.target.classList.remove(anim)}})},{threshold:Array.from(aos).map(el=>{const vue=Array.from(el.classList).find(cls=>cls.startsWith('aos-visible-'));return vue ? parseInt(vue.split('-').pop()) / 100:.5})});aos.forEach(el=>obs.observe(el));$.fn.accordion=function(){return this.each(function(){const obj=$(this);const slideUp=obj.data('slide-up') || 100;const slideDown=obj.data('slide-down') || 150;const autoClose=obj.data('auto-close') || false;obj.on('click','.accordion-header',function(e){e.preventDefault();e.stopPropagation();const header=$(this);const body=header.next('.accordion-body');if (String(autoClose)==='true'){obj.find('.accordion-body').not(body).slideUp(slideUp).parent().removeClass('active')}else if ($(autoClose).length){$(autoClose).find('.accordion-body').not(body).slideUp(slideUp).parent().removeClass('active')}body.slideToggle(slideDown,function(){$(this).parent().toggleClass('active',$(this).is(':visible'))})})})};$('.accordion').accordion();$('.alert').each(function(){const alert=$(this),animation=alert.data('animate') || null;alert.hide().addClass(animation).show();$('.btn-close',alert).on('click',function(){alert.removeClass(animation);if (animation){setTimeout(()=>{alert.addClass([animation,'reverse']).on('animationend',function(){alert.remove()})},100)}else{alert.fadeOut(function(){alert.remove()})}})});$('.btn-check,.btn-switch,.btn-radio').on('mouseup',function(e){if (e.which===1){setTimeout(()=>{let input=$('input',this),name=input.attr('name');$('[name="'+name+'"]',this).removeAttr('checked');input.prop('checked') ? input.attr('checked','checked'):input.removeAttr('checked')},100)}});$('.btn-event').on('click',function(e){e.preventDefault();let el=$(this),buffer=el.html(),delay=el.data('event-delay'),icon=el.data('event-icon') || '',form=el.data('event-form') || '',text=el.data('event-text') || buffer;if ($(form).length &&!$(form)[0].checkValidity()) return;typeof el.prop('disabled')!=='undefined' ? el.prop('disabled',true):el.addClass('disabled');icon ? el.html('
' + text):el.html(text);if (delay){setTimeout(function(){el.html(buffer);typeof el.prop('disabled')!=='undefined' ? el.prop('disabled',false):el.removeClass('disabled');if ($(form).length) $(form).submit()},delay)}else if ($(form).length){$(form).submit()}});$.fn.calendar=function(options){const cfg=$.extend({start:0,animate:'',calendar:'.calendar',days:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],months:['January','February','March','April','May','June','July','August','September','October','November','December'],minYears:4,maxYears:0,disableWeekends:false,onClick:function(){}},options);const pad=n=>String(n).padStart(2,'0');const format=d=>`${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;const isWeekend=day=>day===0 || day===6;const isToday=d=>d.toDateString()===new Date().toDateString();return this.each(function(){const inp=$(this);const dt={minYears:inp.data('min-years') || cfg.minYears,maxYears:inp.data('max-years') || cfg.maxYears,s:inp.data('start') || cfg.start,a:inp.data('animate') || cfg.animate,c:inp.data('calendar') || cfg.calendar,min:new Date(inp.attr('min')),max:new Date(inp.attr('max'))};const updateMinMax=()=>{dt.min=inp.attr('min') ? new Date(inp.attr('min')):null;dt.max=inp.attr('max') ? new Date(inp.attr('max')):null};const isDisabled=d=>(dt.min && d < dt.min) || (dt.max && d>dt.max);const render=(m,y,obj)=>{const days=$('.calendar-days',obj).empty();const fd=new Date(y,m,1).getDay();const dm=new Date(y,m + 1,0).getDate();cfg.days.forEach((_,i)=>{const index=(i + dt.s) % 7;const weekCls=cfg.disableWeekends && isWeekend(index) ? 'we disabled':(isWeekend(index) ? 'we':'');days.append(`
${cfg.days[index]}
`)});days.append('
'.repeat((fd - dt.s + 7) % 7));for (let i=1;i <=dm;i++){const d=new Date(y,m,i);let cls='day';if (isWeekend(d.getDay())) cls +=' we';if (cfg.disableWeekends && isWeekend(d.getDay())) cls +=' disabled';if (isToday(d)) cls +=' today';if (isDisabled(d)) cls +=' disabled';days.append(`
${isDisabled(d) ? '-':i}
`)}if (inp.val()){const [Y,M,D]=inp.val().split('-').map(Number);if (Y===y && M - 1===m)$(`.day[data-day="${D}"]`,days).addClass('active')}toggle(obj,y,m)};const toggle=(obj,y,m)=>{const years=$('.calendar-year option',obj).map((_,el)=>+el.value).get();$('.btn-prev',obj).prop('disabled',y <=Math.min(...years) && m===0);$('.btn-next',obj).prop('disabled',y>=Math.max(...years) && m===11)};const load=obj=>{updateMinMax();const now=new Date();const month=$('.calendar-month',obj).empty();const year=$('.calendar-year',obj).empty();cfg.months.forEach((mn,i)=>month.append(`
`));const yStart=now.getFullYear() - dt.minYears;const yEnd=now.getFullYear() + dt.maxYears;for (let y=yStart;y <=yEnd;y++)year.append(`
`);month.val(now.getMonth());year.val(now.getFullYear());render(now.getMonth(),now.getFullYear(),obj);$('.btn-prev,.btn-next',obj).on('click',function(){let m=+month.val() + ($(this).hasClass('btn-next') ? 1:-1);let y=+year.val();if (m < 0){m=11;y--}if (m>11){m=0;y++}month.val(m);year.val(y);render(m,y,obj)});month.add(year).on('change',()=>render(+month.val(),+year.val(),obj));$('.calendar-days',obj).on('click','.day:not(.disabled)',function(){if (cfg.disableWeekends && $(this).hasClass('we')) return;const dayVal=$(this).data('day');const monthVal=+month.val() + 1;const yearVal=+year.val();const isWe=$(this).hasClass('we');inp.val(`${yearVal}-${pad(monthVal)}-${pad(dayVal)}`);$('.day',obj).removeClass('active');$(this).addClass('active');cfg.onClick(yearVal,monthVal,dayVal,isWe);obj.fadeOut(100,()=>obj.remove())});$('.btn-today',obj).on('click',()=>{const n=new Date();inp.val(format(n));render(n.getMonth(),n.getFullYear(),obj)});$('.btn-undo',obj).on('click',()=>{inp.val('');$('.day',obj).removeClass('active')});$('.btn-close',obj).on('click',()=>obj.fadeOut(100,()=>obj.remove()))};inp.on('click',e=>{e.preventDefault();const id=`calendar_${inp.attr('name')}`;if ($(`#${id}`).length) return;const obj=$(dt.c).clone(true,true).attr('id',id).appendTo('body').css({top:inp.offset().top + inp.outerHeight(),left:inp.offset().left});dt.a ? obj.addClass(['show',dt.a]):obj.fadeIn(100);load(obj);if (inp.val()){const [Y,M,D]=inp.val().split('-').map(Number);$('.calendar-month',obj).val(M - 1);$('.calendar-year',obj).val(Y);render(M - 1,Y,obj)}const bottom=obj.offset().top + obj.outerHeight();const overflow=bottom - $(window).height();if (overflow>0)obj.css('top',obj.offset().top - overflow);$(document).on('click',e=>{if (!$(e.target).closest(obj).length &&!$(e.target).is(inp))obj.fadeOut(100,()=>obj.remove())})});inp.on('change',function(){updateMinMax();const [Y,M]=inp.val().split('-').map(Number);render(M - 1,Y,$(this).closest('.calendar'))})})};$('[data-calendar]').calendar();$.fn.captcha=function(options){let set=$.extend({background:true,color:true,fonts:['Arial','Verdana','Trebuchet MS'],length:5,tokenName:null,tokenValue:null,minTime:2000,onFailure:function(){}},options);return this.each(function(){let canvas=$(this).get(0),audio=$(this).data('audio'),input=$(this).data('input'),submit=$(this).data('submit'),reload=$(this).data('reload'),form=$(submit).closest('form'),ctx=canvas.getContext('2d'),lng=navigator.language.split('-')[0],startTime=Date.now(),rawCode=null,typedChars=0,userInteracted=false;const bgColor=()=>{let r=Math.floor(Math.random()*56 + 200),g=Math.floor(Math.random()*56 + 200),b=Math.floor(Math.random()*56 + 200);if (!set.background) r=g=b=255;return `rgb(${r},${g},${b})`};const grid=()=>{ctx.strokeStyle='rgba(255,255,255,1)';ctx.lineWidth=2;for (let x=0;x < canvas.width;x +=10){ctx.beginPath();ctx.moveTo(x,0);ctx.lineTo(x,canvas.height);ctx.stroke()}for (let y=0;y < canvas.height;y +=10){ctx.beginPath();ctx.moveTo(0,y);ctx.lineTo(canvas.width,y);ctx.stroke()}};const rand=(length)=>{let ascii=[...Array.from({length:10},(_,i)=>String.fromCharCode(48 + i)),...Array.from({length:26},(_,i)=>String.fromCharCode(65 + i))];for (let i=ascii.length - 1;i>0;i--){let j=Math.floor(Math.random()*(i + 1));[ascii[i],ascii[j]]=[ascii[j],ascii[i]]}return ascii.slice(0,length).join('')};const code=()=>rand(set.length);const draw=(v)=>{ctx.fillStyle=bgColor();ctx.fillRect(0,0,canvas.width,canvas.height);grid();let w=canvas.width / (v.length + 2),h=(canvas.height / 2) + 5;v.split('').forEach((ch,i)=>{let x=w*(i + 1),y=h + (Math.random()>.5 ? 0:10),r=Math.floor(Math.random()*156) + 50,g=Math.floor(Math.random()*156) + 50,b=Math.floor(Math.random()*156) + 50,FS=Math.floor(Math.random()*10) + 20,FF=set.fonts[Math.floor(Math.random()*set.fonts.length)];if (!set.color) r=g=b=0;ctx.font=`${FS}px ${FF}`;ctx.fillStyle=`rgb(${r},${g},${b})`;ctx.save();ctx.translate(x,y);ctx.rotate(rotate());ctx.fillText(ch,0,0);ctx.restore()})};const rotate=()=>{const calc=[()=>(Math.random() - .5)*.6,()=>(Math.random()*.6) - .3,()=>(Math.random() - .3)*.5];return calc[Math.floor(Math.random()*calc.length)]()};const listen=()=>{let msg=rawCode.split('').join(',');msg.split('').forEach((l)=>{let speech=new SpeechSynthesisUtterance(l);speech.lang=lng;speechSynthesis.speak(speech)})};const refresh=()=>{speechSynthesis.cancel();rawCode=code();draw(rawCode);startTime=Date.now();typedChars=0;userInteracted=false};$(audio).on('click',function(){listen();$(input).focus()});$(reload).on('click',function(){refresh();$(input).val('').focus()});form.on('mousemove keydown click touchstart',function(){userInteracted=true});form.on('submit',function(){let elapsed=Date.now() - startTime;if (!userInteracted || elapsed < set.minTime || typedChars < set.length){set.onFailure();refresh();return false}if ($(input).val()!==rawCode){$(input).val('');set.onFailure();refresh();return false}let hiddenField=form.find(`[name="${set.tokenName}"]`);if (!hiddenField.length){hiddenField=$('
',{type:'hidden',autocomplete:'off',name:set.tokenName,value:set.tokenValue,}).appendTo(form)}return true});$(input).attr('autocomplete','off').attr('maxlength',set.length).attr('required',true).on('input',function(){$(this).val($(this).val().toUpperCase());typedChars++});refresh()})};$.fn.carousel=function(options){const config=$.extend({animate:'',interval:3000,scrolling:false,},options);return this.each(function(){const obj=$(this),btn=$('.carousel-radio',obj),content=$('.carousel-content',obj).addClass(obj.data('animate') || config.animate);let cur=btn.index($('.btn-radio input:checked',obj)),intervalId;const start=()=>{intervalId=setInterval(()=>slide(1),obj.data('interval') || config.interval)};const stop=()=>clearInterval(intervalId);const show=(index)=>{content.css('transform',`translateX(${-index*100}%)`)};const slide=(direction)=>{const newIndex=(cur + direction + btn.length) % btn.length;show(newIndex);btn.eq(newIndex).prop('checked',true);cur=newIndex};obj.on('click','.carousel-prev',()=>{slide(-1);stop()}).on('click','.carousel-next',()=>{slide(1);stop()}).on('click','.carousel-radio',()=>{cur=btn.index($('.btn-radio input:checked',obj));show(cur)});if (obj.data('scrolling') || config.scrolling){obj.hover(stop,start);start()}show(cur)})};$('.carousel').carousel();$.fn.colorPicker=function(options){let settings=$.extend({callback(){}},options);return this.each(function(){let input=$(this),container=$('
').appendTo('body'),canvas=container.find('canvas')[0],ctx=canvas.getContext('2d'),dpr=window.devicePixelRatio || 1,size=150,dragging=false;canvas.width=canvas.height=size*dpr;canvas.style.width=canvas.style.height=size + 'px';ctx.scale(dpr,dpr);function drawWheel(){let r=size / 2,grad=ctx.createConicGradient(0,r,r);for (let i=0;i<=360;i++) grad.addColorStop(i/360,`hsl(${i},100%,50%)`);ctx.fillStyle=grad;ctx.beginPath();ctx.arc(r,r,r,0,2*Math.PI);ctx.fill();let whiteGrad=ctx.createRadialGradient(r,r,0,r,r,r);whiteGrad.addColorStop(0,'rgba(255,255,255,1)');whiteGrad.addColorStop(1,'rgba(255,255,255,0)');ctx.fillStyle=whiteGrad;ctx.beginPath();ctx.arc(r,r,r,0,2*Math.PI);ctx.fill()}function getColor(x,y){let rect=canvas.getBoundingClientRect(),cx=(x-rect.left)*dpr,cy=(y-rect.top)*dpr,dx=cx/dpr - size/2,dy=cy/dpr - size/2;if (Math.sqrt(dx*dx+dy*dy)>size/2) return null;let d=ctx.getImageData(cx,cy,1,1).data,hex='#' + [0,1,2].map(i=>d[i].toString(16).padStart(2,'0')).join(''),rgb=`rgb(${d[0]},${d[1]},${d[2]})`;return{hex,rgb}}function updateColor(x,y,hide){let c=getColor(x,y);if(!c) return;input.val(c.hex);settings.callback(c.hex,c.rgb);if(hide) container.hide()}drawWheel();input.on('focus',()=>{let off=input.offset();container.css({top:off.top + input.outerHeight() + 5,left:off.left,display:'block'})});$(container).on('mousedown.colorPicker mousemove.colorPicker mouseup.colorPicker',e=>{if(e.type==='mousedown'){if(!$(e.target).closest(container).length && e.target!==input[0]){container.hide();dragging=false;return}if(e.target===canvas){e.preventDefault();dragging=true;updateColor(e.clientX,e.clientY)}}else if(e.type==='mousemove'){if(dragging) updateColor(e.clientX,e.clientY)}else if(e.type==='mouseup'){if(dragging){dragging=false;updateColor(e.clientX,e.clientY,true)}}})})};$.fn.dataList=function(opt){const cfg=$.extend({wrap:null,sorting:null,callback:function (){}},opt);const popup=$('').hide().appendTo('body');const createList=(listEl,sorting)=>{let arr=listEl.find('option').map(function(){const val=$(this).attr('value');const txt=$(this).text() || val;return{val,txt}}).get();if (sorting==='asc') arr.sort((a,b)=>a.txt.localeCompare(b.txt));else if (sorting==='desc') arr.sort((a,b)=>b.txt.localeCompare(a.txt));return arr};const bindInput=(input,arr)=>{input.on('input',()=>showList(input,arr));input.on('focus click',function(e){if (e.type==='click' && e.button!==0) return;this.select();showList(input,arr)})};const showList=(input,arr)=>{let val=input.val().toLowerCase();const wrapAttr=input.attr('data-datalist-wrap') || cfg.wrap;if (wrapAttr && val.startsWith(wrapAttr.charAt(0)) && val.endsWith(wrapAttr.charAt(1) || wrapAttr.charAt(0))) val='';popup.empty().show();arr.forEach(o=>{if (!val || o.txt.toLowerCase().includes(val) || o.val.toLowerCase().includes(val)){popup.append(`
${o.txt}
`)}});if (val && popup.children().length===0){if (!arr.some(o=>o.val===input.val())){const newItem={val:input.val(),txt:input.val()};arr.push(newItem);const listId=input.attr('list');const listEl=$(`datalist#${listId}`);if (listEl.length) listEl.append(`
`);const sorting=input.data('datalist-sorting') || cfg.sorting;if (sorting==='asc') arr.sort((a,b)=>a.txt.localeCompare(b.txt));else if (sorting==='desc') arr.sort((a,b)=>b.txt.localeCompare(a.txt));popup.append(`
${newItem.txt}
`)}}const pos=input.offset();popup.css({position:'absolute',top:pos.top + input.outerHeight(),left:pos.left,width:input.outerWidth()}).data('input',input)};popup.on('mousedown','.datalist-item',function(e){e.preventDefault();const val=$(this).data('value');const txt=$(this).data('txt');const input=popup.data('input');const wrap=input.attr('data-datalist-wrap') || cfg.wrap;if (wrap && wrap.length>=1){const left=wrap.charAt(0);const right=wrap.charAt(1) || left;input.val(`${left}${val}${right}`)}else{input.val(val)}popup.hide();cfg.callback(input,val,txt)});const init=input=>{const listId=input.attr('list');const listEl=$(`datalist#${listId}`);if (!listEl.length || input[0].dl_done) return;input[0].dl_done=true;const sorting=input.data('datalist-sorting') || cfg.sorting;const arr=createList(listEl,sorting);bindInput(input,arr);input.on('focus',function(){input.data('datalist-list',input.attr('list')).removeAttr('list')}).on('blur',function(){const list=input.data('datalist-list');if (list) input.attr('list',list)})};$(document).on('focus','[list]',function(){init($(this))}).on('keydown',function(e){if (e.key==='Escape') popup.hide()}).on('mousedown',function(e){if (!popup.is(e.target) && popup.has(e.target).length===0 &&!$(e.target).is('input[list]')) popup.hide()});return this};$(document).on('change input','.date-range',function(){let dateFirst=$(this).find('[type=date]').first(),dateLast=$(this).find('[type=date]').last(),startDate=dateFirst.val(),endDate=dateLast.val();dateLast.attr('min',startDate).val(startDate>endDate ? startDate:endDate);if (endDate &&!startDate) dateFirst.val(endDate)});$.fn.dateSelector=function(options){const set=$.extend({otherDate:{}},options);const pad=n=>String(n).padStart(2,'0');const format=d=>`${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;return this.each(function(){const select=$(this),startSelector=select.data('date-start'),endSelector=select.data('date-end');const updateDates=()=>{const val=parseInt(select.val());const now=new Date();let startDate='',endDate='';const shift=days=>{const d=new Date(now);d.setDate(d.getDate() - days);return d};switch (val){case 1:startDate=endDate=format(now);break;case 2:startDate=endDate=format(shift(1));break;case 3:startDate=endDate=format(shift(2));break;case 4:startDate=format(shift(7));endDate=format(now);break;case 5:startDate=format(shift(14));endDate=format(now);break;case 6:startDate=format(new Date(now.getFullYear(),now.getMonth(),1));endDate=format(now);break;case 7:startDate=format(new Date(now.getFullYear(),now.getMonth() - 1,1));endDate=format(new Date(now.getFullYear(),now.getMonth(),0));break;case 8:return;default:{const valStr=select.val();if (set.otherDate[valStr]){startDate=set.otherDate[valStr][0];endDate=set.otherDate[valStr][1]}}}if (startSelector){const start=$(startSelector);start.off('.dateSelector').on('change.dateSelector input.dateSelector',function(){$(endSelector).attr('min',$(this).val())}).on('click.dateSelector',()=>{if (select.find('option[value="8"]').length) select.val(8)}).val(startDate)}if (endSelector){const end=$(endSelector);end.off('.dateSelector').on('click.dateSelector',()=>{if (select.find('option[value="8"]').length) select.val(8)}).attr('min',startDate).val(endDate)}};select.off('.dateSelector').on('change.dateSelector',updateDates).trigger('change')})};$('select.date-selector').dateSelector();$.fn.grabit=function(){let dragged=null,parent=null,lastPos=null,offsetX=0,offsetY=0,placeHolder=$('