acbridge 1.1.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -8
- package/dist/acbridge.mjs +141 -122
- package/hub/dist/hub.cjs +88 -67
- package/package.json +1 -1
- package/plugin/README.md +37 -22
- package/plugin/plugins/alexa/dist/channel.mjs +45 -43
- package/plugin/plugins/alexa/scripts/codex-signal.mjs +128 -49
- package/plugin/plugins/alexa/scripts/signal.mjs +90 -20
package/dist/acbridge.mjs
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __acbridgeCreateRequire } from "node:module";
|
|
3
3
|
const require = __acbridgeCreateRequire(import.meta.url);
|
|
4
|
-
var kI=Object.create;var iu=Object.defineProperty;var wI=Object.getOwnPropertyDescriptor;var SI=Object.getOwnPropertyNames;var _I=Object.getPrototypeOf,$I=Object.prototype.hasOwnProperty;var ue=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ie=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},nn=(e,t)=>{for(var r in t)iu(e,r,{get:t[r],enumerable:!0})},II=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of SI(t))!$I.call(e,n)&&n!==r&&iu(e,n,{get:()=>t[n],enumerable:!(o=wI(t,n))||o.enumerable});return e};var rn=(e,t,r)=>(r=e!=null?kI(_I(e)):{},II(t||!e||!e.__esModule?iu(r,"default",{value:e,enumerable:!0}):r,e));var bl=ie(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.default=$D;var $0=/[A-Z]/g;function I0(e){return e.toLowerCase()}function $D(e,t){let r=e.replace($0,I0),o=t.replace($0,I0);return r===o}});var nh=ie(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.DnsTxt=void 0;var xl=class{constructor(t={}){this.binary=t?t.binary:!1}encode(t={}){return Object.entries(t).map(([r,o])=>{let n=`${r}=${o}`;return Buffer.from(n)})}decode(t){var r={};try{let n=t.toString().split(/=(.+)/),i=n[0],s=n[1];r[i]=s}catch{}return r}decodeAll(t){return t.filter(r=>r.length>1).map(r=>this.decode(r)).reduce((r,o)=>{var n=r;let[i]=Object.keys(o),[s]=Object.values(o);return n[i]=s,n},{})}};ps.DnsTxt=xl;ps.default=xl});var rh=ie(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.toType=Ho.toString=void 0;var E0=e=>"_"+e,ID=e=>["name","protocol","subtype"].includes(e),ED=e=>{let t={name:e.name,protocol:e.protocol,subtype:e.subtype};return Object.entries(t).filter(([o,n])=>ID(o)&&n!==void 0).reduce((o,[n,i])=>(typeof i==="object"?i.map(s=>o.push(E0(s))):o.push(E0(i)),o),[]).join(".")};Ho.toString=ED;var AD=e=>{let t=e.split("."),r;for(let o in t)t[o][0]==="_"&&(t[o]=t[o].slice(1));return t.includes("sub")&&(r=t.shift(),t.shift()),{name:t.shift(),protocol:t.shift()||null,subtype:r}};Ho.toType=AD});var oh=ie(Er=>{"use strict";var P0=Er&&Er.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Er,"__esModule",{value:!0});Er.Service=void 0;var A0=P0(ue("os")),PD=P0(nh()),CD=ue("events"),TD=rh(),Zo=".local",kl=class extends CD.EventEmitter{constructor(t,r,o){if(super(),this.start=r,this.stop=o,this.probe=!0,this.published=!1,this.activated=!1,this.destroyed=!1,this.txtService=new PD.default,!t.name)throw new Error("ServiceConfig requires `name` property to be set");if(!t.type)throw new Error("ServiceConfig requires `type` property to be set");if(!t.port)throw new Error("ServiceConfig requires `port` property to be set");this.name=t.name.split(".").join("-"),this.protocol=t.protocol||"tcp",this.type=(0,TD.toString)({name:t.type,protocol:this.protocol}),this.port=t.port,this.host=t.host||A0.default.hostname(),this.fqdn=`${this.name}.${this.type}${Zo}`,this.txt=t.txt,this.subtypes=t.subtypes,this.disableIPv6=!!t.disableIPv6}records(){var t=[this.RecordPTR(this),this.RecordSRV(this),this.RecordTXT(this),this.RecordServicePTR(this)];for(let o of this.subtypes||[])t.push(this.RecordSubtypePTR(this,o));let r=Object.values(A0.default.networkInterfaces());for(let o of r){let n=o;for(let i of n)if(!(i.internal||i.mac==="00:00:00:00:00:00"))switch(i.family){case"IPv4":t.push(this.RecordA(this,i.address));break;case"IPv6":if(this.disableIPv6)break;t.push(this.RecordAAAA(this,i.address));break}}return t}RecordPTR(t){return{name:`${t.type}${Zo}`,type:"PTR",ttl:28800,data:t.fqdn}}RecordServicePTR(t){return{name:`_services._dns-sd._udp${Zo}`,type:"PTR",ttl:120,data:`${t.type}${Zo}`}}RecordSubtypePTR(t,r){return{name:`_${r}._sub.${t.type}${Zo}`,type:"PTR",ttl:28800,data:`${t.name}.${t.type}${Zo}`}}RecordSRV(t){return{name:t.fqdn,type:"SRV",ttl:120,data:{port:t.port,target:t.host}}}RecordTXT(t){return{name:t.fqdn,type:"TXT",ttl:4500,data:this.txtService.encode(t.txt)}}RecordA(t,r){return{name:t.host,type:"A",ttl:120,data:r}}RecordAAAA(t,r){return{name:t.host,type:"AAAA",ttl:120,data:r}}};Er.Service=kl;Er.default=kl});var T0=ie(Ar=>{"use strict";var C0=Ar&&Ar.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.Registry=void 0;var RD=C0(bl()),ih=C0(oh()),OD=3600*1e3,DD=3,ND=function(){},wl=class{constructor(t){this.services=[],this.server=t}publish(t){let r=t.probe!==!1,o=new ih.default(t,n.bind(null,this),i.bind(null,this));function n(s,{probe:a=r}={}){o.activated||(o.activated=!0,s.services.push(o),o instanceof ih.default&&(a?s.probe(s.server.mdns,o,l=>{if(l){o.stop!==void 0&&o.stop(),console.log(new Error("Service name is already in use on the network"));return}s.announce(s.server,o)}):s.announce(s.server,o)))}function i(s,a){if(a||(a=ND),!o.activated||!(o instanceof ih.default))return process.nextTick(a);s.teardown(s.server,o,a);let l=s.services.indexOf(o);l!==-1&&s.services.splice(l,1)}return o.start(),o}unpublishAll(t){this.teardown(this.server,this.services,t),this.services=[]}destroy(){this.services.map(t=>t.destroyed=!0)}probe(t,r,o){var n=!1,i=0,s;let a=()=>{!r.activated||r.destroyed||t.query(r.fqdn,"ANY",function(){n=!0,s=setTimeout(++i<3?a:d,250),s.unref()})},l=p=>{n&&(p.answers.some(u)||p.additionals.some(u))&&d(!0)},u=p=>(0,RD.default)(p.name,r.fqdn),d=p=>{t.removeListener("response",l),clearTimeout(s),o(!!p)};t.on("response",l),setTimeout(a,Math.random()*250)}announce(t,r){var o=1e3,n=r.records();t.register(n);let i=()=>{!r.activated||r.destroyed||t.mdns.respond(n,function(){r.published||(r.activated=!0,r.published=!0,r.emit("up")),o=o*DD,o<OD&&!r.destroyed&&setTimeout(i,o).unref()})};i()}teardown(t,r,o){Array.isArray(r)||(r=[r]),r=r.filter(i=>i.activated);var n=r.flatMap(function(i){i.activated=!1;var s=i.records();return s.forEach(a=>{a.ttl=0}),s});if(n.length===0)return o&&process.nextTick(o);t.unregister(n),t.mdns.respond(n,function(){r.forEach(function(i){i.published=!1}),typeof o=="function"&&o.apply(null,arguments)})}};Ar.Registry=wl;Ar.default=wl});var R0=ie(sh=>{"use strict";sh.toString=function(e){switch(e){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+e};sh.toType=function(e){switch(e.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return e.toUpperCase().startsWith("UNKNOWN_")?parseInt(e.slice(8)):0}});var O0=ie(ah=>{"use strict";ah.toString=function(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e};ah.toRcode=function(e){switch(e.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var D0=ie(ch=>{"use strict";ch.toString=function(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e};ch.toOpcode=function(e){switch(e.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var N0=ie(lh=>{"use strict";lh.toString=function(e){switch(e){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+e};lh.toClass=function(e){switch(e.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var L0=ie(uh=>{"use strict";uh.toString=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:`OPTION_${e}`};uh.toCode=function(e){if(typeof e=="number")return e;if(!e)return-1;switch(e.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}});var z0=ie((j0,dh)=>{var U0=(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=p,e.encode=d,e.familyOf=u,e.name=void 0,e.sizeOf=l,e.v6=e.v4=void 0;let t=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=4,o=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,n=16,i={name:"v4",size:r,isFormat:m=>t.test(m),encode(m,f,g){g=~~g,f=f||new Uint8Array(g+r);let h=m.length,y=0;for(let k=0;k<h;){let _=m.charCodeAt(k++);_===46?(f[g++]=y,y=0):y=y*10+(_-48)}return f[g]=y,f},decode(m,f){return f=~~f,`${m[f++]}.${m[f++]}.${m[f++]}.${m[f]}`}};e.v4=i;let s={name:"v6",size:n,isFormat:m=>m.length>0&&o.test(m),encode(m,f,g){g=~~g;let h=g+n,y=-1,k=0,_=0,I=!0,S=!1;f=f||new Uint8Array(g+n);for(let T=0;T<m.length;T++){let j=m.charCodeAt(T);j===58?(I?y!==-1?(g<h&&(f[g]=0),g<h-1&&(f[g+1]=0),g+=2):g<h&&(y=g):(S===!0?(g<h&&(f[g]=_),g++):(g<h&&(f[g]=k>>8),g<h-1&&(f[g+1]=k&255),g+=2),k=0,_=0),I=!0,S=!1):j===46?(g<h&&(f[g]=_),g++,_=0,k=0,I=!1,S=!0):(I=!1,j>=97?j-=87:j>=65?j-=55:(j-=48,_=_*10+j),k=(k<<4)+j)}if(I===!1)S===!0?(g<h&&(f[g]=_),g++):(g<h&&(f[g]=k>>8),g<h-1&&(f[g+1]=k&255),g+=2);else if(y===0)g<h&&(f[g]=0),g<h-1&&(f[g+1]=0),g+=2;else if(y!==-1){g+=2;for(let T=Math.min(g-1,h-1);T>=y+2;T--)f[T]=f[T-2];f[y]=0,f[y+1]=0,y=g}if(y!==g&&y!==-1)for(g>h-2&&(g=h-2);h>y;)f[--h]=g<h&&g>y?f[--g]:0;else for(;g<h;)f[g++]=0;return f},decode(m,f){f=~~f;let g="";for(let h=0;h<n;h+=2)h!==0&&(g+=":"),g+=(m[f+h]<<8|m[f+h+1]).toString(16);return g.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};e.v6=s;let a="ip";e.name=a;function l(m){if(i.isFormat(m))return i.size;if(s.isFormat(m))return s.size;throw Error(`Invalid ip address: ${m}`)}function u(m){return l(m)===i.size?1:2}function d(m,f,g){g=~~g;let h=l(m);return typeof f=="function"&&(f=f(g+h)),h===i.size?i.encode(m,f,g):s.encode(m,f,g)}function p(m,f,g){if(f=~~f,g=g||m.length-f,g===i.size)return i.decode(m,f,g);if(g===s.size)return s.decode(m,f,g);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${s.size} for v6.`)}return"default"in e?e.default:e})({});typeof define=="function"&&define.amd?define([],function(){return U0}):typeof dh=="object"&&typeof j0=="object"&&(dh.exports=U0)});var B0=ie(B=>{"use strict";var H=ue("buffer").Buffer,In=R0(),LD=O0(),UD=D0(),_l=N0(),ph=L0(),Pr=z0(),jD=0,F0=32768,mh=32768,zD=~mh,M0=32768,FD=~M0,U=B.name={};U.encode=function(e,t,r,{mail:o=!1}={}){t||(t=H.alloc(U.encodingLength(e))),r||(r=0);let n=r,i=e.replace(/^\.|\.$/gm,"");if(i.length){let s=[];if(o){let a="";i.split(".").forEach(l=>{l.endsWith("\\")?a+=(a.length?".":"")+l.slice(0,-1):s.length===0&&a.length?s.push(a+"."+l):s.push(l)})}else s=i.split(".");for(let a=0;a<s.length;a++){let l=t.write(s[a],r+1);t[r]=l,r+=l+1}}return t[r++]=0,U.encode.bytes=r-n,t};U.encode.bytes=0;U.decode=function(e,t,{mail:r=!1}={}){t||(t=0);let o=[],n=t,i=0,s=0,a=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");let l=e[t++];if(s+=a?0:1,l===0)break;if((l&192)===0){if(t+l>e.length)throw new Error("Cannot decode name (buffer overflow)");if(i+=l+1,i>254)throw new Error("Cannot decode name (name too long)");let u=e.toString("utf-8",t,t+l);r&&(u=u.replace(/\./g,"\\.")),o.push(u),t+=l,s+=a?0:l}else if((l&192)===192){if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");let u=e.readUInt16BE(t-1)-49152;if(u>=n)throw new Error("Cannot decode name (bad pointer)");t=u,n=u,s+=a?0:1,a=!0}else throw new Error("Cannot decode name (bad label)")}return U.decode.bytes=s,o.length===0?".":o.join(".")};U.decode.bytes=0;U.encodingLength=function(e){return e==="."||e===".."?1:H.byteLength(e.replace(/^\.|\.$/gm,""))+2};var re={};re.encode=function(e,t,r){t||(t=H.alloc(re.encodingLength(e))),r||(r=0);let o=t.write(e,r+1);return t[r]=o,re.encode.bytes=o+1,t};re.encode.bytes=0;re.decode=function(e,t){t||(t=0);let r=e[t],o=e.toString("utf-8",t+1,t+1+r);return re.decode.bytes=r+1,o};re.decode.bytes=0;re.encodingLength=function(e){return H.byteLength(e)+1};var Rt={};Rt.encode=function(e,t,r){t||(t=Rt.encodingLength(e)),r||(r=0);let o=(e.flags||0)&32767,n=e.type==="response"?F0:jD;return t.writeUInt16BE(e.id||0,r),t.writeUInt16BE(o|n,r+2),t.writeUInt16BE(e.questions.length,r+4),t.writeUInt16BE(e.answers.length,r+6),t.writeUInt16BE(e.authorities.length,r+8),t.writeUInt16BE(e.additionals.length,r+10),t};Rt.encode.bytes=12;Rt.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");let r=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:r&F0?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:UD.toString(r>>11&15),flag_aa:(r>>10&1)===1,flag_tc:(r>>9&1)===1,flag_rd:(r>>8&1)===1,flag_ra:(r>>7&1)===1,flag_z:(r>>6&1)===1,flag_ad:(r>>5&1)===1,flag_cd:(r>>4&1)===1,rcode:LD.toString(r&15),questions:new Array(e.readUInt16BE(t+4)),answers:new Array(e.readUInt16BE(t+6)),authorities:new Array(e.readUInt16BE(t+8)),additionals:new Array(e.readUInt16BE(t+10))}};Rt.decode.bytes=12;Rt.encodingLength=function(){return 12};var vn=B.unknown={};vn.encode=function(e,t,r){return t||(t=H.alloc(vn.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),vn.encode.bytes=e.length+2,t};vn.encode.bytes=0;vn.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),o=e.slice(t+2,t+2+r);return vn.decode.bytes=r+2,o};vn.decode.bytes=0;vn.encodingLength=function(e){return e.length+2};var yn=B.ns={};yn.encode=function(e,t,r){return t||(t=H.alloc(yn.encodingLength(e))),r||(r=0),U.encode(e,t,r+2),t.writeUInt16BE(U.encode.bytes,r),yn.encode.bytes=U.encode.bytes+2,t};yn.encode.bytes=0;yn.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),o=U.decode(e,t+2);return yn.decode.bytes=r+2,o};yn.decode.bytes=0;yn.encodingLength=function(e){return U.encodingLength(e)+2};var bn=B.soa={};bn.encode=function(e,t,r){t||(t=H.alloc(bn.encodingLength(e))),r||(r=0);let o=r;return r+=2,U.encode(e.mname,t,r),r+=U.encode.bytes,U.encode(e.rname,t,r,{mail:!0}),r+=U.encode.bytes,t.writeUInt32BE(e.serial||0,r),r+=4,t.writeUInt32BE(e.refresh||0,r),r+=4,t.writeUInt32BE(e.retry||0,r),r+=4,t.writeUInt32BE(e.expire||0,r),r+=4,t.writeUInt32BE(e.minimum||0,r),r+=4,t.writeUInt16BE(r-o-2,o),bn.encode.bytes=r-o,t};bn.encode.bytes=0;bn.decode=function(e,t){t||(t=0);let r=t,o={};return t+=2,o.mname=U.decode(e,t),t+=U.decode.bytes,o.rname=U.decode(e,t,{mail:!0}),t+=U.decode.bytes,o.serial=e.readUInt32BE(t),t+=4,o.refresh=e.readUInt32BE(t),t+=4,o.retry=e.readUInt32BE(t),t+=4,o.expire=e.readUInt32BE(t),t+=4,o.minimum=e.readUInt32BE(t),t+=4,bn.decode.bytes=t-r,o};bn.decode.bytes=0;bn.encodingLength=function(e){return 22+U.encodingLength(e.mname)+U.encodingLength(e.rname)};var xn=B.txt={};xn.encode=function(e,t,r){Array.isArray(e)||(e=[e]);for(let n=0;n<e.length;n++)if(typeof e[n]=="string"&&(e[n]=H.from(e[n])),!H.isBuffer(e[n]))throw new Error("Must be a Buffer");t||(t=H.alloc(xn.encodingLength(e))),r||(r=0);let o=r;return r+=2,e.forEach(function(n){t[r++]=n.length,n.copy(t,r,0,n.length),r+=n.length}),t.writeUInt16BE(r-o-2,o),xn.encode.bytes=r-o,t};xn.encode.bytes=0;xn.decode=function(e,t){t||(t=0);let r=t,o=e.readUInt16BE(t);t+=2;let n=[];for(;o>0;){let i=e[t++];if(--o,o<i)throw new Error("Buffer overflow");n.push(e.slice(t,t+i)),t+=i,o-=i}return xn.decode.bytes=t-r,n};xn.decode.bytes=0;xn.encodingLength=function(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach(function(r){typeof r=="string"?t+=H.byteLength(r)+1:t+=r.length+1}),t};var kn=B.null={};kn.encode=function(e,t,r){t||(t=H.alloc(kn.encodingLength(e))),r||(r=0),typeof e=="string"&&(e=H.from(e)),e||(e=H.alloc(0));let o=r;r+=2;let n=e.length;return e.copy(t,r,0,n),r+=n,t.writeUInt16BE(r-o-2,o),kn.encode.bytes=r-o,t};kn.encode.bytes=0;kn.decode=function(e,t){t||(t=0);let r=t,o=e.readUInt16BE(t);t+=2;let n=e.slice(t,t+o);return t+=o,kn.decode.bytes=t-r,n};kn.decode.bytes=0;kn.encodingLength=function(e){return e?(H.isBuffer(e)?e.length:H.byteLength(e))+2:2};var wn=B.hinfo={};wn.encode=function(e,t,r){t||(t=H.alloc(wn.encodingLength(e))),r||(r=0);let o=r;return r+=2,re.encode(e.cpu,t,r),r+=re.encode.bytes,re.encode(e.os,t,r),r+=re.encode.bytes,t.writeUInt16BE(r-o-2,o),wn.encode.bytes=r-o,t};wn.encode.bytes=0;wn.decode=function(e,t){t||(t=0);let r=t,o={};return t+=2,o.cpu=re.decode(e,t),t+=re.decode.bytes,o.os=re.decode(e,t),t+=re.decode.bytes,wn.decode.bytes=t-r,o};wn.decode.bytes=0;wn.encodingLength=function(e){return re.encodingLength(e.cpu)+re.encodingLength(e.os)+2};var Ct=B.ptr={},MD=B.cname=Ct,BD=B.dname=Ct;Ct.encode=function(e,t,r){return t||(t=H.alloc(Ct.encodingLength(e))),r||(r=0),U.encode(e,t,r+2),t.writeUInt16BE(U.encode.bytes,r),Ct.encode.bytes=U.encode.bytes+2,t};Ct.encode.bytes=0;Ct.decode=function(e,t){t||(t=0);let r=U.decode(e,t+2);return Ct.decode.bytes=U.decode.bytes+2,r};Ct.decode.bytes=0;Ct.encodingLength=function(e){return U.encodingLength(e)+2};var Sn=B.srv={};Sn.encode=function(e,t,r){t||(t=H.alloc(Sn.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.priority||0,r+2),t.writeUInt16BE(e.weight||0,r+4),t.writeUInt16BE(e.port||0,r+6),U.encode(e.target,t,r+8);let o=U.encode.bytes+6;return t.writeUInt16BE(o,r),Sn.encode.bytes=o+2,t};Sn.encode.bytes=0;Sn.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),o={};return o.priority=e.readUInt16BE(t+2),o.weight=e.readUInt16BE(t+4),o.port=e.readUInt16BE(t+6),o.target=U.decode(e,t+8),Sn.decode.bytes=r+2,o};Sn.decode.bytes=0;Sn.encodingLength=function(e){return 8+U.encodingLength(e.target)};var lt=B.caa={};lt.ISSUER_CRITICAL=128;lt.encode=function(e,t,r){let o=lt.encodingLength(e);return t||(t=H.alloc(lt.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=lt.ISSUER_CRITICAL),t.writeUInt16BE(o-2,r),r+=2,t.writeUInt8(e.flags||0,r),r+=1,re.encode(e.tag,t,r),r+=re.encode.bytes,t.write(e.value,r),r+=H.byteLength(e.value),lt.encode.bytes=o,t};lt.encode.bytes=0;lt.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t);t+=2;let o=t,n={};return n.flags=e.readUInt8(t),t+=1,n.tag=re.decode(e,t),t+=re.decode.bytes,n.value=e.toString("utf-8",t,o+r),n.issuerCritical=!!(n.flags<.ISSUER_CRITICAL),lt.decode.bytes=r+2,n};lt.decode.bytes=0;lt.encodingLength=function(e){return re.encodingLength(e.tag)+re.encodingLength(e.value)+2};var Xn=B.mx={};Xn.encode=function(e,t,r){t||(t=H.alloc(Xn.encodingLength(e))),r||(r=0);let o=r;return r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,U.encode(e.exchange,t,r),r+=U.encode.bytes,t.writeUInt16BE(r-o-2,o),Xn.encode.bytes=r-o,t};Xn.encode.bytes=0;Xn.decode=function(e,t){t||(t=0);let r=t,o={};return t+=2,o.preference=e.readUInt16BE(t),t+=2,o.exchange=U.decode(e,t),t+=U.decode.bytes,Xn.decode.bytes=t-r,o};Xn.encodingLength=function(e){return 4+U.encodingLength(e.exchange)};var _n=B.a={};_n.encode=function(e,t,r){return t||(t=H.alloc(_n.encodingLength(e))),r||(r=0),t.writeUInt16BE(4,r),r+=2,Pr.v4.encode(e,t,r),_n.encode.bytes=6,t};_n.encode.bytes=0;_n.decode=function(e,t){t||(t=0),t+=2;let r=Pr.v4.decode(e,t);return _n.decode.bytes=6,r};_n.decode.bytes=0;_n.encodingLength=function(){return 6};var $n=B.aaaa={};$n.encode=function(e,t,r){return t||(t=H.alloc($n.encodingLength(e))),r||(r=0),t.writeUInt16BE(16,r),r+=2,Pr.v6.encode(e,t,r),$n.encode.bytes=18,t};$n.encode.bytes=0;$n.decode=function(e,t){t||(t=0),t+=2;let r=Pr.v6.decode(e,t);return $n.decode.bytes=18,r};$n.decode.bytes=0;$n.encodingLength=function(){return 18};var rt=B.option={};rt.encode=function(e,t,r){t||(t=H.alloc(rt.encodingLength(e))),r||(r=0);let o=r,n=ph.toCode(e.code);if(t.writeUInt16BE(n,r),r+=2,e.data)t.writeUInt16BE(e.data.length,r),r+=2,e.data.copy(t,r),r+=e.data.length;else switch(n){case 8:let i=e.sourcePrefixLength||0,s=e.family||Pr.familyOf(e.ip),a=Pr.encode(e.ip,H.alloc),l=Math.ceil(i/8);t.writeUInt16BE(l+4,r),r+=2,t.writeUInt16BE(s,r),r+=2,t.writeUInt8(i,r++),t.writeUInt8(e.scopePrefixLength||0,r++),a.copy(t,r,0,l),r+=l;break;case 11:e.timeout?(t.writeUInt16BE(2,r),r+=2,t.writeUInt16BE(e.timeout,r),r+=2):(t.writeUInt16BE(0,r),r+=2);break;case 12:let u=e.length||0;t.writeUInt16BE(u,r),r+=2,t.fill(0,r,r+u),r+=u;break;case 14:let d=e.tags.length*2;t.writeUInt16BE(d,r),r+=2;for(let p of e.tags)t.writeUInt16BE(p,r),r+=2;break;default:throw new Error(`Unknown roption code: ${e.code}`)}return rt.encode.bytes=r-o,t};rt.encode.bytes=0;rt.decode=function(e,t){t||(t=0);let r={};r.code=e.readUInt16BE(t),r.type=ph.toString(r.code),t+=2;let o=e.readUInt16BE(t);switch(t+=2,r.data=e.slice(t,t+o),r.code){case 8:r.family=e.readUInt16BE(t),t+=2,r.sourcePrefixLength=e.readUInt8(t++),r.scopePrefixLength=e.readUInt8(t++);let n=H.alloc(r.family===1?4:16);e.copy(n,0,t,t+o-4),r.ip=Pr.decode(n);break;case 11:o>0&&(r.timeout=e.readUInt16BE(t),t+=2);break;case 14:r.tags=[];for(let i=0;i<o;i+=2)r.tags.push(e.readUInt16BE(t)),t+=2}return rt.decode.bytes=o+4,r};rt.decode.bytes=0;rt.encodingLength=function(e){if(e.data)return e.data.length+4;switch(ph.toCode(e.code)){case 8:let r=e.sourcePrefixLength||0;return Math.ceil(r/8)+8;case 11:return typeof e.timeout=="number"?6:4;case 12:return e.length+4;case 14:return 4+e.tags.length*2}throw new Error(`Unknown roption code: ${e.code}`)};var dt=B.opt={};dt.encode=function(e,t,r){t||(t=H.alloc(dt.encodingLength(e))),r||(r=0);let o=r,n=Go(e,rt);return t.writeUInt16BE(n,r),r=ms(e,rt,t,r+2),dt.encode.bytes=r-o,t};dt.encode.bytes=0;dt.decode=function(e,t){t||(t=0);let r=t,o=[],n=e.readUInt16BE(t);t+=2;let i=0;for(;n>0;)o[i++]=rt.decode(e,t),t+=rt.decode.bytes,n-=rt.decode.bytes;return dt.decode.bytes=t-r,o};dt.decode.bytes=0;dt.encodingLength=function(e){return 2+Go(e||[],rt)};var qe=B.dnskey={};qe.PROTOCOL_DNSSEC=3;qe.ZONE_KEY=128;qe.SECURE_ENTRYPOINT=32768;qe.encode=function(e,t,r){t||(t=H.alloc(qe.encodingLength(e))),r||(r=0);let o=r,n=e.key;if(!H.isBuffer(n))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(qe.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,n.copy(t,r,0,n.length),r+=n.length,qe.encode.bytes=r-o,t.writeUInt16BE(qe.encode.bytes-2,o),t};qe.encode.bytes=0;qe.decode=function(e,t){t||(t=0);let r=t;var o={},n=e.readUInt16BE(t);if(t+=2,o.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==qe.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,o.algorithm=e.readUInt8(t),t+=1,o.key=e.slice(t,r+n+2),t+=o.key.length,qe.decode.bytes=t-r,o};qe.decode.bytes=0;qe.encodingLength=function(e){return 6+H.byteLength(e.key)};var Wt=B.rrsig={};Wt.encode=function(e,t,r){t||(t=H.alloc(Wt.encodingLength(e))),r||(r=0);let o=r,n=e.signature;if(!H.isBuffer(n))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(In.toType(e.typeCovered),r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.labels,r),r+=1,t.writeUInt32BE(e.originalTTL,r),r+=4,t.writeUInt32BE(e.expiration,r),r+=4,t.writeUInt32BE(e.inception,r),r+=4,t.writeUInt16BE(e.keyTag,r),r+=2,U.encode(e.signersName,t,r),r+=U.encode.bytes,n.copy(t,r,0,n.length),r+=n.length,Wt.encode.bytes=r-o,t.writeUInt16BE(Wt.encode.bytes-2,o),t};Wt.encode.bytes=0;Wt.decode=function(e,t){t||(t=0);let r=t;var o={},n=e.readUInt16BE(t);return t+=2,o.typeCovered=In.toString(e.readUInt16BE(t)),t+=2,o.algorithm=e.readUInt8(t),t+=1,o.labels=e.readUInt8(t),t+=1,o.originalTTL=e.readUInt32BE(t),t+=4,o.expiration=e.readUInt32BE(t),t+=4,o.inception=e.readUInt32BE(t),t+=4,o.keyTag=e.readUInt16BE(t),t+=2,o.signersName=U.decode(e,t),t+=U.decode.bytes,o.signature=e.slice(t,r+n+2),t+=o.signature.length,Wt.decode.bytes=t-r,o};Wt.decode.bytes=0;Wt.encodingLength=function(e){return 20+U.encodingLength(e.signersName)+H.byteLength(e.signature)};var Vt=B.rp={};Vt.encode=function(e,t,r){t||(t=H.alloc(Vt.encodingLength(e))),r||(r=0);let o=r;return r+=2,U.encode(e.mbox||".",t,r,{mail:!0}),r+=U.encode.bytes,U.encode(e.txt||".",t,r),r+=U.encode.bytes,Vt.encode.bytes=r-o,t.writeUInt16BE(Vt.encode.bytes-2,o),t};Vt.encode.bytes=0;Vt.decode=function(e,t){t||(t=0);let r=t,o={};return t+=2,o.mbox=U.decode(e,t,{mail:!0})||".",t+=U.decode.bytes,o.txt=U.decode(e,t)||".",t+=U.decode.bytes,Vt.decode.bytes=t-r,o};Vt.decode.bytes=0;Vt.encodingLength=function(e){return 2+U.encodingLength(e.mbox||".")+U.encodingLength(e.txt||".")};var Te={};Te.encode=function(e,t,r){t||(t=H.alloc(Te.encodingLength(e))),r||(r=0);let o=r;for(var n=[],i=0;i<e.length;i++){var s=In.toType(e[i]);n[s>>8]===void 0&&(n[s>>8]=[]),n[s>>8][s>>3&31]|=1<<7-(s&7)}for(i=0;i<n.length;i++)if(n[i]!==void 0){var a=H.from(n[i]);t.writeUInt8(i,r),r+=1,t.writeUInt8(a.length,r),r+=1,a.copy(t,r),r+=a.length}return Te.encode.bytes=r-o,t};Te.encode.bytes=0;Te.decode=function(e,t,r){t||(t=0);let o=t;for(var n=[];t-o<r;){var i=e.readUInt8(t);t+=1;var s=e.readUInt8(t);t+=1;for(var a=0;a<s;a++)for(var l=e.readUInt8(t+a),u=0;u<8;u++)if(l&1<<7-u){var d=In.toString(i<<8|a<<3|u);n.push(d)}t+=s}return Te.decode.bytes=t-o,n};Te.decode.bytes=0;Te.encodingLength=function(e){for(var t=[],r=0;r<e.length;r++){var o=In.toType(e[r]);t[o>>8]=Math.max(t[o>>8]||0,o&255)}var n=0;for(r=0;r<t.length;r++)t[r]!==void 0&&(n+=2+Math.ceil((t[r]+1)/8));return n};var qt=B.nsec={};qt.encode=function(e,t,r){t||(t=H.alloc(qt.encodingLength(e))),r||(r=0);let o=r;return r+=2,U.encode(e.nextDomain,t,r),r+=U.encode.bytes,Te.encode(e.rrtypes,t,r),r+=Te.encode.bytes,qt.encode.bytes=r-o,t.writeUInt16BE(qt.encode.bytes-2,o),t};qt.encode.bytes=0;qt.decode=function(e,t){t||(t=0);let r=t;var o={},n=e.readUInt16BE(t);return t+=2,o.nextDomain=U.decode(e,t),t+=U.decode.bytes,o.rrtypes=Te.decode(e,t,n-(t-r)),t+=Te.decode.bytes,qt.decode.bytes=t-r,o};qt.decode.bytes=0;qt.encodingLength=function(e){return 2+U.encodingLength(e.nextDomain)+Te.encodingLength(e.rrtypes)};var Jt=B.nsec3={};Jt.encode=function(e,t,r){t||(t=H.alloc(Jt.encodingLength(e))),r||(r=0);let o=r,n=e.salt;if(!H.isBuffer(n))throw new Error("salt must be a Buffer");let i=e.nextDomain;if(!H.isBuffer(i))throw new Error("nextDomain must be a Buffer");return r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.flags,r),r+=1,t.writeUInt16BE(e.iterations,r),r+=2,t.writeUInt8(n.length,r),r+=1,n.copy(t,r,0,n.length),r+=n.length,t.writeUInt8(i.length,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,Te.encode(e.rrtypes,t,r),r+=Te.encode.bytes,Jt.encode.bytes=r-o,t.writeUInt16BE(Jt.encode.bytes-2,o),t};Jt.encode.bytes=0;Jt.decode=function(e,t){t||(t=0);let r=t;var o={},n=e.readUInt16BE(t);t+=2,o.algorithm=e.readUInt8(t),t+=1,o.flags=e.readUInt8(t),t+=1,o.iterations=e.readUInt16BE(t),t+=2;let i=e.readUInt8(t);t+=1,o.salt=e.slice(t,t+i),t+=i;let s=e.readUInt8(t);return t+=1,o.nextDomain=e.slice(t,t+s),t+=s,o.rrtypes=Te.decode(e,t,n-(t-r)),t+=Te.decode.bytes,Jt.decode.bytes=t-r,o};Jt.decode.bytes=0;Jt.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+Te.encodingLength(e.rrtypes)};var Kt=B.ds={};Kt.encode=function(e,t,r){t||(t=H.alloc(Kt.encodingLength(e))),r||(r=0);let o=r,n=e.digest;if(!H.isBuffer(n))throw new Error("Digest must be a Buffer");return r+=2,t.writeUInt16BE(e.keyTag,r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.digestType,r),r+=1,n.copy(t,r,0,n.length),r+=n.length,Kt.encode.bytes=r-o,t.writeUInt16BE(Kt.encode.bytes-2,o),t};Kt.encode.bytes=0;Kt.decode=function(e,t){t||(t=0);let r=t;var o={},n=e.readUInt16BE(t);return t+=2,o.keyTag=e.readUInt16BE(t),t+=2,o.algorithm=e.readUInt8(t),t+=1,o.digestType=e.readUInt8(t),t+=1,o.digest=e.slice(t,r+n+2),t+=o.digest.length,Kt.decode.bytes=t-r,o};Kt.decode.bytes=0;Kt.encodingLength=function(e){return 6+H.byteLength(e.digest)};var ut=B.sshfp={};ut.getFingerprintLengthForHashType=function(t){switch(t){case 1:return 20;case 2:return 32}};ut.encode=function(t,r,o){r||(r=H.alloc(ut.encodingLength(t))),o||(o=0);let n=o;o+=2,r[o]=t.algorithm,o+=1,r[o]=t.hash,o+=1;let i=H.from(t.fingerprint.toUpperCase(),"hex");if(i.length!==ut.getFingerprintLengthForHashType(t.hash))throw new Error("Invalid fingerprint length");return i.copy(r,o),o+=i.byteLength,ut.encode.bytes=o-n,r.writeUInt16BE(ut.encode.bytes-2,n),r};ut.encode.bytes=0;ut.decode=function(t,r){r||(r=0);let o=r,n={};r+=2,n.algorithm=t[r],r+=1,n.hash=t[r],r+=1;let i=ut.getFingerprintLengthForHashType(n.hash);return n.fingerprint=t.slice(r,r+i).toString("hex").toUpperCase(),r+=i,ut.decode.bytes=r-o,n};ut.decode.bytes=0;ut.encodingLength=function(e){return 4+H.from(e.fingerprint,"hex").byteLength};var Xt=B.naptr={};Xt.encode=function(e,t,r){t||(t=H.alloc(Xt.encodingLength(e))),r||(r=0);let o=r;return r+=2,t.writeUInt16BE(e.order||0,r),r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,re.encode(e.flags,t,r),r+=re.encode.bytes,re.encode(e.services,t,r),r+=re.encode.bytes,re.encode(e.regexp,t,r),r+=re.encode.bytes,U.encode(e.replacement,t,r),r+=U.encode.bytes,Xt.encode.bytes=r-o,t.writeUInt16BE(Xt.encode.bytes-2,o),t};Xt.encode.bytes=0;Xt.decode=function(e,t){t||(t=0);let r=t,o={};return t+=2,o.order=e.readUInt16BE(t),t+=2,o.preference=e.readUInt16BE(t),t+=2,o.flags=re.decode(e,t),t+=re.decode.bytes,o.services=re.decode(e,t),t+=re.decode.bytes,o.regexp=re.decode(e,t),t+=re.decode.bytes,o.replacement=U.decode(e,t),t+=U.decode.bytes,Xt.decode.bytes=t-r,o};Xt.decode.bytes=0;Xt.encodingLength=function(e){return re.encodingLength(e.flags)+re.encodingLength(e.services)+re.encodingLength(e.regexp)+U.encodingLength(e.replacement)+6};var Yt=B.tlsa={};Yt.encode=function(e,t,r){t||(t=H.alloc(Yt.encodingLength(e))),r||(r=0);let o=r,n=e.certificate;if(!H.isBuffer(n))throw new Error("Certificate must be a Buffer");return r+=2,t.writeUInt8(e.usage,r),r+=1,t.writeUInt8(e.selector,r),r+=1,t.writeUInt8(e.matchingType,r),r+=1,n.copy(t,r,0,n.length),r+=n.length,Yt.encode.bytes=r-o,t.writeUInt16BE(Yt.encode.bytes-2,o),t};Yt.encode.bytes=0;Yt.decode=function(e,t){t||(t=0);let r=t,o={},n=e.readUInt16BE(t);return t+=2,o.usage=e.readUInt8(t),t+=1,o.selector=e.readUInt8(t),t+=1,o.matchingType=e.readUInt8(t),t+=1,o.certificate=e.slice(t,r+n+2),t+=o.certificate.length,Yt.decode.bytes=t-r,o};Yt.decode.bytes=0;Yt.encodingLength=function(e){return 5+H.byteLength(e.certificate)};var fh=B.record=function(e){switch(e.toUpperCase()){case"A":return _n;case"PTR":return Ct;case"CNAME":return MD;case"DNAME":return BD;case"TXT":return xn;case"NULL":return kn;case"AAAA":return $n;case"SRV":return Sn;case"HINFO":return wn;case"CAA":return lt;case"NS":return yn;case"SOA":return bn;case"MX":return Xn;case"OPT":return dt;case"DNSKEY":return qe;case"RRSIG":return Wt;case"RP":return Vt;case"NSEC":return qt;case"NSEC3":return Jt;case"SSHFP":return ut;case"DS":return Kt;case"NAPTR":return Xt;case"TLSA":return Yt}return vn},Le=B.answer={};Le.encode=function(e,t,r){t||(t=H.alloc(Le.encodingLength(e))),r||(r=0);let o=r;if(U.encode(e.name,t,r),r+=U.encode.bytes,t.writeUInt16BE(In.toType(e.type),r),e.type.toUpperCase()==="OPT"){if(e.name!==".")throw new Error("OPT name must be root.");t.writeUInt16BE(e.udpPayloadSize||4096,r+2),t.writeUInt8(e.extendedRcode||0,r+4),t.writeUInt8(e.ednsVersion||0,r+5),t.writeUInt16BE(e.flags||0,r+6),r+=8,dt.encode(e.options||[],t,r),r+=dt.encode.bytes}else{let n=_l.toClass(e.class===void 0?"IN":e.class);e.flush&&(n|=mh),t.writeUInt16BE(n,r+2),t.writeUInt32BE(e.ttl||0,r+4),r+=8;let i=fh(e.type);i.encode(e.data,t,r),r+=i.encode.bytes}return Le.encode.bytes=r-o,t};Le.encode.bytes=0;Le.decode=function(e,t){t||(t=0);let r={},o=t;if(r.name=U.decode(e,t),t+=U.decode.bytes,r.type=In.toString(e.readUInt16BE(t)),r.type==="OPT")r.udpPayloadSize=e.readUInt16BE(t+2),r.extendedRcode=e.readUInt8(t+4),r.ednsVersion=e.readUInt8(t+5),r.flags=e.readUInt16BE(t+6),r.flag_do=(r.flags>>15&1)===1,r.options=dt.decode(e,t+8),t+=8+dt.decode.bytes;else{let n=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=_l.toString(n&zD),r.flush=!!(n&mh);let i=fh(r.type);r.data=i.decode(e,t+8),t+=8+i.decode.bytes}return Le.decode.bytes=t-o,r};Le.decode.bytes=0;Le.encodingLength=function(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return U.encodingLength(e.name)+8+fh(e.type).encodingLength(t)};var Tt=B.question={};Tt.encode=function(e,t,r){t||(t=H.alloc(Tt.encodingLength(e))),r||(r=0);let o=r;return U.encode(e.name,t,r),r+=U.encode.bytes,t.writeUInt16BE(In.toType(e.type),r),r+=2,t.writeUInt16BE(_l.toClass(e.class===void 0?"IN":e.class),r),r+=2,Tt.encode.bytes=r-o,e};Tt.encode.bytes=0;Tt.decode=function(e,t){t||(t=0);let r=t,o={};return o.name=U.decode(e,t),t+=U.decode.bytes,o.type=In.toString(e.readUInt16BE(t)),t+=2,o.class=_l.toString(e.readUInt16BE(t)),t+=2,o.class&M0&&(o.class&=FD),Tt.decode.bytes=t-r,o};Tt.decode.bytes=0;Tt.encodingLength=function(e){return U.encodingLength(e.name)+4};B.AUTHORITATIVE_ANSWER=1024;B.TRUNCATED_RESPONSE=512;B.RECURSION_DESIRED=256;B.RECURSION_AVAILABLE=128;B.AUTHENTIC_DATA=32;B.CHECKING_DISABLED=16;B.DNSSEC_OK=32768;B.encode=function(e,t,r){let o=!t;o&&(t=H.alloc(B.encodingLength(e))),r||(r=0);let n=r;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),Rt.encode(e,t,r),r+=Rt.encode.bytes,r=ms(e.questions,Tt,t,r),r=ms(e.answers,Le,t,r),r=ms(e.authorities,Le,t,r),r=ms(e.additionals,Le,t,r),B.encode.bytes=r-n,o&&B.encode.bytes!==t.length?t.slice(0,B.encode.bytes):t};B.encode.bytes=0;B.decode=function(e,t){t||(t=0);let r=t,o=Rt.decode(e,t);return t+=Rt.decode.bytes,t=Sl(o.questions,Tt,e,t),t=Sl(o.answers,Le,e,t),t=Sl(o.authorities,Le,e,t),t=Sl(o.additionals,Le,e,t),B.decode.bytes=t-r,o};B.decode.bytes=0;B.encodingLength=function(e){return Rt.encodingLength(e)+Go(e.questions||[],Tt)+Go(e.answers||[],Le)+Go(e.authorities||[],Le)+Go(e.additionals||[],Le)};B.streamEncode=function(e){let t=B.encode(e),r=H.alloc(2);r.writeUInt16BE(t.byteLength);let o=H.concat([r,t]);return B.streamEncode.bytes=o.byteLength,o};B.streamEncode.bytes=0;B.streamDecode=function(e){let t=e.readUInt16BE(0);if(e.byteLength<t+2)return null;let r=B.decode(e.slice(2));return B.streamDecode.bytes=B.decode.bytes,r};B.streamDecode.bytes=0;function Go(e,t){let r=0;for(let o=0;o<e.length;o++)r+=t.encodingLength(e[o]);return r}function ms(e,t,r,o){for(let n=0;n<e.length;n++)t.encode(e[n],r,o),o+=t.encode.bytes;return o}function Sl(e,t,r,o){for(let n=0;n<e.length;n++)e[n]=t.decode(r,o),o+=t.decode.bytes;return o}});var G0=ie((tG,Z0)=>{"use strict";var H0=qD;process.nextTick(VD,42);Z0.exports=HD;function HD(e){var t=o;return r;function r(n){t(n||GD)}function o(n){var i=[n];t=s,e(a);function s(l){i.push(l)}function a(l){var u=arguments;for(t=ZD(l)?o:d;i.length;)d(i.shift());function d(p){H0(WD,p,u)}}}}function ZD(e){return Object.prototype.toString.call(e)==="[object Error]"}function GD(){}function WD(e,t){e.apply(null,t)}function VD(e){e===42&&(H0=process.nextTick)}function qD(e,t,r){process.nextTick(function(){e(t,r)})}});var q0=ie((nG,V0)=>{var gh=B0(),JD=ue("dgram"),KD=G0(),XD=ue("events"),vh=ue("os"),hh=function(){};V0.exports=function(e){e||(e={});var t=new XD.EventEmitter,r=typeof e.port=="number"?e.port:5353,o=e.type||"udp4",n=e.ip||e.host||(o==="udp4"?"224.0.0.251":null),i={address:n,port:r},s={},a=!1,l=null;if(o==="udp6"&&(!n||!e.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var u=e.socket||JD.createSocket({type:o,reuseAddr:e.reuseAddr!==!1,toString:function(){return o}});u.on("error",function(p){p.code==="EACCES"||p.code==="EADDRINUSE"?t.emit("error",p):t.emit("warning",p)}),u.on("message",function(p,m){try{p=gh.decode(p)}catch(f){t.emit("warning",f);return}t.emit("packet",p,m),p.type==="query"&&t.emit("query",p,m),p.type==="response"&&t.emit("response",p,m)}),u.on("listening",function(){r||(r=i.port=u.address().port),e.multicast!==!1&&(t.update(),l=setInterval(t.update,5e3),u.setMulticastTTL(e.ttl||255),u.setMulticastLoopback(e.loopback!==!1))});var d=KD(function(p){if(!r||e.bind===!1)return p(null);u.once("error",p),u.bind(r,e.bind||e.interface,function(){u.removeListener("error",p),p(null)})});return d(function(p){if(p)return t.emit("error",p);t.emit("ready")}),t.send=function(p,m,f){if(typeof m=="function")return t.send(p,null,m);f||(f=hh),m?!m.host&&!m.address&&(m.address=i.address):m=i,d(g);function g(h){if(a)return f();if(h)return f(h);var y=gh.encode(p);u.send(y,0,y.length,m.port,m.address||m.host,f)}},t.response=t.respond=function(p,m,f){Array.isArray(p)&&(p={answers:p}),p.type="response",p.flags=(p.flags||0)|gh.AUTHORITATIVE_ANSWER,t.send(p,m,f)},t.query=function(p,m,f,g){if(typeof m=="function")return t.query(p,null,null,m);if(typeof m=="object"&&m&&m.port)return t.query(p,null,m,f);if(typeof f=="function")return t.query(p,m,null,f);g||(g=hh),typeof p=="string"&&(p=[{name:p,type:m||"ANY"}]),Array.isArray(p)&&(p={type:"query",questions:p}),p.type="query",t.send(p,f,g)},t.destroy=function(p){if(p||(p=hh),a)return process.nextTick(p);a=!0,clearInterval(l);for(var m in s)try{u.dropMembership(n,m)}catch{}s={},u.close(p)},t.update=function(){for(var p=e.interface?[].concat(e.interface):QD(),m=!1,f=0;f<p.length;f++){var g=p[f];if(!s[g])try{u.addMembership(n,g),s[g]=!0,m=!0}catch(h){t.emit("warning",h)}}if(m){if(u.setMulticastInterface)try{u.setMulticastInterface(e.interface||YD())}catch(h){t.emit("warning",h)}t.emit("networkInterface")}},t};function YD(){for(var e=vh.networkInterfaces(),t=Object.keys(e),r=0;r<t.length;r++)for(var o=e[t[r]],n=0;n<o.length;n++){var i=o[n];if(W0(i.family)&&!i.internal)return vh.platform()==="darwin"&&t[r]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function QD(){for(var e=vh.networkInterfaces(),t=Object.keys(e),r=[],o=0;o<t.length;o++)for(var n=e[t[o]],i=0;i<n.length;i++){var s=n[i];if(W0(s.family)){r.push(s.address);break}}return r}function W0(e){return e===4||e==="IPv4"}});var K0=ie((rG,J0)=>{"use strict";J0.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,i;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;for(n of t.entries())if(!e(n[1],r.get(n[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(t[n]!==r[n])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),o=i.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=o;n--!==0;){var s=i[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var X0=ie(Cr=>{"use strict";var yh=Cr&&Cr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.Server=void 0;var eN=yh(q0()),tN=yh(K0()),nN=yh(bl()),$l=class{constructor(t,r){this.registry={},this.mdns=(0,eN.default)(t),this.mdns.setMaxListeners(0),this.mdns.on("query",this.respondToQuery.bind(this)),this.errorCallback=r??function(o){throw o}}register(t){let r=o=>{var n=this.registry[o.type];if(!n)n=this.registry[o.type]=[];else if(n.some(this.isDuplicateRecord(o)))return;n.push(o)};Array.isArray(t)?t.forEach(r):r(t)}unregister(t){let r=o=>{let n=o.type;n in this.registry&&(this.registry[n]=this.registry[n].filter(i=>i.name!==o.name))};Array.isArray(t)?t.forEach(r):r(t)}respondToQuery(t){let r=this;t.questions.forEach(o=>{var n=o.type,i=o.name,s=n==="ANY"?Object.keys(r.registry).map(r.recordsFor.bind(r,i)).flat(1):r.recordsFor(i,n);if(s.length!==0){var a=[];n!=="ANY"&&(s.forEach(l=>{l.type==="PTR"&&(a=a.concat(r.recordsFor(l.data,"SRV")).concat(r.recordsFor(l.data,"TXT")))}),a.filter(function(l){return l.type==="SRV"}).map(function(l){return l.data.target}).filter(this.unique()).forEach(function(l){a=a.concat(r.recordsFor(l,"A")).concat(r.recordsFor(l,"AAAA"))})),r.mdns.respond({answers:s,additionals:a},l=>{l&&this.errorCallback(l)})}})}recordsFor(t,r){return r in this.registry?this.registry[r].filter(o=>{var n=~t.indexOf(".")?o.name:o.name.split(".")[0];return(0,nN.default)(n,t)}):[]}isDuplicateRecord(t){return r=>t.type===r.type&&t.name===r.name&&(0,tN.default)(t.data,r.data)}unique(){var t=[];return r=>~t.indexOf(r)?!1:(t.push(r),!0)}};Cr.Server=$l;Cr.default=$l});var Y0=ie(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.default=(e,t)=>{if(t===void 0)return!0;let r=e.txt,o=Object.entries(t).map(([n,i])=>{let s=r[n];return!(s===void 0||i!=s)});return o.length==0?!0:!o.includes(!1)}});var Q0=ie(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.default=e=>Object.keys(e).filter(t=>!t.includes("binary")).reduce((t,r)=>Object.assign(t,{[r]:e[r]}),{})});var eS=ie(kh=>{"use strict";Object.defineProperty(kh,"__esModule",{value:!0});kh.default=rN;function rN(e,t){if(e===void 0||t===void 0)return!1;let r=Object.keys(e),o=Object.keys(t);if(r.length!=o.length)return!1;for(let n of r)if(e[n]!=t[n])return!1;return!0}});var rS=ie(Tr=>{"use strict";var fs=Tr&&Tr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.Browser=void 0;var oN=fs(nh()),Yn=fs(bl()),iN=ue("events"),wh=rh(),tS=fs(Y0()),sN=fs(Q0()),aN=fs(eS()),nS=".local",cN="_services._dns-sd._udp"+nS,Il=class e extends iN.EventEmitter{constructor(t,r,o){if(super(),this.onresponse=void 0,this.serviceMap={},this.wildcard=!1,this._services=[],typeof r=="function")return new e(t,null,r);this.mdns=t,this.txt=new oN.default(r!==null&&r.txt!=null?r.txt:void 0),r===null||r.type===void 0?(this.name=cN,this.wildcard=!0):(this.name=(0,wh.toString)({name:r.type,protocol:r.protocol||"tcp"})+nS,r.name&&(this.name=r.name+"."+this.name),this.wildcard=!1),r!=null&&r.txt!==void 0&&(this.txtQuery=(0,sN.default)(r.txt)),o&&this.on("up",o),this.start()}start(){if(!(this.onresponse||this.name===void 0)){var t=this,r={};this.wildcard||(r[this.name]=!0),this.onresponse=(o,n)=>{t.wildcard&&o.answers.forEach(s=>{s.type!=="PTR"||s.name!==t.name||s.name in r||(r[s.data]=!0,t.mdns.query(s.data,"PTR"))});let i=Date.now();Object.keys(r).forEach(function(s){t.goodbyes(s,o).forEach(t.removeService.bind(t));var a=t.buildServicesFor(s,o,t.txt,n,i);a.length!==0&&a.forEach(l=>{let u=t._services.find(d=>(0,Yn.default)(d.fqdn,l.fqdn));if(u){t.updateServiceSrv(u,l),t.updateServiceTxt(u,l);return}t.addService(l)})})},this.mdns.on("response",this.onresponse),this.update()}}stop(){this.onresponse&&(this.mdns.removeListener("response",this.onresponse),this.onresponse=void 0)}update(){this.mdns.query(this.name,"PTR")}expire(){let t=Date.now();this._services=this._services.filter(r=>!r.ttl||r.lastSeen===void 0?!0:r.lastSeen+r.ttl*1e3<t?(this.emit("down",r),!1):!0)}get services(){return this._services}addService(t){(0,tS.default)(t,this.txtQuery)!==!1&&(this._services.push(t),this.serviceMap[t.fqdn]=!0,this.emit("up",t))}updateServiceSrv(t,r){(t.name!==r.name||t.host!==r.host||t.port!==r.port||t.type!==r.type||t.protocol!==r.protocol)&&(this.replaceService(r),this.emit("srv-update",r,t))}updateServiceTxt(t,r){if(!(0,aN.default)(r.txt,t?.txt||{})){if(!(0,tS.default)(r,this.txtQuery)){this.removeService(r.fqdn);return}this.replaceService(r),this.emit("txt-update",r,t)}}replaceService(t){this._services=this._services.map(r=>(0,Yn.default)(r.fqdn,t.fqdn)?t:r)}removeService(t){var r,o;this._services.some(function(n,i){if((0,Yn.default)(n.fqdn,t))return r=n,o=i,!0}),!(!r||o===void 0)&&(this._services.splice(o,1),delete this.serviceMap[t],this.emit("down",r))}goodbyes(t,r){return r.answers.concat(r.additionals).filter(o=>o.type==="PTR"&&o.ttl===0&&(0,Yn.default)(o.name,t)).map(o=>o.data)}buildServicesFor(t,r,o,n,i){var s=r.answers.concat(r.additionals).filter(a=>a.ttl>0);return s.filter(a=>a.type==="PTR"&&(0,Yn.default)(a.name,t)).map(a=>{let l={addresses:[],subtypes:[],ttl:a.ttl,lastSeen:i};if(s.filter(u=>u.type==="PTR"&&(0,Yn.default)(u.data,a.data)&&u.name.includes("._sub")).forEach(u=>{let d=(0,wh.toType)(u.name);l.subtypes.push(d.subtype)}),s.filter(u=>(u.type==="SRV"||u.type==="TXT")&&(0,Yn.default)(u.name,a.data)).forEach(u=>{if(u.type==="SRV"){var d=u.name.split("."),p=d[0],m=(0,wh.toType)(d.slice(1,-1).join("."));l.name=p,l.fqdn=u.name,l.host=u.data.target,l.referer=n,l.port=u.data.port,l.type=m.name,l.protocol=m.protocol}else u.type==="TXT"&&(l.rawTxt=u.data,l.txt=this.txt.decodeAll(u.data))}),!!l.name)return s.filter(u=>(u.type==="A"||u.type==="AAAA")&&(0,Yn.default)(u.name,l.host)).forEach(u=>l.addresses.push(u.data)),l}).filter(a=>!!a)}};Tr.Browser=Il;Tr.default=Il});var oS=ie(En=>{"use strict";var El=En&&En.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(En,"__esModule",{value:!0});En.Browser=En.Service=void 0;var lN=El(T0()),uN=El(X0()),Sh=El(rS());En.Browser=Sh.default;var dN=El(oh());En.Service=dN.default;var _h=class{constructor(t={},r){this.server=new uN.default(t,r),this.registry=new lN.default(this.server)}publish(t){return this.registry.publish(t)}unpublishAll(t){return this.registry.unpublishAll(t)}find(t=null,r){return new Sh.default(this.server.mdns,t,r)}findOne(t=null,r=1e4,o){let n=new Sh.default(this.server.mdns,t);var i;return n.once("up",s=>{i!==void 0&&clearTimeout(i),n.stop(),o&&o(s)}),i=setTimeout(()=>{n.stop(),o&&o(null)},r),n}destroy(t){this.registry.destroy(),this.server.mdns.destroy(t)}};En.default=_h});var sS=ie((Je,iS)=>{"use strict";var pN=Je&&Je.__createBinding||(Object.create?(function(e,t,r,o){o===void 0&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}):(function(e,t,r,o){o===void 0&&(o=r),e[o]=t[r]})),mN=Je&&Je.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),fN=Je&&Je.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var o=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(o[o.length]=n);return o},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var o=e(t),n=0;n<o.length;n++)o[n]!=="default"&&pN(r,t,o[n]);return mN(r,t),r}})();Object.defineProperty(Je,"__esModule",{value:!0});Je.Browser=Je.Service=Je.Bonjour=void 0;var gs=fN(oS());Object.defineProperty(Je,"Service",{enumerable:!0,get:function(){return gs.Service}});Object.defineProperty(Je,"Browser",{enumerable:!0,get:function(){return gs.Browser}});var Rr=class extends gs.default{};Je.Bonjour=Rr;Je.default=Rr;iS.exports=Object.assign(Rr,{Bonjour:Rr,Service:gs.Service,Browser:gs.Browser,default:Rr})});var Tn=ie(($K,S_)=>{"use strict";var k_=["nodebuffer","arraybuffer","fragments"],w_=typeof Blob<"u";w_&&k_.push("blob");S_.exports={BINARY_TYPES:k_,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:w_,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var ks=ie((IK,Fl)=>{"use strict";var{EMPTY_BUFFER:ej}=Tn(),Hh=Buffer[Symbol.species];function tj(e,t){if(e.length===0)return ej;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),o=0;for(let n=0;n<e.length;n++){let i=e[n];r.set(i,o),o+=i.length}return o<t?new Hh(r.buffer,r.byteOffset,o):r}function __(e,t,r,o,n){for(let i=0;i<n;i++)r[o+i]=e[i]^t[i&3]}function $_(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}function nj(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function Zh(e){if(Zh.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new Hh(e):ArrayBuffer.isView(e)?t=new Hh(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),Zh.readOnly=!1),t}Fl.exports={concat:tj,mask:__,toArrayBuffer:nj,toBuffer:Zh,unmask:$_};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=ue("bufferutil");Fl.exports.mask=function(t,r,o,n,i){i<48?__(t,r,o,n,i):e.mask(t,r,o,n,i)},Fl.exports.unmask=function(t,r){t.length<32?$_(t,r):e.unmask(t,r)}}catch{}});var A_=ie((EK,E_)=>{"use strict";var I_=Symbol("kDone"),Gh=Symbol("kRun"),Wh=class{constructor(t){this[I_]=()=>{this.pending--,this[Gh]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Gh]()}[Gh](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[I_])}}};E_.exports=Wh});var ei=ie((AK,R_)=>{"use strict";var ws=ue("zlib"),P_=ks(),rj=A_(),{kStatusCode:C_}=Tn(),oj=Buffer[Symbol.species],ij=Buffer.from([0,0,255,255]),Bl=Symbol("permessage-deflate"),Rn=Symbol("total-length"),Yo=Symbol("callback"),rr=Symbol("buffers"),Qo=Symbol("error"),Ml,Vh=class{constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!Ml){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Ml=new rj(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[Yo];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,o=t.find(n=>!(r.serverNoContextTakeover===!1&&n.server_no_context_takeover||n.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>n.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!n.client_max_window_bits));if(!o)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(o.server_no_context_takeover=!0),r.clientNoContextTakeover&&(o.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(o.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?o.client_max_window_bits=r.clientMaxWindowBits:(o.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete o.client_max_window_bits,o}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(o=>{let n=r[o];if(n.length>1)throw new Error(`Parameter "${o}" must have only a single value`);if(n=n[0],o==="client_max_window_bits"){if(n!==!0){let i=+n;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${o}": ${n}`);n=i}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${o}": ${n}`)}else if(o==="server_max_window_bits"){let i=+n;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${o}": ${n}`);n=i}else if(o==="client_no_context_takeover"||o==="server_no_context_takeover"){if(n!==!0)throw new TypeError(`Invalid value for parameter "${o}": ${n}`)}else throw new Error(`Unknown parameter "${o}"`);r[o]=n})}),t}decompress(t,r,o){Ml.add(n=>{this._decompress(t,r,(i,s)=>{n(),o(i,s)})})}compress(t,r,o){Ml.add(n=>{this._compress(t,r,(i,s)=>{n(),o(i,s)})})}_decompress(t,r,o){let n=this._isServer?"client":"server";if(!this._inflate){let i=`${n}_max_window_bits`,s=typeof this.params[i]!="number"?ws.Z_DEFAULT_WINDOWBITS:this.params[i];this._inflate=ws.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[Bl]=this,this._inflate[Rn]=0,this._inflate[rr]=[],this._inflate.on("error",aj),this._inflate.on("data",T_)}this._inflate[Yo]=o,this._inflate.write(t),r&&this._inflate.write(ij),this._inflate.flush(()=>{let i=this._inflate[Qo];if(i){this._inflate.close(),this._inflate=null,o(i);return}let s=P_.concat(this._inflate[rr],this._inflate[Rn]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Rn]=0,this._inflate[rr]=[],r&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),o(null,s)})}_compress(t,r,o){let n=this._isServer?"server":"client";if(!this._deflate){let i=`${n}_max_window_bits`,s=typeof this.params[i]!="number"?ws.Z_DEFAULT_WINDOWBITS:this.params[i];this._deflate=ws.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[Rn]=0,this._deflate[rr]=[],this._deflate.on("data",sj)}this._deflate[Yo]=o,this._deflate.write(t),this._deflate.flush(ws.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=P_.concat(this._deflate[rr],this._deflate[Rn]);r&&(i=new oj(i.buffer,i.byteOffset,i.length-4)),this._deflate[Yo]=null,this._deflate[Rn]=0,this._deflate[rr]=[],r&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),o(null,i)})}};R_.exports=Vh;function sj(e){this[rr].push(e),this[Rn]+=e.length}function T_(e){if(this[Rn]+=e.length,this[Bl]._maxPayload<1||this[Rn]<=this[Bl]._maxPayload){this[rr].push(e);return}this[Qo]=new RangeError("Max payload size exceeded"),this[Qo].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Qo][C_]=1009,this.removeListener("data",T_),this.reset()}function aj(e){if(this[Bl]._inflate=null,this[Qo]){this[Yo](this[Qo]);return}e[C_]=1007,this[Yo](e)}});var ti=ie((PK,Hl)=>{"use strict";var{isUtf8:O_}=ue("buffer"),{hasBlob:cj}=Tn(),lj=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function uj(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function qh(e){let t=e.length,r=0;for(;r<t;)if((e[r]&128)===0)r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}function dj(e){return cj&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}Hl.exports={isBlob:dj,isValidStatusCode:uj,isValidUTF8:qh,tokenChars:lj};if(O_)Hl.exports.isValidUTF8=function(e){return e.length<24?qh(e):O_(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=ue("utf-8-validate");Hl.exports.isValidUTF8=function(t){return t.length<32?qh(t):e(t)}}catch{}});var Qh=ie((CK,F_)=>{"use strict";var{Writable:pj}=ue("stream"),D_=ei(),{BINARY_TYPES:mj,EMPTY_BUFFER:N_,kStatusCode:fj,kWebSocket:gj}=Tn(),{concat:Jh,toArrayBuffer:hj,unmask:vj}=ks(),{isValidStatusCode:yj,isValidUTF8:L_}=ti(),Zl=Buffer[Symbol.species],yt=0,U_=1,j_=2,z_=3,Kh=4,Xh=5,Gl=6,Yh=class extends pj{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||mj[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[gj]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=yt}_write(t,r,o){if(this._opcode===8&&this._state==yt)return o();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){o(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(o)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let o=this._buffers[0];return this._buffers[0]=new Zl(o.buffer,o.byteOffset+t,o.length-t),new Zl(o.buffer,o.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let o=this._buffers[0],n=r.length-t;t>=o.length?r.set(this._buffers.shift(),n):(r.set(new Uint8Array(o.buffer,o.byteOffset,t),n),this._buffers[0]=new Zl(o.buffer,o.byteOffset+t,o.length-t)),t-=o.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case yt:this.getInfo(t);break;case U_:this.getPayloadLength16(t);break;case j_:this.getPayloadLength64(t);break;case z_:this.getMask();break;case Kh:this.getData(t);break;case Xh:case Gl:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let n=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(n);return}let o=(r[0]&64)===64;if(o&&!this._extensions[D_.extensionName]){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(n);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(o){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(n);return}if(!this._fragmented){let n=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(n);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let n=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(n);return}this._compressed=o}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let n=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(n);return}if(o){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(n);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let n=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(n);return}}else{let n=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(n);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let n=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(n);return}}else if(this._masked){let n=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(n);return}this._payloadLength===126?this._state=U_:this._payloadLength===127?this._state=j_:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),o=r.readUInt32BE(0);if(o>Math.pow(2,21)-1){let n=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(n);return}this._payloadLength=o*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=z_:this._state=Kh}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Kh}getData(t){let r=N_;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&vj(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._compressed){this._state=Xh,this.decompress(r,t);return}if(r.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let o=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(o);return}this._messageLength=this._totalPayloadLength,this._fragments.push(r)}this.dataMessage(t)}decompress(t,r){this._extensions[D_.extensionName].decompress(t,this._fin,(n,i)=>{if(n)return r(n);if(i.length){if(this._messageLength+=i.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(s);return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let s=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");r(s);return}this._fragments.push(i)}this.dataMessage(r),this._state===yt&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=yt;return}let r=this._messageLength,o=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let n;this._binaryType==="nodebuffer"?n=Jh(o,r):this._binaryType==="arraybuffer"?n=hj(Jh(o,r)):this._binaryType==="blob"?n=new Blob(o):n=o,this._allowSynchronousEvents?(this.emit("message",n,!0),this._state=yt):(this._state=Gl,setImmediate(()=>{this.emit("message",n,!0),this._state=yt,this.startLoop(t)}))}else{let n=Jh(o,r);if(!this._skipUTF8Validation&&!L_(n)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(i);return}this._state===Xh||this._allowSynchronousEvents?(this.emit("message",n,!1),this._state=yt):(this._state=Gl,setImmediate(()=>{this.emit("message",n,!1),this._state=yt,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,N_),this.end();else{let o=t.readUInt16BE(0);if(!yj(o)){let i=this.createError(RangeError,`invalid status code ${o}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(i);return}let n=new Zl(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!L_(n)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(i);return}this._loop=!1,this.emit("conclude",o,n),this.end()}this._state=yt;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=yt):(this._state=Gl,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=yt,this.startLoop(r)}))}createError(t,r,o,n,i){this._loop=!1,this._errored=!0;let s=new t(o?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(s,this.createError),s.code=i,s[fj]=n,s}};F_.exports=Yh});var nv=ie((RK,H_)=>{"use strict";var{Duplex:TK}=ue("stream"),{randomFillSync:bj}=ue("crypto"),{types:{isUint8Array:xj}}=ue("util"),M_=ei(),{EMPTY_BUFFER:kj,kWebSocket:wj,NOOP:Sj}=Tn(),{isBlob:ni,isValidStatusCode:_j}=ti(),{mask:B_,toBuffer:jr}=ks(),bt=Symbol("kByteLength"),$j=Buffer.alloc(4),Wl=8*1024,zr,ri=Wl,Dt=0,Ij=1,Ej=2,ev=class e{constructor(t,r,o){this._extensions=r||{},o&&(this._generateMask=o,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Dt,this.onerror=Sj,this[wj]=void 0}static frame(t,r){let o,n=!1,i=2,s=!1;r.mask&&(o=r.maskBuffer||$j,r.generateMask?r.generateMask(o):(ri===Wl&&(zr===void 0&&(zr=Buffer.alloc(Wl)),bj(zr,0,Wl),ri=0),o[0]=zr[ri++],o[1]=zr[ri++],o[2]=zr[ri++],o[3]=zr[ri++]),s=(o[0]|o[1]|o[2]|o[3])===0,i=6);let a;typeof t=="string"?(!r.mask||s)&&r[bt]!==void 0?a=r[bt]:(t=Buffer.from(t),a=t.length):(a=t.length,n=r.mask&&r.readOnly&&!s);let l=a;a>=65536?(i+=8,l=127):a>125&&(i+=2,l=126);let u=Buffer.allocUnsafe(n?a+i:i);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=l,l===126?u.writeUInt16BE(a,2):l===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),r.mask?(u[1]|=128,u[i-4]=o[0],u[i-3]=o[1],u[i-2]=o[2],u[i-1]=o[3],s?[u,t]:n?(B_(t,o,u,i,a),[u]):(B_(t,o,t,0,a),[u,t])):[u,t]}close(t,r,o,n){let i;if(t===void 0)i=kj;else{if(typeof t!="number"||!_j(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)i=Buffer.allocUnsafe(2),i.writeUInt16BE(t,0);else{let a=Buffer.byteLength(r);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");if(i=Buffer.allocUnsafe(2+a),i.writeUInt16BE(t,0),typeof r=="string")i.write(r,2);else if(xj(r))i.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[bt]:i.length,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Dt?this.enqueue([this.dispatch,i,!1,s,n]):this.sendFrame(e.frame(i,s),n)}ping(t,r,o){let n,i;if(typeof t=="string"?(n=Buffer.byteLength(t),i=!1):ni(t)?(n=t.size,i=!1):(t=jr(t),n=t.length,i=jr.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[bt]:n,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};ni(t)?this._state!==Dt?this.enqueue([this.getBlobData,t,!1,s,o]):this.getBlobData(t,!1,s,o):this._state!==Dt?this.enqueue([this.dispatch,t,!1,s,o]):this.sendFrame(e.frame(t,s),o)}pong(t,r,o){let n,i;if(typeof t=="string"?(n=Buffer.byteLength(t),i=!1):ni(t)?(n=t.size,i=!1):(t=jr(t),n=t.length,i=jr.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[bt]:n,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};ni(t)?this._state!==Dt?this.enqueue([this.getBlobData,t,!1,s,o]):this.getBlobData(t,!1,s,o):this._state!==Dt?this.enqueue([this.dispatch,t,!1,s,o]):this.sendFrame(e.frame(t,s),o)}send(t,r,o){let n=this._extensions[M_.extensionName],i=r.binary?2:1,s=r.compress,a,l;typeof t=="string"?(a=Buffer.byteLength(t),l=!1):ni(t)?(a=t.size,l=!1):(t=jr(t),a=t.length,l=jr.readOnly),this._firstFragment?(this._firstFragment=!1,s&&n&&n.params[n._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(s=a>=n._threshold),this._compress=s):(s=!1,i=0),r.fin&&(this._firstFragment=!0);let u={[bt]:a,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:l,rsv1:s};ni(t)?this._state!==Dt?this.enqueue([this.getBlobData,t,this._compress,u,o]):this.getBlobData(t,this._compress,u,o):this._state!==Dt?this.enqueue([this.dispatch,t,this._compress,u,o]):this.dispatch(t,this._compress,u,o)}getBlobData(t,r,o,n){this._bufferedBytes+=o[bt],this._state=Ej,t.arrayBuffer().then(i=>{if(this._socket.destroyed){let a=new Error("The socket was closed while the blob was being read");process.nextTick(tv,this,a,n);return}this._bufferedBytes-=o[bt];let s=jr(i);r?this.dispatch(s,r,o,n):(this._state=Dt,this.sendFrame(e.frame(s,o),n),this.dequeue())}).catch(i=>{process.nextTick(Aj,this,i,n)})}dispatch(t,r,o,n){if(!r){this.sendFrame(e.frame(t,o),n);return}let i=this._extensions[M_.extensionName];this._bufferedBytes+=o[bt],this._state=Ij,i.compress(t,o.fin,(s,a)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");tv(this,l,n);return}this._bufferedBytes-=o[bt],this._state=Dt,o.readOnly=!1,this.sendFrame(e.frame(a,o),n),this.dequeue()})}dequeue(){for(;this._state===Dt&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][bt],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][bt],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};H_.exports=ev;function tv(e,t,r){typeof r=="function"&&r(t);for(let o=0;o<e._queue.length;o++){let n=e._queue[o],i=n[n.length-1];typeof i=="function"&&i(t)}}function Aj(e,t,r){tv(e,t,r),e.onerror(t)}});var Y_=ie((OK,X_)=>{"use strict";var{kForOnEventAttribute:Ss,kListener:rv}=Tn(),Z_=Symbol("kCode"),G_=Symbol("kData"),W_=Symbol("kError"),V_=Symbol("kMessage"),q_=Symbol("kReason"),oi=Symbol("kTarget"),J_=Symbol("kType"),K_=Symbol("kWasClean"),On=class{constructor(t){this[oi]=null,this[J_]=t}get target(){return this[oi]}get type(){return this[J_]}};Object.defineProperty(On.prototype,"target",{enumerable:!0});Object.defineProperty(On.prototype,"type",{enumerable:!0});var Fr=class extends On{constructor(t,r={}){super(t),this[Z_]=r.code===void 0?0:r.code,this[q_]=r.reason===void 0?"":r.reason,this[K_]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[Z_]}get reason(){return this[q_]}get wasClean(){return this[K_]}};Object.defineProperty(Fr.prototype,"code",{enumerable:!0});Object.defineProperty(Fr.prototype,"reason",{enumerable:!0});Object.defineProperty(Fr.prototype,"wasClean",{enumerable:!0});var ii=class extends On{constructor(t,r={}){super(t),this[W_]=r.error===void 0?null:r.error,this[V_]=r.message===void 0?"":r.message}get error(){return this[W_]}get message(){return this[V_]}};Object.defineProperty(ii.prototype,"error",{enumerable:!0});Object.defineProperty(ii.prototype,"message",{enumerable:!0});var _s=class extends On{constructor(t,r={}){super(t),this[G_]=r.data===void 0?null:r.data}get data(){return this[G_]}};Object.defineProperty(_s.prototype,"data",{enumerable:!0});var Pj={addEventListener(e,t,r={}){for(let n of this.listeners(e))if(!r[Ss]&&n[rv]===t&&!n[Ss])return;let o;if(e==="message")o=function(i,s){let a=new _s("message",{data:s?i:i.toString()});a[oi]=this,Vl(t,this,a)};else if(e==="close")o=function(i,s){let a=new Fr("close",{code:i,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[oi]=this,Vl(t,this,a)};else if(e==="error")o=function(i){let s=new ii("error",{error:i,message:i.message});s[oi]=this,Vl(t,this,s)};else if(e==="open")o=function(){let i=new On("open");i[oi]=this,Vl(t,this,i)};else return;o[Ss]=!!r[Ss],o[rv]=t,r.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[rv]===t&&!r[Ss]){this.removeListener(e,r);break}}};X_.exports={CloseEvent:Fr,ErrorEvent:ii,Event:On,EventTarget:Pj,MessageEvent:_s};function Vl(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}});var ql=ie((DK,Q_)=>{"use strict";var{tokenChars:$s}=ti();function en(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function Cj(e){let t=Object.create(null),r=Object.create(null),o=!1,n=!1,i=!1,s,a,l=-1,u=-1,d=-1,p=0;for(;p<e.length;p++)if(u=e.charCodeAt(p),s===void 0)if(d===-1&&$s[u]===1)l===-1&&(l=p);else if(p!==0&&(u===32||u===9))d===-1&&l!==-1&&(d=p);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1&&(d=p);let f=e.slice(l,d);u===44?(en(t,f,r),r=Object.create(null)):s=f,l=d=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(a===void 0)if(d===-1&&$s[u]===1)l===-1&&(l=p);else if(u===32||u===9)d===-1&&l!==-1&&(d=p);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1&&(d=p),en(r,e.slice(l,d),!0),u===44&&(en(t,s,r),r=Object.create(null),s=void 0),l=d=-1}else if(u===61&&l!==-1&&d===-1)a=e.slice(l,p),l=d=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(n){if($s[u]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);l===-1?l=p:o||(o=!0),n=!1}else if(i)if($s[u]===1)l===-1&&(l=p);else if(u===34&&l!==-1)i=!1,d=p;else if(u===92)n=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(u===34&&e.charCodeAt(p-1)===61)i=!0;else if(d===-1&&$s[u]===1)l===-1&&(l=p);else if(l!==-1&&(u===32||u===9))d===-1&&(d=p);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1&&(d=p);let f=e.slice(l,d);o&&(f=f.replace(/\\/g,""),o=!1),en(r,a,f),u===44&&(en(t,s,r),r=Object.create(null),s=void 0),a=void 0,l=d=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(l===-1||i||u===32||u===9)throw new SyntaxError("Unexpected end of input");d===-1&&(d=p);let m=e.slice(l,d);return s===void 0?en(t,m,r):(a===void 0?en(r,m,!0):o?en(r,a,m.replace(/\\/g,"")):en(r,a,m),en(t,s,r)),t}function Tj(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(o=>[t].concat(Object.keys(o).map(n=>{let i=o[n];return Array.isArray(i)||(i=[i]),i.map(s=>s===!0?n:`${n}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Q_.exports={format:Tj,parse:Cj}});var Yl=ie((UK,d$)=>{"use strict";var Rj=ue("events"),Oj=ue("https"),Dj=ue("http"),n$=ue("net"),Nj=ue("tls"),{randomBytes:Lj,createHash:Uj}=ue("crypto"),{Duplex:NK,Readable:LK}=ue("stream"),{URL:ov}=ue("url"),or=ei(),jj=Qh(),zj=nv(),{isBlob:Fj}=ti(),{BINARY_TYPES:e$,CLOSE_TIMEOUT:Mj,EMPTY_BUFFER:Jl,GUID:Bj,kForOnEventAttribute:iv,kListener:Hj,kStatusCode:Zj,kWebSocket:Re,NOOP:r$}=Tn(),{EventTarget:{addEventListener:Gj,removeEventListener:Wj}}=Y_(),{format:Vj,parse:qj}=ql(),{toBuffer:Jj}=ks(),o$=Symbol("kAborted"),sv=[8,13],Dn=["CONNECTING","OPEN","CLOSING","CLOSED"],Kj=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,Se=class e extends Rj{constructor(t,r,o){super(),this._binaryType=e$[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Jl,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(o=r,r=[]):r=[r]),i$(this,t,r,o)):(this._autoPong=o.autoPong,this._closeTimeout=o.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){e$.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,r,o){let n=new jj({allowSynchronousEvents:o.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation}),i=new zj(t,this._extensions,o.generateMask);this._receiver=n,this._sender=i,this._socket=t,n[Re]=this,i[Re]=this,t[Re]=this,n.on("conclude",Qj),n.on("drain",ez),n.on("error",tz),n.on("message",nz),n.on("ping",rz),n.on("pong",oz),i.onerror=iz,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",c$),t.on("data",Xl),t.on("end",l$),t.on("error",u$),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[or.extensionName]&&this._extensions[or.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pt(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,o=>{o||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),a$(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,o){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(o=t,t=r=void 0):typeof r=="function"&&(o=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){av(this,t,o);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||Jl,r,o)}pong(t,r,o){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(o=t,t=r=void 0):typeof r=="function"&&(o=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){av(this,t,o);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||Jl,r,o)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,o){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(o=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){av(this,t,o);return}let n={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[or.extensionName]||(n.compress=!1),this._sender.send(t||Jl,n,o)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pt(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(Se,"CONNECTING",{enumerable:!0,value:Dn.indexOf("CONNECTING")});Object.defineProperty(Se.prototype,"CONNECTING",{enumerable:!0,value:Dn.indexOf("CONNECTING")});Object.defineProperty(Se,"OPEN",{enumerable:!0,value:Dn.indexOf("OPEN")});Object.defineProperty(Se.prototype,"OPEN",{enumerable:!0,value:Dn.indexOf("OPEN")});Object.defineProperty(Se,"CLOSING",{enumerable:!0,value:Dn.indexOf("CLOSING")});Object.defineProperty(Se.prototype,"CLOSING",{enumerable:!0,value:Dn.indexOf("CLOSING")});Object.defineProperty(Se,"CLOSED",{enumerable:!0,value:Dn.indexOf("CLOSED")});Object.defineProperty(Se.prototype,"CLOSED",{enumerable:!0,value:Dn.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(Se.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(Se.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[iv])return t[Hj];return null},set(t){for(let r of this.listeners(e))if(r[iv]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[iv]:!0})}})});Se.prototype.addEventListener=Gj;Se.prototype.removeEventListener=Wj;d$.exports=Se;function i$(e,t,r,o){let n={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Mj,protocolVersion:sv[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...o,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=n.autoPong,e._closeTimeout=n.closeTimeout,!sv.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${sv.join(", ")})`);let i;if(t instanceof ov)i=t;else try{i=new ov(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}i.protocol==="http:"?i.protocol="ws:":i.protocol==="https:"&&(i.protocol="wss:"),e._url=i.href;let s=i.protocol==="wss:",a=i.protocol==="ws+unix:",l;if(i.protocol!=="ws:"&&!s&&!a?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:a&&!i.pathname?l="The URL's pathname is empty":i.hash&&(l="The URL contains a fragment identifier"),l){let h=new SyntaxError(l);if(e._redirects===0)throw h;Kl(e,h);return}let u=s?443:80,d=Lj(16).toString("base64"),p=s?Oj.request:Dj.request,m=new Set,f;if(n.createConnection=n.createConnection||(s?Yj:Xj),n.defaultPort=n.defaultPort||u,n.port=i.port||u,n.host=i.hostname.startsWith("[")?i.hostname.slice(1,-1):i.hostname,n.headers={...n.headers,"Sec-WebSocket-Version":n.protocolVersion,"Sec-WebSocket-Key":d,Connection:"Upgrade",Upgrade:"websocket"},n.path=i.pathname+i.search,n.timeout=n.handshakeTimeout,n.perMessageDeflate&&(f=new or({...n.perMessageDeflate,isServer:!1,maxPayload:n.maxPayload}),n.headers["Sec-WebSocket-Extensions"]=Vj({[or.extensionName]:f.offer()})),r.length){for(let h of r){if(typeof h!="string"||!Kj.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}n.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(n.origin&&(n.protocolVersion<13?n.headers["Sec-WebSocket-Origin"]=n.origin:n.headers.Origin=n.origin),(i.username||i.password)&&(n.auth=`${i.username}:${i.password}`),a){let h=n.path.split(":");n.socketPath=h[0],n.path=h[1]}let g;if(n.followRedirects){if(e._redirects===0){e._originalIpc=a,e._originalSecure=s,e._originalHostOrSocketPath=a?n.socketPath:i.host;let h=o&&o.headers;if(o={...o,headers:{}},h)for(let[y,k]of Object.entries(h))o.headers[y.toLowerCase()]=k}else if(e.listenerCount("redirect")===0){let h=a?e._originalIpc?n.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:i.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!s)&&(delete n.headers.authorization,delete n.headers.cookie,h||delete n.headers.host,n.auth=void 0)}n.auth&&!o.headers.authorization&&(o.headers.authorization="Basic "+Buffer.from(n.auth).toString("base64")),g=e._req=p(n),e._redirects&&e.emit("redirect",e.url,g)}else g=e._req=p(n);n.timeout&&g.on("timeout",()=>{pt(e,g,"Opening handshake has timed out")}),g.on("error",h=>{g===null||g[o$]||(g=e._req=null,Kl(e,h))}),g.on("response",h=>{let y=h.headers.location,k=h.statusCode;if(y&&n.followRedirects&&k>=300&&k<400){if(++e._redirects>n.maxRedirects){pt(e,g,"Maximum redirects exceeded");return}g.abort();let _;try{_=new ov(y,t)}catch{let S=new SyntaxError(`Invalid URL: ${y}`);Kl(e,S);return}i$(e,_,r,o)}else e.emit("unexpected-response",g,h)||pt(e,g,`Unexpected server response: ${h.statusCode}`)}),g.on("upgrade",(h,y,k)=>{if(e.emit("upgrade",h),e.readyState!==Se.CONNECTING)return;g=e._req=null;let _=h.headers.upgrade;if(_===void 0||_.toLowerCase()!=="websocket"){pt(e,y,"Invalid Upgrade header");return}let I=Uj("sha1").update(d+Bj).digest("base64");if(h.headers["sec-websocket-accept"]!==I){pt(e,y,"Invalid Sec-WebSocket-Accept header");return}let S=h.headers["sec-websocket-protocol"],T;if(S!==void 0?m.size?m.has(S)||(T="Server sent an invalid subprotocol"):T="Server sent a subprotocol but none was requested":m.size&&(T="Server sent no subprotocol"),T){pt(e,y,T);return}S&&(e._protocol=S);let j=h.headers["sec-websocket-extensions"];if(j!==void 0){if(!f){pt(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let F;try{F=qj(j)}catch{pt(e,y,"Invalid Sec-WebSocket-Extensions header");return}let J=Object.keys(F);if(J.length!==1||J[0]!==or.extensionName){pt(e,y,"Server indicated an extension that was not requested");return}try{f.accept(F[or.extensionName])}catch{pt(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[or.extensionName]=f}e.setSocket(y,k,{allowSynchronousEvents:n.allowSynchronousEvents,generateMask:n.generateMask,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation})}),n.finishRequest?n.finishRequest(g,e):g.end()}function Kl(e,t){e._readyState=Se.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function Xj(e){return e.path=e.socketPath,n$.connect(e)}function Yj(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=n$.isIP(e.host)?"":e.host),Nj.connect(e)}function pt(e,t,r){e._readyState=Se.CLOSING;let o=new Error(r);Error.captureStackTrace(o,pt),t.setHeader?(t[o$]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(Kl,e,o)):(t.destroy(o),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function av(e,t,r){if(t){let o=Fj(t)?t.size:Jj(t).length;e._socket?e._sender._bufferedBytes+=o:e._bufferedAmount+=o}if(r){let o=new Error(`WebSocket is not open: readyState ${e.readyState} (${Dn[e.readyState]})`);process.nextTick(r,o)}}function Qj(e,t){let r=this[Re];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[Re]!==void 0&&(r._socket.removeListener("data",Xl),process.nextTick(s$,r._socket),e===1005?r.close():r.close(e,t))}function ez(){let e=this[Re];e.isPaused||e._socket.resume()}function tz(e){let t=this[Re];t._socket[Re]!==void 0&&(t._socket.removeListener("data",Xl),process.nextTick(s$,t._socket),t.close(e[Zj])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function t$(){this[Re].emitClose()}function nz(e,t){this[Re].emit("message",e,t)}function rz(e){let t=this[Re];t._autoPong&&t.pong(e,!this._isServer,r$),t.emit("ping",e)}function oz(e){this[Re].emit("pong",e)}function s$(e){e.resume()}function iz(e){let t=this[Re];t.readyState!==Se.CLOSED&&(t.readyState===Se.OPEN&&(t._readyState=Se.CLOSING,a$(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function a$(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function c$(){let e=this[Re];if(this.removeListener("close",c$),this.removeListener("data",Xl),this.removeListener("end",l$),e._readyState=Se.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[Re]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",t$),e._receiver.on("finish",t$))}function Xl(e){this[Re]._receiver.write(e)||this.pause()}function l$(){let e=this[Re];e._readyState=Se.CLOSING,e._receiver.end(),this.end()}function u$(){let e=this[Re];this.removeListener("error",u$),this.on("error",r$),e&&(e._readyState=Se.CLOSING,this.destroy())}});var g$=ie((zK,f$)=>{"use strict";var jK=Yl(),{Duplex:sz}=ue("stream");function p$(e){e.emit("close")}function az(){!this.destroyed&&this._writableState.finished&&this.destroy()}function m$(e){this.removeListener("error",m$),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function cz(e,t){let r=!0,o=new sz({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(i,s){let a=!s&&o._readableState.objectMode?i.toString():i;o.push(a)||e.pause()}),e.once("error",function(i){o.destroyed||(r=!1,o.destroy(i))}),e.once("close",function(){o.destroyed||o.push(null)}),o._destroy=function(n,i){if(e.readyState===e.CLOSED){i(n),process.nextTick(p$,o);return}let s=!1;e.once("error",function(l){s=!0,i(l)}),e.once("close",function(){s||i(n),process.nextTick(p$,o)}),r&&e.terminate()},o._final=function(n){if(e.readyState===e.CONNECTING){e.once("open",function(){o._final(n)});return}e._socket!==null&&(e._socket._writableState.finished?(n(),o._readableState.endEmitted&&o.destroy()):(e._socket.once("finish",function(){n()}),e.close()))},o._read=function(){e.isPaused&&e.resume()},o._write=function(n,i,s){if(e.readyState===e.CONNECTING){e.once("open",function(){o._write(n,i,s)});return}e.send(n,s)},o.on("end",az),o.on("error",m$),o}f$.exports=cz});var cv=ie((FK,h$)=>{"use strict";var{tokenChars:lz}=ti();function uz(e){let t=new Set,r=-1,o=-1,n=0;for(n;n<e.length;n++){let s=e.charCodeAt(n);if(o===-1&&lz[s]===1)r===-1&&(r=n);else if(n!==0&&(s===32||s===9))o===-1&&r!==-1&&(o=n);else if(s===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${n}`);o===-1&&(o=n);let a=e.slice(r,o);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);t.add(a),r=o=-1}else throw new SyntaxError(`Unexpected character at index ${n}`)}if(r===-1||o!==-1)throw new SyntaxError("Unexpected end of input");let i=e.slice(r,n);if(t.has(i))throw new SyntaxError(`The "${i}" subprotocol is duplicated`);return t.add(i),t}h$.exports={parse:uz}});var S$=ie((BK,w$)=>{"use strict";var dz=ue("events"),Ql=ue("http"),{Duplex:MK}=ue("stream"),{createHash:pz}=ue("crypto"),v$=ql(),Mr=ei(),mz=cv(),fz=Yl(),{CLOSE_TIMEOUT:gz,GUID:hz,kWebSocket:vz}=Tn(),yz=/^[+/0-9A-Za-z]{22}==$/,y$=0,b$=1,k$=2,lv=class extends dz{constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:gz,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:fz,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Ql.createServer((o,n)=>{let i=Ql.STATUS_CODES[426];n.writeHead(426,{"Content-Length":i.length,"Content-Type":"text/plain"}),n.end(i)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let o=this.emit.bind(this,"connection");this._removeListeners=bz(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(n,i,s)=>{this.handleUpgrade(n,i,s,o)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=y$}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===k$){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(Is,this);return}if(t&&this.once("close",t),this._state!==b$)if(this._state=b$,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Is,this):process.nextTick(Is,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Is(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,o,n){r.on("error",x$);let i=t.headers["sec-websocket-key"],s=t.headers.upgrade,a=+t.headers["sec-websocket-version"];if(t.method!=="GET"){Br(this,t,r,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){Br(this,t,r,400,"Invalid Upgrade header");return}if(i===void 0||!yz.test(i)){Br(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(a!==13&&a!==8){Br(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){Es(r,400);return}let l=t.headers["sec-websocket-protocol"],u=new Set;if(l!==void 0)try{u=mz.parse(l)}catch{Br(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let d=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&d!==void 0){let m=new Mr({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=v$.parse(d);f[Mr.extensionName]&&(m.accept(f[Mr.extensionName]),p[Mr.extensionName]=m)}catch{Br(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:t.headers[`${a===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(f,g,h,y)=>{if(!f)return Es(r,g||401,h,y);this.completeUpgrade(p,i,u,t,r,o,n)});return}if(!this.options.verifyClient(m))return Es(r,401)}this.completeUpgrade(p,i,u,t,r,o,n)}completeUpgrade(t,r,o,n,i,s,a){if(!i.readable||!i.writable)return i.destroy();if(i[vz])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>y$)return Es(i,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${pz("sha1").update(r+hz).digest("base64")}`],d=new this.options.WebSocket(null,void 0,this.options);if(o.size){let p=this.options.handleProtocols?this.options.handleProtocols(o,n):o.values().next().value;p&&(u.push(`Sec-WebSocket-Protocol: ${p}`),d._protocol=p)}if(t[Mr.extensionName]){let p=t[Mr.extensionName].params,m=v$.format({[Mr.extensionName]:[p]});u.push(`Sec-WebSocket-Extensions: ${m}`),d._extensions=t}this.emit("headers",u,n),i.write(u.concat(`\r
|
|
4
|
+
var mI=Object.create;var Fu=Object.defineProperty;var fI=Object.getOwnPropertyDescriptor;var gI=Object.getOwnPropertyNames;var hI=Object.getPrototypeOf,vI=Object.prototype.hasOwnProperty;var me=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ae=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},fn=(e,t)=>{for(var n in t)Fu(e,n,{get:t[n],enumerable:!0})},yI=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of gI(t))!vI.call(e,r)&&r!==n&&Fu(e,r,{get:()=>t[r],enumerable:!(o=fI(t,r))||o.enumerable});return e};var gn=(e,t,n)=>(n=e!=null?mI(hI(e)):{},yI(t||!e||!e.__esModule?Fu(n,"default",{value:e,enumerable:!0}):n,e));var Xl=ae(av=>{"use strict";Object.defineProperty(av,"__esModule",{value:!0});av.default=gU;var c_=/[A-Z]/g;function l_(e){return e.toLowerCase()}function gU(e,t){let n=e.replace(c_,l_),o=t.replace(c_,l_);return n===o}});var cv=ae(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.DnsTxt=void 0;var Yl=class{constructor(t={}){this.binary=t?t.binary:!1}encode(t={}){return Object.entries(t).map(([n,o])=>{let r=`${n}=${o}`;return Buffer.from(r)})}decode(t){var n={};try{let r=t.toString().split(/=(.+)/),i=r[0],s=r[1];n[i]=s}catch{}return n}decodeAll(t){return t.filter(n=>n.length>1).map(n=>this.decode(n)).reduce((n,o)=>{var r=n;let[i]=Object.keys(o),[s]=Object.values(o);return r[i]=s,r},{})}};js.DnsTxt=Yl;js.default=Yl});var lv=ae(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.toType=si.toString=void 0;var u_=e=>"_"+e,hU=e=>["name","protocol","subtype"].includes(e),vU=e=>{let t={name:e.name,protocol:e.protocol,subtype:e.subtype};return Object.entries(t).filter(([o,r])=>hU(o)&&r!==void 0).reduce((o,[r,i])=>(typeof i==="object"?i.map(s=>o.push(u_(s))):o.push(u_(i)),o),[]).join(".")};si.toString=vU;var yU=e=>{let t=e.split("."),n;for(let o in t)t[o][0]==="_"&&(t[o]=t[o].slice(1));return t.includes("sub")&&(n=t.shift(),t.shift()),{name:t.shift(),protocol:t.shift()||null,subtype:n}};si.toType=yU});var uv=ae(zr=>{"use strict";var p_=zr&&zr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zr,"__esModule",{value:!0});zr.Service=void 0;var d_=p_(me("os")),bU=p_(cv()),xU=me("events"),kU=lv(),ai=".local",Ql=class extends xU.EventEmitter{constructor(t,n,o){if(super(),this.start=n,this.stop=o,this.probe=!0,this.published=!1,this.activated=!1,this.destroyed=!1,this.txtService=new bU.default,!t.name)throw new Error("ServiceConfig requires `name` property to be set");if(!t.type)throw new Error("ServiceConfig requires `type` property to be set");if(!t.port)throw new Error("ServiceConfig requires `port` property to be set");this.name=t.name.split(".").join("-"),this.protocol=t.protocol||"tcp",this.type=(0,kU.toString)({name:t.type,protocol:this.protocol}),this.port=t.port,this.host=t.host||d_.default.hostname(),this.fqdn=`${this.name}.${this.type}${ai}`,this.txt=t.txt,this.subtypes=t.subtypes,this.disableIPv6=!!t.disableIPv6}records(){var t=[this.RecordPTR(this),this.RecordSRV(this),this.RecordTXT(this),this.RecordServicePTR(this)];for(let o of this.subtypes||[])t.push(this.RecordSubtypePTR(this,o));let n=Object.values(d_.default.networkInterfaces());for(let o of n){let r=o;for(let i of r)if(!(i.internal||i.mac==="00:00:00:00:00:00"))switch(i.family){case"IPv4":t.push(this.RecordA(this,i.address));break;case"IPv6":if(this.disableIPv6)break;t.push(this.RecordAAAA(this,i.address));break}}return t}RecordPTR(t){return{name:`${t.type}${ai}`,type:"PTR",ttl:28800,data:t.fqdn}}RecordServicePTR(t){return{name:`_services._dns-sd._udp${ai}`,type:"PTR",ttl:120,data:`${t.type}${ai}`}}RecordSubtypePTR(t,n){return{name:`_${n}._sub.${t.type}${ai}`,type:"PTR",ttl:28800,data:`${t.name}.${t.type}${ai}`}}RecordSRV(t){return{name:t.fqdn,type:"SRV",ttl:120,data:{port:t.port,target:t.host}}}RecordTXT(t){return{name:t.fqdn,type:"TXT",ttl:4500,data:this.txtService.encode(t.txt)}}RecordA(t,n){return{name:t.host,type:"A",ttl:120,data:n}}RecordAAAA(t,n){return{name:t.host,type:"AAAA",ttl:120,data:n}}};zr.Service=Ql;zr.default=Ql});var f_=ae(Fr=>{"use strict";var m_=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.Registry=void 0;var wU=m_(Xl()),dv=m_(uv()),SU=3600*1e3,_U=3,$U=function(){},eu=class{constructor(t){this.services=[],this.server=t}publish(t){let n=t.probe!==!1,o=new dv.default(t,r.bind(null,this),i.bind(null,this));function r(s,{probe:a=n}={}){o.activated||(o.activated=!0,s.services.push(o),o instanceof dv.default&&(a?s.probe(s.server.mdns,o,l=>{if(l){o.stop!==void 0&&o.stop(),console.log(new Error("Service name is already in use on the network"));return}s.announce(s.server,o)}):s.announce(s.server,o)))}function i(s,a){if(a||(a=$U),!o.activated||!(o instanceof dv.default))return process.nextTick(a);s.teardown(s.server,o,a);let l=s.services.indexOf(o);l!==-1&&s.services.splice(l,1)}return o.start(),o}unpublishAll(t){this.teardown(this.server,this.services,t),this.services=[]}destroy(){this.services.map(t=>t.destroyed=!0)}probe(t,n,o){var r=!1,i=0,s;let a=()=>{!n.activated||n.destroyed||t.query(n.fqdn,"ANY",function(){r=!0,s=setTimeout(++i<3?a:d,250),s.unref()})},l=p=>{r&&(p.answers.some(u)||p.additionals.some(u))&&d(!0)},u=p=>(0,wU.default)(p.name,n.fqdn),d=p=>{t.removeListener("response",l),clearTimeout(s),o(!!p)};t.on("response",l),setTimeout(a,Math.random()*250)}announce(t,n){var o=1e3,r=n.records();t.register(r);let i=()=>{!n.activated||n.destroyed||t.mdns.respond(r,function(){n.published||(n.activated=!0,n.published=!0,n.emit("up")),o=o*_U,o<SU&&!n.destroyed&&setTimeout(i,o).unref()})};i()}teardown(t,n,o){Array.isArray(n)||(n=[n]),n=n.filter(i=>i.activated);var r=n.flatMap(function(i){i.activated=!1;var s=i.records();return s.forEach(a=>{a.ttl=0}),s});if(r.length===0)return o&&process.nextTick(o);t.unregister(r),t.mdns.respond(r,function(){n.forEach(function(i){i.published=!1}),typeof o=="function"&&o.apply(null,arguments)})}};Fr.Registry=eu;Fr.default=eu});var g_=ae(pv=>{"use strict";pv.toString=function(e){switch(e){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+e};pv.toType=function(e){switch(e.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return e.toUpperCase().startsWith("UNKNOWN_")?parseInt(e.slice(8)):0}});var h_=ae(mv=>{"use strict";mv.toString=function(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e};mv.toRcode=function(e){switch(e.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var v_=ae(fv=>{"use strict";fv.toString=function(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e};fv.toOpcode=function(e){switch(e.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var y_=ae(gv=>{"use strict";gv.toString=function(e){switch(e){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+e};gv.toClass=function(e){switch(e.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var b_=ae(hv=>{"use strict";hv.toString=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:`OPTION_${e}`};hv.toCode=function(e){if(typeof e=="number")return e;if(!e)return-1;switch(e.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}});var w_=ae((k_,vv)=>{var x_=(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=p,e.encode=d,e.familyOf=u,e.name=void 0,e.sizeOf=l,e.v6=e.v4=void 0;let t=/^(\d{1,3}\.){3,3}\d{1,3}$/,n=4,o=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,r=16,i={name:"v4",size:n,isFormat:m=>t.test(m),encode(m,f,g){g=~~g,f=f||new Uint8Array(g+n);let h=m.length,y=0;for(let x=0;x<h;){let S=m.charCodeAt(x++);S===46?(f[g++]=y,y=0):y=y*10+(S-48)}return f[g]=y,f},decode(m,f){return f=~~f,`${m[f++]}.${m[f++]}.${m[f++]}.${m[f]}`}};e.v4=i;let s={name:"v6",size:r,isFormat:m=>m.length>0&&o.test(m),encode(m,f,g){g=~~g;let h=g+r,y=-1,x=0,S=0,E=!0,_=!1;f=f||new Uint8Array(g+r);for(let I=0;I<m.length;I++){let N=m.charCodeAt(I);N===58?(E?y!==-1?(g<h&&(f[g]=0),g<h-1&&(f[g+1]=0),g+=2):g<h&&(y=g):(_===!0?(g<h&&(f[g]=S),g++):(g<h&&(f[g]=x>>8),g<h-1&&(f[g+1]=x&255),g+=2),x=0,S=0),E=!0,_=!1):N===46?(g<h&&(f[g]=S),g++,S=0,x=0,E=!1,_=!0):(E=!1,N>=97?N-=87:N>=65?N-=55:(N-=48,S=S*10+N),x=(x<<4)+N)}if(E===!1)_===!0?(g<h&&(f[g]=S),g++):(g<h&&(f[g]=x>>8),g<h-1&&(f[g+1]=x&255),g+=2);else if(y===0)g<h&&(f[g]=0),g<h-1&&(f[g+1]=0),g+=2;else if(y!==-1){g+=2;for(let I=Math.min(g-1,h-1);I>=y+2;I--)f[I]=f[I-2];f[y]=0,f[y+1]=0,y=g}if(y!==g&&y!==-1)for(g>h-2&&(g=h-2);h>y;)f[--h]=g<h&&g>y?f[--g]:0;else for(;g<h;)f[g++]=0;return f},decode(m,f){f=~~f;let g="";for(let h=0;h<r;h+=2)h!==0&&(g+=":"),g+=(m[f+h]<<8|m[f+h+1]).toString(16);return g.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};e.v6=s;let a="ip";e.name=a;function l(m){if(i.isFormat(m))return i.size;if(s.isFormat(m))return s.size;throw Error(`Invalid ip address: ${m}`)}function u(m){return l(m)===i.size?1:2}function d(m,f,g){g=~~g;let h=l(m);return typeof f=="function"&&(f=f(g+h)),h===i.size?i.encode(m,f,g):s.encode(m,f,g)}function p(m,f,g){if(f=~~f,g=g||m.length-f,g===i.size)return i.decode(m,f,g);if(g===s.size)return s.decode(m,f,g);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${s.size} for v6.`)}return"default"in e?e.default:e})({});typeof define=="function"&&define.amd?define([],function(){return x_}):typeof vv=="object"&&typeof k_=="object"&&(vv.exports=x_)});var $_=ae(G=>{"use strict";var W=me("buffer").Buffer,jn=g_(),EU=h_(),AU=v_(),nu=y_(),yv=b_(),Mr=w_(),IU=0,S_=32768,bv=32768,CU=~bv,__=32768,PU=~__,F=G.name={};F.encode=function(e,t,n,{mail:o=!1}={}){t||(t=W.alloc(F.encodingLength(e))),n||(n=0);let r=n,i=e.replace(/^\.|\.$/gm,"");if(i.length){let s=[];if(o){let a="";i.split(".").forEach(l=>{l.endsWith("\\")?a+=(a.length?".":"")+l.slice(0,-1):s.length===0&&a.length?s.push(a+"."+l):s.push(l)})}else s=i.split(".");for(let a=0;a<s.length;a++){let l=t.write(s[a],n+1);t[n]=l,n+=l+1}}return t[n++]=0,F.encode.bytes=n-r,t};F.encode.bytes=0;F.decode=function(e,t,{mail:n=!1}={}){t||(t=0);let o=[],r=t,i=0,s=0,a=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");let l=e[t++];if(s+=a?0:1,l===0)break;if((l&192)===0){if(t+l>e.length)throw new Error("Cannot decode name (buffer overflow)");if(i+=l+1,i>254)throw new Error("Cannot decode name (name too long)");let u=e.toString("utf-8",t,t+l);n&&(u=u.replace(/\./g,"\\.")),o.push(u),t+=l,s+=a?0:l}else if((l&192)===192){if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");let u=e.readUInt16BE(t-1)-49152;if(u>=r)throw new Error("Cannot decode name (bad pointer)");t=u,r=u,s+=a?0:1,a=!0}else throw new Error("Cannot decode name (bad label)")}return F.decode.bytes=s,o.length===0?".":o.join(".")};F.decode.bytes=0;F.encodingLength=function(e){return e==="."||e===".."?1:W.byteLength(e.replace(/^\.|\.$/gm,""))+2};var re={};re.encode=function(e,t,n){t||(t=W.alloc(re.encodingLength(e))),n||(n=0);let o=t.write(e,n+1);return t[n]=o,re.encode.bytes=o+1,t};re.encode.bytes=0;re.decode=function(e,t){t||(t=0);let n=e[t],o=e.toString("utf-8",t+1,t+1+n);return re.decode.bytes=n+1,o};re.decode.bytes=0;re.encodingLength=function(e){return W.byteLength(e)+1};var Bt={};Bt.encode=function(e,t,n){t||(t=Bt.encodingLength(e)),n||(n=0);let o=(e.flags||0)&32767,r=e.type==="response"?S_:IU;return t.writeUInt16BE(e.id||0,n),t.writeUInt16BE(o|r,n+2),t.writeUInt16BE(e.questions.length,n+4),t.writeUInt16BE(e.answers.length,n+6),t.writeUInt16BE(e.authorities.length,n+8),t.writeUInt16BE(e.additionals.length,n+10),t};Bt.encode.bytes=12;Bt.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");let n=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:n&S_?"response":"query",flags:n&32767,flag_qr:(n>>15&1)===1,opcode:AU.toString(n>>11&15),flag_aa:(n>>10&1)===1,flag_tc:(n>>9&1)===1,flag_rd:(n>>8&1)===1,flag_ra:(n>>7&1)===1,flag_z:(n>>6&1)===1,flag_ad:(n>>5&1)===1,flag_cd:(n>>4&1)===1,rcode:EU.toString(n&15),questions:new Array(e.readUInt16BE(t+4)),answers:new Array(e.readUInt16BE(t+6)),authorities:new Array(e.readUInt16BE(t+8)),additionals:new Array(e.readUInt16BE(t+10))}};Bt.decode.bytes=12;Bt.encodingLength=function(){return 12};var Cn=G.unknown={};Cn.encode=function(e,t,n){return t||(t=W.alloc(Cn.encodingLength(e))),n||(n=0),t.writeUInt16BE(e.length,n),e.copy(t,n+2),Cn.encode.bytes=e.length+2,t};Cn.encode.bytes=0;Cn.decode=function(e,t){t||(t=0);let n=e.readUInt16BE(t),o=e.slice(t+2,t+2+n);return Cn.decode.bytes=n+2,o};Cn.decode.bytes=0;Cn.encodingLength=function(e){return e.length+2};var Pn=G.ns={};Pn.encode=function(e,t,n){return t||(t=W.alloc(Pn.encodingLength(e))),n||(n=0),F.encode(e,t,n+2),t.writeUInt16BE(F.encode.bytes,n),Pn.encode.bytes=F.encode.bytes+2,t};Pn.encode.bytes=0;Pn.decode=function(e,t){t||(t=0);let n=e.readUInt16BE(t),o=F.decode(e,t+2);return Pn.decode.bytes=n+2,o};Pn.decode.bytes=0;Pn.encodingLength=function(e){return F.encodingLength(e)+2};var Tn=G.soa={};Tn.encode=function(e,t,n){t||(t=W.alloc(Tn.encodingLength(e))),n||(n=0);let o=n;return n+=2,F.encode(e.mname,t,n),n+=F.encode.bytes,F.encode(e.rname,t,n,{mail:!0}),n+=F.encode.bytes,t.writeUInt32BE(e.serial||0,n),n+=4,t.writeUInt32BE(e.refresh||0,n),n+=4,t.writeUInt32BE(e.retry||0,n),n+=4,t.writeUInt32BE(e.expire||0,n),n+=4,t.writeUInt32BE(e.minimum||0,n),n+=4,t.writeUInt16BE(n-o-2,o),Tn.encode.bytes=n-o,t};Tn.encode.bytes=0;Tn.decode=function(e,t){t||(t=0);let n=t,o={};return t+=2,o.mname=F.decode(e,t),t+=F.decode.bytes,o.rname=F.decode(e,t,{mail:!0}),t+=F.decode.bytes,o.serial=e.readUInt32BE(t),t+=4,o.refresh=e.readUInt32BE(t),t+=4,o.retry=e.readUInt32BE(t),t+=4,o.expire=e.readUInt32BE(t),t+=4,o.minimum=e.readUInt32BE(t),t+=4,Tn.decode.bytes=t-n,o};Tn.decode.bytes=0;Tn.encodingLength=function(e){return 22+F.encodingLength(e.mname)+F.encodingLength(e.rname)};var Rn=G.txt={};Rn.encode=function(e,t,n){Array.isArray(e)||(e=[e]);for(let r=0;r<e.length;r++)if(typeof e[r]=="string"&&(e[r]=W.from(e[r])),!W.isBuffer(e[r]))throw new Error("Must be a Buffer");t||(t=W.alloc(Rn.encodingLength(e))),n||(n=0);let o=n;return n+=2,e.forEach(function(r){t[n++]=r.length,r.copy(t,n,0,r.length),n+=r.length}),t.writeUInt16BE(n-o-2,o),Rn.encode.bytes=n-o,t};Rn.encode.bytes=0;Rn.decode=function(e,t){t||(t=0);let n=t,o=e.readUInt16BE(t);t+=2;let r=[];for(;o>0;){let i=e[t++];if(--o,o<i)throw new Error("Buffer overflow");r.push(e.slice(t,t+i)),t+=i,o-=i}return Rn.decode.bytes=t-n,r};Rn.decode.bytes=0;Rn.encodingLength=function(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach(function(n){typeof n=="string"?t+=W.byteLength(n)+1:t+=n.length+1}),t};var On=G.null={};On.encode=function(e,t,n){t||(t=W.alloc(On.encodingLength(e))),n||(n=0),typeof e=="string"&&(e=W.from(e)),e||(e=W.alloc(0));let o=n;n+=2;let r=e.length;return e.copy(t,n,0,r),n+=r,t.writeUInt16BE(n-o-2,o),On.encode.bytes=n-o,t};On.encode.bytes=0;On.decode=function(e,t){t||(t=0);let n=t,o=e.readUInt16BE(t);t+=2;let r=e.slice(t,t+o);return t+=o,On.decode.bytes=t-n,r};On.decode.bytes=0;On.encodingLength=function(e){return e?(W.isBuffer(e)?e.length:W.byteLength(e))+2:2};var Dn=G.hinfo={};Dn.encode=function(e,t,n){t||(t=W.alloc(Dn.encodingLength(e))),n||(n=0);let o=n;return n+=2,re.encode(e.cpu,t,n),n+=re.encode.bytes,re.encode(e.os,t,n),n+=re.encode.bytes,t.writeUInt16BE(n-o-2,o),Dn.encode.bytes=n-o,t};Dn.encode.bytes=0;Dn.decode=function(e,t){t||(t=0);let n=t,o={};return t+=2,o.cpu=re.decode(e,t),t+=re.decode.bytes,o.os=re.decode(e,t),t+=re.decode.bytes,Dn.decode.bytes=t-n,o};Dn.decode.bytes=0;Dn.encodingLength=function(e){return re.encodingLength(e.cpu)+re.encodingLength(e.os)+2};var Ft=G.ptr={},TU=G.cname=Ft,RU=G.dname=Ft;Ft.encode=function(e,t,n){return t||(t=W.alloc(Ft.encodingLength(e))),n||(n=0),F.encode(e,t,n+2),t.writeUInt16BE(F.encode.bytes,n),Ft.encode.bytes=F.encode.bytes+2,t};Ft.encode.bytes=0;Ft.decode=function(e,t){t||(t=0);let n=F.decode(e,t+2);return Ft.decode.bytes=F.decode.bytes+2,n};Ft.decode.bytes=0;Ft.encodingLength=function(e){return F.encodingLength(e)+2};var Nn=G.srv={};Nn.encode=function(e,t,n){t||(t=W.alloc(Nn.encodingLength(e))),n||(n=0),t.writeUInt16BE(e.priority||0,n+2),t.writeUInt16BE(e.weight||0,n+4),t.writeUInt16BE(e.port||0,n+6),F.encode(e.target,t,n+8);let o=F.encode.bytes+6;return t.writeUInt16BE(o,n),Nn.encode.bytes=o+2,t};Nn.encode.bytes=0;Nn.decode=function(e,t){t||(t=0);let n=e.readUInt16BE(t),o={};return o.priority=e.readUInt16BE(t+2),o.weight=e.readUInt16BE(t+4),o.port=e.readUInt16BE(t+6),o.target=F.decode(e,t+8),Nn.decode.bytes=n+2,o};Nn.decode.bytes=0;Nn.encodingLength=function(e){return 8+F.encodingLength(e.target)};var ft=G.caa={};ft.ISSUER_CRITICAL=128;ft.encode=function(e,t,n){let o=ft.encodingLength(e);return t||(t=W.alloc(ft.encodingLength(e))),n||(n=0),e.issuerCritical&&(e.flags=ft.ISSUER_CRITICAL),t.writeUInt16BE(o-2,n),n+=2,t.writeUInt8(e.flags||0,n),n+=1,re.encode(e.tag,t,n),n+=re.encode.bytes,t.write(e.value,n),n+=W.byteLength(e.value),ft.encode.bytes=o,t};ft.encode.bytes=0;ft.decode=function(e,t){t||(t=0);let n=e.readUInt16BE(t);t+=2;let o=t,r={};return r.flags=e.readUInt8(t),t+=1,r.tag=re.decode(e,t),t+=re.decode.bytes,r.value=e.toString("utf-8",t,o+n),r.issuerCritical=!!(r.flags&ft.ISSUER_CRITICAL),ft.decode.bytes=n+2,r};ft.decode.bytes=0;ft.encodingLength=function(e){return re.encodingLength(e.tag)+re.encodingLength(e.value)+2};var pr=G.mx={};pr.encode=function(e,t,n){t||(t=W.alloc(pr.encodingLength(e))),n||(n=0);let o=n;return n+=2,t.writeUInt16BE(e.preference||0,n),n+=2,F.encode(e.exchange,t,n),n+=F.encode.bytes,t.writeUInt16BE(n-o-2,o),pr.encode.bytes=n-o,t};pr.encode.bytes=0;pr.decode=function(e,t){t||(t=0);let n=t,o={};return t+=2,o.preference=e.readUInt16BE(t),t+=2,o.exchange=F.decode(e,t),t+=F.decode.bytes,pr.decode.bytes=t-n,o};pr.encodingLength=function(e){return 4+F.encodingLength(e.exchange)};var Ln=G.a={};Ln.encode=function(e,t,n){return t||(t=W.alloc(Ln.encodingLength(e))),n||(n=0),t.writeUInt16BE(4,n),n+=2,Mr.v4.encode(e,t,n),Ln.encode.bytes=6,t};Ln.encode.bytes=0;Ln.decode=function(e,t){t||(t=0),t+=2;let n=Mr.v4.decode(e,t);return Ln.decode.bytes=6,n};Ln.decode.bytes=0;Ln.encodingLength=function(){return 6};var Un=G.aaaa={};Un.encode=function(e,t,n){return t||(t=W.alloc(Un.encodingLength(e))),n||(n=0),t.writeUInt16BE(16,n),n+=2,Mr.v6.encode(e,t,n),Un.encode.bytes=18,t};Un.encode.bytes=0;Un.decode=function(e,t){t||(t=0),t+=2;let n=Mr.v6.decode(e,t);return Un.decode.bytes=18,n};Un.decode.bytes=0;Un.encodingLength=function(){return 18};var at=G.option={};at.encode=function(e,t,n){t||(t=W.alloc(at.encodingLength(e))),n||(n=0);let o=n,r=yv.toCode(e.code);if(t.writeUInt16BE(r,n),n+=2,e.data)t.writeUInt16BE(e.data.length,n),n+=2,e.data.copy(t,n),n+=e.data.length;else switch(r){case 8:let i=e.sourcePrefixLength||0,s=e.family||Mr.familyOf(e.ip),a=Mr.encode(e.ip,W.alloc),l=Math.ceil(i/8);t.writeUInt16BE(l+4,n),n+=2,t.writeUInt16BE(s,n),n+=2,t.writeUInt8(i,n++),t.writeUInt8(e.scopePrefixLength||0,n++),a.copy(t,n,0,l),n+=l;break;case 11:e.timeout?(t.writeUInt16BE(2,n),n+=2,t.writeUInt16BE(e.timeout,n),n+=2):(t.writeUInt16BE(0,n),n+=2);break;case 12:let u=e.length||0;t.writeUInt16BE(u,n),n+=2,t.fill(0,n,n+u),n+=u;break;case 14:let d=e.tags.length*2;t.writeUInt16BE(d,n),n+=2;for(let p of e.tags)t.writeUInt16BE(p,n),n+=2;break;default:throw new Error(`Unknown roption code: ${e.code}`)}return at.encode.bytes=n-o,t};at.encode.bytes=0;at.decode=function(e,t){t||(t=0);let n={};n.code=e.readUInt16BE(t),n.type=yv.toString(n.code),t+=2;let o=e.readUInt16BE(t);switch(t+=2,n.data=e.slice(t,t+o),n.code){case 8:n.family=e.readUInt16BE(t),t+=2,n.sourcePrefixLength=e.readUInt8(t++),n.scopePrefixLength=e.readUInt8(t++);let r=W.alloc(n.family===1?4:16);e.copy(r,0,t,t+o-4),n.ip=Mr.decode(r);break;case 11:o>0&&(n.timeout=e.readUInt16BE(t),t+=2);break;case 14:n.tags=[];for(let i=0;i<o;i+=2)n.tags.push(e.readUInt16BE(t)),t+=2}return at.decode.bytes=o+4,n};at.decode.bytes=0;at.encodingLength=function(e){if(e.data)return e.data.length+4;switch(yv.toCode(e.code)){case 8:let n=e.sourcePrefixLength||0;return Math.ceil(n/8)+8;case 11:return typeof e.timeout=="number"?6:4;case 12:return e.length+4;case 14:return 4+e.tags.length*2}throw new Error(`Unknown roption code: ${e.code}`)};var ht=G.opt={};ht.encode=function(e,t,n){t||(t=W.alloc(ht.encodingLength(e))),n||(n=0);let o=n,r=ci(e,at);return t.writeUInt16BE(r,n),n=zs(e,at,t,n+2),ht.encode.bytes=n-o,t};ht.encode.bytes=0;ht.decode=function(e,t){t||(t=0);let n=t,o=[],r=e.readUInt16BE(t);t+=2;let i=0;for(;r>0;)o[i++]=at.decode(e,t),t+=at.decode.bytes,r-=at.decode.bytes;return ht.decode.bytes=t-n,o};ht.decode.bytes=0;ht.encodingLength=function(e){return 2+ci(e||[],at)};var Je=G.dnskey={};Je.PROTOCOL_DNSSEC=3;Je.ZONE_KEY=128;Je.SECURE_ENTRYPOINT=32768;Je.encode=function(e,t,n){t||(t=W.alloc(Je.encodingLength(e))),n||(n=0);let o=n,r=e.key;if(!W.isBuffer(r))throw new Error("Key must be a Buffer");return n+=2,t.writeUInt16BE(e.flags,n),n+=2,t.writeUInt8(Je.PROTOCOL_DNSSEC,n),n+=1,t.writeUInt8(e.algorithm,n),n+=1,r.copy(t,n,0,r.length),n+=r.length,Je.encode.bytes=n-o,t.writeUInt16BE(Je.encode.bytes-2,o),t};Je.encode.bytes=0;Je.decode=function(e,t){t||(t=0);let n=t;var o={},r=e.readUInt16BE(t);if(t+=2,o.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==Je.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,o.algorithm=e.readUInt8(t),t+=1,o.key=e.slice(t,n+r+2),t+=o.key.length,Je.decode.bytes=t-n,o};Je.decode.bytes=0;Je.encodingLength=function(e){return 6+W.byteLength(e.key)};var rn=G.rrsig={};rn.encode=function(e,t,n){t||(t=W.alloc(rn.encodingLength(e))),n||(n=0);let o=n,r=e.signature;if(!W.isBuffer(r))throw new Error("Signature must be a Buffer");return n+=2,t.writeUInt16BE(jn.toType(e.typeCovered),n),n+=2,t.writeUInt8(e.algorithm,n),n+=1,t.writeUInt8(e.labels,n),n+=1,t.writeUInt32BE(e.originalTTL,n),n+=4,t.writeUInt32BE(e.expiration,n),n+=4,t.writeUInt32BE(e.inception,n),n+=4,t.writeUInt16BE(e.keyTag,n),n+=2,F.encode(e.signersName,t,n),n+=F.encode.bytes,r.copy(t,n,0,r.length),n+=r.length,rn.encode.bytes=n-o,t.writeUInt16BE(rn.encode.bytes-2,o),t};rn.encode.bytes=0;rn.decode=function(e,t){t||(t=0);let n=t;var o={},r=e.readUInt16BE(t);return t+=2,o.typeCovered=jn.toString(e.readUInt16BE(t)),t+=2,o.algorithm=e.readUInt8(t),t+=1,o.labels=e.readUInt8(t),t+=1,o.originalTTL=e.readUInt32BE(t),t+=4,o.expiration=e.readUInt32BE(t),t+=4,o.inception=e.readUInt32BE(t),t+=4,o.keyTag=e.readUInt16BE(t),t+=2,o.signersName=F.decode(e,t),t+=F.decode.bytes,o.signature=e.slice(t,n+r+2),t+=o.signature.length,rn.decode.bytes=t-n,o};rn.decode.bytes=0;rn.encodingLength=function(e){return 20+F.encodingLength(e.signersName)+W.byteLength(e.signature)};var on=G.rp={};on.encode=function(e,t,n){t||(t=W.alloc(on.encodingLength(e))),n||(n=0);let o=n;return n+=2,F.encode(e.mbox||".",t,n,{mail:!0}),n+=F.encode.bytes,F.encode(e.txt||".",t,n),n+=F.encode.bytes,on.encode.bytes=n-o,t.writeUInt16BE(on.encode.bytes-2,o),t};on.encode.bytes=0;on.decode=function(e,t){t||(t=0);let n=t,o={};return t+=2,o.mbox=F.decode(e,t,{mail:!0})||".",t+=F.decode.bytes,o.txt=F.decode(e,t)||".",t+=F.decode.bytes,on.decode.bytes=t-n,o};on.decode.bytes=0;on.encodingLength=function(e){return 2+F.encodingLength(e.mbox||".")+F.encodingLength(e.txt||".")};var Oe={};Oe.encode=function(e,t,n){t||(t=W.alloc(Oe.encodingLength(e))),n||(n=0);let o=n;for(var r=[],i=0;i<e.length;i++){var s=jn.toType(e[i]);r[s>>8]===void 0&&(r[s>>8]=[]),r[s>>8][s>>3&31]|=1<<7-(s&7)}for(i=0;i<r.length;i++)if(r[i]!==void 0){var a=W.from(r[i]);t.writeUInt8(i,n),n+=1,t.writeUInt8(a.length,n),n+=1,a.copy(t,n),n+=a.length}return Oe.encode.bytes=n-o,t};Oe.encode.bytes=0;Oe.decode=function(e,t,n){t||(t=0);let o=t;for(var r=[];t-o<n;){var i=e.readUInt8(t);t+=1;var s=e.readUInt8(t);t+=1;for(var a=0;a<s;a++)for(var l=e.readUInt8(t+a),u=0;u<8;u++)if(l&1<<7-u){var d=jn.toString(i<<8|a<<3|u);r.push(d)}t+=s}return Oe.decode.bytes=t-o,r};Oe.decode.bytes=0;Oe.encodingLength=function(e){for(var t=[],n=0;n<e.length;n++){var o=jn.toType(e[n]);t[o>>8]=Math.max(t[o>>8]||0,o&255)}var r=0;for(n=0;n<t.length;n++)t[n]!==void 0&&(r+=2+Math.ceil((t[n]+1)/8));return r};var sn=G.nsec={};sn.encode=function(e,t,n){t||(t=W.alloc(sn.encodingLength(e))),n||(n=0);let o=n;return n+=2,F.encode(e.nextDomain,t,n),n+=F.encode.bytes,Oe.encode(e.rrtypes,t,n),n+=Oe.encode.bytes,sn.encode.bytes=n-o,t.writeUInt16BE(sn.encode.bytes-2,o),t};sn.encode.bytes=0;sn.decode=function(e,t){t||(t=0);let n=t;var o={},r=e.readUInt16BE(t);return t+=2,o.nextDomain=F.decode(e,t),t+=F.decode.bytes,o.rrtypes=Oe.decode(e,t,r-(t-n)),t+=Oe.decode.bytes,sn.decode.bytes=t-n,o};sn.decode.bytes=0;sn.encodingLength=function(e){return 2+F.encodingLength(e.nextDomain)+Oe.encodingLength(e.rrtypes)};var an=G.nsec3={};an.encode=function(e,t,n){t||(t=W.alloc(an.encodingLength(e))),n||(n=0);let o=n,r=e.salt;if(!W.isBuffer(r))throw new Error("salt must be a Buffer");let i=e.nextDomain;if(!W.isBuffer(i))throw new Error("nextDomain must be a Buffer");return n+=2,t.writeUInt8(e.algorithm,n),n+=1,t.writeUInt8(e.flags,n),n+=1,t.writeUInt16BE(e.iterations,n),n+=2,t.writeUInt8(r.length,n),n+=1,r.copy(t,n,0,r.length),n+=r.length,t.writeUInt8(i.length,n),n+=1,i.copy(t,n,0,i.length),n+=i.length,Oe.encode(e.rrtypes,t,n),n+=Oe.encode.bytes,an.encode.bytes=n-o,t.writeUInt16BE(an.encode.bytes-2,o),t};an.encode.bytes=0;an.decode=function(e,t){t||(t=0);let n=t;var o={},r=e.readUInt16BE(t);t+=2,o.algorithm=e.readUInt8(t),t+=1,o.flags=e.readUInt8(t),t+=1,o.iterations=e.readUInt16BE(t),t+=2;let i=e.readUInt8(t);t+=1,o.salt=e.slice(t,t+i),t+=i;let s=e.readUInt8(t);return t+=1,o.nextDomain=e.slice(t,t+s),t+=s,o.rrtypes=Oe.decode(e,t,r-(t-n)),t+=Oe.decode.bytes,an.decode.bytes=t-n,o};an.decode.bytes=0;an.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+Oe.encodingLength(e.rrtypes)};var cn=G.ds={};cn.encode=function(e,t,n){t||(t=W.alloc(cn.encodingLength(e))),n||(n=0);let o=n,r=e.digest;if(!W.isBuffer(r))throw new Error("Digest must be a Buffer");return n+=2,t.writeUInt16BE(e.keyTag,n),n+=2,t.writeUInt8(e.algorithm,n),n+=1,t.writeUInt8(e.digestType,n),n+=1,r.copy(t,n,0,r.length),n+=r.length,cn.encode.bytes=n-o,t.writeUInt16BE(cn.encode.bytes-2,o),t};cn.encode.bytes=0;cn.decode=function(e,t){t||(t=0);let n=t;var o={},r=e.readUInt16BE(t);return t+=2,o.keyTag=e.readUInt16BE(t),t+=2,o.algorithm=e.readUInt8(t),t+=1,o.digestType=e.readUInt8(t),t+=1,o.digest=e.slice(t,n+r+2),t+=o.digest.length,cn.decode.bytes=t-n,o};cn.decode.bytes=0;cn.encodingLength=function(e){return 6+W.byteLength(e.digest)};var gt=G.sshfp={};gt.getFingerprintLengthForHashType=function(t){switch(t){case 1:return 20;case 2:return 32}};gt.encode=function(t,n,o){n||(n=W.alloc(gt.encodingLength(t))),o||(o=0);let r=o;o+=2,n[o]=t.algorithm,o+=1,n[o]=t.hash,o+=1;let i=W.from(t.fingerprint.toUpperCase(),"hex");if(i.length!==gt.getFingerprintLengthForHashType(t.hash))throw new Error("Invalid fingerprint length");return i.copy(n,o),o+=i.byteLength,gt.encode.bytes=o-r,n.writeUInt16BE(gt.encode.bytes-2,r),n};gt.encode.bytes=0;gt.decode=function(t,n){n||(n=0);let o=n,r={};n+=2,r.algorithm=t[n],n+=1,r.hash=t[n],n+=1;let i=gt.getFingerprintLengthForHashType(r.hash);return r.fingerprint=t.slice(n,n+i).toString("hex").toUpperCase(),n+=i,gt.decode.bytes=n-o,r};gt.decode.bytes=0;gt.encodingLength=function(e){return 4+W.from(e.fingerprint,"hex").byteLength};var ln=G.naptr={};ln.encode=function(e,t,n){t||(t=W.alloc(ln.encodingLength(e))),n||(n=0);let o=n;return n+=2,t.writeUInt16BE(e.order||0,n),n+=2,t.writeUInt16BE(e.preference||0,n),n+=2,re.encode(e.flags,t,n),n+=re.encode.bytes,re.encode(e.services,t,n),n+=re.encode.bytes,re.encode(e.regexp,t,n),n+=re.encode.bytes,F.encode(e.replacement,t,n),n+=F.encode.bytes,ln.encode.bytes=n-o,t.writeUInt16BE(ln.encode.bytes-2,o),t};ln.encode.bytes=0;ln.decode=function(e,t){t||(t=0);let n=t,o={};return t+=2,o.order=e.readUInt16BE(t),t+=2,o.preference=e.readUInt16BE(t),t+=2,o.flags=re.decode(e,t),t+=re.decode.bytes,o.services=re.decode(e,t),t+=re.decode.bytes,o.regexp=re.decode(e,t),t+=re.decode.bytes,o.replacement=F.decode(e,t),t+=F.decode.bytes,ln.decode.bytes=t-n,o};ln.decode.bytes=0;ln.encodingLength=function(e){return re.encodingLength(e.flags)+re.encodingLength(e.services)+re.encodingLength(e.regexp)+F.encodingLength(e.replacement)+6};var un=G.tlsa={};un.encode=function(e,t,n){t||(t=W.alloc(un.encodingLength(e))),n||(n=0);let o=n,r=e.certificate;if(!W.isBuffer(r))throw new Error("Certificate must be a Buffer");return n+=2,t.writeUInt8(e.usage,n),n+=1,t.writeUInt8(e.selector,n),n+=1,t.writeUInt8(e.matchingType,n),n+=1,r.copy(t,n,0,r.length),n+=r.length,un.encode.bytes=n-o,t.writeUInt16BE(un.encode.bytes-2,o),t};un.encode.bytes=0;un.decode=function(e,t){t||(t=0);let n=t,o={},r=e.readUInt16BE(t);return t+=2,o.usage=e.readUInt8(t),t+=1,o.selector=e.readUInt8(t),t+=1,o.matchingType=e.readUInt8(t),t+=1,o.certificate=e.slice(t,n+r+2),t+=o.certificate.length,un.decode.bytes=t-n,o};un.decode.bytes=0;un.encodingLength=function(e){return 5+W.byteLength(e.certificate)};var xv=G.record=function(e){switch(e.toUpperCase()){case"A":return Ln;case"PTR":return Ft;case"CNAME":return TU;case"DNAME":return RU;case"TXT":return Rn;case"NULL":return On;case"AAAA":return Un;case"SRV":return Nn;case"HINFO":return Dn;case"CAA":return ft;case"NS":return Pn;case"SOA":return Tn;case"MX":return pr;case"OPT":return ht;case"DNSKEY":return Je;case"RRSIG":return rn;case"RP":return on;case"NSEC":return sn;case"NSEC3":return an;case"SSHFP":return gt;case"DS":return cn;case"NAPTR":return ln;case"TLSA":return un}return Cn},je=G.answer={};je.encode=function(e,t,n){t||(t=W.alloc(je.encodingLength(e))),n||(n=0);let o=n;if(F.encode(e.name,t,n),n+=F.encode.bytes,t.writeUInt16BE(jn.toType(e.type),n),e.type.toUpperCase()==="OPT"){if(e.name!==".")throw new Error("OPT name must be root.");t.writeUInt16BE(e.udpPayloadSize||4096,n+2),t.writeUInt8(e.extendedRcode||0,n+4),t.writeUInt8(e.ednsVersion||0,n+5),t.writeUInt16BE(e.flags||0,n+6),n+=8,ht.encode(e.options||[],t,n),n+=ht.encode.bytes}else{let r=nu.toClass(e.class===void 0?"IN":e.class);e.flush&&(r|=bv),t.writeUInt16BE(r,n+2),t.writeUInt32BE(e.ttl||0,n+4),n+=8;let i=xv(e.type);i.encode(e.data,t,n),n+=i.encode.bytes}return je.encode.bytes=n-o,t};je.encode.bytes=0;je.decode=function(e,t){t||(t=0);let n={},o=t;if(n.name=F.decode(e,t),t+=F.decode.bytes,n.type=jn.toString(e.readUInt16BE(t)),n.type==="OPT")n.udpPayloadSize=e.readUInt16BE(t+2),n.extendedRcode=e.readUInt8(t+4),n.ednsVersion=e.readUInt8(t+5),n.flags=e.readUInt16BE(t+6),n.flag_do=(n.flags>>15&1)===1,n.options=ht.decode(e,t+8),t+=8+ht.decode.bytes;else{let r=e.readUInt16BE(t+2);n.ttl=e.readUInt32BE(t+4),n.class=nu.toString(r&CU),n.flush=!!(r&bv);let i=xv(n.type);n.data=i.decode(e,t+8),t+=8+i.decode.bytes}return je.decode.bytes=t-o,n};je.decode.bytes=0;je.encodingLength=function(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return F.encodingLength(e.name)+8+xv(e.type).encodingLength(t)};var Mt=G.question={};Mt.encode=function(e,t,n){t||(t=W.alloc(Mt.encodingLength(e))),n||(n=0);let o=n;return F.encode(e.name,t,n),n+=F.encode.bytes,t.writeUInt16BE(jn.toType(e.type),n),n+=2,t.writeUInt16BE(nu.toClass(e.class===void 0?"IN":e.class),n),n+=2,Mt.encode.bytes=n-o,e};Mt.encode.bytes=0;Mt.decode=function(e,t){t||(t=0);let n=t,o={};return o.name=F.decode(e,t),t+=F.decode.bytes,o.type=jn.toString(e.readUInt16BE(t)),t+=2,o.class=nu.toString(e.readUInt16BE(t)),t+=2,o.class&__&&(o.class&=PU),Mt.decode.bytes=t-n,o};Mt.decode.bytes=0;Mt.encodingLength=function(e){return F.encodingLength(e.name)+4};G.AUTHORITATIVE_ANSWER=1024;G.TRUNCATED_RESPONSE=512;G.RECURSION_DESIRED=256;G.RECURSION_AVAILABLE=128;G.AUTHENTIC_DATA=32;G.CHECKING_DISABLED=16;G.DNSSEC_OK=32768;G.encode=function(e,t,n){let o=!t;o&&(t=W.alloc(G.encodingLength(e))),n||(n=0);let r=n;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),Bt.encode(e,t,n),n+=Bt.encode.bytes,n=zs(e.questions,Mt,t,n),n=zs(e.answers,je,t,n),n=zs(e.authorities,je,t,n),n=zs(e.additionals,je,t,n),G.encode.bytes=n-r,o&&G.encode.bytes!==t.length?t.slice(0,G.encode.bytes):t};G.encode.bytes=0;G.decode=function(e,t){t||(t=0);let n=t,o=Bt.decode(e,t);return t+=Bt.decode.bytes,t=tu(o.questions,Mt,e,t),t=tu(o.answers,je,e,t),t=tu(o.authorities,je,e,t),t=tu(o.additionals,je,e,t),G.decode.bytes=t-n,o};G.decode.bytes=0;G.encodingLength=function(e){return Bt.encodingLength(e)+ci(e.questions||[],Mt)+ci(e.answers||[],je)+ci(e.authorities||[],je)+ci(e.additionals||[],je)};G.streamEncode=function(e){let t=G.encode(e),n=W.alloc(2);n.writeUInt16BE(t.byteLength);let o=W.concat([n,t]);return G.streamEncode.bytes=o.byteLength,o};G.streamEncode.bytes=0;G.streamDecode=function(e){let t=e.readUInt16BE(0);if(e.byteLength<t+2)return null;let n=G.decode(e.slice(2));return G.streamDecode.bytes=G.decode.bytes,n};G.streamDecode.bytes=0;function ci(e,t){let n=0;for(let o=0;o<e.length;o++)n+=t.encodingLength(e[o]);return n}function zs(e,t,n,o){for(let r=0;r<e.length;r++)t.encode(e[r],n,o),o+=t.encode.bytes;return o}function tu(e,t,n,o){for(let r=0;r<e.length;r++)e[r]=t.decode(n,o),o+=t.decode.bytes;return o}});var I_=ae((XV,A_)=>{"use strict";var E_=jU;process.nextTick(UU,42);A_.exports=OU;function OU(e){var t=o;return n;function n(r){t(r||NU)}function o(r){var i=[r];t=s,e(a);function s(l){i.push(l)}function a(l){var u=arguments;for(t=DU(l)?o:d;i.length;)d(i.shift());function d(p){E_(LU,p,u)}}}}function DU(e){return Object.prototype.toString.call(e)==="[object Error]"}function NU(){}function LU(e,t){e.apply(null,t)}function UU(e){e===42&&(E_=process.nextTick)}function jU(e,t,n){process.nextTick(function(){e(t,n)})}});var T_=ae((YV,P_)=>{var kv=$_(),zU=me("dgram"),FU=I_(),MU=me("events"),Sv=me("os"),wv=function(){};P_.exports=function(e){e||(e={});var t=new MU.EventEmitter,n=typeof e.port=="number"?e.port:5353,o=e.type||"udp4",r=e.ip||e.host||(o==="udp4"?"224.0.0.251":null),i={address:r,port:n},s={},a=!1,l=null;if(o==="udp6"&&(!r||!e.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var u=e.socket||zU.createSocket({type:o,reuseAddr:e.reuseAddr!==!1,toString:function(){return o}});u.on("error",function(p){p.code==="EACCES"||p.code==="EADDRINUSE"?t.emit("error",p):t.emit("warning",p)}),u.on("message",function(p,m){try{p=kv.decode(p)}catch(f){t.emit("warning",f);return}t.emit("packet",p,m),p.type==="query"&&t.emit("query",p,m),p.type==="response"&&t.emit("response",p,m)}),u.on("listening",function(){n||(n=i.port=u.address().port),e.multicast!==!1&&(t.update(),l=setInterval(t.update,5e3),u.setMulticastTTL(e.ttl||255),u.setMulticastLoopback(e.loopback!==!1))});var d=FU(function(p){if(!n||e.bind===!1)return p(null);u.once("error",p),u.bind(n,e.bind||e.interface,function(){u.removeListener("error",p),p(null)})});return d(function(p){if(p)return t.emit("error",p);t.emit("ready")}),t.send=function(p,m,f){if(typeof m=="function")return t.send(p,null,m);f||(f=wv),m?!m.host&&!m.address&&(m.address=i.address):m=i,d(g);function g(h){if(a)return f();if(h)return f(h);var y=kv.encode(p);u.send(y,0,y.length,m.port,m.address||m.host,f)}},t.response=t.respond=function(p,m,f){Array.isArray(p)&&(p={answers:p}),p.type="response",p.flags=(p.flags||0)|kv.AUTHORITATIVE_ANSWER,t.send(p,m,f)},t.query=function(p,m,f,g){if(typeof m=="function")return t.query(p,null,null,m);if(typeof m=="object"&&m&&m.port)return t.query(p,null,m,f);if(typeof f=="function")return t.query(p,m,null,f);g||(g=wv),typeof p=="string"&&(p=[{name:p,type:m||"ANY"}]),Array.isArray(p)&&(p={type:"query",questions:p}),p.type="query",t.send(p,f,g)},t.destroy=function(p){if(p||(p=wv),a)return process.nextTick(p);a=!0,clearInterval(l);for(var m in s)try{u.dropMembership(r,m)}catch{}s={},u.close(p)},t.update=function(){for(var p=e.interface?[].concat(e.interface):HU(),m=!1,f=0;f<p.length;f++){var g=p[f];if(!s[g])try{u.addMembership(r,g),s[g]=!0,m=!0}catch(h){t.emit("warning",h)}}if(m){if(u.setMulticastInterface)try{u.setMulticastInterface(e.interface||BU())}catch(h){t.emit("warning",h)}t.emit("networkInterface")}},t};function BU(){for(var e=Sv.networkInterfaces(),t=Object.keys(e),n=0;n<t.length;n++)for(var o=e[t[n]],r=0;r<o.length;r++){var i=o[r];if(C_(i.family)&&!i.internal)return Sv.platform()==="darwin"&&t[n]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function HU(){for(var e=Sv.networkInterfaces(),t=Object.keys(e),n=[],o=0;o<t.length;o++)for(var r=e[t[o]],i=0;i<r.length;i++){var s=r[i];if(C_(s.family)){n.push(s.address);break}}return n}function C_(e){return e===4||e==="IPv4"}});var O_=ae((QV,R_)=>{"use strict";R_.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var o,r,i;if(Array.isArray(t)){if(o=t.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!e(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;for(r of t.entries())if(!e(r[1],n.get(r[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(o=t.length,o!=n.length)return!1;for(r=o;r--!==0;)if(t[r]!==n[r])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),o=i.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=o;r--!==0;){var s=i[r];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n}});var D_=ae(Br=>{"use strict";var _v=Br&&Br.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Br,"__esModule",{value:!0});Br.Server=void 0;var GU=_v(T_()),WU=_v(O_()),ZU=_v(Xl()),ru=class{constructor(t,n){this.registry={},this.mdns=(0,GU.default)(t),this.mdns.setMaxListeners(0),this.mdns.on("query",this.respondToQuery.bind(this)),this.errorCallback=n??function(o){throw o}}register(t){let n=o=>{var r=this.registry[o.type];if(!r)r=this.registry[o.type]=[];else if(r.some(this.isDuplicateRecord(o)))return;r.push(o)};Array.isArray(t)?t.forEach(n):n(t)}unregister(t){let n=o=>{let r=o.type;r in this.registry&&(this.registry[r]=this.registry[r].filter(i=>i.name!==o.name))};Array.isArray(t)?t.forEach(n):n(t)}respondToQuery(t){let n=this;t.questions.forEach(o=>{var r=o.type,i=o.name,s=r==="ANY"?Object.keys(n.registry).map(n.recordsFor.bind(n,i)).flat(1):n.recordsFor(i,r);if(s.length!==0){var a=[];r!=="ANY"&&(s.forEach(l=>{l.type==="PTR"&&(a=a.concat(n.recordsFor(l.data,"SRV")).concat(n.recordsFor(l.data,"TXT")))}),a.filter(function(l){return l.type==="SRV"}).map(function(l){return l.data.target}).filter(this.unique()).forEach(function(l){a=a.concat(n.recordsFor(l,"A")).concat(n.recordsFor(l,"AAAA"))})),n.mdns.respond({answers:s,additionals:a},l=>{l&&this.errorCallback(l)})}})}recordsFor(t,n){return n in this.registry?this.registry[n].filter(o=>{var r=~t.indexOf(".")?o.name:o.name.split(".")[0];return(0,ZU.default)(r,t)}):[]}isDuplicateRecord(t){return n=>t.type===n.type&&t.name===n.name&&(0,WU.default)(t.data,n.data)}unique(){var t=[];return n=>~t.indexOf(n)?!1:(t.push(n),!0)}};Br.Server=ru;Br.default=ru});var N_=ae($v=>{"use strict";Object.defineProperty($v,"__esModule",{value:!0});$v.default=(e,t)=>{if(t===void 0)return!0;let n=e.txt,o=Object.entries(t).map(([r,i])=>{let s=n[r];return!(s===void 0||i!=s)});return o.length==0?!0:!o.includes(!1)}});var L_=ae(Ev=>{"use strict";Object.defineProperty(Ev,"__esModule",{value:!0});Ev.default=e=>Object.keys(e).filter(t=>!t.includes("binary")).reduce((t,n)=>Object.assign(t,{[n]:e[n]}),{})});var U_=ae(Av=>{"use strict";Object.defineProperty(Av,"__esModule",{value:!0});Av.default=VU;function VU(e,t){if(e===void 0||t===void 0)return!1;let n=Object.keys(e),o=Object.keys(t);if(n.length!=o.length)return!1;for(let r of n)if(e[r]!=t[r])return!1;return!0}});var F_=ae(Hr=>{"use strict";var Fs=Hr&&Hr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.Browser=void 0;var qU=Fs(cv()),mr=Fs(Xl()),JU=me("events"),Iv=lv(),j_=Fs(N_()),KU=Fs(L_()),XU=Fs(U_()),z_=".local",YU="_services._dns-sd._udp"+z_,ou=class e extends JU.EventEmitter{constructor(t,n,o){if(super(),this.onresponse=void 0,this.serviceMap={},this.wildcard=!1,this._services=[],typeof n=="function")return new e(t,null,n);this.mdns=t,this.txt=new qU.default(n!==null&&n.txt!=null?n.txt:void 0),n===null||n.type===void 0?(this.name=YU,this.wildcard=!0):(this.name=(0,Iv.toString)({name:n.type,protocol:n.protocol||"tcp"})+z_,n.name&&(this.name=n.name+"."+this.name),this.wildcard=!1),n!=null&&n.txt!==void 0&&(this.txtQuery=(0,KU.default)(n.txt)),o&&this.on("up",o),this.start()}start(){if(!(this.onresponse||this.name===void 0)){var t=this,n={};this.wildcard||(n[this.name]=!0),this.onresponse=(o,r)=>{t.wildcard&&o.answers.forEach(s=>{s.type!=="PTR"||s.name!==t.name||s.name in n||(n[s.data]=!0,t.mdns.query(s.data,"PTR"))});let i=Date.now();Object.keys(n).forEach(function(s){t.goodbyes(s,o).forEach(t.removeService.bind(t));var a=t.buildServicesFor(s,o,t.txt,r,i);a.length!==0&&a.forEach(l=>{let u=t._services.find(d=>(0,mr.default)(d.fqdn,l.fqdn));if(u){t.updateServiceSrv(u,l),t.updateServiceTxt(u,l);return}t.addService(l)})})},this.mdns.on("response",this.onresponse),this.update()}}stop(){this.onresponse&&(this.mdns.removeListener("response",this.onresponse),this.onresponse=void 0)}update(){this.mdns.query(this.name,"PTR")}expire(){let t=Date.now();this._services=this._services.filter(n=>!n.ttl||n.lastSeen===void 0?!0:n.lastSeen+n.ttl*1e3<t?(this.emit("down",n),!1):!0)}get services(){return this._services}addService(t){(0,j_.default)(t,this.txtQuery)!==!1&&(this._services.push(t),this.serviceMap[t.fqdn]=!0,this.emit("up",t))}updateServiceSrv(t,n){(t.name!==n.name||t.host!==n.host||t.port!==n.port||t.type!==n.type||t.protocol!==n.protocol)&&(this.replaceService(n),this.emit("srv-update",n,t))}updateServiceTxt(t,n){if(!(0,XU.default)(n.txt,t?.txt||{})){if(!(0,j_.default)(n,this.txtQuery)){this.removeService(n.fqdn);return}this.replaceService(n),this.emit("txt-update",n,t)}}replaceService(t){this._services=this._services.map(n=>(0,mr.default)(n.fqdn,t.fqdn)?t:n)}removeService(t){var n,o;this._services.some(function(r,i){if((0,mr.default)(r.fqdn,t))return n=r,o=i,!0}),!(!n||o===void 0)&&(this._services.splice(o,1),delete this.serviceMap[t],this.emit("down",n))}goodbyes(t,n){return n.answers.concat(n.additionals).filter(o=>o.type==="PTR"&&o.ttl===0&&(0,mr.default)(o.name,t)).map(o=>o.data)}buildServicesFor(t,n,o,r,i){var s=n.answers.concat(n.additionals).filter(a=>a.ttl>0);return s.filter(a=>a.type==="PTR"&&(0,mr.default)(a.name,t)).map(a=>{let l={addresses:[],subtypes:[],ttl:a.ttl,lastSeen:i};if(s.filter(u=>u.type==="PTR"&&(0,mr.default)(u.data,a.data)&&u.name.includes("._sub")).forEach(u=>{let d=(0,Iv.toType)(u.name);l.subtypes.push(d.subtype)}),s.filter(u=>(u.type==="SRV"||u.type==="TXT")&&(0,mr.default)(u.name,a.data)).forEach(u=>{if(u.type==="SRV"){var d=u.name.split("."),p=d[0],m=(0,Iv.toType)(d.slice(1,-1).join("."));l.name=p,l.fqdn=u.name,l.host=u.data.target,l.referer=r,l.port=u.data.port,l.type=m.name,l.protocol=m.protocol}else u.type==="TXT"&&(l.rawTxt=u.data,l.txt=this.txt.decodeAll(u.data))}),!!l.name)return s.filter(u=>(u.type==="A"||u.type==="AAAA")&&(0,mr.default)(u.name,l.host)).forEach(u=>l.addresses.push(u.data)),l}).filter(a=>!!a)}};Hr.Browser=ou;Hr.default=ou});var M_=ae(zn=>{"use strict";var iu=zn&&zn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zn,"__esModule",{value:!0});zn.Browser=zn.Service=void 0;var QU=iu(f_()),ej=iu(D_()),Cv=iu(F_());zn.Browser=Cv.default;var tj=iu(uv());zn.Service=tj.default;var Pv=class{constructor(t={},n){this.server=new ej.default(t,n),this.registry=new QU.default(this.server)}publish(t){return this.registry.publish(t)}unpublishAll(t){return this.registry.unpublishAll(t)}find(t=null,n){return new Cv.default(this.server.mdns,t,n)}findOne(t=null,n=1e4,o){let r=new Cv.default(this.server.mdns,t);var i;return r.once("up",s=>{i!==void 0&&clearTimeout(i),r.stop(),o&&o(s)}),i=setTimeout(()=>{r.stop(),o&&o(null)},n),r}destroy(t){this.registry.destroy(),this.server.mdns.destroy(t)}};zn.default=Pv});var H_=ae((Ke,B_)=>{"use strict";var nj=Ke&&Ke.__createBinding||(Object.create?(function(e,t,n,o){o===void 0&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);(!r||("get"in r?!t.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}):(function(e,t,n,o){o===void 0&&(o=n),e[o]=t[n]})),rj=Ke&&Ke.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),oj=Ke&&Ke.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var o=[];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(o[o.length]=r);return o},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var o=e(t),r=0;r<o.length;r++)o[r]!=="default"&&nj(n,t,o[r]);return rj(n,t),n}})();Object.defineProperty(Ke,"__esModule",{value:!0});Ke.Browser=Ke.Service=Ke.Bonjour=void 0;var Ms=oj(M_());Object.defineProperty(Ke,"Service",{enumerable:!0,get:function(){return Ms.Service}});Object.defineProperty(Ke,"Browser",{enumerable:!0,get:function(){return Ms.Browser}});var Gr=class extends Ms.default{};Ke.Bonjour=Gr;Ke.default=Gr;B_.exports=Object.assign(Gr,{Bonjour:Gr,Service:Ms.Service,Browser:Ms.Browser,default:Gr})});var Bn=ae((kee,vE)=>{"use strict";var gE=["nodebuffer","arraybuffer","fragments"],hE=typeof Blob<"u";hE&&gE.push("blob");vE.exports={BINARY_TYPES:gE,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:hE,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Vs=ae((wee,bu)=>{"use strict";var{EMPTY_BUFFER:Fz}=Bn(),Qv=Buffer[Symbol.species];function Mz(e,t){if(e.length===0)return Fz;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),o=0;for(let r=0;r<e.length;r++){let i=e[r];n.set(i,o),o+=i.length}return o<t?new Qv(n.buffer,n.byteOffset,o):n}function yE(e,t,n,o,r){for(let i=0;i<r;i++)n[o+i]=e[i]^t[i&3]}function bE(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function Bz(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function ey(e){if(ey.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new Qv(e):ArrayBuffer.isView(e)?t=new Qv(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),ey.readOnly=!1),t}bu.exports={concat:Mz,mask:yE,toArrayBuffer:Bz,toBuffer:ey,unmask:bE};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=me("bufferutil");bu.exports.mask=function(t,n,o,r,i){i<48?yE(t,n,o,r,i):e.mask(t,n,o,r,i)},bu.exports.unmask=function(t,n){t.length<32?bE(t,n):e.unmask(t,n)}}catch{}});var wE=ae((See,kE)=>{"use strict";var xE=Symbol("kDone"),ty=Symbol("kRun"),ny=class{constructor(t){this[xE]=()=>{this.pending--,this[ty]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[ty]()}[ty](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[xE])}}};kE.exports=ny});var fi=ae((_ee,EE)=>{"use strict";var qs=me("zlib"),SE=Vs(),Hz=wE(),{kStatusCode:_E}=Bn(),Gz=Buffer[Symbol.species],Wz=Buffer.from([0,0,255,255]),ku=Symbol("permessage-deflate"),Hn=Symbol("total-length"),pi=Symbol("callback"),yr=Symbol("buffers"),mi=Symbol("error"),xu,ry=class{constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!xu){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;xu=new Hz(n)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[pi];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let n=this._options,o=t.find(r=>!(n.serverNoContextTakeover===!1&&r.server_no_context_takeover||r.server_max_window_bits&&(n.serverMaxWindowBits===!1||typeof n.serverMaxWindowBits=="number"&&n.serverMaxWindowBits>r.server_max_window_bits)||typeof n.clientMaxWindowBits=="number"&&!r.client_max_window_bits));if(!o)throw new Error("None of the extension offers can be accepted");return n.serverNoContextTakeover&&(o.server_no_context_takeover=!0),n.clientNoContextTakeover&&(o.client_no_context_takeover=!0),typeof n.serverMaxWindowBits=="number"&&(o.server_max_window_bits=n.serverMaxWindowBits),typeof n.clientMaxWindowBits=="number"?o.client_max_window_bits=n.clientMaxWindowBits:(o.client_max_window_bits===!0||n.clientMaxWindowBits===!1)&&delete o.client_max_window_bits,o}acceptAsClient(t){let n=t[0];if(this._options.clientNoContextTakeover===!1&&n.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!n.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(n.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&n.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return n}normalizeParams(t){return t.forEach(n=>{Object.keys(n).forEach(o=>{let r=n[o];if(r.length>1)throw new Error(`Parameter "${o}" must have only a single value`);if(r=r[0],o==="client_max_window_bits"){if(r!==!0){let i=+r;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${o}": ${r}`);r=i}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${o}": ${r}`)}else if(o==="server_max_window_bits"){let i=+r;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${o}": ${r}`);r=i}else if(o==="client_no_context_takeover"||o==="server_no_context_takeover"){if(r!==!0)throw new TypeError(`Invalid value for parameter "${o}": ${r}`)}else throw new Error(`Unknown parameter "${o}"`);n[o]=r})}),t}decompress(t,n,o){xu.add(r=>{this._decompress(t,n,(i,s)=>{r(),o(i,s)})})}compress(t,n,o){xu.add(r=>{this._compress(t,n,(i,s)=>{r(),o(i,s)})})}_decompress(t,n,o){let r=this._isServer?"client":"server";if(!this._inflate){let i=`${r}_max_window_bits`,s=typeof this.params[i]!="number"?qs.Z_DEFAULT_WINDOWBITS:this.params[i];this._inflate=qs.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[ku]=this,this._inflate[Hn]=0,this._inflate[yr]=[],this._inflate.on("error",Vz),this._inflate.on("data",$E)}this._inflate[pi]=o,this._inflate.write(t),n&&this._inflate.write(Wz),this._inflate.flush(()=>{let i=this._inflate[mi];if(i){this._inflate.close(),this._inflate=null,o(i);return}let s=SE.concat(this._inflate[yr],this._inflate[Hn]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Hn]=0,this._inflate[yr]=[],n&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),o(null,s)})}_compress(t,n,o){let r=this._isServer?"server":"client";if(!this._deflate){let i=`${r}_max_window_bits`,s=typeof this.params[i]!="number"?qs.Z_DEFAULT_WINDOWBITS:this.params[i];this._deflate=qs.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[Hn]=0,this._deflate[yr]=[],this._deflate.on("data",Zz)}this._deflate[pi]=o,this._deflate.write(t),this._deflate.flush(qs.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=SE.concat(this._deflate[yr],this._deflate[Hn]);n&&(i=new Gz(i.buffer,i.byteOffset,i.length-4)),this._deflate[pi]=null,this._deflate[Hn]=0,this._deflate[yr]=[],n&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),o(null,i)})}};EE.exports=ry;function Zz(e){this[yr].push(e),this[Hn]+=e.length}function $E(e){if(this[Hn]+=e.length,this[ku]._maxPayload<1||this[Hn]<=this[ku]._maxPayload){this[yr].push(e);return}this[mi]=new RangeError("Max payload size exceeded"),this[mi].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[mi][_E]=1009,this.removeListener("data",$E),this.reset()}function Vz(e){if(this[ku]._inflate=null,this[mi]){this[pi](this[mi]);return}e[_E]=1007,this[pi](e)}});var gi=ae(($ee,wu)=>{"use strict";var{isUtf8:AE}=me("buffer"),{hasBlob:qz}=Bn(),Jz=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Kz(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function oy(e){let t=e.length,n=0;for(;n<t;)if((e[n]&128)===0)n++;else if((e[n]&224)===192){if(n+1===t||(e[n+1]&192)!==128||(e[n]&254)===192)return!1;n+=2}else if((e[n]&240)===224){if(n+2>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||e[n]===224&&(e[n+1]&224)===128||e[n]===237&&(e[n+1]&224)===160)return!1;n+=3}else if((e[n]&248)===240){if(n+3>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||(e[n+3]&192)!==128||e[n]===240&&(e[n+1]&240)===128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function Xz(e){return qz&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}wu.exports={isBlob:Xz,isValidStatusCode:Kz,isValidUTF8:oy,tokenChars:Jz};if(AE)wu.exports.isValidUTF8=function(e){return e.length<24?oy(e):AE(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=me("utf-8-validate");wu.exports.isValidUTF8=function(t){return t.length<32?oy(t):e(t)}}catch{}});var ly=ae((Eee,DE)=>{"use strict";var{Writable:Yz}=me("stream"),IE=fi(),{BINARY_TYPES:Qz,EMPTY_BUFFER:CE,kStatusCode:eF,kWebSocket:tF}=Bn(),{concat:iy,toArrayBuffer:nF,unmask:rF}=Vs(),{isValidStatusCode:oF,isValidUTF8:PE}=gi(),Su=Buffer[Symbol.species],At=0,TE=1,RE=2,OE=3,sy=4,ay=5,_u=6,cy=class extends Yz{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||Qz[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[tF]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=At}_write(t,n,o){if(this._opcode===8&&this._state==At)return o();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){o(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(o)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let o=this._buffers[0];return this._buffers[0]=new Su(o.buffer,o.byteOffset+t,o.length-t),new Su(o.buffer,o.byteOffset,t)}let n=Buffer.allocUnsafe(t);do{let o=this._buffers[0],r=n.length-t;t>=o.length?n.set(this._buffers.shift(),r):(n.set(new Uint8Array(o.buffer,o.byteOffset,t),r),this._buffers[0]=new Su(o.buffer,o.byteOffset+t,o.length-t)),t-=o.length}while(t>0);return n}startLoop(t){this._loop=!0;do switch(this._state){case At:this.getInfo(t);break;case TE:this.getPayloadLength16(t);break;case RE:this.getPayloadLength64(t);break;case OE:this.getMask();break;case sy:this.getData(t);break;case ay:case _u:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let n=this.consume(2);if((n[0]&48)!==0){let r=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(r);return}let o=(n[0]&64)===64;if(o&&!this._extensions[IE.extensionName]){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._fin=(n[0]&128)===128,this._opcode=n[0]&15,this._payloadLength=n[1]&127,this._opcode===0){if(o){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(!this._fragmented){let r=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._compressed=o}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let r=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(r);return}if(o){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let r=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(r);return}}else{let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(n[1]&128)===128,this._isServer){if(!this._masked){let r=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(r);return}}else if(this._masked){let r=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(r);return}this._payloadLength===126?this._state=TE:this._payloadLength===127?this._state=RE:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let n=this.consume(8),o=n.readUInt32BE(0);if(o>Math.pow(2,21)-1){let r=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(r);return}this._payloadLength=o*Math.pow(2,32)+n.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let n=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(n);return}this._masked?this._state=OE:this._state=sy}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=sy}getData(t){let n=CE;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}n=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&rF(n,this._mask)}if(this._opcode>7){this.controlMessage(n,t);return}if(this._compressed){this._state=ay,this.decompress(n,t);return}if(n.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let o=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(o);return}this._messageLength=this._totalPayloadLength,this._fragments.push(n)}this.dataMessage(t)}decompress(t,n){this._extensions[IE.extensionName].decompress(t,this._fin,(r,i)=>{if(r)return n(r);if(i.length){if(this._messageLength+=i.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");n(s);return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let s=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");n(s);return}this._fragments.push(i)}this.dataMessage(n),this._state===At&&this.startLoop(n)})}dataMessage(t){if(!this._fin){this._state=At;return}let n=this._messageLength,o=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=iy(o,n):this._binaryType==="arraybuffer"?r=nF(iy(o,n)):this._binaryType==="blob"?r=new Blob(o):r=o,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=At):(this._state=_u,setImmediate(()=>{this.emit("message",r,!0),this._state=At,this.startLoop(t)}))}else{let r=iy(o,n);if(!this._skipUTF8Validation&&!PE(r)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(i);return}this._state===ay||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=At):(this._state=_u,setImmediate(()=>{this.emit("message",r,!1),this._state=At,this.startLoop(t)}))}}controlMessage(t,n){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,CE),this.end();else{let o=t.readUInt16BE(0);if(!oF(o)){let i=this.createError(RangeError,`invalid status code ${o}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");n(i);return}let r=new Su(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!PE(r)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");n(i);return}this._loop=!1,this.emit("conclude",o,r),this.end()}this._state=At;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=At):(this._state=_u,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=At,this.startLoop(n)}))}createError(t,n,o,r,i){this._loop=!1,this._errored=!0;let s=new t(o?`Invalid WebSocket frame: ${n}`:n);return Error.captureStackTrace(s,this.createError),s.code=i,s[eF]=r,s}};DE.exports=cy});var py=ae((Iee,UE)=>{"use strict";var{Duplex:Aee}=me("stream"),{randomFillSync:iF}=me("crypto"),{types:{isUint8Array:sF}}=me("util"),NE=fi(),{EMPTY_BUFFER:aF,kWebSocket:cF,NOOP:lF}=Bn(),{isBlob:hi,isValidStatusCode:uF}=gi(),{mask:LE,toBuffer:Kr}=Vs(),It=Symbol("kByteLength"),dF=Buffer.alloc(4),$u=8*1024,Xr,vi=$u,Gt=0,pF=1,mF=2,uy=class e{constructor(t,n,o){this._extensions=n||{},o&&(this._generateMask=o,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Gt,this.onerror=lF,this[cF]=void 0}static frame(t,n){let o,r=!1,i=2,s=!1;n.mask&&(o=n.maskBuffer||dF,n.generateMask?n.generateMask(o):(vi===$u&&(Xr===void 0&&(Xr=Buffer.alloc($u)),iF(Xr,0,$u),vi=0),o[0]=Xr[vi++],o[1]=Xr[vi++],o[2]=Xr[vi++],o[3]=Xr[vi++]),s=(o[0]|o[1]|o[2]|o[3])===0,i=6);let a;typeof t=="string"?(!n.mask||s)&&n[It]!==void 0?a=n[It]:(t=Buffer.from(t),a=t.length):(a=t.length,r=n.mask&&n.readOnly&&!s);let l=a;a>=65536?(i+=8,l=127):a>125&&(i+=2,l=126);let u=Buffer.allocUnsafe(r?a+i:i);return u[0]=n.fin?n.opcode|128:n.opcode,n.rsv1&&(u[0]|=64),u[1]=l,l===126?u.writeUInt16BE(a,2):l===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),n.mask?(u[1]|=128,u[i-4]=o[0],u[i-3]=o[1],u[i-2]=o[2],u[i-1]=o[3],s?[u,t]:r?(LE(t,o,u,i,a),[u]):(LE(t,o,t,0,a),[u,t])):[u,t]}close(t,n,o,r){let i;if(t===void 0)i=aF;else{if(typeof t!="number"||!uF(t))throw new TypeError("First argument must be a valid error code number");if(n===void 0||!n.length)i=Buffer.allocUnsafe(2),i.writeUInt16BE(t,0);else{let a=Buffer.byteLength(n);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");if(i=Buffer.allocUnsafe(2+a),i.writeUInt16BE(t,0),typeof n=="string")i.write(n,2);else if(sF(n))i.set(n,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[It]:i.length,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Gt?this.enqueue([this.dispatch,i,!1,s,r]):this.sendFrame(e.frame(i,s),r)}ping(t,n,o){let r,i;if(typeof t=="string"?(r=Buffer.byteLength(t),i=!1):hi(t)?(r=t.size,i=!1):(t=Kr(t),r=t.length,i=Kr.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[It]:r,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};hi(t)?this._state!==Gt?this.enqueue([this.getBlobData,t,!1,s,o]):this.getBlobData(t,!1,s,o):this._state!==Gt?this.enqueue([this.dispatch,t,!1,s,o]):this.sendFrame(e.frame(t,s),o)}pong(t,n,o){let r,i;if(typeof t=="string"?(r=Buffer.byteLength(t),i=!1):hi(t)?(r=t.size,i=!1):(t=Kr(t),r=t.length,i=Kr.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[It]:r,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};hi(t)?this._state!==Gt?this.enqueue([this.getBlobData,t,!1,s,o]):this.getBlobData(t,!1,s,o):this._state!==Gt?this.enqueue([this.dispatch,t,!1,s,o]):this.sendFrame(e.frame(t,s),o)}send(t,n,o){let r=this._extensions[NE.extensionName],i=n.binary?2:1,s=n.compress,a,l;typeof t=="string"?(a=Buffer.byteLength(t),l=!1):hi(t)?(a=t.size,l=!1):(t=Kr(t),a=t.length,l=Kr.readOnly),this._firstFragment?(this._firstFragment=!1,s&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(s=a>=r._threshold),this._compress=s):(s=!1,i=0),n.fin&&(this._firstFragment=!0);let u={[It]:a,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:l,rsv1:s};hi(t)?this._state!==Gt?this.enqueue([this.getBlobData,t,this._compress,u,o]):this.getBlobData(t,this._compress,u,o):this._state!==Gt?this.enqueue([this.dispatch,t,this._compress,u,o]):this.dispatch(t,this._compress,u,o)}getBlobData(t,n,o,r){this._bufferedBytes+=o[It],this._state=mF,t.arrayBuffer().then(i=>{if(this._socket.destroyed){let a=new Error("The socket was closed while the blob was being read");process.nextTick(dy,this,a,r);return}this._bufferedBytes-=o[It];let s=Kr(i);n?this.dispatch(s,n,o,r):(this._state=Gt,this.sendFrame(e.frame(s,o),r),this.dequeue())}).catch(i=>{process.nextTick(fF,this,i,r)})}dispatch(t,n,o,r){if(!n){this.sendFrame(e.frame(t,o),r);return}let i=this._extensions[NE.extensionName];this._bufferedBytes+=o[It],this._state=pF,i.compress(t,o.fin,(s,a)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");dy(this,l,r);return}this._bufferedBytes-=o[It],this._state=Gt,o.readOnly=!1,this.sendFrame(e.frame(a,o),r),this.dequeue()})}dequeue(){for(;this._state===Gt&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][It],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][It],this._queue.push(t)}sendFrame(t,n){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],n),this._socket.uncork()):this._socket.write(t[0],n)}};UE.exports=uy;function dy(e,t,n){typeof n=="function"&&n(t);for(let o=0;o<e._queue.length;o++){let r=e._queue[o],i=r[r.length-1];typeof i=="function"&&i(t)}}function fF(e,t,n){dy(e,t,n),e.onerror(t)}});var ZE=ae((Cee,WE)=>{"use strict";var{kForOnEventAttribute:Js,kListener:my}=Bn(),jE=Symbol("kCode"),zE=Symbol("kData"),FE=Symbol("kError"),ME=Symbol("kMessage"),BE=Symbol("kReason"),yi=Symbol("kTarget"),HE=Symbol("kType"),GE=Symbol("kWasClean"),Gn=class{constructor(t){this[yi]=null,this[HE]=t}get target(){return this[yi]}get type(){return this[HE]}};Object.defineProperty(Gn.prototype,"target",{enumerable:!0});Object.defineProperty(Gn.prototype,"type",{enumerable:!0});var Yr=class extends Gn{constructor(t,n={}){super(t),this[jE]=n.code===void 0?0:n.code,this[BE]=n.reason===void 0?"":n.reason,this[GE]=n.wasClean===void 0?!1:n.wasClean}get code(){return this[jE]}get reason(){return this[BE]}get wasClean(){return this[GE]}};Object.defineProperty(Yr.prototype,"code",{enumerable:!0});Object.defineProperty(Yr.prototype,"reason",{enumerable:!0});Object.defineProperty(Yr.prototype,"wasClean",{enumerable:!0});var bi=class extends Gn{constructor(t,n={}){super(t),this[FE]=n.error===void 0?null:n.error,this[ME]=n.message===void 0?"":n.message}get error(){return this[FE]}get message(){return this[ME]}};Object.defineProperty(bi.prototype,"error",{enumerable:!0});Object.defineProperty(bi.prototype,"message",{enumerable:!0});var Ks=class extends Gn{constructor(t,n={}){super(t),this[zE]=n.data===void 0?null:n.data}get data(){return this[zE]}};Object.defineProperty(Ks.prototype,"data",{enumerable:!0});var gF={addEventListener(e,t,n={}){for(let r of this.listeners(e))if(!n[Js]&&r[my]===t&&!r[Js])return;let o;if(e==="message")o=function(i,s){let a=new Ks("message",{data:s?i:i.toString()});a[yi]=this,Eu(t,this,a)};else if(e==="close")o=function(i,s){let a=new Yr("close",{code:i,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[yi]=this,Eu(t,this,a)};else if(e==="error")o=function(i){let s=new bi("error",{error:i,message:i.message});s[yi]=this,Eu(t,this,s)};else if(e==="open")o=function(){let i=new Gn("open");i[yi]=this,Eu(t,this,i)};else return;o[Js]=!!n[Js],o[my]=t,n.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(let n of this.listeners(e))if(n[my]===t&&!n[Js]){this.removeListener(e,n);break}}};WE.exports={CloseEvent:Yr,ErrorEvent:bi,Event:Gn,EventTarget:gF,MessageEvent:Ks};function Eu(e,t,n){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}});var Au=ae((Pee,VE)=>{"use strict";var{tokenChars:Xs}=gi();function mn(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function hF(e){let t=Object.create(null),n=Object.create(null),o=!1,r=!1,i=!1,s,a,l=-1,u=-1,d=-1,p=0;for(;p<e.length;p++)if(u=e.charCodeAt(p),s===void 0)if(d===-1&&Xs[u]===1)l===-1&&(l=p);else if(p!==0&&(u===32||u===9))d===-1&&l!==-1&&(d=p);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1&&(d=p);let f=e.slice(l,d);u===44?(mn(t,f,n),n=Object.create(null)):s=f,l=d=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(a===void 0)if(d===-1&&Xs[u]===1)l===-1&&(l=p);else if(u===32||u===9)d===-1&&l!==-1&&(d=p);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1&&(d=p),mn(n,e.slice(l,d),!0),u===44&&(mn(t,s,n),n=Object.create(null),s=void 0),l=d=-1}else if(u===61&&l!==-1&&d===-1)a=e.slice(l,p),l=d=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(r){if(Xs[u]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);l===-1?l=p:o||(o=!0),r=!1}else if(i)if(Xs[u]===1)l===-1&&(l=p);else if(u===34&&l!==-1)i=!1,d=p;else if(u===92)r=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(u===34&&e.charCodeAt(p-1)===61)i=!0;else if(d===-1&&Xs[u]===1)l===-1&&(l=p);else if(l!==-1&&(u===32||u===9))d===-1&&(d=p);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1&&(d=p);let f=e.slice(l,d);o&&(f=f.replace(/\\/g,""),o=!1),mn(n,a,f),u===44&&(mn(t,s,n),n=Object.create(null),s=void 0),a=void 0,l=d=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(l===-1||i||u===32||u===9)throw new SyntaxError("Unexpected end of input");d===-1&&(d=p);let m=e.slice(l,d);return s===void 0?mn(t,m,n):(a===void 0?mn(n,m,!0):o?mn(n,a,m.replace(/\\/g,"")):mn(n,a,m),mn(t,s,n)),t}function vF(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(o=>[t].concat(Object.keys(o).map(r=>{let i=o[r];return Array.isArray(i)||(i=[i]),i.map(s=>s===!0?r:`${r}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}VE.exports={format:vF,parse:hF}});var Tu=ae((Oee,iA)=>{"use strict";var yF=me("events"),bF=me("https"),xF=me("http"),KE=me("net"),kF=me("tls"),{randomBytes:wF,createHash:SF}=me("crypto"),{Duplex:Tee,Readable:Ree}=me("stream"),{URL:fy}=me("url"),br=fi(),_F=ly(),$F=py(),{isBlob:EF}=gi(),{BINARY_TYPES:qE,CLOSE_TIMEOUT:AF,EMPTY_BUFFER:Iu,GUID:IF,kForOnEventAttribute:gy,kListener:CF,kStatusCode:PF,kWebSocket:De,NOOP:XE}=Bn(),{EventTarget:{addEventListener:TF,removeEventListener:RF}}=ZE(),{format:OF,parse:DF}=Au(),{toBuffer:NF}=Vs(),YE=Symbol("kAborted"),hy=[8,13],Wn=["CONNECTING","OPEN","CLOSING","CLOSED"],LF=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,Ae=class e extends yF{constructor(t,n,o){super(),this._binaryType=qE[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Iu,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n=="object"&&n!==null?(o=n,n=[]):n=[n]),QE(this,t,n,o)):(this._autoPong=o.autoPong,this._closeTimeout=o.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){qE.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,o){let r=new _F({allowSynchronousEvents:o.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation}),i=new $F(t,this._extensions,o.generateMask);this._receiver=r,this._sender=i,this._socket=t,r[De]=this,i[De]=this,t[De]=this,r.on("conclude",zF),r.on("drain",FF),r.on("error",MF),r.on("message",BF),r.on("ping",HF),r.on("pong",GF),i.onerror=WF,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on("close",nA),t.on("data",Pu),t.on("end",rA),t.on("error",oA),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[br.extensionName]&&this._extensions[br.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){vt(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,o=>{o||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),tA(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,o){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(o=t,t=n=void 0):typeof n=="function"&&(o=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){vy(this,t,o);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||Iu,n,o)}pong(t,n,o){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(o=t,t=n=void 0):typeof n=="function"&&(o=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){vy(this,t,o);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||Iu,n,o)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,o){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof n=="function"&&(o=n,n={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){vy(this,t,o);return}let r={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[br.extensionName]||(r.compress=!1),this._sender.send(t||Iu,r,o)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){vt(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(Ae,"CONNECTING",{enumerable:!0,value:Wn.indexOf("CONNECTING")});Object.defineProperty(Ae.prototype,"CONNECTING",{enumerable:!0,value:Wn.indexOf("CONNECTING")});Object.defineProperty(Ae,"OPEN",{enumerable:!0,value:Wn.indexOf("OPEN")});Object.defineProperty(Ae.prototype,"OPEN",{enumerable:!0,value:Wn.indexOf("OPEN")});Object.defineProperty(Ae,"CLOSING",{enumerable:!0,value:Wn.indexOf("CLOSING")});Object.defineProperty(Ae.prototype,"CLOSING",{enumerable:!0,value:Wn.indexOf("CLOSING")});Object.defineProperty(Ae,"CLOSED",{enumerable:!0,value:Wn.indexOf("CLOSED")});Object.defineProperty(Ae.prototype,"CLOSED",{enumerable:!0,value:Wn.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(Ae.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(Ae.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[gy])return t[CF];return null},set(t){for(let n of this.listeners(e))if(n[gy]){this.removeListener(e,n);break}typeof t=="function"&&this.addEventListener(e,t,{[gy]:!0})}})});Ae.prototype.addEventListener=TF;Ae.prototype.removeEventListener=RF;iA.exports=Ae;function QE(e,t,n,o){let r={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:AF,protocolVersion:hy[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...o,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=r.autoPong,e._closeTimeout=r.closeTimeout,!hy.includes(r.protocolVersion))throw new RangeError(`Unsupported protocol version: ${r.protocolVersion} (supported versions: ${hy.join(", ")})`);let i;if(t instanceof fy)i=t;else try{i=new fy(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}i.protocol==="http:"?i.protocol="ws:":i.protocol==="https:"&&(i.protocol="wss:"),e._url=i.href;let s=i.protocol==="wss:",a=i.protocol==="ws+unix:",l;if(i.protocol!=="ws:"&&!s&&!a?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:a&&!i.pathname?l="The URL's pathname is empty":i.hash&&(l="The URL contains a fragment identifier"),l){let h=new SyntaxError(l);if(e._redirects===0)throw h;Cu(e,h);return}let u=s?443:80,d=wF(16).toString("base64"),p=s?bF.request:xF.request,m=new Set,f;if(r.createConnection=r.createConnection||(s?jF:UF),r.defaultPort=r.defaultPort||u,r.port=i.port||u,r.host=i.hostname.startsWith("[")?i.hostname.slice(1,-1):i.hostname,r.headers={...r.headers,"Sec-WebSocket-Version":r.protocolVersion,"Sec-WebSocket-Key":d,Connection:"Upgrade",Upgrade:"websocket"},r.path=i.pathname+i.search,r.timeout=r.handshakeTimeout,r.perMessageDeflate&&(f=new br({...r.perMessageDeflate,isServer:!1,maxPayload:r.maxPayload}),r.headers["Sec-WebSocket-Extensions"]=OF({[br.extensionName]:f.offer()})),n.length){for(let h of n){if(typeof h!="string"||!LF.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}r.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(r.origin&&(r.protocolVersion<13?r.headers["Sec-WebSocket-Origin"]=r.origin:r.headers.Origin=r.origin),(i.username||i.password)&&(r.auth=`${i.username}:${i.password}`),a){let h=r.path.split(":");r.socketPath=h[0],r.path=h[1]}let g;if(r.followRedirects){if(e._redirects===0){e._originalIpc=a,e._originalSecure=s,e._originalHostOrSocketPath=a?r.socketPath:i.host;let h=o&&o.headers;if(o={...o,headers:{}},h)for(let[y,x]of Object.entries(h))o.headers[y.toLowerCase()]=x}else if(e.listenerCount("redirect")===0){let h=a?e._originalIpc?r.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:i.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!s)&&(delete r.headers.authorization,delete r.headers.cookie,h||delete r.headers.host,r.auth=void 0)}r.auth&&!o.headers.authorization&&(o.headers.authorization="Basic "+Buffer.from(r.auth).toString("base64")),g=e._req=p(r),e._redirects&&e.emit("redirect",e.url,g)}else g=e._req=p(r);r.timeout&&g.on("timeout",()=>{vt(e,g,"Opening handshake has timed out")}),g.on("error",h=>{g===null||g[YE]||(g=e._req=null,Cu(e,h))}),g.on("response",h=>{let y=h.headers.location,x=h.statusCode;if(y&&r.followRedirects&&x>=300&&x<400){if(++e._redirects>r.maxRedirects){vt(e,g,"Maximum redirects exceeded");return}g.abort();let S;try{S=new fy(y,t)}catch{let _=new SyntaxError(`Invalid URL: ${y}`);Cu(e,_);return}QE(e,S,n,o)}else e.emit("unexpected-response",g,h)||vt(e,g,`Unexpected server response: ${h.statusCode}`)}),g.on("upgrade",(h,y,x)=>{if(e.emit("upgrade",h),e.readyState!==Ae.CONNECTING)return;g=e._req=null;let S=h.headers.upgrade;if(S===void 0||S.toLowerCase()!=="websocket"){vt(e,y,"Invalid Upgrade header");return}let E=SF("sha1").update(d+IF).digest("base64");if(h.headers["sec-websocket-accept"]!==E){vt(e,y,"Invalid Sec-WebSocket-Accept header");return}let _=h.headers["sec-websocket-protocol"],I;if(_!==void 0?m.size?m.has(_)||(I="Server sent an invalid subprotocol"):I="Server sent a subprotocol but none was requested":m.size&&(I="Server sent no subprotocol"),I){vt(e,y,I);return}_&&(e._protocol=_);let N=h.headers["sec-websocket-extensions"];if(N!==void 0){if(!f){vt(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let M;try{M=DF(N)}catch{vt(e,y,"Invalid Sec-WebSocket-Extensions header");return}let q=Object.keys(M);if(q.length!==1||q[0]!==br.extensionName){vt(e,y,"Server indicated an extension that was not requested");return}try{f.accept(M[br.extensionName])}catch{vt(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[br.extensionName]=f}e.setSocket(y,x,{allowSynchronousEvents:r.allowSynchronousEvents,generateMask:r.generateMask,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation})}),r.finishRequest?r.finishRequest(g,e):g.end()}function Cu(e,t){e._readyState=Ae.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function UF(e){return e.path=e.socketPath,KE.connect(e)}function jF(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=KE.isIP(e.host)?"":e.host),kF.connect(e)}function vt(e,t,n){e._readyState=Ae.CLOSING;let o=new Error(n);Error.captureStackTrace(o,vt),t.setHeader?(t[YE]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(Cu,e,o)):(t.destroy(o),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function vy(e,t,n){if(t){let o=EF(t)?t.size:NF(t).length;e._socket?e._sender._bufferedBytes+=o:e._bufferedAmount+=o}if(n){let o=new Error(`WebSocket is not open: readyState ${e.readyState} (${Wn[e.readyState]})`);process.nextTick(n,o)}}function zF(e,t){let n=this[De];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[De]!==void 0&&(n._socket.removeListener("data",Pu),process.nextTick(eA,n._socket),e===1005?n.close():n.close(e,t))}function FF(){let e=this[De];e.isPaused||e._socket.resume()}function MF(e){let t=this[De];t._socket[De]!==void 0&&(t._socket.removeListener("data",Pu),process.nextTick(eA,t._socket),t.close(e[PF])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function JE(){this[De].emitClose()}function BF(e,t){this[De].emit("message",e,t)}function HF(e){let t=this[De];t._autoPong&&t.pong(e,!this._isServer,XE),t.emit("ping",e)}function GF(e){this[De].emit("pong",e)}function eA(e){e.resume()}function WF(e){let t=this[De];t.readyState!==Ae.CLOSED&&(t.readyState===Ae.OPEN&&(t._readyState=Ae.CLOSING,tA(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function tA(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function nA(){let e=this[De];if(this.removeListener("close",nA),this.removeListener("data",Pu),this.removeListener("end",rA),e._readyState=Ae.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[De]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",JE),e._receiver.on("finish",JE))}function Pu(e){this[De]._receiver.write(e)||this.pause()}function rA(){let e=this[De];e._readyState=Ae.CLOSING,e._receiver.end(),this.end()}function oA(){let e=this[De];this.removeListener("error",oA),this.on("error",XE),e&&(e._readyState=Ae.CLOSING,this.destroy())}});var lA=ae((Nee,cA)=>{"use strict";var Dee=Tu(),{Duplex:ZF}=me("stream");function sA(e){e.emit("close")}function VF(){!this.destroyed&&this._writableState.finished&&this.destroy()}function aA(e){this.removeListener("error",aA),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function qF(e,t){let n=!0,o=new ZF({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(i,s){let a=!s&&o._readableState.objectMode?i.toString():i;o.push(a)||e.pause()}),e.once("error",function(i){o.destroyed||(n=!1,o.destroy(i))}),e.once("close",function(){o.destroyed||o.push(null)}),o._destroy=function(r,i){if(e.readyState===e.CLOSED){i(r),process.nextTick(sA,o);return}let s=!1;e.once("error",function(l){s=!0,i(l)}),e.once("close",function(){s||i(r),process.nextTick(sA,o)}),n&&e.terminate()},o._final=function(r){if(e.readyState===e.CONNECTING){e.once("open",function(){o._final(r)});return}e._socket!==null&&(e._socket._writableState.finished?(r(),o._readableState.endEmitted&&o.destroy()):(e._socket.once("finish",function(){r()}),e.close()))},o._read=function(){e.isPaused&&e.resume()},o._write=function(r,i,s){if(e.readyState===e.CONNECTING){e.once("open",function(){o._write(r,i,s)});return}e.send(r,s)},o.on("end",VF),o.on("error",aA),o}cA.exports=qF});var yy=ae((Lee,uA)=>{"use strict";var{tokenChars:JF}=gi();function KF(e){let t=new Set,n=-1,o=-1,r=0;for(r;r<e.length;r++){let s=e.charCodeAt(r);if(o===-1&&JF[s]===1)n===-1&&(n=r);else if(r!==0&&(s===32||s===9))o===-1&&n!==-1&&(o=r);else if(s===44){if(n===-1)throw new SyntaxError(`Unexpected character at index ${r}`);o===-1&&(o=r);let a=e.slice(n,o);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);t.add(a),n=o=-1}else throw new SyntaxError(`Unexpected character at index ${r}`)}if(n===-1||o!==-1)throw new SyntaxError("Unexpected end of input");let i=e.slice(n,r);if(t.has(i))throw new SyntaxError(`The "${i}" subprotocol is duplicated`);return t.add(i),t}uA.exports={parse:KF}});var vA=ae((jee,hA)=>{"use strict";var XF=me("events"),Ru=me("http"),{Duplex:Uee}=me("stream"),{createHash:YF}=me("crypto"),dA=Au(),Qr=fi(),QF=yy(),e4=Tu(),{CLOSE_TIMEOUT:t4,GUID:n4,kWebSocket:r4}=Bn(),o4=/^[+/0-9A-Za-z]{22}==$/,pA=0,mA=1,gA=2,by=class extends XF{constructor(t,n){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:t4,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:e4,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Ru.createServer((o,r)=>{let i=Ru.STATUS_CODES[426];r.writeHead(426,{"Content-Length":i.length,"Content-Type":"text/plain"}),r.end(i)}),this._server.listen(t.port,t.host,t.backlog,n)):t.server&&(this._server=t.server),this._server){let o=this.emit.bind(this,"connection");this._removeListeners=i4(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(r,i,s)=>{this.handleUpgrade(r,i,s,o)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=pA}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===gA){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(Ys,this);return}if(t&&this.once("close",t),this._state!==mA)if(this._state=mA,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Ys,this):process.nextTick(Ys,this);else{let n=this._server;this._removeListeners(),this._removeListeners=this._server=null,n.close(()=>{Ys(this)})}}shouldHandle(t){if(this.options.path){let n=t.url.indexOf("?");if((n!==-1?t.url.slice(0,n):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,n,o,r){n.on("error",fA);let i=t.headers["sec-websocket-key"],s=t.headers.upgrade,a=+t.headers["sec-websocket-version"];if(t.method!=="GET"){eo(this,t,n,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){eo(this,t,n,400,"Invalid Upgrade header");return}if(i===void 0||!o4.test(i)){eo(this,t,n,400,"Missing or invalid Sec-WebSocket-Key header");return}if(a!==13&&a!==8){eo(this,t,n,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){Qs(n,400);return}let l=t.headers["sec-websocket-protocol"],u=new Set;if(l!==void 0)try{u=QF.parse(l)}catch{eo(this,t,n,400,"Invalid Sec-WebSocket-Protocol header");return}let d=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&d!==void 0){let m=new Qr({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=dA.parse(d);f[Qr.extensionName]&&(m.accept(f[Qr.extensionName]),p[Qr.extensionName]=m)}catch{eo(this,t,n,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:t.headers[`${a===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(f,g,h,y)=>{if(!f)return Qs(n,g||401,h,y);this.completeUpgrade(p,i,u,t,n,o,r)});return}if(!this.options.verifyClient(m))return Qs(n,401)}this.completeUpgrade(p,i,u,t,n,o,r)}completeUpgrade(t,n,o,r,i,s,a){if(!i.readable||!i.writable)return i.destroy();if(i[r4])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>pA)return Qs(i,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${YF("sha1").update(n+n4).digest("base64")}`],d=new this.options.WebSocket(null,void 0,this.options);if(o.size){let p=this.options.handleProtocols?this.options.handleProtocols(o,r):o.values().next().value;p&&(u.push(`Sec-WebSocket-Protocol: ${p}`),d._protocol=p)}if(t[Qr.extensionName]){let p=t[Qr.extensionName].params,m=dA.format({[Qr.extensionName]:[p]});u.push(`Sec-WebSocket-Extensions: ${m}`),d._extensions=t}this.emit("headers",u,r),i.write(u.concat(`\r
|
|
5
5
|
`).join(`\r
|
|
6
|
-
`)),i.removeListener("error",
|
|
7
|
-
`+Object.keys(o).map(
|
|
6
|
+
`)),i.removeListener("error",fA),d.setSocket(i,s,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(d),d.on("close",()=>{this.clients.delete(d),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Ys,this)})),a(d,r)}};hA.exports=by;function i4(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let o of Object.keys(t))e.removeListener(o,t[o])}}function Ys(e){e._state=gA,e.emit("close")}function fA(){this.destroy()}function Qs(e,t,n,o){n=n||Ru.STATUS_CODES[t],o={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(n),...o},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${Ru.STATUS_CODES[t]}\r
|
|
7
|
+
`+Object.keys(o).map(r=>`${r}: ${o[r]}`).join(`\r
|
|
8
8
|
`)+`\r
|
|
9
9
|
\r
|
|
10
|
-
`+
|
|
11
|
-
`).map(t=>t.trim()).filter(Boolean))]}function
|
|
10
|
+
`+n)}function eo(e,t,n,o,r,i){if(e.listenerCount("wsClientError")){let s=new Error(r);Error.captureStackTrace(s,eo),e.emit("wsClientError",s,n,t)}else Qs(n,o,r,i)}});import{createHash as XT}from"node:crypto";import{chmodSync as Ix,mkdirSync as YT,readFileSync as QT,renameSync as eR,rmSync as Cx,writeFileSync as Px}from"node:fs";import tR from"node:os";import tt from"node:path";import bI from"node:os";import xI from"node:path";var ee=process.env.BRIDGE_SECRET_DIR||xI.join(bI.homedir(),".claude-bridge");import{existsSync as RI,readdirSync as OI,readFileSync as DI}from"node:fs";import NI from"node:os";import oo from"node:path";import{createHash as II}from"node:crypto";import{readFileSync as Cy,rmSync as CI}from"node:fs";import xr from"node:path";import{mkdirSync as kI,readFileSync as wI,renameSync as SI,rmSync as _I,writeFileSync as $I}from"node:fs";import EI from"node:path";function AI(e){return[...new Set(e.split(`
|
|
11
|
+
`).map(t=>t.trim()).filter(Boolean))]}function Mu(e){try{return AI(wI(e,"utf8"))}catch{return[]}}function Ay(e){let t=n=>{try{if(n.length===0){_I(e,{force:!0});return}kI(EI.dirname(e),{recursive:!0,mode:448});let o=`${e}.tmp`;$I(o,`${n.join(`
|
|
12
12
|
`)}
|
|
13
|
-
`,{mode:384}),TI(o,e)}catch{}};return{add(r){let o=su(e);o.includes(r)||t([...o,r])},remove(r){let o=su(e);o.includes(r)&&t(o.filter(n=>n!==r))}}}function xv(e,t){if(!t)return 0;let r=0;for(let o of su(e))try{t.delete(o),r++}catch{}return r}var jI=/^[A-Za-z0-9][A-Za-z0-9_.-]{0,79}$/;function mt(e){return jI.test(e)&&!e.includes("..")?e:`h_${LI("sha256").update(e,"utf8").digest("hex").slice(0,24)}`}function Ls(e){return ir.join(Q,"users",e)}function Ke(e){try{let t=JSON.parse(Buffer.from(e.split(".")[1]??"","base64url").toString("utf8"));return typeof t.sub=="string"&&t.sub?t.sub:null}catch{return null}}var ui=ir.join(Q,"active-user.json");function wv(){try{let e=JSON.parse(kv(ui,"utf8"));return typeof e.sub=="string"&&e.sub?e.sub:null}catch{return null}}var zI="layout-version.json";function on(){try{let e=JSON.parse(kv(ir.join(Q,zI),"utf8"));return typeof e.version=="number"&&Number.isFinite(e.version)?e.version:0}catch{return 0}}var sn=3;function Sv(e){if(!e||e.includes("/")||e.includes("\\")||e.includes("..")||e.includes("\0"))throw new Error(`unsafe credential segment: ${JSON.stringify(e)}`)}function xt(e){Sv(e);let t=Ls(e);return{accessFile:ir.join(t,"relay-access-token"),refreshFile:ir.join(t,"relay-refresh-token")}}function au(e,t){Sv(e);let r=ir.join(Ls(e),"providers"),o=xv(ir.join(r,".keyring-index"),t??null);return UI(r,{recursive:!0,force:!0}),o}var cu=e=>{try{return BI(e,"utf8").trim()||null}catch{return null}},sr="hub-endpoint.json",ZI=24,GI=new Set(["public","default","default user","all users","defaultapppool","administrator"]);function lu(e){if(!e)return null;try{let t=JSON.parse(e);return typeof t?.pid!="number"||typeof t?.port!="number"?null:{pid:t.pid,port:t.port,startedAt:typeof t.startedAt=="number"?t.startedAt:0,...typeof t.sub=="string"&&t.sub?{sub:t.sub}:{}}}catch{return null}}function WI(e){let o=e.readFile("/etc/wsl.conf")?.match(/^\s*root\s*=\s*(\S+)\s*$/m)?.[1]??"/mnt";return o.length>1&&o.endsWith("/")?o.slice(0,-1):o}function uu(e){let t=[],r=n=>{t.length<ZI&&!t.includes(n)&&t.push(n)},o=n=>!GI.has(n.toLowerCase());if(e.isWsl){let n=WI(e);for(let i of e.listDir(n).filter(s=>/^[a-zA-Z]$/.test(s))){let s=`${n}/${i}/Users`;o(e.userName)&&r(`${s}/${e.userName}`);for(let a of e.listDir(s))o(a)&&r(`${s}/${a}`)}return t}if(e.platform==="win32")for(let n of["\\\\wsl.localhost","\\\\wsl$"])for(let i of e.listDir(`${n}\\`)){let s=`${n}\\${i}\\home`;r(`${s}\\${e.userName}`);for(let a of e.listDir(s))r(`${s}\\${a}`)}return t}function VI(e){let t=e.isWsl?"/":"\\";return uu(e).map(r=>`${r}${t}.claude-bridge`)}function qI(e){let t=i=>lu(e.readFile(i.endsWith("\\")||i.endsWith("/")?`${i}${sr}`:`${i}${e.platform==="win32"?"\\":"/"}${sr}`)),r=e.env.BRIDGE_SECRET_DIR;if(r)return{dir:r,source:"env",beacon:t(r)};let o=t(e.secretDir);if(o&&e.pidAlive(o.pid))return{dir:e.secretDir,source:"local",beacon:o};let n=null;for(let i of VI(e)){let s=t(i);s&&(!n||s.startedAt>n.beacon.startedAt)&&(n={dir:i,beacon:s})}return n?{dir:n.dir,source:e.isWsl?"peer-wsl":"peer-windows",beacon:n.beacon}:{dir:e.secretDir,source:"local",beacon:null}}function _v(e,t,r){return t!=="linux"?!1:e.WSL_DISTRO_NAME||e.WSL_INTEROP?!0:/microsoft/i.test(r("/proc/version")??"")}function Gr(){return _v(process.env,process.platform,cu)}var Us=null;function Wr(e={}){if(Us&&!e.fresh)return Us;let t=n=>cu(n),r=n=>{try{return MI(n)}catch{return[]}},o="";try{o=HI.userInfo().username}catch{o=process.env.USER??process.env.USERNAME??""}return Us=qI({secretDir:Q,env:process.env,platform:process.platform,userName:o,isWsl:_v(process.env,process.platform,t),pidAlive:n=>{try{return process.kill(n,0),!0}catch(i){return i.code==="EPERM"}},readFile:t,listDir:r}),Us}function $v(e){return{hubTokenFile:Zr.join(e,"hub-token"),activeUserFile:Zr.join(e,"active-user.json"),sessionsDir:Zr.join(e,"sessions"),configFile:Zr.join(e,"config.json"),beaconFile:Zr.join(e,sr)}}function JI(e){let t=cu($v(e).activeUserFile);if(!t)return null;try{let r=JSON.parse(t);return typeof r.sub=="string"&&r.sub?r.sub:null}catch{return null}}function Iv(e){let t=JI(e);if(t){let r=Zr.join(e,"users",mt(t),"hub-token");if(FI(r))return r}return $v(e).hubTokenFile}function js(e){if(e?.isDevBuild!==!0)return!1;let t=e.env??process.env;return t.BRIDGE_VOICE==="1"||t.BRIDGE_VOICE==="true"}var Ev=e=>{let t=e?.subject?.CN;return typeof t=="string"?t:Array.isArray(t)?t[0]:void 0},Av=(e,t)=>typeof e=="string"&&e.toLowerCase()===t.toLowerCase();var m4=256*1024;import{readFileSync as KI}from"node:fs";import di from"node:path";var XI=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;function du(e){if(typeof e!="string")return{kind:"invalid"};let t=XI.exec(e);return t?t[1]==="0"&&t[2]==="0"&&t[3]==="0"?{kind:"dev"}:{kind:"release",version:e}:{kind:"invalid"}}function Pv(e){let t=du(e);return t.kind==="release"?t.version:null}function Lt(e=process.env,t=process.argv){let r=du(e.BRIDGE_CLIENT_VERSION);if(r.kind==="release")return r.version;if(r.kind==="dev")return null;let o=di.join(Q,"payload"),n=t[1];if(!n)return null;let i=di.relative(o,di.resolve(n));if(i===""||i.startsWith("..")||di.isAbsolute(i))return null;try{let s=JSON.parse(KI(di.join(o,"version.json"),"utf8")),a=du(s.version);return a.kind==="release"?a.version:null}catch{return null}}import{readdirSync as YI}from"node:fs";import QI from"node:path";var ar=class extends Error{constructor(r,o){super(r);this.status=o;this.name="RelayError"}status},eE=e=>e.replace(/\/+$/,"");async function pu(e,t,r,o){return fetch(`${eE(e)}${t}`,{method:"POST",headers:{"content-type":"application/json",...o?{authorization:`Bearer ${o}`}:{}},body:r===void 0?void 0:JSON.stringify(r)})}async function Cv(e,t){let r=await pu(e,"/node/provision",{},t);if(!r.ok)throw new ar(`provision failed (${r.status}): ${(await r.text().catch(()=>"")).slice(0,200)}`,r.status);let o=await r.json().catch(()=>({}));if(typeof o.claim_code!="string")throw new ar("provision returned no claim_code",r.status);return o.claim_code}async function Tv(e,t){let r=await pu(e,"/node/claim",{claim_code:t});if(!r.ok)throw new ar(`pairing failed (${r.status}): ${(await r.text().catch(()=>"")).slice(0,200)}`,r.status);return await r.json()}async function tE(e,t){let r=await pu(e,"/node/token",void 0,t);if(!r.ok)throw new ar(`refresh rejected (${r.status})`,r.status);return await r.json()}function mu(e,t={}){let r=t.log??(l=>console.warn(l)),o=Ke(e.refresh_token),n=Ke(e.access_token),i=o??n;if(o&&n&&o!==n&&r(`credential: access-token sub (${n}) differs from refresh-token sub (${o}) \u2014 trusting the refresh sub (the refresh loop re-mints the access token)`),!i)throw new Error("credential: refusing to persist an unattributable token pair (no decodable sub in refresh or access token)");let s=mt(i),a=xt(s);return ke(a.refreshFile,e.refresh_token),ke(a.accessFile,e.access_token),{sub:i,segment:s}}var nE="__none__";function we(){let e=wv();if(e)return xt(mt(e));let[t,r]=ft();return t&&!r?xt(t.segment):xt(nE)}function Rv(e){let t;try{t=YI(QI.join(Q,"users"),{withFileTypes:!0})}catch{return[]}let r=[];for(let o of t){if(!o.isDirectory())continue;let n;try{n=xt(o.name)}catch{continue}let i=N(n.refreshFile),s=i?Ke(i):null;if(e){if(!s)continue;r.push({sub:s,segment:o.name});continue}let a=s?null:N(n.accessFile),l=s??(a?Ke(a):null);l&&r.push({sub:l,segment:o.name})}return r}function ft(){return Rv(!1)}function Ov(){return Rv(!0)}function rE(e=we()){return N(e.refreshFile)}function pi(e=we()){ve(e.accessFile),ve(e.refreshFile)}function oE(e=we()){let t=N(e.accessFile);if(!t)return null;try{let r=JSON.parse(Buffer.from(t.split(".")[1]??"","base64url").toString());return typeof r.exp=="number"?r.exp-Math.floor(Date.now()/1e3):null}catch{return null}}async function Ut(e,t=60,r,o=we()){let n=oE(o);if(n!==null&&n>t)return!0;let i=rE(o);if(!i)return n!==null&&n>0;try{return mu(await tE(e,i)),!0}catch(s){return r?.(`token refresh failed: ${s instanceof Error?s.message:String(s)}`),s instanceof ar&&(s.status===400||s.status===401)&&pi(o),!1}}function fu(e){return e==="node_superseded"?"This machine was unpaired when AC Bridge was set up on another computer \u2014 only one machine can be paired at a time. Sign in again here (`acbridge login`, or the app) to take the pairing back.":e==="node_revoked"?"This machine's pairing has been revoked. Sign in again (`acbridge login`, or the app) to set it up again.":null}import gu from"node:path";function hu(e){if(!e)return!1;try{return e.available()}catch{return!1}}function vu(e){return hu(e)?"keyring":"file"}function iE(e){let{file:t,account:r}=e,o=()=>N(t);return{backend(){return vu(e.keyring)},read(){if(hu(e.keyring))try{let n=e.keyring.get(r);if(n!==null)return n;let i=o();if(i===null)return null;try{e.keyring.set(r,i),ve(t),e.index?.add(r)}catch{}return i}catch{}return o()},write(n){if(hu(e.keyring))try{e.keyring.set(r,n),ve(t),e.index?.add(r);return}catch{}ke(t,n,384)},delete(){if(e.keyring){try{e.keyring.delete(r)}catch{}e.index?.remove(r)}ve(t)}}}function cr(e,t,r){let o=e.providerSecretFile(t,r);return iE({keyring:mi(),file:o,account:`${t}/${r}`,index:bv(gu.join(gu.dirname(gu.dirname(o)),".keyring-index"))})}var sE="AC Bridge",Nn,aE=new Set(["win32","darwin"]);function mi(e={}){if(Nn!==void 0)return Nn;Nn=null;let t=e.require??null;if(!aE.has(e.platform??process.platform))return Nn;try{let r=t??cE();if(!r)return Nn;let{Entry:o}=r("@napi-rs/keyring"),n=i=>new o(sE,i);Nn={available(){try{return n("__acb_probe__").getPassword(),!0}catch{return!1}},get:i=>n(i).getPassword(),set:(i,s)=>n(i).setPassword(s),delete:i=>{n(i).deletePassword()}}}catch{Nn=null}return Nn}function cE(){try{return typeof ue=="function"?ue:null}catch{return null}}import{spawnSync as lE}from"node:child_process";import{existsSync as uE}from"node:fs";import dE from"node:os";import Dv from"node:path";function zs(e){if(e==="win32"){let r="irm https://claude.ai/install.ps1 | iex";return{file:"powershell",args:["-NoProfile","-ExecutionPolicy","Bypass","-Command",r],manualCommand:r,altCommands:["winget install Anthropic.ClaudeCode"]}}let t="curl -fsSL https://claude.ai/install.sh | bash";return{file:"sh",args:["-c",t],manualCommand:t,altCommands:[]}}function Nv(e,t){if(e==="win32"){let o=Dv.win32;return[o.join(t,".local","bin","claude.exe"),o.join(t,".claude","local","claude.exe")]}let r=Dv.posix;return[r.join(t,".local","bin","claude"),r.join(t,".claude","local","claude"),"/opt/homebrew/bin/claude","/usr/local/bin/claude"]}var Lv=/\.(cmd|bat)$/i,pE=/^\/mnt\/[a-z]\//i;function Uv(e){let t=e.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(t.length===0)return null;let r=t.filter(s=>!pE.test(s)),o=r.length>0?r:t,n=o.find(s=>/\.exe$/i.test(s));if(n)return n;let i=o.find(s=>Lv.test(s));return i||(o[0]??null)}function Fs(e){return Lv.test(e)?{file:"cmd.exe",argsPrefix:["/c",e]}:{file:e,argsPrefix:[]}}function jv(e){let r=lE(e,e==="which"?["-a","claude"]:["claude"],{encoding:"utf8"});return{status:r.status??1,stdout:r.stdout??""}}function zv(e,t){let r=t.home??dE.homedir(),o=t.fileExists??uE;for(let n of Nv(e,r))if(o(n))return n;return null}function an(e,t={}){let r=e?.trim();if(r)return Fs(r);let o=t.platform??process.platform,n=t.runFinder??jv,i=o==="win32"?"where":"which";try{let a=n(i);if(a.status===0){let l=Uv(a.stdout);if(l)return Fs(l)}}catch{}let s=zv(o,t);return Fs(s||"claude")}function Ms(e,t={}){if(e?.trim())return!0;let r=t.platform??process.platform,o=t.runFinder??jv;try{let n=o(r==="win32"?"where":"which");if(n.status===0&&Uv(n.stdout)!==null)return!0}catch{}return zv(r,t)!==null}import{spawnSync as mE}from"node:child_process";import{existsSync as Fv,readdirSync as fE}from"node:fs";import Mv from"node:os";import Hs from"node:path";var Bv=/\.(cmd|bat)$/i,gE=/^\/mnt\/[a-z]\//i;function hE(e){let t=e.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(t.length===0)return null;let r=t.filter(s=>!gE.test(s)),o=r.length>0?r:t,n=o.find(s=>/\.exe$/i.test(s));if(n)return n;let i=o.find(s=>Bv.test(s));return i||(o[0]??null)}function Bs(e){return Bv.test(e)?{file:"cmd.exe",argsPrefix:["/c",e]}:{file:e,argsPrefix:[]}}function vE(e,t,r=[]){if(e==="win32"){let n=Hs.win32;return[n.join(t,"AppData","Roaming","npm","codex.cmd"),n.join(t,"AppData","Roaming","npm","codex.exe"),n.join(t,".local","bin","codex.exe")]}let o=Hs.posix;return[...[...r].sort().reverse().map(n=>o.join(t,".nvm","versions","node",n,"bin","codex")),"/opt/homebrew/bin/codex","/usr/local/bin/codex",o.join(t,".local","bin","codex")]}function yE(e){try{return fE(Hs.posix.join(e,".nvm","versions","node"))}catch{return[]}}function bE(e,t){let r=t.home??Mv.homedir(),o=t.fileExists??Fv,n=e==="win32"?[]:(t.nodeVersions??yE)(r);for(let i of vE(e,r,n))if(o(i))return i;return null}function xE(e){let r=mE(e,e==="which"?["-a","codex"]:["codex"],{encoding:"utf8"});return{status:r.status??1,stdout:r.stdout??""}}function Vr(e,t={}){let r=e?.trim();if(r)return Bs(r);let o=t.platform??process.platform,n=t.runFinder??xE,i=o==="win32"?"where":"which";try{let a=n(i);if(a.status===0){let l=hE(a.stdout);if(l)return Bs(l)}}catch{}let s=bE(o,t);return Bs(s||"codex")}function Zs(e){let t=e?.home??Mv.homedir();return Fv(Hs.join(t,".codex","auth.json"))}import{spawnSync as kE}from"node:child_process";import{readFileSync as Hv}from"node:fs";import Zv from"node:path";function wE(e){try{let t=Number(Hv(e,"utf8").trim());return Number.isInteger(t)&&t>0?t:null}catch{return null}}function SE(e){kE("pkill",["-f",e])}function _E(){try{return lu(Hv(Zv.join(Q,sr),"utf8"))?.pid??null}catch{return null}}function Gv(e={}){let t=e.platform??process.platform,r=e.pidFile??fi,o=e.readPid??wE,n=e.readBeaconPid??_E,i=e.kill??(l=>process.kill(l)),s=e.sweep??SE,a=o(r);if(a!==null&&n()===a)try{i(a)}catch{}if(t!=="win32"){for(let l of e.sweepPatterns??[])if(Zv.isAbsolute(l))try{s(l)}catch{}}}import{accessSync as $E,constants as IE,mkdtempSync as EE,readFileSync as AE,writeFileSync as Wv}from"node:fs";import PE from"node:os";import Gs from"node:path";var je="bridge",Xe="alexa";function lr(e=process.platform){switch(e){case"darwin":return"/Library/Application Support/ClaudeCode/managed-settings.json";case"win32":return"C:\\Program Files\\ClaudeCode\\managed-settings.json";default:return"/etc/claude-code/managed-settings.json"}}function Vv(e,t=!1){let r={...e};if(t){r.channelsEnabled=!0;let o={marketplace:je,plugin:Xe},n=Array.isArray(e.allowedChannelPlugins)?[...e.allowedChannelPlugins]:[];n.some(i=>i.marketplace===o.marketplace&&i.plugin===o.plugin)||n.push(o),r.allowedChannelPlugins=n}return r}function qr(e){return`'${e.replace(/'/g,"'\\''")}'`}function Jr(e){return`"${e}"`}function CE(e){return`'${e.replace(/'/g,"''")}'`}function TE(e,t,r){return`mkdir -p ${qr(e)} && install -m 0644 ${qr(t)} ${qr(r)}`}function bu(e,t){return(e==="win32"?Gs.win32:Gs.posix).dirname(t)}function RE(e,t,r){let o=bu(e,r);return e==="win32"?`md ${Jr(o)} 2>nul & copy /y ${Jr(t)} ${Jr(r)}`:TE(o,t,r)}function OE(e,t){return e==="darwin"?[{method:"osascript",file:"osascript",args:["-e",`do shell script "${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}" with administrator privileges`]}]:e==="win32"?[{method:"uac",file:"powershell",args:["-NoProfile","-Command",`Start-Process -Verb RunAs -Wait -FilePath cmd.exe -ArgumentList '/c',${CE(t)}`]}]:[{method:"pkexec",file:"pkexec",args:["sh","-c",t]},{method:"sudo",file:"sudo",args:["sh","-c",t]}]}function qv(e,t,r){return OE(e,RE(e,t,r))}function Jv(e,t,r){let o=bu(e,r);return e==="win32"?`md ${Jr(o)} & copy /y ${Jr(t)} ${Jr(r)}`:`sudo mkdir -p ${qr(o)} && sudo install -m 0644 ${qr(t)} ${qr(r)}`}function DE(e){try{return AE(e,"utf8")}catch{return""}}function NE(e){try{return $E(e,IE.W_OK),!0}catch{return!1}}function LE(e,t){Wv(e,t,{mode:420})}function UE(e,t,r){let o=t(e),n={};try{n=JSON.parse(o)}catch{}let i=Vv(n,r),s=JSON.stringify(i,null,2)+`
|
|
14
|
-
`;return!
|
|
15
|
-
${Jv(t,f,r)}`)}var xu={udpDstFixed:[4002,6666,6667],udpDstMulticast:[5353],udpSrcBroadcastReply:[9999,20002,38899,56700,1900,1982]},gi=[...xu.udpDstFixed,...xu.udpDstMulticast],hi=xu.udpSrcBroadcastReply;function Xv(e){return e==="app"?"AC Bridge (App)":"AC Bridge (CLI)"}var ku=["domain","private"],Yv="AC Bridge discovery",Qv="AC Bridge replies",jE="macOS will still show one 'Local Network' permission prompt on your first scan \u2014 that prompt cannot be pre-granted; click Allow.";function Kr(e){return/you need to be root|need(?:s)? to be root|must be run as root|requires? (?:super\s?user|root)|operation not permitted|permission denied|are you root/i.test(e)}function ur(e,t,r={}){if(e==="win32")return"windows";let o=r.isWsl??Gr();if(e==="linux"&&o)return"wsl-host";if(e==="darwin"){let i=t.alfGlobalStateOut??"";return/firewall is enabled/i.test(i)||Kr(i)?"macos-alf":"none"}let n=t.ufwStatusOut??"";return/status:\s*active/i.test(n)?"ufw":(t.firewallCmdStateOut??"").trim()==="running"?"firewalld":Kr(n)?"ufw":"none"}function Ws(e,t){if(e==="win32")return{};if(e==="darwin")return{alfGlobalStateOut:t("/usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate")};let r=t("ufw status");return/status:\s*active/i.test(r)?{ufwStatusOut:r}:{ufwStatusOut:r,firewallCmdStateOut:t("firewall-cmd --state")}}function zE(e,t){if(e.length===0)return{state:"nothing-to-do"};let r=e.map((s,a)=>e.length>1?`${t} (${a+1})`:t),n=e.map((s,a)=>{let l=r[a];return`netsh advfirewall firewall delete rule name="${l}" >nul 2>&1 & netsh advfirewall firewall add rule name="${l}" dir=in action=allow program="${s}" protocol=udp profile=${ku.join(",")} remoteip=localsubnet enable=yes`}).join(" & "),i=r.map(s=>`netsh advfirewall firewall show rule name="${s}" verbose`);return{applyScript:n,checkCommands:i,evalCheck:s=>s.every((a,l)=>HE(a,e[l])),manualCommand:n,needsElevation:!0}}function FE(e){if(e.length===0)return{state:"nothing-to-do"};let t=e.flatMap(o=>[`/usr/libexec/ApplicationFirewall/socketfilterfw --add "${o}"`,`/usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp "${o}"`]),r=e.map(o=>`/usr/libexec/ApplicationFirewall/socketfilterfw --getappblocked "${o}"`);return{applyScript:t.join(" && "),checkCommands:r,evalCheck:o=>o.every((n,i)=>GE(n,e[i])),manualCommand:t.map(o=>`sudo ${o}`).join(" && "),needsElevation:!0,userNote:jE}}function ME(){let e=gi.join(","),t=hi.join(","),r=`ufw allow in proto udp to any port ${e} comment '${Yv}'`,o=`ufw allow in proto udp from any port ${t} comment '${Qv}'`;return{applyScript:`${r} && ${o}`,checkCommands:["ufw status"],evalCheck:n=>WE(n[0]??""),manualCommand:`sudo ${r} && sudo ${o}`,needsElevation:!0}}function BE(){let e=gi.map(o=>`firewall-cmd --permanent --add-port=${o}/udp`),t=hi.map(o=>`firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source-port port="${o}" protocol="udp" accept'`),r=[...e,...t,"firewall-cmd --reload"];return{applyScript:r.join(" && "),checkCommands:["firewall-cmd --list-ports","firewall-cmd --list-rich-rules"],evalCheck:o=>VE(o[0]??"",gi)&&qE(o[1]??"",hi),manualCommand:r.map(o=>`sudo ${o}`).join(" && "),needsElevation:!0}}function Vs(e,t){switch(e){case"windows":return zE(t.programs,t.ruleName);case"macos-alf":return FE(t.programs);case"ufw":return ME();case"firewalld":return BE();case"wsl-host":return{state:"nothing-to-do"};case"none":return{state:"nothing-to-do"}}}var wu="You're running inside WSL, so LAN device discovery is governed by the WINDOWS firewall on the host, not by ufw/firewalld inside this distro \u2014 changing those here has no effect on scanning. If scanning misses devices, allow the bridge through Windows Defender Firewall on the Windows side (and check that the network is set to Private, not Public).";function HE(e,t){if(/no rules match/i.test(e))return!1;let r=/Enabled:\s*Yes/i.test(e),n=/Program:\s*(.+)/i.exec(e)?.[1]?.trim().toLowerCase();return r&&n===t.trim().toLowerCase()}function ey(e){let t=[],r=/^(Domain|Private|Public) Profile Settings:/gim,o,n=[];for(;(o=r.exec(e))!==null;)n.push({profile:o[1].toLowerCase(),at:o.index});for(let i=0;i<n.length;i++){let s=e.slice(n[i].at,n[i+1]?.at??e.length);t.push({profile:n[i].profile,firewallOn:!/^\s*State\s+OFF/im.test(s)})}return t}function ZE(e,t=ku){let r=new Set(t.map(o=>o.toLowerCase()));return e.filter(o=>o.firewallOn&&!r.has(o.profile)).map(o=>o.profile)}function ty(e,t){let r=t.toLowerCase(),o=new Set;for(let n of e.split(/^Rule Name:/m).slice(1)){let i=s=>new RegExp(`^${s}:\\s*(.*)$`,"m").exec(n)?.[1]?.trim()??"";if(i("Program").toLowerCase()===r&&/^yes$/i.test(i("Enabled"))&&/^in$/i.test(i("Direction"))&&/^allow$/i.test(i("Action")))for(let s of i("Profiles").split(",")){let a=s.trim().toLowerCase();(a==="domain"||a==="private"||a==="public")&&o.add(a)}}return[...o]}function ny(e,t=ku){if(ZE(e,t).length!==0)return"This network is set to Public, and the LAN-discovery rule only covers Domain and Private networks \u2014 so Windows is still dropping the replies device scanning needs. In Settings \u2192 Network & internet, open this network and set its profile to Private, then scan again."}function GE(e,t){return e.includes(t)&&/is not blocked/i.test(e)}function WE(e){return/status:\s*active/i.test(e)&&e.includes(Yv)&&e.includes(Qv)}function VE(e,t){return t.every(r=>e.includes(`${r}/udp`))}function qE(e,t){return t.every(r=>e.includes(`source-port port="${r}"`))}function ry(e){let{platform:t,programs:r,ruleName:o,runElevated:n,runCheck:i}=e,s=e.isWsl===void 0?{}:{isWsl:e.isWsl};if(ur(t,{},s)==="wsl-host")return{backend:"wsl-host",status:"nothing-to-do",changed:!1,userNote:wu};let l=ur(t,Ws(t,i),s);if(l==="none")return{backend:l,status:"nothing-to-do",changed:!1};let u=Vs(l,{programs:r,ruleName:o});if("state"in u)return{backend:l,status:"nothing-to-do",changed:!1};let d=u.checkCommands.map(i);if(u.evalCheck(d))return{backend:l,status:"unchanged",changed:!1,userNote:u.userNote};let p=d.some(Kr);n(u.applyScript);let m=u.checkCommands.map(i);return u.evalCheck(m)?{backend:l,status:"changed",changed:!0,userNote:u.userNote}:p||m.some(Kr)?{backend:l,status:"changed",changed:!0,userNote:JE(u)}:{backend:l,status:"needs-elevation",changed:!1,manualCommand:u.manualCommand,userNote:u.userNote}}function JE(e){let t=`Added the LAN-discovery firewall rule, but couldn't verify it without root. If device scanning still misses devices, re-run: ${e.manualCommand}`;return e.userNote?`${e.userNote} ${t}`:t}function KE(e,t){switch(e){case"windows":return t.programs.length===0?null:t.programs.map((o,n)=>t.programs.length>1?`${t.ruleName} (${n+1})`:t.ruleName).map(o=>`netsh advfirewall firewall delete rule name="${o}" >nul 2>&1`).join(" & ");case"macos-alf":return t.programs.length===0?null:t.programs.map(r=>`/usr/libexec/ApplicationFirewall/socketfilterfw --remove "${r}"`).join(" && ");case"ufw":return`ufw delete allow in proto udp to any port ${gi.join(",")} && ufw delete allow in proto udp from any port ${hi.join(",")}`;case"firewalld":return[...gi.map(r=>`firewall-cmd --permanent --remove-port=${r}/udp`),...hi.map(r=>`firewall-cmd --permanent --remove-rich-rule='rule family="ipv4" source-port port="${r}" protocol="udp" accept'`),"firewall-cmd --reload"].join(" && ");case"wsl-host":case"none":return null}}function oy(e){let{platform:t,programs:r,ruleName:o,runElevated:n,runCheck:i}=e,s=e.isWsl===void 0?{}:{isWsl:e.isWsl};if(ur(t,{},s)==="wsl-host")return{backend:"wsl-host",status:"nothing-to-do",changed:!1};let a=ur(t,Ws(t,i),s);if(a==="none")return{backend:a,status:"nothing-to-do",changed:!1};let l=Vs(a,{programs:r,ruleName:o}),u=KE(a,{programs:r,ruleName:o});if("state"in l||u===null)return{backend:a,status:"nothing-to-do",changed:!1};let d=l.checkCommands.map(i);if(!l.evalCheck(d)&&!d.some(Kr))return{backend:a,status:"unchanged",changed:!1};n(u);let p=l.checkCommands.map(i);if(!l.evalCheck(p)||p.some(Kr))return{backend:a,status:"changed",changed:!0};let m=t==="win32"?u:u.split(" && ").map(f=>`sudo ${f}`).join(" && ");return{backend:a,status:"needs-elevation",changed:!1,manualCommand:m}}import{spawnSync as XE}from"node:child_process";import{existsSync as YE,readFileSync as qs,readdirSync as QE}from"node:fs";import{homedir as eA}from"node:os";import{join as kt,resolve as tA}from"node:path";var sy=()=>kt(eA(),".claude","plugins"),iy=e=>{let t=tA(e).replace(/[/\\]+$/,"");return process.platform==="win32"||process.platform==="darwin"?t.toLowerCase():t};function ay(){try{let t=JSON.parse(qs(kt(sy(),"known_marketplaces.json"),"utf8"))?.[je]?.source;return typeof t?.path=="string"?t.path:null}catch{return null}}function _u(){try{let t=JSON.parse(qs(kt(sy(),"installed_plugins.json"),"utf8"))?.plugins?.[`${Xe}@${je}`]?.[0];return typeof t?.installPath=="string"?t.installPath:null}catch{return null}}var Su=(e,t)=>{try{return qs(e,"utf8")===qs(t,"utf8")}catch{return!1}};function nA(){return["hooks/hooks.json",".mcp.json"]}function rA(e){let t=_u();if(!t)return!1;let r=kt(e,"plugins",Xe);for(let i of nA())if(!Su(kt(r,i),kt(t,i)))return!1;let o=kt(r,"dist","channel.mjs");if(YE(o)&&!Su(o,kt(t,"dist","channel.mjs")))return!1;let n;try{n=QE(kt(r,"scripts"))}catch{return!1}return n.every(i=>Su(kt(r,"scripts",i),kt(t,"scripts",i)))}function cy(e){return t=>{let r=XE(e.file,[...e.argsPrefix,...t],{encoding:"utf8"});return{ok:r.status===0,out:`${r.stdout??""}${r.stderr??""}${r.error?r.error.message:""}`}}}function ly(e){let t=cy(e.claudeCmd),r=(e.installedDir??_u)(),o=(e.registeredDir??ay)(),n=r!==null&&t(["plugin","uninstall",`${Xe}@${je}`]).ok,i=o!==null&&t(["plugin","marketplace","remove",je]).ok;return{pluginUninstalled:n,marketplaceRemoved:i}}function uy(e){let{marketplaceDir:t,claudeCmd:r}=e,o=cy(r),n=ay(),i=!1;if(n===null||iy(n)!==iy(t)){n!==null&&o(["plugin","marketplace","remove",je]);let a=o(["plugin","marketplace","add",t]);if(!a.ok)throw new Error(`marketplace add failed:
|
|
16
|
-
${a.out}`);i=!0}let s=!1;if(i||!
|
|
17
|
-
${a.out}`);s=!0}return{marketplaceRepointed:i,pluginReinstalled:s}}import{mkdirSync as
|
|
18
|
-
`;try{if(
|
|
19
|
-
|
|
20
|
-
`,384),o}import{createHash as ZA,randomBytes as Uy}from"node:crypto";var Pu=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");function jy(){let e=Pu(Uy(32)),t=Pu(ZA("sha256").update(e).digest());return{verifier:e,challenge:t}}function zy(){return Pu(Uy(24))}var GA="https://api.workos.com";var WA="client_01KW2CY31D0NZKCDKNHF2XQ7VC",VA="org_01KW0DNZ14H6JMK8RHA0WSKNVZ";function Fy(e=t=>process.env[t]){let t=e("WORKOS_CLIENT_ID")??WA,r=Number(e("WORKOS_REDIRECT_PORT")??8765)||8765,o=(e("WORKOS_API_HOST")??GA).replace(/\/+$/,""),n=e("WORKOS_REDIRECT_URI")??`http://127.0.0.1:${r}/callback`;return{clientId:t,apiHost:o,redirectUri:n,port:r,organizationId:e("WORKOS_ORG_ID")??VA,configured:!!t}}var qA={google:"GoogleOAuth",github:"GitHubOAuth",microsoft:"MicrosoftOAuth"},ea=class extends Error{constructor(r,o){super(o);this.kind=r;this.name="AuthError"}kind};function ta({cfg:e,opts:t,state:r,codeChallenge:o}){let n=new URL(`${e.apiHost}/user_management/authorize`),i=n.searchParams;return i.set("response_type","code"),i.set("client_id",e.clientId),i.set("redirect_uri",e.redirectUri),i.set("state",r),i.set("code_challenge",o),i.set("code_challenge_method","S256"),t.provider==="google"||t.provider==="github"||t.provider==="microsoft"?i.set("provider",qA[t.provider]):(i.set("provider","authkit"),t.screenHint&&i.set("screen_hint",t.screenHint),t.provider==="sso"&&e.organizationId&&i.set("organization_id",e.organizationId),t.email&&i.set("login_hint",t.email)),n.toString()}function JA(e){return{id:e.id,email:e.email,firstName:e.first_name,lastName:e.last_name,profilePictureUrl:e.profile_picture_url}}async function KA(e,t,r){try{return await r(`${e.apiHost}/user_management/authenticate`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_id:e.clientId,...t})})}catch(o){throw new ea("network",o instanceof Error?o.message:"Network error reaching WorkOS.")}}async function XA(e,t,r){let o=await KA(e,t,r),n=await o.text().catch(()=>"");if(!o.ok)throw new ea("rejected",`WorkOS ${o.status}: ${YA(n)}`);let i=JSON.parse(n);return{user:JA(i.user),accessToken:i.access_token,refreshToken:i.refresh_token}}function My(e,t,r,o=fetch){return XA(e,{grant_type:"authorization_code",code:t,code_verifier:r},o)}function YA(e){try{let t=JSON.parse(e);return t.error_description??t.message??t.error??e.slice(0,200)}catch{return e.slice(0,200)||"request failed"}}import{createServer as oP}from"node:http";var Qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAD9CAYAAABTCakVAAA+DElEQVR42u1dd7wdVfFP6L0pTUoABZGqIB1CBAICQghpgCACIQgo6E8RUEKNoCDFghCUngoSVARBQoBEaSKELkoHAUFqSPLevbs7vz3cOb5z550yZ+/e93bvnj/m85LbdveU75nynZkBADAgSJAg1ZQwCEGCBAAIUlJZNJV1U9k2leGpHJbK91P5TSrTU7kjlRdTeT+Vhal0p1JHiZR/C+lK5YNUnk/lIfzuTalMTuWXqXwzlRGp7JHKZ1JZPIx/AIAgfSNLp7JbKl9L5XLcmC/ipq7hxu7Cvwvx32KDx7i5Y0US5W+i/D/WfE6CRE25Tg1fE//+MJV/Idj8NJWvprJXKiuGOQsAECSbLJ/KvqmcmcqMVN5UTmwpiWZDS4kMr9PvJBoQcL2u/k5kAA8JHP9J5XepTEhl71SWCHMbACBIb1kfT06htv9TObEj8ld3gseWUzxhfIcrLgDRaRQR0UKEVjI7lXNT2RO1mjD/AQAqJ+IkPCiVSam8ihukptjisWXzuTZjbPl+3hIzNAodeMnnXJDKozgOh6eySlgbAQA6VdZJ5RhUiRcqKr3tpE4YQBAZQCE2gELcwkZPmKaES/OINc8gAHA+mjzjUvlkWDMBAMosn0CPvPCeP6ac8DFRjxOGeh47bHGfU7mV0z7JYErEjN+i5o50OArt4LJUxiCAhnUVAKDQMjCVoRg2W6g5nblqeZzRNk+Ym1+8Dxk3fxatwgVgNr+F6vi8FSMMi4S1FgCgSCLi8Gen8pISMos04TfI4cT0OZld1wNozfbPw88QM8yMmDgTX0nlrFTWCmsvAEB/EnBGp3IXcd6Z4ul5ONVsm76dTr/Y42TP8l2T38IU6pTgKrSs36YyBLWvsC4DAPSJmj8OvfcR8XKbNnTUYijO9p3IQejhnN6tOgFjyO4ETCwbPbGAKvWlCDLSiaksFdZoAIB2yOLoxX9GUfFdaisNg0EG1TpxgEfEDAXqfg8yqvxxBhMlZpgtNm6DbWwjJarybCpHBZpyAIC8ZMlUvqfE613U2azEGd1nIaeTOWaYDe0yEbjhQpcJYHIWRobXXsGciEA2CgCQmazzbdz4NQ0FN3FQbaknuxWnWWRQ9yWpJnFsklY2MUcLyeIHcAFXFqG/LcbmjVROChpBAACurJTKaam8rsmaa3WxZnUAxuDnjc8rxOgr0AIPgKMB+DgQqcPwDeRkfDqs8QAAOhHOo9MxbTYyeJ5jhvoaW2xV7gkaA98J6Lpeqw5An1i+Dgg4Dj+OEzDxAFnbs3dh1uLKYc0HAJByOKbWdms2D01q4XiubTx4zsbgpuq6Tr88Tn3XaZvVqcl9Bs64+mhXkpH5VionYDg3AEBFZQdoFL6IDIvK5M3P4gRsxRa3/XakkTqJVNQNn7P9hqo+14k5FFl+z9dM4ZgAEUPb0WlsLjMrRuD/cgCAasmKmHpbJ4s9Ypw4rhPMFqvmbmrXe+rG7Fb486JuwKxUrk/lJ6kcm8pIaBQS+RzmJ7hotAPRASpqEmwAjeo/e+LviPDa+Uh1vg3t6roCOImn6dKKBpB4Oj1ddOObUxkUAKDzZTcMEdUZarqNzBNnVNu54TAdgIh/z0vl9lSuwQ05GDdrf3m5F0tlM0zY+TU0yoh9BM3VhGynNjf27wMeiQVUIsP91PC+T4GKFS6pEoPvuxY731VIw+VY82X6xZpQX0ROd7Eo70vlEmjUD/hsicZ7TWjUKDwbk3i68HlisFc1ckUKErKJI+BXPeJEWsQ9/qVKeQZVeEixcf4KPXXyIsbm57zPobuakoHod2tKost1qRzaYTnxK6AZIUJxTxv8LlwWYpYcBI45kijzIMqZfS0AQPkTds6ARuWZmkEd5XjZIyb1l2NzUqebSGj5YypHp7JxhVRPWSDlD4p2QB2QrRCBXCaAaa7qxJEqCrisEQCgfCKKaj5l8G5zNr6PeeBagJSv/g90pu0KoVCmrHi8OzounyYRh9ihsXFCnjFT09CZF0LeSWU8+loCAJSAu389OVHqHqE+HycgJ1NNXltQin+cyoZhwztlA2RjPkfGkGuy2cwzFylLt0YkIL2cyk4BAIory6AXmtbbizRkHl+GmcleNYGKDNFNwzBayFfP5rj9MppI3QbzIAIeNyO2mHEmDUAnwlw5IABA8UR0qnmCbH4TAEQWGz9h2I6xIzVVLJILUvlU2MS5agW/UYDAh2XJIRu5AF2+JxuwfCMAQHFkWCrvWSiiNB6dWMJKJvtdx56jav6b6HQM5a3b20PhYujpiOTiGiSO9OHEcVjQ79cV3sBVnUAlLvuC+D64y3HFnj6A2JEMpP5fLATRS+94NEHCJu0bEXF60XHoXYVfkEUL8DUB6PsPlJ0zUOZ8/SmWEyCxoLor2YdjAsgyVMciGy5syv6RldFD/4EjIsAtaRaBu0IxPQBEPsF2AQD6tub+3YwMMWoCRB48APqeSh1+E0/8UJ66OLIqpvl2KTF8myPQpgFETE0yIX6fkQEA2i9DEXE5seHYQubh5pOrAPAqhqdCLnlxRYRZL0WfkIub0YoJoAOVbrz2CgEA2iMjNCG+VjSAyJEgIr/3dionB9JO6UyDCw18EB8nIEcDoKFfUZh09QAA+YpgzX0I7vp6WZ2AOi+/mNArUlktbKjSyuaYB1LXRIISh53v0iRt0aTZSEoLAJCD7I9psN2GSeSq/xFzUsW/56aybdhAHSNHo+8mYmYeRox1lIC9TPkdZTAHij5xI3Hj22ywLCZAonlfOo9+FjZMR4rQ5GYqZkFiiAL4agCRhWMwu+ggUPTNXwNe+a3YAQARAwBEnbhRYaN0tCyGiVj1DExAV2k4U9n2hzFyFQDAU+3v1iBs5AkAsQMA5OafUibHTZCW5YsKdZzjK0rA3NbdlYMgrvFoUddXUTf/QgcyJx5RAN3ESjrnf8savw2SSyn4X5FsQ1u5MhNARMCrTfA48hUCAFhEZH99pJz+Ols/yagB1Mlr9yO3PGyGasvB6GSOHGHAyOKDShwORskanFs0HknRQn0fgbmKblYNQJ1UMQmi3NO3ApMviCIic/Nq6F2ZyIcH4GIZSiez4AmsGQCgWdbDjRkxHX1ZnIBiAp6BChV8DOIteyssQheblOME1OWciHV4b1EOoKKg7/OErBF58rhtoRuJvKIU1zolXZiiQOghqexVwHsbginZnVL0ZDeFdFZ3rEFuiTLqjBa/e20AAIBlU3nMwcpztehKQF8ySr4m/Al3lThPX9iMLysL54KC2c9yXm7tsCjBq5owtIkHwKkPqStMc2HVAeBmaG5jZVKnIk8noKr6i042ZWkPPQb9E2oX2xPI4pmnUR/bnZIs4tjfSWUcgrZ8/XZlzAXQbqa8JzSWK6HRe7GMILA2moy+TEAuAMQY7Tq8qgDwc4fqngC/SaeumqtYkD8u0YI7X0koeU+JG19Dnq1biV6ISrVzFOfSlm26t/vxGjVkt8nX34XmphpfwdePUUyvGmZxlhEEhNY4yxEh8AWAmDgGBQjsWTUAOMJCqOC24jY1i5De/mNKtNAGIhNRJScdgu9N1jyb3OjHQ3MT0NltuLdBmhCq9KXMh+bOuwcomoFaY//0kvMFfmehk+sqSbkAgB5eIuN0g6oAwM5KYg+3BTU3DCg3yEElW2QraUJQ4/G9SeT5xNhtje9NI4tyfhvMgcGElyGutx/RAOS97Y6v/5OcmD8hv1m2EKyo/XdVRhMgYSQYibl/qj/yBvp6IHdA9p0LKTmluyjdUvx9HQGmDE6mbRXP+Wc0DqLx+P55mqjGevi9O8l4LVDCnOK7h0GjbiK3H4HognMuOhpH4Gs7aZxhwxTTQNUApO/iBaLN/ERRqX+HgPIMrocyaWmnQqP6T8JMBuIUplFBYHZfE4X6cgAHKWpuzNj8piytxAAOwpbasQQLaSpOttgE1yljQxeH1AC2VgCujhx2+VtzSOh0gaJKTsBrCPkAeHUNHlFU3W6kZUuNTTU1hivMTfnedcrvPEFMgFPx9ZOIpnNPCU2C77WgAego6THxl9zZlyHVvszC+hu4mzP4OgHl4ImFv29JPMsRcVSKjbmcspEkH+I4ooYLFfQK5fQfgKE31ZQS47AivvcOMYuOYPAxIqJpTMLrdUFzy64toLlC7xCyaK/E55GLem98/SriT/hvSf0C1xjCepwu05HhNTUl/cxOA4ATLCc4tye8CRy6lROp6LIX0WhquLnFe38hC2Ebxu9dRjSAV5X3FhL1fLzjtzbSgOvviabRjeq9y4bfAL8jNL6J0FM//3qyDt4rKQAsgv4XUyKRSwPQ5bhQzWDLTgGAldA2j0j6JZdNZSvqGJXM4bc/meganp6yoKVQwd9P5RLm722KJ70Ek2OVBTqfhJvOdfzWJhqQvlmx3Segb2A9T7tZ/f+15BpvlDg6IMZ4BsMH4HICmnwDd3YKAFznoPJyQoG65h3dGAYr06IZrgGAXXMg6QxDx6L6ek0BSfHvcxy/s5lmzG/J+fnPg+b2XnM6IKV4jobMxuEB2DJW5XePKDsAjAG/fu4ub6qKmD8q4YL5EvSuUrtem67VRez5sxnaBNWy/tiG6If0DdQZoFSWUmPPgr1DkU3Vt7EM32l3/ko7B2YtJeRnqsHmovOasqmuL+liWRo98vJZ/t7Ga3WTsZvA1ADaCQDyOqcgBbZTuiqtm8prFie3LlyYMGjGAlRuKysA3Gng87uce7Z6AGLzz4RyN2UUYb0HU3kolc+38To1spBcGsDmmgV4R0gRZstWmKdhWuOcdOJIE/4Wa/6osgHAGZpUSo7t79IAZqFTMSw4PgBIJ+AEBgBQs+tPYRy9U6PfAX7FYZcJIF8TWuP2ZQGAHZRQlqnvmg0IdBqA+K0XMfmligtrdXR4HknUZuGd/y2mC4u2VMtoTACuE3BzzYINGoC/DAV9NeuICQIm7eAlkolZSABYAimeNjXeRQDSaQACAEZXYPGIbLqRhLUnNv/zCknkUuU9lVlXQ16AzgnIMQE20SzO28OGzpzpWnfQ2WNNlqGt7ZiYw4uKDgBngbkza9ayXmJQpldg0ZyrUIRfg55a8t8mlFGhDsr6BjeTBfU2AQCVLenSAHRRgAAA2Ss4/VuTRanrQmV6j/q+pD9g66ICwHqEfRYznYA2TrV44H9VQPUXav1HyjPXMYQq2XPq+HRh0o54by5570OFpbeAUIHPYnjn6YK8K2zmzLIHyXuIHMlAJicgPRDvLyoA3AT6cl6JJ82Xqj7bV2CxbESyGsUY/hB66gHQfgYb4XtPk037rsK+W0CYgGcxNACqgs4MG7klOUc5vaMMPADTnhhbNAD4Apg78CSOTL/EMhgndejC2IVkLm6nbG41HZgCgGRAfg7fm01MrhctuQAuH8CWGhMgOAFbTyGeA/py4z4mAN0vL0NOZe7yetCrHCm7nI6sMckhv69DF8X1iq1/uhJDrpNxOA3fu5SMjTABZOGIX5DFdZNynQWeTMAtNCGoAACty/qE/MVpX+dyjou/hxYFADYhpw2nMIKLL/0SlLeEt002JJmA7yOSr6ikzsr3xykbc4FCn51E8gAuRFv9JjJmCwiZ5BwmAAQnYP4yTJk/Uz0AW99BnVn9FORQWSmPh/sruJtwJgbtQEeJFCfjzh26EA7QTOyqRJ2XabeDCNX05FS+6sGCnE+YgC4i0KYaDeDOsHlzkx+BuQK2jxNQfe//+hsAdteEOmIL3TF2RALqmD/eqYvgMM14yY0uCnL8EhoVg4blcK0FxAdwDkOTo/ZpMAHy5cg8RXw2Lh6AK9X4DUL+6nMAeJC50W0AoLIERfx75Q5eBMcQAKiTkz5PWUCYgC4fwGZ9mAswsKIgsCM0l1eLDAxYsDgBgRyY3+8vANg9Q0afyUEo7dRvdvgCOA56NyttFwDMJ0BzFkMDoDbon9vAd5iEPqOnlHBmleQqgy+A4wTURc7+Cy10vWrlQWYT50SU0QSQn3mmApN/HNEABACs3eJvrogU4nUtJgAnCvA5DUst72Sgo0mo84YKAsAncNNGYK4IZCPK6ajFZ/Q1AOxKsv04JkBkAQC1nFUny+EapmMrDSE2RvpvhCzAbTUAwE0G2lQzZ2q/v3UUenJWmUJA5uGKmgIXMjSAxLJf6PtvZfUFZH2AWzXJDhGD7GP69zvQU822k+Vg6N0ldg3l/UGYTbYU8/cuJuzBqcp7H3maABtrnIC3KHkKXWi/XsG8t8Whdyny28g1nqwoAKwHzaXRspgA9HA9pa8AYEdiw5jKdrmcgOrnD6/IxO9P1D5hCy+tqMeyjr9IJFkLehdXpbbe3WS8n7f4AFwawLoayul0dMp2EdByNfQQ/oQX8FnmQk8vwxtJmvgDFY4KjCdJPnXgtR9PDAfrW1kc6Flu/B7gNem0OQFVraFKsealka8v4/0PKe+9Rk7zccp7VyosQLVQ5FwCpO8RDcAnCrAYLiLVQXk+9NR3UOf3cOV5LsasRLUB6NWgbwxygRILT9AkqDJN+HFCEOIyAU0AcXa7AWAT6F3swMcJqIv7f75iEy9i/K8gb3+ospFq5HQcr/hbasp4CXNpSXzvMbI531Ku8yEhAp3FuDeRgTgPf1MkGq0JjUKmdM5PhOYqvzW8L1mt6WGyqC+EnjqRTynPsWOFAUDI3tDTJ9PGBOT20xAHwLLtBIDziRc78TABdOrNbRVfAFLW1rDEZJ7AEdC7pfSu0FMPQN2cswgA+KQDq1qKWql4Gw15RWonc4jJcADSU/9BDoWfayIOq4V5/1gLuE+TLMTlz+j22YntAoDF0eOctYOvTrYLi+BjWVnRAGgy0MmabMC9lbBit7LJVR7Fm8qCqilqeJZIA2UvSqbic+T1w/D1R4nP4MIwx0bZTfGxxBlNAPW1J9oFAEdCc62/xFMDoNGCe8LkN50E/yGq4LeUnHKaK7G38j3hoZ+hcfLNVuar3oKjdRGMW0uAWqhEbF4kGoC8xlToKWMl/n4nzLFV7mM4AROHE1A194a0AwDuz3DKJ4bEhrrPTVZELlI2q9jkstX2DzQawO6M3xuCm7WG0YFWKNZ7obovnFaHKK8/S7QM+d4ueO1uNEU2CPPrTBJTfQGmZCCVCpwYXo98nKvcG/y0JlRhcgK6CAwRqohh4nvb3mchVXYf5fV9yfgKJx23RJqoM/A1aF8p9RkkpfWLJLdAtEJbPcwtSx6F5u5CcUYNQIaXV8oTAM4Ce+8+lwmQkBNsbIkn6gvovBQ02QP7yDy4UQHgiwo0Ftsh41Dc1+Q2/P46mCEpOhR9vcMBYCz0VHLmOgFtPTa+mRcACBvwZQYycSoCxag2lrUl1Epoq6v2+MF9dO3PIvgUkdu+A+RQnILIIEx3VYkywzsYABZFB14E7ma5CQMYnsgLAHYAfaMDHx+A+tq4kttqNZLMc2NQX9siY6B3Qc3LOvyZDyVcEO6e0gGA0Ca2zgMATgFzDbPEkgtAMwUl+WPZEk/QCPJcdaTjhg2bvxyhWU+/6vBnXhKZopwQIMfXdlIeAHArmIsZcpmAEgB+VvIJGqlJ550VNmtb5EhNyuxlFXjun4C5VZ6LB+Dd25Fjl3yUgZesK23UjV7pASXXAGhFnwAA7ZGjKqgBSOJVxMytSRwawPvgqL7kupk9wK9CiekzUYekfo7SmDYBANqnAdTJZri0Is/+gMehq9v8oIzZkFYA4CImP9lVFFRM5A87BAAoLTa0z2qfD6BOAPdXFXn24zScG1voz/S60+x23cgLLfL91RvZsAMmZqTGCRg0gPbFxWmzlKoAwKqGyBt386vyelYA2JLw/mNH+CEGc0+AhzpkYlQnYOIwAb6AefGisu5Ehdob8h4a9v0MdDCfaLBTx2ocYJdVaJxuA7+CIDYtYHAWADgH3HX/OBqAmMAzO2RSdGFAXQNNWlxDfO4lJY+/ynIqGRfhHB4P+gKiND/+8gqN07csuQDgoQHUbcBpu4F7wa88UWwIF9aZyStlcgK6fABfhObqt3KxbxUA4OMWZlSbnKT53DhNNKlKAPAFhh/AlCREowH/8gWAJZUcZY6X38YDEL+zRIeaACYNYHeF1x0rqbE7BwD4mNdP28VNtmgA6hqbWDFT6S0LvT5magEy/2ZjHwDYHfzKftsAopOYcqM02s1s0Jd6opxu8dkdAwA0AYA8OK51AEBcQR+AkCtIhqAPE5ACwPE+AHAS9FSa4fgATMlAQr7bQRMymkkF3kfjwQ4A0JBbNABwjcUJGFcwDKjWj6xlTAaiXbem+wDAjdC77r9L9TD1Pd+iwzQA2j3nboMGQMM44v87BQD4GADomrmOaQJUTQNYSmOK+4o8fN70AYCXDASgxJGeSCfsvZIMtEhl3QtlMYYJoA6srrTZVzTqa/AB9JgA1LdkAgBKBJroSKTZ3xbyKqncZ9hv3ChAoozj2hwAWMGgdnDSE6nde1MJBlhU4rkfkbbuYPaN1vAAdBrAfmhCqaBYd2gAh0Ojlt6vkYNRtoX6DaSwigV7gocPwAQAR5GxtmkAq6CnW9YNmNFBADCBaJO+IKBGoQ7hAMC+wOvuYwtLyIV/dAkG+Dzo3ZxhFwcTMHZoAF/WUIbFNXY1/O4l0NxIQ4DRtiVapIeQcRHP+gMHwcXlBByr0aImMijrcl727BAA2I5hjrtMADk2V3EA4FTI3qmUOr3WLMEAT9EknRzISAaS6HqvwwmodtoxqacLNOBZptyJszWnzhyPKMA1Fg2AwwScqll/B3aQFvBWCxqAugb/yQGASRang0868GslGVwfABjZghOwbtEsapoJG++4b9FYYwyaG4u2aWw+hb+/vuNzP9Zkoj1oAQC6ZlwagIsINF2zNjupfNh0jRbgwwNQNbMlXQDwACP/WOeUiMhpV5a+b1M16rpLA1A/e49BA4g8AYBqWKdZ7llsSLWPwKPou8lzXA6CRnVZaVfbinJeonE6/Q3sBWa4PICIYQJMJwBe7zAN4FiDGcBtH15X+AC72gBgIE461wGoYwJKAPh2SQZ3GlE1bQDAdQLuS5yAclHu7NAA1HG1aQDXE62lDvbGkKIn3y/xXoW6vZFjTARz80Ny7/PA3M7rIs3C+3uLADBW4wS8nGECyHnpJA1gGzA35YmZp7/cl0fZAGAdcPf+c5kAkvY6tEQAwLUfR2mcTXcZTIC6JmS4s0MD4ALA3Zr7mGIJcT4Dzf3n3nWo9dtr7qeG5oDu8xdr1sLDHkQgUxSAywScrtG2OkkDWBQdw75EoFgTiZpoA4D9wF7Xn5MOLJFmqQ7UAKgT0AQA+3oyAWsam85mAswm6nEdn0P32d1AX7D1R5bf30UzvzXo6Qno0gAiSwr4Hzw0AHrPJgC4QfPZTish/pAm8ScmvpfEwc+powZmBICxFu4xBwDkxV4p0cBOzWACqAv9LgMRqJuMifjeDjmZAH8hExvhc5hSmBOiItd1ISFFdjZoAMM9TIC/WQCA4wQ8yoMJWAUAuI5hArhC80LetgHAZR5xfhPS1EpGxNDZjzYAoKf6TEsyELW/BudkAszR3IdJAzhYo0rrWnar8iUDk3E40wlo0wCy+ABcNQFv7HAn4ABM5vF1AtIeg7I47+ImALgZeH3KbeBQw7BQGTUA1+kxRqMBzPTgAZiYgN2eGsBs6F10ZaoDtGgSkw0ABmvmW9zjATmYALd6EoHU+760whrAUA8noK3NeITkIi0APMtwLrhMALFQvlqQQVuVEcOeolk8HB6AywlY0zgBTUzAumZcuQDg0gBGGyI2tgq7O3maABdrAOCRFpmAPk7AGzXz4gIAQVL7LOTf0qxdsrwhRd+nX6Ccx1EmAOhibPCEYQLs1s+DtRguKqkOPoShMJsJEDFCSCM1TMBZDB6AvI/BDCJQwnAC3qsBgKmWe6YORpcGsC3o+87bACBmAsCfNCbANcwwYB4+ALHhr1aiIg+VhLE6AEOztuo/nFCgGNNv6QBgCeA3IlAFNAizXD8P1ClK3LSGWslMDwCwaQCUB2CKAujSgXexaAAU0cd7AEBk0QD2NSwEWxRgK8PJwTUBYgcRiK4lbj0AEwD81oMHcJSS+CVrEv6pJABwb4tMwIRGU6hKFEG25p+0N/nAfh6oyeS0qyGRxUYFVjfHCKYTMAJ7RSBqAgx2AEDCNAFmaSZ1uuGzK6DnV130kUNL28oQBrRFAWImANzG1AB8OgPdqDnlhltIVFRbmV8SU2BGC7kA6rqdqgOAnYjjygUAprTDZwrC76eLbH4OVODRmpNmtsEEqJGxtGkA3ZrxtZkAMzUm2VTL5wW/4w1l87sKa2wIvQtS2ohAOicgVwOIUCXnhAE5AODyAUzRzGGTZ7zAclUOPoAI8zF6AcB+BAC4KgWd+FsL4tmnzRUXeJgAIxhEoNgjGShyAEDNEwCmkPTlGrjbZi2GKbIbM8ZvWQRM9RpCg9jE8PkLPUwAbk1AHxPgRrImbQAwSWPGdUE5SrYfn4MJIP4+rgOA0WBu7WVr/kk1gKkF0wCkSugCAG4ykDo2NU8egIkK3OUJAOvjid6N8lwq6+Y8hkfib8taCTaT5EKNymkDgDrwawJy0oFv0PAAhjPMQ7VoZhmYq6OZxB+XCfCeDgDGgr4rqU9Z8DoUo3TzFA1gfZQDD2A09O4O/GeDCdCtSZAyUYEXegKADHHuhlpFu04vETn5MiN56KceGsAt5PTl+AA46cARUwOYrNEAukuiAQz11ABMZntNBwAToHdJL18egPj+D9o4ACJZaQjGRNuhASQeGoAEgHvBXlWJ4wTs0gDq6SUiqZwPvYtQ2jQAGko1pQPTMOBESxQgJvM9wmEeqvfb5dAAVsO5W7qfx3mDHHwAcoyWoABwuUMDcAGAHPjD2/TwslR5HVWYYY4oANcJOK1FJ+C9BqebLhloV4cGkDCZgEWTczycgH/UHDRcE+ByBwBwIjnTNQBkMgFEFt4VCBDi1BSVefqzy9WyjJwczn6NZWq3+uPXGOx+Xw1gRJtO/nnQXKz0fTAXwZhMwMwVBeDyAEZrGGezGNmArpqAdxFzQXxnXIkA4GCNTT2J6QT0SQa6nOkEtM3hVEMUYBmwFyaVc/hkP47zIsw96soXEP/fggLAlBZNAKkBDGvDgx9A7HRpx+zgmGSOCeBTD4A6YeoWJqCOSDPYkn//usJZEG3ZVykRAAxER+B8hV03yOID4PIAqBZlqwhEta0RlvmmG6gbT1cdZ4Dea1c/j3U3+FcE0jkOd6QAMJVB9EkcpkEdnUbtaMhRI6pbt+VEzcID8NEAXOnA+2pi+7aSYEJWxOseWABbs5XCFa57b0UDmGiJAnA1gGmaOawbNIBJGodldz+P8QcZiEC6zw2lADCNucldJsBObQYAVQPYmekEtPEAfJKBuJ2B9tE4sEJjkNYrArlMAI4pOkXDBOw20NenaBy5/Q0A72RIB9Z95isUAKaDu/S3ywQQ8vkM6uNyDvowDb+5TIApmgWxgMEEzKIBzHJEAaIAAL0AgFKfr2MkA0UWALhBsz5tGoCOB7CchTMQk3z6AQ5NbrM2UotfBf/WYDrezjAOAGQJA27u8TBnQKO6rbCrXsSNY9p4NY39vTMDACIlRyFPAIgtJsA+4FcWvGqtweg6u57JBJyYoxOQAsDyDtIQBwAuwoNGzP2/MXks7/F7oUUmoBEAbmD6AChAALGltvJkNdEkjk+DvhBHpCF77MSYZI4GQNV6k/o4RrOpTZ2BdBzsIQEAtE7ASeCuCMSNAriKgk7TcC5qeHLbOAMuJ+AI4ktK8NDJ25n7HGSvCKTu42G+PgCXdiA38DbMB7laY+N1YbxfV6NeFwXgAkDskQtgaypxkOZ3ZzFyAeTiGRwAAH6vWUuTGCaAiwocM/040zQaQN2gAeh8SSYN4DLNGu1qQ1TseQYdmOMEPMAUBWjFBKh72Lk3GUJll1hMAAoAO+bABJyiASJuOrApDLgn6MuC7xoA4H/jrcpkCxMwYWgA0z2IQFM1fpyaAQB0mmQN7L0aYhKpOjjn8Xvd8/Q3gcRwHQ+AowEkDgDYg/kgNxgAYALYC3FwnYBZwoAcJiD1Q+hMgD0MTMDgA2g0jKlBcw8J3ZyP0zgLObkAHA1AFwVYlmkCdDM02kTRAA7KefzmGTY5eJKBepkA13smGJhMgH2YD3Ia6CvP7sPkAbh8ADRzcT4jtTZLWXCdBrAb0Vjk2GwXAOBj77ikX3fh+C1vAAC6oSbmZALU2wAAJ2vutx1zvjAHHkCMdPUBlPQQQWtFQesens9PYkhDppwKmW0IB442+AB2ZEYBuCaACwDGaNR6HQBsQRJ85En3qQAA/5NlHBl4R3jwAKZD76rHIxiHgysKoAMAkwmwBuYKdClr7u9tGLeoxWQg+Z39TclACZgrAuk0ABoFOMLjYcSGuAAaNdl+asnIGmmwqbdnePa5UQCuCUC1kJkGbsMsaK5LeGfY9F5yhEcuwDTNfI9gmAuuXADdOrKFAbfC9HBRq+FSTNnOm2kZEXU/azLQXhQAxmfMBQCCkKe2YTEcmNEJGDN4AFM0UQCf1mAzLQQn8Tun4GJcImxqL9ExAV25AFwNIGKaADo+Sa0fx2QFzwiAzV+3AwWAozUDbutHbjIB2lEQZJjGqWYLA/pQgXW5ALbGIJzegEFal7Gak9pVEShh8ACma0hDXQYNYIom+7M/qcDbeHj+bfT9WPJtbPYtN55IqcCT2/Dg+0FzfbqYSQTi1ASc4hEFoJ2B6kG1bzsAcKIAPk7A6ZroQpdBA5isCSf3ZzbgMOCn7LtMgOUoAIwAfYca32SgdtRYXx9V+Drh1q8O7oIgeQIAlwcQpHXRaaRXMAHApyJQZAGA88i6qCERp7/GZIzG/s/iAxDjsxgFgD01PgCf/oByo7WrM/A06ClQKa5zJYNsEjN4AD5hwDGa3w0mQN+YANx0YJcTcJrGtKgZ0pjXhkZPhUhR/8/vxzH5bsZMQLpn/3cY0lM2An6RAdN7C9v08CJkdCii8n6ObCtfJ6CPBsCpBxCkbwFgukcykKkvgKmOwSCMVF2HDu7+rB48sUUAkK+9AobWYHXw7wwE5H3xGysVhG7KSeLwKQo6RqM+3h02a9sBgEsFTpgaQKLxASxTgjH5rWbP+VKBxb/n6ABAsow4BUFtSNNdAM67zgToytEECBpA34YBXclA04Ff1m26IR24DFWYHgG/1mCmCMANJgB4y4MDYGsPPrpAABA5wje+yUA0JTk4AdvrBEw8fACcsuCTNSDeVRIAWGjQun3SgZt6LNILzAR3D0BXFEAM/o/6eaCu0ywIrg+gzggDxo5cgCD5RgGytAc3zeEkDbDMR5ZdkcdjQ4vZzQkBqib6WBMATAJ98QAfDUBcYEY/D9ZoEi7stsTrJ0PvRpgcHkAcAKAwGsB0jc/HNIeHE1+XWB93lGA8DsF7baU3YEwT9uhFTrX4ALhhQCH/LMCAfTOVp6DREuxuDOnYNABOCOkg4FUECpKPE7AO/q3B5BzaktLOTuW/qBUKrXfNEozHhY7T3qYBUC7DeiYAGKXJu/dtD160dsuu4oyTPZyABwGvMUjWRI8NoBxtqvvKCUiB+TJHFIDT4VnN1Vi0ROPxO9B37eb661Qf3SImANgZmktZJRlNAHGRL5VkYCdncALmTQUWSU0v4m+Lv5sGAPBKBroBeteWPLDDxuNtpgZgqgosgfFx9XfpRZa2cAE4FYHUjKlvl2Rgp0Dv4h3DPaIAM3O4hzuU3+1GtA8mQG/vtY8JMLyDxmJt6F1uzLczkDycp9kAYACyhCLLho8NDgjaCnt6iQCA2x58lEYtbVUDGIheaBVA3woA4N0ZqJMBYCT0rjjs8gPo+niI75/pAoAbQV8QhGsCyO++UGIAaLU5qI8srUll7QoAAEdCa70BOwkALlDWSJZkoMjE0dFd7AwwVwTiOAHVSdikQwFAfeY/t3j9ZUlosY6RC7XUlKguIxpqTCgJZTXPikCc9uDTOlwDeNDhl+NsfgkA67sA4MsZIwFU1RByUgkG91porjXgqwG0CgDCI/s+iUu/Sby/dcW0OrtCGgA3HXgy9K4VMaJDxmEtaK5f4CsqCLxOf193wRURKSLPdOBYM2G3lGCAjyVpxuLv1h5RgD/ncA8zyeJV/QofQPvrLRTdBHBpAGcrn5Vz2ClNWA42OACz1AOYwQEAIY8ZAMCnVoCkWC5S8AEWhRFuU0DgdrAXZKiTKEAeLLKhCujWFBLLKtBcXbgoJKu+1gBcALByKnOhpwjrlA4ah6sMGjm3epe6dn7EBYBroXczTl8NQCLx0JIMtKgwPMRBDhmlMQHyKgkm8s5Fyactif1Pqcf/Jt8TrK5PViQd+ArHd/aAzuu/+HLG7Fxaq1PrGLWhb7eGi82hAlNv7EUdNBljCBrnpQGYZHVCzKojIUS+f7kSNfhuB4YBaZGPiRXRfqR8HnpXwzYBAFjelwCwBhcANlNUYm5z0NjAPX62gyZklCaR5NY2Xm8pNKNUDUCGVzdV5khGDpbtcB7ArysGACdrNPEsyUBifTypu4bt4m84NnrE0ACkGbB+hwGA6gRst1Pub2Q8b1eiNVQ72L5Dw4BSrqwYAMyxROS4yUAyN+dKXwC4Dnp3ZzWZAboIgLowj+yQCTlQYwL8sQ9OATVC8X9KYlIXiR7sQ6I5ok35SiUd60M0h0qVAGA5Ep3y5QHEJAPwq74AMEJjAviGAXuVICq5bKT4RiSyXtjmawqqsOjicgJuaDUzsUYmWvai3zWVDxVacRm7Em+AZk1d2QTjKgQAY8Ddq5PLAhQHxWq+ALAY9JQg4jQjiCw3LMoQL9khEyNO4HcwPi8KqKzQT/exLwKQCgBDDNlxvynpWB+AXvAuDO0NrBAAXGs5cMGTBjzHdB3XTdzqSAoyZQPS98RJ9fUOmpyBBViMn0YAkCfkQgWMniN+iqklH+9FoFq2/wAM93Io+C4QEPM/PisAjNN4Ym25ALa+gneHBJfc5WdKGHCCwYEr5uUmTXQhtCovrgwmJjUn689WEHT7rACwiiYji2P/67yRNTy1wgTnrwlsQF57icyLCgDfQ5NMvH5uGL9CyjUWp7pvMtAHNm2VczOPGzQAn5qBMhPpvDC5fSL3EvNrosI2VP0Gb4axKpwsAz31IWJwl+l32f/WuhycG7qUkQuQGLz/9Gb+U1F7rq/lh4pvoAudaQOQCloj6uGSYbwKJcdYTn+bBgAG+/+wVgFgFAk3ZfUByAU5Kkxy20UUFv0Oov9xJJuRhnY/EcarUDLXElL30QKk2b18qwAgMq3mtcgDUCMETwUtoE9kYwxZDiPkGlpbfvkwVoVK/Y2YoXWOCeCsV+mTkuhKB7bdbEz4818Pk91WGYp2ZA3Dg0fj6/soySVSRVw0jFehTv/Iklvj4wQUc3tiXgCwGzRXzeFUBIoN2oH4+3CY7LbKJGiuWSCjAMui40/O5ewwVoWRPaGn9gO3ApcLAD6fFwCIMMIzDHWE21YsIrTWIPnKX8lYP6C8tx00Cr8KUNgijFWhIjc1S8TNlwfwHw5ZzecGvwf6UmE+uQKqs/DvYdJblsOh0eLqTfQeqxWdVFAOY11s2QH3lq4ID8fW1732c861fW5yNWguT+XLA9A5Bw8Mk99SvHgBNFd8lQUf7iaOpPvCeBVa7lSyPWNwd+KmApqI21Z5A4CQaWCuTxYD32Mp33+yYgkeecp2ikNPLh5Z8ulqMifTwngVVnZScjoiDxPAZmo/xL2+783uAu4CBTYNgN64WMBHhkWQ2WmklouqYxhJvLcfJxc8SCHkHgLkiUMDAIcJIH7r2HYBgJBHwNw4xKYB6ByEEfLWlwgLwSrrY374UEVj2luJ6UsAGEnSlh/BhKEwhsWUL0FzxSOO6eyy/0UNheXaCQBfAXujQq7KolbV+U1YDEY5DGP5ddzwE5TFQ0uCBZ9KuXw4T0JzwZPIY/ProgDa0t95A8AAjB9HDAAA4NUSiLhOiwrK38kYvqAw/WqKml9DezKMWTnkXEKgiyz8GVfRD/l3gS+zsxX7s86wVxIGAMjTa3JYFFp5h5hX85T35igOpJeCQ7U0shaJ4OgAgKv+q38v9b2XVh7iAeD3DYjBXU5MLOTNK7ogVsVQkAiziirAanOQeWQMP1TeEwU/T0/lMmiUcg+bqzynf42wY1UAAM8woPyNDfsSAIZqAICTC2B7gEcqmij0C2XsaoQqPY+M00dtuP7KBkfsYhatQqdqirn7LH5PfX0J9B2FgjCNsm1vQ+8uWiYTgKtV35Xlflp9mPvBXhXIRVukGoPQAsZXcFE8Dc19FLqVDfkW0ZTyLOIxEDkCNQSascRDLerSvU+ci5+DRn9CcZ9PpLIuvr4i0sW78f1BynfU3ou7VxwALlXmOQJ7LU3ag8PEEhS/NaQ/AGAo6JuBuDoL27SABRXjqA8k6dbSK7wyvv8g5NuOXJXNCZFIBZe/KJtW7Uf4G3I/v8DXvwPNbcx/ha9vRKIVd1V4828O+toaPhqAzjy4P+s95ZXEkLV2mamRyGMVSlMdiLa/esrXlBP0UGUjdiEfIK9r765xxsp7+pBoJUvjezPIwr0RX/81mcM/4OvDCHnstYpu/kWQoVfPCACx5dDctz8BYCPlBOPkLbvajckFN70iC2NR6N0CvK6o1gPQdhabdZOcrz1cAwDC9FhSiS7I11fH79xOwOp3Bs3gLiVhST31XqkoAPxS0e5oYhwnCmAyD2a0cl952jV1B6PJJ1VYboKzK7I4Xofm/P3uPmJHDiNzsABPKhWUZGeZZfA7t5C5moSv/1yxVcXf32s0gKgVdbXEcjTZ5LpCOhwAoHtKzMvaRQCADUlYw5UIZNIMdEDwpQoskN+S039uH133i2T8/0Ick2oZN+oDkGB1krLI1Y1+Cb6+gaIBqK9Xicb9Lpib58YacABwVwQSr/201fvL80Evt4CAyzywlUB6DYkTnbxIPo200G5k+g3uw2tfj/P2GuEf7A+NsmLz8N/y9XVSeR6/82gqn8TXhdlwB55K/8TPye/8BF+/TdEkqmL33+845V1MQJMJIKIzqxQJAFbTxDc5TEDb5pef+6smttyp/oD+Wqim+1nU4Lg09URcPMT6/yc/JRtbpwXEBvPABQCX5XGPeT/w8WCvFxA7Yp2mwiHi9DgtLKggJZL9SJqvaY3rgAEcPgDxd9MiAsBADHV0Q+/y0xHwqgmZCBFCHd0uLKwgJRCpDccadd92+tcdB6eu1VuhAECGBRdokoWSFgEgwhDSemGBBSm4XMXwg8UGH4DLBJif5x5oZw57DXiVgjgxz0ghyLwCoZptkOLK98Fc+yJ2mAAmJ6D6/tfzvN92DsQllvCfbYBcnOgIU2S3DYstSMFkHPRuveZqnsOpCCTNgxvzvud2DsbSGC5yOTNMiBhbCBOys23QBIIUyenXhf4vXeTLtfltJoA89NYuEwAI2YowymKmBhA50FO+9gamn4YFGKS/k3zec8TxIwYI1EHfU7MGPe3dSgUAQr4N7tbhHA3ApD28jYy2sBCD9IcIwtPLYK+TaXIC0s2vW/d1pF8PKCsADEAijynn2UQDThxMQjXxRLRB2jksxiB9LJ9SWJEu/ktk0IRjR56AMHXXKDsAbA/NXWk5GYE+RKIaUiO3D4sySB/J6kh5jgwJb7Z1bfMB0EIfo9r5HH05YD9mcAPoJgdmiFCmWb6GPISwQIO0U1bGPIiageXH9QFEliiA+P817X6Wvi58cSvTDLDFQ3UIW4fmqjbBHAjSzpp+fzNsZlsdDB1QRBYQEIfZip0EALKQ5Ezg9RRIwC+XQFXDRCONMyuWeRak/fIJaJRit0WxXJV7I0YugPj3yL54pv4YxCUw7zzKsMltZZHogHZjHnsIEwbJQ8Q6eg7XlS0qlVh4ABwmoJDz++q5+tOB8iJxoHCZgNyehPK3RT77mLCAg7ToxH7Lks/P7Ydh0wCkH+vP0Iel8fu7UsrrmsgAxwSIGe9RbeDCkKseJIOMgEYvBlf/vsiS6+LKB5C/+xKaGQOqAAADMKf5bYcnNfF8T9eBWKKrSKNcNCzqIEz5ATSXObPV7YsYJoApDCiu8UEqX+jrZyzCIA9GhI0YA8nxD8QW1UsM9MMhVBjEIUtBo9ipTd3nagC05L0uCtDd7nh/kQFArZ7CVfNdGoAOeaUWUEPe9jFhoQfRiKg/OdfAzecAALfUnQoAp/bX8xZp4MdD79LitmQgk3NQBwB1g/p1N/oiwsIPIkRUMH6BYatnMQF0ICAOo6v685mLNPiCKHQ6YVdxw4CulOPIoiWI6kWiwGJoXFldEanrP0Q6ua02f5bOPabDSvz9OfRzM9wiTsYBSOTh9BzkAIAu08rkiLm8L9hXQQol22J8n9Ogg6MB2MKAasivEE1wizopX8GTOc5BA7BxrXXFRp6FajQjqbqIMvMTwNyl12YCmPxPkYOsJmVGUcahyBM0FHqKLHDIFtx6a5zPCQ3kT9BohR02S2cSe+ZC70adtlh+lDEKQOtaivThVQIA8EQU+ngVmpsq2qIAOiIRFwBMoCDadm0SNk1HyHKpXGGgoSceh0TCcBAmGoefSB9es0hjUoZJGwQ9RRe4LEGdE7DO2PA6VK9hnHZyKluHTVRaEfUjnzBs0sQDAEyefZd/SkQX1i7auJSp+MJjBhDg8gC4GkCiAY66AgTTQoJRqURU07kEzbpugyPPpS0mjChAZNE+hV9p3SKOT5kmchCiqAwTQkYASBzMwYQBMOL/d6YyGqrRs7CsefsiJXy+B5M0YpqFru/I367j5l+jqONUtkkVLZdmGxIyIgYAcE0GDtFImgf/hkb322AeFENWSuVkaNSJjMDelNYnYYejAdDfe7poNn/ZAWAAEifEBL/r2NytOgET5smgmgkinnxtKl9NZdWwGftUdkBW3UILmcxVjSryIJTZOAJiLfwMSlCQpswTvi76BepgL84Qe4RwXN2KuJEDCQiPILtxh/5mfHWorI4Ze0+DubtOYkkzp8I1JV1Vf88syxh2AoXzSk0OAaf1kuvU5+Qa2JyH1IEo0p5vSOWEVLYJgNASZXxPzNZbAD0VekyqvcnLb/osp/CMDgDkXF+A9xgAoA/la8jjrnvmAiQep3rM8AybuAi6BSYW7z0IYKLry46pLBs2uFE2xs31MhPUXZ2pYw8egO0wUMljR5ZtXDtpgXwObfA60wmYgB8ngFv7LfHQENSKRfIUEZGOqamcmMouFY8yfAY1prugp/kGx7HH0QZ8eACJgwr8Mmp1AwIA9H8u96MEBGzJQNySYhHwy5D5VjE2dYipKyeLKGJyMTTqJnRyRSPhwT8Qk7JeUCItHB+MT/FYjg9ABx6RZl39tchhvqoBgEzy+LFCGnJleOkonq5ipFz/QWKxJ23/d7VG/1WHkJFEjUbRw+F7qdzu8OX4OmRdoGvzAbiuLe/xirIDcqcnfDzLWFSRh7qeME56zoJ0tUezEVWkKrwA88nXKtm8bJnKWdAoDS9Ddl0e9jyHt5FYnHgJ+BfupMlAglx0RCfsk063IUUPgm+ijdZtcdhFDnU+8rDxk4ybn6MJJAaq8vUFz1wUlXbOTeUfDB9L4jm2HB9NwpwPVxhQrKFZJQTdygKAWuTxPIM96aIJc2nEHJUUGIuUu3CpSlpDzkHR4vSX4glv875zfDKJp83v0q5sYUIdENSQ8dlRPpiqeZX3hkaDh5oj8SPxIBH5nja+GkDsoK4mBARuKEDkQFxfFLr8yOF4izNEUbJoWLaKUqb+ffLf3eiQ3LET90RV2WNXQu+e7pwwITe2zP0eh6XmYxZIEJjaj0SjzUjaLdfpxjm1XQxNjhbF/ZwkcP0CGj0tBwQA6CzZKZUHLad74kEV5vIKXNmHPpsltgBAHR2EfT2mwjE2j3nqu56bqxlwtQsXCYjOt6AXD+70fRAYZgBfh0ZLphrY67f7OKpcC5xjsybAJ7iY7mnLPhzHy8GvkrPLCeijYXEiARyNrIYe/tOhIh2kAgD05BScodCJfW3NmOFsapWpFhuIKzat4vo+Gr9zPEAqcfAmuE6/GPxCrpzW3c+hZliZtR82f7N8MpVrNA7CCPw99D4e6sTzs9xwl3BgrdbmMTuOgGYWrSXJyQTg/Bb9TB1P/dPwIBgQACCI4ODfqziCIiYpxdeRlWXDcOxp9d/tDA2Oc2TXcYtwJMAjWvmy/mzAIQFe1G/4VFXXetjsdtkKvcCvOFhkPmQWjs3rS2CxObtealNE4PsOTz8H/GLwr8oTt6hhCfkvNAp2VL5JbNjk/CpEh0GjwIcpKy3x4J/7aAU+GoCpLt0eOY/H4dC7tHaSQVWPoTWCEDdFW4b13kZ+wlJhTQcAyCqH4qkaGTYBt7gEV2V2Za+5gKcG+Xaf3QidpVnYd1yeRZwRBExjVENVf92wfgMA5CEiRDQSGgU9uPUGs9r7ruo1rg1XR2JQXtV4Hm2Bfpt4mD6u77u0qzomGwkT7jNhzQYAaGelGrHI3iQU49iyYH3CfdwQo41W+1BOz3ommLvq2Oi1XM++Kwc/NoQ+I7LxRTepU1JZOazPAAB9qRWMgUa/gDo0NzExbXgAv4o1PixB9TPv5vB8m+KJWvfUZnzYeglkq9AkQfdxNNFCvcUAAP0qYrNcBI3a9HVDFqJPXJ9LojF9vrvFTSG+O9fg94jBP4Tpk/NvCt+p3ZpugUa1pIFh7QUAKFr0YN9UrlPAwFZgJGHYvKYCF7bqRWKjLNnCc4wHcy0+HyKUTzjTVLmpG5/nPiQhrRjWWQCAsoDBttBoanIbpsq6Ohv70INNmy5qEQDEPS8w8CCyMhU5QEHZmK8gS1PkbgwK6ykAQCcAwh5ISHkcmvsIZKHVxpYU4a4Wklse8WD4ZeFA2BqriHbal+A4BfU+AEBHi2gldjA02pC/aslD4PQeoADwfgs8f1s33bw0ALnpRcHTGakcn8rmYU0EAKiybIb59cJ/8Dz0rmJk4x9QHsCTGa7/Wczt5+Q6cJiA6v3IZ/kwlT+gj2FwOOUDAASxZyoeiKm3N6NTUTrEpDdcV75MbLgbMhB+HvTgHSSGTV5TqNOChvtHaPQ3ODiQcwIABGldRHXaYdBoLSYKcszCWD0lxpzt+bsna/IdODH7eegzEAAleheMhUYdxtApOQBAkD4UUQ59DQSHH6aynafpMR9P7oVIIpqLtGehSVwNjeq4AnQOSmV//M7iYdwDAAQpv6yGSTOLhbEIABAkSJAOlv8HOib1/JuFBpoAAAAASUVORK5CYII=";var na="linear-gradient(135deg,#3aa0ff 0%,#6a6ff6 52%,#8a4ff0 100%)",QA=[58,160,255],By=[106,111,246],eP=[138,79,240];function tP(e){let[t,r]=e<=.5?[QA,By]:[By,eP],o=e<=.5?e/.5:(e-.5)/.5,n=(i,s)=>Math.round(i+(s-i)*o);return`rgb(${n(t[0],r[0])},${n(t[1],r[1])},${n(t[2],r[2])})`}var Cu=Array.from({length:65},(e,t)=>{let r=t/64,o=Math.exp(-(((r-.5)/.16)**2)),n=Math.round((3+o*(.8+.2*Math.abs(Math.sin(t*1.9)))*153)*10)/10,i=(1.5+t%5*.2).toFixed(1),s=(Math.abs(r-.5)*.7).toFixed(2);return`<span style="height:${n}px;background:${tP(r)};opacity:${n<6?.92:1};animation:wave ${i}s ease-in-out ${s}s infinite"></span>`}).join("");function nP(e){let t=e.markUri??Qr,r=t?`<span class="mark" style="-webkit-mask:url("${t}") center/contain no-repeat;mask:url("${t}") center/contain no-repeat"></span>`:'<span class="mono">AC</span>',o=e.compact?"body{overflow:auto;align-items:flex-start}.card{margin:auto;padding:30px 28px 44px}.badge{height:140px;margin-bottom:22px}.orb{width:104px;height:104px}.mark{width:78px;height:78px}.glow{width:114px;height:114px;margin:-57px 0 0 -57px;background:radial-gradient(circle,rgba(34,197,94,0) 35px,rgba(34,197,94,.34) 40px,rgba(34,197,94,.12) 47px,rgba(34,197,94,0) 56px)}.bars{-webkit-mask-image:radial-gradient(circle at 50% 50%,transparent 40px,#000 62px);mask-image:radial-gradient(circle at 50% 50%,transparent 40px,#000 62px)}h1{font-size:32px}p{font-size:15px}":"";return`<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${jt(e.title)}</title>
|
|
13
|
+
`,{mode:384}),SI(o,e)}catch{}};return{add(n){let o=Mu(e);o.includes(n)||t([...o,n])},remove(n){let o=Mu(e);o.includes(n)&&t(o.filter(r=>r!==n))}}}function Iy(e,t){if(!t)return 0;let n=0;for(let o of Mu(e))try{t.delete(o),n++}catch{}return n}var PI=/^[A-Za-z0-9][A-Za-z0-9_.-]{0,79}$/;function bt(e){return PI.test(e)&&!e.includes("..")?e:`h_${II("sha256").update(e,"utf8").digest("hex").slice(0,24)}`}function sa(e){return xr.join(ee,"users",e)}function Qe(e){try{let t=JSON.parse(Buffer.from(e.split(".")[1]??"","base64url").toString("utf8"));return typeof t.sub=="string"&&t.sub?t.sub:null}catch{return null}}var $i=xr.join(ee,"active-user.json");function Py(){try{let e=JSON.parse(Cy($i,"utf8"));return typeof e.sub=="string"&&e.sub?e.sub:null}catch{return null}}var TI="layout-version.json";function hn(){try{let e=JSON.parse(Cy(xr.join(ee,TI),"utf8"));return typeof e.version=="number"&&Number.isFinite(e.version)?e.version:0}catch{return 0}}var vn=3;function Ty(e){if(!e||e.includes("/")||e.includes("\\")||e.includes("..")||e.includes("\0"))throw new Error(`unsafe credential segment: ${JSON.stringify(e)}`)}function Ct(e){Ty(e);let t=sa(e);return{accessFile:xr.join(t,"relay-access-token"),refreshFile:xr.join(t,"relay-refresh-token")}}function Bu(e,t){Ty(e);let n=xr.join(sa(e),"providers"),o=Iy(xr.join(n,".keyring-index"),t??null);return CI(n,{recursive:!0,force:!0}),o}var Hu=e=>{try{return DI(e,"utf8").trim()||null}catch{return null}},kr="hub-endpoint.json",LI=24,UI=new Set(["public","default","default user","all users","defaultapppool","administrator"]);function Gu(e){if(!e)return null;try{let t=JSON.parse(e);return typeof t?.pid!="number"||typeof t?.port!="number"?null:{pid:t.pid,port:t.port,startedAt:typeof t.startedAt=="number"?t.startedAt:0,...typeof t.sub=="string"&&t.sub?{sub:t.sub}:{}}}catch{return null}}function jI(e){let o=e.readFile("/etc/wsl.conf")?.match(/^\s*root\s*=\s*(\S+)\s*$/m)?.[1]??"/mnt";return o.length>1&&o.endsWith("/")?o.slice(0,-1):o}function Wu(e){let t=[],n=r=>{t.length<LI&&!t.includes(r)&&t.push(r)},o=r=>!UI.has(r.toLowerCase());if(e.isWsl){let r=jI(e);for(let i of e.listDir(r).filter(s=>/^[a-zA-Z]$/.test(s))){let s=`${r}/${i}/Users`;o(e.userName)&&n(`${s}/${e.userName}`);for(let a of e.listDir(s))o(a)&&n(`${s}/${a}`)}return t}if(e.platform==="win32")for(let r of["\\\\wsl.localhost","\\\\wsl$"])for(let i of e.listDir(`${r}\\`)){let s=`${r}\\${i}\\home`;n(`${s}\\${e.userName}`);for(let a of e.listDir(s))n(`${s}\\${a}`)}return t}function zI(e){let t=e.isWsl?"/":"\\";return Wu(e).map(n=>`${n}${t}.claude-bridge`)}function FI(e){let t=i=>Gu(e.readFile(i.endsWith("\\")||i.endsWith("/")?`${i}${kr}`:`${i}${e.platform==="win32"?"\\":"/"}${kr}`)),n=e.env.BRIDGE_SECRET_DIR;if(n)return{dir:n,source:"env",beacon:t(n)};let o=t(e.secretDir);if(o&&e.pidAlive(o.pid))return{dir:e.secretDir,source:"local",beacon:o};let r=null;for(let i of zI(e)){let s=t(i);s&&(!r||s.startedAt>r.beacon.startedAt)&&(r={dir:i,beacon:s})}return r?{dir:r.dir,source:e.isWsl?"peer-wsl":"peer-windows",beacon:r.beacon}:{dir:e.secretDir,source:"local",beacon:null}}function Ry(e,t,n){return t!=="linux"?!1:e.WSL_DISTRO_NAME||e.WSL_INTEROP?!0:/microsoft/i.test(n("/proc/version")??"")}function Zn(){return Ry(process.env,process.platform,Hu)}var aa=null;function io(e={}){if(aa&&!e.fresh)return aa;let t=r=>Hu(r),n=r=>{try{return OI(r)}catch{return[]}},o="";try{o=NI.userInfo().username}catch{o=process.env.USER??process.env.USERNAME??""}return aa=FI({secretDir:ee,env:process.env,platform:process.platform,userName:o,isWsl:Ry(process.env,process.platform,t),pidAlive:r=>{try{return process.kill(r,0),!0}catch(i){return i.code==="EPERM"}},readFile:t,listDir:n}),aa}function Oy(e){return{hubTokenFile:oo.join(e,"hub-token"),activeUserFile:oo.join(e,"active-user.json"),sessionsDir:oo.join(e,"sessions"),configFile:oo.join(e,"config.json"),beaconFile:oo.join(e,kr)}}function MI(e){let t=Hu(Oy(e).activeUserFile);if(!t)return null;try{let n=JSON.parse(t);return typeof n.sub=="string"&&n.sub?n.sub:null}catch{return null}}function Dy(e){let t=MI(e);if(t){let n=oo.join(e,"users",bt(t),"hub-token");if(RI(n))return n}return Oy(e).hubTokenFile}function ca(e){if(e?.isDevBuild!==!0)return!1;let t=e.env??process.env;return t.BRIDGE_VOICE==="1"||t.BRIDGE_VOICE==="true"}var Ly=e=>{let t=e?.subject?.CN;return typeof t=="string"?t:Array.isArray(t)?t[0]:void 0},Uy=(e,t)=>typeof e=="string"&&e.toLowerCase()===t.toLowerCase(),jy=(e,t)=>`this device is not Hue bridge ${t} (its certificate says ${e||"nothing"}) \u2014 refusing to send Hue credentials to it`;import{readFileSync as BI}from"node:fs";import Ei from"node:path";var HI=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;function Zu(e){if(typeof e!="string")return{kind:"invalid"};let t=HI.exec(e);return t?t[1]==="0"&&t[2]==="0"&&t[3]==="0"?{kind:"dev"}:{kind:"release",version:e}:{kind:"invalid"}}function zy(e){let t=Zu(e);return t.kind==="release"?t.version:null}function Zt(e=process.env,t=process.argv){let n=Zu(e.BRIDGE_CLIENT_VERSION);if(n.kind==="release")return n.version;if(n.kind==="dev")return null;let o=Ei.join(ee,"payload"),r=t[1];if(!r)return null;let i=Ei.relative(o,Ei.resolve(r));if(i===""||i.startsWith("..")||Ei.isAbsolute(i))return null;try{let s=JSON.parse(BI(Ei.join(o,"version.json"),"utf8")),a=Zu(s.version);return a.kind==="release"?a.version:null}catch{return null}}import{readdirSync as GI}from"node:fs";import WI from"node:path";var wr=class extends Error{constructor(n,o){super(n);this.status=o;this.name="RelayError"}status},ZI=e=>e.replace(/\/+$/,"");async function Vu(e,t,n,o){return fetch(`${ZI(e)}${t}`,{method:"POST",headers:{"content-type":"application/json",...o?{authorization:`Bearer ${o}`}:{}},body:n===void 0?void 0:JSON.stringify(n)})}async function Fy(e,t){let n=await Vu(e,"/node/provision",{},t);if(!n.ok)throw new wr(`provision failed (${n.status}): ${(await n.text().catch(()=>"")).slice(0,200)}`,n.status);let o=await n.json().catch(()=>({}));if(typeof o.claim_code!="string")throw new wr("provision returned no claim_code",n.status);return o.claim_code}async function My(e,t){let n=await Vu(e,"/node/claim",{claim_code:t});if(!n.ok)throw new wr(`pairing failed (${n.status}): ${(await n.text().catch(()=>"")).slice(0,200)}`,n.status);return await n.json()}async function VI(e,t){let n=await Vu(e,"/node/token",void 0,t);if(!n.ok)throw new wr(`refresh rejected (${n.status})`,n.status);return await n.json()}function qu(e,t={}){let n=t.log??(l=>console.warn(l)),o=Qe(e.refresh_token),r=Qe(e.access_token),i=o??r;if(o&&r&&o!==r&&n(`credential: access-token sub (${r}) differs from refresh-token sub (${o}) \u2014 trusting the refresh sub (the refresh loop re-mints the access token)`),!i)throw new Error("credential: refusing to persist an unattributable token pair (no decodable sub in refresh or access token)");let s=bt(i),a=Ct(s);return _e(a.refreshFile,e.refresh_token),_e(a.accessFile,e.access_token),{sub:i,segment:s}}var qI="__none__";function $e(){let e=Py();if(e)return Ct(bt(e));let[t,n]=xt();return t&&!n?Ct(t.segment):Ct(qI)}function By(e){let t;try{t=GI(WI.join(ee,"users"),{withFileTypes:!0})}catch{return[]}let n=[];for(let o of t){if(!o.isDirectory())continue;let r;try{r=Ct(o.name)}catch{continue}let i=L(r.refreshFile),s=i?Qe(i):null;if(e){if(!s)continue;n.push({sub:s,segment:o.name});continue}let a=s?null:L(r.accessFile),l=s??(a?Qe(a):null);l&&n.push({sub:l,segment:o.name})}return n}function xt(){return By(!1)}function Hy(){return By(!0)}function JI(e=$e()){return L(e.refreshFile)}function Ai(e=$e()){Ie(e.accessFile),Ie(e.refreshFile)}function KI(e=$e()){let t=L(e.accessFile);if(!t)return null;try{let n=JSON.parse(Buffer.from(t.split(".")[1]??"","base64url").toString());return typeof n.exp=="number"?n.exp-Math.floor(Date.now()/1e3):null}catch{return null}}async function Vt(e,t=60,n,o=$e()){let r=KI(o);if(r!==null&&r>t)return!0;let i=JI(o);if(!i)return r!==null&&r>0;try{return qu(await VI(e,i)),!0}catch(s){return n?.(`token refresh failed: ${s instanceof Error?s.message:String(s)}`),s instanceof wr&&(s.status===400||s.status===401)&&Ai(o),!1}}function Gy(e){return e==="node_superseded"?"This machine was unpaired when AC Bridge was set up on another computer \u2014 only one machine can be paired at a time. Sign in again here (`acbridge login`, or the app) to take the pairing back.":e==="node_revoked"?"This machine's pairing has been revoked. Sign in again (`acbridge login`, or the app) to set it up again.":null}import{createCipheriv as XI,createDecipheriv as YI,randomBytes as Wy,scryptSync as Vy,timingSafeEqual as QI}from"node:crypto";var Yu=[{provider:"tuya",name:"keystore"},{provider:"tuya",name:"cloud"},{provider:"govee",name:"keystore"},{provider:"govee",name:"cloud"},{provider:"meross",name:"keystore"},{provider:"ewelink",name:"keystore"},{provider:"esphome",name:"keystore"},{provider:"nanoleaf",name:"keystore"},{provider:"tapo",name:"tapo_lan"},{provider:"kasa-klap",name:"kasa-klap_lan"},{provider:"shelly",name:"shelly_lan"}],Pt={N:32768,r:8,p:1,keylen:32},Xu="acbridge-backup",Ju={n:1<<20,r:16,p:4},qy=256*1024*1024,Zy="Could not open the backup: wrong passphrase, or the file is damaged.";function Ku(e,t,n=!1){return typeof e!="number"||!Number.isInteger(e)||e<=0||e>t?!1:!n||(e&e-1)===0}var eC=(e,t)=>Vy(e.normalize("NFKC"),t,Pt.keylen,{N:Pt.N,r:Pt.r,p:Pt.p,maxmem:qy});function Qu(e,t,n={}){let o=n.salt??Wy(16),r=n.iv??Wy(12),i=eC(t,o),s=XI("aes-256-gcm",i,r),a=Buffer.concat([s.update(JSON.stringify(e),"utf8"),s.final()]);return JSON.stringify({magic:Xu,v:1,kdf:"scrypt",n:Pt.N,r:Pt.r,p:Pt.p,salt:o.toString("base64"),iv:r.toString("base64"),tag:s.getAuthTag().toString("base64"),ct:a.toString("base64")},null,2)}function ed(e,t){let n;try{n=JSON.parse(e)}catch{throw new Error("That file is not an AC Bridge backup (it isn't the expected JSON envelope).")}if(!(typeof n.magic=="string"&&Buffer.byteLength(n.magic)===Buffer.byteLength(Xu)&&QI(Buffer.from(n.magic),Buffer.from(Xu)))||n.v!==1||n.kdf!=="scrypt")throw new Error("That file is not an AC Bridge backup (unknown format or version).");let r=u=>Buffer.from(String(n[u]??""),"base64"),i=typeof n.n=="number"?n.n:Pt.N,s=typeof n.r=="number"?n.r:Pt.r,a=typeof n.p=="number"?n.p:Pt.p;if(!Ku(i,Ju.n,!0)||!Ku(s,Ju.r)||!Ku(a,Ju.p))throw new Error(Zy);let l;try{let u=Vy(t.normalize("NFKC"),r("salt"),Pt.keylen,{N:i,r:s,p:a,maxmem:qy}),d=YI("aes-256-gcm",u,r("iv"));d.setAuthTag(r("tag")),l=Buffer.concat([d.update(r("ct")),d.final()]).toString("utf8")}catch{throw new Error(Zy)}return JSON.parse(l)}import{chmodSync as tC,mkdirSync as nC,writeFileSync as rC}from"node:fs";import la from"node:path";function td(e){if(!e)return!1;try{return e.available()}catch{return!1}}function nd(e){return td(e)?"keyring":"file"}function oC(e,t){let n=la.dirname(e);nC(n,{recursive:!0,mode:448});try{tC(n,448)}catch{}try{rC(e,t,{mode:384,flag:"wx"})}catch(o){if(o.code==="EEXIST")return;throw o}}function iC(e){let{file:t,account:n}=e,o=()=>L(t);return{backend(){return nd(e.keyring)},read(){let r=o();if(r!==null)return r;if(!td(e.keyring))return null;try{let i=e.keyring.get(n);if(i===null)return null;if(e.index?.add(n),i!=="")try{oC(t,i)}catch{}return i}catch{return null}},write(r){let i;try{_e(t,r,384)}catch(s){i=s}if(td(e.keyring))try{e.keyring.set(n,r),e.index?.add(n)}catch{if(!i)try{e.keyring.delete(n),e.index?.remove(n)}catch{}}if(i)throw i},delete(){if(e.keyring){try{e.keyring.delete(n)}catch{}e.index?.remove(n)}Ie(t)}}}function ct(e,t,n){let o=e.providerSecretFile(t,n);return iC({keyring:Ii(),file:o,account:`${t}/${n}`,index:Ay(la.join(la.dirname(la.dirname(o)),".keyring-index"))})}var sC="AC Bridge",Vn,aC=new Set(["win32","darwin"]);function Ii(e={}){if(Vn!==void 0)return Vn;Vn=null;let t=e.require??null;if(!aC.has(e.platform??process.platform))return Vn;try{let n=t??cC();if(!n)return Vn;let{Entry:o}=n("@napi-rs/keyring"),r=i=>new o(sC,i);Vn={available(){try{return r("__acb_probe__").getPassword(),!0}catch{return!1}},get:i=>r(i).getPassword(),set:(i,s)=>r(i).setPassword(s),delete:i=>{r(i).deletePassword()}}}catch{Vn=null}return Vn}function cC(){try{return typeof me=="function"?me:null}catch{return null}}import{spawnSync as lC}from"node:child_process";import{existsSync as uC}from"node:fs";import dC from"node:os";import Jy from"node:path";function ua(e){if(e==="win32"){let n="irm https://claude.ai/install.ps1 | iex";return{file:"powershell",args:["-NoProfile","-ExecutionPolicy","Bypass","-Command",n],manualCommand:n,altCommands:["winget install Anthropic.ClaudeCode"]}}let t="curl -fsSL https://claude.ai/install.sh | bash";return{file:"sh",args:["-c",t],manualCommand:t,altCommands:[]}}function Ky(e,t){if(e==="win32"){let o=Jy.win32;return[o.join(t,".local","bin","claude.exe"),o.join(t,".claude","local","claude.exe")]}let n=Jy.posix;return[n.join(t,".local","bin","claude"),n.join(t,".claude","local","claude"),"/opt/homebrew/bin/claude","/usr/local/bin/claude"]}var Xy=/\.(cmd|bat)$/i,pC=/^\/mnt\/[a-z]\//i;function Yy(e){let t=e.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(t.length===0)return null;let n=t.filter(s=>!pC.test(s)),o=n.length>0?n:t,r=o.find(s=>/\.exe$/i.test(s));if(r)return r;let i=o.find(s=>Xy.test(s));return i||(o[0]??null)}function da(e){return Xy.test(e)?{file:"cmd.exe",argsPrefix:["/c",e]}:{file:e,argsPrefix:[]}}function Qy(e){let n=lC(e,e==="which"?["-a","claude"]:["claude"],{encoding:"utf8"});return{status:n.status??1,stdout:n.stdout??""}}function eb(e,t){let n=t.home??dC.homedir(),o=t.fileExists??uC;for(let r of Ky(e,n))if(o(r))return r;return null}function yn(e,t={}){let n=e?.trim();if(n)return da(n);let o=t.platform??process.platform,r=t.runFinder??Qy,i=o==="win32"?"where":"which";try{let a=r(i);if(a.status===0){let l=Yy(a.stdout);if(l)return da(l)}}catch{}let s=eb(o,t);return da(s||"claude")}function pa(e,t={}){if(e?.trim())return!0;let n=t.platform??process.platform,o=t.runFinder??Qy;try{let r=o(n==="win32"?"where":"which");if(r.status===0&&Yy(r.stdout)!==null)return!0}catch{}return eb(n,t)!==null}import{spawnSync as mC}from"node:child_process";import{existsSync as tb,readdirSync as fC}from"node:fs";import nb from"node:os";import fa from"node:path";var rb=/\.(cmd|bat)$/i,gC=/^\/mnt\/[a-z]\//i;function hC(e){let t=e.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(t.length===0)return null;let n=t.filter(s=>!gC.test(s)),o=n.length>0?n:t,r=o.find(s=>/\.exe$/i.test(s));if(r)return r;let i=o.find(s=>rb.test(s));return i||(o[0]??null)}function ma(e){return rb.test(e)?{file:"cmd.exe",argsPrefix:["/c",e]}:{file:e,argsPrefix:[]}}function vC(e,t,n=[]){if(e==="win32"){let r=fa.win32;return[r.join(t,"AppData","Roaming","npm","codex.cmd"),r.join(t,"AppData","Roaming","npm","codex.exe"),r.join(t,".local","bin","codex.exe")]}let o=fa.posix;return[...[...n].sort().reverse().map(r=>o.join(t,".nvm","versions","node",r,"bin","codex")),"/opt/homebrew/bin/codex","/usr/local/bin/codex",o.join(t,".local","bin","codex")]}function yC(e){try{return fC(fa.posix.join(e,".nvm","versions","node"))}catch{return[]}}function bC(e,t){let n=t.home??nb.homedir(),o=t.fileExists??tb,r=e==="win32"?[]:(t.nodeVersions??yC)(n);for(let i of vC(e,n,r))if(o(i))return i;return null}function xC(e){let n=mC(e,e==="which"?["-a","codex"]:["codex"],{encoding:"utf8"});return{status:n.status??1,stdout:n.stdout??""}}function so(e,t={}){let n=e?.trim();if(n)return ma(n);let o=t.platform??process.platform,r=t.runFinder??xC,i=o==="win32"?"where":"which";try{let a=r(i);if(a.status===0){let l=hC(a.stdout);if(l)return ma(l)}}catch{}let s=bC(o,t);return ma(s||"codex")}function ga(e){let t=e?.home??nb.homedir();return tb(fa.join(t,".codex","auth.json"))}import{spawnSync as kC}from"node:child_process";import{readFileSync as ob}from"node:fs";import ib from"node:path";function wC(e){try{let t=Number(ob(e,"utf8").trim());return Number.isInteger(t)&&t>0?t:null}catch{return null}}function SC(e){kC("pkill",["-f",e])}function _C(){try{return Gu(ob(ib.join(ee,kr),"utf8"))?.pid??null}catch{return null}}function sb(e={}){let t=e.platform??process.platform,n=e.pidFile??Ci,o=e.readPid??wC,r=e.readBeaconPid??_C,i=e.kill??(l=>process.kill(l)),s=e.sweep??SC,a=o(n);if(a!==null&&r()===a)try{i(a)}catch{}if(t!=="win32"){for(let l of e.sweepPatterns??[])if(ib.isAbsolute(l))try{s(l)}catch{}}}import{accessSync as $C,constants as EC,mkdtempSync as AC,readFileSync as IC,writeFileSync as ab}from"node:fs";import CC from"node:os";import ha from"node:path";var Fe="bridge",et="alexa";function Sr(e=process.platform){switch(e){case"darwin":return"/Library/Application Support/ClaudeCode/managed-settings.json";case"win32":return"C:\\Program Files\\ClaudeCode\\managed-settings.json";default:return"/etc/claude-code/managed-settings.json"}}function cb(e,t=!1){let n={...e};if(t){n.channelsEnabled=!0;let o={marketplace:Fe,plugin:et},r=Array.isArray(e.allowedChannelPlugins)?[...e.allowedChannelPlugins]:[];r.some(i=>i.marketplace===o.marketplace&&i.plugin===o.plugin)||r.push(o),n.allowedChannelPlugins=r}return n}function ao(e){return`'${e.replace(/'/g,"'\\''")}'`}function co(e){return`"${e}"`}function PC(e){return`'${e.replace(/'/g,"''")}'`}function TC(e,t,n){return`mkdir -p ${ao(e)} && install -m 0644 ${ao(t)} ${ao(n)}`}function od(e,t){return(e==="win32"?ha.win32:ha.posix).dirname(t)}function RC(e,t,n){let o=od(e,n);return e==="win32"?`md ${co(o)} 2>nul & copy /y ${co(t)} ${co(n)}`:TC(o,t,n)}function OC(e,t){return e==="darwin"?[{method:"osascript",file:"osascript",args:["-e",`do shell script "${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}" with administrator privileges`]}]:e==="win32"?[{method:"uac",file:"powershell",args:["-NoProfile","-Command",`Start-Process -Verb RunAs -Wait -FilePath cmd.exe -ArgumentList '/c',${PC(t)}`]}]:[{method:"pkexec",file:"pkexec",args:["sh","-c",t]},{method:"sudo",file:"sudo",args:["sh","-c",t]}]}function lb(e,t,n){return OC(e,RC(e,t,n))}function ub(e,t,n){let o=od(e,n);return e==="win32"?`md ${co(o)} & copy /y ${co(t)} ${co(n)}`:`sudo mkdir -p ${ao(o)} && sudo install -m 0644 ${ao(t)} ${ao(n)}`}function DC(e){try{return IC(e,"utf8")}catch{return""}}function NC(e){try{return $C(e,EC.W_OK),!0}catch{return!1}}function LC(e,t){ab(e,t,{mode:420})}function UC(e,t,n){let o=t(e),r={};try{r=JSON.parse(o)}catch{}let i=cb(r,n),s=JSON.stringify(i,null,2)+`
|
|
14
|
+
`;return!n&&JSON.stringify(i)===JSON.stringify(r)?{existing:r,json:s,changed:!1}:{existing:r,json:s,changed:o.trim()!==s.trim()}}function db(e){let t=e.platform??process.platform,n=e.settingsPath??Sr(t),o=e.readDest??DC,r=e.dirWritable??NC,i=e.writeDirect??LC,s=e.tmpDir??CC.tmpdir(),a=e.stage??(g=>{let h=AC(ha.join(s,"acbridge-")),y=ha.join(h,"managed-settings.json");return ab(y,g,{mode:420}),y}),l=e.voice??!1,{existing:u,json:d,changed:p}=UC(n,o,l),m=l&&u.allowedChannelPlugins===void 0;if(!p)return{path:n,changed:!1,json:d,usedSudo:!1,method:"unchanged",replacedDefaultAllowlist:m};if(r(od(t,n)))return i(n,d),{path:n,changed:!0,json:d,usedSudo:!1,method:"direct",replacedDefaultAllowlist:m};let f=a(d);for(let g of lb(t,f,n))if(e.runElevated(g),o(n).trim()===d.trim())return{path:n,changed:!0,json:d,usedSudo:g.method==="sudo",method:g.method,replacedDefaultAllowlist:m};throw new Error(`could not write ${n} with elevation (canceled or unavailable). Run it manually:
|
|
15
|
+
${ub(t,f,n)}`)}var va=["domain","private"],pb='powershell -NoProfile -NonInteractive -Command "';function jC(e){return`'${e.replace(/'/g,"''")}'`}var mb=`${pb}$c = @(Get-NetConnectionProfile -ErrorAction SilentlyContinue | ForEach-Object { [string]$_.NetworkCategory }) -replace 'DomainAuthenticated','Domain'; ConvertTo-Json -Compress -InputObject @(Get-NetFirewallProfile -ErrorAction SilentlyContinue | ForEach-Object { [pscustomobject]@{ Name = [string]$_.Name; Enabled = [string]$_.Enabled; Active = ($c -contains [string]$_.Name) } })"`;function ya(e){return`${pb}ConvertTo-Json -Compress -InputObject @(Get-NetFirewallApplicationFilter -All -ErrorAction SilentlyContinue | Where-Object { $_.Program -eq ${jC(e)} } | ForEach-Object { $p = [string]$_.Program; $_ | Get-NetFirewallRule -ErrorAction SilentlyContinue | ForEach-Object { [pscustomobject]@{ Name = [string]$_.Name; DisplayName = [string]$_.DisplayName; Enabled = [string]$_.Enabled; Direction = [string]$_.Direction; Action = [string]$_.Action; Profile = [string]$_.Profile; Program = $p } } })"`}function fb(e){let t=e.replace(/^\uFEFF/,"").trim();if(t==="")return[];let n;try{n=JSON.parse(t)}catch{return[]}return(Array.isArray(n)?n:[n]).filter(r=>typeof r=="object"&&r!==null)}var id=e=>e===!0||typeof e=="string"&&/^true$/i.test(e.trim());function zC(e){let t=new Set;for(let n of e.split(",")){let o=n.trim().toLowerCase();if(o==="any")return["domain","private","public"];(o==="domain"||o==="private"||o==="public")&&t.add(o)}return[...t]}function gb(e){let t=[];for(let n of fb(e)){let o=String(n.Name??"").trim().toLowerCase();o!=="domain"&&o!=="private"&&o!=="public"||id(n.Active)&&t.push({profile:o,firewallOn:id(n.Enabled)})}return t}function Pi(e,t){let n=t.trim().toLowerCase(),o=[];for(let r of fb(e))String(r.Program??"").trim().toLowerCase()===n&&/^inbound$/i.test(String(r.Direction??"").trim())&&o.push({name:String(r.Name??""),displayName:String(r.DisplayName??""),enabled:id(r.Enabled),allow:/^allow$/i.test(String(r.Action??"").trim()),profiles:zC(String(r.Profile??""))});return o}function FC(e){let t=new Set;for(let n of e)if(!(!n.enabled||!n.allow))for(let o of n.profiles)t.add(o);return[...t]}function hb(e,t){let n=t.trim().toLowerCase();return e.some(o=>o.enabled&&o.allow&&o.displayName.trim().toLowerCase()===n)}function MC(e,t=va){let n=new Set(t.map(o=>o.toLowerCase()));return e.filter(o=>o.firewallOn&&!n.has(o.profile)).map(o=>o.profile)}function BC(e,t=va){if(MC(e,t).length!==0)return"This network is set to Public, and the LAN-discovery rule only covers Domain and Private networks \u2014 so Windows is still dropping the replies device scanning needs. In Settings \u2192 Network & internet, open this network and set its profile to Private, then scan again."}function sd(e){return e.filter(t=>t.enabled&&!t.allow)}var HC="Windows is blocking this app on your network: it created a Block rule when its firewall prompt was dismissed, and a Block rule always wins over the allow rule the bridge adds. Re-run the firewall setup (Scan \u2192 Allow through firewall, or `acbridge setup`) \u2014 it removes the block rules first.";function GC(e){return sd(e).length>0?HC:void 0}function vb(e,t){return GC(t)??BC(e,FC(t))}var cd={udpDstFixed:[4002,6666,6667],udpDstMulticast:[5353],udpSrcBroadcastReply:[9999,20002,38899,56700,1900,1982,3702]},lo=[...cd.udpDstFixed,...cd.udpDstMulticast],Ti=cd.udpSrcBroadcastReply;function xb(e){return e==="app"?"AC Bridge (App)":"AC Bridge (CLI)"}var kb="AC Bridge discovery",wb="AC Bridge replies",WC="macOS will still show one 'Local Network' permission prompt on your first scan \u2014 that prompt cannot be pre-granted; click Allow.";function uo(e){return/you need to be root|need(?:s)? to be root|must be run as root|requires? (?:super\s?user|root)|operation not permitted|permission denied|are you root/i.test(e)}function _r(e,t,n={}){if(e==="win32")return"windows";let o=n.isWsl??Zn();if(e==="linux"&&o)return"wsl-host";if(e==="darwin"){let i=t.alfGlobalStateOut??"";return/firewall is enabled/i.test(i)||uo(i)?"macos-alf":"none"}let r=t.ufwStatusOut??"";return/status:\s*active/i.test(r)?"ufw":(t.firewallCmdStateOut??"").trim()==="running"?"firewalld":uo(r)?"ufw":"none"}function ba(e,t){if(e==="win32")return{};if(e==="darwin")return{alfGlobalStateOut:t("/usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate")};let n=t("ufw status");return/status:\s*active/i.test(n)?{ufwStatusOut:n}:{ufwStatusOut:n,firewallCmdStateOut:t("firewall-cmd --state")}}function ZC(e,t,n=[]){if(e.length===0)return{state:"nothing-to-do"};let o=e.map((u,d)=>e.length>1?`${t} (${d+1})`:t),r=new Set(o.map(u=>u.trim().toLowerCase())),i=[...new Set(n)].filter(u=>!r.has(u.trim().toLowerCase())).flatMap(u=>e.map(d=>`netsh advfirewall firewall delete rule name="${u}" dir=in program="${d}" >nul 2>&1`)),s=e.map((u,d)=>{let p=o[d];return`netsh advfirewall firewall delete rule name="${p}" >nul 2>&1 & netsh advfirewall firewall add rule name="${p}" dir=in action=allow program="${u}" protocol=udp profile=${va.join(",")} remoteip=localsubnet enable=yes`}),a=[...i,...s].join(" & "),l=e.map(u=>ya(u));return{applyScript:a,checkCommands:l,evalCheck:u=>u.every((d,p)=>hb(Pi(d,e[p]),o[p])),manualCommand:a,needsElevation:!0}}function VC(e){if(e.length===0)return{state:"nothing-to-do"};let t=e.flatMap(o=>[`/usr/libexec/ApplicationFirewall/socketfilterfw --add "${o}"`,`/usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp "${o}"`]),n=e.map(o=>`/usr/libexec/ApplicationFirewall/socketfilterfw --getappblocked "${o}"`);return{applyScript:t.join(" && "),checkCommands:n,evalCheck:o=>o.every((r,i)=>XC(r,e[i])),manualCommand:t.map(o=>`sudo ${o}`).join(" && "),needsElevation:!0,userNote:WC}}function qC(){let e=lo.join(","),t=Ti.join(","),n=`ufw allow in proto udp to any port ${e} comment '${kb}'`,o=`ufw allow in proto udp from any port ${t} comment '${wb}'`;return{applyScript:`${n} && ${o}`,checkCommands:["ufw status"],evalCheck:r=>YC(r[0]??""),manualCommand:`sudo ${n} && sudo ${o}`,needsElevation:!0}}function JC(){let e=lo.map(o=>`firewall-cmd --permanent --add-port=${o}/udp`),t=Ti.map(o=>`firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source-port port="${o}" protocol="udp" accept'`),n=[...e,...t,"firewall-cmd --reload"];return{applyScript:n.join(" && "),checkCommands:["firewall-cmd --list-ports","firewall-cmd --list-rich-rules"],evalCheck:o=>QC(o[0]??"",lo)&&eP(o[1]??"",Ti),manualCommand:n.map(o=>`sudo ${o}`).join(" && "),needsElevation:!0}}function Ri(e,t){switch(e){case"windows":return ZC(t.programs,t.ruleName,t.blockRuleNames??[]);case"macos-alf":return VC(t.programs);case"ufw":return qC();case"firewalld":return JC();case"wsl-host":return{state:"nothing-to-do"};case"none":return{state:"nothing-to-do"}}}var yb="{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}",ad="You're running inside WSL, so LAN device discovery is governed by the WINDOWS side, not by ufw/firewalld inside this distro \u2014 changing those here has no effect on scanning. ",bb=`On Windows, the gate is the HYPER-V firewall (on by default since WSL 2.0.9), not Windows Defender Firewall \u2014 a Defender program rule cannot reach traffic entering the VM. In an elevated PowerShell: New-NetFirewallHyperVRule -Name 'ACBridgeDiscovery' -DisplayName 'AC Bridge discovery' -VMCreatorId '${yb}' -Direction Inbound -Protocol UDP -Action Allow -LocalPorts ${lo.join(",")} \u2014 that covers the query ports; replies from broadcast-probed devices land on a random local port, so if scanning is still short, the whole-VM form is the one that covers everything: Set-NetFirewallHyperVVMSetting -Name '${yb}' -DefaultInboundAction Allow. Also check the network is set to Private, not Public.`,KC="This distro is on WSL's DEFAULT (NAT) networking, where LAN multicast never reaches the VM at all \u2014 no firewall rule can change that. Switch to mirrored networking: create or edit %USERPROFILE%\\.wslconfig on the Windows side with the two lines `[wsl2]` and `networkingMode=mirrored`, then run `wsl --shutdown` from Windows and reopen this distro. Also check the network is set to Private, not Public.";function Oi(e){return e==="nat"?`${ad}${KC}`:e==="mirrored"?`${ad}${bb}`:`${ad}${bb} If scanning still misses devices, you may be on WSL's default NAT networking, where LAN multicast never reaches the VM: switch to mirrored networking (%USERPROFILE%\\.wslconfig \u2192 \`[wsl2]\` + \`networkingMode=mirrored\`, then \`wsl --shutdown\`).`}function XC(e,t){return e.includes(t)&&/is not blocked/i.test(e)}function YC(e){return/status:\s*active/i.test(e)&&e.includes(kb)&&e.includes(wb)}function QC(e,t){return t.every(n=>e.includes(`${n}/udp`))}function eP(e,t){return t.every(n=>e.includes(`source-port port="${n}"`))}function Sb(e){let{platform:t,programs:n,ruleName:o,runElevated:r,runCheck:i}=e,s=e.isWsl===void 0?{}:{isWsl:e.isWsl};if(_r(t,{},s)==="wsl-host")return{backend:"wsl-host",status:"nothing-to-do",changed:!1,userNote:Oi()};let l=_r(t,ba(t,i),s);if(l==="none")return{backend:l,status:"nothing-to-do",changed:!1};let u=Ri(l,{programs:n,ruleName:o});if("state"in u)return{backend:l,status:"nothing-to-do",changed:!1};let d=u.checkCommands.map(i);if(u.evalCheck(d))return{backend:l,status:"unchanged",changed:!1,userNote:u.userNote};let p=d.some(uo),m=u.applyScript;if(l==="windows"){let g=d.flatMap((h,y)=>sd(Pi(h,n[y]??"")));if(g.length>0){let h=Ri(l,{programs:n,ruleName:o,blockRuleNames:g.map(y=>y.displayName)});"state"in h||(m=h.applyScript)}}r(m);let f=u.checkCommands.map(i);return u.evalCheck(f)?{backend:l,status:"changed",changed:!0,userNote:u.userNote}:p||f.some(uo)?{backend:l,status:"changed",changed:!0,userNote:tP(u)}:{backend:l,status:"needs-elevation",changed:!1,manualCommand:u.manualCommand,userNote:u.userNote}}function tP(e){let t=`Added the LAN-discovery firewall rule, but couldn't verify it without root. If device scanning still misses devices, re-run: ${e.manualCommand}`;return e.userNote?`${e.userNote} ${t}`:t}function nP(e,t){switch(e){case"windows":return t.programs.length===0?null:t.programs.map((o,r)=>t.programs.length>1?`${t.ruleName} (${r+1})`:t.ruleName).map(o=>`netsh advfirewall firewall delete rule name="${o}" >nul 2>&1`).join(" & ");case"macos-alf":return t.programs.length===0?null:t.programs.map(n=>`/usr/libexec/ApplicationFirewall/socketfilterfw --remove "${n}"`).join(" && ");case"ufw":return`ufw delete allow in proto udp to any port ${lo.join(",")} && ufw delete allow in proto udp from any port ${Ti.join(",")}`;case"firewalld":return[...lo.map(n=>`firewall-cmd --permanent --remove-port=${n}/udp`),...Ti.map(n=>`firewall-cmd --permanent --remove-rich-rule='rule family="ipv4" source-port port="${n}" protocol="udp" accept'`),"firewall-cmd --reload"].join(" && ");case"wsl-host":case"none":return null}}function _b(e){let{platform:t,programs:n,ruleName:o,runElevated:r,runCheck:i}=e,s=e.isWsl===void 0?{}:{isWsl:e.isWsl};if(_r(t,{},s)==="wsl-host")return{backend:"wsl-host",status:"nothing-to-do",changed:!1};let a=_r(t,ba(t,i),s);if(a==="none")return{backend:a,status:"nothing-to-do",changed:!1};let l=Ri(a,{programs:n,ruleName:o}),u=nP(a,{programs:n,ruleName:o});if("state"in l||u===null)return{backend:a,status:"nothing-to-do",changed:!1};let d=l.checkCommands.map(i);if(!l.evalCheck(d)&&!d.some(uo))return{backend:a,status:"unchanged",changed:!1};r(u);let p=l.checkCommands.map(i);if(!l.evalCheck(p)||p.some(uo))return{backend:a,status:"changed",changed:!0};let m=t==="win32"?u:u.split(" && ").map(f=>`sudo ${f}`).join(" && ");return{backend:a,status:"needs-elevation",changed:!1,manualCommand:m}}import{spawnSync as rP}from"node:child_process";import{existsSync as oP,readFileSync as xa,readdirSync as iP}from"node:fs";import{homedir as sP}from"node:os";import{join as Tt,resolve as aP}from"node:path";var Eb=()=>Tt(sP(),".claude","plugins"),$b=e=>{let t=aP(e).replace(/[/\\]+$/,"");return process.platform==="win32"||process.platform==="darwin"?t.toLowerCase():t};function Ab(){try{let t=JSON.parse(xa(Tt(Eb(),"known_marketplaces.json"),"utf8"))?.[Fe]?.source;return typeof t?.path=="string"?t.path:null}catch{return null}}function ud(){try{let t=JSON.parse(xa(Tt(Eb(),"installed_plugins.json"),"utf8"))?.plugins?.[`${et}@${Fe}`]?.[0];return typeof t?.installPath=="string"?t.installPath:null}catch{return null}}var ld=(e,t)=>{try{return xa(e,"utf8")===xa(t,"utf8")}catch{return!1}};function cP(){return["hooks/hooks.json",".mcp.json"]}function lP(e){let t=ud();if(!t)return!1;let n=Tt(e,"plugins",et);for(let i of cP())if(!ld(Tt(n,i),Tt(t,i)))return!1;let o=Tt(n,"dist","channel.mjs");if(oP(o)&&!ld(o,Tt(t,"dist","channel.mjs")))return!1;let r;try{r=iP(Tt(n,"scripts"))}catch{return!1}return r.every(i=>ld(Tt(n,"scripts",i),Tt(t,"scripts",i)))}function Ib(e){return t=>{let n=rP(e.file,[...e.argsPrefix,...t],{encoding:"utf8"});return{ok:n.status===0,out:`${n.stdout??""}${n.stderr??""}${n.error?n.error.message:""}`}}}function Cb(e){let t=Ib(e.claudeCmd),n=(e.installedDir??ud)(),o=(e.registeredDir??Ab)(),r=n!==null&&t(["plugin","uninstall",`${et}@${Fe}`]).ok,i=o!==null&&t(["plugin","marketplace","remove",Fe]).ok;return{pluginUninstalled:r,marketplaceRemoved:i}}function Pb(e){let{marketplaceDir:t,claudeCmd:n}=e,o=Ib(n),r=Ab(),i=!1;if(r===null||$b(r)!==$b(t)){r!==null&&o(["plugin","marketplace","remove",Fe]);let a=o(["plugin","marketplace","add",t]);if(!a.ok)throw new Error(`marketplace add failed:
|
|
16
|
+
${a.out}`);i=!0}let s=!1;if(i||!lP(t)){o(["plugin","marketplace","update",Fe]),ud()!==null&&o(["plugin","uninstall",`${et}@${Fe}`]);let a=o(["plugin","install",`${et}@${Fe}`]);if(!a.ok)throw new Error(`plugin install failed:
|
|
17
|
+
${a.out}`);s=!0}return{marketplaceRepointed:i,pluginReinstalled:s}}import{readFileSync as zb,writeFileSync as hP}from"node:fs";import{mkdirSync as uP,readFileSync as Ob,writeFileSync as dP}from"node:fs";import pP from"node:os";import dd from"node:path";function Db(e,t="node"){return`${t} "${dd.join(e,"plugins","alexa","scripts","statusline.mjs")}"`}function ka(){return dd.join(pP.homedir(),".claude","settings.json")}var Nb=e=>{let t=e.statusLine,n=t&&typeof t=="object"?t.command:void 0;return typeof n=="string"&&n?n:void 0},mP="plugins/alexa/scripts/statusline.mjs",fP="plugins\\alexa\\scripts\\statusline.mjs";function pd(e){return e.includes(mP)||e.includes(fP)}function Tb(e){let t=e.statusline,n=t&&typeof t=="object"&&!Array.isArray(t)?t.prev:void 0,o=typeof n=="string"&&n?n:null;return o!==null&&pd(o)?{prev:null,poisoned:!0}:{prev:o,poisoned:!1}}function gP(e){let t=e.statusline,n=t&&typeof t=="object"&&!Array.isArray(t)?{...t}:{};return delete n.prev,{...e,statusline:n}}function Lb(e,t){let n=Nb(e);return n===t?{settings:e,prev:void 0,changed:!1}:n!==void 0&&pd(n)?{settings:{...e,statusLine:{type:"command",command:t}},prev:void 0,changed:!0}:{settings:{...e,statusLine:{type:"command",command:t}},prev:n??null,changed:!0}}function Ub(e,t){let n=t?.settingsFile??ka(),o=t?.configFile??Ee,r=t?.env??process.env,i=Rb(o),s=Rb(n),a=i.value,u=!(r.BRIDGE_STATUSLINE==="0"||r.BRIDGE_STATUSLINE==="false")&&a.autoStatusline!==!1;if(s.state==="corrupt"||i.state==="corrupt")return{enabled:u,changed:!1};let d=s.value,p=Db(e,t?.nodeCommand);if(u){let y=Lb(d,p),{poisoned:x}=Tb(a);return!y.changed&&!x?{enabled:u,changed:!1}:(y.changed&&Di(n,y.settings),y.prev!==void 0?Di(o,{...a,statusline:{prev:y.prev}}):x&&Di(o,gP(a)),{enabled:u,changed:!0})}let m=Nb(d);if(!m||!pd(m))return{enabled:u,changed:!1};let{prev:f}=Tb(a),g={...d};f?g.statusLine={type:"command",command:f}:delete g.statusLine,Di(n,g);let h={...a};return delete h.statusline,Di(o,h),{enabled:u,changed:!0}}function Rb(e){let t;try{t=Ob(e,"utf8")}catch{return{state:"absent",value:{}}}t.charCodeAt(0)===65279&&(t=t.slice(1));try{let n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?{state:"ok",value:n}:{state:"corrupt",value:{}}}catch{return{state:"corrupt",value:{}}}}function Di(e,t){let n=JSON.stringify(t,null,2)+`
|
|
18
|
+
`;try{if(Ob(e,"utf8")===n)return}catch{}uP(dd.dirname(e),{recursive:!0}),dP(e,n)}var jb=["mcp__plugin_alexa_alexa__list_devices","mcp__plugin_alexa_alexa__get_device","mcp__plugin_alexa_alexa__set_device","mcp__plugin_alexa_alexa__run_scene","Bash(acbridge devices *)","Bash(acbridge brief *)"];function vP(e){let t=(e?.env??process.env).BRIDGE_AGENT_PERMS;if(t==="0"||t==="false")return!1;try{if(JSON.parse(zb(e?.configFile??Ee,"utf8")).autoAgentPermissions===!1)return!1}catch{}return!0}function yP(e,t){let n={};if(e!==null&&e.trim()!=="")try{let l=JSON.parse(e);if(typeof l!="object"||l===null||Array.isArray(l))return{next:null,corrupt:!0};n=l}catch{return{next:null,corrupt:!0}}let o=typeof n.permissions=="object"&&n.permissions!==null&&!Array.isArray(n.permissions)?n.permissions:{},r=Array.isArray(o.allow)?o.allow:[],i=t?[...r,...jb.filter(l=>!r.includes(l))]:r.filter(l=>!(typeof l=="string"&&jb.includes(l)));if(i.length===r.length&&i.every((l,u)=>l===r[u]))return{next:null,corrupt:!1};let s={...o};i.length>0?s.allow=i:delete s.allow;let a={...n};return Object.keys(s).length>0?a.permissions=s:delete a.permissions,{next:JSON.stringify(a,null,2)+`
|
|
19
|
+
`,corrupt:!1}}function wa(e){let t=e?.settingsFile??ka(),n=vP({configFile:e?.configFile,env:e?.env}),o=null;try{o=zb(t,"utf8")}catch{o=null}if(o===null&&!n)return{enabled:n,changed:!1,corrupt:!1};let r=yP(o,n);return r.corrupt?{enabled:n,changed:!1,corrupt:!0}:r.next===null?{enabled:n,changed:!1,corrupt:!1}:(hP(t,r.next),{enabled:n,changed:!0,corrupt:!1})}import{existsSync as bP,mkdirSync as xP,readFileSync as kP,writeFileSync as wP}from"node:fs";import Mb from"node:os";import Sa from"node:path";function po(e=Mb.homedir()){return Sa.join(e,".codex","hooks.json")}function Bb(e,t="node"){return`${t} "${Sa.join(e,"plugins","alexa","scripts","codex-signal.mjs")}"`}var Hb=["SessionStart","UserPromptSubmit","Stop","PermissionRequest","PreCompact","PostCompact","SubagentStart","SubagentStop","PostToolUse","SessionEnd"],SP="plugins/alexa/scripts/codex-signal.mjs",_P="plugins\\alexa\\scripts\\codex-signal.mjs";function $P(e){return e.includes(SP)||e.includes(_P)}function _a(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e.hooks;return Array.isArray(t)?t.some(n=>{if(!n||typeof n!="object")return!1;let o=n.command;return typeof o=="string"&&$P(o)}):!1}var EP=e=>({hooks:[{type:"command",command:e,timeout:10}]});function AP(e){let t=[];for(let[n,o]of Object.entries($a(e)))Array.isArray(o)&&o.some(_a)&&t.push(n);return t}function Gb(e){if(e===null)return new Map;let t;try{t=JSON.parse(e)}catch{return new Map}let n=new Map;for(let[o,r]of Object.entries($a(t))){if(!Array.isArray(r))continue;let i=r.findIndex(_a);i>=0&&n.set(o,i)}return n}function $a(e){let t=e&&typeof e=="object"&&!Array.isArray(e)?e.hooks:void 0;return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Wb(e){let t=new Map;for(let[n,o]of Object.entries($a(e))){if(!Array.isArray(o))continue;let r=o.filter(i=>!_a(i));r.length>0&&t.set(n,r)}return t}function IP(e,t){let n=Wb(e);for(let o of Hb){let r=n.get(o)??[];r.push(EP(t)),n.set(o,r)}return{hooks:Object.fromEntries(n)}}function CP(e){return{hooks:Object.fromEntries(Wb(e))}}function PP(e){return Object.values($a(e)).some(t=>Array.isArray(t)&&t.some(n=>_a(n)))}function TP(e){return JSON.stringify(e,null,2)+`
|
|
20
|
+
`}function md(e){try{return kP(e,"utf8")}catch{return null}}function RP(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=e.hooks;return t===void 0||typeof t=="object"&&t!==null&&!Array.isArray(t)}function OP(e){if(e===null)return{value:void 0,corrupt:!1};let t=e.charCodeAt(0)===65279?e.slice(1):e,n;try{n=JSON.parse(t)}catch{return{value:void 0,corrupt:!0}}return RP(n)?{value:n,corrupt:!1}:{value:void 0,corrupt:!0}}function DP(e){return OP(md(e))}function NP(e){let t=md(e);if(t===null)return{};try{let n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}catch{return{}}}function LP(e){let t=NP(e?.configFile??Ee),n=e?.env??process.env;return!(n.BRIDGE_CODEX_HOOKS==="0"||n.BRIDGE_CODEX_HOOKS==="false")&&t.autoCodexHooks!==!1}function Zb(e,t){let n=t?.home??Mb.homedir(),o=po(n),r=t?.configFile??Ee,i=t?.env??process.env,s=LP({configFile:r,env:i});if(!bP(Sa.dirname(o)))return{enabled:s,skipped:!0,changed:!1,corrupt:!1};let{value:a,corrupt:l}=DP(o);if(l)return{enabled:s,skipped:!1,changed:!1,corrupt:!0};if(!s)return PP(a)?Fb(o,CP(a),s,l):{enabled:s,skipped:!1,changed:!1,corrupt:l};let u=Bb(e,t?.nodeCommand),d=AP(a),p=Fb(o,IP(a,u),s,l);if(p.changed&&d.length>0){let m=Hb.filter(f=>!d.includes(f));if(m.length>0)return{...p,addedEvents:m}}return p}function Fb(e,t,n,o){let r=TP(t);return md(e)===r?{enabled:n,skipped:!1,changed:!1,corrupt:o}:(xP(Sa.dirname(e),{recursive:!0}),wP(e,r),{enabled:n,skipped:!1,changed:!0,corrupt:o})}import{existsSync as FP,mkdirSync as MP,readFileSync as qb,writeFileSync as BP}from"node:fs";import HP from"node:os";import gd from"node:path";import UP from"node:os";import jP from"node:path";function Ea(e=UP.homedir()){return jP.join(e,".codex","config.toml")}function zP(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase()}function fd(e,t){let n=Gb(e);if(n.size===0)return{known:!0,untrusted:[]};if(t===null)return{known:!1};let o=new Set;for(let i of t.split(/\r?\n/)){let s=i.trim();if(!s.startsWith('[hooks.state."')||!s.endsWith('"]'))continue;let l=s.slice(s.indexOf('"')+1,s.lastIndexOf('"')).split(":");if(l.length<4)continue;let u=l[l.length-1],d=l[l.length-2],p=l[l.length-3];u==="0"&&o.add(`${p}:${d}`)}let r=[];for(let[i,s]of n)o.has(`${zP(i)}:${s}`)||r.push(i);return{known:!0,untrusted:r}}var hd="# >>> AC Bridge managed (acbridge setup) \u2014 do not edit >>>",Ni="# <<< AC Bridge managed <<<";function Vb(e){return`"${(e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e).replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}var GP=["list_devices","get_device","set_device","run_scene"];function WP(e,t="node"){let n=gd.join(e,"plugins","alexa","dist","channel.mjs");return[hd,"[mcp_servers.acbridge]",`command = ${Vb(t)}`,`args = [${Vb(n)}]`,"","[mcp_servers.acbridge.env]",'ACB_AGENT = "codex"',...GP.flatMap(o=>["",`[mcp_servers.acbridge.tools.${o}]`,'approval_mode = "approve"']),Ni].join(`
|
|
21
|
+
`)}function Aa(e){return e.split(/\r?\n/).some(t=>{let n=t.trim();return n.startsWith("[mcp_servers.acbridge]")||n.startsWith("[mcp_servers.acbridge.")})}function ZP(e,t){let n=e??"",o=n.indexOf(hd),r=n.indexOf(Ni);if(o>=0!=r>=0||o>=0&&r<o)return{next:null,blocked:"malformed"};if(o>=0){let i=n.slice(0,o),s=n.slice(r+Ni.length);if(t===null){let l=(i.endsWith(`
|
|
22
|
+
|
|
23
|
+
`)?i.slice(0,-1):i)+s.replace(/^\n/,"");return{next:e===null?null:l,blocked:null}}return Aa(i)||Aa(s)?{next:null,blocked:"foreign"}:{next:i+t+s,blocked:null}}return t===null?{next:e,blocked:null}:Aa(n)?{next:null,blocked:"foreign"}:e===null||n===""?{next:t+`
|
|
24
|
+
`,blocked:null}:{next:n+(n.endsWith(`
|
|
25
|
+
`)?"":`
|
|
26
|
+
`)+`
|
|
27
|
+
`+t+`
|
|
28
|
+
`,blocked:null}}function vd(e){let t=(e?.env??process.env).BRIDGE_CODEX_MCP;if(t==="0"||t==="false")return!1;try{if(JSON.parse(qb(e?.configFile??Ee,"utf8")).autoCodexMcp===!1)return!1}catch{}return!0}function yd(e){let t=e??"",n=t.indexOf(hd),o=t.indexOf(Ni);if(n>=0!=o>=0||n>=0&&o<n)return{installed:!1,blocked:"malformed"};let r=n>=0?t.slice(0,n)+t.slice(o+Ni.length):t;return Aa(r)?{installed:n>=0,blocked:"foreign"}:{installed:n>=0,blocked:null}}function Jb(e,t){let n=t?.home??HP.homedir(),o=Ea(n),r=vd({configFile:t?.configFile,env:t?.env});if(!FP(gd.dirname(o)))return{enabled:r,skipped:!0,changed:!1,blocked:null};let i=null;try{i=qb(o,"utf8")}catch{i=null}let s=r?WP(e,t?.nodeCommand??"node"):null,{next:a,blocked:l}=ZP(i,s);return l?{enabled:r,skipped:!1,changed:!1,blocked:l}:a===null||a===i?{enabled:r,skipped:!1,changed:!1,blocked:null}:(MP(gd.dirname(o),{recursive:!0}),BP(o,a),{enabled:r,skipped:!1,changed:!0,blocked:null})}function Kb(e){let t=/(\d+)\.(\d+)\.(\d+)/.exec(e??""),n=Number(t?.[1]??0),o=Number(t?.[2]??0),r=Number(t?.[3]??0);return{ok:n>2||n===2&&(o>1||o===1&&r>=80),version:t?.[0]??null}}function Xb(e){return{ok:new RegExp(`${et}@${Fe}`).test(e??"")}}function Yb(e){if(e===null)return{present:!1,allowed:!1};let t;try{t=JSON.parse(e)}catch{return{present:!1,allowed:!1}}return{present:!0,allowed:t.channelsEnabled===!0&&Array.isArray(t.allowedChannelPlugins)&&t.allowedChannelPlugins.some(o=>o.marketplace===Fe&&o.plugin===et)}}import{existsSync as VP,readdirSync as qP,readFileSync as JP}from"node:fs";import Qb from"node:os";function KP(e,t,n){let o=n.readFile(`${e}${t}plugins${t}installed_plugins.json`);if(!o)return!1;try{return!!JSON.parse(o)?.plugins?.[`${et}@${Fe}`]}catch{return!1}}function XP(e){return/^\\\\(?:wsl\.localhost|wsl\$)\\([^\\]+)\\/i.exec(e)?.[1]??null}function YP(e){let t=e.platform==="win32"?"\\":"/",n=(s,a,l,u,d)=>{let p=`${s}${t}.claude`;return{id:l,label:u,kind:a,home:s,claudeDir:p,claudePresent:e.exists(p),pluginInstalled:KP(p,t,e),setupHint:d}},o=e.env.WSL_DISTRO_NAME,r=e.isWsl?`this environment (WSL${o?`: ${o}`:""})`:e.platform==="win32"?"this environment (Windows)":"this environment",i=[n(e.homeDir,"current","current",r,"acbridge setup")];for(let s of Wu(e)){let a=`${s}${t}.claude`;if(e.exists(a))if(e.isWsl){let l=s.split("/").pop()??e.userName;i.push(n(s,"windows",`windows:${l}`,`Windows (user ${l})`,"run `acbridge setup` in a Windows terminal"))}else{let l=XP(s)??"wsl";i.push(n(s,"wsl",`wsl:${l}`,`WSL: ${l}`,`wsl.exe -d ${l} -- acbridge setup`))}}return i}function ex(){let e=r=>{try{return JP(r,"utf8")}catch{return null}},t=r=>{try{return qP(r)}catch{return[]}},n="";try{n=Qb.userInfo().username}catch{n=process.env.USER??process.env.USERNAME??""}let o=process.platform==="linux"&&!!(process.env.WSL_DISTRO_NAME||process.env.WSL_INTEROP||/microsoft/i.test(e("/proc/version")??""));return YP({homeDir:Qb.homedir(),env:process.env,platform:process.platform,userName:n,isWsl:o,readFile:e,listDir:t,exists:r=>VP(r)})}import{spawnSync as QP}from"node:child_process";import{existsSync as eT,readdirSync as tT,statSync as nT}from"node:fs";import{basename as tx,join as rT}from"node:path";function nx(e){try{let t=QP("git",["-C",e,"rev-parse","--abbrev-ref","HEAD"],{encoding:"utf8",timeout:2500}),n=(t.stdout??"").trim();return t.status===0&&n?n:"\u2014"}catch{return"\u2014"}}function oT(e){try{return tT(e,{withFileTypes:!0}).filter(t=>t.isDirectory()&&!t.name.startsWith(".")&&t.name!=="node_modules").map(t=>rT(e,t.name)).sort((t,n)=>t.localeCompare(n))}catch{return[]}}function iT(e){try{return eT(e)&&nT(e).isDirectory()}catch{return!1}}function rx(e,t,n){let o=n==="root"?oT(t):iT(t)?[t]:[],r=new Set(e.map(s=>s.path)),i=o.filter(s=>!r.has(s)).map(s=>({path:s,name:tx(s),bridge:tx(s),branch:nx(s),fav:!1}));return[...e,...i]}function bd(e,t,n){return e.map(o=>o.path===t?{...o,...n.bridge!==void 0?{bridge:n.bridge}:{},...n.fav!==void 0?{fav:n.fav}:{}}:o)}function ox(e){return e.map(t=>({...t,branch:nx(t.path)}))}import{spawnSync as sT}from"node:child_process";import{existsSync as aT}from"node:fs";import ix from"node:path";function cT(e,t){let n=e==="win32"?ix.win32:ix.posix,o=e==="win32"?"bridge-node.cmd":"bridge-node";return n.join(t,"bin",o)}function sx(e){let t=/(\d+)\.(\d+)\.(\d+)/.exec(e??"");return t?{major:Number(t[1]),full:t[0]}:null}function mo(e){if(e.shimExists()&&sx(e.runShimVersion())!==null)return{kind:"shim",command:e.shimPath};let t=sx(e.runNodeVersion());return t!==null&&t.major>=20?{kind:"system",command:"node",version:t.full}:{kind:"none"}}function Ia(e){return e.kind==="shim"?`"${e.command}"`:void 0}function fo(e,t=process.platform){let n=cT(t,e),o=(r,i)=>{try{let s=sT(r,i,{encoding:"utf8"});return s.status===0?s.stdout??"":null}catch{return null}};return{platform:t,shimPath:n,shimExists:()=>aT(n),runShimVersion:()=>t==="win32"?o("cmd.exe",["/c",n,"--version"]):o(n,["--version"]),runNodeVersion:()=>o("node",["--version"])}}function Ca(e={}){let t=e.configFile??Ee,n={},o=L(t);if(o)try{n=JSON.parse(o)}catch{n={}}return{claudeBin:typeof n.claudeBin=="string"?n.claudeBin:null,codexBin:typeof n.codexBin=="string"?n.codexBin:null,relayUrl:typeof n.relayUrl=="string"?n.relayUrl:null,hubPort:typeof n.hubPort=="number"?n.hubPort:null,onboardedAt:typeof n.onboardedAt=="number"?n.onboardedAt:null}}function Pa(e,t={}){let n=t.configFile??Ee,o={},r=L(n);if(r)try{o=JSON.parse(r)}catch{o={}}for(let[i,s]of Object.entries(e))s===null?delete o[i]:s!==void 0&&(o[i]=s);return _e(n,JSON.stringify(o,null,2)+`
|
|
29
|
+
`,384),o}import{createHash as lT,randomBytes as ax}from"node:crypto";var xd=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");function cx(){let e=xd(ax(32)),t=xd(lT("sha256").update(e).digest());return{verifier:e,challenge:t}}function Ta(){return xd(ax(24))}var uT="https://api.workos.com";var dT="client_01KW2CY31D0NZKCDKNHF2XQ7VC",pT="org_01KW0DNZ14H6JMK8RHA0WSKNVZ";function lx(e=t=>process.env[t]){let t=e("WORKOS_CLIENT_ID")??dT,n=Number(e("WORKOS_REDIRECT_PORT")??8765)||8765,o=(e("WORKOS_API_HOST")??uT).replace(/\/+$/,""),r=e("WORKOS_REDIRECT_URI")??`http://127.0.0.1:${n}/callback`;return{clientId:t,apiHost:o,redirectUri:r,port:n,organizationId:e("WORKOS_ORG_ID")??pT,configured:!!t}}var mT={google:"GoogleOAuth",github:"GitHubOAuth",microsoft:"MicrosoftOAuth"},Ra=class extends Error{constructor(n,o){super(o);this.kind=n;this.name="AuthError"}kind};function Oa({cfg:e,opts:t,state:n,codeChallenge:o}){let r=new URL(`${e.apiHost}/user_management/authorize`),i=r.searchParams;return i.set("response_type","code"),i.set("client_id",e.clientId),i.set("redirect_uri",e.redirectUri),i.set("state",n),i.set("code_challenge",o),i.set("code_challenge_method","S256"),t.prompt&&i.set("prompt",t.prompt),t.provider==="google"||t.provider==="github"||t.provider==="microsoft"?i.set("provider",mT[t.provider]):(i.set("provider","authkit"),t.screenHint&&i.set("screen_hint",t.screenHint),t.provider==="sso"&&e.organizationId&&i.set("organization_id",e.organizationId),t.email&&i.set("login_hint",t.email)),r.toString()}function fT(e){return{id:e.id,email:e.email,firstName:e.first_name,lastName:e.last_name,profilePictureUrl:e.profile_picture_url}}async function gT(e,t,n){try{return await n(`${e.apiHost}/user_management/authenticate`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_id:e.clientId,...t})})}catch(o){throw new Ra("network",o instanceof Error?o.message:"Network error reaching WorkOS.")}}async function hT(e,t,n){let o=await gT(e,t,n),r=await o.text().catch(()=>"");if(!o.ok)throw new Ra("rejected",`WorkOS ${o.status}: ${vT(r)}`);let i=JSON.parse(r);return{user:fT(i.user),accessToken:i.access_token,refreshToken:i.refresh_token}}function ux(e,t,n,o=fetch){return hT(e,{grant_type:"authorization_code",code:t,code_verifier:n},o)}function vT(e){try{let t=JSON.parse(e);return t.error_description??t.message??t.error??e.slice(0,200)}catch{return e.slice(0,200)||"request failed"}}import{createServer as ST}from"node:http";var go="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAD9CAYAAABTCakVAAA+DElEQVR42u1dd7wdVfFP6L0pTUoABZGqIB1CBAICQghpgCACIQgo6E8RUEKNoCDFghCUngoSVARBQoBEaSKELkoHAUFqSPLevbs7vz3cOb5z550yZ+/e93bvnj/m85LbdveU75nynZkBADAgSJAg1ZQwCEGCBAAIUlJZNJV1U9k2leGpHJbK91P5TSrTU7kjlRdTeT+Vhal0p1JHiZR/C+lK5YNUnk/lIfzuTalMTuWXqXwzlRGp7JHKZ1JZPIx/AIAgfSNLp7JbKl9L5XLcmC/ipq7hxu7Cvwvx32KDx7i5Y0US5W+i/D/WfE6CRE25Tg1fE//+MJV/Idj8NJWvprJXKiuGOQsAECSbLJ/KvqmcmcqMVN5UTmwpiWZDS4kMr9PvJBoQcL2u/k5kAA8JHP9J5XepTEhl71SWCHMbACBIb1kfT06htv9TObEj8ld3gseWUzxhfIcrLgDRaRQR0UKEVjI7lXNT2RO1mjD/AQAqJ+IkPCiVSam8ihukptjisWXzuTZjbPl+3hIzNAodeMnnXJDKozgOh6eySlgbAQA6VdZJ5RhUiRcqKr3tpE4YQBAZQCE2gELcwkZPmKaES/OINc8gAHA+mjzjUvlkWDMBAMosn0CPvPCeP6ac8DFRjxOGeh47bHGfU7mV0z7JYErEjN+i5o50OArt4LJUxiCAhnUVAKDQMjCVoRg2W6g5nblqeZzRNk+Ym1+8Dxk3fxatwgVgNr+F6vi8FSMMi4S1FgCgSCLi8Gen8pISMos04TfI4cT0OZld1wNozfbPw88QM8yMmDgTX0nlrFTWCmsvAEB/EnBGp3IXcd6Z4ul5ONVsm76dTr/Y42TP8l2T38IU6pTgKrSs36YyBLWvsC4DAPSJmj8OvfcR8XKbNnTUYijO9p3IQejhnN6tOgFjyO4ETCwbPbGAKvWlCDLSiaksFdZoAIB2yOLoxX9GUfFdaisNg0EG1TpxgEfEDAXqfg8yqvxxBhMlZpgtNm6DbWwjJarybCpHBZpyAIC8ZMlUvqfE613U2azEGd1nIaeTOWaYDe0yEbjhQpcJYHIWRobXXsGciEA2CgCQmazzbdz4NQ0FN3FQbaknuxWnWWRQ9yWpJnFsklY2MUcLyeIHcAFXFqG/LcbmjVROChpBAACurJTKaam8rsmaa3WxZnUAxuDnjc8rxOgr0AIPgKMB+DgQqcPwDeRkfDqs8QAAOhHOo9MxbTYyeJ5jhvoaW2xV7gkaA98J6Lpeqw5An1i+Dgg4Dj+OEzDxAFnbs3dh1uLKYc0HAJByOKbWdms2D01q4XiubTx4zsbgpuq6Tr88Tn3XaZvVqcl9Bs64+mhXkpH5VionYDg3AEBFZQdoFL6IDIvK5M3P4gRsxRa3/XakkTqJVNQNn7P9hqo+14k5FFl+z9dM4ZgAEUPb0WlsLjMrRuD/cgCAasmKmHpbJ4s9Ypw4rhPMFqvmbmrXe+rG7Fb486JuwKxUrk/lJ6kcm8pIaBQS+RzmJ7hotAPRASpqEmwAjeo/e+LviPDa+Uh1vg3t6roCOImn6dKKBpB4Oj1ddOObUxkUAKDzZTcMEdUZarqNzBNnVNu54TAdgIh/z0vl9lSuwQ05GDdrf3m5F0tlM0zY+TU0yoh9BM3VhGynNjf27wMeiQVUIsP91PC+T4GKFS6pEoPvuxY731VIw+VY82X6xZpQX0ROd7Eo70vlEmjUD/hsicZ7TWjUKDwbk3i68HlisFc1ckUKErKJI+BXPeJEWsQ9/qVKeQZVeEixcf4KPXXyIsbm57zPobuakoHod2tKost1qRzaYTnxK6AZIUJxTxv8LlwWYpYcBI45kijzIMqZfS0AQPkTds6ARuWZmkEd5XjZIyb1l2NzUqebSGj5YypHp7JxhVRPWSDlD4p2QB2QrRCBXCaAaa7qxJEqCrisEQCgfCKKaj5l8G5zNr6PeeBagJSv/g90pu0KoVCmrHi8OzounyYRh9ihsXFCnjFT09CZF0LeSWU8+loCAJSAu389OVHqHqE+HycgJ1NNXltQin+cyoZhwztlA2RjPkfGkGuy2cwzFylLt0YkIL2cyk4BAIory6AXmtbbizRkHl+GmcleNYGKDNFNwzBayFfP5rj9MppI3QbzIAIeNyO2mHEmDUAnwlw5IABA8UR0qnmCbH4TAEQWGz9h2I6xIzVVLJILUvlU2MS5agW/UYDAh2XJIRu5AF2+JxuwfCMAQHFkWCrvWSiiNB6dWMJKJvtdx56jav6b6HQM5a3b20PhYujpiOTiGiSO9OHEcVjQ79cV3sBVnUAlLvuC+D64y3HFnj6A2JEMpP5fLATRS+94NEHCJu0bEXF60XHoXYVfkEUL8DUB6PsPlJ0zUOZ8/SmWEyCxoLor2YdjAsgyVMciGy5syv6RldFD/4EjIsAtaRaBu0IxPQBEPsF2AQD6tub+3YwMMWoCRB48APqeSh1+E0/8UJ66OLIqpvl2KTF8myPQpgFETE0yIX6fkQEA2i9DEXE5seHYQubh5pOrAPAqhqdCLnlxRYRZL0WfkIub0YoJoAOVbrz2CgEA2iMjNCG+VjSAyJEgIr/3dionB9JO6UyDCw18EB8nIEcDoKFfUZh09QAA+YpgzX0I7vp6WZ2AOi+/mNArUlktbKjSyuaYB1LXRIISh53v0iRt0aTZSEoLAJCD7I9psN2GSeSq/xFzUsW/56aybdhAHSNHo+8mYmYeRox1lIC9TPkdZTAHij5xI3Hj22ywLCZAonlfOo9+FjZMR4rQ5GYqZkFiiAL4agCRhWMwu+ggUPTNXwNe+a3YAQARAwBEnbhRYaN0tCyGiVj1DExAV2k4U9n2hzFyFQDAU+3v1iBs5AkAsQMA5OafUibHTZCW5YsKdZzjK0rA3NbdlYMgrvFoUddXUTf/QgcyJx5RAN3ESjrnf8savw2SSyn4X5FsQ1u5MhNARMCrTfA48hUCAFhEZH99pJz+Ols/yagB1Mlr9yO3PGyGasvB6GSOHGHAyOKDShwORskanFs0HknRQn0fgbmKblYNQJ1UMQmi3NO3ApMviCIic/Nq6F2ZyIcH4GIZSiez4AmsGQCgWdbDjRkxHX1ZnIBiAp6BChV8DOIteyssQheblOME1OWciHV4b1EOoKKg7/OErBF58rhtoRuJvKIU1zolXZiiQOghqexVwHsbginZnVL0ZDeFdFZ3rEFuiTLqjBa/e20AAIBlU3nMwcpztehKQF8ySr4m/Al3lThPX9iMLysL54KC2c9yXm7tsCjBq5owtIkHwKkPqStMc2HVAeBmaG5jZVKnIk8noKr6i042ZWkPPQb9E2oX2xPI4pmnUR/bnZIs4tjfSWUcgrZ8/XZlzAXQbqa8JzSWK6HRe7GMILA2moy+TEAuAMQY7Tq8qgDwc4fqngC/SaeumqtYkD8u0YI7X0koeU+JG19Dnq1biV6ISrVzFOfSlm26t/vxGjVkt8nX34XmphpfwdePUUyvGmZxlhEEhNY4yxEh8AWAmDgGBQjsWTUAOMJCqOC24jY1i5De/mNKtNAGIhNRJScdgu9N1jyb3OjHQ3MT0NltuLdBmhCq9KXMh+bOuwcomoFaY//0kvMFfmehk+sqSbkAgB5eIuN0g6oAwM5KYg+3BTU3DCg3yEElW2QraUJQ4/G9SeT5xNhtje9NI4tyfhvMgcGElyGutx/RAOS97Y6v/5OcmD8hv1m2EKyo/XdVRhMgYSQYibl/qj/yBvp6IHdA9p0LKTmluyjdUvx9HQGmDE6mbRXP+Wc0DqLx+P55mqjGevi9O8l4LVDCnOK7h0GjbiK3H4HognMuOhpH4Gs7aZxhwxTTQNUApO/iBaLN/ERRqX+HgPIMrocyaWmnQqP6T8JMBuIUplFBYHZfE4X6cgAHKWpuzNj8piytxAAOwpbasQQLaSpOttgE1yljQxeH1AC2VgCujhx2+VtzSOh0gaJKTsBrCPkAeHUNHlFU3W6kZUuNTTU1hivMTfnedcrvPEFMgFPx9ZOIpnNPCU2C77WgAego6THxl9zZlyHVvszC+hu4mzP4OgHl4ImFv29JPMsRcVSKjbmcspEkH+I4ooYLFfQK5fQfgKE31ZQS47AivvcOMYuOYPAxIqJpTMLrdUFzy64toLlC7xCyaK/E55GLem98/SriT/hvSf0C1xjCepwu05HhNTUl/cxOA4ATLCc4tye8CRy6lROp6LIX0WhquLnFe38hC2Ebxu9dRjSAV5X3FhL1fLzjtzbSgOvviabRjeq9y4bfAL8jNL6J0FM//3qyDt4rKQAsgv4XUyKRSwPQ5bhQzWDLTgGAldA2j0j6JZdNZSvqGJXM4bc/meganp6yoKVQwd9P5RLm722KJ70Ek2OVBTqfhJvOdfzWJhqQvlmx3Segb2A9T7tZ/f+15BpvlDg6IMZ4BsMH4HICmnwDd3YKAFznoPJyQoG65h3dGAYr06IZrgGAXXMg6QxDx6L6ek0BSfHvcxy/s5lmzG/J+fnPg+b2XnM6IKV4jobMxuEB2DJW5XePKDsAjAG/fu4ub6qKmD8q4YL5EvSuUrtem67VRez5sxnaBNWy/tiG6If0DdQZoFSWUmPPgr1DkU3Vt7EM32l3/ko7B2YtJeRnqsHmovOasqmuL+liWRo98vJZ/t7Ga3WTsZvA1ADaCQDyOqcgBbZTuiqtm8prFie3LlyYMGjGAlRuKysA3Gng87uce7Z6AGLzz4RyN2UUYb0HU3kolc+38To1spBcGsDmmgV4R0gRZstWmKdhWuOcdOJIE/4Wa/6osgHAGZpUSo7t79IAZqFTMSw4PgBIJ+AEBgBQs+tPYRy9U6PfAX7FYZcJIF8TWuP2ZQGAHZRQlqnvmg0IdBqA+K0XMfmligtrdXR4HknUZuGd/y2mC4u2VMtoTACuE3BzzYINGoC/DAV9NeuICQIm7eAlkolZSABYAimeNjXeRQDSaQACAEZXYPGIbLqRhLUnNv/zCknkUuU9lVlXQ16AzgnIMQE20SzO28OGzpzpWnfQ2WNNlqGt7ZiYw4uKDgBngbkza9ayXmJQpldg0ZyrUIRfg55a8t8mlFGhDsr6BjeTBfU2AQCVLenSAHRRgAAA2Ss4/VuTRanrQmV6j/q+pD9g66ICwHqEfRYznYA2TrV44H9VQPUXav1HyjPXMYQq2XPq+HRh0o54by5570OFpbeAUIHPYnjn6YK8K2zmzLIHyXuIHMlAJicgPRDvLyoA3AT6cl6JJ82Xqj7bV2CxbESyGsUY/hB66gHQfgYb4XtPk037rsK+W0CYgGcxNACqgs4MG7klOUc5vaMMPADTnhhbNAD4Apg78CSOTL/EMhgndejC2IVkLm6nbG41HZgCgGRAfg7fm01MrhctuQAuH8CWGhMgOAFbTyGeA/py4z4mAN0vL0NOZe7yetCrHCm7nI6sMckhv69DF8X1iq1/uhJDrpNxOA3fu5SMjTABZOGIX5DFdZNynQWeTMAtNCGoAACty/qE/MVpX+dyjou/hxYFADYhpw2nMIKLL/0SlLeEt002JJmA7yOSr6ikzsr3xykbc4FCn51E8gAuRFv9JjJmCwiZ5BwmAAQnYP4yTJk/Uz0AW99BnVn9FORQWSmPh/sruJtwJgbtQEeJFCfjzh26EA7QTOyqRJ2XabeDCNX05FS+6sGCnE+YgC4i0KYaDeDOsHlzkx+BuQK2jxNQfe//+hsAdteEOmIL3TF2RALqmD/eqYvgMM14yY0uCnL8EhoVg4blcK0FxAdwDkOTo/ZpMAHy5cg8RXw2Lh6AK9X4DUL+6nMAeJC50W0AoLIERfx75Q5eBMcQAKiTkz5PWUCYgC4fwGZ9mAswsKIgsCM0l1eLDAxYsDgBgRyY3+8vANg9Q0afyUEo7dRvdvgCOA56NyttFwDMJ0BzFkMDoDbon9vAd5iEPqOnlHBmleQqgy+A4wTURc7+Cy10vWrlQWYT50SU0QSQn3mmApN/HNEABACs3eJvrogU4nUtJgAnCvA5DUst72Sgo0mo84YKAsAncNNGYK4IZCPK6ajFZ/Q1AOxKsv04JkBkAQC1nFUny+EapmMrDSE2RvpvhCzAbTUAwE0G2lQzZ2q/v3UUenJWmUJA5uGKmgIXMjSAxLJf6PtvZfUFZH2AWzXJDhGD7GP69zvQU822k+Vg6N0ldg3l/UGYTbYU8/cuJuzBqcp7H3maABtrnIC3KHkKXWi/XsG8t8Whdyny28g1nqwoAKwHzaXRspgA9HA9pa8AYEdiw5jKdrmcgOrnD6/IxO9P1D5hCy+tqMeyjr9IJFkLehdXpbbe3WS8n7f4AFwawLoayul0dMp2EdByNfQQ/oQX8FnmQk8vwxtJmvgDFY4KjCdJPnXgtR9PDAfrW1kc6Flu/B7gNem0OQFVraFKsealka8v4/0PKe+9Rk7zccp7VyosQLVQ5FwCpO8RDcAnCrAYLiLVQXk+9NR3UOf3cOV5LsasRLUB6NWgbwxygRILT9AkqDJN+HFCEOIyAU0AcXa7AWAT6F3swMcJqIv7f75iEy9i/K8gb3+ospFq5HQcr/hbasp4CXNpSXzvMbI531Ku8yEhAp3FuDeRgTgPf1MkGq0JjUKmdM5PhOYqvzW8L1mt6WGyqC+EnjqRTynPsWOFAUDI3tDTJ9PGBOT20xAHwLLtBIDziRc78TABdOrNbRVfAFLW1rDEZJ7AEdC7pfSu0FMPQN2cswgA+KQDq1qKWql4Gw15RWonc4jJcADSU/9BDoWfayIOq4V5/1gLuE+TLMTlz+j22YntAoDF0eOctYOvTrYLi+BjWVnRAGgy0MmabMC9lbBit7LJVR7Fm8qCqilqeJZIA2UvSqbic+T1w/D1R4nP4MIwx0bZTfGxxBlNAPW1J9oFAEdCc62/xFMDoNGCe8LkN50E/yGq4LeUnHKaK7G38j3hoZ+hcfLNVuar3oKjdRGMW0uAWqhEbF4kGoC8xlToKWMl/n4nzLFV7mM4AROHE1A194a0AwDuz3DKJ4bEhrrPTVZELlI2q9jkstX2DzQawO6M3xuCm7WG0YFWKNZ7obovnFaHKK8/S7QM+d4ueO1uNEU2CPPrTBJTfQGmZCCVCpwYXo98nKvcG/y0JlRhcgK6CAwRqohh4nvb3mchVXYf5fV9yfgKJx23RJqoM/A1aF8p9RkkpfWLJLdAtEJbPcwtSx6F5u5CcUYNQIaXV8oTAM4Ce+8+lwmQkBNsbIkn6gvovBQ02QP7yDy4UQHgiwo0Ftsh41Dc1+Q2/P46mCEpOhR9vcMBYCz0VHLmOgFtPTa+mRcACBvwZQYycSoCxag2lrUl1Epoq6v2+MF9dO3PIvgUkdu+A+RQnILIIEx3VYkywzsYABZFB14E7ma5CQMYnsgLAHYAfaMDHx+A+tq4kttqNZLMc2NQX9siY6B3Qc3LOvyZDyVcEO6e0gGA0Ca2zgMATgFzDbPEkgtAMwUl+WPZEk/QCPJcdaTjhg2bvxyhWU+/6vBnXhKZopwQIMfXdlIeAHArmIsZcpmAEgB+VvIJGqlJ550VNmtb5EhNyuxlFXjun4C5VZ6LB+Dd25Fjl3yUgZesK23UjV7pASXXAGhFnwAA7ZGjKqgBSOJVxMytSRwawPvgqL7kupk9wK9CiekzUYekfo7SmDYBANqnAdTJZri0Is/+gMehq9v8oIzZkFYA4CImP9lVFFRM5A87BAAoLTa0z2qfD6BOAPdXFXn24zScG1voz/S60+x23cgLLfL91RvZsAMmZqTGCRg0gPbFxWmzlKoAwKqGyBt386vyelYA2JLw/mNH+CEGc0+AhzpkYlQnYOIwAb6AefGisu5Ehdob8h4a9v0MdDCfaLBTx2ocYJdVaJxuA7+CIDYtYHAWADgH3HX/OBqAmMAzO2RSdGFAXQNNWlxDfO4lJY+/ynIqGRfhHB4P+gKiND/+8gqN07csuQDgoQHUbcBpu4F7wa88UWwIF9aZyStlcgK6fABfhObqt3KxbxUA4OMWZlSbnKT53DhNNKlKAPAFhh/AlCREowH/8gWAJZUcZY6X38YDEL+zRIeaACYNYHeF1x0rqbE7BwD4mNdP28VNtmgA6hqbWDFT6S0LvT5magEy/2ZjHwDYHfzKftsAopOYcqM02s1s0Jd6opxu8dkdAwA0AYA8OK51AEBcQR+AkCtIhqAPE5ACwPE+AHAS9FSa4fgATMlAQr7bQRMymkkF3kfjwQ4A0JBbNABwjcUJGFcwDKjWj6xlTAaiXbem+wDAjdC77r9L9TD1Pd+iwzQA2j3nboMGQMM44v87BQD4GADomrmOaQJUTQNYSmOK+4o8fN70AYCXDASgxJGeSCfsvZIMtEhl3QtlMYYJoA6srrTZVzTqa/AB9JgA1LdkAgBKBJroSKTZ3xbyKqncZ9hv3ChAoozj2hwAWMGgdnDSE6nde1MJBlhU4rkfkbbuYPaN1vAAdBrAfmhCqaBYd2gAh0Ojlt6vkYNRtoX6DaSwigV7gocPwAQAR5GxtmkAq6CnW9YNmNFBADCBaJO+IKBGoQ7hAMC+wOvuYwtLyIV/dAkG+Dzo3ZxhFwcTMHZoAF/WUIbFNXY1/O4l0NxIQ4DRtiVapIeQcRHP+gMHwcXlBByr0aImMijrcl727BAA2I5hjrtMADk2V3EA4FTI3qmUOr3WLMEAT9EknRzISAaS6HqvwwmodtoxqacLNOBZptyJszWnzhyPKMA1Fg2AwwScqll/B3aQFvBWCxqAugb/yQGASRang0868GslGVwfABjZghOwbtEsapoJG++4b9FYYwyaG4u2aWw+hb+/vuNzP9Zkoj1oAQC6ZlwagIsINF2zNjupfNh0jRbgwwNQNbMlXQDwACP/WOeUiMhpV5a+b1M16rpLA1A/e49BA4g8AYBqWKdZ7llsSLWPwKPou8lzXA6CRnVZaVfbinJeonE6/Q3sBWa4PICIYQJMJwBe7zAN4FiDGcBtH15X+AC72gBgIE461wGoYwJKAPh2SQZ3GlE1bQDAdQLuS5yAclHu7NAA1HG1aQDXE62lDvbGkKIn3y/xXoW6vZFjTARz80Ny7/PA3M7rIs3C+3uLADBW4wS8nGECyHnpJA1gGzA35YmZp7/cl0fZAGAdcPf+c5kAkvY6tEQAwLUfR2mcTXcZTIC6JmS4s0MD4ALA3Zr7mGIJcT4Dzf3n3nWo9dtr7qeG5oDu8xdr1sLDHkQgUxSAywScrtG2OkkDWBQdw75EoFgTiZpoA4D9wF7Xn5MOLJFmqQ7UAKgT0AQA+3oyAWsam85mAswm6nEdn0P32d1AX7D1R5bf30UzvzXo6Qno0gAiSwr4Hzw0AHrPJgC4QfPZTish/pAm8ScmvpfEwc+powZmBICxFu4xBwDkxV4p0cBOzWACqAv9LgMRqJuMifjeDjmZAH8hExvhc5hSmBOiItd1ISFFdjZoAMM9TIC/WQCA4wQ8yoMJWAUAuI5hArhC80LetgHAZR5xfhPS1EpGxNDZjzYAoKf6TEsyELW/BudkAszR3IdJAzhYo0rrWnar8iUDk3E40wlo0wCy+ABcNQFv7HAn4ABM5vF1AtIeg7I47+ImALgZeH3KbeBQw7BQGTUA1+kxRqMBzPTgAZiYgN2eGsBs6F10ZaoDtGgSkw0ABmvmW9zjATmYALd6EoHU+760whrAUA8noK3NeITkIi0APMtwLrhMALFQvlqQQVuVEcOeolk8HB6AywlY0zgBTUzAumZcuQDg0gBGGyI2tgq7O3maABdrAOCRFpmAPk7AGzXz4gIAQVL7LOTf0qxdsrwhRd+nX6Ccx1EmAOhibPCEYQLs1s+DtRguKqkOPoShMJsJEDFCSCM1TMBZDB6AvI/BDCJQwnAC3qsBgKmWe6YORpcGsC3o+87bACBmAsCfNCbANcwwYB4+ALHhr1aiIg+VhLE6AEOztuo/nFCgGNNv6QBgCeA3IlAFNAizXD8P1ClK3LSGWslMDwCwaQCUB2CKAujSgXexaAAU0cd7AEBk0QD2NSwEWxRgK8PJwTUBYgcRiK4lbj0AEwD81oMHcJSS+CVrEv6pJABwb4tMwIRGU6hKFEG25p+0N/nAfh6oyeS0qyGRxUYFVjfHCKYTMAJ7RSBqAgx2AEDCNAFmaSZ1uuGzK6DnV130kUNL28oQBrRFAWImANzG1AB8OgPdqDnlhltIVFRbmV8SU2BGC7kA6rqdqgOAnYjjygUAprTDZwrC76eLbH4OVODRmpNmtsEEqJGxtGkA3ZrxtZkAMzUm2VTL5wW/4w1l87sKa2wIvQtS2ohAOicgVwOIUCXnhAE5AODyAUzRzGGTZ7zAclUOPoAI8zF6AcB+BAC4KgWd+FsL4tmnzRUXeJgAIxhEoNgjGShyAEDNEwCmkPTlGrjbZi2GKbIbM8ZvWQRM9RpCg9jE8PkLPUwAbk1AHxPgRrImbQAwSWPGdUE5SrYfn4MJIP4+rgOA0WBu7WVr/kk1gKkF0wCkSugCAG4ykDo2NU8egIkK3OUJAOvjid6N8lwq6+Y8hkfib8taCTaT5EKNymkDgDrwawJy0oFv0PAAhjPMQ7VoZhmYq6OZxB+XCfCeDgDGgr4rqU9Z8DoUo3TzFA1gfZQDD2A09O4O/GeDCdCtSZAyUYEXegKADHHuhlpFu04vETn5MiN56KceGsAt5PTl+AA46cARUwOYrNEAukuiAQz11ABMZntNBwAToHdJL18egPj+D9o4ACJZaQjGRNuhASQeGoAEgHvBXlWJ4wTs0gDq6SUiqZwPvYtQ2jQAGko1pQPTMOBESxQgJvM9wmEeqvfb5dAAVsO5W7qfx3mDHHwAcoyWoABwuUMDcAGAHPjD2/TwslR5HVWYYY4oANcJOK1FJ+C9BqebLhloV4cGkDCZgEWTczycgH/UHDRcE+ByBwBwIjnTNQBkMgFEFt4VCBDi1BSVefqzy9WyjJwczn6NZWq3+uPXGOx+Xw1gRJtO/nnQXKz0fTAXwZhMwMwVBeDyAEZrGGezGNmArpqAdxFzQXxnXIkA4GCNTT2J6QT0SQa6nOkEtM3hVEMUYBmwFyaVc/hkP47zIsw96soXEP/fggLAlBZNAKkBDGvDgx9A7HRpx+zgmGSOCeBTD4A6YeoWJqCOSDPYkn//usJZEG3ZVykRAAxER+B8hV03yOID4PIAqBZlqwhEta0RlvmmG6gbT1cdZ4Dea1c/j3U3+FcE0jkOd6QAMJVB9EkcpkEdnUbtaMhRI6pbt+VEzcID8NEAXOnA+2pi+7aSYEJWxOseWABbs5XCFa57b0UDmGiJAnA1gGmaOawbNIBJGodldz+P8QcZiEC6zw2lADCNucldJsBObQYAVQPYmekEtPEAfJKBuJ2B9tE4sEJjkNYrArlMAI4pOkXDBOw20NenaBy5/Q0A72RIB9Z95isUAKaDu/S3ywQQ8vkM6uNyDvowDb+5TIApmgWxgMEEzKIBzHJEAaIAAL0AgFKfr2MkA0UWALhBsz5tGoCOB7CchTMQk3z6AQ5NbrM2UotfBf/WYDrezjAOAGQJA27u8TBnQKO6rbCrXsSNY9p4NY39vTMDACIlRyFPAIgtJsA+4FcWvGqtweg6u57JBJyYoxOQAsDyDtIQBwAuwoNGzP2/MXks7/F7oUUmoBEAbmD6AChAALGltvJkNdEkjk+DvhBHpCF77MSYZI4GQNV6k/o4RrOpTZ2BdBzsIQEAtE7ASeCuCMSNAriKgk7TcC5qeHLbOAMuJ+AI4ktK8NDJ25n7HGSvCKTu42G+PgCXdiA38DbMB7laY+N1YbxfV6NeFwXgAkDskQtgaypxkOZ3ZzFyAeTiGRwAAH6vWUuTGCaAiwocM/040zQaQN2gAeh8SSYN4DLNGu1qQ1TseQYdmOMEPMAUBWjFBKh72Lk3GUJll1hMAAoAO+bABJyiASJuOrApDLgn6MuC7xoA4H/jrcpkCxMwYWgA0z2IQFM1fpyaAQB0mmQN7L0aYhKpOjjn8Xvd8/Q3gcRwHQ+AowEkDgDYg/kgNxgAYALYC3FwnYBZwoAcJiD1Q+hMgD0MTMDgA2g0jKlBcw8J3ZyP0zgLObkAHA1AFwVYlmkCdDM02kTRAA7KefzmGTY5eJKBepkA13smGJhMgH2YD3Ia6CvP7sPkAbh8ADRzcT4jtTZLWXCdBrAb0Vjk2GwXAOBj77ikX3fh+C1vAAC6oSbmZALU2wAAJ2vutx1zvjAHHkCMdPUBlPQQQWtFQesens9PYkhDppwKmW0IB442+AB2ZEYBuCaACwDGaNR6HQBsQRJ85En3qQAA/5NlHBl4R3jwAKZD76rHIxiHgysKoAMAkwmwBuYKdClr7u9tGLeoxWQg+Z39TclACZgrAuk0ABoFOMLjYcSGuAAaNdl+asnIGmmwqbdnePa5UQCuCUC1kJkGbsMsaK5LeGfY9F5yhEcuwDTNfI9gmAuuXADdOrKFAbfC9HBRq+FSTNnOm2kZEXU/azLQXhQAxmfMBQCCkKe2YTEcmNEJGDN4AFM0UQCf1mAzLQQn8Tun4GJcImxqL9ExAV25AFwNIGKaADo+Sa0fx2QFzwiAzV+3AwWAozUDbutHbjIB2lEQZJjGqWYLA/pQgXW5ALbGIJzegEFal7Gak9pVEShh8ACma0hDXQYNYIom+7M/qcDbeHj+bfT9WPJtbPYtN55IqcCT2/Dg+0FzfbqYSQTi1ASc4hEFoJ2B6kG1bzsAcKIAPk7A6ZroQpdBA5isCSf3ZzbgMOCn7LtMgOUoAIwAfYca32SgdtRYXx9V+Drh1q8O7oIgeQIAlwcQpHXRaaRXMAHApyJQZAGA88i6qCERp7/GZIzG/s/iAxDjsxgFgD01PgCf/oByo7WrM/A06ClQKa5zJYNsEjN4AD5hwDGa3w0mQN+YANx0YJcTcJrGtKgZ0pjXhkZPhUhR/8/vxzH5bsZMQLpn/3cY0lM2An6RAdN7C9v08CJkdCii8n6ObCtfJ6CPBsCpBxCkbwFgukcykKkvgKmOwSCMVF2HDu7+rB48sUUAkK+9AobWYHXw7wwE5H3xGysVhG7KSeLwKQo6RqM+3h02a9sBgEsFTpgaQKLxASxTgjH5rWbP+VKBxb/n6ABAsow4BUFtSNNdAM67zgToytEECBpA34YBXclA04Ff1m26IR24DFWYHgG/1mCmCMANJgB4y4MDYGsPPrpAABA5wje+yUA0JTk4AdvrBEw8fACcsuCTNSDeVRIAWGjQun3SgZt6LNILzAR3D0BXFEAM/o/6eaCu0ywIrg+gzggDxo5cgCD5RgGytAc3zeEkDbDMR5ZdkcdjQ4vZzQkBqib6WBMATAJ98QAfDUBcYEY/D9ZoEi7stsTrJ0PvRpgcHkAcAKAwGsB0jc/HNIeHE1+XWB93lGA8DsF7baU3YEwT9uhFTrX4ALhhQCH/LMCAfTOVp6DREuxuDOnYNABOCOkg4FUECpKPE7AO/q3B5BzaktLOTuW/qBUKrXfNEozHhY7T3qYBUC7DeiYAGKXJu/dtD160dsuu4oyTPZyABwGvMUjWRI8NoBxtqvvKCUiB+TJHFIDT4VnN1Vi0ROPxO9B37eb661Qf3SImANgZmktZJRlNAHGRL5VkYCdncALmTQUWSU0v4m+Lv5sGAPBKBroBeteWPLDDxuNtpgZgqgosgfFx9XfpRZa2cAE4FYHUjKlvl2Rgp0Dv4h3DPaIAM3O4hzuU3+1GtA8mQG/vtY8JMLyDxmJt6F1uzLczkDycp9kAYACyhCLLho8NDgjaCnt6iQCA2x58lEYtbVUDGIheaBVA3woA4N0ZqJMBYCT0rjjs8gPo+niI75/pAoAbQV8QhGsCyO++UGIAaLU5qI8srUll7QoAAEdCa70BOwkALlDWSJZkoMjE0dFd7AwwVwTiOAHVSdikQwFAfeY/t3j9ZUlosY6RC7XUlKguIxpqTCgJZTXPikCc9uDTOlwDeNDhl+NsfgkA67sA4MsZIwFU1RByUgkG91porjXgqwG0CgDCI/s+iUu/Sby/dcW0OrtCGgA3HXgy9K4VMaJDxmEtaK5f4CsqCLxOf193wRURKSLPdOBYM2G3lGCAjyVpxuLv1h5RgD/ncA8zyeJV/QofQPvrLRTdBHBpAGcrn5Vz2ClNWA42OACz1AOYwQEAIY8ZAMCnVoCkWC5S8AEWhRFuU0DgdrAXZKiTKEAeLLKhCujWFBLLKtBcXbgoJKu+1gBcALByKnOhpwjrlA4ah6sMGjm3epe6dn7EBYBroXczTl8NQCLx0JIMtKgwPMRBDhmlMQHyKgkm8s5Fyactif1Pqcf/Jt8TrK5PViQd+ArHd/aAzuu/+HLG7Fxaq1PrGLWhb7eGi82hAlNv7EUdNBljCBrnpQGYZHVCzKojIUS+f7kSNfhuB4YBaZGPiRXRfqR8HnpXwzYBAFjelwCwBhcANlNUYm5z0NjAPX62gyZklCaR5NY2Xm8pNKNUDUCGVzdV5khGDpbtcB7ArysGACdrNPEsyUBifTypu4bt4m84NnrE0ACkGbB+hwGA6gRst1Pub2Q8b1eiNVQ72L5Dw4BSrqwYAMyxROS4yUAyN+dKXwC4Dnp3ZzWZAboIgLowj+yQCTlQYwL8sQ9OATVC8X9KYlIXiR7sQ6I5ok35SiUd60M0h0qVAGA5Ep3y5QHEJAPwq74AMEJjAviGAXuVICq5bKT4RiSyXtjmawqqsOjicgJuaDUzsUYmWvai3zWVDxVacRm7Em+AZk1d2QTjKgQAY8Ddq5PLAhQHxWq+ALAY9JQg4jQjiCw3LMoQL9khEyNO4HcwPi8KqKzQT/exLwKQCgBDDNlxvynpWB+AXvAuDO0NrBAAXGs5cMGTBjzHdB3XTdzqSAoyZQPS98RJ9fUOmpyBBViMn0YAkCfkQgWMniN+iqklH+9FoFq2/wAM93Io+C4QEPM/PisAjNN4Ym25ALa+gneHBJfc5WdKGHCCwYEr5uUmTXQhtCovrgwmJjUn689WEHT7rACwiiYji2P/67yRNTy1wgTnrwlsQF57icyLCgDfQ5NMvH5uGL9CyjUWp7pvMtAHNm2VczOPGzQAn5qBMhPpvDC5fSL3EvNrosI2VP0Gb4axKpwsAz31IWJwl+l32f/WuhycG7qUkQuQGLz/9Gb+U1F7rq/lh4pvoAudaQOQCloj6uGSYbwKJcdYTn+bBgAG+/+wVgFgFAk3ZfUByAU5Kkxy20UUFv0Oov9xJJuRhnY/EcarUDLXElL30QKk2b18qwAgMq3mtcgDUCMETwUtoE9kYwxZDiPkGlpbfvkwVoVK/Y2YoXWOCeCsV+mTkuhKB7bdbEz4818Pk91WGYp2ZA3Dg0fj6/soySVSRVw0jFehTv/Iklvj4wQUc3tiXgCwGzRXzeFUBIoN2oH4+3CY7LbKJGiuWSCjAMui40/O5ewwVoWRPaGn9gO3ApcLAD6fFwCIMMIzDHWE21YsIrTWIPnKX8lYP6C8tx00Cr8KUNgijFWhIjc1S8TNlwfwHw5ZzecGvwf6UmE+uQKqs/DvYdJblsOh0eLqTfQeqxWdVFAOY11s2QH3lq4ID8fW1732c861fW5yNWguT+XLA9A5Bw8Mk99SvHgBNFd8lQUf7iaOpPvCeBVa7lSyPWNwd+KmApqI21Z5A4CQaWCuTxYD32Mp33+yYgkeecp2ikNPLh5Z8ulqMifTwngVVnZScjoiDxPAZmo/xL2+783uAu4CBTYNgN64WMBHhkWQ2WmklouqYxhJvLcfJxc8SCHkHgLkiUMDAIcJIH7r2HYBgJBHwNw4xKYB6ByEEfLWlwgLwSrrY374UEVj2luJ6UsAGEnSlh/BhKEwhsWUL0FzxSOO6eyy/0UNheXaCQBfAXujQq7KolbV+U1YDEY5DGP5ddzwE5TFQ0uCBZ9KuXw4T0JzwZPIY/ProgDa0t95A8AAjB9HDAAA4NUSiLhOiwrK38kYvqAw/WqKml9DezKMWTnkXEKgiyz8GVfRD/l3gS+zsxX7s86wVxIGAMjTa3JYFFp5h5hX85T35igOpJeCQ7U0shaJ4OgAgKv+q38v9b2XVh7iAeD3DYjBXU5MLOTNK7ogVsVQkAiziirAanOQeWQMP1TeEwU/T0/lMmiUcg+bqzynf42wY1UAAM8woPyNDfsSAIZqAICTC2B7gEcqmij0C2XsaoQqPY+M00dtuP7KBkfsYhatQqdqirn7LH5PfX0J9B2FgjCNsm1vQ+8uWiYTgKtV35Xlflp9mPvBXhXIRVukGoPQAsZXcFE8Dc19FLqVDfkW0ZTyLOIxEDkCNQSascRDLerSvU+ci5+DRn9CcZ9PpLIuvr4i0sW78f1BynfU3ou7VxwALlXmOQJ7LU3ag8PEEhS/NaQ/AGAo6JuBuDoL27SABRXjqA8k6dbSK7wyvv8g5NuOXJXNCZFIBZe/KJtW7Uf4G3I/v8DXvwPNbcx/ha9vRKIVd1V4828O+toaPhqAzjy4P+s95ZXEkLV2mamRyGMVSlMdiLa/esrXlBP0UGUjdiEfIK9r765xxsp7+pBoJUvjezPIwr0RX/81mcM/4OvDCHnstYpu/kWQoVfPCACx5dDctz8BYCPlBOPkLbvajckFN70iC2NR6N0CvK6o1gPQdhabdZOcrz1cAwDC9FhSiS7I11fH79xOwOp3Bs3gLiVhST31XqkoAPxS0e5oYhwnCmAyD2a0cl952jV1B6PJJ1VYboKzK7I4Xofm/P3uPmJHDiNzsABPKhWUZGeZZfA7t5C5moSv/1yxVcXf32s0gKgVdbXEcjTZ5LpCOhwAoHtKzMvaRQCADUlYw5UIZNIMdEDwpQoskN+S039uH133i2T8/0Ick2oZN+oDkGB1krLI1Y1+Cb6+gaIBqK9Xicb9Lpib58YacABwVwQSr/201fvL80Evt4CAyzywlUB6DYkTnbxIPo200G5k+g3uw2tfj/P2GuEf7A+NsmLz8N/y9XVSeR6/82gqn8TXhdlwB55K/8TPye/8BF+/TdEkqmL33+845V1MQJMJIKIzqxQJAFbTxDc5TEDb5pef+6smttyp/oD+Wqim+1nU4Lg09URcPMT6/yc/JRtbpwXEBvPABQCX5XGPeT/w8WCvFxA7Yp2mwiHi9DgtLKggJZL9SJqvaY3rgAEcPgDxd9MiAsBADHV0Q+/y0xHwqgmZCBFCHd0uLKwgJRCpDccadd92+tcdB6eu1VuhAECGBRdokoWSFgEgwhDSemGBBSm4XMXwg8UGH4DLBJif5x5oZw57DXiVgjgxz0ghyLwCoZptkOLK98Fc+yJ2mAAmJ6D6/tfzvN92DsQllvCfbYBcnOgIU2S3DYstSMFkHPRuveZqnsOpCCTNgxvzvud2DsbSGC5yOTNMiBhbCBOys23QBIIUyenXhf4vXeTLtfltJoA89NYuEwAI2YowymKmBhA50FO+9gamn4YFGKS/k3zec8TxIwYI1EHfU7MGPe3dSgUAQr4N7tbhHA3ApD28jYy2sBCD9IcIwtPLYK+TaXIC0s2vW/d1pF8PKCsADEAijynn2UQDThxMQjXxRLRB2jksxiB9LJ9SWJEu/ktk0IRjR56AMHXXKDsAbA/NXWk5GYE+RKIaUiO3D4sySB/J6kh5jgwJb7Z1bfMB0EIfo9r5HH05YD9mcAPoJgdmiFCmWb6GPISwQIO0U1bGPIiageXH9QFEliiA+P817X6Wvi58cSvTDLDFQ3UIW4fmqjbBHAjSzpp+fzNsZlsdDB1QRBYQEIfZip0EALKQ5Ezg9RRIwC+XQFXDRCONMyuWeRak/fIJaJRit0WxXJV7I0YugPj3yL54pv4YxCUw7zzKsMltZZHogHZjHnsIEwbJQ8Q6eg7XlS0qlVh4ABwmoJDz++q5+tOB8iJxoHCZgNyehPK3RT77mLCAg7ToxH7Lks/P7Ydh0wCkH+vP0Iel8fu7UsrrmsgAxwSIGe9RbeDCkKseJIOMgEYvBlf/vsiS6+LKB5C/+xKaGQOqAAADMKf5bYcnNfF8T9eBWKKrSKNcNCzqIEz5ATSXObPV7YsYJoApDCiu8UEqX+jrZyzCIA9GhI0YA8nxD8QW1UsM9MMhVBjEIUtBo9ipTd3nagC05L0uCtDd7nh/kQFArZ7CVfNdGoAOeaUWUEPe9jFhoQfRiKg/OdfAzecAALfUnQoAp/bX8xZp4MdD79LitmQgk3NQBwB1g/p1N/oiwsIPIkRUMH6BYatnMQF0ICAOo6v685mLNPiCKHQ6YVdxw4CulOPIoiWI6kWiwGJoXFldEanrP0Q6ua02f5bOPabDSvz9OfRzM9wiTsYBSOTh9BzkAIAu08rkiLm8L9hXQQol22J8n9Ogg6MB2MKAasivEE1wizopX8GTOc5BA7BxrXXFRp6FajQjqbqIMvMTwNyl12YCmPxPkYOsJmVGUcahyBM0FHqKLHDIFtx6a5zPCQ3kT9BohR02S2cSe+ZC70adtlh+lDEKQOtaivThVQIA8EQU+ngVmpsq2qIAOiIRFwBMoCDadm0SNk1HyHKpXGGgoSceh0TCcBAmGoefSB9es0hjUoZJGwQ9RRe4LEGdE7DO2PA6VK9hnHZyKluHTVRaEfUjnzBs0sQDAEyefZd/SkQX1i7auJSp+MJjBhDg8gC4GkCiAY66AgTTQoJRqURU07kEzbpugyPPpS0mjChAZNE+hV9p3SKOT5kmchCiqAwTQkYASBzMwYQBMOL/d6YyGqrRs7CsefsiJXy+B5M0YpqFru/I367j5l+jqONUtkkVLZdmGxIyIgYAcE0GDtFImgf/hkb322AeFENWSuVkaNSJjMDelNYnYYejAdDfe7poNn/ZAWAAEifEBL/r2NytOgET5smgmgkinnxtKl9NZdWwGftUdkBW3UILmcxVjSryIJTZOAJiLfwMSlCQpswTvi76BepgL84Qe4RwXN2KuJEDCQiPILtxh/5mfHWorI4Ze0+DubtOYkkzp8I1JV1Vf88syxh2AoXzSk0OAaf1kuvU5+Qa2JyH1IEo0p5vSOWEVLYJgNASZXxPzNZbAD0VekyqvcnLb/osp/CMDgDkXF+A9xgAoA/la8jjrnvmAiQep3rM8AybuAi6BSYW7z0IYKLry46pLBs2uFE2xs31MhPUXZ2pYw8egO0wUMljR5ZtXDtpgXwObfA60wmYgB8ngFv7LfHQENSKRfIUEZGOqamcmMouFY8yfAY1prugp/kGx7HH0QZ8eACJgwr8Mmp1AwIA9H8u96MEBGzJQNySYhHwy5D5VjE2dYipKyeLKGJyMTTqJnRyRSPhwT8Qk7JeUCItHB+MT/FYjg9ABx6RZl39tchhvqoBgEzy+LFCGnJleOkonq5ipFz/QWKxJ23/d7VG/1WHkJFEjUbRw+F7qdzu8OX4OmRdoGvzAbiuLe/xirIDcqcnfDzLWFSRh7qeME56zoJ0tUezEVWkKrwA88nXKtm8bJnKWdAoDS9Ddl0e9jyHt5FYnHgJ+BfupMlAglx0RCfsk063IUUPgm+ijdZtcdhFDnU+8rDxk4ybn6MJJAaq8vUFz1wUlXbOTeUfDB9L4jm2HB9NwpwPVxhQrKFZJQTdygKAWuTxPIM96aIJc2nEHJUUGIuUu3CpSlpDzkHR4vSX4glv875zfDKJp83v0q5sYUIdENSQ8dlRPpiqeZX3hkaDh5oj8SPxIBH5nja+GkDsoK4mBARuKEDkQFxfFLr8yOF4izNEUbJoWLaKUqb+ffLf3eiQ3LET90RV2WNXQu+e7pwwITe2zP0eh6XmYxZIEJjaj0SjzUjaLdfpxjm1XQxNjhbF/ZwkcP0CGj0tBwQA6CzZKZUHLad74kEV5vIKXNmHPpsltgBAHR2EfT2mwjE2j3nqu56bqxlwtQsXCYjOt6AXD+70fRAYZgBfh0ZLphrY67f7OKpcC5xjsybAJ7iY7mnLPhzHy8GvkrPLCeijYXEiARyNrIYe/tOhIh2kAgD05BScodCJfW3NmOFsapWpFhuIKzat4vo+Gr9zPEAqcfAmuE6/GPxCrpzW3c+hZliZtR82f7N8MpVrNA7CCPw99D4e6sTzs9xwl3BgrdbmMTuOgGYWrSXJyQTg/Bb9TB1P/dPwIBgQACCI4ODfqziCIiYpxdeRlWXDcOxp9d/tDA2Oc2TXcYtwJMAjWvmy/mzAIQFe1G/4VFXXetjsdtkKvcCvOFhkPmQWjs3rS2CxObtealNE4PsOTz8H/GLwr8oTt6hhCfkvNAp2VL5JbNjk/CpEh0GjwIcpKy3x4J/7aAU+GoCpLt0eOY/H4dC7tHaSQVWPoTWCEDdFW4b13kZ+wlJhTQcAyCqH4qkaGTYBt7gEV2V2Za+5gKcG+Xaf3QidpVnYd1yeRZwRBExjVENVf92wfgMA5CEiRDQSGgU9uPUGs9r7ruo1rg1XR2JQXtV4Hm2Bfpt4mD6u77u0qzomGwkT7jNhzQYAaGelGrHI3iQU49iyYH3CfdwQo41W+1BOz3ommLvq2Oi1XM++Kwc/NoQ+I7LxRTepU1JZOazPAAB9qRWMgUa/gDo0NzExbXgAv4o1PixB9TPv5vB8m+KJWvfUZnzYeglkq9AkQfdxNNFCvcUAAP0qYrNcBI3a9HVDFqJPXJ9LojF9vrvFTSG+O9fg94jBP4Tpk/NvCt+p3ZpugUa1pIFh7QUAKFr0YN9UrlPAwFZgJGHYvKYCF7bqRWKjLNnCc4wHcy0+HyKUTzjTVLmpG5/nPiQhrRjWWQCAsoDBttBoanIbpsq6Ohv70INNmy5qEQDEPS8w8CCyMhU5QEHZmK8gS1PkbgwK6ykAQCcAwh5ISHkcmvsIZKHVxpYU4a4Wklse8WD4ZeFA2BqriHbal+A4BfU+AEBHi2gldjA02pC/aslD4PQeoADwfgs8f1s33bw0ALnpRcHTGakcn8rmYU0EAKiybIb59cJ/8Dz0rmJk4x9QHsCTGa7/Wczt5+Q6cJiA6v3IZ/kwlT+gj2FwOOUDAASxZyoeiKm3N6NTUTrEpDdcV75MbLgbMhB+HvTgHSSGTV5TqNOChvtHaPQ3ODiQcwIABGldRHXaYdBoLSYKcszCWD0lxpzt+bsna/IdODH7eegzEAAleheMhUYdxtApOQBAkD4UUQ59DQSHH6aynafpMR9P7oVIIpqLtGehSVwNjeq4AnQOSmV//M7iYdwDAAQpv6yGSTOLhbEIABAkSJAOlv8HOib1/JuFBpoAAAAASUVORK5CYII=";var Da="linear-gradient(135deg,#3aa0ff 0%,#6a6ff6 52%,#8a4ff0 100%)",yT=[58,160,255],dx=[106,111,246],bT=[138,79,240];function xT(e){let[t,n]=e<=.5?[yT,dx]:[dx,bT],o=e<=.5?e/.5:(e-.5)/.5,r=(i,s)=>Math.round(i+(s-i)*o);return`rgb(${r(t[0],n[0])},${r(t[1],n[1])},${r(t[2],n[2])})`}var kd=Array.from({length:65},(e,t)=>{let n=t/64,o=Math.exp(-(((n-.5)/.16)**2)),r=Math.round((3+o*(.8+.2*Math.abs(Math.sin(t*1.9)))*153)*10)/10,i=(1.5+t%5*.2).toFixed(1),s=(Math.abs(n-.5)*.7).toFixed(2);return`<span style="height:${r}px;background:${xT(n)};opacity:${r<6?.92:1};animation:wave ${i}s ease-in-out ${s}s infinite"></span>`}).join("");function kT(e){let t=e.markUri??go,n=t?`<span class="mark" style="-webkit-mask:url("${t}") center/contain no-repeat;mask:url("${t}") center/contain no-repeat"></span>`:'<span class="mono">AC</span>',o=e.compact?"body{overflow:auto;align-items:flex-start}.card{margin:auto;padding:30px 28px 44px}.badge{height:140px;margin-bottom:22px}.orb{width:104px;height:104px}.mark{width:78px;height:78px}.glow{width:114px;height:114px;margin:-57px 0 0 -57px;background:radial-gradient(circle,rgba(34,197,94,0) 35px,rgba(34,197,94,.34) 40px,rgba(34,197,94,.12) 47px,rgba(34,197,94,0) 56px)}.bars{-webkit-mask-image:radial-gradient(circle at 50% 50%,transparent 40px,#000 62px);mask-image:radial-gradient(circle at 50% 50%,transparent 40px,#000 62px)}h1{font-size:32px}p{font-size:15px}":"";return`<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${qt(e.title)}</title>
|
|
21
30
|
<style>
|
|
22
31
|
html,body{height:100%;margin:0}
|
|
23
32
|
body{background:#07070f;color:#e9e8f4;font-family:'Sora','Segoe UI',system-ui,sans-serif;display:flex;align-items:center;justify-content:center;overflow:hidden}
|
|
@@ -31,8 +40,8 @@ body{background:#07070f;color:#e9e8f4;font-family:'Sora','Segoe UI',system-ui,sa
|
|
|
31
40
|
.bars span{width:4px;border-radius:4px;flex:0 0 auto;transform-origin:center}
|
|
32
41
|
.orb{position:absolute;left:50%;top:50%;width:140px;height:140px;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center}
|
|
33
42
|
.glow{position:absolute;left:50%;top:50%;width:154px;height:154px;margin:-77px 0 0 -77px;border-radius:50%;background:radial-gradient(circle,rgba(34,197,94,0) 49px,rgba(34,197,94,.34) 55px,rgba(34,197,94,.12) 63px,rgba(34,197,94,0) 74px);filter:blur(2px);animation:glow 2.6s ease-in-out infinite}
|
|
34
|
-
.mark{position:relative;width:106px;height:106px;background:${
|
|
35
|
-
.mono{position:relative;font-weight:800;font-size:44px;letter-spacing:-1px;background:${
|
|
43
|
+
.mark{position:relative;width:106px;height:106px;background:${Da};filter:drop-shadow(0 6px 16px rgba(0,0,0,.55))}
|
|
44
|
+
.mono{position:relative;font-weight:800;font-size:44px;letter-spacing:-1px;background:${Da};-webkit-background-clip:text;background-clip:text;color:transparent}
|
|
36
45
|
.eyebrow{font-family:'JetBrains Mono',ui-monospace,monospace;font-weight:700;font-size:13px;letter-spacing:2.6px;text-transform:uppercase;color:#7dd3fc;margin-bottom:14px}
|
|
37
46
|
h1{font-size:40px;font-weight:700;line-height:1.1;letter-spacing:-.02em;margin:0 0 14px}
|
|
38
47
|
p{font-size:17px;color:#9b9ab3;margin:0 auto;max-width:460px;line-height:1.65}
|
|
@@ -44,11 +53,11 @@ ${o}${e.extraCss??""}
|
|
|
44
53
|
</style></head>
|
|
45
54
|
<body><div class="aur a"></div><div class="aur b"></div><div class="dots"></div>
|
|
46
55
|
<div class="card">
|
|
47
|
-
<div class="badge" aria-hidden="true"><div class="bars">${
|
|
56
|
+
<div class="badge" aria-hidden="true"><div class="bars">${kd}</div><div class="orb"><span class="glow"></span>${n}</div></div>
|
|
48
57
|
<div class="eyebrow">AC Bridge</div>
|
|
49
|
-
<h1>${
|
|
50
|
-
</div>${
|
|
51
|
-
:root{--ac-bg:#07070f;--ac-surface-2:rgba(255,255,255,.03);--ac-border:rgba(148,132,255,.16);--ac-hairline:rgba(255,255,255,.06);--ac-text:#e9e8f4;--ac-dim:#9b9ab3;--ac-mute:#80809d;--ac-accent:#38bdf8;--ac-accent-soft:#7dd3fc;--ac-accent-3:#34d399;--ac-input:rgba(148,132,255,.16);--ac-brand-grad:${
|
|
58
|
+
<h1>${qt(e.headline)}</h1><p>${qt(e.sub)}</p>${e.extraBody??""}
|
|
59
|
+
</div>${wT(e.cleanPath)}</body></html>`}function wT(e){return!e||!/^\/[a-z0-9-]+$/.test(e)?"":`<script>try{history.replaceState(null,"","${e}")}catch(e){}</script>`}function wd(e,t,n=go,o){return kT({title:e,headline:e,sub:t,markUri:n,...o?{cleanPath:o}:{}})}function qt(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]??t)}var _T=(e,t,n)=>wd(e,t,void 0,n);function Na(e,t,n,o=3e5,r="/callback",i=_T,s){let a,l,u=new Promise((p,m)=>{a=p,l=m});u.catch(()=>{});let d=new Promise((p,m)=>{let f=e,g=ST((E,_)=>{let I=E.headers.host;if(I!==`127.0.0.1:${f}`&&I!==`localhost:${f}`){_.writeHead(400,{"content-type":"text/plain"}),_.end("bad host");return}let N=new URL(E.url??"/",`http://127.0.0.1:${f}`);if(s!==void 0&&N.pathname==="/"){Li(_,200,s);return}if(N.pathname!==r){_.writeHead(404,{"content-type":"text/plain"}),_.end("not found");return}if(N.searchParams.get("state")!==t){Li(_,400,i("Invalid request","This sign-in link isn\u2019t valid for this session.","/sign-in-failed"));return}let M=N.searchParams.get("code"),q=N.searchParams.get("error_description")??N.searchParams.get("error");q?(Li(_,400,i("Sign-in failed","You can return to AC Bridge and try again.","/sign-in-failed")),x(()=>m(new Error(q)))):M?(Li(_,200,i("Signed in","You're connected. Return to AC Bridge \u2014 you can close this tab.","/signed-in")),x(()=>p({code:M}))):(Li(_,400,i("Sign-in failed","You can return to AC Bridge and try again.","/sign-in-failed")),x(()=>m(new Error("No authorization code returned."))))}),h=setTimeout(()=>x(()=>m(new Error("Sign-in timed out."))),o),y=!1;function x(E){y||(y=!0,clearTimeout(h),n?.removeEventListener("abort",S),g.close(),E())}function S(){x(()=>m(new Error("Sign-in cancelled.")))}if(n?.aborted){x(()=>m(new Error("Sign-in cancelled."))),l(new Error("Sign-in cancelled."));return}n?.addEventListener("abort",S),g.on("error",E=>{l(E instanceof Error?E:new Error(String(E))),x(()=>m(E))}),g.listen(e,"127.0.0.1",()=>{let E=g.address();f=typeof E=="object"&&E!==null?E.port:e,a(f)})});return{port:u,result:d}}function Li(e,t,n){e.writeHead(t,{"content-type":"text/html; charset=utf-8"}),e.end(n)}function px(e){let t=e;return t?.code==="EADDRINUSE"?"Port 8765 is in use \u2014 a sign-in may already be open in the AC Bridge app. Finish it there, or close it and retry.":t?.code==="EACCES"||t?.code==="EPERM"?"AC Bridge was blocked from opening port 8765 on this machine \u2014 permission was denied. Security software or a group policy is the usual cause; allow it, or sign in on another machine.":t?.message??String(e)}var $T=[{provider:"google",label:"Continue with Google"},{provider:"github",label:"Continue with GitHub"},{provider:"microsoft",label:"Continue with Microsoft"},{provider:"email",label:"Log in"}];function fx({cfg:e,state:t,codeChallenge:n,email:o,screenHint:r}){return $T.map(({provider:i,label:s})=>{let a=i!=="email"&&i!=="sso";return{provider:i,label:s,direct:a,url:Oa({cfg:e,opts:a?{provider:i}:{provider:i,...o?{email:o}:{},...r?{screenHint:r}:{}},state:t,codeChallenge:n})}})}var ET={google:'<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M21.6 12.23c0-.68-.06-1.36-.18-2.02H12v3.82h5.4a4.6 4.6 0 0 1-2 3.02v2.5h3.24c1.9-1.75 2.96-4.33 2.96-7.32z" fill="#4285F4"/><path d="M12 22c2.7 0 4.96-.9 6.62-2.43l-3.24-2.5c-.9.6-2.05.96-3.38.96-2.6 0-4.8-1.76-5.58-4.12H3.06v2.58A10 10 0 0 0 12 22z" fill="#34A853"/><path d="M6.42 13.9a6 6 0 0 1 0-3.8V7.52H3.06a10 10 0 0 0 0 8.96z" fill="#FBBC05"/><path d="M12 5.98c1.47 0 2.79.5 3.83 1.5l2.86-2.86A10 10 0 0 0 3.06 7.52L6.42 10.1C7.2 7.74 9.4 5.98 12 5.98z" fill="#EA4335"/></svg>',github:'<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2a10 10 0 0 0-3.16 19.49c.5.09.68-.22.68-.48v-1.7c-2.78.6-3.37-1.34-3.37-1.34-.45-1.16-1.11-1.47-1.11-1.47-.91-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.9 1.53 2.34 1.09 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.94 0-1.09.39-1.98 1.03-2.68-.1-.25-.45-1.27.1-2.65 0 0 .84-.27 2.75 1.02a9.5 9.5 0 0 1 5 0c1.91-1.29 2.75-1.02 2.75-1.02.55 1.38.2 2.4.1 2.65.64.7 1.03 1.59 1.03 2.68 0 3.84-2.34 4.68-4.57 4.93.36.31.68.92.68 1.85v2.74c0 .27.18.58.69.48A10 10 0 0 0 12 2z"/></svg>',microsoft:'<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M3 3h8.5v8.5H3z" fill="#F25022"/><path d="M12.5 3H21v8.5h-8.5z" fill="#7FBA00"/><path d="M3 12.5h8.5V21H3z" fill="#00A4EF"/><path d="M12.5 12.5H21V21h-8.5z" fill="#FFB900"/></svg>'},AT='<svg class="arw" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>',mx=`-webkit-mask:url("${go}") center/contain no-repeat;mask:url("${go}") center/contain no-repeat`,Ui="https://ac-bridge.com",IT=`*{box-sizing:border-box}
|
|
60
|
+
:root{--ac-bg:#07070f;--ac-surface-2:rgba(255,255,255,.03);--ac-border:rgba(148,132,255,.16);--ac-hairline:rgba(255,255,255,.06);--ac-text:#e9e8f4;--ac-dim:#9b9ab3;--ac-mute:#80809d;--ac-accent:#38bdf8;--ac-accent-soft:#7dd3fc;--ac-accent-3:#34d399;--ac-input:rgba(148,132,255,.16);--ac-brand-grad:${Da};--ac-brand-grad-text:linear-gradient(92deg,#67e8f9,#38bdf8 40%,#a78bfa 75%,#c084fc)}
|
|
52
61
|
html{background:var(--ac-bg)}
|
|
53
62
|
body{margin:0;min-height:100vh;background:var(--ac-bg);color:var(--ac-text);font-family:'Sora',ui-sans-serif,system-ui,sans-serif;-webkit-font-smoothing:antialiased}
|
|
54
63
|
.mono{font-family:'Space Mono',ui-monospace,'SFMono-Regular',monospace}
|
|
@@ -65,7 +74,7 @@ body{margin:0;min-height:100vh;background:var(--ac-bg);color:var(--ac-text);font
|
|
|
65
74
|
.mesh .aur.a{left:8%;background:radial-gradient(closest-side,rgba(56,189,248,.16),transparent)}
|
|
66
75
|
.mesh .aur.b{left:24%;background:radial-gradient(closest-side,rgba(139,92,246,.18),transparent);animation-delay:-7s}
|
|
67
76
|
.lockup{position:relative;display:inline-flex;width:fit-content;align-items:center;gap:10px;color:var(--ac-text);text-decoration:none}
|
|
68
|
-
.lockup .mk{display:block;flex-shrink:0;width:30px;height:30px;background:var(--ac-brand-grad);${
|
|
77
|
+
.lockup .mk{display:block;flex-shrink:0;width:30px;height:30px;background:var(--ac-brand-grad);${mx}}
|
|
69
78
|
.lockup .wm{font-weight:700;font-size:15px;letter-spacing:-.01em;line-height:1}
|
|
70
79
|
.mid{position:relative;display:flex;flex:1;flex-direction:column;justify-content:center;padding:40px 0}
|
|
71
80
|
|
|
@@ -75,7 +84,7 @@ body{margin:0;min-height:100vh;background:var(--ac-bg);color:var(--ac-text);font
|
|
|
75
84
|
.bars span{width:4px;border-radius:4px;flex:0 0 auto;transform-origin:center}
|
|
76
85
|
.orb{position:absolute;left:50%;top:50%;display:flex;width:140px;height:140px;transform:translate(-50%,-50%);align-items:center;justify-content:center}
|
|
77
86
|
.orb .glow{position:absolute;width:154px;height:154px;border-radius:50%;background:radial-gradient(circle,rgba(34,197,94,0) 49px,rgba(34,197,94,.34) 55px,rgba(34,197,94,.12) 63px,rgba(34,197,94,0) 74px);filter:blur(2px);animation:glow 2.6s ease-in-out infinite}
|
|
78
|
-
.orb .mk{position:relative;width:106px;height:106px;background:var(--ac-brand-grad);${
|
|
87
|
+
.orb .mk{position:relative;width:106px;height:106px;background:var(--ac-brand-grad);${mx};filter:drop-shadow(0 6px 16px rgba(0,0,0,.55))}
|
|
79
88
|
|
|
80
89
|
.eyebrow{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.16em;color:var(--ac-accent-soft)}
|
|
81
90
|
.aside .eyebrow{margin-bottom:16px}
|
|
@@ -131,15 +140,15 @@ form.email .flt{font-size:10.5px;text-transform:uppercase;letter-spacing:.1em;co
|
|
|
131
140
|
@keyframes glow{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.04)}}
|
|
132
141
|
@keyframes aur{0%,5%{opacity:0}12%,28%{opacity:1}38%,100%{opacity:0}}
|
|
133
142
|
@keyframes pulse{0%,100%{opacity:1;box-shadow:0 0 0 0 rgba(56,189,248,.6)}50%{opacity:.5;box-shadow:0 0 0 7px rgba(56,189,248,0)}}
|
|
134
|
-
@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}`,
|
|
135
|
-
<style>${
|
|
143
|
+
@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}`,CT=`<a class="lockup" href="${Ui}/" data-testid="nav-brand" aria-label="AC Bridge home"><span class="mk"></span><span class="wm">AC Bridge</span></a>`,PT='<span class="lockup"><span class="mk"></span><span class="wm">AC Bridge</span></span>';function TT(e){return`<a class="sso" data-testid="oauth-${e.provider}" href="${qt(e.url)}">${ET[e.provider]??""}<span>${qt(e.label)}</span>${AT}</a>`}function RT(e){let t=new URL(e.url),n=[...t.searchParams].filter(([o])=>o!=="login_hint").map(([o,r])=>`<input type="hidden" name="${qt(o)}" value="${qt(r)}">`).join("");return`<form class="email" method="get" action="${qt(`${t.origin}${t.pathname}`)}">${n}<label><span class="flt mono">Email</span><input class="inp" data-testid="email-input" name="login_hint" type="email" placeholder="you@email.com" autocomplete="email" required></label><button class="cta" data-testid="continue-email" type="submit">${qt(e.label)}</button></form>`}function gx(e){let t=e.filter(o=>o.direct),n=e.find(o=>o.provider==="email");return`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Log in | AC Bridge</title>
|
|
144
|
+
<style>${IT}</style></head>
|
|
136
145
|
<body><div class="page" data-testid="login-page"><div class="split">
|
|
137
146
|
|
|
138
147
|
<aside class="aside" data-testid="login-session-panel">
|
|
139
148
|
<div class="mesh" aria-hidden="true"><div class="dots"></div><div class="aur a"></div><div class="aur b"></div></div>
|
|
140
|
-
${
|
|
149
|
+
${CT}
|
|
141
150
|
<div class="mid">
|
|
142
|
-
<div class="badge" aria-hidden="true"><div class="bars">${
|
|
151
|
+
<div class="badge" aria-hidden="true"><div class="bars">${kd}</div><div class="orb"><span class="glow"></span><span class="mk"></span></div></div>
|
|
143
152
|
<div class="eyebrow mono">CLAUDE CODE + CODEX</div>
|
|
144
153
|
<h1>Welcome back to<br><span class="grad">the bridge.</span></h1>
|
|
145
154
|
<p class="lede">Your sessions are still running. Log in to pick up exactly where you left off, and see at a glance what your agents did while you were away.</p>
|
|
@@ -149,98 +158,104 @@ ${uP}
|
|
|
149
158
|
</aside>
|
|
150
159
|
|
|
151
160
|
<div class="right">
|
|
152
|
-
<div class="topright"><span>New here? <a href="${
|
|
161
|
+
<div class="topright"><span>New here? <a href="${Ui}/register" data-testid="nav-register">Sign up free</a></span></div>
|
|
153
162
|
<div class="center"><div class="card">
|
|
154
163
|
<div class="eyebrow mono">WELCOME BACK</div>
|
|
155
164
|
<h2>Log in</h2>
|
|
156
165
|
<p class="sub">Pick up your sessions right where you left them.</p>
|
|
157
|
-
<div class="ssos">${t.map(
|
|
166
|
+
<div class="ssos">${t.map(TT).join("")}</div>
|
|
158
167
|
<div class="rule"><span class="hair"></span><span class="rl mono">or with email</span><span class="hair"></span></div>
|
|
159
|
-
${
|
|
160
|
-
<p class="newto">New to AC Bridge? <a href="${
|
|
168
|
+
${n?RT(n):""}
|
|
169
|
+
<p class="newto">New to AC Bridge? <a href="${Ui}/register">Create a free account</a></p>
|
|
161
170
|
</div></div>
|
|
162
171
|
</div>
|
|
163
172
|
|
|
164
173
|
</div>
|
|
165
174
|
<footer class="foot" data-testid="site-footer"><div class="inner">
|
|
166
|
-
<div class="row">${
|
|
175
|
+
<div class="row">${PT}<nav aria-label="Footer"><a href="mailto:support@ac-bridge.com">support@ac-bridge.com</a><a href="${Ui}/privacy">Privacy</a><a href="${Ui}/terms">Terms</a></nav><span class="cr mono">(c) 2026 AC BRIDGE</span></div>
|
|
167
176
|
<span class="disc">Works with Claude Code and Codex. Not affiliated with or endorsed by Anthropic or OpenAI.</span>
|
|
168
177
|
</div></footer>
|
|
169
|
-
</div></body></html>`}import{spawn as
|
|
170
|
-
`)})}function
|
|
171
|
-
`,384)}function
|
|
172
|
-
`,384)}var jP=He.join(Q,"hub-token"),DF=Number(process.env.BRIDGE_HUB_PORT)||8790,Ae=He.join(Q,"config.json"),wt=He.join(Q,"hub.log"),fi=He.join(Q,"hub.pid"),NF=He.join(Q,sr),Qe=He.join(Q,"daemon.pid"),ia=He.join(Q,"daemon-beacon.json"),Ln=He.join(Q,"daemon.log"),Si=He.join(Q,"hub-stop-reason.json"),kP=He.join(Q,"app-path"),sb=He.join(Q,"hub-relay-status.json"),LF=He.join(Q,"hub-holders.json"),ab=He.join(Q,"sessions"),Nu=e=>He.join(ab,`${e}.json`);function ke(e,t,r=384){let o=He.dirname(e),n=(r&63)===0;if(DP(o,{recursive:!0,...n?{mode:448}:{}}),n)try{rb(o,448)}catch{}let i=`${e}.tmp-${process.pid}-${process.hrtime.bigint()}`;ib(i,t,{mode:r});try{LP(i,e)}catch(s){try{ob(i,{force:!0})}catch{}throw s}}function N(e){try{return NP(e,"utf8").trim()||null}catch{return null}}function cb(e,t){let r=t?.write??((n,i)=>ke(n,i,384)),o=t?.now??Date.now;try{r(Si,JSON.stringify({signal:e,ts:o()}))}catch{}}function sa(){let e={};try{let t=N(Ae);t&&(e=JSON.parse(t))}catch{}return process.env.BRIDGE_MACHINE||e.machine||UP.hostname().split(".")[0]||"node"}function lb(){let e=Number(process.env.BRIDGE_HUB_PORT);if(e)return e;try{let t=N(Ae);if(t){let r=JSON.parse(t);if(r.hubPort)return Number(r.hubPort)}}catch{}return 8790}function Lu(e){try{ib(e,"",{mode:384}),rb(e,384)}catch{}}function ve(e){try{ob(e,{force:!0})}catch{}}function aa(e){try{return process.kill(e,0),!0}catch(t){return t.code!=="ESRCH"}}function ki(e,t){if(!t||t.includes("/")||t.includes("\\")||t.includes("..")||t.includes("\0"))throw new Error(`unsafe ${e}: ${JSON.stringify(t)}`)}function ca(e,t){return ki("provider",e),`${e}_${OP("sha256").update(t).digest("hex").slice(0,12)}`}import{readFileSync as BP}from"node:fs";import{existsSync as zP}from"node:fs";import cn from"node:path";import{fileURLToPath as FP}from"node:url";function MP(e){let t=process.env.BRIDGE_PKG_ROOT;if(t&&t.trim())return t.trim();let r=o=>zP(cn.join(o,"plugin",".claude-plugin","marketplace.json"));for(let o of[cn.join(e,".."),cn.join(e,"..","..")])if(r(o))return o;return cn.join(e,"..","..")}var ln=MP(cn.dirname(FP(import.meta.url))),to=cn.join(ln,"plugin"),_i=cn.join(ln,"hub","dist","hub.cjs"),ub=cn.join(ln,"hub","src","index.ts"),la=cn.join(ln,"node_modules",".bin","tsx");var HP="https://relay.ac-bridge.com",ZP=8790;function de(){let e={};try{e=JSON.parse(BP(Ae,"utf8"))}catch{}return{relayUrl:process.env.BRIDGE_RELAY_URL||e.relayUrl||HP,hubPort:Number(process.env.BRIDGE_HUB_PORT||e.hubPort||ZP),machine:sa()}}async function db(e,t,r){let{relayUrl:o}=de();return fetch(`${o}${e}`,{method:"POST",headers:{"content-type":"application/json",...r?{authorization:`Bearer ${r}`}:{}},body:t===void 0?void 0:JSON.stringify(t)})}async function zt(e){let{relayUrl:t}=de();try{let r=await fetch(`${t}/entitlement`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(6e3)});return r.ok?await r.json():null}catch{return null}}async function pb(e,t=fetch){let{relayUrl:r}=de();try{let o=await t(`${r}/sessions`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(15e3)});return o.ok?(await o.text()).trim()||"(none)":null}catch{return null}}async function mb(e){let{relayUrl:t}=de();try{let r=await fetch(`${t}/devices`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(1e4)});return r.ok?await r.json():null}catch{return null}}async function fb(e,t){try{let r=await db("/device/command",t,e),o=await r.json().catch(()=>({})),n=typeof o.error=="string"?o.error:void 0,i=fu(n)??n;return{ok:r.ok&&o.ok===!0,status:r.status,...i?{error:i}:{},...typeof o.verified=="boolean"?{verified:o.verified}:{},...typeof o.note=="string"?{note:o.note}:{}}}catch(r){return{ok:!1,status:0,error:r instanceof Error?r.message:"command failed"}}}async function no(e){let t=await ua(e);return t?t.config:null}async function ua(e,t=fetch){let{relayUrl:r}=de();try{let o=await t(`${r}/device-config`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(1e4)});if(!o.ok)return null;let n=await o.json();return{version:typeof n.version=="number"?n.version:0,config:n.config&&typeof n.config=="object"?n.config:{}}}catch{return null}}var GP=256*1024;async function gb(e,t,r,o=fetch){let{relayUrl:n}=de(),i=JSON.stringify({version:t,config:r});if(Buffer.byteLength(i)>GP)return{ok:!1,version:t,config:r,error:"This profile set is too large to sync (over 256 KB). Remove a profile or some device actions."};try{let s=await o(`${n}/device-config`,{method:"PUT",headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:i,signal:AbortSignal.timeout(1e4)}),a=await s.json().catch(()=>({}));if(s.ok&&a.error===void 0&&typeof a.version=="number")return{ok:!0,version:a.version,config:r};if(a.error==="version_conflict"){let l=await ua(e,o);return l?{ok:!1,version:l.version,config:l.config,error:"version_conflict"}:{ok:!1,version:t,config:r,error:"version_conflict, and the latest document could not be re-read"}}return{ok:!1,version:t,config:r,error:typeof a.error=="string"?a.error:`device-config update failed (${s.status})`}}catch(s){return{ok:!1,version:t,config:r,error:s instanceof Error?s.message:"device-config update failed"}}}async function hb(e,t,r=fetch){let{relayUrl:o}=de();try{let n=await r(`${o}/connected-accounts/${encodeURIComponent(t)}/revoke`,{method:"POST",headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(1e4)});if(n.ok)return{ok:!0,status:n.status};let i=await n.json().catch(()=>({}));return{ok:!1,status:n.status,error:typeof i.error=="string"?i.error:`revoke failed (${n.status})`}}catch(n){return{ok:!1,status:0,error:n instanceof Error?n.message:"revoke failed"}}}async function ro(e){let{relayUrl:t}=de();try{let r=await fetch(`${t}/connected-accounts`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(1e4)});if(!r.ok)return null;let o=await r.json();return Array.isArray(o.accounts)?o.accounts:[]}catch{return null}}async function vb(e,t,r){let{relayUrl:o}=de();try{let n=await fetch(`${o}/node/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify(r)});if(n.ok)return{ok:!0,status:n.status};let i=await n.json().catch(()=>({})),s=typeof i.error=="string"?i.error:void 0;return{ok:!1,status:n.status,error:fu(s)??s??`patch failed (${n.status})`}}catch(n){return{ok:!1,status:0,error:n instanceof Error?n.message:"patch failed"}}}async function yb(e){let t=N(we().accessFile)?.trim();if(!t)return{ok:!1,error:"Not signed in. Run `acbridge login` first."};try{let r=await db(`/link/${encodeURIComponent(e)}/start`,{},t),o=await r.json().catch(()=>({}));return r.ok&&typeof o.authorize_url=="string"?{ok:!0,authorizeUrl:o.authorize_url}:{ok:!1,error:typeof o.error=="string"?o.error:`link start failed (${r.status})`}}catch(r){return{ok:!1,error:r instanceof Error?r.message:"link start failed"}}}var WP=!!process.stdout.isTTY&&!process.env.NO_COLOR,da=e=>t=>WP?`\x1B[${e}m${t}\x1B[0m`:t,VP=da("32"),qP=da("33"),JP=da("31"),me=da("2"),Uu=!1,be=(e=!0)=>{Uu=e};var pa=e=>{Uu?console.error(e):console.log(e)},K=e=>console.log(JSON.stringify(e)),$=e=>pa(`${VP("\u2714")} ${e}`),z=e=>pa(`${qP("\u26A0")} ${e}`),x=e=>console.error(`${JP("\u2717")} ${e}`),v=e=>pa(e),se=e=>pa(me(`\u2022 ${e}`)),E=(e,t)=>(x(e),Uu&&K({error:e,exit:t}),t);var ot={logoutFirst:(e="sign in")=>`This machine is already signed in as another account. Run \`acbridge logout\` first, then ${e}.`,pointerMismatch:"This machine's signed-in account doesn't match its stored account pointer \u2014 run `acbridge logout` then `acbridge login` to reset it.",unresolved:"Couldn't resolve this machine's signed-in account \u2014 run `acbridge login` again."};function St(e,t=z){return e.length<2?!1:(t(`found ${e.length} relay credentials on this machine (${e.map(r=>r.sub).join(", ")}) \u2014 a crash during an account switch can leave residue; run \`acbridge logout\` to clear it.`),!0)}function ma(e,t=mt){return e.segment===t(e.sub)}function bb(e){let t=e.layout??on(),r=e.read??N,o=e.paths??we(),n=r(o.accessFile)?.trim()||"",i=e.resolveScope??(()=>gt());if(t<sn)return n?{state:"ok",token:n,scope:i()}:{state:"signed-out"};let s=i();if(s)return n?{state:"ok",token:n,scope:s}:{state:"signed-out"};let a=(e.scan??ft)();return(e.warnAmbiguous??St)(a),!!(e.readPointer??(()=>Ce()))()||a.length>0?{state:"mismatch",message:ot.pointerMismatch}:{state:"signed-out"}}function _t(e){let t=bb(e);return t.state==="ok"?{ok:!0,token:t.token,scope:t.scope}:t.state==="mismatch"?{ok:!1,message:t.message,exitCode:3}:{ok:!1,message:e.notSignedIn.message,exitCode:e.notSignedIn.exitCode}}function Ft(e={}){return bb(e)}function Oe(){let e=gt();return e?wi(e):null}function Un(e,t){let r=N(e.providerAccountsFile(t));if(!r)return[];try{let o=JSON.parse(r);return Array.isArray(o)?o.filter(n=>typeof n=="object"&&n!==null):[]}catch{return[]}}function pr(e,t,r){ke(e.providerAccountsFile(t),`${JSON.stringify(r,null,2)}
|
|
173
|
-
`,384)}function KP(e){try{let t=JSON.parse(Buffer.from(e.split(".")[1]??"","base64url").toString("utf8"));return typeof t.nid=="string"?t.nid:null}catch{return null}}var XP=()=>_t({notSignedIn:{message:"Not signed in. Run `acbridge login` first.",exitCode:3}});async function xb(e,t={}){let r=e[0];if(r!=="on"&&r!=="off"&&r!=="status")return x("usage: acbridge capture on|off|status"),2;let o=(t.requireToken??XP)();if(!o.ok)return x(o.message),o.exitCode;let n=o.token;if(r==="status"){let u=await(t.fetchEntitlement??zt)(n);u?(v(`plan: ${u.plan}`),v(`capture.telemetry: ${u.capture.telemetry}`),v(`capture.transcripts: ${u.capture.transcripts}`)):x("couldn't fetch entitlement from the relay (signed out, or the relay is unreachable)");let p=(t.entitlementFileRaw??YP)();if(!p)return v("local entitlement file: absent (capture fail-closed until the hub next syncs)"),0;try{let m=JSON.parse(p),f=(Date.now()-(m.fetchedAt??0))/36e5;v(`local entitlement file: ${f.toFixed(1)}h old (${f<=24?"fresh":"STALE \u2014 capture fail-closed"})`)}catch{v("local entitlement file: unreadable (capture fail-closed)")}return 0}let i=KP(n);if(!i)return x("Couldn't read this machine's node id from its access token \u2014 sign in again with `acbridge login`."),1;let a=await(t.patchNode??vb)(n,i,{captureEnabled:r==="on"});return a.ok?(v(`Capture ${r==="on"?"enabled":"disabled"} for this machine.`),r==="on"&&v("Note: capture is on by default for every account \u2014 this only re-enables it for THIS machine (still subject to the global capture switch)."),0):(x(`capture ${r} failed${a.status?` (${a.status})`:""}: ${a.error??"unknown"}`),1)}function YP(){let e=Oe();return e?N(e.entitlementFile):null}import{readFileSync as EO}from"node:fs";import{createInterface as AO}from"node:readline";var c={};nn(c,{$brand:()=>zu,$input:()=>sm,$output:()=>im,NEVER:()=>ju,TimePrecision:()=>um,ZodAny:()=>eg,ZodArray:()=>og,ZodBase64:()=>Fc,ZodBase64URL:()=>Mc,ZodBigInt:()=>No,ZodBigIntFormat:()=>Zc,ZodBoolean:()=>Do,ZodCIDRv4:()=>jc,ZodCIDRv6:()=>zc,ZodCUID:()=>Tc,ZodCUID2:()=>Rc,ZodCatch:()=>Ig,ZodCodec:()=>ns,ZodCustom:()=>rs,ZodCustomStringFormat:()=>Ro,ZodDate:()=>Xi,ZodDefault:()=>xg,ZodDiscriminatedUnion:()=>sg,ZodE164:()=>Bc,ZodEmail:()=>Ac,ZodEmoji:()=>Pc,ZodEnum:()=>Co,ZodError:()=>PR,ZodExactOptional:()=>vg,ZodFile:()=>gg,ZodFirstPartyTypeKind:()=>zg,ZodFunction:()=>Lg,ZodGUID:()=>Wi,ZodIPv4:()=>Lc,ZodIPv6:()=>Uc,ZodISODate:()=>wc,ZodISODateTime:()=>kc,ZodISODuration:()=>_c,ZodISOTime:()=>Sc,ZodIntersection:()=>ag,ZodIssueCode:()=>TR,ZodJWT:()=>Hc,ZodKSUID:()=>Nc,ZodLazy:()=>Og,ZodLiteral:()=>fg,ZodMAC:()=>Vf,ZodMap:()=>pg,ZodNaN:()=>Ag,ZodNanoID:()=>Cc,ZodNever:()=>ng,ZodNonOptional:()=>Kc,ZodNull:()=>Yf,ZodNullable:()=>bg,ZodNumber:()=>Oo,ZodNumberFormat:()=>kr,ZodObject:()=>Qi,ZodOptional:()=>Jc,ZodPipe:()=>ts,ZodPrefault:()=>wg,ZodPreprocess:()=>Pg,ZodPromise:()=>Ng,ZodReadonly:()=>Cg,ZodRealError:()=>nt,ZodRecord:()=>Po,ZodSet:()=>mg,ZodString:()=>To,ZodStringFormat:()=>he,ZodSuccess:()=>$g,ZodSymbol:()=>Kf,ZodTemplateLiteral:()=>Rg,ZodTransform:()=>hg,ZodTuple:()=>lg,ZodType:()=>ee,ZodULID:()=>Oc,ZodURL:()=>Ki,ZodUUID:()=>Zt,ZodUndefined:()=>Xf,ZodUnion:()=>es,ZodUnknown:()=>tg,ZodVoid:()=>rg,ZodXID:()=>Dc,ZodXor:()=>ig,_ZodString:()=>Ec,_default:()=>kg,_function:()=>cw,any:()=>zk,array:()=>Yi,base64:()=>wk,base64url:()=>Sk,bigint:()=>Dk,boolean:()=>Jf,catch:()=>Eg,check:()=>lw,cidrv4:()=>xk,cidrv6:()=>kk,clone:()=>Ze,codec:()=>ow,coerce:()=>Fg,config:()=>$e,core:()=>pn,cuid:()=>pk,cuid2:()=>mk,custom:()=>uw,date:()=>Mk,decode:()=>Ff,decodeAsync:()=>Bf,describe:()=>dw,discriminatedUnion:()=>Vk,e164:()=>_k,email:()=>nk,emoji:()=>uk,encode:()=>zf,encodeAsync:()=>Mf,endsWith:()=>bo,enum:()=>Vc,exactOptional:()=>yg,file:()=>ew,flattenError:()=>Ri,float32:()=>Ck,float64:()=>Tk,formatError:()=>Oi,fromJSONSchema:()=>yw,function:()=>cw,getErrorMap:()=>OR,globalRegistry:()=>De,gt:()=>Bt,gte:()=>We,guid:()=>rk,hash:()=>Pk,hex:()=>Ak,hostname:()=>Ek,httpUrl:()=>lk,includes:()=>vo,instanceof:()=>mw,int:()=>$c,int32:()=>Rk,int64:()=>Nk,intersection:()=>cg,invertCodec:()=>iw,ipv4:()=>vk,ipv6:()=>bk,iso:()=>Ao,json:()=>gw,jwt:()=>$k,keyof:()=>Bk,ksuid:()=>hk,lazy:()=>Dg,length:()=>br,literal:()=>Qk,locales:()=>Mi,looseObject:()=>Gk,looseRecord:()=>Jk,lowercase:()=>go,lt:()=>Mt,lte:()=>st,mac:()=>yk,map:()=>Kk,maxLength:()=>yr,maxSize:()=>Zn,meta:()=>pw,mime:()=>xo,minLength:()=>dn,minSize:()=>Ht,multipleOf:()=>Hn,nan:()=>rw,nanoid:()=>dk,nativeEnum:()=>Yk,negative:()=>dc,never:()=>Gc,nonnegative:()=>mc,nonoptional:()=>_g,nonpositive:()=>pc,normalize:()=>ko,null:()=>Qf,nullable:()=>qi,nullish:()=>tw,number:()=>qf,object:()=>Hk,optional:()=>Vi,overwrite:()=>It,parse:()=>Nf,parseAsync:()=>Lf,partialRecord:()=>qk,pipe:()=>Ic,positive:()=>uc,prefault:()=>Sg,preprocess:()=>hw,prettifyError:()=>Yu,promise:()=>aw,property:()=>fc,readonly:()=>Tg,record:()=>dg,refine:()=>Ug,regex:()=>fo,regexes:()=>it,registry:()=>Ha,safeDecode:()=>Zf,safeDecodeAsync:()=>Wf,safeEncode:()=>Hf,safeEncodeAsync:()=>Gf,safeParse:()=>Uf,safeParseAsync:()=>jf,set:()=>Xk,setErrorMap:()=>RR,size:()=>vr,slugify:()=>$o,startsWith:()=>yo,strictObject:()=>Zk,string:()=>Gi,stringFormat:()=>Ik,stringbool:()=>fw,success:()=>nw,superRefine:()=>jg,symbol:()=>Uk,templateLiteral:()=>sw,toJSONSchema:()=>yc,toLowerCase:()=>So,toUpperCase:()=>_o,transform:()=>qc,treeifyError:()=>Xu,trim:()=>wo,tuple:()=>ug,uint32:()=>Ok,uint64:()=>Lk,ulid:()=>fk,undefined:()=>jk,union:()=>Wc,unknown:()=>xr,uppercase:()=>ho,url:()=>ck,util:()=>C,uuid:()=>ok,uuidv4:()=>ik,uuidv6:()=>sk,uuidv7:()=>ak,void:()=>Fk,xid:()=>gk,xor:()=>Wk});var pn={};nn(pn,{$ZodAny:()=>Ep,$ZodArray:()=>Rp,$ZodAsyncError:()=>$t,$ZodBase64:()=>vp,$ZodBase64URL:()=>yp,$ZodBigInt:()=>Na,$ZodBigIntFormat:()=>Sp,$ZodBoolean:()=>Ui,$ZodCIDRv4:()=>fp,$ZodCIDRv6:()=>gp,$ZodCUID:()=>np,$ZodCUID2:()=>rp,$ZodCatch:()=>Kp,$ZodCheck:()=>ye,$ZodCheckBigIntFormat:()=>Rd,$ZodCheckEndsWith:()=>Zd,$ZodCheckGreaterThan:()=>Pa,$ZodCheckIncludes:()=>Bd,$ZodCheckLengthEquals:()=>jd,$ZodCheckLessThan:()=>Aa,$ZodCheckLowerCase:()=>Fd,$ZodCheckMaxLength:()=>Ld,$ZodCheckMaxSize:()=>Od,$ZodCheckMimeType:()=>Wd,$ZodCheckMinLength:()=>Ud,$ZodCheckMinSize:()=>Dd,$ZodCheckMultipleOf:()=>Cd,$ZodCheckNumberFormat:()=>Td,$ZodCheckOverwrite:()=>Vd,$ZodCheckProperty:()=>Gd,$ZodCheckRegex:()=>zd,$ZodCheckSizeEquals:()=>Nd,$ZodCheckStartsWith:()=>Hd,$ZodCheckStringFormat:()=>po,$ZodCheckUpperCase:()=>Md,$ZodCodec:()=>zi,$ZodCustom:()=>om,$ZodCustomStringFormat:()=>kp,$ZodDate:()=>Tp,$ZodDefault:()=>Wp,$ZodDiscriminatedUnion:()=>Np,$ZodE164:()=>bp,$ZodEmail:()=>Yd,$ZodEmoji:()=>ep,$ZodEncodeError:()=>jn,$ZodEnum:()=>Fp,$ZodError:()=>Ti,$ZodExactOptional:()=>Zp,$ZodFile:()=>Bp,$ZodFunction:()=>tm,$ZodGUID:()=>Kd,$ZodIPv4:()=>dp,$ZodIPv6:()=>pp,$ZodISODate:()=>cp,$ZodISODateTime:()=>ap,$ZodISODuration:()=>up,$ZodISOTime:()=>lp,$ZodIntersection:()=>Lp,$ZodJWT:()=>xp,$ZodKSUID:()=>sp,$ZodLazy:()=>rm,$ZodLiteral:()=>Mp,$ZodMAC:()=>mp,$ZodMap:()=>jp,$ZodNaN:()=>Xp,$ZodNanoID:()=>tp,$ZodNever:()=>Pp,$ZodNonOptional:()=>qp,$ZodNull:()=>Ip,$ZodNullable:()=>Gp,$ZodNumber:()=>Da,$ZodNumberFormat:()=>wp,$ZodObject:()=>Xb,$ZodObjectJIT:()=>Op,$ZodOptional:()=>Ua,$ZodPipe:()=>ja,$ZodPrefault:()=>Vp,$ZodPreprocess:()=>Yp,$ZodPromise:()=>nm,$ZodReadonly:()=>Qp,$ZodRealError:()=>tt,$ZodRecord:()=>Up,$ZodRegistry:()=>Ba,$ZodSet:()=>zp,$ZodString:()=>hr,$ZodStringFormat:()=>ge,$ZodSuccess:()=>Jp,$ZodSymbol:()=>_p,$ZodTemplateLiteral:()=>em,$ZodTransform:()=>Hp,$ZodTuple:()=>La,$ZodType:()=>V,$ZodULID:()=>op,$ZodURL:()=>Qd,$ZodUUID:()=>Xd,$ZodUndefined:()=>$p,$ZodUnion:()=>ji,$ZodUnknown:()=>Ap,$ZodVoid:()=>Cp,$ZodXID:()=>ip,$ZodXor:()=>Dp,$brand:()=>zu,$constructor:()=>b,$input:()=>sm,$output:()=>im,Doc:()=>Li,JSONSchema:()=>Qx,JSONSchemaGenerator:()=>bc,NEVER:()=>ju,TimePrecision:()=>um,_any:()=>Tm,_array:()=>jm,_base64:()=>sc,_base64url:()=>ac,_bigint:()=>_m,_boolean:()=>wm,_catch:()=>kR,_check:()=>Yx,_cidrv4:()=>oc,_cidrv6:()=>ic,_coercedBigint:()=>$m,_coercedBoolean:()=>Sm,_coercedDate:()=>Lm,_coercedNumber:()=>hm,_coercedString:()=>cm,_cuid:()=>Xa,_cuid2:()=>Ya,_custom:()=>Fm,_date:()=>Nm,_decode:()=>ba,_decodeAsync:()=>ka,_default:()=>yR,_discriminatedUnion:()=>sR,_e164:()=>cc,_email:()=>Za,_emoji:()=>Ja,_encode:()=>ya,_encodeAsync:()=>xa,_endsWith:()=>bo,_enum:()=>pR,_file:()=>zm,_float32:()=>ym,_float64:()=>bm,_gt:()=>Bt,_gte:()=>We,_guid:()=>Bi,_includes:()=>vo,_int:()=>vm,_int32:()=>xm,_int64:()=>Im,_intersection:()=>aR,_ipv4:()=>nc,_ipv6:()=>rc,_isoDate:()=>pm,_isoDateTime:()=>dm,_isoDuration:()=>fm,_isoTime:()=>mm,_jwt:()=>lc,_ksuid:()=>tc,_lazy:()=>$R,_length:()=>br,_literal:()=>fR,_lowercase:()=>go,_lt:()=>Mt,_lte:()=>st,_mac:()=>lm,_map:()=>uR,_max:()=>st,_maxLength:()=>yr,_maxSize:()=>Zn,_mime:()=>xo,_min:()=>We,_minLength:()=>dn,_minSize:()=>Ht,_multipleOf:()=>Hn,_nan:()=>Um,_nanoid:()=>Ka,_nativeEnum:()=>mR,_negative:()=>dc,_never:()=>Om,_nonnegative:()=>mc,_nonoptional:()=>bR,_nonpositive:()=>pc,_normalize:()=>ko,_null:()=>Cm,_nullable:()=>vR,_number:()=>gm,_optional:()=>hR,_overwrite:()=>It,_parse:()=>ao,_parseAsync:()=>co,_pipe:()=>wR,_positive:()=>uc,_promise:()=>IR,_property:()=>fc,_readonly:()=>SR,_record:()=>lR,_refine:()=>Mm,_regex:()=>fo,_safeDecode:()=>Sa,_safeDecodeAsync:()=>$a,_safeEncode:()=>wa,_safeEncodeAsync:()=>_a,_safeParse:()=>lo,_safeParseAsync:()=>uo,_set:()=>dR,_size:()=>vr,_slugify:()=>$o,_startsWith:()=>yo,_string:()=>am,_stringFormat:()=>Io,_stringbool:()=>Gm,_success:()=>xR,_superRefine:()=>Bm,_symbol:()=>Am,_templateLiteral:()=>_R,_toLowerCase:()=>So,_toUpperCase:()=>_o,_transform:()=>gR,_trim:()=>wo,_tuple:()=>cR,_uint32:()=>km,_uint64:()=>Em,_ulid:()=>Qa,_undefined:()=>Pm,_union:()=>oR,_unknown:()=>Rm,_uppercase:()=>ho,_url:()=>Hi,_uuid:()=>Ga,_uuidv4:()=>Wa,_uuidv6:()=>Va,_uuidv7:()=>qa,_void:()=>Dm,_xid:()=>ec,_xor:()=>iR,clone:()=>Ze,config:()=>$e,createStandardJSONSchemaMethod:()=>Eo,createToJSONSchemaMethod:()=>Wm,decode:()=>IC,decodeAsync:()=>AC,describe:()=>Hm,encode:()=>$C,encodeAsync:()=>EC,extractDefs:()=>Wn,finalize:()=>Vn,flattenError:()=>Ri,formatError:()=>Oi,globalConfig:()=>mr,globalRegistry:()=>De,initializeContext:()=>Gn,isValidBase64:()=>hp,isValidBase64URL:()=>Vb,isValidJWT:()=>qb,locales:()=>Mi,meta:()=>Zm,parse:()=>ha,parseAsync:()=>va,prettifyError:()=>Yu,process:()=>pe,regexes:()=>it,registry:()=>Ha,safeDecode:()=>CC,safeDecodeAsync:()=>RC,safeEncode:()=>PC,safeEncodeAsync:()=>TC,safeParse:()=>Qu,safeParseAsync:()=>ed,toDotPath:()=>Ib,toJSONSchema:()=>yc,treeifyError:()=>Xu,util:()=>C,version:()=>qd});var kb,ju=Object.freeze({status:"aborted"});function b(e,t,r){function o(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);let u=s.prototype,d=Object.keys(u);for(let p=0;p<d.length;p++){let m=d[p];m in a||(a[m]=u[m].bind(a))}}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function s(a){var l;let u=r?.Parent?new i:this;o(u,a),(l=u._zod).deferred??(l.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var zu=Symbol("zod_brand"),$t=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},jn=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(kb=globalThis).__zod_globalConfig??(kb.__zod_globalConfig={});var mr=globalThis.__zod_globalConfig;function $e(e){return e&&Object.assign(mr,e),mr}var C={};nn(C,{BIGINT_FORMAT_RANGES:()=>Ju,Class:()=>Mu,NUMBER_FORMAT_RANGES:()=>qu,aborted:()=>Bn,allowsEval:()=>Zu,assert:()=>rC,assertEqual:()=>QP,assertIs:()=>tC,assertNever:()=>nC,assertNotEqual:()=>eC,assignProp:()=>Fn,base64ToUint8Array:()=>Sb,base64urlToUint8Array:()=>xC,cached:()=>io,captureStackTrace:()=>ga,cleanEnum:()=>bC,cleanRegex:()=>Ei,clone:()=>Ze,cloneDef:()=>iC,createTransparentProxy:()=>dC,defineLazy:()=>ne,esc:()=>fa,escapeRegex:()=>ht,explicitlyAborted:()=>Ku,extend:()=>fC,finalizeIssue:()=>Ge,floatSafeRemainder:()=>Bu,getElementAtPath:()=>sC,getEnumValues:()=>Ii,getLengthableOrigin:()=>Ci,getParsedType:()=>uC,getSizableOrigin:()=>Pi,hexToUint8Array:()=>wC,isObject:()=>fr,isPlainObject:()=>Mn,issue:()=>so,joinValues:()=>w,jsonStringifyReplacer:()=>oo,merge:()=>hC,mergeDefs:()=>un,normalizeParams:()=>R,nullish:()=>zn,numKeys:()=>lC,objectClone:()=>oC,omit:()=>mC,optionalKeys:()=>Vu,parsedType:()=>P,partial:()=>vC,pick:()=>pC,prefixIssues:()=>et,primitiveTypes:()=>Wu,promiseAllObject:()=>aC,propertyKeyTypes:()=>Ai,randomString:()=>cC,required:()=>yC,safeExtend:()=>gC,shallowClone:()=>Gu,slugify:()=>Hu,stringifyPrimitive:()=>A,uint8ArrayToBase64:()=>_b,uint8ArrayToBase64url:()=>kC,uint8ArrayToHex:()=>SC,unwrapMessage:()=>$i});function QP(e){return e}function eC(e){return e}function tC(e){}function nC(e){throw new Error("Unexpected value in exhaustive check")}function rC(e){}function Ii(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function w(e,t="|"){return e.map(r=>A(r)).join(t)}function oo(e,t){return typeof t=="bigint"?t.toString():t}function io(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function zn(e){return e==null}function Ei(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Bu(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var wb=Symbol("evaluating");function ne(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==wb)return o===void 0&&(o=wb,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function oC(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Fn(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function un(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function iC(e){return un(e._zod.def)}function sC(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function aC(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}function cC(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function fa(e){return JSON.stringify(e)}function Hu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ga="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function fr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Zu=io(()=>{if(mr.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Mn(e){if(fr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(fr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Gu(e){return Mn(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function lC(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var uC=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Ai=new Set(["string","number","symbol"]),Wu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ht(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function R(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function dC(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function A(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Vu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var qu={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ju={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function pC(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=un(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=r.shape[a])}return Fn(this,"shape",s),s},checks:[]});return Ze(e,i)}function mC(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=un(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return Fn(this,"shape",s),s},checks:[]});return Ze(e,i)}function fC(e,t){if(!Mn(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=un(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Fn(this,"shape",i),i}});return Ze(e,n)}function gC(e,t){if(!Mn(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=un(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Fn(this,"shape",o),o}});return Ze(e,r)}function hC(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=un(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Fn(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ze(e,r)}function vC(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=un(t._zod.def,{get shape(){let a=t._zod.def.shape,l={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(l[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)l[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return Fn(this,"shape",l),l},checks:[]});return Ze(t,s)}function yC(e,t,r){let o=un(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:n[s]}))}else for(let s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return Fn(this,"shape",i),i}});return Ze(t,o)}function Bn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ku(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function et(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function $i(e){return typeof e=="string"?e:e?.message}function Ge(e,t,r){let o=e.message?e.message:$i(e.inst?._zod.def?.error?.(e))??$i(t?.error?.(e))??$i(r.customError?.(e))??$i(r.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:s,...a}=e;return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=s),a}function Pi(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ci(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function P(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function so(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function bC(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Sb(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function _b(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function xC(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Sb(t+r)}function kC(e){return _b(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wC(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function SC(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Mu=class{constructor(...t){}};var $b=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,oo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ti=b("$ZodError",$b),tt=b("$ZodError",$b,{Parent:Error});function Ri(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function Oi(e,t=r=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let l=r,u=0;for(;u<a.length;){let d=a[u];u===a.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(t(s))):l[d]=l[d]||{_errors:[]},l=l[d],u++}}}};return o(e),r}function Xu(e,t=r=>r.message){let r={errors:[]},o=(n,i=[])=>{var s,a;for(let l of n.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>o({issues:u},[...i,...l.path]));else if(l.code==="invalid_key")o({issues:l.issues},[...i,...l.path]);else if(l.code==="invalid_element")o({issues:l.issues},[...i,...l.path]);else{let u=[...i,...l.path];if(u.length===0){r.errors.push(t(l));continue}let d=r,p=0;for(;p<u.length;){let m=u[p],f=p===u.length-1;typeof m=="string"?(d.properties??(d.properties={}),(s=d.properties)[m]??(s[m]={errors:[]}),d=d.properties[m]):(d.items??(d.items=[]),(a=d.items)[m]??(a[m]={errors:[]}),d=d.items[m]),f&&d.errors.push(t(l)),p++}}};return o(e),r}function Ib(e){let t=[],r=e.map(o=>typeof o=="object"?o.key:o);for(let o of r)typeof o=="number"?t.push(`[${o}]`):typeof o=="symbol"?t.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?t.push(`[${JSON.stringify(o)}]`):(t.length&&t.push("."),t.push(o));return t.join("")}function Yu(e){let t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)t.push(`\u2716 ${o.message}`),o.path?.length&&t.push(` \u2192 at ${Ib(o.path)}`);return t.join(`
|
|
174
|
-
`)}var ao=e=>(t,r,o,n)=>{let i=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new $t;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map(l=>Ge(l,i,$e())));throw ga(a,n?.callee),a}return s.value},ha=ao(tt),co=e=>async(t,r,o,n)=>{let i=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(n?.Err??e)(s.issues.map(l=>Ge(l,i,$e())));throw ga(a,n?.callee),a}return s.value},va=co(tt),lo=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new $t;return i.issues.length?{success:!1,error:new(e??Ti)(i.issues.map(s=>Ge(s,n,$e())))}:{success:!0,data:i.value}},Qu=lo(tt),uo=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>Ge(s,n,$e())))}:{success:!0,data:i.value}},ed=uo(tt),ya=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return ao(e)(t,r,n)},$C=ya(tt),ba=e=>(t,r,o)=>ao(e)(t,r,o),IC=ba(tt),xa=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return co(e)(t,r,n)},EC=xa(tt),ka=e=>async(t,r,o)=>co(e)(t,r,o),AC=ka(tt),wa=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return lo(e)(t,r,n)},PC=wa(tt),Sa=e=>(t,r,o)=>lo(e)(t,r,o),CC=Sa(tt),_a=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return uo(e)(t,r,n)},TC=_a(tt),$a=e=>async(t,r,o)=>uo(e)(t,r,o),RC=$a(tt);var it={};nn(it,{base64:()=>hd,base64url:()=>Ia,bigint:()=>Sd,boolean:()=>$d,browserEmail:()=>FC,cidrv4:()=>fd,cidrv6:()=>gd,cuid:()=>td,cuid2:()=>nd,date:()=>bd,datetime:()=>kd,domain:()=>HC,duration:()=>ad,e164:()=>yd,email:()=>ld,emoji:()=>ud,extendedDuration:()=>OC,guid:()=>cd,hex:()=>ZC,hostname:()=>BC,html5Email:()=>UC,httpProtocol:()=>vd,idnEmail:()=>zC,integer:()=>_d,ipv4:()=>dd,ipv6:()=>pd,ksuid:()=>id,lowercase:()=>Ad,mac:()=>md,md5_base64:()=>WC,md5_base64url:()=>VC,md5_hex:()=>GC,nanoid:()=>sd,null:()=>Id,number:()=>Ea,rfc5322Email:()=>jC,sha1_base64:()=>JC,sha1_base64url:()=>KC,sha1_hex:()=>qC,sha256_base64:()=>YC,sha256_base64url:()=>QC,sha256_hex:()=>XC,sha384_base64:()=>tT,sha384_base64url:()=>nT,sha384_hex:()=>eT,sha512_base64:()=>oT,sha512_base64url:()=>iT,sha512_hex:()=>rT,string:()=>wd,time:()=>xd,ulid:()=>rd,undefined:()=>Ed,unicodeEmail:()=>Eb,uppercase:()=>Pd,uuid:()=>gr,uuid4:()=>DC,uuid6:()=>NC,uuid7:()=>LC,xid:()=>od});var td=/^[cC][0-9a-z]{6,}$/,nd=/^[0-9a-z]+$/,rd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,od=/^[0-9a-vA-V]{20}$/,id=/^[A-Za-z0-9]{27}$/,sd=/^[a-zA-Z0-9_-]{21}$/,ad=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,OC=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,cd=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,DC=gr(4),NC=gr(6),LC=gr(7),ld=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,UC=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,jC=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Eb=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,zC=Eb,FC=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,MC="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ud(){return new RegExp(MC,"u")}var dd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,md=e=>{let t=ht(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},fd=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,gd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ia=/^[A-Za-z0-9_-]*$/,BC=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,HC=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,vd=/^https?$/,yd=/^\+[1-9]\d{6,14}$/,Ab="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",bd=new RegExp(`^${Ab}$`);function Pb(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function xd(e){return new RegExp(`^${Pb(e)}$`)}function kd(e){let t=Pb({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Ab}T(?:${o})$`)}var wd=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Sd=/^-?\d+n?$/,_d=/^-?\d+$/,Ea=/^-?\d+(?:\.\d+)?$/,$d=/^(?:true|false)$/i,Id=/^null$/i;var Ed=/^undefined$/i;var Ad=/^[^A-Z]*$/,Pd=/^[^a-z]*$/,ZC=/^[0-9a-fA-F]*$/;function Di(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Ni(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var GC=/^[0-9a-fA-F]{32}$/,WC=Di(22,"=="),VC=Ni(22),qC=/^[0-9a-fA-F]{40}$/,JC=Di(27,"="),KC=Ni(27),XC=/^[0-9a-fA-F]{64}$/,YC=Di(43,"="),QC=Ni(43),eT=/^[0-9a-fA-F]{96}$/,tT=Di(64,""),nT=Ni(64),rT=/^[0-9a-fA-F]{128}$/,oT=Di(86,"=="),iT=Ni(86);var ye=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Tb={number:"number",bigint:"bigint",object:"date"},Aa=b("$ZodCheckLessThan",(e,t)=>{ye.init(e,t);let r=Tb[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Pa=b("$ZodCheckGreaterThan",(e,t)=>{ye.init(e,t);let r=Tb[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Cd=b("$ZodCheckMultipleOf",(e,t)=>{ye.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Bu(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Td=b("$ZodCheckNumberFormat",(e,t)=>{ye.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=qu[t.format];e._zod.onattach.push(s=>{let a=s._zod.bag;a.format=t.format,a.minimum=n,a.maximum=i,r&&(a.pattern=_d)}),e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<n&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Rd=b("$ZodCheckBigIntFormat",(e,t)=>{ye.init(e,t);let[r,o]=Ju[t.format];e._zod.onattach.push(n=>{let i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=n=>{let i=n.value;i<r&&n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>o&&n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Od=b("$ZodCheckMaxSize",(e,t)=>{var r;ye.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zn(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;n.size<=t.maximum||o.issues.push({origin:Pi(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Dd=b("$ZodCheckMinSize",(e,t)=>{var r;ye.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zn(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;n.size>=t.minimum||o.issues.push({origin:Pi(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Nd=b("$ZodCheckSizeEquals",(e,t)=>{var r;ye.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zn(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=o=>{let n=o.value,i=n.size;if(i===t.size)return;let s=i>t.size;o.issues.push({origin:Pi(n),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Ld=b("$ZodCheckMaxLength",(e,t)=>{var r;ye.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zn(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let s=Ci(n);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ud=b("$ZodCheckMinLength",(e,t)=>{var r;ye.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zn(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let s=Ci(n);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),jd=b("$ZodCheckLengthEquals",(e,t)=>{var r;ye.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zn(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,i=n.length;if(i===t.length)return;let s=Ci(n),a=i>t.length;o.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),po=b("$ZodCheckStringFormat",(e,t)=>{var r,o;ye.init(e,t),e._zod.onattach.push(n=>{let i=n._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),zd=b("$ZodCheckRegex",(e,t)=>{po.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Fd=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ad),po.init(e,t)}),Md=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Pd),po.init(e,t)}),Bd=b("$ZodCheckIncludes",(e,t)=>{ye.init(e,t);let r=ht(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Hd=b("$ZodCheckStartsWith",(e,t)=>{ye.init(e,t);let r=new RegExp(`^${ht(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Zd=b("$ZodCheckEndsWith",(e,t)=>{ye.init(e,t);let r=new RegExp(`.*${ht(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function Cb(e,t,r){e.issues.length&&t.issues.push(...et(r,e.issues))}var Gd=b("$ZodCheckProperty",(e,t)=>{ye.init(e,t),e._zod.check=r=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then(n=>Cb(n,r,t.property));Cb(o,r,t.property)}}),Wd=b("$ZodCheckMimeType",(e,t)=>{ye.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(o=>{o._zod.bag.mime=t.mime}),e._zod.check=o=>{r.has(o.value.type)||o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),Vd=b("$ZodCheckOverwrite",(e,t)=>{ye.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Li=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
|
|
175
|
-
`).filter(s=>s),n=Math.min(...o.map(s=>s.length-s.trimStart().length)),i=o.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,n.join(`
|
|
176
|
-
`))}};var qd={major:4,minor:4,patch:3};var V=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qd;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(s,a,l)=>{let u=Bn(s),d;for(let p of a){if(p._zod.def.when){if(Ku(s)||!p._zod.def.when(s))continue}else if(u)continue;let m=s.issues.length,f=p._zod.check(s);if(f instanceof Promise&&l?.async===!1)throw new $t;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,s.issues.length!==m&&(u||(u=Bn(s,m)))});else{if(s.issues.length===m)continue;u||(u=Bn(s,m))}}return d?d.then(()=>s):s},i=(s,a,l)=>{if(Bn(s))return s.aborted=!0,s;let u=n(a,o,l);if(u instanceof Promise){if(l.async===!1)throw new $t;return u.then(d=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let u=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>i(d,s,a)):i(u,s,a)}let l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new $t;return l.then(u=>n(u,o,a))}return n(l,o,a)}}ne(e,"~standard",()=>({validate:n=>{try{let i=Qu(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return ed(e,n).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),hr=b("$ZodString",(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??wd(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ge=b("$ZodStringFormat",(e,t)=>{po.init(e,t),hr.init(e,t)}),Kd=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=cd),ge.init(e,t)}),Xd=b("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gr(o))}else t.pattern??(t.pattern=gr());ge.init(e,t)}),Yd=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ld),ge.init(e,t)}),Qd=b("$ZodURL",(e,t)=>{ge.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===vd.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ep=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ud()),ge.init(e,t)}),tp=b("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=sd),ge.init(e,t)}),np=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=td),ge.init(e,t)}),rp=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=nd),ge.init(e,t)}),op=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=rd),ge.init(e,t)}),ip=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=od),ge.init(e,t)}),sp=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=id),ge.init(e,t)}),ap=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=kd(t)),ge.init(e,t)}),cp=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=bd),ge.init(e,t)}),lp=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=xd(t)),ge.init(e,t)}),up=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ad),ge.init(e,t)}),dp=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dd),ge.init(e,t),e._zod.bag.format="ipv4"}),pp=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=pd),ge.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),mp=b("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=md(t.delimiter)),ge.init(e,t),e._zod.bag.format="mac"}),fp=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fd),ge.init(e,t)}),gp=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=gd),ge.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,i]=o;if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function hp(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var vp=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=hd),ge.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{hp(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Vb(e){if(!Ia.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return hp(r)}var yp=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ia),ge.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Vb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),bp=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=yd),ge.init(e,t)});function qb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var xp=b("$ZodJWT",(e,t)=>{ge.init(e,t),e._zod.check=r=>{qb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),kp=b("$ZodCustomStringFormat",(e,t)=>{ge.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Da=b("$ZodNumber",(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ea,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),wp=b("$ZodNumberFormat",(e,t)=>{Td.init(e,t),Da.init(e,t)}),Ui=b("$ZodBoolean",(e,t)=>{V.init(e,t),e._zod.pattern=$d,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Na=b("$ZodBigInt",(e,t)=>{V.init(e,t),e._zod.pattern=Sd,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Sp=b("$ZodBigIntFormat",(e,t)=>{Rd.init(e,t),Na.init(e,t)}),_p=b("$ZodSymbol",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),$p=b("$ZodUndefined",(e,t)=>{V.init(e,t),e._zod.pattern=Ed,e._zod.values=new Set([void 0]),e._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),Ip=b("$ZodNull",(e,t)=>{V.init(e,t),e._zod.pattern=Id,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Ep=b("$ZodAny",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),Ap=b("$ZodUnknown",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),Pp=b("$ZodNever",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Cp=b("$ZodVoid",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),Tp=b("$ZodDate",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,i=n instanceof Date;return i&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});function Ob(e,t,r){e.issues.length&&t.issues.push(...et(r,e.issues)),t.value[r]=e.value}var Rp=b("$ZodArray",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let a=n[s],l=t.element._zod.run({value:a,issues:[]},o);l instanceof Promise?i.push(l.then(u=>Ob(u,r,s))):Ob(l,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function Oa(e,t,r,o,n,i){let s=r in o;if(e.issues.length){if(n&&i&&!s)return;t.issues.push(...et(r,e.issues))}if(!s&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?s&&(t.value[r]=void 0):t.value[r]=e.value}function Jb(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Vu(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Kb(e,t,r,o,n,i){let s=[],a=n.keySet,l=n.catchall._zod,u=l.def.type,d=l.optin==="optional",p=l.optout==="optional";for(let m in t){if(m==="__proto__"||a.has(m))continue;if(u==="never"){s.push(m);continue}let f=l.run({value:t[m],issues:[]},o);f instanceof Promise?e.push(f.then(g=>Oa(g,r,m,t,d,p))):Oa(f,r,m,t,d,p)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var Xb=b("$ZodObject",(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...a};return Object.defineProperty(t,"shape",{value:l}),l}})}let o=io(()=>Jb(t));ne(e._zod,"propValues",()=>{let a=t.shape,l={};for(let u in a){let d=a[u]._zod;if(d.values){l[u]??(l[u]=new Set);for(let p of d.values)l[u].add(p)}}return l});let n=fr,i=t.catchall,s;e._zod.parse=(a,l)=>{s??(s=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let d=[],p=s.shape;for(let m of s.keys){let f=p[m],g=f._zod.optin==="optional",h=f._zod.optout==="optional",y=f._zod.run({value:u[m],issues:[]},l);y instanceof Promise?d.push(y.then(k=>Oa(k,a,m,u,g,h))):Oa(y,a,m,u,g,h)}return i?Kb(d,u,a,l,o.value,e):d.length?Promise.all(d).then(()=>a):a}}),Op=b("$ZodObjectJIT",(e,t)=>{Xb.init(e,t);let r=e._zod.parse,o=io(()=>Jb(t)),n=m=>{let f=new Li(["shape","payload","ctx"]),g=o.value,h=I=>{let S=fa(I);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),k=0;for(let I of g.keys)y[I]=`key_${k++}`;f.write("const newResult = {};");for(let I of g.keys){let S=y[I],T=fa(I),j=m[I],F=j?._zod?.optin==="optional",J=j?._zod?.optout==="optional";f.write(`const ${S} = ${h(I)};`),F&&J?f.write(`
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
178
|
+
</div></body></html>`}import{spawn as Sd}from"node:child_process";function OT(e,t=Sd){return new Promise(n=>{let o=!1,r=a=>{o||(o=!0,n(a))},i=t("powershell.exe",["-NoProfile","-NonInteractive","-Command","$u=[Console]::In.ReadLine(); try { Start-Process $u -ErrorAction Stop } catch { exit 1 }"],{stdio:["pipe","ignore","ignore"]}),s=setTimeout(()=>{try{i.kill()}catch{}r(!1)},8e3);s.unref?.(),i.on("error",()=>{clearTimeout(s),r(!1)}),i.on("exit",a=>{clearTimeout(s),r(a===0)}),i.stdin?.on("error",()=>{}),i.stdin?.end(`${e}
|
|
179
|
+
`)})}function DT(e,t=Sd){return new Promise(n=>{let o=t("cmd.exe",["/c","start","",e.replace(/&/g,"^&")],{detached:!0,stdio:"ignore"});o.on("error",()=>n(!1)),o.on("spawn",()=>{o.unref(),n(!0)})})}var NT=1200;function hx(e,t,n,o){return new Promise(r=>{let i=!1,s=u=>{i||(i=!0,r(u))},a=n(e,[t],{detached:!0,stdio:"ignore"}),l=setTimeout(()=>s(!0),o);l.unref?.(),a.on("error",()=>{clearTimeout(l),s(!1)}),a.on("exit",u=>{clearTimeout(l),s(u===0)}),a.on("spawn",()=>a.unref())})}async function qn(e,t){let n=t.platform??process.platform,o=t.spawnImpl??Sd;if(n==="win32"||t.isWsl)return await OT(e,o)?!0:DT(e,o);let r=t.graceMs??NT;return hx(n==="darwin"?"open":"xdg-open",e,o,r)}function _d(){return Hy().length>0}function LT(){Ai()}async function vx(e,t,n){let o=(e??"").replace(/\/+$/,""),r=n?.fetchImpl??fetch;if(o&&t)try{await r(`${o}/node/revoke`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${t}`},body:"{}",signal:AbortSignal.timeout(3e3)})}catch{}(n?.clear??LT)()}var UT=4,jT=1500,zT=e=>new Promise(t=>setTimeout(t,e)),ji=null;function yx(e,t,n={}){if((n.hasCredential??_d)())return Promise.resolve(!0);if(ji)return ji;let r=n.attempts??UT,i=n.retryMs??jT,s=n.provision??Fy,a=n.claim??My,l=n.store??qu,u=n.log??(d=>console.error(d));return ji=(async()=>{let d="no attempt made";try{for(let p=1;p<=r;p++){p>1&&await zT(i);let m=t();if(!m){d="no sign-in token available yet";continue}try{let f=await s(e,m),g=await a(e,f);if(!g.access_token||!g.refresh_token)throw new Error("claim returned an incomplete pair");return l(g),!0}catch(f){d=f instanceof Error?f.message:String(f)}}return u(`[auth] node-credential provisioning failed after ${r} attempts (hub will fall back to the app-refreshed token): ${d}`),!1}finally{ji=null}})(),ji}async function bx(e){let t=cx(),n=Ta(),o=e.chooser?gx(fx({cfg:e.cfg,state:n,codeChallenge:t.challenge,...e.opts.email?{email:e.opts.email}:{},...e.opts.screenHint?{screenHint:e.opts.screenHint}:{}})):void 0,i=(e.listen??((d,p,m,f,g)=>Na(d,p,m,f,void 0,void 0,g)))(e.cfg.port,n,e.signal,e.timeoutMs??18e4,o),s=e.openUrl??(d=>qn(d,{isWsl:!1})),a;o?(i.result.catch(()=>{}),a=`http://127.0.0.1:${await i.port}/`):a=Oa({cfg:e.cfg,opts:e.opts,state:n,codeChallenge:t.challenge}),await s(a)||e.onBrowserFail?.(a);let{code:l}=await i.result;return(e.exchange??((d,p,m)=>ux(d,p,m)))(e.cfg,l,t.verifier)}var Ed="https://relay.ac-bridge.com/ha-client";var Ad="/ha/callback",xx=`http://127.0.0.1:8987${Ad}`,$d=e=>e.replace(/\/+$/,"");function kx(e){let t=new URLSearchParams({client_id:e.clientId,redirect_uri:e.redirectUri,state:e.state,response_type:"code"});return`${$d(e.baseUrl)}/auth/authorize?${t.toString()}`}async function wx(e){let t=e.fetchImpl??((s,a)=>fetch(s,a)),n=e.now??Date.now(),o=await t(`${$d(e.baseUrl)}/auth/token`,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:e.code,client_id:e.clientId}).toString()});if(!o.ok)throw new Error(`Home Assistant rejected the sign-in (HTTP ${o.status}). Check the address and try again.`);let r=await o.json().catch(()=>null);if(!r||typeof r.access_token!="string"||typeof r.refresh_token!="string")throw new Error("Home Assistant returned an unexpected token response.");let i=typeof r.expires_in=="number"?r.expires_in:1800;return{hassUrl:$d(e.baseUrl),clientId:e.clientId,refresh_token:r.refresh_token,access_token:r.access_token,expires:n+i*1e3,expires_in:i}}import lt from"node:path";function Te(e={}){let t=L(e.file??$i);if(!t)return null;try{let n=JSON.parse(t);return typeof n.sub!="string"||!n.sub?null:{sub:n.sub,...typeof n.email=="string"?{email:n.email}:{},updatedAt:typeof n.updatedAt=="number"?n.updatedAt:0}}catch{return null}}function $r(e,t={}){let n={sub:e.sub,...e.email?{email:e.email}:{},updatedAt:Date.now()};_e(t.file??$i,`${JSON.stringify(n,null,2)}
|
|
180
|
+
`,384)}function Sx(e={}){Ie(e.file??$i)}function FT(){let e=Te()?.sub;if(!e)return null;let t=Ct(bt(e)),n=L(t.refreshFile),o=n?Qe(n):null;if(o)return o;let r=L(t.accessFile);return r?Qe(r):null}function kt(e={}){let t=e.readActiveUser??(()=>Te()),n=e.readCredentialSub??FT,o=e.log??(a=>console.warn(a)),r=t()?.sub??null,i=n();if(!r||!i)return null;if(r!==i)return o(`user-scope: active-user pointer sub (${r}) does not match the credential sub (${i}) \u2014 refusing to resolve a scope (stale-pointer guard)`),null;let s=bt(r);return{sub:r,segment:s,dir:sa(s)}}function Fi(e){let t=e.dir;return{dir:t,providerSecretFile(n,o){return zi("provider",n),zi("secret name",o),lt.join(t,"providers",n,`${o}.json`)},providerAccountsFile(n){return zi("provider",n),lt.join(t,"providers",n,"accounts.json")},localConfigFile:lt.join(t,"local-config.json"),localDiscoveredFile:lt.join(t,"local-discovered.json"),entitlementFile:lt.join(t,"entitlement.json"),revertSessionFile:lt.join(t,"revert-session.json"),userConfigFile:lt.join(t,"config.json"),relayAccessFile:lt.join(t,"relay-access-token"),relayRefreshFile:lt.join(t,"relay-refresh-token"),hubTokenFile:lt.join(t,"hub-token"),workspaceFile:lt.join(t,"workspace.json")}}function Id(e,t){if((t?.layout??hn())>=vn){let o=(t?.resolveScope??(()=>kt()))();if(o)return lt.join(e,"users",o.segment,"hub-token")}return lt.join(e,"hub-token")}import{existsSync as MT,mkdirSync as $x,renameSync as Cd}from"node:fs";import He from"node:path";var BT="layout-version.json",Ex=3,HT=["providers","local-config.json","local-discovered.json","entitlement.json","revert-session.json","telemetry"];function Ax(e={}){let t=e.secretDir??ee,n=e.now??(()=>new Date),o=He.join(t,BT);if(JT(o))return{archived:[],skipped:!0,credentialRelocated:null,credentialArchived:!1};let r=He.join(t,`legacy-${qT(n())}`),i=!1,s=()=>(i||($x(r,{recursive:!0,mode:448}),i=!0),r),a=HT.filter(p=>MT(He.join(t,p))),l=[];for(let p of a)try{s(),Cd(He.join(t,p),He.join(r,p)),l.push(p)}catch(m){if(m.code==="ENOENT")continue;console.warn(`archiveLegacyUserState: failed to archive "${p}": ${m.message}`)}let u=l.length===a.length;Ie(He.join(t,"hub-token"));let d=u?VT(t,s):{relocated:null,archived:!1,ok:!0};return u&&d.ok&&(Pa({onboardedAt:null},{configFile:He.join(t,"config.json")}),KT(o,n)),{archived:l,skipped:!1,credentialRelocated:d.relocated,credentialArchived:d.archived}}function GT(e){return{accessFile:He.join(e,"relay-access-token"),refreshFile:He.join(e,"relay-refresh-token")}}function WT(e,t){let n=He.join(e,"users",t);return{accessFile:He.join(n,"relay-access-token"),refreshFile:He.join(n,"relay-refresh-token")}}function _x(e,t){try{return $x(He.dirname(t),{recursive:!0,mode:448}),Cd(e,t),"moved"}catch(n){return n.code==="ENOENT"?"absent":(console.warn(`archiveLegacyUserState: failed to relocate credential to "${t}": ${n.message}`),"failed")}}function La(e,t,n){try{let o=e();return Cd(t,He.join(o,n)),"moved"}catch(o){return o.code==="ENOENT"?"absent":(console.warn(`archiveLegacyUserState: failed to archive credential "${n}": ${o.message}`),"failed")}}function ZT(e,t){let n=He.join(e,"active-user.json");if(Te({file:n})===null)try{$r({sub:t},{file:n})}catch(o){console.warn(`archiveLegacyUserState: failed to heal the active-user pointer to "${t}": ${o.message}`)}}function VT(e,t){let n=GT(e),o=L(n.refreshFile),r=L(n.accessFile);if(!o&&!r)return{relocated:null,archived:!1,ok:!0};let i=o?Qe(o):null,s=r?Qe(r):null,a=i??s;if(!a){let m=o?La(t,n.refreshFile,"relay-refresh-token"):"absent",f=r?La(t,n.accessFile,"relay-access-token"):"absent";return{relocated:null,archived:m==="moved"||f==="moved",ok:m!=="failed"&&f!=="failed"}}i&&s&&i!==s&&console.warn(`archiveLegacyUserState: access-token sub (${s}) differs from refresh-token sub (${i}) \u2014 relocating the refresh to its sub and archiving the access (the refresh loop re-mints a matching access)`);let l=bt(a),u=WT(e,l),d=!0,p=!1;if(o){let m=i===a?_x(n.refreshFile,u.refreshFile):La(t,n.refreshFile,"relay-refresh-token");m==="failed"?d=!1:m==="moved"&&i!==a&&(p=!0)}if(r){let m=s===a?_x(n.accessFile,u.accessFile):La(t,n.accessFile,"relay-access-token");m==="failed"?d=!1:m==="moved"&&s!==a&&(p=!0)}return d&&ZT(e,a),{relocated:{sub:a,segment:l},archived:p,ok:d}}function qT(e){return e.toISOString().replace(/[:.]/g,"-")}function JT(e){let t=L(e);if(!t)return!1;try{let n=JSON.parse(t);return typeof n.version=="number"&&n.version>=Ex}catch{return!1}}function KT(e,t){let n={version:Ex,migratedAt:t().toISOString()};_e(e,`${JSON.stringify(n,null,2)}
|
|
181
|
+
`,384)}var nR=tt.join(ee,"hub-token"),M5=Number(process.env.BRIDGE_HUB_PORT)||8790,Ee=tt.join(ee,"config.json"),Rt=tt.join(ee,"hub.log"),Ci=tt.join(ee,"hub.pid"),B5=tt.join(ee,kr),wt=tt.join(ee,"daemon.pid"),Ua=tt.join(ee,"daemon-beacon.json"),Jn=tt.join(ee,"daemon.log"),Mi=tt.join(ee,"hub-stop-reason.json"),Tx=tt.join(ee,"hub-relay-status.json"),H5=tt.join(ee,"hub-holders.json"),Rx=tt.join(ee,"sessions"),Pd=e=>tt.join(Rx,`${e}.json`);function _e(e,t,n=384){let o=tt.dirname(e),r=(n&63)===0;if(YT(o,{recursive:!0,...r?{mode:448}:{}}),r)try{Ix(o,448)}catch{}let i=`${e}.tmp-${process.pid}-${process.hrtime.bigint()}`;Px(i,t,{mode:n});try{eR(i,e)}catch(s){try{Cx(i,{force:!0})}catch{}throw s}}function L(e){try{return QT(e,"utf8").trim()||null}catch{return null}}function Ox(e,t){let n=t?.write??((r,i)=>_e(r,i,384)),o=t?.now??Date.now;try{n(Mi,JSON.stringify({signal:e,ts:o()}))}catch{}}function ja(){let e={};try{let t=L(Ee);t&&(e=JSON.parse(t))}catch{}return process.env.BRIDGE_MACHINE||e.machine||tR.hostname().split(".")[0]||"node"}function Dx(){let e=Number(process.env.BRIDGE_HUB_PORT);if(e)return e;try{let t=L(Ee);if(t){let n=JSON.parse(t);if(n.hubPort)return Number(n.hubPort)}}catch{}return 8790}function Td(e){try{Px(e,"",{mode:384}),Ix(e,384)}catch{}}function Ie(e){try{Cx(e,{force:!0})}catch{}}function za(e){try{return process.kill(e,0),!0}catch(t){return t.code!=="ESRCH"}}function zi(e,t){if(!t||t.includes("/")||t.includes("\\")||t.includes("..")||t.includes("\0"))throw new Error(`unsafe ${e}: ${JSON.stringify(t)}`)}function ho(e,t){return zi("provider",e),`${e}_${XT("sha256").update(t).digest("hex").slice(0,12)}`}import{readFileSync as sR}from"node:fs";import{existsSync as rR}from"node:fs";import bn from"node:path";import{fileURLToPath as oR}from"node:url";function iR(e){let t=process.env.BRIDGE_PKG_ROOT;if(t&&t.trim())return t.trim();let n=o=>rR(bn.join(o,"plugin",".claude-plugin","marketplace.json"));for(let o of[bn.join(e,".."),bn.join(e,"..","..")])if(n(o))return o;return bn.join(e,"..","..")}var xn=iR(bn.dirname(oR(import.meta.url))),Kn=bn.join(xn,"plugin"),Bi=bn.join(xn,"hub","dist","hub.cjs"),Nx=bn.join(xn,"hub","src","index.ts"),Fa=bn.join(xn,"node_modules",".bin","tsx");var aR="https://relay.ac-bridge.com",cR=8790;function le(){let e={};try{e=JSON.parse(sR(Ee,"utf8"))}catch{}return{relayUrl:process.env.BRIDGE_RELAY_URL||e.relayUrl||aR,hubPort:Number(process.env.BRIDGE_HUB_PORT||e.hubPort||cR),machine:ja()}}async function Lx(e,t,n){let{relayUrl:o}=le();return fetch(`${o}${e}`,{method:"POST",headers:{"content-type":"application/json",...n?{authorization:`Bearer ${n}`}:{}},body:t===void 0?void 0:JSON.stringify(t)})}async function Xn(e){let{relayUrl:t}=le();try{let n=await fetch(`${t}/entitlement`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(6e3)});return n.ok?await n.json():null}catch{return null}}async function Ux(e,t=fetch){let{relayUrl:n}=le();try{let o=await t(`${n}/sessions`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(15e3)});return o.ok?(await o.text()).trim()||"(none)":null}catch{return null}}async function jx(e){let{relayUrl:t}=le();try{let n=await fetch(`${t}/devices`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(1e4)});return n.ok?await n.json():null}catch{return null}}async function zx(e){let{relayUrl:t}=le();try{let n=await fetch(`${t}/device-audit`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(1e4)});return n.ok?await n.json():null}catch{return null}}async function Fx(e,t){try{let n=await Lx("/device/command",t,e),o=await n.json().catch(()=>({})),r=typeof o.error=="string"?o.error:void 0,i=Gy(r)??r;return{ok:n.ok&&o.ok===!0,status:n.status,...i?{error:i}:{},...typeof o.verified=="boolean"?{verified:o.verified}:{},...typeof o.note=="string"?{note:o.note}:{}}}catch(n){return{ok:!1,status:0,error:n instanceof Error?n.message:"command failed"}}}async function vo(e){let t=await Ma(e);return t?t.config:null}async function Ma(e,t=fetch){let{relayUrl:n}=le();try{let o=await t(`${n}/device-config`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(1e4)});if(!o.ok)return null;let r=await o.json();return{version:typeof r.version=="number"?r.version:0,config:r.config&&typeof r.config=="object"?r.config:{}}}catch{return null}}var lR=256*1024;async function Mx(e,t,n,o=fetch){let{relayUrl:r}=le(),i=JSON.stringify({version:t,config:n});if(Buffer.byteLength(i)>lR)return{ok:!1,version:t,config:n,error:"This profile set is too large to sync (over 256 KB). Remove a profile or some device actions."};try{let s=await o(`${r}/device-config`,{method:"PUT",headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:i,signal:AbortSignal.timeout(1e4)}),a=await s.json().catch(()=>({}));if(s.ok&&a.error===void 0&&typeof a.version=="number")return{ok:!0,version:a.version,config:n};if(a.error==="version_conflict"){let l=await Ma(e,o);return l?{ok:!1,version:l.version,config:l.config,error:"version_conflict"}:{ok:!1,version:t,config:n,error:"version_conflict, and the latest document could not be re-read"}}return{ok:!1,version:t,config:n,error:typeof a.error=="string"?a.error:`device-config update failed (${s.status})`}}catch(s){return{ok:!1,version:t,config:n,error:s instanceof Error?s.message:"device-config update failed"}}}async function Bx(e,t,n=fetch){let{relayUrl:o}=le();try{let r=await n(`${o}/connected-accounts/${encodeURIComponent(t)}/revoke`,{method:"POST",headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(1e4)});if(r.ok)return{ok:!0,status:r.status};let i=await r.json().catch(()=>({}));return{ok:!1,status:r.status,error:typeof i.error=="string"?i.error:`revoke failed (${r.status})`}}catch(r){return{ok:!1,status:0,error:r instanceof Error?r.message:"revoke failed"}}}async function yo(e){let{relayUrl:t}=le();try{let n=await fetch(`${t}/connected-accounts`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(1e4)});if(!n.ok)return null;let o=await n.json();return Array.isArray(o.accounts)?o.accounts:[]}catch{return null}}async function Hx(e){let t=L($e().accessFile)?.trim();if(!t)return{ok:!1,error:"Not signed in. Run `acbridge login` first."};try{let n=await Lx(`/link/${encodeURIComponent(e)}/start`,{},t),o=await n.json().catch(()=>({}));return n.ok&&typeof o.authorize_url=="string"?{ok:!0,authorizeUrl:o.authorize_url}:{ok:!1,error:typeof o.error=="string"?o.error:`link start failed (${n.status})`}}catch(n){return{ok:!1,error:n instanceof Error?n.message:"link start failed"}}}var uR=!!process.stdout.isTTY&&!process.env.NO_COLOR,Ba=e=>t=>uR?`\x1B[${e}m${t}\x1B[0m`:t,dR=Ba("32"),pR=Ba("33"),mR=Ba("31"),ce=Ba("2"),Rd=!1,fe=(e=!0)=>{Rd=e};var Ha=e=>{Rd?console.error(e):console.log(e)},V=e=>console.log(JSON.stringify(e)),A=e=>Ha(`${dR("\u2714")} ${e}`),j=e=>Ha(`${pR("\u26A0")} ${e}`),k=e=>console.error(`${mR("\u2717")} ${e}`),v=e=>Ha(e),X=e=>Ha(ce(`\u2022 ${e}`)),$=(e,t)=>(k(e),Rd&&V({error:e,exit:t}),t);var ut={logoutFirst:(e="sign in")=>`This machine is already signed in as another account. Run \`acbridge logout\` first, then ${e}.`,pointerMismatch:"This machine's signed-in account doesn't match its stored account pointer \u2014 run `acbridge logout` then `acbridge login` to reset it.",unresolved:"Couldn't resolve this machine's signed-in account \u2014 run `acbridge login` again."};function Ot(e,t=j){return e.length<2?!1:(t(`found ${e.length} relay credentials on this machine (${e.map(n=>n.sub).join(", ")}) \u2014 a crash during an account switch can leave residue; run \`acbridge logout\` to clear it.`),!0)}function Ga(e,t=bt){return e.segment===t(e.sub)}function Gx(e){let t=e.layout??hn(),n=e.read??L,o=e.paths??$e(),r=n(o.accessFile)?.trim()||"",i=e.resolveScope??(()=>kt());if(t<vn)return r?{state:"ok",token:r,scope:i()}:{state:"signed-out"};let s=i();if(s)return r?{state:"ok",token:r,scope:s}:{state:"signed-out"};let a=(e.scan??xt)();return(e.warnAmbiguous??Ot)(a),!!(e.readPointer??(()=>Te()))()||a.length>0?{state:"mismatch",message:ut.pointerMismatch}:{state:"signed-out"}}function Dt(e){let t=Gx(e);return t.state==="ok"?{ok:!0,token:t.token,scope:t.scope}:t.state==="mismatch"?{ok:!1,message:t.message,exitCode:3}:{ok:!1,message:e.notSignedIn.message,exitCode:e.notSignedIn.exitCode}}function Jt(e={}){return Gx(e)}var c={};fn(c,{$brand:()=>Dd,$input:()=>tf,$output:()=>ef,NEVER:()=>Od,TimePrecision:()=>sf,ZodAny:()=>Jg,ZodArray:()=>Qg,ZodBase64:()=>vl,ZodBase64URL:()=>yl,ZodBigInt:()=>Jo,ZodBigIntFormat:()=>kl,ZodBoolean:()=>qo,ZodCIDRv4:()=>gl,ZodCIDRv6:()=>hl,ZodCUID:()=>cl,ZodCUID2:()=>ll,ZodCatch:()=>kh,ZodCodec:()=>xs,ZodCustom:()=>ks,ZodCustomStringFormat:()=>Zo,ZodDate:()=>gs,ZodDefault:()=>gh,ZodDiscriminatedUnion:()=>th,ZodE164:()=>bl,ZodEmail:()=>il,ZodEmoji:()=>sl,ZodEnum:()=>Go,ZodError:()=>GO,ZodExactOptional:()=>ph,ZodFile:()=>uh,ZodFirstPartyTypeKind:()=>Dh,ZodFunction:()=>Th,ZodGUID:()=>us,ZodIPv4:()=>ml,ZodIPv6:()=>fl,ZodISODate:()=>Qc,ZodISODateTime:()=>Yc,ZodISODuration:()=>tl,ZodISOTime:()=>el,ZodIntersection:()=>nh,ZodIssueCode:()=>ZO,ZodJWT:()=>xl,ZodKSUID:()=>pl,ZodLazy:()=>Ih,ZodLiteral:()=>lh,ZodMAC:()=>Bg,ZodMap:()=>ah,ZodNaN:()=>Sh,ZodNanoID:()=>al,ZodNever:()=>Xg,ZodNonOptional:()=>Al,ZodNull:()=>Vg,ZodNullable:()=>fh,ZodNumber:()=>Vo,ZodNumberFormat:()=>Dr,ZodObject:()=>vs,ZodOptional:()=>El,ZodPipe:()=>bs,ZodPrefault:()=>vh,ZodPreprocess:()=>_h,ZodPromise:()=>Ph,ZodReadonly:()=>$h,ZodRealError:()=>ot,ZodRecord:()=>Ho,ZodSet:()=>ch,ZodString:()=>Wo,ZodStringFormat:()=>ye,ZodSuccess:()=>xh,ZodSymbol:()=>Wg,ZodTemplateLiteral:()=>Ah,ZodTransform:()=>dh,ZodTuple:()=>oh,ZodType:()=>Y,ZodULID:()=>ul,ZodURL:()=>fs,ZodUUID:()=>Qt,ZodUndefined:()=>Zg,ZodUnion:()=>ys,ZodUnknown:()=>Kg,ZodVoid:()=>Yg,ZodXID:()=>dl,ZodXor:()=>eh,_ZodString:()=>ol,_default:()=>hh,_function:()=>R0,any:()=>l0,array:()=>hs,base64:()=>Zw,base64url:()=>Vw,bigint:()=>o0,boolean:()=>Gg,catch:()=>wh,check:()=>O0,cidrv4:()=>Gw,cidrv6:()=>Ww,clone:()=>Ge,codec:()=>I0,coerce:()=>Nh,config:()=>Ce,core:()=>Sn,cuid:()=>Lw,cuid2:()=>Uw,custom:()=>D0,date:()=>d0,decode:()=>Ng,decodeAsync:()=>Ug,describe:()=>N0,discriminatedUnion:()=>v0,e164:()=>qw,email:()=>Ew,emoji:()=>Dw,encode:()=>Dg,encodeAsync:()=>Lg,endsWith:()=>Oo,enum:()=>_l,exactOptional:()=>mh,file:()=>_0,flattenError:()=>Ki,float32:()=>e0,float64:()=>t0,formatError:()=>Xi,fromJSONSchema:()=>B0,function:()=>R0,getErrorMap:()=>qO,globalRegistry:()=>Le,gt:()=>Xt,gte:()=>Ze,guid:()=>Aw,hash:()=>Qw,hex:()=>Yw,hostname:()=>Xw,httpUrl:()=>Ow,includes:()=>To,instanceof:()=>U0,int:()=>nl,int32:()=>n0,int64:()=>i0,intersection:()=>rh,invertCodec:()=>C0,ipv4:()=>Mw,ipv6:()=>Hw,iso:()=>Bo,json:()=>z0,jwt:()=>Jw,keyof:()=>p0,ksuid:()=>Fw,lazy:()=>Ch,length:()=>Rr,literal:()=>S0,locales:()=>is,looseObject:()=>g0,looseRecord:()=>b0,lowercase:()=>Co,lt:()=>Kt,lte:()=>pt,mac:()=>Bw,map:()=>x0,maxLength:()=>Tr,maxSize:()=>or,meta:()=>L0,mime:()=>Do,minLength:()=>wn,minSize:()=>Yt,multipleOf:()=>rr,nan:()=>A0,nanoid:()=>Nw,nativeEnum:()=>w0,negative:()=>Bc,never:()=>wl,nonnegative:()=>Gc,nonoptional:()=>bh,nonpositive:()=>Hc,normalize:()=>No,null:()=>qg,nullable:()=>ps,nullish:()=>$0,number:()=>Hg,object:()=>m0,optional:()=>ds,overwrite:()=>Lt,parse:()=>Pg,parseAsync:()=>Tg,partialRecord:()=>y0,pipe:()=>rl,positive:()=>Mc,prefault:()=>yh,preprocess:()=>F0,prettifyError:()=>Vd,promise:()=>T0,property:()=>Wc,readonly:()=>Eh,record:()=>sh,refine:()=>Rh,regex:()=>Io,regexes:()=>dt,registry:()=>xc,safeDecode:()=>zg,safeDecodeAsync:()=>Mg,safeEncode:()=>jg,safeEncodeAsync:()=>Fg,safeParse:()=>Rg,safeParseAsync:()=>Og,set:()=>k0,setErrorMap:()=>VO,size:()=>Pr,slugify:()=>zo,startsWith:()=>Ro,strictObject:()=>f0,string:()=>ls,stringFormat:()=>Kw,stringbool:()=>j0,success:()=>E0,superRefine:()=>Oh,symbol:()=>a0,templateLiteral:()=>P0,toJSONSchema:()=>Jc,toLowerCase:()=>Uo,toUpperCase:()=>jo,transform:()=>$l,treeifyError:()=>Zd,trim:()=>Lo,tuple:()=>ih,uint32:()=>r0,uint64:()=>s0,ulid:()=>jw,undefined:()=>c0,union:()=>Sl,unknown:()=>Or,uppercase:()=>Po,url:()=>Rw,util:()=>T,uuid:()=>Iw,uuidv4:()=>Cw,uuidv6:()=>Pw,uuidv7:()=>Tw,void:()=>u0,xid:()=>zw,xor:()=>h0});var Sn={};fn(Sn,{$ZodAny:()=>wm,$ZodArray:()=>Am,$ZodAsyncError:()=>Nt,$ZodBase64:()=>pm,$ZodBase64URL:()=>mm,$ZodBigInt:()=>pc,$ZodBigIntFormat:()=>ym,$ZodBoolean:()=>ts,$ZodCIDRv4:()=>lm,$ZodCIDRv6:()=>um,$ZodCUID:()=>Xp,$ZodCUID2:()=>Yp,$ZodCatch:()=>Wm,$ZodCheck:()=>be,$ZodCheckBigIntFormat:()=>Ap,$ZodCheckEndsWith:()=>zp,$ZodCheckGreaterThan:()=>sc,$ZodCheckIncludes:()=>Up,$ZodCheckLengthEquals:()=>Op,$ZodCheckLessThan:()=>ic,$ZodCheckLowerCase:()=>Np,$ZodCheckMaxLength:()=>Tp,$ZodCheckMaxSize:()=>Ip,$ZodCheckMimeType:()=>Mp,$ZodCheckMinLength:()=>Rp,$ZodCheckMinSize:()=>Cp,$ZodCheckMultipleOf:()=>$p,$ZodCheckNumberFormat:()=>Ep,$ZodCheckOverwrite:()=>Bp,$ZodCheckProperty:()=>Fp,$ZodCheckRegex:()=>Dp,$ZodCheckSizeEquals:()=>Pp,$ZodCheckStartsWith:()=>jp,$ZodCheckStringFormat:()=>Eo,$ZodCheckUpperCase:()=>Lp,$ZodCodec:()=>rs,$ZodCustom:()=>Qm,$ZodCustomStringFormat:()=>hm,$ZodDate:()=>Em,$ZodDefault:()=>Mm,$ZodDiscriminatedUnion:()=>Pm,$ZodE164:()=>fm,$ZodEmail:()=>Vp,$ZodEmoji:()=>Jp,$ZodEncodeError:()=>Yn,$ZodEnum:()=>Nm,$ZodError:()=>Ji,$ZodExactOptional:()=>zm,$ZodFile:()=>Um,$ZodFunction:()=>Km,$ZodGUID:()=>Wp,$ZodIPv4:()=>sm,$ZodIPv6:()=>am,$ZodISODate:()=>rm,$ZodISODateTime:()=>nm,$ZodISODuration:()=>im,$ZodISOTime:()=>om,$ZodIntersection:()=>Tm,$ZodJWT:()=>gm,$ZodKSUID:()=>tm,$ZodLazy:()=>Ym,$ZodLiteral:()=>Lm,$ZodMAC:()=>cm,$ZodMap:()=>Om,$ZodNaN:()=>Zm,$ZodNanoID:()=>Kp,$ZodNever:()=>_m,$ZodNonOptional:()=>Hm,$ZodNull:()=>km,$ZodNullable:()=>Fm,$ZodNumber:()=>dc,$ZodNumberFormat:()=>vm,$ZodObject:()=>kk,$ZodObjectJIT:()=>Im,$ZodOptional:()=>fc,$ZodPipe:()=>gc,$ZodPrefault:()=>Bm,$ZodPreprocess:()=>Vm,$ZodPromise:()=>Xm,$ZodReadonly:()=>qm,$ZodRealError:()=>rt,$ZodRecord:()=>Rm,$ZodRegistry:()=>bc,$ZodSet:()=>Dm,$ZodString:()=>Cr,$ZodStringFormat:()=>ve,$ZodSuccess:()=>Gm,$ZodSymbol:()=>bm,$ZodTemplateLiteral:()=>Jm,$ZodTransform:()=>jm,$ZodTuple:()=>mc,$ZodType:()=>J,$ZodULID:()=>Qp,$ZodURL:()=>qp,$ZodUUID:()=>Zp,$ZodUndefined:()=>xm,$ZodUnion:()=>ns,$ZodUnknown:()=>Sm,$ZodVoid:()=>$m,$ZodXID:()=>em,$ZodXor:()=>Cm,$brand:()=>Dd,$constructor:()=>b,$input:()=>tf,$output:()=>ef,Doc:()=>es,JSONSchema:()=>Sw,JSONSchemaGenerator:()=>Kc,NEVER:()=>Od,TimePrecision:()=>sf,_any:()=>Af,_array:()=>Df,_base64:()=>Uc,_base64url:()=>jc,_bigint:()=>xf,_boolean:()=>yf,_catch:()=>LO,_check:()=>ww,_cidrv4:()=>Nc,_cidrv6:()=>Lc,_coercedBigint:()=>kf,_coercedBoolean:()=>bf,_coercedDate:()=>Rf,_coercedNumber:()=>pf,_coercedString:()=>rf,_cuid:()=>Ic,_cuid2:()=>Cc,_custom:()=>Lf,_date:()=>Tf,_decode:()=>Ka,_decodeAsync:()=>Ya,_default:()=>OO,_discriminatedUnion:()=>kO,_e164:()=>zc,_email:()=>kc,_emoji:()=>Ec,_encode:()=>Ja,_encodeAsync:()=>Xa,_endsWith:()=>Oo,_enum:()=>AO,_file:()=>Nf,_float32:()=>ff,_float64:()=>gf,_gt:()=>Xt,_gte:()=>Ze,_guid:()=>ss,_includes:()=>To,_int:()=>mf,_int32:()=>hf,_int64:()=>wf,_intersection:()=>wO,_ipv4:()=>Oc,_ipv6:()=>Dc,_isoDate:()=>cf,_isoDateTime:()=>af,_isoDuration:()=>uf,_isoTime:()=>lf,_jwt:()=>Fc,_ksuid:()=>Rc,_lazy:()=>FO,_length:()=>Rr,_literal:()=>CO,_lowercase:()=>Co,_lt:()=>Kt,_lte:()=>pt,_mac:()=>of,_map:()=>$O,_max:()=>pt,_maxLength:()=>Tr,_maxSize:()=>or,_mime:()=>Do,_min:()=>Ze,_minLength:()=>wn,_minSize:()=>Yt,_multipleOf:()=>rr,_nan:()=>Of,_nanoid:()=>Ac,_nativeEnum:()=>IO,_negative:()=>Bc,_never:()=>Cf,_nonnegative:()=>Gc,_nonoptional:()=>DO,_nonpositive:()=>Hc,_normalize:()=>No,_null:()=>Ef,_nullable:()=>RO,_number:()=>df,_optional:()=>TO,_overwrite:()=>Lt,_parse:()=>wo,_parseAsync:()=>So,_pipe:()=>UO,_positive:()=>Mc,_promise:()=>MO,_property:()=>Wc,_readonly:()=>jO,_record:()=>_O,_refine:()=>Uf,_regex:()=>Io,_safeDecode:()=>ec,_safeDecodeAsync:()=>nc,_safeEncode:()=>Qa,_safeEncodeAsync:()=>tc,_safeParse:()=>_o,_safeParseAsync:()=>$o,_set:()=>EO,_size:()=>Pr,_slugify:()=>zo,_startsWith:()=>Ro,_string:()=>nf,_stringFormat:()=>Fo,_stringbool:()=>Mf,_success:()=>NO,_superRefine:()=>jf,_symbol:()=>_f,_templateLiteral:()=>zO,_toLowerCase:()=>Uo,_toUpperCase:()=>jo,_transform:()=>PO,_trim:()=>Lo,_tuple:()=>SO,_uint32:()=>vf,_uint64:()=>Sf,_ulid:()=>Pc,_undefined:()=>$f,_union:()=>bO,_unknown:()=>If,_uppercase:()=>Po,_url:()=>as,_uuid:()=>wc,_uuidv4:()=>Sc,_uuidv6:()=>_c,_uuidv7:()=>$c,_void:()=>Pf,_xid:()=>Tc,_xor:()=>xO,clone:()=>Ge,config:()=>Ce,createStandardJSONSchemaMethod:()=>Mo,createToJSONSchemaMethod:()=>Bf,decode:()=>MR,decodeAsync:()=>HR,describe:()=>zf,encode:()=>FR,encodeAsync:()=>BR,extractDefs:()=>sr,finalize:()=>ar,flattenError:()=>Ki,formatError:()=>Xi,globalConfig:()=>Er,globalRegistry:()=>Le,initializeContext:()=>ir,isValidBase64:()=>dm,isValidBase64URL:()=>vk,isValidJWT:()=>yk,locales:()=>is,meta:()=>Ff,parse:()=>Va,parseAsync:()=>qa,prettifyError:()=>Vd,process:()=>ge,regexes:()=>dt,registry:()=>xc,safeDecode:()=>WR,safeDecodeAsync:()=>VR,safeEncode:()=>GR,safeEncodeAsync:()=>ZR,safeParse:()=>qd,safeParseAsync:()=>Jd,toDotPath:()=>Kx,toJSONSchema:()=>Jc,treeifyError:()=>Zd,util:()=>T,version:()=>Hp});var Wx,Od=Object.freeze({status:"aborted"});function b(e,t,n){function o(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);let u=s.prototype,d=Object.keys(u);for(let p=0;p<d.length;p++){let m=d[p];m in a||(a[m]=u[m].bind(a))}}let r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:e});function s(a){var l;let u=n?.Parent?new i:this;o(u,a),(l=u._zod).deferred??(l.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var Dd=Symbol("zod_brand"),Nt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Yn=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Wx=globalThis).__zod_globalConfig??(Wx.__zod_globalConfig={});var Er=globalThis.__zod_globalConfig;function Ce(e){return e&&Object.assign(Er,e),Er}var T={};fn(T,{BIGINT_FORMAT_RANGES:()=>Gd,Class:()=>Ld,NUMBER_FORMAT_RANGES:()=>Hd,aborted:()=>nr,allowsEval:()=>zd,assert:()=>yR,assertEqual:()=>fR,assertIs:()=>hR,assertNever:()=>vR,assertNotEqual:()=>gR,assignProp:()=>er,base64ToUint8Array:()=>Vx,base64urlToUint8Array:()=>NR,cached:()=>xo,captureStackTrace:()=>Za,cleanEnum:()=>DR,cleanRegex:()=>Wi,clone:()=>Ge,cloneDef:()=>xR,createTransparentProxy:()=>ER,defineLazy:()=>ne,esc:()=>Wa,escapeRegex:()=>St,explicitlyAborted:()=>Wd,extend:()=>CR,finalizeIssue:()=>We,floatSafeRemainder:()=>Ud,getElementAtPath:()=>kR,getEnumValues:()=>Gi,getLengthableOrigin:()=>qi,getParsedType:()=>$R,getSizableOrigin:()=>Vi,hexToUint8Array:()=>UR,isObject:()=>Ar,isPlainObject:()=>tr,issue:()=>ko,joinValues:()=>w,jsonStringifyReplacer:()=>bo,merge:()=>TR,mergeDefs:()=>kn,normalizeParams:()=>O,nullish:()=>Qn,numKeys:()=>_R,objectClone:()=>bR,omit:()=>IR,optionalKeys:()=>Bd,parsedType:()=>P,partial:()=>RR,pick:()=>AR,prefixIssues:()=>nt,primitiveTypes:()=>Md,promiseAllObject:()=>wR,propertyKeyTypes:()=>Zi,randomString:()=>SR,required:()=>OR,safeExtend:()=>PR,shallowClone:()=>Fd,slugify:()=>jd,stringifyPrimitive:()=>C,uint8ArrayToBase64:()=>qx,uint8ArrayToBase64url:()=>LR,uint8ArrayToHex:()=>jR,unwrapMessage:()=>Hi});function fR(e){return e}function gR(e){return e}function hR(e){}function vR(e){throw new Error("Unexpected value in exhaustive check")}function yR(e){}function Gi(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function w(e,t="|"){return e.map(n=>C(n)).join(t)}function bo(e,t){return typeof t=="bigint"?t.toString():t}function xo(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function Qn(e){return e==null}function Wi(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ud(e,t){let n=e/t,o=Math.round(n),r=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-o)<r?0:n-o}var Zx=Symbol("evaluating");function ne(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==Zx)return o===void 0&&(o=Zx,o=n()),o},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function bR(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function er(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function kn(...e){let t={};for(let n of e){let o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function xR(e){return kn(e._zod.def)}function kR(e,t){return t?t.reduce((n,o)=>n?.[o],e):e}function wR(e){let t=Object.keys(e),n=t.map(o=>e[o]);return Promise.all(n).then(o=>{let r={};for(let i=0;i<t.length;i++)r[t[i]]=o[i];return r})}function SR(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let o=0;o<e;o++)n+=t[Math.floor(Math.random()*t.length)];return n}function Wa(e){return JSON.stringify(e)}function jd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Za="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ar(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var zd=xo(()=>{if(Er.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function tr(e){if(Ar(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Ar(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Fd(e){return tr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function _R(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var $R=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Zi=new Set(["string","number","symbol"]),Md=new Set(["string","number","bigint","boolean","symbol","undefined"]);function St(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ge(e,t,n){let o=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(o._zod.parent=e),o}function O(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ER(e){let t;return new Proxy({},{get(n,o,r){return t??(t=e()),Reflect.get(t,o,r)},set(n,o,r,i){return t??(t=e()),Reflect.set(t,o,r,i)},has(n,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(n,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(n,o,r){return t??(t=e()),Reflect.defineProperty(t,o,r)}})}function C(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Bd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Hd={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Gd={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function AR(e,t){let n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=kn(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return er(this,"shape",s),s},checks:[]});return Ge(e,i)}function IR(e,t){let n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=kn(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return er(this,"shape",s),s},checks:[]});return Ge(e,i)}function CR(e,t){if(!tr(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=kn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return er(this,"shape",i),i}});return Ge(e,r)}function PR(e,t){if(!tr(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=kn(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return er(this,"shape",o),o}});return Ge(e,n)}function TR(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=kn(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return er(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ge(e,n)}function RR(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=kn(t._zod.def,{get shape(){let a=t._zod.def.shape,l={...a};if(n)for(let u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(l[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)l[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return er(this,"shape",l),l},checks:[]});return Ge(t,s)}function OR(e,t,n){let o=kn(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(let s in r)i[s]=new e({type:"nonoptional",innerType:r[s]});return er(this,"shape",i),i}});return Ge(t,o)}function nr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Wd(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function nt(e,t){return t.map(n=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function Hi(e){return typeof e=="string"?e:e?.message}function We(e,t,n){let o=e.message?e.message:Hi(e.inst?._zod.def?.error?.(e))??Hi(t?.error?.(e))??Hi(n.customError?.(e))??Hi(n.localeError?.(e))??"Invalid input",{inst:r,continue:i,input:s,...a}=e;return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=s),a}function Vi(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function qi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function P(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function ko(...e){let[t,n,o]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:o}:{...t}}function DR(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Vx(e){let t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}function qx(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function NR(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return Vx(t+n)}function LR(e){return qx(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function UR(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)n[o/2]=Number.parseInt(t.slice(o,o+2),16);return n}function jR(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ld=class{constructor(...t){}};var Jx=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,bo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ji=b("$ZodError",Jx),rt=b("$ZodError",Jx,{Parent:Error});function Ki(e,t=n=>n.message){let n={},o=[];for(let r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):o.push(t(r));return{formErrors:o,fieldErrors:n}}function Xi(e,t=n=>n.message){let n={_errors:[]},o=(r,i=[])=>{for(let s of r.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let l=n,u=0;for(;u<a.length;){let d=a[u];u===a.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(t(s))):l[d]=l[d]||{_errors:[]},l=l[d],u++}}}};return o(e),n}function Zd(e,t=n=>n.message){let n={errors:[]},o=(r,i=[])=>{var s,a;for(let l of r.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>o({issues:u},[...i,...l.path]));else if(l.code==="invalid_key")o({issues:l.issues},[...i,...l.path]);else if(l.code==="invalid_element")o({issues:l.issues},[...i,...l.path]);else{let u=[...i,...l.path];if(u.length===0){n.errors.push(t(l));continue}let d=n,p=0;for(;p<u.length;){let m=u[p],f=p===u.length-1;typeof m=="string"?(d.properties??(d.properties={}),(s=d.properties)[m]??(s[m]={errors:[]}),d=d.properties[m]):(d.items??(d.items=[]),(a=d.items)[m]??(a[m]={errors:[]}),d=d.items[m]),f&&d.errors.push(t(l)),p++}}};return o(e),n}function Kx(e){let t=[],n=e.map(o=>typeof o=="object"?o.key:o);for(let o of n)typeof o=="number"?t.push(`[${o}]`):typeof o=="symbol"?t.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?t.push(`[${JSON.stringify(o)}]`):(t.length&&t.push("."),t.push(o));return t.join("")}function Vd(e){let t=[],n=[...e.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)t.push(`\u2716 ${o.message}`),o.path?.length&&t.push(` \u2192 at ${Kx(o.path)}`);return t.join(`
|
|
182
|
+
`)}var wo=e=>(t,n,o,r)=>{let i=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Nt;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map(l=>We(l,i,Ce())));throw Za(a,r?.callee),a}return s.value},Va=wo(rt),So=e=>async(t,n,o,r)=>{let i=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(r?.Err??e)(s.issues.map(l=>We(l,i,Ce())));throw Za(a,r?.callee),a}return s.value},qa=So(rt),_o=e=>(t,n,o)=>{let r=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new Nt;return i.issues.length?{success:!1,error:new(e??Ji)(i.issues.map(s=>We(s,r,Ce())))}:{success:!0,data:i.value}},qd=_o(rt),$o=e=>async(t,n,o)=>{let r=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>We(s,r,Ce())))}:{success:!0,data:i.value}},Jd=$o(rt),Ja=e=>(t,n,o)=>{let r=o?{...o,direction:"backward"}:{direction:"backward"};return wo(e)(t,n,r)},FR=Ja(rt),Ka=e=>(t,n,o)=>wo(e)(t,n,o),MR=Ka(rt),Xa=e=>async(t,n,o)=>{let r=o?{...o,direction:"backward"}:{direction:"backward"};return So(e)(t,n,r)},BR=Xa(rt),Ya=e=>async(t,n,o)=>So(e)(t,n,o),HR=Ya(rt),Qa=e=>(t,n,o)=>{let r=o?{...o,direction:"backward"}:{direction:"backward"};return _o(e)(t,n,r)},GR=Qa(rt),ec=e=>(t,n,o)=>_o(e)(t,n,o),WR=ec(rt),tc=e=>async(t,n,o)=>{let r=o?{...o,direction:"backward"}:{direction:"backward"};return $o(e)(t,n,r)},ZR=tc(rt),nc=e=>async(t,n,o)=>$o(e)(t,n,o),VR=nc(rt);var dt={};fn(dt,{base64:()=>dp,base64url:()=>rc,bigint:()=>yp,boolean:()=>xp,browserEmail:()=>t1,cidrv4:()=>lp,cidrv6:()=>up,cuid:()=>Kd,cuid2:()=>Xd,date:()=>fp,datetime:()=>hp,domain:()=>o1,duration:()=>np,e164:()=>mp,email:()=>op,emoji:()=>ip,extendedDuration:()=>qR,guid:()=>rp,hex:()=>i1,hostname:()=>r1,html5Email:()=>YR,httpProtocol:()=>pp,idnEmail:()=>e1,integer:()=>bp,ipv4:()=>sp,ipv6:()=>ap,ksuid:()=>ep,lowercase:()=>Sp,mac:()=>cp,md5_base64:()=>a1,md5_base64url:()=>c1,md5_hex:()=>s1,nanoid:()=>tp,null:()=>kp,number:()=>oc,rfc5322Email:()=>QR,sha1_base64:()=>u1,sha1_base64url:()=>d1,sha1_hex:()=>l1,sha256_base64:()=>m1,sha256_base64url:()=>f1,sha256_hex:()=>p1,sha384_base64:()=>h1,sha384_base64url:()=>v1,sha384_hex:()=>g1,sha512_base64:()=>b1,sha512_base64url:()=>x1,sha512_hex:()=>y1,string:()=>vp,time:()=>gp,ulid:()=>Yd,undefined:()=>wp,unicodeEmail:()=>Xx,uppercase:()=>_p,uuid:()=>Ir,uuid4:()=>JR,uuid6:()=>KR,uuid7:()=>XR,xid:()=>Qd});var Kd=/^[cC][0-9a-z]{6,}$/,Xd=/^[0-9a-z]+$/,Yd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Qd=/^[0-9a-vA-V]{20}$/,ep=/^[A-Za-z0-9]{27}$/,tp=/^[a-zA-Z0-9_-]{21}$/,np=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qR=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,rp=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ir=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,JR=Ir(4),KR=Ir(6),XR=Ir(7),op=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,YR=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,QR=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Xx=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,e1=Xx,t1=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,n1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ip(){return new RegExp(n1,"u")}var sp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ap=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,cp=e=>{let t=St(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},lp=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,up=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rc=/^[A-Za-z0-9_-]*$/,r1=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,o1=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,pp=/^https?$/,mp=/^\+[1-9]\d{6,14}$/,Yx="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",fp=new RegExp(`^${Yx}$`);function Qx(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gp(e){return new RegExp(`^${Qx(e)}$`)}function hp(e){let t=Qx({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${n.join("|")})`;return new RegExp(`^${Yx}T(?:${o})$`)}var vp=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},yp=/^-?\d+n?$/,bp=/^-?\d+$/,oc=/^-?\d+(?:\.\d+)?$/,xp=/^(?:true|false)$/i,kp=/^null$/i;var wp=/^undefined$/i;var Sp=/^[^A-Z]*$/,_p=/^[^a-z]*$/,i1=/^[0-9a-fA-F]*$/;function Yi(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Qi(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var s1=/^[0-9a-fA-F]{32}$/,a1=Yi(22,"=="),c1=Qi(22),l1=/^[0-9a-fA-F]{40}$/,u1=Yi(27,"="),d1=Qi(27),p1=/^[0-9a-fA-F]{64}$/,m1=Yi(43,"="),f1=Qi(43),g1=/^[0-9a-fA-F]{96}$/,h1=Yi(64,""),v1=Qi(64),y1=/^[0-9a-fA-F]{128}$/,b1=Yi(86,"=="),x1=Qi(86);var be=b("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),tk={number:"number",bigint:"bigint",object:"date"},ic=b("$ZodCheckLessThan",(e,t)=>{be.init(e,t);let n=tk[typeof t.value];e._zod.onattach.push(o=>{let r=o._zod.bag,i=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sc=b("$ZodCheckGreaterThan",(e,t)=>{be.init(e,t);let n=tk[typeof t.value];e._zod.onattach.push(o=>{let r=o._zod.bag,i=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$p=b("$ZodCheckMultipleOf",(e,t)=>{be.init(e,t),e._zod.onattach.push(n=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Ud(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ep=b("$ZodCheckNumberFormat",(e,t)=>{be.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),o=n?"int":"number",[r,i]=Hd[t.format];e._zod.onattach.push(s=>{let a=s._zod.bag;a.format=t.format,a.minimum=r,a.maximum=i,n&&(a.pattern=bp)}),e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<r&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Ap=b("$ZodCheckBigIntFormat",(e,t)=>{be.init(e,t);let[n,o]=Gd[t.format];e._zod.onattach.push(r=>{let i=r._zod.bag;i.format=t.format,i.minimum=n,i.maximum=o}),e._zod.check=r=>{let i=r.value;i<n&&r.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>o&&r.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Ip=b("$ZodCheckMaxSize",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!Qn(r)&&r.size!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let r=o.value;r.size<=t.maximum||o.issues.push({origin:Vi(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cp=b("$ZodCheckMinSize",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!Qn(r)&&r.size!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let r=o.value;r.size>=t.minimum||o.issues.push({origin:Vi(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Pp=b("$ZodCheckSizeEquals",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!Qn(r)&&r.size!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=o=>{let r=o.value,i=r.size;if(i===t.size)return;let s=i>t.size;o.issues.push({origin:Vi(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Tp=b("$ZodCheckMaxLength",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!Qn(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let r=o.value;if(r.length<=t.maximum)return;let s=qi(r);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Rp=b("$ZodCheckMinLength",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!Qn(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let r=o.value;if(r.length>=t.minimum)return;let s=qi(r);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Op=b("$ZodCheckLengthEquals",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!Qn(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=o=>{let r=o.value,i=r.length;if(i===t.length)return;let s=qi(r),a=i>t.length;o.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Eo=b("$ZodCheckStringFormat",(e,t)=>{var n,o;be.init(e,t),e._zod.onattach.push(r=>{let i=r._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Dp=b("$ZodCheckRegex",(e,t)=>{Eo.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Np=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Sp),Eo.init(e,t)}),Lp=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=_p),Eo.init(e,t)}),Up=b("$ZodCheckIncludes",(e,t)=>{be.init(e,t);let n=St(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push(r=>{let i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),jp=b("$ZodCheckStartsWith",(e,t)=>{be.init(e,t);let n=new RegExp(`^${St(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),zp=b("$ZodCheckEndsWith",(e,t)=>{be.init(e,t);let n=new RegExp(`.*${St(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function ek(e,t,n){e.issues.length&&t.issues.push(...nt(n,e.issues))}var Fp=b("$ZodCheckProperty",(e,t)=>{be.init(e,t),e._zod.check=n=>{let o=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then(r=>ek(r,n,t.property));ek(o,n,t.property)}}),Mp=b("$ZodCheckMimeType",(e,t)=>{be.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(o=>{o._zod.bag.mime=t.mime}),e._zod.check=o=>{n.has(o.value.type)||o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),Bp=b("$ZodCheckOverwrite",(e,t)=>{be.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var es=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
|
|
183
|
+
`).filter(s=>s),r=Math.min(...o.map(s=>s.length-s.trimStart().length)),i=o.map(s=>s.slice(r)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,n=this?.args,r=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,r.join(`
|
|
184
|
+
`))}};var Hp={major:4,minor:4,patch:3};var J=b("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Hp;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let r of o)for(let i of r._zod.onattach)i(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(s,a,l)=>{let u=nr(s),d;for(let p of a){if(p._zod.def.when){if(Wd(s)||!p._zod.def.when(s))continue}else if(u)continue;let m=s.issues.length,f=p._zod.check(s);if(f instanceof Promise&&l?.async===!1)throw new Nt;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,s.issues.length!==m&&(u||(u=nr(s,m)))});else{if(s.issues.length===m)continue;u||(u=nr(s,m))}}return d?d.then(()=>s):s},i=(s,a,l)=>{if(nr(s))return s.aborted=!0,s;let u=r(a,o,l);if(u instanceof Promise){if(l.async===!1)throw new Nt;return u.then(d=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let u=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>i(d,s,a)):i(u,s,a)}let l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Nt;return l.then(u=>r(u,o,a))}return r(l,o,a)}}ne(e,"~standard",()=>({validate:r=>{try{let i=qd(e,r);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Jd(e,r).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Cr=b("$ZodString",(e,t)=>{J.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??vp(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ve=b("$ZodStringFormat",(e,t)=>{Eo.init(e,t),Cr.init(e,t)}),Wp=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=rp),ve.init(e,t)}),Zp=b("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ir(o))}else t.pattern??(t.pattern=Ir());ve.init(e,t)}),Vp=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=op),ve.init(e,t)}),qp=b("$ZodURL",(e,t)=>{ve.init(e,t),e._zod.check=n=>{try{let o=n.value.trim();if(!t.normalize&&t.protocol?.source===pp.source&&!/^https?:\/\//i.test(o)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}let r=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=r.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Jp=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ip()),ve.init(e,t)}),Kp=b("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=tp),ve.init(e,t)}),Xp=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Kd),ve.init(e,t)}),Yp=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Xd),ve.init(e,t)}),Qp=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Yd),ve.init(e,t)}),em=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Qd),ve.init(e,t)}),tm=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ep),ve.init(e,t)}),nm=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=hp(t)),ve.init(e,t)}),rm=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=fp),ve.init(e,t)}),om=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=gp(t)),ve.init(e,t)}),im=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=np),ve.init(e,t)}),sm=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=sp),ve.init(e,t),e._zod.bag.format="ipv4"}),am=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ap),ve.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),cm=b("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=cp(t.delimiter)),ve.init(e,t),e._zod.bag.format="mac"}),lm=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=lp),ve.init(e,t)}),um=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=up),ve.init(e,t),e._zod.check=n=>{let o=n.value.split("/");try{if(o.length!==2)throw new Error;let[r,i]=o;if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function dm(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var pm=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=dp),ve.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{dm(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function vk(e){if(!rc.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return dm(n)}var mm=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=rc),ve.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{vk(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),fm=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=mp),ve.init(e,t)});function yk(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[o]=n;if(!o)return!1;let r=JSON.parse(atob(o));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}var gm=b("$ZodJWT",(e,t)=>{ve.init(e,t),e._zod.check=n=>{yk(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),hm=b("$ZodCustomStringFormat",(e,t)=>{ve.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),dc=b("$ZodNumber",(e,t)=>{J.init(e,t),e._zod.pattern=e._zod.bag.pattern??oc,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let i=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),n}}),vm=b("$ZodNumberFormat",(e,t)=>{Ep.init(e,t),dc.init(e,t)}),ts=b("$ZodBoolean",(e,t)=>{J.init(e,t),e._zod.pattern=xp,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=!!n.value}catch{}let r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),pc=b("$ZodBigInt",(e,t)=>{J.init(e,t),e._zod.pattern=yp,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),ym=b("$ZodBigIntFormat",(e,t)=>{Ap.init(e,t),pc.init(e,t)}),bm=b("$ZodSymbol",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),xm=b("$ZodUndefined",(e,t)=>{J.init(e,t),e._zod.pattern=wp,e._zod.values=new Set([void 0]),e._zod.parse=(n,o)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),km=b("$ZodNull",(e,t)=>{J.init(e,t),e._zod.pattern=kp,e._zod.values=new Set([null]),e._zod.parse=(n,o)=>{let r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),wm=b("$ZodAny",(e,t)=>{J.init(e,t),e._zod.parse=n=>n}),Sm=b("$ZodUnknown",(e,t)=>{J.init(e,t),e._zod.parse=n=>n}),_m=b("$ZodNever",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),$m=b("$ZodVoid",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),Em=b("$ZodDate",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let r=n.value,i=r instanceof Date;return i&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...i?{received:"Invalid Date"}:{},inst:e}),n}});function rk(e,t,n){e.issues.length&&t.issues.push(...nt(n,e.issues)),t.value[n]=e.value}var Am=b("$ZodArray",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let i=[];for(let s=0;s<r.length;s++){let a=r[s],l=t.element._zod.run({value:a,issues:[]},o);l instanceof Promise?i.push(l.then(u=>rk(u,n,s))):rk(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function uc(e,t,n,o,r,i){let s=n in o;if(e.issues.length){if(r&&i&&!s)return;t.issues.push(...nt(n,e.issues))}if(!s&&!r){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?s&&(t.value[n]=void 0):t.value[n]=e.value}function bk(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let n=Bd(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function xk(e,t,n,o,r,i){let s=[],a=r.keySet,l=r.catchall._zod,u=l.def.type,d=l.optin==="optional",p=l.optout==="optional";for(let m in t){if(m==="__proto__"||a.has(m))continue;if(u==="never"){s.push(m);continue}let f=l.run({value:t[m],issues:[]},o);f instanceof Promise?e.push(f.then(g=>uc(g,n,m,t,d,p))):uc(f,n,m,t,d,p)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}var kk=b("$ZodObject",(e,t)=>{if(J.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...a};return Object.defineProperty(t,"shape",{value:l}),l}})}let o=xo(()=>bk(t));ne(e._zod,"propValues",()=>{let a=t.shape,l={};for(let u in a){let d=a[u]._zod;if(d.values){l[u]??(l[u]=new Set);for(let p of d.values)l[u].add(p)}}return l});let r=Ar,i=t.catchall,s;e._zod.parse=(a,l)=>{s??(s=o.value);let u=a.value;if(!r(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let d=[],p=s.shape;for(let m of s.keys){let f=p[m],g=f._zod.optin==="optional",h=f._zod.optout==="optional",y=f._zod.run({value:u[m],issues:[]},l);y instanceof Promise?d.push(y.then(x=>uc(x,a,m,u,g,h))):uc(y,a,m,u,g,h)}return i?xk(d,u,a,l,o.value,e):d.length?Promise.all(d).then(()=>a):a}}),Im=b("$ZodObjectJIT",(e,t)=>{kk.init(e,t);let n=e._zod.parse,o=xo(()=>bk(t)),r=m=>{let f=new es(["shape","payload","ctx"]),g=o.value,h=E=>{let _=Wa(E);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),x=0;for(let E of g.keys)y[E]=`key_${x++}`;f.write("const newResult = {};");for(let E of g.keys){let _=y[E],I=Wa(E),N=m[E],M=N?._zod?.optin==="optional",q=N?._zod?.optout==="optional";f.write(`const ${_} = ${h(E)};`),M&&q?f.write(`
|
|
185
|
+
if (${_}.issues.length) {
|
|
186
|
+
if (${I} in input) {
|
|
187
|
+
payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
|
180
188
|
...iss,
|
|
181
|
-
path: iss.path ? [${
|
|
189
|
+
path: iss.path ? [${I}, ...iss.path] : [${I}]
|
|
182
190
|
})));
|
|
183
191
|
}
|
|
184
192
|
}
|
|
185
193
|
|
|
186
|
-
if (${
|
|
187
|
-
if (${
|
|
188
|
-
newResult[${
|
|
194
|
+
if (${_}.value === undefined) {
|
|
195
|
+
if (${I} in input) {
|
|
196
|
+
newResult[${I}] = undefined;
|
|
189
197
|
}
|
|
190
198
|
} else {
|
|
191
|
-
newResult[${
|
|
199
|
+
newResult[${I}] = ${_}.value;
|
|
192
200
|
}
|
|
193
201
|
|
|
194
|
-
`):
|
|
195
|
-
if (${
|
|
196
|
-
payload.issues = payload.issues.concat(${
|
|
202
|
+
`):M?f.write(`
|
|
203
|
+
if (${_}.issues.length) {
|
|
204
|
+
payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
|
197
205
|
...iss,
|
|
198
|
-
path: iss.path ? [${
|
|
206
|
+
path: iss.path ? [${I}, ...iss.path] : [${I}]
|
|
199
207
|
})));
|
|
200
208
|
}
|
|
201
209
|
|
|
202
|
-
if (${
|
|
203
|
-
if (${
|
|
204
|
-
newResult[${
|
|
210
|
+
if (${_}.value === undefined) {
|
|
211
|
+
if (${I} in input) {
|
|
212
|
+
newResult[${I}] = undefined;
|
|
205
213
|
}
|
|
206
214
|
} else {
|
|
207
|
-
newResult[${
|
|
215
|
+
newResult[${I}] = ${_}.value;
|
|
208
216
|
}
|
|
209
217
|
|
|
210
218
|
`):f.write(`
|
|
211
|
-
const ${
|
|
212
|
-
if (${
|
|
213
|
-
payload.issues = payload.issues.concat(${
|
|
219
|
+
const ${_}_present = ${I} in input;
|
|
220
|
+
if (${_}.issues.length) {
|
|
221
|
+
payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
|
214
222
|
...iss,
|
|
215
|
-
path: iss.path ? [${
|
|
223
|
+
path: iss.path ? [${I}, ...iss.path] : [${I}]
|
|
216
224
|
})));
|
|
217
225
|
}
|
|
218
|
-
if (!${
|
|
226
|
+
if (!${_}_present && !${_}.issues.length) {
|
|
219
227
|
payload.issues.push({
|
|
220
228
|
code: "invalid_type",
|
|
221
229
|
expected: "nonoptional",
|
|
222
230
|
input: undefined,
|
|
223
|
-
path: [${
|
|
231
|
+
path: [${I}]
|
|
224
232
|
});
|
|
225
233
|
}
|
|
226
234
|
|
|
227
|
-
if (${
|
|
228
|
-
if (${
|
|
229
|
-
newResult[${
|
|
235
|
+
if (${_}_present) {
|
|
236
|
+
if (${_}.value === undefined) {
|
|
237
|
+
newResult[${I}] = undefined;
|
|
230
238
|
} else {
|
|
231
|
-
newResult[${
|
|
239
|
+
newResult[${I}] = ${_}.value;
|
|
232
240
|
}
|
|
233
241
|
}
|
|
234
242
|
|
|
235
|
-
`)}f.write("payload.value = newResult;"),f.write("return payload;");let _=f.compile();return(I,S)=>_(m,I,S)},i,s=fr,a=!mr.jitless,u=a&&Zu.value,d=t.catchall,p;e._zod.parse=(m,f)=>{p??(p=o.value);let g=m.value;return s(g)?a&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=n(t.shape)),m=i(m,f),d?Kb([],g,m,f,p,e):m):r(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function Db(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter(i=>!Bn(i));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Ge(s,o,$e())))}),t)}var ji=b("$ZodUnion",(e,t)=>{V.init(e,t),ne(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ne(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ne(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ne(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>Ei(n.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of t.options){let l=a._zod.run({value:o.value,issues:[]},n);if(l instanceof Promise)s.push(l),i=!0;else{if(l.issues.length===0)return l;s.push(l)}}return i?Promise.all(s).then(a=>Db(a,o,e,n)):Db(s,o,e,n)}});function Nb(e,t,r,o){let n=e.filter(i=>i.issues.length===0);return n.length===1?(t.value=n[0].value,t):(n.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Ge(s,o,$e())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var Dp=b("$ZodXor",(e,t)=>{ji.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of t.options){let l=a._zod.run({value:o.value,issues:[]},n);l instanceof Promise?(s.push(l),i=!0):s.push(l)}return i?Promise.all(s).then(a=>Nb(a,o,e,n)):Nb(s,o,e,n)}}),Np=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ji.init(e,t);let r=e._zod.parse;ne(e._zod,"propValues",()=>{let n={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,l]of Object.entries(s)){n[a]||(n[a]=new Set);for(let u of l)n[a].add(u)}}return n});let o=io(()=>{let n=t.options,i=new Map;for(let s of n){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let l of a){if(i.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});e._zod.parse=(n,i)=>{let s=n.value;if(!fr(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let a=o.value.get(s?.[t.discriminator]);return a?a._zod.run(n,i):t.unionFallback||i.direction==="backward"?r(n,i):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:s,path:[t.discriminator],inst:e}),n)}}),Lp=b("$ZodIntersection",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,u])=>Lb(r,l,u)):Lb(r,i,s)}});function Jd(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Mn(e)&&Mn(t)){let r=Object.keys(t),o=Object.keys(e).filter(i=>r.indexOf(i)!==-1),n={...e,...t};for(let i of o){let s=Jd(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],s=Jd(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Lb(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let l of a.keys)o.has(l)||o.set(l,{}),o.get(l).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let l of a.keys)o.has(l)||o.set(l,{}),o.get(l).r=!0;else e.issues.push(a);let i=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&n&&e.issues.push({...n,keys:i}),Bn(e))return e;let s=Jd(t.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var La=b("$ZodTuple",(e,t)=>{V.init(e,t);let r=t.items;e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];let s=[],a=Ub(r,"optin"),l=Ub(r,"optout");if(!t.rest){if(i.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:i,inst:e,origin:"array"}),o;i.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:i,inst:e,origin:"array"})}let u=new Array(r.length);for(let d=0;d<r.length;d++){let p=r[d]._zod.run({value:i[d],issues:[]},n);p instanceof Promise?s.push(p.then(m=>{u[d]=m})):u[d]=p}if(t.rest){let d=r.length-1,p=i.slice(r.length);for(let m of p){d++;let f=t.rest._zod.run({value:m,issues:[]},n);f instanceof Promise?s.push(f.then(g=>jb(g,o,d))):jb(f,o,d)}}return s.length?Promise.all(s).then(()=>zb(u,o,r,i,l)):zb(u,o,r,i,l)}});function Ub(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]._zod[t]!=="optional")return r+1;return 0}function jb(e,t,r){e.issues.length&&t.issues.push(...et(r,e.issues)),t.value[r]=e.value}function zb(e,t,r,o,n){for(let i=0;i<r.length;i++){let s=e[i],a=i<o.length;if(s.issues.length){if(!a&&i>=n){t.value.length=i;break}t.issues.push(...et(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=o.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var Up=b("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Mn(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[],s=t.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>Ge(f,o,$e())),input:u,path:[u],inst:e});continue}let p=d.value,m=t.valueType._zod.run({value:n[u],issues:[]},o);m instanceof Promise?i.push(m.then(f=>{f.issues.length&&r.issues.push(...et(u,f.issues)),r.value[p]=f.value})):(m.issues.length&&r.issues.push(...et(u,m.issues)),r.value[p]=m.value)}let l;for(let u in n)a.has(u)||(l=l??[],l.push(u));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:l})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Ea.test(a)&&l.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(l=p)}if(l.issues.length){t.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(p=>Ge(p,o,$e())),input:a,path:[a],inst:e});continue}let d=t.valueType._zod.run({value:n[a],issues:[]},o);d instanceof Promise?i.push(d.then(p=>{p.issues.length&&r.issues.push(...et(a,p.issues)),r.value[l.value]=p.value})):(d.issues.length&&r.issues.push(...et(a,d.issues)),r.value[l.value]=d.value)}}return i.length?Promise.all(i).then(()=>r):r}}),jp=b("$ZodMap",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;let i=[];r.value=new Map;for(let[s,a]of n){let l=t.keyType._zod.run({value:s,issues:[]},o),u=t.valueType._zod.run({value:a,issues:[]},o);l instanceof Promise||u instanceof Promise?i.push(Promise.all([l,u]).then(([d,p])=>{Fb(d,p,r,s,n,e,o)})):Fb(l,u,r,s,n,e,o)}return i.length?Promise.all(i).then(()=>r):r}});function Fb(e,t,r,o,n,i,s){e.issues.length&&(Ai.has(typeof o)?r.issues.push(...et(o,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map(a=>Ge(a,s,$e()))})),t.issues.length&&(Ai.has(typeof o)?r.issues.push(...et(o,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map(a=>Ge(a,s,$e()))})),r.value.set(e.value,t.value)}var zp=b("$ZodSet",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of n){let a=t.valueType._zod.run({value:s,issues:[]},o);a instanceof Promise?i.push(a.then(l=>Mb(l,r))):Mb(a,r)}return i.length?Promise.all(i).then(()=>r):r}});function Mb(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var Fp=b("$ZodEnum",(e,t)=>{V.init(e,t);let r=Ii(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>Ai.has(typeof n)).map(n=>typeof n=="string"?ht(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let s=n.value;return o.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),Mp=b("$ZodLiteral",(e,t)=>{if(V.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?ht(o):o?ht(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),Bp=b("$ZodFile",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),Hp=b("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new jn(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r.fallback=!0,r));if(n instanceof Promise)throw new $t;return r.value=n,r.fallback=!0,r}});function Bb(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Ua=b("$ZodOptional",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ne(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ei(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,i=t.innerType._zod.run(r,o);return i instanceof Promise?i.then(s=>Bb(s,n)):Bb(i,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),Zp=b("$ZodExactOptional",(e,t)=>{Ua.init(e,t),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Gp=b("$ZodNullable",(e,t)=>{V.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ei(r.source)}|null)$`):void 0}),ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),Wp=b("$ZodDefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Hb(i,t)):Hb(n,t)}});function Hb(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Vp=b("$ZodPrefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),qp=b("$ZodNonOptional",(e,t)=>{V.init(e,t),ne(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Zb(i,e)):Zb(n,e)}});function Zb(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Jp=b("$ZodSuccess",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new jn("ZodSuccess");let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),Kp=b("$ZodCatch",(e,t)=>{V.init(e,t),e._zod.optin="optional",ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>Ge(s,o,$e()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(i=>Ge(i,o,$e()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),Xp=b("$ZodNaN",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),ja=b("$ZodPipe",(e,t)=>{V.init(e,t),ne(e._zod,"values",()=>t.in._zod.values),ne(e._zod,"optin",()=>t.in._zod.optin),ne(e._zod,"optout",()=>t.out._zod.optout),ne(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);return i instanceof Promise?i.then(s=>Ca(s,t.in,o)):Ca(i,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(i=>Ca(i,t.out,o)):Ca(n,t.out,o)}});function Ca(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var zi=b("$ZodCodec",(e,t)=>{V.init(e,t),ne(e._zod,"values",()=>t.in._zod.values),ne(e._zod,"optin",()=>t.in._zod.optin),ne(e._zod,"optout",()=>t.out._zod.optout),ne(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(r,o);return i instanceof Promise?i.then(s=>Ta(s,t,o)):Ta(i,t,o)}else{let i=t.out._zod.run(r,o);return i instanceof Promise?i.then(s=>Ta(s,t,o)):Ta(i,t,o)}}});function Ta(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let n=t.transform(e.value,e);return n instanceof Promise?n.then(i=>Ra(e,i,t.out,r)):Ra(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(i=>Ra(e,i,t.in,r)):Ra(e,n,t.in,r)}}function Ra(e,t,r,o){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},o)}var Yp=b("$ZodPreprocess",(e,t)=>{ja.init(e,t)}),Qp=b("$ZodReadonly",(e,t)=>{V.init(e,t),ne(e._zod,"propValues",()=>t.innerType._zod.propValues),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"optin",()=>t.innerType?._zod?.optin),ne(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Gb):Gb(n)}});function Gb(e){return e.value=Object.freeze(e.value),e}var em=b("$ZodTemplateLiteral",(e,t)=>{V.init(e,t);let r=[];for(let o of t.parts)if(typeof o=="object"&&o!==null){if(!o._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,s))}else if(o===null||Wu.has(typeof o))r.push(ht(`${o}`));else throw new Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>typeof o.value!="string"?(o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(o.value)||o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o)}),tm=b("$ZodFunction",(e,t)=>(V.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...o){let n=e._def.input?ha(e._def.input,o):o,i=Reflect.apply(r,this,n);return e._def.output?ha(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...o){let n=e._def.input?await va(e._def.input,o):o,i=await Reflect.apply(r,this,n);return e._def.output?await va(e._def.output,i):i}},e._zod.parse=(r,o)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let o=e.constructor;return Array.isArray(r[0])?new o({type:"function",input:new La({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new o({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let o=e.constructor;return new o({type:"function",input:e._def.input,output:r})},e)),nm=b("$ZodPromise",(e,t)=>{V.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then(n=>t.innerType._zod.run({value:n,issues:[]},o))}),rm=b("$ZodLazy",(e,t)=>{V.init(e,t),ne(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),ne(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ne(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ne(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ne(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),om=b("$ZodCustom",(e,t)=>{ye.init(e,t),V.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(i=>Wb(i,r,o,e));Wb(n,r,o,e)}});function Wb(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(so(n))}}var Mi={};nn(Mi,{ar:()=>Yb,az:()=>Qb,be:()=>tx,bg:()=>nx,ca:()=>rx,cs:()=>ox,da:()=>ix,de:()=>sx,el:()=>ax,en:()=>za,eo:()=>cx,es:()=>lx,fa:()=>ux,fi:()=>dx,fr:()=>px,frCA:()=>mx,he:()=>fx,hr:()=>gx,hu:()=>hx,hy:()=>yx,id:()=>bx,is:()=>xx,it:()=>kx,ja:()=>wx,ka:()=>Sx,kh:()=>_x,km:()=>Fa,ko:()=>$x,lt:()=>Ex,mk:()=>Ax,ms:()=>Px,nl:()=>Cx,no:()=>Tx,ota:()=>Rx,pl:()=>Dx,ps:()=>Ox,pt:()=>Nx,ro:()=>Lx,ru:()=>jx,sl:()=>zx,sv:()=>Fx,ta:()=>Mx,th:()=>Bx,tr:()=>Hx,ua:()=>Zx,uk:()=>Ma,ur:()=>Gx,uz:()=>Wx,vi:()=>Vx,yo:()=>Kx,zhCN:()=>qx,zhTW:()=>Jx});var aT=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(n){return e[n]??null}let r={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${n.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${i}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`}case"invalid_value":return n.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${A(n.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${n.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${n.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${r[i.format]??n.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${n.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${n.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${n.keys.length>1?"\u0629":""}: ${w(n.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function Yb(){return{localeError:aT()}}var cT=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${n.expected}, daxil olan ${a}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${i}, daxil olan ${a}`}case"invalid_value":return n.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${A(n.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${r[i.format]??n.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${n.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${n.keys.length>1?"lar":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${n.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function Qb(){return{localeError:cT()}}function ex(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;return s>=11&&s<=19?o:i===1?t:i>=2&&i<=4?r:o}var lT=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(n){return e[n]??null}let r={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},o={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${n.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${i}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${A(n.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=ex(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${n.maximum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),l=ex(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${n.minimum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${n.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${w(n.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${n.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function tx(){return{localeError:lT()}}var uT=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${A(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${n.minimum.toString()} ${s.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${i.prefix}"`;if(i.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${i.suffix}"`;if(i.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${i.includes}"`;if(i.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${i.pattern}`;let s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return i.format==="emoji"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="datetime"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="date"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),i.format==="time"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="duration"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${s} ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${w(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function nx(){return{localeError:uT()}}var dT=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}let r={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${a}`:`Tipus inv\xE0lid: s'esperava ${i}, s'ha rebut ${a}`}case"invalid_value":return n.values.length===1?`Valor inv\xE0lid: s'esperava ${A(n.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${w(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a m\xE0xim":"menys de",s=t(n.origin);return s?`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${i} ${n.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"com a m\xEDnim":"m\xE9s de",s=t(n.origin);return s?`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${i} ${n.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${r[i.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${n.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${n.origin}`;default:return"Entrada inv\xE0lida"}}};function rx(){return{localeError:dT()}}var pT=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(n){return e[n]??null}let r={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${n.expected}, obdr\u017Eeno ${a}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${i}, obdr\u017Eeno ${a}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${A(n.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${r[i.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${w(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}};function ox(){return{localeError:pT()}}var mT=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldigt input: forventede instanceof ${n.expected}, fik ${a}`:`Ugyldigt input: forventede ${i}, fik ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig v\xE6rdi: forventede ${A(n.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=o[n.origin]??n.origin;return s?`For stor: forventede ${a??"value"} ${s.verb} ${i} ${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor: forventede ${a??"value"} havde ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=o[n.origin]??n.origin;return s?`For lille: forventede ${a} ${s.verb} ${i} ${n.minimum.toString()} ${s.unit}`:`For lille: forventede ${a} havde ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ugyldig streng: skal starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: skal ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: skal indeholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${w(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${n.origin}`;default:return"Ugyldigt input"}}};function ix(){return{localeError:mT()}}var fT=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}let r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},o={nan:"NaN",number:"Zahl",array:"Array"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${a}`:`Ung\xFCltige Eingabe: erwartet ${i}, erhalten ${a}`}case"invalid_value":return n.values.length===1?`Ung\xFCltige Eingabe: erwartet ${A(n.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${w(n.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${n.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${n.origin}`;default:return"Ung\xFCltige Eingabe"}}};function sx(){return{localeError:fT()}}var gT=()=>{let e={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function t(n){return e[n]??null}let r={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return typeof n.expected=="string"&&/^[A-Z]/.test(n.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${n.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`}case"invalid_value":return n.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${A(n.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${i}${n.maximum.toString()} ${s.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${i}${n.minimum.toString()} ${s.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${i.prefix}"`:i.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${i.suffix}"`:i.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${i.includes}"`:i.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${i.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${r[i.format]??n.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${n.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${n.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${n.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${w(n.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${n.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${n.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function ax(){return{localeError:gT()}}var hT=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return`Invalid input: expected ${i}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${A(n.values[0])}`:`Invalid option: expected one of ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${s.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(s=>`'${s}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function za(){return{localeError:hT()}}var vT=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(n){return e[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${n.expected}, ricevi\u011Dis ${a}`:`Nevalida enigo: atendi\u011Dis ${i}, ricevi\u011Dis ${a}`}case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${A(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()} ${s.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${i}${n.minimum.toString()} ${s.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${i.prefix}"`:i.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${i.suffix}"`:i.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${i.includes}"`:i.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${i.pattern}`:`Nevalida ${r[i.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function cx(){return{localeError:vT()}}var yT=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(n){return e[n]??null}let r={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${n.expected}, recibido ${a}`:`Entrada inv\xE1lida: se esperaba ${i}, recibido ${a}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: se esperaba ${A(n.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=o[n.origin]??n.origin;return s?`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${i}${n.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: se esperaba que ${a??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=o[n.origin]??n.origin;return s?`Demasiado peque\xF1o: se esperaba que ${a} tuviera ${i}${n.minimum.toString()} ${s.unit}`:`Demasiado peque\xF1o: se esperaba que ${a} fuera ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${i.prefix}"`:i.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${i.suffix}"`:i.format==="includes"?`Cadena inv\xE1lida: debe incluir "${i.includes}"`:i.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${i.pattern}`:`Inv\xE1lido ${r[i.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${o[n.origin]??n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${o[n.origin]??n.origin}`;default:return"Entrada inv\xE1lida"}}};function lx(){return{localeError:yT()}}var bT=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(n){return e[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${n.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${i} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return n.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${A(n.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${w(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${r[i.format]??n.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${n.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${n.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${w(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${n.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${n.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function ux(){return{localeError:bT()}}var xT=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(n){return e[n]??null}let r={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${a}`:`Virheellinen tyyppi: odotettiin ${i}, oli ${a}`}case"invalid_value":return n.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${A(n.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${n.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${n.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${r[i.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${w(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function dx(){return{localeError:xT()}}var kT=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}let r={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},o={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : instanceof ${n.expected} attendu, ${a} re\xE7u`:`Entr\xE9e invalide : ${i} attendu, ${a} re\xE7u`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : ${A(n.values[0])} attendu`:`Option invalide : une valeur parmi ${w(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Trop grand : ${o[n.origin]??"valeur"} doit ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o[n.origin]??"valeur"} doit \xEAtre ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Trop petit : ${o[n.origin]??"valeur"} doit ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`Trop petit : ${o[n.origin]??"valeur"} doit \xEAtre ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${w(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function px(){return{localeError:kT()}}var wT=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}let r={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : attendu instanceof ${n.expected}, re\xE7u ${a}`:`Entr\xE9e invalide : attendu ${i}, re\xE7u ${a}`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : attendu ${A(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u2264":"<",s=t(n.origin);return s?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u2265":">",s=t(n.origin);return s?`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${w(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function mx(){return{localeError:wT()}}var ST=()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=u=>u?e[u]:void 0,o=u=>{let d=r(u);return d?d.label:u??e.unknown.label},n=u=>`\u05D4${o(u)}`,i=u=>(r(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=u=>u?t[u]??null:null,a={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},l={nan:"NaN"};return u=>{switch(u.code){case"invalid_type":{let d=u.expected,p=l[d??""]??o(d),m=P(u.input),f=l[m]??e[m]?.label??m;return/^[A-Z]/.test(u.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${u.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${p}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${A(u.values[0])}`;let d=u.values.map(f=>A(f));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${d[0]} \u05D0\u05D5 ${d[1]}`;let p=d[d.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${d.slice(0,-1).join(", ")} \u05D0\u05D5 ${p}`}case"too_big":{let d=s(u.origin),p=n(u.origin??"value");if(u.origin==="string")return`${d?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${d?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let g=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${g}`}if(u.origin==="array"||u.origin==="set"){let g=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=u.inclusive?`${u.maximum} ${d?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${d?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${p} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let m=u.inclusive?"<=":"<",f=i(u.origin??"value");return d?.unit?`${d.longLabel} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.maximum.toString()} ${d.unit}`:`${d?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.maximum.toString()}`}case"too_small":{let d=s(u.origin),p=n(u.origin??"value");if(u.origin==="string")return`${d?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${d?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let g=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${g}`}if(u.origin==="array"||u.origin==="set"){let g=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let y=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`}let h=u.inclusive?`${u.minimum} ${d?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${d?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let m=u.inclusive?">=":">",f=i(u.origin??"value");return d?.unit?`${d.shortLabel} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.minimum.toString()} ${d.unit}`:`${d?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.minimum.toString()}`}case"invalid_format":{let d=u;if(d.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${d.prefix}"`;if(d.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${d.suffix}"`;if(d.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${d.includes}"`;if(d.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${d.pattern}`;let p=a[d.format],m=p?.label??d.format,g=(p?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${m} \u05DC\u05D0 ${g}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${w(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${n(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function fx(){return{localeError:ST()}}var _T=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(n){return e[n]??null}let r={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},o={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${n.expected}, a primljeno je ${a}`:`Neispravan unos: o\u010Dekuje se ${i}, a primljeno je ${a}`}case"invalid_value":return n.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${A(n.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=o[n.origin]??n.origin;return s?`Preveliko: o\u010Dekivano da ${a??"vrijednost"} ima ${i}${n.maximum.toString()} ${s.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${a??"vrijednost"} bude ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=o[n.origin]??n.origin;return s?`Premalo: o\u010Dekivano da ${a} ima ${i}${n.minimum.toString()} ${s.unit}`:`Premalo: o\u010Dekivano da ${a} bude ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${i.prefix}"`:i.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${i.suffix}"`:i.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${i.includes}"`:i.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${i.pattern}`:`Neispravna ${r[i.format]??n.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${n.divisor}`;case"unrecognized_keys":return`Neprepoznat${n.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${w(n.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${o[n.origin]??n.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${o[n.origin]??n.origin}`;default:return"Neispravan unos"}}};function gx(){return{localeError:_T()}}var $T=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}let r={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${n.expected}, a kapott \xE9rt\xE9k ${a}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${i}, a kapott \xE9rt\xE9k ${a}`}case"invalid_value":return n.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${A(n.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${n.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${n.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${i}${n.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} t\xFAl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${r[i.format]??n.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${n.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${n.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${n.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function hx(){return{localeError:$T()}}function vx(e,t,r){return Math.abs(e)===1?t:r}function mo(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],r=e[e.length-1];return e+(t.includes(r)?"\u0576":"\u0568")}var IT=()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(n){return e[n]??null}let r={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},o={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${n.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${i}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`}case"invalid_value":return n.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${A(n.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=vx(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${mo(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.maximum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${mo(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),l=vx(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${mo(n.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.minimum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${mo(n.origin)} \u056C\u056B\u0576\u056B ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${i.prefix}"-\u0578\u057E`:i.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${i.suffix}"-\u0578\u057E`:i.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${i.includes}"`:i.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${i.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${r[i.format]??n.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${n.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${n.keys.length>1?"\u0576\u0565\u0580":""}. ${w(n.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${mo(n.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${mo(n.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function yx(){return{localeError:IT()}}var ET=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}let r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${a}`:`Input tidak valid: diharapkan ${i}, diterima ${a}`}case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${A(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${r[i.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function bx(){return{localeError:ET()}}var AT=()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function t(n){return e[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"n\xFAmer",array:"fylki"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera instanceof ${n.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera ${i}`}case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${A(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${i}${n.maximum.toString()} ${s.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${i}${n.minimum.toString()} ${s.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${i.prefix}"`:i.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${i.suffix}"`:i.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${i.includes}"`:i.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${i.pattern}`:`Rangt ${r[i.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${w(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function xx(){return{localeError:AT()}}var PT=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}let r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"numero",array:"vettore"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Input non valido: atteso instanceof ${n.expected}, ricevuto ${a}`:`Input non valido: atteso ${i}, ricevuto ${a}`}case"invalid_value":return n.values.length===1?`Input non valido: atteso ${A(n.values[0])}`:`Opzione non valida: atteso uno tra ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Input non valido: ${r[i.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${w(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function kx(){return{localeError:PT()}}var CT=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(n){return e[n]??null}let r={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},o={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${n.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${i}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return n.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${A(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${w(n.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=n.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=t(n.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=n.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=t(n.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${r[i.format]??n.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${n.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${n.keys.length>1?"\u7FA4":""}: ${w(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function wx(){return{localeError:CT()}}var TT=()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(n){return e[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},o={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`}case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${A(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${w(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.prefix}"-\u10D8\u10D7`:i.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.suffix}"-\u10D8\u10D7`:i.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${i.includes}"-\u10E1`:i.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${i.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${w(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function Sx(){return{localeError:TT()}}var RT=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(n){return e[n]??null}let r={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},o={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${n.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`}case"invalid_value":return n.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${A(n.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${n.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${w(n.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function Fa(){return{localeError:RT()}}function _x(){return Fa()}var OT=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${i}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`}case"invalid_value":return n.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${A(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${w(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(n.origin),l=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${l} ${i}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${i}${s}`}case"too_small":{let i=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(n.origin),l=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${l} ${i}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${r[i.format]??n.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${n.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${w(n.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${n.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${n.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function $x(){return{localeError:OT()}}var Fi=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ix(e){let t=Math.abs(e),r=t%10,o=t%100;return o>=11&&o<=19||r===0?"many":r===1?"one":"few"}var DT=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(n,i,s,a){let l=e[n]??null;return l===null?l:{unit:l.unit[i],verb:l.verb[a][s?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},o={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Gautas tipas ${a}, o tik\u0117tasi - instanceof ${n.expected}`:`Gautas tipas ${a}, o tik\u0117tasi - ${i}`}case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${A(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${w(n.values,"|")} pasirinkim\u0173`;case"too_big":{let i=o[n.origin]??n.origin,s=t(n.origin,Ix(Number(n.maximum)),n.inclusive??!1,"smaller");if(s?.verb)return`${Fi(i??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.maximum.toString()} ${s.unit??"element\u0173"}`;let a=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Fi(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.maximum.toString()} ${s?.unit}`}case"too_small":{let i=o[n.origin]??n.origin,s=t(n.origin,Ix(Number(n.minimum)),n.inclusive??!1,"bigger");if(s?.verb)return`${Fi(i??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.minimum.toString()} ${s.unit??"element\u0173"}`;let a=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Fi(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.minimum.toString()} ${s?.unit}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${i.prefix}"`:i.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${i.suffix}"`:i.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${i.includes}"`:i.format==="regex"?`Eilut\u0117 privalo atitikti ${i.pattern}`:`Neteisingas ${r[i.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${w(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let i=o[n.origin]??n.origin;return`${Fi(i??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function Ex(){return{localeError:DT()}}var NT=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(n){return e[n]??null}let r={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},o={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${n.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${A(n.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${n.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${w(n.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${n.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${n.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function Ax(){return{localeError:NT()}}var LT=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}let r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"nombor"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${a}`:`Input tidak sah: dijangka ${i}, diterima ${a}`}case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${A(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${r[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${w(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function Px(){return{localeError:LT()}}var UT=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(n){return e[n]??null}let r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},o={nan:"NaN",number:"getal"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${a}`:`Ongeldige invoer: verwacht ${i}, ontving ${a}`}case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${A(n.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";return s?`Te ${a}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${s.unit??"elementen"} ${s.verb}`:`Te ${a}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";return s?`Te ${a}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Te ${a}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function Cx(){return{localeError:UT()}}var jT=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventet instanceof ${n.expected}, fikk ${a}`:`Ugyldig input: forventet ${i}, fikk ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${A(n.values[0])}`:`Ugyldig valg: forventet en av ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${w(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function Tx(){return{localeError:jT()}}var zT=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(n){return e[n]??null}let r={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`F\xE2sit giren: umulan instanceof ${n.expected}, al\u0131nan ${a}`:`F\xE2sit giren: umulan ${i}, al\u0131nan ${a}`}case"invalid_value":return n.values.length===1?`F\xE2sit giren: umulan ${A(n.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=n;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${r[i.format]??n.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${n.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${n.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function Rx(){return{localeError:zT()}}var FT=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(n){return e[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${n.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${i} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return n.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${A(n.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${w(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0648\u064A`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${r[i.format]??n.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${n.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${n.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${w(n.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${n.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${n.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function Ox(){return{localeError:FT()}}var MT=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function t(n){return e[n]??null}let r={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},o={nan:"NaN",number:"liczba",array:"tablica"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${n.expected}, otrzymano ${a}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${i}, otrzymano ${a}`}case"invalid_value":return n.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${A(n.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${r[i.format]??n.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${n.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${n.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function Dx(){return{localeError:MT()}}var BT=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}let r={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",number:"n\xFAmero",null:"nulo"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Tipo inv\xE1lido: esperado instanceof ${n.expected}, recebido ${a}`:`Tipo inv\xE1lido: esperado ${i}, recebido ${a}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: esperado ${A(n.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${r[i.format]??n.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${n.origin}`;default:return"Campo inv\xE1lido"}}};function Nx(){return{localeError:BT()}}var HT=()=>{let e={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function t(n){return e[n]??null}let r={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},o={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return`Intrare invalid\u0103: a\u0219teptat ${i}, primit ${a}`}case"invalid_value":return n.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${A(n.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} s\u0103 fie ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Prea mic: a\u0219teptat ca ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`Prea mic: a\u0219teptat ca ${n.origin} s\u0103 fie ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${i.prefix}"`:i.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${i.suffix}"`:i.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${i.includes}"`:i.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${i.pattern}`:`Format invalid: ${r[i.format]??n.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${n.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${w(n.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${n.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${n.origin}`;default:return"Intrare invalid\u0103"}}};function Lx(){return{localeError:HT()}}function Ux(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;return s>=11&&s<=19?o:i===1?t:i>=2&&i<=4?r:o}var ZT=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${A(n.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=Ux(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${n.maximum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),l=Ux(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${n.minimum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${n.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0438":""}: ${w(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function jx(){return{localeError:ZT()}}var GT=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}let r={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${n.expected}, prejeto ${a}`:`Neveljaven vnos: pri\u010Dakovano ${i}, prejeto ${a}`}case"invalid_value":return n.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${A(n.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${r[i.format]??n.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${w(n.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function zx(){return{localeError:GT()}}var WT=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(n){return e[n]??null}let r={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${n.expected}, fick ${a}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${i}, fick ${a}`}case"invalid_value":return n.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${A(n.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${r[i.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${w(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${n.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function Fx(){return{localeError:WT()}}var VT=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(n){return e[n]??null}let r={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${n.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`}case"invalid_value":return n.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${A(n.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${w(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${n.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${n.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${i}${n.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${i}${n.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${n.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${n.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function Mx(){return{localeError:VT()}}var qT=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(n){return e[n]??null}let r={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},o={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${n.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${i} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`}case"invalid_value":return n.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${A(n.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${n.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${w(n.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function Bx(){return{localeError:qT()}}var JT=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(n){return e[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${n.expected}, al\u0131nan ${a}`:`Ge\xE7ersiz de\u011Fer: beklenen ${i}, al\u0131nan ${a}`}case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${A(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()} ${s.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ge\xE7ersiz metin: "${i.prefix}" ile ba\u015Flamal\u0131`:i.format==="ends_with"?`Ge\xE7ersiz metin: "${i.suffix}" ile bitmeli`:i.format==="includes"?`Ge\xE7ersiz metin: "${i.includes}" i\xE7ermeli`:i.format==="regex"?`Ge\xE7ersiz metin: ${i.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[i.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function Hx(){return{localeError:JT()}}var KT=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${n.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${i}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${A(n.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} \u0431\u0443\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0456":""}: ${w(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${n.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function Ma(){return{localeError:KT()}}function Zx(){return Ma()}var XT=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(n){return e[n]??null}let r={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},o={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${n.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${i} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return n.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${A(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${w(n.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${n.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${i}${n.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u0627 ${i}${n.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${n.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${n.keys.length>1?"\u0632":""}: ${w(n.keys,"\u060C ")}`;case"invalid_key":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function Gx(){return{localeError:XT()}}var YT=()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function t(n){return e[n]??null}let r={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},o={nan:"NaN",number:"raqam",array:"massiv"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${a}`:`Noto\u2018g\u2018ri kirish: kutilgan ${i}, qabul qilingan ${a}`}case"invalid_value":return n.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${A(n.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()} ${s.unit} ${s.verb}`:`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${i.prefix}" bilan boshlanishi kerak`:i.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${i.suffix}" bilan tugashi kerak`:i.format==="includes"?`Noto\u2018g\u2018ri satr: "${i.includes}" ni o\u2018z ichiga olishi kerak`:i.format==="regex"?`Noto\u2018g\u2018ri satr: ${i.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${r[i.format]??n.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${n.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${n.keys.length>1?"lar":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${n.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function Wx(){return{localeError:YT()}}var QT=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(n){return e[n]??null}let r={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},o={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${n.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${i}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`}case"invalid_value":return n.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${A(n.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${r[i.format]??n.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${n.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${w(n.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function Vx(){return{localeError:QT()}}var eR=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function t(n){return e[n]??null}let r={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},o={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${i}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`}case"invalid_value":return n.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${A(n.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${r[i.format]??n.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${n.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${n.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function qx(){return{localeError:eR()}}var tR=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(n){return e[n]??null}let r={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${n.expected}\uFF0C\u4F46\u6536\u5230 ${a}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${i}\uFF0C\u4F46\u6536\u5230 ${a}`}case"invalid_value":return n.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${A(n.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${n.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${n.keys.length>1?"\u5011":""}\uFF1A${w(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function Jx(){return{localeError:tR()}}var nR=()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function t(n){return e[n]??null}let r={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},o={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=P(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${n.expected}, \xE0m\u1ECD\u0300 a r\xED ${a}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${i}, \xE0m\u1ECD\u0300 a r\xED ${a}`}case"invalid_value":return n.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${A(n.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin??"iye"} ${s.verb} ${i}${n.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.maximum}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin} ${s.verb} ${i}${n.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.minimum}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${r[i.format]??n.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${n.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${w(n.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function Kx(){return{localeError:nR()}}var Xx,im=Symbol("ZodOutput"),sm=Symbol("ZodInput"),Ba=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Ha(){return new Ba}(Xx=globalThis).__zod_globalRegistry??(Xx.__zod_globalRegistry=Ha());var De=globalThis.__zod_globalRegistry;function am(e,t){return new e({type:"string",...R(t)})}function cm(e,t){return new e({type:"string",coerce:!0,...R(t)})}function Za(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...R(t)})}function Bi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...R(t)})}function Ga(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function Wa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function Va(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function qa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function Hi(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function Ja(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function Ka(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function Xa(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function Ya(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function Qa(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function ec(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function tc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function nc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function rc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function lm(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...R(t)})}function oc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function ic(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function sc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...R(t)})}function ac(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...R(t)})}function cc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function lc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}var um={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function dm(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function pm(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function mm(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function fm(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function gm(e,t){return new e({type:"number",checks:[],...R(t)})}function hm(e,t){return new e({type:"number",coerce:!0,checks:[],...R(t)})}function vm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...R(t)})}function ym(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...R(t)})}function bm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...R(t)})}function xm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...R(t)})}function km(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...R(t)})}function wm(e,t){return new e({type:"boolean",...R(t)})}function Sm(e,t){return new e({type:"boolean",coerce:!0,...R(t)})}function _m(e,t){return new e({type:"bigint",...R(t)})}function $m(e,t){return new e({type:"bigint",coerce:!0,...R(t)})}function Im(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...R(t)})}function Em(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...R(t)})}function Am(e,t){return new e({type:"symbol",...R(t)})}function Pm(e,t){return new e({type:"undefined",...R(t)})}function Cm(e,t){return new e({type:"null",...R(t)})}function Tm(e){return new e({type:"any"})}function Rm(e){return new e({type:"unknown"})}function Om(e,t){return new e({type:"never",...R(t)})}function Dm(e,t){return new e({type:"void",...R(t)})}function Nm(e,t){return new e({type:"date",...R(t)})}function Lm(e,t){return new e({type:"date",coerce:!0,...R(t)})}function Um(e,t){return new e({type:"nan",...R(t)})}function Mt(e,t){return new Aa({check:"less_than",...R(t),value:e,inclusive:!1})}function st(e,t){return new Aa({check:"less_than",...R(t),value:e,inclusive:!0})}function Bt(e,t){return new Pa({check:"greater_than",...R(t),value:e,inclusive:!1})}function We(e,t){return new Pa({check:"greater_than",...R(t),value:e,inclusive:!0})}function uc(e){return Bt(0,e)}function dc(e){return Mt(0,e)}function pc(e){return st(0,e)}function mc(e){return We(0,e)}function Hn(e,t){return new Cd({check:"multiple_of",...R(t),value:e})}function Zn(e,t){return new Od({check:"max_size",...R(t),maximum:e})}function Ht(e,t){return new Dd({check:"min_size",...R(t),minimum:e})}function vr(e,t){return new Nd({check:"size_equals",...R(t),size:e})}function yr(e,t){return new Ld({check:"max_length",...R(t),maximum:e})}function dn(e,t){return new Ud({check:"min_length",...R(t),minimum:e})}function br(e,t){return new jd({check:"length_equals",...R(t),length:e})}function fo(e,t){return new zd({check:"string_format",format:"regex",...R(t),pattern:e})}function go(e){return new Fd({check:"string_format",format:"lowercase",...R(e)})}function ho(e){return new Md({check:"string_format",format:"uppercase",...R(e)})}function vo(e,t){return new Bd({check:"string_format",format:"includes",...R(t),includes:e})}function yo(e,t){return new Hd({check:"string_format",format:"starts_with",...R(t),prefix:e})}function bo(e,t){return new Zd({check:"string_format",format:"ends_with",...R(t),suffix:e})}function fc(e,t,r){return new Gd({check:"property",property:e,schema:t,...R(r)})}function xo(e,t){return new Wd({check:"mime_type",mime:e,...R(t)})}function It(e){return new Vd({check:"overwrite",tx:e})}function ko(e){return It(t=>t.normalize(e))}function wo(){return It(e=>e.trim())}function So(){return It(e=>e.toLowerCase())}function _o(){return It(e=>e.toUpperCase())}function $o(){return It(e=>Hu(e))}function jm(e,t,r){return new e({type:"array",element:t,...R(r)})}function oR(e,t,r){return new e({type:"union",options:t,...R(r)})}function iR(e,t,r){return new e({type:"union",options:t,inclusive:!1,...R(r)})}function sR(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...R(o)})}function aR(e,t,r){return new e({type:"intersection",left:t,right:r})}function cR(e,t,r,o){let n=r instanceof V,i=n?o:r,s=n?r:null;return new e({type:"tuple",items:t,rest:s,...R(i)})}function lR(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...R(o)})}function uR(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...R(o)})}function dR(e,t,r){return new e({type:"set",valueType:t,...R(r)})}function pR(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:o,...R(r)})}function mR(e,t,r){return new e({type:"enum",entries:t,...R(r)})}function fR(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...R(r)})}function zm(e,t){return new e({type:"file",...R(t)})}function gR(e,t){return new e({type:"transform",transform:t})}function hR(e,t){return new e({type:"optional",innerType:t})}function vR(e,t){return new e({type:"nullable",innerType:t})}function yR(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Gu(r)}})}function bR(e,t,r){return new e({type:"nonoptional",innerType:t,...R(r)})}function xR(e,t){return new e({type:"success",innerType:t})}function kR(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}function wR(e,t,r){return new e({type:"pipe",in:t,out:r})}function SR(e,t){return new e({type:"readonly",innerType:t})}function _R(e,t,r){return new e({type:"template_literal",parts:t,...R(r)})}function $R(e,t){return new e({type:"lazy",getter:t})}function IR(e,t){return new e({type:"promise",innerType:t})}function Fm(e,t,r){let o=R(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Mm(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function Bm(e,t){let r=Yx(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(so(n,o.value,r._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(so(i))}},e(o.value,o)),t);return r}function Yx(e,t){let r=new ye({check:"custom",...R(t)});return r._zod.check=e,r}function Hm(e){let t=new ye({check:"describe"});return t._zod.onattach=[r=>{let o=De.get(r)??{};De.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function Zm(e){let t=new ye({check:"meta"});return t._zod.onattach=[r=>{let o=De.get(r)??{};De.add(r,{...o,...e})}],t._zod.check=()=>{},t}function Gm(e,t){let r=R(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(o=o.map(f=>typeof f=="string"?f.toLowerCase():f),n=n.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(o),s=new Set(n),a=e.Codec??zi,l=e.Boolean??Ui,u=e.String??hr,d=new u({type:"string",error:r.error}),p=new l({type:"boolean",error:r.error}),m=new a({type:"pipe",in:d,out:p,transform:((f,g)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:s.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:g.value,inst:m,continue:!1}),{})}),reverseTransform:((f,g)=>f===!0?o[0]||"true":n[0]||"false"),error:r.error});return m}function Io(e,t,r,o={}){let n=R(o),i={...R(o),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:a=>r.test(a),...n};return r instanceof RegExp&&(i.pattern=r),new e(i)}function Gn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??De,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function pe(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,d);else{let m=s.schema,f=t.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,m,d)}let p=e._zod.parent;p&&(s.ref||(s.ref=p),pe(p,t,d),t.seen.get(p).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),t.io==="input"&&Ve(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((o=s.schema).default??(o.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Wn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let l=o.get(a);if(l&&l!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,s[0])}}let n=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,m=e.external.uri??(g=>g);if(p)return{ref:m(p)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${f}`}}if(s[1]===r)return{ref:"#"};let u=`#/${a}/`,d=s[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:l,defId:u}=n(s);a.def={...a.schema},u&&(a.defId=u);let d=a.schema;for(let p in d)delete d[p];d.$ref=l};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
243
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let S=f.compile();return(E,_)=>S(m,E,_)},i,s=Ar,a=!Er.jitless,u=a&&zd.value,d=t.catchall,p;e._zod.parse=(m,f)=>{p??(p=o.value);let g=m.value;return s(g)?a&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=r(t.shape)),m=i(m,f),d?xk([],g,m,f,p,e):m):n(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function ok(e,t,n,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let r=e.filter(i=>!nr(i));return r.length===1?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>We(s,o,Ce())))}),t)}var ns=b("$ZodUnion",(e,t)=>{J.init(e,t),ne(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ne(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ne(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ne(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${o.map(r=>Wi(r.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,r)=>{if(n)return n(o,r);let i=!1,s=[];for(let a of t.options){let l=a._zod.run({value:o.value,issues:[]},r);if(l instanceof Promise)s.push(l),i=!0;else{if(l.issues.length===0)return l;s.push(l)}}return i?Promise.all(s).then(a=>ok(a,o,e,r)):ok(s,o,e,r)}});function ik(e,t,n,o){let r=e.filter(i=>i.issues.length===0);return r.length===1?(t.value=r[0].value,t):(r.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>We(s,o,Ce())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t)}var Cm=b("$ZodXor",(e,t)=>{ns.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,r)=>{if(n)return n(o,r);let i=!1,s=[];for(let a of t.options){let l=a._zod.run({value:o.value,issues:[]},r);l instanceof Promise?(s.push(l),i=!0):s.push(l)}return i?Promise.all(s).then(a=>ik(a,o,e,r)):ik(s,o,e,r)}}),Pm=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ns.init(e,t);let n=e._zod.parse;ne(e._zod,"propValues",()=>{let r={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,l]of Object.entries(s)){r[a]||(r[a]=new Set);for(let u of l)r[a].add(u)}}return r});let o=xo(()=>{let r=t.options,i=new Map;for(let s of r){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let l of a){if(i.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});e._zod.parse=(r,i)=>{let s=r.value;if(!Ar(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;let a=o.value.get(s?.[t.discriminator]);return a?a._zod.run(r,i):t.unionFallback||i.direction==="backward"?n(r,i):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:s,path:[t.discriminator],inst:e}),r)}}),Tm=b("$ZodIntersection",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>{let r=n.value,i=t.left._zod.run({value:r,issues:[]},o),s=t.right._zod.run({value:r,issues:[]},o);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,u])=>sk(n,l,u)):sk(n,i,s)}});function Gp(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(tr(e)&&tr(t)){let n=Object.keys(t),o=Object.keys(e).filter(i=>n.indexOf(i)!==-1),r={...e,...t};for(let i of o){let s=Gp(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r[i]=s.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t[o],s=Gp(r,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function sk(e,t,n){let o=new Map,r;for(let a of t.issues)if(a.code==="unrecognized_keys"){r??(r=a);for(let l of a.keys)o.has(l)||o.set(l,{}),o.get(l).l=!0}else e.issues.push(a);for(let a of n.issues)if(a.code==="unrecognized_keys")for(let l of a.keys)o.has(l)||o.set(l,{}),o.get(l).r=!0;else e.issues.push(a);let i=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&r&&e.issues.push({...r,keys:i}),nr(e))return e;let s=Gp(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var mc=b("$ZodTuple",(e,t)=>{J.init(e,t);let n=t.items;e._zod.parse=(o,r)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];let s=[],a=ak(n,"optin"),l=ak(n,"optout");if(!t.rest){if(i.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:i,inst:e,origin:"array"}),o;i.length>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:i,inst:e,origin:"array"})}let u=new Array(n.length);for(let d=0;d<n.length;d++){let p=n[d]._zod.run({value:i[d],issues:[]},r);p instanceof Promise?s.push(p.then(m=>{u[d]=m})):u[d]=p}if(t.rest){let d=n.length-1,p=i.slice(n.length);for(let m of p){d++;let f=t.rest._zod.run({value:m,issues:[]},r);f instanceof Promise?s.push(f.then(g=>ck(g,o,d))):ck(f,o,d)}}return s.length?Promise.all(s).then(()=>lk(u,o,n,i,l)):lk(u,o,n,i,l)}});function ak(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!=="optional")return n+1;return 0}function ck(e,t,n){e.issues.length&&t.issues.push(...nt(n,e.issues)),t.value[n]=e.value}function lk(e,t,n,o,r){for(let i=0;i<n.length;i++){let s=e[i],a=i<o.length;if(s.issues.length){if(!a&&i>=r){t.value.length=i;break}t.issues.push(...nt(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=o.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var Rm=b("$ZodRecord",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!tr(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;let i=[],s=t.keyType._zod.values;if(s){n.value={};let a=new Set;for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>We(f,o,Ce())),input:u,path:[u],inst:e});continue}let p=d.value,m=t.valueType._zod.run({value:r[u],issues:[]},o);m instanceof Promise?i.push(m.then(f=>{f.issues.length&&n.issues.push(...nt(u,f.issues)),n.value[p]=f.value})):(m.issues.length&&n.issues.push(...nt(u,m.issues)),n.value[p]=m.value)}let l;for(let u in r)a.has(u)||(l=l??[],l.push(u));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:l})}else{n.value={};for(let a of Reflect.ownKeys(r)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(r,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&oc.test(a)&&l.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(l=p)}if(l.issues.length){t.mode==="loose"?n.value[a]=r[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(p=>We(p,o,Ce())),input:a,path:[a],inst:e});continue}let d=t.valueType._zod.run({value:r[a],issues:[]},o);d instanceof Promise?i.push(d.then(p=>{p.issues.length&&n.issues.push(...nt(a,p.issues)),n.value[l.value]=p.value})):(d.issues.length&&n.issues.push(...nt(a,d.issues)),n.value[l.value]=d.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Om=b("$ZodMap",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!(r instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),n;let i=[];n.value=new Map;for(let[s,a]of r){let l=t.keyType._zod.run({value:s,issues:[]},o),u=t.valueType._zod.run({value:a,issues:[]},o);l instanceof Promise||u instanceof Promise?i.push(Promise.all([l,u]).then(([d,p])=>{uk(d,p,n,s,r,e,o)})):uk(l,u,n,s,r,e,o)}return i.length?Promise.all(i).then(()=>n):n}});function uk(e,t,n,o,r,i,s){e.issues.length&&(Zi.has(typeof o)?n.issues.push(...nt(o,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:r,inst:i,issues:e.issues.map(a=>We(a,s,Ce()))})),t.issues.length&&(Zi.has(typeof o)?n.issues.push(...nt(o,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:r,inst:i,key:o,issues:t.issues.map(a=>We(a,s,Ce()))})),n.value.set(e.value,t.value)}var Dm=b("$ZodSet",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!(r instanceof Set))return n.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),n;let i=[];n.value=new Set;for(let s of r){let a=t.valueType._zod.run({value:s,issues:[]},o);a instanceof Promise?i.push(a.then(l=>dk(l,n))):dk(a,n)}return i.length?Promise.all(i).then(()=>n):n}});function dk(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var Nm=b("$ZodEnum",(e,t)=>{J.init(e,t);let n=Gi(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter(r=>Zi.has(typeof r)).map(r=>typeof r=="string"?St(r):r.toString()).join("|")})$`),e._zod.parse=(r,i)=>{let s=r.value;return o.has(s)||r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),Lm=b("$ZodLiteral",(e,t)=>{if(J.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?St(o):o?St(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,r)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),Um=b("$ZodFile",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;return r instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),n}}),jm=b("$ZodTransform",(e,t)=>{J.init(e,t),e._zod.optin="optional",e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Yn(e.constructor.name);let r=t.transform(n.value,n);if(o.async)return(r instanceof Promise?r:Promise.resolve(r)).then(s=>(n.value=s,n.fallback=!0,n));if(r instanceof Promise)throw new Nt;return n.value=r,n.fallback=!0,n}});function pk(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var fc=b("$ZodOptional",(e,t)=>{J.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ne(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Wi(n.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(t.innerType._zod.optin==="optional"){let r=n.value,i=t.innerType._zod.run(n,o);return i instanceof Promise?i.then(s=>pk(s,r)):pk(i,r)}return n.value===void 0?n:t.innerType._zod.run(n,o)}}),zm=b("$ZodExactOptional",(e,t)=>{fc.init(e,t),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,o)=>t.innerType._zod.run(n,o)}),Fm=b("$ZodNullable",(e,t)=>{J.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Wi(n.source)}|null)$`):void 0}),ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>n.value===null?n:t.innerType._zod.run(n,o)}),Mm=b("$ZodDefault",(e,t)=>{J.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(i=>mk(i,t)):mk(r,t)}});function mk(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Bm=b("$ZodPrefault",(e,t)=>{J.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>(o.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,o))}),Hm=b("$ZodNonOptional",(e,t)=>{J.init(e,t),ne(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,o)=>{let r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(i=>fk(i,e)):fk(r,e)}});function fk(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Gm=b("$ZodSuccess",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Yn("ZodSuccess");let r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(i=>(n.value=i.issues.length===0,n)):(n.value=r.issues.length===0,n)}}),Wm=b("$ZodCatch",(e,t)=>{J.init(e,t),e._zod.optin="optional",ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>We(s,o,Ce()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=r.value,r.issues.length&&(n.value=t.catchValue({...n,error:{issues:r.issues.map(i=>We(i,o,Ce()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Zm=b("$ZodNaN",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),gc=b("$ZodPipe",(e,t)=>{J.init(e,t),ne(e._zod,"values",()=>t.in._zod.values),ne(e._zod,"optin",()=>t.in._zod.optin),ne(e._zod,"optout",()=>t.out._zod.optout),ne(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(n,o);return i instanceof Promise?i.then(s=>ac(s,t.in,o)):ac(i,t.in,o)}let r=t.in._zod.run(n,o);return r instanceof Promise?r.then(i=>ac(i,t.out,o)):ac(r,t.out,o)}});function ac(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var rs=b("$ZodCodec",(e,t)=>{J.init(e,t),ne(e._zod,"values",()=>t.in._zod.values),ne(e._zod,"optin",()=>t.in._zod.optin),ne(e._zod,"optout",()=>t.out._zod.optout),ne(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(n,o);return i instanceof Promise?i.then(s=>cc(s,t,o)):cc(i,t,o)}else{let i=t.out._zod.run(n,o);return i instanceof Promise?i.then(s=>cc(s,t,o)):cc(i,t,o)}}});function cc(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let r=t.transform(e.value,e);return r instanceof Promise?r.then(i=>lc(e,i,t.out,n)):lc(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(i=>lc(e,i,t.in,n)):lc(e,r,t.in,n)}}function lc(e,t,n,o){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},o)}var Vm=b("$ZodPreprocess",(e,t)=>{gc.init(e,t)}),qm=b("$ZodReadonly",(e,t)=>{J.init(e,t),ne(e._zod,"propValues",()=>t.innerType._zod.propValues),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"optin",()=>t.innerType?._zod?.optin),ne(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(gk):gk(r)}});function gk(e){return e.value=Object.freeze(e.value),e}var Jm=b("$ZodTemplateLiteral",(e,t)=>{J.init(e,t);let n=[];for(let o of t.parts)if(typeof o=="object"&&o!==null){if(!o._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let r=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!r)throw new Error(`Invalid template literal part: ${o._zod.traits}`);let i=r.startsWith("^")?1:0,s=r.endsWith("$")?r.length-1:r.length;n.push(r.slice(i,s))}else if(o===null||Md.has(typeof o))n.push(St(`${o}`));else throw new Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(o,r)=>typeof o.value!="string"?(o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(o.value)||o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o)}),Km=b("$ZodFunction",(e,t)=>(J.init(e,t),e._def=t,e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return function(...o){let r=e._def.input?Va(e._def.input,o):o,i=Reflect.apply(n,this,r);return e._def.output?Va(e._def.output,i):i}},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return async function(...o){let r=e._def.input?await qa(e._def.input,o):o,i=await Reflect.apply(n,this,r);return e._def.output?await qa(e._def.output,i):i}},e._zod.parse=(n,o)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let o=e.constructor;return Array.isArray(n[0])?new o({type:"function",input:new mc({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new o({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let o=e.constructor;return new o({type:"function",input:e._def.input,output:n})},e)),Xm=b("$ZodPromise",(e,t)=>{J.init(e,t),e._zod.parse=(n,o)=>Promise.resolve(n.value).then(r=>t.innerType._zod.run({value:r,issues:[]},o))}),Ym=b("$ZodLazy",(e,t)=>{J.init(e,t),ne(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),ne(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ne(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ne(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ne(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,o)=>e._zod.innerType._zod.run(n,o)}),Qm=b("$ZodCustom",(e,t)=>{be.init(e,t),J.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=n=>{let o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then(i=>hk(i,n,o,e));hk(r,n,o,e)}});function hk(e,t,n,o){if(!e){let r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(r.params=o._zod.def.params),t.issues.push(ko(r))}}var is={};fn(is,{ar:()=>wk,az:()=>Sk,be:()=>$k,bg:()=>Ek,ca:()=>Ak,cs:()=>Ik,da:()=>Ck,de:()=>Pk,el:()=>Tk,en:()=>hc,eo:()=>Rk,es:()=>Ok,fa:()=>Dk,fi:()=>Nk,fr:()=>Lk,frCA:()=>Uk,he:()=>jk,hr:()=>zk,hu:()=>Fk,hy:()=>Bk,id:()=>Hk,is:()=>Gk,it:()=>Wk,ja:()=>Zk,ka:()=>Vk,kh:()=>qk,km:()=>vc,ko:()=>Jk,lt:()=>Xk,mk:()=>Yk,ms:()=>Qk,nl:()=>ew,no:()=>tw,ota:()=>nw,pl:()=>ow,ps:()=>rw,pt:()=>iw,ro:()=>sw,ru:()=>cw,sl:()=>lw,sv:()=>uw,ta:()=>dw,th:()=>pw,tr:()=>mw,ua:()=>fw,uk:()=>yc,ur:()=>gw,uz:()=>hw,vi:()=>vw,yo:()=>xw,zhCN:()=>yw,zhTW:()=>bw});var w1=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(r){return e[r]??null}let n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},o={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${r.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${i}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`}case"invalid_value":return r.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${C(r.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${r.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${r.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${r.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${r.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${r.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${r.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${r.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${n[i.format]??r.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${r.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${r.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${r.keys.length>1?"\u0629":""}: ${w(r.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${r.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${r.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function wk(){return{localeError:w1()}}var S1=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(r){return e[r]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${r.expected}, daxil olan ${a}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${i}, daxil olan ${a}`}case"invalid_value":return r.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${C(r.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${r.origin??"d\u0259y\u0259r"} ${i}${r.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${r.origin??"d\u0259y\u0259r"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${r.origin} ${i}${r.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[i.format]??r.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${r.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${r.keys.length>1?"lar":""}: ${w(r.keys,", ")}`;case"invalid_key":return`${r.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${r.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function Sk(){return{localeError:S1()}}function _k(e,t,n,o){let r=Math.abs(e),i=r%10,s=r%100;return s>=11&&s<=19?o:i===1?t:i>=2&&i<=4?n:o}var _1=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(r){return e[r]??null}let n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},o={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${r.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${i}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`}case"invalid_value":return r.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${C(r.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s){let a=Number(r.maximum),l=_k(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${r.maximum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s){let a=Number(r.minimum),l=_k(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${r.minimum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[i.format]??r.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${r.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${w(r.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${r.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${r.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function $k(){return{localeError:_1()}}var $1=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(r){return e[r]??null}let n={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${r.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`}case"invalid_value":return r.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${C(r.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${r.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${r.minimum.toString()} ${s.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${r.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;if(i.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${i.prefix}"`;if(i.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${i.suffix}"`;if(i.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${i.includes}"`;if(i.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${i.pattern}`;let s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return i.format==="emoji"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="datetime"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="date"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),i.format==="time"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="duration"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${s} ${n[i.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${r.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${r.keys.length>1?"\u043E\u0432\u0435":""}: ${w(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${r.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function Ek(){return{localeError:$1()}}var E1=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(r){return e[r]??null}let n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${r.expected}, s'ha rebut ${a}`:`Tipus inv\xE0lid: s'esperava ${i}, s'ha rebut ${a}`}case"invalid_value":return r.values.length===1?`Valor inv\xE0lid: s'esperava ${C(r.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${w(r.values," o ")}`;case"too_big":{let i=r.inclusive?"com a m\xE0xim":"menys de",s=t(r.origin);return s?`Massa gran: s'esperava que ${r.origin??"el valor"} contingu\xE9s ${i} ${r.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${r.origin??"el valor"} fos ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"com a m\xEDnim":"m\xE9s de",s=t(r.origin);return s?`Massa petit: s'esperava que ${r.origin} contingu\xE9s ${i} ${r.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${r.origin} fos ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${n[i.format]??r.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${r.divisor}`;case"unrecognized_keys":return`Clau${r.keys.length>1?"s":""} no reconeguda${r.keys.length>1?"s":""}: ${w(r.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${r.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${r.origin}`;default:return"Entrada inv\xE0lida"}}};function Ak(){return{localeError:E1()}}var A1=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(r){return e[r]??null}let n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${r.expected}, obdr\u017Eeno ${a}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${i}, obdr\u017Eeno ${a}`}case"invalid_value":return r.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${C(r.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${r.origin??"hodnota"} mus\xED m\xEDt ${i}${r.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${r.origin??"hodnota"} mus\xED b\xFDt ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${r.origin??"hodnota"} mus\xED m\xEDt ${i}${r.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${r.origin??"hodnota"} mus\xED b\xFDt ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${n[i.format]??r.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${r.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${w(r.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${r.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${r.origin}`;default:return"Neplatn\xFD vstup"}}};function Ik(){return{localeError:A1()}}var I1=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(r){return e[r]??null}let n={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Ugyldigt input: forventede instanceof ${r.expected}, fik ${a}`:`Ugyldigt input: forventede ${i}, fik ${a}`}case"invalid_value":return r.values.length===1?`Ugyldig v\xE6rdi: forventede ${C(r.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin),a=o[r.origin]??r.origin;return s?`For stor: forventede ${a??"value"} ${s.verb} ${i} ${r.maximum.toString()} ${s.unit??"elementer"}`:`For stor: forventede ${a??"value"} havde ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin),a=o[r.origin]??r.origin;return s?`For lille: forventede ${a} ${s.verb} ${i} ${r.minimum.toString()} ${s.unit}`:`For lille: forventede ${a} havde ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Ugyldig streng: skal starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: skal ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: skal indeholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${n[i.format]??r.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${w(r.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${r.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${r.origin}`;default:return"Ugyldigt input"}}};function Ck(){return{localeError:I1()}}var C1=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(r){return e[r]??null}let n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},o={nan:"NaN",number:"Zahl",array:"Array"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${r.expected}, erhalten ${a}`:`Ung\xFCltige Eingabe: erwartet ${i}, erhalten ${a}`}case"invalid_value":return r.values.length===1?`Ung\xFCltige Eingabe: erwartet ${C(r.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Zu gro\xDF: erwartet, dass ${r.origin??"Wert"} ${i}${r.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${r.origin??"Wert"} ${i}${r.maximum.toString()} ist`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Zu klein: erwartet, dass ${r.origin} ${i}${r.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${r.origin} ${i}${r.minimum.toString()} ist`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${n[i.format]??r.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${r.divisor} sein`;case"unrecognized_keys":return`${r.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${w(r.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${r.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${r.origin}`;default:return"Ung\xFCltige Eingabe"}}};function Pk(){return{localeError:C1()}}var P1=()=>{let e={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function t(r){return e[r]??null}let n={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},o={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return typeof r.expected=="string"&&/^[A-Z]/.test(r.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${r.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`}case"invalid_value":return r.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${C(r.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${i}${r.maximum.toString()} ${s.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${i}${r.minimum.toString()} ${s.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${i.prefix}"`:i.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${i.suffix}"`:i.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${i.includes}"`:i.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${i.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${n[i.format]??r.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${r.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${r.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${r.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${w(r.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${r.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${r.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function Tk(){return{localeError:P1()}}var T1=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(r){return e[r]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return`Invalid input: expected ${i}, received ${a}`}case"invalid_value":return r.values.length===1?`Invalid input: expected ${C(r.values[0])}`:`Invalid option: expected one of ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Too big: expected ${r.origin??"value"} to have ${i}${r.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${r.origin??"value"} to be ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Too small: expected ${r.origin} to have ${i}${r.minimum.toString()} ${s.unit}`:`Too small: expected ${r.origin} to be ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${n[i.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${w(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return r.options&&Array.isArray(r.options)&&r.options.length>0?`Invalid discriminator value. Expected ${r.options.map(s=>`'${s}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function hc(){return{localeError:T1()}}var R1=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(r){return e[r]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${r.expected}, ricevi\u011Dis ${a}`:`Nevalida enigo: atendi\u011Dis ${i}, ricevi\u011Dis ${a}`}case"invalid_value":return r.values.length===1?`Nevalida enigo: atendi\u011Dis ${C(r.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Tro granda: atendi\u011Dis ke ${r.origin??"valoro"} havu ${i}${r.maximum.toString()} ${s.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${r.origin??"valoro"} havu ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Tro malgranda: atendi\u011Dis ke ${r.origin} havu ${i}${r.minimum.toString()} ${s.unit}`:`Tro malgranda: atendi\u011Dis ke ${r.origin} estu ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${i.prefix}"`:i.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${i.suffix}"`:i.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${i.includes}"`:i.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${i.pattern}`:`Nevalida ${n[i.format]??r.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${r.divisor}`;case"unrecognized_keys":return`Nekonata${r.keys.length>1?"j":""} \u015Dlosilo${r.keys.length>1?"j":""}: ${w(r.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${r.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${r.origin}`;default:return"Nevalida enigo"}}};function Rk(){return{localeError:R1()}}var O1=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(r){return e[r]??null}let n={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${r.expected}, recibido ${a}`:`Entrada inv\xE1lida: se esperaba ${i}, recibido ${a}`}case"invalid_value":return r.values.length===1?`Entrada inv\xE1lida: se esperaba ${C(r.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin),a=o[r.origin]??r.origin;return s?`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${i}${r.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: se esperaba que ${a??"valor"} fuera ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin),a=o[r.origin]??r.origin;return s?`Demasiado peque\xF1o: se esperaba que ${a} tuviera ${i}${r.minimum.toString()} ${s.unit}`:`Demasiado peque\xF1o: se esperaba que ${a} fuera ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${i.prefix}"`:i.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${i.suffix}"`:i.format==="includes"?`Cadena inv\xE1lida: debe incluir "${i.includes}"`:i.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${i.pattern}`:`Inv\xE1lido ${n[i.format]??r.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${r.divisor}`;case"unrecognized_keys":return`Llave${r.keys.length>1?"s":""} desconocida${r.keys.length>1?"s":""}: ${w(r.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${o[r.origin]??r.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${o[r.origin]??r.origin}`;default:return"Entrada inv\xE1lida"}}};function Ok(){return{localeError:O1()}}var D1=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(r){return e[r]??null}let n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${r.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${i} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return r.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${C(r.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${w(r.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${r.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${r.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${r.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${r.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${r.origin} \u0628\u0627\u06CC\u062F ${i}${r.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${r.origin} \u0628\u0627\u06CC\u062F ${i}${r.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[i.format]??r.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${r.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${r.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${w(r.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${r.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${r.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function Dk(){return{localeError:D1()}}var N1=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(r){return e[r]??null}let n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Virheellinen tyyppi: odotettiin instanceof ${r.expected}, oli ${a}`:`Virheellinen tyyppi: odotettiin ${i}, oli ${a}`}case"invalid_value":return r.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${C(r.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${r.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${r.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${n[i.format]??r.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${r.divisor} monikerta`;case"unrecognized_keys":return`${r.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${w(r.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function Nk(){return{localeError:N1()}}var L1=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(r){return e[r]??null}let n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},o={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Entr\xE9e invalide : instanceof ${r.expected} attendu, ${a} re\xE7u`:`Entr\xE9e invalide : ${i} attendu, ${a} re\xE7u`}case"invalid_value":return r.values.length===1?`Entr\xE9e invalide : ${C(r.values[0])} attendu`:`Option invalide : une valeur parmi ${w(r.values,"|")} attendue`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Trop grand : ${o[r.origin]??"valeur"} doit ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o[r.origin]??"valeur"} doit \xEAtre ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Trop petit : ${o[r.origin]??"valeur"} doit ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`:`Trop petit : ${o[r.origin]??"valeur"} doit \xEAtre ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${n[i.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${r.divisor}`;case"unrecognized_keys":return`Cl\xE9${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${w(r.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${r.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entr\xE9e invalide"}}};function Lk(){return{localeError:L1()}}var U1=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(r){return e[r]??null}let n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},o={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Entr\xE9e invalide : attendu instanceof ${r.expected}, re\xE7u ${a}`:`Entr\xE9e invalide : attendu ${i}, re\xE7u ${a}`}case"invalid_value":return r.values.length===1?`Entr\xE9e invalide : attendu ${C(r.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"\u2264":"<",s=t(r.origin);return s?`Trop grand : attendu que ${r.origin??"la valeur"} ait ${i}${r.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${r.origin??"la valeur"} soit ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"\u2265":">",s=t(r.origin);return s?`Trop petit : attendu que ${r.origin} ait ${i}${r.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${r.origin} soit ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${n[i.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${r.divisor}`;case"unrecognized_keys":return`Cl\xE9${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${w(r.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${r.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entr\xE9e invalide"}}};function Uk(){return{localeError:U1()}}var j1=()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},n=u=>u?e[u]:void 0,o=u=>{let d=n(u);return d?d.label:u??e.unknown.label},r=u=>`\u05D4${o(u)}`,i=u=>(n(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=u=>u?t[u]??null:null,a={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},l={nan:"NaN"};return u=>{switch(u.code){case"invalid_type":{let d=u.expected,p=l[d??""]??o(d),m=P(u.input),f=l[m]??e[m]?.label??m;return/^[A-Z]/.test(u.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${u.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${p}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${C(u.values[0])}`;let d=u.values.map(f=>C(f));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${d[0]} \u05D0\u05D5 ${d[1]}`;let p=d[d.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${d.slice(0,-1).join(", ")} \u05D0\u05D5 ${p}`}case"too_big":{let d=s(u.origin),p=r(u.origin??"value");if(u.origin==="string")return`${d?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${d?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let g=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${g}`}if(u.origin==="array"||u.origin==="set"){let g=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=u.inclusive?`${u.maximum} ${d?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${d?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${p} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let m=u.inclusive?"<=":"<",f=i(u.origin??"value");return d?.unit?`${d.longLabel} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.maximum.toString()} ${d.unit}`:`${d?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.maximum.toString()}`}case"too_small":{let d=s(u.origin),p=r(u.origin??"value");if(u.origin==="string")return`${d?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${d?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let g=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${g}`}if(u.origin==="array"||u.origin==="set"){let g=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let y=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`}let h=u.inclusive?`${u.minimum} ${d?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${d?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let m=u.inclusive?">=":">",f=i(u.origin??"value");return d?.unit?`${d.shortLabel} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.minimum.toString()} ${d.unit}`:`${d?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.minimum.toString()}`}case"invalid_format":{let d=u;if(d.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${d.prefix}"`;if(d.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${d.suffix}"`;if(d.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${d.includes}"`;if(d.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${d.pattern}`;let p=a[d.format],m=p?.label??d.format,g=(p?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${m} \u05DC\u05D0 ${g}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${w(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${r(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function jk(){return{localeError:j1()}}var z1=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(r){return e[r]??null}let n={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},o={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${r.expected}, a primljeno je ${a}`:`Neispravan unos: o\u010Dekuje se ${i}, a primljeno je ${a}`}case"invalid_value":return r.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${C(r.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin),a=o[r.origin]??r.origin;return s?`Preveliko: o\u010Dekivano da ${a??"vrijednost"} ima ${i}${r.maximum.toString()} ${s.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${a??"vrijednost"} bude ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin),a=o[r.origin]??r.origin;return s?`Premalo: o\u010Dekivano da ${a} ima ${i}${r.minimum.toString()} ${s.unit}`:`Premalo: o\u010Dekivano da ${a} bude ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${i.prefix}"`:i.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${i.suffix}"`:i.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${i.includes}"`:i.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${i.pattern}`:`Neispravna ${n[i.format]??r.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${r.divisor}`;case"unrecognized_keys":return`Neprepoznat${r.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${w(r.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${o[r.origin]??r.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${o[r.origin]??r.origin}`;default:return"Neispravan unos"}}};function zk(){return{localeError:z1()}}var F1=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(r){return e[r]??null}let n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${r.expected}, a kapott \xE9rt\xE9k ${a}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${i}, a kapott \xE9rt\xE9k ${a}`}case"invalid_value":return r.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${C(r.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`T\xFAl nagy: ${r.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${r.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${r.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${r.origin} m\xE9rete t\xFAl kicsi ${i}${r.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${r.origin} t\xFAl kicsi ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[i.format]??r.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${r.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${r.keys.length>1?"s":""}: ${w(r.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${r.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${r.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function Fk(){return{localeError:F1()}}function Mk(e,t,n){return Math.abs(e)===1?t:n}function Ao(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],n=e[e.length-1];return e+(t.includes(n)?"\u0576":"\u0568")}var M1=()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(r){return e[r]??null}let n={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},o={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${r.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${i}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`}case"invalid_value":return r.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${C(r.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s){let a=Number(r.maximum),l=Mk(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ao(r.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${r.maximum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ao(r.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s){let a=Number(r.minimum),l=Mk(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ao(r.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${r.minimum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ao(r.origin)} \u056C\u056B\u0576\u056B ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${i.prefix}"-\u0578\u057E`:i.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${i.suffix}"-\u0578\u057E`:i.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${i.includes}"`:i.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${i.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${n[i.format]??r.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${r.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${r.keys.length>1?"\u0576\u0565\u0580":""}. ${w(r.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${Ao(r.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${Ao(r.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function Bk(){return{localeError:M1()}}var B1=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(r){return e[r]??null}let n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Input tidak valid: diharapkan instanceof ${r.expected}, diterima ${a}`:`Input tidak valid: diharapkan ${i}, diterima ${a}`}case"invalid_value":return r.values.length===1?`Input tidak valid: diharapkan ${C(r.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Terlalu besar: diharapkan ${r.origin??"value"} memiliki ${i}${r.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${r.origin??"value"} menjadi ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Terlalu kecil: diharapkan ${r.origin} memiliki ${i}${r.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${r.origin} menjadi ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${n[i.format]??r.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${r.keys.length>1?"s":""}: ${w(r.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${r.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${r.origin}`;default:return"Input tidak valid"}}};function Hk(){return{localeError:B1()}}var H1=()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function t(r){return e[r]??null}let n={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"n\xFAmer",array:"fylki"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera instanceof ${r.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera ${i}`}case"invalid_value":return r.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${C(r.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin??"gildi"} hafi ${i}${r.maximum.toString()} ${s.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin??"gildi"} s\xE9 ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin} hafi ${i}${r.minimum.toString()} ${s.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${r.origin} s\xE9 ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${i.prefix}"`:i.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${i.suffix}"`:i.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${i.includes}"`:i.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${i.pattern}`:`Rangt ${n[i.format]??r.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${r.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${r.keys.length>1?"ir lyklar":"ur lykill"}: ${w(r.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${r.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${r.origin}`;default:return"Rangt gildi"}}};function Gk(){return{localeError:H1()}}var G1=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(r){return e[r]??null}let n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"numero",array:"vettore"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Input non valido: atteso instanceof ${r.expected}, ricevuto ${a}`:`Input non valido: atteso ${i}, ricevuto ${a}`}case"invalid_value":return r.values.length===1?`Input non valido: atteso ${C(r.values[0])}`:`Opzione non valida: atteso uno tra ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Troppo grande: ${r.origin??"valore"} deve avere ${i}${r.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${r.origin??"valore"} deve essere ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Troppo piccolo: ${r.origin} deve avere ${i}${r.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${r.origin} deve essere ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Input non valido: ${n[i.format]??r.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${r.divisor}`;case"unrecognized_keys":return`Chiav${r.keys.length>1?"i":"e"} non riconosciut${r.keys.length>1?"e":"a"}: ${w(r.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${r.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${r.origin}`;default:return"Input non valido"}}};function Wk(){return{localeError:G1()}}var W1=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(r){return e[r]??null}let n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},o={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${r.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${i}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return r.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${C(r.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${w(r.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=r.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=t(r.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${r.origin??"\u5024"}\u306F${r.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${r.origin??"\u5024"}\u306F${r.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=r.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=t(r.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${r.origin}\u306F${r.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${r.origin}\u306F${r.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[i.format]??r.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${r.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${r.keys.length>1?"\u7FA4":""}: ${w(r.keys,"\u3001")}`;case"invalid_key":return`${r.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${r.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function Zk(){return{localeError:W1()}}var Z1=()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(r){return e[r]??null}let n={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},o={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${r.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`}case"invalid_value":return r.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${C(r.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${w(r.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r.origin} \u10D8\u10E7\u10DD\u10E1 ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.prefix}"-\u10D8\u10D7`:i.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.suffix}"-\u10D8\u10D7`:i.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${i.includes}"-\u10E1`:i.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${i.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${n[i.format]??r.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${r.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${r.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${w(r.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${r.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${r.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function Vk(){return{localeError:Z1()}}var V1=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(r){return e[r]??null}let n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},o={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${r.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`}case"invalid_value":return r.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${C(r.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${r.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin} ${i} ${r.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin} ${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[i.format]??r.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${r.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${w(r.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${r.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${r.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function vc(){return{localeError:V1()}}function qk(){return vc()}var q1=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function t(r){return e[r]??null}let n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},o={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${r.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${i}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`}case"invalid_value":return r.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${C(r.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${w(r.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=r.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(r.origin),l=a?.unit??"\uC694\uC18C";return a?`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${r.maximum.toString()}${l} ${i}${s}`:`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${r.maximum.toString()} ${i}${s}`}case"too_small":{let i=r.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(r.origin),l=a?.unit??"\uC694\uC18C";return a?`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${r.minimum.toString()}${l} ${i}${s}`:`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${r.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[i.format]??r.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${r.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${w(r.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${r.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${r.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function Jk(){return{localeError:q1()}}var os=e=>e.charAt(0).toUpperCase()+e.slice(1);function Kk(e){let t=Math.abs(e),n=t%10,o=t%100;return o>=11&&o<=19||n===0?"many":n===1?"one":"few"}var J1=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(r,i,s,a){let l=e[r]??null;return l===null?l:{unit:l.unit[i],verb:l.verb[a][s?"inclusive":"notInclusive"]}}let n={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},o={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Gautas tipas ${a}, o tik\u0117tasi - instanceof ${r.expected}`:`Gautas tipas ${a}, o tik\u0117tasi - ${i}`}case"invalid_value":return r.values.length===1?`Privalo b\u016Bti ${C(r.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${w(r.values,"|")} pasirinkim\u0173`;case"too_big":{let i=o[r.origin]??r.origin,s=t(r.origin,Kk(Number(r.maximum)),r.inclusive??!1,"smaller");if(s?.verb)return`${os(i??r.origin??"reik\u0161m\u0117")} ${s.verb} ${r.maximum.toString()} ${s.unit??"element\u0173"}`;let a=r.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${os(i??r.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${r.maximum.toString()} ${s?.unit}`}case"too_small":{let i=o[r.origin]??r.origin,s=t(r.origin,Kk(Number(r.minimum)),r.inclusive??!1,"bigger");if(s?.verb)return`${os(i??r.origin??"reik\u0161m\u0117")} ${s.verb} ${r.minimum.toString()} ${s.unit??"element\u0173"}`;let a=r.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${os(i??r.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${r.minimum.toString()} ${s?.unit}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${i.prefix}"`:i.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${i.suffix}"`:i.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${i.includes}"`:i.format==="regex"?`Eilut\u0117 privalo atitikti ${i.pattern}`:`Neteisingas ${n[i.format]??r.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${r.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${r.keys.length>1?"i":"as"} rakt${r.keys.length>1?"ai":"as"}: ${w(r.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let i=o[r.origin]??r.origin;return`${os(i??r.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function Xk(){return{localeError:J1()}}var K1=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(r){return e[r]??null}let n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},o={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${r.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`}case"invalid_value":return r.values.length===1?`Invalid input: expected ${C(r.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${r.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${r.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${n[i.format]??r.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${w(r.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${r.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${r.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function Yk(){return{localeError:K1()}}var X1=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(r){return e[r]??null}let n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"nombor"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Input tidak sah: dijangka instanceof ${r.expected}, diterima ${a}`:`Input tidak sah: dijangka ${i}, diterima ${a}`}case"invalid_value":return r.values.length===1?`Input tidak sah: dijangka ${C(r.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Terlalu besar: dijangka ${r.origin??"nilai"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${r.origin??"nilai"} adalah ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Terlalu kecil: dijangka ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${r.origin} adalah ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${n[i.format]??r.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${w(r.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${r.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${r.origin}`;default:return"Input tidak sah"}}};function Qk(){return{localeError:X1()}}var Y1=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(r){return e[r]??null}let n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},o={nan:"NaN",number:"getal"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Ongeldige invoer: verwacht instanceof ${r.expected}, ontving ${a}`:`Ongeldige invoer: verwacht ${i}, ontving ${a}`}case"invalid_value":return r.values.length===1?`Ongeldige invoer: verwacht ${C(r.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin),a=r.origin==="date"?"laat":r.origin==="string"?"lang":"groot";return s?`Te ${a}: verwacht dat ${r.origin??"waarde"} ${i}${r.maximum.toString()} ${s.unit??"elementen"} ${s.verb}`:`Te ${a}: verwacht dat ${r.origin??"waarde"} ${i}${r.maximum.toString()} is`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin),a=r.origin==="date"?"vroeg":r.origin==="string"?"kort":"klein";return s?`Te ${a}: verwacht dat ${r.origin} ${i}${r.minimum.toString()} ${s.unit} ${s.verb}`:`Te ${a}: verwacht dat ${r.origin} ${i}${r.minimum.toString()} is`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${n[i.format]??r.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${r.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${r.keys.length>1?"s":""}: ${w(r.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${r.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${r.origin}`;default:return"Ongeldige invoer"}}};function ew(){return{localeError:Y1()}}var Q1=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function t(r){return e[r]??null}let n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Ugyldig input: forventet instanceof ${r.expected}, fikk ${a}`:`Ugyldig input: forventet ${i}, fikk ${a}`}case"invalid_value":return r.values.length===1?`Ugyldig verdi: forventet ${C(r.values[0])}`:`Ugyldig valg: forventet en av ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`For stor(t): forventet ${r.origin??"value"} til \xE5 ha ${i}${r.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${r.origin??"value"} til \xE5 ha ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`For lite(n): forventet ${r.origin} til \xE5 ha ${i}${r.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${r.origin} til \xE5 ha ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${n[i.format]??r.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${w(r.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${r.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${r.origin}`;default:return"Ugyldig input"}}};function tw(){return{localeError:Q1()}}var eO=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(r){return e[r]??null}let n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`F\xE2sit giren: umulan instanceof ${r.expected}, al\u0131nan ${a}`:`F\xE2sit giren: umulan ${i}, al\u0131nan ${a}`}case"invalid_value":return r.values.length===1?`F\xE2sit giren: umulan ${C(r.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Fazla b\xFCy\xFCk: ${r.origin??"value"}, ${i}${r.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${r.origin??"value"}, ${i}${r.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Fazla k\xFC\xE7\xFCk: ${r.origin}, ${i}${r.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${r.origin}, ${i}${r.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=r;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[i.format]??r.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${r.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${r.keys.length>1?"s":""}: ${w(r.keys,", ")}`;case"invalid_key":return`${r.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${r.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function nw(){return{localeError:eO()}}var tO=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(r){return e[r]??null}let n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${r.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${i} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return r.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${C(r.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${w(r.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${r.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${r.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${r.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${r.maximum.toString()} \u0648\u064A`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${r.origin} \u0628\u0627\u06CC\u062F ${i}${r.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${r.origin} \u0628\u0627\u06CC\u062F ${i}${r.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[i.format]??r.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${r.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${r.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${w(r.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${r.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${r.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function rw(){return{localeError:tO()}}var nO=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function t(r){return e[r]??null}let n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},o={nan:"NaN",number:"liczba",array:"tablica"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${r.expected}, otrzymano ${a}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${i}, otrzymano ${a}`}case"invalid_value":return r.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${C(r.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${r.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${r.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[i.format]??r.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${r.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${r.keys.length>1?"s":""}: ${w(r.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${r.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${r.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function ow(){return{localeError:nO()}}var rO=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(r){return e[r]??null}let n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",number:"n\xFAmero",null:"nulo"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Tipo inv\xE1lido: esperado instanceof ${r.expected}, recebido ${a}`:`Tipo inv\xE1lido: esperado ${i}, recebido ${a}`}case"invalid_value":return r.values.length===1?`Entrada inv\xE1lida: esperado ${C(r.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Muito grande: esperado que ${r.origin??"valor"} tivesse ${i}${r.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${r.origin??"valor"} fosse ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Muito pequeno: esperado que ${r.origin} tivesse ${i}${r.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${r.origin} fosse ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${n[i.format]??r.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${r.divisor}`;case"unrecognized_keys":return`Chave${r.keys.length>1?"s":""} desconhecida${r.keys.length>1?"s":""}: ${w(r.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${r.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${r.origin}`;default:return"Campo inv\xE1lido"}}};function iw(){return{localeError:rO()}}var oO=()=>{let e={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function t(r){return e[r]??null}let n={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},o={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return`Intrare invalid\u0103: a\u0219teptat ${i}, primit ${a}`}case"invalid_value":return r.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${C(r.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Prea mare: a\u0219teptat ca ${r.origin??"valoarea"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${r.origin??"valoarea"} s\u0103 fie ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Prea mic: a\u0219teptat ca ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`:`Prea mic: a\u0219teptat ca ${r.origin} s\u0103 fie ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${i.prefix}"`:i.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${i.suffix}"`:i.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${i.includes}"`:i.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${i.pattern}`:`Format invalid: ${n[i.format]??r.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${r.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${w(r.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${r.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${r.origin}`;default:return"Intrare invalid\u0103"}}};function sw(){return{localeError:oO()}}function aw(e,t,n,o){let r=Math.abs(e),i=r%10,s=r%100;return s>=11&&s<=19?o:i===1?t:i>=2&&i<=4?n:o}var iO=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(r){return e[r]??null}let n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${r.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`}case"invalid_value":return r.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${C(r.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);if(s){let a=Number(r.maximum),l=aw(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${r.maximum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);if(s){let a=Number(r.minimum),l=aw(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${r.minimum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[i.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${r.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${r.keys.length>1?"\u0438":""}: ${w(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${r.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function cw(){return{localeError:iO()}}var sO=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(r){return e[r]??null}let n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${r.expected}, prejeto ${a}`:`Neveljaven vnos: pri\u010Dakovano ${i}, prejeto ${a}`}case"invalid_value":return r.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${C(r.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${r.origin??"vrednost"} imelo ${i}${r.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${r.origin??"vrednost"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${r.origin} imelo ${i}${r.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${n[i.format]??r.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${r.divisor}`;case"unrecognized_keys":return`Neprepoznan${r.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${w(r.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${r.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${r.origin}`;default:return"Neveljaven vnos"}}};function lw(){return{localeError:sO()}}var aO=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(r){return e[r]??null}let n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${r.expected}, fick ${a}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${i}, fick ${a}`}case"invalid_value":return r.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${C(r.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${i}${r.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${r.origin??"v\xE4rdet"} att ha ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${i}${r.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${n[i.format]??r.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${w(r.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${r.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${r.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function uw(){return{localeError:aO()}}var cO=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(r){return e[r]??null}let n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${r.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`}case"invalid_value":return r.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${C(r.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${w(r.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${r.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${r.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin} ${i}${r.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin} ${i}${r.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[i.format]??r.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${r.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${r.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${w(r.keys,", ")}`;case"invalid_key":return`${r.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${r.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function dw(){return{localeError:cO()}}var lO=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(r){return e[r]??null}let n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},o={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${r.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${i} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`}case"invalid_value":return r.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${C(r.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=t(r.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${r.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=t(r.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${r.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[i.format]??r.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${r.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${w(r.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${r.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${r.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function pw(){return{localeError:lO()}}var uO=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(r){return e[r]??null}let n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},o={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${r.expected}, al\u0131nan ${a}`:`Ge\xE7ersiz de\u011Fer: beklenen ${i}, al\u0131nan ${a}`}case"invalid_value":return r.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${C(r.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\xC7ok b\xFCy\xFCk: beklenen ${r.origin??"de\u011Fer"} ${i}${r.maximum.toString()} ${s.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${r.origin??"de\u011Fer"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\xC7ok k\xFC\xE7\xFCk: beklenen ${r.origin} ${i}${r.minimum.toString()} ${s.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Ge\xE7ersiz metin: "${i.prefix}" ile ba\u015Flamal\u0131`:i.format==="ends_with"?`Ge\xE7ersiz metin: "${i.suffix}" ile bitmeli`:i.format==="includes"?`Ge\xE7ersiz metin: "${i.includes}" i\xE7ermeli`:i.format==="regex"?`Ge\xE7ersiz metin: ${i.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${n[i.format]??r.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${r.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${r.keys.length>1?"lar":""}: ${w(r.keys,", ")}`;case"invalid_key":return`${r.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${r.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function mw(){return{localeError:uO()}}var dO=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(r){return e[r]??null}let n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${r.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${i}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`}case"invalid_value":return r.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${C(r.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin} \u0431\u0443\u0434\u0435 ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[i.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${r.keys.length>1?"\u0456":""}: ${w(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${r.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function yc(){return{localeError:dO()}}function fw(){return yc()}var pO=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(r){return e[r]??null}let n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},o={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${r.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${i} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return r.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${C(r.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${w(r.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${r.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${r.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${r.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${r.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${r.origin} \u06A9\u06D2 ${i}${r.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${r.origin} \u06A9\u0627 ${i}${r.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[i.format]??r.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${r.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${r.keys.length>1?"\u0632":""}: ${w(r.keys,"\u060C ")}`;case"invalid_key":return`${r.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${r.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function gw(){return{localeError:pO()}}var mO=()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function t(r){return e[r]??null}let n={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},o={nan:"NaN",number:"raqam",array:"massiv"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${r.expected}, qabul qilingan ${a}`:`Noto\u2018g\u2018ri kirish: kutilgan ${i}, qabul qilingan ${a}`}case"invalid_value":return r.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${C(r.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Juda katta: kutilgan ${r.origin??"qiymat"} ${i}${r.maximum.toString()} ${s.unit} ${s.verb}`:`Juda katta: kutilgan ${r.origin??"qiymat"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Juda kichik: kutilgan ${r.origin} ${i}${r.minimum.toString()} ${s.unit} ${s.verb}`:`Juda kichik: kutilgan ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${i.prefix}" bilan boshlanishi kerak`:i.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${i.suffix}" bilan tugashi kerak`:i.format==="includes"?`Noto\u2018g\u2018ri satr: "${i.includes}" ni o\u2018z ichiga olishi kerak`:i.format==="regex"?`Noto\u2018g\u2018ri satr: ${i.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${n[i.format]??r.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${r.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${r.keys.length>1?"lar":""}: ${w(r.keys,", ")}`;case"invalid_key":return`${r.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${r.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function hw(){return{localeError:mO()}}var fO=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(r){return e[r]??null}let n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},o={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${r.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${i}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`}case"invalid_value":return r.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${C(r.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${r.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${r.origin??"gi\xE1 tr\u1ECB"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${n[i.format]??r.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${r.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${w(r.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${r.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${r.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function vw(){return{localeError:fO()}}var gO=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function t(r){return e[r]??null}let n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},o={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${r.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${i}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`}case"invalid_value":return r.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${C(r.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${r.origin??"\u503C"} ${i}${r.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${r.origin??"\u503C"} ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${r.origin} ${i}${r.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${n[i.format]??r.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${r.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${w(r.keys,", ")}`;case"invalid_key":return`${r.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${r.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function yw(){return{localeError:gO()}}var hO=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(r){return e[r]??null}let n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},o={nan:"NaN"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${r.expected}\uFF0C\u4F46\u6536\u5230 ${a}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${i}\uFF0C\u4F46\u6536\u5230 ${a}`}case"invalid_value":return r.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${C(r.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${r.origin??"\u503C"} \u61C9\u70BA ${i}${r.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${r.origin??"\u503C"} \u61C9\u70BA ${i}${r.maximum.toString()}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${r.origin} \u61C9\u70BA ${i}${r.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${r.origin} \u61C9\u70BA ${i}${r.minimum.toString()}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${n[i.format]??r.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${r.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${r.keys.length>1?"\u5011":""}\uFF1A${w(r.keys,"\u3001")}`;case"invalid_key":return`${r.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${r.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function bw(){return{localeError:hO()}}var vO=()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function t(r){return e[r]??null}let n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},o={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return r=>{switch(r.code){case"invalid_type":{let i=o[r.expected]??r.expected,s=P(r.input),a=o[s]??s;return/^[A-Z]/.test(r.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${r.expected}, \xE0m\u1ECD\u0300 a r\xED ${a}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${i}, \xE0m\u1ECD\u0300 a r\xED ${a}`}case"invalid_value":return r.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${C(r.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${w(r.values,"|")}`;case"too_big":{let i=r.inclusive?"<=":"<",s=t(r.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${r.origin??"iye"} ${s.verb} ${i}${r.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${r.maximum}`}case"too_small":{let i=r.inclusive?">=":">",s=t(r.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${r.origin} ${s.verb} ${i}${r.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${r.minimum}`}case"invalid_format":{let i=r;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${n[i.format]??r.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${r.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${w(r.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${r.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${r.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function xw(){return{localeError:vO()}}var kw,ef=Symbol("ZodOutput"),tf=Symbol("ZodInput"),bc=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let o=n[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let o={...this.get(n)??{}};delete o.id;let r={...o,...this._map.get(t)};return Object.keys(r).length?r:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function xc(){return new bc}(kw=globalThis).__zod_globalRegistry??(kw.__zod_globalRegistry=xc());var Le=globalThis.__zod_globalRegistry;function nf(e,t){return new e({type:"string",...O(t)})}function rf(e,t){return new e({type:"string",coerce:!0,...O(t)})}function kc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function ss(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function wc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Sc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function _c(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function $c(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function as(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function Ec(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Ac(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function Ic(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function Cc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Pc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function Tc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function Rc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Oc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Dc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function of(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...O(t)})}function Nc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function Lc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function Uc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function jc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function zc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function Fc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}var sf={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function af(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function cf(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function lf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function uf(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function df(e,t){return new e({type:"number",checks:[],...O(t)})}function pf(e,t){return new e({type:"number",coerce:!0,checks:[],...O(t)})}function mf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function ff(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...O(t)})}function gf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...O(t)})}function hf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...O(t)})}function vf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...O(t)})}function yf(e,t){return new e({type:"boolean",...O(t)})}function bf(e,t){return new e({type:"boolean",coerce:!0,...O(t)})}function xf(e,t){return new e({type:"bigint",...O(t)})}function kf(e,t){return new e({type:"bigint",coerce:!0,...O(t)})}function wf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...O(t)})}function Sf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...O(t)})}function _f(e,t){return new e({type:"symbol",...O(t)})}function $f(e,t){return new e({type:"undefined",...O(t)})}function Ef(e,t){return new e({type:"null",...O(t)})}function Af(e){return new e({type:"any"})}function If(e){return new e({type:"unknown"})}function Cf(e,t){return new e({type:"never",...O(t)})}function Pf(e,t){return new e({type:"void",...O(t)})}function Tf(e,t){return new e({type:"date",...O(t)})}function Rf(e,t){return new e({type:"date",coerce:!0,...O(t)})}function Of(e,t){return new e({type:"nan",...O(t)})}function Kt(e,t){return new ic({check:"less_than",...O(t),value:e,inclusive:!1})}function pt(e,t){return new ic({check:"less_than",...O(t),value:e,inclusive:!0})}function Xt(e,t){return new sc({check:"greater_than",...O(t),value:e,inclusive:!1})}function Ze(e,t){return new sc({check:"greater_than",...O(t),value:e,inclusive:!0})}function Mc(e){return Xt(0,e)}function Bc(e){return Kt(0,e)}function Hc(e){return pt(0,e)}function Gc(e){return Ze(0,e)}function rr(e,t){return new $p({check:"multiple_of",...O(t),value:e})}function or(e,t){return new Ip({check:"max_size",...O(t),maximum:e})}function Yt(e,t){return new Cp({check:"min_size",...O(t),minimum:e})}function Pr(e,t){return new Pp({check:"size_equals",...O(t),size:e})}function Tr(e,t){return new Tp({check:"max_length",...O(t),maximum:e})}function wn(e,t){return new Rp({check:"min_length",...O(t),minimum:e})}function Rr(e,t){return new Op({check:"length_equals",...O(t),length:e})}function Io(e,t){return new Dp({check:"string_format",format:"regex",...O(t),pattern:e})}function Co(e){return new Np({check:"string_format",format:"lowercase",...O(e)})}function Po(e){return new Lp({check:"string_format",format:"uppercase",...O(e)})}function To(e,t){return new Up({check:"string_format",format:"includes",...O(t),includes:e})}function Ro(e,t){return new jp({check:"string_format",format:"starts_with",...O(t),prefix:e})}function Oo(e,t){return new zp({check:"string_format",format:"ends_with",...O(t),suffix:e})}function Wc(e,t,n){return new Fp({check:"property",property:e,schema:t,...O(n)})}function Do(e,t){return new Mp({check:"mime_type",mime:e,...O(t)})}function Lt(e){return new Bp({check:"overwrite",tx:e})}function No(e){return Lt(t=>t.normalize(e))}function Lo(){return Lt(e=>e.trim())}function Uo(){return Lt(e=>e.toLowerCase())}function jo(){return Lt(e=>e.toUpperCase())}function zo(){return Lt(e=>jd(e))}function Df(e,t,n){return new e({type:"array",element:t,...O(n)})}function bO(e,t,n){return new e({type:"union",options:t,...O(n)})}function xO(e,t,n){return new e({type:"union",options:t,inclusive:!1,...O(n)})}function kO(e,t,n,o){return new e({type:"union",options:n,discriminator:t,...O(o)})}function wO(e,t,n){return new e({type:"intersection",left:t,right:n})}function SO(e,t,n,o){let r=n instanceof J,i=r?o:n,s=r?n:null;return new e({type:"tuple",items:t,rest:s,...O(i)})}function _O(e,t,n,o){return new e({type:"record",keyType:t,valueType:n,...O(o)})}function $O(e,t,n,o){return new e({type:"map",keyType:t,valueType:n,...O(o)})}function EO(e,t,n){return new e({type:"set",valueType:t,...O(n)})}function AO(e,t,n){let o=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new e({type:"enum",entries:o,...O(n)})}function IO(e,t,n){return new e({type:"enum",entries:t,...O(n)})}function CO(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...O(n)})}function Nf(e,t){return new e({type:"file",...O(t)})}function PO(e,t){return new e({type:"transform",transform:t})}function TO(e,t){return new e({type:"optional",innerType:t})}function RO(e,t){return new e({type:"nullable",innerType:t})}function OO(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():Fd(n)}})}function DO(e,t,n){return new e({type:"nonoptional",innerType:t,...O(n)})}function NO(e,t){return new e({type:"success",innerType:t})}function LO(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}function UO(e,t,n){return new e({type:"pipe",in:t,out:n})}function jO(e,t){return new e({type:"readonly",innerType:t})}function zO(e,t,n){return new e({type:"template_literal",parts:t,...O(n)})}function FO(e,t){return new e({type:"lazy",getter:t})}function MO(e,t){return new e({type:"promise",innerType:t})}function Lf(e,t,n){let o=O(n);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Uf(e,t,n){return new e({type:"custom",check:"custom",fn:t,...O(n)})}function jf(e,t){let n=ww(o=>(o.addIssue=r=>{if(typeof r=="string")o.issues.push(ko(r,o.value,n._zod.def));else{let i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),o.issues.push(ko(i))}},e(o.value,o)),t);return n}function ww(e,t){let n=new be({check:"custom",...O(t)});return n._zod.check=e,n}function zf(e){let t=new be({check:"describe"});return t._zod.onattach=[n=>{let o=Le.get(n)??{};Le.add(n,{...o,description:e})}],t._zod.check=()=>{},t}function Ff(e){let t=new be({check:"meta"});return t._zod.onattach=[n=>{let o=Le.get(n)??{};Le.add(n,{...o,...e})}],t._zod.check=()=>{},t}function Mf(e,t){let n=O(t),o=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(o=o.map(f=>typeof f=="string"?f.toLowerCase():f),r=r.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(o),s=new Set(r),a=e.Codec??rs,l=e.Boolean??ts,u=e.String??Cr,d=new u({type:"string",error:n.error}),p=new l({type:"boolean",error:n.error}),m=new a({type:"pipe",in:d,out:p,transform:((f,g)=>{let h=f;return n.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:s.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:g.value,inst:m,continue:!1}),{})}),reverseTransform:((f,g)=>f===!0?o[0]||"true":r[0]||"false"),error:n.error});return m}function Fo(e,t,n,o={}){let r=O(o),i={...O(o),check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...r};return n instanceof RegExp&&(i.pattern=n),new e(i)}function ir(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Le,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ge(e,t,n={path:[],schemaPath:[]}){var o;let r=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,d);else{let m=s.schema,f=t.processors[r.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);f(e,t,m,d)}let p=e._zod.parent;p&&(s.ref||(s.ref=p),ge(p,t,d),t.seen.get(p).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),t.io==="input"&&Ve(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((o=s.schema).default??(o.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function sr(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let l=o.get(a);if(l&&l!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,s[0])}}let r=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,m=e.external.uri??(g=>g);if(p)return{ref:m(p)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${f}`}}if(s[1]===n)return{ref:"#"};let u=`#/${a}/`,d=s[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:l,defId:u}=r(s);a.def={...a.schema},u&&(a.defId=u);let d=a.schema;for(let p in d)delete d[p];d.$ref=l};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
236
244
|
|
|
237
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1&&e.reused==="ref"){i(s);continue}}}function Vn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let l=e.seen.get(a);if(l.ref===null)return;let u=l.def??l.schema,d={...u},p=l.ref;if(l.ref=null,p){o(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Object.assign(u,g),Object.assign(u,d),a._zod.parent===p)for(let y in u)y==="$ref"||y==="allOf"||y in d||delete u[y];if(g.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let m=a._zod.parent;if(m&&m!==p){o(m);let f=e.seen.get(m);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let g in u)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:l.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&n.id===i&&delete n.id;let s=e.external?.defs??{};for(let a of e.seen.entries()){let l=a[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?n.$defs=s:n.definitions=s);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Eo(t,"input",e.processors),output:Eo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ve(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Ve(o.element,r);if(o.type==="set")return Ve(o.valueType,r);if(o.type==="lazy")return Ve(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Ve(o.innerType,r);if(o.type==="intersection")return Ve(o.left,r)||Ve(o.right,r);if(o.type==="record"||o.type==="map")return Ve(o.keyType,r)||Ve(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ve(o.in,r)||Ve(o.out,r);if(o.type==="object"){for(let n in o.shape)if(Ve(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(Ve(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(Ve(n,r))return!0;return!!(o.rest&&Ve(o.rest,r))}return!1}var Wm=(e,t={})=>r=>{let o=Gn({...r,processors:t});return pe(e,o),Wn(o,e),Vn(o,e)},Eo=(e,t,r={})=>o=>{let{libraryOptions:n,target:i}=o??{},s=Gn({...n??{},target:i,io:t,processors:r});return pe(e,s),Wn(s,e),Vn(s,e)};var ER={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Vm=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:a,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(n.minLength=i),typeof s=="number"&&(n.maxLength=s),a&&(n.format=ER[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),l&&l.size>0){let d=[...l];d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},qm=(e,t,r,o)=>{let n=r,{minimum:i,maximum:s,format:a,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let p=typeof d=="number"&&d>=(i??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";p?f?(n.minimum=d,n.exclusiveMinimum=!0):n.exclusiveMinimum=d:typeof i=="number"&&(n.minimum=i),m?f?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof s=="number"&&(n.maximum=s),typeof l=="number"&&(n.multipleOf=l)},Jm=(e,t,r,o)=>{r.type="boolean"},Km=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Xm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Ym=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Qm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},ef=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},tf=(e,t,r,o)=>{r.not={}},nf=(e,t,r,o)=>{},rf=(e,t,r,o)=>{},of=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},sf=(e,t,r,o)=>{let n=e._zod.def,i=Ii(n.entries);i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},af=(e,t,r,o)=>{let n=e._zod.def,i=[];for(let s of n.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},cf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},lf=(e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},uf=(e,t,r,o)=>{let n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:l}=e._zod.bag;s!==void 0&&(i.minLength=s),a!==void 0&&(i.maxLength=a),l?l.length===1?(i.contentMediaType=l[0],Object.assign(n,i)):(Object.assign(n,i),n.anyOf=l.map(u=>({contentMediaType:u}))):Object.assign(n,i)},df=(e,t,r,o)=>{r.type="boolean"},pf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},mf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},ff=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},gf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},hf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},vf=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(n.minItems=s),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=pe(i.element,t,{...o,path:[...o.path,"items"]})},yf=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object",n.properties={};let s=i.shape;for(let u in s)n.properties[u]=pe(s[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(s)),l=new Set([...a].filter(u=>{let d=i.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));l.size>0&&(n.required=Array.from(l)),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=pe(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},hc=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((a,l)=>pe(a,t,{...o,path:[...o.path,i?"oneOf":"anyOf",l]}));i?r.oneOf=s:r.anyOf=s},bf=(e,t,r,o)=>{let n=e._zod.def,i=pe(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=pe(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,l=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=l},xf=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((m,f)=>pe(m,t,{...o,path:[...o.path,s,f]})),u=i.rest?pe(i.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(n.prefixItems=l,u&&(n.items=u)):t.target==="openapi-3.0"?(n.items={anyOf:l},u&&n.items.anyOf.push(u),n.minItems=l.length,u||(n.maxItems=l.length)):(n.items=l,u&&(n.additionalItems=u));let{minimum:d,maximum:p}=e._zod.bag;typeof d=="number"&&(n.minItems=d),typeof p=="number"&&(n.maxItems=p)},kf=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let s=i.keyType,l=s._zod.bag?.patterns;if(i.mode==="loose"&&l&&l.size>0){let d=pe(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of l)n.patternProperties[p.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=pe(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=pe(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let u=s._zod.values;if(u){let d=[...u].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(n.required=d)}},wf=(e,t,r,o)=>{let n=e._zod.def,i=pe(n.innerType,t,o),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Sf=(e,t,r,o)=>{let n=e._zod.def;pe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},_f=(e,t,r,o)=>{let n=e._zod.def;pe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},$f=(e,t,r,o)=>{let n=e._zod.def;pe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},If=(e,t,r,o)=>{let n=e._zod.def;pe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},Ef=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;pe(s,t,o);let a=t.seen.get(e);a.ref=s},Af=(e,t,r,o)=>{let n=e._zod.def;pe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},Pf=(e,t,r,o)=>{let n=e._zod.def;pe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},vc=(e,t,r,o)=>{let n=e._zod.def;pe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Cf=(e,t,r,o)=>{let n=e._zod.innerType;pe(n,t,o);let i=t.seen.get(e);i.ref=n},gc={string:Vm,number:qm,boolean:Jm,bigint:Km,symbol:Xm,null:Ym,undefined:Qm,void:ef,never:tf,any:nf,unknown:rf,date:of,enum:sf,literal:af,nan:cf,template_literal:lf,file:uf,success:df,custom:pf,function:mf,transform:ff,map:gf,set:hf,array:vf,object:yf,union:hc,intersection:bf,tuple:xf,record:kf,nullable:wf,nonoptional:Sf,default:_f,prefault:$f,catch:If,pipe:Ef,readonly:Af,promise:Pf,optional:vc,lazy:Cf};function yc(e,t){if("_idmap"in e){let o=e,n=Gn({...t,processors:gc}),i={};for(let l of o._idmap.entries()){let[u,d]=l;pe(d,n)}let s={},a={registry:o,uri:t?.uri,defs:i};n.external=a;for(let l of o._idmap.entries()){let[u,d]=l;Wn(n,d),s[u]=Vn(n,d)}if(Object.keys(i).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[l]:i}}return{schemas:s}}let r=Gn({...t,processors:gc});return pe(e,r),Wn(r,e),Vn(r,e)}var bc=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Gn({processors:gc,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return pe(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),Wn(this.ctx,t);let o=Vn(this.ctx,t),{"~standard":n,...i}=o;return i}};var Qx={};var Zi={};nn(Zi,{ZodAny:()=>eg,ZodArray:()=>og,ZodBase64:()=>Fc,ZodBase64URL:()=>Mc,ZodBigInt:()=>No,ZodBigIntFormat:()=>Zc,ZodBoolean:()=>Do,ZodCIDRv4:()=>jc,ZodCIDRv6:()=>zc,ZodCUID:()=>Tc,ZodCUID2:()=>Rc,ZodCatch:()=>Ig,ZodCodec:()=>ns,ZodCustom:()=>rs,ZodCustomStringFormat:()=>Ro,ZodDate:()=>Xi,ZodDefault:()=>xg,ZodDiscriminatedUnion:()=>sg,ZodE164:()=>Bc,ZodEmail:()=>Ac,ZodEmoji:()=>Pc,ZodEnum:()=>Co,ZodExactOptional:()=>vg,ZodFile:()=>gg,ZodFunction:()=>Lg,ZodGUID:()=>Wi,ZodIPv4:()=>Lc,ZodIPv6:()=>Uc,ZodIntersection:()=>ag,ZodJWT:()=>Hc,ZodKSUID:()=>Nc,ZodLazy:()=>Og,ZodLiteral:()=>fg,ZodMAC:()=>Vf,ZodMap:()=>pg,ZodNaN:()=>Ag,ZodNanoID:()=>Cc,ZodNever:()=>ng,ZodNonOptional:()=>Kc,ZodNull:()=>Yf,ZodNullable:()=>bg,ZodNumber:()=>Oo,ZodNumberFormat:()=>kr,ZodObject:()=>Qi,ZodOptional:()=>Jc,ZodPipe:()=>ts,ZodPrefault:()=>wg,ZodPreprocess:()=>Pg,ZodPromise:()=>Ng,ZodReadonly:()=>Cg,ZodRecord:()=>Po,ZodSet:()=>mg,ZodString:()=>To,ZodStringFormat:()=>he,ZodSuccess:()=>$g,ZodSymbol:()=>Kf,ZodTemplateLiteral:()=>Rg,ZodTransform:()=>hg,ZodTuple:()=>lg,ZodType:()=>ee,ZodULID:()=>Oc,ZodURL:()=>Ki,ZodUUID:()=>Zt,ZodUndefined:()=>Xf,ZodUnion:()=>es,ZodUnknown:()=>tg,ZodVoid:()=>rg,ZodXID:()=>Dc,ZodXor:()=>ig,_ZodString:()=>Ec,_default:()=>kg,_function:()=>cw,any:()=>zk,array:()=>Yi,base64:()=>wk,base64url:()=>Sk,bigint:()=>Dk,boolean:()=>Jf,catch:()=>Eg,check:()=>lw,cidrv4:()=>xk,cidrv6:()=>kk,codec:()=>ow,cuid:()=>pk,cuid2:()=>mk,custom:()=>uw,date:()=>Mk,describe:()=>dw,discriminatedUnion:()=>Vk,e164:()=>_k,email:()=>nk,emoji:()=>uk,enum:()=>Vc,exactOptional:()=>yg,file:()=>ew,float32:()=>Ck,float64:()=>Tk,function:()=>cw,guid:()=>rk,hash:()=>Pk,hex:()=>Ak,hostname:()=>Ek,httpUrl:()=>lk,instanceof:()=>mw,int:()=>$c,int32:()=>Rk,int64:()=>Nk,intersection:()=>cg,invertCodec:()=>iw,ipv4:()=>vk,ipv6:()=>bk,json:()=>gw,jwt:()=>$k,keyof:()=>Bk,ksuid:()=>hk,lazy:()=>Dg,literal:()=>Qk,looseObject:()=>Gk,looseRecord:()=>Jk,mac:()=>yk,map:()=>Kk,meta:()=>pw,nan:()=>rw,nanoid:()=>dk,nativeEnum:()=>Yk,never:()=>Gc,nonoptional:()=>_g,null:()=>Qf,nullable:()=>qi,nullish:()=>tw,number:()=>qf,object:()=>Hk,optional:()=>Vi,partialRecord:()=>qk,pipe:()=>Ic,prefault:()=>Sg,preprocess:()=>hw,promise:()=>aw,readonly:()=>Tg,record:()=>dg,refine:()=>Ug,set:()=>Xk,strictObject:()=>Zk,string:()=>Gi,stringFormat:()=>Ik,stringbool:()=>fw,success:()=>nw,superRefine:()=>jg,symbol:()=>Uk,templateLiteral:()=>sw,transform:()=>qc,tuple:()=>ug,uint32:()=>Ok,uint64:()=>Lk,ulid:()=>fk,undefined:()=>jk,union:()=>Wc,unknown:()=>xr,url:()=>ck,uuid:()=>ok,uuidv4:()=>ik,uuidv6:()=>sk,uuidv7:()=>ak,void:()=>Fk,xid:()=>gk,xor:()=>Wk});var xc={};nn(xc,{endsWith:()=>bo,gt:()=>Bt,gte:()=>We,includes:()=>vo,length:()=>br,lowercase:()=>go,lt:()=>Mt,lte:()=>st,maxLength:()=>yr,maxSize:()=>Zn,mime:()=>xo,minLength:()=>dn,minSize:()=>Ht,multipleOf:()=>Hn,negative:()=>dc,nonnegative:()=>mc,nonpositive:()=>pc,normalize:()=>ko,overwrite:()=>It,positive:()=>uc,property:()=>fc,regex:()=>fo,size:()=>vr,slugify:()=>$o,startsWith:()=>yo,toLowerCase:()=>So,toUpperCase:()=>_o,trim:()=>wo,uppercase:()=>ho});var Ao={};nn(Ao,{ZodISODate:()=>wc,ZodISODateTime:()=>kc,ZodISODuration:()=>_c,ZodISOTime:()=>Sc,date:()=>Rf,datetime:()=>Tf,duration:()=>Df,time:()=>Of});var kc=b("ZodISODateTime",(e,t)=>{ap.init(e,t),he.init(e,t)});function Tf(e){return dm(kc,e)}var wc=b("ZodISODate",(e,t)=>{cp.init(e,t),he.init(e,t)});function Rf(e){return pm(wc,e)}var Sc=b("ZodISOTime",(e,t)=>{lp.init(e,t),he.init(e,t)});function Of(e){return mm(Sc,e)}var _c=b("ZodISODuration",(e,t)=>{up.init(e,t),he.init(e,t)});function Df(e){return fm(_c,e)}var ek=(e,t)=>{Ti.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Oi(e,r)},flatten:{value:r=>Ri(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,oo,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,oo,2)}},isEmpty:{get(){return e.issues.length===0}}})},PR=b("ZodError",ek),nt=b("ZodError",ek,{Parent:Error});var Nf=ao(nt),Lf=co(nt),Uf=lo(nt),jf=uo(nt),zf=ya(nt),Ff=ba(nt),Mf=xa(nt),Bf=ka(nt),Hf=wa(nt),Zf=Sa(nt),Gf=_a(nt),Wf=$a(nt);var tk=new WeakMap;function Ji(e,t,r){let o=Object.getPrototypeOf(e),n=tk.get(o);if(n||(n=new Set,tk.set(o,n)),!n.has(t)){n.add(t);for(let i in r){let s=r[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var ee=b("ZodType",(e,t)=>(V.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Eo(e,"input"),output:Eo(e,"output")}}),e.toJSONSchema=Wm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Nf(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Uf(e,r,o),e.parseAsync=async(r,o)=>Lf(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>jf(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>zf(e,r,o),e.decode=(r,o)=>Ff(e,r,o),e.encodeAsync=async(r,o)=>Mf(e,r,o),e.decodeAsync=async(r,o)=>Bf(e,r,o),e.safeEncode=(r,o)=>Hf(e,r,o),e.safeDecode=(r,o)=>Zf(e,r,o),e.safeEncodeAsync=async(r,o)=>Gf(e,r,o),e.safeDecodeAsync=async(r,o)=>Wf(e,r,o),Ji(e,"ZodType",{check(...r){let o=this.def;return this.clone(C.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Ze(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(Ug(r,o))},superRefine(r,o){return this.check(jg(r,o))},overwrite(r){return this.check(It(r))},optional(){return Vi(this)},exactOptional(){return yg(this)},nullable(){return qi(this)},nullish(){return Vi(qi(this))},nonoptional(r){return _g(this,r)},array(){return Yi(this)},or(r){return Wc([this,r])},and(r){return cg(this,r)},transform(r){return Ic(this,qc(r))},default(r){return kg(this,r)},prefault(r){return Sg(this,r)},catch(r){return Eg(this,r)},pipe(r){return Ic(this,r)},readonly(){return Tg(this)},describe(r){let o=this.clone();return De.add(o,{description:r}),o},meta(...r){if(r.length===0)return De.get(this);let o=this.clone();return De.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return De.get(e)?.description},configurable:!0}),e)),Ec=b("_ZodString",(e,t)=>{hr.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Vm(e,o,n,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Ji(e,"_ZodString",{regex(...o){return this.check(fo(...o))},includes(...o){return this.check(vo(...o))},startsWith(...o){return this.check(yo(...o))},endsWith(...o){return this.check(bo(...o))},min(...o){return this.check(dn(...o))},max(...o){return this.check(yr(...o))},length(...o){return this.check(br(...o))},nonempty(...o){return this.check(dn(1,...o))},lowercase(o){return this.check(go(o))},uppercase(o){return this.check(ho(o))},trim(){return this.check(wo())},normalize(...o){return this.check(ko(...o))},toLowerCase(){return this.check(So())},toUpperCase(){return this.check(_o())},slugify(){return this.check($o())}})}),To=b("ZodString",(e,t)=>{hr.init(e,t),Ec.init(e,t),e.email=r=>e.check(Za(Ac,r)),e.url=r=>e.check(Hi(Ki,r)),e.jwt=r=>e.check(lc(Hc,r)),e.emoji=r=>e.check(Ja(Pc,r)),e.guid=r=>e.check(Bi(Wi,r)),e.uuid=r=>e.check(Ga(Zt,r)),e.uuidv4=r=>e.check(Wa(Zt,r)),e.uuidv6=r=>e.check(Va(Zt,r)),e.uuidv7=r=>e.check(qa(Zt,r)),e.nanoid=r=>e.check(Ka(Cc,r)),e.guid=r=>e.check(Bi(Wi,r)),e.cuid=r=>e.check(Xa(Tc,r)),e.cuid2=r=>e.check(Ya(Rc,r)),e.ulid=r=>e.check(Qa(Oc,r)),e.base64=r=>e.check(sc(Fc,r)),e.base64url=r=>e.check(ac(Mc,r)),e.xid=r=>e.check(ec(Dc,r)),e.ksuid=r=>e.check(tc(Nc,r)),e.ipv4=r=>e.check(nc(Lc,r)),e.ipv6=r=>e.check(rc(Uc,r)),e.cidrv4=r=>e.check(oc(jc,r)),e.cidrv6=r=>e.check(ic(zc,r)),e.e164=r=>e.check(cc(Bc,r)),e.datetime=r=>e.check(Tf(r)),e.date=r=>e.check(Rf(r)),e.time=r=>e.check(Of(r)),e.duration=r=>e.check(Df(r))});function Gi(e){return am(To,e)}var he=b("ZodStringFormat",(e,t)=>{ge.init(e,t),Ec.init(e,t)}),Ac=b("ZodEmail",(e,t)=>{Yd.init(e,t),he.init(e,t)});function nk(e){return Za(Ac,e)}var Wi=b("ZodGUID",(e,t)=>{Kd.init(e,t),he.init(e,t)});function rk(e){return Bi(Wi,e)}var Zt=b("ZodUUID",(e,t)=>{Xd.init(e,t),he.init(e,t)});function ok(e){return Ga(Zt,e)}function ik(e){return Wa(Zt,e)}function sk(e){return Va(Zt,e)}function ak(e){return qa(Zt,e)}var Ki=b("ZodURL",(e,t)=>{Qd.init(e,t),he.init(e,t)});function ck(e){return Hi(Ki,e)}function lk(e){return Hi(Ki,{protocol:it.httpProtocol,hostname:it.domain,...C.normalizeParams(e)})}var Pc=b("ZodEmoji",(e,t)=>{ep.init(e,t),he.init(e,t)});function uk(e){return Ja(Pc,e)}var Cc=b("ZodNanoID",(e,t)=>{tp.init(e,t),he.init(e,t)});function dk(e){return Ka(Cc,e)}var Tc=b("ZodCUID",(e,t)=>{np.init(e,t),he.init(e,t)});function pk(e){return Xa(Tc,e)}var Rc=b("ZodCUID2",(e,t)=>{rp.init(e,t),he.init(e,t)});function mk(e){return Ya(Rc,e)}var Oc=b("ZodULID",(e,t)=>{op.init(e,t),he.init(e,t)});function fk(e){return Qa(Oc,e)}var Dc=b("ZodXID",(e,t)=>{ip.init(e,t),he.init(e,t)});function gk(e){return ec(Dc,e)}var Nc=b("ZodKSUID",(e,t)=>{sp.init(e,t),he.init(e,t)});function hk(e){return tc(Nc,e)}var Lc=b("ZodIPv4",(e,t)=>{dp.init(e,t),he.init(e,t)});function vk(e){return nc(Lc,e)}var Vf=b("ZodMAC",(e,t)=>{mp.init(e,t),he.init(e,t)});function yk(e){return lm(Vf,e)}var Uc=b("ZodIPv6",(e,t)=>{pp.init(e,t),he.init(e,t)});function bk(e){return rc(Uc,e)}var jc=b("ZodCIDRv4",(e,t)=>{fp.init(e,t),he.init(e,t)});function xk(e){return oc(jc,e)}var zc=b("ZodCIDRv6",(e,t)=>{gp.init(e,t),he.init(e,t)});function kk(e){return ic(zc,e)}var Fc=b("ZodBase64",(e,t)=>{vp.init(e,t),he.init(e,t)});function wk(e){return sc(Fc,e)}var Mc=b("ZodBase64URL",(e,t)=>{yp.init(e,t),he.init(e,t)});function Sk(e){return ac(Mc,e)}var Bc=b("ZodE164",(e,t)=>{bp.init(e,t),he.init(e,t)});function _k(e){return cc(Bc,e)}var Hc=b("ZodJWT",(e,t)=>{xp.init(e,t),he.init(e,t)});function $k(e){return lc(Hc,e)}var Ro=b("ZodCustomStringFormat",(e,t)=>{kp.init(e,t),he.init(e,t)});function Ik(e,t,r={}){return Io(Ro,e,t,r)}function Ek(e){return Io(Ro,"hostname",it.hostname,e)}function Ak(e){return Io(Ro,"hex",it.hex,e)}function Pk(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=it[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return Io(Ro,o,n,t)}var Oo=b("ZodNumber",(e,t)=>{Da.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(o,n,i)=>qm(e,o,n,i),Ji(e,"ZodNumber",{gt(o,n){return this.check(Bt(o,n))},gte(o,n){return this.check(We(o,n))},min(o,n){return this.check(We(o,n))},lt(o,n){return this.check(Mt(o,n))},lte(o,n){return this.check(st(o,n))},max(o,n){return this.check(st(o,n))},int(o){return this.check($c(o))},safe(o){return this.check($c(o))},positive(o){return this.check(Bt(0,o))},nonnegative(o){return this.check(We(0,o))},negative(o){return this.check(Mt(0,o))},nonpositive(o){return this.check(st(0,o))},multipleOf(o,n){return this.check(Hn(o,n))},step(o,n){return this.check(Hn(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function qf(e){return gm(Oo,e)}var kr=b("ZodNumberFormat",(e,t)=>{wp.init(e,t),Oo.init(e,t)});function $c(e){return vm(kr,e)}function Ck(e){return ym(kr,e)}function Tk(e){return bm(kr,e)}function Rk(e){return xm(kr,e)}function Ok(e){return km(kr,e)}var Do=b("ZodBoolean",(e,t)=>{Ui.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Jm(e,r,o,n)});function Jf(e){return wm(Do,e)}var No=b("ZodBigInt",(e,t)=>{Na.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Km(e,o,n,i),e.gte=(o,n)=>e.check(We(o,n)),e.min=(o,n)=>e.check(We(o,n)),e.gt=(o,n)=>e.check(Bt(o,n)),e.gte=(o,n)=>e.check(We(o,n)),e.min=(o,n)=>e.check(We(o,n)),e.lt=(o,n)=>e.check(Mt(o,n)),e.lte=(o,n)=>e.check(st(o,n)),e.max=(o,n)=>e.check(st(o,n)),e.positive=o=>e.check(Bt(BigInt(0),o)),e.negative=o=>e.check(Mt(BigInt(0),o)),e.nonpositive=o=>e.check(st(BigInt(0),o)),e.nonnegative=o=>e.check(We(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Hn(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Dk(e){return _m(No,e)}var Zc=b("ZodBigIntFormat",(e,t)=>{Sp.init(e,t),No.init(e,t)});function Nk(e){return Im(Zc,e)}function Lk(e){return Em(Zc,e)}var Kf=b("ZodSymbol",(e,t)=>{_p.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xm(e,r,o,n)});function Uk(e){return Am(Kf,e)}var Xf=b("ZodUndefined",(e,t)=>{$p.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qm(e,r,o,n)});function jk(e){return Pm(Xf,e)}var Yf=b("ZodNull",(e,t)=>{Ip.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ym(e,r,o,n)});function Qf(e){return Cm(Yf,e)}var eg=b("ZodAny",(e,t)=>{Ep.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nf(e,r,o,n)});function zk(){return Tm(eg)}var tg=b("ZodUnknown",(e,t)=>{Ap.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rf(e,r,o,n)});function xr(){return Rm(tg)}var ng=b("ZodNever",(e,t)=>{Pp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tf(e,r,o,n)});function Gc(e){return Om(ng,e)}var rg=b("ZodVoid",(e,t)=>{Cp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ef(e,r,o,n)});function Fk(e){return Dm(rg,e)}var Xi=b("ZodDate",(e,t)=>{Tp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(o,n,i)=>of(e,o,n,i),e.min=(o,n)=>e.check(We(o,n)),e.max=(o,n)=>e.check(st(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function Mk(e){return Nm(Xi,e)}var og=b("ZodArray",(e,t)=>{Rp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vf(e,r,o,n),e.element=t.element,Ji(e,"ZodArray",{min(r,o){return this.check(dn(r,o))},nonempty(r){return this.check(dn(1,r))},max(r,o){return this.check(yr(r,o))},length(r,o){return this.check(br(r,o))},unwrap(){return this.element}})});function Yi(e,t){return jm(og,e,t)}function Bk(e){let t=e._zod.def.shape;return Vc(Object.keys(t))}var Qi=b("ZodObject",(e,t)=>{Op.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yf(e,r,o,n),C.defineLazy(e,"shape",()=>t.shape),Ji(e,"ZodObject",{keyof(){return Vc(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:xr()})},loose(){return this.clone({...this._zod.def,catchall:xr()})},strict(){return this.clone({...this._zod.def,catchall:Gc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return C.extend(this,r)},safeExtend(r){return C.safeExtend(this,r)},merge(r){return C.merge(this,r)},pick(r){return C.pick(this,r)},omit(r){return C.omit(this,r)},partial(...r){return C.partial(Jc,this,r[0])},required(...r){return C.required(Kc,this,r[0])}})});function Hk(e,t){let r={type:"object",shape:e??{},...C.normalizeParams(t)};return new Qi(r)}function Zk(e,t){return new Qi({type:"object",shape:e,catchall:Gc(),...C.normalizeParams(t)})}function Gk(e,t){return new Qi({type:"object",shape:e,catchall:xr(),...C.normalizeParams(t)})}var es=b("ZodUnion",(e,t)=>{ji.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hc(e,r,o,n),e.options=t.options});function Wc(e,t){return new es({type:"union",options:e,...C.normalizeParams(t)})}var ig=b("ZodXor",(e,t)=>{es.init(e,t),Dp.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hc(e,r,o,n),e.options=t.options});function Wk(e,t){return new ig({type:"union",options:e,inclusive:!1,...C.normalizeParams(t)})}var sg=b("ZodDiscriminatedUnion",(e,t)=>{es.init(e,t),Np.init(e,t)});function Vk(e,t,r){return new sg({type:"union",options:t,discriminator:e,...C.normalizeParams(r)})}var ag=b("ZodIntersection",(e,t)=>{Lp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bf(e,r,o,n)});function cg(e,t){return new ag({type:"intersection",left:e,right:t})}var lg=b("ZodTuple",(e,t)=>{La.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xf(e,r,o,n),e.rest=r=>e.clone({...e._zod.def,rest:r})});function ug(e,t,r){let o=t instanceof V,n=o?r:t,i=o?t:null;return new lg({type:"tuple",items:e,rest:i,...C.normalizeParams(n)})}var Po=b("ZodRecord",(e,t)=>{Up.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kf(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function dg(e,t,r){return!t||!t._zod?new Po({type:"record",keyType:Gi(),valueType:e,...C.normalizeParams(t)}):new Po({type:"record",keyType:e,valueType:t,...C.normalizeParams(r)})}function qk(e,t,r){let o=Ze(e);return o._zod.values=void 0,new Po({type:"record",keyType:o,valueType:t,...C.normalizeParams(r)})}function Jk(e,t,r){return new Po({type:"record",keyType:e,valueType:t,mode:"loose",...C.normalizeParams(r)})}var pg=b("ZodMap",(e,t)=>{jp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gf(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Ht(...r)),e.nonempty=r=>e.check(Ht(1,r)),e.max=(...r)=>e.check(Zn(...r)),e.size=(...r)=>e.check(vr(...r))});function Kk(e,t,r){return new pg({type:"map",keyType:e,valueType:t,...C.normalizeParams(r)})}var mg=b("ZodSet",(e,t)=>{zp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hf(e,r,o,n),e.min=(...r)=>e.check(Ht(...r)),e.nonempty=r=>e.check(Ht(1,r)),e.max=(...r)=>e.check(Zn(...r)),e.size=(...r)=>e.check(vr(...r))});function Xk(e,t){return new mg({type:"set",valueType:e,...C.normalizeParams(t)})}var Co=b("ZodEnum",(e,t)=>{Fp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(o,n,i)=>sf(e,o,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Co({...t,checks:[],...C.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Co({...t,checks:[],...C.normalizeParams(n),entries:i})}});function Vc(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Co({type:"enum",entries:r,...C.normalizeParams(t)})}function Yk(e,t){return new Co({type:"enum",entries:e,...C.normalizeParams(t)})}var fg=b("ZodLiteral",(e,t)=>{Mp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>af(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Qk(e,t){return new fg({type:"literal",values:Array.isArray(e)?e:[e],...C.normalizeParams(t)})}var gg=b("ZodFile",(e,t)=>{Bp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>uf(e,r,o,n),e.min=(r,o)=>e.check(Ht(r,o)),e.max=(r,o)=>e.check(Zn(r,o)),e.mime=(r,o)=>e.check(xo(Array.isArray(r)?r:[r],o))});function ew(e){return zm(gg,e)}var hg=b("ZodTransform",(e,t)=>{Hp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ff(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new jn(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(C.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(C.issue(s))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function qc(e){return new hg({type:"transform",transform:e})}var Jc=b("ZodOptional",(e,t)=>{Ua.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vc(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Vi(e){return new Jc({type:"optional",innerType:e})}var vg=b("ZodExactOptional",(e,t)=>{Zp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vc(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function yg(e){return new vg({type:"optional",innerType:e})}var bg=b("ZodNullable",(e,t)=>{Gp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wf(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function qi(e){return new bg({type:"nullable",innerType:e})}function tw(e){return Vi(qi(e))}var xg=b("ZodDefault",(e,t)=>{Wp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_f(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function kg(e,t){return new xg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():C.shallowClone(t)}})}var wg=b("ZodPrefault",(e,t)=>{Vp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$f(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Sg(e,t){return new wg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():C.shallowClone(t)}})}var Kc=b("ZodNonOptional",(e,t)=>{qp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sf(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function _g(e,t){return new Kc({type:"nonoptional",innerType:e,...C.normalizeParams(t)})}var $g=b("ZodSuccess",(e,t)=>{Jp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>df(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function nw(e){return new $g({type:"success",innerType:e})}var Ig=b("ZodCatch",(e,t)=>{Kp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>If(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Eg(e,t){return new Ig({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Ag=b("ZodNaN",(e,t)=>{Xp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cf(e,r,o,n)});function rw(e){return Um(Ag,e)}var ts=b("ZodPipe",(e,t)=>{ja.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ef(e,r,o,n),e.in=t.in,e.out=t.out});function Ic(e,t){return new ts({type:"pipe",in:e,out:t})}var ns=b("ZodCodec",(e,t)=>{ts.init(e,t),zi.init(e,t)});function ow(e,t,r){return new ns({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function iw(e){let t=e._zod.def;return new ns({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Pg=b("ZodPreprocess",(e,t)=>{ts.init(e,t),Yp.init(e,t)}),Cg=b("ZodReadonly",(e,t)=>{Qp.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Af(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Tg(e){return new Cg({type:"readonly",innerType:e})}var Rg=b("ZodTemplateLiteral",(e,t)=>{em.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lf(e,r,o,n)});function sw(e,t){return new Rg({type:"template_literal",parts:e,...C.normalizeParams(t)})}var Og=b("ZodLazy",(e,t)=>{rm.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cf(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function Dg(e){return new Og({type:"lazy",getter:e})}var Ng=b("ZodPromise",(e,t)=>{nm.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pf(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function aw(e){return new Ng({type:"promise",innerType:e})}var Lg=b("ZodFunction",(e,t)=>{tm.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mf(e,r,o,n)});function cw(e){return new Lg({type:"function",input:Array.isArray(e?.input)?ug(e?.input):e?.input??Yi(xr()),output:e?.output??xr()})}var rs=b("ZodCustom",(e,t)=>{om.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pf(e,r,o,n)});function lw(e){let t=new ye({check:"custom"});return t._zod.check=e,t}function uw(e,t){return Fm(rs,e??(()=>!0),t)}function Ug(e,t={}){return Mm(rs,e,t)}function jg(e,t){return Bm(e,t)}var dw=Hm,pw=Zm;function mw(e,t={}){let r=new rs({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...C.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}var fw=(...e)=>Gm({Codec:ns,Boolean:Do,String:To},...e);function gw(e){let t=Dg(()=>Wc([Gi(e),qf(),Jf(),Qf(),Yi(t),dg(Gi(),t)]));return t}function hw(e,t){return new Pg({type:"pipe",in:qc(e),out:t})}var TR={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function RR(e){$e({customError:e})}function OR(){return $e().customError}var zg;zg||(zg={});var L={...Zi,...xc,iso:Ao},DR=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function NR(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function LR(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1];if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function vw(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return L.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return L.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=LR(n,t),s=ze(i,t);return t.refs.set(n,s),t.processing.delete(n),s}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return L.null();if(n.length===0)return L.never();if(n.length===1)return L.literal(n[0]);if(n.every(s=>typeof s=="string"))return L.enum(n);let i=n.map(s=>L.literal(s));return i.length<2?i[0]:L.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return L.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(i=>{let s={...e,type:i};return vw(s,t)});return n.length===0?L.never():n.length===1?n[0]:L.union(n)}if(!r)return L.any();let o;switch(r){case"string":{let n=L.string();if(e.format){let i=e.format;i==="email"?n=n.check(L.email()):i==="uri"||i==="uri-reference"?n=n.check(L.url()):i==="uuid"||i==="guid"?n=n.check(L.uuid()):i==="date-time"?n=n.check(L.iso.datetime()):i==="date"?n=n.check(L.iso.date()):i==="time"?n=n.check(L.iso.time()):i==="duration"?n=n.check(L.iso.duration()):i==="ipv4"?n=n.check(L.ipv4()):i==="ipv6"?n=n.check(L.ipv6()):i==="mac"?n=n.check(L.mac()):i==="cidr"?n=n.check(L.cidrv4()):i==="cidr-v6"?n=n.check(L.cidrv6()):i==="base64"?n=n.check(L.base64()):i==="base64url"?n=n.check(L.base64url()):i==="e164"?n=n.check(L.e164()):i==="jwt"?n=n.check(L.jwt()):i==="emoji"?n=n.check(L.emoji()):i==="nanoid"?n=n.check(L.nanoid()):i==="cuid"?n=n.check(L.cuid()):i==="cuid2"?n=n.check(L.cuid2()):i==="ulid"?n=n.check(L.ulid()):i==="xid"?n=n.check(L.xid()):i==="ksuid"&&(n=n.check(L.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),o=n;break}case"number":case"integer":{let n=r==="integer"?L.number().int():L.number();typeof e.minimum=="number"&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),o=n;break}case"boolean":{o=L.boolean();break}case"null":{o=L.null();break}case"object":{let n={},i=e.properties||{},s=new Set(e.required||[]);for(let[l,u]of Object.entries(i)){let d=ze(u,t);n[l]=s.has(l)?d:d.optional()}if(e.propertyNames){let l=ze(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties=="object"?ze(e.additionalProperties,t):L.any();if(Object.keys(n).length===0){o=L.record(l,u);break}let d=L.object(n).passthrough(),p=L.looseRecord(l,u);o=L.intersection(d,p);break}if(e.patternProperties){let l=e.patternProperties,u=Object.keys(l),d=[];for(let m of u){let f=ze(l[m],t),g=L.string().regex(new RegExp(m));d.push(L.looseRecord(g,f))}let p=[];if(Object.keys(n).length>0&&p.push(L.object(n).passthrough()),p.push(...d),p.length===0)o=L.object({}).passthrough();else if(p.length===1)o=p[0];else{let m=L.intersection(p[0],p[1]);for(let f=2;f<p.length;f++)m=L.intersection(m,p[f]);o=m}break}let a=L.object(n);e.additionalProperties===!1?o=a.strict():typeof e.additionalProperties=="object"?o=a.catchall(ze(e.additionalProperties,t)):o=a.passthrough();break}case"array":{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let s=n.map(l=>ze(l,t)),a=i&&typeof i=="object"&&!Array.isArray(i)?ze(i,t):void 0;a?o=L.tuple(s).rest(a):o=L.tuple(s),typeof e.minItems=="number"&&(o=o.check(L.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(L.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=i.map(l=>ze(l,t)),a=e.additionalItems&&typeof e.additionalItems=="object"?ze(e.additionalItems,t):void 0;a?o=L.tuple(s).rest(a):o=L.tuple(s),typeof e.minItems=="number"&&(o=o.check(L.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(L.maxLength(e.maxItems)))}else if(i!==void 0){let s=ze(i,t),a=L.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),o=a}else o=L.array(L.any());break}default:throw new Error(`Unsupported type: ${r}`)}return o}function ze(e,t){if(typeof e=="boolean")return e?L.any():L.never();let r=vw(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>ze(u,t)),l=L.union(a);r=o?L.intersection(r,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>ze(u,t)),l=L.xor(a);r=o?L.intersection(r,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:L.any();else{let a=o?r:ze(e.allOf[0],t),l=o?0:1;for(let u=l;u<e.allOf.length;u++)a=L.intersection(a,ze(e.allOf[u],t));r=a}e.nullable===!0&&t.version==="openapi-3.0"&&(r=L.nullable(r)),e.readOnly===!0&&(r=L.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in e&&(n[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(n[a]=e[a]);for(let a of Object.keys(e))DR.has(a)||(n[a]=e[a]);return Object.keys(n).length>0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function yw(e,t){if(typeof e=="boolean")return e?L.any():L.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=NR(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??De};return ze(r,i)}var Fg={};nn(Fg,{bigint:()=>FR,boolean:()=>zR,date:()=>MR,number:()=>jR,string:()=>UR});function UR(e){return cm(To,e)}function jR(e){return hm(Oo,e)}function zR(e){return Sm(Do,e)}function FR(e){return $m(No,e)}function MR(e){return Lm(Xi,e)}$e(za());var ae=c.number().min(0).max(100),gn=c.number().int().min(1e3).max(12e3),fn=c.number(),te=c.number().int().nonnegative(),Et=c.enum(["hue","matter","smartthings","homeassistant","nest","alexa","google","kasa","wiz","lifx","shelly","govee","tapo","tuya","yeelight","nanoleaf","meross","ewelink","wled","elgato","roku","mqtt","esphome","mock","other"]),BR=c.enum(["local","cloud","offline","unknown"]),os=c.enum(["light","plug","switch","dimmer","thermostat","lock","cover","garageDoor","valve","fan","sensor","binarySensor","camera","doorbell","speaker","tv","mediaPlayer","vacuum","appliance","airPurifier","humidifier","waterHeater","evCharger","sceneController","remote","scene","group","bridge","other"]),HR=c.enum(["temperature","humidity","illuminance","pressure","co2","pm25","pm10","voc","airQuality","noise","uvIndex","windSpeed","distance","generic"]),ZR=c.enum(["motion","occupancy","presence","contact","leak","smoke","co","gas","tamper","vibration","glassBreak","button","person","sound","moisture","generic"]);var xe=(e,t)=>c.object({type:c.literal(e),instance:c.string().optional(),...t}),GR=xe("power",{state:c.object({on:c.boolean().nullable()})}),WR=xe("brightness",{state:c.object({level:ae.nullable()})}),VR=xe("colorTemperature",{config:c.object({minKelvin:gn,maxKelvin:gn}),state:c.object({kelvin:gn.nullable()})}),qR=xe("color",{config:c.object({modes:c.array(c.enum(["hs","rgb","xy"])).default(["hs"])}),state:c.object({hue:c.number().min(0).max(360).nullable(),saturation:ae.nullable()})}),JR=xe("segmentColor",{config:c.object({segments:c.number().int().min(1)}),state:c.object({colors:c.array(c.object({hue:c.number().min(0).max(360).nullable(),saturation:ae.nullable()})).nullable()})}),Hg=c.enum(["off","heat","cool","auto","eco","fanOnly","dry"]),KR=xe("thermostat",{config:c.object({modes:c.array(Hg),minC:fn,maxC:fn,supportsRange:c.boolean().default(!1)}),state:c.object({mode:Hg.nullable(),currentC:fn.nullable(),setpointC:fn.nullable().optional(),heatC:fn.nullable().optional(),coolC:fn.nullable().optional(),action:c.enum(["idle","heating","cooling","fan"]).nullable().optional()})}),XR=xe("humidity",{config:c.object({settable:c.boolean().default(!1),minPct:ae.default(0),maxPct:ae.default(100)}),state:c.object({currentPct:ae.nullable().optional(),targetPct:ae.nullable().optional()})}),YR=xe("lock",{state:c.object({state:c.enum(["locked","unlocked","jammed","unknown"])})}),QR=xe("cover",{config:c.object({kind:c.enum(["blind","shade","curtain","awning","garage","door","window","valve","generic"]),supportsPosition:c.boolean().default(!1),supportsTilt:c.boolean().default(!1)}),state:c.object({position:ae.nullable().optional(),tilt:ae.nullable().optional(),state:c.enum(["open","closed","opening","closing","stopped","partial","unknown"])})}),e1=xe("fan",{config:c.object({presets:c.array(c.string()).default([]),supportsOscillate:c.boolean().default(!1)}),state:c.object({on:c.boolean().nullable(),level:ae.nullable().optional(),preset:c.string().nullable().optional(),oscillating:c.boolean().nullable().optional()})}),t1=xe("mode",{config:c.object({options:c.array(c.string())}),state:c.object({value:c.string().nullable()})}),n1=xe("toggle",{state:c.object({on:c.boolean().nullable()})}),r1=xe("range",{config:c.object({min:c.number(),max:c.number(),step:c.number().optional(),unit:c.string().optional()}),state:c.object({value:c.number().nullable()})}),o1=xe("mediaTransport",{state:c.object({state:c.enum(["playing","paused","stopped","buffering","idle"]).nullable(),metadata:c.object({title:c.string().optional(),artist:c.string().optional(),album:c.string().optional(),artworkUrl:c.string().optional()}).nullable().optional(),positionSec:c.number().nonnegative().nullable().optional(),durationSec:c.number().nonnegative().nullable().optional(),shuffle:c.boolean().nullable().optional(),repeat:c.enum(["off","one","all"]).nullable().optional()})}),i1=xe("volume",{state:c.object({level:ae.nullable(),muted:c.boolean().nullable()})}),s1=xe("inputSource",{config:c.object({sources:c.array(c.string())}),state:c.object({source:c.string().nullable()})}),a1=xe("startStop",{config:c.object({supportsPause:c.boolean().default(!1)}),state:c.object({state:c.enum(["running","paused","stopped","unknown"])})}),c1=xe("scene",{state:c.object({lastActivated:te.nullable().optional()})}),l1=xe("camera",{config:c.object({protocols:c.array(c.enum(["rtsp","webrtc","hls","snapshot"]))}),state:c.object({streaming:c.boolean().nullable().optional()})}),u1=xe("sensor",{config:c.object({measurement:HR,unit:c.string()}),state:c.object({value:c.number().nullable(),ts:te.nullable().optional()})}),d1=xe("binarySensor",{config:c.object({sensorType:ZR}),state:c.object({active:c.boolean().nullable(),lastChanged:te.nullable().optional()})}),p1=xe("battery",{state:c.object({level:ae.nullable(),charging:c.boolean().nullable().optional(),low:c.boolean().nullable().optional()})}),m1=xe("energyMeter",{state:c.object({power:c.number().nullable().optional(),energy:c.number().nullable().optional(),voltage:c.number().nullable().optional(),current:c.number().nullable().optional()})}),f1=xe("doorbell",{state:c.object({lastPress:te.nullable().optional()})}),g1=xe("connectivity",{config:c.object({transport:c.enum(["wifi","thread","zigbee","zwave","ethernet","ble","cloud","matter","unknown"])}),state:c.object({online:c.boolean().nullable(),signal:c.number().nullable().optional()})}),bw=c.enum(["flash","strobe","pulse","colorFade","colorLoop","candle","rainbow","siren","meter"]),at=c.object({hue:c.number().min(0).max(360),saturation:ae}),mn=c.number().int().min(20).max(6e5),Mg=c.number().int().min(1).max(1e3).nullable().default(null),wr=c.discriminatedUnion("kind",[c.object({kind:c.literal("flash"),count:c.number().int().min(1).max(100).default(3),onMs:mn.default(300),offMs:mn.default(300),color:at.nullable().default(null),brightness:ae.nullable().default(null)}),c.object({kind:c.literal("strobe"),hz:c.number().min(.5).max(25).default(8),durationMs:mn.default(3e3),color:at.nullable().default(null)}),c.object({kind:c.literal("pulse"),periodMs:mn.default(2e3),minPct:ae.default(5),maxPct:ae.default(100),color:at.nullable().default(null),cycles:Mg}),c.object({kind:c.literal("colorFade"),from:at.nullable().default(null),to:at,durationMs:mn.default(2e3),easing:c.enum(["linear","ease"]).default("ease")}),c.object({kind:c.literal("colorLoop"),colors:c.array(at).min(2).max(16),holdMs:mn.default(1e3),fadeMs:c.number().int().min(0).max(6e5).default(800),loops:Mg,direction:c.enum(["forward","pingpong"]).default("forward")}),c.object({kind:c.literal("candle"),intensity:ae.default(50),warmthKelvin:gn.nullable().default(null),durationMs:mn.nullable().default(null)}),c.object({kind:c.literal("rainbow"),cycleMs:mn.default(4e3),saturation:ae.default(100),brightness:ae.default(100),loops:Mg}),c.object({kind:c.literal("siren"),colorA:at.default({hue:0,saturation:100}),colorB:at.default({hue:240,saturation:100}),hz:c.number().min(.5).max(10).default(4),durationMs:mn.nullable().default(null)}),c.object({kind:c.literal("meter"),source:c.enum(["context","usage","cost"]),stops:c.array(c.object({at:c.number().min(0),color:at})).min(2).max(6).default([{at:0,color:{hue:120,saturation:90}},{at:75,color:{hue:40,saturation:95}},{at:95,color:{hue:0,saturation:95}}])})]),h1=xe("effect",{config:c.object({kinds:c.array(bw).default(["flash"]),supportsColor:c.boolean().default(!1)}),state:c.object({active:bw.nullable()})}),v1=c.discriminatedUnion("type",[GR,WR,VR,qR,JR,KR,XR,YR,QR,e1,t1,n1,r1,o1,i1,s1,a1,c1,l1,u1,d1,p1,m1,f1,g1,h1]),At=c.enum(["power","brightness","colorTemperature","color","segmentColor","thermostat","humidity","lock","cover","fan","mode","toggle","range","mediaTransport","volume","inputSource","startStop","scene","camera","sensor","binarySensor","battery","energyMeter","doorbell","connectivity","effect"]),ww=c.enum(["needs-password"]),y1=c.object({sourceId:c.string(),provider:Et,providerAccountId:c.string(),nativeId:c.string(),nativeType:c.string().optional(),reachability:c.enum(["local","cloud"]),online:c.boolean(),attention:ww.nullable().optional(),credentialRef:c.string().nullable().optional(),lastSeen:te.nullable().optional()}),b1=c.object({id:c.string(),name:c.string(),providerRefs:c.array(c.object({provider:Et,nativeId:c.string()})).default([])}),x1=c.object({accountId:c.string(),provider:Et,displayName:c.string(),reachability:c.enum(["local","cloud"]),status:c.enum(["linked","needs_reauth","revoked"]),expiresAt:te.nullable().optional()}),k1=c.object({id:c.string(),type:os,name:c.string(),areaId:c.string().nullable(),manufacturer:c.string().nullable().optional(),model:c.string().nullable().optional(),firmwareVersion:c.string().nullable().optional(),online:c.boolean(),reachability:BR,attention:ww.nullable().optional(),parentId:c.string().nullable().optional(),members:c.array(c.string()).optional(),sources:c.array(y1).min(1),preferredSourceId:c.string(),capabilities:c.array(v1),updatedAt:te,raw:c.unknown().optional()}),Sw=c.object({version:c.literal(1),nodeId:c.string(),updatedAt:te,areas:c.array(b1),accounts:c.array(x1),devices:c.array(k1)}),w1=c.enum(["relay-do-sealed","hub-local"]),WH=c.object({accountId:c.string(),provider:Et,providerAccountId:c.string(),nodeId:c.string(),credentialLocation:w1,scopes:c.array(c.string()).default([]),status:c.enum(["linked","needs_reauth","revoked"]),displayName:c.string(),expiresAt:te.nullable().optional(),linkedAt:te}),xw=c.enum(["open","guarded","locked"]),Bg=c.enum(["allow","confirm","deny"]),S1=c.enum(["voice","claude","app","rules"]),VH=c.object({tier:xw.default("open"),perConsumer:c.partialRecord(S1,xw).default({}),perClass:c.partialRecord(At,Bg).default({}),perDeviceType:c.partialRecord(os,Bg).default({}),perDevice:c.record(c.string(),Bg).default({}),confirmWindowSec:c.number().default(60)}),Ie=c.object({}),kw=e=>e.type==="cover"&&(e.config.kind==="garage"||e.config.kind==="door"),is={power:[{command:"turnOn",params:Ie},{command:"turnOff",params:Ie},{command:"toggle",params:Ie}],brightness:[{command:"setBrightness",params:c.object({level:ae})},{command:"adjustBrightness",params:c.object({delta:c.number().min(-100).max(100)})}],colorTemperature:[{command:"setColorTemperature",params:c.object({kelvin:gn})}],color:[{command:"setColor",params:c.object({hue:c.number().min(0).max(360),saturation:ae})}],segmentColor:[{command:"setSegmentColors",voice:!1,params:c.object({segments:c.array(c.object({index:c.number().int().nonnegative(),hue:c.number().min(0).max(360),saturation:ae})).min(1).max(512)})}],thermostat:[{command:"setThermostatMode",params:c.object({mode:Hg})},{command:"setSetpoint",params:c.object({celsius:fn})},{command:"setRange",params:c.object({heatCelsius:fn,coolCelsius:fn}),gate:e=>e.type==="thermostat"&&e.config.supportsRange}],humidity:[{command:"setHumidity",params:c.object({percent:ae}),gate:e=>e.type==="humidity"&&e.config.settable}],lock:[{command:"lock",params:Ie},{command:"unlock",params:Ie,confirm:!0}],cover:[{command:"open",params:Ie,confirm:kw},{command:"close",params:Ie},{command:"stop",params:Ie},{command:"setPosition",params:c.object({position:ae}),confirm:kw,gate:e=>e.type==="cover"&&e.config.supportsPosition},{command:"setTilt",params:c.object({tilt:ae}),gate:e=>e.type==="cover"&&e.config.supportsTilt}],fan:[{command:"turnOn",params:Ie},{command:"turnOff",params:Ie},{command:"setFanSpeed",params:c.object({level:ae})},{command:"setFanPreset",params:c.object({preset:c.string()}),gate:e=>e.type==="fan"&&e.config.presets.length>0},{command:"setOscillate",params:c.object({oscillating:c.boolean()}),gate:e=>e.type==="fan"&&e.config.supportsOscillate}],mode:[{command:"setMode",params:c.object({value:c.string()})}],toggle:[{command:"setToggle",params:c.object({on:c.boolean()})}],range:[{command:"setRange",params:c.object({value:c.number()})},{command:"adjustRange",params:c.object({delta:c.number()})}],mediaTransport:[{command:"play",params:Ie},{command:"pause",params:Ie},{command:"stop",params:Ie},{command:"next",params:Ie},{command:"previous",params:Ie},{command:"seek",params:c.object({positionSec:c.number().nonnegative()})},{command:"setShuffle",params:c.object({on:c.boolean()})},{command:"setRepeat",params:c.object({mode:c.enum(["off","one","all"])})}],volume:[{command:"setVolume",params:c.object({level:ae})},{command:"adjustVolume",params:c.object({delta:c.number().min(-100).max(100)})},{command:"setMute",params:c.object({muted:c.boolean()})}],inputSource:[{command:"selectInput",params:c.object({source:c.string()})}],startStop:[{command:"start",params:Ie},{command:"stop",params:Ie},{command:"pause",params:Ie,gate:e=>e.type==="startStop"&&e.config.supportsPause},{command:"resume",params:Ie,gate:e=>e.type==="startStop"&&e.config.supportsPause}],scene:[{command:"activate",params:Ie}],effect:[{command:"startEffect",params:c.object({spec:wr})},{command:"stopEffect",params:Ie}],camera:[{command:"getStream",params:c.object({protocol:c.enum(["rtsp","webrtc","hls"])}),voice:!1,returns:c.object({url:c.string(),token:c.string().optional(),expiresAt:te.optional()})},{command:"getSnapshot",params:Ie,voice:!1,returns:c.object({url:c.string(),expiresAt:te.optional()})}],sensor:[],binarySensor:[],battery:[],energyMeter:[],doorbell:[],connectivity:[]};var _1=c.discriminatedUnion("kind",[c.object({kind:c.literal("literal"),hue:c.number().min(0).max(360),saturation:ae}),c.object({kind:c.literal("token"),token:c.enum(["main","session"])})]),Xc=c.enum(["main","session","hold","off"]),Yc=c.object({color:_1.optional(),brightnessPct:ae.nullable().optional(),brightnessScale:c.number().min(0).max(2).optional(),kelvin:gn.nullable().optional(),power:c.boolean().optional()});var ss=c.enum(["added","removed","permission_request","started","ended","working","finished","error","idle","needs_permission","promptSubmitted","toolStart","toolEnd","subagentStart","subagentFinished","compacting","resumed","aborted","contextLow","contextCritical","needsInput","planReady","rateLimited","compactDone","permissionDenied","taskCompleted","usageHigh","modePlan","modeAuto","modeBypass","modeNormal","modelChanged","workflowStarted","sandboxEscalation","reviewChanged","costHigh","longRunning"]),hn=c.enum(["claude","codex"]);var $1=c.discriminatedUnion("kind",[c.object({kind:c.literal("deviceState"),deviceId:c.string(),capability:c.string(),instance:c.string().optional(),op:c.enum(["eq","neq","gt","lt","gte","lte","changed"]).default("changed"),path:c.string().optional(),value:c.unknown().optional()}),c.object({kind:c.literal("edge"),deviceId:c.string(),event:c.string()}),c.object({kind:c.literal("session"),event:ss,repo:c.string().optional(),sessionId:c.string().optional(),agent:hn.optional()}),c.object({kind:c.literal("schedule"),cron:c.string()})]),I1=c.object({deviceId:c.string(),capability:c.string(),instance:c.string().optional(),op:c.enum(["eq","neq","gt","lt","gte","lte"]),path:c.string().optional(),value:c.unknown()}),E1=c.discriminatedUnion("kind",[c.object({kind:c.literal("device"),deviceId:c.string(),capability:c.string(),instance:c.string().optional(),command:c.string(),params:c.unknown().optional()}),c.object({kind:c.literal("session"),sessionId:c.string(),text:c.string()}),c.object({kind:c.literal("notify"),title:c.string(),body:c.string()}),c.object({kind:c.literal("intent"),deviceId:c.string(),instance:c.string().optional(),look:Yc.optional(),effect:wr.optional(),returnTo:Xc.optional(),hold:c.boolean().default(!1)})]),_w=c.object({id:c.string(),name:c.string().default(""),enabled:c.boolean().default(!0),trigger:$1,conditions:c.array(I1).default([]),actions:c.array(E1).min(1),allowSecurity:c.boolean().default(!1)});var Lo=c.enum(["started","ended","working","finished","error","idle","needs_permission","subagentFinished","compacting","resumed","contextLow","contextCritical","needsInput","planReady","rateLimited","subagentStart","compactDone","permissionDenied","taskCompleted","usageHigh","modePlan","modeAuto","modeBypass","modeNormal","modelChanged","workflowStarted","sandboxEscalation","reviewChanged","costHigh","longRunning"]),$w=c.object({id:c.string(),name:c.string(),cwd:c.string(),online:c.boolean().default(!0),state:Lo.optional(),bridgeId:c.string().optional(),bridgeName:c.string().optional(),agent:hn.optional()}),Iw=c.enum(["allow","deny"]),iZ=c.object({sessionId:c.string().nullable(),text:c.string(),ts:te.optional()}),Qc=c.object({latestReply:c.string().nullable(),ts:c.number().nullable(),cursor:c.number().int().nonnegative(),hasMore:c.boolean()}),sZ=c.object({requestId:c.string(),behavior:Iw,ts:te.optional()}),aZ=c.object({id:c.string(),sessionId:c.string().nullable(),args:c.unknown(),ts:te.optional()}),A1=c.object({type:c.literal("register"),userToken:c.string().optional(),sessions:c.array($w),claudeSessionId:c.string().optional()}),P1=c.object({type:c.literal("sessions.update"),sessions:c.array($w)}),C1=c.object({type:c.literal("prompt"),sessionId:c.string(),requestId:c.string(),text:c.string(),ts:te.optional()});var T1=c.object({type:c.literal("reply"),sessionId:c.string(),requestId:c.string(),text:c.string(),seq:c.number().int().nonnegative().optional(),final:c.boolean().optional(),ts:te.optional()}),R1=c.object({type:c.literal("permission_request"),sessionId:c.string(),requestId:c.string(),tool:c.string(),description:c.string(),preview:c.string(),ts:te.optional()}),O1=c.object({type:c.literal("permission_verdict"),sessionId:c.string(),requestId:c.string(),behavior:Iw,ts:te.optional()}),D1=c.object({type:c.literal("command"),id:c.string(),requestId:c.string(),sessionId:c.string().nullable(),args:c.unknown(),ts:te.optional()}),N1=c.object({type:c.literal("command_result"),requestId:c.string(),id:c.string(),sessionId:c.string().nullable().optional(),result:c.unknown().optional(),error:c.string().optional(),ts:te.optional()}),L1=c.object({type:c.literal("devices.update"),doc:Sw}),U1=c.object({type:c.literal("device_command"),requestId:c.string(),deviceId:c.string(),sourceId:c.string().nullable().optional(),ruleId:c.string().optional(),capability:At,instance:c.string().optional(),command:c.string(),params:c.unknown(),consumer:c.enum(["voice","claude","app","rules"]),sessionId:c.string().optional(),confirm:c.boolean().optional()}),j1=c.object({type:c.literal("device_query"),requestId:c.string(),kind:c.enum(["list","get"]),deviceId:c.string().optional()}),z1=c.object({type:c.literal("device_result"),requestId:c.string(),deviceId:c.string().optional(),ok:c.boolean(),verified:c.boolean().optional(),state:c.unknown().optional(),result:c.unknown().optional(),error:c.string().optional()}),F1=c.object({type:c.literal("device_event"),deviceId:c.string(),capability:At,instance:c.string().optional(),event:c.string(),payload:c.unknown().optional(),ts:te}),M1=c.object({type:c.literal("device_source_event"),provider:Et,providerAccountId:c.string(),nativeId:c.string(),patch:c.array(c.object({type:At,instance:c.string().optional(),state:c.unknown()})).optional(),edge:c.object({capability:At,instance:c.string().optional(),event:c.string(),payload:c.unknown().optional()}).optional(),online:c.boolean().optional(),ts:te}),B1=c.object({type:c.literal("entitlement"),plan:c.enum(["free","paid"]),planStatus:c.enum(["active","past_due","canceled"]).optional(),serviceOk:c.boolean().optional(),capture:c.object({telemetry:c.boolean(),transcripts:c.boolean()}),policyVersion:c.string(),ts:te}),H1=c.object({type:c.literal("device_config"),version:c.number().int().nonnegative(),config:c.record(c.string(),c.unknown()),ts:te}),Z1=c.object({type:c.literal("disconnect"),code:c.union([c.literal(1012),c.literal(4402),c.literal(4426),c.number().int().min(1e3).max(4999)]),reason:c.string().max(120),ts:te}),G1=c.object({type:c.literal("device_audit"),requestId:c.string(),consumer:c.enum(["voice","claude","app","rules"]),deviceId:c.string(),ruleId:c.string().optional(),capability:At,command:c.string(),params:c.unknown(),ok:c.boolean(),confirmRequired:c.boolean(),confirmedBy:c.string().optional(),error:c.string().optional(),ts:te}),W1=64,V1=c.object({type:c.literal("session_state"),sessionId:c.string(),state:Lo,event:c.string(),ts:te,transitions:c.array(c.object({state:Lo,event:c.string(),ts:te})).max(W1).optional()}),q1=c.object({type:c.literal("notification"),sessionId:c.string(),event:Lo,repo:c.string().optional(),title:c.string().optional(),body:c.string().optional()}),J1=c.discriminatedUnion("type",[A1,P1,C1,T1,R1,O1,D1,N1,L1,U1,j1,z1,F1,M1,G1,B1,Z1,H1,V1,q1]),Ew=e=>J1.parse(typeof e=="string"?JSON.parse(e):e);var K1=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Gt=(e,t)=>e>>>t|e<<32-t;function X1(e){let t=[];for(let r of e){let o=r.codePointAt(0);o<128?t.push(o):o<2048?t.push(192|o>>6,128|o&63):o<65536?t.push(224|o>>12,128|o>>6&63,128|o&63):t.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|o&63)}return Uint8Array.from(t)}function Y1(e){let t=X1(e),r=new Uint8Array((t.length+8>>6)+1<<6);r.set(t),r[t.length]=128;let o=new DataView(r.buffer),n=t.length*8;o.setUint32(r.length-8,Math.floor(n/4294967296)),o.setUint32(r.length-4,n>>>0);let i=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint32Array(64);for(let u=0;u<r.length;u+=64){for(let _=0;_<16;_++)s[_]=o.getUint32(u+_*4);for(let _=16;_<64;_++){let I=s[_-15],S=s[_-2],T=Gt(I,7)^Gt(I,18)^I>>>3,j=Gt(S,17)^Gt(S,19)^S>>>10;s[_]=s[_-16]+T+s[_-7]+j>>>0}let d=i[0],p=i[1],m=i[2],f=i[3],g=i[4],h=i[5],y=i[6],k=i[7];for(let _=0;_<64;_++){let I=Gt(g,6)^Gt(g,11)^Gt(g,25),S=g&h^~g&y,T=k+I+S+K1[_]+s[_],j=Gt(d,2)^Gt(d,13)^Gt(d,22),F=d&p^d&m^p&m,J=j+F;k=y,y=h,h=g,g=f+T>>>0,f=m,m=p,p=d,d=T+J>>>0}i[0]=i[0]+d>>>0,i[1]=i[1]+p>>>0,i[2]=i[2]+m>>>0,i[3]=i[3]+f>>>0,i[4]=i[4]+g>>>0,i[5]=i[5]+h>>>0,i[6]=i[6]+y>>>0,i[7]=i[7]+k>>>0}let a=new Uint8Array(32),l=new DataView(a.buffer);for(let u=0;u<8;u++)l.setUint32(u*4,i[u]);return a}var Aw="abcdefghijklmnopqrstuvwxyz234567";function Q1(e){let t=0,r=0,o="";for(let n of e)for(r=r<<8|n,t+=8;t>=5;)o+=Aw[r>>>t-5&31],t-=5;return t>0&&(o+=Aw[r<<5-t&31]),o}function Cw(e){return Q1(Y1(e))}var eO=c.enum(["mdns","ssdp","kasa-udp","wiz-udp","lifx-lan","yeelight","govee-udp","tuya-beacon","arp","http","meethue"]),tO=c.object({protocol:eO,detail:c.string(),at:te}),nO=c.enum(["connect-now","link-ecosystem","identified-only"]),el=c.enum(["kasa","kasa-klap","wiz","lifx","shelly","govee","tapo","tuya","yeelight","nanoleaf","meross","ewelink","wled","elgato","roku","esphome"]),rO=c.enum(["high","medium","low"]),oO=c.object({ip:c.string(),mac:c.string().optional(),hostname:c.string().optional(),port:c.number().int().positive().optional()}),Tw=c.object({discoveredId:c.string(),addresses:oO,evidence:c.array(tO).min(1),identity:c.object({name:c.string().optional(),manufacturer:c.string().optional(),model:c.string().optional(),hint:c.string().optional(),vendorId:c.string().optional()}).default({}),bucket:nO,kind:c.string().optional(),suggestedProvider:Et.optional(),localProtocol:el.optional(),expectedType:os.optional(),expectedCapabilities:c.array(At).default([]),alreadyLinked:c.object({provider:Et,deviceId:c.string().optional(),accountId:c.string().optional()}).nullable().optional(),confidence:rO,firstSeen:te,lastSeen:te});function Pt(e){return e.trim().toLowerCase().replace(/[^0-9a-f]/g,"").replace(/(..)(?=.)/g,"$1:")}var Rw=c.object({key:c.string(),provider:Et,accountId:c.string().optional(),name:c.string(),mac:c.string().optional(),nativeType:c.string().optional(),expectedType:os.optional(),state:c.enum(["cloud","not-seen"]),deviceId:c.string().optional()}),Ow=c.object({wsl:c.boolean(),multicastOk:c.boolean().nullable(),broadcastOk:c.boolean().nullable(),interop:c.enum(["windows-arp"]).optional(),interfaces:c.array(c.string()).optional(),primaryInterface:c.string().optional()});function Dw(e){return e!==void 0&&(e.wsl||e.multicastOk===!1)}function Nw(e,t){return t>0||e===void 0||e.wsl?!1:e.multicastOk===!0}var Lw="Your computer's network stack is fine, so if you expected devices here the likely cause is the network itself: guest WiFi, VLANs, or an access point with client isolation all block the discovery messages between devices. Try the same scan on your main WiFi, or add a device by IP.",iO=c.enum(["running","done","failed"]),mZ=c.object({id:c.string(),status:iO,startedAt:te,finishedAt:te.optional(),error:c.string().optional(),devices:c.array(Tw),accountDevices:c.array(Rw).optional(),env:Ow,probeStatus:c.record(c.string(),c.string()).optional()}),sO=c.enum(["mdns","ssdp","kasa","wiz","lifx","yeelight","govee","tuya","arp","sweep"]),fZ=c.object({autoConnect:c.enum(["unset","off","open-protocols"]).default("unset"),passive:c.boolean().default(!0),protocols:c.partialRecord(sO,c.boolean()).default({}),unidentified:c.boolean().default(!0)}),gZ=c.object({scanId:c.string()}),hZ=c.object({devices:c.array(Tw),accountDevices:c.array(Rw).optional(),env:Ow,updatedAt:te}),vZ=c.object({discoveredId:c.string().optional(),ip:c.string().optional(),protocol:el,name:c.string().optional(),credentials:c.record(c.string(),c.string()).optional()}).refine(e=>e.discoveredId!==void 0||e.ip!==void 0,{message:"either discoveredId or ip is required"}),Zg={tapo:[{key:"username",label:"TP-Link email",secret:!1,helpText:"the TP-Link ID the device was set up with"},{key:"password",label:"Password",secret:!0}],"kasa-klap":[{key:"username",label:"TP-Link email",secret:!1,helpText:"the TP-Link/Kasa ID the device was set up with (leave blank if never linked to the cloud)"},{key:"password",label:"Password",secret:!0}],shelly:[{key:"password",label:"Device password",secret:!0,helpText:'the password set on this Shelly (its username is always "admin")'}],esphome:[{key:"encryptionKey",label:"Encryption key",secret:!0,helpText:"the `api: encryption: key` from this device's ESPHome config (base64) \u2014 leave blank if it has no encryption"}]},aO=new Set(["shelly","esphome"]);function cO(e){return aO.has(e)}var yZ=c.object({ok:c.boolean(),deviceId:c.string().optional(),accountId:c.string().optional(),error:c.string().optional(),note:c.string().optional(),linkVia:Et.optional()}),bZ=c.object({deviceId:c.string(),purge:c.boolean().default(!1),discoveredId:c.string().optional()}),xZ=c.object({deviceId:c.string(),name:c.string()}),kZ=c.object({clientId:c.string().min(1),clientSecret:c.string().min(1),region:c.string().min(1)}),wZ=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),sleepyCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),SZ=c.object({email:c.string().min(1),password:c.string().min(1),region:c.string().min(1),mfaCode:c.string().optional()}),_Z=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),$Z=c.object({email:c.string().min(1),password:c.string().min(1),region:c.string().min(1)}),IZ=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),EZ=c.object({apiKey:c.string().min(1)}),AZ=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),PZ=c.object({ok:c.boolean(),note:c.string().optional(),error:c.string().optional()}),CZ=c.object({sessionId:c.string().optional(),revertOnStop:c.boolean().default(!0)}),TZ=c.object({sessionId:c.string().optional()}),Uw=c.object({pct:c.number().min(0).max(100),usedTokens:c.number().int().nonnegative().optional(),windowTokens:c.number().int().positive().optional()}),Pw=c.object({usedPct:c.number().min(0).max(100),resetsAt:te.optional()}),RZ=c.object({sessionId:c.string().optional(),claudeSessionId:c.string().optional(),state:Lo,event:c.string(),ts:te.optional(),cwd:c.string().optional(),extra:c.record(c.string(),c.unknown()).optional(),context:Uw.optional(),mode:c.string().optional(),model:c.string().optional(),agent:hn.optional()}),OZ=c.object({sessionId:c.string().optional(),claudeSessionId:c.string().optional(),cwd:c.string().optional(),ts:te.optional(),context:Uw.optional(),rateLimits:c.object({fiveHour:Pw.optional(),sevenDay:Pw.optional()}).optional(),mode:c.string().optional(),model:c.string().optional(),modelName:c.string().optional(),review:c.string().optional(),cost:c.number().nonnegative().optional(),agent:hn.optional()}),DZ=c.object({sessionId:c.string().optional(),claudeSessionId:c.string().optional(),codexThreadId:c.string().min(1),cwd:c.string().optional(),gitBranch:c.string().optional(),ts:te.optional(),inputTokens:c.number().int().nonnegative(),cachedInputTokens:c.number().int().nonnegative().default(0),outputTokens:c.number().int().nonnegative(),agent:hn.optional()}),lO=c.object({reverted:c.number().int().nonnegative(),failed:c.number().int().nonnegative(),skipped:c.number().int().nonnegative()}),NZ=c.object({active:c.boolean(),sessionId:c.string().optional(),generation:c.number().int().nonnegative().optional(),touched:c.number().int().nonnegative().default(0),revertOnStop:c.boolean().default(!0),owner:c.enum(["app","hook"]).optional(),summary:lO.optional()});function Uo(e){return e.kind==="gateway"?"infrastructure":e.bucket==="connect-now"?"ready":e.bucket==="link-ecosystem"?"ecosystems":e.kind==="unidentified"||e.kind==="mdns-service"?"unidentified":e.bucket==="identified-only"?"needs-setup":"unidentified"}var tl=["govee","wiz","yeelight","kasa","esphome"],uO=new Set(["lock","cover","garageDoor","valve","camera","doorbell"]),dO=new Set(["lock","cover","camera","doorbell"]),pO=new Set(["tuya","meross","ewelink","nanoleaf","esphome"]);function jw(e,t=Zg){return e.bucket==="connect-now"&&e.localProtocol!==void 0&&((t[e.localProtocol]?.length??0)===0||cO(e.localProtocol))&&!pO.has(e.localProtocol)&&e.confidence==="high"&&e.addresses.mac!==void 0&&!e.alreadyLinked&&!(e.expectedType!==void 0&&uO.has(e.expectedType))&&!e.expectedCapabilities.some(r=>dO.has(r))}function zw(e){let t=e.trim(),r,o=/^(mqtts?|tcp|ssl|tls|wss?):\/\//i.exec(t);if(o){let a=o[1].toLowerCase();(a==="mqtts"||a==="ssl"||a==="tls"||a==="wss")&&(r=!0),t=t.slice(o[0].length)}t=t.replace(/\/.*$/,"");let n=/^(.+):(\d{1,5})$/.exec(t),i=(n?n[1]:t).trim(),s=n?Number(n[2]):void 0;return{host:i,...s!==void 0&&s>=1&&s<=65535?{port:s}:{},...r!==void 0?{tls:r}:{}}}import{spawn as gO}from"node:child_process";import{chmodSync as hO,existsSync as Wg,openSync as vO,readFileSync as yO,realpathSync as bO,writeFileSync as Gw}from"node:fs";import{request as xO}from"node:http";import kO from"node:net";import wO from"node:path";function as(){return!0}function Fw(){return"1.1.3"}var Mw=3e3,mO=15e3;function fO(e){if(!e)return null;try{let t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return null;let{pid:r,startedAt:o,lastBeat:n}=t;return!Number.isInteger(r)||r<=0||typeof o!="number"||typeof n!="number"?null:{pid:r,startedAt:o,lastBeat:n}}catch{return null}}function Bw(e){let t=e?.read??N;return fO(t(e?.file??ia))}function Gg(e,t){let r=t?.write??((n,i)=>ke(n,i,384)),o=t?.now??Date.now;try{r(t?.file??ia,JSON.stringify({pid:t?.pid??process.pid,startedAt:e,lastBeat:o()}))}catch{}}function Hw(e){try{(e?.remove??ve)(e?.file??ia)}catch{}}function Zw(e){let{beacon:t,pid:r}=e;return!Number.isInteger(r)||r<=0||!t||t.pid!==r||!(e.isAlive??aa)(r)?!1:(e.now??Date.now())-t.lastBeat<=(e.staleAfterMs??mO)}function SO(e){return new Promise(t=>{let r=kO.connect({host:"127.0.0.1",port:e},()=>{r.destroy(),t(!0)});r.on("error",()=>t(!1)),r.setTimeout(500,()=>{r.destroy(),t(!1)})})}function rl(e={}){let t=Wr(e);return{dir:t.dir,source:t.source,port:t.beacon?.port??de().hubPort,tokenFile:Ou(t.dir),advertised:t.beacon!==null}}async function Ne(){return SO(rl().port)}function _O(e=process.env,t=r=>Lt(r)){if(e.BRIDGE_CLIENT_VERSION!==void 0)return{};let r=t(e);return r===null?{}:{BRIDGE_CLIENT_VERSION:r}}function $O(e=process.env,t={}){let r=t.bundled??as(),o={...e};return r&&delete o.BRIDGE_VOICE,o}async function ct(e={kind:"run"}){if(await Ne())return se("hub already running \u2014 reusing it"),{spawned:!1,holderId:await Ww(e.kind)??await ol(e.kind)};let t=de(),r=Wg(_i)?{file:process.env.APPIMAGE||process.execPath,args:[_i]}:{file:Wg(la)?la:"tsx",args:[ub]};Gw(wt,"",{mode:384}),hO(wt,384);let o=vO(wt,"a"),n=gO(r.file,r.args,{cwd:ln,detached:!0,stdio:["ignore",o,o],env:{...$O(),BRIDGE_RELAY_URL:t.relayUrl,BRIDGE_HUB_PORT:String(t.hubPort),BRIDGE_HUB_HOLDER:e.kind,BRIDGE_HUB_HOLDER_PID:String(process.pid),..._O()}});n.unref(),n.pid&&Gw(fi,String(n.pid));for(let i=0;i<30;i++){let s=il(wt);if(/relay connected/i.test(s))return $("hub connected to relay"),{spawned:!0,holderId:await Ww(e.kind)??await ol(e.kind)};if(/relay ws error|FATAL/i.test(s))throw new Error(`hub failed to connect:
|
|
238
|
-
|
|
239
|
-
${
|
|
240
|
-
|
|
245
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1&&e.reused==="ref"){i(s);continue}}}function ar(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let l=e.seen.get(a);if(l.ref===null)return;let u=l.def??l.schema,d={...u},p=l.ref;if(l.ref=null,p){o(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Object.assign(u,g),Object.assign(u,d),a._zod.parent===p)for(let y in u)y==="$ref"||y==="allOf"||y in d||delete u[y];if(g.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let m=a._zod.parent;if(m&&m!==p){o(m);let f=e.seen.get(m);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let g in u)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:l.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}Object.assign(r,n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&r.id===i&&delete r.id;let s=e.external?.defs??{};for(let a of e.seen.entries()){let l=a[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?r.$defs=s:r.definitions=s);try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Mo(t,"input",e.processors),output:Mo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ve(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Ve(o.element,n);if(o.type==="set")return Ve(o.valueType,n);if(o.type==="lazy")return Ve(o.getter(),n);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Ve(o.innerType,n);if(o.type==="intersection")return Ve(o.left,n)||Ve(o.right,n);if(o.type==="record"||o.type==="map")return Ve(o.keyType,n)||Ve(o.valueType,n);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ve(o.in,n)||Ve(o.out,n);if(o.type==="object"){for(let r in o.shape)if(Ve(o.shape[r],n))return!0;return!1}if(o.type==="union"){for(let r of o.options)if(Ve(r,n))return!0;return!1}if(o.type==="tuple"){for(let r of o.items)if(Ve(r,n))return!0;return!!(o.rest&&Ve(o.rest,n))}return!1}var Bf=(e,t={})=>n=>{let o=ir({...n,processors:t});return ge(e,o),sr(o,e),ar(o,e)},Mo=(e,t,n={})=>o=>{let{libraryOptions:r,target:i}=o??{},s=ir({...r??{},target:i,io:t,processors:n});return ge(e,s),sr(s,e),ar(s,e)};var BO={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Hf=(e,t,n,o)=>{let r=n;r.type="string";let{minimum:i,maximum:s,format:a,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(r.minLength=i),typeof s=="number"&&(r.maxLength=s),a&&(r.format=BO[a]??a,r.format===""&&delete r.format,a==="time"&&delete r.format),u&&(r.contentEncoding=u),l&&l.size>0){let d=[...l];d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Gf=(e,t,n,o)=>{let r=n,{minimum:i,maximum:s,format:a,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof a=="string"&&a.includes("int")?r.type="integer":r.type="number";let p=typeof d=="number"&&d>=(i??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";p?f?(r.minimum=d,r.exclusiveMinimum=!0):r.exclusiveMinimum=d:typeof i=="number"&&(r.minimum=i),m?f?(r.maximum=u,r.exclusiveMaximum=!0):r.exclusiveMaximum=u:typeof s=="number"&&(r.maximum=s),typeof l=="number"&&(r.multipleOf=l)},Wf=(e,t,n,o)=>{n.type="boolean"},Zf=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Vf=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},qf=(e,t,n,o)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Jf=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Kf=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Xf=(e,t,n,o)=>{n.not={}},Yf=(e,t,n,o)=>{},Qf=(e,t,n,o)=>{},eg=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},tg=(e,t,n,o)=>{let r=e._zod.def,i=Gi(r.entries);i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},ng=(e,t,n,o)=>{let r=e._zod.def,i=[];for(let s of r.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},rg=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},og=(e,t,n,o)=>{let r=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},ig=(e,t,n,o)=>{let r=n,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:l}=e._zod.bag;s!==void 0&&(i.minLength=s),a!==void 0&&(i.maxLength=a),l?l.length===1?(i.contentMediaType=l[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=l.map(u=>({contentMediaType:u}))):Object.assign(r,i)},sg=(e,t,n,o)=>{n.type="boolean"},ag=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},cg=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},lg=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},ug=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},dg=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},pg=(e,t,n,o)=>{let r=n,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(r.minItems=s),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=ge(i.element,t,{...o,path:[...o.path,"items"]})},mg=(e,t,n,o)=>{let r=n,i=e._zod.def;r.type="object",r.properties={};let s=i.shape;for(let u in s)r.properties[u]=ge(s[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(s)),l=new Set([...a].filter(u=>{let d=i.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));l.size>0&&(r.required=Array.from(l)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=ge(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},Vc=(e,t,n,o)=>{let r=e._zod.def,i=r.inclusive===!1,s=r.options.map((a,l)=>ge(a,t,{...o,path:[...o.path,i?"oneOf":"anyOf",l]}));i?n.oneOf=s:n.anyOf=s},fg=(e,t,n,o)=>{let r=e._zod.def,i=ge(r.left,t,{...o,path:[...o.path,"allOf",0]}),s=ge(r.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,l=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=l},gg=(e,t,n,o)=>{let r=n,i=e._zod.def;r.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((m,f)=>ge(m,t,{...o,path:[...o.path,s,f]})),u=i.rest?ge(i.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(r.prefixItems=l,u&&(r.items=u)):t.target==="openapi-3.0"?(r.items={anyOf:l},u&&r.items.anyOf.push(u),r.minItems=l.length,u||(r.maxItems=l.length)):(r.items=l,u&&(r.additionalItems=u));let{minimum:d,maximum:p}=e._zod.bag;typeof d=="number"&&(r.minItems=d),typeof p=="number"&&(r.maxItems=p)},hg=(e,t,n,o)=>{let r=n,i=e._zod.def;r.type="object";let s=i.keyType,l=s._zod.bag?.patterns;if(i.mode==="loose"&&l&&l.size>0){let d=ge(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(let p of l)r.patternProperties[p.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=ge(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),r.additionalProperties=ge(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let u=s._zod.values;if(u){let d=[...u].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(r.required=d)}},vg=(e,t,n,o)=>{let r=e._zod.def,i=ge(r.innerType,t,o),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},yg=(e,t,n,o)=>{let r=e._zod.def;ge(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},bg=(e,t,n,o)=>{let r=e._zod.def;ge(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},xg=(e,t,n,o)=>{let r=e._zod.def;ge(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},kg=(e,t,n,o)=>{let r=e._zod.def;ge(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},wg=(e,t,n,o)=>{let r=e._zod.def,i=r.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?r.out:r.in:r.out;ge(s,t,o);let a=t.seen.get(e);a.ref=s},Sg=(e,t,n,o)=>{let r=e._zod.def;ge(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType,n.readOnly=!0},_g=(e,t,n,o)=>{let r=e._zod.def;ge(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},qc=(e,t,n,o)=>{let r=e._zod.def;ge(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},$g=(e,t,n,o)=>{let r=e._zod.innerType;ge(r,t,o);let i=t.seen.get(e);i.ref=r},Zc={string:Hf,number:Gf,boolean:Wf,bigint:Zf,symbol:Vf,null:qf,undefined:Jf,void:Kf,never:Xf,any:Yf,unknown:Qf,date:eg,enum:tg,literal:ng,nan:rg,template_literal:og,file:ig,success:sg,custom:ag,function:cg,transform:lg,map:ug,set:dg,array:pg,object:mg,union:Vc,intersection:fg,tuple:gg,record:hg,nullable:vg,nonoptional:yg,default:bg,prefault:xg,catch:kg,pipe:wg,readonly:Sg,promise:_g,optional:qc,lazy:$g};function Jc(e,t){if("_idmap"in e){let o=e,r=ir({...t,processors:Zc}),i={};for(let l of o._idmap.entries()){let[u,d]=l;ge(d,r)}let s={},a={registry:o,uri:t?.uri,defs:i};r.external=a;for(let l of o._idmap.entries()){let[u,d]=l;sr(r,d),s[u]=ar(r,d)}if(Object.keys(i).length>0){let l=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[l]:i}}return{schemas:s}}let n=ir({...t,processors:Zc});return ge(e,n),sr(n,e),ar(n,e)}var Kc=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=ir({processors:Zc,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return ge(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),sr(this.ctx,t);let o=ar(this.ctx,t),{"~standard":r,...i}=o;return i}};var Sw={};var cs={};fn(cs,{ZodAny:()=>Jg,ZodArray:()=>Qg,ZodBase64:()=>vl,ZodBase64URL:()=>yl,ZodBigInt:()=>Jo,ZodBigIntFormat:()=>kl,ZodBoolean:()=>qo,ZodCIDRv4:()=>gl,ZodCIDRv6:()=>hl,ZodCUID:()=>cl,ZodCUID2:()=>ll,ZodCatch:()=>kh,ZodCodec:()=>xs,ZodCustom:()=>ks,ZodCustomStringFormat:()=>Zo,ZodDate:()=>gs,ZodDefault:()=>gh,ZodDiscriminatedUnion:()=>th,ZodE164:()=>bl,ZodEmail:()=>il,ZodEmoji:()=>sl,ZodEnum:()=>Go,ZodExactOptional:()=>ph,ZodFile:()=>uh,ZodFunction:()=>Th,ZodGUID:()=>us,ZodIPv4:()=>ml,ZodIPv6:()=>fl,ZodIntersection:()=>nh,ZodJWT:()=>xl,ZodKSUID:()=>pl,ZodLazy:()=>Ih,ZodLiteral:()=>lh,ZodMAC:()=>Bg,ZodMap:()=>ah,ZodNaN:()=>Sh,ZodNanoID:()=>al,ZodNever:()=>Xg,ZodNonOptional:()=>Al,ZodNull:()=>Vg,ZodNullable:()=>fh,ZodNumber:()=>Vo,ZodNumberFormat:()=>Dr,ZodObject:()=>vs,ZodOptional:()=>El,ZodPipe:()=>bs,ZodPrefault:()=>vh,ZodPreprocess:()=>_h,ZodPromise:()=>Ph,ZodReadonly:()=>$h,ZodRecord:()=>Ho,ZodSet:()=>ch,ZodString:()=>Wo,ZodStringFormat:()=>ye,ZodSuccess:()=>xh,ZodSymbol:()=>Wg,ZodTemplateLiteral:()=>Ah,ZodTransform:()=>dh,ZodTuple:()=>oh,ZodType:()=>Y,ZodULID:()=>ul,ZodURL:()=>fs,ZodUUID:()=>Qt,ZodUndefined:()=>Zg,ZodUnion:()=>ys,ZodUnknown:()=>Kg,ZodVoid:()=>Yg,ZodXID:()=>dl,ZodXor:()=>eh,_ZodString:()=>ol,_default:()=>hh,_function:()=>R0,any:()=>l0,array:()=>hs,base64:()=>Zw,base64url:()=>Vw,bigint:()=>o0,boolean:()=>Gg,catch:()=>wh,check:()=>O0,cidrv4:()=>Gw,cidrv6:()=>Ww,codec:()=>I0,cuid:()=>Lw,cuid2:()=>Uw,custom:()=>D0,date:()=>d0,describe:()=>N0,discriminatedUnion:()=>v0,e164:()=>qw,email:()=>Ew,emoji:()=>Dw,enum:()=>_l,exactOptional:()=>mh,file:()=>_0,float32:()=>e0,float64:()=>t0,function:()=>R0,guid:()=>Aw,hash:()=>Qw,hex:()=>Yw,hostname:()=>Xw,httpUrl:()=>Ow,instanceof:()=>U0,int:()=>nl,int32:()=>n0,int64:()=>i0,intersection:()=>rh,invertCodec:()=>C0,ipv4:()=>Mw,ipv6:()=>Hw,json:()=>z0,jwt:()=>Jw,keyof:()=>p0,ksuid:()=>Fw,lazy:()=>Ch,literal:()=>S0,looseObject:()=>g0,looseRecord:()=>b0,mac:()=>Bw,map:()=>x0,meta:()=>L0,nan:()=>A0,nanoid:()=>Nw,nativeEnum:()=>w0,never:()=>wl,nonoptional:()=>bh,null:()=>qg,nullable:()=>ps,nullish:()=>$0,number:()=>Hg,object:()=>m0,optional:()=>ds,partialRecord:()=>y0,pipe:()=>rl,prefault:()=>yh,preprocess:()=>F0,promise:()=>T0,readonly:()=>Eh,record:()=>sh,refine:()=>Rh,set:()=>k0,strictObject:()=>f0,string:()=>ls,stringFormat:()=>Kw,stringbool:()=>j0,success:()=>E0,superRefine:()=>Oh,symbol:()=>a0,templateLiteral:()=>P0,transform:()=>$l,tuple:()=>ih,uint32:()=>r0,uint64:()=>s0,ulid:()=>jw,undefined:()=>c0,union:()=>Sl,unknown:()=>Or,url:()=>Rw,uuid:()=>Iw,uuidv4:()=>Cw,uuidv6:()=>Pw,uuidv7:()=>Tw,void:()=>u0,xid:()=>zw,xor:()=>h0});var Xc={};fn(Xc,{endsWith:()=>Oo,gt:()=>Xt,gte:()=>Ze,includes:()=>To,length:()=>Rr,lowercase:()=>Co,lt:()=>Kt,lte:()=>pt,maxLength:()=>Tr,maxSize:()=>or,mime:()=>Do,minLength:()=>wn,minSize:()=>Yt,multipleOf:()=>rr,negative:()=>Bc,nonnegative:()=>Gc,nonpositive:()=>Hc,normalize:()=>No,overwrite:()=>Lt,positive:()=>Mc,property:()=>Wc,regex:()=>Io,size:()=>Pr,slugify:()=>zo,startsWith:()=>Ro,toLowerCase:()=>Uo,toUpperCase:()=>jo,trim:()=>Lo,uppercase:()=>Po});var Bo={};fn(Bo,{ZodISODate:()=>Qc,ZodISODateTime:()=>Yc,ZodISODuration:()=>tl,ZodISOTime:()=>el,date:()=>Ag,datetime:()=>Eg,duration:()=>Cg,time:()=>Ig});var Yc=b("ZodISODateTime",(e,t)=>{nm.init(e,t),ye.init(e,t)});function Eg(e){return af(Yc,e)}var Qc=b("ZodISODate",(e,t)=>{rm.init(e,t),ye.init(e,t)});function Ag(e){return cf(Qc,e)}var el=b("ZodISOTime",(e,t)=>{om.init(e,t),ye.init(e,t)});function Ig(e){return lf(el,e)}var tl=b("ZodISODuration",(e,t)=>{im.init(e,t),ye.init(e,t)});function Cg(e){return uf(tl,e)}var _w=(e,t)=>{Ji.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Xi(e,n)},flatten:{value:n=>Ki(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,bo,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,bo,2)}},isEmpty:{get(){return e.issues.length===0}}})},GO=b("ZodError",_w),ot=b("ZodError",_w,{Parent:Error});var Pg=wo(ot),Tg=So(ot),Rg=_o(ot),Og=$o(ot),Dg=Ja(ot),Ng=Ka(ot),Lg=Xa(ot),Ug=Ya(ot),jg=Qa(ot),zg=ec(ot),Fg=tc(ot),Mg=nc(ot);var $w=new WeakMap;function ms(e,t,n){let o=Object.getPrototypeOf(e),r=$w.get(o);if(r||(r=new Set,$w.set(o,r)),!r.has(t)){r.add(t);for(let i in n){let s=n[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var Y=b("ZodType",(e,t)=>(J.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Mo(e,"input"),output:Mo(e,"output")}}),e.toJSONSchema=Bf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,o)=>Pg(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>Rg(e,n,o),e.parseAsync=async(n,o)=>Tg(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>Og(e,n,o),e.spa=e.safeParseAsync,e.encode=(n,o)=>Dg(e,n,o),e.decode=(n,o)=>Ng(e,n,o),e.encodeAsync=async(n,o)=>Lg(e,n,o),e.decodeAsync=async(n,o)=>Ug(e,n,o),e.safeEncode=(n,o)=>jg(e,n,o),e.safeDecode=(n,o)=>zg(e,n,o),e.safeEncodeAsync=async(n,o)=>Fg(e,n,o),e.safeDecodeAsync=async(n,o)=>Mg(e,n,o),ms(e,"ZodType",{check(...n){let o=this.def;return this.clone(T.mergeDefs(o,{checks:[...o.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,o){return Ge(this,n,o)},brand(){return this},register(n,o){return n.add(this,o),this},refine(n,o){return this.check(Rh(n,o))},superRefine(n,o){return this.check(Oh(n,o))},overwrite(n){return this.check(Lt(n))},optional(){return ds(this)},exactOptional(){return mh(this)},nullable(){return ps(this)},nullish(){return ds(ps(this))},nonoptional(n){return bh(this,n)},array(){return hs(this)},or(n){return Sl([this,n])},and(n){return rh(this,n)},transform(n){return rl(this,$l(n))},default(n){return hh(this,n)},prefault(n){return yh(this,n)},catch(n){return wh(this,n)},pipe(n){return rl(this,n)},readonly(){return Eh(this)},describe(n){let o=this.clone();return Le.add(o,{description:n}),o},meta(...n){if(n.length===0)return Le.get(this);let o=this.clone();return Le.add(o,n[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return Le.get(e)?.description},configurable:!0}),e)),ol=b("_ZodString",(e,t)=>{Cr.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(o,r,i)=>Hf(e,o,r,i);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ms(e,"_ZodString",{regex(...o){return this.check(Io(...o))},includes(...o){return this.check(To(...o))},startsWith(...o){return this.check(Ro(...o))},endsWith(...o){return this.check(Oo(...o))},min(...o){return this.check(wn(...o))},max(...o){return this.check(Tr(...o))},length(...o){return this.check(Rr(...o))},nonempty(...o){return this.check(wn(1,...o))},lowercase(o){return this.check(Co(o))},uppercase(o){return this.check(Po(o))},trim(){return this.check(Lo())},normalize(...o){return this.check(No(...o))},toLowerCase(){return this.check(Uo())},toUpperCase(){return this.check(jo())},slugify(){return this.check(zo())}})}),Wo=b("ZodString",(e,t)=>{Cr.init(e,t),ol.init(e,t),e.email=n=>e.check(kc(il,n)),e.url=n=>e.check(as(fs,n)),e.jwt=n=>e.check(Fc(xl,n)),e.emoji=n=>e.check(Ec(sl,n)),e.guid=n=>e.check(ss(us,n)),e.uuid=n=>e.check(wc(Qt,n)),e.uuidv4=n=>e.check(Sc(Qt,n)),e.uuidv6=n=>e.check(_c(Qt,n)),e.uuidv7=n=>e.check($c(Qt,n)),e.nanoid=n=>e.check(Ac(al,n)),e.guid=n=>e.check(ss(us,n)),e.cuid=n=>e.check(Ic(cl,n)),e.cuid2=n=>e.check(Cc(ll,n)),e.ulid=n=>e.check(Pc(ul,n)),e.base64=n=>e.check(Uc(vl,n)),e.base64url=n=>e.check(jc(yl,n)),e.xid=n=>e.check(Tc(dl,n)),e.ksuid=n=>e.check(Rc(pl,n)),e.ipv4=n=>e.check(Oc(ml,n)),e.ipv6=n=>e.check(Dc(fl,n)),e.cidrv4=n=>e.check(Nc(gl,n)),e.cidrv6=n=>e.check(Lc(hl,n)),e.e164=n=>e.check(zc(bl,n)),e.datetime=n=>e.check(Eg(n)),e.date=n=>e.check(Ag(n)),e.time=n=>e.check(Ig(n)),e.duration=n=>e.check(Cg(n))});function ls(e){return nf(Wo,e)}var ye=b("ZodStringFormat",(e,t)=>{ve.init(e,t),ol.init(e,t)}),il=b("ZodEmail",(e,t)=>{Vp.init(e,t),ye.init(e,t)});function Ew(e){return kc(il,e)}var us=b("ZodGUID",(e,t)=>{Wp.init(e,t),ye.init(e,t)});function Aw(e){return ss(us,e)}var Qt=b("ZodUUID",(e,t)=>{Zp.init(e,t),ye.init(e,t)});function Iw(e){return wc(Qt,e)}function Cw(e){return Sc(Qt,e)}function Pw(e){return _c(Qt,e)}function Tw(e){return $c(Qt,e)}var fs=b("ZodURL",(e,t)=>{qp.init(e,t),ye.init(e,t)});function Rw(e){return as(fs,e)}function Ow(e){return as(fs,{protocol:dt.httpProtocol,hostname:dt.domain,...T.normalizeParams(e)})}var sl=b("ZodEmoji",(e,t)=>{Jp.init(e,t),ye.init(e,t)});function Dw(e){return Ec(sl,e)}var al=b("ZodNanoID",(e,t)=>{Kp.init(e,t),ye.init(e,t)});function Nw(e){return Ac(al,e)}var cl=b("ZodCUID",(e,t)=>{Xp.init(e,t),ye.init(e,t)});function Lw(e){return Ic(cl,e)}var ll=b("ZodCUID2",(e,t)=>{Yp.init(e,t),ye.init(e,t)});function Uw(e){return Cc(ll,e)}var ul=b("ZodULID",(e,t)=>{Qp.init(e,t),ye.init(e,t)});function jw(e){return Pc(ul,e)}var dl=b("ZodXID",(e,t)=>{em.init(e,t),ye.init(e,t)});function zw(e){return Tc(dl,e)}var pl=b("ZodKSUID",(e,t)=>{tm.init(e,t),ye.init(e,t)});function Fw(e){return Rc(pl,e)}var ml=b("ZodIPv4",(e,t)=>{sm.init(e,t),ye.init(e,t)});function Mw(e){return Oc(ml,e)}var Bg=b("ZodMAC",(e,t)=>{cm.init(e,t),ye.init(e,t)});function Bw(e){return of(Bg,e)}var fl=b("ZodIPv6",(e,t)=>{am.init(e,t),ye.init(e,t)});function Hw(e){return Dc(fl,e)}var gl=b("ZodCIDRv4",(e,t)=>{lm.init(e,t),ye.init(e,t)});function Gw(e){return Nc(gl,e)}var hl=b("ZodCIDRv6",(e,t)=>{um.init(e,t),ye.init(e,t)});function Ww(e){return Lc(hl,e)}var vl=b("ZodBase64",(e,t)=>{pm.init(e,t),ye.init(e,t)});function Zw(e){return Uc(vl,e)}var yl=b("ZodBase64URL",(e,t)=>{mm.init(e,t),ye.init(e,t)});function Vw(e){return jc(yl,e)}var bl=b("ZodE164",(e,t)=>{fm.init(e,t),ye.init(e,t)});function qw(e){return zc(bl,e)}var xl=b("ZodJWT",(e,t)=>{gm.init(e,t),ye.init(e,t)});function Jw(e){return Fc(xl,e)}var Zo=b("ZodCustomStringFormat",(e,t)=>{hm.init(e,t),ye.init(e,t)});function Kw(e,t,n={}){return Fo(Zo,e,t,n)}function Xw(e){return Fo(Zo,"hostname",dt.hostname,e)}function Yw(e){return Fo(Zo,"hex",dt.hex,e)}function Qw(e,t){let n=t?.enc??"hex",o=`${e}_${n}`,r=dt[o];if(!r)throw new Error(`Unrecognized hash format: ${o}`);return Fo(Zo,o,r,t)}var Vo=b("ZodNumber",(e,t)=>{dc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(o,r,i)=>Gf(e,o,r,i),ms(e,"ZodNumber",{gt(o,r){return this.check(Xt(o,r))},gte(o,r){return this.check(Ze(o,r))},min(o,r){return this.check(Ze(o,r))},lt(o,r){return this.check(Kt(o,r))},lte(o,r){return this.check(pt(o,r))},max(o,r){return this.check(pt(o,r))},int(o){return this.check(nl(o))},safe(o){return this.check(nl(o))},positive(o){return this.check(Xt(0,o))},nonnegative(o){return this.check(Ze(0,o))},negative(o){return this.check(Kt(0,o))},nonpositive(o){return this.check(pt(0,o))},multipleOf(o,r){return this.check(rr(o,r))},step(o,r){return this.check(rr(o,r))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Hg(e){return df(Vo,e)}var Dr=b("ZodNumberFormat",(e,t)=>{vm.init(e,t),Vo.init(e,t)});function nl(e){return mf(Dr,e)}function e0(e){return ff(Dr,e)}function t0(e){return gf(Dr,e)}function n0(e){return hf(Dr,e)}function r0(e){return vf(Dr,e)}var qo=b("ZodBoolean",(e,t)=>{ts.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Wf(e,n,o,r)});function Gg(e){return yf(qo,e)}var Jo=b("ZodBigInt",(e,t)=>{pc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(o,r,i)=>Zf(e,o,r,i),e.gte=(o,r)=>e.check(Ze(o,r)),e.min=(o,r)=>e.check(Ze(o,r)),e.gt=(o,r)=>e.check(Xt(o,r)),e.gte=(o,r)=>e.check(Ze(o,r)),e.min=(o,r)=>e.check(Ze(o,r)),e.lt=(o,r)=>e.check(Kt(o,r)),e.lte=(o,r)=>e.check(pt(o,r)),e.max=(o,r)=>e.check(pt(o,r)),e.positive=o=>e.check(Xt(BigInt(0),o)),e.negative=o=>e.check(Kt(BigInt(0),o)),e.nonpositive=o=>e.check(pt(BigInt(0),o)),e.nonnegative=o=>e.check(Ze(BigInt(0),o)),e.multipleOf=(o,r)=>e.check(rr(o,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function o0(e){return xf(Jo,e)}var kl=b("ZodBigIntFormat",(e,t)=>{ym.init(e,t),Jo.init(e,t)});function i0(e){return wf(kl,e)}function s0(e){return Sf(kl,e)}var Wg=b("ZodSymbol",(e,t)=>{bm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Vf(e,n,o,r)});function a0(e){return _f(Wg,e)}var Zg=b("ZodUndefined",(e,t)=>{xm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Jf(e,n,o,r)});function c0(e){return $f(Zg,e)}var Vg=b("ZodNull",(e,t)=>{km.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>qf(e,n,o,r)});function qg(e){return Ef(Vg,e)}var Jg=b("ZodAny",(e,t)=>{wm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Yf(e,n,o,r)});function l0(){return Af(Jg)}var Kg=b("ZodUnknown",(e,t)=>{Sm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Qf(e,n,o,r)});function Or(){return If(Kg)}var Xg=b("ZodNever",(e,t)=>{_m.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Xf(e,n,o,r)});function wl(e){return Cf(Xg,e)}var Yg=b("ZodVoid",(e,t)=>{$m.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Kf(e,n,o,r)});function u0(e){return Pf(Yg,e)}var gs=b("ZodDate",(e,t)=>{Em.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(o,r,i)=>eg(e,o,r,i),e.min=(o,r)=>e.check(Ze(o,r)),e.max=(o,r)=>e.check(pt(o,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function d0(e){return Tf(gs,e)}var Qg=b("ZodArray",(e,t)=>{Am.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>pg(e,n,o,r),e.element=t.element,ms(e,"ZodArray",{min(n,o){return this.check(wn(n,o))},nonempty(n){return this.check(wn(1,n))},max(n,o){return this.check(Tr(n,o))},length(n,o){return this.check(Rr(n,o))},unwrap(){return this.element}})});function hs(e,t){return Df(Qg,e,t)}function p0(e){let t=e._zod.def.shape;return _l(Object.keys(t))}var vs=b("ZodObject",(e,t)=>{Im.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>mg(e,n,o,r),T.defineLazy(e,"shape",()=>t.shape),ms(e,"ZodObject",{keyof(){return _l(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Or()})},loose(){return this.clone({...this._zod.def,catchall:Or()})},strict(){return this.clone({...this._zod.def,catchall:wl()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return T.extend(this,n)},safeExtend(n){return T.safeExtend(this,n)},merge(n){return T.merge(this,n)},pick(n){return T.pick(this,n)},omit(n){return T.omit(this,n)},partial(...n){return T.partial(El,this,n[0])},required(...n){return T.required(Al,this,n[0])}})});function m0(e,t){let n={type:"object",shape:e??{},...T.normalizeParams(t)};return new vs(n)}function f0(e,t){return new vs({type:"object",shape:e,catchall:wl(),...T.normalizeParams(t)})}function g0(e,t){return new vs({type:"object",shape:e,catchall:Or(),...T.normalizeParams(t)})}var ys=b("ZodUnion",(e,t)=>{ns.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Vc(e,n,o,r),e.options=t.options});function Sl(e,t){return new ys({type:"union",options:e,...T.normalizeParams(t)})}var eh=b("ZodXor",(e,t)=>{ys.init(e,t),Cm.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Vc(e,n,o,r),e.options=t.options});function h0(e,t){return new eh({type:"union",options:e,inclusive:!1,...T.normalizeParams(t)})}var th=b("ZodDiscriminatedUnion",(e,t)=>{ys.init(e,t),Pm.init(e,t)});function v0(e,t,n){return new th({type:"union",options:t,discriminator:e,...T.normalizeParams(n)})}var nh=b("ZodIntersection",(e,t)=>{Tm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>fg(e,n,o,r)});function rh(e,t){return new nh({type:"intersection",left:e,right:t})}var oh=b("ZodTuple",(e,t)=>{mc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>gg(e,n,o,r),e.rest=n=>e.clone({...e._zod.def,rest:n})});function ih(e,t,n){let o=t instanceof J,r=o?n:t,i=o?t:null;return new oh({type:"tuple",items:e,rest:i,...T.normalizeParams(r)})}var Ho=b("ZodRecord",(e,t)=>{Rm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>hg(e,n,o,r),e.keyType=t.keyType,e.valueType=t.valueType});function sh(e,t,n){return!t||!t._zod?new Ho({type:"record",keyType:ls(),valueType:e,...T.normalizeParams(t)}):new Ho({type:"record",keyType:e,valueType:t,...T.normalizeParams(n)})}function y0(e,t,n){let o=Ge(e);return o._zod.values=void 0,new Ho({type:"record",keyType:o,valueType:t,...T.normalizeParams(n)})}function b0(e,t,n){return new Ho({type:"record",keyType:e,valueType:t,mode:"loose",...T.normalizeParams(n)})}var ah=b("ZodMap",(e,t)=>{Om.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ug(e,n,o,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Yt(...n)),e.nonempty=n=>e.check(Yt(1,n)),e.max=(...n)=>e.check(or(...n)),e.size=(...n)=>e.check(Pr(...n))});function x0(e,t,n){return new ah({type:"map",keyType:e,valueType:t,...T.normalizeParams(n)})}var ch=b("ZodSet",(e,t)=>{Dm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>dg(e,n,o,r),e.min=(...n)=>e.check(Yt(...n)),e.nonempty=n=>e.check(Yt(1,n)),e.max=(...n)=>e.check(or(...n)),e.size=(...n)=>e.check(Pr(...n))});function k0(e,t){return new ch({type:"set",valueType:e,...T.normalizeParams(t)})}var Go=b("ZodEnum",(e,t)=>{Nm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(o,r,i)=>tg(e,o,r,i),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(o,r)=>{let i={};for(let s of o)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Go({...t,checks:[],...T.normalizeParams(r),entries:i})},e.exclude=(o,r)=>{let i={...t.entries};for(let s of o)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Go({...t,checks:[],...T.normalizeParams(r),entries:i})}});function _l(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Go({type:"enum",entries:n,...T.normalizeParams(t)})}function w0(e,t){return new Go({type:"enum",entries:e,...T.normalizeParams(t)})}var lh=b("ZodLiteral",(e,t)=>{Lm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ng(e,n,o,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function S0(e,t){return new lh({type:"literal",values:Array.isArray(e)?e:[e],...T.normalizeParams(t)})}var uh=b("ZodFile",(e,t)=>{Um.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ig(e,n,o,r),e.min=(n,o)=>e.check(Yt(n,o)),e.max=(n,o)=>e.check(or(n,o)),e.mime=(n,o)=>e.check(Do(Array.isArray(n)?n:[n],o))});function _0(e){return Nf(uh,e)}var dh=b("ZodTransform",(e,t)=>{jm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>lg(e,n,o,r),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Yn(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(T.issue(i,n.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(T.issue(s))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=r,n.fallback=!0,n)}});function $l(e){return new dh({type:"transform",transform:e})}var El=b("ZodOptional",(e,t)=>{fc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>qc(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function ds(e){return new El({type:"optional",innerType:e})}var ph=b("ZodExactOptional",(e,t)=>{zm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>qc(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function mh(e){return new ph({type:"optional",innerType:e})}var fh=b("ZodNullable",(e,t)=>{Fm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>vg(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function ps(e){return new fh({type:"nullable",innerType:e})}function $0(e){return ds(ps(e))}var gh=b("ZodDefault",(e,t)=>{Mm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>bg(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function hh(e,t){return new gh({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():T.shallowClone(t)}})}var vh=b("ZodPrefault",(e,t)=>{Bm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>xg(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function yh(e,t){return new vh({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():T.shallowClone(t)}})}var Al=b("ZodNonOptional",(e,t)=>{Hm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>yg(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function bh(e,t){return new Al({type:"nonoptional",innerType:e,...T.normalizeParams(t)})}var xh=b("ZodSuccess",(e,t)=>{Gm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>sg(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function E0(e){return new xh({type:"success",innerType:e})}var kh=b("ZodCatch",(e,t)=>{Wm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>kg(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wh(e,t){return new kh({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Sh=b("ZodNaN",(e,t)=>{Zm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>rg(e,n,o,r)});function A0(e){return Of(Sh,e)}var bs=b("ZodPipe",(e,t)=>{gc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>wg(e,n,o,r),e.in=t.in,e.out=t.out});function rl(e,t){return new bs({type:"pipe",in:e,out:t})}var xs=b("ZodCodec",(e,t)=>{bs.init(e,t),rs.init(e,t)});function I0(e,t,n){return new xs({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function C0(e){let t=e._zod.def;return new xs({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var _h=b("ZodPreprocess",(e,t)=>{bs.init(e,t),Vm.init(e,t)}),$h=b("ZodReadonly",(e,t)=>{qm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Sg(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Eh(e){return new $h({type:"readonly",innerType:e})}var Ah=b("ZodTemplateLiteral",(e,t)=>{Jm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>og(e,n,o,r)});function P0(e,t){return new Ah({type:"template_literal",parts:e,...T.normalizeParams(t)})}var Ih=b("ZodLazy",(e,t)=>{Ym.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>$g(e,n,o,r),e.unwrap=()=>e._zod.def.getter()});function Ch(e){return new Ih({type:"lazy",getter:e})}var Ph=b("ZodPromise",(e,t)=>{Xm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>_g(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function T0(e){return new Ph({type:"promise",innerType:e})}var Th=b("ZodFunction",(e,t)=>{Km.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>cg(e,n,o,r)});function R0(e){return new Th({type:"function",input:Array.isArray(e?.input)?ih(e?.input):e?.input??hs(Or()),output:e?.output??Or()})}var ks=b("ZodCustom",(e,t)=>{Qm.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ag(e,n,o,r)});function O0(e){let t=new be({check:"custom"});return t._zod.check=e,t}function D0(e,t){return Lf(ks,e??(()=>!0),t)}function Rh(e,t={}){return Uf(ks,e,t)}function Oh(e,t){return jf(e,t)}var N0=zf,L0=Ff;function U0(e,t={}){let n=new ks({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...T.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:n,path:[...n._zod.def.path??[]]})},n}var j0=(...e)=>Mf({Codec:xs,Boolean:qo,String:Wo},...e);function z0(e){let t=Ch(()=>Sl([ls(e),Hg(),Gg(),qg(),hs(t),sh(ls(),t)]));return t}function F0(e,t){return new _h({type:"pipe",in:$l(e),out:t})}var ZO={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function VO(e){Ce({customError:e})}function qO(){return Ce().customError}var Dh;Dh||(Dh={});var U={...cs,...Xc,iso:Bo},JO=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function KO(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function XO(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===o){let r=n[1];if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function M0(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return U.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return U.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let i=XO(r,t),s=Me(i,t);return t.refs.set(r,s),t.processing.delete(r),s}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return U.null();if(r.length===0)return U.never();if(r.length===1)return U.literal(r[0]);if(r.every(s=>typeof s=="string"))return U.enum(r);let i=r.map(s=>U.literal(s));return i.length<2?i[0]:U.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return U.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(i=>{let s={...e,type:i};return M0(s,t)});return r.length===0?U.never():r.length===1?r[0]:U.union(r)}if(!n)return U.any();let o;switch(n){case"string":{let r=U.string();if(e.format){let i=e.format;i==="email"?r=r.check(U.email()):i==="uri"||i==="uri-reference"?r=r.check(U.url()):i==="uuid"||i==="guid"?r=r.check(U.uuid()):i==="date-time"?r=r.check(U.iso.datetime()):i==="date"?r=r.check(U.iso.date()):i==="time"?r=r.check(U.iso.time()):i==="duration"?r=r.check(U.iso.duration()):i==="ipv4"?r=r.check(U.ipv4()):i==="ipv6"?r=r.check(U.ipv6()):i==="mac"?r=r.check(U.mac()):i==="cidr"?r=r.check(U.cidrv4()):i==="cidr-v6"?r=r.check(U.cidrv6()):i==="base64"?r=r.check(U.base64()):i==="base64url"?r=r.check(U.base64url()):i==="e164"?r=r.check(U.e164()):i==="jwt"?r=r.check(U.jwt()):i==="emoji"?r=r.check(U.emoji()):i==="nanoid"?r=r.check(U.nanoid()):i==="cuid"?r=r.check(U.cuid()):i==="cuid2"?r=r.check(U.cuid2()):i==="ulid"?r=r.check(U.ulid()):i==="xid"?r=r.check(U.xid()):i==="ksuid"&&(r=r.check(U.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),o=r;break}case"number":case"integer":{let r=n==="integer"?U.number().int():U.number();typeof e.minimum=="number"&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),o=r;break}case"boolean":{o=U.boolean();break}case"null":{o=U.null();break}case"object":{let r={},i=e.properties||{},s=new Set(e.required||[]);for(let[l,u]of Object.entries(i)){let d=Me(u,t);r[l]=s.has(l)?d:d.optional()}if(e.propertyNames){let l=Me(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties=="object"?Me(e.additionalProperties,t):U.any();if(Object.keys(r).length===0){o=U.record(l,u);break}let d=U.object(r).passthrough(),p=U.looseRecord(l,u);o=U.intersection(d,p);break}if(e.patternProperties){let l=e.patternProperties,u=Object.keys(l),d=[];for(let m of u){let f=Me(l[m],t),g=U.string().regex(new RegExp(m));d.push(U.looseRecord(g,f))}let p=[];if(Object.keys(r).length>0&&p.push(U.object(r).passthrough()),p.push(...d),p.length===0)o=U.object({}).passthrough();else if(p.length===1)o=p[0];else{let m=U.intersection(p[0],p[1]);for(let f=2;f<p.length;f++)m=U.intersection(m,p[f]);o=m}break}let a=U.object(r);e.additionalProperties===!1?o=a.strict():typeof e.additionalProperties=="object"?o=a.catchall(Me(e.additionalProperties,t)):o=a.passthrough();break}case"array":{let r=e.prefixItems,i=e.items;if(r&&Array.isArray(r)){let s=r.map(l=>Me(l,t)),a=i&&typeof i=="object"&&!Array.isArray(i)?Me(i,t):void 0;a?o=U.tuple(s).rest(a):o=U.tuple(s),typeof e.minItems=="number"&&(o=o.check(U.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(U.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=i.map(l=>Me(l,t)),a=e.additionalItems&&typeof e.additionalItems=="object"?Me(e.additionalItems,t):void 0;a?o=U.tuple(s).rest(a):o=U.tuple(s),typeof e.minItems=="number"&&(o=o.check(U.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(U.maxLength(e.maxItems)))}else if(i!==void 0){let s=Me(i,t),a=U.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),o=a}else o=U.array(U.any());break}default:throw new Error(`Unsupported type: ${n}`)}return o}function Me(e,t){if(typeof e=="boolean")return e?U.any():U.never();let n=M0(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>Me(u,t)),l=U.union(a);n=o?U.intersection(n,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>Me(u,t)),l=U.xor(a);n=o?U.intersection(n,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=o?n:U.any();else{let a=o?n:Me(e.allOf[0],t),l=o?0:1;for(let u=l;u<e.allOf.length;u++)a=U.intersection(a,Me(e.allOf[u],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=U.nullable(n)),e.readOnly===!0&&(n=U.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in e&&(r[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(r[a]=e[a]);for(let a of Object.keys(e))JO.has(a)||(r[a]=e[a]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function B0(e,t){if(typeof e=="boolean")return e?U.any():U.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=KO(n,t?.defaultTarget),r=n.$defs||n.definitions||{},i={version:o,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Le};return Me(n,i)}var Nh={};fn(Nh,{bigint:()=>tD,boolean:()=>eD,date:()=>nD,number:()=>QO,string:()=>YO});function YO(e){return rf(Wo,e)}function QO(e){return pf(Vo,e)}function eD(e){return bf(qo,e)}function tD(e){return kf(Jo,e)}function nD(e){return Rf(gs,e)}Ce(hc());var ue=c.number().min(0).max(100),En=c.number().int().min(1e3).max(12e3),$n=c.number(),Q=c.number().int().nonnegative(),Ut=c.enum(["hue","matter","smartthings","homeassistant","nest","alexa","google","kasa","wiz","lifx","shelly","govee","tapo","tuya","yeelight","nanoleaf","meross","ewelink","wled","elgato","roku","mqtt","esphome","mock","other"]),rD=c.enum(["local","cloud","offline","unknown"]),ws=c.enum(["light","plug","switch","dimmer","thermostat","lock","cover","garageDoor","valve","fan","sensor","binarySensor","camera","doorbell","speaker","tv","mediaPlayer","vacuum","appliance","airPurifier","humidifier","waterHeater","evCharger","sceneController","remote","scene","group","bridge","other"]),oD=c.enum(["temperature","humidity","illuminance","pressure","co2","pm25","pm10","voc","airQuality","noise","uvIndex","windSpeed","distance","generic"]),iD=c.enum(["motion","occupancy","presence","contact","leak","smoke","co","gas","tamper","vibration","glassBreak","button","person","sound","moisture","generic"]);var ke=(e,t)=>c.object({type:c.literal(e),instance:c.string().optional(),...t}),sD=ke("power",{state:c.object({on:c.boolean().nullable()})}),aD=ke("brightness",{state:c.object({level:ue.nullable()})}),cD=ke("colorTemperature",{config:c.object({minKelvin:En,maxKelvin:En}),state:c.object({kelvin:En.nullable()})}),lD=ke("color",{config:c.object({modes:c.array(c.enum(["hs","rgb","xy"])).default(["hs"])}),state:c.object({hue:c.number().min(0).max(360).nullable(),saturation:ue.nullable()})}),uD=ke("segmentColor",{config:c.object({segments:c.number().int().min(1)}),state:c.object({colors:c.array(c.object({hue:c.number().min(0).max(360).nullable(),saturation:ue.nullable()})).nullable()})}),jh=c.enum(["off","heat","cool","auto","eco","fanOnly","dry"]),dD=ke("thermostat",{config:c.object({modes:c.array(jh),minC:$n,maxC:$n,supportsRange:c.boolean().default(!1)}),state:c.object({mode:jh.nullable(),currentC:$n.nullable(),setpointC:$n.nullable().optional(),heatC:$n.nullable().optional(),coolC:$n.nullable().optional(),action:c.enum(["idle","heating","cooling","fan"]).nullable().optional()})}),pD=ke("humidity",{config:c.object({settable:c.boolean().default(!1),minPct:ue.default(0),maxPct:ue.default(100)}),state:c.object({currentPct:ue.nullable().optional(),targetPct:ue.nullable().optional()})}),mD=ke("lock",{state:c.object({state:c.enum(["locked","unlocked","jammed","unknown"])})}),fD=ke("cover",{config:c.object({kind:c.enum(["blind","shade","curtain","awning","garage","door","window","valve","generic"]),supportsPosition:c.boolean().default(!1),supportsTilt:c.boolean().default(!1)}),state:c.object({position:ue.nullable().optional(),tilt:ue.nullable().optional(),state:c.enum(["open","closed","opening","closing","stopped","partial","unknown"])})}),gD=ke("fan",{config:c.object({presets:c.array(c.string()).default([]),supportsOscillate:c.boolean().default(!1)}),state:c.object({on:c.boolean().nullable(),level:ue.nullable().optional(),preset:c.string().nullable().optional(),oscillating:c.boolean().nullable().optional()})}),hD=ke("mode",{config:c.object({options:c.array(c.string())}),state:c.object({value:c.string().nullable()})}),vD=ke("toggle",{state:c.object({on:c.boolean().nullable()})}),yD=ke("range",{config:c.object({min:c.number(),max:c.number(),step:c.number().optional(),unit:c.string().optional()}),state:c.object({value:c.number().nullable()})}),bD=ke("mediaTransport",{state:c.object({state:c.enum(["playing","paused","stopped","buffering","idle"]).nullable(),metadata:c.object({title:c.string().optional(),artist:c.string().optional(),album:c.string().optional(),artworkUrl:c.string().optional()}).nullable().optional(),positionSec:c.number().nonnegative().nullable().optional(),durationSec:c.number().nonnegative().nullable().optional(),shuffle:c.boolean().nullable().optional(),repeat:c.enum(["off","one","all"]).nullable().optional()})}),xD=ke("volume",{state:c.object({level:ue.nullable(),muted:c.boolean().nullable()})}),kD=ke("inputSource",{config:c.object({sources:c.array(c.string())}),state:c.object({source:c.string().nullable()})}),wD=ke("startStop",{config:c.object({supportsPause:c.boolean().default(!1)}),state:c.object({state:c.enum(["running","paused","stopped","unknown"])})}),SD=ke("scene",{state:c.object({lastActivated:Q.nullable().optional()})}),_D=ke("camera",{config:c.object({protocols:c.array(c.enum(["rtsp","webrtc","hls","snapshot"]))}),state:c.object({streaming:c.boolean().nullable().optional()})}),$D=ke("sensor",{config:c.object({measurement:oD,unit:c.string()}),state:c.object({value:c.number().nullable(),ts:Q.nullable().optional()})}),ED=ke("binarySensor",{config:c.object({sensorType:iD}),state:c.object({active:c.boolean().nullable(),lastChanged:Q.nullable().optional()})}),AD=ke("battery",{state:c.object({level:ue.nullable(),charging:c.boolean().nullable().optional(),low:c.boolean().nullable().optional()})}),ID=ke("energyMeter",{state:c.object({power:c.number().nullable().optional(),energy:c.number().nullable().optional(),voltage:c.number().nullable().optional(),current:c.number().nullable().optional()})}),CD=ke("doorbell",{state:c.object({lastPress:Q.nullable().optional()})}),PD=ke("connectivity",{config:c.object({transport:c.enum(["wifi","thread","zigbee","zwave","ethernet","ble","cloud","matter","unknown"])}),state:c.object({online:c.boolean().nullable(),signal:c.number().nullable().optional()})}),H0=c.enum(["flash","strobe","pulse","colorFade","colorLoop","candle","rainbow","siren","meter"]),mt=c.object({hue:c.number().min(0).max(360),saturation:ue}),_n=c.number().int().min(20).max(6e5),Lh=c.number().int().min(1).max(1e3).nullable().default(null),Nr=c.discriminatedUnion("kind",[c.object({kind:c.literal("flash"),count:c.number().int().min(1).max(100).default(3),onMs:_n.default(300),offMs:_n.default(300),color:mt.nullable().default(null),brightness:ue.nullable().default(null)}),c.object({kind:c.literal("strobe"),hz:c.number().min(.5).max(25).default(8),durationMs:_n.default(3e3),color:mt.nullable().default(null)}),c.object({kind:c.literal("pulse"),periodMs:_n.default(2e3),minPct:ue.default(5),maxPct:ue.default(100),color:mt.nullable().default(null),cycles:Lh}),c.object({kind:c.literal("colorFade"),from:mt.nullable().default(null),to:mt,durationMs:_n.default(2e3),easing:c.enum(["linear","ease"]).default("ease")}),c.object({kind:c.literal("colorLoop"),colors:c.array(mt).min(2).max(16),holdMs:_n.default(1e3),fadeMs:c.number().int().min(0).max(6e5).default(800),loops:Lh,direction:c.enum(["forward","pingpong"]).default("forward")}),c.object({kind:c.literal("candle"),intensity:ue.default(50),warmthKelvin:En.nullable().default(null),durationMs:_n.nullable().default(null)}),c.object({kind:c.literal("rainbow"),cycleMs:_n.default(4e3),saturation:ue.default(100),brightness:ue.default(100),loops:Lh}),c.object({kind:c.literal("siren"),colorA:mt.default({hue:0,saturation:100}),colorB:mt.default({hue:240,saturation:100}),hz:c.number().min(.5).max(10).default(4),durationMs:_n.nullable().default(null)}),c.object({kind:c.literal("meter"),source:c.enum(["context","usage","cost"]),stops:c.array(c.object({at:c.number().min(0),color:mt})).min(2).max(6).default([{at:0,color:{hue:120,saturation:90}},{at:75,color:{hue:40,saturation:95}},{at:95,color:{hue:0,saturation:95}}])})]),TD=ke("effect",{config:c.object({kinds:c.array(H0).default(["flash"]),supportsColor:c.boolean().default(!1)}),state:c.object({active:H0.nullable()})}),RD=c.discriminatedUnion("type",[sD,aD,cD,lD,uD,dD,pD,mD,fD,gD,hD,vD,yD,bD,xD,kD,wD,SD,_D,$D,ED,AD,ID,CD,PD,TD]),jt=c.enum(["power","brightness","colorTemperature","color","segmentColor","thermostat","humidity","lock","cover","fan","mode","toggle","range","mediaTransport","volume","inputSource","startStop","scene","camera","sensor","binarySensor","battery","energyMeter","doorbell","connectivity","effect"]),W0=c.enum(["needs-password","plan-required"]),OD=c.enum(["device-permission-limited","provider-auth-rejected","local-transport-unsupported","subscription-denied","live-updates-lost","rate-limited","plan-required"]),DD=c.object({reason:OD,since:Q,detail:c.string().max(200).optional()}),ND="Tapo app: Me > Tapo Lab > Third-Party Compatibility; Kasa app: the device's Settings",LD={"device-permission-limited":{headline:"The device is refusing commands",remedy:"On the device: Settings \u25B8 System \u25B8 Advanced system settings \u25B8 Control by mobile apps \u25B8 Network access \u2014 set it to Enabled or Permissive, then reconnect here."},"provider-auth-rejected":{headline:"The device rejected the saved sign-in",remedy:`In the vendor's phone app, turn this device's Third-Party Compatibility off and on again (${ND}), then reconnect. If you changed the account password, reconnect with the new one.`},"local-transport-unsupported":{headline:"This firmware can't be controlled over your network",remedy:"The device linked, but its firmware only accepts the vendor's own encrypted transport, which AC Bridge does not speak yet. Control it from the vendor app for now."},"subscription-denied":{headline:"The broker refused our subscription",remedy:"Give this MQTT user read access to the discovery prefix (usually `homeassistant/#`) in your broker's ACL, then reconnect. Until then no devices can be discovered."},"live-updates-lost":{headline:"Live updates from this hub stopped",remedy:"We are still retrying in the background, and buttons/motion will not fire until it recovers. If it stays down, power-cycle the hub and reconnect here."},"rate-limited":{headline:"The device locked us out after repeated failures",remedy:"Wait a few minutes without retrying. If the device's password changed, reconnect with the new one \u2014 repeated wrong attempts are what triggers the lockout."},"plan-required":{headline:"This account needs a paid plan with the vendor",remedy:"The vendor now requires a commercial API plan for third-party control. Nothing on this PC can restore it \u2014 check the vendor's developer plan, or remove the account here."}};function Z0(e){return LD[e]}var V0={"needs-password":"needs password","plan-required":"plan required"},UD=c.object({sourceId:c.string(),provider:Ut,providerAccountId:c.string(),nativeId:c.string(),nativeType:c.string().optional(),reachability:c.enum(["local","cloud"]),online:c.boolean(),attention:W0.nullable().optional(),credentialRef:c.string().nullable().optional(),lastSeen:Q.nullable().optional()}),jD=c.object({id:c.string(),name:c.string(),providerRefs:c.array(c.object({provider:Ut,nativeId:c.string()})).default([])}),zD=c.object({accountId:c.string(),provider:Ut,displayName:c.string(),reachability:c.enum(["local","cloud"]),status:c.enum(["linked","needs_reauth","revoked"]),attention:DD.nullable().optional(),expiresAt:Q.nullable().optional()});var FD=c.object({id:c.string(),type:ws,name:c.string(),areaId:c.string().nullable(),manufacturer:c.string().nullable().optional(),model:c.string().nullable().optional(),firmwareVersion:c.string().nullable().optional(),online:c.boolean(),reachability:rD,attention:W0.nullable().optional(),parentId:c.string().nullable().optional(),members:c.array(c.string()).optional(),sources:c.array(UD).min(1),preferredSourceId:c.string(),capabilities:c.array(RD),updatedAt:Q,raw:c.unknown().optional()}),q0=c.object({version:c.literal(1),nodeId:c.string(),updatedAt:Q,areas:c.array(jD),accounts:c.array(zD),devices:c.array(FD)}),MD=c.enum(["relay-do-sealed","hub-local"]),J8=c.object({accountId:c.string(),provider:Ut,providerAccountId:c.string(),nodeId:c.string(),credentialLocation:MD,scopes:c.array(c.string()).default([]),status:c.enum(["linked","needs_reauth","revoked"]),displayName:c.string(),expiresAt:Q.nullable().optional(),linkedAt:Q}),G0=c.enum(["open","guarded","locked"]),Uh=c.enum(["allow","confirm","deny"]),BD=c.enum(["voice","claude","app","rules"]),K8=c.object({tier:G0.default("open"),perConsumer:c.partialRecord(BD,G0).default({}),perClass:c.partialRecord(jt,Uh).default({}),perDeviceType:c.partialRecord(ws,Uh).default({}),perDevice:c.record(c.string(),Uh).default({}),confirmWindowSec:c.number().default(60)});var Pe=c.object({}),Il=e=>e.type==="cover"&&(e.config.kind==="garage"||e.config.kind==="door"||e.config.kind==="valve"),Ss={power:[{command:"turnOn",params:Pe},{command:"turnOff",params:Pe},{command:"toggle",params:Pe}],brightness:[{command:"setBrightness",params:c.object({level:ue})},{command:"adjustBrightness",params:c.object({delta:c.number().min(-100).max(100)})}],colorTemperature:[{command:"setColorTemperature",params:c.object({kelvin:En})}],color:[{command:"setColor",params:c.object({hue:c.number().min(0).max(360),saturation:ue})}],segmentColor:[{command:"setSegmentColors",voice:!1,params:c.object({segments:c.array(c.object({index:c.number().int().nonnegative(),hue:c.number().min(0).max(360),saturation:ue})).min(1).max(512)})}],thermostat:[{command:"setThermostatMode",params:c.object({mode:jh})},{command:"setSetpoint",params:c.object({celsius:$n})},{command:"setRange",params:c.object({heatCelsius:$n,coolCelsius:$n}),gate:e=>e.type==="thermostat"&&e.config.supportsRange}],humidity:[{command:"setHumidity",params:c.object({percent:ue}),gate:e=>e.type==="humidity"&&e.config.settable}],lock:[{command:"lock",params:Pe},{command:"unlock",params:Pe,confirm:!0}],cover:[{command:"open",params:Pe,confirm:Il},{command:"close",params:Pe,confirm:Il},{command:"stop",params:Pe,confirm:Il},{command:"setPosition",params:c.object({position:ue}),confirm:Il,gate:e=>e.type==="cover"&&e.config.supportsPosition},{command:"setTilt",params:c.object({tilt:ue}),gate:e=>e.type==="cover"&&e.config.supportsTilt}],fan:[{command:"turnOn",params:Pe},{command:"turnOff",params:Pe},{command:"setFanSpeed",params:c.object({level:ue})},{command:"setFanPreset",params:c.object({preset:c.string()}),gate:e=>e.type==="fan"&&e.config.presets.length>0},{command:"setOscillate",params:c.object({oscillating:c.boolean()}),gate:e=>e.type==="fan"&&e.config.supportsOscillate}],mode:[{command:"setMode",params:c.object({value:c.string()})}],toggle:[{command:"setToggle",params:c.object({on:c.boolean()})}],range:[{command:"setRange",params:c.object({value:c.number()})},{command:"adjustRange",params:c.object({delta:c.number()})}],mediaTransport:[{command:"play",params:Pe},{command:"pause",params:Pe},{command:"stop",params:Pe},{command:"next",params:Pe},{command:"previous",params:Pe},{command:"seek",params:c.object({positionSec:c.number().nonnegative()})},{command:"setShuffle",params:c.object({on:c.boolean()})},{command:"setRepeat",params:c.object({mode:c.enum(["off","one","all"])})}],volume:[{command:"setVolume",params:c.object({level:ue})},{command:"adjustVolume",params:c.object({delta:c.number().min(-100).max(100)})},{command:"setMute",params:c.object({muted:c.boolean()})}],inputSource:[{command:"selectInput",params:c.object({source:c.string()})}],startStop:[{command:"start",params:Pe},{command:"stop",params:Pe},{command:"pause",params:Pe,gate:e=>e.type==="startStop"&&e.config.supportsPause},{command:"resume",params:Pe,gate:e=>e.type==="startStop"&&e.config.supportsPause}],scene:[{command:"activate",params:Pe}],effect:[{command:"startEffect",params:c.object({spec:Nr})},{command:"stopEffect",params:Pe}],camera:[{command:"getStream",params:c.object({protocol:c.enum(["rtsp","webrtc","hls"])}),voice:!1,confirm:!0,returns:c.object({url:c.string(),token:c.string().optional(),expiresAt:Q.optional()})},{command:"getSnapshot",params:Pe,voice:!1,confirm:!0,returns:c.object({url:c.string(),expiresAt:Q.optional()})}],sensor:[],binarySensor:[],battery:[],energyMeter:[],doorbell:[],connectivity:[]};var HD=c.object({hs:mt.nullable().default(null),brightness:ue.nullable().default(null),kelvin:En.nullable().default(null)}),GD=c.enum(["shared","dedicated"]),WD=c.enum(["focused","priority","mostRecent"]),ZD=c.enum(["profile","repo","session"]),VD=c.object({mode:GD.default("shared"),subMode:WD.default("mostRecent"),priorityBy:ZD.default("session"),priority:c.array(c.string()).default([]),dedicatedTo:c.string().nullable().default(null)}),Ko=c.object({name:c.string().nullable().default(null),instanceNames:c.record(c.string(),c.string()).default({}),favouriteScenes:c.array(c.string()).default([]),groups:c.array(c.string()).default([]),main:HD.default({hs:null,brightness:null,kelvin:null}),arbitration:VD.default({mode:"shared",subMode:"mostRecent",priorityBy:"session",priority:[],dedicatedTo:null}),participate:c.boolean().default(!0),wakeIfOff:c.boolean().default(!0),allowSecurity:c.boolean().default(!1)}),Lr=c.record(c.string(),Ko).default({});var qD=c.object({id:c.string(),name:c.string()}),Cl=c.array(qD).default([]);async function J0(e,t,n,o=3){let r=t;for(let i=0;i<o;i+=1){let s=n(r.config),a=await e(r.version,s);if(a.ok)return{outcome:"committed",version:a.version,config:s};if(a.error==="version_conflict"){r={version:a.version,config:a.config};continue}return{outcome:"error",...a.error!==void 0?{error:a.error}:{}}}return{outcome:"conflict-exhausted"}}function _s(e){let t=Cl.safeParse(e.deviceGroups);return t.success?t.data:[]}function K0(e,t,n){let o=n.trim();return o?{...e,deviceGroups:[..._s(e),{id:t,name:o}]}:null}function X0(e,t,n){let o=n.trim();return o?{...e,deviceGroups:_s(e).map(r=>r.id===t?{...r,name:o}:r)}:null}function Y0(e,t){let n={...e,deviceGroups:_s(e).filter(r=>r.id!==t)},o=Lr.safeParse(e.deviceSettings);if(o.success){let r=o.data,i=!1,s={};for(let[a,l]of Object.entries(r))l.groups.includes(t)?(s[a]={...l,groups:l.groups.filter(u=>u!==t)},i=!0):s[a]=l;i&&(n.deviceSettings=s)}return n}import{readFileSync as JD}from"node:fs";import KD from"node:net";function XD(e){return new Promise(t=>{let n=KD.connect({host:"127.0.0.1",port:e},()=>{n.destroy(),t(!0)});n.on("error",()=>t(!1)),n.setTimeout(500,()=>{n.destroy(),t(!1)})})}function $s(e={}){let t=io(e);return{dir:t.dir,source:t.source,port:t.beacon?.port??le().hubPort,tokenFile:Id(t.dir),advertised:t.beacon!==null}}async function Ue(){return XD($s().port)}var Pl=null;function Re(){let e=Pl;if(!e||e.reason==="offline")return"hub offline \u2014 run `acbridge start`";let n=e.target.source==="peer-wsl"||e.target.source==="peer-windows"?` (it runs ${e.target.source==="peer-wsl"?"on Windows":"inside WSL"}, state in ${e.target.dir})`:"";return e.reason==="absent"?`a hub is running on port ${e.target.port}${n}, but this account has no hub-token to present. Sign in with \`acbridge login\`, or restart the bridge from the side that owns it.`:`the hub on port ${e.target.port}${n} REJECTED this credential (401) \u2014 it belongs to another account or another run. Restart the bridge (\`acbridge stop\` then \`acbridge start\`) to re-mint it.`}function zh(e){return Id(ee,e)}async function Q0(e,t,n){let o=Xo(e.tokenFile).trim();if(!o)return Pl={reason:e.advertised?"absent":"offline",target:e},e.advertised?{hubOffline:!0,hubUnauthorized:"absent"}:{hubOffline:!0};let r=n?.body!==void 0;try{let i=await fetch(`http://127.0.0.1:${e.port}${t}`,{method:n?.method??"GET",headers:{"x-bridge-hub-token":o,...r?{"content-type":"application/json"}:{}},...r?{body:JSON.stringify(n?.body)}:{},signal:AbortSignal.timeout(n?.timeoutMs??1e4)}),s;try{s=await i.json()}catch{s=void 0}return i.status===401&&(Pl={reason:"rejected",target:e}),{status:i.status,body:s,...i.status===401?{hubUnauthorized:"rejected"}:{}}}catch{return Pl={reason:"offline",target:e},{hubOffline:!0}}}async function Z(e,t){let n=$s(),o=await Q0(n,e,t);if(!o.hubOffline&&!o.hubUnauthorized)return o;let r=$s({fresh:!0});return r.port===n.port&&r.tokenFile===n.tokenFile?o:Q0(r,e,t)}function Xo(e){try{return JD(e,"utf8")}catch{return""}}import{spawn as oN}from"node:child_process";import{chmodSync as iN,existsSync as Mh,openSync as sN,realpathSync as aN,writeFileSync as aS}from"node:fs";import cN from"node:path";function Es(){return!0}function eS(){return"1.4.0"}import{request as rN}from"node:http";var YD=3e3,QD=15e3;function eN(e){if(!e)return null;try{let t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return null;let{pid:n,startedAt:o,lastBeat:r}=t;return!Number.isInteger(n)||n<=0||typeof o!="number"||typeof r!="number"?null:{pid:n,startedAt:o,lastBeat:r}}catch{return null}}function tS(e){let t=e?.read??L;return eN(t(e?.file??Ua))}function tN(e,t){let n=t?.write??((r,i)=>_e(r,i,384)),o=t?.now??Date.now;try{n(t?.file??Ua,JSON.stringify({pid:t?.pid??process.pid,startedAt:e,lastBeat:o()}))}catch{}}function nN(e){try{(e?.remove??Ie)(e?.file??Ua)}catch{}}function nS(e,t={}){let n=t.write??(u=>tN(u)),o=t.remove??(()=>nN()),r=t.setInterval??((u,d)=>setInterval(u,d)),i=t.clearInterval??(u=>clearInterval(u)),s=()=>{try{n(e)}catch{}};s();let a=r(s,YD);a.unref?.();let l=!1;return()=>{l||(l=!0,i(a),o())}}function rS(e){let{beacon:t,pid:n}=e;return!Number.isInteger(n)||n<=0||!t||t.pid!==n||!(e.isAlive??za)(n)?!1:(e.now??Date.now())-t.lastBeat<=(e.staleAfterMs??QD)}async function As(e){return(await Z("/local/hub/hold",{method:"POST",body:{kind:e,pid:process.pid}})).body?.holderId??null}function Fh(e,t={}){let n=$s(),o=Xo(n.tokenFile).trim();if(!o)return Promise.resolve(null);let r=JSON.stringify({kind:e,pid:process.pid,stream:!0});return new Promise(i=>{let s=!1,a=l=>{s||(s=!0,i(l))};try{let l=rN({host:"127.0.0.1",port:n.port,path:"/local/hub/hold",method:"POST",headers:{"x-bridge-hub-token":o,"content-type":"application/json","content-length":Buffer.byteLength(r)}},u=>{if(u.statusCode!==200)return u.resume(),a(null);u.socket?.unref(),u.once("data",d=>{try{a(JSON.parse(d.toString("utf8").split(`
|
|
246
|
+
`)[0]??"").holderId??null)}catch{a(null)}}),u.once("close",()=>a(null))});l.on("error",()=>a(null)),l.setTimeout(t.timeoutMs??5e3,()=>a(null)),l.end(r)}catch{a(null)}})}async function oS(e){let t=await Z("/local/hub/beat",{method:"POST",body:{holderId:e},timeoutMs:4e3});return t.hubOffline?"offline":t.status===200?"ok":"unknown"}async function Tl(e){await Z("/local/hub/release",{method:"POST",body:{holderId:e},timeoutMs:4e3})}async function iS(){let e=await Z("/local/hub/shutdown",{method:"POST",body:{},timeoutMs:8e3});return!e.hubOffline&&e.status===200}async function sS(){await Z("/local/reload",{method:"POST",body:{},timeoutMs:8e3})}function Yo(e){return rS({beacon:(e.readBeacon??tS)(),pid:e.pid,...e.now!==void 0?{now:e.now}:{},...e.isAlive?{isAlive:e.isAlive}:{}})}function lN(e=process.env,t=n=>Zt(n)){if(e.BRIDGE_CLIENT_VERSION!==void 0)return{};let n=t(e);return n===null?{}:{BRIDGE_CLIENT_VERSION:n}}function uN(e=process.env,t={}){let n=t.bundled??Es(),o={...e};return n&&delete o.BRIDGE_VOICE,o}async function it(e={kind:"run"}){if(await Ue())return X("hub already running \u2014 reusing it"),{spawned:!1,holderId:await Fh(e.kind)??await As(e.kind)};let t=le(),n=Mh(Bi)?{file:process.env.APPIMAGE||process.execPath,args:[Bi]}:{file:Mh(Fa)?Fa:"tsx",args:[Nx]};aS(Rt,"",{mode:384}),iN(Rt,384);let o=sN(Rt,"a"),r=oN(n.file,n.args,{cwd:xn,detached:!0,stdio:["ignore",o,o],env:{...uN(),BRIDGE_RELAY_URL:t.relayUrl,BRIDGE_HUB_PORT:String(t.hubPort),BRIDGE_HUB_HOLDER:e.kind,BRIDGE_HUB_HOLDER_PID:String(process.pid),...lN()}});r.unref(),r.pid&&aS(Ci,String(r.pid));for(let i=0;i<30;i++){let s=Xo(Rt);if(/relay connected/i.test(s))return A("hub connected to relay"),{spawned:!0,holderId:await Fh(e.kind)??await As(e.kind)};if(/relay ws error|FATAL/i.test(s))throw new Error(`hub failed to connect:
|
|
247
|
+
${ce(cS(s,6))}`);await dN(1e3)}throw new Error(`hub timed out connecting to the relay. Last log:
|
|
248
|
+
${ce(cS(Xo(Rt),8))}`)}function lS(){sb()}function uS(e,t){let n=t?.argv1??process.argv[1]??"",o=t?.exists??Mh,r=t?.tsxBin??Fa,i=(t?.env??process.env).APPIMAGE||process.execPath;if(t?.bundled??Es()){let l=n;try{l=(t?.realpath??aN)(n)}catch{}return{file:i,args:[l,"daemon",...e]}}if(/\.(mjs|cjs|js)$/.test(n))return{file:i,args:[n,"daemon",...e]};let a=n||cN.join(xn,"cli","src","index.ts");return{file:o(r)?r:"tsx",args:[a,"daemon",...e]}}function cS(e,t){return e.trimEnd().split(`
|
|
241
249
|
`).slice(-t).join(`
|
|
242
|
-
`)}function
|
|
243
|
-
acbridge connect <ip> --as ${tl.join("|")} [--name <display-name>]
|
|
250
|
+
`)}function dN(e){return new Promise(t=>setTimeout(t,e))}async function Qo(e,t,n={},o=3){let r=await(n.fetchSnapshot??Ma)(e);if(!r)return{outcome:"unavailable"};let i=n.put??Mx,s=await J0((a,l)=>i(e,a,l),r,t,o);if(s.outcome==="committed"){let a=n.refresh??(()=>Z("/local/rules/refresh",{method:"POST",body:{}}));try{await a()}catch{}}return s}var Rl=["Usage: acbridge devices [list] [--json]"," acbridge devices on|off <device>"," acbridge devices set <device> <capability.command|command> [--param k=v ...]"," acbridge devices set-main <device> [--color <hue>,<sat>|none] [--brightness <0-100>|none] [--kelvin <k>|none]"].join(`
|
|
251
|
+
`);function cr(e,t){let n=e.find(s=>s.id===t);if(n)return{ok:!0,device:n};let o=t.toLowerCase(),r=e.filter(s=>s.name.toLowerCase()===o);if(r.length===1)return{ok:!0,device:r[0]};let i=r.length>1?r:e.filter(s=>s.name.toLowerCase().includes(o));return i.length===1?{ok:!0,device:i[0]}:i.length>1?{ok:!1,kind:"ambiguous",candidates:i.map(s=>({id:s.id,name:s.name}))}:{ok:!1,kind:"not-found",candidates:[]}}function Bh(e){let t={};for(let n of e){let o=n.indexOf("=");if(o<=0)return{ok:!1,message:`--param needs k=v, got: ${n}`};let r=n.slice(0,o),i=n.slice(o+1);if(i==="true"||i==="false")t[r]=i==="true";else if(i!==""&&Number.isFinite(Number(i)))t[r]=Number(i);else if(i.startsWith("[")||i.startsWith("{"))try{t[r]=JSON.parse(i)}catch{return{ok:!1,message:`--param ${r} isn't valid JSON`}}else t[r]=i}return{ok:!0,params:t}}function Ol(e,t,n){let o=t.indexOf("."),r=o>0?t.slice(0,o):null,i=o>0?t.slice(o+1):t,s=[];for(let d of e.capabilities)if(!(r&&d.type!==r))for(let p of Ss[d.type]??[])p.command===i&&(p.gate&&!p.gate(d)||s.push({cap:d,entry:p}));if(s.length===0)return r&&!e.capabilities.some(d=>d.type===r)?{ok:!1,message:`${e.name} doesn't have the "${r}" capability`}:{ok:!1,message:`no command "${i}" on ${e.name}${r?` (${r})`:""}`};if(s.length>1)return{ok:!1,message:`"${i}" is ambiguous on ${e.name} \u2014 qualify it: ${s.map(d=>`${d.cap.type}.${i}`).join(" | ")}`};let{cap:a,entry:l}=s[0],u=l.params.safeParse(n);if(!u.success){let d=u.error.issues[0];return{ok:!1,message:`bad params for ${a.type}.${i}: ${d?`${d.path.join(".")} ${d.message}`:"invalid"}`}}return{ok:!0,capability:a.type,command:i,params:u.data}}function pN(e,t){return{deviceId:e,capability:t.capability,command:t.command,params:t.params,consumer:"app"}}function mN(e,t){let n=new Map(e.areas.map(r=>[r.id,r.name])),o=[];t?.note&&o.push(`(${t.note})`);for(let r of e.accounts){if(!r.attention)continue;let i=Z0(r.attention.reason);o.push(`! ${r.provider}: ${i.headline}`),o.push(` ${i.remedy}`)}if(e.devices.length===0)return o.push("no devices connected \u2014 run `acbridge scan` to find some, or link an account: `acbridge link <provider>`"),o;for(let r of[...e.devices].sort((i,s)=>i.name.localeCompare(s.name))){let i=r.areaId&&n.get(r.areaId)||"\u2014",s=r.attention?V0[r.attention]:r.reachability;o.push(`${r.name.padEnd(26)} ${r.type.padEnd(12)} ${i.padEnd(14)} ${s.padEnd(15)} ${r.id}`)}return o}async function An(){let e=await Z("/local/devices",{method:"GET",timeoutMs:5e3});if(!e.hubOffline&&e.status===200&&e.body)return{doc:e.body};let t=Jt();if(t.state==="mismatch")return{refusal:{message:t.message,exitCode:3}};if(t.state!=="ok")return null;let n=await jx(t.token);return n?{doc:n,note:"relay cache \u2014 bridge not running; state may be stale"}:null}async function dS(e=[]){let t=e.includes("--json");t&&fe(!0);let n=e.filter(d=>!d.startsWith("--")),o=n[0]??"list";if(o==="list"){let d=await An();if(d&&"refusal"in d)return $(d.refusal.message,d.refusal.exitCode);if(!d)return $("no device graph available \u2014 start the bridge (`acbridge start`) or sign in",1);if(t)V(d.doc);else for(let p of mN(d.doc,d.note?{note:d.note}:void 0))v(p);return 0}if(o==="set-main")return hN(e,t);if(o!=="on"&&o!=="off"&&o!=="set")return v(Rl),$(`unknown devices subcommand: ${o}`,2);let r=n[1];if(!r)return v(Rl),$("which device? give an id (dev_\u2026) or a name",2);let i=await An();if(i&&"refusal"in i)return $(i.refusal.message,i.refusal.exitCode);if(!i)return $("no device graph available \u2014 start the bridge (`acbridge start`) or sign in",1);let s=cr(i.doc.devices,r);if(!s.ok){if(s.kind==="ambiguous"){for(let d of s.candidates)v(` ${d.name} (${d.id})`);return $(`"${r}" matches several devices \u2014 name one of the ids above`,2)}return $(`no device matches "${r}" \u2014 try \`acbridge devices\``,2)}let a;if(o==="on"||o==="off")a=Ol(s.device,o==="on"?"power.turnOn":"power.turnOff",{});else{let d=n[2];if(!d)return v(Rl),$("set needs a command \u2014 e.g. `acbridge devices set lamp brightness.setBrightness --param level=40`",2);let p=[];for(let f=0;f<e.length;f++)e[f]==="--param"&&e[f+1]&&p.push(e[++f]);let m=Bh(p);if(!m.ok)return $(m.message,2);a=Ol(s.device,d,m.params)}if(!a.ok)return $(a.message,2);let l=Dt({notSignedIn:{message:"Not signed in. Run `acbridge login` first.",exitCode:3}});if(!l.ok)return $(l.message,l.exitCode);let u=await Fx(l.token,pN(s.device.id,a));return u.ok?(A(`${s.device.name}: ${a.capability}.${a.command}${u.verified===!0?" (verified)":""}`),u.note&&v(ce(u.note)),t&&V({ok:!0,deviceId:s.device.id,capability:a.capability,command:a.command}),0):u.status===503?$("bridge not running \u2014 run `acbridge start` (device control routes through your PC)",1):(k(u.error??`command failed (${u.status||"network"})`),t&&V({ok:!1,error:u.error??null,status:u.status,exit:1}),1)}function fN(e){let t={},n=!1,o=e.indexOf("--color");if(o!==-1){let s=e[o+1];if(s==="none")t.hs=null;else{let a=(s??"").split(",").map(l=>Number(l.trim()));if(a.length!==2||!a.every(Number.isFinite)||a[0]<0||a[0]>360||a[1]<0||a[1]>100)return{patch:t,touched:n,bad:`--color takes <hue 0-360>,<sat 0-100> or none, got: ${s??"(none)"}`};t.hs={hue:a[0],saturation:a[1]}}n=!0}let r=e.indexOf("--brightness");if(r!==-1){let s=e[r+1];if(s==="none")t.brightness=null;else{let a=Number(s);if(!Number.isFinite(a)||a<0||a>100)return{patch:t,touched:n,bad:`--brightness takes 0-100 or none, got: ${s??"(none)"}`};t.brightness=a}n=!0}let i=e.indexOf("--kelvin");if(i!==-1){let s=e[i+1];if(s==="none")t.kelvin=null;else{let a=Number(s);if(!Number.isInteger(a)||a<1e3||a>12e3)return{patch:t,touched:n,bad:`--kelvin takes a whole colour temperature 1000-12000 (or none), got: ${s??"(none)"}`};t.kelvin=a}n=!0}return{patch:t,touched:n}}function gN(e,t,n){let o=Lr.safeParse(e.deviceSettings);if(e.deviceSettings!==void 0&&!o.success)return{error:"this machine's device settings are unreadable by this CLI version \u2014 update acbridge (nothing was written)"};let r=o.success?o.data:{},i=r[t]??Ko.parse({}),s=Ko.safeParse({...i,main:{...i.main??{},...n}});return s.success?{config:{...e,deviceSettings:{...r,[t]:s.data}}}:{error:`that main look doesn't validate: ${s.error.issues[0]?.message??"invalid"}`}}async function hN(e,t){let o=e.filter((m,f)=>!m.startsWith("--")&&!["--color","--brightness","--kelvin"].includes(e[f-1]??""))[1];if(!o)return v(Rl),$("which device? give an id (dev_\u2026) or a name",2);let{patch:r,touched:i,bad:s}=fN(e);if(s)return $(s,2);if(!i)return $("nothing to change \u2014 give at least one of --color / --brightness / --kelvin",2);let a=await An();if(a&&"refusal"in a)return $(a.refusal.message,a.refusal.exitCode);if(!a)return $("no device graph available \u2014 start the bridge (`acbridge start`) or sign in",1);let l=cr(a.doc.devices,o);if(!l.ok){if(l.kind==="ambiguous"){for(let m of l.candidates)v(` ${m.name} (${m.id})`);return $(`"${o}" matches several devices \u2014 name one of the ids above`,2)}return $(`no device matches "${o}" \u2014 try \`acbridge devices\``,2)}let u=Dt({notSignedIn:{message:"Not signed in. Run `acbridge login` first.",exitCode:3}});if(!u.ok)return $(u.message,u.exitCode);let d=null,p=await Qo(u.token,m=>{let f=gN(m,l.device.id,r);if("error"in f)throw new Error(f.error);return f.config}).catch(m=>(d=m instanceof Error?m.message:String(m),{outcome:"error",error:d}));if(p.outcome!=="committed"){let m=p.outcome==="unavailable"?"couldn't read the device settings from the relay \u2014 check your connection":p.outcome==="conflict-exhausted"?"device settings changed elsewhere \u2014 try again":p.error??"couldn't save the main look";return $(m,1)}return A(`${l.device.name}: main look updated`),t&&V({ok:!0,deviceId:l.device.id,main:r}),0}var vN=e=>new Date(e).toISOString().replace("T"," ").slice(0,19);function yN(e,t){return e.length===0?["no device actions recorded yet \u2014 the ledger fills as devices are driven from voice, the app, Claude or rules"]:e.map(n=>{let o=t.get(n.deviceId)??n.deviceId,r=n.ok?"ok":`FAILED${n.error?` (${n.error})`:""}`,i=n.confirmRequired?" [security]":"";return`${vN(n.ts)} ${o.padEnd(24)} ${`${n.capability}.${n.command}`.padEnd(26)} ${n.consumer.padEnd(7)} ${r}${i}`})}async function pS(e=[]){let t=e.includes("--json");t&&fe(!0);let n=Dt({notSignedIn:{message:"Not signed in. Run `acbridge login` first.",exitCode:3}});if(!n.ok)return $(n.message,n.exitCode);let o=await zx(n.token);if(!o)return $("couldn't read the device ledger from the relay \u2014 check your connection",1);if(t)return V(o),0;let r=await An(),i=new Map;if(r&&!("refusal"in r))for(let s of r.doc.devices)i.set(s.id,s.name);for(let s of yN(o.audit,i))v(s);return v(ce("the relay keeps the most recent 200 actions; security actions are retained at least 90 days")),0}import{chmodSync as LN,readFileSync as _S,rmSync as UN,writeFileSync as jN}from"node:fs";import{createInterface as xS}from"node:readline/promises";function en(e={}){let t=(e.payloadVersion??(()=>Zt()))();if(t!==null)return{version:t,channel:"app"};let n=(e.bundledVersion??eS)(),o=zy(n);return o!==null?{version:o,channel:"npm"}:{version:null,channel:null}}function Dl(e=L){let t=$e(),n=e(t.refreshFile)?.trim(),o=n?Qe(n):null;if(o)return o;let r=e(t.accessFile)?.trim();return r?Qe(r):null}var mS="https://www.ac-bridge.com/home";function fS(e,t){return!t||typeof t.plan!="string"?{allowed:!0}:t.plan==="paid"&&t.serviceOk===!1?{allowed:!1,message:`Your subscription has ended \u2014 manage your plan at ${mS}, then retry.`}:t.plan==="free"?{allowed:!1,message:`No active subscription \u2014 start the 3-day free trial at ${mS}, then retry.`}:{allowed:!0}}var bN=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;function gS(e){let t=bN.exec(e);if(!t)return null;let n=t[4]?t[4].split(".").map(o=>/^\d+$/.test(o)?Number(o):o):[];return{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),prerelease:n}}function xN(e,t){let n=typeof e=="number",o=typeof t=="number";return n&&!o?-1:!n&&o?1:e<t?-1:e>t?1:0}function ei(e,t){let n=gS(e),o=gS(t);if(!n||!o)return null;for(let i of["major","minor","patch"])if(n[i]!==o[i])return n[i]<o[i]?-1:1;if(n.prerelease.length===0&&o.prerelease.length===0)return 0;if(n.prerelease.length===0)return 1;if(o.prerelease.length===0)return-1;let r=Math.min(n.prerelease.length,o.prerelease.length);for(let i=0;i<r;i++){let s=xN(n.prerelease[i],o.prerelease[i]);if(s!==0)return s}return n.prerelease.length!==o.prerelease.length?n.prerelease.length<o.prerelease.length?-1:1:0}var hS="npm i -g acbridge@latest",kN="https://www.ac-bridge.com/api/releases/manifest",Hh=6*36e5,wN="https://www.ac-bridge.com/home?tab=download";function SN(e=process.platform){return e==="win32"?"windows":e==="darwin"?"macos":e==="linux"?"linux":null}function vS(e){if(typeof e!="object"||e===null)return null;let t=e;if(t.schemaVersion!==1)return null;let n={},o=typeof t.platforms=="object"&&t.platforms!==null?t.platforms:{};for(let s of["windows","macos","linux"]){let a=o[s];typeof a=="object"&&a!==null&&typeof a.version=="string"&&(n[s]={version:a.version})}let r=[];for(let s of Array.isArray(t.builds)?t.builds:[]){if(typeof s!="object"||s===null)continue;let a=s,l=a.platform;l!=="windows"&&l!=="macos"&&l!=="linux"||typeof a.arch!="string"||!a.arch||typeof a.version!="string"||r.push({platform:l,arch:a.arch,version:a.version})}let i=typeof t.cli=="object"&&t.cli!==null?t.cli:null;return{schemaVersion:1,minimumVersion:typeof t.minimumVersion=="string"?t.minimumVersion:null,downloadPage:typeof t.downloadPage=="string"&&t.downloadPage?t.downloadPage:wN,platforms:n,builds:r,cli:i?{version:typeof i.version=="string"?i.version:null,minimumVersion:typeof i.minimumVersion=="string"?i.minimumVersion:null}:null}}async function Nl(e={}){let n=(e.isDevBuild??en().version===null)&&process.env.BRIDGE_UPDATE_MANIFEST_URL||kN;try{let o=await(e.fetchImpl??fetch)(n,{signal:AbortSignal.timeout(e.timeoutMs??6e3)});if(!o.ok)return null;let r=vS(await o.json());return r&&_N(r,e.now),r}catch{return null}}function _N(e,t=Date.now()){try{let n={};try{let o=JSON.parse(L(Ee)??"{}");typeof o=="object"&&o!==null&&!Array.isArray(o)&&(n=o)}catch{n={}}n.updateCheck={manifest:e,fetchedAt:t},_e(Ee,`${JSON.stringify(n,null,2)}
|
|
252
|
+
`)}catch{}}function Ll(e=Hh,t=Date.now()){try{let n=L(Ee);if(!n)return null;let r=JSON.parse(n).updateCheck;return!r||typeof r!="object"||typeof r.fetchedAt!="number"||t-r.fetchedAt>e?null:vS(r.manifest)}catch{return null}}function $N(e,t,n){if(!t)return;let o;for(let r of e.builds)r.platform!==t||r.arch!==n&&r.arch!=="universal"||(o===void 0||ei(r.version,o)===1)&&(o=r.version);return o??e.platforms[t]?.version}function Is(e,t,n=process.platform,o="app",r=process.arch){if(e===null)return{state:"dev"};if(!t)return{state:"unknown"};if(o==="npm"){let s=t.cli;return s?s.minimumVersion&&ei(e,s.minimumVersion)===-1?{state:"blocked",current:e,minimum:s.minimumVersion,upgrade:hS}:s.version&&ei(e,s.version)===-1?{state:"update",current:e,latest:s.version,upgrade:hS}:{state:"current",current:e}:{state:"unpublished",current:e}}if(t.minimumVersion&&ei(e,t.minimumVersion)===-1)return{state:"blocked",current:e,minimum:t.minimumVersion,upgrade:t.downloadPage};let i=$N(t,SN(n),r);return i&&ei(e,i)===-1?{state:"update",current:e,latest:i,upgrade:t.downloadPage}:{state:"current",current:e}}function yS(e,t,n=process.platform,o="app",r=process.arch){let i=Is(e,t,n,o,r),s=o==="npm"?"acbridge":"app";switch(i.state){case"dev":return{grade:"info",line:"dev build \u2014 update checks skipped"};case"unknown":return{grade:"warn",line:"update check unreachable"};case"unpublished":return{grade:"info",line:`${s} ${i.current} \u2014 no update channel published yet`};case"blocked":return{grade:"bad",line:`${s} ${i.current} is below the minimum supported version ${i.minimum} \u2014 update required: ${i.upgrade}`};case"update":return{grade:"warn",line:`update available: ${i.latest} (you have ${i.current})`};case"current":return{grade:"ok",line:`${s} ${i.current} is current`}}}var IN="Not signed in on this machine. Run `acbridge login`.";function lr(e=L,t={}){let n=t.paths??$e(),o=e(n.accessFile)?.trim(),r=e(n.refreshFile)?.trim();if(o||r)return(t.resolveScope??(()=>kt()))()?{ok:!0,paired:!!r}:(t.readPointer??(()=>Te()))()?{ok:!1,message:ut.pointerMismatch}:{ok:!0,paired:!!r};let i=(t.scan??xt)();return i.length===0?{ok:!1,message:IN}:(Ot(i),{ok:!1,message:ut.pointerMismatch})}async function Ur(e){if(await(e?.hubHealthy??Ue)())return{ok:!0};let n=lr(e?.read??L);return n.ok?{ok:!0}:{ok:!1,message:n.message}}function bS(e={}){let t=e.resolveScope??(()=>kt()),o=(e.layout??hn())>=vn,r=o?(e.scan??xt)():[];(e.warnAmbiguous??(u=>Ot(u)))(r);let i=t();if(i)return i;if((e.readPointer??(()=>Te()))())return null;let a=u=>((e.writePointer??(d=>$r({sub:d})))(u),t());if(o){if(r.length!==1)return null;let u=r[0];return Ga(u,e.segmentOf)?a(u.sub):null}let l=(e.readCredentialSub??Dl)();return l?a(l):null}function CN(){let e=bS();return e?Ca({configFile:Fi(e).userConfigFile}).onboardedAt:null}function PN(e){let t=bS();t&&Pa({onboardedAt:e},{configFile:Fi(t).userConfigFile})}async function TN(e={}){let t=(e.build??en)(),n=e.clientVersion?e.clientVersion():t.version;if(n===null)return{ok:!0};let o=await(e.fetchManifest??Nl)()??(e.cachedManifest??Ll)(Hh);if(!o)return(e.warnLine??j)("update check unreachable \u2014 continuing (it will retry next run)"),{ok:!0};let r=Is(n,o,e.platform??process.platform,t.channel??"app");return r.state==="blocked"?{ok:!1,exitCode:4,message:`This AC Bridge build (${r.current}) is below the minimum supported version (${r.minimum}). Update it: ${r.upgrade}`}:(r.state==="update"&&(e.infoLine??v)(`update available: ${r.latest} (you have ${r.current}) \u2014 ${r.upgrade}`),{ok:!0})}var RN="This machine's sign-in is no longer valid (the relay rejected its stored credential). Run `acbridge login` to sign in again.";function ON(){return!!L($e().refreshFile)?.trim()}var DN="This account hasn't completed setup yet. Run `acbridge login --if-needed` on this machine to complete it.";async function ti(e={}){let t=e.read??L,n=lr(t);if(!n.ok)return{ok:!1,exitCode:3,message:n.message};let o=e.relayUrl??le().relayUrl,r=e.fetchImpl??fetch;if(!await(e.refreshToken??(p=>Vt(p)))(o)&&!(e.hasRefreshCredential??ON)())return{ok:!1,exitCode:3,message:RN};let s=t($e().accessFile)?.trim()??"",a={reachable:!1,completedAt:null};try{let p=await r(`${o.replace(/\/+$/,"")}/settings`,{headers:{authorization:`Bearer ${s}`},signal:AbortSignal.timeout(6e3)});if(p.ok){let f=(await p.json()).config?.onboarding?.completedAt;a={reachable:!0,completedAt:typeof f=="number"?f:null}}}catch{}if(a.reachable){if(a.completedAt===null)return{ok:!1,exitCode:3,message:DN};(e.cacheOnboardedAt??PN)(a.completedAt)}else if((e.cachedOnboardedAt??CN)()===null)return{ok:!1,exitCode:1,message:"Couldn't verify this account's setup with the relay \u2014 check your connection and retry."};let l=await TN(e.updateGate);if(!l.ok)return l;let u=await(e.fetchEntitlement??Xn)(s),d=fS("preflight",u);return d.allowed?{ok:!0}:{ok:!1,exitCode:5,message:d.message}}function qe(){let e=kt();return e?Fi(e):null}function tn(e,t){let n=L(e.providerAccountsFile(t));if(!n)return[];try{let o=JSON.parse(n);return Array.isArray(o)?o.filter(r=>typeof r=="object"&&r!==null):[]}catch{return[]}}function In(e,t,n){_e(e.providerAccountsFile(t),`${JSON.stringify(n,null,2)}
|
|
253
|
+
`,384)}function _t(){let e=io({fresh:!0});if(e.source==="peer-wsl"||e.source==="peer-windows"){let o=e.source==="peer-wsl"?"on Windows":"inside WSL";return k(`the bridge is running ${o} (state in ${e.dir}), so an account linked here would be saved where that hub cannot read it. Run \`acbridge link\` from ${o}, or stop that bridge and start one on this side first.`),null}let t=qe();if(t)return t;let n=lr();return n.ok?(k(Te()?"This machine's signed-in account doesn't match its stored account pointer \u2014 run `acbridge logout` then `acbridge login` to reset it.":"Couldn't resolve this machine's signed-in account \u2014 run `acbridge login` again."),null):(k(n.message),null)}var kS=e=>`${e} on the command line is world-readable via \`ps\` and saved in shell history \u2014 prefer \`${e}-file <path>\`, the interactive prompt, or its env var.`;function $t(e){if(e.file!==void 0){let t=(e.read??L)(e.file);if(t===null)return{ok:!1,message:`Couldn't read ${e.flag}-file ${e.file} \u2014 check the path and its permissions.`};let n=t.trim();return n?{ok:!0,value:n}:{ok:!1,message:`${e.flag}-file ${e.file} is empty \u2014 write the secret into it first.`}}return e.argv!==void 0?((e.warn??j)(kS(e.flag)),{ok:!0,value:e.argv.trim()}):{ok:!0,value:(e.env??"").trim()}}var NN=["tokenFile","keyFile","secretFile","passwordFile","caFile","url","token","units","host","bridgeId","key","clientId","secret","region","email","password","mfa","username","prefix"];function Wh(e){let t={},n=(o,r,i,s)=>o===`--${Gh(r)}`?(t[r]=s[++i],{i,hit:!0}):o.startsWith(`--${Gh(r)}=`)?(t[r]=o.slice(`--${Gh(r)}=`.length),{i,hit:!0}):{i,hit:!1};for(let o=0;o<e.length;o++){let r=e[o];if(!r)continue;if(r==="--sign-in"){t.signIn=!0;continue}if(r==="--user-code"){t.userCode=!0;continue}let i=!1;for(let s of NN){let a=n(r,s,o,e);if(o=a.i,a.hit){i=!0;break}}!i&&r.startsWith("--")&&(t.bad=`unknown option: ${r}`)}return t}var Gh=e=>e==="bridgeId"?"bridge-id":e==="clientId"?"client-id":e.endsWith("File")?`${e.slice(0,-4)}-file`:e,wS=e=>/^(https?|wss?):\/\/[^\s]+$/i.test(e),Cs="Usage: acbridge link home-assistant --url http://homeassistant.local:8123 [--sign-in | --token <long-lived-access-token> | --token-file <path>] [--units metric|imperial]",Ps="Usage: acbridge link hue --host <bridge-ip> [--bridge-id <id>] [--key <existing-app-key> | --key-file <path>]",Ts="Usage: acbridge link smartthings (opens a browser sign-in via the relay; tokens seal at the relay)",ni="Usage: acbridge link tuya [--user-code] [--client-id <id>] [--secret <access-secret> | --secret-file <path>] [--region eu|eu-w|us|us-e|cn|in] (eu-w/us-e = the Azure DCs; --user-code signs in with the Smart Life app instead of a Cloud Project)",Rs="Usage: acbridge link meross [--email <you@example.com>] [--password <pw> | --password-file <path>] [--region eu|us|ap] [--mfa <6-digit-2fa-code>]",Os="Usage: acbridge link ewelink [--email <you@example.com>] [--password <pw> | --password-file <path>] [--region eu|us|as|cn]",Ds="Usage: acbridge link govee [--key <govee-api-key> | --key-file <path>] (Govee Home app \u2192 profile \u2192 Settings \u2192 Apply for API Key)",Ns="Usage: acbridge link mqtt --host <broker-host[:port]> [--username <u>] [--password <p> | --password-file <path>] [--ca-file <path-to-broker-ca.pem>] [--prefix homeassistant]",SS="nanoleaf pairs per-device, not per-account: run `acbridge scan`, then `acbridge connect <device>` and hold the panel's power button.";async function zt(e,t=process.stdout){let n=xS({input:process.stdin,output:t});try{return await n.question(e)}finally{n.close()}}async function jr(e,t=process.stdout){let n=xS({input:process.stdin,output:t}),o=n,r=o._writeToOutput?.bind(n);o._writeToOutput=i=>{(i.includes(e)||i===`\r
|
|
254
|
+
`||i===`
|
|
255
|
+
`)&&r?.(i)};try{let i=await n.question(e);return t.write(`
|
|
256
|
+
`),i}finally{n.close()}}var Zh="Usage: acbridge backup export --out <file> | acbridge backup import --in <file> [--force] (always passphrase-encrypted)";function $S(e,t){let n=e.indexOf(`--${t}`);if(n!==-1)return e[n+1];let o=e.find(r=>r.startsWith(`--${t}=`));return o?o.slice(`--${t}=`.length):void 0}function zN(e){let t=new Set(Yu.map(o=>`${o.provider}/${o.name}`)),n=[];for(let[o,r]of Object.entries(e.secrets??{}))for(let[i,s]of Object.entries(r??{}))t.has(`${o}/${i}`)&&typeof s=="string"&&n.push({provider:o,name:i,value:s});return n}function Vh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ES(e){if(e===null)return null;try{let t=JSON.parse(e);return Vh(t)?t:null}catch{return null}}function IS(e,t){if(!Vh(e)||!Vh(t))return t??e;let n={...e};for(let[o,r]of Object.entries(t))n[o]=Object.prototype.hasOwnProperty.call(e,o)?IS(e[o],r):r;return n}function FN(e,t){if(e===null)return t;let n=ES(e),o=ES(t);return n?o?JSON.stringify(IS(o,n)):e:t}function MN(e,t){return e.map(({provider:n,name:o,value:r})=>{let i=t(n,o),s=o==="keystore"?FN(i,r):r;return{provider:n,name:o,existing:i,nextValue:s,differs:i!==null&&i!==r}})}function BN(e){return e.toISOString().replace(/[-:]/g,"")}function AS(e,t){jN(e,t,{mode:384});try{LN(e,384)}catch{}}async function CS(e,t={}){let n=e[0];if(n!=="export"&&n!=="import")return k(`unsupported backup verb: ${n??"(none)"}`),v(Zh),2;let o=_t();if(!o)return 1;let r=t.promptHidden??(h=>jr(h,process.stderr)),i=t.promptLine??(h=>zt(h,process.stderr)),s=t.interactive??process.stdin.isTTY===!0;if(n==="export"){let h=$S(e,"out");if(!h)return k("Missing --out <file>."),v(Zh),2;let y={},x=0;for(let{provider:E,name:_}of Yu){let I=ct(o,E,_).read();I&&((y[E]??={})[_]=I,x++)}if(x===0)return k("Nothing to export \u2014 no device credentials are stored on this machine yet."),1;let S=await r("Choose a passphrase to encrypt the backup: ");if(!S)return k("A passphrase is required \u2014 the backup holds device keys and account passwords."),2;if(s&&await r("Confirm passphrase: ")!==S)return k("Passphrases didn't match \u2014 nothing was written. Run the command again."),2;AS(h,Qu({version:1,createdAt:Date.now(),secrets:y},S));try{ed(_S(h,"utf8"),S)}catch(E){try{UN(h,{force:!0})}catch{}return k(`Wrote the backup but it failed to verify (${E.message}) \u2014 removed it. Please try again.`),1}return A(`Exported ${x} credential store${x===1?"":"s"} to ${h} (encrypted, verified).`),v("Keep it somewhere safe: it contains your device keys. Restore with `acbridge backup import --in <file>`."),0}let a=$S(e,"in");if(!a)return k("Missing --in <file>."),v(Zh),2;let l=e.includes("--force"),u=await r("Passphrase for this backup: "),d;try{d=ed(_S(a,"utf8"),u)}catch(h){return k(h.message),1}let p=zN(d);if(p.length===0)return v("Nothing in this backup matches a store this build knows how to restore."),0;let m=MN(p,(h,y)=>ct(o,h,y).read()),f=m.filter(h=>h.differs);if(f.length>0){let h=f.map(S=>`${S.provider}/${S.name}`).join(", ");if(!l){if(!s)return k(`this machine already has different values for: ${h} \u2014 pass --force to overwrite (device keystores merge with what's already here; single-credential stores are replaced), or run this interactively to confirm.`),2;let S=await i(`This machine already has different device credentials for: ${h}
|
|
257
|
+
Restoring will merge device keystores and replace single-credential stores. Continue? [y/N] `);if(!/^y(es)?$/i.test(S.trim()))return v("Nothing restored."),0}let y={};for(let{provider:S,name:E,existing:_}of f)_!==null&&((y[S]??={})[E]=_);let x=`${a}.pre-import-${BN(new Date)}.bak`;AS(x,Qu({version:1,createdAt:Date.now(),secrets:y},u)),v(`Saved what was here before to ${x} (same passphrase) \u2014 that's the way back if this restore is wrong.`)}X("Restoring device credentials\u2026");for(let{provider:h,name:y,nextValue:x}of m)ct(o,h,y).write(x);A(`Restored ${p.length} credential store${p.length===1?"":"s"}.`),v('Run `acbridge scan` \u2014 your keyed devices should appear under "Ready to connect" without touching any vendor cloud.');let g=await Z("/local/reload",{method:"POST",body:{}});return g.hubOffline||g.hubUnauthorized?v("restart the bridge to pick up the restored credentials."):Array.isArray(g.body?.failed)&&g.body.failed.length>0?v("saved, but part of the reload didn't apply \u2014 restart the bridge to pick up the restored credentials."):g.body?.pending?v(ce("the bridge is still bringing the restored credentials up \u2014 give it a moment, or restart it if they don't appear.")):v(ce("nudged the running bridge \u2014 it picked up the restored credentials live.")),0}import{readFileSync as jL}from"node:fs";import{createInterface as zL}from"node:readline";var HN=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),nn=(e,t)=>e>>>t|e<<32-t;function GN(e){let t=[];for(let n of e){let o=n.codePointAt(0);o<128?t.push(o):o<2048?t.push(192|o>>6,128|o&63):o<65536?t.push(224|o>>12,128|o>>6&63,128|o&63):t.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|o&63)}return Uint8Array.from(t)}function WN(e){let t=GN(e),n=new Uint8Array((t.length+8>>6)+1<<6);n.set(t),n[t.length]=128;let o=new DataView(n.buffer),r=t.length*8;o.setUint32(n.length-8,Math.floor(r/4294967296)),o.setUint32(n.length-4,r>>>0);let i=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint32Array(64);for(let u=0;u<n.length;u+=64){for(let S=0;S<16;S++)s[S]=o.getUint32(u+S*4);for(let S=16;S<64;S++){let E=s[S-15],_=s[S-2],I=nn(E,7)^nn(E,18)^E>>>3,N=nn(_,17)^nn(_,19)^_>>>10;s[S]=s[S-16]+I+s[S-7]+N>>>0}let d=i[0],p=i[1],m=i[2],f=i[3],g=i[4],h=i[5],y=i[6],x=i[7];for(let S=0;S<64;S++){let E=nn(g,6)^nn(g,11)^nn(g,25),_=g&h^~g&y,I=x+E+_+HN[S]+s[S],N=nn(d,2)^nn(d,13)^nn(d,22),M=d&p^d&m^p&m,q=N+M;x=y,y=h,h=g,g=f+I>>>0,f=m,m=p,p=d,d=I+q>>>0}i[0]=i[0]+d>>>0,i[1]=i[1]+p>>>0,i[2]=i[2]+m>>>0,i[3]=i[3]+f>>>0,i[4]=i[4]+g>>>0,i[5]=i[5]+h>>>0,i[6]=i[6]+y>>>0,i[7]=i[7]+x>>>0}let a=new Uint8Array(32),l=new DataView(a.buffer);for(let u=0;u<8;u++)l.setUint32(u*4,i[u]);return a}var PS="abcdefghijklmnopqrstuvwxyz234567";function ZN(e){let t=0,n=0,o="";for(let r of e)for(n=n<<8|r,t+=8;t>=5;)o+=PS[n>>>t-5&31],t-=5;return t>0&&(o+=PS[n<<5-t&31]),o}function Ul(e){return ZN(WN(e))}var VN=c.discriminatedUnion("kind",[c.object({kind:c.literal("literal"),hue:c.number().min(0).max(360),saturation:ue}),c.object({kind:c.literal("token"),token:c.enum(["main","session"])})]),jl=c.enum(["main","session","hold","off"]),zl=c.object({color:VN.optional(),brightnessPct:ue.nullable().optional(),brightnessScale:c.number().min(0).max(2).optional(),kelvin:En.nullable().optional(),power:c.boolean().optional()});var Ls=c.enum(["added","removed","permission_request","started","ended","working","finished","error","idle","needs_permission","promptSubmitted","toolStart","toolEnd","subagentStart","subagentFinished","compacting","resumed","aborted","contextLow","contextCritical","needsInput","planReady","rateLimited","compactDone","permissionDenied","taskCompleted","usageHigh","modePlan","modeAuto","modeBypass","modeNormal","modelChanged","workflowStarted","sandboxEscalation","reviewChanged","costHigh","longRunning"]),TS=new Set(["added","removed","permission_request","promptSubmitted","toolStart","toolEnd","aborted"]),ur=c.enum(["claude","codex"]);var qN=c.discriminatedUnion("kind",[c.object({kind:c.literal("deviceState"),deviceId:c.string(),capability:c.string(),instance:c.string().optional(),op:c.enum(["eq","neq","gt","lt","gte","lte","changed"]).default("changed"),path:c.string().optional(),value:c.unknown().optional()}),c.object({kind:c.literal("edge"),deviceId:c.string(),event:c.string()}),c.object({kind:c.literal("session"),event:Ls,repo:c.string().optional(),sessionId:c.string().optional(),agent:ur.optional()}),c.object({kind:c.literal("schedule"),cron:c.string()})]),JN=c.object({deviceId:c.string(),capability:c.string(),instance:c.string().optional(),op:c.enum(["eq","neq","gt","lt","gte","lte"]),path:c.string().optional(),value:c.unknown()}),KN=c.discriminatedUnion("kind",[c.object({kind:c.literal("device"),deviceId:c.string(),capability:c.string(),instance:c.string().optional(),command:c.string(),params:c.unknown().optional()}),c.object({kind:c.literal("session"),sessionId:c.string(),text:c.string()}),c.object({kind:c.literal("notify"),title:c.string(),body:c.string()}),c.object({kind:c.literal("intent"),deviceId:c.string(),instance:c.string().optional(),look:zl.optional(),effect:Nr.optional(),returnTo:jl.optional(),hold:c.boolean().default(!1)})]),RS=c.object({id:c.string(),name:c.string().default(""),enabled:c.boolean().default(!0),trigger:qN,conditions:c.array(JN).default([]),actions:c.array(KN).min(1),allowSecurity:c.boolean().default(!1)});var ri=c.enum(["started","ended","working","finished","error","idle","needs_permission","subagentFinished","compacting","resumed","contextLow","contextCritical","needsInput","planReady","rateLimited","subagentStart","compactDone","permissionDenied","taskCompleted","usageHigh","modePlan","modeAuto","modeBypass","modeNormal","modelChanged","workflowStarted","sandboxEscalation","reviewChanged","costHigh","longRunning"]),OS=c.object({id:c.string(),name:c.string(),cwd:c.string(),online:c.boolean().default(!0),state:ri.optional(),bridgeId:c.string().optional(),bridgeName:c.string().optional(),agent:ur.optional()}),DS=c.enum(["allow","deny"]),JZ=c.object({sessionId:c.string().nullable(),text:c.string(),ts:Q.optional()}),Fl=c.object({latestReply:c.string().nullable(),ts:c.number().nullable(),cursor:c.number().int().nonnegative(),hasMore:c.boolean()}),KZ=c.object({requestId:c.string(),behavior:DS,ts:Q.optional()}),XZ=c.object({id:c.string(),sessionId:c.string().nullable(),args:c.unknown(),ts:Q.optional()}),XN=c.object({type:c.literal("register"),userToken:c.string().optional(),sessions:c.array(OS),claudeSessionId:c.string().optional()}),YN=c.object({type:c.literal("sessions.update"),sessions:c.array(OS)}),QN=c.object({type:c.literal("prompt"),sessionId:c.string(),requestId:c.string(),text:c.string(),ts:Q.optional()});var eL=c.object({type:c.literal("reply"),sessionId:c.string(),requestId:c.string(),text:c.string(),seq:c.number().int().nonnegative().optional(),final:c.boolean().optional(),ts:Q.optional()}),tL=c.object({type:c.literal("permission_request"),sessionId:c.string(),requestId:c.string(),tool:c.string(),description:c.string(),preview:c.string(),ts:Q.optional()}),nL=c.object({type:c.literal("permission_verdict"),sessionId:c.string(),requestId:c.string(),behavior:DS,ts:Q.optional()}),rL=c.object({type:c.literal("command"),id:c.string(),requestId:c.string(),sessionId:c.string().nullable(),args:c.unknown(),ts:Q.optional()}),oL=c.object({type:c.literal("command_result"),requestId:c.string(),id:c.string(),sessionId:c.string().nullable().optional(),result:c.unknown().optional(),error:c.string().optional(),ts:Q.optional()}),iL=c.object({type:c.literal("devices.update"),doc:q0}),sL=c.object({type:c.literal("device_command"),requestId:c.string(),deviceId:c.string(),sourceId:c.string().nullable().optional(),ruleId:c.string().optional(),capability:jt,instance:c.string().optional(),command:c.string(),params:c.unknown(),consumer:c.enum(["voice","claude","app","rules"]),sessionId:c.string().optional(),confirm:c.boolean().optional()}),aL=c.object({type:c.literal("device_query"),requestId:c.string(),kind:c.enum(["list","get"]),deviceId:c.string().optional()}),cL=c.object({type:c.literal("device_result"),requestId:c.string(),deviceId:c.string().optional(),ok:c.boolean(),verified:c.boolean().optional(),state:c.unknown().optional(),result:c.unknown().optional(),error:c.string().optional()}),lL=c.object({type:c.literal("device_event"),deviceId:c.string(),capability:jt,instance:c.string().optional(),event:c.string(),payload:c.unknown().optional(),ts:Q}),uL=c.object({type:c.literal("device_source_event"),provider:Ut,providerAccountId:c.string(),nativeId:c.string(),patch:c.array(c.object({type:jt,instance:c.string().optional(),state:c.unknown()})).optional(),edge:c.object({capability:jt,instance:c.string().optional(),event:c.string(),payload:c.unknown().optional()}).optional(),online:c.boolean().optional(),ts:Q}),dL=c.object({type:c.literal("entitlement"),plan:c.enum(["free","paid"]),planStatus:c.enum(["active","past_due","canceled"]).optional(),serviceOk:c.boolean().optional(),capture:c.object({telemetry:c.boolean(),transcripts:c.boolean()}),policyVersion:c.string(),ts:Q}),pL=c.object({type:c.literal("device_config"),version:c.number().int().nonnegative(),config:c.record(c.string(),c.unknown()),ts:Q}),mL=c.object({type:c.literal("disconnect"),code:c.union([c.literal(1012),c.literal(4402),c.literal(4426),c.number().int().min(1e3).max(4999)]),reason:c.string().max(120),ts:Q}),fL=c.object({type:c.literal("device_audit"),requestId:c.string(),consumer:c.enum(["voice","claude","app","rules"]),deviceId:c.string(),ruleId:c.string().optional(),capability:jt,command:c.string(),params:c.unknown(),ok:c.boolean(),confirmRequired:c.boolean(),confirmedBy:c.string().optional(),error:c.string().optional(),ts:Q}),gL=64,hL=c.object({type:c.literal("session_state"),sessionId:c.string(),state:ri,event:c.string(),ts:Q,transitions:c.array(c.object({state:ri,event:c.string(),ts:Q})).max(gL).optional()}),vL=c.object({type:c.literal("notification"),sessionId:c.string(),event:ri,repo:c.string().optional(),title:c.string().optional(),body:c.string().optional()}),yL=c.discriminatedUnion("type",[XN,YN,QN,eL,tL,nL,rL,oL,iL,sL,aL,cL,lL,uL,fL,dL,mL,pL,hL,vL]),NS=e=>yL.parse(typeof e=="string"?JSON.parse(e):e);var bL=c.object({sessionId:c.string().optional(),revertOnStop:c.boolean().default(!0)}),xL=c.object({sessionId:c.string().optional()}),Jh=c.object({pct:c.number().min(0).max(100),usedTokens:c.number().int().nonnegative().optional(),windowTokens:c.number().int().positive().optional()}),qh=c.object({usedPct:c.number().min(0).max(100),resetsAt:Q.optional()}),kL=c.object({sessionId:c.string().optional(),claudeSessionId:c.string().optional(),state:ri,event:c.string(),ts:Q.optional(),cwd:c.string().optional(),extra:c.record(c.string(),c.unknown()).optional(),context:Jh.optional(),mode:c.string().optional(),model:c.string().optional(),agent:ur.optional()}),wL=c.object({sessionId:c.string().optional(),claudeSessionId:c.string().optional(),cwd:c.string().optional(),ts:Q.optional(),context:Jh.optional(),rateLimits:c.object({fiveHour:qh.optional(),sevenDay:qh.optional()}).optional(),mode:c.string().optional(),model:c.string().optional(),modelName:c.string().optional(),review:c.string().optional(),cost:c.number().nonnegative().optional(),agent:ur.optional()}),LS=c.object({reverted:c.number().int().nonnegative(),failed:c.number().int().nonnegative(),skipped:c.number().int().nonnegative()}),SL=c.object({active:c.boolean(),sessionId:c.string().optional(),generation:c.number().int().nonnegative().optional(),touched:c.number().int().nonnegative().default(0),revertOnStop:c.boolean().default(!0),owner:c.enum(["app","hook"]).optional(),summary:LS.optional()});var _L=c.enum(["mdns","ssdp","kasa-udp","wiz-udp","lifx-lan","yeelight","govee-udp","tuya-beacon","arp","http","meethue","wsd"]),$L=c.object({protocol:_L,detail:c.string(),at:Q}),EL=c.enum(["connect-now","link-ecosystem","identified-only"]),Ml=c.enum(["kasa","kasa-klap","wiz","lifx","shelly","govee","tapo","tuya","yeelight","nanoleaf","meross","ewelink","wled","elgato","roku","esphome"]),AL=c.enum(["high","medium","low"]),IL=c.enum(["advertised","commissioning","certified-model"]),CL=c.object({ip:c.string(),mac:c.string().optional(),hostname:c.string().optional(),port:c.number().int().positive().optional()}),US=c.object({discoveredId:c.string(),addresses:CL,evidence:c.array($L).min(1),identity:c.object({name:c.string().optional(),manufacturer:c.string().optional(),model:c.string().optional(),hint:c.string().optional(),vendorId:c.string().optional(),baseUrl:c.string().optional()}).default({}),bucket:EL,kind:c.string().optional(),matter:IL.optional(),suggestedProvider:Ut.optional(),localProtocol:Ml.optional(),expectedType:ws.optional(),expectedCapabilities:c.array(jt).default([]),alreadyLinked:c.object({provider:Ut,deviceId:c.string().optional(),accountId:c.string().optional()}).nullable().optional(),confidence:AL,firstSeen:Q,lastSeen:Q});function Et(e){return e.trim().toLowerCase().replace(/[^0-9a-f]/g,"").replace(/(..)(?=.)/g,"$1:")}var jS=c.object({key:c.string(),provider:Ut,accountId:c.string().optional(),name:c.string(),mac:c.string().optional(),nativeType:c.string().optional(),expectedType:ws.optional(),state:c.enum(["cloud","not-seen"]),deviceId:c.string().optional()}),zS=c.object({wsl:c.boolean(),multicastOk:c.boolean().nullable(),broadcastOk:c.boolean().nullable(),localNetworkDenied:c.boolean().optional(),interop:c.enum(["windows-arp"]).optional(),wslNetworkingMode:c.enum(["nat","mirrored"]).optional(),interfaces:c.array(c.string()).optional(),primaryInterface:c.string().optional()});function FS(e){return e!==void 0&&(e.wsl||e.multicastOk===!1||e.localNetworkDenied===!0)}function MS(e,t){return t>0||e===void 0||e.wsl?!1:e.multicastOk===!0}var BS="Your computer's network stack is fine, so if you expected devices here the likely cause is the network itself: guest WiFi, VLANs, or an access point with client isolation all block the discovery messages between devices. Try the same scan on your main WiFi, or add a device by IP.",HS="On macOS, LAN scanning needs Local Network access. If AC Bridge is not listed at all in System Settings \u25B8 Privacy & Security \u25B8 Local Network, you may have hit a known macOS bug where that permission is never offered and local traffic is silently dropped. Two things work today: run `acbridge scan` from Terminal (Terminal has its own Local Network access), or update macOS.",PL=c.enum(["running","done","failed"]),a9=c.object({id:c.string(),status:PL,startedAt:Q,finishedAt:Q.optional(),error:c.string().optional(),devices:c.array(US),accountDevices:c.array(jS).optional(),env:zS,probeStatus:c.record(c.string(),c.string()).optional()}),TL=c.enum(["mdns","ssdp","kasa","wiz","lifx","yeelight","govee","tuya","arp","sweep","wsd"]),c9=c.object({autoConnect:c.enum(["unset","off","open-protocols"]).default("unset"),passive:c.boolean().default(!0),protocols:c.partialRecord(TL,c.boolean()).default({}),unidentified:c.boolean().default(!0)}),l9=c.object({scanId:c.string()}),u9=c.object({devices:c.array(US),accountDevices:c.array(jS).optional(),env:zS,updatedAt:Q}),d9=c.object({discoveredId:c.string().optional(),ip:c.string().optional(),protocol:Ml,name:c.string().optional(),credentials:c.record(c.string(),c.string()).optional()}).refine(e=>e.discoveredId!==void 0||e.ip!==void 0,{message:"either discoveredId or ip is required"}),Xh={tapo:[{key:"username",label:"TP-Link email",secret:!1,helpText:"the TP-Link ID the device was set up with"},{key:"password",label:"Password",secret:!0}],"kasa-klap":[{key:"username",label:"TP-Link email",secret:!1,helpText:"the TP-Link/Kasa ID the device was set up with (leave blank if never linked to the cloud)"},{key:"password",label:"Password",secret:!0}],shelly:[{key:"password",label:"Device password",secret:!0,helpText:'the password set on this Shelly (its username is always "admin")'}],esphome:[{key:"encryptionKey",label:"Encryption key",secret:!0,helpText:"the `api: encryption: key` from this device's ESPHome config (base64) \u2014 leave blank if it has no encryption"}]},RL=new Set(["shelly","esphome","kasa-klap"]);function OL(e){return RL.has(e)}var p9=c.object({ok:c.boolean(),deviceId:c.string().optional(),accountId:c.string().optional(),error:c.string().optional(),note:c.string().optional(),linkVia:Ut.optional()}),m9=c.object({deviceId:c.string(),purge:c.boolean().default(!1),discoveredId:c.string().optional()}),f9=c.object({deviceId:c.string(),name:c.string()}),g9=c.object({clientId:c.string().min(1),clientSecret:c.string().min(1),region:c.string().min(1)}),h9=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),sleepyCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),v9=c.object({userCode:c.string().min(1),region:c.string().min(1)}),y9=c.object({ok:c.boolean(),token:c.string().optional(),qrcodeUrl:c.string().optional(),error:c.string().optional()}),b9=c.object({userCode:c.string().min(1),region:c.string().min(1),token:c.string().min(1)}),x9=c.object({ok:c.boolean(),pending:c.boolean().optional(),deviceCount:c.number().int().nonnegative().optional(),sleepyCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),k9=c.object({email:c.string().min(1),password:c.string().min(1),region:c.string().min(1),mfaCode:c.string().optional()}),w9=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),S9=c.object({email:c.string().min(1),password:c.string().min(1),region:c.string().min(1)}),_9=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),$9=c.object({apiKey:c.string().min(1)}),E9=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),A9=c.object({ssid:c.string().min(1),password:c.string()}),I9=c.object({ok:c.boolean(),deviceid:c.string().optional(),error:c.string().optional()}),C9=c.object({ok:c.boolean(),note:c.string().optional(),error:c.string().optional()});function oi(e){return e.kind==="gateway"?"infrastructure":e.bucket==="connect-now"?"ready":e.bucket==="link-ecosystem"?"ecosystems":e.kind==="unidentified"||e.kind==="mdns-service"?"unidentified":e.bucket==="identified-only"?"needs-setup":"unidentified"}var Bl=["govee","wiz","yeelight","kasa","esphome"],DL=new Set(["lock","cover","garageDoor","valve","camera","doorbell"]),NL=new Set(["lock","cover","camera","doorbell"]),LL=new Set(["tuya","meross","ewelink","nanoleaf","esphome"]);function GS(e,t=Xh){return e.bucket==="connect-now"&&e.localProtocol!==void 0&&((t[e.localProtocol]?.length??0)===0||OL(e.localProtocol))&&!LL.has(e.localProtocol)&&e.confidence==="high"&&e.addresses.mac!==void 0&&!e.alreadyLinked&&!(e.expectedType!==void 0&&DL.has(e.expectedType))&&!e.expectedCapabilities.some(n=>NL.has(n))}function WS(e){let t=e.trim(),n,o=/^(mqtts?|tcp|ssl|tls|wss?):\/\//i.exec(t);if(o){let a=o[1].toLowerCase();(a==="mqtts"||a==="ssl"||a==="tls"||a==="wss")&&(n=!0),t=t.slice(o[0].length)}t=t.replace(/\/.*$/,"");let r=/^(.+):(\d{1,5})$/.exec(t),i=(r?r[1]:t).trim(),s=r?Number(r[2]):void 0;return{host:i,...s!==void 0&&s>=1&&s<=65535?{port:s}:{},...n!==void 0?{tls:n}:{}}}function Kh(e){let t=e?.trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");if(!(t===void 0||t===""))return/^\d+\.\d+\.\d+\.\d+$/.test(t)?t.split(".").every(n=>n.length<=3&&(n.length===1||!n.startsWith("0"))&&Number(n)<=255)?t:void 0:t.includes(":")&&/^[0-9a-f:.%]+$/.test(t)?t:void 0}function UL(e){let t=Kh(e);if(t===void 0)return!1;if(!t.includes(":")){let r=t.split(".").map(Number);return r[0]===10||r[0]===127||r[0]===172&&r[1]>=16&&r[1]<=31||r[0]===192&&r[1]===168||r[0]===100&&r[1]>=64&&r[1]<=127?!0:r[0]===169&&r[1]===254}if(t==="::1")return!0;let n=t.split(":",1)[0];if(!/^[0-9a-f]+$/.test(n))return!1;let o=parseInt(n,16);return o>=64512&&o<=65023||o>=65152&&o<=65215}function ZS(e,t){let n=e?.trim(),o=Kh(t);if(n===void 0||n===""||o===void 0||!UL(o))return;let r;try{r=new URL(n)}catch{return}if(!(r.protocol!=="http:"&&r.protocol!=="https:")&&!(r.username!==""||r.password!==""))return Kh(r.hostname)===o?n:void 0}var dr=`Usage: acbridge connect <mac|ip|discoveredId> [--name <display-name>] [--credentials-file <json>]
|
|
258
|
+
acbridge connect <ip> --as ${Bl.join("|")} [--name <display-name>]
|
|
244
259
|
acbridge connect --forget <deviceId|mac|ip|discoveredId> [--purge]
|
|
245
260
|
acbridge connect --auto on|off
|
|
246
261
|
|
|
@@ -249,60 +264,56 @@ Targets come from \`acbridge scan\` (the ldev_\u2026 id, or the device's MAC/IP)
|
|
|
249
264
|
LAN-Control toggle flipped after the scan, or multicast is filtered) \u2014 it persists ONLY after the
|
|
250
265
|
protocol's live probe replies at that IP; a dead IP or wrong protocol simply gets no reply.
|
|
251
266
|
A protocol that needs an account credential (e.g. Tapo) prompts on a TTY, or reads
|
|
252
|
-
--credentials-file <json> / $ACBRIDGE_CREDENTIALS_FILE (a {"field":"value"} object) when headless.`;function
|
|
267
|
+
--credentials-file <json> / $ACBRIDGE_CREDENTIALS_FILE (a {"field":"value"} object) when headless.`;function FL(e){let t={purge:!1},n=(o,r,i,s)=>o===`--${r}`?(t[r]=s[++i],i):o.startsWith(`--${r}=`)?(t[r]=o.slice(`--${r}=`.length),i):null;for(let o=0;o<e.length;o++){let r=e[o];if(!r)continue;if(r==="--purge"){t.purge=!0;continue}if(r==="--credentials-file"){t.credentialsFile=e[++o];continue}if(r.startsWith("--credentials-file=")){t.credentialsFile=r.slice(19);continue}let i=!1;for(let s of["forget","auto","name","as"]){let a=n(r,s,o,e);if(a!==null){o=a,i=!0;break}}i||(r.startsWith("--")?t.bad=`unknown option: ${r}`:t.target?t.bad=`unexpected argument: ${r}`:t.target=r)}return t}var JS=e=>/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/.test(Et(e)),Yh=e=>/^(\d{1,3}\.){3}\d{1,3}$/.test(e),VS=e=>`dev_${Ul(`mac:${Et(e)}`).slice(0,8)}`,qS=e=>e==="homeassistant"?"home-assistant":e;async function KS(e){let t=FL(e);if(t.bad)return k(t.bad),v(dr),2;if(t.as!==void 0)return t.forget!==void 0||t.auto!==void 0?(k("--as can't combine with --forget or --auto"),v(dr),2):t.target?ML(t.target,t.as,t.name):(k("connect --as <protocol> needs an IP address as the target"),v(dr),2);let n=[t.target,t.forget,t.auto].filter(o=>o!==void 0).length;return n!==1?(n>1&&k("pick one of: a connect target, --forget, --auto"),v(dr),2):t.auto!==void 0?qL(t.auto):t.forget!==void 0?VL(t.forget,t.purge):BL(t.target,t.name,t.credentialsFile)}async function ML(e,t,n){if(!Bl.includes(t))return k(`--as takes one of: ${Bl.join(", ")} (got ${t||"(none)"})`),2;if(!Yh(e))return k(`connect --as needs an IP address as the target, got: ${e}`),v(dr),2;v(ce(`probing ${e} as ${t}\u2026`));let o={ip:e,protocol:t,...n?{name:n}:{}},r=await Z("/local/connect",{method:"POST",body:o,timeoutMs:15e3});if(r.hubOffline)return k(Re()),1;let i=r.body;return r.status===200&&i?.ok?(A(`connected \u2014 ${i.deviceId??e}${i.accountId?` (account ${i.accountId})`:""}`),i.note&&v(i.note),v("It now appears in `acbridge status`, the app dashboard, and to Claude."),0):(k(i?.error??`hub answered HTTP ${r.status}`),i?.note&&v(i.note),(r.status===502||r.status===422)&&v(`\u2192 no ${t} answered at ${e} \u2014 check the IP, that LAN Control is enabled, and that this machine shares the device's network/VLAN`),1)}async function BL(e,t,n){let o=await XS(e);if(typeof o=="number")return o;let r=o;if(r.bucket==="link-ecosystem"){let l=r.suggestedProvider;return k("this device is managed by an ecosystem"),v(`\u2192 link the ecosystem instead: ${l?`\`acbridge link ${qS(l)}\``:"see `acbridge link --help`"}`),1}if(r.bucket==="identified-only")return k("no direct local adapter for this device"),v(r.identity.hint?`\u2192 ${r.identity.hint}`:"\u2192 control it via a linked Home Assistant (`acbridge link home-assistant`), or wait for a future adapter"),1;if(!r.localProtocol)return k(`no local protocol resolved for ${r.discoveredId} \u2014 rescan and try again`),1;v(ce(`connecting ${Qh(r)} via ${r.localProtocol}\u2026`));let i={discoveredId:r.discoveredId,protocol:r.localProtocol,...t?{name:t}:{}},s=await Z("/local/connect",{method:"POST",body:i,timeoutMs:15e3});if(s.hubOffline)return k(Re()),1;let a=s.body;return s.status===200&&a?.ok?(A(`connected \u2014 ${a.deviceId??r.discoveredId}${a.accountId?` (account ${a.accountId})`:""}`),a.note&&v(a.note),v("It now appears in `acbridge status`, the app dashboard, and to Claude."),0):s.status===428&&a?.error==="pairing-required"?(k(a.note??"put the device in pairing mode (hold its button until it flashes), then connect again"),v(`\u2192 hold the button, then rerun: \`acbridge connect ${r.discoveredId}\``),1):s.status===428?HL(r,r.localProtocol,t,a?.note??null,n):(k(a?.error??`hub answered HTTP ${s.status}`),a?.note&&v(a.note),s.status===404&&v("\u2192 run `acbridge scan`, then retry with a fresh id"),a?.linkVia&&v(`\u2192 \`acbridge link ${qS(a.linkVia)}\``),1)}async function HL(e,t,n,o,r){let i=Xh[t]??[],s=r??process.env.ACBRIDGE_CREDENTIALS_FILE,a;if(s){if(a=GL(s),!a)return 1}else if(process.stdin.isTTY&&process.stdout.isTTY&&i.length>0)a=await WL(i,o);else{k(o??"this protocol needs an account credential \u2014 supply it and retry");let p=i.length>0?` with fields: ${i.map(m=>m.key).join(", ")}`:"";return v(`\u2192 pass --credentials-file <json> (or set ACBRIDGE_CREDENTIALS_FILE)${p}`),1}v(ce(`connecting ${Qh(e)} via ${t} with credentials\u2026`));let l={discoveredId:e.discoveredId,protocol:t,...n?{name:n}:{},credentials:a},u=await Z("/local/connect",{method:"POST",body:l,timeoutMs:15e3});if(u.hubOffline)return k(Re()),1;let d=u.body;return u.status===200&&d?.ok?(A(`connected \u2014 ${d.deviceId??e.discoveredId}${d.accountId?` (account ${d.accountId})`:""}`),d.note&&v(d.note),v("It now appears in `acbridge status`, the app dashboard, and to Claude."),0):(k(d?.error??`hub answered HTTP ${u.status}`),d?.note&&v(d.note),1)}function GL(e){let t;try{t=jL(e,"utf8")}catch{k(`cannot read credentials file: ${e}`);return}let n;try{n=JSON.parse(t)}catch{k(`credentials file is not valid JSON: ${e}`);return}if(!n||typeof n!="object"||Array.isArray(n)){k("credentials file must be a JSON object of field \u2192 value");return}let o={};for(let[r,i]of Object.entries(n))i!=null&&(o[r]=String(i));return o}async function WL(e,t){t&&v(t);let n={};for(let o of e)o.helpText&&v(ce(o.helpText)),n[o.key]=await ZL(`${o.label}: `,o.secret);return n}function ZL(e,t){return new Promise(n=>{let o=zL({input:process.stdin,output:process.stdout,terminal:!0});if(t){let r=!1,i=o;i._writeToOutput=s=>{r?(s.includes(`
|
|
253
268
|
`)||s.includes("\r"))&&process.stdout.write(`
|
|
254
|
-
`):(process.stdout.write(e),
|
|
255
|
-
`)}catch{}}function dl(e=Kg,t=Date.now()){try{let r=N(Ae);if(!r)return null;let n=JSON.parse(r).updateCheck;return!n||typeof n!="object"||typeof n.fetchedAt!="number"||t-n.fetchedAt>e?null:m0(n.manifest)}catch{return null}}function ls(e,t,r=process.platform,o="app"){if(e===null)return{state:"dev"};if(!t)return{state:"unknown"};if(o==="npm"){let s=t.cli;return s?s.minimumVersion&&cs(e,s.minimumVersion)===-1?{state:"blocked",current:e,minimum:s.minimumVersion,upgrade:p0}:s.version&&cs(e,s.version)===-1?{state:"update",current:e,latest:s.version,upgrade:p0}:{state:"current",current:e}:{state:"unpublished",current:e}}if(t.minimumVersion&&cs(e,t.minimumVersion)===-1)return{state:"blocked",current:e,minimum:t.minimumVersion,upgrade:t.downloadPage};let n=HO(r),i=n?t.platforms[n]?.version:void 0;return i&&cs(e,i)===-1?{state:"update",current:e,latest:i,upgrade:t.downloadPage}:{state:"current",current:e}}function f0(e,t,r=process.platform,o="app"){let n=ls(e,t,r,o),i=o==="npm"?"acbridge":"app";switch(n.state){case"dev":return{grade:"info",line:"dev build \u2014 update checks skipped"};case"unknown":return{grade:"warn",line:"update check unreachable"};case"unpublished":return{grade:"info",line:`${i} ${n.current} \u2014 no update channel published yet`};case"blocked":return{grade:"bad",line:`${i} ${n.current} is below the minimum supported version ${n.minimum} \u2014 update required: ${n.upgrade}`};case"update":return{grade:"warn",line:`update available: ${n.latest} (you have ${n.current})`};case"current":return{grade:"ok",line:`${i} ${n.current} is current`}}}var VO="Not signed in on this machine. Run `acbridge login`.";function Sr(e=N,t={}){let r=t.paths??we(),o=e(r.accessFile)?.trim(),n=e(r.refreshFile)?.trim();if(o||n)return(t.resolveScope??(()=>gt()))()?{ok:!0,paired:!!n}:(t.readPointer??(()=>Ce()))()?{ok:!1,message:ot.pointerMismatch}:{ok:!0,paired:!!n};let i=(t.scan??ft)();return i.length===0?{ok:!1,message:VO}:(St(i),{ok:!1,message:ot.pointerMismatch})}async function _r(e){if(await(e?.hubHealthy??Ne)())return{ok:!0};let r=Sr(e?.read??N);return r.ok?{ok:!0}:{ok:!1,message:r.message}}function g0(e={}){let t=e.resolveScope??(()=>gt()),o=(e.layout??on())>=sn,n=o?(e.scan??ft)():[];(e.warnAmbiguous??(u=>St(u)))(n);let i=t();if(i)return i;if((e.readPointer??(()=>Ce()))())return null;let a=u=>((e.writePointer??(d=>dr({sub:d})))(u),t());if(o){if(n.length!==1)return null;let u=n[0];return ma(u,e.segmentOf)?a(u.sub):null}let l=(e.readCredentialSub??ll)();return l?a(l):null}function qO(){let e=g0();return e?Ys({configFile:wi(e).userConfigFile}).onboardedAt:null}function JO(e){let t=g0();t&&Qs({onboardedAt:e},{configFile:wi(t).userConfigFile})}async function KO(e={}){let t=(e.build??Jn)(),r=e.clientVersion?e.clientVersion():t.version;if(r===null)return{ok:!0};let o=await(e.fetchManifest??ul)()??(e.cachedManifest??dl)(Kg);if(!o)return(e.warnLine??z)("update check unreachable \u2014 continuing (it will retry next run)"),{ok:!0};let n=ls(r,o,e.platform??process.platform,t.channel??"app");return n.state==="blocked"?{ok:!1,exitCode:4,message:`This AC Bridge build (${n.current}) is below the minimum supported version (${n.minimum}). Update it: ${n.upgrade}`}:(n.state==="update"&&(e.infoLine??v)(`update available: ${n.latest} (you have ${n.current}) \u2014 ${n.upgrade}`),{ok:!0})}var XO="This machine's sign-in is no longer valid (the relay rejected its stored credential). Run `acbridge login` to sign in again.";function YO(){return!!N(we().refreshFile)?.trim()}var QO="This account hasn't completed setup yet. Run `acbridge login --if-needed` on this machine to complete it.";async function Fo(e={}){let t=e.read??N,r=Sr(t);if(!r.ok)return{ok:!1,exitCode:3,message:r.message};let o=e.relayUrl??de().relayUrl,n=e.fetchImpl??fetch;if(!await(e.refreshToken??(p=>Ut(p)))(o)&&!(e.hasRefreshCredential??YO)())return{ok:!1,exitCode:3,message:XO};let s=t(we().accessFile)?.trim()??"",a={reachable:!1,completedAt:null};try{let p=await n(`${o.replace(/\/+$/,"")}/settings`,{headers:{authorization:`Bearer ${s}`},signal:AbortSignal.timeout(6e3)});if(p.ok){let f=(await p.json()).config?.onboarding?.completedAt;a={reachable:!0,completedAt:typeof f=="number"?f:null}}}catch{}if(a.reachable){if(a.completedAt===null)return{ok:!1,exitCode:3,message:QO};(e.cacheOnboardedAt??JO)(a.completedAt)}else if((e.cachedOnboardedAt??qO)()===null)return{ok:!1,exitCode:1,message:"Couldn't verify this account's setup with the relay \u2014 check your connection and retry."};let l=await KO(e.updateGate);if(!l.ok)return l;let u=await(e.fetchEntitlement??zt)(s),d=u0("preflight",u);return d.allowed?{ok:!0}:{ok:!1,exitCode:5,message:d.message}}var eD=["relayUrl","hubPort","machine"];async function pl(e,t,r=fetch){let o=await r(`${e.replace(/\/+$/,"")}/settings`,{headers:{authorization:`Bearer ${t}`}});if(!o.ok)throw new Error(`relay ${o.status}`);let n=await o.json().catch(()=>null);return{version:typeof n?.version=="number"?n.version:null,config:typeof n?.config=="object"&&n?.config!==null?n.config:{}}}async function ml(e,t,r=fetch){if(!t)return null;let o;try{o=await pl(e,t,r)}catch(n){return v(`Cloud settings sync skipped (${n instanceof Error?n.message:String(n)}).`),null}try{let n=typeof o.config.cli=="object"&&o.config.cli!==null?o.config.cli:null;if(!n)return o;let i={};for(let l of eD){let u=n[l];(l==="hubPort"?typeof u=="number"&&Number.isFinite(u):typeof u=="string"&&u)&&(i[l]=u)}if(Object.keys(i).length===0)return o;let s={};try{s=JSON.parse(N(Ae)??"{}"),(typeof s!="object"||s===null||Array.isArray(s))&&(s={})}catch{s={}}let a={...s,...i};if(JSON.stringify(a)===JSON.stringify(s))return o;ke(Ae,`${JSON.stringify(a,null,2)}
|
|
256
|
-
`)
|
|
257
|
-
`);function Kn(e,t){let r=e.find(s=>s.id===t);if(r)return{ok:!0,device:r};let o=t.toLowerCase(),n=e.filter(s=>s.name.toLowerCase()===o);if(n.length===1)return{ok:!0,device:n[0]};let i=n.length>1?n:e.filter(s=>s.name.toLowerCase().includes(o));return i.length===1?{ok:!0,device:i[0]}:i.length>1?{ok:!1,kind:"ambiguous",candidates:i.map(s=>({id:s.id,name:s.name}))}:{ok:!1,kind:"not-found",candidates:[]}}function Xg(e){let t={};for(let r of e){let o=r.indexOf("=");if(o<=0)return{ok:!1,message:`--param needs k=v, got: ${r}`};let n=r.slice(0,o),i=r.slice(o+1);if(i==="true"||i==="false")t[n]=i==="true";else if(i!==""&&Number.isFinite(Number(i)))t[n]=Number(i);else if(i.startsWith("[")||i.startsWith("{"))try{t[n]=JSON.parse(i)}catch{return{ok:!1,message:`--param ${n} isn't valid JSON`}}else t[n]=i}return{ok:!0,params:t}}function vl(e,t,r){let o=t.indexOf("."),n=o>0?t.slice(0,o):null,i=o>0?t.slice(o+1):t,s=[];for(let d of e.capabilities)if(!(n&&d.type!==n))for(let p of is[d.type]??[])p.command===i&&(p.gate&&!p.gate(d)||s.push({cap:d,entry:p}));if(s.length===0)return n&&!e.capabilities.some(d=>d.type===n)?{ok:!1,message:`${e.name} doesn't have the "${n}" capability`}:{ok:!1,message:`no command "${i}" on ${e.name}${n?` (${n})`:""}`};if(s.length>1)return{ok:!1,message:`"${i}" is ambiguous on ${e.name} \u2014 qualify it: ${s.map(d=>`${d.cap.type}.${i}`).join(" | ")}`};let{cap:a,entry:l}=s[0],u=l.params.safeParse(r);if(!u.success){let d=u.error.issues[0];return{ok:!1,message:`bad params for ${a.type}.${i}: ${d?`${d.path.join(".")} ${d.message}`:"invalid"}`}}return{ok:!0,capability:a.type,command:i,params:u.data}}function lD(e,t){return{deviceId:e,capability:t.capability,command:t.command,params:t.params,consumer:"app"}}function uD(e,t){let r=new Map(e.areas.map(n=>[n.id,n.name])),o=[];if(t?.note&&o.push(`(${t.note})`),e.devices.length===0)return o.push("no devices connected \u2014 run `acbridge scan` to find some, or link an account: `acbridge link <provider>`"),o;for(let n of[...e.devices].sort((i,s)=>i.name.localeCompare(s.name))){let i=n.areaId&&r.get(n.areaId)||"\u2014";o.push(`${n.name.padEnd(26)} ${n.type.padEnd(12)} ${i.padEnd(14)} ${n.reachability.padEnd(9)} ${n.id}`)}return o}async function Ir(){let e=await q("/local/devices",{method:"GET",timeoutMs:5e3});if(!e.hubOffline&&e.status===200&&e.body)return{doc:e.body};let t=Ft();if(t.state==="mismatch")return{refusal:{message:t.message,exitCode:3}};if(t.state!=="ok")return null;let r=await mb(t.token);return r?{doc:r,note:"relay cache \u2014 bridge not running; state may be stale"}:null}async function x0(e=[]){let t=e.includes("--json");t&&be(!0);let r=e.filter(d=>!d.startsWith("--")),o=r[0]??"list";if(o==="list"){let d=await Ir();if(d&&"refusal"in d)return E(d.refusal.message,d.refusal.exitCode);if(!d)return E("no device graph available \u2014 start the bridge (`acbridge start`) or sign in",1);if(t)K(d.doc);else for(let p of uD(d.doc,d.note?{note:d.note}:void 0))v(p);return 0}if(o==="set-main")return mD(e,t);if(o!=="on"&&o!=="off"&&o!=="set")return v(hl),E(`unknown devices subcommand: ${o}`,2);let n=r[1];if(!n)return v(hl),E("which device? give an id (dev_\u2026) or a name",2);let i=await Ir();if(i&&"refusal"in i)return E(i.refusal.message,i.refusal.exitCode);if(!i)return E("no device graph available \u2014 start the bridge (`acbridge start`) or sign in",1);let s=Kn(i.doc.devices,n);if(!s.ok){if(s.kind==="ambiguous"){for(let d of s.candidates)v(` ${d.name} (${d.id})`);return E(`"${n}" matches several devices \u2014 name one of the ids above`,2)}return E(`no device matches "${n}" \u2014 try \`acbridge devices\``,2)}let a;if(o==="on"||o==="off")a=vl(s.device,o==="on"?"power.turnOn":"power.turnOff",{});else{let d=r[2];if(!d)return v(hl),E("set needs a command \u2014 e.g. `acbridge devices set lamp brightness.setBrightness --param level=40`",2);let p=[];for(let f=0;f<e.length;f++)e[f]==="--param"&&e[f+1]&&p.push(e[++f]);let m=Xg(p);if(!m.ok)return E(m.message,2);a=vl(s.device,d,m.params)}if(!a.ok)return E(a.message,2);let l=_t({notSignedIn:{message:"Not signed in. Run `acbridge login` first.",exitCode:3}});if(!l.ok)return E(l.message,l.exitCode);let u=await fb(l.token,lD(s.device.id,a));return u.ok?($(`${s.device.name}: ${a.capability}.${a.command}${u.verified===!0?" (verified)":""}`),u.note&&v(me(u.note)),t&&K({ok:!0,deviceId:s.device.id,capability:a.capability,command:a.command}),0):u.status===503?E("bridge not running \u2014 run `acbridge start` (device control routes through your PC)",1):(x(u.error??`command failed (${u.status||"network"})`),t&&K({ok:!1,error:u.error??null,status:u.status,exit:1}),1)}function dD(e){let t={},r=!1,o=e.indexOf("--color");if(o!==-1){let s=e[o+1];if(s==="none")t.hs=null;else{let a=(s??"").split(",").map(l=>Number(l.trim()));if(a.length!==2||!a.every(Number.isFinite)||a[0]<0||a[0]>360||a[1]<0||a[1]>100)return{patch:t,touched:r,bad:`--color takes <hue 0-360>,<sat 0-100> or none, got: ${s??"(none)"}`};t.hs={hue:a[0],saturation:a[1]}}r=!0}let n=e.indexOf("--brightness");if(n!==-1){let s=e[n+1];if(s==="none")t.brightness=null;else{let a=Number(s);if(!Number.isFinite(a)||a<0||a>100)return{patch:t,touched:r,bad:`--brightness takes 0-100 or none, got: ${s??"(none)"}`};t.brightness=a}r=!0}let i=e.indexOf("--kelvin");if(i!==-1){let s=e[i+1];if(s==="none")t.kelvin=null;else{let a=Number(s);if(!Number.isInteger(a)||a<1e3||a>12e3)return{patch:t,touched:r,bad:`--kelvin takes a whole colour temperature 1000-12000 (or none), got: ${s??"(none)"}`};t.kelvin=a}r=!0}return{patch:t,touched:r}}function pD(e,t,r){let o=$r.safeParse(e.deviceSettings);if(e.deviceSettings!==void 0&&!o.success)return{error:"this machine's device settings are unreadable by this CLI version \u2014 update acbridge (nothing was written)"};let n=o.success?o.data:{},i=n[t]??Mo.parse({}),s=Mo.safeParse({...i,main:{...i.main??{},...r}});return s.success?{config:{...e,deviceSettings:{...n,[t]:s.data}}}:{error:`that main look doesn't validate: ${s.error.issues[0]?.message??"invalid"}`}}async function mD(e,t){let o=e.filter((m,f)=>!m.startsWith("--")&&!["--color","--brightness","--kelvin"].includes(e[f-1]??""))[1];if(!o)return v(hl),E("which device? give an id (dev_\u2026) or a name",2);let{patch:n,touched:i,bad:s}=dD(e);if(s)return E(s,2);if(!i)return E("nothing to change \u2014 give at least one of --color / --brightness / --kelvin",2);let a=await Ir();if(a&&"refusal"in a)return E(a.refusal.message,a.refusal.exitCode);if(!a)return E("no device graph available \u2014 start the bridge (`acbridge start`) or sign in",1);let l=Kn(a.doc.devices,o);if(!l.ok){if(l.kind==="ambiguous"){for(let m of l.candidates)v(` ${m.name} (${m.id})`);return E(`"${o}" matches several devices \u2014 name one of the ids above`,2)}return E(`no device matches "${o}" \u2014 try \`acbridge devices\``,2)}let u=_t({notSignedIn:{message:"Not signed in. Run `acbridge login` first.",exitCode:3}});if(!u.ok)return E(u.message,u.exitCode);let d=null,p=await Bo(u.token,m=>{let f=pD(m,l.device.id,n);if("error"in f)throw new Error(f.error);return f.config}).catch(m=>(d=m instanceof Error?m.message:String(m),{outcome:"error",error:d}));if(p.outcome!=="committed"){let m=p.outcome==="unavailable"?"couldn't read the device settings from the relay \u2014 check your connection":p.outcome==="conflict-exhausted"?"device settings changed elsewhere \u2014 try again":p.error??"couldn't save the main look";return E(m,1)}return $(`${l.device.name}: main look updated`),t&&K({ok:!0,deviceId:l.device.id,main:n}),0}import{spawnSync as Pl}from"node:child_process";import{existsSync as sL}from"node:fs";import SS from"node:path";import{createSocket as bD}from"node:dgram";import{readFile as xD}from"node:fs/promises";import{networkInterfaces as w0}from"node:os";import{execFile as gD}from"node:child_process";import{existsSync as hD}from"node:fs";import{join as vD}from"node:path";import{promisify as yD}from"node:util";var C8=new TextEncoder;var U8=yD(gD);function Yg(e={}){let t=e.env??process.env,r=e.exists??(o=>hD(o));for(let o of(t.PATH??"").split(":"))if(o!=="")try{if(r(vD(o,"powershell.exe")))return!0}catch{}return!1}var Qg="239.255.90.90",eh=35090,S0=35091;function _0(e){return!e.internal&&(e.family==="IPv4"||e.family===4)}var vt={createSocket:(e,t)=>bD({type:e,reuseAddr:t?.reuseAddr??!0}),interfaceAddresses:()=>Object.values(w0()).flatMap(e=>e??[]).filter(_0).map(e=>e.address)};async function yl(e={}){let t=e.timeoutMs??2e3,r=e.sockets??vt,o=await kD(e.readProcVersion??(()=>xD("/proc/version","utf8")),e.env??process.env),[n,i]=await Promise.all([wD(r,t).catch(()=>null),SD(r,t).catch(()=>null)]),s;try{s=(e.interfaces??_D)()}catch{s=void 0}let a={wsl:o,multicastOk:n,broadcastOk:i};s!==void 0&&(a.interfaces=s);try{let l=e.windowsInterop??(()=>Yg({env:e.env??process.env}));o&&l()&&(a.interop="windows-arp")}catch{}return a}async function kD(e,t){if(t.WSL_DISTRO_NAME||t.WSL_INTEROP)return!0;try{return/microsoft/i.test(await e())}catch{return!1}}function wD(e,t){return new Promise(r=>{let o=[],n=[],i=!1,s=a=>{if(!i){i=!0;for(let l of n)clearTimeout(l);for(let l of o)try{l.close()}catch{}r(a)}};try{let a=`acbridge-mc-${Math.random().toString(36).slice(2)}`,l=new TextEncoder().encode(a),u=e.createSocket("udp4",{reuseAddr:!0});o.push(u),u.on("error",()=>s(null)),u.on("message",d=>{new TextDecoder().decode(d)===a&&s(!0)}),u.bind(eh,()=>{try{u.addMembership(Qg)}catch{s(null);return}let d=e.createSocket("udp4",{reuseAddr:!0});o.push(d),d.on("error",()=>s(null)),d.bind(0,()=>{let p=()=>{try{d.setMulticastLoopback(!0),d.send(l,eh,Qg,m=>{m&&s(null)})}catch{s(null)}};p(),n.push(setTimeout(p,Math.max(1,Math.floor(t/2))))}),n.push(setTimeout(()=>s(!1),t))})}catch{s(null)}})}function SD(e,t){return new Promise(r=>{let o,n,i=!1,s=a=>{if(!i){i=!0,n&&clearTimeout(n);try{o?.close()}catch{}r(a)}};try{o=e.createSocket("udp4",{reuseAddr:!0});let a=o;a.on("error",()=>s(null)),a.bind(0,()=>{try{a.setBroadcast(!0),a.send(new TextEncoder().encode("acbridge-env-probe"),S0,"255.255.255.255",l=>{if(!l)return s(!0);let u=l.code;s(u==="EACCES"||u==="ENETUNREACH"||u==="EHOSTUNREACH"?!1:null)})}catch{s(null)}}),n=setTimeout(()=>s(null),t)}catch{s(null)}})}function _D(){return Object.entries(w0()).filter(([,e])=>e?.some(_0)).map(([e])=>e)}var bN=rn(sS(),1);var vG=new TextDecoder;import{createDecipheriv as xG,createHash as xN}from"node:crypto";var SG=xN("md5").update("yGAdlopoPVldABfn").digest(),_G=new TextDecoder;var CG=30*6e4;var wN=new Set(["00:33:7a","10:5a:17","10:d5:61","18:69:d8","18:de:50","1c:90:ff","20:f1:b2","2c:b4:71","30:48:7d","38:1f:8d","38:2c:e5","38:a5:c9","3c:0b:59","4c:a9:19","50:8a:06","50:8b:b9","68:57:2d","70:89:76","7c:f6:66","80:64:7c","84:e3:42","a0:92:08","a8:80:55","b8:06:0d","bc:35:1e","c0:f8:53","c4:82:e1","cc:8c:bf","d0:32:e7","d0:82:e8","d0:82:eb","d4:a6:51","d8:1f:12","d8:c8:0c","d8:d6:68","d8:fc:92","e4:ae:e4","f8:17:2d","fc:3c:d7","fc:67:1f"]),SN={"00:17:88":"Signify (Philips Hue)","c4:29:96":"Signify","fc:26:8c":"Signify","d0:73:d5":"LIFX","50:c7:bf":"TP-Link","1c:3b:f3":"TP-Link","d8:0d:17":"TP-Link","5c:e9:31":"TP-Link","3c:52:a1":"TP-Link","24:0a:c4":"Espressif","24:6f:28":"Espressif","30:ae:a4":"Espressif","5c:cf:7f":"Espressif","ec:fa:bc":"Espressif","a4:cf:12":"Espressif","48:3f:da":"Espressif","70:87:9e":"Beken","80:6d:de":"Beken","c8:47:8c":"Beken",...Object.fromEntries([...wN].map(e=>[e,"Tuya"])),"a8:bb:50":"WiZ","d8:a0:11":"WiZ","44:4f:8e":"WiZ","6c:29:90":"WiZ","94:9f:3e":"Sonos","5c:aa:fd":"Sonos","00:0e:58":"Sonos","fc:65:de":"Amazon","74:c2:46":"Amazon","44:65:0d":"Amazon","0c:47:c9":"Amazon","b8:5f:98":"Amazon","f4:f5:d8":"Google","54:60:09":"Google","1c:f2:9a":"Google","d8:eb:46":"Google","18:b4:30":"Nest Labs","64:16:66":"Nest Labs","d0:52:a8":"SmartThings","24:fd:5b":"SmartThings","28:6d:97":"SAMJIN (SmartThings)","50:14:79":"iRobot","24:9e:7d":"Roborock","b0:4a:39":"Roborock","78:0f:77":"Broadlink","34:ea:34":"Broadlink","2c:aa:8e":"Wyze","44:61:32":"Ecobee","94:10:3e":"Belkin (Wemo)","5c:e7:53":"Govee","d4:13:68":"Govee","e0:2a:25":"Govee","80:8a:f7":"Nanoleaf","f8:24:41":"Yeelight","54:ef:44":"Aqara (Lumi)","18:c2:3c":"Aqara (Lumi)","b0:e9:fe":"SwitchBot","00:1c:2b":"Hive (Centrica)","ec:e5:12":"tado\xB0"};var FG=new TextDecoder;var dS=Buffer.from("020000010000000000000000463cb5d3","hex"),ZG=new TextEncoder,GG=new TextDecoder;var o9=new TextDecoder;var fS="239.255.255.250",$h=1982,gS=["M-SEARCH * HTTP/1.1",`HOST: ${fS}:${$h}`,'MAN: "ssdp:discover"',"ST: wifi_bulb","",""].join(`\r
|
|
258
|
-
`);
|
|
259
|
-
`),A9=new TextDecoder;var L9=new Uint8Array([0]);import{spawnSync as Ih}from"node:child_process";var Al=Xv("cli");function yS(e){try{let t=Ih(e,{shell:!0,encoding:"utf8",timeout:5e3});return`${t.stdout??""}${t.stderr??""}`}catch{return""}}function bS(e=process.platform){return ry({platform:e,programs:[process.execPath],ruleName:Al,runCheck:yS,runElevated:t=>{e!=="win32"&&Ih("sudo",["sh","-c",t],{stdio:"inherit"})}})}function xS(e=process.platform){return oy({platform:e,programs:[process.execPath],ruleName:Al,runCheck:yS,runElevated:t=>{e!=="win32"&&Ih("sudo",["sh","-c",t],{stdio:"inherit"})}})}function kS(e){let t=[],{home:r,credential:o}=e,n=r.source==="peer-wsl"||r.source==="peer-windows";if(r.source==="env")t.push({grade:"info",line:`hub state home: ${r.dir} (BRIDGE_SECRET_DIR override)`});else if(n){let s=r.source==="peer-wsl"?"on Windows":"inside WSL";t.push({grade:"ok",line:`hub state home: ${r.dir} \u2014 the hub runs ${s}, this environment reads its home across the boundary`})}else r.beacon?t.push({grade:"ok",line:`hub state home: ${r.dir} (hub live on port ${r.beacon.port})`}):t.push({grade:"info",line:`hub state home: ${r.dir} \u2014 no hub advertising itself here yet`});o==="rejected"?t.push({grade:"bad",line:"the hub REJECTED this machine's hub-token (401) \u2014 it is stale or belongs to another home. Profiles signals from every session here are being dropped. Restart the bridge (`acbridge stop` then `acbridge start`, or Stop \u2192 Start in the app) to re-mint it."}):o==="absent"&&r.beacon?t.push({grade:"warn",line:`a hub is running (port ${r.beacon.port}) but no readable hub-token was found in ${r.dir} \u2014 sessions here cannot authenticate to it`}):o==="ok"&&t.push({grade:"ok",line:"hub credential accepted (Profiles signals from this environment are authorized)"});let i=e.lastHookError;if(i&&e.nowMs-i.ts<=864e5&&o!=="ok"){let s=Math.max(0,Math.round((e.nowMs-i.ts)/6e4));t.push({grade:"warn",line:`a Profiles signal from this machine was refused ${s}m ago (HTTP ${i.status})${i.hint?` \u2014 ${i.hint}`:""}`})}return t}import{spawnSync as iL}from"node:child_process";function Ue(e={}){let t=e.env??process.env,r=e.clientVersion!==void 0?e.clientVersion:Lt(t),o=e.bundled??as();return js({isDevBuild:r===null&&!o,env:t})}function wS(){return Kv({voice:Ue(),runElevated:e=>{e.method==="sudo"&&iL(e.file,e.args,{stdio:"inherit"})}})}function aL(e,t){let r=`codex: ${e??"not found"} \xB7 ${t?"logged in":"not logged in"}`;return{grade:e!==null&&t?"ok":"warn",line:r}}async function cL(){let e=await yl();e.wsl?z("WSL detected \u2014 LAN scan degraded (mDNS/broadcast limited)"):$("host is not WSL \u2014 LAN discovery unrestricted"),e.multicastOk===!0?e.wsl?z("multicast self-test passed locally, but under WSL that only exercises the loopback stack \u2014 LAN mDNS delivery is still limited (rely on the Windows neighbor table below)"):$("multicast self-test passed (this computer's stack \u2014 it does not prove your NETWORK forwards multicast)"):e.multicastOk===!1?z("multicast self-test failed \u2014 mDNS discovery unavailable"):z("multicast self-test could not run (inconclusive)"),e.wsl&&(e.interop==="windows-arp"?$("WSL interop scanning available (powershell.exe \u2014 Windows neighbor table)"):z("WSL interop unavailable (powershell.exe not on PATH) \u2014 ARP discovery sees only the WSL subnet"));let t=await q("/local/discovered");t.hubOffline?z("hub control API unreachable \u2014 scan/connect unavailable (start it: `acbridge start`)"):t.status===200?$(`hub control API reachable (127.0.0.1:${de().hubPort})`):z(`hub control API answered HTTP ${t.status} \u2014 token mismatch? restart the hub`);try{let r=s=>{let a=Pl(s,{shell:!0,encoding:"utf8",timeout:4e3});return`${a.stdout??""}${a.stderr??""}`};if(ur(process.platform,{})==="wsl-host"){v(`firewall: ${wu}`);return}let o=Ws(process.platform,r),n=ur(process.platform,o),i=`${o.ufwStatusOut??""}${o.firewallCmdStateOut??""}${o.alfGlobalStateOut??""}`;if(n==="none")/permission denied|must be root|need to be root/i.test(i)?v("firewall state undetectable without sudo"):$("firewall: no active firewall detected \u2014 scanning unrestricted");else{let s=Vs(n,{programs:[process.execPath],ruleName:Al});if("state"in s?$("firewall: no active firewall detected \u2014 scanning unrestricted"):s.evalCheck(s.checkCommands.map(r))?$(`firewall: rule present (${n})`):z(`firewall rule missing \u2014 allow it with: ${s.manualCommand} (or use the app's Scan panel to cover the desktop app)`),n==="windows"){let a=ty(r("netsh advfirewall firewall show rule name=all dir=in verbose"),process.execPath),l=ny(ey(r("netsh advfirewall show currentprofile")),a);l&&z(l)}}vu(mi())==="keyring"?$("integration secrets: OS keyring (encrypted at rest, as this CLI resolves it)"):v("integration secrets: 0600 FILES, not the OS keyring (as this CLI resolves it) \u2014 no session keyring here, which is normal on WSL/headless Linux. The app or hub can resolve differently if it runs in a different session.")}catch{v("firewall state undetectable without sudo")}}async function lL(){let e=Wr({fresh:!0}),t=Q,r="unknown",o=e.beacon?.port??lb(),n=N(Iv(e.dir));if(!n)r="absent";else try{r=(await fetch(`http://127.0.0.1:${o}/local/devices`,{headers:{"x-bridge-hub-token":n},signal:AbortSignal.timeout(3e3)})).status===401?"rejected":"ok"}catch{r="unknown"}let i=null;try{let s=N(SS.join(t,"launch-last.json"));if(s)try{let l=JSON.parse(s);l.error?v(`last launch: REFUSED (${l.terminalId}, ${l.cwd}) \u2014 ${l.error}`):v(`last launch: ${l.terminalId} \u2192 ${l.file} ${JSON.stringify(l.args??[])}`)}catch{}let a=N(SS.join(t,"hooks-last-error.json"));if(a){let l=JSON.parse(a);typeof l.ts=="number"&&typeof l.status=="number"&&(i={ts:l.ts,status:l.status,...typeof l.hint=="string"?{hint:l.hint}:{}})}}catch{}return{home:e,localDir:t,credential:r,lastHookError:i,nowMs:Date.now()}}async function _S(e={}){let t=0,r=D=>{t++,x(D)},o=null,n=()=>o??=an(),i=(e.build??Jn)(),s=e.clientVersion?e.clientVersion():i.version,a=e.fetchManifest??ul,l=f0(s,s===null?null:await a(),process.platform,i.channel??"app");l.grade==="ok"?$(l.line):l.grade==="warn"?z(l.line):l.grade==="bad"?r(l.line):v(l.line);let u=e.voice??Ue({clientVersion:s}),d=(e.claudeVersion??(()=>uL(n())))(),p=zs(process.platform).manualCommand;if(d===null)r(`claude CLI not found on PATH \u2014 install it: ${p}`);else{let D=Iy(d);D.ok?$(`claude ${D.version}`):r(`claude ${D.version??"?"} \u2014 channels need \u2265 2.1.80 \u2014 reinstall: ${p}`)}let m=(e.codexVersion??dL)(),f=e.codexLoggedIn??Zs,g=aL(m,f());g.grade==="ok"?$(g.line):z(g.line);let h=(e.nodeRuntime??(()=>Xr(Yr(Q))))();h.kind==="shim"?$(`node runtime: bundled shim (${h.command})`):h.kind==="system"?$(`node v${h.version}`):r("node not found \u2014 install Node \u2265 20 or the AC Bridge app"),(e.pluginInstalled??(()=>pL(n())))()?$(u?"alexa@bridge plugin installed":"alexa@bridge plugin installed (agent state \u2192 device profiles)"):r("alexa@bridge plugin not installed \u2014 run `acbridge setup`");let k=lr(),_=(e.managedSettingsRaw??(()=>N(k)))(),I=Ay(_);u?I.allowed?$("channel allowlisted in managed settings"):I.present?r(`channel not allowlisted in ${k} \u2014 run \`acbridge setup\``):r(`managed settings missing at ${k} \u2014 run \`acbridge setup\``):$("managed settings not used (voice off \u2014 no channel allowlist needed)"),(e.hubBundlePresent??(()=>sL(_i)))()?$("hub bundle present"):z("hub bundle not built \u2014 run `npm run build` (dev uses tsx)");let T=(e.signedIn??Ft)(),j=T.state==="ok"?T.token:"";T.state==="ok"?$("signed in (relay token present)"):T.state==="mismatch"?r(ot.pointerMismatch):z("not signed in \u2014 run `acbridge login`");let F=(e.onboardingVerified??mL)();if(F!==null?$(`account setup verified (${new Date(F).toISOString().slice(0,10)})`):v("account setup not yet verified here \u2014 start/run check the relay on first use"),j){let Z=await(e.fetchEntitlement??zt)(j);Z?v(`plan ${Z.plan}; capture telemetry=${Z.capture.telemetry} transcripts=${Z.capture.transcripts}`):v("entitlement: couldn't read from the relay (offline?)");let Ee=(e.entitlementFileAgeH??fL)();Ee==="absent"?v("entitlement file absent \u2014 capture off until the hub next syncs"):Ee==="unreadable"?z("entitlement file unreadable \u2014 capture off, fail-closed"):Ee<=24?$(`entitlement file fresh (${Ee.toFixed(1)}h)`):z(`entitlement file STALE (${Ee.toFixed(1)}h) \u2014 capture off, fail-closed`)}await(e.hubRunning??Ne)()?$("hub running"):v(u?"hub not running (starts automatically on `acbridge run`)":"hub not running (start it: `acbridge start`)");for(let D of kS(await(e.homeFacts??lL)()))D.grade==="ok"?$(D.line):D.grade==="warn"?z(D.line):D.grade==="bad"?r(D.line):v(D.line);let fe=(e.claudeEnvironments??Cy)();for(let D of fe)D.claudePresent&&(D.pluginInstalled?$(`Claude Code wired for Profiles \u2014 ${D.label}`):z(`Claude Code is installed in ${D.label} WITHOUT the bridge plugin \u2014 sessions there drive no devices. Fix: ${D.setupHint}`));return await(e.discoveryPreflight??cL)(),v(""),t?x(`${t} problem(s) found`):$("all checks passed"),t?1:0}function uL(e){let t=e??an(),r=Pl(t.file,[...t.argsPrefix,"--version"],{encoding:"utf8"});return r.status===0?r.stdout??"":null}function dL(){let e=Vr(),t=Pl(e.file,[...e.argsPrefix,"--version"],{encoding:"utf8",timeout:5e3});return t.status===0?(t.stdout||t.stderr||"").trim()||"unknown":null}function pL(e){let t=e??an(),r=Pl(t.file,[...t.argsPrefix,"plugin","list"],{encoding:"utf8"});return Ey(`${r.stdout??""}${r.stderr??""}`).ok}function mL(){let e=Oe();return e?Ys({configFile:e.userConfigFile}).onboardedAt:null}function fL(){let e=Oe(),t=e?N(e.entitlementFile):null;if(!t)return"absent";try{let r=JSON.parse(t);return(Date.now()-(r.fetchedAt??0))/36e5}catch{return"unreadable"}}import*as $S from"node:https";import{createInterface as IS}from"node:readline/promises";function Vo(){let e=Wr({fresh:!0});if(e.source==="peer-wsl"||e.source==="peer-windows"){let o=e.source==="peer-wsl"?"on Windows":"inside WSL";return x(`the bridge is running ${o} (state in ${e.dir}), so an account linked here would be saved where that hub cannot read it. Run \`acbridge link\` from ${o}, or stop that bridge and start one on this side first.`),null}let t=Oe();if(t)return t;let r=Sr();return r.ok?(x(Ce()?"This machine's signed-in account doesn't match its stored account pointer \u2014 run `acbridge logout` then `acbridge login` to reset it.":"Couldn't resolve this machine's signed-in account \u2014 run `acbridge login` again."),null):(x(r.message),null)}var gL=e=>`${e} on the command line is world-readable via \`ps\` and saved in shell history \u2014 prefer \`${e}-file <path>\`, the interactive prompt, or its env var.`;function Or(e){if(e.file!==void 0){let t=(e.read??N)(e.file);if(t===null)return{ok:!1,message:`Couldn't read ${e.flag}-file ${e.file} \u2014 check the path and its permissions.`};let r=t.trim();return r?{ok:!0,value:r}:{ok:!1,message:`${e.flag}-file ${e.file} is empty \u2014 write the secret into it first.`}}return e.argv!==void 0?((e.warn??z)(gL(e.flag)),{ok:!0,value:e.argv.trim()}):{ok:!0,value:(e.env??"").trim()}}function hL(e){let t={},r=(o,n,i,s)=>o===`--${Eh(n)}`?(t[n]=s[++i],i):(o.startsWith(`--${Eh(n)}=`)&&(t[n]=o.slice(`--${Eh(n)}=`.length)),i);for(let o=0;o<e.length;o++){let n=e[o];if(n)for(let i of["tokenFile","keyFile","secretFile","passwordFile","url","token","units","host","bridgeId","key","clientId","secret","region","email","password","mfa","username","prefix"])o=r(n,i,o,e)}return t}var Eh=e=>e==="bridgeId"?"bridge-id":e==="clientId"?"client-id":e.endsWith("File")?`${e.slice(0,-4)}-file`:e,vL=e=>/^(https?|wss?):\/\/[^\s]+$/i.test(e),ES="Usage: acbridge link home-assistant --url http://homeassistant.local:8123 --token <long-lived-access-token> | --token-file <path> [--units metric|imperial]",AS="Usage: acbridge link hue --host <bridge-ip> [--bridge-id <id>] [--key <existing-app-key> | --key-file <path>]",PS="Usage: acbridge link smartthings (opens a browser sign-in via the relay; tokens seal at the relay)",CS="Usage: acbridge link tuya [--client-id <id>] [--secret <access-secret> | --secret-file <path>] [--region eu|eu-w|us|us-e|cn|in] (eu-w/us-e = the Azure DCs)",TS="Usage: acbridge link meross [--email <you@example.com>] [--password <pw> | --password-file <path>] [--region eu|us|ap] [--mfa <6-digit-2fa-code>]",RS="Usage: acbridge link ewelink [--email <you@example.com>] [--password <pw> | --password-file <path>] [--region eu|us|as|cn]",OS="Usage: acbridge link govee [--key <govee-api-key> | --key-file <path>] (Govee Home app \u2192 profile \u2192 Settings \u2192 Apply for API Key)",DS="Usage: acbridge link mqtt --host <broker-host[:port]> [--username <u>] [--password <p> | --password-file <path>] [--prefix homeassistant]",yL="nanoleaf pairs per-device, not per-account: run `acbridge scan`, then `acbridge connect <device>` and hold the panel's power button.";async function NS(e){let t=e[0],r=hL(e.slice(1));if(t==="smartthings")return _L(e.slice(1));if(t==="tuya")return $L(r);if(t==="meross")return IL(r);if(t==="ewelink")return EL(r);if(t==="govee")return AL(r);let o;if(t==="home-assistant"||t==="homeassistant")o=bL(r);else if(t==="hue")o=await kL(r);else if(t==="mqtt")o=xL(r);else return x(`unsupported provider: ${t??"(none)"}. Supported: home-assistant, hue, smartthings, tuya, meross, ewelink, govee, mqtt`),v(ES),v(AS),v(PS),v(CS),v(TS),v(RS),v(OS),v(DS),v(yL),2;if(!o)return 1;se("Bringing up the integration\u2026");try{let{spawned:n}=await ct({kind:"cli"});n||await Qw(),$(`Linked \u2014 your ${o.label} devices should now appear in \`acbridge devices\` and to Claude.`)}catch(n){v(`Recorded. Start the node when ready (\`acbridge daemon\`) to bring it up. (${n.message})`)}return 0}function bL(e){let t=Vo();if(!t)return null;let r=(e.url??"").trim().replace(/\/+$/,""),o=Or({flag:"--token",argv:e.token,file:e.tokenFile,env:process.env.BRIDGE_HA_TOKEN});if(!o.ok)return x(o.message),null;let n=o.value;if(!vL(r))return x("Missing/invalid --url. Give your Home Assistant base URL, e.g. http://homeassistant.local:8123"),v(ES),null;if(!n)return x("Missing --token (or BRIDGE_HA_TOKEN). Create a Long-Lived Access Token in HA \u2192 your profile \u2192 Security."),null;let i=e.units==="imperial"||e.units==="metric"?e.units:void 0,s=ca("homeassistant",r);cr(t,"homeassistant",s).write(n);let a=Un(t,"homeassistant").filter(l=>l.accountId!==s);return pr(t,"homeassistant",[...a,{accountId:s,baseUrl:r,...i?{unitSystem:i}:{}}]),$(`Linked Home Assistant (${r}). Token stored locally; account ${s}.`),{label:"Home Assistant"}}function xL(e){let t=Vo();if(!t)return null;let r=(e.host??e.url??"").trim(),{host:o,port:n,tls:i}=zw(r);if(!o)return x("Missing --host. Give your broker's address, e.g. --host 192.168.1.5 (or mqtts://broker.lan:8883)."),v(DS),null;let s=(e.username??"").trim(),a=Or({flag:"--password",argv:e.password,file:e.passwordFile,env:process.env.BRIDGE_MQTT_PASSWORD});if(!a.ok)return x(a.message),null;let l=a.value;if(l&&!s)return x("A password needs a --username too \u2014 MQTT forbids a password with no user, and brokers refuse the connection."),null;let u=(e.prefix??"").trim(),d=`${o}:${n??(i?8883:1883)}`,p=ca("mqtt",d);cr(t,"mqtt",p).write(l);let m=Un(t,"mqtt").filter(f=>f.accountId!==p);return pr(t,"mqtt",[...m,{accountId:p,host:o,...n!==void 0?{port:n}:{},...i?{tls:i}:{},...s?{username:s}:{},...u?{discoveryPrefix:u}:{}}]),$(`Linked MQTT broker ${d}${s?` as ${s}`:" (anonymous)"}. Account ${p}.`),v(`Watching \`${u||"homeassistant"}/#\` for Home Assistant Discovery configs \u2014 Zigbee2MQTT, Tasmota and anything else that publishes them.`),{label:"MQTT"}}async function kL(e){let t=Vo();if(!t)return null;let r=(e.host??"").trim();if(!r)return x("Missing --host. Give your Hue Bridge IP, e.g. --host 192.168.1.42"),v(AS),null;let o=(e.bridgeId??"").trim().toLowerCase(),n=o||void 0,i;if(!o){let p=await PL(r);n=p.bridgeId,o=p.bridgeId??r.toLowerCase(),i=p.name}let s=Or({flag:"--key",argv:e.key,file:e.keyFile,env:process.env.BRIDGE_HUE_KEY});if(!s.ok)return x(s.message),null;let a=s.value||void 0,l;if(a)l=JSON.stringify({appkey:a.trim()}),v("Using the provided app key (skipping link-button pairing).");else{se("Press the link button on top of your Hue Bridge now \u2014 pairing completes within 30s\u2026"),n||z(`couldn't read this bridge's id from ${r}, so its certificate can't be verified \u2014 pass --bridge-id <id> to pin it.`);try{let p=await CL(r,n);l=JSON.stringify({appkey:p.appkey,...p.clientkey?{clientkey:p.clientkey}:{}})}catch(p){return x(`Hue pairing failed: ${p.message}`),null}}let u=ca("hue",o);cr(t,"hue",u).write(l);let d=Un(t,"hue").filter(p=>p.accountId!==u);return pr(t,"hue",[...d,{accountId:u,host:r,bridgeId:o,...i?{name:i}:{}}]),$(`Linked Philips Hue (${r}, bridge ${o}). Keys stored locally; account ${u}.`),{label:"Philips Hue"}}function wL(e,t,r){if(!r)return!1;let o=n=>n.provider===e&&n.status!=="revoked"&&n.status!=="needs_reauth";return r.some(n=>{if(!o(n))return!1;let i=t?.find(s=>s.provider===e&&(s.accountId===void 0||n.accountId===void 0||s.accountId===n.accountId));return i?i.status!==n.status||i.linkedAt!==n.linkedAt:!0})}async function SL(e,t,r){let o=r.intervalMs??3e3,n=r.sleep??(s=>new Promise(a=>setTimeout(a,s))),i=Date.now()+r.timeoutMs;for(;;){let s=await t();if(wL(e,r.before??null,s))return!0;if(Date.now()+o>i)return!1;await n(o)}}async function _L(e){let t=Sr();if(!t.ok)return x(t.message),3;let r=e.includes("--no-browser"),o=e.includes("--no-wait"),n=e.indexOf("--timeout"),i=n!==-1?Number(e[n+1]):180;if(!Number.isFinite(i)||i<=0)return x("--timeout takes a positive number of seconds"),2;se("Starting SmartThings sign-in\u2026");let s=N(we().accessFile)?.trim(),a=s?await ro(s):null,l=await yb("smartthings");if(!l.ok||!l.authorizeUrl)return x(l.error??"Couldn't start SmartThings linking."),v(PS),1;let u=!1;return r||(u=await eo(l.authorizeUrl,{isWsl:Gr()}).catch(()=>!1)),u?$("Browser opened \u2014 sign in to Samsung and approve access."):($("Open this URL in a browser, sign in to Samsung, and approve access:"),v(l.authorizeUrl)),o?(v("The account links at the relay; the hub picks it up automatically on its next connect (or restart the hub)."),0):(se(`Waiting for the link to complete (up to ${i}s)\u2026`),await SL("smartthings",async()=>{let p=N(we().accessFile)?.trim();return p?ro(p):null},{timeoutMs:i*1e3,before:a})?($("SmartThings linked \u2014 devices appear after the bridge's next relay connect (or restart the bridge)."),0):(x(`SmartThings didn't finish linking within ${i}s \u2014 the URL stays valid, approve it and check \`acbridge integrations\`:`),v(l.authorizeUrl),1))}async function $L(e){let t=await _r();if(!t.ok)return x(t.message),3;v("Tuya key wizard \u2014 one-time setup to control Smart Life / Tuya devices locally:"),v(" 1. Create a free account + Cloud Project at iot.tuya.com (data-center region MUST match your Smart Life app \u2014 UK/EU \u2192 Central Europe)."),v(" 2. Subscribe IoT Core (+ Authorization) to the project, then 'Link Tuya App Account' by scanning the QR from the Smart Life app."),v(" 3. Copy the project's Access ID (client id) + Access Secret below."),v(" Note: the IoT Core trial runs ~1 month (console \u2192 Cloud \u2192 My Services \u2192 'Extend Trial Period'). After it expires your"),v(" already-connected lamps keep working locally \u2014 only fetching NEW keys stops. Re-pairing a device rotates its key \u2192 re-run this.");let r=(e.clientId??process.env.BRIDGE_TUYA_CLIENT_ID??await Wo("Access ID (client id): ")).trim(),o=Or({flag:"--secret",argv:e.secret,file:e.secretFile,env:process.env.BRIDGE_TUYA_SECRET});if(!o.ok)return x(o.message),2;let n=(o.value||await Cl("Access Secret: ")).trim(),i=((e.region??process.env.BRIDGE_TUYA_REGION??await Wo("Region [eu]: "))||"eu").trim().toLowerCase();if(!r||!n)return x("Both the Access ID and Access Secret are required."),v(CS),1;if(!["eu","eu-w","us","us-e","cn","in"].includes(i))return x(`Unknown region "${i}" \u2014 use eu, eu-w, us, us-e, cn, or in.`),1;se("Making sure the hub is running\u2026");try{await ct({kind:"cli"})}catch(a){return x(`The hub isn't running and couldn't be started: ${a.message}. Start it with \`acbridge daemon\` and retry.`),1}se("Fetching your device keys from Tuya (this can take a few seconds)\u2026");let s=await q("/local/tuya/link",{method:"POST",body:{clientId:r,clientSecret:n,region:i},timeoutMs:9e4});if(s.hubOffline)return x("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(s.status===200&&s.body?.ok){let a=s.body.deviceCount??0,l=s.body.sleepyCount??0;return $(`Imported keys for ${a} Tuya device${a===1?"":"s"}. Keys are stored only on this PC (never on your network or the cloud).`),l>0&&v(`${l} battery/sensor device${l===1?"":"s"} (e.g. a PIR) won't control locally yet \u2014 those come in a later update.`),v('Now run `acbridge scan` \u2014 your lamps should appear under "Ready to connect". Connect each, then control them by voice or `acbridge devices`.'),0}return x(s.body?.error??`The hub couldn't complete the wizard (HTTP ${s.status??"?"}).`),1}async function IL(e){let t=await _r();if(!t.ok)return x(t.message),3;v("Meross account wizard \u2014 a one-time sign-in so the hub can control your Meross devices locally:"),v(" Your Meross email + password are sent ONCE to Meross to fetch the account key that signs local"),v(" requests. The key is stored only on this PC \u2014 never on your network, the cloud, or our relay.");let r=Or({flag:"--password",argv:e.password,file:e.passwordFile,env:process.env.BRIDGE_MEROSS_PASSWORD});if(!r.ok)return x(r.message),2;let o=(e.email??process.env.BRIDGE_MEROSS_EMAIL??await Wo("Meross email: ")).trim(),n=r.value||await Cl("Password: "),i=((e.region??process.env.BRIDGE_MEROSS_REGION??await Wo("Region [eu]: "))||"eu").trim().toLowerCase();if(!o||!n)return x("Both the email and password are required."),v(TS),1;if(!["eu","us","ap"].includes(i))return x(`Unknown region "${i}" \u2014 use eu, us, or ap.`),1;let s=(e.mfa??process.env.BRIDGE_MEROSS_MFA)?.trim()||void 0;se("Making sure the hub is running\u2026");try{await ct({kind:"cli"})}catch(l){return x(`The hub isn't running and couldn't be started: ${l.message}. Start it with \`acbridge daemon\` and retry.`),1}se("Signing in to Meross\u2026");let a=await q("/local/meross/link",{method:"POST",body:{email:o,password:n,region:i,...s?{mfaCode:s}:{}},timeoutMs:6e4});if(a.hubOffline)return x("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(a.status===200&&a.body?.ok){let l=a.body.deviceCount??0;return $(`Signed in. The account key is stored only on this PC.${l?` (${l} device${l===1?"":"s"} on the account.)`:""}`),v('Now run `acbridge scan` \u2014 your Meross plugs/bulbs should appear under "Ready to connect". Connect each, then control them by voice or `acbridge devices`.'),0}return x(a.body?.error??`The hub couldn't complete the sign-in (HTTP ${a.status??"?"}).`),1}async function EL(e){let t=await _r();if(!t.ok)return x(t.message),3;v("SONOFF / eWeLink account wizard \u2014 a one-time sign-in so the hub can control your SONOFF devices locally:"),v(" Your eWeLink email + password are sent ONCE to eWeLink to fetch each device's LAN key. The keys"),v(" are stored only on this PC \u2014 never on your network, the cloud, or our relay.");let r=Or({flag:"--password",argv:e.password,file:e.passwordFile,env:process.env.BRIDGE_EWELINK_PASSWORD});if(!r.ok)return x(r.message),2;let o=(e.email??process.env.BRIDGE_EWELINK_EMAIL??await Wo("eWeLink email: ")).trim(),n=r.value||await Cl("Password: "),i=((e.region??process.env.BRIDGE_EWELINK_REGION??await Wo("Region [eu]: "))||"eu").trim().toLowerCase();if(!o||!n)return x("Both the email and password are required."),v(RS),1;if(!["eu","us","as","cn"].includes(i))return x(`Unknown region "${i}" \u2014 use eu, us, as, or cn.`),1;se("Making sure the hub is running\u2026");try{await ct({kind:"cli"})}catch(a){return x(`The hub isn't running and couldn't be started: ${a.message}. Start it with \`acbridge daemon\` and retry.`),1}se("Signing in to eWeLink\u2026");let s=await q("/local/ewelink/link",{method:"POST",body:{email:o,password:n,region:i},timeoutMs:6e4});if(s.hubOffline)return x("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(s.status===200&&s.body?.ok){let a=s.body.deviceCount??0;return $(`Signed in. ${a} device key${a===1?"":"s"} stored \u2014 only on this PC.`),v('Now run `acbridge scan` \u2014 your SONOFF switches/plugs should appear under "Ready to connect". Connect each, then control them by voice or `acbridge devices`.'),0}return x(s.body?.error??`The hub couldn't complete the sign-in (HTTP ${s.status??"?"}).`),1}async function AL(e){let t=await _r();if(!t.ok)return x(t.message),3;v("Govee key wizard \u2014 one self-service API key imports your Govee devices:"),v(" Govee Home app \u2192 profile \u2192 Settings \u2192 Apply for API Key (it arrives by email within minutes).");let r=Or({flag:"--key",argv:e.key,file:e.keyFile,env:process.env.BRIDGE_GOVEE_KEY});if(!r.ok)return x(r.message),2;let o=(r.value||await Cl("Govee API key: ")).trim();if(!o)return x("An API key is required."),v(OS),2;se("Making sure the hub is running\u2026");try{await ct({kind:"cli"})}catch(i){return x(`The hub isn't running and couldn't be started: ${i.message}. Start it with \`acbridge daemon\` and retry.`),1}se("Importing your Govee devices\u2026");let n=await q("/local/govee/link",{method:"POST",body:{apiKey:o},timeoutMs:6e4});if(n.hubOffline)return x("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(n.status===200&&n.body?.ok){let i=n.body.deviceCount??0;return $(`Imported ${i} Govee device${i===1?"":"s"}. The key is stored only on this PC.`),v('Now run `acbridge scan` \u2014 your Govee lights should appear under "Ready to connect". Connect each, then control them by voice or `acbridge devices`.'),0}return x(n.body?.error??`The hub couldn't complete the wizard (HTTP ${n.status??"?"}).`),1}async function Wo(e){let t=IS({input:process.stdin,output:process.stdout});try{return await t.question(e)}finally{t.close()}}async function Cl(e){let t=process.stdout,r=IS({input:process.stdin,output:t}),o=r,n=o._writeToOutput?.bind(r);o._writeToOutput=i=>{(i.includes(e)||i===`\r
|
|
260
|
-
`||i===`
|
|
261
|
-
`)&&n?.(i)};try{let i=await r.question(e);return t.write(`
|
|
262
|
-
`),i}finally{r.close()}}function LS(e,t,r,o,n){return new Promise((i,s)=>{let a=o===void 0?void 0:JSON.stringify(o),l=$S.request({host:e,port:443,method:t,path:r,rejectUnauthorized:!1,headers:{"content-type":"application/json"}},u=>{if(n){let p=Ev(u.socket.getPeerCertificate?.());if(!Av(p,n)){u.destroy(),l.destroy(),s(new Error(`this device is not Hue bridge ${n} (certificate says ${p??"nothing"}) \u2014 refusing to send the pairing request`));return}}let d="";u.setEncoding("utf8"),u.on("data",p=>d+=p),u.on("end",()=>{try{i(d?JSON.parse(d):{})}catch(p){s(p instanceof Error?p:new Error(String(p)))}})});l.on("error",s),a&&l.write(a),l.end()})}async function PL(e){try{let t=await LS(e,"GET","/api/0/config");return{bridgeId:t.bridgeid?.toLowerCase(),name:t.name}}catch{return{}}}async function CL(e,t){let r=Date.now()+3e4;for(;;){let o=await LS(e,"POST","/api",{devicetype:"acbridge#cli",generateclientkey:!0},t),n=Array.isArray(o)?o.find(s=>s.success)?.success:void 0;if(n)return{appkey:n.username,clientkey:n.clientkey};let i=Array.isArray(o)?o.find(s=>s.error)?.error:void 0;if(i&&i.type!==101)throw new Error(i.description??`Hue error ${i.type}`);if(Date.now()>r)throw new Error("timed out waiting for the link button (30s)");await new Promise(s=>setTimeout(s,1500))}}var Ah=["tuya","meross","ewelink","nanoleaf","govee","esphome"];async function US(e){let t=e[0];if(t===void 0||!el.safeParse(t).success)return x(`usage: acbridge unlink <${Ah.join(" | ")}>`),2;let r=await q(`/local/${t}/unlink`,{method:"POST"});return r.hubOffline?(x(Fe()),1):r.status===200&&r.body?.ok?($(`removed the ${t} account \u2014 its keys and devices are gone from this machine`),r.body.note&&v(r.body.note),0):(x(r.body?.error??`hub answered HTTP ${r.status}`),1)}var TL=["tuya","meross","ewelink","govee"],RL=["homeassistant","mqtt","hue"],OL=["smartthings"];function zS(e){for(let t of RL)if(e.startsWith(`${t}_`))return{provider:t,class:"local"};for(let t of OL)if(e===t||e.startsWith(`${t}_`))return{provider:t,class:"cloud"};for(let t of Ah)if(e===t||e.startsWith(`${t}_`))return{provider:t,class:"keyed"};return null}var DL=e=>e.enabled!==!1;function Ph(e,t){return e.filter(r=>typeof r.accountId=="string").map(r=>({accountId:String(r.accountId),enabled:DL(r),detail:t(r)}))}function NL(e){let t=[],r=e.accounts("homeassistant");t.push({provider:"home-assistant",kind:"local",status:r.length>0?"linked":"not linked",...r.length>0?{detail:r.map(s=>String(s.baseUrl??s.accountId??"")).join(", "),accounts:Ph(r,s=>String(s.baseUrl??""))}:{hint:"acbridge link home-assistant"}});let o=e.accounts("mqtt");t.push({provider:"mqtt",kind:"local",status:o.length>0?"linked":"not linked",...o.length>0?{detail:o.map(s=>`${String(s.host??s.accountId??"")}${s.port?`:${String(s.port)}`:""}`).join(", "),accounts:Ph(o,s=>`${String(s.host??"")}${s.port?`:${String(s.port)}`:""}`)}:{hint:"acbridge link mqtt --host <broker>"}});let n=e.accounts("hue");t.push({provider:"hue",kind:"local",status:n.length>0?"linked":"not linked",...n.length>0?{detail:n.map(s=>String(s.host??s.bridgeId??"")).join(", "),accounts:Ph(n,s=>String(s.host??""))}:{hint:"acbridge link hue"}});for(let s of TL){let a=e.hasKeystore(s);t.push({provider:s,kind:"keyed",status:a?"linked":"not linked",...a?{}:{hint:`acbridge link ${s}`}})}t.push({provider:"nanoleaf",kind:"device-paired",status:"pairs per device",hint:"acbridge connect <device> (hold the power button)"});let i=e.cloudAccounts===null?null:e.cloudAccounts.find(s=>s.provider==="smartthings");return t.push({provider:"smartthings",kind:"cloud",status:e.cloudAccounts===null?"unknown (sign in)":i?i.status??"linked":"not linked",...e.cloudAccounts!==null&&!i?{hint:"acbridge link smartthings"}:{}}),t}function LL(e){let t=[];for(let r of e){t.push(`${r.provider.padEnd(16)} ${r.status.padEnd(18)} ${r.detail??r.hint??""}`.trimEnd());for(let o of r.accounts??[])t.push(me(` ${o.accountId.padEnd(28)} ${o.enabled?"":"(paused) "}${o.detail??""}`.trimEnd()))}return t}var jS=["Usage: acbridge integrations [list] [--json]"," acbridge integrations enable|disable <accountId> (local accounts \u2014 ids from `list`)"," acbridge integrations remove <accountId|smartthings>"].join(`
|
|
263
|
-
`);async function FS(e){(await q("/local/reload",{method:"POST",body:{}})).hubOffline?v(me("bridge not running \u2014 the change applies when it next starts")):e==="down"&&v(me("saved \u2014 a currently-running adapter lets go fully at the next bridge restart"))}async function UL(e,t,r){let o=zS(e);if(!o)return E(`no integration matches "${e}" \u2014 ids are in \`acbridge integrations\``,1);if(o.class==="cloud")return E("Cloud integrations can't be paused \u2014 remove it to disconnect.",2);if(o.class==="keyed")return E(`Pause or remove individual devices from the network scan (\`acbridge scan\`), or remove the whole account: \`acbridge unlink ${o.provider}\`.`,2);let n=Vo();if(!n)return 3;let i=Un(n,o.provider);return i.some(s=>s.accountId===e)?(pr(n,o.provider,i.map(s=>s.accountId===e?{...s,enabled:t}:s)),await FS(t?"up":"down"),$(`${e} ${t?"resumed":"paused"}`),r&&K({ok:!0,accountId:e,enabled:t}),0):E(`no ${o.provider} account "${e}" on this machine`,1)}async function jL(e,t){let r=zS(e);if(!r)return E(`no integration matches "${e}" \u2014 ids are in \`acbridge integrations\``,1);if(r.class==="keyed")return E(`keyed providers remove whole accounts: \`acbridge unlink ${r.provider}\``,2);if(r.class==="cloud"){let i=_t({notSignedIn:{message:"Not signed in. Run `acbridge login` first.",exitCode:3}});if(!i.ok)return E(i.message,i.exitCode);let a=(await ro(i.token))?.find(d=>d.provider===r.provider),l=e.includes("_")?e:a?.accountId;if(!l)return E(`no linked ${r.provider} account to disconnect`,1);let u=await hb(i.token,l);return u.ok?($(`${r.provider} disconnected at the relay`),t&&K({ok:!0,removed:l}),0):E(u.error??"couldn't disconnect the account",1)}let o=Vo();if(!o)return 3;let n=Un(o,r.provider);if(!n.some(i=>i.accountId===e))return E(`no ${r.provider} account "${e}" on this machine`,1);pr(o,r.provider,n.filter(i=>i.accountId!==e));for(let i of[e,"keystore","cloud"])try{cr(o,r.provider,i).delete()}catch{}return await FS("down"),$(`removed ${e} \u2014 its credentials are gone from this machine`),t&&K({ok:!0,removed:e}),0}async function MS(e=[]){let t=e.includes("--json");t&&be(!0);let r=e.filter(l=>l!=="--json"),o=r[0]??"list";if(o==="enable"||o==="disable"||o==="remove"){let l=r[1];return!l||r.length>2?E(jS,2):o==="remove"?jL(l,t):UL(l,o==="enable",t)}if(o!=="list")return E(jS,2);let n=Ft(),i=n.state==="ok"?await ro(n.token):null,s=Oe(),a=NL({accounts:l=>s?Un(s,l):[],hasKeystore:l=>s?cr(s,l,"keystore").read()!==null:!1,cloudAccounts:i});if(t)K(a);else for(let l of LL(a))v(l);return 0}function zL(e){let t=e?.onboarding;return typeof t=="object"&&t!==null&&typeof t.completedAt=="number"}function FL(e){return{onboarding:{completedAt:e,completedBy:"cli"}}}async function BS(e,t,r={}){if(!t)return"skipped";let o=r.http??fetch,n=r.now??Date.now,i=e.replace(/\/+$/,""),s=2;try{let a=r.current??await pl(e,t,o);for(let l=0;l<s;l+=1){if(zL(a.config))return"already";if(a.version===null)return"skipped";let u=await o(`${i}/settings`,{method:"PUT",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify({version:a.version,config:{...a.config,...FL(n())}}),signal:AbortSignal.timeout(6e3)});if(u.ok)return"claimed";if(u.status!==409)return"skipped";l+1<s&&(a=await pl(e,t,o))}return"skipped"}catch{return"skipped"}}function ML(e){try{let t=JSON.parse(Buffer.from(e.split(".")[1]??"","base64url").toString("utf8"));return{...typeof t.sub=="string"?{sub:t.sub}:{},...typeof t.nid=="string"?{nid:t.nid}:{},...typeof t.exp=="number"?{exp:t.exp}:{}}}catch{return null}}function BL(e){let t=[`account: ${e.claims.sub??"(unknown)"}`,...e.claims.nid?[`node: ${e.claims.nid}`]:[],`machine: ${e.machine}`,`relay: ${e.relayUrl}`,...e.plan?[`plan: ${e.plan}`]:[]],r={account:e.claims.sub??null,...e.claims.nid?{node:e.claims.nid}:{},machine:e.machine,relayUrl:e.relayUrl,...e.plan?{plan:e.plan}:{}};if(e.scope){let{pointerSub:o,resolvedSub:n}=e.scope,i=!!n&&o===n;t.push(`pointer: ${o??"(none)"}`),t.push(n?`resolved: ${n}${i?" (pointer and credential agree)":""}`:o?`resolved: MISMATCH \u2014 pointer and credential name different accounts (${ot.pointerMismatch})`:"resolved: not signed in"),r.pointer=o,r.resolved=n,r.agree=i}return{lines:t,json:r}}async function Tl(e=[]){let t=e.includes("--json");t&&be(!0);let r=N(we().accessFile)?.trim(),o=Ce()?.sub??null,n=gt()?.sub??null;if(!r){let l=ft();return l.length>0&&o&&!n?(St(l),E(ot.pointerMismatch,3)):E("Not signed in. Run `acbridge login` first.",3)}let i=ML(r)??{},s=await zt(r),a=BL({claims:i,machine:sa(),relayUrl:de().relayUrl,plan:s?.plan??null,scope:{pointerSub:o,resolvedSub:n}});if(t)K(a.json);else for(let l of a.lines)v(l);return 0}var HL=`Usage: acbridge login [--if-needed] [--provider google|github|microsoft|sso] [--email <you@example.com>] [--no-browser] [--timeout <s>] [--json]
|
|
264
|
-
--if-needed skip the sign-in when this machine already holds a usable credential (default: always sign in)`,HS=["google","github","microsoft","email","sso"];function ZL(e){let t={provider:"email",noBrowser:!1,timeoutMs:18e4,json:!1,ifNeeded:!1,chooser:!0};for(let r=0;r<e.length;r++){let o=e[r];if(o==="--if-needed")t.ifNeeded=!0;else if(o==="--no-browser")t.noBrowser=!0;else if(o==="--json")t.json=!0;else if(o==="--provider"){let n=e[++r];HS.includes(n)?(t.provider=n,t.chooser=!1):t.bad=`invalid --provider: ${n??"(none)"} (use ${HS.join(" | ")})`}else if(o==="--email")t.email=e[++r],t.chooser=!1;else if(o==="--timeout"){let n=Number(e[++r]);Number.isFinite(n)?t.timeoutMs=Math.min(600,Math.max(30,Math.round(n)))*1e3:t.bad=`invalid --timeout: ${e[r]??"(none)"}`}else t.bad=`unknown option: ${o??""}`}return t}function GS(e={}){let t=e.readCredentialSub??ll,r=e.writePointer??(n=>dr({sub:n})),o=e.log??z;try{let n=t();n&&r(n)}catch(n){o(`couldn't update the active-user pointer (non-fatal): ${n instanceof Error?n.message:String(n)}`)}}function GL(e={}){(e.readActiveUser??(()=>Ce()))()||(e.heal??GS)()}function WL(e={}){let t=(e.scan??ft)();return(e.warnAmbiguous??(o=>St(o)))(t),(e.resolveScope??(()=>gt()))()?{kind:"signed-in"}:(e.readPointer??(()=>Ce()))()?{kind:"refuse",message:ot.pointerMismatch}:t.length===1&&ma(t[0],e.segmentOf)?{kind:"heal",sub:t[0].sub}:{kind:"refuse",message:ot.logoutFirst("log in")}}function VL(e){return e.hasCredential?e.refreshed?{kind:"already"}:{kind:"stale-sign-in"}:{kind:"sign-in"}}async function ZS(e,t,r={}){let o=(r.readToken??(()=>N(we().accessFile)?.trim()??""))();if(o){let n=await(r.sync??ml)(e,o);await(r.claim??BS)(e,o,{current:n})==="claimed"&&v("Account setup completed from this machine \u2014 `acbridge start` will run here now.")}return $(t.successLine),(r.report??(n=>Tl(n?["--json"]:[])))(t.json)}async function WS(e=[]){let t=ZL(e);if(t.bad)return x(t.bad),v(HL),2;t.json&&be(!0);let r=de().relayUrl;if(t.ifNeeded&&ra()){if(on()>=sn){let n=WL();if(n.kind==="refuse")return x(n.message),3;n.kind==="heal"&&dr({sub:n.sub})}else GL();if(VL({hasCredential:!0,refreshed:await Ut(r)}).kind==="already")return ZS(r,{json:t.json,successLine:"already signed in on this machine"});z("this machine's stored sign-in is no longer valid \u2014 signing in again")}{let o=Fy(),n=Gr();try{t.noBrowser||se("opening your browser to sign in\u2026");let i=await Xy({cfg:o,opts:{provider:t.provider,...t.email?{email:t.email}:{}},chooser:t.chooser,timeoutMs:t.timeoutMs,openUrl:t.noBrowser?async()=>!1:a=>eo(a,{isWsl:n}),onBrowserFail:a=>{v(t.noBrowser?"Open this URL to sign in:":"Couldn't open a browser \u2014 open this URL to sign in:"),v(a)}});if(se("pairing this machine\u2026"),!await Ky(r,()=>i.accessToken))return x("Signed in, but couldn't pair this machine with the relay \u2014 check your connection and retry."),1}catch(i){return x(Zy(i)),3}}return GS(),ZS(r,{json:t.json,successLine:"Signed in. This machine now holds its own relay credential and refreshes itself."})}function qL(e){let t=e.reverted+e.failed+e.skipped;if(t===0)return"no devices needed reverting";let r=[`reverted ${e.reverted} of ${t} device${t===1?"":"s"}`];return e.failed&&r.push(`${e.failed} failed`),e.skipped&&r.push(`${e.skipped} skipped`),r.join(", ")}async function Qn(e=[]){let t=e.includes("--json");t&&be(!0);let r,o=d=>{t&&K({stopped:d,...r?{revert:r}:{}})},n=await q("/local/session/stop",{method:"POST",body:{},timeoutMs:2e4});!n.hubOffline&&n.status===200&&n.body?.summary&&(r=n.body.summary,$(`lights: ${qL(r)}`));let i=await Yw(),s=N(Qe);if(i)return s&&ve(Qe),$("hub stopping \u2014 devices reverting, holders releasing"),o(!0),0;cb("stop-requested");let a=s?Number(s):0,l=a>0&&jo({pid:a}),u=await Ne();if(!l&&!u)return s&&ve(Qe),$("bridge already stopped"),o(!1),0;if(l)try{process.kill(a)}catch{}return s&&ve(Qe),Jw(),await Ne()?(x("the hub is still running and didn't answer the shutdown \u2014 check ~/.claude-bridge/hub.log"),1):($("hub stopped"),o(!0),0)}var JL="Usage: acbridge logout [--json]",KL=new Set(["--json"]);async function Rl(e=[],t={}){let r=e.filter(h=>!KL.has(h));if(r.length>0)return x(`unknown option: ${r[0]}`),v(JL),2;let o=e.includes("--json");o&&be(!0);let n=t.read??N,i=t.stopBridge??Qn,s=t.revoke??((h,y,k)=>Jy(h,y,{clear:k})),a=t.clearTokens??pi,l=t.keyring??mi(),u=h=>(t.clearDeviceCredentials??au)(h,l),d=t.clearLogs??(()=>{Lu(wt),Lu(Ln)}),p=t.clearPointer??Yy,m=t.relayUrl??de().relayUrl,f=[],g=(t.scan??ft)();g.length>=2&&(t.warnAmbiguous??(h=>St(h)))(g);for(let{segment:h}of g){let y=xt(h),k=n(y.accessFile)?.trim()??n(y.refreshFile)?.trim()??null;f.push({segment:h,paths:y,bearer:k})}if(f.length===0)return $("already signed out"),o&&K({signedOut:!0,alreadySignedOut:!0}),0;se("stopping the bridge\u2026"),await i([]);for(let{segment:h,paths:y,bearer:k}of f)se("revoking this machine's credential\u2026"),await s(m,k,()=>a(y)),u(h);return d(),p(),$("signed out \u2014 this machine no longer holds a credential."),o&&K({signedOut:!0,alreadySignedOut:!1}),0}var XL=c.object({deviceId:c.string(),capability:At,instance:c.string().optional(),command:c.string(),params:c.unknown().optional()}),YL=c.object({deviceId:c.string(),instance:c.string().optional(),look:Yc.optional(),effect:wr.optional(),returnTo:Xc.optional(),hold:c.boolean().default(!1)}),QL=c.object({enabled:c.boolean().default(!0),actions:c.array(XL).default([]),looks:c.array(YL).default([]),allowSecurity:c.boolean().default(!1),threshold:c.number().min(0).max(100).optional(),modelMatch:c.object({models:c.array(c.string()).min(1),direction:c.enum(["becomes","leaves"]).default("becomes")}).optional()}),er={contextLow:{kind:"percent",default:75,min:50,max:95,step:1,hysteresis:10,unitLabel:"% context"},contextCritical:{kind:"percent",default:90,min:60,max:99,step:1,hysteresis:10,unitLabel:"% context"},usageHigh:{kind:"percent",default:80,min:50,max:95,step:1,hysteresis:10,unitLabel:"% usage"},costHigh:{kind:"dollars",default:5,min:.5,max:50,step:.5,hysteresis:0,unitLabel:"$ spent"},longRunning:{kind:"minutes",default:10,min:1,max:60,step:1,hysteresis:0,unitLabel:"min working"}},VS=Object.fromEntries(Object.entries(er).map(([e,t])=>[e,t.default])),eU=c.object({proactive:c.boolean().default(!0),doNotDisturb:c.boolean().default(!1),announce:c.record(c.string(),c.boolean()).default({})}),tU=c.object({enabled:c.boolean().default(!1),start:c.string().regex(/^\d{2}:\d{2}$/).default("22:00"),end:c.string().regex(/^\d{2}:\d{2}$/).default("07:00"),tz:c.string().optional()}),Qt=c.object({id:c.string(),name:c.string().default(""),icon:c.string().default("spark"),gradient:c.tuple([c.string(),c.string(),c.string()]).optional(),deviceScope:c.array(c.string()).default([]),palette:c.array(at).default([]),states:c.record(c.string(),QL).default({}),notifications:eU.default({proactive:!0,doNotDisturb:!1,announce:{}}),quietHours:tU.default({enabled:!1,start:"22:00",end:"07:00"}),updatedAt:c.number().optional(),agent:hn.optional()}),Ol=c.object({profiles:c.array(Qt).default([]),bindings:c.record(c.string(),c.string()).default({}),codexBindings:c.record(c.string(),c.string()).default({})});var nU={started:"Claude started a session",working:"Claude is working",needs_permission:"Claude needs permission",needsInput:"Claude has a question for you",planReady:"Claude's plan is ready for approval",idle:"Claude is waiting for you",finished:"Claude finished",contextLow:"Claude is at {pct} percent context",contextCritical:"Claude's context is nearly full \u2014 {pct} percent",rateLimited:"You've hit your Claude usage limit",error:"Claude hit an error",ended:"Claude session ended",resumed:"Claude session resumed",subagentStart:"Claude started a subagent",subagentFinished:"A Claude subagent finished",compacting:"Claude is compacting its context",compactDone:"Claude finished compacting",permissionDenied:"A Claude tool call was blocked",taskCompleted:"A background Claude task finished",usageHigh:"Claude usage is at {pct} percent of the {window} window",modePlan:"Claude entered plan mode",modeAuto:"Claude is auto accepting edits",modeBypass:"Claude is bypassing permission checks",modeNormal:"Claude is back to normal permission checks",modelChanged:"Claude switched to {model}",workflowStarted:"Claude launched a workflow",reviewChanged:"The pull request review changed to {review}",costHigh:"This session has cost {cost} dollars",longRunning:"Claude has been working {mins} minutes"},Th=["started","resumed","working","finished","needs_permission","compacting","compactDone","subagentStart","subagentFinished","contextLow","contextCritical","modePlan","modeAuto","modeBypass","modeNormal","modelChanged","error","idle","ended","permissionDenied","planReady","rateLimited","sandboxEscalation","longRunning"],rU=["sandboxEscalation"];function Dl(e,t){return e==="codex"?Th.includes(t):!rU.includes(t)}var oU={started:"Codex started a session",resumed:"Codex session resumed",working:"Codex is working",finished:"Codex finished",needs_permission:"Codex needs permission",compacting:"Codex is compacting its context",compactDone:"Codex finished compacting",subagentStart:"Codex started a subagent",subagentFinished:"A Codex subagent finished",contextLow:"Codex is at {pct} percent context",contextCritical:"Codex's context is nearly full \u2014 {pct} percent",modePlan:"Codex entered plan mode",modeAuto:"Codex is auto accepting edits",modeBypass:"Codex is bypassing permission checks",modeNormal:"Codex is back to normal permission checks",modelChanged:"Codex switched to {model}",error:"Codex hit an error",idle:"Codex is waiting",ended:"Codex session ended",permissionDenied:"A Codex action was declined",planReady:"Codex has a plan ready for approval",rateLimited:"Codex hit its usage limit",sandboxEscalation:"Codex wants to leave its sandbox",longRunning:"Codex has been working {mins} minutes"};function iU(e,t){return e==="codex"?oU[t]:nU[t]}var sU="codex::";function aU(e,t){return e==="codex"?`${sU}${t}`:t}function Rh(e){return typeof e?.id=="string"&&e.id.startsWith("prof:")}function cU(e,t){return!(!is[e.capability]?.some(o=>o.command===e.command)||t&&!t.devices.some(o=>o.id===e.deviceId))}var lU=new Set(["color","colorTemperature","brightness"]);function qS(e,t,r){let o=r?.voice??!1,n=Ol.safeParse({profiles:e?.profiles,bindings:e?.bindings,codexBindings:e?.codexBindings}),i=[],s={},a={},l={};if(Array.isArray(e?.rules))for(let u of e.rules){let d=_w.safeParse(u);d.success&&!Rh(d.data)&&i.push(d.data)}if(n.success){let u=new Map(n.data.profiles.map(p=>[p.id,p])),d=[["claude",n.data.bindings],["codex",n.data.codexBindings]];for(let[p,m]of d)for(let[f,g]of Object.entries(m)){let h=u.get(g);if(!h)continue;let y=aU(p,f);s[y]={proactive:h.notifications.proactive,doNotDisturb:h.notifications.doNotDisturb,quietHours:h.quietHours};for(let[k,_]of Object.entries(h.states)){if(!_.enabled)continue;let I=ss.safeParse(k);if(!I.success)continue;let S=I.data;S in VS&&((a[y]??={})[S]=_.threshold??VS[S]),S==="modelChanged"&&_.modelMatch&&(l[y]={models:_.modelMatch.models,direction:_.modelMatch.direction});let T=_.actions.filter(X=>h.deviceScope.includes(X.deviceId)&&cU(X,t)),j=new Set(T.filter(X=>X.capability==="power").map(X=>X.deviceId)),fe=[...[...new Set(T.filter(X=>lU.has(X.capability)&&!j.has(X.deviceId)).map(X=>X.deviceId))].map(X=>({kind:"device",deviceId:X,capability:"power",command:"turnOn",params:{}})),...T.map(X=>({kind:"device",deviceId:X.deviceId,capability:X.capability,...X.instance?{instance:X.instance}:{},command:X.command,params:X.params}))],D=iU(p,S),Z=o&&h.notifications.announce[S]&&D?[{kind:"notify",title:h.name||"AC Bridge",body:D}]:[],Ee=_.looks.filter(X=>h.deviceScope.includes(X.deviceId)).map(X=>({kind:"intent",deviceId:X.deviceId,...X.instance?{instance:X.instance}:{},...X.look?{look:X.look}:{},...X.effect?{effect:X.effect}:{},...X.returnTo?{returnTo:X.returnTo}:{},hold:X.hold})),_e=[...fe,...Ee,...Z];if(_e.length===0)continue;let Nt=p==="codex"?`prof:codex:${h.id}:${f}:${S}`:`prof:${h.id}:${f}:${S}`;i.push({id:Nt,name:h.name?`${h.name} \xB7 ${S}`:S,enabled:!0,trigger:{kind:"session",event:S,repo:f,agent:p},conditions:[],actions:_e,allowSecurity:_.allowSecurity})}}}return{rules:i,notifyPolicy:s,thresholds:a,modelMatch:l}}var Oh="this account's profiles document is unreadable by this version \u2014 update AC Bridge (nothing was written)";function Dh(e){return e.profiles!==void 0||e.bindings!==void 0||e.codexBindings!==void 0?Ol.safeParse({profiles:e.profiles,bindings:e.bindings,codexBindings:e.codexBindings}).success?"ok":"malformed":"empty"}function Ot(e){let t=Ol.safeParse({profiles:e.profiles,bindings:e.bindings,codexBindings:e.codexBindings});return t.success?t.data:{profiles:[],bindings:{},codexBindings:{}}}function Nh(){return`prof_${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`}function JS(e="New profile",t){return Qt.parse({id:Nh(),name:e,...t==="codex"?{agent:"codex"}:{}})}function Lh(e){return e==="codex"?"codexBindings":"bindings"}function Uh(e,t,r,o){let n=Lh(o),i={...e[n]};return r?i[t]=r:delete i[t],{...e,[n]:i}}function KS(e,t,r){if(Dh(e)==="malformed")throw new Error(Oh);let o=Array.isArray(e.rules)?e.rules.filter(i=>!Rh(i)):[],{rules:n}=qS({profiles:t.profiles,bindings:t.bindings,codexBindings:t.codexBindings,rules:o},void 0,{voice:r});return{...e,profiles:t.profiles,bindings:t.bindings,codexBindings:t.codexBindings,rules:n}}function hs(e){let t=er[e];return{defaultPct:t.default,min:t.min,max:t.max,unitLabel:t.unitLabel,step:t.step}}var XS=[{event:"started",label:"Started",hint:"A Claude session opens in this repo (SessionStart) \u2014 cold start or /clear, not a resume.",tooltip:"Fires the moment a Claude session starts in a repo bound to this profile \u2014 a cold start or after /clear. A resume fires Resumed instead, and an auto-compaction restart fires neither."},{event:"working",label:"Working",hint:"You send a prompt and Claude starts working (UserPromptSubmit) \u2014 also fires when it resumes after a question or plan approval.",tooltip:"Fires when you send Claude a prompt and it starts working \u2014 and again the moment it resumes after you answer a question or approve a plan."},{event:"needs_permission",label:"Needs permission",hint:"Claude paused to ask permission for a tool (permission notification) \u2014 waiting on your yes/no.",tooltip:"Claude paused mid-task to ask permission to run a tool and is waiting on your yes or no."},{event:"needsInput",label:"Needs input",hint:"Claude asked you a question (AskUserQuestion) and is waiting on your answer.",tooltip:"Claude asked you a question and is waiting on your answer (also fires when a background agent needs input)."},{event:"planReady",label:"Plan ready",hint:"Claude presented a plan for approval (ExitPlanMode) \u2014 nothing runs until you decide.",tooltip:"Claude finished planning and is waiting for you to review and approve the plan before it touches anything."},{event:"idle",label:"Idle",hint:"Claude has been left waiting on you for about a minute (idle notification) \u2014 the 'your turn' nudge.",tooltip:"Claude has been left waiting on you with nothing to do for about a minute \u2014 the 'your turn' nudge."},{event:"finished",label:"Finished",hint:"Claude ends a turn (Stop hook) \u2014 fires every time it stops replying. The common one.",tooltip:"Claude ends a turn \u2014 the instant it stops replying. Fires at the end of every response; the everyday 'done' signal."},{event:"contextLow",label:"Context low",hint:"Context use crossed your threshold below (default 75%) \u2014 read from the live session.",tooltip:"Claude's context window filled past your chosen percentage \u2014 set the slider below. Your early warning to wrap up, hand off, or /compact.",threshold:hs("contextLow")},{event:"contextCritical",label:"Context critical",hint:"Context nearly full \u2014 your second, higher threshold (default 90%). Auto-compact is imminent.",tooltip:"Context is nearly full \u2014 past your higher threshold. Auto-compact typically kicks in around 85\u201390%, so this is last-call.",threshold:hs("contextCritical")},{event:"rateLimited",label:"Rate limited",hint:"Claude hit a usage limit (rate-limit warning, or a turn died on one).",tooltip:"You hit \u2014 or are about to hit \u2014 your Claude plan's usage limit (the 5-hour or weekly window) and Claude may stop replying."},{event:"error",label:"Error",hint:"A turn or tool failed (StopFailure, a tool failure, or an MCP server error).",tooltip:"Something failed \u2014 an API error ended the turn, a tool call failed, or an MCP server dropped. Rate-limit failures fire Rate limited instead."},{event:"ended",label:"Ended",hint:"The session closed (SessionEnd) \u2014 Claude is no longer running in this repo.",tooltip:"The session closed \u2014 Claude is no longer running in this repo. Profile scenes revert."}],YS=[{event:"resumed",label:"Resumed",hint:"A previous session picks up where it left off (SessionStart on resume).",tooltip:"A previous session picks up where it left off (--resume / reopening a conversation)."},{event:"subagentStart",label:"Subagent started",hint:"Claude spawned a subagent for a subtask (SubagentStart).",tooltip:"Claude spawned a subagent to work on a subtask in the background."},{event:"subagentFinished",label:"Subagent finished",hint:"A spawned subagent finished (SubagentStop).",tooltip:"A spawned subagent finished its subtask and reported back."},{event:"compacting",label:"Compacting",hint:"Claude is about to compact its context (PreCompact) \u2014 manual /compact or automatic when nearly full.",tooltip:"Claude is about to compact its context to free room \u2014 manual /compact or automatic when nearly full."},{event:"compactDone",label:"Compaction done",hint:"Compaction finished (PostCompact) \u2014 context freed.",tooltip:"Compaction finished \u2014 context freed. The context meters (and Context low/critical) re-arm."},{event:"permissionDenied",label:"Permission denied",hint:"A tool call was auto-blocked by permission rules (PermissionDenied) \u2014 without asking you.",tooltip:"A tool call was auto-blocked by permission rules without asking you \u2014 worth a glance at what was refused."},{event:"taskCompleted",label:"Task completed",hint:"A background task or agent finished (TaskCompleted) while the session kept going.",tooltip:"A background task or agent finished while the main session kept going."},{event:"usageHigh",label:"Usage high",hint:"Plan usage crossed your threshold below (default 80%) \u2014 fed by the statusline feed (5-hour/7-day window).",tooltip:"Your Claude plan usage crossed your chosen percentage of the 5-hour or weekly window \u2014 pace yourself before the hard limit. Needs the AC Bridge statusline tee (installed by acbridge).",threshold:hs("usageHigh")},{event:"modePlan",label:"Plan mode",hint:"The session switched INTO plan mode (shift+tab) \u2014 read from the session transcript.",tooltip:"You switched the session into plan mode \u2014 Claude researches and proposes before touching anything. Fires on the switch itself; Plan ready fires later, when a finished plan awaits your approval. A session that OPENS in plan mode stays quiet until the mode actually moves."},{event:"modeAuto",label:"Auto-accept mode",hint:"The session switched into auto-accept \u2014 edits apply without per-action confirmation.",tooltip:"You switched into auto-accept mode \u2014 edits and tool calls apply without per-action confirmation. Fires once on the switch, not per edit."},{event:"modeBypass",label:"Bypass permissions",hint:"The session entered bypass-permissions mode \u2014 ALL permission checks are skipped.",tooltip:"The session entered bypass-permissions mode: every permission check is skipped until you leave it. The riskiest mode \u2014 a bright warning scene is a good fit."},{event:"modeNormal",label:"Normal mode",hint:"The session returned to default permission checks (from plan, auto-accept, or bypass).",tooltip:"The session returned to normal permission checks \u2014 the exit edge of the other mode states, handy for restoring your regular working scene."},{event:"modelChanged",label:"Model changed",hint:"The session's model switched mid-run (/model, fast mode) \u2014 the announcement names the new model.",tooltip:`The session's model changed mid-run \u2014 /model, a fast-mode toggle, or an opusplan hand-off. The spoken announcement names the new model ("Claude switched to Opus 4.8").`,modelMatch:!0},{event:"workflowStarted",label:"Workflow started",hint:"Claude kicked off a multi-agent workflow (Workflow tool) \u2014 expect a subagent burst.",tooltip:"Claude launched a multi-agent workflow. Expect a burst of Subagent started/finished signals until it completes \u2014 the completion itself lands as Task completed."},{event:"reviewChanged",label:"Review changed",hint:"Your PR's review state changed (approved / changes requested) \u2014 read from the statusline's pr.review_state field.",tooltip:"The statusline tee reports your pull request's review state, and this fires the moment it changes \u2014 approved, changes requested, or back to pending \u2014 so a CI-review scene can react the instant someone reviews your PR. Needs the AC Bridge statusline tee and an open PR with review data (installed by acbridge). Claude's own exclusive state \u2014 Codex has no equivalent."},{event:"costHigh",label:"Cost alarm",hint:"This session's estimated spend crossed your dollar threshold (default $5) \u2014 from the statusline cost feed.",tooltip:"Fires once when Claude's estimated session cost passes the dollar amount you set below. Needs the AC Bridge statusline tee (installed by acbridge); Codex sessions have no dollar cost, so this is Claude-only.",threshold:hs("costHigh")},{event:"longRunning",label:"Long run",hint:"The session has been working non-stop past your minutes threshold (default 10) \u2014 a hub timer.",tooltip:"Fires when a session stays in 'working' longer than the minutes you set below without pausing for you \u2014 a 'did it get stuck / long task still going' watchdog. Re-arms on the next turn. Works for Claude and Codex.",threshold:hs("longRunning")}],QS={started:{hint:"Codex opens a fresh rollout in this repo \u2014 a true cold start, not reopening an earlier conversation.",tooltip:"A new Codex session spins up against a repo bound to this profile, beginning an empty rollout. Reopening a prior conversation routes to Resumed instead, so this card only marks genuine first starts."},resumed:{hint:"A previous Codex conversation picks up where it left off.",tooltip:"A previous Codex conversation resumes \u2014 Codex reloads its prior rollout and continues from where it stopped."},working:{hint:"A turn begins on Codex's UserPromptSubmit hook \u2014 your prompt is in and work has started.",tooltip:"Codex's UserPromptSubmit hook trips as each turn opens: the moment your prompt is submitted. This is the 'now busy' edge."},finished:{hint:"Codex's Stop hook lands at the end of every reply \u2014 turn done, not the session closing.",tooltip:"Codex fires its Stop hook when a turn wraps, once per reply. It marks end-of-turn rather than a closed session, so expect it after every answer \u2014 the routine 'ready for you' beat."},needs_permission:{hint:"Codex paused to ask approval for a command \u2014 waiting on your yes/no.",tooltip:"Codex paused mid-task to ask for your approval to run a command and is waiting on your decision. Sandbox and network escalation requests fire the separate 'Sandbox escalation' state instead \u2014 bind that too if you want one scene for every approval."},compacting:{hint:"Codex is about to compact its context to free room.",tooltip:"Codex is about to compact its context \u2014 manual or automatic once its context window is nearly full."},compactDone:{hint:"Codex's PostCompact hook lands once the squeeze is done \u2014 room reclaimed.",tooltip:"The compaction Codex flagged with Compacting has just completed via its PostCompact hook, so the freed headroom resets what the context thresholds watch. A natural cue to swap back from any 'compacting' scene."},subagentStart:{hint:"Codex delegated a subtask \u2014 its SubagentStart hook signals a child agent spinning up.",tooltip:"Codex handed part of the work to a child agent; the SubagentStart lifecycle hook fires as that delegate begins. Pair it with Subagent finished to bracket the detour."},subagentFinished:{hint:"A delegated child agent wrapped up \u2014 Codex's SubagentStop hook fires as it returns.",tooltip:"The child agent Codex delegated to has completed and folded its result back into the main run; the SubagentStop lifecycle hook marks the hand-back."},contextLow:{hint:"Context use crossed your threshold below (default 75%) \u2014 tallied from Codex's rollout token counts.",tooltip:"Codex's context window filled past your chosen percentage, tallied from its rollout file's token counts \u2014 your early warning to wrap up or compact."},contextCritical:{hint:"Codex's context is nearly full \u2014 your second, higher threshold (default 90%).",tooltip:"Codex's context is nearly full, past your higher threshold, tallied from its rollout token counts \u2014 last call before it has to compact."},modePlan:{hint:"Codex's permission_mode flipped to plan \u2014 it will propose a course before acting.",tooltip:"The permission_mode field in Codex's hook payloads changed to plan, usually from a /approvals switch in the TUI. In this mode Codex maps out its approach for you rather than editing straightaway; the card marks the switch, not any later approval."},modeAuto:{hint:"Codex's permission_mode moved to acceptEdits \u2014 file edits auto-approve from here.",tooltip:"Codex reported an acceptEdits (dontAsk) permission_mode in its hook payload, so it stops prompting before each edit and applies them on its own. One signal on the mode change, never one per edit."},modeBypass:{hint:"permission_mode hit bypassPermissions \u2014 Codex now runs commands with no approval gate at all.",tooltip:"Codex's hook payload shows a bypassPermissions permission_mode: it executes edits and commands with every approval prompt turned off until the mode changes back. This is the most dangerous state to sit in, so a loud, unmistakable scene earns its place here."},modeNormal:{hint:"permission_mode fell back to default \u2014 Codex is asking before each action again.",tooltip:"Codex's permission_mode returned to default, so it resumes prompting for approval on every edit and command. Treat this as leaving plan, auto-accept, or full-access \u2014 the cue to restore your everyday working scene."},modelChanged:{hint:"The model slug in Codex's hook payload changed \u2014 the model was swapped mid-session.",tooltip:"Codex emitted a different model slug between hook payloads, usually after a /model pick in its TUI. The state carries whichever model is now in charge, so the read-back can name it."},error:{hint:"A Codex turn fails or the app-server crashes mid-turn (voice sessions) \u2014 or any codex session's tool result comes back error-shaped.",tooltip:"In a voice session, Codex's turn/completed event reports a failure it can't classify as a usage limit or a full context window, or the app-server itself dies while a turn is in flight. In any codex session running the plugin's hooks, a tool result flagged as an error (is_error, isError, or a non-empty error field) raises it too \u2014 the one card codex can fire outside a voice session."},idle:{hint:"Voice sessions only: your turn was interrupted and Codex is left waiting on you.",tooltip:"Voice-session only \u2014 Codex's turn/completed event reports status interrupted (you cut it off, or it landed mid-turn) and Codex now sits idle waiting for your next prompt. Codex has no separate idle-after-a-minute hook, so this fires on the interruption itself, not a timer."},ended:{hint:"Voice sessions only: the adapter session closes \u2014 the same signal a codex profile relies on to revert its devices.",tooltip:"Voice-session only \u2014 when the Codex adapter tears down, this fires as its last act, before any still-pending approvals are auto-declined and the process exits. It's the state a codex profile needs to revert its devices, since Codex has no SessionEnd hook of its own outside the adapter."},permissionDenied:{hint:"Voice sessions only: you decline a Codex approval request \u2014 by voice or the local keyboard shortcut.",tooltip:"Voice-session only \u2014 fires when a pending Codex approval (a command or file-change request) is declined, whether you say no over Alexa or press the deny key locally. An approved request instead just returns Codex to working."},planReady:{hint:"Voice sessions only: Codex shares its plan for the turn \u2014 the first plan update, not every step after.",tooltip:"Voice-session only \u2014 the first plan/updated notification after a turn starts fires this once; later step-status updates within the same turn stay silent so it isn't a play-by-play. The latch resets on the next turn, so a fresh turn's first plan fires again."},rateLimited:{hint:"Voice sessions only: a Codex turn fails because you've hit your usage limit.",tooltip:"Voice-session only \u2014 Codex's turn/completed event reports a failure it specifically recognizes as a usage-limit hit, distinct from the generic Error card for anything it can't classify that precisely."},sandboxEscalation:{hint:"Voice sessions only, codex-exclusive: Codex asks to leave its sandbox for network or full access \u2014 its loudest approval request.",tooltip:"Voice-session only, and a state only Codex can raise \u2014 when its app-server sends an item/permissions/requestApproval (rather than a routine command or file-change approval), it's asking to escalate out of its sandbox for network or unrestricted access. This is codex's own exclusive approval type, so give it the loudest scene you've got."},longRunning:{hint:"Codex has been mid-turn past your minutes threshold (default 10) \u2014 a hub timer watching its turns.",tooltip:"Fires when Codex stays mid-turn longer than the minutes you set below without pausing for your input \u2014 a 'still going, might be stuck' watchdog fed by the hub's own timer, not a Codex hook. The latch resets the moment a new turn begins."}},uU=[{event:"sandboxEscalation",label:"Sandbox escalation",...QS.sandboxEscalation}],dU=new Set(["idle","ended","permissionDenied","planReady","rateLimited","sandboxEscalation"]);function Nl(e,t=!1){if(e!=="codex")return{curated:XS,advanced:YS};let r=n=>Dl(e,n)&&(t||!dU.has(n)),o=n=>n.filter(i=>r(i.event)).map(i=>{let s=QS[i.event];return s?{...i,hint:s.hint,tooltip:s.tooltip}:i});return{curated:o(XS),advanced:[...o(YS),...uU.filter(n=>r(n.event))]}}import{resolve as IU}from"node:path";var pU=new Set(["--device","--color","--brightness","--scale","--kelvin","--power","--return","--effect-json","--action","--param","--instance","--threshold","--models","--direction","--announce","--clear-device"]),mU=new Set(["--hold","--allow-security","--clear","--enable","--disable","--json"]);function vs(e){let t={devices:[],hold:!1,allowSecurity:!1,params:[],clear:!1,clearDevices:[],json:!1},r=o=>({...t,bad:o});for(let o=0;o<e.length;o+=1){let n=e[o];if(mU.has(n)){if(n==="--hold")t.hold=!0;else if(n==="--allow-security")t.allowSecurity=!0;else if(n==="--clear")t.clear=!0;else if(n==="--json")t.json=!0;else if(n==="--enable"||n==="--disable"){let s=n==="--enable";if(t.enable!==void 0&&t.enable!==s)return r("--enable and --disable are opposites \u2014 pick one");t.enable=s}continue}if(!pU.has(n))return r(`unknown flag: ${n}`);let i=e[o+1];if(i===void 0||i.startsWith("--")&&!/^-?\d/.test(i.slice(2)))return r(`${n} needs a value`);switch(o+=1,n){case"--device":t.devices.push(i);break;case"--clear-device":t.clearDevices.push(i);break;case"--param":t.params.push(i);break;case"--instance":t.instance=i;break;case"--action":t.action=i;break;case"--effect-json":t.effectJson=i;break;case"--color":{if(i==="main"||i==="session"||i==="none")t.color=i;else{let s=i.split(",").map(a=>Number(a.trim()));if(s.length!==2||!s.every(Number.isFinite)||s[0]<0||s[0]>360||s[1]<0||s[1]>100)return r(`--color takes main | session | none | <hue 0-360>,<sat 0-100>, got: ${i}`);t.color={hue:s[0],saturation:s[1]}}break}case"--brightness":{if(i==="none")t.brightness="none";else{let s=Number(i);if(!Number.isFinite(s)||s<0||s>100)return r(`--brightness takes 0-100 or none, got: ${i}`);t.brightness=s}break}case"--scale":{let s=Number(i);if(!Number.isFinite(s)||s<0||s>2)return r(`--scale takes 0-2 (relative to main), got: ${i}`);t.scale=s;break}case"--kelvin":{if(i==="none")t.kelvin="none";else{let s=Number(i);if(!Number.isFinite(s))return r(`--kelvin takes a colour temperature or none, got: ${i}`);t.kelvin=s}break}case"--power":{if(i!=="on"&&i!=="off"&&i!=="auto")return r(`--power takes on | off | auto, got: ${i}`);t.power=i;break}case"--return":{if(i!=="main"&&i!=="session"&&i!=="hold"&&i!=="off")return r(`--return takes main | session | hold | off, got: ${i}`);t.ret=i;break}case"--threshold":{let s=Number(i);if(!Number.isFinite(s))return r(`--threshold takes a number, got: ${i}`);t.threshold=s;break}case"--models":t.models=i.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);break;case"--direction":{if(i!=="becomes"&&i!=="leaves")return r(`--direction takes becomes | leaves, got: ${i}`);t.direction=i;break}case"--announce":{if(i!=="on"&&i!=="off")return r(`--announce takes on | off, got: ${i}`);t.announce=i;break}}}return t.brightness!==void 0&&t.scale!==void 0?r("--brightness (absolute) and --scale (relative to main) are exclusive \u2014 pick one"):t}var fU=e=>e.capabilities.some(t=>t.type==="color");function gU(){return{enabled:!0,actions:[],looks:[],allowSecurity:!1}}function hU(e){return e.color!==void 0||e.brightness!==void 0||e.scale!==void 0||e.kelvin!==void 0||e.power!==void 0||e.ret!==void 0||e.hold||e.effectJson!==void 0}function vU(e,t,r){let o={...e?.look??{}};r.color==="none"?delete o.color:r.color==="main"||r.color==="session"?o.color={kind:"token",token:r.color}:r.color!==void 0&&(o.color={kind:"literal",hue:r.color.hue,saturation:r.color.saturation}),r.brightness==="none"?delete o.brightnessPct:r.brightness!==void 0&&(o.brightnessPct=r.brightness,delete o.brightnessScale),r.scale!==void 0&&(o.brightnessScale=r.scale,delete o.brightnessPct),r.kelvin==="none"?delete o.kelvin:r.kelvin!==void 0&&(o.kelvin=r.kelvin),r.power==="auto"?delete o.power:r.power!==void 0&&(o.power=r.power==="on");let n=e?.effect;if(r.effectJson!==void 0){let l;try{l=JSON.parse(r.effectJson)}catch{return{error:"--effect-json isn't valid JSON"}}let u=wr.safeParse(l);if(!u.success)return{error:`--effect-json isn't a valid effect: ${u.error.issues[0]?.message??"invalid"}`};n=u.data}let i=r.ret??e?.returnTo,s=r.ret==="hold"||r.hold?!0:r.ret!==void 0?!1:e?.hold??!1,a=Object.keys(o).length>0;return!a&&!n?null:{deviceId:t,...r.instance!==void 0?{instance:r.instance}:e?.instance!==void 0?{instance:e.instance}:{},...a?{look:o}:{},...n?{effect:n}:{},...i!==void 0?{returnTo:i}:{},hold:s}}function ys(e,t,r,o,n){let i=[],s={...e.states},a=e.notifications,l=[...e.deviceScope];if(r.clear)delete s[t];else{let d=s[t]?{...s[t],actions:[...s[t].actions],looks:[...s[t].looks]}:gU();for(let g of n)d.looks=d.looks.filter(h=>h.deviceId!==g.id),d.actions=d.actions.filter(h=>h.deviceId!==g.id);let p=hU(r),m=r.action!==void 0;if((p||m)&&o.length===0)return{ok:!1,message:"that edit targets devices \u2014 name at least one with --device <id|name>"};for(let g of o)l.includes(g.id)||(l=[...l,g.id],i.push(`added ${g.name} to the profile's device scope`));if(p){let g=r.color!==void 0&&r.color!=="none";for(let h of o){if(g&&!fU(h))return{ok:!1,message:`${h.name} has no color capability \u2014 drop --color for it (brightness/power/kelvin still work)`};let y=d.looks.findIndex(_=>_.deviceId===h.id&&_.instance===r.instance),k=vU(y>=0?d.looks[y]:void 0,h.id,r);if(k&&typeof k=="object"&&"error"in k)return{ok:!1,message:k.error};k===null?y>=0&&(d.looks=d.looks.filter((_,I)=>I!==y)):y>=0?d.looks=d.looks.map((_,I)=>I===y?k:_):d.looks=[...d.looks,k]}}if(r.action!==void 0){let g=Xg(r.params);if(!g.ok)return{ok:!1,message:g.message};for(let h of o){let y=vl(h,r.action,g.params);if(!y.ok)return{ok:!1,message:y.message};let k={deviceId:h.id,capability:y.capability,...r.instance!==void 0?{instance:r.instance}:{},command:y.command,params:y.params};d.actions=[...d.actions.filter(_=>!(_.deviceId===h.id&&_.capability===k.capability&&_.instance===k.instance)),k]}}if(r.threshold!==void 0){let g=er[t];if(!g)return{ok:!1,message:`"${t}" has no threshold \u2014 the threshold states are: ${Object.keys(er).join(", ")}`};if(r.threshold<g.min||r.threshold>g.max)return{ok:!1,message:`--threshold for ${t} takes ${g.min}-${g.max} (${g.unitLabel})`};d={...d,threshold:r.threshold}}if(r.models!==void 0||r.direction!==void 0){if(t!=="modelChanged")return{ok:!1,message:"--models/--direction filter the modelChanged state only"};if(!r.models||r.models.length===0)return{ok:!1,message:"--models needs at least one model family"};d={...d,modelMatch:{models:r.models,direction:r.direction??"becomes"}}}r.allowSecurity&&(d={...d,allowSecurity:!0}),r.enable!==void 0&&(d={...d,enabled:r.enable}),(p||m||n.length>0||r.threshold!==void 0||r.models!==void 0||r.allowSecurity||r.enable!==void 0||r.announce!==void 0||s[t])&&(s[t]=d)}r.announce!==void 0&&(a={...a,announce:{...a.announce,[t]:r.announce==="on"}});let u=Qt.safeParse({...e,states:s,notifications:a,deviceScope:l});return u.success?{ok:!0,result:{profile:u.data,notes:i}}:{ok:!1,message:`that edit doesn't parse as a valid profile: ${u.error.issues[0]?.message??"invalid"}`}}function e_(e,t){let r=e.find(s=>s.id===t);if(r)return{ok:!0,profile:r};let o=t.toLowerCase(),n=e.filter(s=>s.name.toLowerCase()===o);if(n.length===1)return{ok:!0,profile:n[0]};let i=n.length>1?n:e.filter(s=>s.name.toLowerCase().includes(o));return i.length===1?{ok:!0,profile:i[0]}:i.length>1?{ok:!1,kind:"ambiguous",candidates:i.map(s=>({id:s.id,name:s.name}))}:{ok:!1,kind:"not-found",candidates:[]}}var yU=e=>({enabled:!0,actions:[],looks:e,allowSecurity:!1}),qo=(e,t)=>({deviceId:e,look:t,hold:!1}),bU=[{event:"working",color:e=>e.hasColor?qo(e.id,{color:{kind:"token",token:"session"}}):null},{event:"needs_permission",color:e=>qo(e.id,e.hasColor?{color:{kind:"literal",hue:45,saturation:100},brightnessPct:100}:{brightnessPct:100})},{event:"planReady",color:e=>qo(e.id,e.hasColor?{color:{kind:"literal",hue:190,saturation:90},brightnessPct:100}:{brightnessPct:100})},{event:"error",color:e=>qo(e.id,e.hasColor?{color:{kind:"literal",hue:0,saturation:100},brightnessPct:100}:{brightnessPct:100})},{event:"finished",color:e=>e.hasColor?qo(e.id,{color:{kind:"literal",hue:120,saturation:80}}):null},{event:"idle",color:e=>qo(e.id,e.hasColor?{color:{kind:"token",token:"main"},brightnessScale:.3}:{brightnessScale:.3})}];function xU(e,t){return e!=="codex"?!0:Th.includes(t)}function t_(e,t){if(t.length===0)return{};let r={};for(let o of bU){if(!xU(e,o.event))continue;let n=t.map(i=>o.color(i)).filter(i=>i!==null);n.length>0&&(r[o.event]=yU(n))}return r}import{createInterface as n_}from"node:readline/promises";function kU(e){let t=n_({input:process.stdin,output:process.stdout});return t.question(e).finally(()=>t.close())}function wU(e){return new Promise(t=>{let r=n_({input:process.stdin,output:process.stdout,terminal:!0}),o=!1,n=r;n._writeToOutput=i=>{o?(i.includes(`
|
|
269
|
+
`):(process.stdout.write(e),r=!0)}}o.question(e,r=>{o.close(),n(r.trim())})})}async function XS(e){let t=await Z("/local/discovered");if(t.hubOffline)return k(Re()),1;if(t.status!==200||!t.body)return k(`hub answered HTTP ${t.status} reading /local/discovered`),1;let n=t.body.devices;if(e.startsWith("ldev_")){let o=n.find(r=>r.discoveredId===e);return o||(k(`unknown discoveredId ${e} \u2014 run \`acbridge scan\` and use an id from its results`),1)}if(JS(e)){let o=Et(e),r=n.find(i=>i.addresses.mac===o);return r||(k(`no discovered device with MAC ${o} \u2014 run \`acbridge scan\` first`),1)}if(Yh(e)){let o=n.filter(r=>r.addresses.ip===e);if(o.length===1)return o[0];if(o.length===0)return k(`no discovered device at ${e} \u2014 run \`acbridge scan\` first`),1;k(`${o.length} devices share ${e} \u2014 pick one by id:`);for(let r of o)v(` ${r.discoveredId} ${Qh(r)}`);return 1}return k(`not a MAC, IP, or ldev_\u2026 id: ${e}`),v(dr),2}var Qh=e=>{let t=[e.identity.manufacturer,e.identity.model].filter(Boolean).join(" ");return`${e.identity.name??(t||(e.identity.hint??"unknown device"))} (${e.addresses.ip}${e.addresses.mac?`, ${e.addresses.mac}`:""})`};async function VL(e,t){let n;if(e.startsWith("dev_"))n=e;else if(JS(e))n=VS(e);else if(e.startsWith("ldev_")||Yh(e)){let r=await XS(e);if(typeof r=="number")return r;if(!r.addresses.mac)return k(`${e} has no stable identity (no MAC) \u2014 it was never connected, so there is nothing to forget`),1;n=VS(r.addresses.mac)}else return k(`not a deviceId, MAC, IP, or ldev_\u2026 id: ${e}`),v(dr),2;let o=await Z("/local/forget",{method:"POST",body:{deviceId:n,purge:t}});return o.hubOffline?(k(Re()),1):o.status===200&&o.body?.ok?(A(`forgot ${n}${t?" (purged)":""} \u2014 it will not be auto-reconnected`),o.body.note&&v(o.body.note),0):(k(o.body?.error??`hub answered HTTP ${o.status}`),1)}async function qL(e){if(e!=="on"&&e!=="off")return k(`--auto takes on|off, got: ${e||"(none)"}`),v(dr),2;let t=await Z("/local/config");if(t.hubOffline)return k(Re()),1;if(t.status!==200||!t.body)return k(`hub answered HTTP ${t.status} reading /local/config`),1;let n={...t.body,autoConnect:e==="on"?"open-protocols":"off"},o=await Z("/local/config",{method:"POST",body:n});return o.hubOffline?(k(Re()),1):o.status!==200||!o.body?(k(`hub answered HTTP ${o.status} writing /local/config`),1):(o.body.autoConnect==="open-protocols"?(A("auto-connect ON (open protocols)"),v("New lights/plugs on open local protocols connect automatically. Never locks, covers, garage doors, valves, cameras, or doorbells.")):A("auto-connect OFF"),0)}import{writeFileSync as XL}from"node:fs";function Hl(){return Pb({marketplaceDir:Kn,claudeCmd:yn()})}function YS(){return Cb({claudeCmd:yn()})}function JL(e=ee){return Ia(mo(fo(e)))}function ii(e){return Ub(Kn,{settingsFile:e?.settingsFile,configFile:e?.configFile,env:e?.env,nodeCommand:e?.nodeCommand??JL(e?.bridgeDir)})}function Gl(e={}){let t=[],n=e.ensurePluginInstalled??Hl;try{let r=n();r.marketplaceRepointed?t.push({level:"info",message:"Re-pointed the alexa plugin marketplace to this install."}):r.pluginReinstalled&&t.push({level:"info",message:"Refreshed the alexa plugin from this install."})}catch(r){t.push({level:"warn",message:`plugin refresh skipped: ${r.message}`})}let o=e.ensureStatusline??ii;try{let r=o();r.changed&&t.push({level:"info",message:r.enabled?"Installed the AC Bridge statusline tee (chains any existing statusline).":"Removed the AC Bridge statusline tee (original restored)."})}catch(r){t.push({level:"warn",message:`statusline tee skipped: ${r.message}`})}return t}function QS(e){if(!e)return null;try{let t=JSON.parse(e);return typeof t.signal!="string"||typeof t.ts!="number"?null:{signal:t.signal,ts:t.ts}}catch{return null}}function e_(e){if(e.reason!==null&&e.now-e.reason.ts<(e.reasonFreshMs??6e4)&&e.reason.signal!=="account-switched")return{action:"exit-clean"};let n=e.windowMs??3e5;return e.respawnTimes.filter(r=>e.now-r<n).length>=(e.maxRespawns??3)?{action:"exit-fail",why:"the hub keeps dying \u2014 respawn cap reached (see ~/.claude-bridge/hub.log)"}:{action:"respawn"}}function t_(e,t,n){return t==="offline"?"handle-offline":t==="unknown"||e.holderId===null?"rehold":e.wantRevert&&n&&n.active===!1?"rearm":"none"}var KL=["relayUrl","hubPort","machine"];async function Wl(e,t,n=fetch){let o=await n(`${e.replace(/\/+$/,"")}/settings`,{headers:{authorization:`Bearer ${t}`}});if(!o.ok)throw new Error(`relay ${o.status}`);let r=await o.json().catch(()=>null);return{version:typeof r?.version=="number"?r.version:null,config:typeof r?.config=="object"&&r?.config!==null?r.config:{}}}async function Zl(e,t,n=fetch){if(!t)return null;let o;try{o=await Wl(e,t,n)}catch(r){return v(`Cloud settings sync skipped (${r instanceof Error?r.message:String(r)}).`),null}try{let r=typeof o.config.cli=="object"&&o.config.cli!==null?o.config.cli:null;if(!r)return o;let i={};for(let l of KL){let u=r[l];(l==="hubPort"?typeof u=="number"&&Number.isFinite(u):typeof u=="string"&&u)&&(i[l]=u)}if(Object.keys(i).length===0)return o;let s={};try{s=JSON.parse(L(Ee)??"{}"),(typeof s!="object"||s===null||Array.isArray(s))&&(s={})}catch{s={}}let a={...s,...i};if(JSON.stringify(a)===JSON.stringify(s))return o;_e(Ee,`${JSON.stringify(a,null,2)}
|
|
270
|
+
`),v(`Synced cloud settings into config.json (${Object.keys(i).join(", ")}).`)}catch(r){v(`Cloud settings sync skipped (${r instanceof Error?r.message:String(r)}).`)}return o}var YL=3e3;async function Vl(e=[],t={}){let n=t.preflightAccount??ti,o=t.ensureFreshToken??Vt,r=t.syncConfigFromSettings??Zl,i=t.refreshAgentStateWiring??Gl,s=t.ensureHub??it,a=t.hubBeat??oS,l=t.hubHold??As,u=t.hubRelease??Tl,d=t.hubRequest??Z,p=t.isHubHealthy??Ue,m=t.armBeacon??nS,f=t.writePid??(()=>XL(wt,String(process.pid))),g=t.removePid??(()=>Ie(wt)),h=t.readStopReason??(()=>L(Mi)),y=t.onSignal??((Se,Wt)=>{process.once(Se,Wt)}),x=t.exit??(Se=>process.exit(Se)),S=t.scheduleTick??((Se,Wt)=>{setInterval(Se,Wt)}),E=!e.includes("--no-revert"),{relayUrl:_}=le(),I=await n();if(!I.ok)return k(I.message),I.exitCode;if(!await o(_))return k("No valid credential. Run `acbridge login` first."),3;await r(_,L($e().accessFile)??"");for(let Se of i())(Se.level==="info"?v:j)(Se.message);let N=(await s({kind:"daemon"})).holderId;try{f()}catch{}let M=Date.now(),q=m(M),he,B=!1,D=async()=>{let Se=await d("/local/session/activate",{method:"POST",body:{revertOnStop:E},timeoutMs:8e3});B=!Se.hubOffline&&Se.status===200&&Se.body?.active===!0,he=Se.body?.active?Se.body.sessionId:void 0};await D();let xe=!1,ie=async(Se=0)=>{xe||(xe=!0,N&&await u(N).catch(()=>{}),g(),q(),x(Se))};y("SIGINT",()=>{ie()}),y("SIGTERM",()=>{ie()}),A(`Bridge running \u2014 hub connected, revert-on-stop ${E?"armed":"off"}. Ctrl-C to stop.`);let Xe=[],yt=async()=>{let Se=e_({reason:QS(h()),now:Date.now(),respawnTimes:Xe});if(Se.action==="exit-clean"){A("hub stopped \u2014 daemon exiting."),await ie();return}if(Se.action==="exit-fail"){k(Se.why),await ie(1);return}Xe.push(Date.now()),j("hub went down without a stop \u2014 respawning it\u2026");try{N=(await s({kind:"daemon"})).holderId,await D(),A("hub respawned")}catch(Wt){j(`respawn failed: ${Wt.message} \u2014 retrying on the next beat`),N=null}},te=!1,to=async()=>{if(!(te||xe)){te=!0;try{let Se=N?await a(N):await p()?"unknown":"offline",Wt=null;if(Se==="ok"&&E){let Ye=await d("/local/session/heartbeat",{method:"POST",body:{...he?{sessionId:he}:{}},timeoutMs:4e3});!Ye.hubOffline&&Ye.status===200&&Ye.body&&(Wt={active:Ye.body.active})}let no=t_({holderId:N,wantRevert:E,sessionArmed:B},Se,Wt);no==="handle-offline"?await yt():no==="rehold"?(N=await l("daemon"),E&&await D()):no==="rearm"&&await D()}finally{te=!1}}};return S(()=>{to()},YL),await new Promise(()=>{}),0}import{spawnSync as cu}from"node:child_process";import{existsSync as qj}from"node:fs";import p$ from"node:path";var ql=["Zigbee2MQTT","ESPresense","OpenMQTTGateway"];var ev={1:{expectedType:"other",expectedCapabilities:[]},2:{expectedType:"bridge",expectedCapabilities:[]},3:{expectedType:"fan",expectedCapabilities:["power","fan"]},4:{expectedType:"garageDoor",expectedCapabilities:["cover"]},5:{expectedType:"light",expectedCapabilities:["power","brightness"]},6:{expectedType:"lock",expectedCapabilities:["lock"]},7:{expectedType:"plug",expectedCapabilities:["power"]},8:{expectedType:"switch",expectedCapabilities:["power"]},9:{expectedType:"thermostat",expectedCapabilities:["thermostat"]},10:{expectedType:"sensor",expectedCapabilities:["sensor"]},11:{expectedType:"other",expectedCapabilities:[]},12:{expectedType:"cover",expectedCapabilities:["cover"]},13:{expectedType:"cover",expectedCapabilities:["cover"]},14:{expectedType:"cover",expectedCapabilities:["cover"]},15:{expectedType:"sceneController",expectedCapabilities:[]},16:{expectedType:"other",expectedCapabilities:[]},17:{expectedType:"camera",expectedCapabilities:["camera"]},18:{expectedType:"doorbell",expectedCapabilities:["doorbell"]},19:{expectedType:"airPurifier",expectedCapabilities:["power","fan"]},20:{expectedType:"other",expectedCapabilities:["power"]},21:{expectedType:"thermostat",expectedCapabilities:["thermostat"]},22:{expectedType:"humidifier",expectedCapabilities:["power"]},23:{expectedType:"other",expectedCapabilities:["power"]},24:{expectedType:"mediaPlayer",expectedCapabilities:["power"]},25:{expectedType:"speaker",expectedCapabilities:["volume"]},26:{expectedType:"speaker",expectedCapabilities:["volume"]},27:{expectedType:"bridge",expectedCapabilities:[]},28:{expectedType:"valve",expectedCapabilities:[]},29:{expectedType:"valve",expectedCapabilities:[]},30:{expectedType:"valve",expectedCapabilities:[]},31:{expectedType:"tv",expectedCapabilities:["power"]},32:{expectedType:"remote",expectedCapabilities:[]},33:{expectedType:"bridge",expectedCapabilities:[]},34:{expectedType:"speaker",expectedCapabilities:["volume"]},35:{expectedType:"mediaPlayer",expectedCapabilities:["power"]},36:{expectedType:"mediaPlayer",expectedCapabilities:["power"]}},tv=new Set([24,25]),nv="Philips Hue light \u2014 connect via its Hue Bridge (Integrations \u2192 Hue)",n_=[{prefix:"BSB",manufacturer:"Signify",product:"Hue Bridge",hueBridge:!0},{prefix:"LCT",manufacturer:"Signify",product:"Hue color bulb",hueBulb:!0},{prefix:"LTW",manufacturer:"Signify",product:"Hue ambiance bulb",hueBulb:!0},{prefix:"LWB",manufacturer:"Signify",product:"Hue white bulb",hueBulb:!0},{prefix:"LWA",manufacturer:"Signify",product:"Hue white bulb",hueBulb:!0},{prefix:"LCA",manufacturer:"Signify",product:"Hue color bulb",hueBulb:!0},{prefix:"LST",manufacturer:"Signify",product:"Hue lightstrip",hueBulb:!0},{prefix:"LLC",manufacturer:"Signify",product:"Hue accent light",hueBulb:!0},{prefix:"LIFX",manufacturer:"LIFX"},{prefix:"NL",manufacturer:"Nanoleaf"},{prefix:"TRADFRI",manufacturer:"IKEA",product:"Tr\xE5dfri"},{prefix:"Wemo",manufacturer:"Belkin",product:"Wemo"},{prefix:"Socket",manufacturer:"Belkin",product:"Wemo socket"},{prefix:"YL",manufacturer:"Yeelight"},{prefix:"ecobee",manufacturer:"Ecobee",product:"Ecobee thermostat"},{prefix:"EB",manufacturer:"Ecobee"},{prefix:"Eve ",manufacturer:"Eve Systems"},{prefix:"MSS",manufacturer:"Meross"},{prefix:"Rachio",manufacturer:"Rachio",product:"Rachio sprinkler"},{prefix:"Smart Bridge",manufacturer:"Lutron",product:"Cas\xE9ta Smart Bridge"},{prefix:"iSmartGate",manufacturer:"iSmartGate",product:"Garage controller"},{prefix:"Sensibo",manufacturer:"Sensibo"},{prefix:"tado",manufacturer:"tado\xB0"},{prefix:"AC02",manufacturer:"tado\xB0"}];function Jl(e){return n_.find(t=>e.startsWith(t.prefix))}function rv(e){return e!==void 0&&Jl(e)?.hueBulb===!0}var eU={kasa:{bucket:"connect-now",confidence:"high",localProtocol:"kasa",identityWeight:2},"kasa-klap":{bucket:"connect-now",confidence:"high",localProtocol:"kasa-klap",identityWeight:2},wiz:{bucket:"connect-now",confidence:"high",localProtocol:"wiz",identityWeight:2},lifx:{bucket:"connect-now",confidence:"high",localProtocol:"lifx",identityWeight:2},shelly:{bucket:"connect-now",confidence:"high",localProtocol:"shelly",identityWeight:2},"shelly-gen1":{bucket:"identified-only",confidence:"high",hint:"Gen1 Shelly \u2014 not controllable directly yet; control it via a linked Home Assistant",identityWeight:2},"hue-bridge":{bucket:"link-ecosystem",confidence:"high",suggestedProvider:"hue",expectedType:"bridge",identityWeight:2},"home-assistant":{bucket:"link-ecosystem",confidence:"high",suggestedProvider:"homeassistant",expectedType:"bridge",identityWeight:2},smartthings:{bucket:"link-ecosystem",confidence:"high",suggestedProvider:"smartthings",expectedType:"bridge",identityWeight:2},hap:{bucket:"identified-only",confidence:"medium",hint:"HomeKit device \u2014 commands shown are expected only",identityWeight:1},"hue-bulb":{bucket:"identified-only",confidence:"medium",expectedType:"light",hint:nv,identityWeight:1},matter:{bucket:"identified-only",confidence:"medium",hint:"Matter device \u2014 control via the ecosystem it's commissioned into",identityWeight:0},"matter-pairing":{bucket:"identified-only",confidence:"medium",hint:"Matter device in pairing mode \u2014 commissioning isn't supported yet",identityWeight:1},cast:{bucket:"identified-only",confidence:"high",expectedType:"mediaPlayer",expectedCapabilities:["volume","mediaTransport"],hint:"Google Cast device \u2014 no local control in v1",identityWeight:2},sonos:{bucket:"identified-only",confidence:"high",expectedType:"speaker",expectedCapabilities:["volume","mediaTransport"],hint:"Sonos speaker \u2014 control via Home Assistant",identityWeight:2},androidtv:{bucket:"identified-only",confidence:"high",expectedType:"tv",hint:"Android TV \u2014 control via its ecosystem",identityWeight:1},printer:{bucket:"identified-only",confidence:"medium",expectedType:"other",hint:"Network printer",identityWeight:1},miio:{bucket:"identified-only",confidence:"high",hint:"Xiaomi / miIO device \u2014 control via Home Assistant",identityWeight:2},lutron:{bucket:"identified-only",confidence:"high",expectedType:"bridge",hint:"Lutron Cas\xE9ta \u2014 control via Home Assistant",identityWeight:2},bond:{bucket:"identified-only",confidence:"high",expectedType:"bridge",hint:"Bond Bridge \u2014 control via Home Assistant",identityWeight:2},octoprint:{bucket:"identified-only",confidence:"high",expectedType:"other",hint:"OctoPrint 3D-print server",identityWeight:2},apple:{bucket:"identified-only",confidence:"high",hint:"Apple TV / HomePod / AirPlay device \u2014 control via HomeKit or Home Assistant",identityWeight:1},roku:{bucket:"connect-now",confidence:"high",localProtocol:"roku",expectedType:"tv",expectedCapabilities:["power","mediaTransport","volume"],identityWeight:2},wled:{bucket:"connect-now",confidence:"high",localProtocol:"wled",expectedType:"light",expectedCapabilities:["power","brightness","color"],identityWeight:2},esphome:{bucket:"connect-now",confidence:"high",localProtocol:"esphome",identityWeight:1},nanoleaf:{bucket:"connect-now",confidence:"high",localProtocol:"nanoleaf",expectedType:"light",expectedCapabilities:["power","brightness","color"],identityWeight:2},elgato:{bucket:"connect-now",confidence:"high",localProtocol:"elgato",expectedType:"light",expectedCapabilities:["power","brightness","colorTemperature"],identityWeight:2},yeelight:{bucket:"connect-now",confidence:"high",localProtocol:"yeelight",identityWeight:2},ewelink:{bucket:"identified-only",confidence:"high",hint:"SONOFF / eWeLink device \u2014 sign in with eWeLink (acbridge link ewelink) to control it on your network",identityWeight:2},"ewelink-diy":{bucket:"connect-now",confidence:"high",localProtocol:"ewelink",expectedCapabilities:["power"],identityWeight:2},govee:{bucket:"connect-now",confidence:"high",localProtocol:"govee",identityWeight:2},tuya:{bucket:"identified-only",confidence:"low",hint:"Smart Life / Tuya device \u2014 run the Tuya key wizard (acbridge link tuya) to enable local control",identityWeight:0},"tplink-smart":{bucket:"connect-now",confidence:"high",localProtocol:"tapo",identityWeight:2},"kasa-noncontrol":{bucket:"identified-only",confidence:"high",hint:"Kasa device \u2014 no local adapter for this model in v1",identityWeight:2},gateway:{bucket:"identified-only",confidence:"medium",expectedType:"bridge",hint:"Your network's router \u2014 not a controllable smart device",identityWeight:1},"mqtt-broker":{bucket:"link-ecosystem",confidence:"high",suggestedProvider:"mqtt",expectedType:"bridge",hint:`MQTT broker \u2014 link it to bring in everything publishing Home Assistant discovery (${ql.join(", ")})`,identityWeight:2},"thread-border-router":{bucket:"identified-only",confidence:"high",expectedType:"bridge",hint:"Thread border router \u2014 the Thread devices behind it are reached through their own ecosystem",identityWeight:1},wemo:{bucket:"identified-only",confidence:"high",expectedType:"plug",hint:"Belkin Wemo \u2014 control via Home Assistant",identityWeight:2},hubitat:{bucket:"identified-only",confidence:"high",expectedType:"bridge",hint:"Hubitat Elevation hub \u2014 control via Home Assistant",identityWeight:2},"zwave-js":{bucket:"identified-only",confidence:"high",expectedType:"bridge",hint:"Z-Wave JS server \u2014 the Z-Wave devices behind it are reached through Home Assistant for now",identityWeight:2},"zigbee-coordinator":{bucket:"identified-only",confidence:"high",expectedType:"bridge",hint:"Zigbee coordinator \u2014 if it runs Zigbee2MQTT, link its MQTT broker (Integrations \u2192 MQTT) to bring in every device behind it",identityWeight:2},"onvif-camera":{bucket:"identified-only",confidence:"high",expectedType:"camera",expectedCapabilities:["camera"],hint:"IP camera (ONVIF) \u2014 no local control in v1; view it in its own app or via Home Assistant",identityWeight:2},"wsd-host":{bucket:"identified-only",confidence:"medium",expectedType:"other",hint:"Computer or NAS on your network",identityWeight:1},"ssdp-generic":{bucket:"identified-only",confidence:"medium",identityWeight:0},"http-generic":{bucket:"identified-only",confidence:"medium",identityWeight:0},dhcp:{bucket:"identified-only",confidence:"low",identityWeight:0},oui:{bucket:"identified-only",confidence:"low",identityWeight:0},unidentified:{bucket:"identified-only",confidence:"low",identityWeight:0},"mdns-service":{bucket:"identified-only",confidence:"medium",identityWeight:0}};import{execFile as iU}from"node:child_process";import{createSocket as sU}from"node:dgram";import{readFile as aU}from"node:fs/promises";import{networkInterfaces as o_}from"node:os";import{promisify as cU}from"node:util";import{execFile as tU}from"node:child_process";import{existsSync as nU}from"node:fs";import{join as rU}from"node:path";import{promisify as oU}from"node:util";var _V=new TextEncoder;var TV=oU(tU);function ov(e={}){let t=e.env??process.env,n=e.exists??(o=>nU(o));for(let o of(t.PATH??"").split(":"))if(o!=="")try{if(n(rU(o,"powershell.exe")))return!0}catch{}return!1}var iv="239.255.90.90",sv=35090,i_=35091;function s_(e){return!e.internal&&(e.family==="IPv4"||e.family===4)}var st={createSocket:(e,t)=>sU({type:e,reuseAddr:t?.reuseAddr??!0}),interfaceAddresses:()=>Object.values(o_()).flatMap(e=>e??[]).filter(s_).map(e=>e.address)},lU=cU(iU);function a_(e){let t=e.trim().toLowerCase();return t==="nat"||t==="mirrored"?t:void 0}var uU=async()=>{let{stdout:e}=await lU("wslinfo",["--networking-mode"],{timeout:1500,maxBuffer:4096});return e};async function Kl(e={}){let t=e.timeoutMs??2e3,n=e.sockets??st,o=await dU(e.readProcVersion??(()=>aU("/proc/version","utf8")),e.env??process.env),[r,i,s]=await Promise.all([pU(n,t).catch(()=>({ok:null})),mU(n,t).catch(()=>({ok:null})),o?(e.readWslNetworkingMode??uU)().then(a_).catch(()=>{}):Promise.resolve(void 0)]),a;try{a=(e.interfaces??fU)()}catch{a=void 0}let l={wsl:o,multicastOk:r.ok,broadcastOk:i.ok};(e.platform??process.platform)==="darwin"&&(r.code==="EHOSTUNREACH"||i.code==="EHOSTUNREACH")&&(l.localNetworkDenied=!0),a!==void 0&&(l.interfaces=a),s!==void 0&&(l.wslNetworkingMode=s);try{let u=e.windowsInterop??(()=>ov({env:e.env??process.env}));o&&u()&&(l.interop="windows-arp")}catch{}return l}async function dU(e,t){if(t.WSL_DISTRO_NAME||t.WSL_INTEROP)return!0;try{return/microsoft/i.test(await e())}catch{return!1}}function pU(e,t){return new Promise(n=>{let o=[],r=[],i=!1,s=a=>{if(!i){i=!0;for(let l of r)clearTimeout(l);for(let l of o)try{l.close()}catch{}n(a)}};try{let a=`acbridge-mc-${Math.random().toString(36).slice(2)}`,l=new TextEncoder().encode(a),u=e.createSocket("udp4",{reuseAddr:!0});o.push(u),u.on("error",()=>s({ok:null})),u.on("message",d=>{new TextDecoder().decode(d)===a&&s({ok:!0})}),u.bind(sv,()=>{try{u.addMembership(iv)}catch{s({ok:null});return}let d=e.createSocket("udp4",{reuseAddr:!0});o.push(d),d.on("error",()=>s({ok:null})),d.bind(0,()=>{let p=()=>{try{d.setMulticastLoopback(!0),d.send(l,sv,iv,m=>{m&&s({ok:null,...typeof m.code=="string"?{code:m.code}:{}})})}catch{s({ok:null})}};p(),r.push(setTimeout(p,Math.max(1,Math.floor(t/2))))}),r.push(setTimeout(()=>s({ok:!1}),t))})}catch{s({ok:null})}})}function mU(e,t){return new Promise(n=>{let o,r,i=!1,s=a=>{if(!i){i=!0,r&&clearTimeout(r);try{o?.close()}catch{}n(a)}};try{o=e.createSocket("udp4",{reuseAddr:!0});let a=o;a.on("error",()=>s({ok:null})),a.bind(0,()=>{try{a.setBroadcast(!0),a.send(new TextEncoder().encode("acbridge-env-probe"),i_,"255.255.255.255",l=>{if(!l)return s({ok:!0});let u=l.code;s({ok:u==="EACCES"||u==="ENETUNREACH"||u==="EHOSTUNREACH"?!1:null,...u?{code:u}:{}})})}catch{s({ok:null})}}),r=setTimeout(()=>s({ok:null}),t)}catch{s({ok:null})}})}function fU(){return Object.entries(o_()).filter(([,e])=>e?.some(s_)).map(([e])=>e)}var sj=gn(H_(),1);var Tv={10:{expectedType:"lock",expectedCapabilities:["lock"]},14:{expectedType:"bridge",expectedCapabilities:[]},21:{expectedType:"binarySensor",expectedCapabilities:["sensor"]},43:{expectedType:"fan",expectedCapabilities:["power","fan"]},44:{expectedType:"sensor",expectedCapabilities:["sensor"]},45:{expectedType:"airPurifier",expectedCapabilities:["power","fan"]},114:{expectedType:"thermostat",expectedCapabilities:["thermostat"]},116:{expectedType:"vacuum",expectedCapabilities:["power"]},118:{expectedType:"binarySensor",expectedCapabilities:["sensor"]},256:{expectedType:"light",expectedCapabilities:["power"]},257:{expectedType:"light",expectedCapabilities:["power","brightness"]},266:{expectedType:"plug",expectedCapabilities:["power"]},267:{expectedType:"plug",expectedCapabilities:["power","brightness"]},268:{expectedType:"light",expectedCapabilities:["power","brightness"]},269:{expectedType:"light",expectedCapabilities:["power","brightness"]},514:{expectedType:"cover",expectedCapabilities:["cover"]},769:{expectedType:"thermostat",expectedCapabilities:["thermostat"]},770:{expectedType:"sensor",expectedCapabilities:["sensor"]},775:{expectedType:"sensor",expectedCapabilities:["sensor"]}};function Rv(e){if(e===void 0)return{};let[t,n]=e.split("+"),o={};return t!==void 0&&t.trim()!==""&&(o.vendorId=t.trim()),n!==void 0&&n.trim()!==""&&(o.productId=n.trim()),o}function Ov(e){if(!(e!=="1"&&e!=="2"))return"Matter device in pairing mode \u2014 commissioning isn't supported yet"}function su(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!(!/^[0-9a-f]{16}$/.test(t)||t.slice(6,10)!=="fffe"))return Et(t.slice(0,6)+t.slice(10))}var Dv=(e,t)=>{let n=e.txt[t];if(n===void 0)return;let o=Number.parseInt(n,10);return Number.isFinite(o)?o:void 0},we=e=>e.name.trim()||void 0,G_=e=>{if(!e)return;let t=e.split(".")[0]??e;return/-([0-9a-f]{12})$/i.exec(t)?.[1]},W_=e=>{let t=e.txt.mac;return t&&/^[0-9a-f]{12}$/i.test(t.replace(/[:.-]/g,""))?t:void 0};function Z_(e){let t=e.txt.md,n=Dv(e,"ci"),o=Dv(e,"sf"),r=t?Jl(t):void 0,i=n!==void 0?ev[n]:void 0,s=[t!==void 0?`md=${t}`:void 0,n!==void 0?`ci=${n}`:void 0,o!==void 0?`sf=${o}${(o&1)===1?" unpaired":""}`:void 0].filter(l=>l!==void 0).join(" ");if(r?.hueBridge)return{kind:"hue-bridge",identity:{name:we(e),manufacturer:r.manufacturer,model:r.product},expectedType:"bridge",detail:s};let a={name:we(e)};return r?(a.manufacturer=r.manufacturer,a.model=r.product??t):t!==void 0&&(a.model=t),{kind:rv(t)?"hue-bulb":n!==void 0&&tv.has(n)?"apple":"hap",identity:a,expectedType:i?.expectedType,expectedCapabilities:i?.expectedCapabilities,detail:s||void 0}}var q_="Thread border router \u2014 not currently the active one for this Thread network (another device is carrying it)";function J_(e){if(e===void 0)return;let t=e.trim().replace(/^0x/i,"");if(t===""||!/^[0-9a-f]+$/i.test(t))return;let n=Number.parseInt(t,16);if(!Number.isFinite(n))return;let o=n>>>4&3;return o===2?!0:o===1?!1:void 0}var K_=[{type:"hap",protocol:"tcp",extract:Z_},{type:"hap",protocol:"udp",extract:Z_},{type:"hue",protocol:"tcp",extract:e=>({kind:"hue-bridge",mac:su(e.txt.bridgeid),identity:{name:we(e),manufacturer:"Signify",model:e.txt.modelid??"Hue Bridge"},expectedType:"bridge",detail:e.txt.bridgeid!==void 0?`bridgeid=${e.txt.bridgeid}`:void 0})},{type:"home-assistant",protocol:"tcp",extract:e=>{let t=ZS(e.txt.internal_url??e.txt.base_url,e.refererAddress);return{kind:"home-assistant",identity:{name:we(e),manufacturer:"Home Assistant",...t?{baseUrl:t}:{}},expectedType:"bridge",detail:e.txt.version!==void 0?`version=${e.txt.version}`:void 0}}},{type:"smartthings",protocol:"tcp",extract:e=>({kind:"smartthings",identity:{name:we(e),manufacturer:"Samsung SmartThings",model:"SmartThings hub"},expectedType:"bridge"})},{type:"shelly",protocol:"tcp",extract:e=>{let t=G_(e.name)??G_(e.fqdn),n=e.txt.gen,o=e.txt.app,r={kind:"shelly",identity:{name:we(e),manufacturer:"Shelly",model:o},detail:[n!==void 0?`gen=${n}`:void 0,o!==void 0?`app=${o}`:void 0].filter(i=>i!==void 0).join(" ")||void 0,followUp:"shelly-info"};return t!==void 0&&(r.mac=t),r}},{type:"esphomelib",protocol:"tcp",extract:e=>({kind:"esphome",mac:W_(e),identity:{name:we(e),manufacturer:"ESPHome"},detail:e.txt.version!==void 0?`version=${e.txt.version}`:void 0})},{type:"wled",protocol:"tcp",extract:e=>({kind:"wled",mac:W_(e),identity:{name:we(e),model:"WLED"}})},{type:"nanoleafapi",protocol:"tcp",extract:e=>({kind:"nanoleaf",identity:{name:we(e),manufacturer:"Nanoleaf",model:e.txt.md}})},{type:"ewelink",protocol:"tcp",extract:e=>{let t=e.txt.id,n=e.txt.encrypt,o=n!==void 0&&n!=="false"&&n!=="0"&&n!=="",r=e.txt.type;return{kind:o?"ewelink":"ewelink-diy",identity:{name:we(e),manufacturer:"SONOFF (ITEAD)",...!o&&t!==void 0?{vendorId:t}:{}},detail:[r!==void 0?`type=${r}`:void 0,o?"encrypt":"diy"].filter(i=>i!==void 0).join(" ")||void 0}}},{type:"elg",protocol:"tcp",extract:e=>({kind:"elgato",identity:{name:we(e),manufacturer:"Elgato",model:e.txt.md}})},{type:"googlecast",protocol:"tcp",extract:e=>({kind:"cast",identity:{name:e.txt.fn??we(e),manufacturer:"Google Cast",model:e.txt.md},detail:e.txt.md!==void 0?`md=${e.txt.md}`:void 0})},{type:"sonos",protocol:"tcp",extract:e=>({kind:"sonos",identity:{name:we(e),manufacturer:"Sonos"}})},{type:"androidtvremote2",protocol:"tcp",extract:e=>({kind:"androidtv",identity:{name:we(e)}})},{type:"ipp",protocol:"tcp",extract:e=>({kind:"printer",identity:{name:we(e),model:e.txt.ty}})},{type:"miio",protocol:"udp",extract:e=>({kind:"miio",identity:{name:we(e),manufacturer:"Xiaomi"}})},{type:"lutron",protocol:"tcp",extract:e=>({kind:"lutron",identity:{name:we(e),manufacturer:"Lutron",model:e.txt.systype??"Cas\xE9ta"}})},{type:"mqtt",protocol:"tcp",extract:e=>({kind:"mqtt-broker",identity:{name:we(e)}})},{type:"meshcop",protocol:"udp",extract:e=>{let t={name:we(e)};return e.txt.vn!==void 0&&(t.manufacturer=e.txt.vn),e.txt.mn!==void 0&&(t.model=e.txt.mn),J_(e.txt.sb)===!1&&(t.hint=q_),{kind:"thread-border-router",identity:t,detail:[e.txt.nn!==void 0?`nn=${e.txt.nn}`:void 0,e.txt.xp!==void 0?`xp=${e.txt.xp}`:void 0,e.txt.sb!==void 0?`sb=${e.txt.sb}`:void 0].filter(n=>n!==void 0).join(" ")||void 0}}},{type:"bond",protocol:"tcp",extract:e=>({kind:"bond",identity:{name:we(e),manufacturer:"Bond"}})},{type:"octoprint",protocol:"tcp",extract:e=>({kind:"octoprint",identity:{name:we(e),model:"OctoPrint"}})},{type:"airplay",protocol:"tcp",extract:e=>{let t=e.txt.deviceid,n={kind:"apple",identity:{name:we(e),manufacturer:"Apple",model:e.txt.model},detail:e.txt.model!==void 0?`model=${e.txt.model}`:void 0};return t!==void 0&&/^[0-9a-f]{2}(:[0-9a-f]{2}){5}$/i.test(t)&&(n.mac=t),n}},{type:"raop",protocol:"tcp",extract:e=>{let t=e.name.indexOf("@");return{kind:"apple",identity:{name:(t>=0?e.name.slice(t+1).trim():we(e))||we(e),manufacturer:"Apple"}}}},{type:"matter",protocol:"tcp",extract:e=>V_(e,"matter")},{type:"matterc",protocol:"udp",extract:e=>{let t=V_(e,"matter-pairing");return e.txt.dn!==void 0&&(t.identity={...t.identity,name:e.txt.dn}),t}},{type:"zwave-js-server",protocol:"tcp",extract:e=>({kind:"zwave-js",identity:{name:we(e),model:"Z-Wave JS Server"}})},...["zigbee-coordinator","slzb-06","uzg-01","xzg","zigstar_gw","zigate-zigbee-gateway"].map(e=>({type:e,protocol:"tcp",extract:t=>({kind:"zigbee-coordinator",identity:{name:we(t)}})}))];function V_(e,t){let n=Dv(e,"dt"),o=n!==void 0?Tv[n]:void 0,{productId:r}=Rv(e.txt.vp),i={};r!==void 0&&(i.model=r);let s=Ov(e.txt.cm);s!==void 0?i.hint=s:t==="matter"&&(i.hint="Matter device \u2014 commissioned into another ecosystem; control it there");let a={kind:t,identity:i,detail:[n!==void 0?`dt=${n}`:void 0,e.txt.vp!==void 0?`vp=${e.txt.vp}`:void 0,e.txt.cm!==void 0?`cm=${e.txt.cm}`:void 0].filter(l=>l!==void 0).join(" ")||void 0};return o!==void 0&&(a.expectedType=o.expectedType,a.expectedCapabilities=o.expectedCapabilities),a}var vq=new TextDecoder;import{createDecipheriv as xq,createHash as aj}from"node:crypto";var Sq=aj("md5").update("yGAdlopoPVldABfn").digest(),_q=new TextDecoder;var Pq=30*6e4;var lj=new Set(["00:33:7a","10:5a:17","10:d5:61","18:69:d8","18:de:50","1c:90:ff","20:f1:b2","2c:b4:71","30:48:7d","38:1f:8d","38:2c:e5","38:a5:c9","3c:0b:59","4c:a9:19","50:8a:06","50:8b:b9","68:57:2d","70:89:76","7c:f6:66","80:64:7c","84:e3:42","a0:92:08","a8:80:55","b8:06:0d","bc:35:1e","c0:f8:53","c4:82:e1","cc:8c:bf","d0:32:e7","d0:82:e8","d0:82:eb","d4:a6:51","d8:1f:12","d8:c8:0c","d8:d6:68","d8:fc:92","e4:ae:e4","f8:17:2d","fc:3c:d7","fc:67:1f"]),uj={"00:17:88":"Signify (Philips Hue)","c4:29:96":"Signify","fc:26:8c":"Signify","d0:73:d5":"LIFX","00:31:92":"TP-Link","00:5f:67":"TP-Link","10:27:f5":"TP-Link","14:eb:b6":"TP-Link","1c:3b:f3":"TP-Link","1c:61:b4":"TP-Link","30:de:4b":"TP-Link","34:60:f9":"TP-Link","3c:52:a1":"TP-Link","40:3f:8c":"TP-Link","48:22:54":"TP-Link","50:91:e3":"TP-Link","50:c7:bf":"TP-Link","54:af:97":"TP-Link","5c:62:8b":"TP-Link","5c:e9:31":"TP-Link","60:a4:b7":"TP-Link","68:ff:7b":"TP-Link","6c:5a:b0":"TP-Link","70:4f:57":"TP-Link","74:da:88":"TP-Link","78:8c:b5":"TP-Link","90:9a:4a":"TP-Link","98:da:c4":"TP-Link","9c:53:22":"TP-Link","a8:42:a1":"TP-Link","ac:15:a2":"TP-Link","b0:95:75":"TP-Link","b0:a7:b9":"TP-Link","b4:b0:24":"TP-Link","c0:06:c3":"TP-Link","c0:c9:e3":"TP-Link","cc:32:e5":"TP-Link","d8:0d:17":"TP-Link","d8:47:32":"TP-Link","e8:48:b8":"TP-Link","f0:a7:31":"TP-Link","24:0a:c4":"Espressif","24:6f:28":"Espressif","30:ae:a4":"Espressif","5c:cf:7f":"Espressif","ec:fa:bc":"Espressif","a4:cf:12":"Espressif","48:3f:da":"Espressif","70:87:9e":"Beken","80:6d:de":"Beken","c8:47:8c":"Beken",...Object.fromEntries([...lj].map(e=>[e,"Tuya"])),"a8:bb:50":"WiZ","d8:a0:11":"WiZ","44:4f:8e":"WiZ","6c:29:90":"WiZ","94:9f:3e":"Sonos","5c:aa:fd":"Sonos","00:0e:58":"Sonos","fc:65:de":"Amazon","74:c2:46":"Amazon","44:65:0d":"Amazon","0c:47:c9":"Amazon","b8:5f:98":"Amazon","f4:f5:d8":"Google","54:60:09":"Google","1c:f2:9a":"Google","d8:eb:46":"Google","18:b4:30":"Nest Labs","64:16:66":"Nest Labs","d0:52:a8":"SmartThings","24:fd:5b":"SmartThings","28:6d:97":"SAMJIN (SmartThings)","50:14:79":"iRobot","24:9e:7d":"Roborock","b0:4a:39":"Roborock","78:0f:77":"Broadlink","34:ea:34":"Broadlink","2c:aa:8e":"Wyze","44:61:32":"Ecobee","94:10:3e":"Belkin (Wemo)","5c:e7:53":"Govee","d4:13:68":"Govee","e0:2a:25":"Govee","80:8a:f7":"Nanoleaf","f8:24:41":"Yeelight","54:ef:44":"Aqara (Lumi)","18:c2:3c":"Aqara (Lumi)","b0:e9:fe":"SwitchBot","00:1c:2b":"Hive (Centrica)","ec:e5:12":"tado\xB0"};var Mq=new TextDecoder;var e$=Buffer.from("020000010000000000000000463cb5d3","hex"),Wq=new TextEncoder,Zq=new TextDecoder;var iJ=new TextDecoder;var r$="239.255.255.250",Nv=1982,o$=["M-SEARCH * HTTP/1.1",`HOST: ${r$}:${Nv}`,'MAN: "ssdp:discover"',"ST: wifi_bulb","",""].join(`\r
|
|
271
|
+
`);var uJ=new TextDecoder;var SJ=new TextDecoder;var i$="239.255.255.250",s$=1900,Dj=["M-SEARCH * HTTP/1.1",`HOST: ${i$}:${s$}`,'MAN: "ssdp:discover"',"MX: 3","ST: ssdp:all","",""].join(`\r
|
|
272
|
+
`),CJ=new TextDecoder;var UJ=new Uint8Array([0]);var MJ=new TextDecoder;import{spawnSync as Lv}from"node:child_process";var au=xb("cli");function a$(e){try{let t=Lv(e,{shell:!0,encoding:"utf8",timeout:5e3});return`${t.stdout??""}${t.stderr??""}`}catch{return""}}function c$(e=process.platform){return Sb({platform:e,programs:[process.execPath],ruleName:au,runCheck:a$,runElevated:t=>{e!=="win32"&&Lv("sudo",["sh","-c",t],{stdio:"inherit"})}})}function l$(e=process.platform){return _b({platform:e,programs:[process.execPath],ruleName:au,runCheck:a$,runElevated:t=>{e!=="win32"&&Lv("sudo",["sh","-c",t],{stdio:"inherit"})}})}function u$(e){let t=[],{home:n,credential:o}=e,r=n.source==="peer-wsl"||n.source==="peer-windows";if(n.source==="env")t.push({grade:"info",line:`hub state home: ${n.dir} (BRIDGE_SECRET_DIR override)`});else if(r){let s=n.source==="peer-wsl"?"on Windows":"inside WSL";t.push({grade:"ok",line:`hub state home: ${n.dir} \u2014 the hub runs ${s}, this environment reads its home across the boundary`})}else n.beacon?t.push({grade:"ok",line:`hub state home: ${n.dir} (hub live on port ${n.beacon.port})`}):t.push({grade:"info",line:`hub state home: ${n.dir} \u2014 no hub advertising itself here yet`});o==="rejected"?t.push({grade:"bad",line:"the hub REJECTED this machine's hub-token (401) \u2014 it is stale or belongs to another home. Profiles signals from every session here are being dropped. Restart the bridge (`acbridge stop` then `acbridge start`, or Stop \u2192 Start in the app) to re-mint it."}):o==="absent"&&n.beacon?t.push({grade:"warn",line:`a hub is running (port ${n.beacon.port}) but no readable hub-token was found in ${n.dir} \u2014 sessions here cannot authenticate to it`}):o==="ok"&&t.push({grade:"ok",line:"hub credential accepted (Profiles signals from this environment are authorized)"});let i=e.lastHookError;if(i&&e.nowMs-i.ts<=864e5&&o!=="ok"){let s=Math.max(0,Math.round((e.nowMs-i.ts)/6e4));t.push({grade:"warn",line:`a Profiles signal from this machine was refused ${s}m ago (HTTP ${i.status})${i.hint?` \u2014 ${i.hint}`:""}`})}return t}import{spawnSync as Vj}from"node:child_process";function ze(e={}){let t=e.env??process.env,n=e.clientVersion!==void 0?e.clientVersion:Zt(t),o=e.bundled??Es();return ca({isDevBuild:n===null&&!o,env:t})}function d$(){return db({voice:ze(),runElevated:e=>{e.method==="sudo"&&Vj(e.file,e.args,{stdio:"inherit"})}})}function Jj(e,t){let n=`codex: ${e??"not found"} \xB7 ${t?"logged in":"not logged in"}`;return{grade:e!==null&&t?"ok":"warn",line:n}}function Kj(e){return e.wslNetworkingMode==="nat"?{grade:"warn",text:`WSL networking mode: NAT \u2014 ${Oi("nat")}`}:e.wslNetworkingMode==="mirrored"?{grade:"info",text:`WSL networking mode: mirrored \u2014 ${Oi("mirrored")}`}:{grade:"info",text:"WSL networking mode: unknown (`wslinfo --networking-mode` unavailable on this WSL build) \u2014 the guidance below covers both modes"}}async function Xj(){let e=await Kl();if(e.wsl?j("WSL detected \u2014 LAN scan degraded (mDNS/broadcast limited)"):A("host is not WSL \u2014 LAN discovery unrestricted"),e.localNetworkDenied&&j("macOS Local Network access is denied for the app \u2014 every probe send fails, so an empty scan in the app means nothing. System Settings > Privacy & Security > Local Network, enable AC Bridge, then rescan. (`acbridge scan` from Terminal is exempt and works as the control.)"),e.multicastOk===!0?e.wsl?j("multicast self-test passed locally, but under WSL that only exercises the loopback stack \u2014 LAN mDNS delivery is still limited (rely on the Windows neighbor table below)"):A("multicast self-test passed (this computer's stack \u2014 it does not prove your NETWORK forwards multicast)"):e.multicastOk===!1?j("multicast self-test failed \u2014 mDNS discovery unavailable"):j("multicast self-test could not run (inconclusive)"),e.wsl){let n=Kj(e);(n.grade==="warn"?j:v)(n.text),e.interop==="windows-arp"?A("WSL interop scanning available (powershell.exe \u2014 Windows neighbor table)"):j("WSL interop unavailable (powershell.exe not on PATH) \u2014 ARP discovery sees only the WSL subnet")}process.platform==="darwin"&&v(HS);let t=await Z("/local/discovered");t.hubOffline?j("hub control API unreachable \u2014 scan/connect unavailable (start it: `acbridge start`)"):t.status===200?A(`hub control API reachable (127.0.0.1:${le().hubPort})`):j(`hub control API answered HTTP ${t.status} \u2014 token mismatch? restart the hub`);try{let n=s=>{let a=process.platform==="win32"?15e3:4e3,l=cu(s,{shell:!0,encoding:"utf8",timeout:a});return`${l.stdout??""}${l.stderr??""}`};if(_r(process.platform,{})==="wsl-host"){v(`firewall: ${Oi(e.wslNetworkingMode)}`);return}let o=ba(process.platform,n),r=_r(process.platform,o),i=`${o.ufwStatusOut??""}${o.firewallCmdStateOut??""}${o.alfGlobalStateOut??""}`;if(r==="none")/permission denied|must be root|need to be root/i.test(i)?v("firewall state undetectable without sudo"):A("firewall: no active firewall detected \u2014 scanning unrestricted");else{let s=Ri(r,{programs:[process.execPath],ruleName:au});if("state"in s?A("firewall: no active firewall detected \u2014 scanning unrestricted"):s.evalCheck(s.checkCommands.map(n))?A(`firewall: rule present (${r})`):j(`firewall rule missing \u2014 allow it with: ${s.manualCommand} (or use the app's Scan panel to cover the desktop app)`),r==="windows"){let a=vb(gb(n(mb)),Pi(n(ya(process.execPath)),process.execPath));a&&j(a)}}}catch{v("firewall state undetectable without sudo")}}function Yj(e){return e==="keyring"?{tone:"ok",text:"integration secrets: 0600 files, mirrored into the OS keyring (encrypted at rest, as this CLI resolves it)"}:{tone:"info",text:"integration secrets: 0600 FILES, not the OS keyring (as this CLI resolves it) \u2014 no session keyring here, which is normal on WSL/headless Linux. The app or hub can resolve differently if it runs in a different session."}}async function Qj(){let e=io({fresh:!0}),t=ee,n="unknown",o=e.beacon?.port??Dx(),r=L(Dy(e.dir));if(!r)n="absent";else try{n=(await fetch(`http://127.0.0.1:${o}/local/devices`,{headers:{"x-bridge-hub-token":r},signal:AbortSignal.timeout(3e3)})).status===401?"rejected":"ok"}catch{n="unknown"}let i=null;try{let s=L(p$.join(t,"launch-last.json"));if(s)try{let l=JSON.parse(s);l.error?v(`last launch: REFUSED (${l.terminalId}, ${l.cwd}) \u2014 ${l.error}`):v(`last launch: ${l.terminalId} \u2192 ${l.file} ${JSON.stringify(l.args??[])}`)}catch{}let a=L(p$.join(t,"hooks-last-error.json"));if(a){let l=JSON.parse(a);typeof l.ts=="number"&&typeof l.status=="number"&&(i={ts:l.ts,status:l.status,...typeof l.hint=="string"?{hint:l.hint}:{}})}}catch{}return{home:e,localDir:t,credential:n,lastHookError:i,nowMs:Date.now()}}async function m$(e={}){let t=0,n=D=>{t++,k(D)},o=null,r=()=>o??=yn(),i=(e.build??en)(),s=e.clientVersion?e.clientVersion():i.version,a=e.fetchManifest??Nl,l=yS(s,s===null?null:await a(),process.platform,i.channel??"app");l.grade==="ok"?A(l.line):l.grade==="warn"?j(l.line):l.grade==="bad"?n(l.line):v(l.line);let u=e.voice??ze({clientVersion:s}),d=(e.claudeVersion??(()=>e2(r())))(),p=ua(process.platform).manualCommand;if(d===null)n(`claude CLI not found on PATH \u2014 install it: ${p}`);else{let D=Kb(d);D.ok?A(`claude ${D.version}`):n(`claude ${D.version??"?"} \u2014 channels need \u2265 2.1.80 \u2014 reinstall: ${p}`)}let m=(e.codexVersion??t2)(),f=e.codexLoggedIn??ga,g=Jj(m,f());if(g.grade==="ok"?A(g.line):j(g.line),m!==null){let D=e.readCodexConfig??(()=>L(Ea())),xe=fd((e.readCodexHooks??(()=>L(po())))(),D());xe.known&&xe.untrusted.length>0&&j(`codex hooks awaiting /hooks approval inside Codex: ${xe.untrusted.join(", ")}`);let ie=yd(D());ie.blocked==="foreign"?j("~/.codex/config.toml defines [mcp_servers.acbridge] outside the AC Bridge block \u2014 remove it, then run `acbridge setup`"):ie.blocked==="malformed"?j("~/.codex/config.toml has a damaged AC Bridge block \u2014 fix or remove the markers, then run `acbridge setup`"):ie.installed?A("codex device tools registered (MCP)"):vd()&&j("codex device tools not registered \u2014 run `acbridge setup`")}let h=(e.nodeRuntime??(()=>mo(fo(ee))))();h.kind==="shim"?A(`node runtime: bundled shim (${h.command})`):h.kind==="system"?A(`node v${h.version}`):n("node not found \u2014 install Node \u2265 20 or the AC Bridge app"),(e.pluginInstalled??(()=>n2(r())))()?A(u?"alexa@bridge plugin installed":"alexa@bridge plugin installed (agent state \u2192 device profiles)"):n("alexa@bridge plugin not installed \u2014 run `acbridge setup`");let x=Sr(),S=(e.managedSettingsRaw??(()=>L(x)))(),E=Yb(S);u?E.allowed?A("channel allowlisted in managed settings"):E.present?n(`channel not allowlisted in ${x} \u2014 run \`acbridge setup\``):n(`managed settings missing at ${x} \u2014 run \`acbridge setup\``):A("managed settings not used (voice off \u2014 no channel allowlist needed)"),(e.hubBundlePresent??(()=>qj(Bi)))()?A("hub bundle present"):j("hub bundle not built \u2014 run `npm run build` (dev uses tsx)");let I=(e.signedIn??Jt)(),N=I.state==="ok"?I.token:"";I.state==="ok"?A("signed in (relay token present)"):I.state==="mismatch"?n(ut.pointerMismatch):j("not signed in \u2014 run `acbridge login`");let M=(e.onboardingVerified??r2)();if(M!==null?A(`account setup verified (${new Date(M).toISOString().slice(0,10)})`):v("account setup not yet verified here \u2014 start/run check the relay on first use"),N){let xe=await(e.fetchEntitlement??Xn)(N);xe?v(`plan ${xe.plan}`):v("entitlement: couldn't read from the relay (offline?)");let ie=(e.entitlementFileAgeH??o2)();ie==="absent"?v("entitlement file absent \u2014 not synced from the relay yet"):ie==="unreadable"?j("entitlement file unreadable"):ie<=24?A(`entitlement file fresh (${ie.toFixed(1)}h)`):j(`entitlement file stale (${ie.toFixed(1)}h) \u2014 the hub refreshes it every 6h`)}await(e.hubRunning??Ue)()?A("hub running"):v(u?"hub not running (starts automatically on `acbridge run`)":"hub not running (start it: `acbridge start`)");for(let D of u$(await(e.homeFacts??Qj)()))D.grade==="ok"?A(D.line):D.grade==="warn"?j(D.line):D.grade==="bad"?n(D.line):v(D.line);let he=(e.claudeEnvironments??ex)();for(let D of he)D.claudePresent&&(D.pluginInstalled?A(`Claude Code wired for Profiles \u2014 ${D.label}`):j(`Claude Code is installed in ${D.label} WITHOUT the bridge plugin \u2014 sessions there drive no devices. Fix: ${D.setupHint}`));await(e.discoveryPreflight??Xj)();let B=Yj((e.secretStore??(()=>nd(Ii())))());return B.tone==="ok"?A(B.text):v(B.text),v(""),t?k(`${t} problem(s) found`):A("all checks passed"),t?1:0}function e2(e){let t=e??yn(),n=cu(t.file,[...t.argsPrefix,"--version"],{encoding:"utf8"});return n.status===0?n.stdout??"":null}function t2(){let e=so(),t=cu(e.file,[...e.argsPrefix,"--version"],{encoding:"utf8",timeout:5e3});return t.status===0?(t.stdout||t.stderr||"").trim()||"unknown":null}function n2(e){let t=e??yn(),n=cu(t.file,[...t.argsPrefix,"plugin","list"],{encoding:"utf8"});return Xb(`${n.stdout??""}${n.stderr??""}`).ok}function r2(){let e=qe();return e?Ca({configFile:e.userConfigFile}).onboardedAt:null}function o2(){let e=qe(),t=e?L(e.entitlementFile):null;if(!t)return"absent";try{let n=JSON.parse(t);return(Date.now()-(n.fetchedAt??0))/36e5}catch{return"unreadable"}}function s2(e){let t=(e.url??"").trim().replace(/\/+$/,"");return wS(t)?e.signIn?{mode:"sign-in",baseUrl:t}:e.token||e.tokenFile||process.env.BRIDGE_HA_TOKEN?{mode:"token",baseUrl:t}:{error:"Choose how to sign in: --sign-in opens your browser (recommended \u2014 nothing to paste, never expires), or --token <long-lived-access-token> for a headless machine."}:{error:"Missing/invalid --url. Give your Home Assistant base URL, e.g. http://homeassistant.local:8123"}}async function f$(e){let t=_t();if(!t)return null;let n=s2(e);if("error"in n)return k(n.error),v(Cs),null;let{baseUrl:o}=n,r=e.units==="imperial"||e.units==="metric"?e.units:void 0,i;if(n.mode==="sign-in"){let l=Ta(),u=Na(8987,l,void 0,12e4,Ad),d=kx({baseUrl:o,clientId:Ed,redirectUri:xx,state:l});X("Opening your browser to sign in to Home Assistant\u2026"),await qn(d,{isWsl:Zn()}).catch(()=>!1)||(v("Couldn't open a browser. Open this URL yourself, then come back:"),v(d));try{let{code:p}=await u.result;i=JSON.stringify(await wx({baseUrl:o,clientId:Ed,code:p}))}catch(p){return k(`Home Assistant sign-in failed: ${p.message}`),null}}else{let l=$t({flag:"--token",argv:e.token,file:e.tokenFile,env:process.env.BRIDGE_HA_TOKEN});if(!l.ok)return k(l.message),null;if(i=l.value,!i)return k("Missing --token (or BRIDGE_HA_TOKEN). Create a Long-Lived Access Token in HA \u2192 your profile \u2192 Security \u2014 or use --sign-in instead."),null}let s=ho("homeassistant",o);ct(t,"homeassistant",s).write(i);let a=tn(t,"homeassistant").filter(l=>l.accountId!==s);return In(t,"homeassistant",[...a,{accountId:s,baseUrl:o,...r?{unitSystem:r}:{}}]),A(`Linked Home Assistant (${o}). Credentials stored locally; account ${s}.`),{label:"Home Assistant"}}import*as g$ from"node:https";async function h$(e){let t=_t();if(!t)return null;let n=(e.host??"").trim();if(!n)return k("Missing --host. Give your Hue Bridge IP, e.g. --host 192.168.1.42"),v(Ps),null;let o=(e.bridgeId??"").trim().toLowerCase(),r=o||void 0,i;if(!o){let p=await a2(n);r=p.bridgeId,o=p.bridgeId??n.toLowerCase(),i=p.name}let s=$t({flag:"--key",argv:e.key,file:e.keyFile,env:process.env.BRIDGE_HUE_KEY});if(!s.ok)return k(s.message),null;let a=s.value||void 0,l;if(a)l=JSON.stringify({appkey:a.trim()}),v("Using the provided app key (skipping link-button pairing).");else{X("Press the link button on top of your Hue Bridge now \u2014 pairing completes within 30s\u2026"),r||j(`couldn't read this bridge's id from ${n}, so its certificate can't be verified \u2014 pass --bridge-id <id> to pin it.`);try{let p=await c2(n,r);l=JSON.stringify({appkey:p.appkey,...p.clientkey?{clientkey:p.clientkey}:{}})}catch(p){return k(`Hue pairing failed: ${p.message}`),null}}let u=ho("hue",o);ct(t,"hue",u).write(l);let d=tn(t,"hue").filter(p=>p.accountId!==u);return In(t,"hue",[...d,{accountId:u,host:n,bridgeId:o,...i?{name:i}:{}}]),A(`Linked Philips Hue (${n}, bridge ${o}). Keys stored locally; account ${u}.`),{label:"Philips Hue"}}function v$(e,t,n,o,r){return new Promise((i,s)=>{let a=o===void 0?void 0:JSON.stringify(o),l=g$.request({host:e,port:443,method:t,path:n,rejectUnauthorized:!1,headers:{"content-type":"application/json"}},u=>{if(r){let p=Ly(u.socket.getPeerCertificate?.());if(!Uy(p,r)){u.destroy(),l.destroy(),s(new Error(jy(p,r)));return}}let d="";u.setEncoding("utf8"),u.on("data",p=>d+=p),u.on("end",()=>{try{i(d?JSON.parse(d):{})}catch(p){s(p instanceof Error?p:new Error(String(p)))}})});l.on("error",s),a&&l.write(a),l.end()})}async function a2(e){try{let t=await v$(e,"GET","/api/0/config");return{bridgeId:t.bridgeid?.toLowerCase(),name:t.name}}catch{return{}}}async function c2(e,t){let n=Date.now()+3e4;for(;;){let o=await v$(e,"POST","/api",{devicetype:"acbridge#cli",generateclientkey:!0},t),r=Array.isArray(o)?o.find(s=>s.success)?.success:void 0;if(r)return{appkey:r.username,clientkey:r.clientkey};let i=Array.isArray(o)?o.find(s=>s.error)?.error:void 0;if(i&&i.type!==101)throw new Error(i.description??`Hue error ${i.type}`);if(Date.now()>n)throw new Error("timed out waiting for the link button (30s)");await new Promise(s=>setTimeout(s,1500))}}import{readFileSync as l2}from"node:fs";var u2=e=>`Watching \`${e||"homeassistant"}/#\` for Home Assistant Discovery configs \u2014 ${ql.join(", ")}, and anything else that publishes them.`;function y$(e){let t=_t();if(!t)return null;let n=(e.host??e.url??"").trim(),{host:o,port:r,tls:i}=WS(n);if(!o)return k("Missing --host. Give your broker's address, e.g. --host 192.168.1.5 (or mqtts://broker.lan:8883)."),v(Ns),null;let s=(e.username??"").trim(),a=$t({flag:"--password",argv:e.password,file:e.passwordFile,env:process.env.BRIDGE_MQTT_PASSWORD});if(!a.ok)return k(a.message),null;let l=a.value;if(l&&!s)return k("A password needs a --username too \u2014 MQTT forbids a password with no user, and brokers refuse the connection."),null;let u=(e.prefix??"").trim(),d;if(e.caFile){try{d=l2(e.caFile,"utf8")}catch{return k(`Could not read --ca-file ${e.caFile}. Give the path to your broker's CA certificate (PEM).`),null}if(!d.includes("BEGIN CERTIFICATE"))return k(`--ca-file ${e.caFile} is not a PEM certificate (no "BEGIN CERTIFICATE" block).`),null}let p=`${o}:${r??(i?8883:1883)}`,m=ho("mqtt",p);ct(t,"mqtt",m).write(l);let f=tn(t,"mqtt").filter(g=>g.accountId!==m);return In(t,"mqtt",[...f,{accountId:m,host:o,...r!==void 0?{port:r}:{},...i?{tls:i}:{},...d?{tlsCaCert:d}:{},...s?{username:s}:{},...u?{discoveryPrefix:u}:{}}]),A(`Linked MQTT broker ${p}${s?` as ${s}`:" (anonymous)"}. Account ${m}.`),v(u2(u)),{label:"MQTT"}}function b$(e,t,n){if(!n)return!1;let o=r=>r.provider===e&&r.status!=="revoked"&&r.status!=="needs_reauth";return n.some(r=>{if(!o(r))return!1;let i=t?.find(s=>s.provider===e&&(s.accountId===void 0||r.accountId===void 0||s.accountId===r.accountId));return i?i.status!==r.status||i.linkedAt!==r.linkedAt:!0})}async function x$(e,t,n){let o=n.intervalMs??3e3,r=n.sleep??(s=>new Promise(a=>setTimeout(a,s))),i=Date.now()+n.timeoutMs;for(;;){let s=await t();if(b$(e,n.before??null,s))return!0;if(Date.now()+o>i)return!1;await r(o)}}async function k$(e){let t=lr();if(!t.ok)return k(t.message),3;let n=e.includes("--no-browser"),o=e.includes("--no-wait"),r=e.indexOf("--timeout"),i=r!==-1?Number(e[r+1]):180;if(!Number.isFinite(i)||i<=0)return k("--timeout takes a positive number of seconds"),2;X("Starting SmartThings sign-in\u2026");let s=L($e().accessFile)?.trim(),a=s?await yo(s):null,l=await Hx("smartthings");if(!l.ok||!l.authorizeUrl)return k(l.error??"Couldn't start SmartThings linking."),v(Ts),1;let u=!1;return n||(u=await qn(l.authorizeUrl,{isWsl:Zn()}).catch(()=>!1)),u?A("Browser opened \u2014 sign in to Samsung and approve access."):(A("Open this URL in a browser, sign in to Samsung, and approve access:"),v(l.authorizeUrl)),o?(v("The account links at the relay; the hub picks it up automatically on its next connect (or restart the hub)."),0):(X(`Waiting for the link to complete (up to ${i}s)\u2026`),await x$("smartthings",async()=>{let p=L($e().accessFile)?.trim();return p?yo(p):null},{timeoutMs:i*1e3,before:a})?(A("SmartThings linked \u2014 devices appear after the bridge's next relay connect (or restart the bridge)."),0):(k(`SmartThings didn't finish linking within ${i}s \u2014 the URL stays valid, approve it and check \`acbridge integrations\`:`),v(l.authorizeUrl),1))}var lu=["eu","eu-w","us","us-e","cn","in"],d2=2e3,w$=18e4;function p2(e){return{mode:e.userCode===!0?"user-code":"keys"}}function m2(e,t,n=w$){if(e.hubOffline)return{kind:"hub-offline"};if(e.status===200&&e.body?.ok){if(e.body.pending)return t>=n?{kind:"expired"}:{kind:"pending"};let o=e.body.deviceCount??0;return o===0?{kind:"empty"}:{kind:"linked",deviceCount:o,sleepyCount:e.body.sleepyCount??0}}return{kind:"error",message:e.body?.error??`The hub couldn't finish the sign-in (HTTP ${e.status??"?"}).`}}async function f2(e){v("Tuya sign-in with the Smart Life app \u2014 no developer account, no Cloud Project:"),v(" 1. Open Smart Life (or Tuya Smart) on your phone."),v(" 2. Me \u2192 Settings \u2192 Account and Security \u2192 User Code \u2014 copy the code shown there."),v(" 3. Paste it below, then scan the QR we print with the same app.");let t=(process.env.BRIDGE_TUYA_USER_CODE??await zt("User Code: ")).trim(),n=((e.region??process.env.BRIDGE_TUYA_REGION??await zt("Region [eu]: "))||"eu").trim().toLowerCase();if(!t)return k("The User Code is required \u2014 Smart Life \u2192 Me \u2192 Settings \u2192 Account and Security \u2192 User Code."),v(ni),1;if(!lu.includes(n))return k(`Unknown region "${n}" \u2014 use ${lu.join(", ")}.`),1;X("Making sure the hub is running\u2026");try{await it({kind:"cli"})}catch(a){return k(`The hub isn't running and couldn't be started: ${a.message}. Start it with \`acbridge daemon\` and retry.`),1}X("Asking your bridge to start the sign-in\u2026");let o=await Z("/local/tuya/usercode/start",{method:"POST",body:{userCode:t,region:n},timeoutMs:3e4});if(o.hubOffline)return k("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(o.status!==200||!o.body?.ok||!o.body.token||!o.body.qrcodeUrl)return k(o.body?.error??`The hub couldn't start the sign-in (HTTP ${o.status??"?"}).`),v("The Access ID / Access Secret wizard does the same job: `acbridge link tuya`."),1;let{token:r,qrcodeUrl:i}=o.body;v("Scan this with the Smart Life app:"),v(i),X(`Waiting for the scan (up to ${Math.round(w$/1e3)}s)\u2026`);let s=Date.now();for(;;){await new Promise(u=>setTimeout(u,d2));let a=await Z("/local/tuya/usercode/finish",{method:"POST",body:{userCode:t,region:n,token:r},timeoutMs:9e4}),l=m2(a,Date.now()-s);if(l.kind!=="pending"){if(l.kind==="linked"){let u=l.deviceCount??0;return A(`Imported keys for ${u} Tuya device${u===1?"":"s"}. Keys are stored only on this PC (never on your network or the cloud).`),(l.sleepyCount??0)>0&&v(`${l.sleepyCount} battery/sensor device${l.sleepyCount===1?"":"s"} won't control locally yet \u2014 those come in a later update.`),v('Now run `acbridge scan` \u2014 your lamps should appear under "Ready to connect".'),0}return l.kind==="empty"?(k("Signed in, but found 0 devices \u2014 this usually means the Region doesn't match your Smart Life app. Re-run with a different --region."),1):l.kind==="expired"?(k("The login QR code expired before it was scanned \u2014 re-run to get a fresh one."),1):l.kind==="hub-offline"?(k("The hub went offline while waiting for the scan. Start it with `acbridge daemon` and retry."),1):(k(l.message??"The hub couldn't finish the sign-in."),1)}}}async function S$(e){let t=await Ur();if(!t.ok)return k(t.message),3;if(p2(e).mode==="user-code")return f2(e);v("Tuya key wizard \u2014 one-time setup to control Smart Life / Tuya devices locally:"),v(" 1. Create a free account + Cloud Project at iot.tuya.com (data-center region MUST match your Smart Life app \u2014 UK/EU \u2192 Central Europe)."),v(" 2. Subscribe IoT Core (+ Authorization) to the project, then 'Link Tuya App Account' by scanning the QR from the Smart Life app."),v(" 3. Copy the project's Access ID (client id) + Access Secret below."),v(" Note: the IoT Core trial runs ~1 month (console \u2192 Cloud \u2192 My Services \u2192 'Extend Trial Period'). After it expires your"),v(" already-connected lamps keep working locally \u2014 only fetching NEW keys stops. Re-pairing a device rotates its key \u2192 re-run this.");let n=(e.clientId??process.env.BRIDGE_TUYA_CLIENT_ID??await zt("Access ID (client id): ")).trim(),o=$t({flag:"--secret",argv:e.secret,file:e.secretFile,env:process.env.BRIDGE_TUYA_SECRET});if(!o.ok)return k(o.message),2;let r=(o.value||await jr("Access Secret: ")).trim(),i=((e.region??process.env.BRIDGE_TUYA_REGION??await zt("Region [eu]: "))||"eu").trim().toLowerCase();if(!n||!r)return k("Both the Access ID and Access Secret are required."),v(ni),1;if(!lu.includes(i))return k(`Unknown region "${i}" \u2014 use ${lu.join(", ")}.`),1;X("Making sure the hub is running\u2026");try{await it({kind:"cli"})}catch(a){return k(`The hub isn't running and couldn't be started: ${a.message}. Start it with \`acbridge daemon\` and retry.`),1}X("Fetching your device keys from Tuya (this can take a few seconds)\u2026");let s=await Z("/local/tuya/link",{method:"POST",body:{clientId:n,clientSecret:r,region:i},timeoutMs:9e4});if(s.hubOffline)return k("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(s.status===200&&s.body?.ok){let a=s.body.deviceCount??0,l=s.body.sleepyCount??0;return A(`Imported keys for ${a} Tuya device${a===1?"":"s"}. Keys are stored only on this PC (never on your network or the cloud).`),l>0&&v(`${l} battery/sensor device${l===1?"":"s"} (e.g. a PIR) won't control locally yet \u2014 those come in a later update.`),v('Now run `acbridge scan` \u2014 your lamps should appear under "Ready to connect". Connect each, then control them by voice or `acbridge devices`.'),0}return k(s.body?.error??`The hub couldn't complete the wizard (HTTP ${s.status??"?"}).`),1}async function _$(e){let t=await Ur();if(!t.ok)return k(t.message),3;v("Meross account wizard \u2014 a one-time sign-in so the hub can control your Meross devices locally:"),v(" Your Meross email + password are sent ONCE to Meross to fetch the account key that signs local"),v(" requests. The key is stored only on this PC \u2014 never on your network, the cloud, or our relay.");let n=$t({flag:"--password",argv:e.password,file:e.passwordFile,env:process.env.BRIDGE_MEROSS_PASSWORD});if(!n.ok)return k(n.message),2;let o=(e.email??process.env.BRIDGE_MEROSS_EMAIL??await zt("Meross email: ")).trim(),r=n.value||await jr("Password: "),i=((e.region??process.env.BRIDGE_MEROSS_REGION??await zt("Region [eu]: "))||"eu").trim().toLowerCase();if(!o||!r)return k("Both the email and password are required."),v(Rs),1;if(!["eu","us","ap"].includes(i))return k(`Unknown region "${i}" \u2014 use eu, us, or ap.`),1;let s=(e.mfa??process.env.BRIDGE_MEROSS_MFA)?.trim()||void 0;X("Making sure the hub is running\u2026");try{await it({kind:"cli"})}catch(l){return k(`The hub isn't running and couldn't be started: ${l.message}. Start it with \`acbridge daemon\` and retry.`),1}X("Signing in to Meross\u2026");let a=await Z("/local/meross/link",{method:"POST",body:{email:o,password:r,region:i,...s?{mfaCode:s}:{}},timeoutMs:6e4});if(a.hubOffline)return k("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(a.status===200&&a.body?.ok){let l=a.body.deviceCount??0;return A(`Signed in. The account key is stored only on this PC.${l?` (${l} device${l===1?"":"s"} on the account.)`:""}`),v('Now run `acbridge scan` \u2014 your Meross plugs/bulbs should appear under "Ready to connect". Connect each, then control them by voice or `acbridge devices`.'),0}return k(a.body?.error??`The hub couldn't complete the sign-in (HTTP ${a.status??"?"}).`),1}async function $$(e){let t=await Ur();if(!t.ok)return k(t.message),3;v("SONOFF / eWeLink account wizard \u2014 a one-time sign-in so the hub can control your SONOFF devices locally:"),v(" Your eWeLink email + password are sent ONCE to eWeLink to fetch each device's LAN key. The keys"),v(" are stored only on this PC \u2014 never on your network, the cloud, or our relay.");let n=$t({flag:"--password",argv:e.password,file:e.passwordFile,env:process.env.BRIDGE_EWELINK_PASSWORD});if(!n.ok)return k(n.message),2;let o=(e.email??process.env.BRIDGE_EWELINK_EMAIL??await zt("eWeLink email: ")).trim(),r=n.value||await jr("Password: "),i=((e.region??process.env.BRIDGE_EWELINK_REGION??await zt("Region [eu]: "))||"eu").trim().toLowerCase();if(!o||!r)return k("Both the email and password are required."),v(Os),1;if(!["eu","us","as","cn"].includes(i))return k(`Unknown region "${i}" \u2014 use eu, us, as, or cn.`),1;X("Making sure the hub is running\u2026");try{await it({kind:"cli"})}catch(a){return k(`The hub isn't running and couldn't be started: ${a.message}. Start it with \`acbridge daemon\` and retry.`),1}X("Signing in to eWeLink\u2026");let s=await Z("/local/ewelink/link",{method:"POST",body:{email:o,password:r,region:i},timeoutMs:6e4});if(s.hubOffline)return k("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(s.status===200&&s.body?.ok){let a=s.body.deviceCount??0;return A(`Signed in. ${a} device key${a===1?"":"s"} stored \u2014 only on this PC.`),v('Now run `acbridge scan` \u2014 your SONOFF switches/plugs should appear under "Ready to connect". Connect each, then control them by voice or `acbridge devices`.'),0}return k(s.body?.error??`The hub couldn't complete the sign-in (HTTP ${s.status??"?"}).`),1}async function E$(e){let t=await Ur();if(!t.ok)return k(t.message),3;v("Govee key wizard \u2014 one self-service API key imports your Govee devices:"),v(" Govee Home app \u2192 profile \u2192 Settings \u2192 Apply for API Key (it arrives by email within minutes).");let n=$t({flag:"--key",argv:e.key,file:e.keyFile,env:process.env.BRIDGE_GOVEE_KEY});if(!n.ok)return k(n.message),2;let o=(n.value||await jr("Govee API key: ")).trim();if(!o)return k("An API key is required."),v(Ds),2;X("Making sure the hub is running\u2026");try{await it({kind:"cli"})}catch(i){return k(`The hub isn't running and couldn't be started: ${i.message}. Start it with \`acbridge daemon\` and retry.`),1}X("Importing your Govee devices\u2026");let r=await Z("/local/govee/link",{method:"POST",body:{apiKey:o},timeoutMs:6e4});if(r.hubOffline)return k("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(r.status===200&&r.body?.ok){let i=r.body.deviceCount??0;return A(`Imported ${i} Govee device${i===1?"":"s"}. The key is stored only on this PC.`),v('Now run `acbridge scan` \u2014 your Govee lights should appear under "Ready to connect". Connect each, then control them by voice or `acbridge devices`.'),0}return k(r.body?.error??`The hub couldn't complete the wizard (HTTP ${r.status??"?"}).`),1}function A$(e){switch(e){case"home-assistant":case"homeassistant":return Cs;case"hue":return Ps;case"smartthings":return Ts;case"tuya":return ni;case"meross":return Rs;case"ewelink":return Os;case"govee":return Ds;case"mqtt":return Ns;default:return[Cs,Ps,Ts,ni,Rs,Os,Ds,Ns,SS].join(`
|
|
273
|
+
`)}}async function I$(e){let t=e[0],n=Wh(e.slice(1));if(n.bad)return k(n.bad),v(A$(t)),2;if(t==="smartthings")return k$(e.slice(1));if(t==="tuya")return S$(n);if(t==="meross")return _$(n);if(t==="ewelink")return $$(n);if(t==="govee")return E$(n);let o;if(t==="home-assistant"||t==="homeassistant")o=await f$(n);else if(t==="hue")o=await h$(n);else if(t==="mqtt")o=y$(n);else return k(`unsupported provider: ${t??"(none)"}. Supported: home-assistant, hue, smartthings, tuya, meross, ewelink, govee, mqtt`),v(A$(t)),2;if(!o)return 1;X("Bringing up the integration\u2026");try{let{spawned:r}=await it({kind:"cli"});r||await sS(),A(`Linked \u2014 your ${o.label} devices should now appear in \`acbridge devices\` and to Claude.`)}catch(r){v(`Recorded. Start the node when ready (\`acbridge daemon\`) to bring it up. (${r.message})`)}return 0}var Uv=["tuya","meross","ewelink","nanoleaf","govee","esphome"];async function C$(e){let t=e[0];if(t===void 0||!Ml.safeParse(t).success)return k(`usage: acbridge unlink <${Uv.join(" | ")}>`),2;let n=await Z(`/local/${t}/unlink`,{method:"POST"});return n.hubOffline?(k(Re()),1):n.status===200&&n.body?.ok?(A(`removed the ${t} account \u2014 its keys and devices are gone from this machine`),n.body.note&&v(n.body.note),0):(k(n.body?.error??`hub answered HTTP ${n.status}`),1)}var g2=["tuya","meross","ewelink","govee"],h2=["homeassistant","mqtt","hue"],v2=["smartthings"];function T$(e){for(let t of h2)if(e.startsWith(`${t}_`))return{provider:t,class:"local"};for(let t of v2)if(e===t||e.startsWith(`${t}_`))return{provider:t,class:"cloud"};for(let t of Uv)if(e===t||e.startsWith(`${t}_`))return{provider:t,class:"keyed"};return null}var y2=e=>e.enabled!==!1;function jv(e,t){return e.filter(n=>typeof n.accountId=="string").map(n=>({accountId:String(n.accountId),enabled:y2(n),detail:t(n)}))}function b2(e){let t=new Set;for(let n of e?.devices??[])for(let o of n.sources)o.attention==="plan-required"&&t.add(o.provider);return t}function x2(e){let t=[],n=e.accounts("homeassistant");t.push({provider:"home-assistant",kind:"local",status:n.length>0?"linked":"not linked",...n.length>0?{detail:n.map(a=>String(a.baseUrl??a.accountId??"")).join(", "),accounts:jv(n,a=>String(a.baseUrl??""))}:{hint:"acbridge link home-assistant"}});let o=e.accounts("mqtt");t.push({provider:"mqtt",kind:"local",status:o.length>0?"linked":"not linked",...o.length>0?{detail:o.map(a=>`${String(a.host??a.accountId??"")}${a.port?`:${String(a.port)}`:""}`).join(", "),accounts:jv(o,a=>`${String(a.host??"")}${a.port?`:${String(a.port)}`:""}`)}:{hint:"acbridge link mqtt --host <broker>"}});let r=e.accounts("hue");t.push({provider:"hue",kind:"local",status:r.length>0?"linked":"not linked",...r.length>0?{detail:r.map(a=>String(a.host??a.bridgeId??"")).join(", "),accounts:jv(r,a=>String(a.host??""))}:{hint:"acbridge link hue"}});for(let a of g2){let l=e.hasKeystore(a);t.push({provider:a,kind:"keyed",status:l?"linked":"not linked",...l?{}:{hint:`acbridge link ${a}`}})}t.push({provider:"nanoleaf",kind:"device-paired",status:"pairs per device",hint:"acbridge connect <device> (hold the power button)"});let i=e.cloudAccounts===null?null:e.cloudAccounts.find(a=>a.provider==="smartthings"),s=e.planRequired?.has("smartthings")??!1;return t.push({provider:"smartthings",kind:"cloud",status:s?"plan required":e.cloudAccounts===null?"unknown (sign in)":i?i.status??"linked":"not linked",...s?{hint:"SmartThings refused on plan/quota \u2014 signing in again will not fix it (docs/INTEGRATIONS.md)"}:e.cloudAccounts!==null&&!i?{hint:"acbridge link smartthings"}:{}}),t}function k2(e){let t=[];for(let n of e){t.push(`${n.provider.padEnd(16)} ${n.status.padEnd(18)} ${n.detail??n.hint??""}`.trimEnd());for(let o of n.accounts??[])t.push(ce(` ${o.accountId.padEnd(28)} ${o.enabled?"":"(paused) "}${o.detail??""}`.trimEnd()))}return t}var P$=["Usage: acbridge integrations [list] [--json]"," acbridge integrations enable|disable <accountId> (local accounts \u2014 ids from `list`)"," acbridge integrations remove <accountId|smartthings>"].join(`
|
|
274
|
+
`);async function R$(e){let t=await Z("/local/reload",{method:"POST",body:{}});t.hubOffline?v(ce("bridge not running \u2014 the change applies when it next starts")):!t.hubUnauthorized&&Array.isArray(t.body?.failed)&&t.body.failed.length>0?v(ce("saved, but part of the change didn't apply \u2014 restart the bridge to finish it")):e==="down"&&v(ce("saved \u2014 the adapter was torn down live"))}async function w2(e,t,n){let o=T$(e);if(!o)return $(`no integration matches "${e}" \u2014 ids are in \`acbridge integrations\``,1);if(o.class==="cloud")return $("Cloud integrations can't be paused \u2014 remove it to disconnect.",2);if(o.class==="keyed")return $(`Pause or remove individual devices from the network scan (\`acbridge scan\`), or remove the whole account: \`acbridge unlink ${o.provider}\`.`,2);let r=_t();if(!r)return 3;let i=tn(r,o.provider);return i.some(s=>s.accountId===e)?(In(r,o.provider,i.map(s=>s.accountId===e?{...s,enabled:t}:s)),await R$(t?"up":"down"),A(`${e} ${t?"resumed":"paused"}`),n&&V({ok:!0,accountId:e,enabled:t}),0):$(`no ${o.provider} account "${e}" on this machine`,1)}async function S2(e,t){let n=T$(e);if(!n)return $(`no integration matches "${e}" \u2014 ids are in \`acbridge integrations\``,1);if(n.class==="keyed")return $(`keyed providers remove whole accounts: \`acbridge unlink ${n.provider}\``,2);if(n.class==="cloud"){let i=Dt({notSignedIn:{message:"Not signed in. Run `acbridge login` first.",exitCode:3}});if(!i.ok)return $(i.message,i.exitCode);let a=(await yo(i.token))?.find(d=>d.provider===n.provider),l=e.includes("_")?e:a?.accountId;if(!l)return $(`no linked ${n.provider} account to disconnect`,1);let u=await Bx(i.token,l);return u.ok?(A(`${n.provider} disconnected at the relay`),t&&V({ok:!0,removed:l}),0):$(u.error??"couldn't disconnect the account",1)}let o=_t();if(!o)return 3;let r=tn(o,n.provider);if(!r.some(i=>i.accountId===e))return $(`no ${n.provider} account "${e}" on this machine`,1);In(o,n.provider,r.filter(i=>i.accountId!==e));for(let i of[e,"keystore","cloud"])try{ct(o,n.provider,i).delete()}catch{}return await R$("down"),A(`removed ${e} \u2014 its credentials are gone from this machine`),t&&V({ok:!0,removed:e}),0}async function O$(e=[]){let t=e.includes("--json");t&&fe(!0);let n=e.filter(d=>d!=="--json"),o=n[0]??"list";if(o==="enable"||o==="disable"||o==="remove"){let d=n[1];return!d||n.length>2?$(P$,2):o==="remove"?S2(d,t):w2(d,o==="enable",t)}if(o!=="list")return $(P$,2);let r=Jt(),i=r.state==="ok"?await yo(r.token):null,s=qe(),a=await Z("/local/devices",{method:"GET",timeoutMs:3e3}),l=!a.hubOffline&&a.status===200&&a.body?a.body:null,u=x2({accounts:d=>s?tn(s,d):[],hasKeystore:d=>s?ct(s,d,"keystore").read()!==null:!1,cloudAccounts:i,planRequired:b2(l)});if(t)V(u);else for(let d of k2(u))v(d);return 0}function _2(e){let t=e?.onboarding;return typeof t=="object"&&t!==null&&typeof t.completedAt=="number"}function $2(e){return{onboarding:{completedAt:e,completedBy:"cli"}}}async function D$(e,t,n={}){if(!t)return"skipped";let o=n.http??fetch,r=n.now??Date.now,i=e.replace(/\/+$/,""),s=2;try{let a=n.current??await Wl(e,t,o);for(let l=0;l<s;l+=1){if(_2(a.config))return"already";if(a.version===null)return"skipped";let u=await o(`${i}/settings`,{method:"PUT",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify({version:a.version,config:{...a.config,...$2(r())}}),signal:AbortSignal.timeout(6e3)});if(u.ok)return"claimed";if(u.status!==409)return"skipped";l+1<s&&(a=await Wl(e,t,o))}return"skipped"}catch{return"skipped"}}function E2(e){try{let t=JSON.parse(Buffer.from(e.split(".")[1]??"","base64url").toString("utf8"));return{...typeof t.sub=="string"?{sub:t.sub}:{},...typeof t.nid=="string"?{nid:t.nid}:{},...typeof t.exp=="number"?{exp:t.exp}:{}}}catch{return null}}function A2(e){let t=[`account: ${e.claims.sub??"(unknown)"}`,...e.claims.nid?[`node: ${e.claims.nid}`]:[],`machine: ${e.machine}`,`relay: ${e.relayUrl}`,...e.plan?[`plan: ${e.plan}`]:[]],n={account:e.claims.sub??null,...e.claims.nid?{node:e.claims.nid}:{},machine:e.machine,relayUrl:e.relayUrl,...e.plan?{plan:e.plan}:{}};if(e.scope){let{pointerSub:o,resolvedSub:r}=e.scope,i=!!r&&o===r;t.push(`pointer: ${o??"(none)"}`),t.push(r?`resolved: ${r}${i?" (pointer and credential agree)":""}`:o?`resolved: MISMATCH \u2014 pointer and credential name different accounts (${ut.pointerMismatch})`:"resolved: not signed in"),n.pointer=o,n.resolved=r,n.agree=i}return{lines:t,json:n}}async function uu(e=[]){let t=e.includes("--json");t&&fe(!0);let n=L($e().accessFile)?.trim(),o=Te()?.sub??null,r=kt()?.sub??null;if(!n){let l=xt();return l.length>0&&o&&!r?(Ot(l),$(ut.pointerMismatch,3)):$("Not signed in. Run `acbridge login` first.",3)}let i=E2(n)??{},s=await Xn(n),a=A2({claims:i,machine:ja(),relayUrl:le().relayUrl,plan:s?.plan??null,scope:{pointerSub:o,resolvedSub:r}});if(t)V(a.json);else for(let l of a.lines)v(l);return 0}var I2=`Usage: acbridge login [--if-needed] [--provider google|github|microsoft|sso] [--email <you@example.com>] [--no-browser] [--timeout <s>] [--json]
|
|
275
|
+
--if-needed skip the sign-in when this machine already holds a usable credential (default: always sign in)`,N$=["google","github","microsoft","email","sso"];function C2(e){let t={provider:"email",noBrowser:!1,timeoutMs:18e4,json:!1,ifNeeded:!1,chooser:!0};for(let n=0;n<e.length;n++){let o=e[n];if(o==="--if-needed")t.ifNeeded=!0;else if(o==="--no-browser")t.noBrowser=!0;else if(o==="--json")t.json=!0;else if(o==="--provider"){let r=e[++n];N$.includes(r)?(t.provider=r,t.chooser=!1):t.bad=`invalid --provider: ${r??"(none)"} (use ${N$.join(" | ")})`}else if(o==="--email")t.email=e[++n],t.chooser=!1;else if(o==="--timeout"){let r=Number(e[++n]);Number.isFinite(r)?t.timeoutMs=Math.min(600,Math.max(30,Math.round(r)))*1e3:t.bad=`invalid --timeout: ${e[n]??"(none)"}`}else t.bad=`unknown option: ${o??""}`}return t}function U$(e={}){let t=e.readCredentialSub??Dl,n=e.writePointer??(r=>$r({sub:r})),o=e.log??j;try{let r=t();r&&n(r)}catch(r){o(`couldn't update the active-user pointer (non-fatal): ${r instanceof Error?r.message:String(r)}`)}}function P2(e={}){(e.readActiveUser??(()=>Te()))()||(e.heal??U$)()}function T2(e={}){let t=(e.scan??xt)();return(e.warnAmbiguous??(o=>Ot(o)))(t),(e.resolveScope??(()=>kt()))()?{kind:"signed-in"}:(e.readPointer??(()=>Te()))()?{kind:"refuse",message:ut.pointerMismatch}:t.length===1&&Ga(t[0],e.segmentOf)?{kind:"heal",sub:t[0].sub}:{kind:"refuse",message:ut.logoutFirst("log in")}}function R2(e){return e.hasCredential?e.refreshed?{kind:"already"}:{kind:"stale-sign-in"}:{kind:"sign-in"}}async function L$(e,t,n={}){let o=(n.readToken??(()=>L($e().accessFile)?.trim()??""))();if(o){let r=await(n.sync??Zl)(e,o);await(n.claim??D$)(e,o,{current:r})==="claimed"&&v("Account setup completed from this machine \u2014 `acbridge start` will run here now.")}return A(t.successLine),(n.report??(r=>uu(r?["--json"]:[])))(t.json)}async function j$(e=[]){let t=C2(e);if(t.json&&fe(!0),t.bad){let o=$(t.bad,2);return v(I2),o}let n=le().relayUrl;if(t.ifNeeded&&_d()){if(hn()>=vn){let r=T2();if(r.kind==="refuse")return k(r.message),3;r.kind==="heal"&&$r({sub:r.sub})}else P2();if(R2({hasCredential:!0,refreshed:await Vt(n)}).kind==="already")return L$(n,{json:t.json,successLine:"already signed in on this machine"});j("this machine's stored sign-in is no longer valid \u2014 signing in again")}{let o=lx(),r=Zn();try{t.noBrowser||X("opening your browser to sign in\u2026");let i=await bx({cfg:o,opts:{provider:t.provider,...t.email?{email:t.email}:{}},chooser:t.chooser,timeoutMs:t.timeoutMs,openUrl:t.noBrowser?async()=>!1:a=>qn(a,{isWsl:r}),onBrowserFail:a=>{v(t.noBrowser?"Open this URL to sign in:":"Couldn't open a browser \u2014 open this URL to sign in:"),v(a)}});if(X("pairing this machine\u2026"),!await yx(n,()=>i.accessToken))return k("Signed in, but couldn't pair this machine with the relay \u2014 check your connection and retry."),1}catch(i){return k(px(i)),3}}return U$(),L$(n,{json:t.json,successLine:"Signed in. This machine now holds its own relay credential and refreshes itself."})}function O2(e){let t=e.reverted+e.failed+e.skipped;if(t===0)return"no devices needed reverting";let n=[`reverted ${e.reverted} of ${t} device${t===1?"":"s"}`];return e.failed&&n.push(`${e.failed} failed`),e.skipped&&n.push(`${e.skipped} skipped`),n.join(", ")}async function fr(e=[],t={}){let n=t.hubRequest??Z,o=t.hubShutdown??iS,r=t.isHubHealthy??Ue,i=t.shouldSignalDaemon??Yo,s=t.stopHub??lS,a=t.writeStopReason??Ox,l=t.readDaemonPid??(()=>L(wt)),u=t.removeDaemonPid??(()=>Ie(wt)),d=t.killPid??(_=>{try{process.kill(_)}catch{}}),p=e.includes("--json");p&&fe(!0);let m,f=_=>{p&&V({stopped:_,...m?{revert:m}:{}})},g=await n("/local/session/stop",{method:"POST",body:{},timeoutMs:2e4});!g.hubOffline&&g.status===200&&g.body?.summary&&(m=g.body.summary,A(`lights: ${O2(m)}`));let h=await o(),y=l();if(h)return y&&u(),A("hub stopping \u2014 devices reverting, holders releasing"),f(!0),0;a("stop-requested");let x=y?Number(y):0,S=x>0&&i({pid:x}),E=await r();return!S&&!E?(y&&u(),A("bridge already stopped"),f(!1),0):(S&&d(x),y&&u(),s(),await r()?$("the hub is still running and didn't answer the shutdown \u2014 check ~/.claude-bridge/hub.log",1):(A("hub stopped"),f(!0),0))}var D2="Usage: acbridge logout [--json]",N2=new Set(["--json"]);async function du(e=[],t={}){let n=e.filter(h=>!N2.has(h));if(n.length>0)return k(`unknown option: ${n[0]}`),v(D2),2;let o=e.includes("--json");o&&fe(!0);let r=t.read??L,i=t.stopBridge??fr,s=t.revoke??((h,y,x)=>vx(h,y,{clear:x})),a=t.clearTokens??Ai,l=t.keyring??Ii(),u=h=>(t.clearDeviceCredentials??Bu)(h,l),d=t.clearLogs??(()=>{Td(Rt),Td(Jn)}),p=t.clearPointer??Sx,m=t.relayUrl??le().relayUrl,f=[],g=(t.scan??xt)();g.length>=2&&(t.warnAmbiguous??(h=>Ot(h)))(g);for(let{segment:h}of g){let y=Ct(h),x=r(y.accessFile)?.trim()??r(y.refreshFile)?.trim()??null;f.push({segment:h,paths:y,bearer:x})}if(f.length===0)return A("already signed out"),o&&V({signedOut:!0,alreadySignedOut:!0}),0;X("stopping the bridge\u2026"),await i([]);for(let{segment:h,paths:y,bearer:x}of f)X("revoking this machine's credential\u2026"),await s(m,x,()=>a(y)),u(h);return d(),p(),A("signed out \u2014 this machine no longer holds a credential."),o&&V({signedOut:!0,alreadySignedOut:!1}),0}var z$="Usage: acbridge brief [--cwd <path>] [--agent claude|codex] [--json]";async function F$(e){let t=process.cwd(),n="claude",o=!1;for(let s=0;s<e.length;s++){let a=e[s];if(a==="--json")o=!0;else if(a==="--cwd"&&e[s+1])t=e[++s];else if(a==="--agent"&&e[s+1])n=e[++s];else return o&&fe(!0),$(z$,2)}if(o&&fe(!0),n!=="claude"&&n!=="codex")return $(z$,2);let r=await Z(`/local/agent/brief?cwd=${encodeURIComponent(t)}&agent=${n}`);if(r.hubOffline||r.hubUnauthorized)return $(Re(),1);if(r.status===404)return $("this hub predates the brief route \u2014 update AC Bridge on this machine, then restart the bridge",1);if(r.status!==200||!r.body)return $(`hub answered ${r.status??"nothing"} \u2014 try \`acbridge status\``,1);if(o)return V(r.body),0;let i=r.body;return i.enabled?(v(i.brief),0):(i.reason==="disabled"?v(`the device brief is OFF for profile "${i.profileName??"?"}" \u2014 tick "Make agent aware of devices in chat" in the app's Profiles editor (profile ${i.profileId??"?"}).`):v(`no ${n} profile is bound to ${t} \u2014 bind one with \`acbridge profiles bind <profile>${n==="codex"?" --agent codex":""}\`.`),0)}var L2=c.object({deviceId:c.string(),capability:jt,instance:c.string().optional(),command:c.string(),params:c.unknown().optional()}),U2=c.object({deviceId:c.string(),instance:c.string().optional(),look:zl.optional(),effect:Nr.optional(),returnTo:jl.optional(),hold:c.boolean().default(!1)}),j2=c.object({enabled:c.boolean().default(!0),actions:c.array(L2).default([]),looks:c.array(U2).default([]),allowSecurity:c.boolean().default(!1),threshold:c.number().min(0).max(100).optional(),modelMatch:c.object({models:c.array(c.string()).min(1),direction:c.enum(["becomes","leaves"]).default("becomes")}).optional()}),gr={contextLow:{kind:"percent",default:75,min:50,max:95,step:1,hysteresis:10,unitLabel:"% context"},contextCritical:{kind:"percent",default:90,min:60,max:99,step:1,hysteresis:10,unitLabel:"% context"},usageHigh:{kind:"percent",default:80,min:50,max:95,step:1,hysteresis:10,unitLabel:"% usage"},costHigh:{kind:"dollars",default:5,min:.5,max:50,step:.5,hysteresis:0,unitLabel:"$ spent"},longRunning:{kind:"minutes",default:10,min:1,max:60,step:1,hysteresis:0,unitLabel:"min working"}},M$=Object.fromEntries(Object.entries(gr).map(([e,t])=>[e,t.default])),z2=c.object({proactive:c.boolean().default(!0),doNotDisturb:c.boolean().default(!1),announce:c.record(c.string(),c.boolean()).default({})}),F2=c.object({enabled:c.boolean().default(!1),start:c.string().regex(/^\d{2}:\d{2}$/).default("22:00"),end:c.string().regex(/^\d{2}:\d{2}$/).default("07:00"),tz:c.string().optional()}),pn=c.object({id:c.string(),name:c.string().default(""),icon:c.string().default("spark"),gradient:c.tuple([c.string(),c.string(),c.string()]).optional(),deviceScope:c.array(c.string()).default([]),palette:c.array(mt).default([]),states:c.record(c.string(),j2).default({}),notifications:z2.default({proactive:!0,doNotDisturb:!1,announce:{}}),quietHours:F2.default({enabled:!1,start:"22:00",end:"07:00"}),agentDeviceAwareness:c.boolean().default(!1),updatedAt:c.number().optional(),agent:ur.optional()}),pu=c.object({profiles:c.array(pn).default([]),bindings:c.record(c.string(),c.string()).default({}),codexBindings:c.record(c.string(),c.string()).default({})});var M2={started:"Claude started a session",working:"Claude is working",needs_permission:"Claude needs permission",needsInput:"Claude has a question for you",planReady:"Claude's plan is ready for approval",idle:"Claude is waiting for you",finished:"Claude finished",contextLow:"Claude is at {pct} percent context",contextCritical:"Claude's context is nearly full \u2014 {pct} percent",rateLimited:"You've hit your Claude usage limit",error:"Claude hit an error",ended:"Claude session ended",resumed:"Claude session resumed",subagentStart:"Claude started a subagent",subagentFinished:"A Claude subagent finished",compacting:"Claude is compacting its context",compactDone:"Claude finished compacting",permissionDenied:"A Claude tool call was blocked",taskCompleted:"A background Claude task finished",usageHigh:"Claude usage is at {pct} percent of the {window} window",modePlan:"Claude entered plan mode",modeAuto:"Claude is auto accepting edits",modeBypass:"Claude is bypassing permission checks",modeNormal:"Claude is back to normal permission checks",modelChanged:"Claude switched to {model}",workflowStarted:"Claude launched a workflow",reviewChanged:"The pull request review changed to {review}",costHigh:"This session has cost {cost} dollars",longRunning:"Claude has been working {mins} minutes"},Mv=["started","resumed","working","finished","needs_permission","compacting","compactDone","subagentStart","subagentFinished","contextLow","contextCritical","modePlan","modeAuto","modeBypass","modeNormal","modelChanged","error","idle","ended","permissionDenied","planReady","rateLimited","sandboxEscalation","longRunning"],B2=["sandboxEscalation"];function mu(e,t){return e==="codex"?Mv.includes(t):!B2.includes(t)}var H2={started:"Codex started a session",resumed:"Codex session resumed",working:"Codex is working",finished:"Codex finished",needs_permission:"Codex needs permission",compacting:"Codex is compacting its context",compactDone:"Codex finished compacting",subagentStart:"Codex started a subagent",subagentFinished:"A Codex subagent finished",contextLow:"Codex is at {pct} percent context",contextCritical:"Codex's context is nearly full \u2014 {pct} percent",modePlan:"Codex entered plan mode",modeAuto:"Codex is auto accepting edits",modeBypass:"Codex is bypassing permission checks",modeNormal:"Codex is back to normal permission checks",modelChanged:"Codex switched to {model}",error:"Codex hit an error",idle:"Codex is waiting",ended:"Codex session ended",permissionDenied:"A Codex action was declined",planReady:"Codex has a plan ready for approval",rateLimited:"Codex hit its usage limit",sandboxEscalation:"Codex wants to leave its sandbox",longRunning:"Codex has been working {mins} minutes"};function G2(e,t){return e==="codex"?H2[t]:M2[t]}var W2="codex::";function Z2(e,t){return e==="codex"?`${W2}${t}`:t}function Bv(e){return typeof e?.id=="string"&&e.id.startsWith("prof:")}function V2(e,t){return!(!Ss[e.capability]?.some(o=>o.command===e.command)||t&&!t.devices.some(o=>o.id===e.deviceId))}function zv(e){if(Array.isArray(e))return`[${e.map(zv).join(",")}]`;if(e&&typeof e=="object"){let t=e;return`{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${zv(t[n])}`).join(",")}}`}return JSON.stringify(e)??"null"}function q2(e){let t=new Set,n=[];for(let o of e){let r=`${o.deviceId} ${o.capability} ${o.instance??""} ${o.command} ${zv(o.params??{})}`;t.has(r)||(t.add(r),n.push(o))}return n}var J2=new Set(["color","colorTemperature","brightness"]);function B$(e,t,n){let o=n?.voice??!1,r=pu.safeParse({profiles:e?.profiles,bindings:e?.bindings,codexBindings:e?.codexBindings}),i=[],s={},a={},l={},u={};if(Array.isArray(e?.rules))for(let d of e.rules){let p=RS.safeParse(d);p.success&&!Bv(p.data)&&i.push(p.data)}if(r.success){let d=new Map(r.data.profiles.map(m=>[m.id,m])),p=[["claude",r.data.bindings],["codex",r.data.codexBindings]];for(let[m,f]of p)for(let[g,h]of Object.entries(f)){let y=d.get(h);if(!y)continue;let x=Z2(m,g);s[x]={proactive:y.notifications.proactive,doNotDisturb:y.notifications.doNotDisturb,quietHours:y.quietHours},u[x]={profileId:y.id,profileName:y.name,aware:y.agentDeviceAwareness,deviceScope:[...y.deviceScope]};for(let[S,E]of Object.entries(y.states)){if(!E.enabled)continue;let _=Ls.safeParse(S);if(!_.success)continue;let I=_.data;I in M$&&((a[x]??={})[I]=E.threshold??M$[I]),I==="modelChanged"&&E.modelMatch&&(l[x]={models:E.modelMatch.models,direction:E.modelMatch.direction});let N=q2(E.actions.filter(te=>y.deviceScope.includes(te.deviceId)&&V2(te,t))),M=new Set(N.filter(te=>te.capability==="power").map(te=>te.deviceId)),B=[...[...new Set(N.filter(te=>J2.has(te.capability)&&!M.has(te.deviceId)).map(te=>te.deviceId))].map(te=>({kind:"device",deviceId:te,capability:"power",command:"turnOn",params:{}})),...N.map(te=>({kind:"device",deviceId:te.deviceId,capability:te.capability,...te.instance?{instance:te.instance}:{},command:te.command,params:te.params}))],D=G2(m,I),xe=o&&y.notifications.announce[I]&&D?[{kind:"notify",title:y.name||"AC Bridge",body:D}]:[],ie=E.looks.filter(te=>y.deviceScope.includes(te.deviceId)).map(te=>({kind:"intent",deviceId:te.deviceId,...te.instance?{instance:te.instance}:{},...te.look?{look:te.look}:{},...te.effect?{effect:te.effect}:{},...te.returnTo?{returnTo:te.returnTo}:{},hold:te.hold})),Xe=[...B,...ie,...xe];if(Xe.length===0)continue;let yt=m==="codex"?`prof:codex:${y.id}:${g}:${I}`:`prof:${y.id}:${g}:${I}`;i.push({id:yt,name:y.name?`${y.name} \xB7 ${I}`:I,enabled:!0,trigger:{kind:"session",event:I,repo:g,agent:m},conditions:[],actions:Xe,allowSecurity:E.allowSecurity})}}}return{rules:i,notifyPolicy:s,thresholds:a,modelMatch:l,agentAwareness:u}}var Hv="this account's profiles document is unreadable by this version \u2014 update AC Bridge (nothing was written)";function Gv(e){return e.profiles!==void 0||e.bindings!==void 0||e.codexBindings!==void 0?pu.safeParse({profiles:e.profiles,bindings:e.bindings,codexBindings:e.codexBindings}).success?"ok":"malformed":"empty"}function Ht(e){let t=pu.safeParse({profiles:e.profiles,bindings:e.bindings,codexBindings:e.codexBindings});return t.success?t.data:{profiles:[],bindings:{},codexBindings:{}}}function Wv(){return`prof_${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`}function H$(e="New profile",t){return pn.parse({id:Wv(),name:e,...t==="codex"?{agent:"codex"}:{}})}function Zv(e){return e==="codex"?"codexBindings":"bindings"}function Vv(e,t,n,o){let r=Zv(o),i={...e[r]};return n?i[t]=n:delete i[t],{...e,[r]:i}}function G$(e,t,n){if(Gv(e)==="malformed")throw new Error(Hv);let o=Array.isArray(e.rules)?e.rules.filter(i=>!Bv(i)):[],{rules:r}=B$({profiles:t.profiles,bindings:t.bindings,codexBindings:t.codexBindings,rules:o},void 0,{voice:n});return{...e,profiles:t.profiles,bindings:t.bindings,codexBindings:t.codexBindings,rules:r}}function Bs(e){let t=gr[e];return{defaultPct:t.default,min:t.min,max:t.max,unitLabel:t.unitLabel,step:t.step}}var W$=[{event:"started",label:"Started",hint:"A Claude session opens in this repo (SessionStart) \u2014 cold start or /clear, not a resume.",tooltip:"Fires the moment a Claude session starts in a repo bound to this profile \u2014 a cold start or after /clear. A resume fires Resumed instead, and an auto-compaction restart fires neither."},{event:"working",label:"Working",hint:"You send a prompt and Claude starts working (UserPromptSubmit) \u2014 also fires when it resumes after a question or plan approval.",tooltip:"Fires when you send Claude a prompt and it starts working \u2014 and again the moment it resumes after you answer a question or approve a plan."},{event:"needs_permission",label:"Needs permission",hint:"Claude paused to ask permission for a tool (permission notification) \u2014 waiting on your yes/no.",tooltip:"Claude paused mid-task to ask permission to run a tool and is waiting on your yes or no."},{event:"needsInput",label:"Needs input",hint:"Claude asked you a question (AskUserQuestion) and is waiting on your answer.",tooltip:"Claude asked you a question and is waiting on your answer (also fires when a background agent needs input)."},{event:"planReady",label:"Plan ready",hint:"Claude presented a plan for approval (ExitPlanMode) \u2014 nothing runs until you decide.",tooltip:"Claude finished planning and is waiting for you to review and approve the plan before it touches anything."},{event:"idle",label:"Idle",hint:"Claude stopped and nothing happened for a moment \u2014 the 'your turn' nudge.",tooltip:`Fires a second or so after Claude's turn ends, if neither Claude nor you has done anything since. Anything at all \u2014 you typing, a question, a permission prompt \u2014 cancels it, so this is the honest "it's your move" state. (Claude Code's own one-minute idle notification also lands here.)`},{event:"finished",label:"Finished",hint:"Claude ends a turn (Stop hook) \u2014 fires every time it stops replying. The common one.",tooltip:"Claude ends a turn \u2014 the instant it stops replying. Fires at the end of every response; the everyday 'done' signal."},{event:"contextLow",label:"Context low",hint:"Context use crossed your threshold below (default 75%) \u2014 read from the live session.",tooltip:"Claude's context window filled past your chosen percentage \u2014 set the slider below. Your early warning to wrap up, hand off, or /compact.",threshold:Bs("contextLow")},{event:"contextCritical",label:"Context critical",hint:"Context nearly full \u2014 your second, higher threshold (default 90%). Auto-compact is imminent.",tooltip:"Context is nearly full \u2014 past your higher threshold. Auto-compact typically kicks in around 85\u201390%, so this is last-call.",threshold:Bs("contextCritical")},{event:"rateLimited",label:"Rate limited",hint:"Claude hit a usage limit (rate-limit warning, or a turn died on one).",tooltip:"You hit \u2014 or are about to hit \u2014 your Claude plan's usage limit (the 5-hour or weekly window) and Claude may stop replying."},{event:"error",label:"Error",hint:"A turn or tool failed (StopFailure, a tool failure, or an MCP server error).",tooltip:"Something failed \u2014 an API error ended the turn, a tool call failed, or an MCP server dropped. Rate-limit failures fire Rate limited instead."},{event:"ended",label:"Ended",hint:"The session closed (SessionEnd) \u2014 Claude is no longer running in this repo.",tooltip:"The session closed \u2014 Claude is no longer running in this repo. Profile scenes revert."}],Z$=[{event:"resumed",label:"Resumed",hint:"A previous session picks up where it left off (SessionStart on resume).",tooltip:"A previous session picks up where it left off (--resume / reopening a conversation)."},{event:"subagentStart",label:"Subagent started",hint:"Claude spawned a subagent for a subtask (SubagentStart).",tooltip:"Claude spawned a subagent to work on a subtask in the background."},{event:"subagentFinished",label:"Subagent finished",hint:"A spawned subagent finished (SubagentStop).",tooltip:"A spawned subagent finished its subtask and reported back."},{event:"compacting",label:"Compacting",hint:"Claude is about to compact its context (PreCompact) \u2014 manual /compact or automatic when nearly full.",tooltip:"Claude is about to compact its context to free room \u2014 manual /compact or automatic when nearly full."},{event:"compactDone",label:"Compaction done",hint:"Compaction finished (PostCompact) \u2014 context freed.",tooltip:"Compaction finished \u2014 context freed. The context meters (and Context low/critical) re-arm."},{event:"permissionDenied",label:"Permission denied",hint:"A tool call was auto-blocked by permission rules (PermissionDenied) \u2014 without asking you.",tooltip:"A tool call was auto-blocked by permission rules without asking you \u2014 worth a glance at what was refused."},{event:"taskCompleted",label:"Task completed",hint:"A background task or agent finished (TaskCompleted) while the session kept going.",tooltip:"A background task or agent finished while the main session kept going."},{event:"usageHigh",label:"Usage high",hint:"Plan usage crossed your threshold below (default 80%) \u2014 fed by the statusline feed (5-hour/7-day window).",tooltip:"Your Claude plan usage crossed your chosen percentage of the 5-hour or weekly window \u2014 pace yourself before the hard limit. Needs the AC Bridge statusline tee (installed by acbridge).",threshold:Bs("usageHigh")},{event:"modePlan",label:"Plan mode",hint:"The session switched INTO plan mode (shift+tab) \u2014 read from the session transcript.",tooltip:"You switched the session into plan mode \u2014 Claude researches and proposes before touching anything. Fires on the switch itself; Plan ready fires later, when a finished plan awaits your approval. A session that OPENS in plan mode stays quiet until the mode actually moves."},{event:"modeAuto",label:"Auto-accept mode",hint:"The session switched into auto-accept \u2014 edits apply without per-action confirmation.",tooltip:"You switched into auto-accept mode \u2014 edits and tool calls apply without per-action confirmation. Fires once on the switch, not per edit."},{event:"modeBypass",label:"Bypass permissions",hint:"The session entered bypass-permissions mode \u2014 ALL permission checks are skipped.",tooltip:"The session entered bypass-permissions mode: every permission check is skipped until you leave it. The riskiest mode \u2014 a bright warning scene is a good fit."},{event:"modeNormal",label:"Normal mode",hint:"The session returned to default permission checks (from plan, auto-accept, or bypass).",tooltip:"The session returned to normal permission checks \u2014 the exit edge of the other mode states, handy for restoring your regular working scene."},{event:"modelChanged",label:"Model changed",hint:"The session's model switched mid-run (/model, fast mode) \u2014 the announcement names the new model.",tooltip:`The session's model changed mid-run \u2014 /model, a fast-mode toggle, or an opusplan hand-off. The spoken announcement names the new model ("Claude switched to Opus 4.8").`,modelMatch:!0},{event:"workflowStarted",label:"Workflow started",hint:"Claude kicked off a multi-agent workflow (Workflow tool) \u2014 expect a subagent burst.",tooltip:"Claude launched a multi-agent workflow. Expect a burst of Subagent started/finished signals until it completes \u2014 the completion itself lands as Task completed."},{event:"reviewChanged",label:"Review changed",hint:"Your PR's review state changed (approved / changes requested) \u2014 read from the statusline's pr.review_state field.",tooltip:"The statusline tee reports your pull request's review state, and this fires the moment it changes \u2014 approved, changes requested, or back to pending \u2014 so a CI-review scene can react the instant someone reviews your PR. Needs the AC Bridge statusline tee and an open PR with review data (installed by acbridge). Claude's own exclusive state \u2014 Codex has no equivalent."},{event:"costHigh",label:"Cost alarm",hint:"This session's estimated spend crossed your dollar threshold (default $5) \u2014 from the statusline cost feed.",tooltip:"Fires once when Claude's estimated session cost passes the dollar amount you set below. Needs the AC Bridge statusline tee (installed by acbridge); Codex sessions have no dollar cost, so this is Claude-only.",threshold:Bs("costHigh")},{event:"longRunning",label:"Long run",hint:"The session has been working non-stop past your minutes threshold (default 10) \u2014 a hub timer.",tooltip:"Fires when a session stays in 'working' longer than the minutes you set below without pausing for you \u2014 a 'did it get stuck / long task still going' watchdog. Re-arms on the next turn. Works for Claude and Codex.",threshold:Bs("longRunning")}],V$={started:{hint:"Codex opens a fresh rollout in this repo \u2014 a true cold start, not reopening an earlier conversation.",tooltip:"A new Codex session spins up against a repo bound to this profile, beginning an empty rollout. Reopening a prior conversation routes to Resumed instead, so this card only marks genuine first starts."},resumed:{hint:"A previous Codex conversation picks up where it left off.",tooltip:"A previous Codex conversation resumes \u2014 Codex reloads its prior rollout and continues from where it stopped."},working:{hint:"A turn begins on Codex's UserPromptSubmit hook \u2014 your prompt is in and work has started.",tooltip:"Codex's UserPromptSubmit hook trips as each turn opens: the moment your prompt is submitted. This is the 'now busy' edge."},finished:{hint:"Codex's Stop hook lands at the end of every reply \u2014 turn done, not the session closing.",tooltip:"Codex fires its Stop hook when a turn wraps, once per reply. It marks end-of-turn rather than a closed session, so expect it after every answer \u2014 the routine 'ready for you' beat."},needs_permission:{hint:"Codex paused to ask approval for a command \u2014 waiting on your yes/no.",tooltip:"Codex paused mid-task to ask for your approval to run a command and is waiting on your decision. Sandbox and network escalation requests fire the separate 'Sandbox escalation' state instead \u2014 bind that too if you want one scene for every approval."},compacting:{hint:"Codex is about to compact its context to free room.",tooltip:"Codex is about to compact its context \u2014 manual or automatic once its context window is nearly full."},compactDone:{hint:"Codex's PostCompact hook lands once the squeeze is done \u2014 room reclaimed.",tooltip:"The compaction Codex flagged with Compacting has just completed via its PostCompact hook, so the freed headroom resets what the context thresholds watch. A natural cue to swap back from any 'compacting' scene."},subagentStart:{hint:"Codex delegated a subtask \u2014 its SubagentStart hook signals a child agent spinning up.",tooltip:"Codex handed part of the work to a child agent; the SubagentStart lifecycle hook fires as that delegate begins. Pair it with Subagent finished to bracket the detour."},subagentFinished:{hint:"A delegated child agent wrapped up \u2014 Codex's SubagentStop hook fires as it returns.",tooltip:"The child agent Codex delegated to has completed and folded its result back into the main run; the SubagentStop lifecycle hook marks the hand-back."},contextLow:{hint:"Context use crossed your threshold below (default 75%) \u2014 tallied from Codex's rollout token counts.",tooltip:"Codex's context window filled past your chosen percentage, tallied from its rollout file's token counts \u2014 your early warning to wrap up or compact."},contextCritical:{hint:"Codex's context is nearly full \u2014 your second, higher threshold (default 90%).",tooltip:"Codex's context is nearly full, past your higher threshold, tallied from its rollout token counts \u2014 last call before it has to compact."},modePlan:{hint:"Codex's permission_mode flipped to plan \u2014 it will propose a course before acting.",tooltip:"The permission_mode field in Codex's hook payloads changed to plan, usually from a /approvals switch in the TUI. In this mode Codex maps out its approach for you rather than editing straightaway; the card marks the switch, not any later approval."},modeAuto:{hint:"Codex's permission_mode moved to acceptEdits \u2014 file edits auto-approve from here.",tooltip:"Codex reported an acceptEdits (dontAsk) permission_mode in its hook payload, so it stops prompting before each edit and applies them on its own. One signal on the mode change, never one per edit."},modeBypass:{hint:"permission_mode hit bypassPermissions \u2014 Codex now runs commands with no approval gate at all.",tooltip:"Codex's hook payload shows a bypassPermissions permission_mode: it executes edits and commands with every approval prompt turned off until the mode changes back. This is the most dangerous state to sit in, so a loud, unmistakable scene earns its place here."},modeNormal:{hint:"permission_mode fell back to default \u2014 Codex is asking before each action again.",tooltip:"Codex's permission_mode returned to default, so it resumes prompting for approval on every edit and command. Treat this as leaving plan, auto-accept, or full-access \u2014 the cue to restore your everyday working scene."},modelChanged:{hint:"The model slug in Codex's hook payload changed \u2014 the model was swapped mid-session.",tooltip:"Codex emitted a different model slug between hook payloads, usually after a /model pick in its TUI. The state carries whichever model is now in charge, so the read-back can name it."},error:{hint:"A Codex turn fails or the app-server crashes mid-turn (voice sessions) \u2014 or any codex session's tool result comes back error-shaped.",tooltip:"In a voice session, Codex's turn/completed event reports a failure it can't classify as a usage limit or a full context window, or the app-server itself dies while a turn is in flight. In any codex session running the plugin's hooks, a tool result flagged as an error (is_error, isError, or a non-empty error field) raises it too \u2014 the one card codex can fire outside a voice session."},idle:{hint:"Voice sessions only: your turn was interrupted and Codex is left waiting on you.",tooltip:"Voice-session only \u2014 Codex's turn/completed event reports status interrupted (you cut it off, or it landed mid-turn) and Codex now sits idle waiting for your next prompt. Codex has no separate idle-after-a-minute hook, so this fires on the interruption itself, not a timer."},ended:{hint:"Voice sessions only: the adapter session closes \u2014 the same signal a codex profile relies on to revert its devices.",tooltip:"Voice-session only \u2014 when the Codex adapter tears down, this fires as its last act, before any still-pending approvals are auto-declined and the process exits. It's the state a codex profile needs to revert its devices, since Codex has no SessionEnd hook of its own outside the adapter."},permissionDenied:{hint:"Voice sessions only: you decline a Codex approval request \u2014 by voice or the local keyboard shortcut.",tooltip:"Voice-session only \u2014 fires when a pending Codex approval (a command or file-change request) is declined, whether you say no over Alexa or press the deny key locally. An approved request instead just returns Codex to working."},planReady:{hint:"Voice sessions only: Codex shares its plan for the turn \u2014 the first plan update, not every step after.",tooltip:"Voice-session only \u2014 the first plan/updated notification after a turn starts fires this once; later step-status updates within the same turn stay silent so it isn't a play-by-play. The latch resets on the next turn, so a fresh turn's first plan fires again."},rateLimited:{hint:"Voice sessions only: a Codex turn fails because you've hit your usage limit.",tooltip:"Voice-session only \u2014 Codex's turn/completed event reports a failure it specifically recognizes as a usage-limit hit, distinct from the generic Error card for anything it can't classify that precisely."},sandboxEscalation:{hint:"Voice sessions only, codex-exclusive: Codex asks to leave its sandbox for network or full access \u2014 its loudest approval request.",tooltip:"Voice-session only, and a state only Codex can raise \u2014 when its app-server sends an item/permissions/requestApproval (rather than a routine command or file-change approval), it's asking to escalate out of its sandbox for network or unrestricted access. This is codex's own exclusive approval type, so give it the loudest scene you've got."},longRunning:{hint:"Codex has been mid-turn past your minutes threshold (default 10) \u2014 a hub timer watching its turns.",tooltip:"Fires when Codex stays mid-turn longer than the minutes you set below without pausing for your input \u2014 a 'still going, might be stuck' watchdog fed by the hub's own timer, not a Codex hook. The latch resets the moment a new turn begins."}},K2=[{event:"sandboxEscalation",label:"Sandbox escalation",...V$.sandboxEscalation}],X2=new Set(["idle","ended","permissionDenied","planReady","rateLimited","sandboxEscalation"]);function fu(e,t=!1){if(e!=="codex")return{curated:W$,advanced:Z$};let n=r=>mu(e,r)&&(t||!X2.has(r)),o=r=>r.filter(i=>n(i.event)).map(i=>{let s=V$[i.event];return s?{...i,hint:s.hint,tooltip:s.tooltip}:i});return{curated:o(W$),advanced:[...o(Z$),...K2.filter(r=>n(r.event))]}}import{resolve as pz}from"node:path";var Y2=new Set(["--device","--color","--brightness","--scale","--kelvin","--power","--return","--effect-json","--action","--param","--instance","--threshold","--models","--direction","--announce","--clear-device"]),Q2=new Set(["--hold","--allow-security","--clear","--enable","--disable","--json"]);function Hs(e){let t={devices:[],hold:!1,allowSecurity:!1,params:[],clear:!1,clearDevices:[],json:!1},n=o=>({...t,bad:o});for(let o=0;o<e.length;o+=1){let r=e[o];if(Q2.has(r)){if(r==="--hold")t.hold=!0;else if(r==="--allow-security")t.allowSecurity=!0;else if(r==="--clear")t.clear=!0;else if(r==="--json")t.json=!0;else if(r==="--enable"||r==="--disable"){let s=r==="--enable";if(t.enable!==void 0&&t.enable!==s)return n("--enable and --disable are opposites \u2014 pick one");t.enable=s}continue}if(!Y2.has(r))return n(`unknown flag: ${r}`);let i=e[o+1];if(i===void 0||i.startsWith("--")&&!/^-?\d/.test(i.slice(2)))return n(`${r} needs a value`);switch(o+=1,r){case"--device":t.devices.push(i);break;case"--clear-device":t.clearDevices.push(i);break;case"--param":t.params.push(i);break;case"--instance":t.instance=i;break;case"--action":t.action=i;break;case"--effect-json":t.effectJson=i;break;case"--color":{if(i==="main"||i==="session"||i==="none")t.color=i;else{let s=i.split(",").map(a=>Number(a.trim()));if(s.length!==2||!s.every(Number.isFinite)||s[0]<0||s[0]>360||s[1]<0||s[1]>100)return n(`--color takes main | session | none | <hue 0-360>,<sat 0-100>, got: ${i}`);t.color={hue:s[0],saturation:s[1]}}break}case"--brightness":{if(i==="none")t.brightness="none";else{let s=Number(i);if(!Number.isFinite(s)||s<0||s>100)return n(`--brightness takes 0-100 or none, got: ${i}`);t.brightness=s}break}case"--scale":{let s=Number(i);if(!Number.isFinite(s)||s<0||s>2)return n(`--scale takes 0-2 (relative to main), got: ${i}`);t.scale=s;break}case"--kelvin":{if(i==="none")t.kelvin="none";else{let s=Number(i);if(!Number.isFinite(s))return n(`--kelvin takes a colour temperature or none, got: ${i}`);t.kelvin=s}break}case"--power":{if(i!=="on"&&i!=="off"&&i!=="auto")return n(`--power takes on | off | auto, got: ${i}`);t.power=i;break}case"--return":{if(i!=="main"&&i!=="session"&&i!=="hold"&&i!=="off")return n(`--return takes main | session | hold | off, got: ${i}`);t.ret=i;break}case"--threshold":{let s=Number(i);if(!Number.isFinite(s))return n(`--threshold takes a number, got: ${i}`);t.threshold=s;break}case"--models":t.models=i.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);break;case"--direction":{if(i!=="becomes"&&i!=="leaves")return n(`--direction takes becomes | leaves, got: ${i}`);t.direction=i;break}case"--announce":{if(i!=="on"&&i!=="off")return n(`--announce takes on | off, got: ${i}`);t.announce=i;break}}}return t.brightness!==void 0&&t.scale!==void 0?n("--brightness (absolute) and --scale (relative to main) are exclusive \u2014 pick one"):t}var ez=e=>e.capabilities.some(t=>t.type==="color");function tz(){return{enabled:!0,actions:[],looks:[],allowSecurity:!1}}function nz(e){return e.color!==void 0||e.brightness!==void 0||e.scale!==void 0||e.kelvin!==void 0||e.power!==void 0||e.ret!==void 0||e.hold||e.effectJson!==void 0}function rz(e,t,n){let o={...e?.look??{}};n.color==="none"?delete o.color:n.color==="main"||n.color==="session"?o.color={kind:"token",token:n.color}:n.color!==void 0&&(o.color={kind:"literal",hue:n.color.hue,saturation:n.color.saturation}),n.brightness==="none"?delete o.brightnessPct:n.brightness!==void 0&&(o.brightnessPct=n.brightness,delete o.brightnessScale),n.scale!==void 0&&(o.brightnessScale=n.scale,delete o.brightnessPct),n.kelvin==="none"?delete o.kelvin:n.kelvin!==void 0&&(o.kelvin=n.kelvin),n.power==="auto"?delete o.power:n.power!==void 0&&(o.power=n.power==="on");let r=e?.effect;if(n.effectJson!==void 0){let l;try{l=JSON.parse(n.effectJson)}catch{return{error:"--effect-json isn't valid JSON"}}let u=Nr.safeParse(l);if(!u.success)return{error:`--effect-json isn't a valid effect: ${u.error.issues[0]?.message??"invalid"}`};r=u.data}let i=n.ret??e?.returnTo,s=n.ret==="hold"||n.hold?!0:n.ret!==void 0?!1:e?.hold??!1,a=Object.keys(o).length>0;return!a&&!r?null:{deviceId:t,...n.instance!==void 0?{instance:n.instance}:e?.instance!==void 0?{instance:e.instance}:{},...a?{look:o}:{},...r?{effect:r}:{},...i!==void 0?{returnTo:i}:{},hold:s}}function Gs(e,t,n,o,r){let i=[],s={...e.states},a=e.notifications,l=[...e.deviceScope];if(TS.has(t)&&i.push(`note: '${t}' never fires \u2014 no producer emits it (kept for stored-config compatibility only)`),n.clear)delete s[t];else{let d=s[t]?{...s[t],actions:[...s[t].actions],looks:[...s[t].looks]}:tz();for(let g of r)d.looks=d.looks.filter(h=>h.deviceId!==g.id),d.actions=d.actions.filter(h=>h.deviceId!==g.id);let p=nz(n),m=n.action!==void 0;if((p||m)&&o.length===0)return{ok:!1,message:"that edit targets devices \u2014 name at least one with --device <id|name>"};for(let g of o)l.includes(g.id)||(l=[...l,g.id],i.push(`added ${g.name} to the profile's device scope`));if(p){let g=n.color!==void 0&&n.color!=="none";for(let h of o){if(g&&!ez(h))return{ok:!1,message:`${h.name} has no color capability \u2014 drop --color for it (brightness/power/kelvin still work)`};let y=d.looks.findIndex(S=>S.deviceId===h.id&&S.instance===n.instance),x=rz(y>=0?d.looks[y]:void 0,h.id,n);if(x&&typeof x=="object"&&"error"in x)return{ok:!1,message:x.error};x===null?y>=0&&(d.looks=d.looks.filter((S,E)=>E!==y)):y>=0?d.looks=d.looks.map((S,E)=>E===y?x:S):d.looks=[...d.looks,x]}}if(n.action!==void 0){let g=Bh(n.params);if(!g.ok)return{ok:!1,message:g.message};for(let h of o){let y=Ol(h,n.action,g.params);if(!y.ok)return{ok:!1,message:y.message};let x={deviceId:h.id,capability:y.capability,...n.instance!==void 0?{instance:n.instance}:{},command:y.command,params:y.params};d.actions=[...d.actions.filter(S=>!(S.deviceId===h.id&&S.capability===x.capability&&S.instance===x.instance)),x]}}if(n.threshold!==void 0){let g=gr[t];if(!g)return{ok:!1,message:`"${t}" has no threshold \u2014 the threshold states are: ${Object.keys(gr).join(", ")}`};if(n.threshold<g.min||n.threshold>g.max)return{ok:!1,message:`--threshold for ${t} takes ${g.min}-${g.max} (${g.unitLabel})`};d={...d,threshold:n.threshold}}if(n.models!==void 0||n.direction!==void 0){if(t!=="modelChanged")return{ok:!1,message:"--models/--direction filter the modelChanged state only"};if(!n.models||n.models.length===0)return{ok:!1,message:"--models needs at least one model family"};d={...d,modelMatch:{models:n.models,direction:n.direction??"becomes"}}}n.allowSecurity&&(d={...d,allowSecurity:!0}),n.enable!==void 0&&(d={...d,enabled:n.enable}),(p||m||r.length>0||n.threshold!==void 0||n.models!==void 0||n.allowSecurity||n.enable!==void 0||n.announce!==void 0||s[t])&&(s[t]=d)}n.announce!==void 0&&(a={...a,announce:{...a.announce,[t]:n.announce==="on"}});let u=pn.safeParse({...e,states:s,notifications:a,deviceScope:l});return u.success?{ok:!0,result:{profile:u.data,notes:i}}:{ok:!1,message:`that edit doesn't parse as a valid profile: ${u.error.issues[0]?.message??"invalid"}`}}function q$(e,t){let n=e.find(s=>s.id===t);if(n)return{ok:!0,profile:n};let o=t.toLowerCase(),r=e.filter(s=>s.name.toLowerCase()===o);if(r.length===1)return{ok:!0,profile:r[0]};let i=r.length>1?r:e.filter(s=>s.name.toLowerCase().includes(o));return i.length===1?{ok:!0,profile:i[0]}:i.length>1?{ok:!1,kind:"ambiguous",candidates:i.map(s=>({id:s.id,name:s.name}))}:{ok:!1,kind:"not-found",candidates:[]}}var oz=e=>({enabled:!0,actions:[],looks:e,allowSecurity:!1}),Wr=(e,t)=>({deviceId:e,look:t,hold:!1}),iz=[{event:"started",color:e=>e.hasColor?Wr(e.id,{color:{kind:"token",token:"session"}}):null},{event:"working",color:e=>e.hasColor?Wr(e.id,{color:{kind:"token",token:"session"}}):null},{event:"needs_permission",color:e=>Wr(e.id,e.hasColor?{color:{kind:"literal",hue:45,saturation:100},brightnessPct:100}:{brightnessPct:100})},{event:"planReady",color:e=>Wr(e.id,e.hasColor?{color:{kind:"literal",hue:190,saturation:90},brightnessPct:100}:{brightnessPct:100})},{event:"error",color:e=>Wr(e.id,e.hasColor?{color:{kind:"literal",hue:0,saturation:100},brightnessPct:100}:{brightnessPct:100})},{event:"finished",color:e=>e.hasColor?Wr(e.id,{color:{kind:"literal",hue:120,saturation:80}}):null},{event:"idle",color:e=>Wr(e.id,e.hasColor?{color:{kind:"token",token:"main"},brightnessScale:.3}:{brightnessScale:.3})}];function sz(e,t){return e!=="codex"?!0:Mv.includes(t)}function J$(e,t){if(t.length===0)return{};let n={};for(let o of iz){if(!sz(e,o.event))continue;let r=t.map(i=>o.color(i)).filter(i=>i!==null);r.length>0&&(n[o.event]=oz(r))}return n}import{createInterface as K$}from"node:readline/promises";function az(e){let t=K$({input:process.stdin,output:process.stdout});return t.question(e).finally(()=>t.close())}function cz(e){return new Promise(t=>{let n=K$({input:process.stdin,output:process.stdout,terminal:!0}),o=!1,r=n;r._writeToOutput=i=>{o?(i.includes(`
|
|
265
276
|
`)||i.includes("\r"))&&process.stdout.write(`
|
|
266
|
-
`):(process.stdout.write(e),o=!0)},
|
|
267
|
-
`),
|
|
268
|
-
`)})}function
|
|
269
|
-
`)}}async function
|
|
270
|
-
`)}}async function
|
|
271
|
-
`)),await
|
|
272
|
-
`);continue}let
|
|
273
|
-
`);continue}for(let
|
|
274
|
-
`);
|
|
275
|
-
`,384)}function
|
|
276
|
-
${
|
|
277
|
-
`)}`,2)
|
|
278
|
-
`);async function d_(e=[],t={}){let r=e.includes("--json");r&&be(!0);let o=e.filter(u=>u!=="--json"),n=o[0]&&!o[0].startsWith("--")?o[0]:"list",i=o[0]===n?o.slice(1):o,s=t.interactive??Jo.isTTY(),a=t.io??Jo,l=TU(o);if(l==="bad")return E("--agent takes claude | codex",2);switch(n){case"list":{let u=await Cn(t,r);if(typeof u=="number")return u;let d=EU(u.config),p=o.includes("--agent")?{...d,profiles:d.profiles.filter(m=>m.agent===(l??"claude"))}:d;if(r)K(p);else for(let m of AU(p))v(m);return 0}case"show":{let u=i[0];if(!u)return E(nr,2);let d=await Cn(t,r);if(typeof d=="number")return d;let p=Ot(d.config),m=Ur(p,u);if(typeof m=="number")return m;let f=Object.entries(p.bindings).filter(([,y])=>y===m.id).map(([y])=>y),g=Object.entries(p.codexBindings).filter(([,y])=>y===m.id).map(([y])=>y);if(r)return K({profile:m,bindings:{claude:f,codex:g}}),0;v(`${m.name} (${m.id}) \u2014 ${m.agent??"claude"}`),v(`scope: ${m.deviceScope.length===0?"no devices":m.deviceScope.join(", ")}`);let h=Object.keys(m.states);if(h.length===0)v("states: none configured \u2014 try `acbridge profiles set-state`");else{v("states:");for(let y of h){let k=m.states[y],_=[`${k.looks.length} look${k.looks.length===1?"":"s"}`,`${k.actions.length} action${k.actions.length===1?"":"s"}`,...k.threshold!==void 0?[`fires at ${k.threshold}`]:[],...k.enabled?[]:["disabled"]];v(` ${y.padEnd(18)} ${_.join(", ")}`)}}for(let y of f)v(`bound: ${y} [claude]`);for(let y of g)v(`bound: ${y} [codex]`);return 0}case"states":{let u=t.voice??Ue(),d=Nl(l,u);if(r){let p=m=>({event:m.event,label:m.label,hint:m.hint,...m.threshold?{threshold:m.threshold}:{}});return K({agent:l??"claude",curated:d.curated.map(p),advanced:d.advanced.map(p)}),0}v(me(`states a ${l??"claude"} profile can react to (use the left column with set-state):`));for(let[p,m]of[["curated",d.curated],["advanced",d.advanced]]){v(`${p}:`);for(let f of m){let g=f.threshold?` (threshold ${f.threshold.min}-${f.threshold.max} ${f.threshold.unitLabel}, default ${f.threshold.defaultPct})`:"";v(` ${f.event.padEnd(18)} ${f.label} \u2014 ${f.hint}${g}`)}}return 0}case"create":{let u=await Cn(t,r);if(typeof u=="number")return u;let d=i.filter((D,Z)=>!D.startsWith("--")&&!["--agent","--devices","--bind"].includes(i[Z-1]??"")),p=d[0];if(d.length>1)return E("one profile name (quote names with spaces)",2);let m=i.includes("--starter"),f=[],g=i.indexOf("--devices");if(g!==-1){let D=i[g+1];if(!D||D.startsWith("--"))return E("--devices takes a comma-separated list",2);f=D.split(",").map(Z=>Z.trim()).filter(Boolean)}let h=i.indexOf("--bind"),y=null;if(h!==-1){let D=i[h+1];y=D&&!D.startsWith("--")&&!d.includes(D)?D:void 0}let k=l,_=[],I=[],S=s&&!r&&i.length===0;if(f.length>0||S){let D=await zh(u);if(typeof D=="number")return D;I=D}if(S){let D=(t.cwd??(()=>process.cwd()))(),Z=await i_(a,{devices:I,cwd:D,cwdLooksLikeRepo:!0});if(!Z)return v("nothing saved"),0;p=Z.name,k=Z.agent,_=Z.deviceIds,m=Z.starter,y=Z.bindCwd?void 0:null}else if(f.length>0){let D=Fh(I,f);if(typeof D=="string")return E(D,2);_=D.map(Z=>Z.id)}m&&_.length===0&&(z("--starter needs devices to wire \u2014 creating a blank profile instead (add some with --devices)"),m=!1);let T=I.filter(D=>_.includes(D.id)).map(D=>({id:D.id,hasColor:D.capabilities.some(Z=>Z.type==="color")})),j=JS(p||"New profile",k),F=Qt.parse({...j,deviceScope:_,states:m?t_(k,T):{}}),J=y===null?null:u_(u,y).key,fe=await Nr(u,D=>({profiles:[...D.profiles,F],...J===null?{bindings:D.bindings,codexBindings:D.codexBindings}:Uh({bindings:D.bindings,codexBindings:D.codexBindings},J,F.id,k)}));return Lr(fe,()=>{$(`created "${F.name}" (${F.id})${m?" with the starter scene set":""}`),J!==null&&$(`bound ${J} \u2192 ${F.name} [${k??"claude"}]`),m||v(`wire a state next: acbridge profiles set-state ${F.id} working --device <name> --color session`),r&&K({ok:!0,profile:F})})}case"rename":{let[u,...d]=i,p=d.join(" ").trim();if(!u||!p)return E(nr,2);let m=await Cn(t,r);if(typeof m=="number")return m;let f=Ur(Ot(m.config),u);if(typeof f=="number")return f;let g=await Nr(m,h=>({...h,profiles:h.profiles.map(y=>y.id===f.id?{...y,name:p}:y)}));return Lr(g,()=>{$(`renamed to "${p}"`),r&&K({ok:!0,id:f.id,name:p})})}case"duplicate":{let[u,...d]=i.filter(h=>!h.startsWith("--"));if(!u)return E(nr,2);let p=await Cn(t,r);if(typeof p=="number")return p;let m=Ur(Ot(p.config),u);if(typeof m=="number")return m;let f={...m,id:Nh(),name:d.join(" ").trim()||`${m.name||"Profile"} copy`},g=await Nr(p,h=>({...h,profiles:[...h.profiles,f]}));return Lr(g,()=>{$(`duplicated "${m.name}" \u2192 "${f.name}" (${f.id})`),r&&K({ok:!0,profile:f})})}case"delete":{let u=i.includes("--yes"),d=i.filter(g=>!g.startsWith("--"))[0];if(!d)return E(nr,2);let p=await Cn(t,r);if(typeof p=="number")return p;let m=Ur(Ot(p.config),d);if(typeof m=="number")return m;if(!u){if(!s||r)return E(`deleting "${m.name}" needs --yes when not on a terminal`,2);if(!await Pn(a,`Delete "${m.name}" and unbind it everywhere?`,{def:!1}))return v("kept"),0}let f=await Nr(p,g=>({profiles:g.profiles.filter(h=>h.id!==m.id),bindings:Object.fromEntries(Object.entries(g.bindings).filter(([,h])=>h!==m.id)),codexBindings:Object.fromEntries(Object.entries(g.codexBindings).filter(([,h])=>h!==m.id))}));return Lr(f,()=>{$(`deleted "${m.name}" (bindings in both lanes pruned)`),r&&K({ok:!0,deleted:m.id})})}case"edit":{let u=i[0];if(!u)return E(nr,2);if(!s||r)return E("`profiles edit` is interactive \u2014 use `profiles set-state` for scripting",2);let d=await Cn(t,r);if(typeof d=="number")return d;let p=Ur(Ot(d.config),u);if(typeof p=="number")return p;let m=await zh(d);if(typeof m=="number")return m;let f=await s_(a,p,m,d.voice);if(!f)return v("no changes"),0;let g=await Nr(d,h=>{if(!h.profiles.some(y=>y.id===f.id))throw new Error(`"${p.name}" was deleted on another device while you edited \u2014 nothing saved`);return{...h,profiles:h.profiles.map(y=>y.id===f.id?f:y)}});return Lr(g,()=>$(`saved "${f.name}"`))}case"set-state":{let[u,d,...p]=i;if(!u||!d)return E(nr,2);let m=vs(p);if(m.bad)return E(m.bad,2);let f=await Cn(t,r);if(typeof f=="number")return f;let g=Ur(Ot(f.config),u);if(typeof g=="number")return g;if(!ss.options.includes(d))return E(`"${d}" isn't a session state \u2014 see \`acbridge profiles states --agent ${g.agent??"claude"}\``,2);let h=d;if(!Dl(g.agent,h))return E(`a ${g.agent??"claude"} profile can't react to "${h}" \u2014 see \`acbridge profiles states --agent ${g.agent??"claude"}\``,2);let y=[],k=[];if(m.devices.length>0||m.clearDevices.length>0){let S=await zh(f);if(typeof S=="number")return S;let T=Fh(S,m.devices);if(typeof T=="string")return E(T,2);y=T;let j=Fh(S,m.clearDevices);if(typeof j=="string")return E(j,2);k=j}let _=ys(g,h,m,y,k);if(!_.ok)return E(_.message,2);for(let S of _.result.notes)$(S);let I=await Nr(f,S=>{let T=S.profiles.find(F=>F.id===g.id);if(!T)throw new Error(`"${g.name}" was deleted on another device \u2014 nothing saved`);let j=ys(T,h,m,y,k);if(!j.ok)throw new Error(j.message);return{...S,profiles:S.profiles.map(F=>F.id===g.id?j.result.profile:F)}});return Lr(I,S=>{$(`${g.name} \xB7 ${h} updated`),r&&K({ok:!0,profile:g.id,state:h,version:S})})}case"bind":case"unbind":{let u=n==="bind",d=u?i.filter((j,F)=>!j.startsWith("--")&&i[F-1]!=="--repo"&&i[F-1]!=="--agent")[0]:void 0;if(u&&!d)return E(nr,2);let p,m=i.indexOf("--repo");if(m!==-1&&(p=i[m+1],!p||p.startsWith("--")))return E("--repo needs a path or a repos-list name",2);let f=await Cn(t,r);if(typeof f=="number")return f;let g=Ot(f.config),h=u?Ur(g,d):null;if(typeof h=="number")return h;let{key:y,note:k}=u_(f,p);k&&z(k);let _=o.includes("--agent"),I=_?l:u&&h.agent==="codex"?"codex":l;u&&_&&(l??"claude")!==(h.agent??"claude")&&z(`"${h.name}" is a ${h.agent??"claude"} profile \u2014 a ${l??"claude"}-lane binding for it never fires`);let S=Lh(I);if(!u&&g[S][y]===void 0)return v(`nothing bound to ${y} in the ${I??"claude"} lane`),0;let T=await Nr(f,j=>({profiles:j.profiles,...Uh({bindings:j.bindings,codexBindings:j.codexBindings},y,u?h.id:null,I)}));return Lr(T,()=>{u?$(`bound ${y} \u2192 ${h.name} [${I??"claude"}]`):$(`unbound ${y} [${I??"claude"}]`),r&&K({ok:!0,repo:y,lane:I??"claude",...u?{profile:h.id}:{unbound:!0}})})}default:return E(nr,2)}}async function p_(e=[]){let t=e[0],r=e.slice(1).join(" ").trim();if(!t||!r)return x("Usage: acbridge rename <device> <new name>"),2;let o=await _r();if(!o.ok)return x(o.message),3;let n=await q("/local/devices",{method:"GET",timeoutMs:5e3});if(n.hubOffline||n.status!==200||!n.body)return x(Fe()),1;let i=Kn(n.body.devices,t);if(!i.ok){if(i.kind==="ambiguous"){x(`"${t}" matches several devices:`);for(let l of i.candidates)v(` ${l.name} (${l.id})`)}else x(`no device matches "${t}" \u2014 try \`acbridge devices\``);return 2}let s={deviceId:i.device.id,name:r},a=await q("/local/rename",{method:"POST",body:s,timeoutMs:8e3});return!a.hubOffline&&a.status===200&&a.body?.ok?($(`renamed ${i.device.name} \u2192 ${r}`),0):(x(a.body?.error??`rename failed (HTTP ${a.status??"offline"})`),1)}import{spawn as RU}from"node:child_process";import{chmodSync as OU,openSync as DU,writeFileSync as NU}from"node:fs";var LU="Usage: acbridge start [--no-revert] [--attach] [--json]",m_=35;function UU(e){let t=e.daemonPidRaw?Number(e.daemonPidRaw):0;return t>0&&(e.identifiable||e.hubUp)?"already-running":t>0?"stale-pid":"proceed"}function jU(e,t){return e.daemonAlive?e.hubUp&&(t||e.session==="active"||e.session==="unavailable")?"ready":"waiting":"died"}async function Ul(e=[]){let t=e.includes("--json");t&&be(!0);let r=e.includes("--no-revert"),o=e.includes("--attach"),n=e.find(f=>!["--json","--no-revert","--attach"].includes(f));if(n!==void 0)return x(`unknown option: ${n}`),v(LU),2;let i=await Fo();if(!i.ok)return x(i.message),i.exitCode;await Ut(de().relayUrl);let s=N(Qe),a=s?Number(s):0,l=UU({daemonPidRaw:s,identifiable:a>0&&jo({pid:a}),hubUp:await Ne()});if(l==="already-running")return $(`bridge already running (daemon pid ${a})`),t&&K({started:!1,alreadyRunning:!0}),0;l==="stale-pid"&&(ve(Qe),se("removed a stale daemon.pid")),ve(Si);let u=r?["--no-revert"]:[];if(o)return v("running the bridge keeper in the foreground (Ctrl-C to stop)\u2026"),fl(u);let d=Kw(u);NU(Ln,"",{mode:384}),OU(Ln,384);let p=DU(Ln,"a"),m=RU(d.file,d.args,{cwd:ln,detached:!0,stdio:["ignore",p,p],env:process.env});m.unref(),se(`bridge keeper starting (pid ${m.pid??"?"})`);for(let f=0;f<m_;f++){await FU(1e3);let g={daemonAlive:m.pid?aa(m.pid):!1,hubUp:await Ne(),session:await zU()},h=jU(g,r);if(h==="ready"){let y=r?"revert-on-stop off":g.session==="active"?"revert-on-stop armed":"session probe unavailable (older hub)";return $(`bridge running \u2014 hub up, ${y}`),v("stop it with: acbridge stop"),t&&K({started:!0,revertOnStop:!r,session:g.session}),0}if(h==="died"){x("the bridge keeper exited during startup");let y=N(Ln);return y&&v(me(f_(y,8))),1}}x(`timed out waiting for the bridge to come up (${m_}s)`);for(let f of[Ln,wt]){let g=N(f);g?.trim()&&v(me(f_(g,6)))}return 1}async function zU(){let e=await q("/local/session",{method:"GET",timeoutMs:3e3});return e.hubOffline||e.status!==200||!e.body?"unavailable":e.body.active?"active":"inactive"}function f_(e,t){return e.trimEnd().split(`
|
|
277
|
+
`):(process.stdout.write(e),o=!0)},n.question(e).then(i=>{n.close(),t(i)})})}var li={isTTY:()=>process.stdin.isTTY===!0&&process.stdout.isTTY===!0,write:e=>process.stdout.write(e),ask:az,askMasked:cz};function X$(e,t,n){e.write(`${t}
|
|
278
|
+
`),n.forEach((o,r)=>{e.write(` ${r+1}) ${o.label}${o.hint?` \u2014 ${o.hint}`:""}
|
|
279
|
+
`)})}function Y$(e,t){let n=e.trim().toLowerCase();if(!n)return null;if(/^[0-9]+$/.test(n)){let r=Number(n);return r>=1&&r<=t.length?r-1:null}let o=t.flatMap((r,i)=>r.label.toLowerCase().startsWith(n)?[i]:[]);return o.length===1?o[0]:null}async function Zr(e,t,n,o={}){X$(e,t,n);let r=o.def!==void 0?` [${o.def+1}]`:"";for(;;){let i=(await e.ask(`> ${r?r.trim()+" ":""}`)).trim();if(!i&&o.def!==void 0)return o.def;let s=i?Y$(i,n):null;if(s!==null)return s;e.write(` Pick a number from the list (or a unique name prefix).
|
|
280
|
+
`)}}async function gu(e,t,n){for(X$(e,t,n);;){let o=(await e.ask("> (comma-separated, `all`, or empty for none) ")).trim();if(!o)return[];if(o.toLowerCase()==="all")return n.map((s,a)=>a);let r=new Set,i=!1;for(let s of o.split(",")){let a=Y$(s,n);if(a===null){i=!0;break}r.add(a)}if(!i)return[...r].sort((s,a)=>s-a);e.write(` Use numbers from the list (or unique name prefixes), separated by commas.
|
|
281
|
+
`)}}async function Fn(e,t,n){let o=n.def?"[Y/n]":"[y/N]",r=(await e.ask(`${t} ${o} `)).trim().toLowerCase();return r?r==="y"||r==="yes":n.def}async function ui(e,t,n={}){let o=n.def!==void 0?` [${n.def}]`:"",r=(await e.ask(`${t}${o}: `)).trim();return r||n.def||r}var qv=e=>({label:e.name,hint:e.type}),lz=e=>e.capabilities.some(t=>t.type==="color");async function Q$(e,t){let o=await Zr(e,"Which agent is this profile for?",[{label:"Claude",hint:"Claude Code sessions"},{label:"Codex",hint:"OpenAI Codex CLI sessions"}],{def:0})===1?"codex":void 0,r=await ui(e,"Profile name",{def:"New profile"}),i=[];t.devices.length>0?i=(await gu(e,"Which devices should this profile drive?",t.devices.map(qv))).map(d=>t.devices[d].id):e.write("(no devices connected yet \u2014 add some with `acbridge scan`, then `acbridge profiles set-state`)\n");let s=i.length>0?await Fn(e,"Pre-wire a starter scene set (working, needs permission, plan ready, error, finished, idle)?",{def:!0}):!1,a=await Fn(e,`Bind to this folder (${t.cwd}) for ${o??"claude"} sessions?`,{def:t.cwdLooksLikeRepo});return e.write(["",` name: ${r}`,` agent: ${o??"claude"}`,` devices: ${i.length===0?"none yet":i.length}`,` starter: ${s?"yes":"no"}`,` binding: ${a?t.cwd:"none"}`,""].join(`
|
|
282
|
+
`)),await Fn(e,"Save profile?",{def:!0})?{name:r,agent:o,deviceIds:i,starter:s,bindCwd:a}:null}async function uz(e,t,n){let o=Hs([]);if(n){let s=await Zr(e,"Colour",[{label:"Session",hint:"each session's own palette colour"},{label:"Main",hint:"the device's main colour"},{label:"Custom",hint:"a literal hue,saturation"},{label:"Keep",hint:"leave the colour axis as it is"}],{def:3});if(s===0)o.color="session";else if(s===1)o.color="main";else if(s===2){let l=(await ui(e,"Hue,Saturation (0-360,0-100)",{def:"200,80"})).split(",").map(u=>Number(u.trim()));l.length===2&&l.every(Number.isFinite)&&(o.color={hue:l[0],saturation:l[1]})}}let r=await Zr(e,"Brightness",[{label:"Keep",hint:"leave as it is"},{label:"Full",hint:"100%"},{label:"Dim",hint:"30% of the main brightness"},{label:"Custom %"}],{def:0});if(r===1)o.brightness=100;else if(r===2)o.scale=.3;else if(r===3){let s=Number(await ui(e,"Brightness %",{def:"60"}));Number.isFinite(s)&&(o.brightness=Math.max(0,Math.min(100,s)))}let i=await Zr(e,"Power",[{label:"Auto",hint:"on when the look has something to show"},{label:"Force on"},{label:"Force off"}],{def:0});return i===0?o.power="auto":i===1?o.power="on":i===2&&(o.power="off"),o}function dz(e,t){let n=fu(e,t);return[...n.curated,...n.advanced]}async function eE(e,t,n,o){let r=t,i=!1;for(;;){let s=await Zr(e,`Editing "${r.name}" (${r.agent??"claude"})`,[{label:"Rename"},{label:"Device scope",hint:`${r.deviceScope.length} device${r.deviceScope.length===1?"":"s"}`},{label:"Edit a state",hint:"looks, thresholds, enable/disable"},{label:"Done"}],{def:3});if(s===3)break;if(s===0){let S=await ui(e,"New name",{def:r.name});S&&S!==r.name&&(r=pn.parse({...r,name:S}),i=!0);continue}if(s===1){if(n.length===0){e.write("no devices connected \u2014 `acbridge scan` finds some first\n");continue}let S=await gu(e,"Devices this profile drives (replaces the current scope; EMPTY keeps it as is)",n.map(qv));if(S.length===0){e.write(` scope unchanged
|
|
283
|
+
`);continue}let E=S.map(N=>n[N].id),_=r.deviceScope.filter(N=>!E.includes(N)),I=Object.fromEntries(Object.entries(r.states).map(([N,M])=>[N,{...M,looks:M.looks.filter(q=>!_.includes(q.deviceId)),actions:M.actions.filter(q=>!_.includes(q.deviceId))}]));r=pn.parse({...r,deviceScope:E,states:I}),i=!0;continue}let a=dz(r.agent,o),l=await Zr(e,"Which state?",a.map(S=>({label:S.label,hint:S.hint}))),u=a[l],d=u.event,p=r.states[d]?.enabled??!0,m=await Fn(e,`Keep "${u.label}" enabled?`,{def:p}),f=n.filter(S=>r.deviceScope.includes(S.id)),g=[];f.length>0&&(g=(await gu(e,"Set the look on which devices?",f.map(qv))).map(E=>f[E]));let h=Hs([]);g.length>0&&(h=await uz(e,d,g.every(lz)),h.devices=g.map(S=>S.id)),h.enable=m;let y=gr[d];if(y){let S=r.states[d]?.threshold??y.default,E=await ui(e,`Fire at (${y.min}-${y.max} ${y.unitLabel})`,{def:String(S)}),_=Number(E);Number.isFinite(_)&&_>=y.min&&_<=y.max&&(h.threshold=_)}let x=Gs(r,d,h,g,[]);if(!x.ok){e.write(` ${x.message}
|
|
284
|
+
`);continue}for(let S of x.result.notes)e.write(` ${S}
|
|
285
|
+
`);r=x.result.profile,i=!0}return i?r:null}import{basename as tE}from"node:path";function nE(e){let t=L(e.workspaceFile);if(!t)return{doc:{},corrupt:!1};try{let n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?{doc:n,corrupt:!1}:{doc:{},corrupt:!0}}catch{return{doc:{},corrupt:!0}}}function hr(e){let t=nE(e).doc.repos;if(!Array.isArray(t))return[];let n=[];for(let o of t){if(!o||typeof o!="object")continue;let r=o;typeof r.path!="string"||!r.path||n.push({path:r.path,name:typeof r.name=="string"&&r.name?r.name:tE(r.path),bridge:typeof r.bridge=="string"&&r.bridge?r.bridge:tE(r.path),branch:typeof r.branch=="string"&&r.branch?r.branch:"\u2014",fav:r.fav===!0})}return n}function Ws(e,t){let n=nE(e);if(n.corrupt)throw new Error("workspace.json exists but isn't readable JSON \u2014 fix or remove it first (nothing was written)");let o={...n.doc,repos:t};_e(e.workspaceFile,`${JSON.stringify(o,null,2)}
|
|
286
|
+
`,384)}function rE(e,t,n){let o=e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{};return Object.entries(o).filter(r=>typeof r[1]=="string").map(([r,i])=>({repo:r,profile:n.get(i)??`${i} (missing)`,lane:t}))}function mz(e){let t=e??{},o=(Array.isArray(t.profiles)?t.profiles:[]).filter(s=>s!==null&&typeof s=="object").map(s=>({id:typeof s.id=="string"?s.id:"(unknown)",name:typeof s.name=="string"&&s.name.trim()?s.name:"(unnamed)",states:s.states!==null&&typeof s.states=="object"?Object.keys(s.states).length:0,agent:s.agent==="codex"?"codex":"claude"})),r=new Map(o.map(s=>[s.id,s.name])),i=[...rE(t.bindings,"claude",r),...rE(t.codexBindings,"codex",r)];return{profiles:o,bindings:i}}function fz(e){if(e.profiles.length===0)return["no profiles yet \u2014 create one: acbridge profiles create"];let t=e.profiles.map(n=>`${n.name.padEnd(24)} ${n.states} state${n.states===1?"":"s"}${n.agent==="codex"?" [codex]":""} (${n.id})`);if(e.bindings.length>0){t.push("","bindings (repo \u2192 profile):");for(let n of e.bindings)t.push(` ${n.repo} \u2192 ${n.profile} [${n.lane}]`)}return t}var gz={message:"Not signed in. Run `acbridge login` first.",exitCode:3};async function Mn(e,t){let n=(e.auth??(()=>Dt({notSignedIn:gz})))();if(!n.ok)return $(n.message,n.exitCode);let o=await(e.fetchConfig??vo)(n.token);return o===null?$("couldn't read the profiles document from the relay \u2014 check your connection",1):{token:n.token,config:o,voice:e.voice??ze(),json:t,deps:e}}var hz=Hv;async function Vr(e,t){try{return await(e.deps.commit??Qo)(e.token,n=>{if(Gv(n)==="malformed")throw new Error(hz);return G$(n,t(Ht(n)),e.voice)})}catch(n){return{outcome:"raced",message:n instanceof Error?n.message:String(n)}}}function qr(e,t){switch(e.outcome){case"committed":return t(e.version),0;case"unavailable":return $("couldn't read the profiles document from the relay \u2014 check your connection",1);case"conflict-exhausted":return $("profiles changed elsewhere (another device kept editing) \u2014 try again",1);case"raced":return $(e.message,1);default:return $(e.error??"couldn't save profiles",1)}}function Jr(e,t){let n=q$(e.profiles,t);return n.ok?n.profile:n.kind==="ambiguous"?$(`"${t}" matches more than one profile:
|
|
287
|
+
${n.candidates.map(o=>`${o.name} (${o.id})`).join(`
|
|
288
|
+
`)}`,2):$(`no profile matches "${t}" \u2014 see \`acbridge profiles\``,1)}async function Jv(e){let t=await(e.deps.graph??An)();return t&&"refusal"in t?$(t.refusal.message,t.refusal.exitCode):t?.doc.devices??[]}function Kv(e,t){let n=[];for(let o of t){let r=cr(e,o);if(!r.ok)return r.kind==="ambiguous"?`"${o}" matches more than one device: ${r.candidates.map(i=>i.name).join(" | ")}`:`no device matches "${o}" \u2014 see \`acbridge devices\``;n.push(r.device)}return n}function oE(e,t){if(t===void 0)return{key:(e.deps.cwd??(()=>process.cwd()))()};let n=(e.deps.repos??(()=>{let o=qe();return o?hr(o):null}))();if(n){let o=t.toLowerCase(),r=n.filter(i=>i.name.toLowerCase()===o||i.bridge.toLowerCase()===o);if(r.length===1)return{key:r[0].path}}return t.includes("/")||t.includes("\\")||t.startsWith(".")?{key:pz(t)}:{key:t,note:`"${t}" isn't in the repos list \u2014 stored as a NAME binding (matches any repo folder named ${t})`}}var vz=e=>{let t=e.indexOf("--agent");if(t===-1)return;let n=e[t+1];if(n!=="claude")return n==="codex"?"codex":"bad"},vr=["Usage: acbridge profiles [list] [--agent claude|codex] [--json]"," acbridge profiles show <profile> [--json]"," acbridge profiles states [--agent claude|codex] [--json]"," acbridge profiles create [<name>] [--agent claude|codex] [--devices <id|name>,...] [--starter] [--bind [<repo>]] [--json]"," acbridge profiles rename <profile> <new-name> [--json]"," acbridge profiles duplicate <profile> [<new-name>] [--json]"," acbridge profiles delete <profile> [--yes] [--json]"," acbridge profiles edit <profile>"," acbridge profiles set-state <profile> <state> [--device <d>]... [--color main|session|<h>,<s>|none]"," [--brightness <0-100>|none | --scale <0-2>] [--kelvin <k>|none] [--power on|off|auto]"," [--return main|session|hold|off] [--hold] [--effect-json '<spec>'] [--action <cap.cmd>]"," [--param k=v]... [--instance <i>] [--threshold <n>] [--models <m>,... [--direction becomes|leaves]]"," [--allow-security] [--announce on|off] [--enable|--disable] [--clear] [--clear-device <d>]..."," acbridge profiles bind <profile> [--repo <path|name>] [--agent claude|codex] [--json]"," acbridge profiles unbind [--repo <path|name>] [--agent claude|codex] [--json]"].join(`
|
|
289
|
+
`);async function iE(e=[],t={}){let n=e.includes("--json");n&&fe(!0);let o=e.filter(u=>u!=="--json"),r=o[0]&&!o[0].startsWith("--")?o[0]:"list",i=o[0]===r?o.slice(1):o,s=t.interactive??li.isTTY(),a=t.io??li,l=vz(o);if(l==="bad")return $("--agent takes claude | codex",2);switch(r){case"list":{let u=await Mn(t,n);if(typeof u=="number")return u;let d=mz(u.config),p=o.includes("--agent")?{...d,profiles:d.profiles.filter(m=>m.agent===(l??"claude"))}:d;if(n)V(p);else for(let m of fz(p))v(m);return 0}case"show":{let u=i[0];if(!u)return $(vr,2);let d=await Mn(t,n);if(typeof d=="number")return d;let p=Ht(d.config),m=Jr(p,u);if(typeof m=="number")return m;let f=Object.entries(p.bindings).filter(([,y])=>y===m.id).map(([y])=>y),g=Object.entries(p.codexBindings).filter(([,y])=>y===m.id).map(([y])=>y);if(n)return V({profile:m,bindings:{claude:f,codex:g}}),0;v(`${m.name} (${m.id}) \u2014 ${m.agent??"claude"}`),v(`scope: ${m.deviceScope.length===0?"no devices":m.deviceScope.join(", ")}`),v(`agent device awareness: ${m.agentDeviceAwareness?"on":"off"} (the in-chat device brief \u2014 see \`acbridge brief\`)`);let h=Object.keys(m.states);if(h.length===0)v("states: none configured \u2014 try `acbridge profiles set-state`");else{v("states:");for(let y of h){let x=m.states[y],S=[`${x.looks.length} look${x.looks.length===1?"":"s"}`,`${x.actions.length} action${x.actions.length===1?"":"s"}`,...x.threshold!==void 0?[`fires at ${x.threshold}`]:[],...x.enabled?[]:["disabled"]];v(` ${y.padEnd(18)} ${S.join(", ")}`)}}for(let y of f)v(`bound: ${y} [claude]`);for(let y of g)v(`bound: ${y} [codex]`);return 0}case"states":{let u=t.voice??ze(),d=fu(l,u);if(n){let p=m=>({event:m.event,label:m.label,hint:m.hint,...m.threshold?{threshold:m.threshold}:{}});return V({agent:l??"claude",curated:d.curated.map(p),advanced:d.advanced.map(p)}),0}v(ce(`states a ${l??"claude"} profile can react to (use the left column with set-state):`));for(let[p,m]of[["curated",d.curated],["advanced",d.advanced]]){v(`${p}:`);for(let f of m){let g=f.threshold?` (threshold ${f.threshold.min}-${f.threshold.max} ${f.threshold.unitLabel}, default ${f.threshold.defaultPct})`:"";v(` ${f.event.padEnd(18)} ${f.label} \u2014 ${f.hint}${g}`)}}return 0}case"create":{let u=await Mn(t,n);if(typeof u=="number")return u;let d=i.filter((B,D)=>!B.startsWith("--")&&!["--agent","--devices","--bind"].includes(i[D-1]??"")),p=d[0];if(d.length>1)return $("one profile name (quote names with spaces)",2);let m=i.includes("--starter"),f=[],g=i.indexOf("--devices");if(g!==-1){let B=i[g+1];if(!B||B.startsWith("--"))return $("--devices takes a comma-separated list",2);f=B.split(",").map(D=>D.trim()).filter(Boolean)}let h=i.indexOf("--bind"),y=null;if(h!==-1){let B=i[h+1];y=B&&!B.startsWith("--")&&!d.includes(B)?B:void 0}let x=l,S=[],E=[],_=s&&!n&&i.length===0;if(f.length>0||_){let B=await Jv(u);if(typeof B=="number")return B;E=B}if(_){let B=(t.cwd??(()=>process.cwd()))(),D=await Q$(a,{devices:E,cwd:B,cwdLooksLikeRepo:!0});if(!D)return v("nothing saved"),0;p=D.name,x=D.agent,S=D.deviceIds,m=D.starter,y=D.bindCwd?void 0:null}else if(f.length>0){let B=Kv(E,f);if(typeof B=="string")return $(B,2);S=B.map(D=>D.id)}m&&S.length===0&&(j("--starter needs devices to wire \u2014 creating a blank profile instead (add some with --devices)"),m=!1);let I=E.filter(B=>S.includes(B.id)).map(B=>({id:B.id,hasColor:B.capabilities.some(D=>D.type==="color")})),N=H$(p||"New profile",x),M=pn.parse({...N,deviceScope:S,states:m?J$(x,I):{}}),q=y===null?null:oE(u,y).key,he=await Vr(u,B=>({profiles:[...B.profiles,M],...q===null?{bindings:B.bindings,codexBindings:B.codexBindings}:Vv({bindings:B.bindings,codexBindings:B.codexBindings},q,M.id,x)}));return qr(he,()=>{A(`created "${M.name}" (${M.id})${m?" with the starter scene set":""}`),q!==null&&A(`bound ${q} \u2192 ${M.name} [${x??"claude"}]`),m||v(`wire a state next: acbridge profiles set-state ${M.id} working --device <name> --color session`),n&&V({ok:!0,profile:M})})}case"rename":{let[u,...d]=i,p=d.join(" ").trim();if(!u||!p)return $(vr,2);let m=await Mn(t,n);if(typeof m=="number")return m;let f=Jr(Ht(m.config),u);if(typeof f=="number")return f;let g=await Vr(m,h=>({...h,profiles:h.profiles.map(y=>y.id===f.id?{...y,name:p}:y)}));return qr(g,()=>{A(`renamed to "${p}"`),n&&V({ok:!0,id:f.id,name:p})})}case"duplicate":{let[u,...d]=i.filter(h=>!h.startsWith("--"));if(!u)return $(vr,2);let p=await Mn(t,n);if(typeof p=="number")return p;let m=Jr(Ht(p.config),u);if(typeof m=="number")return m;let f={...m,id:Wv(),name:d.join(" ").trim()||`${m.name||"Profile"} copy`},g=await Vr(p,h=>({...h,profiles:[...h.profiles,f]}));return qr(g,()=>{A(`duplicated "${m.name}" \u2192 "${f.name}" (${f.id})`),n&&V({ok:!0,profile:f})})}case"delete":{let u=i.includes("--yes"),d=i.filter(g=>!g.startsWith("--"))[0];if(!d)return $(vr,2);let p=await Mn(t,n);if(typeof p=="number")return p;let m=Jr(Ht(p.config),d);if(typeof m=="number")return m;if(!u){if(!s||n)return $(`deleting "${m.name}" needs --yes when not on a terminal`,2);if(!await Fn(a,`Delete "${m.name}" and unbind it everywhere?`,{def:!1}))return v("kept"),0}let f=await Vr(p,g=>({profiles:g.profiles.filter(h=>h.id!==m.id),bindings:Object.fromEntries(Object.entries(g.bindings).filter(([,h])=>h!==m.id)),codexBindings:Object.fromEntries(Object.entries(g.codexBindings).filter(([,h])=>h!==m.id))}));return qr(f,()=>{A(`deleted "${m.name}" (bindings in both lanes pruned)`),n&&V({ok:!0,deleted:m.id})})}case"edit":{let u=i[0];if(!u)return $(vr,2);if(!s||n)return $("`profiles edit` is interactive \u2014 use `profiles set-state` for scripting",2);let d=await Mn(t,n);if(typeof d=="number")return d;let p=Jr(Ht(d.config),u);if(typeof p=="number")return p;let m=await Jv(d);if(typeof m=="number")return m;let f=await eE(a,p,m,d.voice);if(!f)return v("no changes"),0;let g=await Vr(d,h=>{if(!h.profiles.some(y=>y.id===f.id))throw new Error(`"${p.name}" was deleted on another device while you edited \u2014 nothing saved`);return{...h,profiles:h.profiles.map(y=>y.id===f.id?f:y)}});return qr(g,()=>A(`saved "${f.name}"`))}case"set-state":{let[u,d,...p]=i;if(!u||!d)return $(vr,2);let m=Hs(p);if(m.bad)return $(m.bad,2);let f=await Mn(t,n);if(typeof f=="number")return f;let g=Jr(Ht(f.config),u);if(typeof g=="number")return g;if(!Ls.options.includes(d))return $(`"${d}" isn't a session state \u2014 see \`acbridge profiles states --agent ${g.agent??"claude"}\``,2);let h=d;if(!mu(g.agent,h))return $(`a ${g.agent??"claude"} profile can't react to "${h}" \u2014 see \`acbridge profiles states --agent ${g.agent??"claude"}\``,2);let y=[],x=[];if(m.devices.length>0||m.clearDevices.length>0){let _=await Jv(f);if(typeof _=="number")return _;let I=Kv(_,m.devices);if(typeof I=="string")return $(I,2);y=I;let N=Kv(_,m.clearDevices);if(typeof N=="string")return $(N,2);x=N}let S=Gs(g,h,m,y,x);if(!S.ok)return $(S.message,2);for(let _ of S.result.notes)A(_);let E=await Vr(f,_=>{let I=_.profiles.find(M=>M.id===g.id);if(!I)throw new Error(`"${g.name}" was deleted on another device \u2014 nothing saved`);let N=Gs(I,h,m,y,x);if(!N.ok)throw new Error(N.message);return{..._,profiles:_.profiles.map(M=>M.id===g.id?N.result.profile:M)}});return qr(E,_=>{A(`${g.name} \xB7 ${h} updated`),n&&V({ok:!0,profile:g.id,state:h,version:_})})}case"bind":case"unbind":{let u=r==="bind",d=u?i.filter((N,M)=>!N.startsWith("--")&&i[M-1]!=="--repo"&&i[M-1]!=="--agent")[0]:void 0;if(u&&!d)return $(vr,2);let p,m=i.indexOf("--repo");if(m!==-1&&(p=i[m+1],!p||p.startsWith("--")))return $("--repo needs a path or a repos-list name",2);let f=await Mn(t,n);if(typeof f=="number")return f;let g=Ht(f.config),h=u?Jr(g,d):null;if(typeof h=="number")return h;let{key:y,note:x}=oE(f,p);x&&j(x);let S=o.includes("--agent"),E=S?l:u&&h.agent==="codex"?"codex":l;u&&S&&(l??"claude")!==(h.agent??"claude")&&j(`"${h.name}" is a ${h.agent??"claude"} profile \u2014 a ${l??"claude"}-lane binding for it never fires`);let _=Zv(E);if(!u&&g[_][y]===void 0)return v(`nothing bound to ${y} in the ${E??"claude"} lane`),0;let I=await Vr(f,N=>({profiles:N.profiles,...Vv({bindings:N.bindings,codexBindings:N.codexBindings},y,u?h.id:null,E)}));return qr(I,()=>{u?A(`bound ${y} \u2192 ${h.name} [${E??"claude"}]`):A(`unbound ${y} [${E??"claude"}]`),n&&V({ok:!0,repo:y,lane:E??"claude",...u?{profile:h.id}:{unbound:!0}})})}default:return $(vr,2)}}async function sE(e=[]){let t=e[0],n=e.slice(1).join(" ").trim();if(!t||!n)return k("Usage: acbridge rename <device> <new name>"),2;let o=await Ur();if(!o.ok)return k(o.message),3;let r=await Z("/local/devices",{method:"GET",timeoutMs:5e3});if(r.hubOffline||r.status!==200||!r.body)return k(Re()),1;let i=cr(r.body.devices,t);if(!i.ok){if(i.kind==="ambiguous"){k(`"${t}" matches several devices:`);for(let l of i.candidates)v(` ${l.name} (${l.id})`)}else k(`no device matches "${t}" \u2014 try \`acbridge devices\``);return 2}let s={deviceId:i.device.id,name:n},a=await Z("/local/rename",{method:"POST",body:s,timeoutMs:8e3});return!a.hubOffline&&a.status===200&&a.body?.ok?(A(`renamed ${i.device.name} \u2192 ${n}`),0):(k(a.body?.error??`rename failed (HTTP ${a.status??"offline"})`),1)}import{spawn as yz}from"node:child_process";import{chmodSync as bz,openSync as xz,writeFileSync as kz}from"node:fs";var wz="Usage: acbridge start [--no-revert] [--attach] [--json]",aE=35;function Sz(e){let t=e.daemonPidRaw?Number(e.daemonPidRaw):0;return t>0&&(e.identifiable||e.hubUp)?"already-running":t>0?"stale-pid":"proceed"}function _z(e,t){return e.daemonAlive?e.hubUp&&(t||e.session==="active"||e.session==="unavailable")?"ready":"waiting":"died"}async function hu(e=[]){let t=e.includes("--json");t&&fe(!0);let n=e.includes("--no-revert"),o=e.includes("--attach"),r=e.find(g=>!["--json","--no-revert","--attach"].includes(g));if(r!==void 0){let g=$(`unknown option: ${r}`,2);return v(wz),g}let i=await ti();if(!i.ok)return $(i.message,i.exitCode);await Vt(le().relayUrl);let s=L(wt),a=s?Number(s):0,l=Sz({daemonPidRaw:s,identifiable:a>0&&Yo({pid:a}),hubUp:await Ue()});if(l==="already-running")return A(`bridge already running (daemon pid ${a})`),t&&V({started:!1,alreadyRunning:!0}),0;l==="stale-pid"&&(Ie(wt),X("removed a stale daemon.pid")),Ie(Mi);let u=n?["--no-revert"]:[];if(o)return v("running the bridge keeper in the foreground (Ctrl-C to stop)\u2026"),Vl(u);let d=uS(u);kz(Jn,"",{mode:384}),bz(Jn,384);let p=xz(Jn,"a"),m=yz(d.file,d.args,{cwd:xn,detached:!0,stdio:["ignore",p,p],env:process.env});m.unref(),X(`bridge keeper starting (pid ${m.pid??"?"})`);for(let g=0;g<aE;g++){await Ez(1e3);let h={daemonAlive:m.pid?za(m.pid):!1,hubUp:await Ue(),session:await $z()},y=_z(h,n);if(y==="ready"){let x=n?"revert-on-stop off":h.session==="active"?"revert-on-stop armed":"session probe unavailable (older hub)";return A(`bridge running \u2014 hub up, ${x}`),v("stop it with: acbridge stop"),t&&V({started:!0,revertOnStop:!n,session:h.session}),0}if(y==="died"){let x=$("the bridge keeper exited during startup",1),S=L(Jn);return S&&v(ce(cE(S,8))),x}}let f=$(`timed out waiting for the bridge to come up (${aE}s)`,1);for(let g of[Jn,Rt]){let h=L(g);h?.trim()&&v(ce(cE(h,6)))}return f}async function $z(){let e=await Z("/local/session",{method:"GET",timeoutMs:3e3});return e.hubOffline||e.status!==200||!e.body?"unavailable":e.body.active?"active":"inactive"}function cE(e,t){return e.trimEnd().split(`
|
|
279
290
|
`).slice(-t).join(`
|
|
280
|
-
`)}function
|
|
281
|
-
`),
|
|
282
|
-
${g.join(", ")}`:""}`)}return 0}case"add":{let m=
|
|
283
|
-
${
|
|
284
|
-
`)}`,2);if(!
|
|
285
|
-
${g.candidates.map(
|
|
286
|
-
`)}`,2);if(!g.group)return
|
|
287
|
-
`);async function
|
|
288
|
-
${
|
|
291
|
+
`)}function Ez(e){return new Promise(t=>setTimeout(t,e))}async function lE(e=[],t={}){let n=await(t.stop??fr)([]);return n!==0?n:(t.start??hu)(e)}var Zs=["Usage: acbridge groups [list] [--json]"," acbridge groups add <name>"," acbridge groups rename <id|name> <new-name>"," acbridge groups remove <id|name> [--yes]"," acbridge groups assign <device> <group>"," acbridge groups unassign <device> <group>"].join(`
|
|
292
|
+
`),Az={message:"Not signed in. Run `acbridge login` first.",exitCode:3};function vu(e){return e.deviceGroups!==void 0&&!Cl.safeParse(e.deviceGroups).success?"this account's device groups are unreadable by this CLI version \u2014 update acbridge (nothing was written)":null}function uE(e,t){let n=e.find(s=>s.id===t);if(n)return{group:n};let o=t.toLowerCase(),r=e.filter(s=>s.name.toLowerCase()===o);if(r.length===1)return{group:r[0]};let i=r.length>1?r:e.filter(s=>s.name.toLowerCase().includes(o));return i.length===1?{group:i[0]}:i.length>1?{candidates:i}:{}}function Iz(e,t,n,o){let r=Lr.safeParse(e.deviceSettings);if(e.deviceSettings!==void 0&&!r.success)return{error:"this machine's device settings are unreadable by this CLI version \u2014 update acbridge (nothing was written)"};let i=r.success?r.data:{},s=i[t]??Ko.parse({}),a=o?[...new Set([...s.groups,n])]:s.groups.filter(l=>l!==n);return{config:{...e,deviceSettings:{...i,[t]:{...s,groups:a}}}}}function Cz(e){let t=Lr.safeParse(e.deviceSettings),n=new Map;if(!t.success)return n;for(let[o,r]of Object.entries(t.data))for(let i of r.groups)n.set(i,[...n.get(i)??[],o]);return n}var Pz=()=>`grp_${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;function yu(e,t){return e.outcome==="committed"?(t(),0):e.outcome==="unavailable"?$("couldn't read the groups document from the relay \u2014 check your connection",1):e.outcome==="conflict-exhausted"?$("groups changed elsewhere \u2014 try again",1):$(e.error??"couldn't save groups",1)}async function dE(e=[],t={}){let n=e.includes("--json");n&&fe(!0);let o=e.includes("--yes"),r=e.filter(m=>m!=="--json"&&m!=="--yes"),i=r[0]??"list",s=t.interactive??li.isTTY(),a=t.io??li,l=(t.auth??(()=>Dt({notSignedIn:Az})))();if(!l.ok)return $(l.message,l.exitCode);let u=await(t.fetchConfig??vo)(l.token);if(u===null)return $("couldn't read the groups document from the relay \u2014 check your connection",1);let d=_s(u),p=t.commit??Qo;switch(i){case"list":{let m=Cz(u);if(n)return V({groups:d.map(f=>({...f,devices:m.get(f.id)??[]}))}),0;if(d.length===0)v("no groups yet \u2014 add one: acbridge groups add <name>");else for(let f of d){let g=m.get(f.id)??[];v(`${f.name.padEnd(20)} ${g.length} device${g.length===1?"":"s"} ${ce(`(${f.id})`)}${g.length>0?`
|
|
293
|
+
${g.join(", ")}`:""}`)}return 0}case"add":{let m=r.slice(1).join(" ").trim();if(!m)return $(Zs,2);let f=vu(u);if(f)return $(f,1);let g=Pz(),h=await p(l.token,y=>{let x=vu(y);if(x)throw new Error(x);return K0(y,g,m)??y});return yu(h,()=>{A(`added "${m}" (${g})`),n&&V({ok:!0,id:g,name:m})})}case"rename":case"remove":case"assign":case"unassign":{if(i==="rename"||i==="remove"){let _=r[1];if(!_)return $(Zs,2);let I=uE(d,_);if(I.candidates)return $(`"${_}" matches more than one group:
|
|
294
|
+
${I.candidates.map(M=>`${M.name} (${M.id})`).join(`
|
|
295
|
+
`)}`,2);if(!I.group)return $(`no group matches "${_}" \u2014 see \`acbridge groups\``,1);if(i==="rename"){let M=r.slice(2).join(" ").trim();if(!M)return $(Zs,2);let q=vu(u);if(q)return $(q,1);let he=await p(l.token,B=>{let D=vu(B);if(D)throw new Error(D);return X0(B,I.group.id,M)??B});return yu(he,()=>{A(`renamed "${I.group.name}" \u2192 "${M}"`),n&&V({ok:!0,id:I.group.id,name:M})})}if(!o){if(!s||n)return $(`removing "${I.group.name}" prunes its membership from every device \u2014 add --yes`,2);if(!await Fn(a,`Remove "${I.group.name}" and prune it from every device?`,{def:!1}))return v("kept"),0}let N=await p(l.token,M=>Y0(M,I.group.id));return yu(N,()=>{A(`removed "${I.group.name}" (membership pruned from every device)`),n&&V({ok:!0,removed:I.group.id})})}let m=r[1],f=r[2];if(!m||!f)return $(Zs,2);let g=uE(d,f);if(g.candidates)return $(`"${f}" matches more than one group:
|
|
296
|
+
${g.candidates.map(_=>`${_.name} (${_.id})`).join(`
|
|
297
|
+
`)}`,2);if(!g.group)return $(`no group matches "${f}" \u2014 see \`acbridge groups\``,1);let h=await(t.graph??An)();if(h&&"refusal"in h)return $(h.refusal.message,h.refusal.exitCode);let y=h&&"doc"in h?h.doc.devices:[],x=cr(y,m);if(!x.ok)return $(x.kind==="ambiguous"?`"${m}" matches more than one device: ${x.candidates.map(_=>_.name).join(" | ")}`:`no device matches "${m}" \u2014 see \`acbridge devices\``,2);let S=i==="assign",E=await p(l.token,_=>{let I=Iz(_,x.device.id,g.group.id,S);if("error"in I)throw new Error(I.error);return I.config}).catch(_=>({outcome:"error",error:_ instanceof Error?_.message:String(_)}));return yu(E,()=>{A(`${x.device.name} ${S?"\u2192":"\xD7"} ${g.group.name}`),n&&V({ok:!0,deviceId:x.device.id,group:g.group.id,member:S})})}default:return $(Zs,2)}}var Tz=/^\/\/(?:wsl\.localhost|wsl\$)\/([^/]+)(\/.*)?$/i,Rz=/^\/mnt\/([a-zA-Z])(\/.*)?$/;var Oz=e=>e.replace(/\\/g,"/");function pE(e){let t=Oz(e),n=Tz.exec(t);if(n)return n[2]??"/";let o=Rz.exec(t);return o?`${o[1]?.toLowerCase()}:${o[2]??"/"}`.toLowerCase():/^[a-zA-Z]:/.test(t)?t.toLowerCase():t}function Xv(e,t){let n=pE(e.replace(/\\/g,"/")),o=pE(t.replace(/\\/g,"/"));if(o===n)return!0;let r=n.endsWith("/")?n:n+"/";return!!(o.startsWith(r)||!n.includes("/")&&o.replace(/\/+$/,"").split("/").pop()?.toLowerCase()===n.toLowerCase())}import{existsSync as Dz,statSync as Nz}from"node:fs";import{resolve as mE}from"node:path";var di=["Usage: acbridge repos [list] [--refresh] [--json]"," acbridge repos add <path> [--root] [--name <label>] [--json]"," acbridge repos remove <path|name> [--json]"].join(`
|
|
298
|
+
`);async function Lz(){let e=Jt();if(e.state!=="ok")return null;let t=await vo(e.token);if(!t)return null;let n=Ht(t);return{bindings:n.bindings,codexBindings:n.codexBindings}}function Uz(e){try{return Dz(e)&&Nz(e).isDirectory()}catch{return!1}}function jz(e){if(e.length===0)return["no bridges yet \u2014 add one: acbridge repos add <path>"];let t=Math.max(6,...e.map(r=>(r.bridge||r.name).length)),n=Math.max(6,...e.map(r=>r.branch.length)),o=[ce(`${"BRIDGE".padEnd(t+2)}${"BRANCH".padEnd(n+2)}PATH`)];for(let r of e)o.push(`${r.fav?"\u2605 ":" "}${(r.bridge||r.name).padEnd(t)}${r.branch.padEnd(n+2)}${r.path}`.trimEnd());return o}function Yv(e,t){let n=mE(t),o=e.find(a=>a.path===t||a.path===n);if(o)return{row:o};let r=t.toLowerCase(),i=e.filter(a=>a.name.toLowerCase()===r||a.bridge.toLowerCase()===r);if(i.length===1)return{row:i[0]};if(i.length>1)return{candidates:i};let s=e.filter(a=>a.name.toLowerCase().startsWith(r)||a.bridge.toLowerCase().startsWith(r));return s.length===1?{row:s[0]}:s.length>1?{candidates:s}:{}}async function fE(e=[],t={}){try{return await zz(e,t)}catch(n){return $(n instanceof Error?n.message:String(n),1)}}async function zz(e,t){let n=e.includes("--json");n&&fe(!0);let o=e.filter(a=>a!=="--json"),r=o[0]??"list",i=(t.paths??qe)();if(!i)return $("Not signed in. Run `acbridge login` first.",3);let s=a=>{if(n)V({repos:a});else for(let l of jz(a))v(l);return 0};switch(r){case"list":{let a=o.includes("--refresh");if(o.filter(u=>u!=="--refresh").length>1)return $(di,2);let l=hr(i);return a&&(l=ox(l),Ws(i,l)),s(l)}case"add":{let a=!1,l,u=[],d=o.slice(1);for(let h=0;h<d.length;h+=1){let y=d[h];if(y==="--root")a=!0;else if(y==="--name"){if(l=d[h+1],!l||l.startsWith("--"))return $(di,2);h+=1}else{if(y.startsWith("--"))return $(`unknown flag: ${y}
|
|
299
|
+
${di}`,2);u.push(y)}}let p=u[0];if(!p||u.length>1)return $(di,2);if(a&&l!==void 0)return $("--name labels ONE bridge \u2014 it can't apply to a --root import.",2);let m=mE(p);if(!Uz(m))return $(`not a folder: ${m}`,2);let f=hr(i),g=rx(f,m,a?"root":"single");return g.length===f.length?l!==void 0&&!a?(g=bd(f,m,{bridge:l}),Ws(i,g),A("already in the list \u2014 label updated"),s(g)):(A(a?"nothing new under that root \u2014 every subfolder is already in the list":"already in the list"),s(f)):(l!==void 0&&(g=bd(g,m,{bridge:l})),Ws(i,g),A(`added ${g.length-f.length} bridge${g.length-f.length===1?"":"s"}`),s(g))}case"remove":{let a=o[1];if(!a||o.length>2)return $(di,2);let l=hr(i),u=Yv(l,a);if(u.candidates)return $(`"${a}" matches more than one bridge:
|
|
289
300
|
${u.candidates.map(m=>`${m.name} (${m.path})`).join(`
|
|
290
|
-
`)}`,2);if(!u.row)return
|
|
301
|
+
`)}`,2);if(!u.row)return $(`no bridge matches "${a}" \u2014 see \`acbridge repos list\``,1);let d=await(t.fetchBindings??Lz)();if(d){let m=[...Object.keys(d.bindings).filter(f=>Xv(f,u.row.path)).map(f=>`claude: ${f}`),...Object.keys(d.codexBindings).filter(f=>Xv(f,u.row.path)).map(f=>`codex: ${f}`)];m.length>0&&j(`this repo still has profile bindings (they keep firing \u2014 unbind with \`acbridge profiles unbind\`):
|
|
291
302
|
${m.join(`
|
|
292
|
-
`)}`)}let p=l.filter(m=>m.path!==u.row.path);return bs(i,p),$(`removed ${u.row.bridge||u.row.name}`),s(p)}default:return E(Xo,2)}}import{spawnSync as rI}from"node:child_process";import{randomUUID as c2}from"node:crypto";import{existsSync as l2,mkdirSync as u2,statSync as d2,writeFileSync as p2}from"node:fs";import m2 from"node:os";import Os from"node:path";import{createInterface as f2}from"node:readline";import{spawn as Hz,spawnSync as Zz}from"node:child_process";import{randomUUID as Gz}from"node:crypto";import{readFileSync as Wz}from"node:fs";import{request as Vz}from"node:http";import{createInterface as qz}from"node:readline";import{readFileSync as Ez}from"node:fs";var xz=rn(g$(),1),kz=rn(ql(),1),wz=rn(ei(),1),Sz=rn(Qh(),1),_z=rn(nv(),1),$z=rn(cv(),1),As=rn(Yl(),1),Iz=rn(S$(),1);var _$=100;function $$(e){let t=null,r=!1,o=1e3,n=null,i=[],s=()=>"endpoint"in e?e.endpoint():{port:e.port,tokenFile:e.tokenFile},a=p=>{try{return Ez(p,"utf8").trim()}catch(m){return console.error(`[channel] cannot read hub token file ${p}:`,m),""}},l=p=>(i.push(p),i.length>_$&&(i.shift(),console.error(`[channel] outbound buffer at cap (${_$}); dropped oldest frame`)),!0),u=p=>{for(;i.length>0&&p.readyState===As.default.OPEN;){let m=i.shift();m&&p.send(JSON.stringify(m))}},d=()=>{if(r)return;let{port:p,tokenFile:m}=s(),f=a(m),g=new As.default(`ws://${e.host??"127.0.0.1"}:${p}`,{headers:{"x-bridge-hub-token":f}});t=g;let h=!0,y=null;g.on("open",()=>{o=1e3;let k=e.hello?.();k&&g.send(JSON.stringify(k)),u(g),h=!0,y=setInterval(()=>{if(!h){g.terminate();return}h=!1;try{g.ping()}catch{}},3e4)}),g.on("pong",()=>{h=!0}),g.on("message",k=>{try{e.onMessage(Ew(k.toString()))}catch(_){console.error("[channel] bad hub frame:",_)}}),g.on("error",k=>console.error("[channel] hub ws error:",k)),g.on("close",()=>{if(y&&(clearInterval(y),y=null),t===g&&(t=null),r)return;let k=o;o=Math.min(o*2,5e3),n=setTimeout(d,k)})};return d(),{send:p=>{if(r)return!1;let m=t;return m&&m.readyState===As.default.OPEN&&i.length===0?(m.send(JSON.stringify(p)),!0):l(p)},close:()=>{r=!0,n&&clearTimeout(n),t?.close()}}}var ce=e=>e;var I$=ce({id:"ActivateScene",target:"hub",customHandler:!0,scaffold:!0,carrier:"scene",utterances:["activate {scene} scene","activate scene {scene}","run scene {scene}","start {scene} scene"],slots:[{name:"scene",type:"SceneName",dynamic:!0,elicitationPrompts:["Which scene?"]}],customTypes:[{name:"SceneName",values:["movie night","good morning","bedtime","focus"]}],deviceCommands:[{capability:"scene",command:"activate"}],args:c.object({scene:c.string()}),result:c.object({ok:c.boolean()}),fromSlots:e=>({scene:e.scene??""}),ackSpeech:()=>"",speak:()=>""});var E$=ce({id:"Attach",target:"hub",skillLocal:!0,carrier:"attach",utterances:["attach to {target}","attach","switch to {target}","use {target}"],slots:[{name:"target",type:"SessionName",required:!0,dynamic:!0,elicitationPrompts:["Which session?","Which one would you like to attach to?"]}],customTypes:[{name:"SessionName",values:["one","two","three","four","five","six","seven","eight","nine","ten"]}],args:c.object({target:c.string()}),result:c.object({name:c.string()}),precheck:(e,t)=>t.sessionCount===0?"No sessions are running yet.":null,fromSlots:e=>({target:e.target??""}),ackSpeech:()=>"",speak:e=>`Entered ${e.name}.`});var A$=ce({id:"AttachBridge",target:"hub",skillLocal:!0,attachLevel:"bridge",carrier:"bridge",utterances:["attach to bridge {bridge}","switch to bridge {bridge}","open bridge {bridge}","go to bridge {bridge}"],slots:[{name:"bridge",type:"BridgeName",required:!0,dynamic:!0,elicitationPrompts:["Which bridge?","Which bridge would you like to attach to?"]}],customTypes:[{name:"BridgeName",values:["one","two","three","four","five","six","seven","eight","nine","ten"]}],args:c.object({target:c.string()}),result:c.object({name:c.string()}),precheck:(e,t)=>(t.bridgeCount??0)===0?"No bridges have a running session yet.":null,fromSlots:e=>({target:e.bridge??""}),ackSpeech:()=>"",speak:e=>`Entered ${e.name}.`});var P$=ce({id:"ControlDevice",target:"hub",customHandler:!0,scaffold:!0,carrier:"turn",utterances:["turn on {device}","turn off {device}","turn on the {device}","turn off the {device}","toggle {device}"],slots:[{name:"device",type:"DeviceName",dynamic:!0,elicitationPrompts:["Which device?"]}],customTypes:[{name:"DeviceName",values:["light","lamp","fan","plug","heater"]}],deviceCommands:[{capability:"power",command:"turnOn"},{capability:"power",command:"turnOff"},{capability:"power",command:"toggle"}],args:c.object({device:c.string()}),result:c.object({ok:c.boolean()}),fromSlots:e=>({device:e.device??""}),ackSpeech:()=>"",speak:()=>""});var C$=ce({id:"ControlGroup",target:"hub",customHandler:!0,scaffold:!0,carrier:"group",utterances:["turn on the {group} group","turn off the {group} group","turn off {group} group"],slots:[{name:"group",type:"GroupName",dynamic:!0,elicitationPrompts:["Which group or room?"]}],customTypes:[{name:"GroupName",values:["living room","bedroom","kitchen","office","studio"]}],deviceCommands:[{capability:"power",command:"turnOn"},{capability:"power",command:"turnOff"}],args:c.object({group:c.string()}),result:c.object({ok:c.boolean()}),fromSlots:e=>({group:e.group??""}),ackSpeech:()=>"",speak:()=>""});var T$=e=>`In the current working directory, ${e}. Keep the answer brief enough to be read aloud.`;var R$=ce({id:"GitStatus",target:"session",carrier:"git",utterances:["git status","what's the git status","any uncommitted changes in git"],slots:[],args:c.object({}),result:c.object({}),fromSlots:()=>({}),ackSpeech:()=>"Asking git status.",speak:()=>"",render:()=>T$("run git status and report the current branch and any uncommitted changes")});var Az=c.object({index:c.number().int().positive(),name:c.string(),id:c.string(),sessionCount:c.number().int().nonnegative()}),O$=ce({id:"ListBridges",target:"hub",carrier:"bridge",utterances:["list bridges","list my bridges","what bridges do I have","what bridges are running","which bridges are running"],slots:[],args:c.object({}),result:c.object({bridges:c.array(Az)}),speaksResult:!0,cacheSource:"bridges",providesBridgeCatalog:!0,fromSlots:()=>({}),ackSpeech:()=>"",speak:e=>{let t=e.bridges.length;if(t===0)return"No bridges have a running session.";let r=e.bridges.map(o=>`${o.index}, ${o.name}`).join("; ");return`${t} bridge${t===1?"":"s"}: ${r}.`}});var Pz=c.object({name:c.string(),type:c.string(),room:c.string().nullable(),online:c.boolean()}),Cz=c.object({provider:c.string(),status:c.string()}),D$=ce({id:"ListDevices",target:"hub",carrier:"device",utterances:["list devices","list my devices","what devices do I have","what devices are online"],slots:[],args:c.object({}),result:c.object({devices:c.array(Pz),accounts:c.array(Cz)}),speaksResult:!0,cacheSource:"devices",fromSlots:()=>({}),ackSpeech:()=>"",speak:e=>{let t=e.accounts.filter(i=>i.status!=="linked"),r=t.length?` ${t.map(i=>`${i.provider} needs re-linking`).join("; ")}.`:"",o=e.devices.length;if(o===0)return`No devices are connected.${r}`;let n=e.devices.filter(i=>i.online).length;return`${o} device${o===1?"":"s"}, ${n} online.${r}`}});var Tz=c.object({index:c.number().int().positive(),name:c.string(),id:c.string()}),N$=ce({id:"ListSessions",target:"hub",carrier:"session",utterances:["list sessions","list my sessions","what sessions do I have","what sessions are running"],slots:[],args:c.object({}),result:c.object({sessions:c.array(Tz)}),speaksResult:!0,cacheSource:"sessions",providesSessionCatalog:!0,fromSlots:()=>({}),ackSpeech:()=>"",speak:e=>{let t=e.sessions.length;if(t===0)return"No sessions are running.";let r=e.sessions.map(o=>`${o.index}, ${o.name}`).join("; ");return`${t} session${t===1?"":"s"}: ${r}.`}});var L$=ce({id:"ReadMore",target:"hub",carrier:"more",utterances:["read more","continue reading","keep reading"],slots:[],args:c.object({}),result:Qc,speaksResult:!0,cacheSource:"output",fromSlots:()=>({}),ackSpeech:()=>"",speak:e=>e.latestReply?e.hasMore?`${e.latestReply} Say read more to continue.`:e.latestReply:"That's the end of the output."});var U$=ce({id:"ReadOutput",target:"hub",carrier:"output",utterances:["read output","read the output","what's the output","read reply","read the reply","what's the reply","read the last reply","read it","replies","read replies","dev replies","any replies","latest reply"],slots:[],args:c.object({}),result:Qc,speaksResult:!0,cacheSource:"output",fromSlots:()=>({}),ackSpeech:()=>"",speak:e=>e.latestReply?e.hasMore?`${e.latestReply} Say read more to continue.`:e.latestReply:"No output yet."});var Rz=c.object({index:c.number().int().positive(),name:c.string(),id:c.string(),sessionCount:c.number().int().nonnegative()}),j$=ce({id:"RenameBridge",target:"hub",relayMutation:!0,customHandler:!0,carrier:"bridge",utterances:["rename bridge {bridge}","rename a bridge","rename this bridge","rename the bridge","rename this bridge to {name}","rename the bridge to {name}","call the bridge {name}"],slots:[{name:"bridge",type:"BridgeName",dynamic:!0},{name:"name",type:"AMAZON.SearchQuery",allowFreeText:!0}],args:c.object({name:c.string(),bridgeId:c.string().optional()}),result:c.object({bridges:c.array(Rz)}),providesBridgeCatalog:!0,precheck:e=>e.name.trim()?null:"What would you like to call it?",fromSlots:e=>({name:(e.name??"").trim()}),ackSpeech:e=>`Okay, I'll call it ${e.name}.`,speak:()=>""});var Oz=c.object({index:c.number().int().positive(),name:c.string(),id:c.string()}),z$=ce({id:"RenameSession",target:"hub",relayMutation:!0,customHandler:!0,carrier:"rename",utterances:["rename","rename a session","rename this session","rename the session","rename it","rename {target}","rename session {target}","rename to {name}","rename this session to {name}","call it {name}"],slots:[{name:"target",type:"SessionName",dynamic:!0},{name:"name",type:"AMAZON.SearchQuery",allowFreeText:!0}],args:c.object({name:c.string()}),result:c.object({sessions:c.array(Oz)}),providesSessionCatalog:!0,precheck:e=>e.name.trim()?null:"What would you like to call it?",fromSlots:e=>({name:(e.name??"").trim()}),ackSpeech:e=>`Okay, I'll call it ${e.name}.`,speak:()=>""});var F$=ce({id:"Return",target:"hub",skillLocal:!0,clearsAttach:!0,carrier:"return",utterances:["return","go back","back to the main menu","main menu","leave the session","leave this session"],slots:[],args:c.object({}),result:c.object({}),fromSlots:()=>({}),ackSpeech:()=>"",speak:()=>"Back at the main menu."});var M$=ce({id:"SetBrightness",target:"hub",customHandler:!0,scaffold:!0,carrier:"brightness",utterances:["set brightness of {device} to {level}","set {device} brightness to {level}","dim {device} to {level}"],slots:[{name:"device",type:"DeviceName",dynamic:!0,elicitationPrompts:["Which device?"]},{name:"level",type:"AMAZON.NUMBER",elicitationPrompts:["What level, 0 to 100?"]}],customTypes:[{name:"DeviceName",values:["light","lamp","fan","plug","heater"]}],deviceCommands:[{capability:"brightness",command:"setBrightness"}],args:c.object({device:c.string(),level:c.number()}),result:c.object({ok:c.boolean()}),fromSlots:e=>({device:e.device??"",level:Number(e.level??0)}),ackSpeech:()=>"",speak:()=>""});var B$=ce({id:"SetTemperature",target:"hub",customHandler:!0,scaffold:!0,carrier:"temperature",utterances:["set temperature of {device} to {temperature}","set {device} temperature to {temperature}","set {device} to {temperature} degrees"],slots:[{name:"device",type:"DeviceName",dynamic:!0,elicitationPrompts:["Which thermostat?"]},{name:"temperature",type:"AMAZON.NUMBER",elicitationPrompts:["What temperature?"]}],customTypes:[{name:"DeviceName",values:["light","lamp","fan","plug","heater"]}],deviceCommands:[{capability:"thermostat",command:"setSetpoint"}],args:c.object({device:c.string(),temperature:c.number()}),result:c.object({ok:c.boolean()}),fromSlots:e=>({device:e.device??"",temperature:Number(e.temperature??0)}),ackSpeech:()=>"",speak:()=>""});var H$=[I$,E$,A$,P$,C$,R$,O$,D$,N$,L$,U$,j$,z$,F$,M$,B$],Z$=new Map(H$.map(e=>[e.id,e])),l7=new Map(H$.map(e=>[`${e.id}Intent`,e]));function G$(e){if(e.type==="prompt")return e.text;let t=Z$.get(e.id);if(!t?.render)throw new Error(`channel got command "${e.id}" with no render() \u2014 not a session-target command`);return t.render(t.args.parse(e.args))}var Dz=new Set(["item/commandExecution/requestApproval","item/fileChange/requestApproval","item/permissions/requestApproval"]);function W$(e){return{decision:e}}var Nz="Added to the current turn.",V$="late verdict dropped",Lz="approve? [y/n/a]",uv="Codex restarted before this prompt ran \u2014 please resend.",Uz=16e3;function Pe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function q$(e){let t=e.replace(/\\/g,"/").replace(/\/+$/,""),r=t.lastIndexOf("/");return(r>=0?t.slice(r+1):t)||e}function J$(e){return(Array.isArray(e)?e.map(String).join(" "):typeof e=="string"?e:"").replace(/\s+/g," ").trim()}function jz(e){return e.replace(/^```.*\n?/gm,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1")}function zz(e,t){return e.length>t?e.slice(0,t):e}function Fz(e){let t=Pe(e),r=t.codexErrorInfo,o=typeof r=="string"?r:r&&typeof r=="object"?String(Pe(r).kind??Pe(r).code??""):"",n=typeof t.message=="string"?t.message:"",i=`${o} ${n}`;return/usagelimitexceeded/i.test(i)?"rateLimited":/contextwindowexceeded/i.test(i)?"contextCritical":"error"}function Mz(e,t,r,o,n){let i=Pe(t);switch(e){case"item/commandExecution/requestApproval":{let s=J$(i.command),a=typeof i.cwd=="string"&&i.cwd?i.cwd:n,{command:l,cwd:u,...d}=i;return{type:"permission_request",sessionId:r,requestId:o,tool:"Shell",description:`\`${s}\` in ${q$(a)}`,preview:JSON.stringify({command:s,cwd:a,...d})}}case"item/fileChange/requestApproval":{let a=(Array.isArray(i.files)?i.files:[]).map(d=>typeof d=="string"?d:Pe(d).path).filter(d=>typeof d=="string"&&d.length>0),l=a.slice(0,3).map(q$).join(", "),u=a.length>3?", \u2026":"";return{type:"permission_request",sessionId:r,requestId:o,tool:"File change",description:`edit ${a.length} file(s): ${l}${u}`,preview:JSON.stringify(i)}}case"item/permissions/requestApproval":{let s=typeof i.mode=="string"?i.mode:typeof i.requestedMode=="string"?i.requestedMode:"unknown";return{type:"permission_request",sessionId:r,requestId:o,tool:"Permissions",description:`escalate sandbox to ${s}`,preview:JSON.stringify(i)}}default:return{type:"permission_request",sessionId:r,requestId:o,tool:"Approval",description:"approve this action?",preview:JSON.stringify(i)}}}var eu=class{sessionId;cwd;steerSupported;newSeq;turnInFlight=!1;owner=null;queue=[];pendingApprovals=new Map;lastApprovalRequestId=null;planReadyFired=!1;pendingSteerAcks=new Set;constructor(t){this.sessionId=t.sessionId,this.cwd=t.cwd,this.steerSupported=t.steerSupported,this.newSeq=t.newSeq}setSteerSupported(t){this.steerSupported=t}handle(t){switch(t.kind){case"hub":return this.onHub(t.msg);case"notification":return this.onNotification(t.method,t.params);case"server-request":return this.onServerRequest(t.id,t.method,t.params);case"local-line":return this.onLocalInput(t.text);case"local-approval":return this.onLocalApproval(t.behavior);case"steer-ok":return this.onSteerOk(t.requestId);case"sigint":return this.turnInFlight?[{kind:"rpc",method:"turn/interrupt"}]:this.endSession();case"teardown":return this.endSession();case"server-exit":return this.onServerExit();default:return[]}}onHub(t){switch(t.type){case"prompt":return this.onHubInput(t.requestId,t.text);case"command":return this.onHubInput(t.requestId,G$(t));case"permission_verdict":return this.onHubVerdict(t.requestId,t.behavior);default:return[]}}onHubInput(t,r){return this.turnInFlight?this.steerSupported?(this.pendingSteerAcks.add(t),[{kind:"rpc",method:"turn/steer",params:{text:r}}]):(this.queue.push({source:"hub",requestId:t,text:r}),[]):this.startTurn({kind:"hub",requestId:t},r)}onLocalInput(t){return this.turnInFlight?this.steerSupported?[{kind:"rpc",method:"turn/steer",params:{text:t}}]:(this.queue.push({source:"local",text:t}),[]):this.startTurn({kind:"local"},t)}startTurn(t,r){this.turnInFlight=!0,this.owner=t;let o=[{kind:"rpc",method:"turn/start",params:{text:r}}];return t.kind==="hub"&&o.push({kind:"render",channel:"voice",text:`[alexa] ${r}`}),o}onSteerOk(t){return this.pendingSteerAcks.has(t)?(this.pendingSteerAcks.delete(t),[this.replyAction(t,Nz)]):[]}replyAction(t,r){return{kind:"hub-send",msg:{type:"reply",sessionId:this.sessionId,requestId:t,seq:this.newSeq(),text:r,final:!0}}}statePost(t,r){return{kind:"state-post",state:t,event:`codex-adapter:${r}`}}onNotification(t,r){switch(t){case"turn/started":return this.planReadyFired=!1,[this.statePost("working","turn-started")];case"turn/completed":return this.onTurnCompleted(r);case"item/agentMessage/delta":return this.onAgentDelta(r);case"item/started":return this.onItemStarted(r);case"item/completed":return this.onItemCompleted(r);case"item/commandExecution/outputDelta":return this.onOutputDelta(r);case"turn/plan/updated":return this.onPlanUpdated(r);case"thread/tokenUsage/updated":return this.onTokenUsage(r);default:return[]}}onTurnCompleted(t){let r=Pe(t),o=Pe(r.turn),n=typeof o.status=="string"?o.status:typeof r.status=="string"?r.status:"",i=o.error??r.error,s=[];if(n==="completed")s.push(this.statePost("finished","turn-completed"));else if(n==="failed"){if(this.owner?.kind==="hub"){let a=Pe(i),l=typeof a.message=="string"?a.message:"unknown error";s.push(this.replyAction(this.owner.requestId,`Codex hit an error: ${l}`))}s.push(this.statePost(Fz(i),"turn-failed"))}else n==="interrupted"&&s.push(this.statePost("idle","turn-interrupted"));return s.push(...this.finishTurnAndDrain()),s}finishTurnAndDrain(){this.turnInFlight=!1,this.owner=null;let t=this.queue.shift();return t?t.source==="hub"?this.startTurn({kind:"hub",requestId:t.requestId},t.text):this.startTurn({kind:"local"},t.text):[]}onAgentDelta(t){let r=Pe(t).delta;return typeof r=="string"&&r?[{kind:"render",channel:"agent",text:r}]:[]}onItemStarted(t){let r=Pe(Pe(t).item);return r.type==="commandExecution"?[{kind:"render",channel:"tool",text:`$ ${J$(r.command)}`}]:[]}onItemCompleted(t){let r=Pe(Pe(t).item);if(r.type==="agentMessage"){if(this.owner?.kind!=="hub")return[];let o=zz(jz(typeof r.text=="string"?r.text:""),Uz);return[this.replyAction(this.owner.requestId,o)]}if(r.type==="commandExecution"){let o=r.exitCode;return[{kind:"render",channel:"tool",text:typeof o=="number"?`(exit ${o})`:"(done)"}]}return[]}onOutputDelta(t){let r=Pe(t).delta;return typeof r=="string"&&r?[{kind:"render",channel:"tool",text:r}]:[]}onPlanUpdated(t){let r=Pe(t).plan;if(!Array.isArray(r))return[];let o=r.map(n=>({kind:"render",channel:"meta",text:`- ${String(n)}`}));return this.planReadyFired||(this.planReadyFired=!0,o.push(this.statePost("planReady","plan-updated"))),o}onTokenUsage(t){let r=Pe(t),o=Pe(r.tokenUsage),n=Pe(o.total),i=Pe(o.last),s=m=>typeof m=="number"&&Number.isFinite(m)?m:void 0,a=[],l=s(n.inputTokens),u=s(n.outputTokens);l!==void 0&&u!==void 0&&a.push({kind:"usage-post",inputTokens:l,cachedInputTokens:s(n.cachedInputTokens)??0,outputTokens:u});let d=s(i.totalTokens),p=s(o.modelContextWindow);if(d!==void 0&&p!==void 0&&p>0){let m=Math.round(d/p*1e3)/10;a.push({kind:"context-post",pct:m,usedTokens:d,windowTokens:p})}return a}onServerRequest(t,r,o){if(!Dz.has(r))return[];let n=`codex-approval-${this.newSeq()}`,i=Mz(r,o,this.sessionId,n,this.cwd);this.pendingApprovals.set(n,{serverRequestId:t}),this.lastApprovalRequestId=n;let s=r==="item/permissions/requestApproval"?"sandboxEscalation":"needs_permission";return[{kind:"hub-send",msg:i},this.statePost(s,"approval-requested"),{kind:"render",channel:"meta",text:Lz}]}onHubVerdict(t,r){let o=r==="allow"?"accept":"decline",n={kind:"render",channel:"voice",text:r==="allow"?"[alexa] approved":"[alexa] denied"};return this.resolveApproval(t,o,n)}onLocalApproval(t){let r=this.lastApprovalRequestId;if(!r)return[{kind:"render",channel:"meta",text:V$}];let o=t==="allow"?"accept":t==="allow-session"?"acceptForSession":"decline",n=t==="allow"?"approved":t==="allow-session"?"approved for session":"denied";return this.resolveApproval(r,o,{kind:"render",channel:"meta",text:n})}resolveApproval(t,r,o){let n=this.pendingApprovals.get(t);if(!n)return[{kind:"render",channel:"meta",text:V$}];this.pendingApprovals.delete(t),this.lastApprovalRequestId===t&&(this.lastApprovalRequestId=null);let i=r==="decline";return[{kind:"rpc-respond",id:n.serverRequestId,result:W$(r)},this.statePost(i?"permissionDenied":"working",i?"approval-denied":"approval-allowed"),o]}endSession(){let t=[...this.pendingApprovals.values()].map(r=>({kind:"rpc-respond",id:r.serverRequestId,result:W$("decline")}));return this.pendingApprovals.clear(),this.lastApprovalRequestId=null,this.pendingSteerAcks.clear(),[this.statePost("ended","teardown"),...t,{kind:"exit"}]}onServerExit(){let t=[];this.turnInFlight&&t.push(this.statePost("error","server-exit"));for(let r of this.queue)r.source==="hub"&&t.push(this.replyAction(r.requestId,uv));return this.queue=[],this.turnInFlight=!1,this.owner=null,this.pendingApprovals.clear(),this.lastApprovalRequestId=null,this.pendingSteerAcks.clear(),t}};import Bz from"node:path";function K$(e,t){let r=Bz.basename(e)||"session";return{id:`${r}@${t}+codex`,name:`${r} codex (${t})`}}function X$(e){let{sub:t,...r}=e;return{...r,voice:!0,agent:"codex",...t?{sub:t}:{}}}var Ps=class extends Error{code;constructor(t,r){super(`codex app-server error ${t}: ${r}`),this.name="AppServerError",this.code=t}};function dv(e,t){let r=1,o=!1,n="",i=new Map,s=[],a=[],l=[];function u(k){o||e.write(`${JSON.stringify(k)}
|
|
293
|
-
`)}function d(
|
|
294
|
-
`))>=0;){let
|
|
295
|
-
`);return}if(t==="tool"){this.out.write(
|
|
303
|
+
`)}`)}let p=l.filter(m=>m.path!==u.row.path);return Ws(i,p),A(`removed ${u.row.bridge||u.row.name}`),s(p)}default:return $(di,2)}}import{spawnSync as YA}from"node:child_process";import{randomUUID as V4}from"node:crypto";import{existsSync as q4,mkdirSync as J4,statSync as K4,writeFileSync as X4}from"node:fs";import Y4 from"node:os";import oa from"node:path";import{createInterface as Q4}from"node:readline";import{spawn as O4,spawnSync as D4}from"node:child_process";import{randomUUID as N4}from"node:crypto";import{readFileSync as L4}from"node:fs";import{request as U4}from"node:http";import{createInterface as j4}from"node:readline";import{readFileSync as m4}from"node:fs";var s4=gn(lA(),1),a4=gn(Au(),1),c4=gn(fi(),1),l4=gn(ly(),1),u4=gn(py(),1),d4=gn(yy(),1),ea=gn(Tu(),1),p4=gn(vA(),1);var yA=100;function bA(e){let t=null,n=!1,o=1e3,r=null,i=[],s=()=>"endpoint"in e?e.endpoint():{port:e.port,tokenFile:e.tokenFile},a=p=>{try{return m4(p,"utf8").trim()}catch(m){return console.error(`[channel] cannot read hub token file ${p}:`,m),""}},l=p=>(i.push(p),i.length>yA&&(i.shift(),console.error(`[channel] outbound buffer at cap (${yA}); dropped oldest frame`)),!0),u=p=>{for(;i.length>0&&p.readyState===ea.default.OPEN;){let m=i.shift();m&&p.send(JSON.stringify(m))}},d=()=>{if(n)return;let{port:p,tokenFile:m}=s(),f=a(m),g=new ea.default(`ws://${e.host??"127.0.0.1"}:${p}`,{headers:{"x-bridge-hub-token":f}});t=g;let h=!0,y=null;g.on("open",()=>{o=1e3;let x=e.hello?.();x&&g.send(JSON.stringify(x)),u(g),h=!0,y=setInterval(()=>{if(!h){g.terminate();return}h=!1;try{g.ping()}catch{}},e.heartbeatMs??3e4)}),g.on("pong",()=>{h=!0}),g.on("message",x=>{try{e.onMessage(NS(x.toString()))}catch(S){console.error("[channel] bad hub frame:",S)}}),g.on("error",x=>console.error("[channel] hub ws error:",x)),g.on("close",()=>{if(y&&(clearInterval(y),y=null),t===g&&(t=null),n)return;let x=o;o=Math.min(o*2,5e3),r=setTimeout(d,x)})};return d(),{send:p=>{if(n)return!1;let m=t;return m&&m.readyState===ea.default.OPEN&&i.length===0?(m.send(JSON.stringify(p)),!0):l(p)},close:()=>{n=!0,r&&clearTimeout(r),t?.close()}}}var de=e=>e;var xA=de({id:"ActivateScene",target:"hub",customHandler:!0,scaffold:!0,carrier:"scene",utterances:["activate {scene} scene","activate scene {scene}","run scene {scene}","start {scene} scene"],slots:[{name:"scene",type:"SceneName",dynamic:!0,elicitationPrompts:["Which scene?"]}],customTypes:[{name:"SceneName",values:["movie night","good morning","bedtime","focus"]}],deviceCommands:[{capability:"scene",command:"activate"}],args:c.object({scene:c.string()}),result:c.object({ok:c.boolean()}),fromSlots:e=>({scene:e.scene??""}),ackSpeech:()=>"",speak:()=>""});var kA=de({id:"Attach",target:"hub",skillLocal:!0,carrier:"attach",utterances:["attach to {target}","attach","switch to {target}","use {target}"],slots:[{name:"target",type:"SessionName",required:!0,dynamic:!0,elicitationPrompts:["Which session?","Which one would you like to attach to?"]}],customTypes:[{name:"SessionName",values:["one","two","three","four","five","six","seven","eight","nine","ten"]}],args:c.object({target:c.string()}),result:c.object({name:c.string()}),precheck:(e,t)=>t.sessionCount===0?"No sessions are running yet.":null,fromSlots:e=>({target:e.target??""}),ackSpeech:()=>"",speak:e=>`Entered ${e.name}.`});var wA=de({id:"AttachBridge",target:"hub",skillLocal:!0,attachLevel:"bridge",carrier:"bridge",utterances:["attach to bridge {bridge}","switch to bridge {bridge}","open bridge {bridge}","go to bridge {bridge}"],slots:[{name:"bridge",type:"BridgeName",required:!0,dynamic:!0,elicitationPrompts:["Which bridge?","Which bridge would you like to attach to?"]}],customTypes:[{name:"BridgeName",values:["one","two","three","four","five","six","seven","eight","nine","ten"]}],args:c.object({target:c.string()}),result:c.object({name:c.string()}),precheck:(e,t)=>(t.bridgeCount??0)===0?"No bridges have a running session yet.":null,fromSlots:e=>({target:e.bridge??""}),ackSpeech:()=>"",speak:e=>`Entered ${e.name}.`});var SA=de({id:"ControlDevice",target:"hub",customHandler:!0,scaffold:!0,carrier:"turn",utterances:["turn on {device}","turn off {device}","turn on the {device}","turn off the {device}","toggle {device}"],slots:[{name:"device",type:"DeviceName",dynamic:!0,elicitationPrompts:["Which device?"]}],customTypes:[{name:"DeviceName",values:["light","lamp","fan","plug","heater"]}],deviceCommands:[{capability:"power",command:"turnOn"},{capability:"power",command:"turnOff"},{capability:"power",command:"toggle"}],args:c.object({device:c.string()}),result:c.object({ok:c.boolean()}),fromSlots:e=>({device:e.device??""}),ackSpeech:()=>"",speak:()=>""});var _A=de({id:"ControlGroup",target:"hub",customHandler:!0,scaffold:!0,carrier:"group",utterances:["turn on the {group} group","turn off the {group} group","turn off {group} group"],slots:[{name:"group",type:"GroupName",dynamic:!0,elicitationPrompts:["Which group or room?"]}],customTypes:[{name:"GroupName",values:["living room","bedroom","kitchen","office","studio"]}],deviceCommands:[{capability:"power",command:"turnOn"},{capability:"power",command:"turnOff"}],args:c.object({group:c.string()}),result:c.object({ok:c.boolean()}),fromSlots:e=>({group:e.group??""}),ackSpeech:()=>"",speak:()=>""});var $A=e=>`In the current working directory, ${e}. Keep the answer brief enough to be read aloud.`;var EA=de({id:"GitStatus",target:"session",carrier:"git",utterances:["git status","what's the git status","any uncommitted changes in git"],slots:[],args:c.object({}),result:c.object({}),fromSlots:()=>({}),ackSpeech:()=>"Asking git status.",speak:()=>"",render:()=>$A("run git status and report the current branch and any uncommitted changes")});var f4=c.object({index:c.number().int().positive(),name:c.string(),id:c.string(),sessionCount:c.number().int().nonnegative()}),AA=de({id:"ListBridges",target:"hub",carrier:"bridge",utterances:["list bridges","list my bridges","what bridges do I have","what bridges are running","which bridges are running"],slots:[],args:c.object({}),result:c.object({bridges:c.array(f4)}),speaksResult:!0,cacheSource:"bridges",providesBridgeCatalog:!0,fromSlots:()=>({}),ackSpeech:()=>"",speak:e=>{let t=e.bridges.length;if(t===0)return"No bridges have a running session.";let n=e.bridges.map(o=>`${o.index}, ${o.name}`).join("; ");return`${t} bridge${t===1?"":"s"}: ${n}.`}});var g4=c.object({name:c.string(),type:c.string(),room:c.string().nullable(),online:c.boolean()}),h4=c.object({provider:c.string(),status:c.string()}),IA=de({id:"ListDevices",target:"hub",carrier:"device",utterances:["list devices","list my devices","what devices do I have","what devices are online"],slots:[],args:c.object({}),result:c.object({devices:c.array(g4),accounts:c.array(h4)}),speaksResult:!0,cacheSource:"devices",fromSlots:()=>({}),ackSpeech:()=>"",speak:e=>{let t=e.accounts.filter(i=>i.status!=="linked"),n=t.length?` ${t.map(i=>`${i.provider} needs re-linking`).join("; ")}.`:"",o=e.devices.length;if(o===0)return`No devices are connected.${n}`;let r=e.devices.filter(i=>i.online).length;return`${o} device${o===1?"":"s"}, ${r} online.${n}`}});var v4=c.object({index:c.number().int().positive(),name:c.string(),id:c.string()}),CA=de({id:"ListSessions",target:"hub",carrier:"session",utterances:["list sessions","list my sessions","what sessions do I have","what sessions are running"],slots:[],args:c.object({}),result:c.object({sessions:c.array(v4)}),speaksResult:!0,cacheSource:"sessions",providesSessionCatalog:!0,fromSlots:()=>({}),ackSpeech:()=>"",speak:e=>{let t=e.sessions.length;if(t===0)return"No sessions are running.";let n=e.sessions.map(o=>`${o.index}, ${o.name}`).join("; ");return`${t} session${t===1?"":"s"}: ${n}.`}});var PA=de({id:"ReadMore",target:"hub",carrier:"more",utterances:["read more","continue reading","keep reading"],slots:[],args:c.object({}),result:Fl,speaksResult:!0,cacheSource:"output",fromSlots:()=>({}),ackSpeech:()=>"",speak:e=>e.latestReply?e.hasMore?`${e.latestReply} Say read more to continue.`:e.latestReply:"That's the end of the output."});var TA=de({id:"ReadOutput",target:"hub",carrier:"output",utterances:["read output","read the output","what's the output","read reply","read the reply","what's the reply","read the last reply","read it","replies","read replies","dev replies","any replies","latest reply"],slots:[],args:c.object({}),result:Fl,speaksResult:!0,cacheSource:"output",fromSlots:()=>({}),ackSpeech:()=>"",speak:e=>e.latestReply?e.hasMore?`${e.latestReply} Say read more to continue.`:e.latestReply:"No output yet."});var y4=c.object({index:c.number().int().positive(),name:c.string(),id:c.string(),sessionCount:c.number().int().nonnegative()}),RA=de({id:"RenameBridge",target:"hub",relayMutation:!0,customHandler:!0,carrier:"bridge",utterances:["rename bridge {bridge}","rename a bridge","rename this bridge","rename the bridge","rename this bridge to {name}","rename the bridge to {name}","call the bridge {name}"],slots:[{name:"bridge",type:"BridgeName",dynamic:!0},{name:"name",type:"AMAZON.SearchQuery",allowFreeText:!0}],args:c.object({name:c.string(),bridgeId:c.string().optional()}),result:c.object({bridges:c.array(y4)}),providesBridgeCatalog:!0,precheck:e=>e.name.trim()?null:"What would you like to call it?",fromSlots:e=>({name:(e.name??"").trim()}),ackSpeech:e=>`Okay, I'll call it ${e.name}.`,speak:()=>""});var b4=c.object({index:c.number().int().positive(),name:c.string(),id:c.string()}),OA=de({id:"RenameSession",target:"hub",relayMutation:!0,customHandler:!0,carrier:"rename",utterances:["rename","rename a session","rename this session","rename the session","rename it","rename {target}","rename session {target}","rename to {name}","rename this session to {name}","call it {name}"],slots:[{name:"target",type:"SessionName",dynamic:!0},{name:"name",type:"AMAZON.SearchQuery",allowFreeText:!0}],args:c.object({name:c.string()}),result:c.object({sessions:c.array(b4)}),providesSessionCatalog:!0,precheck:e=>e.name.trim()?null:"What would you like to call it?",fromSlots:e=>({name:(e.name??"").trim()}),ackSpeech:e=>`Okay, I'll call it ${e.name}.`,speak:()=>""});var DA=de({id:"Return",target:"hub",skillLocal:!0,clearsAttach:!0,carrier:"return",utterances:["return","go back","back to the main menu","main menu","leave the session","leave this session"],slots:[],args:c.object({}),result:c.object({}),fromSlots:()=>({}),ackSpeech:()=>"",speak:()=>"Back at the main menu."});var NA=de({id:"SetBrightness",target:"hub",customHandler:!0,scaffold:!0,carrier:"brightness",utterances:["set brightness of {device} to {level}","set {device} brightness to {level}","dim {device} to {level}"],slots:[{name:"device",type:"DeviceName",dynamic:!0,elicitationPrompts:["Which device?"]},{name:"level",type:"AMAZON.NUMBER",elicitationPrompts:["What level, 0 to 100?"]}],customTypes:[{name:"DeviceName",values:["light","lamp","fan","plug","heater"]}],deviceCommands:[{capability:"brightness",command:"setBrightness"}],args:c.object({device:c.string(),level:c.number()}),result:c.object({ok:c.boolean()}),fromSlots:e=>({device:e.device??"",level:Number(e.level??0)}),ackSpeech:()=>"",speak:()=>""});var LA=de({id:"SetTemperature",target:"hub",customHandler:!0,scaffold:!0,carrier:"temperature",utterances:["set temperature of {device} to {temperature}","set {device} temperature to {temperature}","set {device} to {temperature} degrees"],slots:[{name:"device",type:"DeviceName",dynamic:!0,elicitationPrompts:["Which thermostat?"]},{name:"temperature",type:"AMAZON.NUMBER",elicitationPrompts:["What temperature?"]}],customTypes:[{name:"DeviceName",values:["light","lamp","fan","plug","heater"]}],deviceCommands:[{capability:"thermostat",command:"setSetpoint"}],args:c.object({device:c.string(),temperature:c.number()}),result:c.object({ok:c.boolean()}),fromSlots:e=>({device:e.device??"",temperature:Number(e.temperature??0)}),ackSpeech:()=>"",speak:()=>""});var UA=[xA,kA,wA,SA,_A,EA,AA,IA,CA,PA,TA,RA,OA,DA,NA,LA],jA=new Map(UA.map(e=>[e.id,e])),ine=new Map(UA.map(e=>[`${e.id}Intent`,e]));function zA(e){if(e.type==="prompt")return e.text;let t=jA.get(e.id);if(!t?.render)throw new Error(`channel got command "${e.id}" with no render() \u2014 not a session-target command`);return t.render(t.args.parse(e.args))}var x4=new Set(["item/commandExecution/requestApproval","item/fileChange/requestApproval","item/permissions/requestApproval"]);function FA(e){return{decision:e}}var k4="Added to the current turn.",MA="late verdict dropped",w4="approve? [y/n/a]",xy="Codex restarted before this prompt ran \u2014 please resend.",S4=16e3;function Ne(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function BA(e){let t=e.replace(/\\/g,"/").replace(/\/+$/,""),n=t.lastIndexOf("/");return(n>=0?t.slice(n+1):t)||e}function HA(e){return(Array.isArray(e)?e.map(String).join(" "):typeof e=="string"?e:"").replace(/\s+/g," ").trim()}function _4(e){return e.replace(/^```.*\n?/gm,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1")}function $4(e,t){return e.length>t?e.slice(0,t):e}function E4(e){let t=Ne(e),n=t.codexErrorInfo,o=typeof n=="string"?n:n&&typeof n=="object"?String(Ne(n).kind??Ne(n).code??""):"",r=typeof t.message=="string"?t.message:"",i=`${o} ${r}`;return/usagelimitexceeded/i.test(i)?"rateLimited":/contextwindowexceeded/i.test(i)?"contextCritical":"error"}function A4(e,t,n,o,r){let i=Ne(t);switch(e){case"item/commandExecution/requestApproval":{let s=HA(i.command),a=typeof i.cwd=="string"&&i.cwd?i.cwd:r,{command:l,cwd:u,...d}=i;return{type:"permission_request",sessionId:n,requestId:o,tool:"Shell",description:`\`${s}\` in ${BA(a)}`,preview:JSON.stringify({command:s,cwd:a,...d})}}case"item/fileChange/requestApproval":{let a=(Array.isArray(i.files)?i.files:[]).map(d=>typeof d=="string"?d:Ne(d).path).filter(d=>typeof d=="string"&&d.length>0),l=a.slice(0,3).map(BA).join(", "),u=a.length>3?", \u2026":"";return{type:"permission_request",sessionId:n,requestId:o,tool:"File change",description:`edit ${a.length} file(s): ${l}${u}`,preview:JSON.stringify(i)}}case"item/permissions/requestApproval":{let s=typeof i.mode=="string"?i.mode:typeof i.requestedMode=="string"?i.requestedMode:"unknown";return{type:"permission_request",sessionId:n,requestId:o,tool:"Permissions",description:`escalate sandbox to ${s}`,preview:JSON.stringify(i)}}default:return{type:"permission_request",sessionId:n,requestId:o,tool:"Approval",description:"approve this action?",preview:JSON.stringify(i)}}}var Ou=class{sessionId;cwd;steerSupported;newSeq;turnInFlight=!1;owner=null;queue=[];pendingApprovals=new Map;lastApprovalRequestId=null;planReadyFired=!1;pendingSteerAcks=new Set;constructor(t){this.sessionId=t.sessionId,this.cwd=t.cwd,this.steerSupported=t.steerSupported,this.newSeq=t.newSeq}setSteerSupported(t){this.steerSupported=t}handle(t){switch(t.kind){case"hub":return this.onHub(t.msg);case"notification":return this.onNotification(t.method,t.params);case"server-request":return this.onServerRequest(t.id,t.method,t.params);case"local-line":return this.onLocalInput(t.text);case"local-approval":return this.onLocalApproval(t.behavior);case"steer-ok":return this.onSteerOk(t.requestId);case"sigint":return this.turnInFlight?[{kind:"rpc",method:"turn/interrupt"}]:this.endSession();case"teardown":return this.endSession();case"server-exit":return this.onServerExit();default:return[]}}onHub(t){switch(t.type){case"prompt":return this.onHubInput(t.requestId,t.text);case"command":return this.onHubInput(t.requestId,zA(t));case"permission_verdict":return this.onHubVerdict(t.requestId,t.behavior);default:return[]}}onHubInput(t,n){return this.turnInFlight?this.steerSupported?(this.pendingSteerAcks.add(t),[{kind:"rpc",method:"turn/steer",params:{text:n}}]):(this.queue.push({source:"hub",requestId:t,text:n}),[]):this.startTurn({kind:"hub",requestId:t},n)}onLocalInput(t){return this.turnInFlight?this.steerSupported?[{kind:"rpc",method:"turn/steer",params:{text:t}}]:(this.queue.push({source:"local",text:t}),[]):this.startTurn({kind:"local"},t)}startTurn(t,n){this.turnInFlight=!0,this.owner=t;let o=[{kind:"rpc",method:"turn/start",params:{text:n}}];return t.kind==="hub"&&o.push({kind:"render",channel:"voice",text:`[alexa] ${n}`}),o}onSteerOk(t){return this.pendingSteerAcks.has(t)?(this.pendingSteerAcks.delete(t),[this.replyAction(t,k4)]):[]}replyAction(t,n){return{kind:"hub-send",msg:{type:"reply",sessionId:this.sessionId,requestId:t,seq:this.newSeq(),text:n,final:!0}}}statePost(t,n){return{kind:"state-post",state:t,event:`codex-adapter:${n}`}}onNotification(t,n){switch(t){case"turn/started":return this.planReadyFired=!1,[this.statePost("working","turn-started")];case"turn/completed":return this.onTurnCompleted(n);case"item/agentMessage/delta":return this.onAgentDelta(n);case"item/started":return this.onItemStarted(n);case"item/completed":return this.onItemCompleted(n);case"item/commandExecution/outputDelta":return this.onOutputDelta(n);case"turn/plan/updated":return this.onPlanUpdated(n);case"thread/tokenUsage/updated":return this.onTokenUsage(n);default:return[]}}onTurnCompleted(t){let n=Ne(t),o=Ne(n.turn),r=typeof o.status=="string"?o.status:typeof n.status=="string"?n.status:"",i=o.error??n.error,s=[];if(r==="completed")s.push(this.statePost("finished","turn-completed"));else if(r==="failed"){if(this.owner?.kind==="hub"){let a=Ne(i),l=typeof a.message=="string"?a.message:"unknown error";s.push(this.replyAction(this.owner.requestId,`Codex hit an error: ${l}`))}s.push(this.statePost(E4(i),"turn-failed"))}else r==="interrupted"&&s.push(this.statePost("idle","turn-interrupted"));return s.push(...this.finishTurnAndDrain()),s}finishTurnAndDrain(){this.turnInFlight=!1,this.owner=null;let t=this.queue.shift();return t?t.source==="hub"?this.startTurn({kind:"hub",requestId:t.requestId},t.text):this.startTurn({kind:"local"},t.text):[]}onAgentDelta(t){let n=Ne(t).delta;return typeof n=="string"&&n?[{kind:"render",channel:"agent",text:n}]:[]}onItemStarted(t){let n=Ne(Ne(t).item);return n.type==="commandExecution"?[{kind:"render",channel:"tool",text:`$ ${HA(n.command)}`}]:[]}onItemCompleted(t){let n=Ne(Ne(t).item);if(n.type==="agentMessage"){if(this.owner?.kind!=="hub")return[];let o=$4(_4(typeof n.text=="string"?n.text:""),S4);return[this.replyAction(this.owner.requestId,o)]}if(n.type==="commandExecution"){let o=n.exitCode;return[{kind:"render",channel:"tool",text:typeof o=="number"?`(exit ${o})`:"(done)"}]}return[]}onOutputDelta(t){let n=Ne(t).delta;return typeof n=="string"&&n?[{kind:"render",channel:"tool",text:n}]:[]}onPlanUpdated(t){let n=Ne(t).plan;if(!Array.isArray(n))return[];let o=n.map(r=>({kind:"render",channel:"meta",text:`- ${String(r)}`}));return this.planReadyFired||(this.planReadyFired=!0,o.push(this.statePost("planReady","plan-updated"))),o}onTokenUsage(t){let n=Ne(t),o=Ne(n.tokenUsage),r=Ne(o.last),i=u=>typeof u=="number"&&Number.isFinite(u)?u:void 0,s=[],a=i(r.totalTokens),l=i(o.modelContextWindow);if(a!==void 0&&l!==void 0&&l>0){let u=Math.round(a/l*1e3)/10;s.push({kind:"context-post",pct:u,usedTokens:a,windowTokens:l})}return s}onServerRequest(t,n,o){if(!x4.has(n))return[];let r=`codex-approval-${this.newSeq()}`,i=A4(n,o,this.sessionId,r,this.cwd);this.pendingApprovals.set(r,{serverRequestId:t}),this.lastApprovalRequestId=r;let s=n==="item/permissions/requestApproval"?"sandboxEscalation":"needs_permission";return[{kind:"hub-send",msg:i},this.statePost(s,"approval-requested"),{kind:"render",channel:"meta",text:w4}]}onHubVerdict(t,n){let o=n==="allow"?"accept":"decline",r={kind:"render",channel:"voice",text:n==="allow"?"[alexa] approved":"[alexa] denied"};return this.resolveApproval(t,o,r)}onLocalApproval(t){let n=this.lastApprovalRequestId;if(!n)return[{kind:"render",channel:"meta",text:MA}];let o=t==="allow"?"accept":t==="allow-session"?"acceptForSession":"decline",r=t==="allow"?"approved":t==="allow-session"?"approved for session":"denied";return this.resolveApproval(n,o,{kind:"render",channel:"meta",text:r})}resolveApproval(t,n,o){let r=this.pendingApprovals.get(t);if(!r)return[{kind:"render",channel:"meta",text:MA}];this.pendingApprovals.delete(t),this.lastApprovalRequestId===t&&(this.lastApprovalRequestId=null);let i=n==="decline";return[{kind:"rpc-respond",id:r.serverRequestId,result:FA(n)},this.statePost(i?"permissionDenied":"working",i?"approval-denied":"approval-allowed"),o]}endSession(){let t=[...this.pendingApprovals.values()].map(n=>({kind:"rpc-respond",id:n.serverRequestId,result:FA("decline")}));return this.pendingApprovals.clear(),this.lastApprovalRequestId=null,this.pendingSteerAcks.clear(),[this.statePost("ended","teardown"),...t,{kind:"exit"}]}onServerExit(){let t=[];this.turnInFlight&&t.push(this.statePost("error","server-exit"));for(let n of this.queue)n.source==="hub"&&t.push(this.replyAction(n.requestId,xy));return this.queue=[],this.turnInFlight=!1,this.owner=null,this.pendingApprovals.clear(),this.lastApprovalRequestId=null,this.pendingSteerAcks.clear(),t}};import I4 from"node:path";function GA(e,t){let n=I4.basename(e)||"session";return{id:`${n}@${t}+codex`,name:`${n} codex (${t})`}}function WA(e){let{sub:t,...n}=e;return{...n,voice:!0,agent:"codex",...t?{sub:t}:{}}}var ta=class extends Error{code;constructor(t,n){super(`codex app-server error ${t}: ${n}`),this.name="AppServerError",this.code=t}};function ky(e,t){let n=1,o=!1,r="",i=new Map,s=[],a=[],l=[];function u(x){o||e.write(`${JSON.stringify(x)}
|
|
304
|
+
`)}function d(x){let S=x.trim();if(!S)return;let E;try{E=JSON.parse(S)}catch{return}if(!E||typeof E!="object"||Array.isArray(E))return;let _=E,I=_.id,N=typeof I=="number"||typeof I=="string",M=_.method;if(typeof M=="string"){if(N)for(let q of a)q(I,M,_.params);else for(let q of s)q(M,_.params);return}if(N&&("result"in _||"error"in _)){if(typeof I!="number")return;let q=i.get(I);if(!q)return;if(i.delete(I),"error"in _&&_.error){let he=_.error,B=typeof he.code=="number"?he.code:-32603,D=typeof he.message=="string"?he.message:"unknown app-server error";q.reject(new ta(B,D))}else q.resolve(_.result);return}}function p(x){r+=x;let S;for(;(S=r.indexOf(`
|
|
305
|
+
`))>=0;){let E=r.slice(0,S);r=r.slice(S+1),d(E)}}function m(){t.removeListener("data",p),t.removeListener("end",h),t.removeListener("error",y),e.removeListener("error",y)}function f(x){m();let S=x??new Error("codex app-server stream closed");for(let E of i.values())E.reject(S);i.clear()}function g(x){if(!o){o=!0,f(x);for(let S of l)S(x)}}function h(){g()}function y(x){g(x)}return t.setEncoding("utf8"),t.on("data",p),t.on("end",h),t.on("error",y),e.on("error",y),{request(x,S){if(o)return Promise.reject(new Error("codex app-server client is closed"));let E=n++;return new Promise((_,I)=>{i.set(E,{resolve:_,reject:I}),u({id:E,method:x,params:S})})},notify(x,S){u({method:x,params:S})},respond(x,S){u({id:x,result:S})},onNotification(x){s.push(x)},onServerRequest(x){a.push(x)},onClose(x){l.push(x)},close(){o||(o=!0,f())}}}var na={dim:"\x1B[2m",italic:"\x1B[3m",reset:"\x1B[0m",cyan:"\x1B[36m"};function wy(e,t,n){return n?`${e}${t}${na.reset}`:t}var Du=class{constructor(t){this.out=t;this.colorEnabled=!!t.isTTY&&!process.env.NO_COLOR}out;atLineStart=!0;colorEnabled;render(t,n){if(t==="agent"){this.out.write(n),this.atLineStart=n.endsWith(`
|
|
306
|
+
`);return}if(t==="tool"){this.out.write(wy(na.dim,n,this.colorEnabled)),this.atLineStart=n.endsWith(`
|
|
296
307
|
`);return}if(this.atLineStart||this.out.write(`
|
|
297
|
-
`),t==="meta")this.out.write(`${
|
|
298
|
-
`);else{let o=/^(\[[^\]]+\]\s?)/.exec(
|
|
299
|
-
`)}this.atLineStart=!0}};function mv(e){return new Promise(t=>{let r="";try{r=Wz(e.tokenFile,"utf8").trim()}catch{}let o=JSON.stringify(e.body),n=Vz({host:"127.0.0.1",port:e.hubPort,path:e.path,method:"POST",headers:{"content-type":"application/json","content-length":Buffer.byteLength(o),"x-bridge-hub-token":r},timeout:2e3},i=>{i.on("data",()=>{}),i.on("end",()=>t())});n.on("timeout",()=>{n.destroy(),t()}),n.on("error",()=>t()),n.end(o)})}function si(e){return e instanceof Error?e.message:String(e)}function o2(e){if(e.kind!=="hub")return;let t=e.msg;return t.type==="prompt"||t.type==="command"?t.requestId:void 0}async function Rs(e,t,r){let o=await e.request("thread/start",{cwd:t});return Qz(o)&&r("thread/start returned a result but no recognizable thread id (threadId/thread_id/thread.id) \u2014 codex resume may not work"),gv(o)}async function eI(e,t,r,o){try{let n=await e.request("thread/resume",{threadId:r});return gv(n)??r}catch{return o("codex thread/resume was rejected \u2014 starting a fresh thread instead"),Rs(e,t,o)}}async function i2(e,t,r){let o=await e.request("thread/list",{cwd:t});if(t2(o))return r("thread/list returned a result but no recognizable thread list \u2014 starting a fresh thread"),Rs(e,t,r);let n=n2(o,t);return n?(r(`resuming the most recent codex thread for this cwd (${n})`),eI(e,t,n,r)):(r("no existing codex thread found for this cwd \u2014 starting a fresh thread"),Rs(e,t,r))}var Y$=5,s2=1e3,a2=3e4;async function tI(e){let t=e.codexCmd??Vr(),r=e.clientVersion??"0.0.0",o=e.voice??js({isDevBuild:Lt()===null}),n=e.spawn??Jz,i=e.delay??Kz,s=e.stdin??process.stdin,a=e.stdout??process.stdout,l=new fv(a),u=0;function d(){return u+=1,{...process.env,ACB_CODEX_ADAPTER:"1",ACB_CODEX_GENERATION:String(u)}}let p;try{p=n(t,d())}catch(I){return l.render("meta",`failed to launch codex: ${si(I)}`),1}p.on("error",I=>l.render("meta",`codex process error: ${si(I)}`));let m=dv(p.stdin,p.stdout),f=null,g=I=>(l.render("meta",I),m.close(),Cs(p),f&&ve(f),1),h,y,k,_={};try{await m.request("initialize",{clientInfo:{name:"acbridge",title:"AC Bridge",version:r}}),m.notify("initialized",{});let I=S=>l.render("meta",S);h=e.resume?await i2(m,e.cwd,I):await Rs(m,e.cwd,I),k=Gz(),y=K$(e.cwd,e.machine),f=Nu(k),_=X$({id:y.id,name:y.name,hubPort:e.hubPort,hubTokenFile:e.hubTokenFile,claudeSessionId:k,cwd:e.cwd,sub:e.sub}),ke(f,JSON.stringify({..._,...h?{codexThreadId:h}:{}}))}catch(I){return g(`codex bring-up failed: ${si(I)}`)}return new Promise(I=>{let S=!1,T=0,j=()=>T+=1,F=new eu({sessionId:y.id,cwd:e.cwd,steerSupported:!0,newSeq:j}),J=!1,fe=!1,D=[];function Z(Y){if(fe){D.push(Y);return}tn(Y)}function Ee(){let Y=D.splice(0,D.length);for(let le of Y){if(le.kind!=="hub")continue;let W=le.msg;W.type!=="prompt"&&W.type!=="command"||_e.send({type:"reply",sessionId:y.id,requestId:W.requestId,seq:j(),text:uv,final:!0})}}let _e=$$({port:e.hubPort,tokenFile:e.hubTokenFile,hello:()=>o?{type:"register",sessions:[{id:y.id,name:y.name,cwd:e.cwd,online:!0,agent:"codex"}],claudeSessionId:k}:null,onMessage:Y=>Z({kind:"hub",msg:Y})}),Nt=qz({input:s,output:a,terminal:!!s.isTTY}),X=null;function hv(Y){S||(S=!0,X&&(Cs(X),X=null),m.close(),_e.close(),Cs(p),f&&ve(f),Nt.close(),I(Y))}function Ds(Y,le){mv({hubPort:e.hubPort,tokenFile:e.hubTokenFile,path:"/local/session/state",body:{sessionId:y.id,claudeSessionId:k,cwd:e.cwd,ts:Date.now(),state:Y,event:le,agent:"codex"}})}function hI(Y,le,W){if(Y===void 0)return;let Me={pct:Y};le!==void 0&&(Me.usedTokens=le),W!==void 0&&(Me.windowTokens=W),mv({hubPort:e.hubPort,tokenFile:e.hubTokenFile,path:"/local/session/context",body:{sessionId:y.id,claudeSessionId:k,cwd:e.cwd,ts:Date.now(),agent:"codex",context:Me}})}function vI(Y){h&&mv({hubPort:e.hubPort,tokenFile:e.hubTokenFile,path:"/local/session/usage",body:{sessionId:y.id,claudeSessionId:k,codexThreadId:h,cwd:e.cwd,ts:Date.now(),agent:"codex",inputTokens:Y.inputTokens,cachedInputTokens:Y.cachedInputTokens,outputTokens:Y.outputTokens}})}function yI(){f&&ke(f,JSON.stringify({..._,...h?{codexThreadId:h}:{}}))}function vv(Y,le){for(let W of Y)switch(W.kind){case"rpc":{let Me=W.method,li=Yz(Me,W.params,h);m.request(Me,li).then(()=>{if(Me!=="turn/steer")return;let Hr=o2(le);Hr&&tn({kind:"steer-ok",requestId:Hr})},Hr=>{if(Me==="turn/steer"&&Hr instanceof Ps&&Hr.code===-32601){F.setSteerSupported(!1),vv(F.handle(le),le);return}l.render("meta",`codex error (${Me}): ${si(Hr)}`)});break}case"rpc-respond":J=!1,m.respond(W.id,W.result);break;case"hub-send":W.msg.type==="permission_request"&&(J=!0),_e.send(W.msg);break;case"state-post":Ds(W.state,W.event);break;case"context-post":hI(W.pct,W.usedTokens,W.windowTokens);break;case"usage-post":vI(W);break;case"render":l.render(W.channel,W.text);break;case"exit":hv(0);break;default:break}}function tn(Y){vv(F.handle(Y),Y)}let ru=!1,Ns,ci=0;function yv(){ci+=1;let Y=ci;p.on("exit",le=>{Y===ci&&(Ns=le,ou())}),m.onClose(()=>{Y===ci&&(Ns!==void 0?ou():setTimeout(()=>{Y===ci&&ou()},25))}),m.onNotification((le,W)=>tn({kind:"notification",method:le,params:W})),m.onServerRequest((le,W,Me)=>tn({kind:"server-request",id:le,method:W,params:Me}))}async function bI(){let Y=n(t,d());X=Y,Y.on("error",W=>l.render("meta",`codex process error: ${si(W)}`));let le=dv(Y.stdin,Y.stdout);try{await le.request("initialize",{clientInfo:{name:"acbridge",title:"AC Bridge",version:r}}),le.notify("initialized",{});let W=li=>l.render("meta",li),Me=h?await eI(le,e.cwd,h,W):await Rs(le,e.cwd,W);return X=null,{child:Y,client:le,threadId:Me}}catch(W){throw X=null,le.close(),Cs(Y),W}}async function xI(){let Y=s2,le=0;for(;;){if(await i(Y),S)return;try{let W=await bI();if(S){W.client.close(),Cs(W.child);return}p=W.child,m=W.client,ru=!1,Ns=void 0,J=!1,yv(),W.threadId!==void 0&&W.threadId!==h&&(h=W.threadId,yI()),l.render("meta","codex reconnected \u2014 session resumed"),Ds("resumed","codex-adapter:respawned"),fe=!1;let Me=D.splice(0,D.length);for(let li of Me)tn(li);return}catch(W){if(le+=1,l.render("meta",`codex respawn attempt ${le} failed: ${si(W)}`),S)return;if(le>=Y$){Ds("error","codex-adapter:respawn-gave-up"),l.render("meta",`codex gave up respawning after ${Y$} consecutive failed attempts \u2014 ending session`),Ee(),hv(1);return}Y=Math.min(Y*2,a2)}}}function ou(){if(ru||S)return;ru=!0;let Y=Ns??null;tn({kind:"server-exit",code:Y}),l.render("meta",`codex exited unexpectedly (code ${Y??"unknown"}) \u2014 attempting to respawn`),J=!1,fe=!0,xI()}yv(),Nt.on("line",Y=>{let le=Y.trim();if(J){let W=r2(le);if(W){tn({kind:"local-approval",behavior:W});return}}Z({kind:"local-line",text:le})}),Nt.on("SIGINT",()=>tn({kind:"sigint"})),Nt.on("close",()=>{S||tn({kind:"teardown"})}),Ds("started","codex-adapter:started")})}function g2(e){try{return l2(e)&&d2(e).isDirectory()}catch{return!1}}function h2(e){let t=Oe();return t?Bh(tr(t),e):{signedOut:!0}}function v2(e){let t=e.flatMap(i=>{for(let s of["--cwd","--agent"])if(i.startsWith(`${s}=`))return[s,i.slice(s.length+1)];return[i]}),r={hold:t.includes("--hold"),agent:"claude",resume:t.includes("--resume")},o=t.indexOf("--agent");if(o>=0){let i=t[o+1];i==="claude"||i==="codex"?r.agent=i:r.bad=`invalid --agent: ${i??"(none)"} (use claude | codex)`}let n=t.indexOf("--cwd");if(!r.bad&&n>=0){let i=t[n+1];i&&!i.startsWith("--")?r.cwd=i:r.bad="--cwd needs a folder path"}if(!r.bad){let i=t.filter((s,a)=>!s.startsWith("--")&&t[a-1]!=="--agent"&&t[a-1]!=="--cwd");i.length>1?r.bad="at most one repo name (see `acbridge repos list`)":i.length===1&&(r.cwd!==void 0?r.bad="pick ONE launch folder: a repo name or --cwd <path>":r.repo=i[0])}return!r.bad&&r.resume&&r.agent!=="codex"&&(r.bad="--resume requires --agent codex"),r}function y2(e,t,r){let o={...r,BRIDGE_SESSION_ID:t.sessionId,BRIDGE_SESSION_NAME:t.sessionName,BRIDGE_HUB_PORT:String(t.hubPort)};return delete o.ELECTRON_RUN_AS_NODE,{file:e.file,args:[...e.argsPrefix,"--session-id",t.claudeSessionId,"--channels","plugin:alexa@bridge"],env:o}}function b2(e){let{sub:t,...r}=e;return{...r,voice:!0,...t?{sub:t}:{}}}async function x2(){v("[bridge] session closed \u2014 press Enter to exit\u2026"),await new Promise(e=>{let t=f2({input:process.stdin,output:process.stdout});t.question("",()=>{t.close(),e()})})}var nI="https://github.com/openai/codex#install";function k2(e){return rI(e.file,[...e.argsPrefix,"--version"],{encoding:"utf8",timeout:5e3}).status===0}function w2(e={}){let t;try{t=(e.resolveCodex??Vr)()}catch{return{ok:!1,message:`codex CLI not found \u2014 install it: ${nI}`}}return(e.probeCodex??k2)(t)?(e.codexLoggedIn??Zs)()?{ok:!0,codexCmd:t}:{ok:!1,message:"Run `codex login` first."}:{ok:!1,message:`codex CLI not found \u2014 install it: ${nI}`}}async function oI(e=[],t={}){let r=v2(e);if(r.bad)return x(r.bad),2;if(r.cwd!==void 0||r.repo!==void 0){let Z=t.chdir??(_e=>process.chdir(_e)),Ee;if(r.cwd!==void 0){if(Ee=Os.resolve(r.cwd),!g2(Ee))return x(`not a folder: ${Ee}`),2}else{let _e=(t.repoLookup??h2)(r.repo);if(_e.signedOut)return x("Not signed in. Run `acbridge login` first \u2014 the bridges list is per-account."),3;if(_e.candidates)return x(`"${r.repo}" matches more than one bridge:
|
|
300
|
-
${
|
|
301
|
-
`)}`),2;if(!
|
|
308
|
+
`),t==="meta")this.out.write(`${wy(`${na.dim}${na.italic}`,`\u2022 ${n}`,this.colorEnabled)}
|
|
309
|
+
`);else{let o=/^(\[[^\]]+\]\s?)/.exec(n),r=o?`${wy(na.cyan,o[1],this.colorEnabled)}${n.slice(o[1].length)}`:n;this.out.write(`${r}
|
|
310
|
+
`)}this.atLineStart=!0}};function Sy(e){if(!e||typeof e!="object")return;let t=e;if(typeof t.threadId=="string"&&t.threadId)return t.threadId;if(typeof t.thread_id=="string"&&t.thread_id)return t.thread_id;let n=t.thread;if(n&&typeof n=="object"){let o=n.id;if(typeof o=="string"&&o)return o}}function C4(e){return Sy(e)!==void 0?!1:!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0}function ZA(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"&&Array.isArray(e.threads))return e.threads}function P4(e){let t=ZA(e);if(!t)return[];let n=[];for(let o of t){if(!o||typeof o!="object")continue;let r=o,i=typeof r.threadId=="string"?r.threadId:typeof r.thread_id=="string"?r.thread_id:typeof r.id=="string"?r.id:void 0;if(!i)continue;let s=typeof r.cwd=="string"?r.cwd:typeof r.workingDirectory=="string"?r.workingDirectory:typeof r.path=="string"?r.path:void 0,a=r.updatedAt??r.lastActiveAt??r.createdAt,l=typeof a=="number"?a:typeof a=="string"?Date.parse(a):void 0;n.push({id:i,cwd:s,updatedAt:l!==void 0&&Number.isFinite(l)?l:void 0})}return n}function T4(e){return ZA(e)!==void 0?!1:!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0}function R4(e,t){let n=P4(e).filter(o=>o.cwd===t);if(n.length!==0)return n.sort((o,r)=>(r.updatedAt??0)-(o.updatedAt??0)),n[0]?.id}async function xi(e,t,n){let o=await e.request("thread/start",{cwd:t});return C4(o)&&n("thread/start returned a result but no recognizable thread id (threadId/thread_id/thread.id) \u2014 codex resume may not work"),Sy(o)}async function _y(e,t,n,o){try{let r=await e.request("thread/resume",{threadId:n});return Sy(r)??n}catch{return o("codex thread/resume was rejected \u2014 starting a fresh thread instead"),xi(e,t,o)}}async function VA(e,t,n){let o=await e.request("thread/list",{cwd:t});if(T4(o))return n("thread/list returned a result but no recognizable thread list \u2014 starting a fresh thread"),xi(e,t,n);let r=R4(o,t);return r?(n(`resuming the most recent codex thread for this cwd (${r})`),_y(e,t,r,n)):(n("no existing codex thread found for this cwd \u2014 starting a fresh thread"),xi(e,t,n))}function z4(e,t){return O4(e.file,[...e.argsPrefix,"app-server"],{env:t,stdio:["pipe","pipe","inherit"]})}function ra(e){if(process.platform==="win32"&&e.pid){D4("taskkill",["/pid",String(e.pid),"/T","/F"]);return}try{e.kill?.("SIGTERM")}catch{}}function F4(e){return new Promise(t=>setTimeout(t,e))}function M4(e,t){return{...t?{threadId:t}:{},input:[{type:"text",text:e}]}}function B4(e,t,n){if(e==="turn/start"||e==="turn/steer"){let o=t,r=typeof o?.text=="string"?o.text:"";return M4(r,n)}return e==="turn/interrupt"?n?{threadId:n}:void 0:t}function H4(e){switch(e.trim().toLowerCase()){case"y":case"yes":return"allow";case"a":case"always":return"allow-session";case"n":case"no":return"deny";default:return null}}function qA(e){return new Promise(t=>{let n="";try{n=L4(e.tokenFile,"utf8").trim()}catch{}let o=JSON.stringify(e.body),r=U4({host:"127.0.0.1",port:e.hubPort,path:e.path,method:"POST",headers:{"content-type":"application/json","content-length":Buffer.byteLength(o),"x-bridge-hub-token":n},timeout:2e3},i=>{i.on("data",()=>{}),i.on("end",()=>t())});r.on("timeout",()=>{r.destroy(),t()}),r.on("error",()=>t()),r.end(o)})}function ki(e){return e instanceof Error?e.message:String(e)}function G4(e){if(e.kind!=="hub")return;let t=e.msg;return t.type==="prompt"||t.type==="command"?t.requestId:void 0}var JA=5,W4=1e3,Z4=3e4;async function KA(e){let t=e.codexCmd??so(),n=e.clientVersion??"0.0.0",o=e.voice??ca({isDevBuild:Zt()===null}),r=e.spawn??z4,i=e.delay??F4,s=e.stdin??process.stdin,a=e.stdout??process.stdout,l=new Du(a),u=0;function d(){return u+=1,{...process.env,ACB_CODEX_ADAPTER:"1",ACB_CODEX_GENERATION:String(u)}}let p;try{p=r(t,d())}catch(E){return l.render("meta",`failed to launch codex: ${ki(E)}`),1}p.on("error",E=>l.render("meta",`codex process error: ${ki(E)}`));let m=ky(p.stdin,p.stdout),f=null,g=E=>(l.render("meta",E),m.close(),ra(p),f&&Ie(f),1),h,y,x,S={};try{await m.request("initialize",{clientInfo:{name:"acbridge",title:"AC Bridge",version:n}}),m.notify("initialized",{});let E=_=>l.render("meta",_);h=e.resume?await VA(m,e.cwd,E):await xi(m,e.cwd,E),x=N4(),y=GA(e.cwd,e.machine),f=Pd(x),S=WA({id:y.id,name:y.name,hubPort:e.hubPort,hubTokenFile:e.hubTokenFile,claudeSessionId:x,cwd:e.cwd,sub:e.sub}),_e(f,JSON.stringify({...S,...h?{codexThreadId:h}:{}}))}catch(E){return g(`codex bring-up failed: ${ki(E)}`)}return new Promise(E=>{let _=!1,I=0,N=()=>I+=1,M=new Ou({sessionId:y.id,cwd:e.cwd,steerSupported:!0,newSeq:N}),q=!1,he=!1,B=[];function D(oe){if(he){B.push(oe);return}Ye(oe)}function xe(){let oe=B.splice(0,B.length);for(let pe of oe){if(pe.kind!=="hub")continue;let K=pe.msg;K.type!=="prompt"&&K.type!=="command"||ie.send({type:"reply",sessionId:y.id,requestId:K.requestId,seq:N(),text:xy,final:!0})}}let ie=bA({port:e.hubPort,tokenFile:e.hubTokenFile,hello:()=>o?{type:"register",sessions:[{id:y.id,name:y.name,cwd:e.cwd,online:!0,agent:"codex"}],claudeSessionId:x}:null,onMessage:oe=>D({kind:"hub",msg:oe})}),Xe=j4({input:s,output:a,terminal:!!s.isTTY}),yt=null;function te(oe){_||(_=!0,yt&&(ra(yt),yt=null),m.close(),ie.close(),ra(p),f&&Ie(f),Xe.close(),E(oe))}function to(oe,pe){qA({hubPort:e.hubPort,tokenFile:e.hubTokenFile,path:"/local/session/state",body:{sessionId:y.id,claudeSessionId:x,cwd:e.cwd,ts:Date.now(),state:oe,event:pe,agent:"codex"}})}function Se(oe,pe,K){if(oe===void 0)return;let Be={pct:oe};pe!==void 0&&(Be.usedTokens=pe),K!==void 0&&(Be.windowTokens=K),qA({hubPort:e.hubPort,tokenFile:e.hubTokenFile,path:"/local/session/context",body:{sessionId:y.id,claudeSessionId:x,cwd:e.cwd,ts:Date.now(),agent:"codex",context:Be}})}function Wt(){f&&_e(f,JSON.stringify({...S,...h?{codexThreadId:h}:{}}))}function no(oe,pe){for(let K of oe)switch(K.kind){case"rpc":{let Be=K.method,_i=B4(Be,K.params,h);m.request(Be,_i).then(()=>{if(Be!=="turn/steer")return;let ro=G4(pe);ro&&Ye({kind:"steer-ok",requestId:ro})},ro=>{if(Be==="turn/steer"&&ro instanceof ta&&ro.code===-32601){M.setSteerSupported(!1),no(M.handle(pe),pe);return}l.render("meta",`codex error (${Be}): ${ki(ro)}`)});break}case"rpc-respond":q=!1,m.respond(K.id,K.result);break;case"hub-send":K.msg.type==="permission_request"&&(q=!0),ie.send(K.msg);break;case"state-post":to(K.state,K.event);break;case"context-post":Se(K.pct,K.usedTokens,K.windowTokens);break;case"render":l.render(K.channel,K.text);break;case"exit":te(0);break;default:break}}function Ye(oe){no(M.handle(oe),oe)}let ju=!1,ia,Si=0;function Ey(){Si+=1;let oe=Si;p.on("exit",pe=>{oe===Si&&(ia=pe,zu())}),m.onClose(()=>{oe===Si&&(ia!==void 0?zu():setTimeout(()=>{oe===Si&&zu()},25))}),m.onNotification((pe,K)=>Ye({kind:"notification",method:pe,params:K})),m.onServerRequest((pe,K,Be)=>Ye({kind:"server-request",id:pe,method:K,params:Be}))}async function dI(){let oe=r(t,d());yt=oe,oe.on("error",K=>l.render("meta",`codex process error: ${ki(K)}`));let pe=ky(oe.stdin,oe.stdout);try{await pe.request("initialize",{clientInfo:{name:"acbridge",title:"AC Bridge",version:n}}),pe.notify("initialized",{});let K=_i=>l.render("meta",_i),Be=h?await _y(pe,e.cwd,h,K):await xi(pe,e.cwd,K);return yt=null,{child:oe,client:pe,threadId:Be}}catch(K){throw yt=null,pe.close(),ra(oe),K}}async function pI(){let oe=W4,pe=0;for(;;){if(await i(oe),_)return;try{let K=await dI();if(_){K.client.close(),ra(K.child);return}p=K.child,m=K.client,ju=!1,ia=void 0,q=!1,Ey(),K.threadId!==void 0&&K.threadId!==h&&(h=K.threadId,Wt()),l.render("meta","codex reconnected \u2014 session resumed"),to("resumed","codex-adapter:respawned"),he=!1;let Be=B.splice(0,B.length);for(let _i of Be)Ye(_i);return}catch(K){if(pe+=1,l.render("meta",`codex respawn attempt ${pe} failed: ${ki(K)}`),_)return;if(pe>=JA){to("error","codex-adapter:respawn-gave-up"),l.render("meta",`codex gave up respawning after ${JA} consecutive failed attempts \u2014 ending session`),xe(),te(1);return}oe=Math.min(oe*2,Z4)}}}function zu(){if(ju||_)return;ju=!0;let oe=ia??null;Ye({kind:"server-exit",code:oe}),l.render("meta",`codex exited unexpectedly (code ${oe??"unknown"}) \u2014 attempting to respawn`),q=!1,he=!0,pI()}Ey(),Xe.on("line",oe=>{let pe=oe.trim();if(q){let K=H4(pe);if(K){Ye({kind:"local-approval",behavior:K});return}}D({kind:"local-line",text:pe})}),Xe.on("SIGINT",()=>Ye({kind:"sigint"})),Xe.on("close",()=>{_||Ye({kind:"teardown"})}),to("started","codex-adapter:started")})}function e6(e){try{return q4(e)&&K4(e).isDirectory()}catch{return!1}}function t6(e){let t=qe();return t?Yv(hr(t),e):{signedOut:!0}}function n6(e){let t=e.flatMap(i=>{for(let s of["--cwd","--agent"])if(i.startsWith(`${s}=`))return[s,i.slice(s.length+1)];return[i]}),n={hold:t.includes("--hold"),agent:"claude",resume:t.includes("--resume")},o=t.indexOf("--agent");if(o>=0){let i=t[o+1];i==="claude"||i==="codex"?n.agent=i:n.bad=`invalid --agent: ${i??"(none)"} (use claude | codex)`}let r=t.indexOf("--cwd");if(!n.bad&&r>=0){let i=t[r+1];i&&!i.startsWith("--")?n.cwd=i:n.bad="--cwd needs a folder path"}if(!n.bad){let i=t.filter((s,a)=>!s.startsWith("--")&&t[a-1]!=="--agent"&&t[a-1]!=="--cwd");i.length>1?n.bad="at most one repo name (see `acbridge repos list`)":i.length===1&&(n.cwd!==void 0?n.bad="pick ONE launch folder: a repo name or --cwd <path>":n.repo=i[0])}return!n.bad&&n.resume&&n.agent!=="codex"&&(n.bad="--resume requires --agent codex"),n}function r6(e,t,n){let o={...n,BRIDGE_SESSION_ID:t.sessionId,BRIDGE_SESSION_NAME:t.sessionName,BRIDGE_HUB_PORT:String(t.hubPort)};return delete o.ELECTRON_RUN_AS_NODE,{file:e.file,args:[...e.argsPrefix,"--session-id",t.claudeSessionId,"--channels","plugin:alexa@bridge"],env:o}}function o6(e){let{sub:t,...n}=e;return{...n,voice:!0,...t?{sub:t}:{}}}async function i6(){v("[bridge] session closed \u2014 press Enter to exit\u2026"),await new Promise(e=>{let t=Q4({input:process.stdin,output:process.stdout});t.question("",()=>{t.close(),e()})})}var XA="https://github.com/openai/codex#install";function s6(e){return YA(e.file,[...e.argsPrefix,"--version"],{encoding:"utf8",timeout:5e3}).status===0}function a6(e={}){let t;try{t=(e.resolveCodex??so)()}catch{return{ok:!1,message:`codex CLI not found \u2014 install it: ${XA}`}}return(e.probeCodex??s6)(t)?(e.codexLoggedIn??ga)()?{ok:!0,codexCmd:t}:{ok:!1,message:"Run `codex login` first."}:{ok:!1,message:`codex CLI not found \u2014 install it: ${XA}`}}async function QA(e=[],t={}){let n=n6(e);if(n.bad)return k(n.bad),2;if(n.cwd!==void 0||n.repo!==void 0){let D=t.chdir??(ie=>process.chdir(ie)),xe;if(n.cwd!==void 0){if(xe=oa.resolve(n.cwd),!e6(xe))return k(`not a folder: ${xe}`),2}else{let ie=(t.repoLookup??t6)(n.repo);if(ie.signedOut)return k("Not signed in. Run `acbridge login` first \u2014 the bridges list is per-account."),3;if(ie.candidates)return k(`"${n.repo}" matches more than one bridge:
|
|
311
|
+
${ie.candidates.map(Xe=>`${Xe.name} (${Xe.path})`).join(`
|
|
312
|
+
`)}`),2;if(!ie.row)return k(`no bridge matches "${n.repo}" \u2014 see \`acbridge repos list\``),2;xe=ie.row.path}try{D(xe)}catch(ie){return k(`couldn't enter ${xe}: ${ie instanceof Error?ie.message:String(ie)}`),1}}if(!(t.voice??ze()))return k("voice sessions are turned off in this build."),v("Your devices and Profiles are unaffected \u2014 `acbridge start` keeps the bridge running."),v(`Launch the agent yourself in this folder: \`${n.agent}\` \u2014 its hooks still drive your Profiles.`),1;let{hold:o,agent:r}=n,i=le(),s=t.preflightAccount??ti,a=t.ensureFreshToken??Vt,l=t.ensureHub??it,u=t.hubRelease??Tl,d=t.readActiveUser??Te,p=t.holdForEnter??i6,m=await s();if(!m.ok)return k(m.message),m.exitCode;await a(i.relayUrl);let{holderId:f}=await l({kind:"run"});if(r==="codex"){let D=!1,xe=async()=>{if(!D&&(D=!0,f))try{await u(f)}catch{}};process.once("SIGINT",()=>{xe()}),process.once("SIGTERM",()=>{xe()});let ie=(t.codexPreflight??a6)();if(!ie.ok)return k(ie.message),await xe(),1;v(`Launching Codex with the Alexa channel \u2014 cwd: ${process.cwd()}`);let yt=await(t.runCodexAdapter??KA)({cwd:process.cwd(),machine:i.machine,hubPort:i.hubPort,hubTokenFile:zh(),sub:d()?.sub,codexCmd:ie.codexCmd,clientVersion:Zt()??void 0,voice:!0,resume:n.resume});return await xe(),o&&await p(),yt}for(let D of Gl({...t.ensurePluginInstalled?{ensurePluginInstalled:t.ensurePluginInstalled}:{},...t.ensureStatusline?{ensureStatusline:t.ensureStatusline}:{}}))(D.level==="info"?v:j)(D.message);let g=oa.basename(process.cwd())||"session",h=`${g}@${i.machine}`,y=`${g} (${i.machine})`,x=V4(),S=oa.join(ee,"sessions");J4(S,{recursive:!0});let E=oa.join(S,`${x}.json`),_=process.cwd(),I=oa.join(Y4.homedir(),".claude","projects",_.replace(/[^A-Za-z0-9]/g,"-"),`${x}.jsonl`),N=zh();X4(E,JSON.stringify(o6({id:h,name:y,hubPort:i.hubPort,hubTokenFile:N,claudeSessionId:x,transcriptPath:I,cwd:_,sub:d()?.sub})),{mode:384});let M=!1,q=async()=>{if(!M&&(M=!0,Ie(E),f))try{await u(f)}catch{}};process.once("SIGINT",()=>{q()}),process.once("SIGTERM",()=>{q()}),v(`Launching Claude with the Alexa channel \u2014 session: ${h}`);let he=r6((t.resolveClaude??yn)(),{sessionId:h,claudeSessionId:x,sessionName:y,hubPort:i.hubPort},process.env),B=(t.spawnClaude??(D=>YA(D.file,D.args,{stdio:"inherit",env:D.env})))(he);return await q(),o&&await p(),B.status??0}var c6="Usage: acbridge scan [--json] [--timeout <seconds>]",l6=1e3,u6=e=>GS(e);function d6(e){let t={json:!1,timeoutMs:3e4};for(let n=0;n<e.length;n++){let o=e[n];if(o==="--json")t.json=!0;else if(o==="--timeout"||o?.startsWith("--timeout=")){let r=o==="--timeout"?e[++n]:o.slice(10),i=Number(r);!Number.isFinite(i)||i<=0?t.bad=`invalid --timeout: ${r??"(none)"}`:t.timeoutMs=Math.min(120,Math.max(5,Math.round(i)))*1e3}else t.bad=`unknown option: ${o??""}`}return t}async function rI(e){let t=d6(e);if(t.json&&fe(!0),t.bad){let i=$(t.bad,2);return v(c6),i}if(!await Ue()){let i=lr();if(!i.ok)return $(i.message,3);if(t.json)return $(Re(),1);try{await it({kind:"cli"})}catch(s){let a=$(`couldn't start the hub: ${s.message}`,1);return v("check ~/.claude-bridge/hub.log, or start it yourself with `acbridge daemon` and re-run"),a}}let n=await Z("/local/scan",{method:"POST"});if(n.hubOffline)return $(Re(),1);if(n.status!==200||!n.body?.scanId)return $(`hub answered HTTP ${n.status} starting the scan \u2014 token mismatch? restart the hub`,1);let{session:o,expired:r}=await p6(n.body.scanId,t);return o?t.json?(console.log(JSON.stringify(o)),o.status==="failed"?1:0):(r&&v(ce("(scan session expired mid-poll \u2014 showing the hub's last-known devices)")),o.status==="failed"?$(`scan failed: ${o.error??"unknown error"}`,1):(o.status==="running"&&j("scan still running at --timeout \u2014 showing partial results (re-run `acbridge scan` for the final list)"),v6(o.devices,o.env,o.accountDevices),await x6(o.devices),0)):$(Re(),1)}async function p6(e,t){let n=Date.now()+t.timeoutMs,o=!t.json&&process.stdout.isTTY,r=null;!t.json&&!o&&v("scanning\u2026");try{for(;;){let i=await Z(`/local/scan/${e}`);if(i.hubOffline)return{session:r,expired:!1};if(i.status===404){let s=await Z("/local/discovered");return s.status===200&&s.body?{session:m6(e,s.body),expired:!0}:{session:r,expired:!0}}if(i.status===200&&i.body&&(r=i.body,o&&process.stdout.write(`\r\u2022 scanning\u2026 ${r.devices.length} device(s) found`),r.status!=="running"))return{session:r,expired:!1};if(Date.now()>=n)return{session:r,expired:!1};await new Promise(s=>setTimeout(s,l6))}}finally{o&&process.stdout.write("\r\x1B[2K")}}var m6=(e,t)=>({id:e,status:"done",startedAt:t.updatedAt,finishedAt:t.updatedAt,devices:t.devices,...t.accountDevices?{accountDevices:t.accountDevices}:{},env:t.env}),f6={ready:0,ecosystems:1,"needs-setup":2,unidentified:3,infrastructure:4},g6={ready:"Ready",ecosystems:"Link account","needs-setup":"Needs setup",unidentified:"Unknown",infrastructure:"Infrastructure"};function eI(e){return f6[oi(e)]}function h6(e){return g6[oi(e)]}function Nu(e){let t=[e.identity.manufacturer,e.identity.model].filter(Boolean).join(" ");return e.identity.name??(t||e.identity.hint||e.addresses.hostname||e.addresses.ip)}function tI(e){if(e.alreadyLinked)return`connected \u2713 (via ${e.alreadyLinked.provider})`;if(e.bucket==="connect-now"&&e.localProtocol)return`acbridge connect ${e.discoveredId}`;if(e.bucket==="link-ecosystem"){let t=e.suggestedProvider;return t==="homeassistant"?"acbridge link home-assistant":t==="mqtt"?`acbridge link mqtt --host ${e.addresses.ip}`:t==="hue"||t==="smartthings"?`acbridge link ${t}`:`acbridge link ${t}`}return"\u2014"}function nI(e){let t=y6(e);if(t.length!==0){v(""),v(ce(t[0]));for(let n of t.slice(1))v(n)}}function v6(e,t,n){let o=FS(t);if(o&&t.interop==="windows-arp"?j("WSL detected \u2014 mDNS/broadcast limited; using the Windows neighbor table for ARP discovery"):o&&t.wsl?j("WSL detected \u2014 LAN scan degraded (mDNS/broadcast limited); results may be incomplete"):o&&j("multicast self-test failed \u2014 mDNS results may be missing"),e.length===0){o&&t.wsl?v("0 devices found \u2014 expected to be incomplete under WSL (see `acbridge doctor`)."):o?v("0 devices found \u2014 the multicast self-test failed, so this scan is expected to be incomplete (see `acbridge doctor`)."):MS(t,e.length)?v(`No devices found. ${BS}`):v("No devices found. Devices must be on the same network/VLAN; Wi-Fi isolation limits discovery."),nI(n);return}let r=[...e].sort((m,f)=>eI(m)-eI(f)||Nu(m).localeCompare(Nu(f))),i=r.map(m=>[oI(Nu(m),28),m.expectedType??"\u2014",m.addresses.ip,m.addresses.mac??"\u2014",h6(m),tI(m)]),s=["NAME","TYPE","IP","MAC","STATUS","ACTION"],a=s.map((m,f)=>Math.max(m.length,...i.map(g=>g[f].length))),l=m=>m.map((f,g)=>f.padEnd(a[g])).join(" ").trimEnd();v(ce(l(s)));for(let m of i)v(l(m));v("");let u=new Map;for(let m of r)u.set(oi(m),(u.get(oi(m))??0)+1);let d=[["ready","ready"],["ecosystems","ecosystem"],["needs-setup","need setup"],["unidentified","unidentified"],["infrastructure","infrastructure"]].map(([m,f])=>u.get(m)?`${u.get(m)} ${f}`:null).filter(m=>m!==null);v(`${e.length} device(s)${d.length>0?` \u2014 ${d.join(" \xB7 ")}`:""}`);let p=r.filter(m=>m.identity.hint!==void 0&&tI(m)==="\u2014"&&oi(m)!=="unidentified");if(p.length>0){v(""),v(ce("Notes:"));for(let m of p)v(` \u2022 ${Nu(m)} (${m.addresses.ip}): ${m.identity.hint}`)}nI(n)}var oI=(e,t)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e;function y6(e){let t=e??[];if(t.length===0)return[];let n=[`Known from your accounts (${t.length}):`];for(let o of t){let r=o.state==="cloud"?`added \u2014 reads over the ${o.provider} cloud, so it never appears in a scan`:`in your ${o.provider} account \u2014 not seen on this network`;n.push(` \u2022 ${b6(o)}: ${r}`)}return n}var b6=e=>oI(e.name,40);async function x6(e){if(!e.some(u6))return;let t=await Z("/local/config");t.status!==200||t.body?.autoConnect!=="unset"||(v(""),A("Tip: `acbridge connect --auto on` auto-connects open-protocol lights/plugs (never locks, cameras, or doors)."))}import{existsSync as k6}from"node:fs";import{dirname as w6}from"node:path";function $y(e=ee){return Ia(mo(fo(e)))}function Lu(e){return Zb(Kn,{home:e?.home,configFile:e?.configFile,env:e?.env,nodeCommand:e?.nodeCommand??$y(e?.bridgeDir)})}function Uu(e){return Jb(Kn,{home:e?.home,configFile:e?.configFile,env:e?.env,nodeCommand:e?.nodeCommand??$y(e?.bridgeDir)})}function S6(e){return e?"Setup complete. Run `acbridge run` in any project to start a voice-driven session.":"Setup complete. `acbridge start` runs the bridge; launch `claude` in any project \u2014 its hooks drive your Profiles."}async function iI(e={}){let t=e.installPlugin??Hl,n=e.applyManaged??d$,o=e.applyFirewall??(()=>c$()),r=e.ensureStatusline??ii,i=e.ensureAgentPerms??(()=>wa()),s=e.ensureCodexHooks??Lu,a=e.ensureCodexMcp??Uu,l=e.voice??ze(),u=(e.codexInstalled??(()=>k6(w6(po()))))(),d=(e.claudeInstalled??pa)();if(v(l?`Setting up the Alexa bridge on this machine\u2026
|
|
302
313
|
`:`Setting up AC Bridge on this machine\u2026
|
|
303
|
-
`),
|
|
304
|
-
${
|
|
305
|
-
${p.manualCommand}`)});let l=!1,u=!1;if(!
|
|
314
|
+
`),d)try{X("installing the alexa@bridge plugin (bound to this install)");let p=t();A(p.marketplaceRepointed?"plugin marketplace re-pointed to this install + installed":p.pluginReinstalled?"plugin refreshed from this install":"plugin already current")}catch(p){if(!u)return k(`plugin install failed: ${p.message}`),1;j(`plugin install skipped (${p.message}) \u2014 no Claude Code here; continuing for Codex.`)}else{let p=ua(process.platform).manualCommand;if(!u)return k(`no coding agent found \u2014 setup wires the Claude Code plugin and Codex hooks. Install Claude Code (\`${p}\`) or Codex, then re-run \`acbridge setup\`. Device control from this CLI works without either \u2014 but the desktop app's first-run setup does require one.`),1;j(`plugin install skipped (claude CLI not found \u2014 install it: ${p}) \u2014 no Claude Code here; continuing for Codex.`)}try{X(l?`allowlisting the channel in ${Sr()}`:`checking managed settings in ${Sr()}`);let p=n();p.replacedDefaultAllowlist&&j("allowedChannelPlugins was unset \u2014 setting it REPLACES Anthropic's default channel list. If you also use Telegram/Discord channels, add them to the managed-settings file too."),A(p.changed?`managed settings written${p.usedSudo?" (via sudo)":""}`:"managed settings already current")}catch(p){if(!u)return k(`managed settings: ${p.message}`),v("Write it manually if needed \u2014 `acbridge doctor` prints the exact path + expected JSON."),1;j(`managed settings skipped (${p.message}) \u2014 not needed for Codex-only.`)}try{X("adding the LAN device-scan firewall rule");let p=o();p.status==="nothing-to-do"?A("no active firewall detected \u2014 nothing to add"):p.status==="needs-elevation"?(j("firewall rule not applied (declined or unavailable)."),p.manualCommand&&v(`Run it manually if device scanning misses devices:
|
|
315
|
+
${p.manualCommand}`)):(A(p.changed?"firewall rule added":"firewall rule already present"),p.userNote&&v(p.userNote))}catch(p){j(`firewall rule skipped: ${p.message}`)}try{X("installing the statusline tee (context + usage readings)");let p=r();A(p.enabled?p.changed?"statusline tee installed (any existing statusline is chained)":"statusline tee already current":"statusline tee disabled by config \u2014 skipped")}catch(p){j(`statusline tee skipped: ${p.message}`)}try{X("pre-approving the bridge device tools in Claude Code permissions");let p=i();p.corrupt?j("~/.claude/settings.json is unparseable \u2014 fix or delete it, then re-run setup"):p.enabled?p.changed?A("bridge device tools pre-approved (locks & other security devices still need in-app approval)"):A("agent permissions already current"):A("agent permissions disabled by config \u2014 skipped")}catch(p){j(`agent permissions skipped: ${p.message}`)}try{X("installing Codex hooks (session-state signals for OpenAI Codex CLI)");let p=s();if(p.skipped)A("Codex not detected (no ~/.codex) \u2014 hooks skipped");else if(p.corrupt)j("~/.codex/hooks.json is unparseable \u2014 fix or delete it, then re-run setup.");else if(!p.enabled)A("Codex hooks disabled by config \u2014 skipped");else if(p.changed){A("Codex hooks installed (any existing hooks are preserved)");let m=p.addedEvents&&p.addedEvents.length>0?` (new: ${p.addedEvents.join(", ")})`:"";v(`Codex hooks installed \u2014 run /hooks once inside Codex to review and trust the AC Bridge hook${m}.`)}else A("Codex hooks already current")}catch(p){j(`Codex hooks skipped: ${p.message}`)}try{X("registering the AC Bridge device MCP server with Codex");let p=a();p.skipped?A("Codex not detected (no ~/.codex) \u2014 MCP registration skipped"):p.blocked==="foreign"?j("~/.codex/config.toml already defines [mcp_servers.acbridge] outside the AC Bridge block \u2014 remove it, then re-run setup."):p.blocked==="malformed"?j("~/.codex/config.toml's AC Bridge markers are damaged \u2014 fix or delete the marked block, then re-run setup."):p.enabled?p.changed?(A("Codex MCP server registered (device tools + the profile brief in Codex chats)"),v("Restart Codex to pick up the device tools \u2014 calls are pre-approved; locks and other security devices still need in-app approval.")):A("Codex MCP registration already current"):A("Codex MCP registration disabled by config \u2014 skipped")}catch(p){j(`Codex MCP registration skipped: ${p.message}`)}return v(""),A(S6(l)),0}function _6(e){return e.voice&&e.hubUp&&e.signedIn}function $6(e){let t=[`relay: ${e.relayUrl}`,`machine: ${e.machine}`,`version: ${e.version??"dev"}`,`signed in: ${e.signedIn?e.paired?"yes (paired)":"yes":"no"}`,`hub: ${e.hubUp?"running":"stopped"}`];if(e.update&&t.push(`update: ${e.update.latest} available (you have ${e.version??"dev"})`),e.accountMismatch&&t.push("account: signed-in account does not match this machine's credential \u2014 run `acbridge logout` then `acbridge login`"),e.daemonPid!==void 0&&t.push(`daemon: running (pid ${e.daemonPid})`),e.relayLink&&t.push(`relay link: ${e.relayLink.connected?"connected":e.relayLink.code===4426?"refused \u2014 app update required":"down"}`),e.session&&t.push(e.session.active?`session: active \u2014 ${[e.session.owner?`owner ${e.session.owner}`:null,`${e.session.touched} touched`,e.session.revertOnStop?"revert on stop":"no revert"].filter(Boolean).join(", ")}`:"session: none"),e.sessions!==null&&t.push(`sessions: ${e.sessions}`),e.entitlement&&t.push(`plan: ${e.entitlement.plan}`),e.signedIn)if(e.entitlementFile==="absent")t.push("entitlement file: absent (not synced from the relay yet)");else if(e.entitlementFile==="unreadable")t.push("entitlement file: unreadable");else{let r=e.entitlementFile.ageHours;t.push(`entitlement file: ${r.toFixed(1)}h old (${r<=24?"fresh":"stale \u2014 the hub refreshes it every 6h"})`)}let n;if(e.sessions!==null)try{n=JSON.parse(e.sessions)}catch{n=e.sessions}let o={relayUrl:e.relayUrl,machine:e.machine,version:e.version??"dev",...e.update?{updateAvailable:!0,latestVersion:e.update.latest}:{},signedIn:e.signedIn,paired:e.paired,hub:e.hubUp?"running":"stopped",...e.accountMismatch?{accountMismatch:!0}:{},...e.daemonPid!==void 0?{daemonPid:e.daemonPid}:{},...e.relayLink?{relayLink:e.relayLink}:{},...e.session?{session:e.session}:{},...e.sessions!==null?{sessions:n}:{},...e.entitlement?{plan:e.entitlement.plan}:{},...typeof e.entitlementFile=="object"?{entitlementFile:{ageHours:e.entitlementFile.ageHours,fresh:e.entitlementFile.ageHours<=24}}:{}};return{lines:t,exitCode:e.hubUp?0:1,json:o}}async function sI(e=[]){let t=e.includes("--json");t&&fe(!0);let n=le(),o=Jt(),r=o.state==="ok"?o.token:"",i=!!r,s=o.state==="mismatch",a=!!L($e().refreshFile)?.trim(),l=await Ue(),u=_6({voice:ze(),hubUp:l,signedIn:i}),d=u?await Ux(r):null;u&&d===null&&j("could not reach the relay /sessions endpoint");let p=i?await Xn(r):null,m=p?{plan:p.plan}:null,f="absent",g=i?qe():null,h=g?L(g.entitlementFile):null;if(h)try{let D=JSON.parse(h);f={ageHours:(Date.now()-(D.fetchedAt??0))/36e5}}catch{f="unreadable"}let y=L(wt),x=y?Number(y):0,S=x>0&&Yo({pid:x})?x:void 0,E,_=L(Tx);if(l&&_)try{let D=JSON.parse(_);typeof D.connected=="boolean"&&(E={connected:D.connected,...typeof D.code=="number"?{code:D.code}:{}})}catch{}let I=en(),N=I.version,M=Is(N,Ll(),process.platform,I.channel??"app"),q=M.state==="update"?{latest:M.latest}:void 0,he;if(l){let D=await Z("/local/session",{method:"GET",timeoutMs:3e3});!D.hubOffline&&D.status===200&&D.body&&(he={active:D.body.active,...D.body.owner?{owner:D.body.owner}:{},touched:D.body.touched,revertOnStop:D.body.revertOnStop})}let B=$6({relayUrl:n.relayUrl,machine:n.machine,version:N,...q?{update:q}:{},signedIn:i,paired:a,hubUp:l,sessions:d,entitlement:m,entitlementFile:f,...s?{accountMismatch:!0}:{},...S!==void 0?{daemonPid:S}:{},...E?{relayLink:E}:{},...he?{session:he}:{}});if(t)V(B.json);else for(let D of B.lines)v(D);return B.exitCode}import{rmSync as E6}from"node:fs";import{createInterface as A6}from"node:readline/promises";var aI="Usage: acbridge uninstall [--purge | --keep-account] [--json]",I6=new Set(["--purge","--keep-account","--json"]);async function cI(e=[],t={}){let n=e.filter(p=>!I6.has(p));if(n.length>0)return k(`unknown option: ${n[0]}`),v(aI),2;let o=e.includes("--purge"),r=e.includes("--keep-account");if(o&&r)return k("--purge and --keep-account are opposites \u2014 pick one"),v(aI),2;let i=e.includes("--json");i&&fe(!0);let s={},a=async(p,m,f)=>{X(m);try{await f(),s[p]="ok"}catch(g){s[p]="failed",j(`${m} failed (${g.message}) \u2014 continuing`)}};await a("stop","stopping the bridge (devices revert)\u2026",()=>(t.stopBridge??fr)([])),await a("statusline","restoring your Claude Code statusline\u2026",()=>(t.restoreStatusline??(()=>ii({env:{...process.env,BRIDGE_STATUSLINE:"0"}})))()),await a("agentPerms","removing the bridge device-tool permissions\u2026",()=>(t.removeAgentPerms??(()=>wa({env:{...process.env,BRIDGE_AGENT_PERMS:"0"}})))()),await a("codex","removing the Codex hooks\u2026",()=>(t.removeCodexHooks??(()=>Lu({env:{...process.env,BRIDGE_CODEX_HOOKS:"0"}})))()),await a("codexMcp","removing the Codex MCP registration\u2026",()=>(t.removeCodexMcp??(()=>Uu({env:{...process.env,BRIDGE_CODEX_MCP:"0"}})))()),(t.claudeInstalled??pa)()?await a("plugin","removing the Claude Code plugin + marketplace\u2026",()=>(t.removePlugin??YS)()):(s.plugin="skipped",v("no Claude Code here \u2014 plugin removal skipped")),await a("firewall","removing the LAN-discovery firewall rule\u2026",()=>{let p=(t.removeFirewall??l$)();p.status==="needs-elevation"&&p.manualCommand&&j(`couldn't remove the firewall rule without elevation \u2014 run it yourself:
|
|
316
|
+
${p.manualCommand}`)});let l=!1,u=!1;if(!r){let p=o;if(!p)if(t.isTTY??!!(process.stdin.isTTY&&process.stdout.isTTY)){let g=(await(t.ask??(async h=>{let y=A6({input:process.stdin,output:process.stdout});try{return await y.question(h)}finally{y.close()}}))("Sign out and delete this machine's account data (credentials, provider keys, device configs, logs)? [y/N] ")).trim().toLowerCase();p=g==="y"||g==="yes"}else v("keeping account data (non-interactive) \u2014 pass --purge to remove everything, --keep-account to silence this");p&&(await a("signOut","signing out (revokes this machine at the relay)\u2026",()=>(t.signOut??du)([])),l=s.signOut==="ok",o&&(await a("purgeHome","deleting the AC Bridge home (100% fresh next install)\u2026",()=>(t.purgeHome??(()=>E6(ee,{recursive:!0,force:!0})))()),u=s.purgeHome==="ok"))}let d=Object.entries(s).filter(([,p])=>p==="failed").map(([p])=>p);return d.length===0?A("AC Bridge is unwired from this machine."):j(`unwired with issues (${d.join(", ")}) \u2014 see above`),v("finish with: npm uninstall -g acbridge"),i&&V({steps:s,signedOut:l,purged:u}),0}function wi(e){return`${e?"acbridge \u2014 voice-driven Claude Code, on any machine":"acbridge \u2014 the AC Bridge companion CLI: bridge, devices, and profiles from any terminal"}
|
|
306
317
|
|
|
307
318
|
Usage: acbridge <command>
|
|
308
319
|
|
|
@@ -333,6 +344,8 @@ ${e?" setup One-time: install the channel plugin + allowlist it (manag
|
|
|
333
344
|
devices [list | on <dev> | off <dev> | set <dev> <cmd> [--param k=v] | set-main <dev> [--color <h>,<s>] [--brightness <n>] [--kelvin <k>]] [--json]
|
|
334
345
|
List the connected-device graph, control a device (same guarded path as the app),
|
|
335
346
|
or set its resting "main" look (what profile looks return to)
|
|
347
|
+
audit [--json] What has driven your devices: the relay's action ledger (voice, app, Claude, rules)
|
|
348
|
+
\u2014 newest first, security actions marked
|
|
336
349
|
groups [list | add <name> | rename <g> <new> | remove <g> | assign <dev> <g> | unassign <dev> <g>] [--json]
|
|
337
350
|
Device groups: a registry + per-device membership, shared with the app
|
|
338
351
|
profiles [list | show <p> | states | create [<name>] [--starter] | rename | duplicate | delete |
|
|
@@ -341,6 +354,9 @@ ${e?" setup One-time: install the channel plugin + allowlist it (manag
|
|
|
341
354
|
Profiles, end to end: list/inspect them, create (bare \`create\` opens a wizard;
|
|
342
355
|
--starter pre-wires a scene set), edit states \u2192 device looks/actions, and bind
|
|
343
356
|
them to repos \u2014 per agent lane (a wrong/missing verb prints the full grammar)
|
|
357
|
+
brief [--cwd <path>] [--agent claude|codex] [--json]
|
|
358
|
+
Print the device brief a session in that cwd receives (the "Make agent aware of
|
|
359
|
+
devices in chat" tick box) \u2014 or why it wouldn't (off / unbound / no hub)
|
|
344
360
|
integrations [list | enable <id> | disable <id> | remove <id|smartthings>] [--json]
|
|
345
361
|
Linked provider accounts: list them (with per-account ids), pause/resume a local
|
|
346
362
|
account, or remove one (credentials deleted; cloud accounts revoke at the relay)
|
|
@@ -351,12 +367,15 @@ ${e?" setup One-time: install the channel plugin + allowlist it (manag
|
|
|
351
367
|
(--purge forgets credentials too); --as forces a protocol for connect-by-IP
|
|
352
368
|
daemon [--no-revert] Run the bridge keeper in the foreground (what "start" runs detached)
|
|
353
369
|
status [--json] Show relay / hub / session status (exit 0 = hub running, 1 = stopped)
|
|
354
|
-
|
|
370
|
+
backup export --out <file> | import --in <file>
|
|
371
|
+
Save/restore this machine's device credentials (Tuya keys, Meross/eWeLink/Govee
|
|
372
|
+
accounts, ESPHome + Nanoleaf tokens) as one passphrase-encrypted file \u2014 so a new
|
|
373
|
+
PC never has to re-authenticate to any vendor
|
|
355
374
|
doctor Diagnose prerequisites and configuration
|
|
356
375
|
--version Print the acbridge version (dev builds print "dev (unversioned)")
|
|
357
376
|
|
|
358
377
|
Exit codes: 0 ok \xB7 1 failure \xB7 2 usage error \xB7 3 not signed in (run \`acbridge login\`)
|
|
359
378
|
\xB7 4 update required (below the minimum supported version) \xB7 5 no active subscription (ac-bridge.com/home)
|
|
360
|
-
`}function
|
|
361
|
-
`),o=new RegExp(`^ {2}${e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")}(?=\\s|$)`),n
|
|
362
|
-
`).trimEnd()}async function
|
|
379
|
+
`}function lI(e){return e.some(t=>t==="-h"||t==="--help")}function uI(e,t){let n=wi(t).split(`
|
|
380
|
+
`),o=new RegExp(`^ {2}${e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")}(?=\\s|$)`),r=n.findIndex(s=>o.test(s));if(r===-1)return null;let i=[n[r]];for(let s of n.slice(r+1)){if(s.trim()===""||/^ {2}\S/.test(s))break;i.push(s)}return i.join(`
|
|
381
|
+
`).trimEnd()}async function C6(){try{Ax()}catch(n){k(`archiveLegacyUserState() failed (non-fatal): ${n instanceof Error?n.message:String(n)}`)}let[,,e,...t]=process.argv;if(e&&lI(t)){let n=ze();return v(uI(e,n)??wi(n)),0}switch(e){case"login":return j$(t);case"logout":return du(t);case"whoami":return uu(t);case"start":return hu(t);case"restart":return lE(t);case"run":return QA(t);case"repos":return fE(t);case"groups":return dE(t);case"setup":return iI();case"uninstall":return cI(t);case"pair":return k("the pairing-code flow was retired \u2014 sign this machine in with `acbridge login` instead."),2;case"link":return I$(t);case"unlink":return C$(t);case"devices":return dS(t);case"audit":return pS(t);case"profiles":return iE(t);case"brief":return F$(t);case"integrations":return O$(t);case"rename":return sE(t);case"scan":return rI(t);case"connect":return KS(t);case"daemon":return Vl(t);case"stop":return fr(t);case"status":return sI(t);case"backup":return CS(t);case"doctor":return m$();case"--version":case"-V":return v(en().version??"dev (unversioned)"),0;case void 0:case"-h":case"--help":case"help":return v(wi(ze())),0;default:return k(`unknown command: ${e}`),v(wi(ze())),2}}C6().then(e=>process.exit(e),e=>{k(e instanceof Error?e.message:String(e)),process.exit(1)});
|