1var m=Object.defineProperty;var T=(l,t,e)=>t in l?m(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var o=(l,t,e)=>T(l,typeof t!="symbol"?t+"":t,e);import{b as f}from"./events.D6srCRP6.js";import{f as d}from"./toast.DyMQi0Zr.js";const r=class r{constructor(){o(this,"_handleValidationTriggerClick",t=>{const e=t.target instanceof Element?t.target:null,n=e?e.closest(`[${r.TRIGGER_ATTRIBUTE}]`):null;if(!(n instanceof HTMLElement))return;const{valid:i,targets:a}=this.validateTrigger(n);i||(t.preventDefault(),t.stopImmediatePropagation(),f(n,"ui-validation:blocked",{targets:a},{source:"validation"}))})}install(){typeof document>"u"||r.listenerController||(r.listenerController=new AbortController,document.addEventListener("click",this._handleValidationTriggerClick,{capture:!0,signal:r.listenerController.signal}))}uninstall(){var t;(t=r.listenerController)==null||t.abort(),r.listenerController=null}validateTrigger(t){const e=this._resolveValidationTargets(t);let n=!0,i=!0;return e.forEach(a=>{this._validateContainer(a,{focusFirstInvalid:i})||(n=!1,i=!1)}),{valid:n,targets:e}}_validateContainer(t,{focusFirstInvalid:e=!0}={}){const n=this._collectValidatableElements(t);let i=null,a=!0;return n.forEach(s=>{const u=!!s.validate();!u&&!i&&(i=s),u||(a=!1)}),!a&&e&&i&&this._focusInvalidField(i),a}_collectValidatableElements(t){if(!t||typeof t.querySelectorAll!="function")return[];const e=[];for(const n of Array.from(t.querySelectorAll(r.VALIDATABLE_FIELD_SELECTOR))){if(!(n instanceof HTMLElement))continue;const i=n,a=!!(i.offsetWidth||i.offsetHeight||i.getClientRects().length);typeof i.validate=="function"&&!i.disabled&&a&&e.push(i)}return e}_resolveValidationTargets(t){const e=(t.getAttribute(r.TRIGGER_ATTRIBUTE)||"").trim();if(!e){const n=t.closest("form");return n?[n]:[document.querySelector("#main-content")||document.body]}try{return Array.from(document.querySelectorAll(e)).filter(n=>n instanceof HTMLElement)}catch{return[]}}_focusInvalidField(t){var i,a;const e="input:not([type='hidden']):not([disabled]), textarea:not([disabled]), select:not([disabled]), [contenteditable='true'], [tabindex]:not([tabindex='-1'])",n=(i=t.matches)!=null&&i.call(t,e)?t:(a=t.querySelector)==null?void 0:a.call(t,e);if(n instanceof HTMLElement){n.focus(),d(n,{behavior:"smooth",block:"center"});return}typeof t.focus=="function"&&(t.focus(),d(t,{behavior:"smooth",block:"center"}))}};o(r,"TRIGGER_ATTRIBUTE","data-validate-target"),o(r,"VALIDATABLE_FIELD_SELECTOR","[data-validatable-field='true']"),o(r,"listenerController",null);let c=r;const g=new c;function h(){g.install()}function I(l){const{valid:t,targets:e}=g.validateTrigger(l);return t||f(l,"ui-validation:blocked",{targets:e},{source:"validation"}),t}export{h as i,I as v};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.