@featherk/composables 0.13.5 → 0.13.7
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/docs-manifest.js +24 -24
- package/dist/featherk-composables.es.js +1203 -1193
- 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/window/useWindow.d.ts +5 -1
- package/docs/window/useWindow.md +50 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(j,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],n):(j=typeof globalThis<"u"?globalThis:j||self,n(j.FeatherKComposables={},j.Vue,j.useFocusTrap))})(this,(function(j,n,Ne){"use strict";const ze=(e,t)=>{const o=n.ref(null);let u=!1,a=null,d=null;const w=[],S=".k-table-row[data-grid-row-index] [tabindex]",L=()=>{const c=e?.value?.$el;return c?c.closest(".k-grid"):null},z=c=>{const T=L();if(!T)return!1;const g=c.closest(".k-grid-aria-root");if(g)return T.contains(g);const D=c.closest(".k-grid-header, .k-grid-content, .k-grid-content-locked");return D?T.contains(D):!1},M=c=>c.key==="Enter"||c.code==="Enter"||c.code==="NumpadEnter",F=()=>e?.value?.columns,x=c=>{const T=c.key||c.code;([" ","Spacebar","Space"].includes(T)||M(c))&&(c.preventDefault(),c.stopPropagation(),o.value=c.target,c.target.click())},E=c=>{if(!o.value)return;if(c.code==="Escape"){c.stopPropagation(),o.value&&o.value.focus();return}const T=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),g=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(g){if(c.code==="Tab"){const D=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],C=t?.focusableMenuSelectors??D,k=Array.from(g.querySelectorAll(C.join(",")));if(k.length===0)return;const V=k.findIndex(_=>_===document.activeElement);let H;V===-1?H=0:c.shiftKey?H=(V-1+k.length)%k.length:H=(V+1)%k.length,c.preventDefault(),c.stopPropagation(),k[H]?.focus()}}else if(c.code==="ArrowUp"||c.code==="ArrowDown"){c.preventDefault(),c.stopPropagation();const D=T.findIndex(k=>k===document.activeElement);let C=D;c.code==="ArrowUp"?C=D>0?D-1:T.length-1:c.code==="ArrowDown"&&(C=D<T.length-1?D+1:0),T[C]?.focus();return}if(c.code==="Tab"){c.preventDefault(),c.stopPropagation();const D=o.value?.parentElement;(c.shiftKey?D?.previousElementSibling:D?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},N=()=>{a=new MutationObserver(c=>{c.forEach(T=>{T.addedNodes.forEach(g=>{if(g.nodeType===Node.ELEMENT_NODE){const D=g;if(D.classList.contains("k-animation-container")){const k=o.value;k&&(k.dataset.featherKSortable==="true"||n.nextTick(()=>{D.querySelectorAll(".k-columnmenu-item-wrapper").forEach(_=>{_.textContent?.toLowerCase().includes("sort")&&_.remove()})})),D.addEventListener("keydown",E),n.nextTick(()=>{const V=()=>{const H=Array.from(D.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(H.length===1)H[0].focus(),H[0].click(),V.attempts=0;else if(H.length>1){V.attempts=0;return}else V.attempts===void 0&&(V.attempts=0),V.attempts++<3&&setTimeout(V,200)};V()})}D.querySelectorAll(".k-animation-container").forEach(k=>{k.addEventListener("keydown",E)})}}),T.removedNodes.forEach(g=>{if(g.nodeType===Node.ELEMENT_NODE){const D=g;D.classList.contains("k-animation-container")&&D.removeEventListener("keydown",E),D.querySelectorAll(".k-animation-container").forEach(k=>{k.removeEventListener("keydown",E)})}})})}),a.observe(document.body,{childList:!0,subtree:!0})},p=c=>{const T=c.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(T)||c.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},s=c=>{if(!c.type||!c)return;const T=c.target;if(!T)return;const g=T.closest(".k-table-row[data-grid-row-index]");if(!z(T))return;const D=["ArrowLeft","ArrowRight"].includes(c.code);if(!(p(T)&&!(g&&D))){if(c.code==="Escape"){const C=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(C){c.preventDefault(),c.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(V=>V.setAttribute("tabindex","-1"))}catch{}C.setAttribute("tabindex","0"),C.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(c.code)){if(T.classList.contains("k-grid-header-menu")&&T.classList.contains("k-grid-column-menu")){o.value=T;return}if(g){if(["ArrowDown","ArrowUp"].includes(c.code)){c.preventDefault(),c.stopPropagation();const C=(V,H)=>{let _=H==="next"?V.nextElementSibling:V.previousElementSibling;for(;_;){const ee=_;try{if(ee.classList.contains("k-table-row"))return ee}catch{}_=H==="next"?_.nextElementSibling:_.previousElementSibling}return null},k=c.code==="ArrowDown"?C(g,"next"):C(g,"previous");k&&(g.setAttribute("tabindex","-1"),k.setAttribute("tabindex","0"),k.focus());return}if(["ArrowLeft","ArrowRight"].includes(c.code)){c.preventDefault(),c.stopPropagation();const C=g.querySelectorAll(S);if(C.length===0)return;let k=Array.from(C).findIndex(V=>V===document.activeElement);if(k===-1&&document.activeElement===g){C[0].focus();return}c.code==="ArrowRight"?k=k===C.length-1?0:k+1:c.code==="ArrowLeft"&&(k=k===0?C.length-1:k-1),C[k].focus();return}}}}},h=()=>{n.nextTick(()=>{const c=e.value?.$el;if(!c||typeof c.closest!="function")return;const T=c.closest(".k-grid");T&&T.classList.add("fk-grid")})},I=()=>{if(!d)try{const c=()=>{try{const D=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!D||D.length===0||D.filter(V=>V.getAttribute("tabindex")==="0").length===1)return;const k=D.find(V=>V===document.activeElement||V.contains(document.activeElement));if(D.forEach(V=>V.setAttribute("tabindex","-1")),k){k.setAttribute("tabindex","0");return}D[0].setAttribute("tabindex","0")}catch(D){console.error("ensureSingleTabindex error:",D)}},T=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));T.length>0&&T.forEach((D,C)=>{D.setAttribute("tabindex",C===0?"0":"-1")});const g=e.value.$el.querySelector(".k-table-tbody");g&&(d=new MutationObserver(()=>{c()}),d.observe(g,{childList:!0,subtree:!0}))}catch(c){console.error("Error setting up row navigation:",c)}},K=()=>{n.nextTick(()=>{const T=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");T&&T.forEach(g=>{g.setAttribute("role","button"),g.addEventListener("keydown",x)}),N(),A()})},P=()=>{const T=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");T&&T.forEach(g=>{g.removeEventListener("keydown",x)}),a&&(a.disconnect(),a=null),d&&(d.disconnect(),d=null),w.forEach(g=>g()),w.length=0},A=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((g,D)=>{if(g.dataset.featherKHeaderBound==="true")return;const C=g.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!C)return;const k=F();if(k&&k[D]){const l=k[D].field??"";g.setAttribute("data-feather-k-field",l),g.setAttribute("data-feather-k-filterable",k[D].filterable===!1?"false":"true"),g.setAttribute("data-feather-k-sortable",k[D].sortable===!1?"false":"true")}const V=g.dataset.featherKFilterable!=="false",H=g.dataset.featherKSortable!=="false";C.setAttribute("tabindex","-1"),V||H?g.style.cursor="pointer":g.style.cursor="default",V?(g.setAttribute("tabindex","0"),g.setAttribute("role","button"),g.setAttribute("aria-haspopup","menu")):(g.setAttribute("tabindex","0"),g.setAttribute("role","columnheader"),g.removeAttribute("aria-haspopup"));const _=l=>{l.target?.closest(".k-column-resizer")||(o.value=g,C.click())},ee=l=>{if(V)o.value=g,l.preventDefault(),l.stopPropagation(),_(l);else if(H){o.value=g;const b=g.querySelector(".k-link");b&&b.click()}};g.addEventListener("click",ee),w.push(()=>{g.removeEventListener("click",ee)});const ae=l=>{if((M(l)||l.code==="Space")&&(V||H)){if(l.preventDefault(),l.stopPropagation(),o.value=g,o.value.focus(),V)_(l);else if(H){const b=g.querySelector(".k-link");b&&b.click()}}};g.addEventListener("keydown",ae,!0),w.push(()=>{g.removeEventListener("keydown",ae,!0)}),g.dataset.featherKHeaderBound="true"});const T=document.querySelector(".k-grid-header .k-table-thead");if(T&&T.dataset.featherKHeaderBound!=="true"){const g=D=>{const C=D.target.closest("th");C&&(M(D)||D.code==="Space")&&C.dataset.featherKFilterable==="false"&&C.dataset.featherKSortable==="false"&&(D.preventDefault(),D.stopImmediatePropagation())};T.addEventListener("keydown",g,!0),w.push(()=>{T.removeEventListener("keydown",g,!0)}),T.dataset.featherKHeaderBound="true"}},$=function(c,T){const g=c?.event?.event.target,D=F();if(!g||!D)return;const C=g.classList.contains("k-grid-header-menu"),k=g.classList.contains("k-columnmenu-item"),V=D.find(H=>H.field===c?.event?.field)?.sortable&&!0;if(!C){if(k&&!V){c?.event?.sort?.filter(_=>_.field!==c?.event?.field);return}typeof T=="function"&&n.nextTick(()=>{o.value&&o.value.focus(),T(c),n.nextTick(()=>{A()})})}},X=()=>{if(!u)try{h(),I(),K(),u=!0}catch(c){console.error("initA11y failed:",c),P()}};return n.onBeforeUnmount(()=>{P()}),{activeFilterButton:o,handleGridKeyDown:s,handleSortChange:$,initA11y:X}},qe=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Ke=e=>!!e&&typeof e=="object"&&"field"in e,Te=(e,t)=>!e||typeof e!="object"?!1:qe(e)?e.filters.some(o=>Te(o,t)):Ke(e)?e.field===t:!1,Ue=e=>t=>e.value?.filters&&e.value.filters.some(o=>Te(o,t))?"active":"",Be=["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"],Ye=e=>{const{onRowAction:t,gridRef:o,dataItems:u,ignoreSelectors:a=[],shouldIgnoreTarget:d,enableKeyboardAction:w=!0}=e,S=[...Be,...a],L=(p,s)=>{if(!p)return!1;const h=S.join(",");return p.closest&&p.closest(h)?!0:d&&s?d(p,s):!1},z=p=>{const h=p?.closest?.(".k-table-row[data-grid-row-index]")?.getAttribute("data-grid-row-index");if(h==null)return;const I=parseInt(h,10);return Number.isNaN(I)?void 0:I},M=p=>{if(!p||typeof p.clientX!="number")return;const s=typeof window<"u"&&window.scrollX||0,h=typeof window<"u"&&window.scrollY||0,I=typeof window<"u"&&window.screenX||0,K=typeof window<"u"&&window.screenY||0;return{clientX:p.clientX,clientY:p.clientY,pageX:typeof p.pageX=="number"?p.pageX:p.clientX+s,pageY:typeof p.pageY=="number"?p.pageY:p.clientY+h,screenX:typeof p.screenX=="number"?p.screenX:p.clientX+I,screenY:typeof p.screenY=="number"?p.screenY:p.clientY+K}},F=p=>{if(!p||typeof p.getBoundingClientRect!="function")return;const s=p.getBoundingClientRect();if(!s)return;const h=s.left,I=s.bottom,K=typeof window<"u"&&window.scrollX||0,P=typeof window<"u"&&window.scrollY||0;return{clientX:h,clientY:I,pageX:h+K,pageY:I+P,screenX:h,screenY:I}},x=p=>{if(typeof window>"u")return!1;const s=window.getSelection();if(!s||s.isCollapsed||!s.toString().trim())return!1;if(p&&s.anchorNode&&s.focusNode){const h=p.closest(".k-table-row")||p.closest(".k-grid")||p,I=s.anchorNode.nodeType===Node.ELEMENT_NODE?s.anchorNode:s.anchorNode.parentElement,K=s.focusNode.nodeType===Node.ELEMENT_NODE?s.focusNode:s.focusNode.parentElement,P=!!(I&&h.contains(I)),A=!!(K&&h.contains(K));return P||A}return!0};return{handleRowClick:p=>{const s=p?.htmlEvent||p?.event||p?.nativeEvent||(p instanceof Event?p:void 0);if(s&&s.button!==void 0&&s.button!==0)return;const h=s?.target||p?.target;if(h&&L(h,s||p)||x(h))return;const I={dataItem:p.dataItem,rowIndex:p.rowIndex??z(h),field:p.field,event:s||p,triggerType:"click",ctrlKey:!!s?.ctrlKey,shiftKey:!!s?.shiftKey,metaKey:!!s?.metaKey,altKey:!!s?.altKey,coordinates:M(s)??F(h)};t(p.dataItem,I)},handleRowKeyDown:(p,s)=>{if(!w)return;const h=p.key||p.code;if(!(h==="Enter"||h==="NumpadEnter"||h===" "||h==="Space"||p.code==="Enter"||p.code==="NumpadEnter"||p.code==="Space"))return;const K=p.target;if(!K)return;const P=K.closest(".k-table-row[data-grid-row-index], .k-table-row");if(!P||L(K,p))return;p.preventDefault(),p.stopPropagation();const A=P.getAttribute("data-grid-row-index"),$=A!==null?parseInt(A,10):void 0;let X=s;if(X===void 0){const T=(Array.isArray(u)?u:u?.value)||o?.value?.props?.dataItems||o?.value?.dataItems;T&&$!==void 0&&$>=0&&$<T.length&&(X=T[$])}if(X===void 0)return;const c={dataItem:X,rowIndex:$,event:p,triggerType:"keyboard",ctrlKey:!!p.ctrlKey,shiftKey:!!p.shiftKey,metaKey:!!p.metaKey,altKey:!!p.altKey,coordinates:F(P)};t(X,c)},isIgnoredTarget:L}},He="Enter a valid ZIP code with exactly 5 or 9 digits.",xe=e=>{const t=e.replace(/\D/g,"").slice(0,9);return t.length>5?`${t.slice(0,5)}-${t.slice(5)}`:t},We=(e,t)=>e.slice(0,Math.max(0,t)).replace(/\D/g,"").length,Xe=e=>e<=5?e:Math.min(e+1,10),Me=e=>{const t=n.ref(xe(e.initialValue??"")),o=n.ref(!1),u=n.ref(e.errorMessage?.trim()||He),a=n.computed(()=>t.value.replace(/\D/g,"")),d=n.computed(()=>{const E=a.value.length;return E===5||E===9}),w=n.computed(()=>o.value&&!d.value),S=n.computed(()=>!o.value||d.value),L=n.computed(()=>o.value),z=(E,N)=>{const p=Xe(N);n.nextTick(()=>{E.isConnected&&E.setSelectionRange(p,p)})};return{zipDisplay:t,submitted:o,errorMessage:u,wrapperClass:"fk-zip-textbox",zipRaw:a,isZipValid:d,showZipError:w,textBoxValid:S,textBoxValidate:L,handleZipInput:(...E)=>{const N=E[0],s=N?.event?.target,h=N?.value,I=Array.isArray(h)?h.join(""):String(h??""),K=s?.selectionStart!==void 0&&s.selectionStart!==null?We(s.value,s.selectionStart):I.replace(/\D/g,"").length;t.value=xe(I),s&&z(s,K)},submitAndValidate:E=>{o.value=!0;const N=d.value;return!N&&E?.focus&&n.nextTick(()=>{document.getElementById(e.id)?.focus()}),N},buildPayload:()=>({zip:a.value})}};function Ie(e,t){const o=n.ref(!1);n.watchEffect(()=>{e.value?.setAttribute("aria-invalid",String(!t.isValid()))});function u(d){const w=e.value??d.currentTarget,S=d.relatedTarget;(!w||!w.contains(S))&&(o.value=!0)}function a(){o.value=!1}return{touched:o,onFocusout:u,reset:a}}function Ce(e,t){const o=n.ref(!1),u=n.ref(!1),a=n.computed(()=>n.toValue(t.submitted)||o.value),d=n.computed(()=>!a.value||t.isValid()),w=Ie(e,{isValid:()=>d.value});function S(x){return n.computed(()=>!a.value||n.toValue(x))}function L(x){return Object.fromEntries(Object.entries(x).map(([E,N])=>[E,S(N)]))}function z(x){const E=n.toValue(x);if(!E)return;E.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function M(x){if(u.value){u.value=!1;return}w.onFocusout(x),w.touched.value&&(o.value=!0)}function F(){o.value=!1,u.value=!0,w.reset()}return{touched:o,fieldsetValidate:a,onFocusout:M,reset:F,createFieldValidity:S,createFieldValidationsMap:L,focusFirstInvalidField:z}}const _e=[{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 ye(e){if(e&&typeof e=="object"&&"value"in e){const t=e.value;return typeof t=="string"?t:String(t??"")}return""}function Ze(){const e=n.reactive({address1:"",address2:"",city:"",state:null,zip:""});return{formData:e,onAddress1Input:(...w)=>{e.address1=ye(w[0])},onAddress2Input:(...w)=>{e.address2=ye(w[0])},onCityInput:(...w)=>{e.city=ye(w[0])},onStateChange:w=>{e.state=w.value},resetFormData:()=>{e.address1="",e.address2="",e.city="",e.state=null,e.zip=""}}}function je(e,t="zip"){const o=Me({id:t}),{zipDisplay:u,zipRaw:a,isZipValid:d,wrapperClass:w,handleZipInput:S}=o;return n.watch(a,z=>{e.zip=z}),{zipDisplay:u,isZipValid:d,zipWrapperClass:w,onZipInput:S,resetZip:()=>{u.value="",e.zip=""}}}function Ge(e){const t=n.computed(()=>e.formData.address1.trim()!==""),o=n.computed(()=>e.formData.city.trim()!==""),u=n.computed(()=>!!e.formData.state),a=n.computed(()=>n.toValue(e.isZipValid)),d=n.computed(()=>t.value&&o.value&&u.value&&a.value);return{strictAddress1Valid:t,strictCityValid:o,strictStateValid:u,strictZipValid:a,strictAddressValid:d}}function Je(e){if(!e)return;e.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function Qe(e,t){const o=e??t.currentTarget,u=t.relatedTarget;return!o||!o.contains(u)}function et(e){const t=n.ref(n.toValue(e.fieldsetRef));n.watchEffect(()=>{t.value=n.toValue(e.fieldsetRef)});const o=n.ref(!1),u=n.ref(!1),a=n.computed(()=>n.toValue(e.required)??!0),{formData:d,onAddress1Input:w,onAddress2Input:S,onCityInput:L,onStateChange:z,resetFormData:M}=Ze(),F=`${e.addressId}-zip`,{zipDisplay:x,isZipValid:E,zipWrapperClass:N,onZipInput:p,resetZip:s}=je(d,F),{strictAddress1Valid:h,strictCityValid:I,strictStateValid:K,strictZipValid:P,strictAddressValid:A}=Ge({formData:d,isZipValid:E}),$=Ce(t,{submitted:o,isValid:()=>A.value}),{touched:X,fieldsetValidate:c,onFocusout:T,reset:g}=$,D=$.createFieldValidationsMap({address1:h,city:I,state:K,zip:P,address:A}),{address1:C,city:k,state:V,zip:H,address:_}=D,ee=n.computed(()=>a.value?c.value:!1),ae=n.computed(()=>a.value?C.value:!0),l=n.computed(()=>a.value?k.value:!0),b=n.computed(()=>a.value?V.value:!0),U=n.computed(()=>a.value?H.value:!0),m=n.computed(()=>a.value?_.value:!0),y={value:null,label:"State"},q=_e.map(({label:v,value:O})=>({label:v,value:O})),r=n.computed(()=>({address1:d.address1.trim(),address2:d.address2.trim(),city:d.city.trim(),state:(d.state??"").trim().toUpperCase(),zip:d.zip.replace(/\D/g,"")})),f=n.computed(()=>d.address1.trim()===""&&d.address2.trim()===""&&d.city.trim()===""&&(d.state??"").trim()===""&&d.zip.replace(/\D/g,"")===""),R=n.computed(()=>!f.value),B=n.computed(()=>!a.value&&R.value&&(!h.value||!I.value||!K.value)),Y=n.computed(()=>{const v=d.zip.replace(/\D/g,"");return!a.value&&R.value&&v.length!==5&&v.length!==9}),J=n.computed(()=>!a.value&&R.value&&!A.value),Z=n.computed(()=>!a.value&&J.value&&(u.value||o.value));return n.watch(r,()=>{a.value||(u.value=!1)}),n.watch(a,v=>{v||(o.value=!1,u.value=!1,g())}),{formData:d,submitted:o,touched:X,addressValidate:ee,address1Valid:ae,cityValid:l,stateValid:b,zipValid:U,addressValid:m,optionalFeedbackActive:Z,optionalPartialInvalid:J,optionalMissingRequiredFields:B,optionalZipInvalid:Y,stateDefaultItem:y,stateOptions:q,zipDisplay:x,zipWrapperClass:N,onAddress1Input:w,onAddress2Input:S,onCityInput:L,onStateChange:z,onZipInput:p,onFieldsetFocusout:v=>{const O=Qe(t.value,v);T(v),!a.value&&O&&(u.value=!0)},normalizedPayload:r,validateForSubmit:async()=>a.value?(o.value=!0,A.value?{isValid:!0,payload:r.value}:(await n.nextTick(),Je(t.value),{isValid:!1,payload:null})):f.value||A.value?(o.value=!1,{isValid:!0,payload:r.value}):(o.value=!0,{isValid:!1,payload:null}),reset:()=>{o.value=!1,u.value=!1,g(),M(),s()}}}const Re=e=>e==="left"?"right":e==="right"?"left":"center",Fe=e=>e==="top"?"bottom":e==="bottom"?"top":"center",we=(e,t,o,u)=>{const a=e.left+(o.horizontal==="right"?e.width:o.horizontal==="center"?e.width/2:0),d=e.top+(o.vertical==="bottom"?e.height:o.vertical==="center"?e.height/2:0),w=t?u.horizontal==="right"?t.width:u.horizontal==="center"?t.width/2:0:0,S=t?u.vertical==="bottom"?t.height:u.vertical==="center"?t.height/2:0:0;return{left:a-w,top:d-S}},Pe=(e,t,o,u)=>t>=u-o?o:Math.min(Math.max(e,o),u-t),Le=({anchor:e,popup:t,anchorAlign:o,popupAlign:u,bounds:a,collision:d})=>{const w=we(e,t,o,u);if(!t)return w;let{left:S,top:L}=w;if(d.horizontal==="fit")S=Pe(S,t.width,a.left,a.right);else{const z=S+t.width-a.right,M=a.left-S;if(z>0||M>0){const F=we(e,t,{horizontal:Re(o.horizontal),vertical:o.vertical},{horizontal:Re(u.horizontal),vertical:u.vertical}),x=Math.max(z,0)+Math.max(M,0);Math.max(F.left+t.width-a.right,0)+Math.max(a.left-F.left,0)<x&&(S=F.left)}}if(d.vertical==="fit")L=Pe(L,t.height,a.top,a.bottom);else{const z=L+t.height-a.bottom,M=a.top-L;if(z>0||M>0){const F=we(e,t,{horizontal:o.horizontal,vertical:Fe(o.vertical)},{horizontal:u.horizontal,vertical:Fe(u.vertical)}),x=Math.max(z,0)+Math.max(M,0);Math.max(F.top+t.height-a.bottom,0)+Math.max(a.top-F.top,0)<x&&(L=F.top)}}return{left:S,top:L}},tt=(e="fkid")=>{const t=`${e}-${n.useId()}`;return{instanceId:t,compose:(...u)=>[t,...u].filter(a=>a!=null).map(String).join("-")}},nt=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ot=Object.prototype.toString,rt=e=>ot.call(e)==="[object Object]",he=()=>{};function be(e){return Array.isArray(e)?e:[e]}function at(e,t,o){return n.watch(e,t,{...o,immediate:!0})}const $e=nt?window:void 0;function me(e){var t;const o=n.toValue(e);return(t=o?.$el)!==null&&t!==void 0?t:o}function Se(...e){const t=(u,a,d,w)=>(u.addEventListener(a,d,w),()=>u.removeEventListener(a,d,w)),o=n.computed(()=>{const u=be(n.toValue(e[0])).filter(a=>a!=null);return u.every(a=>typeof a!="string")?u:void 0});return at(()=>{var u,a;return[(u=(a=o.value)===null||a===void 0?void 0:a.map(d=>me(d)))!==null&&u!==void 0?u:[$e].filter(d=>d!=null),be(n.toValue(o.value?e[1]:e[0])),be(n.unref(o.value?e[2]:e[1])),n.toValue(o.value?e[3]:e[2])]},([u,a,d,w],S,L)=>{if(!u?.length||!a?.length||!d?.length)return;const z=rt(w)?{...w}:w,M=u.flatMap(F=>a.flatMap(x=>d.map(E=>t(F,x,E,z))));L(()=>{M.forEach(F=>F())})},{flush:"post"})}function Ve(e,t,o={}){const{window:u=$e,ignore:a=[],capture:d=!0,detectIframe:w=!1,controls:S=!1}=o;if(!u)return S?{stop:he,cancel:he,trigger:he}:he;let L=!0;const z=s=>n.toValue(a).some(h=>{if(typeof h=="string")return Array.from(u.document.querySelectorAll(h)).some(I=>I===s.target||s.composedPath().includes(I));{const I=me(h);return I&&(s.target===I||s.composedPath().includes(I))}});function M(s){const h=n.toValue(s);return h&&h.$.subTree.shapeFlag===16}function F(s,h){const I=n.toValue(s),K=I.$.subTree&&I.$.subTree.children;return K==null||!Array.isArray(K)?!1:K.some(P=>P.el===h.target||h.composedPath().includes(P.el))}const x=s=>{const h=me(e);if(s.target!=null&&!(!(h instanceof Element)&&M(e)&&F(e,s))&&!(!h||h===s.target||s.composedPath().includes(h))){if("detail"in s&&s.detail===0&&(L=!z(s)),!L){L=!0;return}t(s)}};let E=!1;const N=[Se(u,"click",s=>{E||(E=!0,setTimeout(()=>{E=!1},0),x(s))},{passive:!0,capture:d}),Se(u,"pointerdown",s=>{const h=me(e);L=!z(s)&&!!(h&&!s.composedPath().includes(h))},{passive:!0}),w&&Se(u,"blur",s=>{setTimeout(()=>{const h=me(e);let I=u.document.activeElement;for(;I?.shadowRoot;)I=I.shadowRoot.activeElement;I?.tagName==="IFRAME"&&!h?.contains(u.document.activeElement)&&t(s)},0)},{passive:!0})].filter(Boolean),p=()=>N.forEach(s=>s());return S?{stop:p,cancel:()=>{L=!1},trigger:s=>{L=!0,x(s),L=!1}}:p}const Oe=e=>{let t=null;const o=()=>{t?.disconnect(),t=null};return typeof window<"u"&&typeof window.IntersectionObserver=="function"&&n.watch([e.target,()=>e.root()],([a,d])=>{o(),a&&(t=new IntersectionObserver(([w])=>{w&&e.onChange(w)},{root:d,threshold:e.threshold??1}),t.observe(a))},{immediate:!0}),n.onUnmounted(o),{disconnect:o}},lt=".k-table-row",ue=e=>{if(e instanceof HTMLElement)return e;const t=e?.$el;return t instanceof HTMLElement?t:null},it=(e,t)=>t==="row"?e.matches("tr.k-table-row"):!e.matches("tr.k-table-row"),st=(e,t)=>{console.warn(`usePopupMenu: triggerMode "${t}" does not match resolved element <${e.tagName.toLowerCase()}${e.className?`.${e.className.split(" ").join(".")}`:""}>; ARIA management skipped.`)},ct=e=>{let t=e.parentElement,o=null;for(;t;){const{overflow:u,overflowX:a,overflowY:d}=window.getComputedStyle(t),w=/auto|scroll|overlay/.test(`${u} ${a}`),S=/auto|scroll|overlay/.test(`${u} ${d}`);if((w||S)&&(o??=t),w&&t.scrollWidth>t.clientWidth||S&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return o},ut=e=>{const t=n.ref(null),o=e.menuItemSelector??".k-menu-item:not(.k-disabled)",u=e.triggerMode,a=e.anchor===!0?{}:e.anchor,d=a?.activationPoint?a.activationPoint===!0?{}:a.activationPoint:null,w=n.shallowRef(null),S=n.shallowRef(null),L=a?.anchorAlign??{horizontal:"left",vertical:"bottom"},z=a?.popupAlign??{horizontal:"left",vertical:"top"},M=a?.collision??{horizontal:"flip",vertical:"flip"},F=n.shallowRef(null),x=()=>ue(e.triggerRef.value),E=n.computed(()=>x()),N=n.computed(()=>a&&a.hideWhenAnchorClipped!==!1?E.value:null),p=()=>{const m=a?.clipRoot?n.toValue(a.clipRoot):null;if(m){const y=m.getBoundingClientRect();return{left:y.left,top:y.top,right:y.right,bottom:y.bottom}}return{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},s=n.computed(()=>{const m=w.value;if(!e.isOpen.value||!m)return{left:0,top:0};const y=p(),q=Le({anchor:m,popup:F.value,anchorAlign:L,popupAlign:z,bounds:y,collision:M});return{left:q.left+window.scrollX,top:q.top+window.scrollY}}),h=()=>{const m=e.resolveFocusTarget?.()??ue(e.focusTargetRef?.value);return m||(e.focusTargetContainerSelector?x()?.closest(e.focusTargetContainerSelector)??null:null)},I=(m,y)=>{if(!d)return!1;const q=ue(m);if(!q)return S.value=null,!1;const r=q.getBoundingClientRect();if(y.triggerType==="keyboard"){const f=d.keyboardPosition,R=f?.y??"center",B=typeof R=="number"?R:R==="top"?0:R==="bottom"?r.height:r.height/2;return S.value={trigger:q,point:{x:f?.x??8,y:B},hasMatchedTrigger:!1},!0}return y.coordinates?(S.value={trigger:q,point:{x:y.coordinates.clientX-r.left+(d.pointerOffset?.x??0),y:y.coordinates.clientY-r.top+(d.pointerOffset?.y??0)},hasMatchedTrigger:!1},!0):(S.value=null,!1)},K=()=>{if(u!=="button")return null;if(e.escapeFocusTarget)return e.escapeFocusTarget();const m=e.escapeFocusContainerSelector??lt;return(x()??document.activeElement)?.closest(m)??null},P=()=>{const m=h()??K();if(m)return m.focus(),!0;const y=x();return y?.focus(),!!y},A=()=>{ue(e.menuRef.value)?.querySelector(o)?.focus({preventScroll:!0})},$=n.shallowRef(null),X=n.shallowRef(null);let c=!1;const T=()=>{const m=t.value;if(m==="keyboard"||m==="escape"){const y=$.value??X.value;y?.focus(),m==="keyboard"&&y&&y===X.value&&(c=!0)}else t.value==="mouse-selection"&&X.value?.focus();t.value=null,$.value=null,X.value=null},g=m=>{e.isOpen.value&&(t.value=m,$.value=h()??(m==="escape"?K():null),X.value=x(),H(!1),e.requestHide(),n.nextTick(T))};n.watch([E,S],([m],y,q)=>{if(!a||!m){w.value=null;return}let r=null;const f=()=>{r=null;const Y=S.value;if(d){Y&&Y.trigger===m?Y.hasMatchedTrigger=!0:Y?.hasMatchedTrigger&&(Y.trigger=m);const J=m.getBoundingClientRect();w.value=Y?.trigger===m?new DOMRect(J.left+Y.point.x,J.top+Y.point.y,0,0):null;return}w.value=a.getRect?.(m)??m.getBoundingClientRect()},R=()=>{r===null&&(r=window.requestAnimationFrame(f))},B=typeof window.ResizeObserver=="function"?new window.ResizeObserver(R):null;B?.observe(m),window.addEventListener("scroll",R,{capture:!0,passive:!0}),window.addEventListener("resize",R,{passive:!0}),R(),q(()=>{r!==null&&window.cancelAnimationFrame(r),B?.disconnect(),window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)})},{immediate:!0,flush:"post"});const D=()=>{const m=ue(e.popupContentRef?.value??e.menuRef.value);return m?.closest(".k-popup")??m};a&&n.watch(e.isOpen,(m,y,q)=>{if(!m){F.value=null;return}let r=null;const f=()=>{r=null;const J=D();F.value=J?.getBoundingClientRect()??null},R=()=>{r===null&&(r=window.requestAnimationFrame(f))},B=D(),Y=B&&typeof window.ResizeObserver=="function"?new window.ResizeObserver(R):null;Y?.observe(B),R(),q(()=>{r!==null&&window.cancelAnimationFrame(r),Y?.disconnect()})},{immediate:!0,flush:"post"}),Oe({target:N,root:()=>a?.clipRoot?n.toValue(a.clipRoot):E.value?ct(E.value):null,threshold:a?.intersectionThreshold??(d?0:.5),onChange:m=>{m.isIntersecting||g("anchor-hidden")}}),Ve(e.menuRef,()=>g("outside-click"),{ignore:[E]});let C=null,k=null;const V=()=>{C?.isConnected&&C.setAttribute("aria-expanded","false"),C=null},H=m=>{if(e.manageMenuTriggerAria===!1)return;const y=E.value;if(!y){C?.isConnected&&C.setAttribute("aria-expanded",m?"true":"false");return}if(!it(y,u)){st(y,u),V();return}C&&C!==y&&V(),y.setAttribute("aria-expanded",m?"true":"false"),C=y},_=()=>{const m=ue(e.menuRef.value),y=m?.matches('[role="menubar"]')?m:m?.querySelector('[role="menubar"]'),q=n.toValue(e.menuLabel)?.trim();k&&k!==y&&k.removeAttribute("aria-label"),y&&(q?y.setAttribute("aria-label",q):y.removeAttribute("aria-label")),k=y??null};n.watch([e.isOpen,e.triggerRef],([m])=>{H(m),!m&&d&&(S.value=null,w.value=null)},{immediate:!0,flush:"post"}),n.watch([e.isOpen,e.menuRef,()=>n.toValue(e.menuLabel)],_,{immediate:!0,flush:"post"}),n.onUnmounted(()=>{S.value=null,V(),k?.removeAttribute("aria-label")}),n.watch(e.isOpen,m=>{m&&A()},{flush:"post"});const ee=(...m)=>{const y=m[0];if(c){c=!1;return}if(e.isOpen.value){g("trigger-click");return}e.requestShow(y)};return{setAnchorActivation:I,handleMenuSelect:(m,y)=>{g(m.event?.type?.startsWith("key")?"keyboard":"mouse-selection"),y?.(m)},handleTriggerClick:ee,handleTriggerKeydown:(...m)=>{const y=m[0],q=m[1];if(y.key==="Enter"||y.code==="Space"){y.preventDefault(),ee(q);return}if(y.key==="Escape"){if(y.preventDefault(),y.stopPropagation(),e.isOpen.value){g("escape");return}P()}},handleMenuEscape:m=>{m.preventDefault(),m.stopPropagation(),g("escape")},handlePopupClose:()=>{n.nextTick(T)},offset:s}},dt=()=>{const e=new Set;return{register:a=>{e.add(a),n.onUnmounted(()=>e.delete(a))},deactivateOthers:a=>{e.forEach(d=>{d!==a&&d.deactivate()})},deactivateAll:()=>{e.forEach(a=>a.deactivate())}}},ft=e=>{if(e instanceof HTMLElement)return e;const t=e&&"$el"in e?e.$el:null;return t instanceof HTMLElement?t:null},pt=()=>{const e=n.shallowReactive(new Map),t=n.ref(null),o=(S,L)=>{const z=ft(L);z?e.set(S,z):e.delete(S)},u=S=>e.get(S)??null,a=S=>{t.value=S},d=()=>{t.value=null},w=S=>t.value===S;return{activeId:n.readonly(t),isActive:n.computed(()=>t.value!==null),activeElement:n.computed(()=>t.value!==null?u(t.value):null),register:o,resolve:u,activate:a,deactivate:d,isIdActive:w}},ke={title:"My Window",draggable:!0,resizable:!0,closable:!0,fixed:!0,minimizeButton:!0,maximizeButton:!0,initialWidth:500,initialHeight:500,width:500,height:500,left:void 0,top:void 0},mt=e=>e==="DEFAULT"||e==="MINIMIZED"||e==="FULLSCREEN",gt=(e,t,o)=>Math.max(e-t-o,0);function ht(e={}){n.isRef(e.settings)&&(e.settings.value={...ke,...e.settings.value});const t=n.isRef(e.settings)?e.settings:n.ref({...ke,...e.settings}),o=n.shallowRef(null),u=n.ref(!1),a=n.ref(e.initialStage??"DEFAULT"),d=n.ref(!1),w=n.ref(!1),S=n.ref(0),L=n.ref(0),z=async P=>{const A=t.value.left!==void 0&&t.value.top!==void 0;if(P?.resetPosition||!A){const $=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize),X=Number.isFinite($)?$:16,c=t.value.fixed?0:window.scrollX,T=t.value.fixed?0:window.scrollY;t.value.left=void 0,t.value.top=void 0,t.value.width=void 0,t.value.height=void 0,S.value=c+gt(window.innerWidth,t.value.initialWidth,X),L.value=T+X,u.value=!0,await n.nextTick(),t.value.width=t.value.initialWidth,t.value.height=t.value.initialHeight}else u.value=!0;e.onOpen?.()},M=()=>{a.value="DEFAULT",u.value=!1,e.onClose?.()},F=(...P)=>{const A=P[2];if(typeof A!="object"||A===null||!("state"in A)||!mt(A.state))return;const $=A.state;$!==a.value&&(a.value=$,e.onStageChange?.($))},x=(...P)=>{const A=P[0];if(typeof A=="object"&&A!==null&&"drag"in A&&"left"in A&&"top"in A&&"width"in A&&"height"in A&&typeof A.left=="number"&&typeof A.top=="number"&&typeof A.width=="number"&&typeof A.height=="number"){const $=A,X=o.value?.$el,T=(X instanceof Element?X.querySelector(".k-window-titlebar"):null)?.getBoundingClientRect(),g=T?.width??$.width,D=T?.height??$.height,C=t.value.fixed?0:window.scrollX,k=t.value.fixed?0:window.scrollY,V=C+document.documentElement.clientWidth,H=k+document.documentElement.clientHeight,_=Math.max(V-g,C),ee=Math.max(H-D,k);t.value.left=Math.min(Math.max($.left,C),_),t.value.top=Math.min(Math.max($.top,k),ee),d.value=$.drag&&!$.end,e.onMove?.($)}},E=(...P)=>{const A=P[0];if(typeof A=="object"&&A!==null&&"drag"in A&&"left"in A&&"top"in A&&"width"in A&&"height"in A&&typeof A.left=="number"&&typeof A.top=="number"&&typeof A.width=="number"&&typeof A.height=="number"){const $=A;t.value.left=$.left,t.value.top=$.top,t.value.width=$.width,t.value.height=$.height,w.value=$.drag&&!$.end,e.onResize?.($)}},N=P=>{P.target instanceof Element&&P.target.closest(".k-resize-handle")&&P.preventDefault()};let p;const s=()=>{p?.(),p=void 0};n.watch(o,P=>{s();const A=P?.$el;A instanceof HTMLElement&&(A.addEventListener("pointerdown",N,{capture:!0}),p=()=>A.removeEventListener("pointerdown",N,{capture:!0}))},{flush:"post"}),n.onScopeDispose(s);const h=n.computed(()=>{const P=["fk-window"];return t.value.draggable&&a.value!=="FULLSCREEN"&&P.push("fk-window-can-drag"),d.value&&P.push("fk-window-is-dragging"),w.value&&P.push("fk-window-is-resizing"),t.value.fixed&&P.push("fk-window-fixed"),t.value.minimizeButton||P.push("fk-window-hide-minimize"),t.value.maximizeButton||P.push("fk-window-hide-maximize"),t.value.closable||P.push("fk-window-hide-close"),P.join(" ")}),I=n.computed(()=>({title:t.value.title,draggable:t.value.draggable,resizable:t.value.resizable,left:t.value.left,top:t.value.top,initialLeft:S.value,initialTop:L.value,initialWidth:t.value.initialWidth,initialHeight:t.value.initialHeight,width:t.value.width,height:t.value.height,stage:a.value,windowClass:h.value}));return{windowRef:o,settings:t,visible:u,stage:a,isDragging:d,isResizing:w,props:I,events:{move:x,resize:E,stagechange:F,close:M},open:z,close:M}}function vt(e){const t=n.ref(""),o=n.ref(void 0),u=n.ref(!!e.debug),a=n.ref(e.dateFormat??"mm/dd/yyyy"),d=n.computed(()=>!!e.required),w=1e3,S=n.ref(!1),L=["ArrowUp","ArrowDown"],z=["ArrowLeft","ArrowRight"],M=n.computed(()=>(t.value??"").replace(/\D/g,"")),F=l=>l<=2?"mm":l<=5?"dd":M.value.length<=10?"yyyy":"mm",x=n.computed(()=>{const l=t.value&&t.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(l).toString().padStart(2,"0")}),E=n.computed(()=>{const l=t.value&&t.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(l).toString().padStart(2,"0")}),N=n.computed(()=>{const l=t.value&&t.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(l).toString().padStart(4,"0")}),p=l=>{if(M.value.length===0){e.onChange({value:null,event:l});return}if(M.value.length<8){e.onChange({value:null,event:l});return}if((t.value??"").length===10&&M.value.length===8){const[b,U,m]=t.value.split("/"),y=parseInt(b),q=parseInt(U),r=parseInt(m);if(A(r,y,q)){const f=K(r,y,q);s(f)?e.onChange({value:f,event:l}):e.onChange({value:null,event:l})}else e.onChange({value:null,event:l})}},s=l=>{const b=e.min??void 0,U=e.max??void 0;return!(b&&l<b||U&&l>U)},h=n.computed(()=>{if((t.value??"").length===10&&M.value.length===8){const[l,b,U]=(t.value??"").split("/"),m=parseInt(l),y=parseInt(b),q=parseInt(U);if(A(q,m,y))return K(q,m,y)}return null}),I=n.computed(()=>(t.value??"").length===10&&M.value.length===8),K=(l,b,U)=>{const m=new Date(0);return m.setFullYear(l,b-1,U),m.setHours(0,0,0,0),m},P=(l,b)=>K(l,b+1,0).getDate(),A=(l,b,U)=>b>=1&&b<=12&&l>=w&&U>=1&&U<=P(l,b),$=l=>{t.value=l.value;const b=l.event?.target;o.value=b?.selectionStart??0,p(l)},X=l=>{o.value=l.target.selectionStart??0},c=(l,b,U)=>{const m=b?.selectionStart??o.value??0;o.value=m;let y=parseInt(x.value),q=parseInt(E.value),r=parseInt(N.value);if(!(M.value.length>=8)||!A(r,y,q)){const G=e.defaultValue??new Date;y=G.getMonth()+1,q=G.getDate(),r=G.getFullYear(),t.value=`${String(y).padStart(2,"0")}/${String(q).padStart(2,"0")}/${String(r)}`;const le=K(r,y,q);e.onChange({value:s(le)?le:null,event:U}),k({useRAF:!0});return}const R=F(m);if(R==="mm")y=l==="ArrowUp"?y<12?y+1:1:y>1?y-1:12;else if(R==="dd"){const G=new Date(r,y,0).getDate();q=l==="ArrowUp"?q<G?q+1:1:q>1?q-1:G}else R==="yyyy"&&(r=l==="ArrowUp"?r+1:Math.max(1,r-1));t.value=`${String(y).padStart(2,"0")}/${String(q).padStart(2,"0")}/${String(r)}`;const[B,Y,J]=t.value.split("/"),Z=K(parseInt(J),parseInt(B),parseInt(Y));Z.toString()!=="Invalid Date"&&parseInt(J)>=1e3?e.onChange({value:s(Z)?Z:null,event:U}):e.onChange({value:null,event:U}),k({useRAF:!0})},T=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(L.includes(l.key)){if(l.altKey)return;l.preventDefault(),l.stopPropagation();const b=l.target;c(l.key,b,l);return}},g=l=>{l.preventDefault();const b=l.deltaY<0?"ArrowUp":"ArrowDown";c(b,l.target,l)},D=l=>{const b=l.target;if(z.includes(l.key)){o.value=b?.selectionStart??0;return}if(L.includes(l.key)){if(l.altKey)return;o.value=b?.selectionStart??0}},C=l=>{S.value=!0,d.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&M.value.length===0&&(e.externalValue.value="");const b=l.target;b&&(o.value=b.selectionStart??0)},k=l=>{const b=()=>{const U=document.getElementById(e.id);if(!U)return;const m=l?.pos??o.value??U.value.length;try{U.focus(),U.setSelectionRange(m,m)}catch{}};n.nextTick(()=>{if(l?.delay&&l.delay>0){setTimeout(b,l.delay);return}if(l?.useRAF){requestAnimationFrame(b);return}b()})};e.externalValue&&n.watch(e.externalValue,l=>{if(l){const b=new Date(l);if(b.toString()!=="Invalid Date"){const U=(b.getMonth()+1).toString().padStart(2,"0"),m=b.getDate().toString().padStart(2,"0"),y=b.getFullYear().toString();t.value=`${U}/${m}/${y}`,k({delay:50});return}}},{immediate:!0});const V=n.computed(()=>[["Date",`${x.value} / ${E.value} / ${N.value}`],["Digits only",M.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]]),H=n.computed(()=>{if(!d.value){if(!I.value)return!0;const b=h.value;return b?s(b):!1}if(!S.value)return!0;const l=h.value;return!I.value||!l?!1:s(l)}),_=n.computed(()=>{if(!d.value){if(!I.value)return;const b=h.value;return b?s(b)?"valid":"out-of-bounds":"invalid-date"}if(!S.value)return;if(M.value.length===0||!I.value)return"incomplete";const l=h.value;return l?s(l)?"valid":"out-of-bounds":"invalid-date"}),ee=n.computed(()=>{const l=_.value;if(!l||l==="valid")return"";if(l==="incomplete")return"Required";if(l==="invalid-date")return`Must be in ${a.value} format.`;const b=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,U=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(l==="out-of-bounds"){if(b&&U)return`Must be between ${b} and ${U}.`;if(b)return`Must be on or after ${b}.`;if(U)return`Must be on or before ${U}.`}return""}),ae=()=>{n.nextTick(()=>{const l=document.getElementById(e.id);if(!l){console.warn(`ID (#${e.id}) not found for styling.`);return}const b=l.closest(".k-datepicker");if(!b){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const U=b.parentElement;if(U){if(U.classList.contains("fk-datepicker"))return;U.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return n.onMounted(()=>{ae()}),{raw:t,cursorPos:o,debugEnabled:u,debugLines:V,placeholder:a,isValid:H,reason:n.readonly(_),validationMessage:ee,digitsOnly:M,month:n.readonly(x),day:n.readonly(E),year:n.readonly(N),datePart:F,handleChange:$,handleKeyDown:T,handleWheel:g,handleKeyUp:D,handleClick:X,handleBlur:C,initStyling:ae}}function yt(e){const t=n.ref(""),o=n.ref(void 0),u=n.ref(!!e.debug),a=n.ref(!1),d=1440*60*1e3,w=365*d,S=new Date,L=new Date(S.getTime()-w),z=new Date(S.getTime()+w);e.min=e.min??L,e.max=e.max??z;const M=n.computed(()=>(t.value??"").replace(/\D/g,"")),F=(i,v)=>new Date(i,v,0).getDate(),x=(i,v,O)=>v>=1&&v<=12&&i>=1e3&&O>=1&&O<=F(i,v),E=i=>Date.UTC(i.getFullYear(),i.getMonth(),i.getDate()),N=i=>{if(!i)return null;const v=e.min??new Date(Date.now()-90*d),O=e.max??new Date,W=E(i);return W<E(v)||W>E(O)?null:i},p=(i,v)=>e.allowReverse??!1?!0:i<=v,s=n.computed(()=>(t.value?.length??0)>=23&&M.value.length>=16),h=i=>{if((i??"").length<23||M.value.length<16)return{start:null,end:null};const v=i.substring(0,10),O=i.substring(13,23),[W,te,ne]=v.split("/").map(ce=>parseInt(ce||"0",10)),[se,de,fe]=O.split("/").map(ce=>parseInt(ce||"0",10)),pe=new Date(ne,W-1,te),ge=new Date(fe,se-1,de),Ae=x(ne,W,te)&&pe.toString()!=="Invalid Date",De=x(fe,se,de)&&ge.toString()!=="Invalid Date";return{start:Ae?pe:null,end:De?ge:null}},I=e.externalValid??n.ref(!0),K=n.computed(()=>h(t.value)),P=n.computed(()=>{const i=N(K.value.start),v=N(K.value.end);return{start:i,end:v}}),A=n.computed(()=>{if(!s.value)return;const i=P.value.start,v=P.value.end;if(!i||!v)return;const O=Math.abs(E(v)-E(i));return Math.round(O/864e5+1)}),$=n.ref(!1),X=n.computed(()=>{if(!$.value)return;const{start:i,end:v}=K.value;if(!s.value)return"incomplete";if(!i||!v)return"invalid-date";if(!P.value.start||!P.value.end)return"out-of-bounds";const O=P.value.start,W=P.value.end;return p(O,W)?typeof e.maxSpanDays=="number"&&A.value!==void 0&&A.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),c=n.computed(()=>{const i=X.value;return i===void 0||i==="valid"}),T=n.computed(()=>{const{min:i,max:v}=e,O=X.value;if(!O)return"";switch(O){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 i&&v?`Dates must be between ${k(i)} and ${k(v)}.`:"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""}}),g=["ArrowUp","ArrowDown"],D=["ArrowLeft","ArrowRight"],C=(i,v)=>String(i).padStart(v,"0"),k=i=>`${C(i.getMonth()+1,2)}/${C(i.getDate(),2)}/${C(i.getFullYear(),4)}`,V=i=>i<=2?{side:"start",part:"mm"}:i<=5?{side:"start",part:(i<=3,"dd")}:i<=11?{side:"start",part:"yyyy"}:i<=15?{side:"end",part:"mm"}:i<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},H=(i,v,O)=>{const W=v?.selectionStart??o.value??0;o.value=W;const{start:te,end:ne}=h(t.value);if(!te&&!ne){const Q=new Date,ie=k(Q);t.value=`${ie} - ${ie}`,e.onChange({value:{start:Q,end:Q},event:O}),n.nextTick(()=>{requestAnimationFrame(()=>{const oe=document.getElementById(e.id),re=o.value??0;oe&&(oe.focus(),oe.setSelectionRange(re,re))})});return}const se=new Date,de=V(W);let fe=te?new Date(te):new Date(se),pe=ne?new Date(ne):new Date(se);const ge=(Q,ie)=>{if(ie==="mm"){const oe=Q.getMonth()+1,re=i==="ArrowUp"?oe<12?oe+1:1:oe>1?oe-1:12;Q.setMonth(re-1);const ve=F(Q.getFullYear(),re);Q.getDate()>ve&&Q.setDate(ve)}else if(ie==="dd"){const oe=F(Q.getFullYear(),Q.getMonth()+1),re=Q.getDate(),ve=i==="ArrowUp"?re<oe?re+1:1:re>1?re-1:oe;Q.setDate(ve)}else if(ie==="yyyy"){const oe=Q.getFullYear();Q.setFullYear(i==="ArrowUp"?oe+1:Math.max(1,oe-1));const re=F(Q.getFullYear(),Q.getMonth()+1);Q.getDate()>re&&Q.setDate(re)}};de.side==="start"?ge(fe,de.part):ge(pe,de.part);const Ae=k(fe),De=k(pe);t.value=`${Ae} - ${De}`;const ce=N(fe),Ee=N(pe);ce&&Ee&&p(ce,Ee)?e.onChange({value:{start:ce,end:Ee},event:O}):e.onChange({value:null,event:O}),n.nextTick(()=>{requestAnimationFrame(()=>{const Q=document.getElementById(e.id),ie=o.value??0;Q&&(Q.focus(),Q.setSelectionRange(ie,ie))})})},_=i=>{const{start:v,end:O}=h(t.value);if(!v||!O){e.onChange({value:null,event:i});return}const W=N(v),te=N(O);if(!W||!te){e.onChange({value:null,event:i});return}if(!p(W,te)){e.onChange({value:null,event:i});return}e.onChange({value:{start:W,end:te},event:i})},ee=i=>{const v=i.value??"",O=i.event;if(!v&&O&&O.type==="click"){q(O);return}t.value=v;const W=O?.target;o.value=W?.selectionStart??0,_(i)},ae=i=>{o.value=i.target.selectionStart??0},l=i=>{if(i.code==="Space"||i.key===" "){i.preventDefault(),i.stopPropagation(),e.onShowCalendar(i);return}if(i.key==="ArrowDown"&&i.altKey){i.preventDefault(),i.stopPropagation(),e.onShowCalendar(i);return}if(g.includes(i.key)){i.preventDefault(),i.stopPropagation();const v=i.target;H(i.key,v,i);return}},b=i=>{i.preventDefault();const v=i.deltaY<0?"ArrowUp":"ArrowDown";H(v,i.target,i)},U=i=>{if(D.includes(i.key)||g.includes(i.key)){const v=i.target;o.value=v?.selectionStart??0}},m=()=>{$.value=!0,(e.manageValid??!0)&&(I.value=c.value)},y=i=>{m()},q=i=>{t.value="",o.value=0,e.onChange({value:null,event:i}),m(),n.nextTick(()=>{const v=document.getElementById(e.id);v&&(v.focus(),v.setSelectionRange(0,0))})};e.externalValue&&n.watch(e.externalValue,i=>{const v=i?.start??null,O=i?.end??null;if(v&&O){if(t.value=`${k(v)} - ${k(O)}`,e.isOpen?.value&&a.value&&e.onRequestClose){const W=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),a.value=!1,m()},W)}return}},{immediate:!0});const r=n.computed(()=>t.value&&t.value.substring(0,2).replace(/\D/g,"0")||"0"),f=n.computed(()=>t.value&&t.value.substring(3,5).replace(/\D/g,"0")||"0"),R=n.computed(()=>t.value&&t.value.substring(6,10).replace(/\D/g,"0")||"0"),B=n.computed(()=>t.value&&t.value.substring(13,15).replace(/\D/g,"0")||"0"),Y=n.computed(()=>t.value&&t.value.substring(16,18).replace(/\D/g,"0")||"0"),J=n.computed(()=>t.value&&t.value.substring(19,23).replace(/\D/g,"0")||"0"),Z=n.computed(()=>{const{start:i,end:v}=h(t.value);return[{label:"Raw",value:t.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(r.value).padStart(2,"0")} / ${String(f.value).padStart(2,"0")} / ${String(R.value).padStart(4,"0")}`},{label:"End",value:`${String(B.value).padStart(2,"0")} / ${String(Y.value).padStart(2,"0")} / ${String(J.value).padStart(4,"0")}`},{label:"Digits only",value:M.value},{label:"Mask complete",value:`${s.value}`},{label:"Parsed",value:`${i?i.toDateString():"-"} | ${v?v.toDateString():"-"}`},{label:"Valid (managed)",value:`${I.value??"-"}`},{label:"Span (days)",value:`${A.value??"-"}`},{label:"Reason",value:`${X.value??"-"}`},{label:"Cursor in",value:`${o.value??"-"} (${(()=>{const O=o.value??0,W=V(O);return`${W.side}.${W.part}`})()})`}]}),G=()=>{n.nextTick(()=>{const i=document.getElementById(e.id);if(!i){console.warn(`#${e.id} not found for styling.`);return}const v=i.closest("div");if(!v){console.warn(`Parent div of #${e.id} not found for styling.`);return}v.classList.contains("fk-daterangepicker")||v.classList.add("fk-daterangepicker")})};n.onMounted(()=>{G()});const le=()=>{n.nextTick(()=>{try{const i=Array.from(document.querySelectorAll(".k-animation-container"));if(!i.length)return;const O=[...i].reverse().find(ne=>ne.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!O)return;const W=O.querySelectorAll(".k-calendar-table");let te=!1;W.forEach(ne=>{ne.tabIndex===0&&(te?ne.tabIndex=-1:te=!0)})}catch(i){console.warn(i)}})};return e.isOpen&&n.watch(e.isOpen,i=>{i&&setTimeout(()=>le(),0)},{immediate:!1}),{raw:t,cursorPos:o,debugEnabled:u,debugLines:Z,digitsOnly:M,valid:I,validComputed:n.readonly(c),reason:n.readonly(X),validationMessage:n.readonly(T),spanDays:n.readonly(A),month1:n.readonly(r),day1:n.readonly(f),year1:n.readonly(R),month2:n.readonly(B),day2:n.readonly(Y),year2:n.readonly(J),handleChange:ee,handleKeyDown:l,handleWheel:b,handleKeyUp:U,handleClick:ae,handleBlur:y,handleClear:q,onCalendarChange:()=>{a.value=!0},initStyling:G}}function wt(e){const t=n.ref(""),o=n.ref(void 0),u=n.ref(!!e.debug),a=n.ref(e.timeFormat??"hh:mm AM"),d=n.computed(()=>!!e.required),w=n.ref(!1),S=["ArrowUp","ArrowDown"],L=["ArrowLeft","ArrowRight"],z=n.computed(()=>(t.value??"").replace(/\D/g,"")),M={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},F=r=>r<=2?"hh":r<=5?"mm":"ampm",x=n.computed(()=>{const r=t.value&&t.value.substring(0,2).replace(/\D/g,"0")||"0",f=parseInt(r);return Math.min(Math.max(f,0),23)}),E=n.computed(()=>{const r=t.value&&t.value.substring(3,5).replace(/\D/g,"0")||"0",f=parseInt(r);return Math.min(Math.max(f,0),59)}),N=n.computed(()=>(t.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),p=n.computed(()=>{const r=parseInt(t.value?.substring(0,2).replace(/\D/g,"0")||"0"),f=N.value;return r===12?f==="AM"?0:12:f==="PM"?r+12:r}),s=n.computed(()=>h.value?`${String(p.value).padStart(2,"0")}:${String(E.value).padStart(2,"0")}:00`:null),h=n.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value??"")),I=(r,f,R)=>{let B=r%12;return B===0&&(B=12),`${String(B).padStart(2,"0")}:${String(f).padStart(2,"0")} ${R}`},K=r=>{const f=r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!f)return null;const R=parseInt(f[1]),B=parseInt(f[2]),Y=f[3].toUpperCase();if(R<1||R>12||B<0||B>59)return null;let J=R%12;Y==="PM"&&(J+=12);const Z=new Date;return Z.setSeconds(0,0),Z.setHours(J),Z.setMinutes(B),Z},P=r=>{if(z.value.length===0){e.onChange({value:null,event:r});return}if(!h.value){e.onChange({value:null,event:r});return}const f=K(t.value);f&&$(f)?e.onChange({value:f,event:r}):e.onChange({value:null,event:r})},A=r=>r.getHours()*60+r.getMinutes(),$=r=>{const f=e.min??void 0,R=e.max??void 0,B=A(r);if(f){const Y=A(f);if(B<Y)return!1}if(R){const Y=A(R);if(B>Y)return!1}return!0},X=r=>{const f=r.getHours(),R=f>=12?"PM":"AM";t.value=I(f,r.getMinutes(),R)},c=(r,f)=>{e.onChange({value:r,event:f})},T=()=>{n.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const r=document.getElementById(e.id);if(r){r.focus();const f=(r.value??"").length;r.setSelectionRange(f,f)}})})})},g=r=>{const f=r?.event?.target;return f?f.closest(".k-time-now")?"now":f.closest(".k-time-accept")?"set":null:null},D=(r,f)=>{r&&$(r)?c(r,f):c(null,f)},C=(...r)=>{const f=r[0];if(!f)return;const R=g(f);if(R==="now"){const Y=new Date;X(Y),D(Y,f),T();return}if(f?.value instanceof Date){const Y=new Date(f.value);X(Y),D(Y,f),R==="set"&&T();return}if(f?.value===null){t.value="",c(null,f);return}t.value=f.value;const B=f.event?.target;o.value=B?.selectionStart??0;try{const Y=o.value??0;if(F(Y)==="ampm"&&(t.value??"").length>=8){const J=t.value.charAt(6);/[Aa]/.test(J)?(t.value=`${t.value.slice(0,6)}AM${t.value.slice(8)}`,n.nextTick(()=>{requestAnimationFrame(()=>{const Z=document.getElementById(e.id);Z&&(Z.focus(),Z.setSelectionRange(8,8))})})):/[Pp]/.test(J)&&(t.value=`${t.value.slice(0,6)}PM${t.value.slice(8)}`,n.nextTick(()=>{requestAnimationFrame(()=>{const Z=document.getElementById(e.id);Z&&(Z.focus(),Z.setSelectionRange(8,8))})}))}}catch{}P(f)},k=r=>{o.value=r.target.selectionStart??0},V=(r,f,R)=>{const B=f?.selectionStart??o.value??0;o.value=B;const Y=F(B),J=(t.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!J){if((t.value??"").length===0||z.value.length===0){const v=new Date,O=v.getHours(),W=O>=12?"PM":"AM";t.value=I(O,v.getMinutes(),W);const te=K(t.value);D(te,R),n.nextTick(()=>{requestAnimationFrame(()=>{const ne=document.getElementById(e.id),se=o.value??0;ne&&(ne.focus(),ne.setSelectionRange(se,se))})})}return}let Z=parseInt(J[1]),G=parseInt(J[2]),le=J[3].toUpperCase();if(Y==="hh")r==="ArrowUp"?Z=Z<12?Z+1:1:Z=Z>1?Z-1:12;else if(Y==="mm"){const v=e.minuteStepRef?.value??e.minuteStep??1;if(v===1)r==="ArrowUp"?G=G<59?G+1:0:G=G>0?G-1:59;else if(r==="ArrowUp"){const O=G%v;let W=O===0?G+v:G+(v-O);W>=60&&(W=0),G=W}else{const O=G%v;let W=O===0?G-v:G-O;W<0&&(W=60-v),G=W}}else Y==="ampm"&&(le=le==="AM"?"PM":"AM");t.value=`${String(Z).padStart(2,"0")}:${String(G).padStart(2,"0")} ${le}`;const i=K(t.value);D(i,R),n.nextTick(()=>{requestAnimationFrame(()=>{const v=document.getElementById(e.id),O=o.value??0;v&&(v.focus(),v.setSelectionRange(O,O))})})},H=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),r.stopPropagation(),e.onShowPicker(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),r.stopPropagation(),e.onShowPicker(r);return}if(S.includes(r.key)){if(r.altKey)return;r.preventDefault(),r.stopPropagation();const f=r.target;V(r.key,f,r);return}},_=r=>{r.preventDefault();const f=r.deltaY<0?"ArrowUp":"ArrowDown";V(f,r.target,r)},ee=r=>{const f=r.target;if(L.includes(r.key)){o.value=f?.selectionStart??0;return}if(S.includes(r.key)){if(r.altKey)return;o.value=f?.selectionStart??0}},ae=r=>{w.value=!0,d.value&&e.externalValue&&e.externalValue.value===void 0&&z.value.length===0&&(e.externalValue.value="");const f=r.target;f&&(o.value=f.selectionStart??0)};e.externalValue&&n.watch(e.externalValue,r=>{if(r){const f=new Date(r);if(f.toString()!=="Invalid Date"){const R=f.getHours(),B=R>=12?"PM":"AM";t.value=I(R,f.getMinutes(),B);return}}},{immediate:!0});const l=n.computed(()=>[["Time",t.value||"--:-- --"],["Hour (12h)",x.value],["Hour (24h)",p.value],["Minute",E.value],["Period",N.value],["Time (24h)",s.value??"--:--:--"],["Digits only",z.value],["Parsed Date",b.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",U.value],["reason",m.value],["validationMessage",y.value]]),b=n.computed(()=>K(t.value)??null),U=n.computed(()=>{if(!d.value){if(!h.value)return!0;const f=b.value;return f?$(f):!1}if(!w.value)return!0;const r=b.value;return!h.value||!r?!1:$(r)}),m=n.computed(()=>{if(!d.value){if(!h.value)return;const f=b.value;return f?$(f)?"valid":"out-of-bounds":"invalid-time"}if(!w.value)return;if(z.value.length===0||!h.value)return"incomplete";const r=b.value;return r?$(r)?"valid":"out-of-bounds":"invalid-time"}),y=n.computed(()=>{const r=m.value;if(!r||r==="valid")return"";if(r==="incomplete")return"Required";if(r==="invalid-time")return`Must be in ${a.value} format.`;const f={hour:"2-digit",minute:"2-digit"},R=e.min?e.min.toLocaleTimeString("en-US",f):null,B=e.max?e.max.toLocaleTimeString("en-US",f):null;if(r==="out-of-bounds"){if(R&&B)return`Must be between ${R} and ${B}.`;if(R)return`Must be ${R} or later.`;if(B)return`Must be ${B} or earlier.`}return""}),q=()=>{n.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`#${e.id} not found for styling.`);return}const f=r.closest(".k-timepicker");if(!f){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const R=f.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 n.onMounted(()=>{q()}),{raw:t,rules:M,debugEnabled:u,debugLines:l,placeholder:a,isValid:U,reason:n.readonly(m),validationMessage:y,isComplete:h,inRangeTime:$,cursorPos:o,hour:n.readonly(x),hour24:n.readonly(p),minute:n.readonly(E),period:n.readonly(N),time24:n.readonly(s),parsedRawTime:n.readonly(b),handleChange:C,handleKeyDown:H,handleKeyUp:ee,handleClick:k,handleWheel:_,handleBlur:ae,initStyling:q}}const bt={returnFocusToTrigger:!1,focusTrapOptions:{returnFocusOnDeactivate:!1}};function St(e){const t=n.shallowRef(null),o=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],u=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??o].flat(),a=M=>M?typeof e.initialFocus=="string"?M.querySelector(e.initialFocus)??M:typeof e.initialFocus=="function"?e.initialFocus(M)??M:M.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??M:null,{activate:d,deactivate:w}=Ne.useFocusTrap(t,{escapeDeactivates:!1,clickOutsideDeactivates:!1,allowOutsideClick:!0,fallbackFocus:()=>t.value,initialFocus:()=>a(t.value),...e.focusTrapOptions??{}});let S=null,L=n.ref(null);const z=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const M=(x,E)=>{const N=Array.from(x.querySelectorAll(E));if(!N.length)return null;const p=N.filter(s=>s.offsetParent!==null||s.getClientRects().length>0);return p[p.length-1]??N[N.length-1]??null},F=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const x of u){const E=M(F,x);if(E)return E}for(const x of u){const E=M(document,x);if(E)return E}return null};return Ve(t,M=>{L.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",M)}),n.watch(()=>e.isOpen.value,M=>{M?(L.value=null,n.nextTick(()=>{const F=z();F&&(F.tabIndex<0&&(F.tabIndex=-1),t.value=F,setTimeout(()=>{try{d()}catch(x){console.warn("usePopupTrap: focus trap failed to activate",x)}},0),S||(S=x=>{x.key==="Escape"&&(L.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",x))},document.addEventListener("keydown",S,!0)))})):(w(),S&&(document.removeEventListener("keydown",S,!0),S=null),t.value=null,L.value==="outside"&&n.nextTick(()=>{const F=()=>{const x=e.triggerEl?.value,E=x?.querySelector("input"),N=document.activeElement;N&&(N===E||x&&x.contains(N))&&(E??x)?.blur?.()};requestAnimationFrame(()=>setTimeout(F,0))}),e.returnFocusToTrigger!==!1&&L.value==="escape"&&e.triggerEl?.value&&n.nextTick(()=>{const F=()=>{const x=e.triggerEl?.value;if(!x)return;(x.querySelector("input")??x)?.focus?.()};requestAnimationFrame(()=>setTimeout(F,0))}))}),{popupRef:t,activate:d,deactivate:w,lastCloseReason:n.readonly(L),setPopupEl:M=>t.value=M}}j.POPUP_MENU_TRAP_OPTIONS=bt,j.WINDOW_SETTINGS_DEFAULTS=ke,j.computeCollisionOffset=Le,j.useActiveIdRegistry=pt,j.useCompositeId=tt,j.useExclusiveGroup=dt,j.useFieldsetTouchTracker=Ie,j.useFieldsetValidationKit=Ce,j.useGridA11y=ze,j.useGridActiveFilter=Ue,j.useGridRowAction=Ye,j.useIntersectionObserver=Oe,j.useMaskedDateInput=vt,j.useMaskedDateRangeInput=yt,j.useMaskedTimeInput=wt,j.usePopupMenu=ut,j.usePopupTrap=St,j.useUSAddress=et,j.useWindow=ht,j.useZipTextBox=Me,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(j,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],n):(j=typeof globalThis<"u"?globalThis:j||self,n(j.FeatherKComposables={},j.Vue,j.useFocusTrap))})(this,(function(j,n,Ne){"use strict";const ze=(e,t)=>{const o=n.ref(null);let u=!1,l=null,d=null;const b=[],k=".k-table-row[data-grid-row-index] [tabindex]",P=()=>{const r=e?.value?.$el;return r?r.closest(".k-grid"):null},N=r=>{const h=P();if(!h)return!1;const g=r.closest(".k-grid-aria-root");if(g)return h.contains(g);const A=r.closest(".k-grid-header, .k-grid-content, .k-grid-content-locked");return A?h.contains(A):!1},x=r=>r.key==="Enter"||r.code==="Enter"||r.code==="NumpadEnter",R=()=>e?.value?.columns,T=r=>{const h=r.key||r.code;([" ","Spacebar","Space"].includes(h)||x(r))&&(r.preventDefault(),r.stopPropagation(),o.value=r.target,r.target.click())},D=r=>{if(!o.value)return;if(r.code==="Escape"){r.stopPropagation(),o.value&&o.value.focus();return}const h=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),g=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(g){if(r.code==="Tab"){const A=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],I=t?.focusableMenuSelectors??A,E=Array.from(g.querySelectorAll(I.join(",")));if(E.length===0)return;const L=E.findIndex(X=>X===document.activeElement);let K;L===-1?K=0:r.shiftKey?K=(L-1+E.length)%E.length:K=(L+1)%E.length,r.preventDefault(),r.stopPropagation(),E[K]?.focus()}}else if(r.code==="ArrowUp"||r.code==="ArrowDown"){r.preventDefault(),r.stopPropagation();const A=h.findIndex(E=>E===document.activeElement);let I=A;r.code==="ArrowUp"?I=A>0?A-1:h.length-1:r.code==="ArrowDown"&&(I=A<h.length-1?A+1:0),h[I]?.focus();return}if(r.code==="Tab"){r.preventDefault(),r.stopPropagation();const A=o.value?.parentElement;(r.shiftKey?A?.previousElementSibling:A?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},V=()=>{l=new MutationObserver(r=>{r.forEach(h=>{h.addedNodes.forEach(g=>{if(g.nodeType===Node.ELEMENT_NODE){const A=g;if(A.classList.contains("k-animation-container")){const E=o.value;E&&(E.dataset.featherKSortable==="true"||n.nextTick(()=>{A.querySelectorAll(".k-columnmenu-item-wrapper").forEach(X=>{X.textContent?.toLowerCase().includes("sort")&&X.remove()})})),A.addEventListener("keydown",D),n.nextTick(()=>{const L=()=>{const K=Array.from(A.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(),L.attempts=0;else if(K.length>1){L.attempts=0;return}else L.attempts===void 0&&(L.attempts=0),L.attempts++<3&&setTimeout(L,200)};L()})}A.querySelectorAll(".k-animation-container").forEach(E=>{E.addEventListener("keydown",D)})}}),h.removedNodes.forEach(g=>{if(g.nodeType===Node.ELEMENT_NODE){const A=g;A.classList.contains("k-animation-container")&&A.removeEventListener("keydown",D),A.querySelectorAll(".k-animation-container").forEach(E=>{E.removeEventListener("keydown",D)})}})})}),l.observe(document.body,{childList:!0,subtree:!0})},p=r=>{const h=r.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(h)||r.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},c=r=>{if(!r.type||!r)return;const h=r.target;if(!h)return;const g=h.closest(".k-table-row[data-grid-row-index]");if(!N(h))return;const A=["ArrowLeft","ArrowRight"].includes(r.code);if(!(p(h)&&!(g&&A))){if(r.code==="Escape"){const I=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(I){r.preventDefault(),r.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(L=>L.setAttribute("tabindex","-1"))}catch{}I.setAttribute("tabindex","0"),I.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(r.code)){if(h.classList.contains("k-grid-header-menu")&&h.classList.contains("k-grid-column-menu")){o.value=h;return}if(g){if(["ArrowDown","ArrowUp"].includes(r.code)){r.preventDefault(),r.stopPropagation();const I=(L,K)=>{let X=K==="next"?L.nextElementSibling:L.previousElementSibling;for(;X;){const ee=X;try{if(ee.classList.contains("k-table-row"))return ee}catch{}X=K==="next"?X.nextElementSibling:X.previousElementSibling}return null},E=r.code==="ArrowDown"?I(g,"next"):I(g,"previous");E&&(g.setAttribute("tabindex","-1"),E.setAttribute("tabindex","0"),E.focus());return}if(["ArrowLeft","ArrowRight"].includes(r.code)){r.preventDefault(),r.stopPropagation();const I=g.querySelectorAll(k);if(I.length===0)return;let E=Array.from(I).findIndex(L=>L===document.activeElement);if(E===-1&&document.activeElement===g){I[0].focus();return}r.code==="ArrowRight"?E=E===I.length-1?0:E+1:r.code==="ArrowLeft"&&(E=E===0?I.length-1:E-1),I[E].focus();return}}}}},v=()=>{n.nextTick(()=>{const r=e.value?.$el;if(!r||typeof r.closest!="function")return;const h=r.closest(".k-grid");h&&h.classList.add("fk-grid")})},M=()=>{if(!d)try{const r=()=>{try{const A=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!A||A.length===0||A.filter(L=>L.getAttribute("tabindex")==="0").length===1)return;const E=A.find(L=>L===document.activeElement||L.contains(document.activeElement));if(A.forEach(L=>L.setAttribute("tabindex","-1")),E){E.setAttribute("tabindex","0");return}A[0].setAttribute("tabindex","0")}catch(A){console.error("ensureSingleTabindex error:",A)}},h=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));h.length>0&&h.forEach((A,I)=>{A.setAttribute("tabindex",I===0?"0":"-1")});const g=e.value.$el.querySelector(".k-table-tbody");g&&(d=new MutationObserver(()=>{r()}),d.observe(g,{childList:!0,subtree:!0}))}catch(r){console.error("Error setting up row navigation:",r)}},O=()=>{n.nextTick(()=>{const h=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");h&&h.forEach(g=>{g.setAttribute("role","button"),g.addEventListener("keydown",T)}),V(),H()})},W=()=>{const h=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");h&&h.forEach(g=>{g.removeEventListener("keydown",T)}),l&&(l.disconnect(),l=null),d&&(d.disconnect(),d=null),b.forEach(g=>g()),b.length=0},H=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((g,A)=>{if(g.dataset.featherKHeaderBound==="true")return;const I=g.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!I)return;const E=R();if(E&&E[A]){const i=E[A].field??"";g.setAttribute("data-feather-k-field",i),g.setAttribute("data-feather-k-filterable",E[A].filterable===!1?"false":"true"),g.setAttribute("data-feather-k-sortable",E[A].sortable===!1?"false":"true")}const L=g.dataset.featherKFilterable!=="false",K=g.dataset.featherKSortable!=="false";I.setAttribute("tabindex","-1"),L||K?g.style.cursor="pointer":g.style.cursor="default",L?(g.setAttribute("tabindex","0"),g.setAttribute("role","button"),g.setAttribute("aria-haspopup","menu")):(g.setAttribute("tabindex","0"),g.setAttribute("role","columnheader"),g.removeAttribute("aria-haspopup"));const X=i=>{i.target?.closest(".k-column-resizer")||(o.value=g,I.click())},ee=i=>{if(L)o.value=g,i.preventDefault(),i.stopPropagation(),X(i);else if(K){o.value=g;const S=g.querySelector(".k-link");S&&S.click()}};g.addEventListener("click",ee),b.push(()=>{g.removeEventListener("click",ee)});const oe=i=>{if((x(i)||i.code==="Space")&&(L||K)){if(i.preventDefault(),i.stopPropagation(),o.value=g,o.value.focus(),L)X(i);else if(K){const S=g.querySelector(".k-link");S&&S.click()}}};g.addEventListener("keydown",oe,!0),b.push(()=>{g.removeEventListener("keydown",oe,!0)}),g.dataset.featherKHeaderBound="true"});const h=document.querySelector(".k-grid-header .k-table-thead");if(h&&h.dataset.featherKHeaderBound!=="true"){const g=A=>{const I=A.target.closest("th");I&&(x(A)||A.code==="Space")&&I.dataset.featherKFilterable==="false"&&I.dataset.featherKSortable==="false"&&(A.preventDefault(),A.stopImmediatePropagation())};h.addEventListener("keydown",g,!0),b.push(()=>{h.removeEventListener("keydown",g,!0)}),h.dataset.featherKHeaderBound="true"}},_=function(r,h){const g=r?.event?.event.target,A=R();if(!g||!A)return;const I=g.classList.contains("k-grid-header-menu"),E=g.classList.contains("k-columnmenu-item"),L=A.find(K=>K.field===r?.event?.field)?.sortable&&!0;if(!I){if(E&&!L){r?.event?.sort?.filter(X=>X.field!==r?.event?.field);return}typeof h=="function"&&n.nextTick(()=>{o.value&&o.value.focus(),h(r),n.nextTick(()=>{H()})})}},F=()=>{if(!u)try{v(),M(),O(),u=!0}catch(r){console.error("initA11y failed:",r),W()}};return n.onBeforeUnmount(()=>{W()}),{activeFilterButton:o,handleGridKeyDown:c,handleSortChange:_,initA11y:F}},qe=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Ke=e=>!!e&&typeof e=="object"&&"field"in e,Te=(e,t)=>!e||typeof e!="object"?!1:qe(e)?e.filters.some(o=>Te(o,t)):Ke(e)?e.field===t:!1,Ue=e=>t=>e.value?.filters&&e.value.filters.some(o=>Te(o,t))?"active":"",Be=["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"],Ye=e=>{const{onRowAction:t,gridRef:o,dataItems:u,ignoreSelectors:l=[],shouldIgnoreTarget:d,enableKeyboardAction:b=!0}=e,k=[...Be,...l],P=(p,c)=>{if(!p)return!1;const v=k.join(",");return p.closest&&p.closest(v)?!0:d&&c?d(p,c):!1},N=p=>{const v=p?.closest?.(".k-table-row[data-grid-row-index]")?.getAttribute("data-grid-row-index");if(v==null)return;const M=parseInt(v,10);return Number.isNaN(M)?void 0:M},x=p=>{if(!p||typeof p.clientX!="number")return;const c=typeof window<"u"&&window.scrollX||0,v=typeof window<"u"&&window.scrollY||0,M=typeof window<"u"&&window.screenX||0,O=typeof window<"u"&&window.screenY||0;return{clientX:p.clientX,clientY:p.clientY,pageX:typeof p.pageX=="number"?p.pageX:p.clientX+c,pageY:typeof p.pageY=="number"?p.pageY:p.clientY+v,screenX:typeof p.screenX=="number"?p.screenX:p.clientX+M,screenY:typeof p.screenY=="number"?p.screenY:p.clientY+O}},R=p=>{if(!p||typeof p.getBoundingClientRect!="function")return;const c=p.getBoundingClientRect();if(!c)return;const v=c.left,M=c.bottom,O=typeof window<"u"&&window.scrollX||0,W=typeof window<"u"&&window.scrollY||0;return{clientX:v,clientY:M,pageX:v+O,pageY:M+W,screenX:v,screenY:M}},T=p=>{if(typeof window>"u")return!1;const c=window.getSelection();if(!c||c.isCollapsed||!c.toString().trim())return!1;if(p&&c.anchorNode&&c.focusNode){const v=p.closest(".k-table-row")||p.closest(".k-grid")||p,M=c.anchorNode.nodeType===Node.ELEMENT_NODE?c.anchorNode:c.anchorNode.parentElement,O=c.focusNode.nodeType===Node.ELEMENT_NODE?c.focusNode:c.focusNode.parentElement,W=!!(M&&v.contains(M)),H=!!(O&&v.contains(O));return W||H}return!0};return{handleRowClick:p=>{const c=p?.htmlEvent||p?.event||p?.nativeEvent||(p instanceof Event?p:void 0);if(c&&c.button!==void 0&&c.button!==0)return;const v=c?.target||p?.target;if(v&&P(v,c||p)||T(v))return;const M={dataItem:p.dataItem,rowIndex:p.rowIndex??N(v),field:p.field,event:c||p,triggerType:"click",ctrlKey:!!c?.ctrlKey,shiftKey:!!c?.shiftKey,metaKey:!!c?.metaKey,altKey:!!c?.altKey,coordinates:x(c)??R(v)};t(p.dataItem,M)},handleRowKeyDown:(p,c)=>{if(!b)return;const v=p.key||p.code;if(!(v==="Enter"||v==="NumpadEnter"||v===" "||v==="Space"||p.code==="Enter"||p.code==="NumpadEnter"||p.code==="Space"))return;const O=p.target;if(!O)return;const W=O.closest(".k-table-row[data-grid-row-index], .k-table-row");if(!W||P(O,p))return;p.preventDefault(),p.stopPropagation();const H=W.getAttribute("data-grid-row-index"),_=H!==null?parseInt(H,10):void 0;let F=c;if(F===void 0){const h=(Array.isArray(u)?u:u?.value)||o?.value?.props?.dataItems||o?.value?.dataItems;h&&_!==void 0&&_>=0&&_<h.length&&(F=h[_])}if(F===void 0)return;const r={dataItem:F,rowIndex:_,event:p,triggerType:"keyboard",ctrlKey:!!p.ctrlKey,shiftKey:!!p.shiftKey,metaKey:!!p.metaKey,altKey:!!p.altKey,coordinates:R(W)};t(F,r)},isIgnoredTarget:P}},We="Enter a valid ZIP code with exactly 5 or 9 digits.",xe=e=>{const t=e.replace(/\D/g,"").slice(0,9);return t.length>5?`${t.slice(0,5)}-${t.slice(5)}`:t},He=(e,t)=>e.slice(0,Math.max(0,t)).replace(/\D/g,"").length,Xe=e=>e<=5?e:Math.min(e+1,10),Me=e=>{const t=n.ref(xe(e.initialValue??"")),o=n.ref(!1),u=n.ref(e.errorMessage?.trim()||We),l=n.computed(()=>t.value.replace(/\D/g,"")),d=n.computed(()=>{const D=l.value.length;return D===5||D===9}),b=n.computed(()=>o.value&&!d.value),k=n.computed(()=>!o.value||d.value),P=n.computed(()=>o.value),N=(D,V)=>{const p=Xe(V);n.nextTick(()=>{D.isConnected&&D.setSelectionRange(p,p)})};return{zipDisplay:t,submitted:o,errorMessage:u,wrapperClass:"fk-zip-textbox",zipRaw:l,isZipValid:d,showZipError:b,textBoxValid:k,textBoxValidate:P,handleZipInput:(...D)=>{const V=D[0],c=V?.event?.target,v=V?.value,M=Array.isArray(v)?v.join(""):String(v??""),O=c?.selectionStart!==void 0&&c.selectionStart!==null?He(c.value,c.selectionStart):M.replace(/\D/g,"").length;t.value=xe(M),c&&N(c,O)},submitAndValidate:D=>{o.value=!0;const V=d.value;return!V&&D?.focus&&n.nextTick(()=>{document.getElementById(e.id)?.focus()}),V},buildPayload:()=>({zip:l.value})}};function Ie(e,t){const o=n.ref(!1);n.watchEffect(()=>{e.value?.setAttribute("aria-invalid",String(!t.isValid()))});function u(d){const b=e.value??d.currentTarget,k=d.relatedTarget;(!b||!b.contains(k))&&(o.value=!0)}function l(){o.value=!1}return{touched:o,onFocusout:u,reset:l}}function Ce(e,t){const o=n.ref(!1),u=n.ref(!1),l=n.computed(()=>n.toValue(t.submitted)||o.value),d=n.computed(()=>!l.value||t.isValid()),b=Ie(e,{isValid:()=>d.value});function k(T){return n.computed(()=>!l.value||n.toValue(T))}function P(T){return Object.fromEntries(Object.entries(T).map(([D,V])=>[D,k(V)]))}function N(T){const D=n.toValue(T);if(!D)return;D.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function x(T){if(u.value){u.value=!1;return}b.onFocusout(T),b.touched.value&&(o.value=!0)}function R(){o.value=!1,u.value=!0,b.reset()}return{touched:o,fieldsetValidate:l,onFocusout:x,reset:R,createFieldValidity:k,createFieldValidationsMap:P,focusFirstInvalidField:N}}const _e=[{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 ye(e){if(e&&typeof e=="object"&&"value"in e){const t=e.value;return typeof t=="string"?t:String(t??"")}return""}function Ze(){const e=n.reactive({address1:"",address2:"",city:"",state:null,zip:""});return{formData:e,onAddress1Input:(...b)=>{e.address1=ye(b[0])},onAddress2Input:(...b)=>{e.address2=ye(b[0])},onCityInput:(...b)=>{e.city=ye(b[0])},onStateChange:b=>{e.state=b.value},resetFormData:()=>{e.address1="",e.address2="",e.city="",e.state=null,e.zip=""}}}function je(e,t="zip"){const o=Me({id:t}),{zipDisplay:u,zipRaw:l,isZipValid:d,wrapperClass:b,handleZipInput:k}=o;return n.watch(l,N=>{e.zip=N}),{zipDisplay:u,isZipValid:d,zipWrapperClass:b,onZipInput:k,resetZip:()=>{u.value="",e.zip=""}}}function Ge(e){const t=n.computed(()=>e.formData.address1.trim()!==""),o=n.computed(()=>e.formData.city.trim()!==""),u=n.computed(()=>!!e.formData.state),l=n.computed(()=>n.toValue(e.isZipValid)),d=n.computed(()=>t.value&&o.value&&u.value&&l.value);return{strictAddress1Valid:t,strictCityValid:o,strictStateValid:u,strictZipValid:l,strictAddressValid:d}}function Je(e){if(!e)return;e.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function Qe(e,t){const o=e??t.currentTarget,u=t.relatedTarget;return!o||!o.contains(u)}function et(e){const t=n.ref(n.toValue(e.fieldsetRef));n.watchEffect(()=>{t.value=n.toValue(e.fieldsetRef)});const o=n.ref(!1),u=n.ref(!1),l=n.computed(()=>n.toValue(e.required)??!0),{formData:d,onAddress1Input:b,onAddress2Input:k,onCityInput:P,onStateChange:N,resetFormData:x}=Ze(),R=`${e.addressId}-zip`,{zipDisplay:T,isZipValid:D,zipWrapperClass:V,onZipInput:p,resetZip:c}=je(d,R),{strictAddress1Valid:v,strictCityValid:M,strictStateValid:O,strictZipValid:W,strictAddressValid:H}=Ge({formData:d,isZipValid:D}),_=Ce(t,{submitted:o,isValid:()=>H.value}),{touched:F,fieldsetValidate:r,onFocusout:h,reset:g}=_,A=_.createFieldValidationsMap({address1:v,city:M,state:O,zip:W,address:H}),{address1:I,city:E,state:L,zip:K,address:X}=A,ee=n.computed(()=>l.value?r.value:!1),oe=n.computed(()=>l.value?I.value:!0),i=n.computed(()=>l.value?E.value:!0),S=n.computed(()=>l.value?L.value:!0),q=n.computed(()=>l.value?K.value:!0),m=n.computed(()=>l.value?X.value:!0),w={value:null,label:"State"},z=_e.map(({label:y,value:$})=>({label:y,value:$})),a=n.computed(()=>({address1:d.address1.trim(),address2:d.address2.trim(),city:d.city.trim(),state:(d.state??"").trim().toUpperCase(),zip:d.zip.replace(/\D/g,"")})),f=n.computed(()=>d.address1.trim()===""&&d.address2.trim()===""&&d.city.trim()===""&&(d.state??"").trim()===""&&d.zip.replace(/\D/g,"")===""),C=n.computed(()=>!f.value),U=n.computed(()=>!l.value&&C.value&&(!v.value||!M.value||!O.value)),B=n.computed(()=>{const y=d.zip.replace(/\D/g,"");return!l.value&&C.value&&y.length!==5&&y.length!==9}),J=n.computed(()=>!l.value&&C.value&&!H.value),Z=n.computed(()=>!l.value&&J.value&&(u.value||o.value));return n.watch(a,()=>{l.value||(u.value=!1)}),n.watch(l,y=>{y||(o.value=!1,u.value=!1,g())}),{formData:d,submitted:o,touched:F,addressValidate:ee,address1Valid:oe,cityValid:i,stateValid:S,zipValid:q,addressValid:m,optionalFeedbackActive:Z,optionalPartialInvalid:J,optionalMissingRequiredFields:U,optionalZipInvalid:B,stateDefaultItem:w,stateOptions:z,zipDisplay:T,zipWrapperClass:V,onAddress1Input:b,onAddress2Input:k,onCityInput:P,onStateChange:N,onZipInput:p,onFieldsetFocusout:y=>{const $=Qe(t.value,y);h(y),!l.value&&$&&(u.value=!0)},normalizedPayload:a,validateForSubmit:async()=>l.value?(o.value=!0,H.value?{isValid:!0,payload:a.value}:(await n.nextTick(),Je(t.value),{isValid:!1,payload:null})):f.value||H.value?(o.value=!1,{isValid:!0,payload:a.value}):(o.value=!0,{isValid:!1,payload:null}),reset:()=>{o.value=!1,u.value=!1,g(),x(),c()}}}const Re=e=>e==="left"?"right":e==="right"?"left":"center",Fe=e=>e==="top"?"bottom":e==="bottom"?"top":"center",we=(e,t,o,u)=>{const l=e.left+(o.horizontal==="right"?e.width:o.horizontal==="center"?e.width/2:0),d=e.top+(o.vertical==="bottom"?e.height:o.vertical==="center"?e.height/2:0),b=t?u.horizontal==="right"?t.width:u.horizontal==="center"?t.width/2:0:0,k=t?u.vertical==="bottom"?t.height:u.vertical==="center"?t.height/2:0:0;return{left:l-b,top:d-k}},Pe=(e,t,o,u)=>t>=u-o?o:Math.min(Math.max(e,o),u-t),Le=({anchor:e,popup:t,anchorAlign:o,popupAlign:u,bounds:l,collision:d})=>{const b=we(e,t,o,u);if(!t)return b;let{left:k,top:P}=b;if(d.horizontal==="fit")k=Pe(k,t.width,l.left,l.right);else{const N=k+t.width-l.right,x=l.left-k;if(N>0||x>0){const R=we(e,t,{horizontal:Re(o.horizontal),vertical:o.vertical},{horizontal:Re(u.horizontal),vertical:u.vertical}),T=Math.max(N,0)+Math.max(x,0);Math.max(R.left+t.width-l.right,0)+Math.max(l.left-R.left,0)<T&&(k=R.left)}}if(d.vertical==="fit")P=Pe(P,t.height,l.top,l.bottom);else{const N=P+t.height-l.bottom,x=l.top-P;if(N>0||x>0){const R=we(e,t,{horizontal:o.horizontal,vertical:Fe(o.vertical)},{horizontal:u.horizontal,vertical:Fe(u.vertical)}),T=Math.max(N,0)+Math.max(x,0);Math.max(R.top+t.height-l.bottom,0)+Math.max(l.top-R.top,0)<T&&(P=R.top)}}return{left:k,top:P}},tt=(e="fkid")=>{const t=`${e}-${n.useId()}`;return{instanceId:t,compose:(...u)=>[t,...u].filter(l=>l!=null).map(String).join("-")}},nt=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ot=Object.prototype.toString,at=e=>ot.call(e)==="[object Object]",he=()=>{};function be(e){return Array.isArray(e)?e:[e]}function rt(e,t,o){return n.watch(e,t,{...o,immediate:!0})}const $e=nt?window:void 0;function me(e){var t;const o=n.toValue(e);return(t=o?.$el)!==null&&t!==void 0?t:o}function Se(...e){const t=(u,l,d,b)=>(u.addEventListener(l,d,b),()=>u.removeEventListener(l,d,b)),o=n.computed(()=>{const u=be(n.toValue(e[0])).filter(l=>l!=null);return u.every(l=>typeof l!="string")?u:void 0});return rt(()=>{var u,l;return[(u=(l=o.value)===null||l===void 0?void 0:l.map(d=>me(d)))!==null&&u!==void 0?u:[$e].filter(d=>d!=null),be(n.toValue(o.value?e[1]:e[0])),be(n.unref(o.value?e[2]:e[1])),n.toValue(o.value?e[3]:e[2])]},([u,l,d,b],k,P)=>{if(!u?.length||!l?.length||!d?.length)return;const N=at(b)?{...b}:b,x=u.flatMap(R=>l.flatMap(T=>d.map(D=>t(R,T,D,N))));P(()=>{x.forEach(R=>R())})},{flush:"post"})}function Ve(e,t,o={}){const{window:u=$e,ignore:l=[],capture:d=!0,detectIframe:b=!1,controls:k=!1}=o;if(!u)return k?{stop:he,cancel:he,trigger:he}:he;let P=!0;const N=c=>n.toValue(l).some(v=>{if(typeof v=="string")return Array.from(u.document.querySelectorAll(v)).some(M=>M===c.target||c.composedPath().includes(M));{const M=me(v);return M&&(c.target===M||c.composedPath().includes(M))}});function x(c){const v=n.toValue(c);return v&&v.$.subTree.shapeFlag===16}function R(c,v){const M=n.toValue(c),O=M.$.subTree&&M.$.subTree.children;return O==null||!Array.isArray(O)?!1:O.some(W=>W.el===v.target||v.composedPath().includes(W.el))}const T=c=>{const v=me(e);if(c.target!=null&&!(!(v instanceof Element)&&x(e)&&R(e,c))&&!(!v||v===c.target||c.composedPath().includes(v))){if("detail"in c&&c.detail===0&&(P=!N(c)),!P){P=!0;return}t(c)}};let D=!1;const V=[Se(u,"click",c=>{D||(D=!0,setTimeout(()=>{D=!1},0),T(c))},{passive:!0,capture:d}),Se(u,"pointerdown",c=>{const v=me(e);P=!N(c)&&!!(v&&!c.composedPath().includes(v))},{passive:!0}),b&&Se(u,"blur",c=>{setTimeout(()=>{const v=me(e);let M=u.document.activeElement;for(;M?.shadowRoot;)M=M.shadowRoot.activeElement;M?.tagName==="IFRAME"&&!v?.contains(u.document.activeElement)&&t(c)},0)},{passive:!0})].filter(Boolean),p=()=>V.forEach(c=>c());return k?{stop:p,cancel:()=>{P=!1},trigger:c=>{P=!0,T(c),P=!1}}:p}const Oe=e=>{let t=null;const o=()=>{t?.disconnect(),t=null};return typeof window<"u"&&typeof window.IntersectionObserver=="function"&&n.watch([e.target,()=>e.root()],([l,d])=>{o(),l&&(t=new IntersectionObserver(([b])=>{b&&e.onChange(b)},{root:d,threshold:e.threshold??1}),t.observe(l))},{immediate:!0}),n.onUnmounted(o),{disconnect:o}},lt=".k-table-row",ue=e=>{if(e instanceof HTMLElement)return e;const t=e?.$el;return t instanceof HTMLElement?t:null},it=(e,t)=>t==="row"?e.matches("tr.k-table-row"):!e.matches("tr.k-table-row"),st=(e,t)=>{console.warn(`usePopupMenu: triggerMode "${t}" does not match resolved element <${e.tagName.toLowerCase()}${e.className?`.${e.className.split(" ").join(".")}`:""}>; ARIA management skipped.`)},ct=e=>{let t=e.parentElement,o=null;for(;t;){const{overflow:u,overflowX:l,overflowY:d}=window.getComputedStyle(t),b=/auto|scroll|overlay/.test(`${u} ${l}`),k=/auto|scroll|overlay/.test(`${u} ${d}`);if((b||k)&&(o??=t),b&&t.scrollWidth>t.clientWidth||k&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return o},ut=e=>{const t=n.ref(null),o=e.menuItemSelector??".k-menu-item:not(.k-disabled)",u=e.triggerMode,l=e.anchor===!0?{}:e.anchor,d=l?.activationPoint?l.activationPoint===!0?{}:l.activationPoint:null,b=n.shallowRef(null),k=n.shallowRef(null),P=l?.anchorAlign??{horizontal:"left",vertical:"bottom"},N=l?.popupAlign??{horizontal:"left",vertical:"top"},x=l?.collision??{horizontal:"flip",vertical:"flip"},R=n.shallowRef(null),T=()=>ue(e.triggerRef.value),D=n.computed(()=>T()),V=n.computed(()=>l&&l.hideWhenAnchorClipped!==!1?D.value:null),p=()=>{const m=l?.clipRoot?n.toValue(l.clipRoot):null;if(m){const w=m.getBoundingClientRect();return{left:w.left,top:w.top,right:w.right,bottom:w.bottom}}return{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},c=n.computed(()=>{const m=b.value;if(!e.isOpen.value||!m)return{left:0,top:0};const w=p(),z=Le({anchor:m,popup:R.value,anchorAlign:P,popupAlign:N,bounds:w,collision:x});return{left:z.left+window.scrollX,top:z.top+window.scrollY}}),v=()=>{const m=e.resolveFocusTarget?.()??ue(e.focusTargetRef?.value);return m||(e.focusTargetContainerSelector?T()?.closest(e.focusTargetContainerSelector)??null:null)},M=(m,w)=>{if(!d)return!1;const z=ue(m);if(!z)return k.value=null,!1;const a=z.getBoundingClientRect();if(w.triggerType==="keyboard"){const f=d.keyboardPosition,C=f?.y??"center",U=typeof C=="number"?C:C==="top"?0:C==="bottom"?a.height:a.height/2;return k.value={trigger:z,point:{x:f?.x??8,y:U},hasMatchedTrigger:!1},!0}return w.coordinates?(k.value={trigger:z,point:{x:w.coordinates.clientX-a.left+(d.pointerOffset?.x??0),y:w.coordinates.clientY-a.top+(d.pointerOffset?.y??0)},hasMatchedTrigger:!1},!0):(k.value=null,!1)},O=()=>{if(u!=="button")return null;if(e.escapeFocusTarget)return e.escapeFocusTarget();const m=e.escapeFocusContainerSelector??lt;return(T()??document.activeElement)?.closest(m)??null},W=()=>{const m=v()??O();if(m)return m.focus(),!0;const w=T();return w?.focus(),!!w},H=()=>{ue(e.menuRef.value)?.querySelector(o)?.focus({preventScroll:!0})},_=n.shallowRef(null),F=n.shallowRef(null);let r=!1;const h=()=>{const m=t.value;if(m==="keyboard"||m==="escape"){const w=_.value??F.value;w?.focus(),m==="keyboard"&&w&&w===F.value&&(r=!0)}else t.value==="mouse-selection"&&F.value?.focus();t.value=null,_.value=null,F.value=null},g=m=>{e.isOpen.value&&(t.value=m,_.value=v()??(m==="escape"?O():null),F.value=T(),K(!1),e.requestHide(),n.nextTick(h))};n.watch([D,k],([m],w,z)=>{if(!l||!m){b.value=null;return}let a=null;const f=()=>{a=null;const B=k.value;if(d){B&&B.trigger===m?B.hasMatchedTrigger=!0:B?.hasMatchedTrigger&&(B.trigger=m);const J=m.getBoundingClientRect();b.value=B?.trigger===m?new DOMRect(J.left+B.point.x,J.top+B.point.y,0,0):null;return}b.value=l.getRect?.(m)??m.getBoundingClientRect()},C=()=>{a===null&&(a=window.requestAnimationFrame(f))},U=typeof window.ResizeObserver=="function"?new window.ResizeObserver(C):null;U?.observe(m),window.addEventListener("scroll",C,{capture:!0,passive:!0}),window.addEventListener("resize",C,{passive:!0}),C(),z(()=>{a!==null&&window.cancelAnimationFrame(a),U?.disconnect(),window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)})},{immediate:!0,flush:"post"});const A=()=>{const m=ue(e.popupContentRef?.value??e.menuRef.value);return m?.closest(".k-popup")??m};l&&n.watch(e.isOpen,(m,w,z)=>{if(!m){R.value=null;return}let a=null;const f=()=>{a=null;const J=A();R.value=J?.getBoundingClientRect()??null},C=()=>{a===null&&(a=window.requestAnimationFrame(f))},U=A(),B=U&&typeof window.ResizeObserver=="function"?new window.ResizeObserver(C):null;B?.observe(U),C(),z(()=>{a!==null&&window.cancelAnimationFrame(a),B?.disconnect()})},{immediate:!0,flush:"post"}),Oe({target:V,root:()=>l?.clipRoot?n.toValue(l.clipRoot):D.value?ct(D.value):null,threshold:l?.intersectionThreshold??(d?0:.5),onChange:m=>{m.isIntersecting||g("anchor-hidden")}}),Ve(e.menuRef,()=>g("outside-click"),{ignore:[D]});let I=null,E=null;const L=()=>{I?.isConnected&&I.setAttribute("aria-expanded","false"),I=null},K=m=>{if(e.manageMenuTriggerAria===!1)return;const w=D.value;if(!w){I?.isConnected&&I.setAttribute("aria-expanded",m?"true":"false");return}if(!it(w,u)){st(w,u),L();return}I&&I!==w&&L(),w.setAttribute("aria-expanded",m?"true":"false"),I=w},X=()=>{const m=ue(e.menuRef.value),w=m?.matches('[role="menubar"]')?m:m?.querySelector('[role="menubar"]'),z=n.toValue(e.menuLabel)?.trim();E&&E!==w&&E.removeAttribute("aria-label"),w&&(z?w.setAttribute("aria-label",z):w.removeAttribute("aria-label")),E=w??null};n.watch([e.isOpen,e.triggerRef],([m])=>{K(m),!m&&d&&(k.value=null,b.value=null)},{immediate:!0,flush:"post"}),n.watch([e.isOpen,e.menuRef,()=>n.toValue(e.menuLabel)],X,{immediate:!0,flush:"post"}),n.onUnmounted(()=>{k.value=null,L(),E?.removeAttribute("aria-label")}),n.watch(e.isOpen,m=>{m&&H()},{flush:"post"});const ee=(...m)=>{const w=m[0];if(r){r=!1;return}if(e.isOpen.value){g("trigger-click");return}e.requestShow(w)};return{setAnchorActivation:M,handleMenuSelect:(m,w)=>{g(m.event?.type?.startsWith("key")?"keyboard":"mouse-selection"),w?.(m)},handleTriggerClick:ee,handleTriggerKeydown:(...m)=>{const w=m[0],z=m[1];if(w.key==="Enter"||w.code==="Space"){w.preventDefault(),ee(z);return}if(w.key==="Escape"){if(w.preventDefault(),w.stopPropagation(),e.isOpen.value){g("escape");return}W()}},handleMenuEscape:m=>{m.preventDefault(),m.stopPropagation(),g("escape")},handlePopupClose:()=>{n.nextTick(h)},offset:c}},dt=()=>{const e=new Set;return{register:l=>{e.add(l),n.onUnmounted(()=>e.delete(l))},deactivateOthers:l=>{e.forEach(d=>{d!==l&&d.deactivate()})},deactivateAll:()=>{e.forEach(l=>l.deactivate())}}},ft=e=>{if(e instanceof HTMLElement)return e;const t=e&&"$el"in e?e.$el:null;return t instanceof HTMLElement?t:null},pt=()=>{const e=n.shallowReactive(new Map),t=n.ref(null),o=(k,P)=>{const N=ft(P);N?e.set(k,N):e.delete(k)},u=k=>e.get(k)??null,l=k=>{t.value=k},d=()=>{t.value=null},b=k=>t.value===k;return{activeId:n.readonly(t),isActive:n.computed(()=>t.value!==null),activeElement:n.computed(()=>t.value!==null?u(t.value):null),register:o,resolve:u,activate:l,deactivate:d,isIdActive:b}},ke={title:"My Window",draggable:!0,resizable:!0,closable:!0,fixed:!0,minimizeButton:!0,maximizeButton:!0,initialLeft:void 0,initialTop:void 0,initialWidth:500,initialHeight:500,width:500,height:500,left:void 0,top:void 0},mt=e=>e==="DEFAULT"||e==="MINIMIZED"||e==="FULLSCREEN",gt=(e,t,o)=>Math.max(e-t-o,0);function ht(e={}){n.isRef(e.settings)&&(e.settings.value={...ke,...e.settings.value});const t=n.isRef(e.settings)?e.settings:n.ref({...ke,...e.settings}),o=n.shallowRef(null),u=n.ref(!1),l=n.ref(e.initialStage??"DEFAULT"),d=n.ref(!1),b=n.ref(!1),k=n.ref(0),P=n.ref(0),N=async F=>{const r=t.value.left!==void 0&&t.value.top!==void 0;if(F?.resetPosition||!r){const h=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize),g=Number.isFinite(h)?h:16,A=t.value.fixed?0:window.scrollX,I=t.value.fixed?0:window.scrollY;t.value.left=void 0,t.value.top=void 0,t.value.width=void 0,t.value.height=void 0,k.value=t.value.initialLeft??A+gt(window.innerWidth,t.value.initialWidth,g),P.value=t.value.initialTop??I+g,u.value=!0,await n.nextTick(),t.value.width=t.value.initialWidth,t.value.height=t.value.initialHeight}else u.value=!0;e.onOpen?.()},x=()=>{l.value="DEFAULT",u.value=!1,e.onClose?.()},R=(...F)=>{const r=F[2];if(typeof r!="object"||r===null||!("state"in r)||!mt(r.state))return;const h=r.state;h!==l.value&&(l.value=h,e.onStageChange?.(h))},T=(...F)=>{const r=F[0];if(typeof r=="object"&&r!==null&&"drag"in r&&"left"in r&&"top"in r&&"width"in r&&"height"in r&&typeof r.left=="number"&&typeof r.top=="number"&&typeof r.width=="number"&&typeof r.height=="number"){const h=r,g=o.value?.$el,I=(g instanceof Element?g.querySelector(".k-window-titlebar"):null)?.getBoundingClientRect(),E=I?.width??h.width,L=I?.height??h.height,K=t.value.fixed?0:window.scrollX,X=t.value.fixed?0:window.scrollY,ee=K+document.documentElement.clientWidth,oe=X+document.documentElement.clientHeight,i=Math.max(ee-E,K),S=Math.max(oe-L,X);t.value.left=Math.min(Math.max(h.left,K),i),t.value.top=Math.min(Math.max(h.top,X),S),d.value=h.drag&&!h.end,e.onMove?.(h)}},D=(...F)=>{const r=F[0];if(typeof r=="object"&&r!==null&&"drag"in r&&"left"in r&&"top"in r&&"width"in r&&"height"in r&&typeof r.left=="number"&&typeof r.top=="number"&&typeof r.width=="number"&&typeof r.height=="number"){const h=r;t.value.left=h.left,t.value.top=h.top,t.value.width=h.width,t.value.height=h.height,b.value=h.drag&&!h.end,e.onResize?.(h)}},V=F=>{F.target instanceof Element&&F.target.closest(".k-resize-handle")&&F.preventDefault()},p=F=>{n.toValue(e.titlebarDoubleClick)===!1&&F.target instanceof Element&&F.target.closest(".k-window-titlebar")&&(F.preventDefault(),F.stopPropagation())};let c,v;const M=()=>{c?.(),c=void 0},O=()=>{v?.(),v=void 0};n.watch(o,F=>{M(),O();const r=F?.$el;r instanceof HTMLElement&&(r.addEventListener("pointerdown",V,{capture:!0}),c=()=>r.removeEventListener("pointerdown",V,{capture:!0}),r.addEventListener("dblclick",p,{capture:!0}),v=()=>r.removeEventListener("dblclick",p,{capture:!0}))},{flush:"post"}),n.onScopeDispose(M),n.onScopeDispose(O);const W=n.computed(()=>{const F=["fk-window"];return t.value.draggable&&l.value!=="FULLSCREEN"&&F.push("fk-window-can-drag"),d.value&&F.push("fk-window-is-dragging"),b.value&&F.push("fk-window-is-resizing"),t.value.fixed&&F.push("fk-window-fixed"),t.value.minimizeButton||F.push("fk-window-hide-minimize"),t.value.maximizeButton||F.push("fk-window-hide-maximize"),t.value.closable||F.push("fk-window-hide-close"),F.join(" ")}),H=n.computed(()=>({title:t.value.title,draggable:t.value.draggable,resizable:t.value.resizable,left:t.value.left,top:t.value.top,initialLeft:k.value,initialTop:P.value,initialWidth:t.value.initialWidth,initialHeight:t.value.initialHeight,width:t.value.width,height:t.value.height,stage:l.value,windowClass:W.value}));return{windowRef:o,settings:t,visible:u,stage:l,isDragging:d,isResizing:b,props:H,events:{move:T,resize:D,stagechange:R,close:x},open:N,close:x}}function vt(e){const t=n.ref(""),o=n.ref(void 0),u=n.ref(!!e.debug),l=n.ref(e.dateFormat??"mm/dd/yyyy"),d=n.computed(()=>!!e.required),b=1e3,k=n.ref(!1),P=["ArrowUp","ArrowDown"],N=["ArrowLeft","ArrowRight"],x=n.computed(()=>(t.value??"").replace(/\D/g,"")),R=i=>i<=2?"mm":i<=5?"dd":x.value.length<=10?"yyyy":"mm",T=n.computed(()=>{const i=t.value&&t.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(i).toString().padStart(2,"0")}),D=n.computed(()=>{const i=t.value&&t.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(i).toString().padStart(2,"0")}),V=n.computed(()=>{const i=t.value&&t.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(i).toString().padStart(4,"0")}),p=i=>{if(x.value.length===0){e.onChange({value:null,event:i});return}if(x.value.length<8){e.onChange({value:null,event:i});return}if((t.value??"").length===10&&x.value.length===8){const[S,q,m]=t.value.split("/"),w=parseInt(S),z=parseInt(q),a=parseInt(m);if(H(a,w,z)){const f=O(a,w,z);c(f)?e.onChange({value:f,event:i}):e.onChange({value:null,event:i})}else e.onChange({value:null,event:i})}},c=i=>{const S=e.min??void 0,q=e.max??void 0;return!(S&&i<S||q&&i>q)},v=n.computed(()=>{if((t.value??"").length===10&&x.value.length===8){const[i,S,q]=(t.value??"").split("/"),m=parseInt(i),w=parseInt(S),z=parseInt(q);if(H(z,m,w))return O(z,m,w)}return null}),M=n.computed(()=>(t.value??"").length===10&&x.value.length===8),O=(i,S,q)=>{const m=new Date(0);return m.setFullYear(i,S-1,q),m.setHours(0,0,0,0),m},W=(i,S)=>O(i,S+1,0).getDate(),H=(i,S,q)=>S>=1&&S<=12&&i>=b&&q>=1&&q<=W(i,S),_=i=>{t.value=i.value;const S=i.event?.target;o.value=S?.selectionStart??0,p(i)},F=i=>{o.value=i.target.selectionStart??0},r=(i,S,q)=>{const m=S?.selectionStart??o.value??0;o.value=m;let w=parseInt(T.value),z=parseInt(D.value),a=parseInt(V.value);if(!(x.value.length>=8)||!H(a,w,z)){const G=e.defaultValue??new Date;w=G.getMonth()+1,z=G.getDate(),a=G.getFullYear(),t.value=`${String(w).padStart(2,"0")}/${String(z).padStart(2,"0")}/${String(a)}`;const le=O(a,w,z);e.onChange({value:c(le)?le:null,event:q}),E({useRAF:!0});return}const C=R(m);if(C==="mm")w=i==="ArrowUp"?w<12?w+1:1:w>1?w-1:12;else if(C==="dd"){const G=new Date(a,w,0).getDate();z=i==="ArrowUp"?z<G?z+1:1:z>1?z-1:G}else C==="yyyy"&&(a=i==="ArrowUp"?a+1:Math.max(1,a-1));t.value=`${String(w).padStart(2,"0")}/${String(z).padStart(2,"0")}/${String(a)}`;const[U,B,J]=t.value.split("/"),Z=O(parseInt(J),parseInt(U),parseInt(B));Z.toString()!=="Invalid Date"&&parseInt(J)>=1e3?e.onChange({value:c(Z)?Z:null,event:q}):e.onChange({value:null,event:q}),E({useRAF:!0})},h=i=>{if(i.code==="Space"||i.key===" "){i.preventDefault(),i.stopPropagation(),e.onShowCalendar(i);return}if(i.key==="ArrowDown"&&i.altKey){i.preventDefault(),i.stopPropagation(),e.onShowCalendar(i);return}if(P.includes(i.key)){if(i.altKey)return;i.preventDefault(),i.stopPropagation();const S=i.target;r(i.key,S,i);return}},g=i=>{i.preventDefault();const S=i.deltaY<0?"ArrowUp":"ArrowDown";r(S,i.target,i)},A=i=>{const S=i.target;if(N.includes(i.key)){o.value=S?.selectionStart??0;return}if(P.includes(i.key)){if(i.altKey)return;o.value=S?.selectionStart??0}},I=i=>{k.value=!0,d.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&x.value.length===0&&(e.externalValue.value="");const S=i.target;S&&(o.value=S.selectionStart??0)},E=i=>{const S=()=>{const q=document.getElementById(e.id);if(!q)return;const m=i?.pos??o.value??q.value.length;try{q.focus(),q.setSelectionRange(m,m)}catch{}};n.nextTick(()=>{if(i?.delay&&i.delay>0){setTimeout(S,i.delay);return}if(i?.useRAF){requestAnimationFrame(S);return}S()})};e.externalValue&&n.watch(e.externalValue,i=>{if(i){const S=new Date(i);if(S.toString()!=="Invalid Date"){const q=(S.getMonth()+1).toString().padStart(2,"0"),m=S.getDate().toString().padStart(2,"0"),w=S.getFullYear().toString();t.value=`${q}/${m}/${w}`,E({delay:50});return}}},{immediate:!0});const L=n.computed(()=>[["Date",`${T.value} / ${D.value} / ${V.value}`],["Digits only",x.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=n.computed(()=>{if(!d.value){if(!M.value)return!0;const S=v.value;return S?c(S):!1}if(!k.value)return!0;const i=v.value;return!M.value||!i?!1:c(i)}),X=n.computed(()=>{if(!d.value){if(!M.value)return;const S=v.value;return S?c(S)?"valid":"out-of-bounds":"invalid-date"}if(!k.value)return;if(x.value.length===0||!M.value)return"incomplete";const i=v.value;return i?c(i)?"valid":"out-of-bounds":"invalid-date"}),ee=n.computed(()=>{const i=X.value;if(!i||i==="valid")return"";if(i==="incomplete")return"Required";if(i==="invalid-date")return`Must be in ${l.value} format.`;const S=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,q=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(i==="out-of-bounds"){if(S&&q)return`Must be between ${S} and ${q}.`;if(S)return`Must be on or after ${S}.`;if(q)return`Must be on or before ${q}.`}return""}),oe=()=>{n.nextTick(()=>{const i=document.getElementById(e.id);if(!i){console.warn(`ID (#${e.id}) not found for styling.`);return}const S=i.closest(".k-datepicker");if(!S){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const q=S.parentElement;if(q){if(q.classList.contains("fk-datepicker"))return;q.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return n.onMounted(()=>{oe()}),{raw:t,cursorPos:o,debugEnabled:u,debugLines:L,placeholder:l,isValid:K,reason:n.readonly(X),validationMessage:ee,digitsOnly:x,month:n.readonly(T),day:n.readonly(D),year:n.readonly(V),datePart:R,handleChange:_,handleKeyDown:h,handleWheel:g,handleKeyUp:A,handleClick:F,handleBlur:I,initStyling:oe}}function yt(e){const t=n.ref(""),o=n.ref(void 0),u=n.ref(!!e.debug),l=n.ref(!1),d=1440*60*1e3,b=365*d,k=new Date,P=new Date(k.getTime()-b),N=new Date(k.getTime()+b);e.min=e.min??P,e.max=e.max??N;const x=n.computed(()=>(t.value??"").replace(/\D/g,"")),R=(s,y)=>new Date(s,y,0).getDate(),T=(s,y,$)=>y>=1&&y<=12&&s>=1e3&&$>=1&&$<=R(s,y),D=s=>Date.UTC(s.getFullYear(),s.getMonth(),s.getDate()),V=s=>{if(!s)return null;const y=e.min??new Date(Date.now()-90*d),$=e.max??new Date,Y=D(s);return Y<D(y)||Y>D($)?null:s},p=(s,y)=>e.allowReverse??!1?!0:s<=y,c=n.computed(()=>(t.value?.length??0)>=23&&x.value.length>=16),v=s=>{if((s??"").length<23||x.value.length<16)return{start:null,end:null};const y=s.substring(0,10),$=s.substring(13,23),[Y,te,ne]=y.split("/").map(ce=>parseInt(ce||"0",10)),[se,de,fe]=$.split("/").map(ce=>parseInt(ce||"0",10)),pe=new Date(ne,Y-1,te),ge=new Date(fe,se-1,de),Ae=T(ne,Y,te)&&pe.toString()!=="Invalid Date",De=T(fe,se,de)&&ge.toString()!=="Invalid Date";return{start:Ae?pe:null,end:De?ge:null}},M=e.externalValid??n.ref(!0),O=n.computed(()=>v(t.value)),W=n.computed(()=>{const s=V(O.value.start),y=V(O.value.end);return{start:s,end:y}}),H=n.computed(()=>{if(!c.value)return;const s=W.value.start,y=W.value.end;if(!s||!y)return;const $=Math.abs(D(y)-D(s));return Math.round($/864e5+1)}),_=n.ref(!1),F=n.computed(()=>{if(!_.value)return;const{start:s,end:y}=O.value;if(!c.value)return"incomplete";if(!s||!y)return"invalid-date";if(!W.value.start||!W.value.end)return"out-of-bounds";const $=W.value.start,Y=W.value.end;return p($,Y)?typeof e.maxSpanDays=="number"&&H.value!==void 0&&H.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),r=n.computed(()=>{const s=F.value;return s===void 0||s==="valid"}),h=n.computed(()=>{const{min:s,max:y}=e,$=F.value;if(!$)return"";switch($){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 s&&y?`Dates must be between ${E(s)} and ${E(y)}.`:"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""}}),g=["ArrowUp","ArrowDown"],A=["ArrowLeft","ArrowRight"],I=(s,y)=>String(s).padStart(y,"0"),E=s=>`${I(s.getMonth()+1,2)}/${I(s.getDate(),2)}/${I(s.getFullYear(),4)}`,L=s=>s<=2?{side:"start",part:"mm"}:s<=5?{side:"start",part:(s<=3,"dd")}:s<=11?{side:"start",part:"yyyy"}:s<=15?{side:"end",part:"mm"}:s<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},K=(s,y,$)=>{const Y=y?.selectionStart??o.value??0;o.value=Y;const{start:te,end:ne}=v(t.value);if(!te&&!ne){const Q=new Date,ie=E(Q);t.value=`${ie} - ${ie}`,e.onChange({value:{start:Q,end:Q},event:$}),n.nextTick(()=>{requestAnimationFrame(()=>{const ae=document.getElementById(e.id),re=o.value??0;ae&&(ae.focus(),ae.setSelectionRange(re,re))})});return}const se=new Date,de=L(Y);let fe=te?new Date(te):new Date(se),pe=ne?new Date(ne):new Date(se);const ge=(Q,ie)=>{if(ie==="mm"){const ae=Q.getMonth()+1,re=s==="ArrowUp"?ae<12?ae+1:1:ae>1?ae-1:12;Q.setMonth(re-1);const ve=R(Q.getFullYear(),re);Q.getDate()>ve&&Q.setDate(ve)}else if(ie==="dd"){const ae=R(Q.getFullYear(),Q.getMonth()+1),re=Q.getDate(),ve=s==="ArrowUp"?re<ae?re+1:1:re>1?re-1:ae;Q.setDate(ve)}else if(ie==="yyyy"){const ae=Q.getFullYear();Q.setFullYear(s==="ArrowUp"?ae+1:Math.max(1,ae-1));const re=R(Q.getFullYear(),Q.getMonth()+1);Q.getDate()>re&&Q.setDate(re)}};de.side==="start"?ge(fe,de.part):ge(pe,de.part);const Ae=E(fe),De=E(pe);t.value=`${Ae} - ${De}`;const ce=V(fe),Ee=V(pe);ce&&Ee&&p(ce,Ee)?e.onChange({value:{start:ce,end:Ee},event:$}):e.onChange({value:null,event:$}),n.nextTick(()=>{requestAnimationFrame(()=>{const Q=document.getElementById(e.id),ie=o.value??0;Q&&(Q.focus(),Q.setSelectionRange(ie,ie))})})},X=s=>{const{start:y,end:$}=v(t.value);if(!y||!$){e.onChange({value:null,event:s});return}const Y=V(y),te=V($);if(!Y||!te){e.onChange({value:null,event:s});return}if(!p(Y,te)){e.onChange({value:null,event:s});return}e.onChange({value:{start:Y,end:te},event:s})},ee=s=>{const y=s.value??"",$=s.event;if(!y&&$&&$.type==="click"){z($);return}t.value=y;const Y=$?.target;o.value=Y?.selectionStart??0,X(s)},oe=s=>{o.value=s.target.selectionStart??0},i=s=>{if(s.code==="Space"||s.key===" "){s.preventDefault(),s.stopPropagation(),e.onShowCalendar(s);return}if(s.key==="ArrowDown"&&s.altKey){s.preventDefault(),s.stopPropagation(),e.onShowCalendar(s);return}if(g.includes(s.key)){s.preventDefault(),s.stopPropagation();const y=s.target;K(s.key,y,s);return}},S=s=>{s.preventDefault();const y=s.deltaY<0?"ArrowUp":"ArrowDown";K(y,s.target,s)},q=s=>{if(A.includes(s.key)||g.includes(s.key)){const y=s.target;o.value=y?.selectionStart??0}},m=()=>{_.value=!0,(e.manageValid??!0)&&(M.value=r.value)},w=s=>{m()},z=s=>{t.value="",o.value=0,e.onChange({value:null,event:s}),m(),n.nextTick(()=>{const y=document.getElementById(e.id);y&&(y.focus(),y.setSelectionRange(0,0))})};e.externalValue&&n.watch(e.externalValue,s=>{const y=s?.start??null,$=s?.end??null;if(y&&$){if(t.value=`${E(y)} - ${E($)}`,e.isOpen?.value&&l.value&&e.onRequestClose){const Y=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),l.value=!1,m()},Y)}return}},{immediate:!0});const a=n.computed(()=>t.value&&t.value.substring(0,2).replace(/\D/g,"0")||"0"),f=n.computed(()=>t.value&&t.value.substring(3,5).replace(/\D/g,"0")||"0"),C=n.computed(()=>t.value&&t.value.substring(6,10).replace(/\D/g,"0")||"0"),U=n.computed(()=>t.value&&t.value.substring(13,15).replace(/\D/g,"0")||"0"),B=n.computed(()=>t.value&&t.value.substring(16,18).replace(/\D/g,"0")||"0"),J=n.computed(()=>t.value&&t.value.substring(19,23).replace(/\D/g,"0")||"0"),Z=n.computed(()=>{const{start:s,end:y}=v(t.value);return[{label:"Raw",value:t.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(f.value).padStart(2,"0")} / ${String(C.value).padStart(4,"0")}`},{label:"End",value:`${String(U.value).padStart(2,"0")} / ${String(B.value).padStart(2,"0")} / ${String(J.value).padStart(4,"0")}`},{label:"Digits only",value:x.value},{label:"Mask complete",value:`${c.value}`},{label:"Parsed",value:`${s?s.toDateString():"-"} | ${y?y.toDateString():"-"}`},{label:"Valid (managed)",value:`${M.value??"-"}`},{label:"Span (days)",value:`${H.value??"-"}`},{label:"Reason",value:`${F.value??"-"}`},{label:"Cursor in",value:`${o.value??"-"} (${(()=>{const $=o.value??0,Y=L($);return`${Y.side}.${Y.part}`})()})`}]}),G=()=>{n.nextTick(()=>{const s=document.getElementById(e.id);if(!s){console.warn(`#${e.id} not found for styling.`);return}const y=s.closest("div");if(!y){console.warn(`Parent div of #${e.id} not found for styling.`);return}y.classList.contains("fk-daterangepicker")||y.classList.add("fk-daterangepicker")})};n.onMounted(()=>{G()});const le=()=>{n.nextTick(()=>{try{const s=Array.from(document.querySelectorAll(".k-animation-container"));if(!s.length)return;const $=[...s].reverse().find(ne=>ne.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!$)return;const Y=$.querySelectorAll(".k-calendar-table");let te=!1;Y.forEach(ne=>{ne.tabIndex===0&&(te?ne.tabIndex=-1:te=!0)})}catch(s){console.warn(s)}})};return e.isOpen&&n.watch(e.isOpen,s=>{s&&setTimeout(()=>le(),0)},{immediate:!1}),{raw:t,cursorPos:o,debugEnabled:u,debugLines:Z,digitsOnly:x,valid:M,validComputed:n.readonly(r),reason:n.readonly(F),validationMessage:n.readonly(h),spanDays:n.readonly(H),month1:n.readonly(a),day1:n.readonly(f),year1:n.readonly(C),month2:n.readonly(U),day2:n.readonly(B),year2:n.readonly(J),handleChange:ee,handleKeyDown:i,handleWheel:S,handleKeyUp:q,handleClick:oe,handleBlur:w,handleClear:z,onCalendarChange:()=>{l.value=!0},initStyling:G}}function wt(e){const t=n.ref(""),o=n.ref(void 0),u=n.ref(!!e.debug),l=n.ref(e.timeFormat??"hh:mm AM"),d=n.computed(()=>!!e.required),b=n.ref(!1),k=["ArrowUp","ArrowDown"],P=["ArrowLeft","ArrowRight"],N=n.computed(()=>(t.value??"").replace(/\D/g,"")),x={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},R=a=>a<=2?"hh":a<=5?"mm":"ampm",T=n.computed(()=>{const a=t.value&&t.value.substring(0,2).replace(/\D/g,"0")||"0",f=parseInt(a);return Math.min(Math.max(f,0),23)}),D=n.computed(()=>{const a=t.value&&t.value.substring(3,5).replace(/\D/g,"0")||"0",f=parseInt(a);return Math.min(Math.max(f,0),59)}),V=n.computed(()=>(t.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),p=n.computed(()=>{const a=parseInt(t.value?.substring(0,2).replace(/\D/g,"0")||"0"),f=V.value;return a===12?f==="AM"?0:12:f==="PM"?a+12:a}),c=n.computed(()=>v.value?`${String(p.value).padStart(2,"0")}:${String(D.value).padStart(2,"0")}:00`:null),v=n.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value??"")),M=(a,f,C)=>{let U=a%12;return U===0&&(U=12),`${String(U).padStart(2,"0")}:${String(f).padStart(2,"0")} ${C}`},O=a=>{const f=a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!f)return null;const C=parseInt(f[1]),U=parseInt(f[2]),B=f[3].toUpperCase();if(C<1||C>12||U<0||U>59)return null;let J=C%12;B==="PM"&&(J+=12);const Z=new Date;return Z.setSeconds(0,0),Z.setHours(J),Z.setMinutes(U),Z},W=a=>{if(N.value.length===0){e.onChange({value:null,event:a});return}if(!v.value){e.onChange({value:null,event:a});return}const f=O(t.value);f&&_(f)?e.onChange({value:f,event:a}):e.onChange({value:null,event:a})},H=a=>a.getHours()*60+a.getMinutes(),_=a=>{const f=e.min??void 0,C=e.max??void 0,U=H(a);if(f){const B=H(f);if(U<B)return!1}if(C){const B=H(C);if(U>B)return!1}return!0},F=a=>{const f=a.getHours(),C=f>=12?"PM":"AM";t.value=M(f,a.getMinutes(),C)},r=(a,f)=>{e.onChange({value:a,event:f})},h=()=>{n.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const a=document.getElementById(e.id);if(a){a.focus();const f=(a.value??"").length;a.setSelectionRange(f,f)}})})})},g=a=>{const f=a?.event?.target;return f?f.closest(".k-time-now")?"now":f.closest(".k-time-accept")?"set":null:null},A=(a,f)=>{a&&_(a)?r(a,f):r(null,f)},I=(...a)=>{const f=a[0];if(!f)return;const C=g(f);if(C==="now"){const B=new Date;F(B),A(B,f),h();return}if(f?.value instanceof Date){const B=new Date(f.value);F(B),A(B,f),C==="set"&&h();return}if(f?.value===null){t.value="",r(null,f);return}t.value=f.value;const U=f.event?.target;o.value=U?.selectionStart??0;try{const B=o.value??0;if(R(B)==="ampm"&&(t.value??"").length>=8){const J=t.value.charAt(6);/[Aa]/.test(J)?(t.value=`${t.value.slice(0,6)}AM${t.value.slice(8)}`,n.nextTick(()=>{requestAnimationFrame(()=>{const Z=document.getElementById(e.id);Z&&(Z.focus(),Z.setSelectionRange(8,8))})})):/[Pp]/.test(J)&&(t.value=`${t.value.slice(0,6)}PM${t.value.slice(8)}`,n.nextTick(()=>{requestAnimationFrame(()=>{const Z=document.getElementById(e.id);Z&&(Z.focus(),Z.setSelectionRange(8,8))})}))}}catch{}W(f)},E=a=>{o.value=a.target.selectionStart??0},L=(a,f,C)=>{const U=f?.selectionStart??o.value??0;o.value=U;const B=R(U),J=(t.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!J){if((t.value??"").length===0||N.value.length===0){const y=new Date,$=y.getHours(),Y=$>=12?"PM":"AM";t.value=M($,y.getMinutes(),Y);const te=O(t.value);A(te,C),n.nextTick(()=>{requestAnimationFrame(()=>{const ne=document.getElementById(e.id),se=o.value??0;ne&&(ne.focus(),ne.setSelectionRange(se,se))})})}return}let Z=parseInt(J[1]),G=parseInt(J[2]),le=J[3].toUpperCase();if(B==="hh")a==="ArrowUp"?Z=Z<12?Z+1:1:Z=Z>1?Z-1:12;else if(B==="mm"){const y=e.minuteStepRef?.value??e.minuteStep??1;if(y===1)a==="ArrowUp"?G=G<59?G+1:0:G=G>0?G-1:59;else if(a==="ArrowUp"){const $=G%y;let Y=$===0?G+y:G+(y-$);Y>=60&&(Y=0),G=Y}else{const $=G%y;let Y=$===0?G-y:G-$;Y<0&&(Y=60-y),G=Y}}else B==="ampm"&&(le=le==="AM"?"PM":"AM");t.value=`${String(Z).padStart(2,"0")}:${String(G).padStart(2,"0")} ${le}`;const s=O(t.value);A(s,C),n.nextTick(()=>{requestAnimationFrame(()=>{const y=document.getElementById(e.id),$=o.value??0;y&&(y.focus(),y.setSelectionRange($,$))})})},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(k.includes(a.key)){if(a.altKey)return;a.preventDefault(),a.stopPropagation();const f=a.target;L(a.key,f,a);return}},X=a=>{a.preventDefault();const f=a.deltaY<0?"ArrowUp":"ArrowDown";L(f,a.target,a)},ee=a=>{const f=a.target;if(P.includes(a.key)){o.value=f?.selectionStart??0;return}if(k.includes(a.key)){if(a.altKey)return;o.value=f?.selectionStart??0}},oe=a=>{b.value=!0,d.value&&e.externalValue&&e.externalValue.value===void 0&&N.value.length===0&&(e.externalValue.value="");const f=a.target;f&&(o.value=f.selectionStart??0)};e.externalValue&&n.watch(e.externalValue,a=>{if(a){const f=new Date(a);if(f.toString()!=="Invalid Date"){const C=f.getHours(),U=C>=12?"PM":"AM";t.value=M(C,f.getMinutes(),U);return}}},{immediate:!0});const i=n.computed(()=>[["Time",t.value||"--:-- --"],["Hour (12h)",T.value],["Hour (24h)",p.value],["Minute",D.value],["Period",V.value],["Time (24h)",c.value??"--:--:--"],["Digits only",N.value],["Parsed Date",S.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",q.value],["reason",m.value],["validationMessage",w.value]]),S=n.computed(()=>O(t.value)??null),q=n.computed(()=>{if(!d.value){if(!v.value)return!0;const f=S.value;return f?_(f):!1}if(!b.value)return!0;const a=S.value;return!v.value||!a?!1:_(a)}),m=n.computed(()=>{if(!d.value){if(!v.value)return;const f=S.value;return f?_(f)?"valid":"out-of-bounds":"invalid-time"}if(!b.value)return;if(N.value.length===0||!v.value)return"incomplete";const a=S.value;return a?_(a)?"valid":"out-of-bounds":"invalid-time"}),w=n.computed(()=>{const a=m.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-time")return`Must be in ${l.value} format.`;const f={hour:"2-digit",minute:"2-digit"},C=e.min?e.min.toLocaleTimeString("en-US",f):null,U=e.max?e.max.toLocaleTimeString("en-US",f):null;if(a==="out-of-bounds"){if(C&&U)return`Must be between ${C} and ${U}.`;if(C)return`Must be ${C} or later.`;if(U)return`Must be ${U} or earlier.`}return""}),z=()=>{n.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`#${e.id} not found for styling.`);return}const f=a.closest(".k-timepicker");if(!f){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const C=f.parentElement;if(!C){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}C.classList.contains("fk-timepicker")||C.classList.add("fk-timepicker")})};return n.onMounted(()=>{z()}),{raw:t,rules:x,debugEnabled:u,debugLines:i,placeholder:l,isValid:q,reason:n.readonly(m),validationMessage:w,isComplete:v,inRangeTime:_,cursorPos:o,hour:n.readonly(T),hour24:n.readonly(p),minute:n.readonly(D),period:n.readonly(V),time24:n.readonly(c),parsedRawTime:n.readonly(S),handleChange:I,handleKeyDown:K,handleKeyUp:ee,handleClick:E,handleWheel:X,handleBlur:oe,initStyling:z}}const bt={returnFocusToTrigger:!1,focusTrapOptions:{returnFocusOnDeactivate:!1}};function St(e){const t=n.shallowRef(null),o=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],u=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??o].flat(),l=x=>x?typeof e.initialFocus=="string"?x.querySelector(e.initialFocus)??x:typeof e.initialFocus=="function"?e.initialFocus(x)??x:x.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??x:null,{activate:d,deactivate:b}=Ne.useFocusTrap(t,{escapeDeactivates:!1,clickOutsideDeactivates:!1,allowOutsideClick:!0,fallbackFocus:()=>t.value,initialFocus:()=>l(t.value),...e.focusTrapOptions??{}});let k=null,P=n.ref(null);const N=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const x=(T,D)=>{const V=Array.from(T.querySelectorAll(D));if(!V.length)return null;const p=V.filter(c=>c.offsetParent!==null||c.getClientRects().length>0);return p[p.length-1]??V[V.length-1]??null},R=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const T of u){const D=x(R,T);if(D)return D}for(const T of u){const D=x(document,T);if(D)return D}return null};return Ve(t,x=>{P.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",x)}),n.watch(()=>e.isOpen.value,x=>{x?(P.value=null,n.nextTick(()=>{const R=N();R&&(R.tabIndex<0&&(R.tabIndex=-1),t.value=R,setTimeout(()=>{try{d()}catch(T){console.warn("usePopupTrap: focus trap failed to activate",T)}},0),k||(k=T=>{T.key==="Escape"&&(P.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",T))},document.addEventListener("keydown",k,!0)))})):(b(),k&&(document.removeEventListener("keydown",k,!0),k=null),t.value=null,P.value==="outside"&&n.nextTick(()=>{const R=()=>{const T=e.triggerEl?.value,D=T?.querySelector("input"),V=document.activeElement;V&&(V===D||T&&T.contains(V))&&(D??T)?.blur?.()};requestAnimationFrame(()=>setTimeout(R,0))}),e.returnFocusToTrigger!==!1&&P.value==="escape"&&e.triggerEl?.value&&n.nextTick(()=>{const R=()=>{const T=e.triggerEl?.value;if(!T)return;(T.querySelector("input")??T)?.focus?.()};requestAnimationFrame(()=>setTimeout(R,0))}))}),{popupRef:t,activate:d,deactivate:b,lastCloseReason:n.readonly(P),setPopupEl:x=>t.value=x}}j.POPUP_MENU_TRAP_OPTIONS=bt,j.WINDOW_SETTINGS_DEFAULTS=ke,j.computeCollisionOffset=Le,j.useActiveIdRegistry=pt,j.useCompositeId=tt,j.useExclusiveGroup=dt,j.useFieldsetTouchTracker=Ie,j.useFieldsetValidationKit=Ce,j.useGridA11y=ze,j.useGridActiveFilter=Ue,j.useGridRowAction=Ye,j.useIntersectionObserver=Oe,j.useMaskedDateInput=vt,j.useMaskedDateRangeInput=yt,j.useMaskedTimeInput=wt,j.usePopupMenu=ut,j.usePopupTrap=St,j.useUSAddress=et,j.useWindow=ht,j.useZipTextBox=Me,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})}));
|
|
2
2
|
//# sourceMappingURL=featherk-composables.umd.js.map
|