import{$ as P,aX as j,ce as U,a3 as k,cf as C,r as w,a7 as O,z as b,ar as $,d as N,H as D,t as K,N as L,A as T,Z as p,ac as F,U as x,aU as z,ad as M}from"./D8zG9Ut8.js";import{u as B}from"./B_NqmWCc.js";import{u as H}from"./CThvs1cs.js";function A(e){"@babel/helpers - typeof";return A=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(e)}function V(e){var t=typeof e=="string"||e instanceof String;if(!t){var r=A(e);throw e===null?r="null":r==="object"&&(r=e.constructor.name),new TypeError("Expected a string but received a ".concat(r))}}function I(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;for(var r in t)typeof e[r]>"u"&&(e[r]=t[r]);return e}var Z={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_numeric_tld:!1,allow_wildcard:!1,ignore_max_length:!1};function Q(e,t){V(e),t=I(t,Z),t.allow_trailing_dot&&e[e.length-1]==="."&&(e=e.substring(0,e.length-1)),t.allow_wildcard===!0&&e.indexOf("*.")===0&&(e=e.substring(2));var r=e.split("."),o=r[r.length-1];return t.require_tld&&(r.length<2||!t.allow_numeric_tld&&!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(o)||/\s/.test(o))||!t.allow_numeric_tld&&/^\d+$/.test(o)?!1:r.every(function(l){return!(l.length>63&&!t.ignore_max_length||!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(l)||/[\uff01-\uff5e]/.test(l)||/^-|-$/.test(l)||!t.allow_underscores&&/_/.test(l))})}var q="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",_="(".concat(q,"[.]){3}").concat(q),W=new RegExp("^".concat(_,"$")),i="(?:[0-9a-fA-F]{1,4})",X=new RegExp("^("+"(?:".concat(i,":){7}(?:").concat(i,"|:)|")+"(?:".concat(i,":){6}(?:").concat(_,"|:").concat(i,"|:)|")+"(?:".concat(i,":){5}(?::").concat(_,"|(:").concat(i,"){1,2}|:)|")+"(?:".concat(i,":){4}(?:(:").concat(i,"){0,1}:").concat(_,"|(:").concat(i,"){1,3}|:)|")+"(?:".concat(i,":){3}(?:(:").concat(i,"){0,2}:").concat(_,"|(:").concat(i,"){1,4}|:)|")+"(?:".concat(i,":){2}(?:(:").concat(i,"){0,3}:").concat(_,"|(:").concat(i,"){1,5}|:)|")+"(?:".concat(i,":){1}(?:(:").concat(i,"){0,4}:").concat(_,"|(:").concat(i,"){1,6}|:)|")+"(?::((?::".concat(i,"){0,5}:").concat(_,"|(?::").concat(i,"){1,7}|:))")+")(%[0-9a-zA-Z-.:]{1,})?$");function S(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return V(e),t=String(t),t?t==="4"?W.test(e):t==="6"?X.test(e):!1:S(e,4)||S(e,6)}function G(e,t){return te(e)||ee(e,t)||Y(e,t)||J()}function J(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y(e,t){if(e){if(typeof e=="string")return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(e,t)}}function E(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function ee(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,l,s,f,u=[],n=!0,a=!1;try{if(s=(r=r.call(e)).next,t!==0)for(;!(n=(o=s.call(r)).done)&&(u.push(o.value),u.length!==t);n=!0);}catch(c){a=!0,l=c}finally{try{if(!n&&r.return!=null&&(f=r.return(),Object(f)!==f))return}finally{if(a)throw l}}return u}}function te(e){if(Array.isArray(e))return e}var re={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1,allow_fragments:!0,allow_query_components:!0,validate_length:!0},ne=/^\[([^\]]+)\](?::([0-9]+))?$/;function ae(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function R(e,t){for(var r=0;r<t.length;r++){var o=t[r];if(e===o||ae(o)&&o.test(e))return!0}return!1}function le(e,t){if(V(e),!e||/[\s<>]/.test(e)||e.indexOf("mailto:")===0||(t=I(t,re),t.validate_length&&e.length>=2083)||!t.allow_fragments&&e.includes("#")||!t.allow_query_components&&(e.includes("?")||e.includes("&")))return!1;var r,o,l,s,f,u,n,a;if(n=e.split("#"),e=n.shift(),n=e.split("?"),e=n.shift(),n=e.split("://"),n.length>1){if(r=n.shift().toLowerCase(),t.require_valid_protocol&&t.protocols.indexOf(r)===-1)return!1}else{if(t.require_protocol)return!1;if(e.slice(0,2)==="//"){if(!t.allow_protocol_relative_urls)return!1;n[0]=e.slice(2)}}if(e=n.join("://"),e==="")return!1;if(n=e.split("/"),e=n.shift(),e===""&&!t.require_host)return!0;if(n=e.split("@"),n.length>1){if(t.disallow_auth||n[0]===""||(o=n.shift(),o.indexOf(":")>=0&&o.split(":").length>2))return!1;var c=o.split(":"),y=G(c,2),g=y[0],h=y[1];if(g===""&&h==="")return!1}s=n.join("@"),u=null,a=null;var d=s.match(ne);if(d?(l="",a=d[1],u=d[2]||null):(n=s.split(":"),l=n.shift(),n.length&&(u=n.join(":"))),u!==null&&u.length>0){if(f=parseInt(u,10),!/^[0-9]+$/.test(u)||f<=0||f>65535)return!1}else if(t.require_port)return!1;return t.host_whitelist?R(l,t.host_whitelist):l===""&&!t.require_host?!0:!(!S(l)&&!Q(l,t)&&(!a||!S(a,6))||(l=l||a,t.host_blacklist&&R(l,t.host_blacklist)))}const oe=P({...j(),...U()},"VForm"),ie=k()({name:"VForm",props:oe(),emits:{"update:modelValue":e=>!0,submit:e=>!0},setup(e,t){let{slots:r,emit:o}=t;const l=C(e),s=w();function f(n){n.preventDefault(),l.reset()}function u(n){const a=n,c=l.validate();a.then=c.then.bind(c),a.catch=c.catch.bind(c),a.finally=c.finally.bind(c),o("submit",a),a.defaultPrevented||c.then(y=>{var h;let{valid:g}=y;g&&((h=s.value)==null||h.submit())}),a.preventDefault()}return O(()=>{var n;return b("form",{ref:s,class:["v-form",e.class],style:e.style,novalidate:!0,onReset:f,onSubmit:u},[(n=r.default)==null?void 0:n.call(r,l)])}),$(l,s)}}),fe=N({__name:"ScannerForm",props:{scanner:{type:Object,default:()=>({endpoint:"",apiKey:"",name:""})},isEditMode:{type:Boolean,defualt:!1}},emits:["close-form"],setup(e,{emit:t}){const r={endpoint:"",apiKey:"",name:""},o=e,l=w(),s=w(!1),f=t,u=B(),n=H(),a=w(r),c={required:d=>d.trim()!==""||"This field is required",url:d=>le(d)||"Must be a valid URL"};D(o.scanner,d=>{a.value={...d}},{immediate:!0,deep:!0});const y=async()=>{if(s.value===!0&&a.value!==null)try{u.addOrUpdateScanner(a.value),g(),f("close-form"),n.reportSuccess("Scanner saved successfully.")}catch{n.reportError("Failed to save scanner information. Please try again.")}},g=()=>{a.value=r},h=()=>{g(),f("close-form")};return(d,m)=>(K(),L(ie,{ref_key:"form",ref:l,modelValue:p(s),"onUpdate:modelValue":m[3]||(m[3]=v=>z(s)?s.value=v:null),onSubmit:M(y,["prevent"])},{default:T(()=>[b(F,{modelValue:p(a).endpoint,"onUpdate:modelValue":m[0]||(m[0]=v=>p(a).endpoint=v),variant:"outlined",density:"compact",label:"Scanner Endpoint",placeholder:"https://api.example.com/graphql",disabled:e.isEditMode===!0,rules:[c.required,c.url]},null,8,["modelValue","disabled","rules"]),b(F,{modelValue:p(a).name,"onUpdate:modelValue":m[1]||(m[1]=v=>p(a).name=v),variant:"outlined",density:"compact",label:"Scanner Name",placeholder:"Scanner Name"},null,8,["modelValue"]),b(F,{modelValue:p(a).apiKey,"onUpdate:modelValue":m[2]||(m[2]=v=>p(a).apiKey=v),variant:"outlined",density:"compact",label:"API Key",placeholder:"Enter API Key",rules:[c.required]},null,8,["modelValue","rules"]),b(x,{class:"me-2",type:"submit",color:"success",text:"Save","prepend-icon":"mdi-check",disabled:!p(s)},null,8,["disabled"]),b(x,{text:"Cancel","prepend-icon":"mdi-close",onClick:h})]),_:1},8,["modelValue"]))}});export{ie as V,fe as _};
