var U=Object.defineProperty;var B=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var O=(c,u,a)=>u in c?U(c,u,{enumerable:!0,configurable:!0,writable:!0,value:a}):c[u]=a,L=(c,u)=>{for(var a in u||(u={}))H.call(u,a)&&O(c,a,u[a]);if(B)for(var a of B(u))Q.call(u,a)&&O(c,a,u[a]);return c};var D=(c,u,a)=>new Promise((d,l)=>{var P=w=>{try{x(a.next(w))}catch(I){l(I)}},m=w=>{try{x(a.throw(w))}catch(I){l(I)}},x=w=>w.done?d(w.value):Promise.resolve(w.value).then(P,m);x((a=a.apply(c,u)).next())});import{_ as W,d as J,r as S,x as K,P as X,o as k,c as C,f as p,w as g,j as R,F as z,Q as j,s as T,h as V,t as Y,g as Z,i as N,T as $}from"./index.js";var ee=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},G={exports:{}};(function(c){(function(u){const a="(0?\\d+|0x[a-f0-9]+)",d={fourOctet:new RegExp(`^${a}\\.${a}\\.${a}\\.${a}$`,"i"),threeOctet:new RegExp(`^${a}\\.${a}\\.${a}$`,"i"),twoOctet:new RegExp(`^${a}\\.${a}$`,"i"),longValue:new RegExp(`^${a}$`,"i")},l=new RegExp("^0[0-7]+$","i"),P=new RegExp("^0x[a-f0-9]+$","i"),m="%[0-9a-z]{1,}",x="(?:[0-9a-f]+::?)+",w={zoneIndex:new RegExp(m,"i"),native:new RegExp(`^(::)?(${x})?([0-9a-f]+)?(::)?(${m})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${a}\\.${a}\\.${a}\\.${a}(${m})?)$`,"i"),transitional:new RegExp(`^((?:${x})|(?:::)(?:${x})?)${a}\\.${a}\\.${a}\\.${a}(${m})?$`,"i")};function I(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r=0,n=-1,o=(e.match(w.zoneIndex)||[])[0],s,h;for(o&&(o=o.substring(1),e=e.replace(/%.+$/,""));(n=e.indexOf(":",n+1))>=0;)r++;if(e.substr(0,2)==="::"&&r--,e.substr(-2,2)==="::"&&r--,r>t)return null;for(h=t-r,s=":";h--;)s+="0:";return e=e.replace("::",s),e[0]===":"&&(e=e.slice(1)),e[e.length-1]===":"&&(e=e.slice(0,-1)),t=function(){const A=e.split(":"),_=[];for(let M=0;M0;){if(s=r-n,s<0&&(s=0),e[o]>>s!==t[o]>>s)return!1;n-=r,o+=1}return!0}function v(e){if(P.test(e))return parseInt(e,16);if(e[0]==="0"&&!isNaN(parseInt(e[1],10))){if(l.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function b(e,t){for(;e.length=0;o-=1)if(s=this.octets[o],s in n){if(h=n[s],r&&h!==0)return null;h!==8&&(r=!0),t+=h}else return null;return 32-t},e.prototype.range=function(){return i.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return i.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),i.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[];let s=0;for(;s<4;)o.push(parseInt(r[s],10)|parseInt(n[s],10)^255),s++;return new this(o)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},i.IPv4.isIPv4=function(e){return this.parser(e)!==null},i.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(t){return!1}},i.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch(t){return!1}},i.IPv4.isValidFourPartDecimal=function(e){return!!(i.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},i.IPv4.networkAddressFromCIDR=function(e){let t,r,n,o,s;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),s=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],r=0;r<4;)o.push(parseInt(n[r],10)&parseInt(s[r],10)),r++;return new this(o)}catch(h){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},i.IPv4.parse=function(e){const t=this.parser(e);if(t===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},i.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const r=parseInt(t[2]);if(r>=0&&r<=32){const n=[this.parse(t[1]),r];return Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},i.IPv4.parser=function(e){let t,r,n;if(t=e.match(d.fourOctet))return function(){const o=t.slice(1,6),s=[];for(let h=0;h4294967295||n<0)throw new Error("ipaddr: address outside defined range");return function(){const o=[];let s;for(s=0;s<=24;s+=8)o.push(n>>s&255);return o}().reverse()}else return(t=e.match(d.twoOctet))?function(){const o=t.slice(1,4),s=[];if(n=v(o[1]),n>16777215||n<0)throw new Error("ipaddr: address outside defined range");return s.push(v(o[0])),s.push(n>>16&255),s.push(n>>8&255),s.push(n&255),s}():(t=e.match(d.threeOctet))?function(){const o=t.slice(1,5),s=[];if(n=v(o[2]),n>65535||n<0)throw new Error("ipaddr: address outside defined range");return s.push(v(o[0])),s.push(v(o[1])),s.push(n>>8&255),s.push(n&255),s}():null},i.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r=0;h-=1)if(o=this.parts[h],o in n){if(s=n[o],r&&s!==0)return null;s!==16&&(r=!0),t+=s}else return null;return 128-t},e.prototype.range=function(){return i.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let t;const r=[],n=this.parts;for(let o=0;o>8),r.push(t&255);return r},e.prototype.toFixedLengthString=function(){const t=function(){const n=[];for(let o=0;o>8,r&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){const t=function(){const n=[];for(let o=0;oo&&(n=s.index,o=s[0].length);return o<0?r:`${r.substring(0,n)}::${r.substring(n+o)}`},e.prototype.toString=function(){return this.toRFC5952String()},e}(),i.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[];let s=0;for(;s<16;)o.push(parseInt(r[s],10)|parseInt(n[s],10)^255),s++;return new this(o)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},i.IPv6.isIPv6=function(e){return this.parser(e)!==null},i.IPv6.isValid=function(e){if(typeof e=="string"&&e.indexOf(":")===-1)return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(t){return!1}},i.IPv6.isValidCIDR=function(e){if(typeof e=="string"&&e.indexOf(":")===-1)return!1;try{return this.parseCIDR(e),!0}catch(t){return!1}},i.IPv6.networkAddressFromCIDR=function(e){let t,r,n,o,s;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),s=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],r=0;r<16;)o.push(parseInt(n[r],10)&parseInt(s[r],10)),r++;return new this(o)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},i.IPv6.parse=function(e){const t=this.parser(e);if(t.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},i.IPv6.parseCIDR=function(e){let t,r,n;if((r=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(r[2]),t>=0&&t<=128))return n=[this.parse(r[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},i.IPv6.parser=function(e){let t,r,n,o,s,h;if(n=e.match(w.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(w.native.test(e))return I(e,8);if((n=e.match(w.transitional))&&(h=n[6]||"",t=n[1],n[1].endsWith("::")||(t=t.slice(0,-1)),t=I(t+h,6),t.parts)){for(s=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(e/8);for(;rF.isValid(c),y=c=>{const u=F.IPv4.parse(c).toByteArray();return u[0]<<24|u[1]<<16|u[2]<<8|u[3]},q=c=>F.fromByteArray([c>>24&255,c>>16&255,c>>8&255,c&255]).toString(),ne=c=>{if(!F.IPv4.isIPv4(c))return!1;let u=0,a=y(c);for(let d=31;d>=0&&(a&1<{let l=y(c)&y(u),P=y(a),m=y(d),w=~y(u);return Pl+1&&m{let a=y(u),d=y(c)&a,l=~a,P;return l>=105?(P=d|l-5,d=d|100):l>=3?(P=d|l-1,d=d|2):(d=d|1,P=d),[q(d),q(P)]};var E={isValidMask:ne,isValidIP:te,isValidMaskRange:re,calcMaskRange:se};const oe=p("div",{class:"label-name"},[p("span",null,"\u5185\u7F51\u5730\u5740")],-1),ie={class:"label-value"},ae=p("div",{class:"label-name"},[p("span",null,"\u5B50\u7F51\u63A9\u7801")],-1),ue={class:"label-value"},le=p("div",{class:"label-name"},[p("span",null,"DHCP\u670D\u52A1")],-1),de={class:"label-value"},ce={class:"label-flex"},pe=p("div",{class:"label-name"},[p("span",null,"IP\u6C60\u8D77\u59CB\u5730\u5740")],-1),fe={class:"label-value"},he=p("div",{class:"label-name"},[p("span",null,"IP\u6C60\u7ED3\u675F\u5730\u5740")],-1),Ie={class:"label-value"},ve={class:"label-btns"},we=["disabled"],Pe={key:2,class:"label-msg"},me=J({__name:"index",setup(c){return D(this,null,function*(){let u,a;const d=S(""),l=K({lanIp:"",netMask:"255.255.255.0",enableDhcp:!1,dhcpStart:"",dhcpEnd:""}),P=S(!1),m=S(!1),x=()=>D(this,null,function*(){P.value=!0;const I=yield N.Guide.GetLan.GET();if(I.data){const{result:f}=I.data;f&&(l.lanIp=f.lanIp,l.netMask=f.netMask,m.value=f.enableDhcp||!1,l.dhcpStart=f.dhcpStart,l.dhcpEnd=f.dhcpEnd,f.lanIp,location.hostname)}P.value=!1});[u,a]=X(()=>x()),yield u,a();const w=()=>D(this,null,function*(){const I=L({},l);if(!E.isValidIP(I.lanIp)){$.Error("IPv4\u5730\u5740\u683C\u5F0F\u9519\u8BEF");return}if(!E.isValidMask(I.netMask)){$.Error("IPv4\u5B50\u7F51\u63A9\u7801\u683C\u5F0F\u9519\u8BEF");return}if(I.enableDhcp&&!E.isValidIP(I.dhcpStart)||!E.isValidIP(I.dhcpEnd)||!E.isValidMaskRange(I.lanIp,I.netMask,I.dhcpStart,I.dhcpEnd)){$.Error("DHCP\u7684IP\u6C60\u683C\u5F0F\u9519\u8BEF\u6216\u8D85\u51FA\u5B50\u7F51\u8303\u56F4");return}const f=$.Loading("\u6B63\u5728\u914D\u7F6E,\u8BF7\u7A0D\u7B49\u2026");let v=!1;try{const b=yield N.Guide.LanIp.POST(I);if(b.data){const{result:i,success:e,error:t}=b.data;if(t){d.value=t;return}(e||0)==0&&(v=!0)}}catch(b){d.value=b}finally{f.Close()}v&&(d.value=`\u66F4\u65B0\u6210\u529F,\u8BF7\u8FDB\u5165 ${I.lanIp} \u8DEF\u7531\u5668\u5730\u5740`)});return(I,f)=>(k(),C("form",{class:"form-container",onSubmit:Z(w,["prevent"])},[oe,p("div",ie,[g(p("input",{type:"text",placeholder:"192.168.100.1","onUpdate:modelValue":f[0]||(f[0]=v=>l.lanIp=v),required:""},null,512),[[R,l.lanIp,void 0,{trim:!0}]])]),ae,p("div",ue,[g(p("input",{type:"text",placeholder:"255.255.255.0","onUpdate:modelValue":f[1]||(f[1]=v=>l.netMask=v),required:""},null,512),[[R,l.netMask,void 0,{trim:!0}]])]),m.value?(k(),C(z,{key:0},[le,p("div",de,[p("div",ce,[p("label",null,[g(p("input",{type:"radio",value:!1,"onUpdate:modelValue":f[2]||(f[2]=v=>l.enableDhcp=v)},null,512),[[j,l.enableDhcp]]),T("\u4FDD\u6301DHCP")]),p("label",null,[g(p("input",{type:"radio",value:!0,"onUpdate:modelValue":f[3]||(f[3]=v=>l.enableDhcp=v)},null,512),[[j,l.enableDhcp]]),T("\u4FEE\u6539DHCP")])])])],64)):V("v-if",!0),l.enableDhcp?(k(),C(z,{key:1},[pe,p("div",fe,[g(p("input",{type:"text",placeholder:"192.168.100.100","onUpdate:modelValue":f[4]||(f[4]=v=>l.dhcpStart=v),required:""},null,512),[[R,l.dhcpStart,void 0,{trim:!0}]])]),he,p("div",Ie,[g(p("input",{type:"text",placeholder:"192.168.100.100","onUpdate:modelValue":f[5]||(f[5]=v=>l.dhcpEnd=v),required:""},null,512),[[R,l.dhcpEnd,void 0,{trim:!0}]])])],64)):V("v-if",!0),p("div",ve,[p("button",{class:"sumbit",disabled:P.value},"\u4FDD\u5B58",8,we)]),d.value?(k(),C("div",Pe,[p("span",null,Y(d.value),1)])):V("v-if",!0)],32))})}});var be=W(me,[]);export{be as default};