@featherk/composables 0.10.10 → 0.11.0
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.
- package/dist/featherk-composables.es.js +832 -822
- package/dist/featherk-composables.es.js.map +1 -1
- package/dist/featherk-composables.umd.js +1 -1
- package/dist/featherk-composables.umd.js.map +1 -1
- package/dist/menu/usePopupMenu.d.ts +5 -5
- package/docs/menu/usePopupMenu.md +6 -3
- package/package.json +1 -1
|
@@ -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,y=null,g=null;const D=[],C=".k-table-row[data-grid-row-index] [tabindex]",F=()=>{const s=e?.value?.$el;return s?s.closest(".k-grid"):null},q=s=>{const w=F();if(!w)return!1;const m=s.closest(".k-grid-aria-root");if(m)return w.contains(m);const b=s.closest(".k-grid-header, .k-grid-content, .k-grid-content-locked");return b?w.contains(b):!1},E=s=>s.key==="Enter"||s.code==="Enter"||s.code==="NumpadEnter",V=()=>e?.value?.columns,x=s=>{const w=s.key||s.code;([" ","Spacebar","Space"].includes(w)||E(s))&&(s.preventDefault(),s.stopPropagation(),o.value=s.target,s.target.click())},f=s=>{if(!o.value)return;if(s.code==="Escape"){s.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(s.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"],T=n?.focusableMenuSelectors??b,k=Array.from(m.querySelectorAll(T.join(",")));if(k.length===0)return;const M=k.findIndex(Z=>Z===document.activeElement);let K;M===-1?K=0:s.shiftKey?K=(M-1+k.length)%k.length:K=(M+1)%k.length,s.preventDefault(),s.stopPropagation(),k[K]?.focus()}}else if(s.code==="ArrowUp"||s.code==="ArrowDown"){s.preventDefault(),s.stopPropagation();const b=w.findIndex(k=>k===document.activeElement);let T=b;s.code==="ArrowUp"?T=b>0?b-1:w.length-1:s.code==="ArrowDown"&&(T=b<w.length-1?b+1:0),w[T]?.focus();return}if(s.code==="Tab"){s.preventDefault(),s.stopPropagation();const b=o.value?.parentElement;(s.shiftKey?b?.previousElementSibling:b?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},A=()=>{y=new MutationObserver(s=>{s.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",f),t.nextTick(()=>{const M=()=>{const K=Array.from(b.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(K.length===1)K[0].focus(),K[0].click(),M.attempts=0;else if(K.length>1){M.attempts=0;return}else M.attempts===void 0&&(M.attempts=0),M.attempts++<3&&setTimeout(M,200)};M()})}b.querySelectorAll(".k-animation-container").forEach(k=>{k.addEventListener("keydown",f)})}}),w.removedNodes.forEach(m=>{if(m.nodeType===Node.ELEMENT_NODE){const b=m;b.classList.contains("k-animation-container")&&b.removeEventListener("keydown",f),b.querySelectorAll(".k-animation-container").forEach(k=>{k.removeEventListener("keydown",f)})}})})}),y.observe(document.body,{childList:!0,subtree:!0})},u=s=>{const w=s.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(w)||s.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},i=s=>{if(!s.type||!s)return;const w=s.target;if(!w)return;const m=w.closest(".k-table-row[data-grid-row-index]");if(!q(w))return;const b=["ArrowLeft","ArrowRight"].includes(s.code);if(!(u(w)&&!(m&&b))){if(s.code==="Escape"){const T=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(T){s.preventDefault(),s.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(M=>M.setAttribute("tabindex","-1"))}catch{}T.setAttribute("tabindex","0"),T.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(s.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(s.code)){s.preventDefault(),s.stopPropagation();const T=(M,K)=>{let Z=K==="next"?M.nextElementSibling:M.previousElementSibling;for(;Z;){const ne=Z;try{if(ne.classList.contains("k-table-row"))return ne}catch{}Z=K==="next"?Z.nextElementSibling:Z.previousElementSibling}return null},k=s.code==="ArrowDown"?T(m,"next"):T(m,"previous");k&&(m.setAttribute("tabindex","-1"),k.setAttribute("tabindex","0"),k.focus());return}if(["ArrowLeft","ArrowRight"].includes(s.code)){s.preventDefault(),s.stopPropagation();const T=m.querySelectorAll(C);if(T.length===0)return;let k=Array.from(T).findIndex(M=>M===document.activeElement);if(k===-1&&document.activeElement===m){T[0].focus();return}s.code==="ArrowRight"?k=k===T.length-1?0:k+1:s.code==="ArrowLeft"&&(k=k===0?T.length-1:k-1),T[k].focus();return}}}}},p=()=>{t.nextTick(()=>{const s=e.value?.$el;if(!s||typeof s.closest!="function")return;const w=s.closest(".k-grid");w&&w.classList.add("fk-grid")})},S=()=>{if(!g)try{const s=()=>{try{const b=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!b||b.length===0||b.filter(M=>M.getAttribute("tabindex")==="0").length===1)return;const k=b.find(M=>M===document.activeElement||M.contains(document.activeElement));if(b.forEach(M=>M.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,T)=>{b.setAttribute("tabindex",T===0?"0":"-1")});const m=e.value.$el.querySelector(".k-table-tbody");m&&(g=new MutationObserver(()=>{s()}),g.observe(m,{childList:!0,subtree:!0}))}catch(s){console.error("Error setting up row navigation:",s)}},$=()=>{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",x)}),A(),B()})},U=()=>{const w=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");w&&w.forEach(m=>{m.removeEventListener("keydown",x)}),y&&(y.disconnect(),y=null),g&&(g.disconnect(),g=null),D.forEach(m=>m()),D.length=0},B=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((m,b)=>{if(m.dataset.featherKHeaderBound==="true")return;const T=m.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!T)return;const k=V();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 M=m.dataset.featherKFilterable!=="false",K=m.dataset.featherKSortable!=="false";T.setAttribute("tabindex","-1"),M||K?m.style.cursor="pointer":m.style.cursor="default",M?(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,T.click())},ne=r=>{if(M)o.value=m,r.preventDefault(),r.stopPropagation(),Z(r);else if(K){o.value=m;const h=m.querySelector(".k-link");h&&h.click()}};m.addEventListener("click",ne),D.push(()=>{m.removeEventListener("click",ne)});const oe=r=>{if((E(r)||r.code==="Space")&&(M||K)){if(r.preventDefault(),r.stopPropagation(),o.value=m,o.value.focus(),M)Z(r);else if(K){const h=m.querySelector(".k-link");h&&h.click()}}};m.addEventListener("keydown",oe,!0),D.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 T=b.target.closest("th");T&&(E(b)||b.code==="Space")&&T.dataset.featherKFilterable==="false"&&T.dataset.featherKSortable==="false"&&(b.preventDefault(),b.stopImmediatePropagation())};w.addEventListener("keydown",m,!0),D.push(()=>{w.removeEventListener("keydown",m,!0)}),w.dataset.featherKHeaderBound="true"}},G=function(s,w){const m=s?.event?.event.target,b=V();if(!m||!b)return;const T=m.classList.contains("k-grid-header-menu"),k=m.classList.contains("k-columnmenu-item"),M=b.find(K=>K.field===s?.event?.field)?.sortable&&!0;if(!T){if(k&&!M){s?.event?.sort?.filter(Z=>Z.field!==s?.event?.field);return}typeof w=="function"&&t.nextTick(()=>{o.value&&o.value.focus(),w(s),t.nextTick(()=>{B()})})}},J=()=>{if(!v)try{p(),S(),$(),v=!0}catch(s){console.error("initA11y failed:",s),U()}};return t.onBeforeUnmount(()=>{U()}),{activeFilterButton:o,handleGridKeyDown:i,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:y=[],shouldIgnoreTarget:g,enableKeyboardAction:D=!0}=e,C=[...Le,...y],F=(u,i)=>{if(!u)return!1;const p=C.join(",");return u.closest&&u.closest(p)?!0:g&&i?g(u,i):!1},q=u=>{const p=u?.closest?.(".k-table-row[data-grid-row-index]")?.getAttribute("data-grid-row-index");if(p==null)return;const S=parseInt(p,10);return Number.isNaN(S)?void 0:S},E=u=>{if(!u||typeof u.clientX!="number")return;const i=typeof window<"u"&&window.scrollX||0,p=typeof window<"u"&&window.scrollY||0,S=typeof window<"u"&&window.screenX||0,$=typeof window<"u"&&window.screenY||0;return{clientX:u.clientX,clientY:u.clientY,pageX:typeof u.pageX=="number"?u.pageX:u.clientX+i,pageY:typeof u.pageY=="number"?u.pageY:u.clientY+p,screenX:typeof u.screenX=="number"?u.screenX:u.clientX+S,screenY:typeof u.screenY=="number"?u.screenY:u.clientY+$}},V=u=>{if(!u||typeof u.getBoundingClientRect!="function")return;const i=u.getBoundingClientRect();if(!i)return;const p=i.left,S=i.bottom,$=typeof window<"u"&&window.scrollX||0,U=typeof window<"u"&&window.scrollY||0;return{clientX:p,clientY:S,pageX:p+$,pageY:S+U,screenX:p,screenY:S}},x=u=>{if(typeof window>"u")return!1;const i=window.getSelection();if(!i||i.isCollapsed||!i.toString().trim())return!1;if(u&&i.anchorNode&&i.focusNode){const p=u.closest(".k-table-row")||u.closest(".k-grid")||u,S=i.anchorNode.nodeType===Node.ELEMENT_NODE?i.anchorNode:i.anchorNode.parentElement,$=i.focusNode.nodeType===Node.ELEMENT_NODE?i.focusNode:i.focusNode.parentElement,U=!!(S&&p.contains(S)),B=!!($&&p.contains($));return U||B}return!0};return{handleRowClick:u=>{const i=u?.htmlEvent||u?.event||u?.nativeEvent||(u instanceof Event?u:void 0);if(i&&i.button!==void 0&&i.button!==0)return;const p=i?.target||u?.target;if(p&&F(p,i||u)||x(p))return;const S={dataItem:u.dataItem,rowIndex:u.rowIndex??q(p),field:u.field,event:i||u,triggerType:"click",ctrlKey:!!i?.ctrlKey,shiftKey:!!i?.shiftKey,metaKey:!!i?.metaKey,altKey:!!i?.altKey,coordinates:E(i)??V(p)};n(u.dataItem,S)},handleRowKeyDown:(u,i)=>{if(!D)return;const p=u.key||u.code;if(!(p==="Enter"||p==="NumpadEnter"||p===" "||p==="Space"||u.code==="Enter"||u.code==="NumpadEnter"||u.code==="Space"))return;const $=u.target;if(!$)return;const U=$.closest(".k-table-row[data-grid-row-index], .k-table-row");if(!U||F($,u))return;u.preventDefault(),u.stopPropagation();const B=U.getAttribute("data-grid-row-index"),G=B!==null?parseInt(B,10):void 0;let J=i;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 s={dataItem:J,rowIndex:G,event:u,triggerType:"keyboard",ctrlKey:!!u.ctrlKey,shiftKey:!!u.shiftKey,metaKey:!!u.metaKey,altKey:!!u.altKey,coordinates:V(U)};n(J,s)},isIgnoredTarget:F}},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),y=t.computed(()=>n.value.replace(/\D/g,"")),g=t.computed(()=>{const f=y.value.length;return f===5||f===9}),D=t.computed(()=>o.value&&!g.value),C=t.computed(()=>!o.value||g.value),F=t.computed(()=>o.value),q=(f,A)=>{const u=Oe(A);t.nextTick(()=>{f.isConnected&&f.setSelectionRange(u,u)})};return{zipDisplay:n,submitted:o,errorMessage:v,wrapperClass:"fk-zip-textbox",zipRaw:y,isZipValid:g,showZipError:D,textBoxValid:C,textBoxValidate:F,handleZipInput:(...f)=>{const A=f[0],i=A?.event?.target,p=A?.value,S=Array.isArray(p)?p.join(""):String(p??""),$=i?.selectionStart!==void 0&&i.selectionStart!==null?Ne(i.value,i.selectionStart):S.replace(/\D/g,"").length;n.value=Ee(S),i&&q(i,$)},submitAndValidate:f=>{o.value=!0;const A=g.value;return!A&&f?.focus&&t.nextTick(()=>{document.getElementById(e.id)?.focus()}),A},buildPayload:()=>({zip:y.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,C=g.relatedTarget;(!D||!D.contains(C))&&(o.value=!0)}function y(){o.value=!1}return{touched:o,onFocusout:v,reset:y}}function Te(e,n){const o=t.ref(!1),v=t.ref(!1),y=t.computed(()=>t.toValue(n.submitted)||o.value),g=t.computed(()=>!y.value||n.isValid()),D=Ie(e,{isValid:()=>g.value});function C(x){return t.computed(()=>!y.value||t.toValue(x))}function F(x){return Object.fromEntries(Object.entries(x).map(([f,A])=>[f,C(A)]))}function q(x){const f=t.toValue(x);if(!f)return;f.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function E(x){if(v.value){v.value=!1;return}D.onFocusout(x),D.touched.value&&(o.value=!0)}function V(){o.value=!1,v.value=!0,D.reset()}return{touched:o,fieldsetValidate:y,onFocusout:E,reset:V,createFieldValidity:C,createFieldValidationsMap:F,focusFirstInvalidField:q}}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:y,isZipValid:g,wrapperClass:D,handleZipInput:C}=o;return t.watch(y,q=>{e.zip=q}),{zipDisplay:v,isZipValid:g,zipWrapperClass:D,onZipInput:C,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),y=t.computed(()=>t.toValue(e.isZipValid)),g=t.computed(()=>n.value&&o.value&&v.value&&y.value);return{strictAddress1Valid:n,strictCityValid:o,strictStateValid:v,strictZipValid:y,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),y=t.computed(()=>t.toValue(e.required)??!0),{formData:g,onAddress1Input:D,onAddress2Input:C,onCityInput:F,onStateChange:q,resetFormData:E}=Be(),V=`${e.addressId}-zip`,{zipDisplay:x,isZipValid:f,zipWrapperClass:A,onZipInput:u,resetZip:i}=Ye(g,V),{strictAddress1Valid:p,strictCityValid:S,strictStateValid:$,strictZipValid:U,strictAddressValid:B}=ze({formData:g,isZipValid:f}),G=Te(n,{submitted:o,isValid:()=>B.value}),{touched:J,fieldsetValidate:s,onFocusout:w,reset:m}=G,b=G.createFieldValidationsMap({address1:p,city:S,state:$,zip:U,address:B}),{address1:T,city:k,state:M,zip:K,address:Z}=b,ne=t.computed(()=>y.value?s.value:!1),oe=t.computed(()=>y.value?T.value:!0),r=t.computed(()=>y.value?k.value:!0),h=t.computed(()=>y.value?M.value:!0),P=t.computed(()=>y.value?K.value:!0),Y=t.computed(()=>y.value?Z.value:!0),z={value:null,label:"State"},X=Ue.map(({label:d,value:I})=>({label:d,value:I})),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,"")})),c=t.computed(()=>g.address1.trim()===""&&g.address2.trim()===""&&g.city.trim()===""&&(g.state??"").trim()===""&&g.zip.replace(/\D/g,"")===""),R=t.computed(()=>!c.value),N=t.computed(()=>!y.value&&R.value&&(!p.value||!S.value||!$.value)),W=t.computed(()=>{const d=g.zip.replace(/\D/g,"");return!y.value&&R.value&&d.length!==5&&d.length!==9}),Q=t.computed(()=>!y.value&&R.value&&!B.value),O=t.computed(()=>!y.value&&Q.value&&(v.value||o.value));return t.watch(a,()=>{y.value||(v.value=!1)}),t.watch(y,d=>{d||(o.value=!1,v.value=!1,m())}),{formData:g,submitted:o,touched:J,addressValidate:ne,address1Valid:oe,cityValid:r,stateValid:h,zipValid:P,addressValid:Y,optionalFeedbackActive:O,optionalPartialInvalid:Q,optionalMissingRequiredFields:N,optionalZipInvalid:W,stateDefaultItem:z,stateOptions:X,zipDisplay:x,zipWrapperClass:A,onAddress1Input:D,onAddress2Input:C,onCityInput:F,onStateChange:q,onZipInput:u,onFieldsetFocusout:d=>{const I=Ze(n.value,d);w(d),!y.value&&I&&(v.value=!0)},normalizedPayload:a,validateForSubmit:async()=>y.value?(o.value=!0,B.value?{isValid:!0,payload:a.value}:(await t.nextTick(),He(n.value),{isValid:!1,payload:null})):c.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,m(),E(),i()}}}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]",ye=()=>{};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,y,g,D)=>(v.addEventListener(y,g,D),()=>v.removeEventListener(y,g,D)),o=t.computed(()=>{const v=ve(t.toValue(e[0])).filter(y=>y!=null);return v.every(y=>typeof y!="string")?v:void 0});return _e(()=>{var v,y;return[(v=(y=o.value)===null||y===void 0?void 0:y.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,y,g,D],C,F)=>{if(!v?.length||!y?.length||!g?.length)return;const q=je(D)?{...D}:D,E=v.flatMap(V=>y.flatMap(x=>g.map(f=>n(V,x,f,q))));F(()=>{E.forEach(V=>V())})},{flush:"post"})}function Ce(e,n,o={}){const{window:v=Me,ignore:y=[],capture:g=!0,detectIframe:D=!1,controls:C=!1}=o;if(!v)return C?{stop:ye,cancel:ye,trigger:ye}:ye;let F=!0;const q=i=>t.toValue(y).some(p=>{if(typeof p=="string")return Array.from(v.document.querySelectorAll(p)).some(S=>S===i.target||i.composedPath().includes(S));{const S=pe(p);return S&&(i.target===S||i.composedPath().includes(S))}});function E(i){const p=t.toValue(i);return p&&p.$.subTree.shapeFlag===16}function V(i,p){const S=t.toValue(i),$=S.$.subTree&&S.$.subTree.children;return $==null||!Array.isArray($)?!1:$.some(U=>U.el===p.target||p.composedPath().includes(U.el))}const x=i=>{const p=pe(e);if(i.target!=null&&!(!(p instanceof Element)&&E(e)&&V(e,i))&&!(!p||p===i.target||i.composedPath().includes(p))){if("detail"in i&&i.detail===0&&(F=!q(i)),!F){F=!0;return}n(i)}};let f=!1;const A=[be(v,"click",i=>{f||(f=!0,setTimeout(()=>{f=!1},0),x(i))},{passive:!0,capture:g}),be(v,"pointerdown",i=>{const p=pe(e);F=!q(i)&&!!(p&&!i.composedPath().includes(p))},{passive:!0}),D&&be(v,"blur",i=>{setTimeout(()=>{const p=pe(e);let S=v.document.activeElement;for(;S?.shadowRoot;)S=S.shadowRoot.activeElement;S?.tagName==="IFRAME"&&!p?.contains(v.document.activeElement)&&n(i)},0)},{passive:!0})].filter(Boolean),u=()=>A.forEach(i=>i());return C?{stop:u,cancel:()=>{F=!1},trigger:i=>{F=!0,x(i),F=!1}}:u}const we=e=>{if(e instanceof HTMLElement)return e;const n=e?.$el;return n instanceof HTMLElement?n:null},Je=e=>e instanceof HTMLButtonElement||e.getAttribute("role")==="button"||e.hasAttribute("aria-haspopup"),Qe=e=>{const n=t.ref(null),o=e.menuItemSelector??".k-menu-item:not(.k-disabled)",v=()=>we(e.triggerRef.value),y=()=>e.resolveFocusTarget?.()??we(e.focusTargetRef?.value),g=()=>{const f=y();if(f)return f.focus(),!0;const A=v();return A?.focus(),!!A},D=()=>{we(e.menuRef.value)?.querySelector(o)?.focus()},C=f=>{e.isOpen.value&&(n.value=f,e.requestHide())};Ce(e.menuRef,()=>C("outside-click"),{ignore:[e.triggerRef]}),e.manageAriaExpanded!==!1&&t.watch([e.isOpen,e.triggerRef],([f])=>{const A=v();!A||!Je(A)||A.setAttribute("aria-expanded",f?"true":"false")},{immediate:!0,flush:"post"});const F=()=>{if(e.isOpen.value){C("trigger-click");return}e.requestShow(),t.nextTick(D)};return{handleMenuSelect:(f,A)=>{C(f.event?.type?.startsWith("key")?"keyboard":"mouse-selection"),A?.(f)},handleActionButtonClick:F,handleActionButtonKeydown:f=>{if(f.key==="Enter"||f.code==="Space"){f.preventDefault(),F();return}if(f.key==="Escape"){if(f.preventDefault(),f.stopPropagation(),e.isOpen.value){C("keyboard");return}g()}},handleActionMenuEscape:f=>{f.preventDefault(),f.stopPropagation(),C("keyboard")},handlePopupClose:()=>{t.nextTick(()=>{n.value==="keyboard"?g():n.value==="mouse-selection"&&v()?.focus(),n.value=null})}}};function et(e){const n=t.ref(""),o=t.ref(void 0),v=t.ref(!!e.debug),y=t.ref(e.dateFormat??"mm/dd/yyyy"),g=t.computed(()=>!!e.required),D=1e3,C=t.ref(!1),F=["ArrowUp","ArrowDown"],q=["ArrowLeft","ArrowRight"],E=t.computed(()=>(n.value??"").replace(/\D/g,"")),V=r=>r<=2?"mm":r<=5?"dd":E.value.length<=10?"yyyy":"mm",x=t.computed(()=>{const r=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),f=t.computed(()=>{const r=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),A=t.computed(()=>{const r=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(4,"0")}),u=r=>{if(E.value.length===0){e.onChange({value:null,event:r});return}if(E.value.length<8){e.onChange({value:null,event:r});return}if((n.value??"").length===10&&E.value.length===8){const[h,P,Y]=n.value.split("/"),z=parseInt(h),X=parseInt(P),a=parseInt(Y);if(B(a,z,X)){const c=$(a,z,X);i(c)?e.onChange({value:c,event:r}):e.onChange({value:null,event:r})}else e.onChange({value:null,event:r})}},i=r=>{const h=e.min??void 0,P=e.max??void 0;return!(h&&r<h||P&&r>P)},p=t.computed(()=>{if((n.value??"").length===10&&E.value.length===8){const[r,h,P]=(n.value??"").split("/"),Y=parseInt(r),z=parseInt(h),X=parseInt(P);if(B(X,Y,z))return $(X,Y,z)}return null}),S=t.computed(()=>(n.value??"").length===10&&E.value.length===8),$=(r,h,P)=>{const Y=new Date(0);return Y.setFullYear(r,h-1,P),Y.setHours(0,0,0,0),Y},U=(r,h)=>$(r,h+1,0).getDate(),B=(r,h,P)=>h>=1&&h<=12&&r>=D&&P>=1&&P<=U(r,h),G=r=>{n.value=r.value;const h=r.event?.target;o.value=h?.selectionStart??0,u(r)},J=r=>{o.value=r.target.selectionStart??0},s=(r,h,P)=>{const Y=h?.selectionStart??o.value??0;o.value=Y;let z=parseInt(x.value),X=parseInt(f.value),a=parseInt(A.value);if(!(E.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=$(a,z,X);e.onChange({value:i(le)?le:null,event:P}),k({useRAF:!0});return}const R=V(Y);if(R==="mm")z=r==="ArrowUp"?z<12?z+1:1:z>1?z-1:12;else if(R==="dd"){const H=new Date(a,z,0).getDate();X=r==="ArrowUp"?X<H?X+1:1:X>1?X-1:H}else R==="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=$(parseInt(Q),parseInt(N),parseInt(W));O.toString()!=="Invalid Date"&&parseInt(Q)>=1e3?e.onChange({value:i(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(F.includes(r.key)){if(r.altKey)return;r.preventDefault(),r.stopPropagation();const h=r.target;s(r.key,h,r);return}},m=r=>{r.preventDefault();const h=r.deltaY<0?"ArrowUp":"ArrowDown";s(h,r.target,r)},b=r=>{const h=r.target;if(q.includes(r.key)){o.value=h?.selectionStart??0;return}if(F.includes(r.key)){if(r.altKey)return;o.value=h?.selectionStart??0}},T=r=>{C.value=!0,g.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&E.value.length===0&&(e.externalValue.value="");const h=r.target;h&&(o.value=h.selectionStart??0)},k=r=>{const h=()=>{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(h,r.delay);return}if(r?.useRAF){requestAnimationFrame(h);return}h()})};e.externalValue&&t.watch(e.externalValue,r=>{if(r){const h=new Date(r);if(h.toString()!=="Invalid Date"){const P=(h.getMonth()+1).toString().padStart(2,"0"),Y=h.getDate().toString().padStart(2,"0"),z=h.getFullYear().toString();n.value=`${P}/${Y}/${z}`,k({delay:50});return}}},{immediate:!0});const M=t.computed(()=>[["Date",`${x.value} / ${f.value} / ${A.value}`],["Digits only",E.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]]),K=t.computed(()=>{if(!g.value){if(!S.value)return!0;const h=p.value;return h?i(h):!1}if(!C.value)return!0;const r=p.value;return!S.value||!r?!1:i(r)}),Z=t.computed(()=>{if(!g.value){if(!S.value)return;const h=p.value;return h?i(h)?"valid":"out-of-bounds":"invalid-date"}if(!C.value)return;if(E.value.length===0||!S.value)return"incomplete";const r=p.value;return r?i(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 ${y.value} format.`;const h=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(h&&P)return`Must be between ${h} and ${P}.`;if(h)return`Must be on or after ${h}.`;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 h=r.closest(".k-datepicker");if(!h){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const P=h.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:M,placeholder:y,isValid:K,reason:t.readonly(Z),validationMessage:ne,digitsOnly:E,month:t.readonly(x),day:t.readonly(f),year:t.readonly(A),datePart:V,handleChange:G,handleKeyDown:w,handleWheel:m,handleKeyUp:b,handleClick:J,handleBlur:T,initStyling:oe}}function tt(e){const n=t.ref(""),o=t.ref(void 0),v=t.ref(!!e.debug),y=t.ref(!1),g=1440*60*1e3,D=365*g,C=new Date,F=new Date(C.getTime()-D),q=new Date(C.getTime()+D);e.min=e.min??F,e.max=e.max??q;const E=t.computed(()=>(n.value??"").replace(/\D/g,"")),V=(l,d)=>new Date(l,d,0).getDate(),x=(l,d,I)=>d>=1&&d<=12&&l>=1e3&&I>=1&&I<=V(l,d),f=l=>Date.UTC(l.getFullYear(),l.getMonth(),l.getDate()),A=l=>{if(!l)return null;const d=e.min??new Date(Date.now()-90*g),I=e.max??new Date,L=f(l);return L<f(d)||L>f(I)?null:l},u=(l,d)=>e.allowReverse??!1?!0:l<=d,i=t.computed(()=>(n.value?.length??0)>=23&&E.value.length>=16),p=l=>{if((l??"").length<23||E.value.length<16)return{start:null,end:null};const d=l.substring(0,10),I=l.substring(13,23),[L,ee,te]=d.split("/").map(ue=>parseInt(ue||"0",10)),[se,ce,de]=I.split("/").map(ue=>parseInt(ue||"0",10)),fe=new Date(te,L-1,ee),me=new Date(de,se-1,ce),ke=x(te,L,ee)&&fe.toString()!=="Invalid Date",Se=x(de,se,ce)&&me.toString()!=="Invalid Date";return{start:ke?fe:null,end:Se?me:null}},S=e.externalValid??t.ref(!0),$=t.computed(()=>p(n.value)),U=t.computed(()=>{const l=A($.value.start),d=A($.value.end);return{start:l,end:d}}),B=t.computed(()=>{if(!i.value)return;const l=U.value.start,d=U.value.end;if(!l||!d)return;const I=Math.abs(f(d)-f(l));return Math.round(I/864e5+1)}),G=t.ref(!1),J=t.computed(()=>{if(!G.value)return;const{start:l,end:d}=$.value;if(!i.value)return"incomplete";if(!l||!d)return"invalid-date";if(!U.value.start||!U.value.end)return"out-of-bounds";const I=U.value.start,L=U.value.end;return u(I,L)?typeof e.maxSpanDays=="number"&&B.value!==void 0&&B.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),s=t.computed(()=>{const l=J.value;return l===void 0||l==="valid"}),w=t.computed(()=>{const{min:l,max:d}=e,I=J.value;if(!I)return"";switch(I){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&&d?`Dates must be between ${k(l)} and ${k(d)}.`:"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"],T=(l,d)=>String(l).padStart(d,"0"),k=l=>`${T(l.getMonth()+1,2)}/${T(l.getDate(),2)}/${T(l.getFullYear(),4)}`,M=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"},K=(l,d,I)=>{const L=d?.selectionStart??o.value??0;o.value=L;const{start:ee,end:te}=p(n.value);if(!ee&&!te){const j=new Date,ie=k(j);n.value=`${ie} - ${ie}`,e.onChange({value:{start:j,end:j},event:I}),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=M(L);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 ge=V(j.getFullYear(),re);j.getDate()>ge&&j.setDate(ge)}else if(ie==="dd"){const ae=V(j.getFullYear(),j.getMonth()+1),re=j.getDate(),ge=l==="ArrowUp"?re<ae?re+1:1:re>1?re-1:ae;j.setDate(ge)}else if(ie==="yyyy"){const ae=j.getFullYear();j.setFullYear(l==="ArrowUp"?ae+1:Math.max(1,ae-1));const re=V(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=A(de),Ae=A(fe);ue&&Ae&&u(ue,Ae)?e.onChange({value:{start:ue,end:Ae},event:I}):e.onChange({value:null,event:I}),t.nextTick(()=>{requestAnimationFrame(()=>{const j=document.getElementById(e.id),ie=o.value??0;j&&(j.focus(),j.setSelectionRange(ie,ie))})})},Z=l=>{const{start:d,end:I}=p(n.value);if(!d||!I){e.onChange({value:null,event:l});return}const L=A(d),ee=A(I);if(!L||!ee){e.onChange({value:null,event:l});return}if(!u(L,ee)){e.onChange({value:null,event:l});return}e.onChange({value:{start:L,end:ee},event:l})},ne=l=>{const d=l.value??"",I=l.event;if(!d&&I&&I.type==="click"){X(I);return}n.value=d;const L=I?.target;o.value=L?.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 d=l.target;K(l.key,d,l);return}},h=l=>{l.preventDefault();const d=l.deltaY<0?"ArrowUp":"ArrowDown";K(d,l.target,l)},P=l=>{if(b.includes(l.key)||m.includes(l.key)){const d=l.target;o.value=d?.selectionStart??0}},Y=()=>{G.value=!0,(e.manageValid??!0)&&(S.value=s.value)},z=l=>{Y()},X=l=>{n.value="",o.value=0,e.onChange({value:null,event:l}),Y(),t.nextTick(()=>{const d=document.getElementById(e.id);d&&(d.focus(),d.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,l=>{const d=l?.start??null,I=l?.end??null;if(d&&I){if(n.value=`${k(d)} - ${k(I)}`,e.isOpen?.value&&y.value&&e.onRequestClose){const L=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),y.value=!1,Y()},L)}return}},{immediate:!0});const a=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),c=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),R=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:d}=p(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(c.value).padStart(2,"0")} / ${String(R.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:E.value},{label:"Mask complete",value:`${i.value}`},{label:"Parsed",value:`${l?l.toDateString():"-"} | ${d?d.toDateString():"-"}`},{label:"Valid (managed)",value:`${S.value??"-"}`},{label:"Span (days)",value:`${B.value??"-"}`},{label:"Reason",value:`${J.value??"-"}`},{label:"Cursor in",value:`${o.value??"-"} (${(()=>{const I=o.value??0,L=M(I);return`${L.side}.${L.part}`})()})`}]}),H=()=>{t.nextTick(()=>{const l=document.getElementById(e.id);if(!l){console.warn(`#${e.id} not found for styling.`);return}const d=l.closest("div");if(!d){console.warn(`Parent div of #${e.id} not found for styling.`);return}d.classList.contains("fk-daterangepicker")||d.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 I=[...l].reverse().find(te=>te.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!I)return;const L=I.querySelectorAll(".k-calendar-table");let ee=!1;L.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:E,valid:S,validComputed:t.readonly(s),reason:t.readonly(J),validationMessage:t.readonly(w),spanDays:t.readonly(B),month1:t.readonly(a),day1:t.readonly(c),year1:t.readonly(R),month2:t.readonly(N),day2:t.readonly(W),year2:t.readonly(Q),handleChange:ne,handleKeyDown:r,handleWheel:h,handleKeyUp:P,handleClick:oe,handleBlur:z,handleClear:X,onCalendarChange:()=>{y.value=!0},initStyling:H}}function nt(e){const n=t.ref(""),o=t.ref(void 0),v=t.ref(!!e.debug),y=t.ref(e.timeFormat??"hh:mm AM"),g=t.computed(()=>!!e.required),D=t.ref(!1),C=["ArrowUp","ArrowDown"],F=["ArrowLeft","ArrowRight"],q=t.computed(()=>(n.value??"").replace(/\D/g,"")),E={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},V=a=>a<=2?"hh":a<=5?"mm":"ampm",x=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",c=parseInt(a);return Math.min(Math.max(c,0),23)}),f=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",c=parseInt(a);return Math.min(Math.max(c,0),59)}),A=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),u=t.computed(()=>{const a=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),c=A.value;return a===12?c==="AM"?0:12:c==="PM"?a+12:a}),i=t.computed(()=>p.value?`${String(u.value).padStart(2,"0")}:${String(f.value).padStart(2,"0")}:00`:null),p=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),S=(a,c,R)=>{let N=a%12;return N===0&&(N=12),`${String(N).padStart(2,"0")}:${String(c).padStart(2,"0")} ${R}`},$=a=>{const c=a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!c)return null;const R=parseInt(c[1]),N=parseInt(c[2]),W=c[3].toUpperCase();if(R<1||R>12||N<0||N>59)return null;let Q=R%12;W==="PM"&&(Q+=12);const O=new Date;return O.setSeconds(0,0),O.setHours(Q),O.setMinutes(N),O},U=a=>{if(q.value.length===0){e.onChange({value:null,event:a});return}if(!p.value){e.onChange({value:null,event:a});return}const c=$(n.value);c&&G(c)?e.onChange({value:c,event:a}):e.onChange({value:null,event:a})},B=a=>a.getHours()*60+a.getMinutes(),G=a=>{const c=e.min??void 0,R=e.max??void 0,N=B(a);if(c){const W=B(c);if(N<W)return!1}if(R){const W=B(R);if(N>W)return!1}return!0},J=a=>{const c=a.getHours(),R=c>=12?"PM":"AM";n.value=S(c,a.getMinutes(),R)},s=(a,c)=>{e.onChange({value:a,event:c})},w=()=>{t.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const a=document.getElementById(e.id);if(a){a.focus();const c=(a.value??"").length;a.setSelectionRange(c,c)}})})})},m=a=>{const c=a?.event?.target;return c?c.closest(".k-time-now")?"now":c.closest(".k-time-accept")?"set":null:null},b=(a,c)=>{a&&G(a)?s(a,c):s(null,c)},T=(...a)=>{const c=a[0];if(!c)return;const R=m(c);if(R==="now"){const W=new Date;J(W),b(W,c),w();return}if(c?.value instanceof Date){const W=new Date(c.value);J(W),b(W,c),R==="set"&&w();return}if(c?.value===null){n.value="",s(null,c);return}n.value=c.value;const N=c.event?.target;o.value=N?.selectionStart??0;try{const W=o.value??0;if(V(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(c)},k=a=>{o.value=a.target.selectionStart??0},M=(a,c,R)=>{const N=c?.selectionStart??o.value??0;o.value=N;const W=V(N),Q=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!Q){if((n.value??"").length===0||q.value.length===0){const d=new Date,I=d.getHours(),L=I>=12?"PM":"AM";n.value=S(I,d.getMinutes(),L);const ee=$(n.value);b(ee,R),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 d=e.minuteStepRef?.value??e.minuteStep??1;if(d===1)a==="ArrowUp"?H=H<59?H+1:0:H=H>0?H-1:59;else if(a==="ArrowUp"){const I=H%d;let L=I===0?H+d:H+(d-I);L>=60&&(L=0),H=L}else{const I=H%d;let L=I===0?H-d:H-I;L<0&&(L=60-d),H=L}}else W==="ampm"&&(le=le==="AM"?"PM":"AM");n.value=`${String(O).padStart(2,"0")}:${String(H).padStart(2,"0")} ${le}`;const l=$(n.value);b(l,R),t.nextTick(()=>{requestAnimationFrame(()=>{const d=document.getElementById(e.id),I=o.value??0;d&&(d.focus(),d.setSelectionRange(I,I))})})},K=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(C.includes(a.key)){if(a.altKey)return;a.preventDefault(),a.stopPropagation();const c=a.target;M(a.key,c,a);return}},Z=a=>{a.preventDefault();const c=a.deltaY<0?"ArrowUp":"ArrowDown";M(c,a.target,a)},ne=a=>{const c=a.target;if(F.includes(a.key)){o.value=c?.selectionStart??0;return}if(C.includes(a.key)){if(a.altKey)return;o.value=c?.selectionStart??0}},oe=a=>{D.value=!0,g.value&&e.externalValue&&e.externalValue.value===void 0&&q.value.length===0&&(e.externalValue.value="");const c=a.target;c&&(o.value=c.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const c=new Date(a);if(c.toString()!=="Invalid Date"){const R=c.getHours(),N=R>=12?"PM":"AM";n.value=S(R,c.getMinutes(),N);return}}},{immediate:!0});const r=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",x.value],["Hour (24h)",u.value],["Minute",f.value],["Period",A.value],["Time (24h)",i.value??"--:--:--"],["Digits only",q.value],["Parsed Date",h.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]]),h=t.computed(()=>$(n.value)??null),P=t.computed(()=>{if(!g.value){if(!p.value)return!0;const c=h.value;return c?G(c):!1}if(!D.value)return!0;const a=h.value;return!p.value||!a?!1:G(a)}),Y=t.computed(()=>{if(!g.value){if(!p.value)return;const c=h.value;return c?G(c)?"valid":"out-of-bounds":"invalid-time"}if(!D.value)return;if(q.value.length===0||!p.value)return"incomplete";const a=h.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 ${y.value} format.`;const c={hour:"2-digit",minute:"2-digit"},R=e.min?e.min.toLocaleTimeString("en-US",c):null,N=e.max?e.max.toLocaleTimeString("en-US",c):null;if(a==="out-of-bounds"){if(R&&N)return`Must be between ${R} and ${N}.`;if(R)return`Must be ${R} 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 c=a.closest(".k-timepicker");if(!c){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const R=c.parentElement;if(!R){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}R.classList.contains("fk-timepicker")||R.classList.add("fk-timepicker")})};return t.onMounted(()=>{X()}),{raw:n,rules:E,debugEnabled:v,debugLines:r,placeholder:y,isValid:P,reason:t.readonly(Y),validationMessage:z,isComplete:p,inRangeTime:G,cursorPos:o,hour:t.readonly(x),hour24:t.readonly(u),minute:t.readonly(f),period:t.readonly(A),time24:t.readonly(i),parsedRawTime:t.readonly(h),handleChange:T,handleKeyDown:K,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(),y=E=>E?typeof e.initialFocus=="string"?E.querySelector(e.initialFocus)??E:typeof e.initialFocus=="function"?e.initialFocus(E)??E:E.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??E:null,{activate:g,deactivate:D}=Fe.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>y(n.value),...e.focusTrapOptions??{}});let C=null,F=t.ref(null);const q=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const E=(x,f)=>{const A=Array.from(x.querySelectorAll(f));if(!A.length)return null;const u=A.filter(i=>i.offsetParent!==null||i.getClientRects().length>0);return u[u.length-1]??A[A.length-1]??null},V=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const x of v){const f=E(V,x);if(f)return f}for(const x of v){const f=E(document,x);if(f)return f}return null};return Ce(n,E=>{F.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",E)}),t.watch(()=>e.isOpen.value,E=>{E?(F.value=null,t.nextTick(()=>{const V=q();V&&(n.value=V,setTimeout(()=>g(),0),C||(C=x=>{x.key==="Escape"&&(F.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",x))},document.addEventListener("keydown",C,!0)))})):(D(),C&&(document.removeEventListener("keydown",C,!0),C=null),n.value=null,F.value==="outside"&&t.nextTick(()=>{const V=()=>{const x=e.triggerEl?.value,f=x?.querySelector("input"),A=document.activeElement;A&&(A===f||x&&x.contains(A))&&(f??x)?.blur?.()};requestAnimationFrame(()=>setTimeout(V,0))}),e.returnFocusToTrigger!==!1&&F.value==="escape"&&e.triggerEl?.value&&t.nextTick(()=>{const V=()=>{const x=e.triggerEl?.value;if(!x)return;(x.querySelector("input")??x)?.focus?.()};requestAnimationFrame(()=>setTimeout(V,0))}))}),{popupRef:n,activate:g,deactivate:D,lastCloseReason:t.readonly(F),setPopupEl:E=>n.value=E}}_.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,Fe){"use strict";const Re=(e,n)=>{const o=t.ref(null);let v=!1,m=null,g=null;const D=[],P=".k-table-row[data-grid-row-index] [tabindex]",C=()=>{const u=e?.value?.$el;return u?u.closest(".k-grid"):null},L=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},A=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)||A(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")),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",S),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",S)})}}),w.removedNodes.forEach(p=>{if(p.nodeType===Node.ELEMENT_NODE){const b=p;b.classList.contains("k-animation-container")&&b.removeEventListener("keydown",S),b.querySelectorAll(".k-animation-container").forEach(k=>{k.removeEventListener("keydown",S)})}})})}),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(!L(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(P);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)}},$=()=>{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((A(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&&(A(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(),$(),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,P=[...Le,...m],C=(c,s)=>{if(!c)return!1;const i=P.join(",");return c.closest&&c.closest(i)?!0:g&&s?g(c,s):!1},L=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},A=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,$=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+$}},F=c=>{if(!c||typeof c.getBoundingClientRect!="function")return;const s=c.getBoundingClientRect();if(!s)return;const i=s.left,h=s.bottom,$=typeof window<"u"&&window.scrollX||0,U=typeof window<"u"&&window.scrollY||0;return{clientX:i,clientY:h,pageX:i+$,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,$=s.focusNode.nodeType===Node.ELEMENT_NODE?s.focusNode:s.focusNode.parentElement,U=!!(h&&i.contains(h)),B=!!($&&i.contains($));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??L(i),field:c.field,event:s||c,triggerType:"click",ctrlKey:!!s?.ctrlKey,shiftKey:!!s?.shiftKey,metaKey:!!s?.metaKey,altKey:!!s?.altKey,coordinates:A(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 $=c.target;if(!$)return;const U=$.closest(".k-table-row[data-grid-row-index], .k-table-row");if(!U||C($,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 S=m.value.length;return S===5||S===9}),D=t.computed(()=>o.value&&!g.value),P=t.computed(()=>!o.value||g.value),C=t.computed(()=>o.value),L=(S,M)=>{const c=Oe(M);t.nextTick(()=>{S.isConnected&&S.setSelectionRange(c,c)})};return{zipDisplay:n,submitted:o,errorMessage:v,wrapperClass:"fk-zip-textbox",zipRaw:m,isZipValid:g,showZipError:D,textBoxValid:P,textBoxValidate:C,handleZipInput:(...S)=>{const M=S[0],s=M?.event?.target,i=M?.value,h=Array.isArray(i)?i.join(""):String(i??""),$=s?.selectionStart!==void 0&&s.selectionStart!==null?Ne(s.value,s.selectionStart):h.replace(/\D/g,"").length;n.value=Ee(h),s&&L(s,$)},submitAndValidate:S=>{o.value=!0;const M=g.value;return!M&&S?.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,P=g.relatedTarget;(!D||!D.contains(P))&&(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 P(E){return t.computed(()=>!m.value||t.toValue(E))}function C(E){return Object.fromEntries(Object.entries(E).map(([S,M])=>[S,P(M)]))}function L(E){const S=t.toValue(E);if(!S)return;S.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function A(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:A,reset:F,createFieldValidity:P,createFieldValidationsMap:C,focusFirstInvalidField:L}}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:P}=o;return t.watch(m,L=>{e.zip=L}),{zipDisplay:v,isZipValid:g,zipWrapperClass:D,onZipInput:P,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:P,onCityInput:C,onStateChange:L,resetFormData:A}=Be(),F=`${e.addressId}-zip`,{zipDisplay:E,isZipValid:S,zipWrapperClass:M,onZipInput:c,resetZip:s}=Ye(g,F),{strictAddress1Valid:i,strictCityValid:h,strictStateValid:$,strictZipValid:U,strictAddressValid:B}=ze({formData:g,isZipValid:S}),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:$,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),V=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,"")===""),R=t.computed(()=>!d.value),N=t.computed(()=>!m.value&&R.value&&(!i.value||!h.value||!$.value)),W=t.computed(()=>{const f=g.zip.replace(/\D/g,"");return!m.value&&R.value&&f.length!==5&&f.length!==9}),Q=t.computed(()=>!m.value&&R.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:V,addressValid:Y,optionalFeedbackActive:O,optionalPartialInvalid:Q,optionalMissingRequiredFields:N,optionalZipInvalid:W,stateDefaultItem:z,stateOptions:X,zipDisplay:E,zipWrapperClass:M,onAddress1Input:D,onAddress2Input:P,onCityInput:C,onStateChange:L,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(),A(),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],P,C)=>{if(!v?.length||!m?.length||!g?.length)return;const L=je(D)?{...D}:D,A=v.flatMap(F=>m.flatMap(E=>g.map(S=>n(F,E,S,L))));C(()=>{A.forEach(F=>F())})},{flush:"post"})}function Ce(e,n,o={}){const{window:v=Me,ignore:m=[],capture:g=!0,detectIframe:D=!1,controls:P=!1}=o;if(!v)return P?{stop:ge,cancel:ge,trigger:ge}:ge;let C=!0;const L=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 A(s){const i=t.toValue(s);return i&&i.$.subTree.shapeFlag===16}function F(s,i){const h=t.toValue(s),$=h.$.subTree&&h.$.subTree.children;return $==null||!Array.isArray($)?!1:$.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)&&A(e)&&F(e,s))&&!(!i||i===s.target||s.composedPath().includes(i))){if("detail"in s&&s.detail===0&&(C=!L(s)),!C){C=!0;return}n(s)}};let S=!1;const M=[be(v,"click",s=>{S||(S=!0,setTimeout(()=>{S=!1},0),E(s))},{passive:!0,capture:g}),be(v,"pointerdown",s=>{const i=pe(e);C=!L(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 P?{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},P=()=>{we(e.menuRef.value)?.querySelector(o)?.focus()},C=i=>{e.isOpen.value&&(n.value=i,e.requestHide())};Ce(e.menuRef,()=>C("outside-click"),{ignore:[e.triggerRef]});let L=null;const A=()=>{L?.removeAttribute("aria-haspopup"),L?.removeAttribute("aria-expanded"),L=null},F=i=>{if(e.manageMenuTriggerAria===!1)return;const h=m();if(!h||!Je(h,v)){A();return}L!==h&&A(),h.setAttribute("aria-haspopup","menu"),h.setAttribute("aria-expanded",i?"true":"false"),L=h};t.watch([e.isOpen,e.triggerRef],([i])=>F(i),{immediate:!0,flush:"post"}),t.onUnmounted(A);const E=()=>{if(e.isOpen.value){C("trigger-click");return}e.requestShow(),t.nextTick(P)};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,P=t.ref(!1),C=["ArrowUp","ArrowDown"],L=["ArrowLeft","ArrowRight"],A=t.computed(()=>(n.value??"").replace(/\D/g,"")),F=r=>r<=2?"mm":r<=5?"dd":A.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")}),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(A.value.length===0){e.onChange({value:null,event:r});return}if(A.value.length<8){e.onChange({value:null,event:r});return}if((n.value??"").length===10&&A.value.length===8){const[y,V,Y]=n.value.split("/"),z=parseInt(y),X=parseInt(V),a=parseInt(Y);if(B(a,z,X)){const d=$(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,V=e.max??void 0;return!(y&&r<y||V&&r>V)},i=t.computed(()=>{if((n.value??"").length===10&&A.value.length===8){const[r,y,V]=(n.value??"").split("/"),Y=parseInt(r),z=parseInt(y),X=parseInt(V);if(B(X,Y,z))return $(X,Y,z)}return null}),h=t.computed(()=>(n.value??"").length===10&&A.value.length===8),$=(r,y,V)=>{const Y=new Date(0);return Y.setFullYear(r,y-1,V),Y.setHours(0,0,0,0),Y},U=(r,y)=>$(r,y+1,0).getDate(),B=(r,y,V)=>y>=1&&y<=12&&r>=D&&V>=1&&V<=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,V)=>{const Y=y?.selectionStart??o.value??0;o.value=Y;let z=parseInt(E.value),X=parseInt(S.value),a=parseInt(M.value);if(!(A.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=$(a,z,X);e.onChange({value:s(le)?le:null,event:V}),k({useRAF:!0});return}const R=F(Y);if(R==="mm")z=r==="ArrowUp"?z<12?z+1:1:z>1?z-1:12;else if(R==="dd"){const H=new Date(a,z,0).getDate();X=r==="ArrowUp"?X<H?X+1:1:X>1?X-1:H}else R==="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=$(parseInt(Q),parseInt(N),parseInt(W));O.toString()!=="Invalid Date"&&parseInt(Q)>=1e3?e.onChange({value:s(O)?O:null,event:V}):e.onChange({value:null,event:V}),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(L.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=>{P.value=!0,g.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&A.value.length===0&&(e.externalValue.value="");const y=r.target;y&&(o.value=y.selectionStart??0)},k=r=>{const y=()=>{const V=document.getElementById(e.id);if(!V)return;const Y=r?.pos??o.value??V.value.length;try{V.focus(),V.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 V=(y.getMonth()+1).toString().padStart(2,"0"),Y=y.getDate().toString().padStart(2,"0"),z=y.getFullYear().toString();n.value=`${V}/${Y}/${z}`,k({delay:50});return}}},{immediate:!0});const T=t.computed(()=>[["Date",`${E.value} / ${S.value} / ${M.value}`],["Digits only",A.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(!P.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(!P.value)return;if(A.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,V=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(r==="out-of-bounds"){if(y&&V)return`Must be between ${y} and ${V}.`;if(y)return`Must be on or after ${y}.`;if(V)return`Must be on or before ${V}.`}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 V=y.parentElement;if(V){if(V.classList.contains("fk-datepicker"))return;V.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:A,month:t.readonly(E),day:t.readonly(S),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,P=new Date,C=new Date(P.getTime()-D),L=new Date(P.getTime()+D);e.min=e.min??C,e.max=e.max??L;const A=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),S=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=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&&A.value.length>=16),i=l=>{if((l??"").length<23||A.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),$=t.computed(()=>i(n.value)),U=t.computed(()=>{const l=M($.value.start),f=M($.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}=$.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)},V=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"),R=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(R.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:A.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:A,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(R),month2:t.readonly(N),day2:t.readonly(W),year2:t.readonly(Q),handleChange:ne,handleKeyDown:r,handleWheel:y,handleKeyUp:V,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),P=["ArrowUp","ArrowDown"],C=["ArrowLeft","ArrowRight"],L=t.computed(()=>(n.value??"").replace(/\D/g,"")),A={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)}),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)}),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(S.value).padStart(2,"0")}:00`:null),i=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),h=(a,d,R)=>{let N=a%12;return N===0&&(N=12),`${String(N).padStart(2,"0")}:${String(d).padStart(2,"0")} ${R}`},$=a=>{const d=a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!d)return null;const R=parseInt(d[1]),N=parseInt(d[2]),W=d[3].toUpperCase();if(R<1||R>12||N<0||N>59)return null;let Q=R%12;W==="PM"&&(Q+=12);const O=new Date;return O.setSeconds(0,0),O.setHours(Q),O.setMinutes(N),O},U=a=>{if(L.value.length===0){e.onChange({value:null,event:a});return}if(!i.value){e.onChange({value:null,event:a});return}const d=$(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,R=e.max??void 0,N=B(a);if(d){const W=B(d);if(N<W)return!1}if(R){const W=B(R);if(N>W)return!1}return!0},J=a=>{const d=a.getHours(),R=d>=12?"PM":"AM";n.value=h(d,a.getMinutes(),R)},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 R=p(d);if(R==="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),R==="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,R)=>{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||L.value.length===0){const f=new Date,x=f.getHours(),K=x>=12?"PM":"AM";n.value=h(x,f.getMinutes(),K);const ee=$(n.value);b(ee,R),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=$(n.value);b(l,R),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(P.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(P.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&&L.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 R=d.getHours(),N=R>=12?"PM":"AM";n.value=h(R,d.getMinutes(),N);return}}},{immediate:!0});const r=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",E.value],["Hour (24h)",c.value],["Minute",S.value],["Period",M.value],["Time (24h)",s.value??"--:--:--"],["Digits only",L.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",V.value],["reason",Y.value],["validationMessage",z.value]]),y=t.computed(()=>$(n.value)??null),V=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(L.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"},R=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(R&&N)return`Must be between ${R} and ${N}.`;if(R)return`Must be ${R} 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 R=d.parentElement;if(!R){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}R.classList.contains("fk-timepicker")||R.classList.add("fk-timepicker")})};return t.onMounted(()=>{X()}),{raw:n,rules:A,debugEnabled:v,debugLines:r,placeholder:m,isValid:V,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(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=A=>A?typeof e.initialFocus=="string"?A.querySelector(e.initialFocus)??A:typeof e.initialFocus=="function"?e.initialFocus(A)??A:A.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??A:null,{activate:g,deactivate:D}=Fe.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>m(n.value),...e.focusTrapOptions??{}});let P=null,C=t.ref(null);const L=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const A=(E,S)=>{const M=Array.from(E.querySelectorAll(S));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 S=A(F,E);if(S)return S}for(const E of v){const S=A(document,E);if(S)return S}return null};return Ce(n,A=>{C.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",A)}),t.watch(()=>e.isOpen.value,A=>{A?(C.value=null,t.nextTick(()=>{const F=L();F&&(n.value=F,setTimeout(()=>g(),0),P||(P=E=>{E.key==="Escape"&&(C.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",E))},document.addEventListener("keydown",P,!0)))})):(D(),P&&(document.removeEventListener("keydown",P,!0),P=null),n.value=null,C.value==="outside"&&t.nextTick(()=>{const F=()=>{const E=e.triggerEl?.value,S=E?.querySelector("input"),M=document.activeElement;M&&(M===S||E&&E.contains(M))&&(S??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:A=>n.value=A}}_.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"})}));
|
|
2
2
|
//# sourceMappingURL=featherk-composables.umd.js.map
|