@featherk/composables 0.11.1 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- (function(_,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],t):(_=typeof globalThis<"u"?globalThis:_||self,t(_.FeatherKComposables={},_.Vue,_.useFocusTrap))})(this,(function(_,t,Fe){"use strict";const Re=(e,n)=>{const o=t.ref(null);let v=!1,m=null,g=null;const D=[],$=".k-table-row[data-grid-row-index] [tabindex]",C=()=>{const u=e?.value?.$el;return u?u.closest(".k-grid"):null},R=u=>{const w=C();if(!w)return!1;const p=u.closest(".k-grid-aria-root");if(p)return w.contains(p);const b=u.closest(".k-grid-header, .k-grid-content, .k-grid-content-locked");return b?w.contains(b):!1},S=u=>u.key==="Enter"||u.code==="Enter"||u.code==="NumpadEnter",F=()=>e?.value?.columns,E=u=>{const w=u.key||u.code;([" ","Spacebar","Space"].includes(w)||S(u))&&(u.preventDefault(),u.stopPropagation(),o.value=u.target,u.target.click())},A=u=>{if(!o.value)return;if(u.code==="Escape"){u.stopPropagation(),o.value&&o.value.focus();return}const w=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),p=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(p){if(u.code==="Tab"){const b=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],I=n?.focusableMenuSelectors??b,k=Array.from(p.querySelectorAll(I.join(",")));if(k.length===0)return;const T=k.findIndex(Z=>Z===document.activeElement);let q;T===-1?q=0:u.shiftKey?q=(T-1+k.length)%k.length:q=(T+1)%k.length,u.preventDefault(),u.stopPropagation(),k[q]?.focus()}}else if(u.code==="ArrowUp"||u.code==="ArrowDown"){u.preventDefault(),u.stopPropagation();const b=w.findIndex(k=>k===document.activeElement);let I=b;u.code==="ArrowUp"?I=b>0?b-1:w.length-1:u.code==="ArrowDown"&&(I=b<w.length-1?b+1:0),w[I]?.focus();return}if(u.code==="Tab"){u.preventDefault(),u.stopPropagation();const b=o.value?.parentElement;(u.shiftKey?b?.previousElementSibling:b?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},M=()=>{m=new MutationObserver(u=>{u.forEach(w=>{w.addedNodes.forEach(p=>{if(p.nodeType===Node.ELEMENT_NODE){const b=p;if(b.classList.contains("k-animation-container")){const k=o.value;k&&(k.dataset.featherKSortable==="true"||t.nextTick(()=>{b.querySelectorAll(".k-columnmenu-item-wrapper").forEach(Z=>{Z.textContent?.toLowerCase().includes("sort")&&Z.remove()})})),b.addEventListener("keydown",A),t.nextTick(()=>{const T=()=>{const q=Array.from(b.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(q.length===1)q[0].focus(),q[0].click(),T.attempts=0;else if(q.length>1){T.attempts=0;return}else T.attempts===void 0&&(T.attempts=0),T.attempts++<3&&setTimeout(T,200)};T()})}b.querySelectorAll(".k-animation-container").forEach(k=>{k.addEventListener("keydown",A)})}}),w.removedNodes.forEach(p=>{if(p.nodeType===Node.ELEMENT_NODE){const b=p;b.classList.contains("k-animation-container")&&b.removeEventListener("keydown",A),b.querySelectorAll(".k-animation-container").forEach(k=>{k.removeEventListener("keydown",A)})}})})}),m.observe(document.body,{childList:!0,subtree:!0})},c=u=>{const w=u.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(w)||u.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},s=u=>{if(!u.type||!u)return;const w=u.target;if(!w)return;const p=w.closest(".k-table-row[data-grid-row-index]");if(!R(w))return;const b=["ArrowLeft","ArrowRight"].includes(u.code);if(!(c(w)&&!(p&&b))){if(u.code==="Escape"){const I=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(I){u.preventDefault(),u.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(T=>T.setAttribute("tabindex","-1"))}catch{}I.setAttribute("tabindex","0"),I.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(u.code)){if(w.classList.contains("k-grid-header-menu")&&w.classList.contains("k-grid-column-menu")){o.value=w;return}if(p){if(["ArrowDown","ArrowUp"].includes(u.code)){u.preventDefault(),u.stopPropagation();const I=(T,q)=>{let Z=q==="next"?T.nextElementSibling:T.previousElementSibling;for(;Z;){const ne=Z;try{if(ne.classList.contains("k-table-row"))return ne}catch{}Z=q==="next"?Z.nextElementSibling:Z.previousElementSibling}return null},k=u.code==="ArrowDown"?I(p,"next"):I(p,"previous");k&&(p.setAttribute("tabindex","-1"),k.setAttribute("tabindex","0"),k.focus());return}if(["ArrowLeft","ArrowRight"].includes(u.code)){u.preventDefault(),u.stopPropagation();const I=p.querySelectorAll($);if(I.length===0)return;let k=Array.from(I).findIndex(T=>T===document.activeElement);if(k===-1&&document.activeElement===p){I[0].focus();return}u.code==="ArrowRight"?k=k===I.length-1?0:k+1:u.code==="ArrowLeft"&&(k=k===0?I.length-1:k-1),I[k].focus();return}}}}},i=()=>{t.nextTick(()=>{const u=e.value?.$el;if(!u||typeof u.closest!="function")return;const w=u.closest(".k-grid");w&&w.classList.add("fk-grid")})},h=()=>{if(!g)try{const u=()=>{try{const b=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!b||b.length===0||b.filter(T=>T.getAttribute("tabindex")==="0").length===1)return;const k=b.find(T=>T===document.activeElement||T.contains(document.activeElement));if(b.forEach(T=>T.setAttribute("tabindex","-1")),k){k.setAttribute("tabindex","0");return}b[0].setAttribute("tabindex","0")}catch(b){console.error("ensureSingleTabindex error:",b)}},w=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));w.length>0&&w.forEach((b,I)=>{b.setAttribute("tabindex",I===0?"0":"-1")});const p=e.value.$el.querySelector(".k-table-tbody");p&&(g=new MutationObserver(()=>{u()}),g.observe(p,{childList:!0,subtree:!0}))}catch(u){console.error("Error setting up row navigation:",u)}},L=()=>{t.nextTick(()=>{const w=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");w&&w.forEach(p=>{p.setAttribute("role","button"),p.addEventListener("keydown",E)}),M(),B()})},U=()=>{const w=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");w&&w.forEach(p=>{p.removeEventListener("keydown",E)}),m&&(m.disconnect(),m=null),g&&(g.disconnect(),g=null),D.forEach(p=>p()),D.length=0},B=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((p,b)=>{if(p.dataset.featherKHeaderBound==="true")return;const I=p.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!I)return;const k=F();if(k&&k[b]){const r=k[b].field??"";p.setAttribute("data-feather-k-field",r),p.setAttribute("data-feather-k-filterable",k[b].filterable===!1?"false":"true"),p.setAttribute("data-feather-k-sortable",k[b].sortable===!1?"false":"true")}const T=p.dataset.featherKFilterable!=="false",q=p.dataset.featherKSortable!=="false";I.setAttribute("tabindex","-1"),T||q?p.style.cursor="pointer":p.style.cursor="default",T?(p.setAttribute("tabindex","0"),p.setAttribute("role","button"),p.setAttribute("aria-haspopup","menu")):(p.setAttribute("tabindex","0"),p.setAttribute("role","columnheader"),p.removeAttribute("aria-haspopup"));const Z=r=>{r.target?.closest(".k-column-resizer")||(o.value=p,I.click())},ne=r=>{if(T)o.value=p,r.preventDefault(),r.stopPropagation(),Z(r);else if(q){o.value=p;const y=p.querySelector(".k-link");y&&y.click()}};p.addEventListener("click",ne),D.push(()=>{p.removeEventListener("click",ne)});const oe=r=>{if((S(r)||r.code==="Space")&&(T||q)){if(r.preventDefault(),r.stopPropagation(),o.value=p,o.value.focus(),T)Z(r);else if(q){const y=p.querySelector(".k-link");y&&y.click()}}};p.addEventListener("keydown",oe,!0),D.push(()=>{p.removeEventListener("keydown",oe,!0)}),p.dataset.featherKHeaderBound="true"});const w=document.querySelector(".k-grid-header .k-table-thead");if(w&&w.dataset.featherKHeaderBound!=="true"){const p=b=>{const I=b.target.closest("th");I&&(S(b)||b.code==="Space")&&I.dataset.featherKFilterable==="false"&&I.dataset.featherKSortable==="false"&&(b.preventDefault(),b.stopImmediatePropagation())};w.addEventListener("keydown",p,!0),D.push(()=>{w.removeEventListener("keydown",p,!0)}),w.dataset.featherKHeaderBound="true"}},G=function(u,w){const p=u?.event?.event.target,b=F();if(!p||!b)return;const I=p.classList.contains("k-grid-header-menu"),k=p.classList.contains("k-columnmenu-item"),T=b.find(q=>q.field===u?.event?.field)?.sortable&&!0;if(!I){if(k&&!T){u?.event?.sort?.filter(Z=>Z.field!==u?.event?.field);return}typeof w=="function"&&t.nextTick(()=>{o.value&&o.value.focus(),w(u),t.nextTick(()=>{B()})})}},J=()=>{if(!v)try{i(),h(),L(),v=!0}catch(u){console.error("initA11y failed:",u),U()}};return t.onBeforeUnmount(()=>{U()}),{activeFilterButton:o,handleGridKeyDown:s,handleSortChange:G,initA11y:J}},Ve=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Pe=e=>!!e&&typeof e=="object"&&"field"in e,De=(e,n)=>!e||typeof e!="object"?!1:Ve(e)?e.filters.some(o=>De(o,n)):Pe(e)?e.field===n:!1,$e=e=>n=>e.value?.filters&&e.value.filters.some(o=>De(o,n))?"active":"",Le=["button","a","input","select","textarea",'[role="button"]','[role="checkbox"]','[role="link"]','[role="menuitem"]','[role="option"]',".k-checkbox",".k-button",".k-dropdown",".k-picker",".k-hierarchy-cell",".k-grid-header-menu",".k-column-menu"],Ke=e=>{const{onRowAction:n,gridRef:o,dataItems:v,ignoreSelectors:m=[],shouldIgnoreTarget:g,enableKeyboardAction:D=!0}=e,$=[...Le,...m],C=(c,s)=>{if(!c)return!1;const i=$.join(",");return c.closest&&c.closest(i)?!0:g&&s?g(c,s):!1},R=c=>{const i=c?.closest?.(".k-table-row[data-grid-row-index]")?.getAttribute("data-grid-row-index");if(i==null)return;const h=parseInt(i,10);return Number.isNaN(h)?void 0:h},S=c=>{if(!c||typeof c.clientX!="number")return;const s=typeof window<"u"&&window.scrollX||0,i=typeof window<"u"&&window.scrollY||0,h=typeof window<"u"&&window.screenX||0,L=typeof window<"u"&&window.screenY||0;return{clientX:c.clientX,clientY:c.clientY,pageX:typeof c.pageX=="number"?c.pageX:c.clientX+s,pageY:typeof c.pageY=="number"?c.pageY:c.clientY+i,screenX:typeof c.screenX=="number"?c.screenX:c.clientX+h,screenY:typeof c.screenY=="number"?c.screenY:c.clientY+L}},F=c=>{if(!c||typeof c.getBoundingClientRect!="function")return;const s=c.getBoundingClientRect();if(!s)return;const i=s.left,h=s.bottom,L=typeof window<"u"&&window.scrollX||0,U=typeof window<"u"&&window.scrollY||0;return{clientX:i,clientY:h,pageX:i+L,pageY:h+U,screenX:i,screenY:h}},E=c=>{if(typeof window>"u")return!1;const s=window.getSelection();if(!s||s.isCollapsed||!s.toString().trim())return!1;if(c&&s.anchorNode&&s.focusNode){const i=c.closest(".k-table-row")||c.closest(".k-grid")||c,h=s.anchorNode.nodeType===Node.ELEMENT_NODE?s.anchorNode:s.anchorNode.parentElement,L=s.focusNode.nodeType===Node.ELEMENT_NODE?s.focusNode:s.focusNode.parentElement,U=!!(h&&i.contains(h)),B=!!(L&&i.contains(L));return U||B}return!0};return{handleRowClick:c=>{const s=c?.htmlEvent||c?.event||c?.nativeEvent||(c instanceof Event?c:void 0);if(s&&s.button!==void 0&&s.button!==0)return;const i=s?.target||c?.target;if(i&&C(i,s||c)||E(i))return;const h={dataItem:c.dataItem,rowIndex:c.rowIndex??R(i),field:c.field,event:s||c,triggerType:"click",ctrlKey:!!s?.ctrlKey,shiftKey:!!s?.shiftKey,metaKey:!!s?.metaKey,altKey:!!s?.altKey,coordinates:S(s)??F(i)};n(c.dataItem,h)},handleRowKeyDown:(c,s)=>{if(!D)return;const i=c.key||c.code;if(!(i==="Enter"||i==="NumpadEnter"||i===" "||i==="Space"||c.code==="Enter"||c.code==="NumpadEnter"||c.code==="Space"))return;const L=c.target;if(!L)return;const U=L.closest(".k-table-row[data-grid-row-index], .k-table-row");if(!U||C(L,c))return;c.preventDefault(),c.stopPropagation();const B=U.getAttribute("data-grid-row-index"),G=B!==null?parseInt(B,10):void 0;let J=s;if(J===void 0){const w=(Array.isArray(v)?v:v?.value)||o?.value?.props?.dataItems||o?.value?.dataItems;w&&G!==void 0&&G>=0&&G<w.length&&(J=w[G])}if(J===void 0)return;const u={dataItem:J,rowIndex:G,event:c,triggerType:"keyboard",ctrlKey:!!c.ctrlKey,shiftKey:!!c.shiftKey,metaKey:!!c.metaKey,altKey:!!c.altKey,coordinates:F(U)};n(J,u)},isIgnoredTarget:C}},qe="Enter a valid ZIP code with exactly 5 or 9 digits.",Ee=e=>{const n=e.replace(/\D/g,"").slice(0,9);return n.length>5?`${n.slice(0,5)}-${n.slice(5)}`:n},Ne=(e,n)=>e.slice(0,Math.max(0,n)).replace(/\D/g,"").length,Oe=e=>e<=5?e:Math.min(e+1,10),xe=e=>{const n=t.ref(Ee(e.initialValue??"")),o=t.ref(!1),v=t.ref(e.errorMessage?.trim()||qe),m=t.computed(()=>n.value.replace(/\D/g,"")),g=t.computed(()=>{const A=m.value.length;return A===5||A===9}),D=t.computed(()=>o.value&&!g.value),$=t.computed(()=>!o.value||g.value),C=t.computed(()=>o.value),R=(A,M)=>{const c=Oe(M);t.nextTick(()=>{A.isConnected&&A.setSelectionRange(c,c)})};return{zipDisplay:n,submitted:o,errorMessage:v,wrapperClass:"fk-zip-textbox",zipRaw:m,isZipValid:g,showZipError:D,textBoxValid:$,textBoxValidate:C,handleZipInput:(...A)=>{const M=A[0],s=M?.event?.target,i=M?.value,h=Array.isArray(i)?i.join(""):String(i??""),L=s?.selectionStart!==void 0&&s.selectionStart!==null?Ne(s.value,s.selectionStart):h.replace(/\D/g,"").length;n.value=Ee(h),s&&R(s,L)},submitAndValidate:A=>{o.value=!0;const M=g.value;return!M&&A?.focus&&t.nextTick(()=>{document.getElementById(e.id)?.focus()}),M},buildPayload:()=>({zip:m.value})}};function Ie(e,n){const o=t.ref(!1);t.watchEffect(()=>{e.value?.setAttribute("aria-invalid",String(!n.isValid()))});function v(g){const D=e.value??g.currentTarget,$=g.relatedTarget;(!D||!D.contains($))&&(o.value=!0)}function m(){o.value=!1}return{touched:o,onFocusout:v,reset:m}}function Te(e,n){const o=t.ref(!1),v=t.ref(!1),m=t.computed(()=>t.toValue(n.submitted)||o.value),g=t.computed(()=>!m.value||n.isValid()),D=Ie(e,{isValid:()=>g.value});function $(E){return t.computed(()=>!m.value||t.toValue(E))}function C(E){return Object.fromEntries(Object.entries(E).map(([A,M])=>[A,$(M)]))}function R(E){const A=t.toValue(E);if(!A)return;A.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function S(E){if(v.value){v.value=!1;return}D.onFocusout(E),D.touched.value&&(o.value=!0)}function F(){o.value=!1,v.value=!0,D.reset()}return{touched:o,fieldsetValidate:m,onFocusout:S,reset:F,createFieldValidity:$,createFieldValidationsMap:C,focusFirstInvalidField:R}}const Ue=[{label:"Alabama",value:"AL"},{label:"Alaska",value:"AK"},{label:"Arizona",value:"AZ"},{label:"Arkansas",value:"AR"},{label:"California",value:"CA"},{label:"Colorado",value:"CO"},{label:"Connecticut",value:"CT"},{label:"Delaware",value:"DE"},{label:"Florida",value:"FL"},{label:"Georgia",value:"GA"},{label:"Hawaii",value:"HI"},{label:"Idaho",value:"ID"},{label:"Illinois",value:"IL"},{label:"Indiana",value:"IN"},{label:"Iowa",value:"IA"},{label:"Kansas",value:"KS"},{label:"Kentucky",value:"KY"},{label:"Louisiana",value:"LA"},{label:"Maine",value:"ME"},{label:"Maryland",value:"MD"},{label:"Massachusetts",value:"MA"},{label:"Michigan",value:"MI"},{label:"Minnesota",value:"MN"},{label:"Mississippi",value:"MS"},{label:"Missouri",value:"MO"},{label:"Montana",value:"MT"},{label:"Nebraska",value:"NE"},{label:"Nevada",value:"NV"},{label:"New Hampshire",value:"NH"},{label:"New Jersey",value:"NJ"},{label:"New Mexico",value:"NM"},{label:"New York",value:"NY"},{label:"North Carolina",value:"NC"},{label:"North Dakota",value:"ND"},{label:"Ohio",value:"OH"},{label:"Oklahoma",value:"OK"},{label:"Oregon",value:"OR"},{label:"Pennsylvania",value:"PA"},{label:"Rhode Island",value:"RI"},{label:"South Carolina",value:"SC"},{label:"South Dakota",value:"SD"},{label:"Tennessee",value:"TN"},{label:"Texas",value:"TX"},{label:"Utah",value:"UT"},{label:"Vermont",value:"VT"},{label:"Virginia",value:"VA"},{label:"Washington",value:"WA"},{label:"West Virginia",value:"WV"},{label:"Wisconsin",value:"WI"},{label:"Wyoming",value:"WY"}];function he(e){if(e&&typeof e=="object"&&"value"in e){const n=e.value;return typeof n=="string"?n:String(n??"")}return""}function Be(){const e=t.reactive({address1:"",address2:"",city:"",state:null,zip:""});return{formData:e,onAddress1Input:(...D)=>{e.address1=he(D[0])},onAddress2Input:(...D)=>{e.address2=he(D[0])},onCityInput:(...D)=>{e.city=he(D[0])},onStateChange:D=>{e.state=D.value},resetFormData:()=>{e.address1="",e.address2="",e.city="",e.state=null,e.zip=""}}}function Ye(e,n="zip"){const o=xe({id:n}),{zipDisplay:v,zipRaw:m,isZipValid:g,wrapperClass:D,handleZipInput:$}=o;return t.watch(m,R=>{e.zip=R}),{zipDisplay:v,isZipValid:g,zipWrapperClass:D,onZipInput:$,resetZip:()=>{v.value="",e.zip=""}}}function ze(e){const n=t.computed(()=>e.formData.address1.trim()!==""),o=t.computed(()=>e.formData.city.trim()!==""),v=t.computed(()=>!!e.formData.state),m=t.computed(()=>t.toValue(e.isZipValid)),g=t.computed(()=>n.value&&o.value&&v.value&&m.value);return{strictAddress1Valid:n,strictCityValid:o,strictStateValid:v,strictZipValid:m,strictAddressValid:g}}function He(e){if(!e)return;e.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function Ze(e,n){const o=e??n.currentTarget,v=n.relatedTarget;return!o||!o.contains(v)}function Xe(e){const n=t.ref(t.toValue(e.fieldsetRef));t.watchEffect(()=>{n.value=t.toValue(e.fieldsetRef)});const o=t.ref(!1),v=t.ref(!1),m=t.computed(()=>t.toValue(e.required)??!0),{formData:g,onAddress1Input:D,onAddress2Input:$,onCityInput:C,onStateChange:R,resetFormData:S}=Be(),F=`${e.addressId}-zip`,{zipDisplay:E,isZipValid:A,zipWrapperClass:M,onZipInput:c,resetZip:s}=Ye(g,F),{strictAddress1Valid:i,strictCityValid:h,strictStateValid:L,strictZipValid:U,strictAddressValid:B}=ze({formData:g,isZipValid:A}),G=Te(n,{submitted:o,isValid:()=>B.value}),{touched:J,fieldsetValidate:u,onFocusout:w,reset:p}=G,b=G.createFieldValidationsMap({address1:i,city:h,state:L,zip:U,address:B}),{address1:I,city:k,state:T,zip:q,address:Z}=b,ne=t.computed(()=>m.value?u.value:!1),oe=t.computed(()=>m.value?I.value:!0),r=t.computed(()=>m.value?k.value:!0),y=t.computed(()=>m.value?T.value:!0),P=t.computed(()=>m.value?q.value:!0),Y=t.computed(()=>m.value?Z.value:!0),z={value:null,label:"State"},X=Ue.map(({label:f,value:x})=>({label:f,value:x})),a=t.computed(()=>({address1:g.address1.trim(),address2:g.address2.trim(),city:g.city.trim(),state:(g.state??"").trim().toUpperCase(),zip:g.zip.replace(/\D/g,"")})),d=t.computed(()=>g.address1.trim()===""&&g.address2.trim()===""&&g.city.trim()===""&&(g.state??"").trim()===""&&g.zip.replace(/\D/g,"")===""),V=t.computed(()=>!d.value),N=t.computed(()=>!m.value&&V.value&&(!i.value||!h.value||!L.value)),W=t.computed(()=>{const f=g.zip.replace(/\D/g,"");return!m.value&&V.value&&f.length!==5&&f.length!==9}),Q=t.computed(()=>!m.value&&V.value&&!B.value),O=t.computed(()=>!m.value&&Q.value&&(v.value||o.value));return t.watch(a,()=>{m.value||(v.value=!1)}),t.watch(m,f=>{f||(o.value=!1,v.value=!1,p())}),{formData:g,submitted:o,touched:J,addressValidate:ne,address1Valid:oe,cityValid:r,stateValid:y,zipValid:P,addressValid:Y,optionalFeedbackActive:O,optionalPartialInvalid:Q,optionalMissingRequiredFields:N,optionalZipInvalid:W,stateDefaultItem:z,stateOptions:X,zipDisplay:E,zipWrapperClass:M,onAddress1Input:D,onAddress2Input:$,onCityInput:C,onStateChange:R,onZipInput:c,onFieldsetFocusout:f=>{const x=Ze(n.value,f);w(f),!m.value&&x&&(v.value=!0)},normalizedPayload:a,validateForSubmit:async()=>m.value?(o.value=!0,B.value?{isValid:!0,payload:a.value}:(await t.nextTick(),He(n.value),{isValid:!1,payload:null})):d.value||B.value?(o.value=!1,{isValid:!0,payload:a.value}):(o.value=!0,{isValid:!1,payload:null}),reset:()=>{o.value=!1,v.value=!1,p(),S(),s()}}}const We=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ge=Object.prototype.toString,je=e=>Ge.call(e)==="[object Object]",ge=()=>{};function ve(e){return Array.isArray(e)?e:[e]}function _e(e,n,o){return t.watch(e,n,{...o,immediate:!0})}const Me=We?window:void 0;function pe(e){var n;const o=t.toValue(e);return(n=o?.$el)!==null&&n!==void 0?n:o}function be(...e){const n=(v,m,g,D)=>(v.addEventListener(m,g,D),()=>v.removeEventListener(m,g,D)),o=t.computed(()=>{const v=ve(t.toValue(e[0])).filter(m=>m!=null);return v.every(m=>typeof m!="string")?v:void 0});return _e(()=>{var v,m;return[(v=(m=o.value)===null||m===void 0?void 0:m.map(g=>pe(g)))!==null&&v!==void 0?v:[Me].filter(g=>g!=null),ve(t.toValue(o.value?e[1]:e[0])),ve(t.unref(o.value?e[2]:e[1])),t.toValue(o.value?e[3]:e[2])]},([v,m,g,D],$,C)=>{if(!v?.length||!m?.length||!g?.length)return;const R=je(D)?{...D}:D,S=v.flatMap(F=>m.flatMap(E=>g.map(A=>n(F,E,A,R))));C(()=>{S.forEach(F=>F())})},{flush:"post"})}function Ce(e,n,o={}){const{window:v=Me,ignore:m=[],capture:g=!0,detectIframe:D=!1,controls:$=!1}=o;if(!v)return $?{stop:ge,cancel:ge,trigger:ge}:ge;let C=!0;const R=s=>t.toValue(m).some(i=>{if(typeof i=="string")return Array.from(v.document.querySelectorAll(i)).some(h=>h===s.target||s.composedPath().includes(h));{const h=pe(i);return h&&(s.target===h||s.composedPath().includes(h))}});function S(s){const i=t.toValue(s);return i&&i.$.subTree.shapeFlag===16}function F(s,i){const h=t.toValue(s),L=h.$.subTree&&h.$.subTree.children;return L==null||!Array.isArray(L)?!1:L.some(U=>U.el===i.target||i.composedPath().includes(U.el))}const E=s=>{const i=pe(e);if(s.target!=null&&!(!(i instanceof Element)&&S(e)&&F(e,s))&&!(!i||i===s.target||s.composedPath().includes(i))){if("detail"in s&&s.detail===0&&(C=!R(s)),!C){C=!0;return}n(s)}};let A=!1;const M=[be(v,"click",s=>{A||(A=!0,setTimeout(()=>{A=!1},0),E(s))},{passive:!0,capture:g}),be(v,"pointerdown",s=>{const i=pe(e);C=!R(s)&&!!(i&&!s.composedPath().includes(i))},{passive:!0}),D&&be(v,"blur",s=>{setTimeout(()=>{const i=pe(e);let h=v.document.activeElement;for(;h?.shadowRoot;)h=h.shadowRoot.activeElement;h?.tagName==="IFRAME"&&!i?.contains(v.document.activeElement)&&n(s)},0)},{passive:!0})].filter(Boolean),c=()=>M.forEach(s=>s());return $?{stop:c,cancel:()=>{C=!1},trigger:s=>{C=!0,E(s),C=!1}}:c}const we=e=>{if(e instanceof HTMLElement)return e;const n=e?.$el;return n instanceof HTMLElement?n:null},Je=(e,n)=>n==="row"||!e.matches("tr.k-table-row"),Qe=e=>{const n=t.ref(null),o=e.menuItemSelector??".k-menu-item:not(.k-disabled)",v=e.triggerMode??"button",m=()=>we(e.triggerRef.value),g=()=>e.resolveFocusTarget?.()??we(e.focusTargetRef?.value),D=()=>{const i=g();if(i)return i.focus(),!0;const h=m();return h?.focus(),!!h},$=()=>{we(e.menuRef.value)?.querySelector(o)?.focus()},C=i=>{e.isOpen.value&&(n.value=i,F(!1),e.requestHide())};Ce(e.menuRef,()=>C("outside-click"),{ignore:[e.triggerRef]});let R=null;const S=()=>{R?.removeAttribute("aria-haspopup"),R?.removeAttribute("aria-expanded"),R=null},F=i=>{if(e.manageMenuTriggerAria===!1)return;const h=m();if(!h){R&&(R.isConnected?(R.setAttribute("aria-haspopup","menu"),R.setAttribute("aria-expanded",i?"true":"false")):S());return}if(!Je(h,v)){S();return}R&&R!==h&&S(),h.setAttribute("aria-haspopup","menu"),h.setAttribute("aria-expanded",i?"true":"false"),R=h};t.watch([e.isOpen,e.triggerRef],([i])=>F(i),{immediate:!0,flush:"post"}),t.onUnmounted(S);const E=()=>{if(e.isOpen.value){C("trigger-click");return}e.requestShow(),t.nextTick($)};return{handleMenuSelect:(i,h)=>{C(i.event?.type?.startsWith("key")?"keyboard":"mouse-selection"),h?.(i)},handleActionButtonClick:E,handleActionButtonKeydown:i=>{if(i.key==="Enter"||i.code==="Space"){i.preventDefault(),E();return}if(i.key==="Escape"){if(i.preventDefault(),i.stopPropagation(),e.isOpen.value){C("keyboard");return}D()}},handleActionMenuEscape:i=>{i.preventDefault(),i.stopPropagation(),C("keyboard")},handlePopupClose:()=>{t.nextTick(()=>{n.value==="keyboard"?D():n.value==="mouse-selection"&&m()?.focus(),n.value=null})}}};function et(e){const n=t.ref(""),o=t.ref(void 0),v=t.ref(!!e.debug),m=t.ref(e.dateFormat??"mm/dd/yyyy"),g=t.computed(()=>!!e.required),D=1e3,$=t.ref(!1),C=["ArrowUp","ArrowDown"],R=["ArrowLeft","ArrowRight"],S=t.computed(()=>(n.value??"").replace(/\D/g,"")),F=r=>r<=2?"mm":r<=5?"dd":S.value.length<=10?"yyyy":"mm",E=t.computed(()=>{const r=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),A=t.computed(()=>{const r=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),M=t.computed(()=>{const r=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(4,"0")}),c=r=>{if(S.value.length===0){e.onChange({value:null,event:r});return}if(S.value.length<8){e.onChange({value:null,event:r});return}if((n.value??"").length===10&&S.value.length===8){const[y,P,Y]=n.value.split("/"),z=parseInt(y),X=parseInt(P),a=parseInt(Y);if(B(a,z,X)){const d=L(a,z,X);s(d)?e.onChange({value:d,event:r}):e.onChange({value:null,event:r})}else e.onChange({value:null,event:r})}},s=r=>{const y=e.min??void 0,P=e.max??void 0;return!(y&&r<y||P&&r>P)},i=t.computed(()=>{if((n.value??"").length===10&&S.value.length===8){const[r,y,P]=(n.value??"").split("/"),Y=parseInt(r),z=parseInt(y),X=parseInt(P);if(B(X,Y,z))return L(X,Y,z)}return null}),h=t.computed(()=>(n.value??"").length===10&&S.value.length===8),L=(r,y,P)=>{const Y=new Date(0);return Y.setFullYear(r,y-1,P),Y.setHours(0,0,0,0),Y},U=(r,y)=>L(r,y+1,0).getDate(),B=(r,y,P)=>y>=1&&y<=12&&r>=D&&P>=1&&P<=U(r,y),G=r=>{n.value=r.value;const y=r.event?.target;o.value=y?.selectionStart??0,c(r)},J=r=>{o.value=r.target.selectionStart??0},u=(r,y,P)=>{const Y=y?.selectionStart??o.value??0;o.value=Y;let z=parseInt(E.value),X=parseInt(A.value),a=parseInt(M.value);if(!(S.value.length>=8)||!B(a,z,X)){const H=e.defaultValue??new Date;z=H.getMonth()+1,X=H.getDate(),a=H.getFullYear(),n.value=`${String(z).padStart(2,"0")}/${String(X).padStart(2,"0")}/${String(a)}`;const le=L(a,z,X);e.onChange({value:s(le)?le:null,event:P}),k({useRAF:!0});return}const V=F(Y);if(V==="mm")z=r==="ArrowUp"?z<12?z+1:1:z>1?z-1:12;else if(V==="dd"){const H=new Date(a,z,0).getDate();X=r==="ArrowUp"?X<H?X+1:1:X>1?X-1:H}else V==="yyyy"&&(a=r==="ArrowUp"?a+1:Math.max(1,a-1));n.value=`${String(z).padStart(2,"0")}/${String(X).padStart(2,"0")}/${String(a)}`;const[N,W,Q]=n.value.split("/"),O=L(parseInt(Q),parseInt(N),parseInt(W));O.toString()!=="Invalid Date"&&parseInt(Q)>=1e3?e.onChange({value:s(O)?O:null,event:P}):e.onChange({value:null,event:P}),k({useRAF:!0})},w=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(C.includes(r.key)){if(r.altKey)return;r.preventDefault(),r.stopPropagation();const y=r.target;u(r.key,y,r);return}},p=r=>{r.preventDefault();const y=r.deltaY<0?"ArrowUp":"ArrowDown";u(y,r.target,r)},b=r=>{const y=r.target;if(R.includes(r.key)){o.value=y?.selectionStart??0;return}if(C.includes(r.key)){if(r.altKey)return;o.value=y?.selectionStart??0}},I=r=>{$.value=!0,g.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&S.value.length===0&&(e.externalValue.value="");const y=r.target;y&&(o.value=y.selectionStart??0)},k=r=>{const y=()=>{const P=document.getElementById(e.id);if(!P)return;const Y=r?.pos??o.value??P.value.length;try{P.focus(),P.setSelectionRange(Y,Y)}catch{}};t.nextTick(()=>{if(r?.delay&&r.delay>0){setTimeout(y,r.delay);return}if(r?.useRAF){requestAnimationFrame(y);return}y()})};e.externalValue&&t.watch(e.externalValue,r=>{if(r){const y=new Date(r);if(y.toString()!=="Invalid Date"){const P=(y.getMonth()+1).toString().padStart(2,"0"),Y=y.getDate().toString().padStart(2,"0"),z=y.getFullYear().toString();n.value=`${P}/${Y}/${z}`,k({delay:50});return}}},{immediate:!0});const T=t.computed(()=>[["Date",`${E.value} / ${A.value} / ${M.value}`],["Digits only",S.value],["min",e.min?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null],["max",e.max?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null]]),q=t.computed(()=>{if(!g.value){if(!h.value)return!0;const y=i.value;return y?s(y):!1}if(!$.value)return!0;const r=i.value;return!h.value||!r?!1:s(r)}),Z=t.computed(()=>{if(!g.value){if(!h.value)return;const y=i.value;return y?s(y)?"valid":"out-of-bounds":"invalid-date"}if(!$.value)return;if(S.value.length===0||!h.value)return"incomplete";const r=i.value;return r?s(r)?"valid":"out-of-bounds":"invalid-date"}),ne=t.computed(()=>{const r=Z.value;if(!r||r==="valid")return"";if(r==="incomplete")return"Required";if(r==="invalid-date")return`Must be in ${m.value} format.`;const y=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,P=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(r==="out-of-bounds"){if(y&&P)return`Must be between ${y} and ${P}.`;if(y)return`Must be on or after ${y}.`;if(P)return`Must be on or before ${P}.`}return""}),oe=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`ID (#${e.id}) not found for styling.`);return}const y=r.closest(".k-datepicker");if(!y){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const P=y.parentElement;if(P){if(P.classList.contains("fk-datepicker"))return;P.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{oe()}),{raw:n,cursorPos:o,debugEnabled:v,debugLines:T,placeholder:m,isValid:q,reason:t.readonly(Z),validationMessage:ne,digitsOnly:S,month:t.readonly(E),day:t.readonly(A),year:t.readonly(M),datePart:F,handleChange:G,handleKeyDown:w,handleWheel:p,handleKeyUp:b,handleClick:J,handleBlur:I,initStyling:oe}}function tt(e){const n=t.ref(""),o=t.ref(void 0),v=t.ref(!!e.debug),m=t.ref(!1),g=1440*60*1e3,D=365*g,$=new Date,C=new Date($.getTime()-D),R=new Date($.getTime()+D);e.min=e.min??C,e.max=e.max??R;const S=t.computed(()=>(n.value??"").replace(/\D/g,"")),F=(l,f)=>new Date(l,f,0).getDate(),E=(l,f,x)=>f>=1&&f<=12&&l>=1e3&&x>=1&&x<=F(l,f),A=l=>Date.UTC(l.getFullYear(),l.getMonth(),l.getDate()),M=l=>{if(!l)return null;const f=e.min??new Date(Date.now()-90*g),x=e.max??new Date,K=A(l);return K<A(f)||K>A(x)?null:l},c=(l,f)=>e.allowReverse??!1?!0:l<=f,s=t.computed(()=>(n.value?.length??0)>=23&&S.value.length>=16),i=l=>{if((l??"").length<23||S.value.length<16)return{start:null,end:null};const f=l.substring(0,10),x=l.substring(13,23),[K,ee,te]=f.split("/").map(ue=>parseInt(ue||"0",10)),[se,ce,de]=x.split("/").map(ue=>parseInt(ue||"0",10)),fe=new Date(te,K-1,ee),me=new Date(de,se-1,ce),ke=E(te,K,ee)&&fe.toString()!=="Invalid Date",Se=E(de,se,ce)&&me.toString()!=="Invalid Date";return{start:ke?fe:null,end:Se?me:null}},h=e.externalValid??t.ref(!0),L=t.computed(()=>i(n.value)),U=t.computed(()=>{const l=M(L.value.start),f=M(L.value.end);return{start:l,end:f}}),B=t.computed(()=>{if(!s.value)return;const l=U.value.start,f=U.value.end;if(!l||!f)return;const x=Math.abs(A(f)-A(l));return Math.round(x/864e5+1)}),G=t.ref(!1),J=t.computed(()=>{if(!G.value)return;const{start:l,end:f}=L.value;if(!s.value)return"incomplete";if(!l||!f)return"invalid-date";if(!U.value.start||!U.value.end)return"out-of-bounds";const x=U.value.start,K=U.value.end;return c(x,K)?typeof e.maxSpanDays=="number"&&B.value!==void 0&&B.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),u=t.computed(()=>{const l=J.value;return l===void 0||l==="valid"}),w=t.computed(()=>{const{min:l,max:f}=e,x=J.value;if(!x)return"";switch(x){case"incomplete":return"Required";case"invalid-date":return"One or both dates invalid.";case"reversed-range":return"End Date must be on or after Start Date.";case"out-of-bounds":return l&&f?`Dates must be between ${k(l)} and ${k(f)}.`:"Dates must be within the allowed range.";case"span-exceeds-limit":return typeof e.maxSpanDays=="number"?`Date range exceeds ${e.maxSpanDays} days.`:"Date range exceeds maximum allowed span.";default:return""}}),p=["ArrowUp","ArrowDown"],b=["ArrowLeft","ArrowRight"],I=(l,f)=>String(l).padStart(f,"0"),k=l=>`${I(l.getMonth()+1,2)}/${I(l.getDate(),2)}/${I(l.getFullYear(),4)}`,T=l=>l<=2?{side:"start",part:"mm"}:l<=5?{side:"start",part:(l<=3,"dd")}:l<=11?{side:"start",part:"yyyy"}:l<=15?{side:"end",part:"mm"}:l<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},q=(l,f,x)=>{const K=f?.selectionStart??o.value??0;o.value=K;const{start:ee,end:te}=i(n.value);if(!ee&&!te){const j=new Date,ie=k(j);n.value=`${ie} - ${ie}`,e.onChange({value:{start:j,end:j},event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const ae=document.getElementById(e.id),re=o.value??0;ae&&(ae.focus(),ae.setSelectionRange(re,re))})});return}const se=new Date,ce=T(K);let de=ee?new Date(ee):new Date(se),fe=te?new Date(te):new Date(se);const me=(j,ie)=>{if(ie==="mm"){const ae=j.getMonth()+1,re=l==="ArrowUp"?ae<12?ae+1:1:ae>1?ae-1:12;j.setMonth(re-1);const ye=F(j.getFullYear(),re);j.getDate()>ye&&j.setDate(ye)}else if(ie==="dd"){const ae=F(j.getFullYear(),j.getMonth()+1),re=j.getDate(),ye=l==="ArrowUp"?re<ae?re+1:1:re>1?re-1:ae;j.setDate(ye)}else if(ie==="yyyy"){const ae=j.getFullYear();j.setFullYear(l==="ArrowUp"?ae+1:Math.max(1,ae-1));const re=F(j.getFullYear(),j.getMonth()+1);j.getDate()>re&&j.setDate(re)}};ce.side==="start"?me(de,ce.part):me(fe,ce.part);const ke=k(de),Se=k(fe);n.value=`${ke} - ${Se}`;const ue=M(de),Ae=M(fe);ue&&Ae&&c(ue,Ae)?e.onChange({value:{start:ue,end:Ae},event:x}):e.onChange({value:null,event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const j=document.getElementById(e.id),ie=o.value??0;j&&(j.focus(),j.setSelectionRange(ie,ie))})})},Z=l=>{const{start:f,end:x}=i(n.value);if(!f||!x){e.onChange({value:null,event:l});return}const K=M(f),ee=M(x);if(!K||!ee){e.onChange({value:null,event:l});return}if(!c(K,ee)){e.onChange({value:null,event:l});return}e.onChange({value:{start:K,end:ee},event:l})},ne=l=>{const f=l.value??"",x=l.event;if(!f&&x&&x.type==="click"){X(x);return}n.value=f;const K=x?.target;o.value=K?.selectionStart??0,Z(l)},oe=l=>{o.value=l.target.selectionStart??0},r=l=>{if(l.code==="Space"||l.key===" "){l.preventDefault(),l.stopPropagation(),e.onShowCalendar(l);return}if(l.key==="ArrowDown"&&l.altKey){l.preventDefault(),l.stopPropagation(),e.onShowCalendar(l);return}if(p.includes(l.key)){l.preventDefault(),l.stopPropagation();const f=l.target;q(l.key,f,l);return}},y=l=>{l.preventDefault();const f=l.deltaY<0?"ArrowUp":"ArrowDown";q(f,l.target,l)},P=l=>{if(b.includes(l.key)||p.includes(l.key)){const f=l.target;o.value=f?.selectionStart??0}},Y=()=>{G.value=!0,(e.manageValid??!0)&&(h.value=u.value)},z=l=>{Y()},X=l=>{n.value="",o.value=0,e.onChange({value:null,event:l}),Y(),t.nextTick(()=>{const f=document.getElementById(e.id);f&&(f.focus(),f.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,l=>{const f=l?.start??null,x=l?.end??null;if(f&&x){if(n.value=`${k(f)} - ${k(x)}`,e.isOpen?.value&&m.value&&e.onRequestClose){const K=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),m.value=!1,Y()},K)}return}},{immediate:!0});const a=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),d=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),V=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),N=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),W=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),Q=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),O=t.computed(()=>{const{start:l,end:f}=i(n.value);return[{label:"Raw",value:n.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(a.value).padStart(2,"0")} / ${String(d.value).padStart(2,"0")} / ${String(V.value).padStart(4,"0")}`},{label:"End",value:`${String(N.value).padStart(2,"0")} / ${String(W.value).padStart(2,"0")} / ${String(Q.value).padStart(4,"0")}`},{label:"Digits only",value:S.value},{label:"Mask complete",value:`${s.value}`},{label:"Parsed",value:`${l?l.toDateString():"-"} | ${f?f.toDateString():"-"}`},{label:"Valid (managed)",value:`${h.value??"-"}`},{label:"Span (days)",value:`${B.value??"-"}`},{label:"Reason",value:`${J.value??"-"}`},{label:"Cursor in",value:`${o.value??"-"} (${(()=>{const x=o.value??0,K=T(x);return`${K.side}.${K.part}`})()})`}]}),H=()=>{t.nextTick(()=>{const l=document.getElementById(e.id);if(!l){console.warn(`#${e.id} not found for styling.`);return}const f=l.closest("div");if(!f){console.warn(`Parent div of #${e.id} not found for styling.`);return}f.classList.contains("fk-daterangepicker")||f.classList.add("fk-daterangepicker")})};t.onMounted(()=>{H()});const le=()=>{t.nextTick(()=>{try{const l=Array.from(document.querySelectorAll(".k-animation-container"));if(!l.length)return;const x=[...l].reverse().find(te=>te.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!x)return;const K=x.querySelectorAll(".k-calendar-table");let ee=!1;K.forEach(te=>{te.tabIndex===0&&(ee?te.tabIndex=-1:ee=!0)})}catch(l){console.warn(l)}})};return e.isOpen&&t.watch(e.isOpen,l=>{l&&setTimeout(()=>le(),0)},{immediate:!1}),{raw:n,cursorPos:o,debugEnabled:v,debugLines:O,digitsOnly:S,valid:h,validComputed:t.readonly(u),reason:t.readonly(J),validationMessage:t.readonly(w),spanDays:t.readonly(B),month1:t.readonly(a),day1:t.readonly(d),year1:t.readonly(V),month2:t.readonly(N),day2:t.readonly(W),year2:t.readonly(Q),handleChange:ne,handleKeyDown:r,handleWheel:y,handleKeyUp:P,handleClick:oe,handleBlur:z,handleClear:X,onCalendarChange:()=>{m.value=!0},initStyling:H}}function nt(e){const n=t.ref(""),o=t.ref(void 0),v=t.ref(!!e.debug),m=t.ref(e.timeFormat??"hh:mm AM"),g=t.computed(()=>!!e.required),D=t.ref(!1),$=["ArrowUp","ArrowDown"],C=["ArrowLeft","ArrowRight"],R=t.computed(()=>(n.value??"").replace(/\D/g,"")),S={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},F=a=>a<=2?"hh":a<=5?"mm":"ampm",E=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",d=parseInt(a);return Math.min(Math.max(d,0),23)}),A=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",d=parseInt(a);return Math.min(Math.max(d,0),59)}),M=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),c=t.computed(()=>{const a=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),d=M.value;return a===12?d==="AM"?0:12:d==="PM"?a+12:a}),s=t.computed(()=>i.value?`${String(c.value).padStart(2,"0")}:${String(A.value).padStart(2,"0")}:00`:null),i=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),h=(a,d,V)=>{let N=a%12;return N===0&&(N=12),`${String(N).padStart(2,"0")}:${String(d).padStart(2,"0")} ${V}`},L=a=>{const d=a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!d)return null;const V=parseInt(d[1]),N=parseInt(d[2]),W=d[3].toUpperCase();if(V<1||V>12||N<0||N>59)return null;let Q=V%12;W==="PM"&&(Q+=12);const O=new Date;return O.setSeconds(0,0),O.setHours(Q),O.setMinutes(N),O},U=a=>{if(R.value.length===0){e.onChange({value:null,event:a});return}if(!i.value){e.onChange({value:null,event:a});return}const d=L(n.value);d&&G(d)?e.onChange({value:d,event:a}):e.onChange({value:null,event:a})},B=a=>a.getHours()*60+a.getMinutes(),G=a=>{const d=e.min??void 0,V=e.max??void 0,N=B(a);if(d){const W=B(d);if(N<W)return!1}if(V){const W=B(V);if(N>W)return!1}return!0},J=a=>{const d=a.getHours(),V=d>=12?"PM":"AM";n.value=h(d,a.getMinutes(),V)},u=(a,d)=>{e.onChange({value:a,event:d})},w=()=>{t.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const a=document.getElementById(e.id);if(a){a.focus();const d=(a.value??"").length;a.setSelectionRange(d,d)}})})})},p=a=>{const d=a?.event?.target;return d?d.closest(".k-time-now")?"now":d.closest(".k-time-accept")?"set":null:null},b=(a,d)=>{a&&G(a)?u(a,d):u(null,d)},I=(...a)=>{const d=a[0];if(!d)return;const V=p(d);if(V==="now"){const W=new Date;J(W),b(W,d),w();return}if(d?.value instanceof Date){const W=new Date(d.value);J(W),b(W,d),V==="set"&&w();return}if(d?.value===null){n.value="",u(null,d);return}n.value=d.value;const N=d.event?.target;o.value=N?.selectionStart??0;try{const W=o.value??0;if(F(W)==="ampm"&&(n.value??"").length>=8){const Q=n.value.charAt(6);/[Aa]/.test(Q)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const O=document.getElementById(e.id);O&&(O.focus(),O.setSelectionRange(8,8))})})):/[Pp]/.test(Q)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const O=document.getElementById(e.id);O&&(O.focus(),O.setSelectionRange(8,8))})}))}}catch{}U(d)},k=a=>{o.value=a.target.selectionStart??0},T=(a,d,V)=>{const N=d?.selectionStart??o.value??0;o.value=N;const W=F(N),Q=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!Q){if((n.value??"").length===0||R.value.length===0){const f=new Date,x=f.getHours(),K=x>=12?"PM":"AM";n.value=h(x,f.getMinutes(),K);const ee=L(n.value);b(ee,V),t.nextTick(()=>{requestAnimationFrame(()=>{const te=document.getElementById(e.id),se=o.value??0;te&&(te.focus(),te.setSelectionRange(se,se))})})}return}let O=parseInt(Q[1]),H=parseInt(Q[2]),le=Q[3].toUpperCase();if(W==="hh")a==="ArrowUp"?O=O<12?O+1:1:O=O>1?O-1:12;else if(W==="mm"){const f=e.minuteStepRef?.value??e.minuteStep??1;if(f===1)a==="ArrowUp"?H=H<59?H+1:0:H=H>0?H-1:59;else if(a==="ArrowUp"){const x=H%f;let K=x===0?H+f:H+(f-x);K>=60&&(K=0),H=K}else{const x=H%f;let K=x===0?H-f:H-x;K<0&&(K=60-f),H=K}}else W==="ampm"&&(le=le==="AM"?"PM":"AM");n.value=`${String(O).padStart(2,"0")}:${String(H).padStart(2,"0")} ${le}`;const l=L(n.value);b(l,V),t.nextTick(()=>{requestAnimationFrame(()=>{const f=document.getElementById(e.id),x=o.value??0;f&&(f.focus(),f.setSelectionRange(x,x))})})},q=a=>{if(a.code==="Space"||a.key===" "){a.preventDefault(),a.stopPropagation(),e.onShowPicker(a);return}if(a.key==="ArrowDown"&&a.altKey){a.preventDefault(),a.stopPropagation(),e.onShowPicker(a);return}if($.includes(a.key)){if(a.altKey)return;a.preventDefault(),a.stopPropagation();const d=a.target;T(a.key,d,a);return}},Z=a=>{a.preventDefault();const d=a.deltaY<0?"ArrowUp":"ArrowDown";T(d,a.target,a)},ne=a=>{const d=a.target;if(C.includes(a.key)){o.value=d?.selectionStart??0;return}if($.includes(a.key)){if(a.altKey)return;o.value=d?.selectionStart??0}},oe=a=>{D.value=!0,g.value&&e.externalValue&&e.externalValue.value===void 0&&R.value.length===0&&(e.externalValue.value="");const d=a.target;d&&(o.value=d.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const d=new Date(a);if(d.toString()!=="Invalid Date"){const V=d.getHours(),N=V>=12?"PM":"AM";n.value=h(V,d.getMinutes(),N);return}}},{immediate:!0});const r=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",E.value],["Hour (24h)",c.value],["Minute",A.value],["Period",M.value],["Time (24h)",s.value??"--:--:--"],["Digits only",R.value],["Parsed Date",y.value?.toLocaleDateString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["min",e.min?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["max",e.max?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["valid",P.value],["reason",Y.value],["validationMessage",z.value]]),y=t.computed(()=>L(n.value)??null),P=t.computed(()=>{if(!g.value){if(!i.value)return!0;const d=y.value;return d?G(d):!1}if(!D.value)return!0;const a=y.value;return!i.value||!a?!1:G(a)}),Y=t.computed(()=>{if(!g.value){if(!i.value)return;const d=y.value;return d?G(d)?"valid":"out-of-bounds":"invalid-time"}if(!D.value)return;if(R.value.length===0||!i.value)return"incomplete";const a=y.value;return a?G(a)?"valid":"out-of-bounds":"invalid-time"}),z=t.computed(()=>{const a=Y.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-time")return`Must be in ${m.value} format.`;const d={hour:"2-digit",minute:"2-digit"},V=e.min?e.min.toLocaleTimeString("en-US",d):null,N=e.max?e.max.toLocaleTimeString("en-US",d):null;if(a==="out-of-bounds"){if(V&&N)return`Must be between ${V} and ${N}.`;if(V)return`Must be ${V} or later.`;if(N)return`Must be ${N} or earlier.`}return""}),X=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`#${e.id} not found for styling.`);return}const d=a.closest(".k-timepicker");if(!d){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const V=d.parentElement;if(!V){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}V.classList.contains("fk-timepicker")||V.classList.add("fk-timepicker")})};return t.onMounted(()=>{X()}),{raw:n,rules:S,debugEnabled:v,debugLines:r,placeholder:m,isValid:P,reason:t.readonly(Y),validationMessage:z,isComplete:i,inRangeTime:G,cursorPos:o,hour:t.readonly(E),hour24:t.readonly(c),minute:t.readonly(A),period:t.readonly(M),time24:t.readonly(s),parsedRawTime:t.readonly(y),handleChange:I,handleKeyDown:q,handleKeyUp:ne,handleClick:k,handleWheel:Z,handleBlur:oe,initStyling:X}}function at(e){const n=t.shallowRef(null),o=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],v=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??o].flat(),m=S=>S?typeof e.initialFocus=="string"?S.querySelector(e.initialFocus)??S:typeof e.initialFocus=="function"?e.initialFocus(S)??S:S.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??S:null,{activate:g,deactivate:D}=Fe.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>m(n.value),...e.focusTrapOptions??{}});let $=null,C=t.ref(null);const R=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const S=(E,A)=>{const M=Array.from(E.querySelectorAll(A));if(!M.length)return null;const c=M.filter(s=>s.offsetParent!==null||s.getClientRects().length>0);return c[c.length-1]??M[M.length-1]??null},F=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const E of v){const A=S(F,E);if(A)return A}for(const E of v){const A=S(document,E);if(A)return A}return null};return Ce(n,S=>{C.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",S)}),t.watch(()=>e.isOpen.value,S=>{S?(C.value=null,t.nextTick(()=>{const F=R();F&&(n.value=F,setTimeout(()=>g(),0),$||($=E=>{E.key==="Escape"&&(C.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",E))},document.addEventListener("keydown",$,!0)))})):(D(),$&&(document.removeEventListener("keydown",$,!0),$=null),n.value=null,C.value==="outside"&&t.nextTick(()=>{const F=()=>{const E=e.triggerEl?.value,A=E?.querySelector("input"),M=document.activeElement;M&&(M===A||E&&E.contains(M))&&(A??E)?.blur?.()};requestAnimationFrame(()=>setTimeout(F,0))}),e.returnFocusToTrigger!==!1&&C.value==="escape"&&e.triggerEl?.value&&t.nextTick(()=>{const F=()=>{const E=e.triggerEl?.value;if(!E)return;(E.querySelector("input")??E)?.focus?.()};requestAnimationFrame(()=>setTimeout(F,0))}))}),{popupRef:n,activate:g,deactivate:D,lastCloseReason:t.readonly(C),setPopupEl:S=>n.value=S}}_.useFieldsetTouchTracker=Ie,_.useFieldsetValidationKit=Te,_.useGridA11y=Re,_.useGridActiveFilter=$e,_.useGridRowAction=Ke,_.useMaskedDateInput=et,_.useMaskedDateRangeInput=tt,_.useMaskedTimeInput=nt,_.usePopupMenu=Qe,_.usePopupTrap=at,_.useUSAddress=Xe,_.useZipTextBox=xe,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(_,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],t):(_=typeof globalThis<"u"?globalThis:_||self,t(_.FeatherKComposables={},_.Vue,_.useFocusTrap))})(this,(function(_,t,Re){"use strict";const Fe=(e,n)=>{const o=t.ref(null);let h=!1,p=null,g=null;const A=[],I=".k-table-row[data-grid-row-index] [tabindex]",T=()=>{const u=e?.value?.$el;return u?u.closest(".k-grid"):null},F=u=>{const w=T();if(!w)return!1;const m=u.closest(".k-grid-aria-root");if(m)return w.contains(m);const b=u.closest(".k-grid-header, .k-grid-content, .k-grid-content-locked");return b?w.contains(b):!1},D=u=>u.key==="Enter"||u.code==="Enter"||u.code==="NumpadEnter",$=()=>e?.value?.columns,E=u=>{const w=u.key||u.code;([" ","Spacebar","Space"].includes(w)||D(u))&&(u.preventDefault(),u.stopPropagation(),o.value=u.target,u.target.click())},S=u=>{if(!o.value)return;if(u.code==="Escape"){u.stopPropagation(),o.value&&o.value.focus();return}const w=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),m=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(m){if(u.code==="Tab"){const b=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],M=n?.focusableMenuSelectors??b,k=Array.from(m.querySelectorAll(M.join(",")));if(k.length===0)return;const C=k.findIndex(Z=>Z===document.activeElement);let N;C===-1?N=0:u.shiftKey?N=(C-1+k.length)%k.length:N=(C+1)%k.length,u.preventDefault(),u.stopPropagation(),k[N]?.focus()}}else if(u.code==="ArrowUp"||u.code==="ArrowDown"){u.preventDefault(),u.stopPropagation();const b=w.findIndex(k=>k===document.activeElement);let M=b;u.code==="ArrowUp"?M=b>0?b-1:w.length-1:u.code==="ArrowDown"&&(M=b<w.length-1?b+1:0),w[M]?.focus();return}if(u.code==="Tab"){u.preventDefault(),u.stopPropagation();const b=o.value?.parentElement;(u.shiftKey?b?.previousElementSibling:b?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},R=()=>{p=new MutationObserver(u=>{u.forEach(w=>{w.addedNodes.forEach(m=>{if(m.nodeType===Node.ELEMENT_NODE){const b=m;if(b.classList.contains("k-animation-container")){const k=o.value;k&&(k.dataset.featherKSortable==="true"||t.nextTick(()=>{b.querySelectorAll(".k-columnmenu-item-wrapper").forEach(Z=>{Z.textContent?.toLowerCase().includes("sort")&&Z.remove()})})),b.addEventListener("keydown",S),t.nextTick(()=>{const C=()=>{const N=Array.from(b.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(N.length===1)N[0].focus(),N[0].click(),C.attempts=0;else if(N.length>1){C.attempts=0;return}else C.attempts===void 0&&(C.attempts=0),C.attempts++<3&&setTimeout(C,200)};C()})}b.querySelectorAll(".k-animation-container").forEach(k=>{k.addEventListener("keydown",S)})}}),w.removedNodes.forEach(m=>{if(m.nodeType===Node.ELEMENT_NODE){const b=m;b.classList.contains("k-animation-container")&&b.removeEventListener("keydown",S),b.querySelectorAll(".k-animation-container").forEach(k=>{k.removeEventListener("keydown",S)})}})})}),p.observe(document.body,{childList:!0,subtree:!0})},c=u=>{const w=u.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(w)||u.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},s=u=>{if(!u.type||!u)return;const w=u.target;if(!w)return;const m=w.closest(".k-table-row[data-grid-row-index]");if(!F(w))return;const b=["ArrowLeft","ArrowRight"].includes(u.code);if(!(c(w)&&!(m&&b))){if(u.code==="Escape"){const M=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(M){u.preventDefault(),u.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(C=>C.setAttribute("tabindex","-1"))}catch{}M.setAttribute("tabindex","0"),M.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(u.code)){if(w.classList.contains("k-grid-header-menu")&&w.classList.contains("k-grid-column-menu")){o.value=w;return}if(m){if(["ArrowDown","ArrowUp"].includes(u.code)){u.preventDefault(),u.stopPropagation();const M=(C,N)=>{let Z=N==="next"?C.nextElementSibling:C.previousElementSibling;for(;Z;){const ne=Z;try{if(ne.classList.contains("k-table-row"))return ne}catch{}Z=N==="next"?Z.nextElementSibling:Z.previousElementSibling}return null},k=u.code==="ArrowDown"?M(m,"next"):M(m,"previous");k&&(m.setAttribute("tabindex","-1"),k.setAttribute("tabindex","0"),k.focus());return}if(["ArrowLeft","ArrowRight"].includes(u.code)){u.preventDefault(),u.stopPropagation();const M=m.querySelectorAll(I);if(M.length===0)return;let k=Array.from(M).findIndex(C=>C===document.activeElement);if(k===-1&&document.activeElement===m){M[0].focus();return}u.code==="ArrowRight"?k=k===M.length-1?0:k+1:u.code==="ArrowLeft"&&(k=k===0?M.length-1:k-1),M[k].focus();return}}}}},i=()=>{t.nextTick(()=>{const u=e.value?.$el;if(!u||typeof u.closest!="function")return;const w=u.closest(".k-grid");w&&w.classList.add("fk-grid")})},v=()=>{if(!g)try{const u=()=>{try{const b=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!b||b.length===0||b.filter(C=>C.getAttribute("tabindex")==="0").length===1)return;const k=b.find(C=>C===document.activeElement||C.contains(document.activeElement));if(b.forEach(C=>C.setAttribute("tabindex","-1")),k){k.setAttribute("tabindex","0");return}b[0].setAttribute("tabindex","0")}catch(b){console.error("ensureSingleTabindex error:",b)}},w=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));w.length>0&&w.forEach((b,M)=>{b.setAttribute("tabindex",M===0?"0":"-1")});const m=e.value.$el.querySelector(".k-table-tbody");m&&(g=new MutationObserver(()=>{u()}),g.observe(m,{childList:!0,subtree:!0}))}catch(u){console.error("Error setting up row navigation:",u)}},L=()=>{t.nextTick(()=>{const w=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");w&&w.forEach(m=>{m.setAttribute("role","button"),m.addEventListener("keydown",E)}),R(),B()})},U=()=>{const w=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");w&&w.forEach(m=>{m.removeEventListener("keydown",E)}),p&&(p.disconnect(),p=null),g&&(g.disconnect(),g=null),A.forEach(m=>m()),A.length=0},B=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((m,b)=>{if(m.dataset.featherKHeaderBound==="true")return;const M=m.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!M)return;const k=$();if(k&&k[b]){const r=k[b].field??"";m.setAttribute("data-feather-k-field",r),m.setAttribute("data-feather-k-filterable",k[b].filterable===!1?"false":"true"),m.setAttribute("data-feather-k-sortable",k[b].sortable===!1?"false":"true")}const C=m.dataset.featherKFilterable!=="false",N=m.dataset.featherKSortable!=="false";M.setAttribute("tabindex","-1"),C||N?m.style.cursor="pointer":m.style.cursor="default",C?(m.setAttribute("tabindex","0"),m.setAttribute("role","button"),m.setAttribute("aria-haspopup","menu")):(m.setAttribute("tabindex","0"),m.setAttribute("role","columnheader"),m.removeAttribute("aria-haspopup"));const Z=r=>{r.target?.closest(".k-column-resizer")||(o.value=m,M.click())},ne=r=>{if(C)o.value=m,r.preventDefault(),r.stopPropagation(),Z(r);else if(N){o.value=m;const y=m.querySelector(".k-link");y&&y.click()}};m.addEventListener("click",ne),A.push(()=>{m.removeEventListener("click",ne)});const oe=r=>{if((D(r)||r.code==="Space")&&(C||N)){if(r.preventDefault(),r.stopPropagation(),o.value=m,o.value.focus(),C)Z(r);else if(N){const y=m.querySelector(".k-link");y&&y.click()}}};m.addEventListener("keydown",oe,!0),A.push(()=>{m.removeEventListener("keydown",oe,!0)}),m.dataset.featherKHeaderBound="true"});const w=document.querySelector(".k-grid-header .k-table-thead");if(w&&w.dataset.featherKHeaderBound!=="true"){const m=b=>{const M=b.target.closest("th");M&&(D(b)||b.code==="Space")&&M.dataset.featherKFilterable==="false"&&M.dataset.featherKSortable==="false"&&(b.preventDefault(),b.stopImmediatePropagation())};w.addEventListener("keydown",m,!0),A.push(()=>{w.removeEventListener("keydown",m,!0)}),w.dataset.featherKHeaderBound="true"}},G=function(u,w){const m=u?.event?.event.target,b=$();if(!m||!b)return;const M=m.classList.contains("k-grid-header-menu"),k=m.classList.contains("k-columnmenu-item"),C=b.find(N=>N.field===u?.event?.field)?.sortable&&!0;if(!M){if(k&&!C){u?.event?.sort?.filter(Z=>Z.field!==u?.event?.field);return}typeof w=="function"&&t.nextTick(()=>{o.value&&o.value.focus(),w(u),t.nextTick(()=>{B()})})}},J=()=>{if(!h)try{i(),v(),L(),h=!0}catch(u){console.error("initA11y failed:",u),U()}};return t.onBeforeUnmount(()=>{U()}),{activeFilterButton:o,handleGridKeyDown:s,handleSortChange:G,initA11y:J}},$e=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Ve=e=>!!e&&typeof e=="object"&&"field"in e,De=(e,n)=>!e||typeof e!="object"?!1:$e(e)?e.filters.some(o=>De(o,n)):Ve(e)?e.field===n:!1,Pe=e=>n=>e.value?.filters&&e.value.filters.some(o=>De(o,n))?"active":"",Le=["button","a","input","select","textarea",'[role="button"]','[role="checkbox"]','[role="link"]','[role="menuitem"]','[role="option"]',".k-checkbox",".k-button",".k-dropdown",".k-picker",".k-hierarchy-cell",".k-grid-header-menu",".k-column-menu"],Ke=e=>{const{onRowAction:n,gridRef:o,dataItems:h,ignoreSelectors:p=[],shouldIgnoreTarget:g,enableKeyboardAction:A=!0}=e,I=[...Le,...p],T=(c,s)=>{if(!c)return!1;const i=I.join(",");return c.closest&&c.closest(i)?!0:g&&s?g(c,s):!1},F=c=>{const i=c?.closest?.(".k-table-row[data-grid-row-index]")?.getAttribute("data-grid-row-index");if(i==null)return;const v=parseInt(i,10);return Number.isNaN(v)?void 0:v},D=c=>{if(!c||typeof c.clientX!="number")return;const s=typeof window<"u"&&window.scrollX||0,i=typeof window<"u"&&window.scrollY||0,v=typeof window<"u"&&window.screenX||0,L=typeof window<"u"&&window.screenY||0;return{clientX:c.clientX,clientY:c.clientY,pageX:typeof c.pageX=="number"?c.pageX:c.clientX+s,pageY:typeof c.pageY=="number"?c.pageY:c.clientY+i,screenX:typeof c.screenX=="number"?c.screenX:c.clientX+v,screenY:typeof c.screenY=="number"?c.screenY:c.clientY+L}},$=c=>{if(!c||typeof c.getBoundingClientRect!="function")return;const s=c.getBoundingClientRect();if(!s)return;const i=s.left,v=s.bottom,L=typeof window<"u"&&window.scrollX||0,U=typeof window<"u"&&window.scrollY||0;return{clientX:i,clientY:v,pageX:i+L,pageY:v+U,screenX:i,screenY:v}},E=c=>{if(typeof window>"u")return!1;const s=window.getSelection();if(!s||s.isCollapsed||!s.toString().trim())return!1;if(c&&s.anchorNode&&s.focusNode){const i=c.closest(".k-table-row")||c.closest(".k-grid")||c,v=s.anchorNode.nodeType===Node.ELEMENT_NODE?s.anchorNode:s.anchorNode.parentElement,L=s.focusNode.nodeType===Node.ELEMENT_NODE?s.focusNode:s.focusNode.parentElement,U=!!(v&&i.contains(v)),B=!!(L&&i.contains(L));return U||B}return!0};return{handleRowClick:c=>{const s=c?.htmlEvent||c?.event||c?.nativeEvent||(c instanceof Event?c:void 0);if(s&&s.button!==void 0&&s.button!==0)return;const i=s?.target||c?.target;if(i&&T(i,s||c)||E(i))return;const v={dataItem:c.dataItem,rowIndex:c.rowIndex??F(i),field:c.field,event:s||c,triggerType:"click",ctrlKey:!!s?.ctrlKey,shiftKey:!!s?.shiftKey,metaKey:!!s?.metaKey,altKey:!!s?.altKey,coordinates:D(s)??$(i)};n(c.dataItem,v)},handleRowKeyDown:(c,s)=>{if(!A)return;const i=c.key||c.code;if(!(i==="Enter"||i==="NumpadEnter"||i===" "||i==="Space"||c.code==="Enter"||c.code==="NumpadEnter"||c.code==="Space"))return;const L=c.target;if(!L)return;const U=L.closest(".k-table-row[data-grid-row-index], .k-table-row");if(!U||T(L,c))return;c.preventDefault(),c.stopPropagation();const B=U.getAttribute("data-grid-row-index"),G=B!==null?parseInt(B,10):void 0;let J=s;if(J===void 0){const w=(Array.isArray(h)?h:h?.value)||o?.value?.props?.dataItems||o?.value?.dataItems;w&&G!==void 0&&G>=0&&G<w.length&&(J=w[G])}if(J===void 0)return;const u={dataItem:J,rowIndex:G,event:c,triggerType:"keyboard",ctrlKey:!!c.ctrlKey,shiftKey:!!c.shiftKey,metaKey:!!c.metaKey,altKey:!!c.altKey,coordinates:$(U)};n(J,u)},isIgnoredTarget:T}},Ne="Enter a valid ZIP code with exactly 5 or 9 digits.",Ee=e=>{const n=e.replace(/\D/g,"").slice(0,9);return n.length>5?`${n.slice(0,5)}-${n.slice(5)}`:n},qe=(e,n)=>e.slice(0,Math.max(0,n)).replace(/\D/g,"").length,Oe=e=>e<=5?e:Math.min(e+1,10),xe=e=>{const n=t.ref(Ee(e.initialValue??"")),o=t.ref(!1),h=t.ref(e.errorMessage?.trim()||Ne),p=t.computed(()=>n.value.replace(/\D/g,"")),g=t.computed(()=>{const S=p.value.length;return S===5||S===9}),A=t.computed(()=>o.value&&!g.value),I=t.computed(()=>!o.value||g.value),T=t.computed(()=>o.value),F=(S,R)=>{const c=Oe(R);t.nextTick(()=>{S.isConnected&&S.setSelectionRange(c,c)})};return{zipDisplay:n,submitted:o,errorMessage:h,wrapperClass:"fk-zip-textbox",zipRaw:p,isZipValid:g,showZipError:A,textBoxValid:I,textBoxValidate:T,handleZipInput:(...S)=>{const R=S[0],s=R?.event?.target,i=R?.value,v=Array.isArray(i)?i.join(""):String(i??""),L=s?.selectionStart!==void 0&&s.selectionStart!==null?qe(s.value,s.selectionStart):v.replace(/\D/g,"").length;n.value=Ee(v),s&&F(s,L)},submitAndValidate:S=>{o.value=!0;const R=g.value;return!R&&S?.focus&&t.nextTick(()=>{document.getElementById(e.id)?.focus()}),R},buildPayload:()=>({zip:p.value})}};function Ie(e,n){const o=t.ref(!1);t.watchEffect(()=>{e.value?.setAttribute("aria-invalid",String(!n.isValid()))});function h(g){const A=e.value??g.currentTarget,I=g.relatedTarget;(!A||!A.contains(I))&&(o.value=!0)}function p(){o.value=!1}return{touched:o,onFocusout:h,reset:p}}function Me(e,n){const o=t.ref(!1),h=t.ref(!1),p=t.computed(()=>t.toValue(n.submitted)||o.value),g=t.computed(()=>!p.value||n.isValid()),A=Ie(e,{isValid:()=>g.value});function I(E){return t.computed(()=>!p.value||t.toValue(E))}function T(E){return Object.fromEntries(Object.entries(E).map(([S,R])=>[S,I(R)]))}function F(E){const S=t.toValue(E);if(!S)return;S.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function D(E){if(h.value){h.value=!1;return}A.onFocusout(E),A.touched.value&&(o.value=!0)}function $(){o.value=!1,h.value=!0,A.reset()}return{touched:o,fieldsetValidate:p,onFocusout:D,reset:$,createFieldValidity:I,createFieldValidationsMap:T,focusFirstInvalidField:F}}const Ue=[{label:"Alabama",value:"AL"},{label:"Alaska",value:"AK"},{label:"Arizona",value:"AZ"},{label:"Arkansas",value:"AR"},{label:"California",value:"CA"},{label:"Colorado",value:"CO"},{label:"Connecticut",value:"CT"},{label:"Delaware",value:"DE"},{label:"Florida",value:"FL"},{label:"Georgia",value:"GA"},{label:"Hawaii",value:"HI"},{label:"Idaho",value:"ID"},{label:"Illinois",value:"IL"},{label:"Indiana",value:"IN"},{label:"Iowa",value:"IA"},{label:"Kansas",value:"KS"},{label:"Kentucky",value:"KY"},{label:"Louisiana",value:"LA"},{label:"Maine",value:"ME"},{label:"Maryland",value:"MD"},{label:"Massachusetts",value:"MA"},{label:"Michigan",value:"MI"},{label:"Minnesota",value:"MN"},{label:"Mississippi",value:"MS"},{label:"Missouri",value:"MO"},{label:"Montana",value:"MT"},{label:"Nebraska",value:"NE"},{label:"Nevada",value:"NV"},{label:"New Hampshire",value:"NH"},{label:"New Jersey",value:"NJ"},{label:"New Mexico",value:"NM"},{label:"New York",value:"NY"},{label:"North Carolina",value:"NC"},{label:"North Dakota",value:"ND"},{label:"Ohio",value:"OH"},{label:"Oklahoma",value:"OK"},{label:"Oregon",value:"OR"},{label:"Pennsylvania",value:"PA"},{label:"Rhode Island",value:"RI"},{label:"South Carolina",value:"SC"},{label:"South Dakota",value:"SD"},{label:"Tennessee",value:"TN"},{label:"Texas",value:"TX"},{label:"Utah",value:"UT"},{label:"Vermont",value:"VT"},{label:"Virginia",value:"VA"},{label:"Washington",value:"WA"},{label:"West Virginia",value:"WV"},{label:"Wisconsin",value:"WI"},{label:"Wyoming",value:"WY"}];function he(e){if(e&&typeof e=="object"&&"value"in e){const n=e.value;return typeof n=="string"?n:String(n??"")}return""}function Be(){const e=t.reactive({address1:"",address2:"",city:"",state:null,zip:""});return{formData:e,onAddress1Input:(...A)=>{e.address1=he(A[0])},onAddress2Input:(...A)=>{e.address2=he(A[0])},onCityInput:(...A)=>{e.city=he(A[0])},onStateChange:A=>{e.state=A.value},resetFormData:()=>{e.address1="",e.address2="",e.city="",e.state=null,e.zip=""}}}function Ye(e,n="zip"){const o=xe({id:n}),{zipDisplay:h,zipRaw:p,isZipValid:g,wrapperClass:A,handleZipInput:I}=o;return t.watch(p,F=>{e.zip=F}),{zipDisplay:h,isZipValid:g,zipWrapperClass:A,onZipInput:I,resetZip:()=>{h.value="",e.zip=""}}}function ze(e){const n=t.computed(()=>e.formData.address1.trim()!==""),o=t.computed(()=>e.formData.city.trim()!==""),h=t.computed(()=>!!e.formData.state),p=t.computed(()=>t.toValue(e.isZipValid)),g=t.computed(()=>n.value&&o.value&&h.value&&p.value);return{strictAddress1Valid:n,strictCityValid:o,strictStateValid:h,strictZipValid:p,strictAddressValid:g}}function He(e){if(!e)return;e.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function Ze(e,n){const o=e??n.currentTarget,h=n.relatedTarget;return!o||!o.contains(h)}function Xe(e){const n=t.ref(t.toValue(e.fieldsetRef));t.watchEffect(()=>{n.value=t.toValue(e.fieldsetRef)});const o=t.ref(!1),h=t.ref(!1),p=t.computed(()=>t.toValue(e.required)??!0),{formData:g,onAddress1Input:A,onAddress2Input:I,onCityInput:T,onStateChange:F,resetFormData:D}=Be(),$=`${e.addressId}-zip`,{zipDisplay:E,isZipValid:S,zipWrapperClass:R,onZipInput:c,resetZip:s}=Ye(g,$),{strictAddress1Valid:i,strictCityValid:v,strictStateValid:L,strictZipValid:U,strictAddressValid:B}=ze({formData:g,isZipValid:S}),G=Me(n,{submitted:o,isValid:()=>B.value}),{touched:J,fieldsetValidate:u,onFocusout:w,reset:m}=G,b=G.createFieldValidationsMap({address1:i,city:v,state:L,zip:U,address:B}),{address1:M,city:k,state:C,zip:N,address:Z}=b,ne=t.computed(()=>p.value?u.value:!1),oe=t.computed(()=>p.value?M.value:!0),r=t.computed(()=>p.value?k.value:!0),y=t.computed(()=>p.value?C.value:!0),P=t.computed(()=>p.value?N.value:!0),Y=t.computed(()=>p.value?Z.value:!0),z={value:null,label:"State"},X=Ue.map(({label:f,value:x})=>({label:f,value:x})),a=t.computed(()=>({address1:g.address1.trim(),address2:g.address2.trim(),city:g.city.trim(),state:(g.state??"").trim().toUpperCase(),zip:g.zip.replace(/\D/g,"")})),d=t.computed(()=>g.address1.trim()===""&&g.address2.trim()===""&&g.city.trim()===""&&(g.state??"").trim()===""&&g.zip.replace(/\D/g,"")===""),V=t.computed(()=>!d.value),q=t.computed(()=>!p.value&&V.value&&(!i.value||!v.value||!L.value)),W=t.computed(()=>{const f=g.zip.replace(/\D/g,"");return!p.value&&V.value&&f.length!==5&&f.length!==9}),Q=t.computed(()=>!p.value&&V.value&&!B.value),O=t.computed(()=>!p.value&&Q.value&&(h.value||o.value));return t.watch(a,()=>{p.value||(h.value=!1)}),t.watch(p,f=>{f||(o.value=!1,h.value=!1,m())}),{formData:g,submitted:o,touched:J,addressValidate:ne,address1Valid:oe,cityValid:r,stateValid:y,zipValid:P,addressValid:Y,optionalFeedbackActive:O,optionalPartialInvalid:Q,optionalMissingRequiredFields:q,optionalZipInvalid:W,stateDefaultItem:z,stateOptions:X,zipDisplay:E,zipWrapperClass:R,onAddress1Input:A,onAddress2Input:I,onCityInput:T,onStateChange:F,onZipInput:c,onFieldsetFocusout:f=>{const x=Ze(n.value,f);w(f),!p.value&&x&&(h.value=!0)},normalizedPayload:a,validateForSubmit:async()=>p.value?(o.value=!0,B.value?{isValid:!0,payload:a.value}:(await t.nextTick(),He(n.value),{isValid:!1,payload:null})):d.value||B.value?(o.value=!1,{isValid:!0,payload:a.value}):(o.value=!0,{isValid:!1,payload:null}),reset:()=>{o.value=!1,h.value=!1,m(),D(),s()}}}const We=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ge=Object.prototype.toString,je=e=>Ge.call(e)==="[object Object]",ge=()=>{};function ve(e){return Array.isArray(e)?e:[e]}function _e(e,n,o){return t.watch(e,n,{...o,immediate:!0})}const Te=We?window:void 0;function pe(e){var n;const o=t.toValue(e);return(n=o?.$el)!==null&&n!==void 0?n:o}function be(...e){const n=(h,p,g,A)=>(h.addEventListener(p,g,A),()=>h.removeEventListener(p,g,A)),o=t.computed(()=>{const h=ve(t.toValue(e[0])).filter(p=>p!=null);return h.every(p=>typeof p!="string")?h:void 0});return _e(()=>{var h,p;return[(h=(p=o.value)===null||p===void 0?void 0:p.map(g=>pe(g)))!==null&&h!==void 0?h:[Te].filter(g=>g!=null),ve(t.toValue(o.value?e[1]:e[0])),ve(t.unref(o.value?e[2]:e[1])),t.toValue(o.value?e[3]:e[2])]},([h,p,g,A],I,T)=>{if(!h?.length||!p?.length||!g?.length)return;const F=je(A)?{...A}:A,D=h.flatMap($=>p.flatMap(E=>g.map(S=>n($,E,S,F))));T(()=>{D.forEach($=>$())})},{flush:"post"})}function Ce(e,n,o={}){const{window:h=Te,ignore:p=[],capture:g=!0,detectIframe:A=!1,controls:I=!1}=o;if(!h)return I?{stop:ge,cancel:ge,trigger:ge}:ge;let T=!0;const F=s=>t.toValue(p).some(i=>{if(typeof i=="string")return Array.from(h.document.querySelectorAll(i)).some(v=>v===s.target||s.composedPath().includes(v));{const v=pe(i);return v&&(s.target===v||s.composedPath().includes(v))}});function D(s){const i=t.toValue(s);return i&&i.$.subTree.shapeFlag===16}function $(s,i){const v=t.toValue(s),L=v.$.subTree&&v.$.subTree.children;return L==null||!Array.isArray(L)?!1:L.some(U=>U.el===i.target||i.composedPath().includes(U.el))}const E=s=>{const i=pe(e);if(s.target!=null&&!(!(i instanceof Element)&&D(e)&&$(e,s))&&!(!i||i===s.target||s.composedPath().includes(i))){if("detail"in s&&s.detail===0&&(T=!F(s)),!T){T=!0;return}n(s)}};let S=!1;const R=[be(h,"click",s=>{S||(S=!0,setTimeout(()=>{S=!1},0),E(s))},{passive:!0,capture:g}),be(h,"pointerdown",s=>{const i=pe(e);T=!F(s)&&!!(i&&!s.composedPath().includes(i))},{passive:!0}),A&&be(h,"blur",s=>{setTimeout(()=>{const i=pe(e);let v=h.document.activeElement;for(;v?.shadowRoot;)v=v.shadowRoot.activeElement;v?.tagName==="IFRAME"&&!i?.contains(h.document.activeElement)&&n(s)},0)},{passive:!0})].filter(Boolean),c=()=>R.forEach(s=>s());return I?{stop:c,cancel:()=>{T=!1},trigger:s=>{T=!0,E(s),T=!1}}:c}const we=e=>{if(e instanceof HTMLElement)return e;const n=e?.$el;return n instanceof HTMLElement?n:null},Je=(e,n)=>n==="row"?e.matches("tr.k-table-row"):!e.matches("tr.k-table-row"),Qe=(e,n)=>{console.warn(`usePopupMenu: triggerMode "${n}" does not match resolved element <${e.tagName.toLowerCase()}${e.className?`.${e.className.split(" ").join(".")}`:""}>; ARIA management skipped.`)},et=e=>{const n=t.ref(null),o=e.menuItemSelector??".k-menu-item:not(.k-disabled)",h=e.triggerMode,p=()=>we(e.triggerRef.value),g=()=>e.resolveFocusTarget?.()??we(e.focusTargetRef?.value),A=()=>{const i=g();if(i)return i.focus(),!0;const v=p();return v?.focus(),!!v},I=()=>{we(e.menuRef.value)?.querySelector(o)?.focus()},T=i=>{e.isOpen.value&&(n.value=i,$(!1),e.requestHide())};Ce(e.menuRef,()=>T("outside-click"),{ignore:[e.triggerRef]});let F=null;const D=()=>{F?.isConnected&&F.setAttribute("aria-expanded","false"),F=null},$=i=>{if(e.manageMenuTriggerAria===!1)return;const v=p();if(!v){F?.isConnected&&F.setAttribute("aria-expanded",i?"true":"false");return}if(!Je(v,h)){Qe(v,h),D();return}F&&F!==v&&D(),v.setAttribute("aria-expanded",i?"true":"false"),F=v};t.watch([e.isOpen,e.triggerRef],([i])=>$(i),{immediate:!0,flush:"post"}),t.onUnmounted(D);const E=()=>{if(e.isOpen.value){T("trigger-click");return}e.requestShow(),t.nextTick(I)};return{handleMenuSelect:(i,v)=>{T(i.event?.type?.startsWith("key")?"keyboard":"mouse-selection"),v?.(i)},handleActionButtonClick:E,handleActionButtonKeydown:i=>{if(i.key==="Enter"||i.code==="Space"){i.preventDefault(),E();return}if(i.key==="Escape"){if(i.preventDefault(),i.stopPropagation(),e.isOpen.value){T("keyboard");return}A()}},handleActionMenuEscape:i=>{i.preventDefault(),i.stopPropagation(),T("keyboard")},handlePopupClose:()=>{t.nextTick(()=>{n.value==="keyboard"?A():n.value==="mouse-selection"&&p()?.focus(),n.value=null})}}},tt=e=>{if(e instanceof HTMLElement)return e;const n=e&&"$el"in e?e.$el:null;return n instanceof HTMLElement?n:null},nt=()=>{const e=t.shallowReactive(new Map),n=t.ref(null),o=(I,T)=>{const F=tt(T);F?e.set(I,F):e.delete(I)},h=I=>e.get(I)??null,p=I=>{n.value=I},g=()=>{n.value=null},A=I=>n.value===I;return{activeId:t.readonly(n),isActive:t.computed(()=>n.value!==null),activeElement:t.computed(()=>n.value!==null?h(n.value):null),register:o,resolve:h,activate:p,deactivate:g,isIdActive:A}};function at(e){const n=t.ref(""),o=t.ref(void 0),h=t.ref(!!e.debug),p=t.ref(e.dateFormat??"mm/dd/yyyy"),g=t.computed(()=>!!e.required),A=1e3,I=t.ref(!1),T=["ArrowUp","ArrowDown"],F=["ArrowLeft","ArrowRight"],D=t.computed(()=>(n.value??"").replace(/\D/g,"")),$=r=>r<=2?"mm":r<=5?"dd":D.value.length<=10?"yyyy":"mm",E=t.computed(()=>{const r=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),S=t.computed(()=>{const r=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),R=t.computed(()=>{const r=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(4,"0")}),c=r=>{if(D.value.length===0){e.onChange({value:null,event:r});return}if(D.value.length<8){e.onChange({value:null,event:r});return}if((n.value??"").length===10&&D.value.length===8){const[y,P,Y]=n.value.split("/"),z=parseInt(y),X=parseInt(P),a=parseInt(Y);if(B(a,z,X)){const d=L(a,z,X);s(d)?e.onChange({value:d,event:r}):e.onChange({value:null,event:r})}else e.onChange({value:null,event:r})}},s=r=>{const y=e.min??void 0,P=e.max??void 0;return!(y&&r<y||P&&r>P)},i=t.computed(()=>{if((n.value??"").length===10&&D.value.length===8){const[r,y,P]=(n.value??"").split("/"),Y=parseInt(r),z=parseInt(y),X=parseInt(P);if(B(X,Y,z))return L(X,Y,z)}return null}),v=t.computed(()=>(n.value??"").length===10&&D.value.length===8),L=(r,y,P)=>{const Y=new Date(0);return Y.setFullYear(r,y-1,P),Y.setHours(0,0,0,0),Y},U=(r,y)=>L(r,y+1,0).getDate(),B=(r,y,P)=>y>=1&&y<=12&&r>=A&&P>=1&&P<=U(r,y),G=r=>{n.value=r.value;const y=r.event?.target;o.value=y?.selectionStart??0,c(r)},J=r=>{o.value=r.target.selectionStart??0},u=(r,y,P)=>{const Y=y?.selectionStart??o.value??0;o.value=Y;let z=parseInt(E.value),X=parseInt(S.value),a=parseInt(R.value);if(!(D.value.length>=8)||!B(a,z,X)){const H=e.defaultValue??new Date;z=H.getMonth()+1,X=H.getDate(),a=H.getFullYear(),n.value=`${String(z).padStart(2,"0")}/${String(X).padStart(2,"0")}/${String(a)}`;const le=L(a,z,X);e.onChange({value:s(le)?le:null,event:P}),k({useRAF:!0});return}const V=$(Y);if(V==="mm")z=r==="ArrowUp"?z<12?z+1:1:z>1?z-1:12;else if(V==="dd"){const H=new Date(a,z,0).getDate();X=r==="ArrowUp"?X<H?X+1:1:X>1?X-1:H}else V==="yyyy"&&(a=r==="ArrowUp"?a+1:Math.max(1,a-1));n.value=`${String(z).padStart(2,"0")}/${String(X).padStart(2,"0")}/${String(a)}`;const[q,W,Q]=n.value.split("/"),O=L(parseInt(Q),parseInt(q),parseInt(W));O.toString()!=="Invalid Date"&&parseInt(Q)>=1e3?e.onChange({value:s(O)?O:null,event:P}):e.onChange({value:null,event:P}),k({useRAF:!0})},w=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(T.includes(r.key)){if(r.altKey)return;r.preventDefault(),r.stopPropagation();const y=r.target;u(r.key,y,r);return}},m=r=>{r.preventDefault();const y=r.deltaY<0?"ArrowUp":"ArrowDown";u(y,r.target,r)},b=r=>{const y=r.target;if(F.includes(r.key)){o.value=y?.selectionStart??0;return}if(T.includes(r.key)){if(r.altKey)return;o.value=y?.selectionStart??0}},M=r=>{I.value=!0,g.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&D.value.length===0&&(e.externalValue.value="");const y=r.target;y&&(o.value=y.selectionStart??0)},k=r=>{const y=()=>{const P=document.getElementById(e.id);if(!P)return;const Y=r?.pos??o.value??P.value.length;try{P.focus(),P.setSelectionRange(Y,Y)}catch{}};t.nextTick(()=>{if(r?.delay&&r.delay>0){setTimeout(y,r.delay);return}if(r?.useRAF){requestAnimationFrame(y);return}y()})};e.externalValue&&t.watch(e.externalValue,r=>{if(r){const y=new Date(r);if(y.toString()!=="Invalid Date"){const P=(y.getMonth()+1).toString().padStart(2,"0"),Y=y.getDate().toString().padStart(2,"0"),z=y.getFullYear().toString();n.value=`${P}/${Y}/${z}`,k({delay:50});return}}},{immediate:!0});const C=t.computed(()=>[["Date",`${E.value} / ${S.value} / ${R.value}`],["Digits only",D.value],["min",e.min?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null],["max",e.max?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null]]),N=t.computed(()=>{if(!g.value){if(!v.value)return!0;const y=i.value;return y?s(y):!1}if(!I.value)return!0;const r=i.value;return!v.value||!r?!1:s(r)}),Z=t.computed(()=>{if(!g.value){if(!v.value)return;const y=i.value;return y?s(y)?"valid":"out-of-bounds":"invalid-date"}if(!I.value)return;if(D.value.length===0||!v.value)return"incomplete";const r=i.value;return r?s(r)?"valid":"out-of-bounds":"invalid-date"}),ne=t.computed(()=>{const r=Z.value;if(!r||r==="valid")return"";if(r==="incomplete")return"Required";if(r==="invalid-date")return`Must be in ${p.value} format.`;const y=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,P=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(r==="out-of-bounds"){if(y&&P)return`Must be between ${y} and ${P}.`;if(y)return`Must be on or after ${y}.`;if(P)return`Must be on or before ${P}.`}return""}),oe=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`ID (#${e.id}) not found for styling.`);return}const y=r.closest(".k-datepicker");if(!y){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const P=y.parentElement;if(P){if(P.classList.contains("fk-datepicker"))return;P.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{oe()}),{raw:n,cursorPos:o,debugEnabled:h,debugLines:C,placeholder:p,isValid:N,reason:t.readonly(Z),validationMessage:ne,digitsOnly:D,month:t.readonly(E),day:t.readonly(S),year:t.readonly(R),datePart:$,handleChange:G,handleKeyDown:w,handleWheel:m,handleKeyUp:b,handleClick:J,handleBlur:M,initStyling:oe}}function rt(e){const n=t.ref(""),o=t.ref(void 0),h=t.ref(!!e.debug),p=t.ref(!1),g=1440*60*1e3,A=365*g,I=new Date,T=new Date(I.getTime()-A),F=new Date(I.getTime()+A);e.min=e.min??T,e.max=e.max??F;const D=t.computed(()=>(n.value??"").replace(/\D/g,"")),$=(l,f)=>new Date(l,f,0).getDate(),E=(l,f,x)=>f>=1&&f<=12&&l>=1e3&&x>=1&&x<=$(l,f),S=l=>Date.UTC(l.getFullYear(),l.getMonth(),l.getDate()),R=l=>{if(!l)return null;const f=e.min??new Date(Date.now()-90*g),x=e.max??new Date,K=S(l);return K<S(f)||K>S(x)?null:l},c=(l,f)=>e.allowReverse??!1?!0:l<=f,s=t.computed(()=>(n.value?.length??0)>=23&&D.value.length>=16),i=l=>{if((l??"").length<23||D.value.length<16)return{start:null,end:null};const f=l.substring(0,10),x=l.substring(13,23),[K,ee,te]=f.split("/").map(ue=>parseInt(ue||"0",10)),[se,ce,de]=x.split("/").map(ue=>parseInt(ue||"0",10)),fe=new Date(te,K-1,ee),me=new Date(de,se-1,ce),ke=E(te,K,ee)&&fe.toString()!=="Invalid Date",Se=E(de,se,ce)&&me.toString()!=="Invalid Date";return{start:ke?fe:null,end:Se?me:null}},v=e.externalValid??t.ref(!0),L=t.computed(()=>i(n.value)),U=t.computed(()=>{const l=R(L.value.start),f=R(L.value.end);return{start:l,end:f}}),B=t.computed(()=>{if(!s.value)return;const l=U.value.start,f=U.value.end;if(!l||!f)return;const x=Math.abs(S(f)-S(l));return Math.round(x/864e5+1)}),G=t.ref(!1),J=t.computed(()=>{if(!G.value)return;const{start:l,end:f}=L.value;if(!s.value)return"incomplete";if(!l||!f)return"invalid-date";if(!U.value.start||!U.value.end)return"out-of-bounds";const x=U.value.start,K=U.value.end;return c(x,K)?typeof e.maxSpanDays=="number"&&B.value!==void 0&&B.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),u=t.computed(()=>{const l=J.value;return l===void 0||l==="valid"}),w=t.computed(()=>{const{min:l,max:f}=e,x=J.value;if(!x)return"";switch(x){case"incomplete":return"Required";case"invalid-date":return"One or both dates invalid.";case"reversed-range":return"End Date must be on or after Start Date.";case"out-of-bounds":return l&&f?`Dates must be between ${k(l)} and ${k(f)}.`:"Dates must be within the allowed range.";case"span-exceeds-limit":return typeof e.maxSpanDays=="number"?`Date range exceeds ${e.maxSpanDays} days.`:"Date range exceeds maximum allowed span.";default:return""}}),m=["ArrowUp","ArrowDown"],b=["ArrowLeft","ArrowRight"],M=(l,f)=>String(l).padStart(f,"0"),k=l=>`${M(l.getMonth()+1,2)}/${M(l.getDate(),2)}/${M(l.getFullYear(),4)}`,C=l=>l<=2?{side:"start",part:"mm"}:l<=5?{side:"start",part:(l<=3,"dd")}:l<=11?{side:"start",part:"yyyy"}:l<=15?{side:"end",part:"mm"}:l<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},N=(l,f,x)=>{const K=f?.selectionStart??o.value??0;o.value=K;const{start:ee,end:te}=i(n.value);if(!ee&&!te){const j=new Date,ie=k(j);n.value=`${ie} - ${ie}`,e.onChange({value:{start:j,end:j},event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const ae=document.getElementById(e.id),re=o.value??0;ae&&(ae.focus(),ae.setSelectionRange(re,re))})});return}const se=new Date,ce=C(K);let de=ee?new Date(ee):new Date(se),fe=te?new Date(te):new Date(se);const me=(j,ie)=>{if(ie==="mm"){const ae=j.getMonth()+1,re=l==="ArrowUp"?ae<12?ae+1:1:ae>1?ae-1:12;j.setMonth(re-1);const ye=$(j.getFullYear(),re);j.getDate()>ye&&j.setDate(ye)}else if(ie==="dd"){const ae=$(j.getFullYear(),j.getMonth()+1),re=j.getDate(),ye=l==="ArrowUp"?re<ae?re+1:1:re>1?re-1:ae;j.setDate(ye)}else if(ie==="yyyy"){const ae=j.getFullYear();j.setFullYear(l==="ArrowUp"?ae+1:Math.max(1,ae-1));const re=$(j.getFullYear(),j.getMonth()+1);j.getDate()>re&&j.setDate(re)}};ce.side==="start"?me(de,ce.part):me(fe,ce.part);const ke=k(de),Se=k(fe);n.value=`${ke} - ${Se}`;const ue=R(de),Ae=R(fe);ue&&Ae&&c(ue,Ae)?e.onChange({value:{start:ue,end:Ae},event:x}):e.onChange({value:null,event:x}),t.nextTick(()=>{requestAnimationFrame(()=>{const j=document.getElementById(e.id),ie=o.value??0;j&&(j.focus(),j.setSelectionRange(ie,ie))})})},Z=l=>{const{start:f,end:x}=i(n.value);if(!f||!x){e.onChange({value:null,event:l});return}const K=R(f),ee=R(x);if(!K||!ee){e.onChange({value:null,event:l});return}if(!c(K,ee)){e.onChange({value:null,event:l});return}e.onChange({value:{start:K,end:ee},event:l})},ne=l=>{const f=l.value??"",x=l.event;if(!f&&x&&x.type==="click"){X(x);return}n.value=f;const K=x?.target;o.value=K?.selectionStart??0,Z(l)},oe=l=>{o.value=l.target.selectionStart??0},r=l=>{if(l.code==="Space"||l.key===" "){l.preventDefault(),l.stopPropagation(),e.onShowCalendar(l);return}if(l.key==="ArrowDown"&&l.altKey){l.preventDefault(),l.stopPropagation(),e.onShowCalendar(l);return}if(m.includes(l.key)){l.preventDefault(),l.stopPropagation();const f=l.target;N(l.key,f,l);return}},y=l=>{l.preventDefault();const f=l.deltaY<0?"ArrowUp":"ArrowDown";N(f,l.target,l)},P=l=>{if(b.includes(l.key)||m.includes(l.key)){const f=l.target;o.value=f?.selectionStart??0}},Y=()=>{G.value=!0,(e.manageValid??!0)&&(v.value=u.value)},z=l=>{Y()},X=l=>{n.value="",o.value=0,e.onChange({value:null,event:l}),Y(),t.nextTick(()=>{const f=document.getElementById(e.id);f&&(f.focus(),f.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,l=>{const f=l?.start??null,x=l?.end??null;if(f&&x){if(n.value=`${k(f)} - ${k(x)}`,e.isOpen?.value&&p.value&&e.onRequestClose){const K=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),p.value=!1,Y()},K)}return}},{immediate:!0});const a=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),d=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),V=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),q=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),W=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),Q=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),O=t.computed(()=>{const{start:l,end:f}=i(n.value);return[{label:"Raw",value:n.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(a.value).padStart(2,"0")} / ${String(d.value).padStart(2,"0")} / ${String(V.value).padStart(4,"0")}`},{label:"End",value:`${String(q.value).padStart(2,"0")} / ${String(W.value).padStart(2,"0")} / ${String(Q.value).padStart(4,"0")}`},{label:"Digits only",value:D.value},{label:"Mask complete",value:`${s.value}`},{label:"Parsed",value:`${l?l.toDateString():"-"} | ${f?f.toDateString():"-"}`},{label:"Valid (managed)",value:`${v.value??"-"}`},{label:"Span (days)",value:`${B.value??"-"}`},{label:"Reason",value:`${J.value??"-"}`},{label:"Cursor in",value:`${o.value??"-"} (${(()=>{const x=o.value??0,K=C(x);return`${K.side}.${K.part}`})()})`}]}),H=()=>{t.nextTick(()=>{const l=document.getElementById(e.id);if(!l){console.warn(`#${e.id} not found for styling.`);return}const f=l.closest("div");if(!f){console.warn(`Parent div of #${e.id} not found for styling.`);return}f.classList.contains("fk-daterangepicker")||f.classList.add("fk-daterangepicker")})};t.onMounted(()=>{H()});const le=()=>{t.nextTick(()=>{try{const l=Array.from(document.querySelectorAll(".k-animation-container"));if(!l.length)return;const x=[...l].reverse().find(te=>te.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!x)return;const K=x.querySelectorAll(".k-calendar-table");let ee=!1;K.forEach(te=>{te.tabIndex===0&&(ee?te.tabIndex=-1:ee=!0)})}catch(l){console.warn(l)}})};return e.isOpen&&t.watch(e.isOpen,l=>{l&&setTimeout(()=>le(),0)},{immediate:!1}),{raw:n,cursorPos:o,debugEnabled:h,debugLines:O,digitsOnly:D,valid:v,validComputed:t.readonly(u),reason:t.readonly(J),validationMessage:t.readonly(w),spanDays:t.readonly(B),month1:t.readonly(a),day1:t.readonly(d),year1:t.readonly(V),month2:t.readonly(q),day2:t.readonly(W),year2:t.readonly(Q),handleChange:ne,handleKeyDown:r,handleWheel:y,handleKeyUp:P,handleClick:oe,handleBlur:z,handleClear:X,onCalendarChange:()=>{p.value=!0},initStyling:H}}function ot(e){const n=t.ref(""),o=t.ref(void 0),h=t.ref(!!e.debug),p=t.ref(e.timeFormat??"hh:mm AM"),g=t.computed(()=>!!e.required),A=t.ref(!1),I=["ArrowUp","ArrowDown"],T=["ArrowLeft","ArrowRight"],F=t.computed(()=>(n.value??"").replace(/\D/g,"")),D={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},$=a=>a<=2?"hh":a<=5?"mm":"ampm",E=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",d=parseInt(a);return Math.min(Math.max(d,0),23)}),S=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",d=parseInt(a);return Math.min(Math.max(d,0),59)}),R=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),c=t.computed(()=>{const a=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),d=R.value;return a===12?d==="AM"?0:12:d==="PM"?a+12:a}),s=t.computed(()=>i.value?`${String(c.value).padStart(2,"0")}:${String(S.value).padStart(2,"0")}:00`:null),i=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),v=(a,d,V)=>{let q=a%12;return q===0&&(q=12),`${String(q).padStart(2,"0")}:${String(d).padStart(2,"0")} ${V}`},L=a=>{const d=a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!d)return null;const V=parseInt(d[1]),q=parseInt(d[2]),W=d[3].toUpperCase();if(V<1||V>12||q<0||q>59)return null;let Q=V%12;W==="PM"&&(Q+=12);const O=new Date;return O.setSeconds(0,0),O.setHours(Q),O.setMinutes(q),O},U=a=>{if(F.value.length===0){e.onChange({value:null,event:a});return}if(!i.value){e.onChange({value:null,event:a});return}const d=L(n.value);d&&G(d)?e.onChange({value:d,event:a}):e.onChange({value:null,event:a})},B=a=>a.getHours()*60+a.getMinutes(),G=a=>{const d=e.min??void 0,V=e.max??void 0,q=B(a);if(d){const W=B(d);if(q<W)return!1}if(V){const W=B(V);if(q>W)return!1}return!0},J=a=>{const d=a.getHours(),V=d>=12?"PM":"AM";n.value=v(d,a.getMinutes(),V)},u=(a,d)=>{e.onChange({value:a,event:d})},w=()=>{t.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const a=document.getElementById(e.id);if(a){a.focus();const d=(a.value??"").length;a.setSelectionRange(d,d)}})})})},m=a=>{const d=a?.event?.target;return d?d.closest(".k-time-now")?"now":d.closest(".k-time-accept")?"set":null:null},b=(a,d)=>{a&&G(a)?u(a,d):u(null,d)},M=(...a)=>{const d=a[0];if(!d)return;const V=m(d);if(V==="now"){const W=new Date;J(W),b(W,d),w();return}if(d?.value instanceof Date){const W=new Date(d.value);J(W),b(W,d),V==="set"&&w();return}if(d?.value===null){n.value="",u(null,d);return}n.value=d.value;const q=d.event?.target;o.value=q?.selectionStart??0;try{const W=o.value??0;if($(W)==="ampm"&&(n.value??"").length>=8){const Q=n.value.charAt(6);/[Aa]/.test(Q)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const O=document.getElementById(e.id);O&&(O.focus(),O.setSelectionRange(8,8))})})):/[Pp]/.test(Q)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const O=document.getElementById(e.id);O&&(O.focus(),O.setSelectionRange(8,8))})}))}}catch{}U(d)},k=a=>{o.value=a.target.selectionStart??0},C=(a,d,V)=>{const q=d?.selectionStart??o.value??0;o.value=q;const W=$(q),Q=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!Q){if((n.value??"").length===0||F.value.length===0){const f=new Date,x=f.getHours(),K=x>=12?"PM":"AM";n.value=v(x,f.getMinutes(),K);const ee=L(n.value);b(ee,V),t.nextTick(()=>{requestAnimationFrame(()=>{const te=document.getElementById(e.id),se=o.value??0;te&&(te.focus(),te.setSelectionRange(se,se))})})}return}let O=parseInt(Q[1]),H=parseInt(Q[2]),le=Q[3].toUpperCase();if(W==="hh")a==="ArrowUp"?O=O<12?O+1:1:O=O>1?O-1:12;else if(W==="mm"){const f=e.minuteStepRef?.value??e.minuteStep??1;if(f===1)a==="ArrowUp"?H=H<59?H+1:0:H=H>0?H-1:59;else if(a==="ArrowUp"){const x=H%f;let K=x===0?H+f:H+(f-x);K>=60&&(K=0),H=K}else{const x=H%f;let K=x===0?H-f:H-x;K<0&&(K=60-f),H=K}}else W==="ampm"&&(le=le==="AM"?"PM":"AM");n.value=`${String(O).padStart(2,"0")}:${String(H).padStart(2,"0")} ${le}`;const l=L(n.value);b(l,V),t.nextTick(()=>{requestAnimationFrame(()=>{const f=document.getElementById(e.id),x=o.value??0;f&&(f.focus(),f.setSelectionRange(x,x))})})},N=a=>{if(a.code==="Space"||a.key===" "){a.preventDefault(),a.stopPropagation(),e.onShowPicker(a);return}if(a.key==="ArrowDown"&&a.altKey){a.preventDefault(),a.stopPropagation(),e.onShowPicker(a);return}if(I.includes(a.key)){if(a.altKey)return;a.preventDefault(),a.stopPropagation();const d=a.target;C(a.key,d,a);return}},Z=a=>{a.preventDefault();const d=a.deltaY<0?"ArrowUp":"ArrowDown";C(d,a.target,a)},ne=a=>{const d=a.target;if(T.includes(a.key)){o.value=d?.selectionStart??0;return}if(I.includes(a.key)){if(a.altKey)return;o.value=d?.selectionStart??0}},oe=a=>{A.value=!0,g.value&&e.externalValue&&e.externalValue.value===void 0&&F.value.length===0&&(e.externalValue.value="");const d=a.target;d&&(o.value=d.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const d=new Date(a);if(d.toString()!=="Invalid Date"){const V=d.getHours(),q=V>=12?"PM":"AM";n.value=v(V,d.getMinutes(),q);return}}},{immediate:!0});const r=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",E.value],["Hour (24h)",c.value],["Minute",S.value],["Period",R.value],["Time (24h)",s.value??"--:--:--"],["Digits only",F.value],["Parsed Date",y.value?.toLocaleDateString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["min",e.min?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["max",e.max?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["valid",P.value],["reason",Y.value],["validationMessage",z.value]]),y=t.computed(()=>L(n.value)??null),P=t.computed(()=>{if(!g.value){if(!i.value)return!0;const d=y.value;return d?G(d):!1}if(!A.value)return!0;const a=y.value;return!i.value||!a?!1:G(a)}),Y=t.computed(()=>{if(!g.value){if(!i.value)return;const d=y.value;return d?G(d)?"valid":"out-of-bounds":"invalid-time"}if(!A.value)return;if(F.value.length===0||!i.value)return"incomplete";const a=y.value;return a?G(a)?"valid":"out-of-bounds":"invalid-time"}),z=t.computed(()=>{const a=Y.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-time")return`Must be in ${p.value} format.`;const d={hour:"2-digit",minute:"2-digit"},V=e.min?e.min.toLocaleTimeString("en-US",d):null,q=e.max?e.max.toLocaleTimeString("en-US",d):null;if(a==="out-of-bounds"){if(V&&q)return`Must be between ${V} and ${q}.`;if(V)return`Must be ${V} or later.`;if(q)return`Must be ${q} or earlier.`}return""}),X=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`#${e.id} not found for styling.`);return}const d=a.closest(".k-timepicker");if(!d){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const V=d.parentElement;if(!V){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}V.classList.contains("fk-timepicker")||V.classList.add("fk-timepicker")})};return t.onMounted(()=>{X()}),{raw:n,rules:D,debugEnabled:h,debugLines:r,placeholder:p,isValid:P,reason:t.readonly(Y),validationMessage:z,isComplete:i,inRangeTime:G,cursorPos:o,hour:t.readonly(E),hour24:t.readonly(c),minute:t.readonly(S),period:t.readonly(R),time24:t.readonly(s),parsedRawTime:t.readonly(y),handleChange:M,handleKeyDown:N,handleKeyUp:ne,handleClick:k,handleWheel:Z,handleBlur:oe,initStyling:X}}function lt(e){const n=t.shallowRef(null),o=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],h=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??o].flat(),p=D=>D?typeof e.initialFocus=="string"?D.querySelector(e.initialFocus)??D:typeof e.initialFocus=="function"?e.initialFocus(D)??D:D.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??D:null,{activate:g,deactivate:A}=Re.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>p(n.value),...e.focusTrapOptions??{}});let I=null,T=t.ref(null);const F=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const D=(E,S)=>{const R=Array.from(E.querySelectorAll(S));if(!R.length)return null;const c=R.filter(s=>s.offsetParent!==null||s.getClientRects().length>0);return c[c.length-1]??R[R.length-1]??null},$=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const E of h){const S=D($,E);if(S)return S}for(const E of h){const S=D(document,E);if(S)return S}return null};return Ce(n,D=>{T.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",D)}),t.watch(()=>e.isOpen.value,D=>{D?(T.value=null,t.nextTick(()=>{const $=F();$&&(n.value=$,setTimeout(()=>g(),0),I||(I=E=>{E.key==="Escape"&&(T.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",E))},document.addEventListener("keydown",I,!0)))})):(A(),I&&(document.removeEventListener("keydown",I,!0),I=null),n.value=null,T.value==="outside"&&t.nextTick(()=>{const $=()=>{const E=e.triggerEl?.value,S=E?.querySelector("input"),R=document.activeElement;R&&(R===S||E&&E.contains(R))&&(S??E)?.blur?.()};requestAnimationFrame(()=>setTimeout($,0))}),e.returnFocusToTrigger!==!1&&T.value==="escape"&&e.triggerEl?.value&&t.nextTick(()=>{const $=()=>{const E=e.triggerEl?.value;if(!E)return;(E.querySelector("input")??E)?.focus?.()};requestAnimationFrame(()=>setTimeout($,0))}))}),{popupRef:n,activate:g,deactivate:A,lastCloseReason:t.readonly(T),setPopupEl:D=>n.value=D}}_.useActiveIdRegistry=nt,_.useFieldsetTouchTracker=Ie,_.useFieldsetValidationKit=Me,_.useGridA11y=Fe,_.useGridActiveFilter=Pe,_.useGridRowAction=Ke,_.useMaskedDateInput=at,_.useMaskedDateRangeInput=rt,_.useMaskedTimeInput=ot,_.usePopupMenu=et,_.usePopupTrap=lt,_.useUSAddress=Xe,_.useZipTextBox=xe,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
2
2
  //# sourceMappingURL=featherk-composables.umd.js.map