acbridge 1.0.0 → 1.1.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/dist/acbridge.mjs CHANGED
@@ -1,23 +1,23 @@
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 B_=Object.create;var fl=Object.defineProperty;var H_=Object.getOwnPropertyDescriptor;var Z_=Object.getOwnPropertyNames;var G_=Object.getPrototypeOf,W_=Object.prototype.hasOwnProperty;var te=(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 q=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Jt=(e,t)=>{for(var r in t)fl(e,r,{get:t[r],enumerable:!0})},V_=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Z_(t))!W_.call(e,n)&&n!==r&&fl(e,n,{get:()=>t[n],enumerable:!(o=H_(t,n))||o.enumerable});return e};var qt=(e,t,r)=>(r=e!=null?B_(G_(e)):{},V_(t||!e||!e.__esModule?fl(r,"default",{value:e,enumerable:!0}):r,e));var Nc=q(hg=>{"use strict";Object.defineProperty(hg,"__esModule",{value:!0});hg.default=OR;var y0=/[A-Z]/g;function b0(e){return e.toLowerCase()}function OR(e,t){let r=e.replace(y0,b0),o=t.replace(y0,b0);return r===o}});var vg=q(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.DnsTxt=void 0;var Lc=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],a=n[1];r[i]=a}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),[a]=Object.values(o);return n[i]=a,n},{})}};Li.DnsTxt=Lc;Li.default=Lc});var yg=q(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.toType=yo.toString=void 0;var x0=e=>"_"+e,DR=e=>["name","protocol","subtype"].includes(e),NR=e=>{let t={name:e.name,protocol:e.protocol,subtype:e.subtype};return Object.entries(t).filter(([o,n])=>DR(o)&&n!==void 0).reduce((o,[n,i])=>(typeof i==="object"?i.map(a=>o.push(x0(a))):o.push(x0(i)),o),[]).join(".")};yo.toString=NR;var LR=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}};yo.toType=LR});var bg=q(lr=>{"use strict";var w0=lr&&lr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(lr,"__esModule",{value:!0});lr.Service=void 0;var k0=w0(te("os")),UR=w0(vg()),zR=te("events"),jR=yg(),bo=".local",Uc=class extends zR.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 UR.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,jR.toString)({name:t.type,protocol:this.protocol}),this.port=t.port,this.host=t.host||k0.default.hostname(),this.fqdn=`${this.name}.${this.type}${bo}`,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(k0.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}${bo}`,type:"PTR",ttl:28800,data:t.fqdn}}RecordServicePTR(t){return{name:`_services._dns-sd._udp${bo}`,type:"PTR",ttl:120,data:`${t.type}${bo}`}}RecordSubtypePTR(t,r){return{name:`_${r}._sub.${t.type}${bo}`,type:"PTR",ttl:28800,data:`${t.name}.${t.type}${bo}`}}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}}};lr.Service=Uc;lr.default=Uc});var _0=q(ur=>{"use strict";var S0=ur&&ur.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ur,"__esModule",{value:!0});ur.Registry=void 0;var FR=S0(Nc()),xg=S0(bg()),MR=3600*1e3,BR=3,HR=function(){},zc=class{constructor(t){this.services=[],this.server=t}publish(t){let r=t.probe!==!1,o=new xg.default(t,n.bind(null,this),i.bind(null,this));function n(a,{probe:s=r}={}){o.activated||(o.activated=!0,a.services.push(o),o instanceof xg.default&&(s?a.probe(a.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}a.announce(a.server,o)}):a.announce(a.server,o)))}function i(a,s){if(s||(s=HR),!o.activated||!(o instanceof xg.default))return process.nextTick(s);a.teardown(a.server,o,s);let l=a.services.indexOf(o);l!==-1&&a.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,a;let s=()=>{!r.activated||r.destroyed||t.query(r.fqdn,"ANY",function(){n=!0,a=setTimeout(++i<3?s:d,250),a.unref()})},l=p=>{n&&(p.answers.some(u)||p.additionals.some(u))&&d(!0)},u=p=>(0,FR.default)(p.name,r.fqdn),d=p=>{t.removeListener("response",l),clearTimeout(a),o(!!p)};t.on("response",l),setTimeout(s,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*BR,o<MR&&!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 a=i.records();return a.forEach(s=>{s.ttl=0}),a});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)})}};ur.Registry=zc;ur.default=zc});var $0=q(kg=>{"use strict";kg.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};kg.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 I0=q(wg=>{"use strict";wg.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};wg.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 A0=q(Sg=>{"use strict";Sg.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};Sg.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 E0=q(_g=>{"use strict";_g.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};_g.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 P0=q($g=>{"use strict";$g.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}`};$g.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 R0=q((T0,Ig)=>{var C0=(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 y=m.length,k=0;for(let _=0;_<y;){let P=m.charCodeAt(_++);P===46?(f[g++]=k,k=0):k=k*10+(P-48)}return f[g]=k,f},decode(m,f){return f=~~f,`${m[f++]}.${m[f++]}.${m[f++]}.${m[f]}`}};e.v4=i;let a={name:"v6",size:n,isFormat:m=>m.length>0&&o.test(m),encode(m,f,g){g=~~g;let y=g+n,k=-1,_=0,P=0,C=!0,E=!1;f=f||new Uint8Array(g+n);for(let D=0;D<m.length;D++){let G=m.charCodeAt(D);G===58?(C?k!==-1?(g<y&&(f[g]=0),g<y-1&&(f[g+1]=0),g+=2):g<y&&(k=g):(E===!0?(g<y&&(f[g]=P),g++):(g<y&&(f[g]=_>>8),g<y-1&&(f[g+1]=_&255),g+=2),_=0,P=0),C=!0,E=!1):G===46?(g<y&&(f[g]=P),g++,P=0,_=0,C=!1,E=!0):(C=!1,G>=97?G-=87:G>=65?G-=55:(G-=48,P=P*10+G),_=(_<<4)+G)}if(C===!1)E===!0?(g<y&&(f[g]=P),g++):(g<y&&(f[g]=_>>8),g<y-1&&(f[g+1]=_&255),g+=2);else if(k===0)g<y&&(f[g]=0),g<y-1&&(f[g+1]=0),g+=2;else if(k!==-1){g+=2;for(let D=Math.min(g-1,y-1);D>=k+2;D--)f[D]=f[D-2];f[k]=0,f[k+1]=0,k=g}if(k!==g&&k!==-1)for(g>y-2&&(g=y-2);y>k;)f[--y]=g<y&&g>k?f[--g]:0;else for(;g<y;)f[g++]=0;return f},decode(m,f){f=~~f;let g="";for(let y=0;y<n;y+=2)y!==0&&(g+=":"),g+=(m[f+y]<<8|m[f+y+1]).toString(16);return g.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};e.v6=a;let s="ip";e.name=s;function l(m){if(i.isFormat(m))return i.size;if(a.isFormat(m))return a.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 y=l(m);return typeof f=="function"&&(f=f(g+y)),y===i.size?i.encode(m,f,g):a.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===a.size)return a.decode(m,f,g);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${a.size} for v6.`)}return"default"in e?e.default:e})({});typeof define=="function"&&define.amd?define([],function(){return C0}):typeof Ig=="object"&&typeof T0=="object"&&(Ig.exports=C0)});var N0=q(N=>{"use strict";var L=te("buffer").Buffer,yn=$0(),ZR=I0(),GR=A0(),Fc=E0(),Ag=P0(),dr=R0(),WR=0,O0=32768,Eg=32768,VR=~Eg,D0=32768,JR=~D0,R=N.name={};R.encode=function(e,t,r,{mail:o=!1}={}){t||(t=L.alloc(R.encodingLength(e))),r||(r=0);let n=r,i=e.replace(/^\.|\.$/gm,"");if(i.length){let a=[];if(o){let s="";i.split(".").forEach(l=>{l.endsWith("\\")?s+=(s.length?".":"")+l.slice(0,-1):a.length===0&&s.length?a.push(s+"."+l):a.push(l)})}else a=i.split(".");for(let s=0;s<a.length;s++){let l=t.write(a[s],r+1);t[r]=l,r+=l+1}}return t[r++]=0,R.encode.bytes=r-n,t};R.encode.bytes=0;R.decode=function(e,t,{mail:r=!1}={}){t||(t=0);let o=[],n=t,i=0,a=0,s=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");let l=e[t++];if(a+=s?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,a+=s?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,a+=s?0:1,s=!0}else throw new Error("Cannot decode name (bad label)")}return R.decode.bytes=a,o.length===0?".":o.join(".")};R.decode.bytes=0;R.encodingLength=function(e){return e==="."||e===".."?1:L.byteLength(e.replace(/^\.|\.$/gm,""))+2};var J={};J.encode=function(e,t,r){t||(t=L.alloc(J.encodingLength(e))),r||(r=0);let o=t.write(e,r+1);return t[r]=o,J.encode.bytes=o+1,t};J.encode.bytes=0;J.decode=function(e,t){t||(t=0);let r=e[t],o=e.toString("utf-8",t+1,t+1+r);return J.decode.bytes=r+1,o};J.decode.bytes=0;J.encodingLength=function(e){return L.byteLength(e)+1};var Et={};Et.encode=function(e,t,r){t||(t=Et.encodingLength(e)),r||(r=0);let o=(e.flags||0)&32767,n=e.type==="response"?O0:WR;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};Et.encode.bytes=12;Et.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&O0?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:GR.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:ZR.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))}};Et.decode.bytes=12;Et.encodingLength=function(){return 12};var ln=N.unknown={};ln.encode=function(e,t,r){return t||(t=L.alloc(ln.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),ln.encode.bytes=e.length+2,t};ln.encode.bytes=0;ln.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),o=e.slice(t+2,t+2+r);return ln.decode.bytes=r+2,o};ln.decode.bytes=0;ln.encodingLength=function(e){return e.length+2};var un=N.ns={};un.encode=function(e,t,r){return t||(t=L.alloc(un.encodingLength(e))),r||(r=0),R.encode(e,t,r+2),t.writeUInt16BE(R.encode.bytes,r),un.encode.bytes=R.encode.bytes+2,t};un.encode.bytes=0;un.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),o=R.decode(e,t+2);return un.decode.bytes=r+2,o};un.decode.bytes=0;un.encodingLength=function(e){return R.encodingLength(e)+2};var dn=N.soa={};dn.encode=function(e,t,r){t||(t=L.alloc(dn.encodingLength(e))),r||(r=0);let o=r;return r+=2,R.encode(e.mname,t,r),r+=R.encode.bytes,R.encode(e.rname,t,r,{mail:!0}),r+=R.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),dn.encode.bytes=r-o,t};dn.encode.bytes=0;dn.decode=function(e,t){t||(t=0);let r=t,o={};return t+=2,o.mname=R.decode(e,t),t+=R.decode.bytes,o.rname=R.decode(e,t,{mail:!0}),t+=R.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,dn.decode.bytes=t-r,o};dn.decode.bytes=0;dn.encodingLength=function(e){return 22+R.encodingLength(e.mname)+R.encodingLength(e.rname)};var pn=N.txt={};pn.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]=L.from(e[n])),!L.isBuffer(e[n]))throw new Error("Must be a Buffer");t||(t=L.alloc(pn.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),pn.encode.bytes=r-o,t};pn.encode.bytes=0;pn.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 pn.decode.bytes=t-r,n};pn.decode.bytes=0;pn.encodingLength=function(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach(function(r){typeof r=="string"?t+=L.byteLength(r)+1:t+=r.length+1}),t};var mn=N.null={};mn.encode=function(e,t,r){t||(t=L.alloc(mn.encodingLength(e))),r||(r=0),typeof e=="string"&&(e=L.from(e)),e||(e=L.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),mn.encode.bytes=r-o,t};mn.encode.bytes=0;mn.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,mn.decode.bytes=t-r,n};mn.decode.bytes=0;mn.encodingLength=function(e){return e?(L.isBuffer(e)?e.length:L.byteLength(e))+2:2};var fn=N.hinfo={};fn.encode=function(e,t,r){t||(t=L.alloc(fn.encodingLength(e))),r||(r=0);let o=r;return r+=2,J.encode(e.cpu,t,r),r+=J.encode.bytes,J.encode(e.os,t,r),r+=J.encode.bytes,t.writeUInt16BE(r-o-2,o),fn.encode.bytes=r-o,t};fn.encode.bytes=0;fn.decode=function(e,t){t||(t=0);let r=t,o={};return t+=2,o.cpu=J.decode(e,t),t+=J.decode.bytes,o.os=J.decode(e,t),t+=J.decode.bytes,fn.decode.bytes=t-r,o};fn.decode.bytes=0;fn.encodingLength=function(e){return J.encodingLength(e.cpu)+J.encodingLength(e.os)+2};var It=N.ptr={},qR=N.cname=It,KR=N.dname=It;It.encode=function(e,t,r){return t||(t=L.alloc(It.encodingLength(e))),r||(r=0),R.encode(e,t,r+2),t.writeUInt16BE(R.encode.bytes,r),It.encode.bytes=R.encode.bytes+2,t};It.encode.bytes=0;It.decode=function(e,t){t||(t=0);let r=R.decode(e,t+2);return It.decode.bytes=R.decode.bytes+2,r};It.decode.bytes=0;It.encodingLength=function(e){return R.encodingLength(e)+2};var gn=N.srv={};gn.encode=function(e,t,r){t||(t=L.alloc(gn.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),R.encode(e.target,t,r+8);let o=R.encode.bytes+6;return t.writeUInt16BE(o,r),gn.encode.bytes=o+2,t};gn.encode.bytes=0;gn.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=R.decode(e,t+8),gn.decode.bytes=r+2,o};gn.decode.bytes=0;gn.encodingLength=function(e){return 8+R.encodingLength(e.target)};var at=N.caa={};at.ISSUER_CRITICAL=128;at.encode=function(e,t,r){let o=at.encodingLength(e);return t||(t=L.alloc(at.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=at.ISSUER_CRITICAL),t.writeUInt16BE(o-2,r),r+=2,t.writeUInt8(e.flags||0,r),r+=1,J.encode(e.tag,t,r),r+=J.encode.bytes,t.write(e.value,r),r+=L.byteLength(e.value),at.encode.bytes=o,t};at.encode.bytes=0;at.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=J.decode(e,t),t+=J.decode.bytes,n.value=e.toString("utf-8",t,o+r),n.issuerCritical=!!(n.flags&at.ISSUER_CRITICAL),at.decode.bytes=r+2,n};at.decode.bytes=0;at.encodingLength=function(e){return J.encodingLength(e.tag)+J.encodingLength(e.value)+2};var Hn=N.mx={};Hn.encode=function(e,t,r){t||(t=L.alloc(Hn.encodingLength(e))),r||(r=0);let o=r;return r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,R.encode(e.exchange,t,r),r+=R.encode.bytes,t.writeUInt16BE(r-o-2,o),Hn.encode.bytes=r-o,t};Hn.encode.bytes=0;Hn.decode=function(e,t){t||(t=0);let r=t,o={};return t+=2,o.preference=e.readUInt16BE(t),t+=2,o.exchange=R.decode(e,t),t+=R.decode.bytes,Hn.decode.bytes=t-r,o};Hn.encodingLength=function(e){return 4+R.encodingLength(e.exchange)};var hn=N.a={};hn.encode=function(e,t,r){return t||(t=L.alloc(hn.encodingLength(e))),r||(r=0),t.writeUInt16BE(4,r),r+=2,dr.v4.encode(e,t,r),hn.encode.bytes=6,t};hn.encode.bytes=0;hn.decode=function(e,t){t||(t=0),t+=2;let r=dr.v4.decode(e,t);return hn.decode.bytes=6,r};hn.decode.bytes=0;hn.encodingLength=function(){return 6};var vn=N.aaaa={};vn.encode=function(e,t,r){return t||(t=L.alloc(vn.encodingLength(e))),r||(r=0),t.writeUInt16BE(16,r),r+=2,dr.v6.encode(e,t,r),vn.encode.bytes=18,t};vn.encode.bytes=0;vn.decode=function(e,t){t||(t=0),t+=2;let r=dr.v6.decode(e,t);return vn.decode.bytes=18,r};vn.decode.bytes=0;vn.encodingLength=function(){return 18};var Ye=N.option={};Ye.encode=function(e,t,r){t||(t=L.alloc(Ye.encodingLength(e))),r||(r=0);let o=r,n=Ag.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,a=e.family||dr.familyOf(e.ip),s=dr.encode(e.ip,L.alloc),l=Math.ceil(i/8);t.writeUInt16BE(l+4,r),r+=2,t.writeUInt16BE(a,r),r+=2,t.writeUInt8(i,r++),t.writeUInt8(e.scopePrefixLength||0,r++),s.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 Ye.encode.bytes=r-o,t};Ye.encode.bytes=0;Ye.decode=function(e,t){t||(t=0);let r={};r.code=e.readUInt16BE(t),r.type=Ag.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=L.alloc(r.family===1?4:16);e.copy(n,0,t,t+o-4),r.ip=dr.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 Ye.decode.bytes=o+4,r};Ye.decode.bytes=0;Ye.encodingLength=function(e){if(e.data)return e.data.length+4;switch(Ag.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 ct=N.opt={};ct.encode=function(e,t,r){t||(t=L.alloc(ct.encodingLength(e))),r||(r=0);let o=r,n=xo(e,Ye);return t.writeUInt16BE(n,r),r=Ui(e,Ye,t,r+2),ct.encode.bytes=r-o,t};ct.encode.bytes=0;ct.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++]=Ye.decode(e,t),t+=Ye.decode.bytes,n-=Ye.decode.bytes;return ct.decode.bytes=t-r,o};ct.decode.bytes=0;ct.encodingLength=function(e){return 2+xo(e||[],Ye)};var Be=N.dnskey={};Be.PROTOCOL_DNSSEC=3;Be.ZONE_KEY=128;Be.SECURE_ENTRYPOINT=32768;Be.encode=function(e,t,r){t||(t=L.alloc(Be.encodingLength(e))),r||(r=0);let o=r,n=e.key;if(!L.isBuffer(n))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(Be.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,n.copy(t,r,0,n.length),r+=n.length,Be.encode.bytes=r-o,t.writeUInt16BE(Be.encode.bytes-2,o),t};Be.encode.bytes=0;Be.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)!==Be.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,Be.decode.bytes=t-r,o};Be.decode.bytes=0;Be.encodingLength=function(e){return 6+L.byteLength(e.key)};var jt=N.rrsig={};jt.encode=function(e,t,r){t||(t=L.alloc(jt.encodingLength(e))),r||(r=0);let o=r,n=e.signature;if(!L.isBuffer(n))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(yn.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,R.encode(e.signersName,t,r),r+=R.encode.bytes,n.copy(t,r,0,n.length),r+=n.length,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);return t+=2,o.typeCovered=yn.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=R.decode(e,t),t+=R.decode.bytes,o.signature=e.slice(t,r+n+2),t+=o.signature.length,jt.decode.bytes=t-r,o};jt.decode.bytes=0;jt.encodingLength=function(e){return 20+R.encodingLength(e.signersName)+L.byteLength(e.signature)};var Ft=N.rp={};Ft.encode=function(e,t,r){t||(t=L.alloc(Ft.encodingLength(e))),r||(r=0);let o=r;return r+=2,R.encode(e.mbox||".",t,r,{mail:!0}),r+=R.encode.bytes,R.encode(e.txt||".",t,r),r+=R.encode.bytes,Ft.encode.bytes=r-o,t.writeUInt16BE(Ft.encode.bytes-2,o),t};Ft.encode.bytes=0;Ft.decode=function(e,t){t||(t=0);let r=t,o={};return t+=2,o.mbox=R.decode(e,t,{mail:!0})||".",t+=R.decode.bytes,o.txt=R.decode(e,t)||".",t+=R.decode.bytes,Ft.decode.bytes=t-r,o};Ft.decode.bytes=0;Ft.encodingLength=function(e){return 2+R.encodingLength(e.mbox||".")+R.encodingLength(e.txt||".")};var Ie={};Ie.encode=function(e,t,r){t||(t=L.alloc(Ie.encodingLength(e))),r||(r=0);let o=r;for(var n=[],i=0;i<e.length;i++){var a=yn.toType(e[i]);n[a>>8]===void 0&&(n[a>>8]=[]),n[a>>8][a>>3&31]|=1<<7-(a&7)}for(i=0;i<n.length;i++)if(n[i]!==void 0){var s=L.from(n[i]);t.writeUInt8(i,r),r+=1,t.writeUInt8(s.length,r),r+=1,s.copy(t,r),r+=s.length}return Ie.encode.bytes=r-o,t};Ie.encode.bytes=0;Ie.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 a=e.readUInt8(t);t+=1;for(var s=0;s<a;s++)for(var l=e.readUInt8(t+s),u=0;u<8;u++)if(l&1<<7-u){var d=yn.toString(i<<8|s<<3|u);n.push(d)}t+=a}return Ie.decode.bytes=t-o,n};Ie.decode.bytes=0;Ie.encodingLength=function(e){for(var t=[],r=0;r<e.length;r++){var o=yn.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 Mt=N.nsec={};Mt.encode=function(e,t,r){t||(t=L.alloc(Mt.encodingLength(e))),r||(r=0);let o=r;return r+=2,R.encode(e.nextDomain,t,r),r+=R.encode.bytes,Ie.encode(e.rrtypes,t,r),r+=Ie.encode.bytes,Mt.encode.bytes=r-o,t.writeUInt16BE(Mt.encode.bytes-2,o),t};Mt.encode.bytes=0;Mt.decode=function(e,t){t||(t=0);let r=t;var o={},n=e.readUInt16BE(t);return t+=2,o.nextDomain=R.decode(e,t),t+=R.decode.bytes,o.rrtypes=Ie.decode(e,t,n-(t-r)),t+=Ie.decode.bytes,Mt.decode.bytes=t-r,o};Mt.decode.bytes=0;Mt.encodingLength=function(e){return 2+R.encodingLength(e.nextDomain)+Ie.encodingLength(e.rrtypes)};var Bt=N.nsec3={};Bt.encode=function(e,t,r){t||(t=L.alloc(Bt.encodingLength(e))),r||(r=0);let o=r,n=e.salt;if(!L.isBuffer(n))throw new Error("salt must be a Buffer");let i=e.nextDomain;if(!L.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,Ie.encode(e.rrtypes,t,r),r+=Ie.encode.bytes,Bt.encode.bytes=r-o,t.writeUInt16BE(Bt.encode.bytes-2,o),t};Bt.encode.bytes=0;Bt.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 a=e.readUInt8(t);return t+=1,o.nextDomain=e.slice(t,t+a),t+=a,o.rrtypes=Ie.decode(e,t,n-(t-r)),t+=Ie.decode.bytes,Bt.decode.bytes=t-r,o};Bt.decode.bytes=0;Bt.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+Ie.encodingLength(e.rrtypes)};var Ht=N.ds={};Ht.encode=function(e,t,r){t||(t=L.alloc(Ht.encodingLength(e))),r||(r=0);let o=r,n=e.digest;if(!L.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,Ht.encode.bytes=r-o,t.writeUInt16BE(Ht.encode.bytes-2,o),t};Ht.encode.bytes=0;Ht.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,Ht.decode.bytes=t-r,o};Ht.decode.bytes=0;Ht.encodingLength=function(e){return 6+L.byteLength(e.digest)};var st=N.sshfp={};st.getFingerprintLengthForHashType=function(t){switch(t){case 1:return 20;case 2:return 32}};st.encode=function(t,r,o){r||(r=L.alloc(st.encodingLength(t))),o||(o=0);let n=o;o+=2,r[o]=t.algorithm,o+=1,r[o]=t.hash,o+=1;let i=L.from(t.fingerprint.toUpperCase(),"hex");if(i.length!==st.getFingerprintLengthForHashType(t.hash))throw new Error("Invalid fingerprint length");return i.copy(r,o),o+=i.byteLength,st.encode.bytes=o-n,r.writeUInt16BE(st.encode.bytes-2,n),r};st.encode.bytes=0;st.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=st.getFingerprintLengthForHashType(n.hash);return n.fingerprint=t.slice(r,r+i).toString("hex").toUpperCase(),r+=i,st.decode.bytes=r-o,n};st.decode.bytes=0;st.encodingLength=function(e){return 4+L.from(e.fingerprint,"hex").byteLength};var Zt=N.naptr={};Zt.encode=function(e,t,r){t||(t=L.alloc(Zt.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,J.encode(e.flags,t,r),r+=J.encode.bytes,J.encode(e.services,t,r),r+=J.encode.bytes,J.encode(e.regexp,t,r),r+=J.encode.bytes,R.encode(e.replacement,t,r),r+=R.encode.bytes,Zt.encode.bytes=r-o,t.writeUInt16BE(Zt.encode.bytes-2,o),t};Zt.encode.bytes=0;Zt.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=J.decode(e,t),t+=J.decode.bytes,o.services=J.decode(e,t),t+=J.decode.bytes,o.regexp=J.decode(e,t),t+=J.decode.bytes,o.replacement=R.decode(e,t),t+=R.decode.bytes,Zt.decode.bytes=t-r,o};Zt.decode.bytes=0;Zt.encodingLength=function(e){return J.encodingLength(e.flags)+J.encodingLength(e.services)+J.encodingLength(e.regexp)+R.encodingLength(e.replacement)+6};var Gt=N.tlsa={};Gt.encode=function(e,t,r){t||(t=L.alloc(Gt.encodingLength(e))),r||(r=0);let o=r,n=e.certificate;if(!L.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,Gt.encode.bytes=r-o,t.writeUInt16BE(Gt.encode.bytes-2,o),t};Gt.encode.bytes=0;Gt.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,Gt.decode.bytes=t-r,o};Gt.decode.bytes=0;Gt.encodingLength=function(e){return 5+L.byteLength(e.certificate)};var Pg=N.record=function(e){switch(e.toUpperCase()){case"A":return hn;case"PTR":return It;case"CNAME":return qR;case"DNAME":return KR;case"TXT":return pn;case"NULL":return mn;case"AAAA":return vn;case"SRV":return gn;case"HINFO":return fn;case"CAA":return at;case"NS":return un;case"SOA":return dn;case"MX":return Hn;case"OPT":return ct;case"DNSKEY":return Be;case"RRSIG":return jt;case"RP":return Ft;case"NSEC":return Mt;case"NSEC3":return Bt;case"SSHFP":return st;case"DS":return Ht;case"NAPTR":return Zt;case"TLSA":return Gt}return ln},Re=N.answer={};Re.encode=function(e,t,r){t||(t=L.alloc(Re.encodingLength(e))),r||(r=0);let o=r;if(R.encode(e.name,t,r),r+=R.encode.bytes,t.writeUInt16BE(yn.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,ct.encode(e.options||[],t,r),r+=ct.encode.bytes}else{let n=Fc.toClass(e.class===void 0?"IN":e.class);e.flush&&(n|=Eg),t.writeUInt16BE(n,r+2),t.writeUInt32BE(e.ttl||0,r+4),r+=8;let i=Pg(e.type);i.encode(e.data,t,r),r+=i.encode.bytes}return Re.encode.bytes=r-o,t};Re.encode.bytes=0;Re.decode=function(e,t){t||(t=0);let r={},o=t;if(r.name=R.decode(e,t),t+=R.decode.bytes,r.type=yn.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=ct.decode(e,t+8),t+=8+ct.decode.bytes;else{let n=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=Fc.toString(n&VR),r.flush=!!(n&Eg);let i=Pg(r.type);r.data=i.decode(e,t+8),t+=8+i.decode.bytes}return Re.decode.bytes=t-o,r};Re.decode.bytes=0;Re.encodingLength=function(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return R.encodingLength(e.name)+8+Pg(e.type).encodingLength(t)};var At=N.question={};At.encode=function(e,t,r){t||(t=L.alloc(At.encodingLength(e))),r||(r=0);let o=r;return R.encode(e.name,t,r),r+=R.encode.bytes,t.writeUInt16BE(yn.toType(e.type),r),r+=2,t.writeUInt16BE(Fc.toClass(e.class===void 0?"IN":e.class),r),r+=2,At.encode.bytes=r-o,e};At.encode.bytes=0;At.decode=function(e,t){t||(t=0);let r=t,o={};return o.name=R.decode(e,t),t+=R.decode.bytes,o.type=yn.toString(e.readUInt16BE(t)),t+=2,o.class=Fc.toString(e.readUInt16BE(t)),t+=2,o.class&D0&&(o.class&=JR),At.decode.bytes=t-r,o};At.decode.bytes=0;At.encodingLength=function(e){return R.encodingLength(e.name)+4};N.AUTHORITATIVE_ANSWER=1024;N.TRUNCATED_RESPONSE=512;N.RECURSION_DESIRED=256;N.RECURSION_AVAILABLE=128;N.AUTHENTIC_DATA=32;N.CHECKING_DISABLED=16;N.DNSSEC_OK=32768;N.encode=function(e,t,r){let o=!t;o&&(t=L.alloc(N.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=[]),Et.encode(e,t,r),r+=Et.encode.bytes,r=Ui(e.questions,At,t,r),r=Ui(e.answers,Re,t,r),r=Ui(e.authorities,Re,t,r),r=Ui(e.additionals,Re,t,r),N.encode.bytes=r-n,o&&N.encode.bytes!==t.length?t.slice(0,N.encode.bytes):t};N.encode.bytes=0;N.decode=function(e,t){t||(t=0);let r=t,o=Et.decode(e,t);return t+=Et.decode.bytes,t=jc(o.questions,At,e,t),t=jc(o.answers,Re,e,t),t=jc(o.authorities,Re,e,t),t=jc(o.additionals,Re,e,t),N.decode.bytes=t-r,o};N.decode.bytes=0;N.encodingLength=function(e){return Et.encodingLength(e)+xo(e.questions||[],At)+xo(e.answers||[],Re)+xo(e.authorities||[],Re)+xo(e.additionals||[],Re)};N.streamEncode=function(e){let t=N.encode(e),r=L.alloc(2);r.writeUInt16BE(t.byteLength);let o=L.concat([r,t]);return N.streamEncode.bytes=o.byteLength,o};N.streamEncode.bytes=0;N.streamDecode=function(e){let t=e.readUInt16BE(0);if(e.byteLength<t+2)return null;let r=N.decode(e.slice(2));return N.streamDecode.bytes=N.decode.bytes,r};N.streamDecode.bytes=0;function xo(e,t){let r=0;for(let o=0;o<e.length;o++)r+=t.encodingLength(e[o]);return r}function Ui(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 jc(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 z0=q((BH,U0)=>{"use strict";var L0=nO;process.nextTick(tO,42);U0.exports=XR;function XR(e){var t=o;return r;function r(n){t(n||QR)}function o(n){var i=[n];t=a,e(s);function a(l){i.push(l)}function s(l){var u=arguments;for(t=YR(l)?o:d;i.length;)d(i.shift());function d(p){L0(eO,p,u)}}}}function YR(e){return Object.prototype.toString.call(e)==="[object Error]"}function QR(){}function eO(e,t){e.apply(null,t)}function tO(e){e===42&&(L0=process.nextTick)}function nO(e,t,r){process.nextTick(function(){e(t,r)})}});var M0=q((HH,F0)=>{var Cg=N0(),rO=te("dgram"),oO=z0(),iO=te("events"),Rg=te("os"),Tg=function(){};F0.exports=function(e){e||(e={});var t=new iO.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},a={},s=!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||rO.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=Cg.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=oO(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=Tg),m?!m.host&&!m.address&&(m.address=i.address):m=i,d(g);function g(y){if(s)return f();if(y)return f(y);var k=Cg.encode(p);u.send(k,0,k.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)|Cg.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=Tg),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=Tg),s)return process.nextTick(p);s=!0,clearInterval(l);for(var m in a)try{u.dropMembership(n,m)}catch{}a={},u.close(p)},t.update=function(){for(var p=e.interface?[].concat(e.interface):sO(),m=!1,f=0;f<p.length;f++){var g=p[f];if(!a[g])try{u.addMembership(n,g),a[g]=!0,m=!0}catch(y){t.emit("warning",y)}}if(m){if(u.setMulticastInterface)try{u.setMulticastInterface(e.interface||aO())}catch(y){t.emit("warning",y)}t.emit("networkInterface")}},t};function aO(){for(var e=Rg.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(j0(i.family)&&!i.internal)return Rg.platform()==="darwin"&&t[r]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function sO(){for(var e=Rg.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 a=n[i];if(j0(a.family)){r.push(a.address);break}}return r}function j0(e){return e===4||e==="IPv4"}});var H0=q((ZH,B0)=>{"use strict";B0.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 a=i[n];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var Z0=q(pr=>{"use strict";var Og=pr&&pr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pr,"__esModule",{value:!0});pr.Server=void 0;var cO=Og(M0()),lO=Og(H0()),uO=Og(Nc()),Mc=class{constructor(t,r){this.registry={},this.mdns=(0,cO.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,a=n==="ANY"?Object.keys(r.registry).map(r.recordsFor.bind(r,i)).flat(1):r.recordsFor(i,n);if(a.length!==0){var s=[];n!=="ANY"&&(a.forEach(l=>{l.type==="PTR"&&(s=s.concat(r.recordsFor(l.data,"SRV")).concat(r.recordsFor(l.data,"TXT")))}),s.filter(function(l){return l.type==="SRV"}).map(function(l){return l.data.target}).filter(this.unique()).forEach(function(l){s=s.concat(r.recordsFor(l,"A")).concat(r.recordsFor(l,"AAAA"))})),r.mdns.respond({answers:a,additionals:s},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,uO.default)(n,t)}):[]}isDuplicateRecord(t){return r=>t.type===r.type&&t.name===r.name&&(0,lO.default)(t.data,r.data)}unique(){var t=[];return r=>~t.indexOf(r)?!1:(t.push(r),!0)}};pr.Server=Mc;pr.default=Mc});var G0=q(Dg=>{"use strict";Object.defineProperty(Dg,"__esModule",{value:!0});Dg.default=(e,t)=>{if(t===void 0)return!0;let r=e.txt,o=Object.entries(t).map(([n,i])=>{let a=r[n];return!(a===void 0||i!=a)});return o.length==0?!0:!o.includes(!1)}});var W0=q(Ng=>{"use strict";Object.defineProperty(Ng,"__esModule",{value:!0});Ng.default=e=>Object.keys(e).filter(t=>!t.includes("binary")).reduce((t,r)=>Object.assign(t,{[r]:e[r]}),{})});var V0=q(Lg=>{"use strict";Object.defineProperty(Lg,"__esModule",{value:!0});Lg.default=dO;function dO(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 K0=q(mr=>{"use strict";var zi=mr&&mr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mr,"__esModule",{value:!0});mr.Browser=void 0;var pO=zi(vg()),Zn=zi(Nc()),mO=te("events"),Ug=yg(),J0=zi(G0()),fO=zi(W0()),gO=zi(V0()),q0=".local",hO="_services._dns-sd._udp"+q0,Bc=class e extends mO.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 pO.default(r!==null&&r.txt!=null?r.txt:void 0),r===null||r.type===void 0?(this.name=hO,this.wildcard=!0):(this.name=(0,Ug.toString)({name:r.type,protocol:r.protocol||"tcp"})+q0,r.name&&(this.name=r.name+"."+this.name),this.wildcard=!1),r!=null&&r.txt!==void 0&&(this.txtQuery=(0,fO.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(a=>{a.type!=="PTR"||a.name!==t.name||a.name in r||(r[a.data]=!0,t.mdns.query(a.data,"PTR"))});let i=Date.now();Object.keys(r).forEach(function(a){t.goodbyes(a,o).forEach(t.removeService.bind(t));var s=t.buildServicesFor(a,o,t.txt,n,i);s.length!==0&&s.forEach(l=>{let u=t._services.find(d=>(0,Zn.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,J0.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,gO.default)(r.txt,t?.txt||{})){if(!(0,J0.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,Zn.default)(r.fqdn,t.fqdn)?t:r)}removeService(t){var r,o;this._services.some(function(n,i){if((0,Zn.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,Zn.default)(o.name,t)).map(o=>o.data)}buildServicesFor(t,r,o,n,i){var a=r.answers.concat(r.additionals).filter(s=>s.ttl>0);return a.filter(s=>s.type==="PTR"&&(0,Zn.default)(s.name,t)).map(s=>{let l={addresses:[],subtypes:[],ttl:s.ttl,lastSeen:i};if(a.filter(u=>u.type==="PTR"&&(0,Zn.default)(u.data,s.data)&&u.name.includes("._sub")).forEach(u=>{let d=(0,Ug.toType)(u.name);l.subtypes.push(d.subtype)}),a.filter(u=>(u.type==="SRV"||u.type==="TXT")&&(0,Zn.default)(u.name,s.data)).forEach(u=>{if(u.type==="SRV"){var d=u.name.split("."),p=d[0],m=(0,Ug.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 a.filter(u=>(u.type==="A"||u.type==="AAAA")&&(0,Zn.default)(u.name,l.host)).forEach(u=>l.addresses.push(u.data)),l}).filter(s=>!!s)}};mr.Browser=Bc;mr.default=Bc});var X0=q(bn=>{"use strict";var Hc=bn&&bn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(bn,"__esModule",{value:!0});bn.Browser=bn.Service=void 0;var vO=Hc(_0()),yO=Hc(Z0()),zg=Hc(K0());bn.Browser=zg.default;var bO=Hc(bg());bn.Service=bO.default;var jg=class{constructor(t={},r){this.server=new yO.default(t,r),this.registry=new vO.default(this.server)}publish(t){return this.registry.publish(t)}unpublishAll(t){return this.registry.unpublishAll(t)}find(t=null,r){return new zg.default(this.server.mdns,t,r)}findOne(t=null,r=1e4,o){let n=new zg.default(this.server.mdns,t);var i;return n.once("up",a=>{i!==void 0&&clearTimeout(i),n.stop(),o&&o(a)}),i=setTimeout(()=>{n.stop(),o&&o(null)},r),n}destroy(t){this.registry.destroy(),this.server.mdns.destroy(t)}};bn.default=jg});var Q0=q((He,Y0)=>{"use strict";var xO=He&&He.__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]})),kO=He&&He.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),wO=He&&He.__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"&&xO(r,t,o[n]);return kO(r,t),r}})();Object.defineProperty(He,"__esModule",{value:!0});He.Browser=He.Service=He.Bonjour=void 0;var ji=wO(X0());Object.defineProperty(He,"Service",{enumerable:!0,get:function(){return ji.Service}});Object.defineProperty(He,"Browser",{enumerable:!0,get:function(){return ji.Browser}});var fr=class extends ji.default{};He.Bonjour=fr;He.default=fr;Y0.exports=Object.assign(fr,{Bonjour:fr,Service:ji.Service,Browser:ji.Browser,default:fr})});var kn=q((nW,Zw)=>{"use strict";var Bw=["nodebuffer","arraybuffer","fragments"],Hw=typeof Blob<"u";Hw&&Bw.push("blob");Zw.exports={BINARY_TYPES:Bw,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Hw,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Fi=q((rW,qc)=>{"use strict";var{EMPTY_BUFFER:uN}=kn(),Zg=Buffer[Symbol.species];function dN(e,t){if(e.length===0)return uN;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 Zg(r.buffer,r.byteOffset,o):r}function Gw(e,t,r,o,n){for(let i=0;i<n;i++)r[o+i]=e[i]^t[i&3]}function Ww(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}function pN(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function Gg(e){if(Gg.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new Zg(e):ArrayBuffer.isView(e)?t=new Zg(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),Gg.readOnly=!1),t}qc.exports={concat:dN,mask:Gw,toArrayBuffer:pN,toBuffer:Gg,unmask:Ww};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=te("bufferutil");qc.exports.mask=function(t,r,o,n,i){i<48?Gw(t,r,o,n,i):e.mask(t,r,o,n,i)},qc.exports.unmask=function(t,r){t.length<32?Ww(t,r):e.unmask(t,r)}}catch{}});var qw=q((oW,Jw)=>{"use strict";var Vw=Symbol("kDone"),Wg=Symbol("kRun"),Vg=class{constructor(t){this[Vw]=()=>{this.pending--,this[Wg]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Wg]()}[Wg](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[Vw])}}};Jw.exports=Vg});var $o=q((iW,Qw)=>{"use strict";var Mi=te("zlib"),Kw=Fi(),mN=qw(),{kStatusCode:Xw}=kn(),fN=Buffer[Symbol.species],gN=Buffer.from([0,0,255,255]),Xc=Symbol("permessage-deflate"),wn=Symbol("total-length"),So=Symbol("callback"),Gn=Symbol("buffers"),_o=Symbol("error"),Kc,Jg=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,!Kc){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Kc=new mN(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[So];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){Kc.add(n=>{this._decompress(t,r,(i,a)=>{n(),o(i,a)})})}compress(t,r,o){Kc.add(n=>{this._compress(t,r,(i,a)=>{n(),o(i,a)})})}_decompress(t,r,o){let n=this._isServer?"client":"server";if(!this._inflate){let i=`${n}_max_window_bits`,a=typeof this.params[i]!="number"?Mi.Z_DEFAULT_WINDOWBITS:this.params[i];this._inflate=Mi.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[Xc]=this,this._inflate[wn]=0,this._inflate[Gn]=[],this._inflate.on("error",vN),this._inflate.on("data",Yw)}this._inflate[So]=o,this._inflate.write(t),r&&this._inflate.write(gN),this._inflate.flush(()=>{let i=this._inflate[_o];if(i){this._inflate.close(),this._inflate=null,o(i);return}let a=Kw.concat(this._inflate[Gn],this._inflate[wn]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[wn]=0,this._inflate[Gn]=[],r&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),o(null,a)})}_compress(t,r,o){let n=this._isServer?"server":"client";if(!this._deflate){let i=`${n}_max_window_bits`,a=typeof this.params[i]!="number"?Mi.Z_DEFAULT_WINDOWBITS:this.params[i];this._deflate=Mi.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[wn]=0,this._deflate[Gn]=[],this._deflate.on("data",hN)}this._deflate[So]=o,this._deflate.write(t),this._deflate.flush(Mi.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=Kw.concat(this._deflate[Gn],this._deflate[wn]);r&&(i=new fN(i.buffer,i.byteOffset,i.length-4)),this._deflate[So]=null,this._deflate[wn]=0,this._deflate[Gn]=[],r&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),o(null,i)})}};Qw.exports=Jg;function hN(e){this[Gn].push(e),this[wn]+=e.length}function Yw(e){if(this[wn]+=e.length,this[Xc]._maxPayload<1||this[wn]<=this[Xc]._maxPayload){this[Gn].push(e);return}this[_o]=new RangeError("Max payload size exceeded"),this[_o].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[_o][Xw]=1009,this.removeListener("data",Yw),this.reset()}function vN(e){if(this[Xc]._inflate=null,this[_o]){this[So](this[_o]);return}e[Xw]=1007,this[So](e)}});var Io=q((aW,Yc)=>{"use strict";var{isUtf8:eS}=te("buffer"),{hasBlob:yN}=kn(),bN=[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 xN(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function qg(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 kN(e){return yN&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}Yc.exports={isBlob:kN,isValidStatusCode:xN,isValidUTF8:qg,tokenChars:bN};if(eS)Yc.exports.isValidUTF8=function(e){return e.length<24?qg(e):eS(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=te("utf-8-validate");Yc.exports.isValidUTF8=function(t){return t.length<32?qg(t):e(t)}}catch{}});var eh=q((sW,sS)=>{"use strict";var{Writable:wN}=te("stream"),tS=$o(),{BINARY_TYPES:SN,EMPTY_BUFFER:nS,kStatusCode:_N,kWebSocket:$N}=kn(),{concat:Kg,toArrayBuffer:IN,unmask:AN}=Fi(),{isValidStatusCode:EN,isValidUTF8:rS}=Io(),Qc=Buffer[Symbol.species],gt=0,oS=1,iS=2,aS=3,Xg=4,Yg=5,el=6,Qg=class extends wN{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||SN[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[$N]=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=gt}_write(t,r,o){if(this._opcode===8&&this._state==gt)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 Qc(o.buffer,o.byteOffset+t,o.length-t),new Qc(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 Qc(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 gt:this.getInfo(t);break;case oS:this.getPayloadLength16(t);break;case iS:this.getPayloadLength64(t);break;case aS:this.getMask();break;case Xg:this.getData(t);break;case Yg:case el: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[tS.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=oS:this._payloadLength===127?this._state=iS: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=aS:this._state=Xg}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Xg}getData(t){let r=nS;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&&AN(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._compressed){this._state=Yg,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[tS.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 a=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(a);return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let a=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");r(a);return}this._fragments.push(i)}this.dataMessage(r),this._state===gt&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=gt;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=Kg(o,r):this._binaryType==="arraybuffer"?n=IN(Kg(o,r)):this._binaryType==="blob"?n=new Blob(o):n=o,this._allowSynchronousEvents?(this.emit("message",n,!0),this._state=gt):(this._state=el,setImmediate(()=>{this.emit("message",n,!0),this._state=gt,this.startLoop(t)}))}else{let n=Kg(o,r);if(!this._skipUTF8Validation&&!rS(n)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(i);return}this._state===Yg||this._allowSynchronousEvents?(this.emit("message",n,!1),this._state=gt):(this._state=el,setImmediate(()=>{this.emit("message",n,!1),this._state=gt,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,nS),this.end();else{let o=t.readUInt16BE(0);if(!EN(o)){let i=this.createError(RangeError,`invalid status code ${o}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(i);return}let n=new Qc(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!rS(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=gt;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=gt):(this._state=el,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=gt,this.startLoop(r)}))}createError(t,r,o,n,i){this._loop=!1,this._errored=!0;let a=new t(o?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(a,this.createError),a.code=i,a[_N]=n,a}};sS.exports=Qg});var rh=q((lW,uS)=>{"use strict";var{Duplex:cW}=te("stream"),{randomFillSync:PN}=te("crypto"),{types:{isUint8Array:CN}}=te("util"),cS=$o(),{EMPTY_BUFFER:TN,kWebSocket:RN,NOOP:ON}=kn(),{isBlob:Ao,isValidStatusCode:DN}=Io(),{mask:lS,toBuffer:hr}=Fi(),ht=Symbol("kByteLength"),NN=Buffer.alloc(4),tl=8*1024,vr,Eo=tl,Pt=0,LN=1,UN=2,th=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=Pt,this.onerror=ON,this[RN]=void 0}static frame(t,r){let o,n=!1,i=2,a=!1;r.mask&&(o=r.maskBuffer||NN,r.generateMask?r.generateMask(o):(Eo===tl&&(vr===void 0&&(vr=Buffer.alloc(tl)),PN(vr,0,tl),Eo=0),o[0]=vr[Eo++],o[1]=vr[Eo++],o[2]=vr[Eo++],o[3]=vr[Eo++]),a=(o[0]|o[1]|o[2]|o[3])===0,i=6);let s;typeof t=="string"?(!r.mask||a)&&r[ht]!==void 0?s=r[ht]:(t=Buffer.from(t),s=t.length):(s=t.length,n=r.mask&&r.readOnly&&!a);let l=s;s>=65536?(i+=8,l=127):s>125&&(i+=2,l=126);let u=Buffer.allocUnsafe(n?s+i:i);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=l,l===126?u.writeUInt16BE(s,2):l===127&&(u[2]=u[3]=0,u.writeUIntBE(s,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],a?[u,t]:n?(lS(t,o,u,i,s),[u]):(lS(t,o,t,0,s),[u,t])):[u,t]}close(t,r,o,n){let i;if(t===void 0)i=TN;else{if(typeof t!="number"||!DN(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 s=Buffer.byteLength(r);if(s>123)throw new RangeError("The message must not be greater than 123 bytes");if(i=Buffer.allocUnsafe(2+s),i.writeUInt16BE(t,0),typeof r=="string")i.write(r,2);else if(CN(r))i.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let a={[ht]:i.length,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Pt?this.enqueue([this.dispatch,i,!1,a,n]):this.sendFrame(e.frame(i,a),n)}ping(t,r,o){let n,i;if(typeof t=="string"?(n=Buffer.byteLength(t),i=!1):Ao(t)?(n=t.size,i=!1):(t=hr(t),n=t.length,i=hr.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[ht]:n,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};Ao(t)?this._state!==Pt?this.enqueue([this.getBlobData,t,!1,a,o]):this.getBlobData(t,!1,a,o):this._state!==Pt?this.enqueue([this.dispatch,t,!1,a,o]):this.sendFrame(e.frame(t,a),o)}pong(t,r,o){let n,i;if(typeof t=="string"?(n=Buffer.byteLength(t),i=!1):Ao(t)?(n=t.size,i=!1):(t=hr(t),n=t.length,i=hr.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[ht]:n,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};Ao(t)?this._state!==Pt?this.enqueue([this.getBlobData,t,!1,a,o]):this.getBlobData(t,!1,a,o):this._state!==Pt?this.enqueue([this.dispatch,t,!1,a,o]):this.sendFrame(e.frame(t,a),o)}send(t,r,o){let n=this._extensions[cS.extensionName],i=r.binary?2:1,a=r.compress,s,l;typeof t=="string"?(s=Buffer.byteLength(t),l=!1):Ao(t)?(s=t.size,l=!1):(t=hr(t),s=t.length,l=hr.readOnly),this._firstFragment?(this._firstFragment=!1,a&&n&&n.params[n._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=s>=n._threshold),this._compress=a):(a=!1,i=0),r.fin&&(this._firstFragment=!0);let u={[ht]:s,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:l,rsv1:a};Ao(t)?this._state!==Pt?this.enqueue([this.getBlobData,t,this._compress,u,o]):this.getBlobData(t,this._compress,u,o):this._state!==Pt?this.enqueue([this.dispatch,t,this._compress,u,o]):this.dispatch(t,this._compress,u,o)}getBlobData(t,r,o,n){this._bufferedBytes+=o[ht],this._state=UN,t.arrayBuffer().then(i=>{if(this._socket.destroyed){let s=new Error("The socket was closed while the blob was being read");process.nextTick(nh,this,s,n);return}this._bufferedBytes-=o[ht];let a=hr(i);r?this.dispatch(a,r,o,n):(this._state=Pt,this.sendFrame(e.frame(a,o),n),this.dequeue())}).catch(i=>{process.nextTick(zN,this,i,n)})}dispatch(t,r,o,n){if(!r){this.sendFrame(e.frame(t,o),n);return}let i=this._extensions[cS.extensionName];this._bufferedBytes+=o[ht],this._state=LN,i.compress(t,o.fin,(a,s)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");nh(this,l,n);return}this._bufferedBytes-=o[ht],this._state=Pt,o.readOnly=!1,this.sendFrame(e.frame(s,o),n),this.dequeue()})}dequeue(){for(;this._state===Pt&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][ht],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][ht],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)}};uS.exports=th;function nh(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 zN(e,t,r){nh(e,t,r),e.onerror(t)}});var bS=q((uW,yS)=>{"use strict";var{kForOnEventAttribute:Bi,kListener:oh}=kn(),dS=Symbol("kCode"),pS=Symbol("kData"),mS=Symbol("kError"),fS=Symbol("kMessage"),gS=Symbol("kReason"),Po=Symbol("kTarget"),hS=Symbol("kType"),vS=Symbol("kWasClean"),Sn=class{constructor(t){this[Po]=null,this[hS]=t}get target(){return this[Po]}get type(){return this[hS]}};Object.defineProperty(Sn.prototype,"target",{enumerable:!0});Object.defineProperty(Sn.prototype,"type",{enumerable:!0});var yr=class extends Sn{constructor(t,r={}){super(t),this[dS]=r.code===void 0?0:r.code,this[gS]=r.reason===void 0?"":r.reason,this[vS]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[dS]}get reason(){return this[gS]}get wasClean(){return this[vS]}};Object.defineProperty(yr.prototype,"code",{enumerable:!0});Object.defineProperty(yr.prototype,"reason",{enumerable:!0});Object.defineProperty(yr.prototype,"wasClean",{enumerable:!0});var Co=class extends Sn{constructor(t,r={}){super(t),this[mS]=r.error===void 0?null:r.error,this[fS]=r.message===void 0?"":r.message}get error(){return this[mS]}get message(){return this[fS]}};Object.defineProperty(Co.prototype,"error",{enumerable:!0});Object.defineProperty(Co.prototype,"message",{enumerable:!0});var Hi=class extends Sn{constructor(t,r={}){super(t),this[pS]=r.data===void 0?null:r.data}get data(){return this[pS]}};Object.defineProperty(Hi.prototype,"data",{enumerable:!0});var jN={addEventListener(e,t,r={}){for(let n of this.listeners(e))if(!r[Bi]&&n[oh]===t&&!n[Bi])return;let o;if(e==="message")o=function(i,a){let s=new Hi("message",{data:a?i:i.toString()});s[Po]=this,nl(t,this,s)};else if(e==="close")o=function(i,a){let s=new yr("close",{code:i,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});s[Po]=this,nl(t,this,s)};else if(e==="error")o=function(i){let a=new Co("error",{error:i,message:i.message});a[Po]=this,nl(t,this,a)};else if(e==="open")o=function(){let i=new Sn("open");i[Po]=this,nl(t,this,i)};else return;o[Bi]=!!r[Bi],o[oh]=t,r.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[oh]===t&&!r[Bi]){this.removeListener(e,r);break}}};yS.exports={CloseEvent:yr,ErrorEvent:Co,Event:Sn,EventTarget:jN,MessageEvent:Hi};function nl(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}});var rl=q((dW,xS)=>{"use strict";var{tokenChars:Zi}=Io();function Wt(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function FN(e){let t=Object.create(null),r=Object.create(null),o=!1,n=!1,i=!1,a,s,l=-1,u=-1,d=-1,p=0;for(;p<e.length;p++)if(u=e.charCodeAt(p),a===void 0)if(d===-1&&Zi[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?(Wt(t,f,r),r=Object.create(null)):a=f,l=d=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(s===void 0)if(d===-1&&Zi[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),Wt(r,e.slice(l,d),!0),u===44&&(Wt(t,a,r),r=Object.create(null),a=void 0),l=d=-1}else if(u===61&&l!==-1&&d===-1)s=e.slice(l,p),l=d=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(n){if(Zi[u]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);l===-1?l=p:o||(o=!0),n=!1}else if(i)if(Zi[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&&Zi[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),Wt(r,s,f),u===44&&(Wt(t,a,r),r=Object.create(null),a=void 0),s=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 a===void 0?Wt(t,m,r):(s===void 0?Wt(r,m,!0):o?Wt(r,s,m.replace(/\\/g,"")):Wt(r,s,m),Wt(t,a,r)),t}function MN(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(a=>a===!0?n:`${n}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}xS.exports={format:MN,parse:FN}});var sl=q((fW,RS)=>{"use strict";var BN=te("events"),HN=te("https"),ZN=te("http"),SS=te("net"),GN=te("tls"),{randomBytes:WN,createHash:VN}=te("crypto"),{Duplex:pW,Readable:mW}=te("stream"),{URL:ih}=te("url"),Wn=$o(),JN=eh(),qN=rh(),{isBlob:KN}=Io(),{BINARY_TYPES:kS,CLOSE_TIMEOUT:XN,EMPTY_BUFFER:ol,GUID:YN,kForOnEventAttribute:ah,kListener:QN,kStatusCode:eL,kWebSocket:Ae,NOOP:_S}=kn(),{EventTarget:{addEventListener:tL,removeEventListener:nL}}=bS(),{format:rL,parse:oL}=rl(),{toBuffer:iL}=Fi(),$S=Symbol("kAborted"),sh=[8,13],_n=["CONNECTING","OPEN","CLOSING","CLOSED"],aL=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,fe=class e extends BN{constructor(t,r,o){super(),this._binaryType=kS[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=ol,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]),IS(this,t,r,o)):(this._autoPong=o.autoPong,this._closeTimeout=o.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){kS.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 JN({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 qN(t,this._extensions,o.generateMask);this._receiver=n,this._sender=i,this._socket=t,n[Ae]=this,i[Ae]=this,t[Ae]=this,n.on("conclude",lL),n.on("drain",uL),n.on("error",dL),n.on("message",pL),n.on("ping",mL),n.on("pong",fL),i.onerror=gL,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",PS),t.on("data",al),t.on("end",CS),t.on("error",TS),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[Wn.extensionName]&&this._extensions[Wn.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){lt(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())}),ES(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){ch(this,t,o);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||ol,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){ch(this,t,o);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||ol,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){ch(this,t,o);return}let n={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Wn.extensionName]||(n.compress=!1),this._sender.send(t||ol,n,o)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){lt(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(fe,"CONNECTING",{enumerable:!0,value:_n.indexOf("CONNECTING")});Object.defineProperty(fe.prototype,"CONNECTING",{enumerable:!0,value:_n.indexOf("CONNECTING")});Object.defineProperty(fe,"OPEN",{enumerable:!0,value:_n.indexOf("OPEN")});Object.defineProperty(fe.prototype,"OPEN",{enumerable:!0,value:_n.indexOf("OPEN")});Object.defineProperty(fe,"CLOSING",{enumerable:!0,value:_n.indexOf("CLOSING")});Object.defineProperty(fe.prototype,"CLOSING",{enumerable:!0,value:_n.indexOf("CLOSING")});Object.defineProperty(fe,"CLOSED",{enumerable:!0,value:_n.indexOf("CLOSED")});Object.defineProperty(fe.prototype,"CLOSED",{enumerable:!0,value:_n.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(fe.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(fe.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[ah])return t[QN];return null},set(t){for(let r of this.listeners(e))if(r[ah]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[ah]:!0})}})});fe.prototype.addEventListener=tL;fe.prototype.removeEventListener=nL;RS.exports=fe;function IS(e,t,r,o){let n={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:XN,protocolVersion:sh[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,!sh.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${sh.join(", ")})`);let i;if(t instanceof ih)i=t;else try{i=new ih(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 a=i.protocol==="wss:",s=i.protocol==="ws+unix:",l;if(i.protocol!=="ws:"&&!a&&!s?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:s&&!i.pathname?l="The URL's pathname is empty":i.hash&&(l="The URL contains a fragment identifier"),l){let y=new SyntaxError(l);if(e._redirects===0)throw y;il(e,y);return}let u=a?443:80,d=WN(16).toString("base64"),p=a?HN.request:ZN.request,m=new Set,f;if(n.createConnection=n.createConnection||(a?cL:sL),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 Wn({...n.perMessageDeflate,isServer:!1,maxPayload:n.maxPayload}),n.headers["Sec-WebSocket-Extensions"]=rL({[Wn.extensionName]:f.offer()})),r.length){for(let y of r){if(typeof y!="string"||!aL.test(y)||m.has(y))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(y)}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}`),s){let y=n.path.split(":");n.socketPath=y[0],n.path=y[1]}let g;if(n.followRedirects){if(e._redirects===0){e._originalIpc=s,e._originalSecure=a,e._originalHostOrSocketPath=s?n.socketPath:i.host;let y=o&&o.headers;if(o={...o,headers:{}},y)for(let[k,_]of Object.entries(y))o.headers[k.toLowerCase()]=_}else if(e.listenerCount("redirect")===0){let y=s?e._originalIpc?n.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:i.host===e._originalHostOrSocketPath;(!y||e._originalSecure&&!a)&&(delete n.headers.authorization,delete n.headers.cookie,y||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",()=>{lt(e,g,"Opening handshake has timed out")}),g.on("error",y=>{g===null||g[$S]||(g=e._req=null,il(e,y))}),g.on("response",y=>{let k=y.headers.location,_=y.statusCode;if(k&&n.followRedirects&&_>=300&&_<400){if(++e._redirects>n.maxRedirects){lt(e,g,"Maximum redirects exceeded");return}g.abort();let P;try{P=new ih(k,t)}catch{let E=new SyntaxError(`Invalid URL: ${k}`);il(e,E);return}IS(e,P,r,o)}else e.emit("unexpected-response",g,y)||lt(e,g,`Unexpected server response: ${y.statusCode}`)}),g.on("upgrade",(y,k,_)=>{if(e.emit("upgrade",y),e.readyState!==fe.CONNECTING)return;g=e._req=null;let P=y.headers.upgrade;if(P===void 0||P.toLowerCase()!=="websocket"){lt(e,k,"Invalid Upgrade header");return}let C=VN("sha1").update(d+YN).digest("base64");if(y.headers["sec-websocket-accept"]!==C){lt(e,k,"Invalid Sec-WebSocket-Accept header");return}let E=y.headers["sec-websocket-protocol"],D;if(E!==void 0?m.size?m.has(E)||(D="Server sent an invalid subprotocol"):D="Server sent a subprotocol but none was requested":m.size&&(D="Server sent no subprotocol"),D){lt(e,k,D);return}E&&(e._protocol=E);let G=y.headers["sec-websocket-extensions"];if(G!==void 0){if(!f){lt(e,k,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let ae;try{ae=oL(G)}catch{lt(e,k,"Invalid Sec-WebSocket-Extensions header");return}let X=Object.keys(ae);if(X.length!==1||X[0]!==Wn.extensionName){lt(e,k,"Server indicated an extension that was not requested");return}try{f.accept(ae[Wn.extensionName])}catch{lt(e,k,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Wn.extensionName]=f}e.setSocket(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 il(e,t){e._readyState=fe.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function sL(e){return e.path=e.socketPath,SS.connect(e)}function cL(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=SS.isIP(e.host)?"":e.host),GN.connect(e)}function lt(e,t,r){e._readyState=fe.CLOSING;let o=new Error(r);Error.captureStackTrace(o,lt),t.setHeader?(t[$S]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(il,e,o)):(t.destroy(o),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function ch(e,t,r){if(t){let o=KN(t)?t.size:iL(t).length;e._socket?e._sender._bufferedBytes+=o:e._bufferedAmount+=o}if(r){let o=new Error(`WebSocket is not open: readyState ${e.readyState} (${_n[e.readyState]})`);process.nextTick(r,o)}}function lL(e,t){let r=this[Ae];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[Ae]!==void 0&&(r._socket.removeListener("data",al),process.nextTick(AS,r._socket),e===1005?r.close():r.close(e,t))}function uL(){let e=this[Ae];e.isPaused||e._socket.resume()}function dL(e){let t=this[Ae];t._socket[Ae]!==void 0&&(t._socket.removeListener("data",al),process.nextTick(AS,t._socket),t.close(e[eL])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function wS(){this[Ae].emitClose()}function pL(e,t){this[Ae].emit("message",e,t)}function mL(e){let t=this[Ae];t._autoPong&&t.pong(e,!this._isServer,_S),t.emit("ping",e)}function fL(e){this[Ae].emit("pong",e)}function AS(e){e.resume()}function gL(e){let t=this[Ae];t.readyState!==fe.CLOSED&&(t.readyState===fe.OPEN&&(t._readyState=fe.CLOSING,ES(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function ES(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function PS(){let e=this[Ae];if(this.removeListener("close",PS),this.removeListener("data",al),this.removeListener("end",CS),e._readyState=fe.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[Ae]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",wS),e._receiver.on("finish",wS))}function al(e){this[Ae]._receiver.write(e)||this.pause()}function CS(){let e=this[Ae];e._readyState=fe.CLOSING,e._receiver.end(),this.end()}function TS(){let e=this[Ae];this.removeListener("error",TS),this.on("error",_S),e&&(e._readyState=fe.CLOSING,this.destroy())}});var LS=q((hW,NS)=>{"use strict";var gW=sl(),{Duplex:hL}=te("stream");function OS(e){e.emit("close")}function vL(){!this.destroyed&&this._writableState.finished&&this.destroy()}function DS(e){this.removeListener("error",DS),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function yL(e,t){let r=!0,o=new hL({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(i,a){let s=!a&&o._readableState.objectMode?i.toString():i;o.push(s)||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(OS,o);return}let a=!1;e.once("error",function(l){a=!0,i(l)}),e.once("close",function(){a||i(n),process.nextTick(OS,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,a){if(e.readyState===e.CONNECTING){e.once("open",function(){o._write(n,i,a)});return}e.send(n,a)},o.on("end",vL),o.on("error",DS),o}NS.exports=yL});var lh=q((vW,US)=>{"use strict";var{tokenChars:bL}=Io();function xL(e){let t=new Set,r=-1,o=-1,n=0;for(n;n<e.length;n++){let a=e.charCodeAt(n);if(o===-1&&bL[a]===1)r===-1&&(r=n);else if(n!==0&&(a===32||a===9))o===-1&&r!==-1&&(o=n);else if(a===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${n}`);o===-1&&(o=n);let s=e.slice(r,o);if(t.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);t.add(s),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}US.exports={parse:xL}});var ZS=q((bW,HS)=>{"use strict";var kL=te("events"),cl=te("http"),{Duplex:yW}=te("stream"),{createHash:wL}=te("crypto"),zS=rl(),br=$o(),SL=lh(),_L=sl(),{CLOSE_TIMEOUT:$L,GUID:IL,kWebSocket:AL}=kn(),EL=/^[+/0-9A-Za-z]{22}==$/,jS=0,FS=1,BS=2,uh=class extends kL{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:$L,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:_L,...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=cl.createServer((o,n)=>{let i=cl.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=PL(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(n,i,a)=>{this.handleUpgrade(n,i,a,o)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=jS}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===BS){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(Gi,this);return}if(t&&this.once("close",t),this._state!==FS)if(this._state=FS,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(Gi,this):process.nextTick(Gi,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Gi(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",MS);let i=t.headers["sec-websocket-key"],a=t.headers.upgrade,s=+t.headers["sec-websocket-version"];if(t.method!=="GET"){xr(this,t,r,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){xr(this,t,r,400,"Invalid Upgrade header");return}if(i===void 0||!EL.test(i)){xr(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(s!==13&&s!==8){xr(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){Wi(r,400);return}let l=t.headers["sec-websocket-protocol"],u=new Set;if(l!==void 0)try{u=SL.parse(l)}catch{xr(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 br({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=zS.parse(d);f[br.extensionName]&&(m.accept(f[br.extensionName]),p[br.extensionName]=m)}catch{xr(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:t.headers[`${s===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,y,k)=>{if(!f)return Wi(r,g||401,y,k);this.completeUpgrade(p,i,u,t,r,o,n)});return}if(!this.options.verifyClient(m))return Wi(r,401)}this.completeUpgrade(p,i,u,t,r,o,n)}completeUpgrade(t,r,o,n,i,a,s){if(!i.readable||!i.writable)return i.destroy();if(i[AL])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>jS)return Wi(i,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${wL("sha1").update(r+IL).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[br.extensionName]){let p=t[br.extensionName].params,m=zS.format({[br.extensionName]:[p]});u.push(`Sec-WebSocket-Extensions: ${m}`),d._extensions=t}this.emit("headers",u,n),i.write(u.concat(`\r
4
+ var yI=Object.create;var iu=Object.defineProperty;var bI=Object.getOwnPropertyDescriptor;var xI=Object.getOwnPropertyNames;var kI=Object.getPrototypeOf,wI=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})},SI=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of xI(t))!wI.call(e,n)&&n!==r&&iu(e,n,{get:()=>t[n],enumerable:!(o=bI(t,n))||o.enumerable});return e};var rn=(e,t,r)=>(r=e!=null?yI(kI(e)):{},SI(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=wD;var k0=/[A-Z]/g;function w0(e){return e.toLowerCase()}function wD(e,t){let r=e.replace(k0,w0),o=t.replace(k0,w0);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 S0=e=>"_"+e,SD=e=>["name","protocol","subtype"].includes(e),_D=e=>{let t={name:e.name,protocol:e.protocol,subtype:e.subtype};return Object.entries(t).filter(([o,n])=>SD(o)&&n!==void 0).reduce((o,[n,i])=>(typeof i==="object"?i.map(s=>o.push(S0(s))):o.push(S0(i)),o),[]).join(".")};Ho.toString=_D;var $D=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=$D});var oh=ie(Er=>{"use strict";var $0=Er&&Er.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Er,"__esModule",{value:!0});Er.Service=void 0;var _0=$0(ue("os")),ID=$0(nh()),ED=ue("events"),AD=rh(),Zo=".local",kl=class extends ED.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 ID.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,AD.toString)({name:t.type,protocol:this.protocol}),this.port=t.port,this.host=t.host||_0.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(_0.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 E0=ie(Ar=>{"use strict";var I0=Ar&&Ar.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.Registry=void 0;var PD=I0(bl()),ih=I0(oh()),CD=3600*1e3,TD=3,RD=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=RD),!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=m=>{n&&(m.answers.some(u)||m.additionals.some(u))&&d(!0)},u=m=>(0,PD.default)(m.name,r.fqdn),d=m=>{t.removeListener("response",l),clearTimeout(s),o(!!m)};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*TD,o<CD&&!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 A0=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 P0=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 C0=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 T0=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 R0=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 N0=ie((D0,dh)=>{var O0=(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=m,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:p=>t.test(p),encode(p,f,g){g=~~g,f=f||new Uint8Array(g+r);let h=p.length,y=0;for(let w=0;w<h;){let _=p.charCodeAt(w++);_===46?(f[g++]=y,y=0):y=y*10+(_-48)}return f[g]=y,f},decode(p,f){return f=~~f,`${p[f++]}.${p[f++]}.${p[f++]}.${p[f]}`}};e.v4=i;let s={name:"v6",size:n,isFormat:p=>p.length>0&&o.test(p),encode(p,f,g){g=~~g;let h=g+n,y=-1,w=0,_=0,I=!0,S=!1;f=f||new Uint8Array(g+n);for(let T=0;T<p.length;T++){let j=p.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]=w>>8),g<h-1&&(f[g+1]=w&255),g+=2),w=0,_=0),I=!0,S=!1):j===46?(g<h&&(f[g]=_),g++,_=0,w=0,I=!1,S=!0):(I=!1,j>=97?j-=87:j>=65?j-=55:(j-=48,_=_*10+j),w=(w<<4)+j)}if(I===!1)S===!0?(g<h&&(f[g]=_),g++):(g<h&&(f[g]=w>>8),g<h-1&&(f[g+1]=w&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(p,f){f=~~f;let g="";for(let h=0;h<n;h+=2)h!==0&&(g+=":"),g+=(p[f+h]<<8|p[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(p){if(i.isFormat(p))return i.size;if(s.isFormat(p))return s.size;throw Error(`Invalid ip address: ${p}`)}function u(p){return l(p)===i.size?1:2}function d(p,f,g){g=~~g;let h=l(p);return typeof f=="function"&&(f=f(g+h)),h===i.size?i.encode(p,f,g):s.encode(p,f,g)}function m(p,f,g){if(f=~~f,g=g||p.length-f,g===i.size)return i.decode(p,f,g);if(g===s.size)return s.decode(p,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 O0}):typeof dh=="object"&&typeof D0=="object"&&(dh.exports=O0)});var j0=ie(B=>{"use strict";var H=ue("buffer").Buffer,In=A0(),OD=P0(),DD=C0(),_l=T0(),ph=R0(),Pr=N0(),ND=0,L0=32768,mh=32768,LD=~mh,U0=32768,UD=~U0,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"?L0:ND;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&L0?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:DD.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:OD.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={},jD=B.cname=Ct,zD=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&lt.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 m of e.tags)t.writeUInt16BE(m,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 jD;case"DNAME":return zD;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&LD),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&U0&&(o.class&=UD),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 M0=ie((K8,F0)=>{"use strict";var z0=GD;process.nextTick(ZD,42);F0.exports=FD;function FD(e){var t=o;return r;function r(n){t(n||BD)}function o(n){var i=[n];t=s,e(a);function s(l){i.push(l)}function a(l){var u=arguments;for(t=MD(l)?o:d;i.length;)d(i.shift());function d(m){z0(HD,m,u)}}}}function MD(e){return Object.prototype.toString.call(e)==="[object Error]"}function BD(){}function HD(e,t){e.apply(null,t)}function ZD(e){e===42&&(z0=process.nextTick)}function GD(e,t,r){process.nextTick(function(){e(t,r)})}});var Z0=ie((X8,H0)=>{var gh=j0(),WD=ue("dgram"),VD=M0(),qD=ue("events"),vh=ue("os"),hh=function(){};H0.exports=function(e){e||(e={});var t=new qD.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||WD.createSocket({type:o,reuseAddr:e.reuseAddr!==!1,toString:function(){return o}});u.on("error",function(m){m.code==="EACCES"||m.code==="EADDRINUSE"?t.emit("error",m):t.emit("warning",m)}),u.on("message",function(m,p){try{m=gh.decode(m)}catch(f){t.emit("warning",f);return}t.emit("packet",m,p),m.type==="query"&&t.emit("query",m,p),m.type==="response"&&t.emit("response",m,p)}),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=VD(function(m){if(!r||e.bind===!1)return m(null);u.once("error",m),u.bind(r,e.bind||e.interface,function(){u.removeListener("error",m),m(null)})});return d(function(m){if(m)return t.emit("error",m);t.emit("ready")}),t.send=function(m,p,f){if(typeof p=="function")return t.send(m,null,p);f||(f=hh),p?!p.host&&!p.address&&(p.address=i.address):p=i,d(g);function g(h){if(a)return f();if(h)return f(h);var y=gh.encode(m);u.send(y,0,y.length,p.port,p.address||p.host,f)}},t.response=t.respond=function(m,p,f){Array.isArray(m)&&(m={answers:m}),m.type="response",m.flags=(m.flags||0)|gh.AUTHORITATIVE_ANSWER,t.send(m,p,f)},t.query=function(m,p,f,g){if(typeof p=="function")return t.query(m,null,null,p);if(typeof p=="object"&&p&&p.port)return t.query(m,null,p,f);if(typeof f=="function")return t.query(m,p,null,f);g||(g=hh),typeof m=="string"&&(m=[{name:m,type:p||"ANY"}]),Array.isArray(m)&&(m={type:"query",questions:m}),m.type="query",t.send(m,f,g)},t.destroy=function(m){if(m||(m=hh),a)return process.nextTick(m);a=!0,clearInterval(l);for(var p in s)try{u.dropMembership(n,p)}catch{}s={},u.close(m)},t.update=function(){for(var m=e.interface?[].concat(e.interface):KD(),p=!1,f=0;f<m.length;f++){var g=m[f];if(!s[g])try{u.addMembership(n,g),s[g]=!0,p=!0}catch(h){t.emit("warning",h)}}if(p){if(u.setMulticastInterface)try{u.setMulticastInterface(e.interface||JD())}catch(h){t.emit("warning",h)}t.emit("networkInterface")}},t};function JD(){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(B0(i.family)&&!i.internal)return vh.platform()==="darwin"&&t[r]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function KD(){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(B0(s.family)){r.push(s.address);break}}return r}function B0(e){return e===4||e==="IPv4"}});var W0=ie((Y8,G0)=>{"use strict";G0.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 V0=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 XD=yh(Z0()),YD=yh(W0()),QD=yh(bl()),$l=class{constructor(t,r){this.registry={},this.mdns=(0,XD.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,QD.default)(n,t)}):[]}isDuplicateRecord(t){return r=>t.type===r.type&&t.name===r.name&&(0,YD.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 q0=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 J0=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 K0=ie(kh=>{"use strict";Object.defineProperty(kh,"__esModule",{value:!0});kh.default=eN;function eN(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 Q0=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 tN=fs(nh()),Yn=fs(bl()),nN=ue("events"),wh=rh(),X0=fs(q0()),rN=fs(J0()),oN=fs(K0()),Y0=".local",iN="_services._dns-sd._udp"+Y0,Il=class e extends nN.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 tN.default(r!==null&&r.txt!=null?r.txt:void 0),r===null||r.type===void 0?(this.name=iN,this.wildcard=!0):(this.name=(0,wh.toString)({name:r.type,protocol:r.protocol||"tcp"})+Y0,r.name&&(this.name=r.name+"."+this.name),this.wildcard=!1),r!=null&&r.txt!==void 0&&(this.txtQuery=(0,rN.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,X0.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,oN.default)(r.txt,t?.txt||{})){if(!(0,X0.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("."),m=d[0],p=(0,wh.toType)(d.slice(1,-1).join("."));l.name=m,l.fqdn=u.name,l.host=u.data.target,l.referer=n,l.port=u.data.port,l.type=p.name,l.protocol=p.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 eS=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 sN=El(E0()),aN=El(V0()),Sh=El(Q0());En.Browser=Sh.default;var cN=El(oh());En.Service=cN.default;var _h=class{constructor(t={},r){this.server=new aN.default(t,r),this.registry=new sN.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 nS=ie((Je,tS)=>{"use strict";var lN=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]})),uN=Je&&Je.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),dN=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"&&lN(r,t,o[n]);return uN(r,t),r}})();Object.defineProperty(Je,"__esModule",{value:!0});Je.Browser=Je.Service=Je.Bonjour=void 0;var gs=dN(eS());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;tS.exports=Object.assign(Rr,{Bonjour:Rr,Service:gs.Service,Browser:gs.Browser,default:Rr})});var Tn=ie((xK,x_)=>{"use strict";var y_=["nodebuffer","arraybuffer","fragments"],b_=typeof Blob<"u";b_&&y_.push("blob");x_.exports={BINARY_TYPES:y_,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:b_,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var ks=ie((kK,Fl)=>{"use strict";var{EMPTY_BUFFER:XU}=Tn(),Mh=Buffer[Symbol.species];function YU(e,t){if(e.length===0)return XU;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 Mh(r.buffer,r.byteOffset,o):r}function k_(e,t,r,o,n){for(let i=0;i<n;i++)r[o+i]=e[i]^t[i&3]}function w_(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}function QU(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function Bh(e){if(Bh.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new Mh(e):ArrayBuffer.isView(e)?t=new Mh(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),Bh.readOnly=!1),t}Fl.exports={concat:YU,mask:k_,toArrayBuffer:QU,toBuffer:Bh,unmask:w_};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=ue("bufferutil");Fl.exports.mask=function(t,r,o,n,i){i<48?k_(t,r,o,n,i):e.mask(t,r,o,n,i)},Fl.exports.unmask=function(t,r){t.length<32?w_(t,r):e.unmask(t,r)}}catch{}});var $_=ie((wK,__)=>{"use strict";var S_=Symbol("kDone"),Hh=Symbol("kRun"),Zh=class{constructor(t){this[S_]=()=>{this.pending--,this[Hh]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Hh]()}[Hh](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[S_])}}};__.exports=Zh});var ei=ie((SK,P_)=>{"use strict";var ws=ue("zlib"),I_=ks(),ej=$_(),{kStatusCode:E_}=Tn(),tj=Buffer[Symbol.species],nj=Buffer.from([0,0,255,255]),Bl=Symbol("permessage-deflate"),Rn=Symbol("total-length"),Yo=Symbol("callback"),rr=Symbol("buffers"),Qo=Symbol("error"),Ml,Gh=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 ej(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",oj),this._inflate.on("data",A_)}this._inflate[Yo]=o,this._inflate.write(t),r&&this._inflate.write(nj),this._inflate.flush(()=>{let i=this._inflate[Qo];if(i){this._inflate.close(),this._inflate=null,o(i);return}let s=I_.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",rj)}this._deflate[Yo]=o,this._deflate.write(t),this._deflate.flush(ws.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=I_.concat(this._deflate[rr],this._deflate[Rn]);r&&(i=new tj(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)})}};P_.exports=Gh;function rj(e){this[rr].push(e),this[Rn]+=e.length}function A_(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][E_]=1009,this.removeListener("data",A_),this.reset()}function oj(e){if(this[Bl]._inflate=null,this[Qo]){this[Yo](this[Qo]);return}e[E_]=1007,this[Yo](e)}});var ti=ie((_K,Hl)=>{"use strict";var{isUtf8:C_}=ue("buffer"),{hasBlob:ij}=Tn(),sj=[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 aj(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function Wh(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 cj(e){return ij&&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:cj,isValidStatusCode:aj,isValidUTF8:Wh,tokenChars:sj};if(C_)Hl.exports.isValidUTF8=function(e){return e.length<24?Wh(e):C_(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?Wh(t):e(t)}}catch{}});var Xh=ie(($K,U_)=>{"use strict";var{Writable:lj}=ue("stream"),T_=ei(),{BINARY_TYPES:uj,EMPTY_BUFFER:R_,kStatusCode:dj,kWebSocket:pj}=Tn(),{concat:Vh,toArrayBuffer:mj,unmask:fj}=ks(),{isValidStatusCode:gj,isValidUTF8:O_}=ti(),Zl=Buffer[Symbol.species],yt=0,D_=1,N_=2,L_=3,qh=4,Jh=5,Gl=6,Kh=class extends lj{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||uj[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[pj]=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 D_:this.getPayloadLength16(t);break;case N_:this.getPayloadLength64(t);break;case L_:this.getMask();break;case qh:this.getData(t);break;case Jh: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[T_.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=D_:this._payloadLength===127?this._state=N_: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=L_:this._state=qh}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=qh}getData(t){let r=R_;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&&fj(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._compressed){this._state=Jh,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[T_.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=Vh(o,r):this._binaryType==="arraybuffer"?n=mj(Vh(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=Vh(o,r);if(!this._skipUTF8Validation&&!O_(n)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(i);return}this._state===Jh||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,R_),this.end();else{let o=t.readUInt16BE(0);if(!gj(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&&!O_(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[dj]=n,s}};U_.exports=Kh});var ev=ie((EK,F_)=>{"use strict";var{Duplex:IK}=ue("stream"),{randomFillSync:hj}=ue("crypto"),{types:{isUint8Array:vj}}=ue("util"),j_=ei(),{EMPTY_BUFFER:yj,kWebSocket:bj,NOOP:xj}=Tn(),{isBlob:ni,isValidStatusCode:kj}=ti(),{mask:z_,toBuffer:jr}=ks(),bt=Symbol("kByteLength"),wj=Buffer.alloc(4),Wl=8*1024,zr,ri=Wl,Dt=0,Sj=1,_j=2,Yh=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=xj,this[bj]=void 0}static frame(t,r){let o,n=!1,i=2,s=!1;r.mask&&(o=r.maskBuffer||wj,r.generateMask?r.generateMask(o):(ri===Wl&&(zr===void 0&&(zr=Buffer.alloc(Wl)),hj(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?(z_(t,o,u,i,a),[u]):(z_(t,o,t,0,a),[u,t])):[u,t]}close(t,r,o,n){let i;if(t===void 0)i=yj;else{if(typeof t!="number"||!kj(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(vj(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[j_.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=_j,t.arrayBuffer().then(i=>{if(this._socket.destroyed){let a=new Error("The socket was closed while the blob was being read");process.nextTick(Qh,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($j,this,i,n)})}dispatch(t,r,o,n){if(!r){this.sendFrame(e.frame(t,o),n);return}let i=this._extensions[j_.extensionName];this._bufferedBytes+=o[bt],this._state=Sj,i.compress(t,o.fin,(s,a)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");Qh(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)}};F_.exports=Yh;function Qh(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 $j(e,t,r){Qh(e,t,r),e.onerror(t)}});var J_=ie((AK,q_)=>{"use strict";var{kForOnEventAttribute:Ss,kListener:tv}=Tn(),M_=Symbol("kCode"),B_=Symbol("kData"),H_=Symbol("kError"),Z_=Symbol("kMessage"),G_=Symbol("kReason"),oi=Symbol("kTarget"),W_=Symbol("kType"),V_=Symbol("kWasClean"),On=class{constructor(t){this[oi]=null,this[W_]=t}get target(){return this[oi]}get type(){return this[W_]}};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[M_]=r.code===void 0?0:r.code,this[G_]=r.reason===void 0?"":r.reason,this[V_]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[M_]}get reason(){return this[G_]}get wasClean(){return this[V_]}};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[H_]=r.error===void 0?null:r.error,this[Z_]=r.message===void 0?"":r.message}get error(){return this[H_]}get message(){return this[Z_]}};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[B_]=r.data===void 0?null:r.data}get data(){return this[B_]}};Object.defineProperty(_s.prototype,"data",{enumerable:!0});var Ij={addEventListener(e,t,r={}){for(let n of this.listeners(e))if(!r[Ss]&&n[tv]===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[tv]=t,r.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[tv]===t&&!r[Ss]){this.removeListener(e,r);break}}};q_.exports={CloseEvent:Fr,ErrorEvent:ii,Event:On,EventTarget:Ij,MessageEvent:_s};function Vl(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}});var ql=ie((PK,K_)=>{"use strict";var{tokenChars:$s}=ti();function en(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function Ej(e){let t=Object.create(null),r=Object.create(null),o=!1,n=!1,i=!1,s,a,l=-1,u=-1,d=-1,m=0;for(;m<e.length;m++)if(u=e.charCodeAt(m),s===void 0)if(d===-1&&$s[u]===1)l===-1&&(l=m);else if(m!==0&&(u===32||u===9))d===-1&&l!==-1&&(d=m);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${m}`);d===-1&&(d=m);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 ${m}`);else if(a===void 0)if(d===-1&&$s[u]===1)l===-1&&(l=m);else if(u===32||u===9)d===-1&&l!==-1&&(d=m);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${m}`);d===-1&&(d=m),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,m),l=d=-1;else throw new SyntaxError(`Unexpected character at index ${m}`);else if(n){if($s[u]!==1)throw new SyntaxError(`Unexpected character at index ${m}`);l===-1?l=m:o||(o=!0),n=!1}else if(i)if($s[u]===1)l===-1&&(l=m);else if(u===34&&l!==-1)i=!1,d=m;else if(u===92)n=!0;else throw new SyntaxError(`Unexpected character at index ${m}`);else if(u===34&&e.charCodeAt(m-1)===61)i=!0;else if(d===-1&&$s[u]===1)l===-1&&(l=m);else if(l!==-1&&(u===32||u===9))d===-1&&(d=m);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${m}`);d===-1&&(d=m);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 ${m}`);if(l===-1||i||u===32||u===9)throw new SyntaxError("Unexpected end of input");d===-1&&(d=m);let p=e.slice(l,d);return s===void 0?en(t,p,r):(a===void 0?en(r,p,!0):o?en(r,a,p.replace(/\\/g,"")):en(r,a,p),en(t,s,r)),t}function Aj(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(", ")}K_.exports={format:Aj,parse:Ej}});var Yl=ie((RK,c$)=>{"use strict";var Pj=ue("events"),Cj=ue("https"),Tj=ue("http"),Q_=ue("net"),Rj=ue("tls"),{randomBytes:Oj,createHash:Dj}=ue("crypto"),{Duplex:CK,Readable:TK}=ue("stream"),{URL:nv}=ue("url"),or=ei(),Nj=Xh(),Lj=ev(),{isBlob:Uj}=ti(),{BINARY_TYPES:X_,CLOSE_TIMEOUT:jj,EMPTY_BUFFER:Jl,GUID:zj,kForOnEventAttribute:rv,kListener:Fj,kStatusCode:Mj,kWebSocket:Re,NOOP:e$}=Tn(),{EventTarget:{addEventListener:Bj,removeEventListener:Hj}}=J_(),{format:Zj,parse:Gj}=ql(),{toBuffer:Wj}=ks(),t$=Symbol("kAborted"),ov=[8,13],Dn=["CONNECTING","OPEN","CLOSING","CLOSED"],Vj=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,Se=class e extends Pj{constructor(t,r,o){super(),this._binaryType=X_[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]),n$(this,t,r,o)):(this._autoPong=o.autoPong,this._closeTimeout=o.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){X_.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 Nj({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 Lj(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",Kj),n.on("drain",Xj),n.on("error",Yj),n.on("message",Qj),n.on("ping",ez),n.on("pong",tz),i.onerror=nz,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",i$),t.on("data",Xl),t.on("end",s$),t.on("error",a$),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())}),o$(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){iv(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){iv(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){iv(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[rv])return t[Fj];return null},set(t){for(let r of this.listeners(e))if(r[rv]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[rv]:!0})}})});Se.prototype.addEventListener=Bj;Se.prototype.removeEventListener=Hj;c$.exports=Se;function n$(e,t,r,o){let n={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:jj,protocolVersion:ov[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,!ov.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${ov.join(", ")})`);let i;if(t instanceof nv)i=t;else try{i=new nv(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=Oj(16).toString("base64"),m=s?Cj.request:Tj.request,p=new Set,f;if(n.createConnection=n.createConnection||(s?Jj:qj),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"]=Zj({[or.extensionName]:f.offer()})),r.length){for(let h of r){if(typeof h!="string"||!Vj.test(h)||p.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");p.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,w]of Object.entries(h))o.headers[y.toLowerCase()]=w}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=m(n),e._redirects&&e.emit("redirect",e.url,g)}else g=e._req=m(n);n.timeout&&g.on("timeout",()=>{pt(e,g,"Opening handshake has timed out")}),g.on("error",h=>{g===null||g[t$]||(g=e._req=null,Kl(e,h))}),g.on("response",h=>{let y=h.headers.location,w=h.statusCode;if(y&&n.followRedirects&&w>=300&&w<400){if(++e._redirects>n.maxRedirects){pt(e,g,"Maximum redirects exceeded");return}g.abort();let _;try{_=new nv(y,t)}catch{let S=new SyntaxError(`Invalid URL: ${y}`);Kl(e,S);return}n$(e,_,r,o)}else e.emit("unexpected-response",g,h)||pt(e,g,`Unexpected server response: ${h.statusCode}`)}),g.on("upgrade",(h,y,w)=>{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=Dj("sha1").update(d+zj).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?p.size?p.has(S)||(T="Server sent an invalid subprotocol"):T="Server sent a subprotocol but none was requested":p.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 z;try{z=Gj(j)}catch{pt(e,y,"Invalid Sec-WebSocket-Extensions header");return}let J=Object.keys(z);if(J.length!==1||J[0]!==or.extensionName){pt(e,y,"Server indicated an extension that was not requested");return}try{f.accept(z[or.extensionName])}catch{pt(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[or.extensionName]=f}e.setSocket(y,w,{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 qj(e){return e.path=e.socketPath,Q_.connect(e)}function Jj(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Q_.isIP(e.host)?"":e.host),Rj.connect(e)}function pt(e,t,r){e._readyState=Se.CLOSING;let o=new Error(r);Error.captureStackTrace(o,pt),t.setHeader?(t[t$]=!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 iv(e,t,r){if(t){let o=Uj(t)?t.size:Wj(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 Kj(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(r$,r._socket),e===1005?r.close():r.close(e,t))}function Xj(){let e=this[Re];e.isPaused||e._socket.resume()}function Yj(e){let t=this[Re];t._socket[Re]!==void 0&&(t._socket.removeListener("data",Xl),process.nextTick(r$,t._socket),t.close(e[Mj])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function Y_(){this[Re].emitClose()}function Qj(e,t){this[Re].emit("message",e,t)}function ez(e){let t=this[Re];t._autoPong&&t.pong(e,!this._isServer,e$),t.emit("ping",e)}function tz(e){this[Re].emit("pong",e)}function r$(e){e.resume()}function nz(e){let t=this[Re];t.readyState!==Se.CLOSED&&(t.readyState===Se.OPEN&&(t._readyState=Se.CLOSING,o$(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function o$(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function i$(){let e=this[Re];if(this.removeListener("close",i$),this.removeListener("data",Xl),this.removeListener("end",s$),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",Y_),e._receiver.on("finish",Y_))}function Xl(e){this[Re]._receiver.write(e)||this.pause()}function s$(){let e=this[Re];e._readyState=Se.CLOSING,e._receiver.end(),this.end()}function a$(){let e=this[Re];this.removeListener("error",a$),this.on("error",e$),e&&(e._readyState=Se.CLOSING,this.destroy())}});var p$=ie((DK,d$)=>{"use strict";var OK=Yl(),{Duplex:rz}=ue("stream");function l$(e){e.emit("close")}function oz(){!this.destroyed&&this._writableState.finished&&this.destroy()}function u$(e){this.removeListener("error",u$),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function iz(e,t){let r=!0,o=new rz({...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(l$,o);return}let s=!1;e.once("error",function(l){s=!0,i(l)}),e.once("close",function(){s||i(n),process.nextTick(l$,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",oz),o.on("error",u$),o}d$.exports=iz});var sv=ie((NK,m$)=>{"use strict";var{tokenChars:sz}=ti();function az(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&&sz[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}m$.exports={parse:az}});var x$=ie((UK,b$)=>{"use strict";var cz=ue("events"),Ql=ue("http"),{Duplex:LK}=ue("stream"),{createHash:lz}=ue("crypto"),f$=ql(),Mr=ei(),uz=sv(),dz=Yl(),{CLOSE_TIMEOUT:pz,GUID:mz,kWebSocket:fz}=Tn(),gz=/^[+/0-9A-Za-z]{22}==$/,g$=0,h$=1,y$=2,av=class extends cz{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:pz,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:dz,...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=hz(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=g$}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===y$){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!==h$)if(this._state=h$,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",v$);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||!gz.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=uz.parse(l)}catch{Br(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let d=t.headers["sec-websocket-extensions"],m={};if(this.options.perMessageDeflate&&d!==void 0){let p=new Mr({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=f$.parse(d);f[Mr.extensionName]&&(p.accept(f[Mr.extensionName]),m[Mr.extensionName]=p)}catch{Br(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let p={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(p,(f,g,h,y)=>{if(!f)return Es(r,g||401,h,y);this.completeUpgrade(m,i,u,t,r,o,n)});return}if(!this.options.verifyClient(p))return Es(r,401)}this.completeUpgrade(m,i,u,t,r,o,n)}completeUpgrade(t,r,o,n,i,s,a){if(!i.readable||!i.writable)return i.destroy();if(i[fz])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>g$)return Es(i,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${lz("sha1").update(r+mz).digest("base64")}`],d=new this.options.WebSocket(null,void 0,this.options);if(o.size){let m=this.options.handleProtocols?this.options.handleProtocols(o,n):o.values().next().value;m&&(u.push(`Sec-WebSocket-Protocol: ${m}`),d._protocol=m)}if(t[Mr.extensionName]){let m=t[Mr.extensionName].params,p=f$.format({[Mr.extensionName]:[m]});u.push(`Sec-WebSocket-Extensions: ${p}`),d._extensions=t}this.emit("headers",u,n),i.write(u.concat(`\r
5
5
  `).join(`\r
6
- `)),i.removeListener("error",MS),d.setSocket(i,a,{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(Gi,this)})),s(d,n)}};HS.exports=uh;function PL(e,t){for(let r of Object.keys(t))e.on(r,t[r]);return function(){for(let o of Object.keys(t))e.removeListener(o,t[o])}}function Gi(e){e._state=BS,e.emit("close")}function MS(){this.destroy()}function Wi(e,t,r,o){r=r||cl.STATUS_CODES[t],o={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...o},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${cl.STATUS_CODES[t]}\r
6
+ `)),i.removeListener("error",v$),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(Is,this)})),a(d,n)}};b$.exports=av;function hz(e,t){for(let r of Object.keys(t))e.on(r,t[r]);return function(){for(let o of Object.keys(t))e.removeListener(o,t[o])}}function Is(e){e._state=y$,e.emit("close")}function v$(){this.destroy()}function Es(e,t,r,o){r=r||Ql.STATUS_CODES[t],o={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...o},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${Ql.STATUS_CODES[t]}\r
7
7
  `+Object.keys(o).map(n=>`${n}: ${o[n]}`).join(`\r
8
8
  `)+`\r
9
9
  \r
10
- `+r)}function xr(e,t,r,o,n,i){if(e.listenerCount("wsClientError")){let a=new Error(n);Error.captureStackTrace(a,xr),e.emit("wsClientError",a,r,t)}else Wi(r,o,n,i)}});import{createHash as VA}from"node:crypto";import{chmodSync as Xv,mkdirSync as JA,readFileSync as qA,renameSync as KA,rmSync as Yv,writeFileSync as Qv}from"node:fs";import XA from"node:os";import Ue from"node:path";import J_ from"node:os";import q_ from"node:path";var W=process.env.BRIDGE_SECRET_DIR||q_.join(J_.homedir(),".claude-bridge");import{existsSync as s$,readdirSync as c$,readFileSync as l$}from"node:fs";import u$ from"node:os";import wr from"node:path";import{createHash as r$}from"node:crypto";import{readFileSync as wh,rmSync as o$}from"node:fs";import Vn from"node:path";import{mkdirSync as K_,readFileSync as X_,renameSync as Y_,rmSync as Q_,writeFileSync as e$}from"node:fs";import t$ from"node:path";function n$(e){return[...new Set(e.split(`
11
- `).map(t=>t.trim()).filter(Boolean))]}function gl(e){try{return n$(X_(e,"utf8"))}catch{return[]}}function xh(e){let t=r=>{try{if(r.length===0){Q_(e,{force:!0});return}K_(t$.dirname(e),{recursive:!0,mode:448});let o=`${e}.tmp`;e$(o,`${r.join(`
10
+ `+r)}function Br(e,t,r,o,n,i){if(e.listenerCount("wsClientError")){let s=new Error(n);Error.captureStackTrace(s,Br),e.emit("wsClientError",s,r,t)}else Es(r,o,n,i)}});import{createHash as CP}from"node:crypto";import{chmodSync as Qy,mkdirSync as TP,readFileSync as RP,renameSync as OP,rmSync as eb,writeFileSync as tb}from"node:fs";import DP from"node:os";import He from"node:path";import _I from"node:os";import $I from"node:path";var Q=process.env.BRIDGE_SECRET_DIR||$I.join(_I.homedir(),".claude-bridge");import{existsSync as UI,readdirSync as jI,readFileSync as zI}from"node:fs";import FI from"node:os";import Zr from"node:path";import{createHash as OI}from"node:crypto";import{readFileSync as bv,rmSync as DI}from"node:fs";import ir from"node:path";import{mkdirSync as II,readFileSync as EI,renameSync as AI,rmSync as PI,writeFileSync as CI}from"node:fs";import TI from"node:path";function RI(e){return[...new Set(e.split(`
11
+ `).map(t=>t.trim()).filter(Boolean))]}function su(e){try{return RI(EI(e,"utf8"))}catch{return[]}}function vv(e){let t=r=>{try{if(r.length===0){PI(e,{force:!0});return}II(TI.dirname(e),{recursive:!0,mode:448});let o=`${e}.tmp`;CI(o,`${r.join(`
12
12
  `)}
13
- `,{mode:384}),Y_(o,e)}catch{}};return{add(r){let o=gl(e);o.includes(r)||t([...o,r])},remove(r){let o=gl(e);o.includes(r)&&t(o.filter(n=>n!==r))}}}function kh(e,t){if(!t)return 0;let r=0;for(let o of gl(e))try{t.delete(o),r++}catch{}return r}var i$=/^[A-Za-z0-9][A-Za-z0-9_.-]{0,79}$/;function ut(e){return i$.test(e)&&!e.includes("..")?e:`h_${r$("sha256").update(e,"utf8").digest("hex").slice(0,24)}`}function ea(e){return Vn.join(W,"users",e)}function Ze(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 Lo=Vn.join(W,"active-user.json");function Sh(){try{let e=JSON.parse(wh(Lo,"utf8"));return typeof e.sub=="string"&&e.sub?e.sub:null}catch{return null}}var a$="layout-version.json";function Kt(){try{let e=JSON.parse(wh(Vn.join(W,a$),"utf8"));return typeof e.version=="number"&&Number.isFinite(e.version)?e.version:0}catch{return 0}}var Xt=3;function _h(e){if(!e||e.includes("/")||e.includes("\\")||e.includes("..")||e.includes("\0"))throw new Error(`unsafe credential segment: ${JSON.stringify(e)}`)}function yt(e){_h(e);let t=ea(e);return{accessFile:Vn.join(t,"relay-access-token"),refreshFile:Vn.join(t,"relay-refresh-token")}}function hl(e,t){_h(e);let r=Vn.join(ea(e),"providers"),o=kh(Vn.join(r,".keyring-index"),t??null);return o$(r,{recursive:!0,force:!0}),o}var vl=e=>{try{return l$(e,"utf8").trim()||null}catch{return null}},Jn="hub-endpoint.json",d$=24,p$=new Set(["public","default","default user","all users","defaultapppool","administrator"]);function yl(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 m$(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 bl(e){let t=[],r=n=>{t.length<d$&&!t.includes(n)&&t.push(n)},o=n=>!p$.has(n.toLowerCase());if(e.isWsl){let n=m$(e);for(let i of e.listDir(n).filter(a=>/^[a-zA-Z]$/.test(a))){let a=`${n}/${i}/Users`;o(e.userName)&&r(`${a}/${e.userName}`);for(let s of e.listDir(a))o(s)&&r(`${a}/${s}`)}return t}if(e.platform==="win32")for(let n of["\\\\wsl.localhost","\\\\wsl$"])for(let i of e.listDir(`${n}\\`)){let a=`${n}\\${i}\\home`;r(`${a}\\${e.userName}`);for(let s of e.listDir(a))r(`${a}\\${s}`)}return t}function f$(e){let t=e.isWsl?"/":"\\";return bl(e).map(r=>`${r}${t}.claude-bridge`)}function g$(e){let t=i=>yl(e.readFile(i.endsWith("\\")||i.endsWith("/")?`${i}${Jn}`:`${i}${e.platform==="win32"?"\\":"/"}${Jn}`)),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 f$(e)){let a=t(i);a&&(!n||a.startedAt>n.beacon.startedAt)&&(n={dir:i,beacon:a})}return n?{dir:n.dir,source:e.isWsl?"peer-wsl":"peer-windows",beacon:n.beacon}:{dir:e.secretDir,source:"local",beacon:null}}function $h(e,t,r){return t!=="linux"?!1:e.WSL_DISTRO_NAME||e.WSL_INTEROP?!0:/microsoft/i.test(r("/proc/version")??"")}function na(){return $h(process.env,process.platform,vl)}var ta=null;function Sr(e={}){if(ta&&!e.fresh)return ta;let t=n=>vl(n),r=n=>{try{return c$(n)}catch{return[]}},o="";try{o=u$.userInfo().username}catch{o=process.env.USER??process.env.USERNAME??""}return ta=g$({secretDir:W,env:process.env,platform:process.platform,userName:o,isWsl:$h(process.env,process.platform,t),pidAlive:n=>{try{return process.kill(n,0),!0}catch(i){return i.code==="EPERM"}},readFile:t,listDir:r}),ta}function Ih(e){return{hubTokenFile:wr.join(e,"hub-token"),activeUserFile:wr.join(e,"active-user.json"),sessionsDir:wr.join(e,"sessions"),configFile:wr.join(e,"config.json"),beaconFile:wr.join(e,Jn)}}function h$(e){let t=vl(Ih(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 Ah(e){let t=h$(e);if(t){let r=wr.join(e,"users",ut(t),"hub-token");if(s$(r))return r}return Ih(e).hubTokenFile}function ra(e){if(e?.isDevBuild!==!0)return!1;let t=e.env??process.env;return t.BRIDGE_VOICE==="1"||t.BRIDGE_VOICE==="true"}var hz=256*1024;import{readFileSync as v$}from"node:fs";import Uo from"node:path";var y$=/^(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 xl(e){if(typeof e!="string")return{kind:"invalid"};let t=y$.exec(e);return t?t[1]==="0"&&t[2]==="0"&&t[3]==="0"?{kind:"dev"}:{kind:"release",version:e}:{kind:"invalid"}}function Eh(e){let t=xl(e);return t.kind==="release"?t.version:null}function Ct(e=process.env,t=process.argv){let r=xl(e.BRIDGE_CLIENT_VERSION);if(r.kind==="release")return r.version;if(r.kind==="dev")return null;let o=Uo.join(W,"payload"),n=t[1];if(!n)return null;let i=Uo.relative(o,Uo.resolve(n));if(i===""||i.startsWith("..")||Uo.isAbsolute(i))return null;try{let a=JSON.parse(v$(Uo.join(o,"version.json"),"utf8")),s=xl(a.version);return s.kind==="release"?s.version:null}catch{return null}}import{readdirSync as b$}from"node:fs";import x$ from"node:path";var qn=class extends Error{constructor(r,o){super(r);this.status=o;this.name="RelayError"}status},k$=e=>e.replace(/\/+$/,"");async function kl(e,t,r,o){return fetch(`${k$(e)}${t}`,{method:"POST",headers:{"content-type":"application/json",...o?{authorization:`Bearer ${o}`}:{}},body:r===void 0?void 0:JSON.stringify(r)})}async function Ph(e,t){let r=await kl(e,"/node/provision",{},t);if(!r.ok)throw new qn(`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 qn("provision returned no claim_code",r.status);return o.claim_code}async function Ch(e,t){let r=await kl(e,"/node/claim",{claim_code:t});if(!r.ok)throw new qn(`pairing failed (${r.status}): ${(await r.text().catch(()=>"")).slice(0,200)}`,r.status);return await r.json()}async function w$(e,t){let r=await kl(e,"/node/token",void 0,t);if(!r.ok)throw new qn(`refresh rejected (${r.status})`,r.status);return await r.json()}function zo(e,t={}){let r=t.log??(l=>console.warn(l)),o=Ze(e.refresh_token),n=Ze(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 a=ut(i),s=yt(a);return ge(s.refreshFile,e.refresh_token),ge(s.accessFile,e.access_token),{sub:i,segment:a}}var S$="__none__";function he(){let e=Sh();if(e)return yt(ut(e));let[t,r]=dt();return t&&!r?yt(t.segment):yt(S$)}function Th(e){let t;try{t=b$(x$.join(W,"users"),{withFileTypes:!0})}catch{return[]}let r=[];for(let o of t){if(!o.isDirectory())continue;let n;try{n=yt(o.name)}catch{continue}let i=O(n.refreshFile),a=i?Ze(i):null;if(e){if(!a)continue;r.push({sub:a,segment:o.name});continue}let s=a?null:O(n.accessFile),l=a??(s?Ze(s):null);l&&r.push({sub:l,segment:o.name})}return r}function dt(){return Th(!1)}function oa(){return Th(!0)}function _$(e=he()){return O(e.refreshFile)}function jo(e=he()){ue(e.accessFile),ue(e.refreshFile)}function $$(e=he()){let t=O(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 Tt(e,t=60,r,o=he()){let n=$$(o);if(n!==null&&n>t)return!0;let i=_$(o);if(!i)return n!==null&&n>0;try{return zo(await w$(e,i)),!0}catch(a){return r?.(`token refresh failed: ${a instanceof Error?a.message:String(a)}`),a instanceof qn&&(a.status===400||a.status===401)&&jo(o),!1}}function wl(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. Run `acbridge pair` here to take the pairing back.":e==="node_revoked"?"This machine's pairing has been revoked. Run `acbridge pair` to set it up again.":null}import Sl from"node:path";function _l(e){if(!e)return!1;try{return e.available()}catch{return!1}}function $l(e){return _l(e)?"keyring":"file"}function I$(e){let{file:t,account:r}=e,o=()=>O(t);return{backend(){return $l(e.keyring)},read(){if(_l(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),ue(t),e.index?.add(r)}catch{}return i}catch{}return o()},write(n){if(_l(e.keyring))try{e.keyring.set(r,n),ue(t),e.index?.add(r);return}catch{}ge(t,n,384)},delete(){if(e.keyring){try{e.keyring.delete(r)}catch{}e.index?.remove(r)}ue(t)}}}function _r(e,t,r){let o=e.providerSecretFile(t,r);return I$({keyring:Fo(),file:o,account:`${t}/${r}`,index:xh(Sl.join(Sl.dirname(Sl.dirname(o)),".keyring-index"))})}var A$="AC Bridge",In,E$=new Set(["win32","darwin"]);function Fo(e={}){if(In!==void 0)return In;In=null;let t=e.require??null;if(!E$.has(e.platform??process.platform))return In;try{let r=t??P$();if(!r)return In;let{Entry:o}=r("@napi-rs/keyring"),n=i=>new o(A$,i);In={available(){try{return n("__acb_probe__").getPassword(),!0}catch{return!1}},get:i=>n(i).getPassword(),set:(i,a)=>n(i).setPassword(a),delete:i=>{n(i).deletePassword()}}}catch{In=null}return In}function P$(){try{return typeof te=="function"?te:null}catch{return null}}import{spawnSync as C$}from"node:child_process";import{existsSync as T$}from"node:fs";import R$ from"node:os";import Rh from"node:path";function ia(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 Oh(e,t){if(e==="win32"){let o=Rh.win32;return[o.join(t,".local","bin","claude.exe"),o.join(t,".claude","local","claude.exe")]}let r=Rh.posix;return[r.join(t,".local","bin","claude"),r.join(t,".claude","local","claude"),"/opt/homebrew/bin/claude","/usr/local/bin/claude"]}var Dh=/\.(cmd|bat)$/i,O$=/^\/mnt\/[a-z]\//i;function Nh(e){let t=e.split(/\r?\n/).map(a=>a.trim()).filter(Boolean);if(t.length===0)return null;let r=t.filter(a=>!O$.test(a)),o=r.length>0?r:t,n=o.find(a=>/\.exe$/i.test(a));if(n)return n;let i=o.find(a=>Dh.test(a));return i||(o[0]??null)}function aa(e){return Dh.test(e)?{file:"cmd.exe",argsPrefix:["/c",e]}:{file:e,argsPrefix:[]}}function Lh(e){let r=C$(e,e==="which"?["-a","claude"]:["claude"],{encoding:"utf8"});return{status:r.status??1,stdout:r.stdout??""}}function Uh(e,t){let r=t.home??R$.homedir(),o=t.fileExists??T$;for(let n of Oh(e,r))if(o(n))return n;return null}function An(e,t={}){let r=e?.trim();if(r)return aa(r);let o=t.platform??process.platform,n=t.runFinder??Lh,i=o==="win32"?"where":"which";try{let s=n(i);if(s.status===0){let l=Nh(s.stdout);if(l)return aa(l)}}catch{}let a=Uh(o,t);return aa(a||"claude")}function zh(e,t={}){if(e?.trim())return!0;let r=t.platform??process.platform,o=t.runFinder??Lh;try{let n=o(r==="win32"?"where":"which");if(n.status===0&&Nh(n.stdout)!==null)return!0}catch{}return Uh(r,t)!==null}import{spawnSync as D$}from"node:child_process";import{existsSync as jh,readdirSync as N$}from"node:fs";import Fh from"node:os";import ca from"node:path";var Mh=/\.(cmd|bat)$/i,L$=/^\/mnt\/[a-z]\//i;function U$(e){let t=e.split(/\r?\n/).map(a=>a.trim()).filter(Boolean);if(t.length===0)return null;let r=t.filter(a=>!L$.test(a)),o=r.length>0?r:t,n=o.find(a=>/\.exe$/i.test(a));if(n)return n;let i=o.find(a=>Mh.test(a));return i||(o[0]??null)}function sa(e){return Mh.test(e)?{file:"cmd.exe",argsPrefix:["/c",e]}:{file:e,argsPrefix:[]}}function z$(e,t,r=[]){if(e==="win32"){let n=ca.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=ca.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 j$(e){try{return N$(ca.posix.join(e,".nvm","versions","node"))}catch{return[]}}function F$(e,t){let r=t.home??Fh.homedir(),o=t.fileExists??jh,n=e==="win32"?[]:(t.nodeVersions??j$)(r);for(let i of z$(e,r,n))if(o(i))return i;return null}function M$(e){let r=D$(e,e==="which"?["-a","codex"]:["codex"],{encoding:"utf8"});return{status:r.status??1,stdout:r.stdout??""}}function $r(e,t={}){let r=e?.trim();if(r)return sa(r);let o=t.platform??process.platform,n=t.runFinder??M$,i=o==="win32"?"where":"which";try{let s=n(i);if(s.status===0){let l=U$(s.stdout);if(l)return sa(l)}}catch{}let a=F$(o,t);return sa(a||"codex")}function la(e){let t=e?.home??Fh.homedir();return jh(ca.join(t,".codex","auth.json"))}import{spawnSync as B$}from"node:child_process";import{readFileSync as Bh}from"node:fs";import Hh from"node:path";function H$(e){try{let t=Number(Bh(e,"utf8").trim());return Number.isInteger(t)&&t>0?t:null}catch{return null}}function Z$(e){B$("pkill",["-f",e])}function G$(){try{return yl(Bh(Hh.join(W,Jn),"utf8"))?.pid??null}catch{return null}}function Zh(e={}){let t=e.platform??process.platform,r=e.pidFile??Mo,o=e.readPid??H$,n=e.readBeaconPid??G$,i=e.kill??(l=>process.kill(l)),a=e.sweep??Z$,s=o(r);if(s!==null&&n()===s)try{i(s)}catch{}if(t!=="win32"){for(let l of e.sweepPatterns??[])if(Hh.isAbsolute(l))try{a(l)}catch{}}}import{accessSync as W$,constants as V$,mkdtempSync as J$,readFileSync as q$,writeFileSync as Gh}from"node:fs";import K$ from"node:os";import ua from"node:path";var Ge="bridge",tt="alexa";function Kn(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 Wh(e,t=!1){let r={...e};if(t){r.channelsEnabled=!0;let o={marketplace:Ge,plugin:tt},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 Ir(e){return`'${e.replace(/'/g,"'\\''")}'`}function Ar(e){return`"${e}"`}function X$(e){return`'${e.replace(/'/g,"''")}'`}function Y$(e,t,r){return`mkdir -p ${Ir(e)} && install -m 0644 ${Ir(t)} ${Ir(r)}`}function Al(e,t){return(e==="win32"?ua.win32:ua.posix).dirname(t)}function Q$(e,t,r){let o=Al(e,r);return e==="win32"?`md ${Ar(o)} 2>nul & copy /y ${Ar(t)} ${Ar(r)}`:Y$(o,t,r)}function eI(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',${X$(t)}`]}]:[{method:"pkexec",file:"pkexec",args:["sh","-c",t]},{method:"sudo",file:"sudo",args:["sh","-c",t]}]}function Vh(e,t,r){return eI(e,Q$(e,t,r))}function Jh(e,t,r){let o=Al(e,r);return e==="win32"?`md ${Ar(o)} & copy /y ${Ar(t)} ${Ar(r)}`:`sudo mkdir -p ${Ir(o)} && sudo install -m 0644 ${Ir(t)} ${Ir(r)}`}function tI(e){try{return q$(e,"utf8")}catch{return""}}function nI(e){try{return W$(e,V$.W_OK),!0}catch{return!1}}function rI(e,t){Gh(e,t,{mode:420})}function oI(e,t,r){let o=t(e),n={};try{n=JSON.parse(o)}catch{}let i=Wh(n,r),a=JSON.stringify(i,null,2)+`
14
- `;return!r&&JSON.stringify(i)===JSON.stringify(n)?{existing:n,json:a,changed:!1}:{existing:n,json:a,changed:o.trim()!==a.trim()}}function qh(e){let t=e.platform??process.platform,r=e.settingsPath??Kn(t),o=e.readDest??tI,n=e.dirWritable??nI,i=e.writeDirect??rI,a=e.tmpDir??K$.tmpdir(),s=e.stage??(g=>{let y=J$(ua.join(a,"acbridge-")),k=ua.join(y,"managed-settings.json");return Gh(k,g,{mode:420}),k}),l=e.voice??!1,{existing:u,json:d,changed:p}=oI(r,o,l),m=l&&u.allowedChannelPlugins===void 0;if(!p)return{path:r,changed:!1,json:d,usedSudo:!1,method:"unchanged",replacedDefaultAllowlist:m};if(n(Al(t,r)))return i(r,d),{path:r,changed:!0,json:d,usedSudo:!1,method:"direct",replacedDefaultAllowlist:m};let f=s(d);for(let g of Vh(t,f,r))if(e.runElevated(g),o(r).trim()===d.trim())return{path:r,changed:!0,json:d,usedSudo:g.method==="sudo",method:g.method,replacedDefaultAllowlist:m};throw new Error(`could not write ${r} with elevation (canceled or unavailable). Run it manually:
15
- ${Jh(t,f,r)}`)}var El={udpDstFixed:[4002,6666,6667],udpDstMulticast:[5353],udpSrcBroadcastReply:[9999,20002,38899,56700,1900,1982]},Pl=[...El.udpDstFixed,...El.udpDstMulticast],Cl=El.udpSrcBroadcastReply;function Kh(e){return e==="app"?"AC Bridge (App)":"AC Bridge (CLI)"}var Tl=["domain","private"],Xh="AC Bridge discovery",Yh="AC Bridge replies",iI="macOS will still show one 'Local Network' permission prompt on your first scan \u2014 that prompt cannot be pre-granted; click Allow.";function da(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 Bo(e,t,r={}){if(e==="win32")return"windows";let o=r.isWsl??na();if(e==="linux"&&o)return"wsl-host";if(e==="darwin"){let i=t.alfGlobalStateOut??"";return/firewall is enabled/i.test(i)||da(i)?"macos-alf":"none"}let n=t.ufwStatusOut??"";return/status:\s*active/i.test(n)?"ufw":(t.firewallCmdStateOut??"").trim()==="running"?"firewalld":da(n)?"ufw":"none"}function Rl(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 aI(e,t){if(e.length===0)return{state:"nothing-to-do"};let r=e.map((a,s)=>e.length>1?`${t} (${s+1})`:t),n=e.map((a,s)=>{let l=r[s];return`netsh advfirewall firewall delete rule name="${l}" >nul 2>&1 & netsh advfirewall firewall add rule name="${l}" dir=in action=allow program="${a}" protocol=udp profile=${Tl.join(",")} remoteip=localsubnet enable=yes`}).join(" & "),i=r.map(a=>`netsh advfirewall firewall show rule name="${a}" verbose`);return{applyScript:n,checkCommands:i,evalCheck:a=>a.every((s,l)=>uI(s,e[l])),manualCommand:n,needsElevation:!0}}function sI(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)=>pI(n,e[i])),manualCommand:t.map(o=>`sudo ${o}`).join(" && "),needsElevation:!0,userNote:iI}}function cI(){let e=Pl.join(","),t=Cl.join(","),r=`ufw allow in proto udp to any port ${e} comment '${Xh}'`,o=`ufw allow in proto udp from any port ${t} comment '${Yh}'`;return{applyScript:`${r} && ${o}`,checkCommands:["ufw status"],evalCheck:n=>mI(n[0]??""),manualCommand:`sudo ${r} && sudo ${o}`,needsElevation:!0}}function lI(){let e=Pl.map(o=>`firewall-cmd --permanent --add-port=${o}/udp`),t=Cl.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=>fI(o[0]??"",Pl)&&gI(o[1]??"",Cl),manualCommand:r.map(o=>`sudo ${o}`).join(" && "),needsElevation:!0}}function Ol(e,t){switch(e){case"windows":return aI(t.programs,t.ruleName);case"macos-alf":return sI(t.programs);case"ufw":return cI();case"firewalld":return lI();case"wsl-host":return{state:"nothing-to-do"};case"none":return{state:"nothing-to-do"}}}var Dl="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 uI(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 Qh(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 a=e.slice(n[i].at,n[i+1]?.at??e.length);t.push({profile:n[i].profile,firewallOn:!/^\s*State\s+OFF/im.test(a)})}return t}function dI(e,t=Tl){let r=new Set(t.map(o=>o.toLowerCase()));return e.filter(o=>o.firewallOn&&!r.has(o.profile)).map(o=>o.profile)}function ev(e,t){let r=t.toLowerCase(),o=new Set;for(let n of e.split(/^Rule Name:/m).slice(1)){let i=a=>new RegExp(`^${a}:\\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 a of i("Profiles").split(",")){let s=a.trim().toLowerCase();(s==="domain"||s==="private"||s==="public")&&o.add(s)}}return[...o]}function tv(e,t=Tl){if(dI(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 pI(e,t){return e.includes(t)&&/is not blocked/i.test(e)}function mI(e){return/status:\s*active/i.test(e)&&e.includes(Xh)&&e.includes(Yh)}function fI(e,t){return t.every(r=>e.includes(`${r}/udp`))}function gI(e,t){return t.every(r=>e.includes(`source-port port="${r}"`))}function nv(e){let{platform:t,programs:r,ruleName:o,runElevated:n,runCheck:i}=e,a=e.isWsl===void 0?{}:{isWsl:e.isWsl};if(Bo(t,{},a)==="wsl-host")return{backend:"wsl-host",status:"nothing-to-do",changed:!1,userNote:Dl};let l=Bo(t,Rl(t,i),a);if(l==="none")return{backend:l,status:"nothing-to-do",changed:!1};let u=Ol(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(da);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(da)?{backend:l,status:"changed",changed:!0,userNote:hI(u)}:{backend:l,status:"needs-elevation",changed:!1,manualCommand:u.manualCommand,userNote:u.userNote}}function hI(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}import{spawnSync as vI}from"node:child_process";import{existsSync as yI,readFileSync as pa,readdirSync as bI}from"node:fs";import{homedir as xI}from"node:os";import{join as bt,resolve as kI}from"node:path";var ov=()=>bt(xI(),".claude","plugins"),rv=e=>{let t=kI(e).replace(/[/\\]+$/,"");return process.platform==="win32"||process.platform==="darwin"?t.toLowerCase():t};function wI(){try{let t=JSON.parse(pa(bt(ov(),"known_marketplaces.json"),"utf8"))?.[Ge]?.source;return typeof t?.path=="string"?t.path:null}catch{return null}}function iv(){try{let t=JSON.parse(pa(bt(ov(),"installed_plugins.json"),"utf8"))?.plugins?.[`${tt}@${Ge}`]?.[0];return typeof t?.installPath=="string"?t.installPath:null}catch{return null}}var Nl=(e,t)=>{try{return pa(e,"utf8")===pa(t,"utf8")}catch{return!1}};function SI(){return["hooks/hooks.json",".mcp.json"]}function _I(e){let t=iv();if(!t)return!1;let r=bt(e,"plugins",tt);for(let i of SI())if(!Nl(bt(r,i),bt(t,i)))return!1;let o=bt(r,"dist","channel.mjs");if(yI(o)&&!Nl(o,bt(t,"dist","channel.mjs")))return!1;let n;try{n=bI(bt(r,"scripts"))}catch{return!1}return n.every(i=>Nl(bt(r,"scripts",i),bt(t,"scripts",i)))}function av(e){let{marketplaceDir:t,claudeCmd:r}=e,o=s=>{let l=vI(r.file,[...r.argsPrefix,...s],{encoding:"utf8"});return{ok:l.status===0,out:`${l.stdout??""}${l.stderr??""}${l.error?l.error.message:""}`}},n=wI(),i=!1;if(n===null||rv(n)!==rv(t)){n!==null&&o(["plugin","marketplace","remove",Ge]);let s=o(["plugin","marketplace","add",t]);if(!s.ok)throw new Error(`marketplace add failed:
16
- ${s.out}`);i=!0}let a=!1;if(i||!_I(t)){o(["plugin","marketplace","update",Ge]),iv()!==null&&o(["plugin","uninstall",`${tt}@${Ge}`]);let s=o(["plugin","install",`${tt}@${Ge}`]);if(!s.ok)throw new Error(`plugin install failed:
17
- ${s.out}`);a=!0}return{marketplaceRepointed:i,pluginReinstalled:a}}import{mkdirSync as $I,readFileSync as lv,writeFileSync as II}from"node:fs";import AI from"node:os";import Ll from"node:path";function uv(e,t="node"){return`${t} "${Ll.join(e,"plugins","alexa","scripts","statusline.mjs")}"`}function dv(){return Ll.join(AI.homedir(),".claude","settings.json")}var pv=e=>{let t=e.statusLine,r=t&&typeof t=="object"?t.command:void 0;return typeof r=="string"&&r?r:void 0},EI="plugins/alexa/scripts/statusline.mjs",PI="plugins\\alexa\\scripts\\statusline.mjs";function Ul(e){return e.includes(EI)||e.includes(PI)}function sv(e){let t=e.statusline,r=t&&typeof t=="object"&&!Array.isArray(t)?t.prev:void 0,o=typeof r=="string"&&r?r:null;return o!==null&&Ul(o)?{prev:null,poisoned:!0}:{prev:o,poisoned:!1}}function CI(e){let t=e.statusline,r=t&&typeof t=="object"&&!Array.isArray(t)?{...t}:{};return delete r.prev,{...e,statusline:r}}function mv(e,t){let r=pv(e);return r===t?{settings:e,prev:void 0,changed:!1}:r!==void 0&&Ul(r)?{settings:{...e,statusLine:{type:"command",command:t}},prev:void 0,changed:!0}:{settings:{...e,statusLine:{type:"command",command:t}},prev:r??null,changed:!0}}function fv(e,t){let r=t?.settingsFile??dv(),o=t?.configFile??ke,n=t?.env??process.env,i=cv(o),s=!(n.BRIDGE_STATUSLINE==="0"||n.BRIDGE_STATUSLINE==="false")&&i.autoStatusline!==!1,l=cv(r),u=uv(e,t?.nodeCommand);if(s){let g=mv(l,u),{poisoned:y}=sv(i);return!g.changed&&!y?{enabled:s,changed:!1}:(g.changed&&Ho(r,g.settings),g.prev!==void 0?Ho(o,{...i,statusline:{prev:g.prev}}):y&&Ho(o,CI(i)),{enabled:s,changed:!0})}let d=pv(l);if(!d||!Ul(d))return{enabled:s,changed:!1};let{prev:p}=sv(i),m={...l};p?m.statusLine={type:"command",command:p}:delete m.statusLine,Ho(r,m);let f={...i};return delete f.statusline,Ho(o,f),{enabled:s,changed:!0}}function cv(e){try{let t=JSON.parse(lv(e,"utf8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Ho(e,t){let r=JSON.stringify(t,null,2)+`
18
- `;try{if(lv(e,"utf8")===r)return}catch{}$I(Ll.dirname(e),{recursive:!0}),II(e,r)}import{existsSync as TI,mkdirSync as RI,readFileSync as OI,writeFileSync as DI}from"node:fs";import hv from"node:os";import ma from"node:path";function fa(e=hv.homedir()){return ma.join(e,".codex","hooks.json")}function vv(e,t="node"){return`${t} "${ma.join(e,"plugins","alexa","scripts","codex-signal.mjs")}"`}var NI=["SessionStart","UserPromptSubmit","Stop","PermissionRequest","PreCompact","PostCompact","SubagentStart","SubagentStop","PostToolUse"],LI="plugins/alexa/scripts/codex-signal.mjs",UI="plugins\\alexa\\scripts\\codex-signal.mjs";function zI(e){return e.includes(LI)||e.includes(UI)}function yv(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e.hooks;return Array.isArray(t)?t.some(r=>{if(!r||typeof r!="object")return!1;let o=r.command;return typeof o=="string"&&zI(o)}):!1}var jI=e=>({hooks:[{type:"command",command:e,timeout:10}]});function bv(e){let t=e&&typeof e=="object"&&!Array.isArray(e)?e.hooks:void 0;return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function xv(e){let t=new Map;for(let[r,o]of Object.entries(bv(e))){if(!Array.isArray(o))continue;let n=o.filter(i=>!yv(i));n.length>0&&t.set(r,n)}return t}function FI(e,t){let r=xv(e);for(let o of NI){let n=r.get(o)??[];n.push(jI(t)),r.set(o,n)}return{hooks:Object.fromEntries(r)}}function MI(e){return{hooks:Object.fromEntries(xv(e))}}function BI(e){return Object.values(bv(e)).some(t=>Array.isArray(t)&&t.some(r=>yv(r)))}function HI(e){return JSON.stringify(e,null,2)+`
19
- `}function zl(e){try{return OI(e,"utf8")}catch{return null}}function ZI(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 GI(e){if(e===null)return{value:void 0,corrupt:!1};let t;try{t=JSON.parse(e)}catch{return{value:void 0,corrupt:!0}}return ZI(t)?{value:t,corrupt:!1}:{value:void 0,corrupt:!0}}function WI(e){return GI(zl(e))}function VI(e){let t=zl(e);if(t===null)return{};try{let r=JSON.parse(t);return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{}}}function JI(e){let t=VI(e?.configFile??ke),r=e?.env??process.env;return!(r.BRIDGE_CODEX_HOOKS==="0"||r.BRIDGE_CODEX_HOOKS==="false")&&t.autoCodexHooks!==!1}function kv(e,t){let r=t?.home??hv.homedir(),o=fa(r),n=t?.configFile??ke,i=t?.env??process.env,a=JI({configFile:n,env:i});if(!TI(ma.dirname(o)))return{enabled:a,skipped:!0,changed:!1,corrupt:!1};let{value:s,corrupt:l}=WI(o);if(l)return{enabled:a,skipped:!1,changed:!1,corrupt:!0};if(!a)return BI(s)?gv(o,MI(s),a,l):{enabled:a,skipped:!1,changed:!1,corrupt:l};let u=vv(e,t?.nodeCommand);return gv(o,FI(s,u),a,l)}function gv(e,t,r,o){let n=HI(t);return zl(e)===n?{enabled:r,skipped:!1,changed:!1,corrupt:o}:(RI(ma.dirname(e),{recursive:!0}),DI(e,n),{enabled:r,skipped:!1,changed:!0,corrupt:o})}function wv(e){let t=/(\d+)\.(\d+)\.(\d+)/.exec(e??""),r=Number(t?.[1]??0),o=Number(t?.[2]??0),n=Number(t?.[3]??0);return{ok:r>2||r===2&&(o>1||o===1&&n>=80),version:t?.[0]??null}}function Sv(e){return{ok:new RegExp(`${tt}@${Ge}`).test(e??"")}}function _v(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===Ge&&o.plugin===tt)}}import{existsSync as qI,readdirSync as KI,readFileSync as XI}from"node:fs";import $v from"node:os";function YI(e,t,r){let o=r.readFile(`${e}${t}plugins${t}installed_plugins.json`);if(!o)return!1;try{return!!JSON.parse(o)?.plugins?.[`${tt}@${Ge}`]}catch{return!1}}function QI(e){return/^\\\\(?:wsl\.localhost|wsl\$)\\([^\\]+)\\/i.exec(e)?.[1]??null}function eA(e){let t=e.platform==="win32"?"\\":"/",r=(a,s,l,u,d)=>{let p=`${a}${t}.claude`;return{id:l,label:u,kind:s,home:a,claudeDir:p,claudePresent:e.exists(p),pluginInstalled:YI(p,t,e),setupHint:d}},o=e.env.WSL_DISTRO_NAME,n=e.isWsl?`this environment (WSL${o?`: ${o}`:""})`:e.platform==="win32"?"this environment (Windows)":"this environment",i=[r(e.homeDir,"current","current",n,"acbridge setup")];for(let a of bl(e)){let s=`${a}${t}.claude`;if(e.exists(s))if(e.isWsl){let l=a.split("/").pop()??e.userName;i.push(r(a,"windows",`windows:${l}`,`Windows (user ${l})`,"run `acbridge setup` in a Windows terminal"))}else{let l=QI(a)??"wsl";i.push(r(a,"wsl",`wsl:${l}`,`WSL: ${l}`,`wsl.exe -d ${l} -- acbridge setup`))}}return i}function Iv(){let e=n=>{try{return XI(n,"utf8")}catch{return null}},t=n=>{try{return KI(n)}catch{return[]}},r="";try{r=$v.userInfo().username}catch{r=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 eA({homeDir:$v.homedir(),env:process.env,platform:process.platform,userName:r,isWsl:o,readFile:e,listDir:t,exists:n=>qI(n)})}import{spawnSync as tA}from"node:child_process";import{existsSync as nA}from"node:fs";import Av from"node:path";function rA(e,t){let r=e==="win32"?Av.win32:Av.posix,o=e==="win32"?"bridge-node.cmd":"bridge-node";return r.join(t,"bin",o)}function Ev(e){let t=/(\d+)\.(\d+)\.(\d+)/.exec(e??"");return t?{major:Number(t[1]),full:t[0]}:null}function Er(e){if(e.shimExists()&&Ev(e.runShimVersion())!==null)return{kind:"shim",command:e.shimPath};let t=Ev(e.runNodeVersion());return t!==null&&t.major>=20?{kind:"system",command:"node",version:t.full}:{kind:"none"}}function ga(e){return e.kind==="shim"?`"${e.command}"`:void 0}function Pr(e,t=process.platform){let r=rA(t,e),o=(n,i)=>{try{let a=tA(n,i,{encoding:"utf8"});return a.status===0?a.stdout??"":null}catch{return null}};return{platform:t,shimPath:r,shimExists:()=>nA(r),runShimVersion:()=>t==="win32"?o("cmd.exe",["/c",r,"--version"]):o(r,["--version"]),runNodeVersion:()=>o("node",["--version"])}}function ha(e={}){let t=e.configFile??ke,r={},o=O(t);if(o)try{r=JSON.parse(o)}catch{r={}}return{claudeBin:typeof r.claudeBin=="string"?r.claudeBin:null,relayUrl:typeof r.relayUrl=="string"?r.relayUrl:null,hubPort:typeof r.hubPort=="number"?r.hubPort:null,onboardedAt:typeof r.onboardedAt=="number"?r.onboardedAt:null}}function va(e,t={}){let r=t.configFile??ke,o={},n=O(r);if(n)try{o=JSON.parse(n)}catch{o={}}for(let[i,a]of Object.entries(e))a===null?delete o[i]:a!==void 0&&(o[i]=a);return ge(r,JSON.stringify(o,null,2)+`
20
- `,384),o}import{createHash as oA,randomBytes as Pv}from"node:crypto";var jl=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");function Cv(){let e=jl(Pv(32)),t=jl(oA("sha256").update(e).digest());return{verifier:e,challenge:t}}function Tv(){return jl(Pv(24))}var iA="https://api.workos.com";var aA="client_01KW2CY31D0NZKCDKNHF2XQ7VC",sA="org_01KW0DNZ14H6JMK8RHA0WSKNVZ";function Rv(e=t=>process.env[t]){let t=e("WORKOS_CLIENT_ID")??aA,r=Number(e("WORKOS_REDIRECT_PORT")??8765)||8765,o=(e("WORKOS_API_HOST")??iA).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")??sA,configured:!!t}}var cA={google:"GoogleOAuth",github:"GitHubOAuth",microsoft:"MicrosoftOAuth"},ya=class extends Error{constructor(r,o){super(o);this.kind=r;this.name="AuthError"}kind};function ba({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",cA[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 lA(e){return{id:e.id,email:e.email,firstName:e.first_name,lastName:e.last_name,profilePictureUrl:e.profile_picture_url}}async function uA(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 ya("network",o instanceof Error?o.message:"Network error reaching WorkOS.")}}async function dA(e,t,r){let o=await uA(e,t,r),n=await o.text().catch(()=>"");if(!o.ok)throw new ya("rejected",`WorkOS ${o.status}: ${pA(n)}`);let i=JSON.parse(n);return{user:lA(i.user),accessToken:i.access_token,refreshToken:i.refresh_token}}function Ov(e,t,r,o=fetch){return dA(e,{grant_type:"authorization_code",code:t,code_verifier:r},o)}function pA(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 yA}from"node:http";var Cr="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 xa="linear-gradient(135deg,#3aa0ff 0%,#6a6ff6 52%,#8a4ff0 100%)",mA=[58,160,255],Dv=[106,111,246],fA=[138,79,240];function gA(e){let[t,r]=e<=.5?[mA,Dv]:[Dv,fA],o=e<=.5?e/.5:(e-.5)/.5,n=(i,a)=>Math.round(i+(a-i)*o);return`rgb(${n(t[0],r[0])},${n(t[1],r[1])},${n(t[2],r[2])})`}var Fl=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),a=(Math.abs(r-.5)*.7).toFixed(2);return`<span style="height:${n}px;background:${gA(r)};opacity:${n<6?.92:1};animation:wave ${i}s ease-in-out ${a}s infinite"></span>`}).join("");function hA(e){let t=e.markUri??Cr,r=t?`<span class="mark" style="-webkit-mask:url(&quot;${t}&quot;) center/contain no-repeat;mask:url(&quot;${t}&quot;) 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>${Rt(e.title)}</title>
13
+ `,{mode:384}),AI(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 yv(e,t){if(!t)return 0;let r=0;for(let o of su(e))try{t.delete(o),r++}catch{}return r}var NI=/^[A-Za-z0-9][A-Za-z0-9_.-]{0,79}$/;function mt(e){return NI.test(e)&&!e.includes("..")?e:`h_${OI("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 xv(){try{let e=JSON.parse(bv(ui,"utf8"));return typeof e.sub=="string"&&e.sub?e.sub:null}catch{return null}}var LI="layout-version.json";function on(){try{let e=JSON.parse(bv(ir.join(Q,LI),"utf8"));return typeof e.version=="number"&&Number.isFinite(e.version)?e.version:0}catch{return 0}}var sn=3;function kv(e){if(!e||e.includes("/")||e.includes("\\")||e.includes("..")||e.includes("\0"))throw new Error(`unsafe credential segment: ${JSON.stringify(e)}`)}function xt(e){kv(e);let t=Ls(e);return{accessFile:ir.join(t,"relay-access-token"),refreshFile:ir.join(t,"relay-refresh-token")}}function au(e,t){kv(e);let r=ir.join(Ls(e),"providers"),o=yv(ir.join(r,".keyring-index"),t??null);return DI(r,{recursive:!0,force:!0}),o}var cu=e=>{try{return zI(e,"utf8").trim()||null}catch{return null}},sr="hub-endpoint.json",MI=24,BI=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 HI(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<MI&&!t.includes(n)&&t.push(n)},o=n=>!BI.has(n.toLowerCase());if(e.isWsl){let n=HI(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 ZI(e){let t=e.isWsl?"/":"\\";return uu(e).map(r=>`${r}${t}.claude-bridge`)}function GI(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 ZI(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 wv(e,t,r){return t!=="linux"?!1:e.WSL_DISTRO_NAME||e.WSL_INTEROP?!0:/microsoft/i.test(r("/proc/version")??"")}function Gr(){return wv(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 jI(n)}catch{return[]}},o="";try{o=FI.userInfo().username}catch{o=process.env.USER??process.env.USERNAME??""}return Us=GI({secretDir:Q,env:process.env,platform:process.platform,userName:o,isWsl:wv(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 Sv(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 WI(e){let t=cu(Sv(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 _v(e){let t=WI(e);if(t){let r=Zr.join(e,"users",mt(t),"hub-token");if(UI(r))return r}return Sv(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 l4=256*1024;import{readFileSync as VI}from"node:fs";import di from"node:path";var qI=/^(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=qI.exec(e);return t?t[1]==="0"&&t[2]==="0"&&t[3]==="0"?{kind:"dev"}:{kind:"release",version:e}:{kind:"invalid"}}function $v(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(VI(di.join(o,"version.json"),"utf8")),a=du(s.version);return a.kind==="release"?a.version:null}catch{return null}}import{readdirSync as JI}from"node:fs";import KI from"node:path";var ar=class extends Error{constructor(r,o){super(r);this.status=o;this.name="RelayError"}status},XI=e=>e.replace(/\/+$/,"");async function pu(e,t,r,o){return fetch(`${XI(e)}${t}`,{method:"POST",headers:{"content-type":"application/json",...o?{authorization:`Bearer ${o}`}:{}},body:r===void 0?void 0:JSON.stringify(r)})}async function Iv(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 Ev(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 YI(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 QI="__none__";function we(){let e=xv();if(e)return xt(mt(e));let[t,r]=ft();return t&&!r?xt(t.segment):xt(QI)}function Av(e){let t;try{t=JI(KI.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 Av(!1)}function Pv(){return Av(!0)}function eE(e=we()){return N(e.refreshFile)}function pi(e=we()){ve(e.accessFile),ve(e.refreshFile)}function tE(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=tE(o);if(n!==null&&n>t)return!0;let i=eE(o);if(!i)return n!==null&&n>0;try{return mu(await YI(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 nE(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 nE({keyring:mi(),file:o,account:`${t}/${r}`,index:vv(gu.join(gu.dirname(gu.dirname(o)),".keyring-index"))})}var rE="AC Bridge",Nn,oE=new Set(["win32","darwin"]);function mi(e={}){if(Nn!==void 0)return Nn;Nn=null;let t=e.require??null;if(!oE.has(e.platform??process.platform))return Nn;try{let r=t??iE();if(!r)return Nn;let{Entry:o}=r("@napi-rs/keyring"),n=i=>new o(rE,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 iE(){try{return typeof ue=="function"?ue:null}catch{return null}}import{spawnSync as sE}from"node:child_process";import{existsSync as aE}from"node:fs";import cE from"node:os";import Cv 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 Tv(e,t){if(e==="win32"){let o=Cv.win32;return[o.join(t,".local","bin","claude.exe"),o.join(t,".claude","local","claude.exe")]}let r=Cv.posix;return[r.join(t,".local","bin","claude"),r.join(t,".claude","local","claude"),"/opt/homebrew/bin/claude","/usr/local/bin/claude"]}var Rv=/\.(cmd|bat)$/i,lE=/^\/mnt\/[a-z]\//i;function Ov(e){let t=e.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(t.length===0)return null;let r=t.filter(s=>!lE.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=>Rv.test(s));return i||(o[0]??null)}function Fs(e){return Rv.test(e)?{file:"cmd.exe",argsPrefix:["/c",e]}:{file:e,argsPrefix:[]}}function Dv(e){let r=sE(e,e==="which"?["-a","claude"]:["claude"],{encoding:"utf8"});return{status:r.status??1,stdout:r.stdout??""}}function Nv(e,t){let r=t.home??cE.homedir(),o=t.fileExists??aE;for(let n of Tv(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??Dv,i=o==="win32"?"where":"which";try{let a=n(i);if(a.status===0){let l=Ov(a.stdout);if(l)return Fs(l)}}catch{}let s=Nv(o,t);return Fs(s||"claude")}function Ms(e,t={}){if(e?.trim())return!0;let r=t.platform??process.platform,o=t.runFinder??Dv;try{let n=o(r==="win32"?"where":"which");if(n.status===0&&Ov(n.stdout)!==null)return!0}catch{}return Nv(r,t)!==null}import{spawnSync as uE}from"node:child_process";import{existsSync as Lv,readdirSync as dE}from"node:fs";import Uv from"node:os";import Hs from"node:path";var jv=/\.(cmd|bat)$/i,pE=/^\/mnt\/[a-z]\//i;function mE(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=>jv.test(s));return i||(o[0]??null)}function Bs(e){return jv.test(e)?{file:"cmd.exe",argsPrefix:["/c",e]}:{file:e,argsPrefix:[]}}function fE(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 gE(e){try{return dE(Hs.posix.join(e,".nvm","versions","node"))}catch{return[]}}function hE(e,t){let r=t.home??Uv.homedir(),o=t.fileExists??Lv,n=e==="win32"?[]:(t.nodeVersions??gE)(r);for(let i of fE(e,r,n))if(o(i))return i;return null}function vE(e){let r=uE(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??vE,i=o==="win32"?"where":"which";try{let a=n(i);if(a.status===0){let l=mE(a.stdout);if(l)return Bs(l)}}catch{}let s=hE(o,t);return Bs(s||"codex")}function Zs(e){let t=e?.home??Uv.homedir();return Lv(Hs.join(t,".codex","auth.json"))}import{spawnSync as yE}from"node:child_process";import{readFileSync as zv}from"node:fs";import Fv from"node:path";function bE(e){try{let t=Number(zv(e,"utf8").trim());return Number.isInteger(t)&&t>0?t:null}catch{return null}}function xE(e){yE("pkill",["-f",e])}function kE(){try{return lu(zv(Fv.join(Q,sr),"utf8"))?.pid??null}catch{return null}}function Mv(e={}){let t=e.platform??process.platform,r=e.pidFile??fi,o=e.readPid??bE,n=e.readBeaconPid??kE,i=e.kill??(l=>process.kill(l)),s=e.sweep??xE,a=o(r);if(a!==null&&n()===a)try{i(a)}catch{}if(t!=="win32"){for(let l of e.sweepPatterns??[])if(Fv.isAbsolute(l))try{s(l)}catch{}}}import{accessSync as wE,constants as SE,mkdtempSync as _E,readFileSync as $E,writeFileSync as Bv}from"node:fs";import IE 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 Hv(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 EE(e){return`'${e.replace(/'/g,"''")}'`}function AE(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 PE(e,t,r){let o=bu(e,r);return e==="win32"?`md ${Jr(o)} 2>nul & copy /y ${Jr(t)} ${Jr(r)}`:AE(o,t,r)}function CE(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',${EE(t)}`]}]:[{method:"pkexec",file:"pkexec",args:["sh","-c",t]},{method:"sudo",file:"sudo",args:["sh","-c",t]}]}function Zv(e,t,r){return CE(e,PE(e,t,r))}function Gv(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 TE(e){try{return $E(e,"utf8")}catch{return""}}function RE(e){try{return wE(e,SE.W_OK),!0}catch{return!1}}function OE(e,t){Bv(e,t,{mode:420})}function DE(e,t,r){let o=t(e),n={};try{n=JSON.parse(o)}catch{}let i=Hv(n,r),s=JSON.stringify(i,null,2)+`
14
+ `;return!r&&JSON.stringify(i)===JSON.stringify(n)?{existing:n,json:s,changed:!1}:{existing:n,json:s,changed:o.trim()!==s.trim()}}function Wv(e){let t=e.platform??process.platform,r=e.settingsPath??lr(t),o=e.readDest??TE,n=e.dirWritable??RE,i=e.writeDirect??OE,s=e.tmpDir??IE.tmpdir(),a=e.stage??(g=>{let h=_E(Gs.join(s,"acbridge-")),y=Gs.join(h,"managed-settings.json");return Bv(y,g,{mode:420}),y}),l=e.voice??!1,{existing:u,json:d,changed:m}=DE(r,o,l),p=l&&u.allowedChannelPlugins===void 0;if(!m)return{path:r,changed:!1,json:d,usedSudo:!1,method:"unchanged",replacedDefaultAllowlist:p};if(n(bu(t,r)))return i(r,d),{path:r,changed:!0,json:d,usedSudo:!1,method:"direct",replacedDefaultAllowlist:p};let f=a(d);for(let g of Zv(t,f,r))if(e.runElevated(g),o(r).trim()===d.trim())return{path:r,changed:!0,json:d,usedSudo:g.method==="sudo",method:g.method,replacedDefaultAllowlist:p};throw new Error(`could not write ${r} with elevation (canceled or unavailable). Run it manually:
15
+ ${Gv(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 Vv(e){return e==="app"?"AC Bridge (App)":"AC Bridge (CLI)"}var ku=["domain","private"],qv="AC Bridge discovery",Jv="AC Bridge replies",NE="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 LE(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)=>FE(a,e[l])),manualCommand:n,needsElevation:!0}}function UE(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)=>BE(n,e[i])),manualCommand:t.map(o=>`sudo ${o}`).join(" && "),needsElevation:!0,userNote:NE}}function jE(){let e=gi.join(","),t=hi.join(","),r=`ufw allow in proto udp to any port ${e} comment '${qv}'`,o=`ufw allow in proto udp from any port ${t} comment '${Jv}'`;return{applyScript:`${r} && ${o}`,checkCommands:["ufw status"],evalCheck:n=>HE(n[0]??""),manualCommand:`sudo ${r} && sudo ${o}`,needsElevation:!0}}function zE(){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=>ZE(o[0]??"",gi)&&GE(o[1]??"",hi),manualCommand:r.map(o=>`sudo ${o}`).join(" && "),needsElevation:!0}}function Vs(e,t){switch(e){case"windows":return LE(t.programs,t.ruleName);case"macos-alf":return UE(t.programs);case"ufw":return jE();case"firewalld":return zE();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 FE(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 Kv(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 ME(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 Xv(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 Yv(e,t=ku){if(ME(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 BE(e,t){return e.includes(t)&&/is not blocked/i.test(e)}function HE(e){return/status:\s*active/i.test(e)&&e.includes(qv)&&e.includes(Jv)}function ZE(e,t){return t.every(r=>e.includes(`${r}/udp`))}function GE(e,t){return t.every(r=>e.includes(`source-port port="${r}"`))}function Qv(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 m=d.some(Kr);n(u.applyScript);let p=u.checkCommands.map(i);return u.evalCheck(p)?{backend:l,status:"changed",changed:!0,userNote:u.userNote}:m||p.some(Kr)?{backend:l,status:"changed",changed:!0,userNote:WE(u)}:{backend:l,status:"needs-elevation",changed:!1,manualCommand:u.manualCommand,userNote:u.userNote}}function WE(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 VE(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 ey(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=VE(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 m=l.checkCommands.map(i);if(!l.evalCheck(m)||m.some(Kr))return{backend:a,status:"changed",changed:!0};let p=t==="win32"?u:u.split(" && ").map(f=>`sudo ${f}`).join(" && ");return{backend:a,status:"needs-elevation",changed:!1,manualCommand:p}}import{spawnSync as qE}from"node:child_process";import{existsSync as JE,readFileSync as qs,readdirSync as KE}from"node:fs";import{homedir as XE}from"node:os";import{join as kt,resolve as YE}from"node:path";var ny=()=>kt(XE(),".claude","plugins"),ty=e=>{let t=YE(e).replace(/[/\\]+$/,"");return process.platform==="win32"||process.platform==="darwin"?t.toLowerCase():t};function ry(){try{let t=JSON.parse(qs(kt(ny(),"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(ny(),"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 QE(){return["hooks/hooks.json",".mcp.json"]}function eA(e){let t=_u();if(!t)return!1;let r=kt(e,"plugins",Xe);for(let i of QE())if(!Su(kt(r,i),kt(t,i)))return!1;let o=kt(r,"dist","channel.mjs");if(JE(o)&&!Su(o,kt(t,"dist","channel.mjs")))return!1;let n;try{n=KE(kt(r,"scripts"))}catch{return!1}return n.every(i=>Su(kt(r,"scripts",i),kt(t,"scripts",i)))}function oy(e){return t=>{let r=qE(e.file,[...e.argsPrefix,...t],{encoding:"utf8"});return{ok:r.status===0,out:`${r.stdout??""}${r.stderr??""}${r.error?r.error.message:""}`}}}function iy(e){let t=oy(e.claudeCmd),r=(e.installedDir??_u)(),o=(e.registeredDir??ry)(),n=r!==null&&t(["plugin","uninstall",`${Xe}@${je}`]).ok,i=o!==null&&t(["plugin","marketplace","remove",je]).ok;return{pluginUninstalled:n,marketplaceRemoved:i}}function sy(e){let{marketplaceDir:t,claudeCmd:r}=e,o=oy(r),n=ry(),i=!1;if(n===null||ty(n)!==ty(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||!eA(t)){o(["plugin","marketplace","update",je]),_u()!==null&&o(["plugin","uninstall",`${Xe}@${je}`]);let a=o(["plugin","install",`${Xe}@${je}`]);if(!a.ok)throw new Error(`plugin install failed:
17
+ ${a.out}`);s=!0}return{marketplaceRepointed:i,pluginReinstalled:s}}import{mkdirSync as tA,readFileSync as ly,writeFileSync as nA}from"node:fs";import rA from"node:os";import $u from"node:path";function uy(e,t="node"){return`${t} "${$u.join(e,"plugins","alexa","scripts","statusline.mjs")}"`}function dy(){return $u.join(rA.homedir(),".claude","settings.json")}var py=e=>{let t=e.statusLine,r=t&&typeof t=="object"?t.command:void 0;return typeof r=="string"&&r?r:void 0},oA="plugins/alexa/scripts/statusline.mjs",iA="plugins\\alexa\\scripts\\statusline.mjs";function Iu(e){return e.includes(oA)||e.includes(iA)}function ay(e){let t=e.statusline,r=t&&typeof t=="object"&&!Array.isArray(t)?t.prev:void 0,o=typeof r=="string"&&r?r:null;return o!==null&&Iu(o)?{prev:null,poisoned:!0}:{prev:o,poisoned:!1}}function sA(e){let t=e.statusline,r=t&&typeof t=="object"&&!Array.isArray(t)?{...t}:{};return delete r.prev,{...e,statusline:r}}function my(e,t){let r=py(e);return r===t?{settings:e,prev:void 0,changed:!1}:r!==void 0&&Iu(r)?{settings:{...e,statusLine:{type:"command",command:t}},prev:void 0,changed:!0}:{settings:{...e,statusLine:{type:"command",command:t}},prev:r??null,changed:!0}}function fy(e,t){let r=t?.settingsFile??dy(),o=t?.configFile??Ae,n=t?.env??process.env,i=cy(o),a=!(n.BRIDGE_STATUSLINE==="0"||n.BRIDGE_STATUSLINE==="false")&&i.autoStatusline!==!1,l=cy(r),u=uy(e,t?.nodeCommand);if(a){let g=my(l,u),{poisoned:h}=ay(i);return!g.changed&&!h?{enabled:a,changed:!1}:(g.changed&&vi(r,g.settings),g.prev!==void 0?vi(o,{...i,statusline:{prev:g.prev}}):h&&vi(o,sA(i)),{enabled:a,changed:!0})}let d=py(l);if(!d||!Iu(d))return{enabled:a,changed:!1};let{prev:m}=ay(i),p={...l};m?p.statusLine={type:"command",command:m}:delete p.statusLine,vi(r,p);let f={...i};return delete f.statusline,vi(o,f),{enabled:a,changed:!0}}function cy(e){try{let t=JSON.parse(ly(e,"utf8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function vi(e,t){let r=JSON.stringify(t,null,2)+`
18
+ `;try{if(ly(e,"utf8")===r)return}catch{}tA($u.dirname(e),{recursive:!0}),nA(e,r)}import{existsSync as aA,mkdirSync as cA,readFileSync as lA,writeFileSync as uA}from"node:fs";import hy from"node:os";import Js from"node:path";function Ks(e=hy.homedir()){return Js.join(e,".codex","hooks.json")}function vy(e,t="node"){return`${t} "${Js.join(e,"plugins","alexa","scripts","codex-signal.mjs")}"`}var dA=["SessionStart","UserPromptSubmit","Stop","PermissionRequest","PreCompact","PostCompact","SubagentStart","SubagentStop","PostToolUse"],pA="plugins/alexa/scripts/codex-signal.mjs",mA="plugins\\alexa\\scripts\\codex-signal.mjs";function fA(e){return e.includes(pA)||e.includes(mA)}function yy(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e.hooks;return Array.isArray(t)?t.some(r=>{if(!r||typeof r!="object")return!1;let o=r.command;return typeof o=="string"&&fA(o)}):!1}var gA=e=>({hooks:[{type:"command",command:e,timeout:10}]});function by(e){let t=e&&typeof e=="object"&&!Array.isArray(e)?e.hooks:void 0;return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function xy(e){let t=new Map;for(let[r,o]of Object.entries(by(e))){if(!Array.isArray(o))continue;let n=o.filter(i=>!yy(i));n.length>0&&t.set(r,n)}return t}function hA(e,t){let r=xy(e);for(let o of dA){let n=r.get(o)??[];n.push(gA(t)),r.set(o,n)}return{hooks:Object.fromEntries(r)}}function vA(e){return{hooks:Object.fromEntries(xy(e))}}function yA(e){return Object.values(by(e)).some(t=>Array.isArray(t)&&t.some(r=>yy(r)))}function bA(e){return JSON.stringify(e,null,2)+`
19
+ `}function Eu(e){try{return lA(e,"utf8")}catch{return null}}function xA(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 kA(e){if(e===null)return{value:void 0,corrupt:!1};let t;try{t=JSON.parse(e)}catch{return{value:void 0,corrupt:!0}}return xA(t)?{value:t,corrupt:!1}:{value:void 0,corrupt:!0}}function wA(e){return kA(Eu(e))}function SA(e){let t=Eu(e);if(t===null)return{};try{let r=JSON.parse(t);return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{}}}function _A(e){let t=SA(e?.configFile??Ae),r=e?.env??process.env;return!(r.BRIDGE_CODEX_HOOKS==="0"||r.BRIDGE_CODEX_HOOKS==="false")&&t.autoCodexHooks!==!1}function ky(e,t){let r=t?.home??hy.homedir(),o=Ks(r),n=t?.configFile??Ae,i=t?.env??process.env,s=_A({configFile:n,env:i});if(!aA(Js.dirname(o)))return{enabled:s,skipped:!0,changed:!1,corrupt:!1};let{value:a,corrupt:l}=wA(o);if(l)return{enabled:s,skipped:!1,changed:!1,corrupt:!0};if(!s)return yA(a)?gy(o,vA(a),s,l):{enabled:s,skipped:!1,changed:!1,corrupt:l};let u=vy(e,t?.nodeCommand);return gy(o,hA(a,u),s,l)}function gy(e,t,r,o){let n=bA(t);return Eu(e)===n?{enabled:r,skipped:!1,changed:!1,corrupt:o}:(cA(Js.dirname(e),{recursive:!0}),uA(e,n),{enabled:r,skipped:!1,changed:!0,corrupt:o})}function wy(e){let t=/(\d+)\.(\d+)\.(\d+)/.exec(e??""),r=Number(t?.[1]??0),o=Number(t?.[2]??0),n=Number(t?.[3]??0);return{ok:r>2||r===2&&(o>1||o===1&&n>=80),version:t?.[0]??null}}function Sy(e){return{ok:new RegExp(`${Xe}@${je}`).test(e??"")}}function _y(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===je&&o.plugin===Xe)}}import{existsSync as $A,readdirSync as IA,readFileSync as EA}from"node:fs";import $y from"node:os";function AA(e,t,r){let o=r.readFile(`${e}${t}plugins${t}installed_plugins.json`);if(!o)return!1;try{return!!JSON.parse(o)?.plugins?.[`${Xe}@${je}`]}catch{return!1}}function PA(e){return/^\\\\(?:wsl\.localhost|wsl\$)\\([^\\]+)\\/i.exec(e)?.[1]??null}function CA(e){let t=e.platform==="win32"?"\\":"/",r=(s,a,l,u,d)=>{let m=`${s}${t}.claude`;return{id:l,label:u,kind:a,home:s,claudeDir:m,claudePresent:e.exists(m),pluginInstalled:AA(m,t,e),setupHint:d}},o=e.env.WSL_DISTRO_NAME,n=e.isWsl?`this environment (WSL${o?`: ${o}`:""})`:e.platform==="win32"?"this environment (Windows)":"this environment",i=[r(e.homeDir,"current","current",n,"acbridge setup")];for(let s of uu(e)){let a=`${s}${t}.claude`;if(e.exists(a))if(e.isWsl){let l=s.split("/").pop()??e.userName;i.push(r(s,"windows",`windows:${l}`,`Windows (user ${l})`,"run `acbridge setup` in a Windows terminal"))}else{let l=PA(s)??"wsl";i.push(r(s,"wsl",`wsl:${l}`,`WSL: ${l}`,`wsl.exe -d ${l} -- acbridge setup`))}}return i}function Iy(){let e=n=>{try{return EA(n,"utf8")}catch{return null}},t=n=>{try{return IA(n)}catch{return[]}},r="";try{r=$y.userInfo().username}catch{r=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 CA({homeDir:$y.homedir(),env:process.env,platform:process.platform,userName:r,isWsl:o,readFile:e,listDir:t,exists:n=>$A(n)})}import{spawnSync as TA}from"node:child_process";import{existsSync as RA,readdirSync as OA,statSync as DA}from"node:fs";import{basename as Ey,join as NA}from"node:path";function Ay(e){try{let t=TA("git",["-C",e,"rev-parse","--abbrev-ref","HEAD"],{encoding:"utf8",timeout:2500}),r=(t.stdout??"").trim();return t.status===0&&r?r:"\u2014"}catch{return"\u2014"}}function LA(e){try{return OA(e,{withFileTypes:!0}).filter(t=>t.isDirectory()&&!t.name.startsWith(".")&&t.name!=="node_modules").map(t=>NA(e,t.name)).sort((t,r)=>t.localeCompare(r))}catch{return[]}}function UA(e){try{return RA(e)&&DA(e).isDirectory()}catch{return!1}}function Py(e,t,r){let o=r==="root"?LA(t):UA(t)?[t]:[],n=new Set(e.map(s=>s.path)),i=o.filter(s=>!n.has(s)).map(s=>({path:s,name:Ey(s),bridge:Ey(s),branch:Ay(s),fav:!1}));return[...e,...i]}function Au(e,t,r){return e.map(o=>o.path===t?{...o,...r.bridge!==void 0?{bridge:r.bridge}:{},...r.fav!==void 0?{fav:r.fav}:{}}:o)}function Cy(e){return e.map(t=>({...t,branch:Ay(t.path)}))}import{spawnSync as jA}from"node:child_process";import{existsSync as zA}from"node:fs";import Ty from"node:path";function FA(e,t){let r=e==="win32"?Ty.win32:Ty.posix,o=e==="win32"?"bridge-node.cmd":"bridge-node";return r.join(t,"bin",o)}function Ry(e){let t=/(\d+)\.(\d+)\.(\d+)/.exec(e??"");return t?{major:Number(t[1]),full:t[0]}:null}function Xr(e){if(e.shimExists()&&Ry(e.runShimVersion())!==null)return{kind:"shim",command:e.shimPath};let t=Ry(e.runNodeVersion());return t!==null&&t.major>=20?{kind:"system",command:"node",version:t.full}:{kind:"none"}}function Xs(e){return e.kind==="shim"?`"${e.command}"`:void 0}function Yr(e,t=process.platform){let r=FA(t,e),o=(n,i)=>{try{let s=jA(n,i,{encoding:"utf8"});return s.status===0?s.stdout??"":null}catch{return null}};return{platform:t,shimPath:r,shimExists:()=>zA(r),runShimVersion:()=>t==="win32"?o("cmd.exe",["/c",r,"--version"]):o(r,["--version"]),runNodeVersion:()=>o("node",["--version"])}}function Ys(e={}){let t=e.configFile??Ae,r={},o=N(t);if(o)try{r=JSON.parse(o)}catch{r={}}return{claudeBin:typeof r.claudeBin=="string"?r.claudeBin:null,relayUrl:typeof r.relayUrl=="string"?r.relayUrl:null,hubPort:typeof r.hubPort=="number"?r.hubPort:null,onboardedAt:typeof r.onboardedAt=="number"?r.onboardedAt:null}}function Qs(e,t={}){let r=t.configFile??Ae,o={},n=N(r);if(n)try{o=JSON.parse(n)}catch{o={}}for(let[i,s]of Object.entries(e))s===null?delete o[i]:s!==void 0&&(o[i]=s);return ke(r,JSON.stringify(o,null,2)+`
20
+ `,384),o}import{createHash as MA,randomBytes as Oy}from"node:crypto";var Pu=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");function Dy(){let e=Pu(Oy(32)),t=Pu(MA("sha256").update(e).digest());return{verifier:e,challenge:t}}function Ny(){return Pu(Oy(24))}var BA="https://api.workos.com";var HA="client_01KW2CY31D0NZKCDKNHF2XQ7VC",ZA="org_01KW0DNZ14H6JMK8RHA0WSKNVZ";function Ly(e=t=>process.env[t]){let t=e("WORKOS_CLIENT_ID")??HA,r=Number(e("WORKOS_REDIRECT_PORT")??8765)||8765,o=(e("WORKOS_API_HOST")??BA).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")??ZA,configured:!!t}}var GA={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",GA[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 WA(e){return{id:e.id,email:e.email,firstName:e.first_name,lastName:e.last_name,profilePictureUrl:e.profile_picture_url}}async function VA(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 qA(e,t,r){let o=await VA(e,t,r),n=await o.text().catch(()=>"");if(!o.ok)throw new ea("rejected",`WorkOS ${o.status}: ${JA(n)}`);let i=JSON.parse(n);return{user:WA(i.user),accessToken:i.access_token,refreshToken:i.refresh_token}}function Uy(e,t,r,o=fetch){return qA(e,{grant_type:"authorization_code",code:t,code_verifier:r},o)}function JA(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 tP}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%)",KA=[58,160,255],jy=[106,111,246],XA=[138,79,240];function YA(e){let[t,r]=e<=.5?[KA,jy]:[jy,XA],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:${YA(r)};opacity:${n<6?.92:1};animation:wave ${i}s ease-in-out ${s}s infinite"></span>`}).join("");function QA(e){let t=e.markUri??Qr,r=t?`<span class="mark" style="-webkit-mask:url(&quot;${t}&quot;) center/contain no-repeat;mask:url(&quot;${t}&quot;) 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>
21
21
  <style>
22
22
  html,body{height:100%;margin:0}
23
23
  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 +31,8 @@ body{background:#07070f;color:#e9e8f4;font-family:'Sora','Segoe UI',system-ui,sa
31
31
  .bars span{width:4px;border-radius:4px;flex:0 0 auto;transform-origin:center}
32
32
  .orb{position:absolute;left:50%;top:50%;width:140px;height:140px;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center}
33
33
  .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:${xa};filter:drop-shadow(0 6px 16px rgba(0,0,0,.55))}
35
- .mono{position:relative;font-weight:800;font-size:44px;letter-spacing:-1px;background:${xa};-webkit-background-clip:text;background-clip:text;color:transparent}
34
+ .mark{position:relative;width:106px;height:106px;background:${na};filter:drop-shadow(0 6px 16px rgba(0,0,0,.55))}
35
+ .mono{position:relative;font-weight:800;font-size:44px;letter-spacing:-1px;background:${na};-webkit-background-clip:text;background-clip:text;color:transparent}
36
36
  .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
37
  h1{font-size:40px;font-weight:700;line-height:1.1;letter-spacing:-.02em;margin:0 0 14px}
38
38
  p{font-size:17px;color:#9b9ab3;margin:0 auto;max-width:460px;line-height:1.65}
@@ -44,11 +44,11 @@ ${o}${e.extraCss??""}
44
44
  </style></head>
45
45
  <body><div class="aur a"></div><div class="aur b"></div><div class="dots"></div>
46
46
  <div class="card">
47
- <div class="badge" aria-hidden="true"><div class="bars">${Fl}</div><div class="orb"><span class="glow"></span>${r}</div></div>
47
+ <div class="badge" aria-hidden="true"><div class="bars">${Cu}</div><div class="orb"><span class="glow"></span>${r}</div></div>
48
48
  <div class="eyebrow">AC Bridge</div>
49
- <h1>${Rt(e.headline)}</h1><p>${Rt(e.sub)}</p>${e.extraBody??""}
50
- </div>${vA(e.cleanPath)}</body></html>`}function vA(e){return!e||!/^\/[a-z0-9-]+$/.test(e)?"":`<script>try{history.replaceState(null,"","${e}")}catch(e){}</script>`}function Ml(e,t,r=Cr,o){return hA({title:e,headline:e,sub:t,markUri:r,...o?{cleanPath:o}:{}})}function Rt(e){return e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]??t)}var bA=(e,t,r)=>Ml(e,t,void 0,r);function Nv(e,t,r,o=12e4,n="/callback",i=bA,a){let s,l,u=new Promise((p,m)=>{s=p,l=m});u.catch(()=>{});let d=new Promise((p,m)=>{let f=e,g=yA((C,E)=>{let D=C.headers.host;if(D!==`127.0.0.1:${f}`&&D!==`localhost:${f}`){E.writeHead(400,{"content-type":"text/plain"}),E.end("bad host");return}let G=new URL(C.url??"/",`http://127.0.0.1:${f}`);if(a!==void 0&&G.pathname==="/"){Zo(E,200,a);return}if(G.pathname!==n){E.writeHead(404,{"content-type":"text/plain"}),E.end("not found");return}if(G.searchParams.get("state")!==t){Zo(E,400,i("Invalid request","This sign-in link isn\u2019t valid for this session.","/sign-in-failed"));return}let ae=G.searchParams.get("code"),X=G.searchParams.get("error_description")??G.searchParams.get("error");X?(Zo(E,400,i("Sign-in failed","You can return to AC Bridge and try again.","/sign-in-failed")),_(()=>m(new Error(X)))):ae?(Zo(E,200,i("Signed in","You're connected. Return to AC Bridge \u2014 you can close this tab.","/signed-in")),_(()=>p({code:ae}))):(Zo(E,400,i("Sign-in failed","You can return to AC Bridge and try again.","/sign-in-failed")),_(()=>m(new Error("No authorization code returned."))))}),y=setTimeout(()=>_(()=>m(new Error("Sign-in timed out."))),o),k=!1;function _(C){k||(k=!0,clearTimeout(y),r?.removeEventListener("abort",P),g.close(),C())}function P(){_(()=>m(new Error("Sign-in cancelled.")))}if(r?.aborted){_(()=>m(new Error("Sign-in cancelled."))),l(new Error("Sign-in cancelled."));return}r?.addEventListener("abort",P),g.on("error",C=>{l(C instanceof Error?C:new Error(String(C))),_(()=>m(C))}),g.listen(e,"127.0.0.1",()=>{let C=g.address();f=typeof C=="object"&&C!==null?C.port:e,s(f)})});return{port:u,result:d}}function Zo(e,t,r){e.writeHead(t,{"content-type":"text/html; charset=utf-8"}),e.end(r)}function Lv(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 xA=[{provider:"google",label:"Continue with Google"},{provider:"github",label:"Continue with GitHub"},{provider:"microsoft",label:"Continue with Microsoft"},{provider:"email",label:"Log in"}];function zv({cfg:e,state:t,codeChallenge:r,email:o,screenHint:n}){return xA.map(({provider:i,label:a})=>{let s=i!=="email"&&i!=="sso";return{provider:i,label:a,direct:s,url:ba({cfg:e,opts:s?{provider:i}:{provider:i,...o?{email:o}:{},...n?{screenHint:n}:{}},state:t,codeChallenge:r})}})}var kA={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>'},wA='<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>',Uv=`-webkit-mask:url("${Cr}") center/contain no-repeat;mask:url("${Cr}") center/contain no-repeat`,Go="https://ac-bridge.com",SA=`*{box-sizing:border-box}
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:${xa};--ac-brand-grad-text:linear-gradient(92deg,#67e8f9,#38bdf8 40%,#a78bfa 75%,#c084fc)}
49
+ <h1>${jt(e.headline)}</h1><p>${jt(e.sub)}</p>${e.extraBody??""}
50
+ </div>${eP(e.cleanPath)}</body></html>`}function eP(e){return!e||!/^\/[a-z0-9-]+$/.test(e)?"":`<script>try{history.replaceState(null,"","${e}")}catch(e){}</script>`}function Tu(e,t,r=Qr,o){return QA({title:e,headline:e,sub:t,markUri:r,...o?{cleanPath:o}:{}})}function jt(e){return e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]??t)}var nP=(e,t,r)=>Tu(e,t,void 0,r);function zy(e,t,r,o=12e4,n="/callback",i=nP,s){let a,l,u=new Promise((m,p)=>{a=m,l=p});u.catch(()=>{});let d=new Promise((m,p)=>{let f=e,g=tP((I,S)=>{let T=I.headers.host;if(T!==`127.0.0.1:${f}`&&T!==`localhost:${f}`){S.writeHead(400,{"content-type":"text/plain"}),S.end("bad host");return}let j=new URL(I.url??"/",`http://127.0.0.1:${f}`);if(s!==void 0&&j.pathname==="/"){yi(S,200,s);return}if(j.pathname!==n){S.writeHead(404,{"content-type":"text/plain"}),S.end("not found");return}if(j.searchParams.get("state")!==t){yi(S,400,i("Invalid request","This sign-in link isn\u2019t valid for this session.","/sign-in-failed"));return}let z=j.searchParams.get("code"),J=j.searchParams.get("error_description")??j.searchParams.get("error");J?(yi(S,400,i("Sign-in failed","You can return to AC Bridge and try again.","/sign-in-failed")),w(()=>p(new Error(J)))):z?(yi(S,200,i("Signed in","You're connected. Return to AC Bridge \u2014 you can close this tab.","/signed-in")),w(()=>m({code:z}))):(yi(S,400,i("Sign-in failed","You can return to AC Bridge and try again.","/sign-in-failed")),w(()=>p(new Error("No authorization code returned."))))}),h=setTimeout(()=>w(()=>p(new Error("Sign-in timed out."))),o),y=!1;function w(I){y||(y=!0,clearTimeout(h),r?.removeEventListener("abort",_),g.close(),I())}function _(){w(()=>p(new Error("Sign-in cancelled.")))}if(r?.aborted){w(()=>p(new Error("Sign-in cancelled."))),l(new Error("Sign-in cancelled."));return}r?.addEventListener("abort",_),g.on("error",I=>{l(I instanceof Error?I:new Error(String(I))),w(()=>p(I))}),g.listen(e,"127.0.0.1",()=>{let I=g.address();f=typeof I=="object"&&I!==null?I.port:e,a(f)})});return{port:u,result:d}}function yi(e,t,r){e.writeHead(t,{"content-type":"text/html; charset=utf-8"}),e.end(r)}function Fy(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 rP=[{provider:"google",label:"Continue with Google"},{provider:"github",label:"Continue with GitHub"},{provider:"microsoft",label:"Continue with Microsoft"},{provider:"email",label:"Log in"}];function By({cfg:e,state:t,codeChallenge:r,email:o,screenHint:n}){return rP.map(({provider:i,label:s})=>{let a=i!=="email"&&i!=="sso";return{provider:i,label:s,direct:a,url:ta({cfg:e,opts:a?{provider:i}:{provider:i,...o?{email:o}:{},...n?{screenHint:n}:{}},state:t,codeChallenge:r})}})}var oP={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>'},iP='<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>',My=`-webkit-mask:url("${Qr}") center/contain no-repeat;mask:url("${Qr}") center/contain no-repeat`,bi="https://ac-bridge.com",sP=`*{box-sizing:border-box}
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:${na};--ac-brand-grad-text:linear-gradient(92deg,#67e8f9,#38bdf8 40%,#a78bfa 75%,#c084fc)}
52
52
  html{background:var(--ac-bg)}
53
53
  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
54
  .mono{font-family:'Space Mono',ui-monospace,'SFMono-Regular',monospace}
@@ -65,7 +65,7 @@ body{margin:0;min-height:100vh;background:var(--ac-bg);color:var(--ac-text);font
65
65
  .mesh .aur.a{left:8%;background:radial-gradient(closest-side,rgba(56,189,248,.16),transparent)}
66
66
  .mesh .aur.b{left:24%;background:radial-gradient(closest-side,rgba(139,92,246,.18),transparent);animation-delay:-7s}
67
67
  .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);${Uv}}
68
+ .lockup .mk{display:block;flex-shrink:0;width:30px;height:30px;background:var(--ac-brand-grad);${My}}
69
69
  .lockup .wm{font-weight:700;font-size:15px;letter-spacing:-.01em;line-height:1}
70
70
  .mid{position:relative;display:flex;flex:1;flex-direction:column;justify-content:center;padding:40px 0}
71
71
 
@@ -75,7 +75,7 @@ body{margin:0;min-height:100vh;background:var(--ac-bg);color:var(--ac-text);font
75
75
  .bars span{width:4px;border-radius:4px;flex:0 0 auto;transform-origin:center}
76
76
  .orb{position:absolute;left:50%;top:50%;display:flex;width:140px;height:140px;transform:translate(-50%,-50%);align-items:center;justify-content:center}
77
77
  .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);${Uv};filter:drop-shadow(0 6px 16px rgba(0,0,0,.55))}
78
+ .orb .mk{position:relative;width:106px;height:106px;background:var(--ac-brand-grad);${My};filter:drop-shadow(0 6px 16px rgba(0,0,0,.55))}
79
79
 
80
80
  .eyebrow{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.16em;color:var(--ac-accent-soft)}
81
81
  .aside .eyebrow{margin-bottom:16px}
@@ -131,15 +131,15 @@ form.email .flt{font-size:10.5px;text-transform:uppercase;letter-spacing:.1em;co
131
131
  @keyframes glow{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.04)}}
132
132
  @keyframes aur{0%,5%{opacity:0}12%,28%{opacity:1}38%,100%{opacity:0}}
133
133
  @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}}`,_A=`<a class="lockup" href="${Go}/" data-testid="nav-brand" aria-label="AC Bridge home"><span class="mk"></span><span class="wm">AC Bridge</span></a>`,$A='<span class="lockup"><span class="mk"></span><span class="wm">AC Bridge</span></span>';function IA(e){return`<a class="sso" data-testid="oauth-${e.provider}" href="${Rt(e.url)}">${kA[e.provider]??""}<span>${Rt(e.label)}</span>${wA}</a>`}function AA(e){let t=new URL(e.url),r=[...t.searchParams].filter(([o])=>o!=="login_hint").map(([o,n])=>`<input type="hidden" name="${Rt(o)}" value="${Rt(n)}">`).join("");return`<form class="email" method="get" action="${Rt(`${t.origin}${t.pathname}`)}">${r}<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">${Rt(e.label)}</button></form>`}function jv(e){let t=e.filter(o=>o.direct),r=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>
135
- <style>${SA}</style></head>
134
+ @media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}`,aP=`<a class="lockup" href="${bi}/" data-testid="nav-brand" aria-label="AC Bridge home"><span class="mk"></span><span class="wm">AC Bridge</span></a>`,cP='<span class="lockup"><span class="mk"></span><span class="wm">AC Bridge</span></span>';function lP(e){return`<a class="sso" data-testid="oauth-${e.provider}" href="${jt(e.url)}">${oP[e.provider]??""}<span>${jt(e.label)}</span>${iP}</a>`}function uP(e){let t=new URL(e.url),r=[...t.searchParams].filter(([o])=>o!=="login_hint").map(([o,n])=>`<input type="hidden" name="${jt(o)}" value="${jt(n)}">`).join("");return`<form class="email" method="get" action="${jt(`${t.origin}${t.pathname}`)}">${r}<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">${jt(e.label)}</button></form>`}function Hy(e){let t=e.filter(o=>o.direct),r=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>
135
+ <style>${sP}</style></head>
136
136
  <body><div class="page" data-testid="login-page"><div class="split">
137
137
 
138
138
  <aside class="aside" data-testid="login-session-panel">
139
139
  <div class="mesh" aria-hidden="true"><div class="dots"></div><div class="aur a"></div><div class="aur b"></div></div>
140
- ${_A}
140
+ ${aP}
141
141
  <div class="mid">
142
- <div class="badge" aria-hidden="true"><div class="bars">${Fl}</div><div class="orb"><span class="glow"></span><span class="mk"></span></div></div>
142
+ <div class="badge" aria-hidden="true"><div class="bars">${Cu}</div><div class="orb"><span class="glow"></span><span class="mk"></span></div></div>
143
143
  <div class="eyebrow mono">CLAUDE CODE + CODEX</div>
144
144
  <h1>Welcome back to<br><span class="grad">the bridge.</span></h1>
145
145
  <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 +149,98 @@ ${_A}
149
149
  </aside>
150
150
 
151
151
  <div class="right">
152
- <div class="topright"><span>New here? <a href="${Go}/register" data-testid="nav-register">Sign up free</a></span></div>
152
+ <div class="topright"><span>New here? <a href="${bi}/register" data-testid="nav-register">Sign up free</a></span></div>
153
153
  <div class="center"><div class="card">
154
154
  <div class="eyebrow mono">WELCOME BACK</div>
155
155
  <h2>Log in</h2>
156
156
  <p class="sub">Pick up your sessions right where you left them.</p>
157
- <div class="ssos">${t.map(IA).join("")}</div>
157
+ <div class="ssos">${t.map(lP).join("")}</div>
158
158
  <div class="rule"><span class="hair"></span><span class="rl mono">or with email</span><span class="hair"></span></div>
159
- ${r?AA(r):""}
160
- <p class="newto">New to AC Bridge? <a href="${Go}/register">Create a free account</a></p>
159
+ ${r?uP(r):""}
160
+ <p class="newto">New to AC Bridge? <a href="${bi}/register">Create a free account</a></p>
161
161
  </div></div>
162
162
  </div>
163
163
 
164
164
  </div>
165
165
  <footer class="foot" data-testid="site-footer"><div class="inner">
166
- <div class="row">${$A}<nav aria-label="Footer"><a href="mailto:support@ac-bridge.com">support@ac-bridge.com</a><a href="${Go}/privacy">Privacy</a><a href="${Go}/terms">Terms</a></nav><span class="cr mono">(c) 2026 AC BRIDGE</span></div>
166
+ <div class="row">${cP}<nav aria-label="Footer"><a href="mailto:support@ac-bridge.com">support@ac-bridge.com</a><a href="${bi}/privacy">Privacy</a><a href="${bi}/terms">Terms</a></nav><span class="cr mono">(c) 2026 AC BRIDGE</span></div>
167
167
  <span class="disc">Works with Claude Code and Codex. Not affiliated with or endorsed by Anthropic or OpenAI.</span>
168
168
  </div></footer>
169
- </div></body></html>`}import{spawn as Bl}from"node:child_process";function EA(e,t=Bl){return new Promise(r=>{let o=!1,n=s=>{o||(o=!0,r(s))},i=t("powershell.exe",["-NoProfile","-NonInteractive","-Command","$u=[Console]::In.ReadLine(); try { Start-Process $u -ErrorAction Stop } catch { exit 1 }"],{stdio:["pipe","ignore","ignore"]}),a=setTimeout(()=>{try{i.kill()}catch{}n(!1)},8e3);a.unref?.(),i.on("error",()=>{clearTimeout(a),n(!1)}),i.on("exit",s=>{clearTimeout(a),n(s===0)}),i.stdin?.on("error",()=>{}),i.stdin?.end(`${e}
170
- `)})}function PA(e,t=Bl){return new Promise(r=>{let o=t("cmd.exe",["/c","start","",e.replace(/&/g,"^&")],{detached:!0,stdio:"ignore"});o.on("error",()=>r(!1)),o.on("spawn",()=>{o.unref(),r(!0)})})}var CA=1200;function Fv(e,t,r,o){return new Promise(n=>{let i=!1,a=u=>{i||(i=!0,n(u))},s=r(e,[t],{detached:!0,stdio:"ignore"}),l=setTimeout(()=>a(!0),o);l.unref?.(),s.on("error",()=>{clearTimeout(l),a(!1)}),s.on("exit",u=>{clearTimeout(l),a(u===0)}),s.on("spawn",()=>s.unref())})}async function ka(e,t){let r=t.platform??process.platform,o=t.spawnImpl??Bl;if(r==="win32"||t.isWsl)return await EA(e,o)?!0:PA(e,o);let n=t.graceMs??CA;return Fv(r==="darwin"?"open":"xdg-open",e,o,n)}function Vo(){return oa().length>0}function TA(){jo()}async function Mv(e,t,r){let o=(e??"").replace(/\/+$/,""),n=r?.fetchImpl??fetch;if(o&&t)try{await n(`${o}/node/revoke`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${t}`},body:"{}",signal:AbortSignal.timeout(3e3)})}catch{}(r?.clear??TA)()}var RA=4,OA=1500,DA=e=>new Promise(t=>setTimeout(t,e)),Wo=null;function Bv(e,t,r={}){if((r.hasCredential??Vo)())return Promise.resolve(!0);if(Wo)return Wo;let n=r.attempts??RA,i=r.retryMs??OA,a=r.provision??Ph,s=r.claim??Ch,l=r.store??zo,u=r.log??(d=>console.error(d));return Wo=(async()=>{let d="no attempt made";try{for(let p=1;p<=n;p++){p>1&&await DA(i);let m=t();if(!m){d="no sign-in token available yet";continue}try{let f=await a(e,m),g=await s(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 ${n} attempts (hub will fall back to the app-refreshed token): ${d}`),!1}finally{Wo=null}})(),Wo}async function Hv(e){let t=Cv(),r=Tv(),o=e.chooser?jv(zv({cfg:e.cfg,state:r,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)=>Nv(d,p,m,f,void 0,void 0,g)))(e.cfg.port,r,e.signal,e.timeoutMs??18e4,o),a=e.openUrl??(d=>ka(d,{isWsl:!1})),s;o?(i.result.catch(()=>{}),s=`http://127.0.0.1:${await i.port}/`):s=ba({cfg:e.cfg,opts:e.opts,state:r,codeChallenge:t.challenge}),await a(s)||e.onBrowserFail?.(s);let{code:l}=await i.result;return(e.exchange??((d,p,m)=>Ov(d,p,m)))(e.cfg,l,t.verifier)}import{spawn as NA}from"node:child_process";import{existsSync as Zv}from"node:fs";import wa from"node:path";function Tr(e={}){let t=e.platform??process.platform,r=e.env??(u=>process.env[u]),o=e.read??O,n=e.exists??Zv,i=u=>({path:u,darwinBundle:t==="darwin"&&u.endsWith(".app")}),a=r("BRIDGE_APP_PATH")?.trim();if(a&&n(a))return i(a);let s=o(Gv)?.trim();if(s&&n(s))return i(s);if(t==="win32"){let u=r("LOCALAPPDATA");if(u){let d=wa.win32.join(u,"Programs","AC Bridge","ac-bridge.exe");if(n(d))return i(d)}return null}if(t==="darwin"){let u=r("HOME");for(let d of["/Applications/AC Bridge.app",...u?[wa.join(u,"Applications","AC Bridge.app")]:[]])if(n(d))return i(d);return null}let l=r("PATH")??"";for(let u of l.split(wa.delimiter).filter(Boolean)){let d=wa.join(u,"ac-bridge");if(n(d))return i(d)}return null}function Sa(e,t=NA){return new Promise(r=>{let o=e.darwinBundle?t("open",["-a",e.path],{detached:!0,stdio:"ignore"}):t(e.path,[],{detached:!0,stdio:"ignore"});o.on("error",()=>r(!1)),o.on("spawn",()=>{o.unref(),r(!0)})})}async function _a(e){let t=e?.timeoutMs??18e4,r=e?.pollMs??1e3,o=e?.exists??Zv,n=e?.exists||e?.file?()=>o(e?.file??""):Vo,i=Date.now()+t;for(;;){if(n())return!0;if(Date.now()>=i)return!1;await new Promise(a=>setTimeout(a,r))}}import We from"node:path";function $e(e={}){let t=O(e.file??Lo);if(!t)return null;try{let r=JSON.parse(t);return typeof r.sub!="string"||!r.sub?null:{sub:r.sub,...typeof r.email=="string"?{email:r.email}:{},updatedAt:typeof r.updatedAt=="number"?r.updatedAt:0}}catch{return null}}function Yt(e,t={}){let r={sub:e.sub,...e.email?{email:e.email}:{},updatedAt:Date.now()};ge(t.file??Lo,`${JSON.stringify(r,null,2)}
171
- `,384)}function Wv(e={}){ue(e.file??Lo)}function LA(){let e=$e()?.sub;if(!e)return null;let t=yt(ut(e)),r=O(t.refreshFile),o=r?Ze(r):null;if(o)return o;let n=O(t.accessFile);return n?Ze(n):null}function pt(e={}){let t=e.readActiveUser??(()=>$e()),r=e.readCredentialSub??LA,o=e.log??(s=>console.warn(s)),n=t()?.sub??null,i=r();if(!n||!i)return null;if(n!==i)return o(`user-scope: active-user pointer sub (${n}) does not match the credential sub (${i}) \u2014 refusing to resolve a scope (stale-pointer guard)`),null;let a=ut(n);return{sub:n,segment:a,dir:ea(a)}}function qo(e){let t=e.dir;return{dir:t,providerSecretFile(r,o){return Jo("provider",r),Jo("secret name",o),We.join(t,"providers",r,`${o}.json`)},providerAccountsFile(r){return Jo("provider",r),We.join(t,"providers",r,"accounts.json")},localConfigFile:We.join(t,"local-config.json"),localDiscoveredFile:We.join(t,"local-discovered.json"),entitlementFile:We.join(t,"entitlement.json"),revertSessionFile:We.join(t,"revert-session.json"),telemetrySpoolDir:We.join(t,"telemetry","spool"),userConfigFile:We.join(t,"config.json"),relayAccessFile:We.join(t,"relay-access-token"),relayRefreshFile:We.join(t,"relay-refresh-token"),hubTokenFile:We.join(t,"hub-token"),workspaceFile:We.join(t,"workspace.json")}}function Hl(e,t){if((t?.layout??Kt())>=Xt){let o=(t?.resolveScope??(()=>pt()))();if(o)return We.join(e,"users",o.segment,"hub-token")}return We.join(e,"hub-token")}import{existsSync as UA,mkdirSync as Jv,renameSync as Zl}from"node:fs";import Le from"node:path";var zA="layout-version.json",qv=3,jA=["providers","local-config.json","local-discovered.json","entitlement.json","revert-session.json","telemetry"];function Kv(e={}){let t=e.secretDir??W,r=e.now??(()=>new Date),o=Le.join(t,zA);if(GA(o))return{archived:[],skipped:!0,credentialRelocated:null,credentialArchived:!1};let n=Le.join(t,`legacy-${ZA(r())}`),i=!1,a=()=>(i||(Jv(n,{recursive:!0,mode:448}),i=!0),n),s=jA.filter(p=>UA(Le.join(t,p))),l=[];for(let p of s)try{a(),Zl(Le.join(t,p),Le.join(n,p)),l.push(p)}catch(m){if(m.code==="ENOENT")continue;console.warn(`archiveLegacyUserState: failed to archive "${p}": ${m.message}`)}let u=l.length===s.length;ue(Le.join(t,"hub-token"));let d=u?HA(t,a):{relocated:null,archived:!1,ok:!0};return u&&d.ok&&(va({onboardedAt:null},{configFile:Le.join(t,"config.json")}),WA(o,r)),{archived:l,skipped:!1,credentialRelocated:d.relocated,credentialArchived:d.archived}}function FA(e){return{accessFile:Le.join(e,"relay-access-token"),refreshFile:Le.join(e,"relay-refresh-token")}}function MA(e,t){let r=Le.join(e,"users",t);return{accessFile:Le.join(r,"relay-access-token"),refreshFile:Le.join(r,"relay-refresh-token")}}function Vv(e,t){try{return Jv(Le.dirname(t),{recursive:!0,mode:448}),Zl(e,t),"moved"}catch(r){return r.code==="ENOENT"?"absent":(console.warn(`archiveLegacyUserState: failed to relocate credential to "${t}": ${r.message}`),"failed")}}function $a(e,t,r){try{let o=e();return Zl(t,Le.join(o,r)),"moved"}catch(o){return o.code==="ENOENT"?"absent":(console.warn(`archiveLegacyUserState: failed to archive credential "${r}": ${o.message}`),"failed")}}function BA(e,t){let r=Le.join(e,"active-user.json");if($e({file:r})===null)try{Yt({sub:t},{file:r})}catch(o){console.warn(`archiveLegacyUserState: failed to heal the active-user pointer to "${t}": ${o.message}`)}}function HA(e,t){let r=FA(e),o=O(r.refreshFile),n=O(r.accessFile);if(!o&&!n)return{relocated:null,archived:!1,ok:!0};let i=o?Ze(o):null,a=n?Ze(n):null,s=i??a;if(!s){let m=o?$a(t,r.refreshFile,"relay-refresh-token"):"absent",f=n?$a(t,r.accessFile,"relay-access-token"):"absent";return{relocated:null,archived:m==="moved"||f==="moved",ok:m!=="failed"&&f!=="failed"}}i&&a&&i!==a&&console.warn(`archiveLegacyUserState: access-token sub (${a}) 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=ut(s),u=MA(e,l),d=!0,p=!1;if(o){let m=i===s?Vv(r.refreshFile,u.refreshFile):$a(t,r.refreshFile,"relay-refresh-token");m==="failed"?d=!1:m==="moved"&&i!==s&&(p=!0)}if(n){let m=a===s?Vv(r.accessFile,u.accessFile):$a(t,r.accessFile,"relay-access-token");m==="failed"?d=!1:m==="moved"&&a!==s&&(p=!0)}return d&&BA(e,s),{relocated:{sub:s,segment:l},archived:p,ok:d}}function ZA(e){return e.toISOString().replace(/[:.]/g,"-")}function GA(e){let t=O(e);if(!t)return!1;try{let r=JSON.parse(t);return typeof r.version=="number"&&r.version>=qv}catch{return!1}}function WA(e,t){let r={version:qv,migratedAt:t().toISOString()};ge(e,`${JSON.stringify(r,null,2)}
172
- `,384)}var YA=Ue.join(W,"hub-token"),L2=Number(process.env.BRIDGE_HUB_PORT)||8790,ke=Ue.join(W,"config.json"),xt=Ue.join(W,"hub.log"),Mo=Ue.join(W,"hub.pid"),U2=Ue.join(W,Jn),Ve=Ue.join(W,"daemon.pid"),Ia=Ue.join(W,"daemon-beacon.json"),En=Ue.join(W,"daemon.log"),Ko=Ue.join(W,"hub-stop-reason.json"),Gv=Ue.join(W,"app-path"),ey=Ue.join(W,"hub-relay-status.json"),z2=Ue.join(W,"hub-holders.json"),ty=Ue.join(W,"sessions"),Gl=e=>Ue.join(ty,`${e}.json`);function ge(e,t,r=384){let o=Ue.dirname(e),n=(r&63)===0;if(JA(o,{recursive:!0,...n?{mode:448}:{}}),n)try{Xv(o,448)}catch{}let i=`${e}.tmp-${process.pid}-${process.hrtime.bigint()}`;Qv(i,t,{mode:r});try{KA(i,e)}catch(a){try{Yv(i,{force:!0})}catch{}throw a}}function O(e){try{return qA(e,"utf8").trim()||null}catch{return null}}function ny(e,t){let r=t?.write??((n,i)=>ge(n,i,384)),o=t?.now??Date.now;try{r(Ko,JSON.stringify({signal:e,ts:o()}))}catch{}}function Aa(){let e={};try{let t=O(ke);t&&(e=JSON.parse(t))}catch{}return process.env.BRIDGE_MACHINE||e.machine||XA.hostname().split(".")[0]||"node"}function ry(){let e=Number(process.env.BRIDGE_HUB_PORT);if(e)return e;try{let t=O(ke);if(t){let r=JSON.parse(t);if(r.hubPort)return Number(r.hubPort)}}catch{}return 8790}function Wl(e){try{Qv(e,"",{mode:384}),Xv(e,384)}catch{}}function ue(e){try{Yv(e,{force:!0})}catch{}}function Ea(e){try{return process.kill(e,0),!0}catch(t){return t.code!=="ESRCH"}}function Jo(e,t){if(!t||t.includes("/")||t.includes("\\")||t.includes("..")||t.includes("\0"))throw new Error(`unsafe ${e}: ${JSON.stringify(t)}`)}function Pa(e,t){return Jo("provider",e),`${e}_${VA("sha256").update(t).digest("hex").slice(0,12)}`}import{readFileSync as nE}from"node:fs";import{existsSync as QA}from"node:fs";import Qt from"node:path";import{fileURLToPath as eE}from"node:url";function tE(e){let t=process.env.BRIDGE_PKG_ROOT;if(t&&t.trim())return t.trim();let r=o=>QA(Qt.join(o,"plugin",".claude-plugin","marketplace.json"));for(let o of[Qt.join(e,".."),Qt.join(e,"..","..")])if(r(o))return o;return Qt.join(e,"..","..")}var en=tE(Qt.dirname(eE(import.meta.url))),Rr=Qt.join(en,"plugin"),Xo=Qt.join(en,"hub","dist","hub.cjs"),oy=Qt.join(en,"hub","src","index.ts"),Ca=Qt.join(en,"node_modules",".bin","tsx");var rE="https://relay.ac-bridge.com",oE=8790;function ne(){let e={};try{e=JSON.parse(nE(ke,"utf8"))}catch{}return{relayUrl:process.env.BRIDGE_RELAY_URL||e.relayUrl||rE,hubPort:Number(process.env.BRIDGE_HUB_PORT||e.hubPort||oE),machine:Aa()}}var Vl=class extends Error{constructor(r,o){super(r);this.status=o}status};async function Jl(e,t,r){let{relayUrl:o}=ne();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 iy(e){let t=await Jl("/node/claim",{claim_code:e});if(!t.ok)throw new Vl(`pairing failed (${t.status}): ${(await t.text()).slice(0,200)}`,t.status);return await t.json()}async function Ot(e){let{relayUrl:t}=ne();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 ay(e,t=fetch){let{relayUrl:r}=ne();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 sy(e){let{relayUrl:t}=ne();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 cy(e,t){try{let r=await Jl("/device/command",t,e),o=await r.json().catch(()=>({})),n=typeof o.error=="string"?o.error:void 0,i=wl(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 ly(e){let{relayUrl:t}=ne();try{let r=await fetch(`${t}/device-config`,{headers:{authorization:`Bearer ${e}`},signal:AbortSignal.timeout(1e4)});if(!r.ok)return null;let o=await r.json();return o.config&&typeof o.config=="object"?o.config:{}}catch{return null}}async function uy(e){let{relayUrl:t}=ne();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 dy(e,t,r){let{relayUrl:o}=ne();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(()=>({})),a=typeof i.error=="string"?i.error:void 0;return{ok:!1,status:n.status,error:wl(a)??a??`patch failed (${n.status})`}}catch(n){return{ok:!1,status:0,error:n instanceof Error?n.message:"patch failed"}}}async function py(e){let t=O(he().accessFile)?.trim();if(!t)return{ok:!1,error:"This machine isn't paired yet \u2014 run `acbridge pair` first."};try{let r=await Jl(`/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 iE=!!process.stdout.isTTY&&!process.env.NO_COLOR,Ta=e=>t=>iE?`\x1B[${e}m${t}\x1B[0m`:t,aE=Ta("32"),sE=Ta("33"),cE=Ta("31"),Se=Ta("2"),ql=!1,we=(e=!0)=>{ql=e};var Ra=e=>{ql?console.error(e):console.log(e)},xe=e=>console.log(JSON.stringify(e)),A=e=>Ra(`${aE("\u2714")} ${e}`),U=e=>Ra(`${sE("\u26A0")} ${e}`),b=e=>console.error(`${cE("\u2717")} ${e}`),h=e=>Ra(e),Y=e=>Ra(Se(`\u2022 ${e}`)),Pe=(e,t)=>(b(e),ql&&xe({error:e,exit:t}),t);var Je={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 my(e,t="sign in"){return e.length===0?{ok:!0}:{ok:!1,message:Je.logoutFirst(t),ambiguous:e.length>=2}}function nt(e,t=U){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 Oa(e,t=ut){return e.segment===t(e.sub)}function fy(e){let t=e.layout??Kt(),r=e.read??O,o=e.paths??he(),n=r(o.accessFile)?.trim()||"",i=e.resolveScope??(()=>pt());if(t<Xt)return n?{state:"ok",token:n,scope:i()}:{state:"signed-out"};let a=i();if(a)return n?{state:"ok",token:n,scope:a}:{state:"signed-out"};let s=(e.scan??dt)();return(e.warnAmbiguous??nt)(s),!!(e.readPointer??(()=>$e()))()||s.length>0?{state:"mismatch",message:Je.pointerMismatch}:{state:"signed-out"}}function Or(e){let t=fy(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 Pn(e={}){return fy(e)}function kt(){let e=pt();return e?qo(e):null}function Dr(e,t){let r=O(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 Da(e,t,r){ge(e.providerAccountsFile(t),`${JSON.stringify(r,null,2)}
173
- `,384)}function lE(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 uE=()=>Or({notSignedIn:{message:"This machine isn't paired yet \u2014 run `acbridge pair <code>` first.",exitCode:3}});async function gy(e,t={}){let r=e[0];if(r!=="on"&&r!=="off"&&r!=="status")return b("usage: acbridge capture on|off|status"),2;let o=(t.requireToken??uE)();if(!o.ok)return b(o.message),o.exitCode;let n=o.token;if(r==="status"){let u=await(t.fetchEntitlement??Ot)(n);u?(h(`plan: ${u.plan}`),h(`capture.telemetry: ${u.capture.telemetry}`),h(`capture.transcripts: ${u.capture.transcripts}`)):b("couldn't fetch entitlement from the relay (signed out, or the relay is unreachable)");let p=(t.entitlementFileRaw??dE)();if(!p)return h("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;h(`local entitlement file: ${f.toFixed(1)}h old (${f<=24?"fresh":"STALE \u2014 capture fail-closed"})`)}catch{h("local entitlement file: unreadable (capture fail-closed)")}return 0}let i=lE(n);if(!i)return b("Couldn't read this machine's node id from its access token \u2014 re-pair with `acbridge pair`."),1;let s=await(t.patchNode??dy)(n,i,{captureEnabled:r==="on"});return s.ok?(h(`Capture ${r==="on"?"enabled":"disabled"} for this machine.`),r==="on"&&h("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):(b(`capture ${r} failed${s.status?` (${s.status})`:""}: ${s.error??"unknown"}`),1)}function dE(){let e=kt();return e?O(e.entitlementFile):null}import{readFileSync as M1}from"node:fs";import{createInterface as B1}from"node:readline";var c={};Jt(c,{$brand:()=>Xl,$input:()=>yp,$output:()=>vp,NEVER:()=>Kl,TimePrecision:()=>wp,ZodAny:()=>pf,ZodArray:()=>hf,ZodBase64:()=>sc,ZodBase64URL:()=>cc,ZodBigInt:()=>po,ZodBigIntFormat:()=>dc,ZodBoolean:()=>uo,ZodCIDRv4:()=>ic,ZodCIDRv6:()=>ac,ZodCUID:()=>Ys,ZodCUID2:()=>Qs,ZodCatch:()=>zf,ZodCodec:()=>Pi,ZodCustom:()=>Ci,ZodCustomStringFormat:()=>co,ZodDate:()=>_i,ZodDefault:()=>Rf,ZodDiscriminatedUnion:()=>yf,ZodE164:()=>lc,ZodEmail:()=>qs,ZodEmoji:()=>Ks,ZodEnum:()=>ao,ZodError:()=>BC,ZodExactOptional:()=>Pf,ZodFile:()=>Af,ZodFirstPartyTypeKind:()=>Xf,ZodFunction:()=>Jf,ZodGUID:()=>bi,ZodIPv4:()=>rc,ZodIPv6:()=>oc,ZodISODate:()=>Hs,ZodISODateTime:()=>Bs,ZodISODuration:()=>Gs,ZodISOTime:()=>Zs,ZodIntersection:()=>bf,ZodIssueCode:()=>ZC,ZodJWT:()=>uc,ZodKSUID:()=>nc,ZodLazy:()=>Gf,ZodLiteral:()=>If,ZodMAC:()=>of,ZodMap:()=>_f,ZodNaN:()=>Ff,ZodNanoID:()=>Xs,ZodNever:()=>ff,ZodNonOptional:()=>vc,ZodNull:()=>uf,ZodNullable:()=>Tf,ZodNumber:()=>lo,ZodNumberFormat:()=>ir,ZodObject:()=>Ii,ZodOptional:()=>hc,ZodPipe:()=>Ei,ZodPrefault:()=>Df,ZodPreprocess:()=>Mf,ZodPromise:()=>Vf,ZodReadonly:()=>Bf,ZodRealError:()=>Xe,ZodRecord:()=>io,ZodSet:()=>$f,ZodString:()=>so,ZodStringFormat:()=>ce,ZodSuccess:()=>Uf,ZodSymbol:()=>cf,ZodTemplateLiteral:()=>Zf,ZodTransform:()=>Ef,ZodTuple:()=>kf,ZodType:()=>B,ZodULID:()=>ec,ZodURL:()=>Si,ZodUUID:()=>Ut,ZodUndefined:()=>lf,ZodUnion:()=>Ai,ZodUnknown:()=>mf,ZodVoid:()=>gf,ZodXID:()=>tc,ZodXor:()=>vf,_ZodString:()=>Js,_default:()=>Of,_function:()=>rk,any:()=>Dx,array:()=>$i,base64:()=>vx,base64url:()=>yx,bigint:()=>Px,boolean:()=>sf,catch:()=>jf,check:()=>ok,cidrv4:()=>gx,cidrv6:()=>hx,clone:()=>ze,codec:()=>Qx,coerce:()=>Yf,config:()=>ve,core:()=>rn,cuid:()=>sx,cuid2:()=>cx,custom:()=>ik,date:()=>Lx,decode:()=>Xm,decodeAsync:()=>Qm,describe:()=>ak,discriminatedUnion:()=>Bx,e164:()=>bx,email:()=>Xb,emoji:()=>ix,encode:()=>Km,encodeAsync:()=>Ym,endsWith:()=>qr,enum:()=>fc,exactOptional:()=>Cf,file:()=>qx,flattenError:()=>ii,float32:()=>$x,float64:()=>Ix,formatError:()=>ai,fromJSONSchema:()=>mk,function:()=>rk,getErrorMap:()=>WC,globalRegistry:()=>Ce,gt:()=>Nt,gte:()=>Fe,guid:()=>Yb,hash:()=>_x,hex:()=>Sx,hostname:()=>wx,httpUrl:()=>ox,includes:()=>Vr,instanceof:()=>ck,int:()=>Ws,int32:()=>Ax,int64:()=>Cx,intersection:()=>xf,invertCodec:()=>ek,ipv4:()=>px,ipv6:()=>fx,iso:()=>oo,json:()=>uk,jwt:()=>xx,keyof:()=>Ux,ksuid:()=>dx,lazy:()=>Wf,length:()=>rr,literal:()=>Jx,locales:()=>fi,looseObject:()=>Fx,looseRecord:()=>Zx,lowercase:()=>Gr,lt:()=>Dt,lte:()=>ot,mac:()=>mx,map:()=>Gx,maxLength:()=>nr,maxSize:()=>Ln,meta:()=>sk,mime:()=>Kr,minLength:()=>nn,minSize:()=>Lt,multipleOf:()=>Nn,nan:()=>Yx,nanoid:()=>ax,nativeEnum:()=>Vx,negative:()=>Rs,never:()=>pc,nonnegative:()=>Ds,nonoptional:()=>Lf,nonpositive:()=>Os,normalize:()=>Xr,null:()=>df,nullable:()=>ki,nullish:()=>Kx,number:()=>af,object:()=>zx,optional:()=>xi,overwrite:()=>St,parse:()=>Wm,parseAsync:()=>Vm,partialRecord:()=>Hx,pipe:()=>Vs,positive:()=>Ts,prefault:()=>Nf,preprocess:()=>dk,prettifyError:()=>uu,promise:()=>nk,property:()=>Ns,readonly:()=>Hf,record:()=>Sf,refine:()=>qf,regex:()=>Zr,regexes:()=>rt,registry:()=>us,safeDecode:()=>tf,safeDecodeAsync:()=>rf,safeEncode:()=>ef,safeEncodeAsync:()=>nf,safeParse:()=>Jm,safeParseAsync:()=>qm,set:()=>Wx,setErrorMap:()=>GC,size:()=>tr,slugify:()=>to,startsWith:()=>Jr,strictObject:()=>jx,string:()=>yi,stringFormat:()=>kx,stringbool:()=>lk,success:()=>Xx,superRefine:()=>Kf,symbol:()=>Rx,templateLiteral:()=>tk,toJSONSchema:()=>js,toLowerCase:()=>Qr,toUpperCase:()=>eo,transform:()=>gc,treeifyError:()=>lu,trim:()=>Yr,tuple:()=>wf,uint32:()=>Ex,uint64:()=>Tx,ulid:()=>lx,undefined:()=>Ox,union:()=>mc,unknown:()=>or,uppercase:()=>Wr,url:()=>rx,util:()=>$,uuid:()=>Qb,uuidv4:()=>ex,uuidv6:()=>tx,uuidv7:()=>nx,void:()=>Nx,xid:()=>ux,xor:()=>Mx});var rn={};Jt(rn,{$ZodAny:()=>jd,$ZodArray:()=>Zd,$ZodAsyncError:()=>wt,$ZodBase64:()=>Pd,$ZodBase64URL:()=>Cd,$ZodBigInt:()=>ns,$ZodBigIntFormat:()=>Nd,$ZodBoolean:()=>ui,$ZodCIDRv4:()=>Id,$ZodCIDRv6:()=>Ad,$ZodCUID:()=>fd,$ZodCUID2:()=>gd,$ZodCatch:()=>cp,$ZodCheck:()=>de,$ZodCheckBigIntFormat:()=>Zu,$ZodCheckEndsWith:()=>nd,$ZodCheckGreaterThan:()=>Ka,$ZodCheckIncludes:()=>ed,$ZodCheckLengthEquals:()=>Ku,$ZodCheckLessThan:()=>qa,$ZodCheckLowerCase:()=>Yu,$ZodCheckMaxLength:()=>Ju,$ZodCheckMaxSize:()=>Gu,$ZodCheckMimeType:()=>od,$ZodCheckMinLength:()=>qu,$ZodCheckMinSize:()=>Wu,$ZodCheckMultipleOf:()=>Bu,$ZodCheckNumberFormat:()=>Hu,$ZodCheckOverwrite:()=>id,$ZodCheckProperty:()=>rd,$ZodCheckRegex:()=>Xu,$ZodCheckSizeEquals:()=>Vu,$ZodCheckStartsWith:()=>td,$ZodCheckStringFormat:()=>Br,$ZodCheckUpperCase:()=>Qu,$ZodCodec:()=>pi,$ZodCustom:()=>hp,$ZodCustomStringFormat:()=>Od,$ZodDate:()=>Hd,$ZodDefault:()=>op,$ZodDiscriminatedUnion:()=>Vd,$ZodE164:()=>Td,$ZodEmail:()=>ud,$ZodEmoji:()=>pd,$ZodEncodeError:()=>Cn,$ZodEnum:()=>Yd,$ZodError:()=>oi,$ZodExactOptional:()=>np,$ZodFile:()=>ep,$ZodFunction:()=>mp,$ZodGUID:()=>cd,$ZodIPv4:()=>Sd,$ZodIPv6:()=>_d,$ZodISODate:()=>xd,$ZodISODateTime:()=>bd,$ZodISODuration:()=>wd,$ZodISOTime:()=>kd,$ZodIntersection:()=>Jd,$ZodJWT:()=>Rd,$ZodKSUID:()=>yd,$ZodLazy:()=>gp,$ZodLiteral:()=>Qd,$ZodMAC:()=>$d,$ZodMap:()=>Kd,$ZodNaN:()=>lp,$ZodNanoID:()=>md,$ZodNever:()=>Md,$ZodNonOptional:()=>ap,$ZodNull:()=>zd,$ZodNullable:()=>rp,$ZodNumber:()=>ts,$ZodNumberFormat:()=>Dd,$ZodObject:()=>Wy,$ZodObjectJIT:()=>Gd,$ZodOptional:()=>os,$ZodPipe:()=>is,$ZodPrefault:()=>ip,$ZodPreprocess:()=>up,$ZodPromise:()=>fp,$ZodReadonly:()=>dp,$ZodRealError:()=>Ke,$ZodRecord:()=>qd,$ZodRegistry:()=>ls,$ZodSet:()=>Xd,$ZodString:()=>er,$ZodStringFormat:()=>se,$ZodSuccess:()=>sp,$ZodSymbol:()=>Ld,$ZodTemplateLiteral:()=>pp,$ZodTransform:()=>tp,$ZodTuple:()=>rs,$ZodType:()=>F,$ZodULID:()=>hd,$ZodURL:()=>dd,$ZodUUID:()=>ld,$ZodUndefined:()=>Ud,$ZodUnion:()=>di,$ZodUnknown:()=>Fd,$ZodVoid:()=>Bd,$ZodXID:()=>vd,$ZodXor:()=>Wd,$brand:()=>Xl,$constructor:()=>v,$input:()=>yp,$output:()=>vp,Doc:()=>li,JSONSchema:()=>Jb,JSONSchemaGenerator:()=>Fs,NEVER:()=>Kl,TimePrecision:()=>wp,_any:()=>Hp,_array:()=>Kp,_base64:()=>As,_base64url:()=>Es,_bigint:()=>Lp,_boolean:()=>Dp,_catch:()=>DC,_check:()=>Vb,_cidrv4:()=>$s,_cidrv6:()=>Is,_coercedBigint:()=>Up,_coercedBoolean:()=>Np,_coercedDate:()=>Jp,_coercedNumber:()=>Ep,_coercedString:()=>xp,_cuid:()=>ys,_cuid2:()=>bs,_custom:()=>Yp,_date:()=>Vp,_decode:()=>Fa,_decodeAsync:()=>Ba,_default:()=>TC,_discriminatedUnion:()=>bC,_e164:()=>Ps,_email:()=>ds,_emoji:()=>hs,_encode:()=>ja,_encodeAsync:()=>Ma,_endsWith:()=>qr,_enum:()=>$C,_file:()=>Xp,_float32:()=>Cp,_float64:()=>Tp,_gt:()=>Nt,_gte:()=>Fe,_guid:()=>gi,_includes:()=>Vr,_int:()=>Pp,_int32:()=>Rp,_int64:()=>zp,_intersection:()=>xC,_ipv4:()=>Ss,_ipv6:()=>_s,_isoDate:()=>_p,_isoDateTime:()=>Sp,_isoDuration:()=>Ip,_isoTime:()=>$p,_jwt:()=>Cs,_ksuid:()=>ws,_lazy:()=>zC,_length:()=>rr,_literal:()=>AC,_lowercase:()=>Gr,_lt:()=>Dt,_lte:()=>ot,_mac:()=>kp,_map:()=>SC,_max:()=>ot,_maxLength:()=>nr,_maxSize:()=>Ln,_mime:()=>Kr,_min:()=>Fe,_minLength:()=>nn,_minSize:()=>Lt,_multipleOf:()=>Nn,_nan:()=>qp,_nanoid:()=>vs,_nativeEnum:()=>IC,_negative:()=>Rs,_never:()=>Gp,_nonnegative:()=>Ds,_nonoptional:()=>RC,_nonpositive:()=>Os,_normalize:()=>Xr,_null:()=>Bp,_nullable:()=>CC,_number:()=>Ap,_optional:()=>PC,_overwrite:()=>St,_parse:()=>zr,_parseAsync:()=>jr,_pipe:()=>NC,_positive:()=>Ts,_promise:()=>jC,_property:()=>Ns,_readonly:()=>LC,_record:()=>wC,_refine:()=>Qp,_regex:()=>Zr,_safeDecode:()=>Za,_safeDecodeAsync:()=>Wa,_safeEncode:()=>Ha,_safeEncodeAsync:()=>Ga,_safeParse:()=>Fr,_safeParseAsync:()=>Mr,_set:()=>_C,_size:()=>tr,_slugify:()=>to,_startsWith:()=>Jr,_string:()=>bp,_stringFormat:()=>no,_stringbool:()=>rm,_success:()=>OC,_superRefine:()=>em,_symbol:()=>Fp,_templateLiteral:()=>UC,_toLowerCase:()=>Qr,_toUpperCase:()=>eo,_transform:()=>EC,_trim:()=>Yr,_tuple:()=>kC,_uint32:()=>Op,_uint64:()=>jp,_ulid:()=>xs,_undefined:()=>Mp,_union:()=>vC,_unknown:()=>Zp,_uppercase:()=>Wr,_url:()=>hi,_uuid:()=>ps,_uuidv4:()=>ms,_uuidv6:()=>fs,_uuidv7:()=>gs,_void:()=>Wp,_xid:()=>ks,_xor:()=>yC,clone:()=>ze,config:()=>ve,createStandardJSONSchemaMethod:()=>ro,createToJSONSchemaMethod:()=>om,decode:()=>jE,decodeAsync:()=>ME,describe:()=>tm,encode:()=>zE,encodeAsync:()=>FE,extractDefs:()=>zn,finalize:()=>jn,flattenError:()=>ii,formatError:()=>ai,globalConfig:()=>Xn,globalRegistry:()=>Ce,initializeContext:()=>Un,isValidBase64:()=>Ed,isValidBase64URL:()=>By,isValidJWT:()=>Hy,locales:()=>fi,meta:()=>nm,parse:()=>Ua,parseAsync:()=>za,prettifyError:()=>uu,process:()=>oe,regexes:()=>rt,registry:()=>us,safeDecode:()=>HE,safeDecodeAsync:()=>GE,safeEncode:()=>BE,safeEncodeAsync:()=>ZE,safeParse:()=>du,safeParseAsync:()=>pu,toDotPath:()=>ky,toJSONSchema:()=>js,treeifyError:()=>lu,util:()=>$,version:()=>ad});var hy,Kl=Object.freeze({status:"aborted"});function v(e,t,r){function o(s,l){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,l);let u=a.prototype,d=Object.keys(u);for(let p=0;p<d.length;p++){let m=d[p];m in s||(s[m]=u[m].bind(s))}}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function a(s){var l;let u=r?.Parent?new i:this;o(u,s),(l=u._zod).deferred??(l.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var Xl=Symbol("zod_brand"),wt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Cn=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(hy=globalThis).__zod_globalConfig??(hy.__zod_globalConfig={});var Xn=globalThis.__zod_globalConfig;function ve(e){return e&&Object.assign(Xn,e),Xn}var $={};Jt($,{BIGINT_FORMAT_RANGES:()=>su,Class:()=>Ql,NUMBER_FORMAT_RANGES:()=>au,aborted:()=>Dn,allowsEval:()=>nu,assert:()=>hE,assertEqual:()=>pE,assertIs:()=>fE,assertNever:()=>gE,assertNotEqual:()=>mE,assignProp:()=>Rn,base64ToUint8Array:()=>yy,base64urlToUint8Array:()=>OE,cached:()=>Lr,captureStackTrace:()=>La,cleanEnum:()=>RE,cleanRegex:()=>ei,clone:()=>ze,cloneDef:()=>yE,createTransparentProxy:()=>_E,defineLazy:()=>V,esc:()=>Na,escapeRegex:()=>mt,explicitlyAborted:()=>cu,extend:()=>AE,finalizeIssue:()=>je,floatSafeRemainder:()=>eu,getElementAtPath:()=>bE,getEnumValues:()=>Qo,getLengthableOrigin:()=>ri,getParsedType:()=>SE,getSizableOrigin:()=>ni,hexToUint8Array:()=>NE,isObject:()=>Yn,isPlainObject:()=>On,issue:()=>Ur,joinValues:()=>x,jsonStringifyReplacer:()=>Nr,merge:()=>PE,mergeDefs:()=>tn,normalizeParams:()=>I,nullish:()=>Tn,numKeys:()=>wE,objectClone:()=>vE,omit:()=>IE,optionalKeys:()=>iu,parsedType:()=>S,partial:()=>CE,pick:()=>$E,prefixIssues:()=>qe,primitiveTypes:()=>ou,promiseAllObject:()=>xE,propertyKeyTypes:()=>ti,randomString:()=>kE,required:()=>TE,safeExtend:()=>EE,shallowClone:()=>ru,slugify:()=>tu,stringifyPrimitive:()=>w,uint8ArrayToBase64:()=>by,uint8ArrayToBase64url:()=>DE,uint8ArrayToHex:()=>LE,unwrapMessage:()=>Yo});function pE(e){return e}function mE(e){return e}function fE(e){}function gE(e){throw new Error("Unexpected value in exhaustive check")}function hE(e){}function Qo(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 x(e,t="|"){return e.map(r=>w(r)).join(t)}function Nr(e,t){return typeof t=="bigint"?t.toString():t}function Lr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Tn(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 eu(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 vy=Symbol("evaluating");function V(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==vy)return o===void 0&&(o=vy,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function vE(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Rn(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function tn(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function yE(e){return tn(e._zod.def)}function bE(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function xE(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 kE(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function Na(e){return JSON.stringify(e)}function tu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var La="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Yn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var nu=Lr(()=>{if(Xn.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function On(e){if(Yn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Yn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function ru(e){return On(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function wE(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var SE=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}`)}},ti=new Set(["string","number","symbol"]),ou=new Set(["string","number","bigint","boolean","symbol","undefined"]);function mt(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 I(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 _E(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 w(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function iu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var au={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]},su={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function $E(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=tn(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Rn(this,"shape",a),a},checks:[]});return ze(e,i)}function IE(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=tn(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Rn(this,"shape",a),a},checks:[]});return ze(e,i)}function AE(e,t){if(!On(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 a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=tn(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Rn(this,"shape",i),i}});return ze(e,n)}function EE(e,t){if(!On(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=tn(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Rn(this,"shape",o),o}});return ze(e,r)}function PE(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=tn(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Rn(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ze(e,r)}function CE(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 a=tn(t._zod.def,{get shape(){let s=t._zod.def.shape,l={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(l[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)l[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Rn(this,"shape",l),l},checks:[]});return ze(t,a)}function TE(e,t,r){let o=tn(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:n[a]}))}else for(let a in n)i[a]=new e({type:"nonoptional",innerType:n[a]});return Rn(this,"shape",i),i}});return ze(t,o)}function Dn(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 cu(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 qe(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Yo(e){return typeof e=="string"?e:e?.message}function je(e,t,r){let o=e.message?e.message:Yo(e.inst?._zod.def?.error?.(e))??Yo(t?.error?.(e))??Yo(r.customError?.(e))??Yo(r.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:a,...s}=e;return s.path??(s.path=[]),s.message=o,t?.reportInput&&(s.input=a),s}function ni(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ri(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function S(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 Ur(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function RE(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function yy(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 by(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function OE(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return yy(t+r)}function DE(e){return by(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function NE(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 LE(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ql=class{constructor(...t){}};var xy=(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,Nr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},oi=v("$ZodError",xy),Ke=v("$ZodError",xy,{Parent:Error});function ii(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 ai(e,t=r=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>o({issues:s},[...i,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...i,...a.path]);else{let s=[...i,...a.path];if(s.length===0)r._errors.push(t(a));else{let l=r,u=0;for(;u<s.length;){let d=s[u];u===s.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(t(a))):l[d]=l[d]||{_errors:[]},l=l[d],u++}}}};return o(e),r}function lu(e,t=r=>r.message){let r={errors:[]},o=(n,i=[])=>{var a,s;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={}),(a=d.properties)[m]??(a[m]={errors:[]}),d=d.properties[m]):(d.items??(d.items=[]),(s=d.items)[m]??(s[m]={errors:[]}),d=d.items[m]),f&&d.errors.push(t(l)),p++}}};return o(e),r}function ky(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 uu(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 ${ky(o.path)}`);return t.join(`
174
- `)}var zr=e=>(t,r,o,n)=>{let i=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new wt;if(a.issues.length){let s=new(n?.Err??e)(a.issues.map(l=>je(l,i,ve())));throw La(s,n?.callee),s}return a.value},Ua=zr(Ke),jr=e=>async(t,r,o,n)=>{let i=o?{...o,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(n?.Err??e)(a.issues.map(l=>je(l,i,ve())));throw La(s,n?.callee),s}return a.value},za=jr(Ke),Fr=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 wt;return i.issues.length?{success:!1,error:new(e??oi)(i.issues.map(a=>je(a,n,ve())))}:{success:!0,data:i.value}},du=Fr(Ke),Mr=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(a=>je(a,n,ve())))}:{success:!0,data:i.value}},pu=Mr(Ke),ja=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return zr(e)(t,r,n)},zE=ja(Ke),Fa=e=>(t,r,o)=>zr(e)(t,r,o),jE=Fa(Ke),Ma=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return jr(e)(t,r,n)},FE=Ma(Ke),Ba=e=>async(t,r,o)=>jr(e)(t,r,o),ME=Ba(Ke),Ha=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Fr(e)(t,r,n)},BE=Ha(Ke),Za=e=>(t,r,o)=>Fr(e)(t,r,o),HE=Za(Ke),Ga=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Mr(e)(t,r,n)},ZE=Ga(Ke),Wa=e=>async(t,r,o)=>Mr(e)(t,r,o),GE=Wa(Ke);var rt={};Jt(rt,{base64:()=>Eu,base64url:()=>Va,bigint:()=>Nu,boolean:()=>Uu,browserEmail:()=>QE,cidrv4:()=>Iu,cidrv6:()=>Au,cuid:()=>mu,cuid2:()=>fu,date:()=>Tu,datetime:()=>Ou,domain:()=>nP,duration:()=>bu,e164:()=>Cu,email:()=>ku,emoji:()=>wu,extendedDuration:()=>WE,guid:()=>xu,hex:()=>rP,hostname:()=>tP,html5Email:()=>KE,httpProtocol:()=>Pu,idnEmail:()=>YE,integer:()=>Lu,ipv4:()=>Su,ipv6:()=>_u,ksuid:()=>vu,lowercase:()=>Fu,mac:()=>$u,md5_base64:()=>iP,md5_base64url:()=>aP,md5_hex:()=>oP,nanoid:()=>yu,null:()=>zu,number:()=>Ja,rfc5322Email:()=>XE,sha1_base64:()=>cP,sha1_base64url:()=>lP,sha1_hex:()=>sP,sha256_base64:()=>dP,sha256_base64url:()=>pP,sha256_hex:()=>uP,sha384_base64:()=>fP,sha384_base64url:()=>gP,sha384_hex:()=>mP,sha512_base64:()=>vP,sha512_base64url:()=>yP,sha512_hex:()=>hP,string:()=>Du,time:()=>Ru,ulid:()=>gu,undefined:()=>ju,unicodeEmail:()=>wy,uppercase:()=>Mu,uuid:()=>Qn,uuid4:()=>VE,uuid6:()=>JE,uuid7:()=>qE,xid:()=>hu});var mu=/^[cC][0-9a-z]{6,}$/,fu=/^[0-9a-z]+$/,gu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hu=/^[0-9a-vA-V]{20}$/,vu=/^[A-Za-z0-9]{27}$/,yu=/^[a-zA-Z0-9_-]{21}$/,bu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,WE=/^[-+]?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)?)??$/,xu=/^([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})$/,Qn=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)$/,VE=Qn(4),JE=Qn(6),qE=Qn(7),ku=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,KE=/^[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])?)*$/,XE=/^(([^<>()\[\]\\.,;:\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,}))$/,wy=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,YE=wy,QE=/^[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])?)*$/,eP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function wu(){return new RegExp(eP,"u")}var Su=/^(?:(?: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])$/,_u=/^(([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}|:))$/,$u=e=>{let t=mt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Iu=/^((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])$/,Au=/^(([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])$/,Eu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Va=/^[A-Za-z0-9_-]*$/,tP=/^(?=.{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])?)*\.?$/,nP=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Pu=/^https?$/,Cu=/^\+[1-9]\d{6,14}$/,Sy="(?:(?:\\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])))",Tu=new RegExp(`^${Sy}$`);function _y(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 Ru(e){return new RegExp(`^${_y(e)}$`)}function Ou(e){let t=_y({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(`^${Sy}T(?:${o})$`)}var Du=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Nu=/^-?\d+n?$/,Lu=/^-?\d+$/,Ja=/^-?\d+(?:\.\d+)?$/,Uu=/^(?:true|false)$/i,zu=/^null$/i;var ju=/^undefined$/i;var Fu=/^[^A-Z]*$/,Mu=/^[^a-z]*$/,rP=/^[0-9a-fA-F]*$/;function si(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function ci(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var oP=/^[0-9a-fA-F]{32}$/,iP=si(22,"=="),aP=ci(22),sP=/^[0-9a-fA-F]{40}$/,cP=si(27,"="),lP=ci(27),uP=/^[0-9a-fA-F]{64}$/,dP=si(43,"="),pP=ci(43),mP=/^[0-9a-fA-F]{96}$/,fP=si(64,""),gP=ci(64),hP=/^[0-9a-fA-F]{128}$/,vP=si(86,"=="),yP=ci(86);var de=v("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Iy={number:"number",bigint:"bigint",object:"date"},qa=v("$ZodCheckLessThan",(e,t)=>{de.init(e,t);let r=Iy[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})}}),Ka=v("$ZodCheckGreaterThan",(e,t)=>{de.init(e,t);let r=Iy[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})}}),Bu=v("$ZodCheckMultipleOf",(e,t)=>{de.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):eu(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})}}),Hu=v("$ZodCheckNumberFormat",(e,t)=>{de.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=au[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=n,s.maximum=i,r&&(s.pattern=Lu)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,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}):a.issues.push({input:s,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}}s<n&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Zu=v("$ZodCheckBigIntFormat",(e,t)=>{de.init(e,t);let[r,o]=su[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})}}),Gu=v("$ZodCheckMaxSize",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tn(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:ni(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Wu=v("$ZodCheckMinSize",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tn(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:ni(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Vu=v("$ZodCheckSizeEquals",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tn(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 a=i>t.size;o.issues.push({origin:ni(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Ju=v("$ZodCheckMaxLength",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tn(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 a=ri(n);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),qu=v("$ZodCheckMinLength",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tn(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 a=ri(n);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ku=v("$ZodCheckLengthEquals",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Tn(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 a=ri(n),s=i>t.length;o.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Br=v("$ZodCheckStringFormat",(e,t)=>{var r,o;de.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=()=>{})}),Xu=v("$ZodCheckRegex",(e,t)=>{Br.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})}}),Yu=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Fu),Br.init(e,t)}),Qu=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Mu),Br.init(e,t)}),ed=v("$ZodCheckIncludes",(e,t)=>{de.init(e,t);let r=mt(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})}}),td=v("$ZodCheckStartsWith",(e,t)=>{de.init(e,t);let r=new RegExp(`^${mt(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})}}),nd=v("$ZodCheckEndsWith",(e,t)=>{de.init(e,t);let r=new RegExp(`.*${mt(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 $y(e,t,r){e.issues.length&&t.issues.push(...qe(r,e.issues))}var rd=v("$ZodCheckProperty",(e,t)=>{de.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=>$y(n,r,t.property));$y(o,r,t.property)}}),od=v("$ZodCheckMimeType",(e,t)=>{de.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})}}),id=v("$ZodCheckOverwrite",(e,t)=>{de.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(a=>a),n=Math.min(...o.map(a=>a.length-a.trimStart().length)),i=o.map(a=>a.slice(n)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,n.join(`
176
- `))}};var ad={major:4,minor:4,patch:3};var F=v("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ad;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=(a,s,l)=>{let u=Dn(a),d;for(let p of s){if(p._zod.def.when){if(cu(a)||!p._zod.def.when(a))continue}else if(u)continue;let m=a.issues.length,f=p._zod.check(a);if(f instanceof Promise&&l?.async===!1)throw new wt;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,a.issues.length!==m&&(u||(u=Dn(a,m)))});else{if(a.issues.length===m)continue;u||(u=Dn(a,m))}}return d?d.then(()=>a):a},i=(a,s,l)=>{if(Dn(a))return a.aborted=!0,a;let u=n(s,o,l);if(u instanceof Promise){if(l.async===!1)throw new wt;return u.then(d=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(d=>i(d,a,s)):i(u,a,s)}let l=e._zod.parse(a,s);if(l instanceof Promise){if(s.async===!1)throw new wt;return l.then(u=>n(u,o,s))}return n(l,o,s)}}V(e,"~standard",()=>({validate:n=>{try{let i=du(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return pu(e,n).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),er=v("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Du(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}}),se=v("$ZodStringFormat",(e,t)=>{Br.init(e,t),er.init(e,t)}),cd=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=xu),se.init(e,t)}),ld=v("$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=Qn(o))}else t.pattern??(t.pattern=Qn());se.init(e,t)}),ud=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ku),se.init(e,t)}),dd=v("$ZodURL",(e,t)=>{se.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===Pu.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})}}}),pd=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=wu()),se.init(e,t)}),md=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=yu),se.init(e,t)}),fd=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mu),se.init(e,t)}),gd=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=fu),se.init(e,t)}),hd=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=gu),se.init(e,t)}),vd=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=hu),se.init(e,t)}),yd=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=vu),se.init(e,t)}),bd=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ou(t)),se.init(e,t)}),xd=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Tu),se.init(e,t)}),kd=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ru(t)),se.init(e,t)}),wd=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=bu),se.init(e,t)}),Sd=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Su),se.init(e,t),e._zod.bag.format="ipv4"}),_d=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=_u),se.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})}}}),$d=v("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=$u(t.delimiter)),se.init(e,t),e._zod.bag.format="mac"}),Id=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Iu),se.init(e,t)}),Ad=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Au),se.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 a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>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 Ed(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Pd=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Eu),se.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Ed(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function By(e){if(!Va.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ed(r)}var Cd=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Va),se.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{By(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Td=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Cu),se.init(e,t)});function Hy(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 Rd=v("$ZodJWT",(e,t)=>{se.init(e,t),e._zod.check=r=>{Hy(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Od=v("$ZodCustomStringFormat",(e,t)=>{se.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})}}),ts=v("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ja,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}}),Dd=v("$ZodNumberFormat",(e,t)=>{Hu.init(e,t),ts.init(e,t)}),ui=v("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=Uu,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}}),ns=v("$ZodBigInt",(e,t)=>{F.init(e,t),e._zod.pattern=Nu,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}}),Nd=v("$ZodBigIntFormat",(e,t)=>{Zu.init(e,t),ns.init(e,t)}),Ld=v("$ZodSymbol",(e,t)=>{F.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}}),Ud=v("$ZodUndefined",(e,t)=>{F.init(e,t),e._zod.pattern=ju,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}}),zd=v("$ZodNull",(e,t)=>{F.init(e,t),e._zod.pattern=zu,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}}),jd=v("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Fd=v("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Md=v("$ZodNever",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Bd=v("$ZodVoid",(e,t)=>{F.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}}),Hd=v("$ZodDate",(e,t)=>{F.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 Ey(e,t,r){e.issues.length&&t.issues.push(...qe(r,e.issues)),t.value[r]=e.value}var Zd=v("$ZodArray",(e,t)=>{F.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 a=0;a<n.length;a++){let s=n[a],l=t.element._zod.run({value:s,issues:[]},o);l instanceof Promise?i.push(l.then(u=>Ey(u,r,a))):Ey(l,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function es(e,t,r,o,n,i){let a=r in o;if(e.issues.length){if(n&&i&&!a)return;t.issues.push(...qe(r,e.issues))}if(!a&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?a&&(t.value[r]=void 0):t.value[r]=e.value}function Zy(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=iu(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Gy(e,t,r,o,n,i){let a=[],s=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__"||s.has(m))continue;if(u==="never"){a.push(m);continue}let f=l.run({value:t[m],issues:[]},o);f instanceof Promise?e.push(f.then(g=>es(g,r,m,t,d,p))):es(f,r,m,t,d,p)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var Wy=v("$ZodObject",(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...s};return Object.defineProperty(t,"shape",{value:l}),l}})}let o=Lr(()=>Zy(t));V(e._zod,"propValues",()=>{let s=t.shape,l={};for(let u in s){let d=s[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=Yn,i=t.catchall,a;e._zod.parse=(s,l)=>{a??(a=o.value);let u=s.value;if(!n(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let d=[],p=a.shape;for(let m of a.keys){let f=p[m],g=f._zod.optin==="optional",y=f._zod.optout==="optional",k=f._zod.run({value:u[m],issues:[]},l);k instanceof Promise?d.push(k.then(_=>es(_,s,m,u,g,y))):es(k,s,m,u,g,y)}return i?Gy(d,u,s,l,o.value,e):d.length?Promise.all(d).then(()=>s):s}}),Gd=v("$ZodObjectJIT",(e,t)=>{Wy.init(e,t);let r=e._zod.parse,o=Lr(()=>Zy(t)),n=m=>{let f=new li(["shape","payload","ctx"]),g=o.value,y=C=>{let E=Na(C);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};f.write("const input = payload.value;");let k=Object.create(null),_=0;for(let C of g.keys)k[C]=`key_${_++}`;f.write("const newResult = {};");for(let C of g.keys){let E=k[C],D=Na(C),G=m[C],ae=G?._zod?.optin==="optional",X=G?._zod?.optout==="optional";f.write(`const ${E} = ${y(C)};`),ae&&X?f.write(`
177
- if (${E}.issues.length) {
178
- if (${D} in input) {
179
- payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
169
+ </div></body></html>`}import{spawn as Ru}from"node:child_process";function dP(e,t=Ru){return new Promise(r=>{let o=!1,n=a=>{o||(o=!0,r(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{}n(!1)},8e3);s.unref?.(),i.on("error",()=>{clearTimeout(s),n(!1)}),i.on("exit",a=>{clearTimeout(s),n(a===0)}),i.stdin?.on("error",()=>{}),i.stdin?.end(`${e}
170
+ `)})}function pP(e,t=Ru){return new Promise(r=>{let o=t("cmd.exe",["/c","start","",e.replace(/&/g,"^&")],{detached:!0,stdio:"ignore"});o.on("error",()=>r(!1)),o.on("spawn",()=>{o.unref(),r(!0)})})}var mP=1200;function Zy(e,t,r,o){return new Promise(n=>{let i=!1,s=u=>{i||(i=!0,n(u))},a=r(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 eo(e,t){let r=t.platform??process.platform,o=t.spawnImpl??Ru;if(r==="win32"||t.isWsl)return await dP(e,o)?!0:pP(e,o);let n=t.graceMs??mP;return Zy(r==="darwin"?"open":"xdg-open",e,o,n)}function ra(){return Pv().length>0}function fP(){pi()}async function Gy(e,t,r){let o=(e??"").replace(/\/+$/,""),n=r?.fetchImpl??fetch;if(o&&t)try{await n(`${o}/node/revoke`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${t}`},body:"{}",signal:AbortSignal.timeout(3e3)})}catch{}(r?.clear??fP)()}var gP=4,hP=1500,vP=e=>new Promise(t=>setTimeout(t,e)),xi=null;function Wy(e,t,r={}){if((r.hasCredential??ra)())return Promise.resolve(!0);if(xi)return xi;let n=r.attempts??gP,i=r.retryMs??hP,s=r.provision??Iv,a=r.claim??Ev,l=r.store??mu,u=r.log??(d=>console.error(d));return xi=(async()=>{let d="no attempt made";try{for(let m=1;m<=n;m++){m>1&&await vP(i);let p=t();if(!p){d="no sign-in token available yet";continue}try{let f=await s(e,p),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 ${n} attempts (hub will fall back to the app-refreshed token): ${d}`),!1}finally{xi=null}})(),xi}async function Vy(e){let t=Dy(),r=Ny(),o=e.chooser?Hy(By({cfg:e.cfg,state:r,codeChallenge:t.challenge,...e.opts.email?{email:e.opts.email}:{},...e.opts.screenHint?{screenHint:e.opts.screenHint}:{}})):void 0,i=(e.listen??((d,m,p,f,g)=>zy(d,m,p,f,void 0,void 0,g)))(e.cfg.port,r,e.signal,e.timeoutMs??18e4,o),s=e.openUrl??(d=>eo(d,{isWsl:!1})),a;o?(i.result.catch(()=>{}),a=`http://127.0.0.1:${await i.port}/`):a=ta({cfg:e.cfg,opts:e.opts,state:r,codeChallenge:t.challenge}),await s(a)||e.onBrowserFail?.(a);let{code:l}=await i.result;return(e.exchange??((d,m,p)=>Uy(d,m,p)))(e.cfg,l,t.verifier)}import Ye from"node:path";function Ce(e={}){let t=N(e.file??ui);if(!t)return null;try{let r=JSON.parse(t);return typeof r.sub!="string"||!r.sub?null:{sub:r.sub,...typeof r.email=="string"?{email:r.email}:{},updatedAt:typeof r.updatedAt=="number"?r.updatedAt:0}}catch{return null}}function dr(e,t={}){let r={sub:e.sub,...e.email?{email:e.email}:{},updatedAt:Date.now()};ke(t.file??ui,`${JSON.stringify(r,null,2)}
171
+ `,384)}function qy(e={}){ve(e.file??ui)}function bP(){let e=Ce()?.sub;if(!e)return null;let t=xt(mt(e)),r=N(t.refreshFile),o=r?Ke(r):null;if(o)return o;let n=N(t.accessFile);return n?Ke(n):null}function gt(e={}){let t=e.readActiveUser??(()=>Ce()),r=e.readCredentialSub??bP,o=e.log??(a=>console.warn(a)),n=t()?.sub??null,i=r();if(!n||!i)return null;if(n!==i)return o(`user-scope: active-user pointer sub (${n}) does not match the credential sub (${i}) \u2014 refusing to resolve a scope (stale-pointer guard)`),null;let s=mt(n);return{sub:n,segment:s,dir:Ls(s)}}function wi(e){let t=e.dir;return{dir:t,providerSecretFile(r,o){return ki("provider",r),ki("secret name",o),Ye.join(t,"providers",r,`${o}.json`)},providerAccountsFile(r){return ki("provider",r),Ye.join(t,"providers",r,"accounts.json")},localConfigFile:Ye.join(t,"local-config.json"),localDiscoveredFile:Ye.join(t,"local-discovered.json"),entitlementFile:Ye.join(t,"entitlement.json"),revertSessionFile:Ye.join(t,"revert-session.json"),telemetrySpoolDir:Ye.join(t,"telemetry","spool"),userConfigFile:Ye.join(t,"config.json"),relayAccessFile:Ye.join(t,"relay-access-token"),relayRefreshFile:Ye.join(t,"relay-refresh-token"),hubTokenFile:Ye.join(t,"hub-token"),workspaceFile:Ye.join(t,"workspace.json")}}function Ou(e,t){if((t?.layout??on())>=sn){let o=(t?.resolveScope??(()=>gt()))();if(o)return Ye.join(e,"users",o.segment,"hub-token")}return Ye.join(e,"hub-token")}import{existsSync as xP,mkdirSync as Ky,renameSync as Du}from"node:fs";import Be from"node:path";var kP="layout-version.json",Xy=3,wP=["providers","local-config.json","local-discovered.json","entitlement.json","revert-session.json","telemetry"];function Yy(e={}){let t=e.secretDir??Q,r=e.now??(()=>new Date),o=Be.join(t,kP);if(AP(o))return{archived:[],skipped:!0,credentialRelocated:null,credentialArchived:!1};let n=Be.join(t,`legacy-${EP(r())}`),i=!1,s=()=>(i||(Ky(n,{recursive:!0,mode:448}),i=!0),n),a=wP.filter(m=>xP(Be.join(t,m))),l=[];for(let m of a)try{s(),Du(Be.join(t,m),Be.join(n,m)),l.push(m)}catch(p){if(p.code==="ENOENT")continue;console.warn(`archiveLegacyUserState: failed to archive "${m}": ${p.message}`)}let u=l.length===a.length;ve(Be.join(t,"hub-token"));let d=u?IP(t,s):{relocated:null,archived:!1,ok:!0};return u&&d.ok&&(Qs({onboardedAt:null},{configFile:Be.join(t,"config.json")}),PP(o,r)),{archived:l,skipped:!1,credentialRelocated:d.relocated,credentialArchived:d.archived}}function SP(e){return{accessFile:Be.join(e,"relay-access-token"),refreshFile:Be.join(e,"relay-refresh-token")}}function _P(e,t){let r=Be.join(e,"users",t);return{accessFile:Be.join(r,"relay-access-token"),refreshFile:Be.join(r,"relay-refresh-token")}}function Jy(e,t){try{return Ky(Be.dirname(t),{recursive:!0,mode:448}),Du(e,t),"moved"}catch(r){return r.code==="ENOENT"?"absent":(console.warn(`archiveLegacyUserState: failed to relocate credential to "${t}": ${r.message}`),"failed")}}function oa(e,t,r){try{let o=e();return Du(t,Be.join(o,r)),"moved"}catch(o){return o.code==="ENOENT"?"absent":(console.warn(`archiveLegacyUserState: failed to archive credential "${r}": ${o.message}`),"failed")}}function $P(e,t){let r=Be.join(e,"active-user.json");if(Ce({file:r})===null)try{dr({sub:t},{file:r})}catch(o){console.warn(`archiveLegacyUserState: failed to heal the active-user pointer to "${t}": ${o.message}`)}}function IP(e,t){let r=SP(e),o=N(r.refreshFile),n=N(r.accessFile);if(!o&&!n)return{relocated:null,archived:!1,ok:!0};let i=o?Ke(o):null,s=n?Ke(n):null,a=i??s;if(!a){let p=o?oa(t,r.refreshFile,"relay-refresh-token"):"absent",f=n?oa(t,r.accessFile,"relay-access-token"):"absent";return{relocated:null,archived:p==="moved"||f==="moved",ok:p!=="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=mt(a),u=_P(e,l),d=!0,m=!1;if(o){let p=i===a?Jy(r.refreshFile,u.refreshFile):oa(t,r.refreshFile,"relay-refresh-token");p==="failed"?d=!1:p==="moved"&&i!==a&&(m=!0)}if(n){let p=s===a?Jy(r.accessFile,u.accessFile):oa(t,r.accessFile,"relay-access-token");p==="failed"?d=!1:p==="moved"&&s!==a&&(m=!0)}return d&&$P(e,a),{relocated:{sub:a,segment:l},archived:m,ok:d}}function EP(e){return e.toISOString().replace(/[:.]/g,"-")}function AP(e){let t=N(e);if(!t)return!1;try{let r=JSON.parse(t);return typeof r.version=="number"&&r.version>=Xy}catch{return!1}}function PP(e,t){let r={version:Xy,migratedAt:t().toISOString()};ke(e,`${JSON.stringify(r,null,2)}
172
+ `,384)}var NP=He.join(Q,"hub-token"),CF=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"),TF=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"),yP=He.join(Q,"app-path"),nb=He.join(Q,"hub-relay-status.json"),RF=He.join(Q,"hub-holders.json"),rb=He.join(Q,"sessions"),Nu=e=>He.join(rb,`${e}.json`);function ke(e,t,r=384){let o=He.dirname(e),n=(r&63)===0;if(TP(o,{recursive:!0,...n?{mode:448}:{}}),n)try{Qy(o,448)}catch{}let i=`${e}.tmp-${process.pid}-${process.hrtime.bigint()}`;tb(i,t,{mode:r});try{OP(i,e)}catch(s){try{eb(i,{force:!0})}catch{}throw s}}function N(e){try{return RP(e,"utf8").trim()||null}catch{return null}}function ob(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||DP.hostname().split(".")[0]||"node"}function ib(){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{tb(e,"",{mode:384}),Qy(e,384)}catch{}}function ve(e){try{eb(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}_${CP("sha256").update(t).digest("hex").slice(0,12)}`}import{readFileSync as zP}from"node:fs";import{existsSync as LP}from"node:fs";import cn from"node:path";import{fileURLToPath as UP}from"node:url";function jP(e){let t=process.env.BRIDGE_PKG_ROOT;if(t&&t.trim())return t.trim();let r=o=>LP(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=jP(cn.dirname(UP(import.meta.url))),to=cn.join(ln,"plugin"),_i=cn.join(ln,"hub","dist","hub.cjs"),sb=cn.join(ln,"hub","src","index.ts"),la=cn.join(ln,"node_modules",".bin","tsx");var FP="https://relay.ac-bridge.com",MP=8790;function de(){let e={};try{e=JSON.parse(zP(Ae,"utf8"))}catch{}return{relayUrl:process.env.BRIDGE_RELAY_URL||e.relayUrl||FP,hubPort:Number(process.env.BRIDGE_HUB_PORT||e.hubPort||MP),machine:sa()}}async function ab(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 cb(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 lb(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 ub(e,t){try{let r=await ab("/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 BP=256*1024;async function db(e,t,r,o=fetch){let{relayUrl:n}=de(),i=JSON.stringify({version:t,config:r});if(Buffer.byteLength(i)>BP)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 pb(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 mb(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 fb(e){let t=N(we().accessFile)?.trim();if(!t)return{ok:!1,error:"Not signed in. Run `acbridge login` first."};try{let r=await ab(`/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 HP=!!process.stdout.isTTY&&!process.env.NO_COLOR,da=e=>t=>HP?`\x1B[${e}m${t}\x1B[0m`:t,ZP=da("32"),GP=da("33"),WP=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(`${ZP("\u2714")} ${e}`),F=e=>pa(`${GP("\u26A0")} ${e}`),x=e=>console.error(`${WP("\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=F){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 gb(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=gb(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 gb(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 VP(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 qP=()=>_t({notSignedIn:{message:"Not signed in. Run `acbridge login` first.",exitCode:3}});async function hb(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??qP)();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 m=(t.entitlementFileRaw??JP)();if(!m)return v("local entitlement file: absent (capture fail-closed until the hub next syncs)"),0;try{let p=JSON.parse(m),f=(Date.now()-(p.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=VP(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??mb)(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 JP(){let e=Oe();return e?N(e.entitlementFile):null}import{readFileSync as _O}from"node:fs";import{createInterface as $O}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:()=>I1,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:()=>A1,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:()=>ow,any:()=>Nk,array:()=>Yi,base64:()=>yk,base64url:()=>bk,bigint:()=>Ck,boolean:()=>Jf,catch:()=>Eg,check:()=>iw,cidrv4:()=>hk,cidrv6:()=>vk,clone:()=>Ze,codec:()=>ew,coerce:()=>Fg,config:()=>$e,core:()=>pn,cuid:()=>ck,cuid2:()=>lk,custom:()=>sw,date:()=>Uk,decode:()=>Ff,decodeAsync:()=>Bf,describe:()=>aw,discriminatedUnion:()=>Hk,e164:()=>xk,email:()=>Yx,emoji:()=>sk,encode:()=>zf,encodeAsync:()=>Mf,endsWith:()=>bo,enum:()=>Vc,exactOptional:()=>yg,file:()=>Kk,flattenError:()=>Ri,float32:()=>Ik,float64:()=>Ek,formatError:()=>Oi,fromJSONSchema:()=>fw,function:()=>ow,getErrorMap:()=>C1,globalRegistry:()=>De,gt:()=>Bt,gte:()=>We,guid:()=>Qx,hash:()=>$k,hex:()=>_k,hostname:()=>Sk,httpUrl:()=>ik,includes:()=>vo,instanceof:()=>lw,int:()=>$c,int32:()=>Ak,int64:()=>Tk,intersection:()=>cg,invertCodec:()=>tw,ipv4:()=>mk,ipv6:()=>gk,iso:()=>Ao,json:()=>dw,jwt:()=>kk,keyof:()=>jk,ksuid:()=>pk,lazy:()=>Dg,length:()=>br,literal:()=>Jk,locales:()=>Mi,looseObject:()=>Mk,looseRecord:()=>Gk,lowercase:()=>go,lt:()=>Mt,lte:()=>st,mac:()=>fk,map:()=>Wk,maxLength:()=>yr,maxSize:()=>Zn,meta:()=>cw,mime:()=>xo,minLength:()=>dn,minSize:()=>Ht,multipleOf:()=>Hn,nan:()=>Qk,nanoid:()=>ak,nativeEnum:()=>qk,negative:()=>dc,never:()=>Gc,nonnegative:()=>mc,nonoptional:()=>_g,nonpositive:()=>pc,normalize:()=>ko,null:()=>Qf,nullable:()=>qi,nullish:()=>Xk,number:()=>qf,object:()=>zk,optional:()=>Vi,overwrite:()=>It,parse:()=>Nf,parseAsync:()=>Lf,partialRecord:()=>Zk,pipe:()=>Ic,positive:()=>uc,prefault:()=>Sg,preprocess:()=>pw,prettifyError:()=>Yu,promise:()=>rw,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:()=>Vk,setErrorMap:()=>P1,size:()=>vr,slugify:()=>$o,startsWith:()=>yo,strictObject:()=>Fk,string:()=>Gi,stringFormat:()=>wk,stringbool:()=>uw,success:()=>Yk,superRefine:()=>jg,symbol:()=>Ok,templateLiteral:()=>nw,toJSONSchema:()=>yc,toLowerCase:()=>So,toUpperCase:()=>_o,transform:()=>qc,treeifyError:()=>Xu,trim:()=>wo,tuple:()=>ug,uint32:()=>Pk,uint64:()=>Rk,ulid:()=>uk,undefined:()=>Dk,union:()=>Wc,unknown:()=>xr,uppercase:()=>ho,url:()=>ok,util:()=>C,uuid:()=>ek,uuidv4:()=>tk,uuidv6:()=>nk,uuidv7:()=>rk,void:()=>Lk,xid:()=>dk,xor:()=>Bk});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:()=>Vb,$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:()=>Jx,JSONSchemaGenerator:()=>bc,NEVER:()=>ju,TimePrecision:()=>um,_any:()=>Tm,_array:()=>jm,_base64:()=>sc,_base64url:()=>ac,_bigint:()=>_m,_boolean:()=>wm,_catch:()=>y1,_check:()=>qx,_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:()=>g1,_discriminatedUnion:()=>r1,_e164:()=>cc,_email:()=>Za,_emoji:()=>Ja,_encode:()=>ya,_encodeAsync:()=>xa,_endsWith:()=>bo,_enum:()=>l1,_file:()=>zm,_float32:()=>ym,_float64:()=>bm,_gt:()=>Bt,_gte:()=>We,_guid:()=>Bi,_includes:()=>vo,_int:()=>vm,_int32:()=>xm,_int64:()=>Im,_intersection:()=>o1,_ipv4:()=>nc,_ipv6:()=>rc,_isoDate:()=>pm,_isoDateTime:()=>dm,_isoDuration:()=>fm,_isoTime:()=>mm,_jwt:()=>lc,_ksuid:()=>tc,_lazy:()=>w1,_length:()=>br,_literal:()=>d1,_lowercase:()=>go,_lt:()=>Mt,_lte:()=>st,_mac:()=>lm,_map:()=>a1,_max:()=>st,_maxLength:()=>yr,_maxSize:()=>Zn,_mime:()=>xo,_min:()=>We,_minLength:()=>dn,_minSize:()=>Ht,_multipleOf:()=>Hn,_nan:()=>Um,_nanoid:()=>Ka,_nativeEnum:()=>u1,_negative:()=>dc,_never:()=>Om,_nonnegative:()=>mc,_nonoptional:()=>h1,_nonpositive:()=>pc,_normalize:()=>ko,_null:()=>Cm,_nullable:()=>f1,_number:()=>gm,_optional:()=>m1,_overwrite:()=>It,_parse:()=>ao,_parseAsync:()=>co,_pipe:()=>b1,_positive:()=>uc,_promise:()=>S1,_property:()=>fc,_readonly:()=>x1,_record:()=>s1,_refine:()=>Mm,_regex:()=>fo,_safeDecode:()=>Sa,_safeDecodeAsync:()=>$a,_safeEncode:()=>wa,_safeEncodeAsync:()=>_a,_safeParse:()=>lo,_safeParseAsync:()=>uo,_set:()=>c1,_size:()=>vr,_slugify:()=>$o,_startsWith:()=>yo,_string:()=>am,_stringFormat:()=>Io,_stringbool:()=>Gm,_success:()=>v1,_superRefine:()=>Bm,_symbol:()=>Am,_templateLiteral:()=>k1,_toLowerCase:()=>So,_toUpperCase:()=>_o,_transform:()=>p1,_trim:()=>wo,_tuple:()=>i1,_uint32:()=>km,_uint64:()=>Em,_ulid:()=>Qa,_undefined:()=>Pm,_union:()=>t1,_unknown:()=>Rm,_uppercase:()=>ho,_url:()=>Hi,_uuid:()=>Ga,_uuidv4:()=>Wa,_uuidv6:()=>Va,_uuidv7:()=>qa,_void:()=>Dm,_xid:()=>ec,_xor:()=>n1,clone:()=>Ze,config:()=>$e,createStandardJSONSchemaMethod:()=>Eo,createToJSONSchemaMethod:()=>Wm,decode:()=>SC,decodeAsync:()=>$C,describe:()=>Hm,encode:()=>wC,encodeAsync:()=>_C,extractDefs:()=>Wn,finalize:()=>Vn,flattenError:()=>Ri,formatError:()=>Oi,globalConfig:()=>mr,globalRegistry:()=>De,initializeContext:()=>Gn,isValidBase64:()=>hp,isValidBase64URL:()=>Hb,isValidJWT:()=>Zb,locales:()=>Mi,meta:()=>Zm,parse:()=>ha,parseAsync:()=>va,prettifyError:()=>Yu,process:()=>pe,regexes:()=>it,registry:()=>Ha,safeDecode:()=>EC,safeDecodeAsync:()=>PC,safeEncode:()=>IC,safeEncodeAsync:()=>AC,safeParse:()=>Qu,safeParseAsync:()=>ed,toDotPath:()=>wb,toJSONSchema:()=>yc,treeifyError:()=>Xu,util:()=>C,version:()=>qd});var vb,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 m=0;m<d.length;m++){let p=d[m];p in a||(a[p]=u[p].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"}};(vb=globalThis).__zod_globalConfig??(vb.__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:()=>eC,assertEqual:()=>KP,assertIs:()=>YP,assertNever:()=>QP,assertNotEqual:()=>XP,assignProp:()=>Fn,base64ToUint8Array:()=>bb,base64urlToUint8Array:()=>vC,cached:()=>io,captureStackTrace:()=>ga,cleanEnum:()=>hC,cleanRegex:()=>Ei,clone:()=>Ze,cloneDef:()=>nC,createTransparentProxy:()=>cC,defineLazy:()=>ne,esc:()=>fa,escapeRegex:()=>ht,explicitlyAborted:()=>Ku,extend:()=>dC,finalizeIssue:()=>Ge,floatSafeRemainder:()=>Bu,getElementAtPath:()=>rC,getEnumValues:()=>Ii,getLengthableOrigin:()=>Ci,getParsedType:()=>aC,getSizableOrigin:()=>Pi,hexToUint8Array:()=>bC,isObject:()=>fr,isPlainObject:()=>Mn,issue:()=>so,joinValues:()=>k,jsonStringifyReplacer:()=>oo,merge:()=>mC,mergeDefs:()=>un,normalizeParams:()=>R,nullish:()=>zn,numKeys:()=>sC,objectClone:()=>tC,omit:()=>uC,optionalKeys:()=>Vu,parsedType:()=>P,partial:()=>fC,pick:()=>lC,prefixIssues:()=>et,primitiveTypes:()=>Wu,promiseAllObject:()=>oC,propertyKeyTypes:()=>Ai,randomString:()=>iC,required:()=>gC,safeExtend:()=>pC,shallowClone:()=>Gu,slugify:()=>Hu,stringifyPrimitive:()=>A,uint8ArrayToBase64:()=>xb,uint8ArrayToBase64url:()=>yC,uint8ArrayToHex:()=>xC,unwrapMessage:()=>$i});function KP(e){return e}function XP(e){return e}function YP(e){}function QP(e){throw new Error("Unexpected value in exhaustive check")}function eC(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 k(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 yb=Symbol("evaluating");function ne(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==yb)return o===void 0&&(o=yb,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function tC(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 nC(e){return un(e._zod.def)}function rC(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function oC(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 iC(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 sC(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var aC=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 cC(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 lC(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 uC(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 dC(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 pC(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 mC(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 fC(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 gC(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 hC(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function bb(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 xb(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function vC(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return bb(t+r)}function yC(e){return xb(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function bC(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 xC(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Mu=class{constructor(...t){}};var kb=(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",kb),tt=b("$ZodError",kb,{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,m=0;for(;m<u.length;){let p=u[m],f=m===u.length-1;typeof p=="string"?(d.properties??(d.properties={}),(s=d.properties)[p]??(s[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(a=d.items)[p]??(a[p]={errors:[]}),d=d.items[p]),f&&d.errors.push(t(l)),m++}}};return o(e),r}function wb(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 ${wb(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)},wC=ya(tt),ba=e=>(t,r,o)=>ao(e)(t,r,o),SC=ba(tt),xa=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return co(e)(t,r,n)},_C=xa(tt),ka=e=>async(t,r,o)=>co(e)(t,r,o),$C=ka(tt),wa=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return lo(e)(t,r,n)},IC=wa(tt),Sa=e=>(t,r,o)=>lo(e)(t,r,o),EC=Sa(tt),_a=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return uo(e)(t,r,n)},AC=_a(tt),$a=e=>async(t,r,o)=>uo(e)(t,r,o),PC=$a(tt);var it={};nn(it,{base64:()=>hd,base64url:()=>Ia,bigint:()=>Sd,boolean:()=>$d,browserEmail:()=>UC,cidrv4:()=>fd,cidrv6:()=>gd,cuid:()=>td,cuid2:()=>nd,date:()=>bd,datetime:()=>kd,domain:()=>FC,duration:()=>ad,e164:()=>yd,email:()=>ld,emoji:()=>ud,extendedDuration:()=>CC,guid:()=>cd,hex:()=>MC,hostname:()=>zC,html5Email:()=>DC,httpProtocol:()=>vd,idnEmail:()=>LC,integer:()=>_d,ipv4:()=>dd,ipv6:()=>pd,ksuid:()=>id,lowercase:()=>Ad,mac:()=>md,md5_base64:()=>HC,md5_base64url:()=>ZC,md5_hex:()=>BC,nanoid:()=>sd,null:()=>Id,number:()=>Ea,rfc5322Email:()=>NC,sha1_base64:()=>WC,sha1_base64url:()=>VC,sha1_hex:()=>GC,sha256_base64:()=>JC,sha256_base64url:()=>KC,sha256_hex:()=>qC,sha384_base64:()=>YC,sha384_base64url:()=>QC,sha384_hex:()=>XC,sha512_base64:()=>tT,sha512_base64url:()=>nT,sha512_hex:()=>eT,string:()=>wd,time:()=>xd,ulid:()=>rd,undefined:()=>Ed,unicodeEmail:()=>Sb,uppercase:()=>Pd,uuid:()=>gr,uuid4:()=>TC,uuid6:()=>RC,uuid7:()=>OC,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)?)?)$/,CC=/^[-+]?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)$/,TC=gr(4),RC=gr(6),OC=gr(7),ld=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,DC=/^[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])?)*$/,NC=/^(([^<>()\[\]\\.,;:\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,}))$/,Sb=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,LC=Sb,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="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ud(){return new RegExp(jC,"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_-]*$/,zC=/^(?=.{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])?)*\.?$/,FC=/^([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}$/,_b="(?:(?:\\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(`^${_b}$`);function $b(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(`^${$b(e)}$`)}function kd(e){let t=$b({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(`^${_b}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]*$/,MC=/^[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 BC=/^[0-9a-fA-F]{32}$/,HC=Di(22,"=="),ZC=Ni(22),GC=/^[0-9a-fA-F]{40}$/,WC=Di(27,"="),VC=Ni(27),qC=/^[0-9a-fA-F]{64}$/,JC=Di(43,"="),KC=Ni(43),XC=/^[0-9a-fA-F]{96}$/,YC=Di(64,""),QC=Ni(64),eT=/^[0-9a-fA-F]{128}$/,tT=Di(86,"=="),nT=Ni(86);var ye=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Eb={number:"number",bigint:"bigint",object:"date"},Aa=b("$ZodCheckLessThan",(e,t)=>{ye.init(e,t);let r=Eb[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=Eb[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 Ib(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=>Ib(n,r,t.property));Ib(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 m of a){if(m._zod.def.when){if(Ku(s)||!m._zod.def.when(s))continue}else if(u)continue;let p=s.issues.length,f=m._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!==p&&(u||(u=Bn(s,p)))});else{if(s.issues.length===p)continue;u||(u=Bn(s,p))}}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 Hb(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=>{Hb(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 Zb(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=>{Zb(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 Pb(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=>Pb(u,r,s))):Pb(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 Gb(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 Wb(e,t,r,o,n,i){let s=[],a=n.keySet,l=n.catchall._zod,u=l.def.type,d=l.optin==="optional",m=l.optout==="optional";for(let p in t){if(p==="__proto__"||a.has(p))continue;if(u==="never"){s.push(p);continue}let f=l.run({value:t[p],issues:[]},o);f instanceof Promise?e.push(f.then(g=>Oa(g,r,p,t,d,m))):Oa(f,r,p,t,d,m)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var Vb=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(()=>Gb(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 m of d.values)l[u].add(m)}}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=[],m=s.shape;for(let p of s.keys){let f=m[p],g=f._zod.optin==="optional",h=f._zod.optout==="optional",y=f._zod.run({value:u[p],issues:[]},l);y instanceof Promise?d.push(y.then(w=>Oa(w,a,p,u,g,h))):Oa(y,a,p,u,g,h)}return i?Wb(d,u,a,l,o.value,e):d.length?Promise.all(d).then(()=>a):a}}),Op=b("$ZodObjectJIT",(e,t)=>{Vb.init(e,t);let r=e._zod.parse,o=io(()=>Gb(t)),n=p=>{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),w=0;for(let I of g.keys)y[I]=`key_${w++}`;f.write("const newResult = {};");for(let I of g.keys){let S=y[I],T=fa(I),j=p[I],z=j?._zod?.optin==="optional",J=j?._zod?.optout==="optional";f.write(`const ${S} = ${h(I)};`),z&&J?f.write(`
177
+ if (${S}.issues.length) {
178
+ if (${T} in input) {
179
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
180
180
  ...iss,
181
- path: iss.path ? [${D}, ...iss.path] : [${D}]
181
+ path: iss.path ? [${T}, ...iss.path] : [${T}]
182
182
  })));
183
183
  }
184
184
  }
185
185
 
186
- if (${E}.value === undefined) {
187
- if (${D} in input) {
188
- newResult[${D}] = undefined;
186
+ if (${S}.value === undefined) {
187
+ if (${T} in input) {
188
+ newResult[${T}] = undefined;
189
189
  }
190
190
  } else {
191
- newResult[${D}] = ${E}.value;
191
+ newResult[${T}] = ${S}.value;
192
192
  }
193
193
 
194
- `):ae?f.write(`
195
- if (${E}.issues.length) {
196
- payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
194
+ `):z?f.write(`
195
+ if (${S}.issues.length) {
196
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
197
197
  ...iss,
198
- path: iss.path ? [${D}, ...iss.path] : [${D}]
198
+ path: iss.path ? [${T}, ...iss.path] : [${T}]
199
199
  })));
200
200
  }
201
201
 
202
- if (${E}.value === undefined) {
203
- if (${D} in input) {
204
- newResult[${D}] = undefined;
202
+ if (${S}.value === undefined) {
203
+ if (${T} in input) {
204
+ newResult[${T}] = undefined;
205
205
  }
206
206
  } else {
207
- newResult[${D}] = ${E}.value;
207
+ newResult[${T}] = ${S}.value;
208
208
  }
209
209
 
210
210
  `):f.write(`
211
- const ${E}_present = ${D} in input;
212
- if (${E}.issues.length) {
213
- payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
211
+ const ${S}_present = ${T} in input;
212
+ if (${S}.issues.length) {
213
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
214
214
  ...iss,
215
- path: iss.path ? [${D}, ...iss.path] : [${D}]
215
+ path: iss.path ? [${T}, ...iss.path] : [${T}]
216
216
  })));
217
217
  }
218
- if (!${E}_present && !${E}.issues.length) {
218
+ if (!${S}_present && !${S}.issues.length) {
219
219
  payload.issues.push({
220
220
  code: "invalid_type",
221
221
  expected: "nonoptional",
222
222
  input: undefined,
223
- path: [${D}]
223
+ path: [${T}]
224
224
  });
225
225
  }
226
226
 
227
- if (${E}_present) {
228
- if (${E}.value === undefined) {
229
- newResult[${D}] = undefined;
227
+ if (${S}_present) {
228
+ if (${S}.value === undefined) {
229
+ newResult[${T}] = undefined;
230
230
  } else {
231
- newResult[${D}] = ${E}.value;
231
+ newResult[${T}] = ${S}.value;
232
232
  }
233
233
  }
234
234
 
235
- `)}f.write("payload.value = newResult;"),f.write("return payload;");let P=f.compile();return(C,E)=>P(m,C,E)},i,a=Yn,s=!Xn.jitless,u=s&&nu.value,d=t.catchall,p;e._zod.parse=(m,f)=>{p??(p=o.value);let g=m.value;return a(g)?s&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=n(t.shape)),m=i(m,f),d?Gy([],g,m,f,p,e):m):r(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function Py(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=>!Dn(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(a=>je(a,o,ve())))}),t)}var di=v("$ZodUnion",(e,t)=>{F.init(e,t),V(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),V(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,a=[];for(let s of t.options){let l=s._zod.run({value:o.value,issues:[]},n);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}return i?Promise.all(a).then(s=>Py(s,o,e,n)):Py(a,o,e,n)}});function Cy(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(a=>je(a,o,ve())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var Wd=v("$ZodXor",(e,t)=>{di.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,a=[];for(let s of t.options){let l=s._zod.run({value:o.value,issues:[]},n);l instanceof Promise?(a.push(l),i=!0):a.push(l)}return i?Promise.all(a).then(s=>Cy(s,o,e,n)):Cy(a,o,e,n)}}),Vd=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,di.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let n={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[s,l]of Object.entries(a)){n[s]||(n[s]=new Set);for(let u of l)n[s].add(u)}}return n});let o=Lr(()=>{let n=t.options,i=new Map;for(let a of n){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let l of s){if(i.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,a)}}return i});e._zod.parse=(n,i)=>{let a=n.value;if(!Yn(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;let s=o.value.get(a?.[t.discriminator]);return s?s._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:a,path:[t.discriminator],inst:e}),n)}}),Jd=v("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),a=t.right._zod.run({value:n,issues:[]},o);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([l,u])=>Ty(r,l,u)):Ty(r,i,a)}});function sd(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(On(e)&&On(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 a=sd(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n[i]=a.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],a=sd(n,i);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ty(e,t,r){let o=new Map,n;for(let s of t.issues)if(s.code==="unrecognized_keys"){n??(n=s);for(let l of s.keys)o.has(l)||o.set(l,{}),o.get(l).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let l of s.keys)o.has(l)||o.set(l,{}),o.get(l).r=!0;else e.issues.push(s);let i=[...o].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&n&&e.issues.push({...n,keys:i}),Dn(e))return e;let a=sd(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var rs=v("$ZodTuple",(e,t)=>{F.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 a=[],s=Ry(r,"optin"),l=Ry(r,"optout");if(!t.rest){if(i.length<s)return o.issues.push({code:"too_small",minimum:s,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?a.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?a.push(f.then(g=>Oy(g,o,d))):Oy(f,o,d)}}return a.length?Promise.all(a).then(()=>Dy(u,o,r,i,l)):Dy(u,o,r,i,l)}});function Ry(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]._zod[t]!=="optional")return r+1;return 0}function Oy(e,t,r){e.issues.length&&t.issues.push(...qe(r,e.issues)),t.value[r]=e.value}function Dy(e,t,r,o,n){for(let i=0;i<r.length;i++){let a=e[i],s=i<o.length;if(a.issues.length){if(!s&&i>=n){t.value.length=i;break}t.issues.push(...qe(i,a.issues))}t.value[i]=a.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 qd=v("$ZodRecord",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!On(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.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=>je(f,o,ve())),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(...qe(u,f.issues)),r.value[p]=f.value})):(m.issues.length&&r.issues.push(...qe(u,m.issues)),r.value[p]=m.value)}let l;for(let u in n)s.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 s of Reflect.ownKeys(n)){if(s==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,s))continue;let l=t.keyType._zod.run({value:s,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Ja.test(s)&&l.issues.length){let p=t.keyType._zod.run({value:Number(s),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[s]=n[s]:r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(p=>je(p,o,ve())),input:s,path:[s],inst:e});continue}let d=t.valueType._zod.run({value:n[s],issues:[]},o);d instanceof Promise?i.push(d.then(p=>{p.issues.length&&r.issues.push(...qe(s,p.issues)),r.value[l.value]=p.value})):(d.issues.length&&r.issues.push(...qe(s,d.issues)),r.value[l.value]=d.value)}}return i.length?Promise.all(i).then(()=>r):r}}),Kd=v("$ZodMap",(e,t)=>{F.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[a,s]of n){let l=t.keyType._zod.run({value:a,issues:[]},o),u=t.valueType._zod.run({value:s,issues:[]},o);l instanceof Promise||u instanceof Promise?i.push(Promise.all([l,u]).then(([d,p])=>{Ny(d,p,r,a,n,e,o)})):Ny(l,u,r,a,n,e,o)}return i.length?Promise.all(i).then(()=>r):r}});function Ny(e,t,r,o,n,i,a){e.issues.length&&(ti.has(typeof o)?r.issues.push(...qe(o,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map(s=>je(s,a,ve()))})),t.issues.length&&(ti.has(typeof o)?r.issues.push(...qe(o,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map(s=>je(s,a,ve()))})),r.value.set(e.value,t.value)}var Xd=v("$ZodSet",(e,t)=>{F.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 a of n){let s=t.valueType._zod.run({value:a,issues:[]},o);s instanceof Promise?i.push(s.then(l=>Ly(l,r))):Ly(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Ly(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var Yd=v("$ZodEnum",(e,t)=>{F.init(e,t);let r=Qo(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>ti.has(typeof n)).map(n=>typeof n=="string"?mt(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;return o.has(a)||n.issues.push({code:"invalid_value",values:r,input:a,inst:e}),n}}),Qd=v("$ZodLiteral",(e,t)=>{if(F.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"?mt(o):o?mt(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}}),ep=v("$ZodFile",(e,t)=>{F.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}}),tp=v("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Cn(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(a=>(r.value=a,r.fallback=!0,r));if(n instanceof Promise)throw new wt;return r.value=n,r.fallback=!0,r}});function Uy(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var os=v("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(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(a=>Uy(a,n)):Uy(i,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),np=v("$ZodExactOptional",(e,t)=>{os.init(e,t),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),rp=v("$ZodNullable",(e,t)=>{F.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ei(r.source)}|null)$`):void 0}),V(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)}),op=v("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",V(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=>zy(i,t)):zy(n,t)}});function zy(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ip=v("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",V(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))}),ap=v("$ZodNonOptional",(e,t)=>{F.init(e,t),V(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=>jy(i,e)):jy(n,e)}});function jy(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 sp=v("$ZodSuccess",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Cn("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)}}),cp=v("$ZodCatch",(e,t)=>{F.init(e,t),e._zod.optin="optional",V(e._zod,"optout",()=>t.innerType._zod.optout),V(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(a=>je(a,o,ve()))},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=>je(i,o,ve()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),lp=v("$ZodNaN",(e,t)=>{F.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)}),is=v("$ZodPipe",(e,t)=>{F.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(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(a=>Xa(a,t.in,o)):Xa(i,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(i=>Xa(i,t.out,o)):Xa(n,t.out,o)}});function Xa(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 pi=v("$ZodCodec",(e,t)=>{F.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(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(a=>Ya(a,t,o)):Ya(i,t,o)}else{let i=t.out._zod.run(r,o);return i instanceof Promise?i.then(a=>Ya(a,t,o)):Ya(i,t,o)}}});function Ya(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=>Qa(e,i,t.out,r)):Qa(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(i=>Qa(e,i,t.in,r)):Qa(e,n,t.in,r)}}function Qa(e,t,r,o){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},o)}var up=v("$ZodPreprocess",(e,t)=>{is.init(e,t)}),dp=v("$ZodReadonly",(e,t)=>{F.init(e,t),V(e._zod,"propValues",()=>t.innerType._zod.propValues),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"optin",()=>t.innerType?._zod?.optin),V(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(Fy):Fy(n)}});function Fy(e){return e.value=Object.freeze(e.value),e}var pp=v("$ZodTemplateLiteral",(e,t)=>{F.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,a=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,a))}else if(o===null||ou.has(typeof o))r.push(mt(`${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)}),mp=v("$ZodFunction",(e,t)=>(F.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?Ua(e._def.input,o):o,i=Reflect.apply(r,this,n);return e._def.output?Ua(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 za(e._def.input,o):o,i=await Reflect.apply(r,this,n);return e._def.output?await za(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 rs({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)),fp=v("$ZodPromise",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then(n=>t.innerType._zod.run({value:n,issues:[]},o))}),gp=v("$ZodLazy",(e,t)=>{F.init(e,t),V(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),V(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),V(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),V(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),V(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),hp=v("$ZodCustom",(e,t)=>{de.init(e,t),F.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=>My(i,r,o,e));My(n,r,o,e)}});function My(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(Ur(n))}}var fi={};Jt(fi,{ar:()=>Vy,az:()=>Jy,be:()=>Ky,bg:()=>Xy,ca:()=>Yy,cs:()=>Qy,da:()=>eb,de:()=>tb,el:()=>nb,en:()=>as,eo:()=>rb,es:()=>ob,fa:()=>ib,fi:()=>ab,fr:()=>sb,frCA:()=>cb,he:()=>lb,hr:()=>ub,hu:()=>db,hy:()=>mb,id:()=>fb,is:()=>gb,it:()=>hb,ja:()=>vb,ka:()=>yb,kh:()=>bb,km:()=>ss,ko:()=>xb,lt:()=>wb,mk:()=>Sb,ms:()=>_b,nl:()=>$b,no:()=>Ib,ota:()=>Ab,pl:()=>Pb,ps:()=>Eb,pt:()=>Cb,ro:()=>Tb,ru:()=>Ob,sl:()=>Db,sv:()=>Nb,ta:()=>Lb,th:()=>Ub,tr:()=>zb,ua:()=>jb,uk:()=>cs,ur:()=>Fb,uz:()=>Mb,vi:()=>Bb,yo:()=>Gb,zhCN:()=>Hb,zhTW:()=>Zb});var xP=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}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 ${w(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: ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?` \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()} ${a.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?">=":">",a=t(n.origin);return a?`\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()} ${a.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":""}: ${x(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 Vy(){return{localeError:xP()}}var kP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${n.expected}, daxil olan ${s}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${i}, daxil olan ${s}`}case"invalid_value":return n.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${w(n.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()} ${a.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":""}: ${x(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 Jy(){return{localeError:kP()}}function qy(e,t,r,o){let n=Math.abs(e),i=n%10,a=n%100;return a>=11&&a<=19?o:i===1?t:i>=2&&i<=4?r:o}var wP=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}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 ${w(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 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let s=Number(n.maximum),l=qy(s,a.unit.one,a.unit.few,a.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 ${a.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?">=":">",a=t(n.origin);if(a){let s=Number(n.minimum),l=qy(s,a.unit.one,a.unit.few,a.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 ${a.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"}: ${x(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 Ky(){return{localeError:wP()}}var SP=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}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 ${w(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 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\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()} ${a.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?">=":">",a=t(n.origin);return a?`\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()} ${a.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 a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return i.format==="emoji"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="datetime"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="date"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),i.format==="time"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="duration"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${a} ${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":""}: ${x(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 Xy(){return{localeError:SP()}}var _P=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${s}`:`Tipus inv\xE0lid: s'esperava ${i}, s'ha rebut ${s}`}case"invalid_value":return n.values.length===1?`Valor inv\xE0lid: s'esperava ${w(n.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${x(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a m\xE0xim":"menys de",a=t(n.origin);return a?`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${i} ${n.maximum.toString()} ${a.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",a=t(n.origin);return a?`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${i} ${n.minimum.toString()} ${a.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":""}: ${x(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 Yy(){return{localeError:_P()}}var $P=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${n.expected}, obdr\u017Eeno ${s}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${i}, obdr\u017Eeno ${s}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${w(n.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.minimum.toString()} ${a.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: ${x(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 Qy(){return{localeError:$P()}}var IP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ugyldigt input: forventede instanceof ${n.expected}, fik ${s}`:`Ugyldigt input: forventede ${i}, fik ${s}`}case"invalid_value":return n.values.length===1?`Ugyldig v\xE6rdi: forventede ${w(n.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=o[n.origin]??n.origin;return a?`For stor: forventede ${s??"value"} ${a.verb} ${i} ${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor: forventede ${s??"value"} havde ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=o[n.origin]??n.origin;return a?`For lille: forventede ${s} ${a.verb} ${i} ${n.minimum.toString()} ${a.unit}`:`For lille: forventede ${s} 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"}: ${x(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 eb(){return{localeError:IP()}}var AP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${s}`:`Ung\xFCltige Eingabe: erwartet ${i}, erhalten ${s}`}case"invalid_value":return n.values.length===1?`Ung\xFCltige Eingabe: erwartet ${w(n.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${a.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"}: ${x(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 tb(){return{localeError:AP()}}var EP=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}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 ${w(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 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\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()} ${a.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?">=":">",a=t(n.origin);return a?`\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()} ${a.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"}: ${x(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 nb(){return{localeError:EP()}}var PP=()=>{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,a=S(n.input),s=o[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${w(n.values[0])}`:`Invalid option: expected one of ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${a.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":""}: ${x(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(a=>`'${a}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function as(){return{localeError:PP()}}var CP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${n.expected}, ricevi\u011Dis ${s}`:`Nevalida enigo: atendi\u011Dis ${i}, ricevi\u011Dis ${s}`}case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${w(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${i}${n.minimum.toString()} ${a.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":""}: ${x(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 rb(){return{localeError:CP()}}var TP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${n.expected}, recibido ${s}`:`Entrada inv\xE1lida: se esperaba ${i}, recibido ${s}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: se esperaba ${w(n.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=o[n.origin]??n.origin;return a?`Demasiado grande: se esperaba que ${s??"valor"} tuviera ${i}${n.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${s??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=o[n.origin]??n.origin;return a?`Demasiado peque\xF1o: se esperaba que ${s} tuviera ${i}${n.minimum.toString()} ${a.unit}`:`Demasiado peque\xF1o: se esperaba que ${s} 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":""}: ${x(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 ob(){return{localeError:TP()}}var RP=()=>{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,a=S(n.input),s=o[a]??a;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 ${s} \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 ${s} \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 ${w(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 ${x(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${a.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: ${x(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 ib(){return{localeError:RP()}}var OP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${s}`:`Virheellinen tyyppi: odotettiin ${i}, oli ${s}`}case"invalid_value":return n.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${w(n.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Liian suuri: ${a.subject} t\xE4ytyy olla ${i}${n.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Liian pieni: ${a.subject} t\xE4ytyy olla ${i}${n.minimum.toString()} ${a.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"}: ${x(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 ab(){return{localeError:OP()}}var DP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : instanceof ${n.expected} attendu, ${s} re\xE7u`:`Entr\xE9e invalide : ${i} attendu, ${s} re\xE7u`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : ${w(n.values[0])} attendu`:`Option invalide : une valeur parmi ${x(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Trop grand : ${o[n.origin]??"valeur"} doit ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o[n.origin]??"valeur"} doit \xEAtre ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Trop petit : ${o[n.origin]??"valeur"} doit ${a.verb} ${i}${n.minimum.toString()} ${a.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":""} : ${x(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 sb(){return{localeError:DP()}}var NP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : attendu instanceof ${n.expected}, re\xE7u ${s}`:`Entr\xE9e invalide : attendu ${i}, re\xE7u ${s}`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : attendu ${w(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u2264":"<",a=t(n.origin);return a?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u2265":">",a=t(n.origin);return a?`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${a.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":""} : ${x(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 cb(){return{localeError:NP()}}var LP=()=>{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",a=u=>u?t[u]??null:null,s={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=S(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 ${w(u.values[0])}`;let d=u.values.map(f=>w(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=a(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",y=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 ${y}`.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=a(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 k=(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 ${k}`}let y=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 ${y}`.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=s[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"}: ${x(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 lb(){return{localeError:LP()}}var UP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${n.expected}, a primljeno je ${s}`:`Neispravan unos: o\u010Dekuje se ${i}, a primljeno je ${s}`}case"invalid_value":return n.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${w(n.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=o[n.origin]??n.origin;return a?`Preveliko: o\u010Dekivano da ${s??"vrijednost"} ima ${i}${n.maximum.toString()} ${a.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${s??"vrijednost"} bude ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=o[n.origin]??n.origin;return a?`Premalo: o\u010Dekivano da ${s} ima ${i}${n.minimum.toString()} ${a.unit}`:`Premalo: o\u010Dekivano da ${s} 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"}: ${x(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 ub(){return{localeError:UP()}}var zP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${n.expected}, a kapott \xE9rt\xE9k ${s}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${i}, a kapott \xE9rt\xE9k ${s}`}case"invalid_value":return n.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${w(n.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${i}${n.minimum.toString()} ${a.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":""}: ${x(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 db(){return{localeError:zP()}}function pb(e,t,r){return Math.abs(e)===1?t:r}function Hr(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 jP=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}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 ${w(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 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let s=Number(n.maximum),l=pb(s,a.unit.one,a.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 ${Hr(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 ${Hr(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a){let s=Number(n.minimum),l=pb(s,a.unit.one,a.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 ${Hr(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 ${Hr(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":""}. ${x(n.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${Hr(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 ${Hr(n.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function mb(){return{localeError:jP()}}var FP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${s}`:`Input tidak valid: diharapkan ${i}, diterima ${s}`}case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${w(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${a.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":""}: ${x(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 fb(){return{localeError:FP()}}var MP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera instanceof ${n.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera ${i}`}case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${w(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${i}${n.minimum.toString()} ${a.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"}: ${x(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 gb(){return{localeError:MP()}}var BP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Input non valido: atteso instanceof ${n.expected}, ricevuto ${s}`:`Input non valido: atteso ${i}, ricevuto ${s}`}case"invalid_value":return n.values.length===1?`Input non valido: atteso ${w(n.values[0])}`:`Opzione non valida: atteso uno tra ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${a.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"}: ${x(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 hb(){return{localeError:BP()}}var HP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${n.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${i}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return n.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${w(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${x(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",a=t(n.origin);return a?`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${a.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",a=t(n.origin);return a?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${a.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":""}: ${x(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 vb(){return{localeError:HP()}}var ZP=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}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 ${w(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 ${x(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\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"} ${a.verb} ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`\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} ${a.verb} ${i}${n.minimum.toString()} ${a.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"}: ${x(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 yb(){return{localeError:ZP()}}var GP=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}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 ${w(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 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\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()} ${a.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?">=":">",a=t(n.origin);return a?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()} ${a.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 ${x(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 ss(){return{localeError:GP()}}function bb(){return ss()}var WP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${i}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`}case"invalid_value":return n.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${w(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${x(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",a=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(n.origin),l=s?.unit??"\uC694\uC18C";return s?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${l} ${i}${a}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${i}${a}`}case"too_small":{let i=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",a=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(n.origin),l=s?.unit??"\uC694\uC18C";return s?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${l} ${i}${a}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${i}${a}`}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: ${x(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 xb(){return{localeError:WP()}}var mi=e=>e.charAt(0).toUpperCase()+e.slice(1);function kb(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 VP=()=>{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,a,s){let l=e[n]??null;return l===null?l:{unit:l.unit[i],verb:l.verb[s][a?"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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Gautas tipas ${s}, o tik\u0117tasi - instanceof ${n.expected}`:`Gautas tipas ${s}, o tik\u0117tasi - ${i}`}case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${w(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${x(n.values,"|")} pasirinkim\u0173`;case"too_big":{let i=o[n.origin]??n.origin,a=t(n.origin,kb(Number(n.maximum)),n.inclusive??!1,"smaller");if(a?.verb)return`${mi(i??n.origin??"reik\u0161m\u0117")} ${a.verb} ${n.maximum.toString()} ${a.unit??"element\u0173"}`;let s=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${mi(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.maximum.toString()} ${a?.unit}`}case"too_small":{let i=o[n.origin]??n.origin,a=t(n.origin,kb(Number(n.minimum)),n.inclusive??!1,"bigger");if(a?.verb)return`${mi(i??n.origin??"reik\u0161m\u0117")} ${a.verb} ${n.minimum.toString()} ${a.unit??"element\u0173"}`;let s=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${mi(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.minimum.toString()} ${a?.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"}: ${x(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`${mi(i??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function wb(){return{localeError:VP()}}var JP=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${w(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 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\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()} ${a.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?">=":">",a=t(n.origin);return a?`\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()} ${a.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"}: ${x(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 Sb(){return{localeError:JP()}}var qP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${s}`:`Input tidak sah: dijangka ${i}, diterima ${s}`}case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${w(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: dijangka ${n.origin??"nilai"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: dijangka ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.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: ${x(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 _b(){return{localeError:qP()}}var KP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${s}`:`Ongeldige invoer: verwacht ${i}, ontving ${s}`}case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${w(n.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";return a?`Te ${s}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${a.unit??"elementen"} ${a.verb}`:`Te ${s}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";return a?`Te ${s}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${a.unit} ${a.verb}`:`Te ${s}: 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":""}: ${x(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 $b(){return{localeError:KP()}}var XP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventet instanceof ${n.expected}, fikk ${s}`:`Ugyldig input: forventet ${i}, fikk ${s}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${w(n.values[0])}`:`Ugyldig valg: forventet en av ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()} ${a.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"}: ${x(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 Ib(){return{localeError:XP()}}var YP=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`F\xE2sit giren: umulan instanceof ${n.expected}, al\u0131nan ${s}`:`F\xE2sit giren: umulan ${i}, al\u0131nan ${s}`}case"invalid_value":return n.values.length===1?`F\xE2sit giren: umulan ${w(n.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} ${a.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":""}: ${x(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 Ab(){return{localeError:YP()}}var QP=()=>{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,a=S(n.input),s=o[a]??a;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 ${s} \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 ${s} \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 ${w(n.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${x(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${a.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"}: ${x(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 Eb(){return{localeError:QP()}}var eC=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${n.expected}, otrzymano ${s}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${i}, otrzymano ${s}`}case"invalid_value":return n.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${w(n.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.minimum.toString()} ${a.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":""}: ${x(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 Pb(){return{localeError:eC()}}var tC=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Tipo inv\xE1lido: esperado instanceof ${n.expected}, recebido ${s}`:`Tipo inv\xE1lido: esperado ${i}, recebido ${s}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: esperado ${w(n.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${a.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":""}: ${x(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 Cb(){return{localeError:tC()}}var nC=()=>{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,a=S(n.input),s=o[a]??a;return`Intrare invalid\u0103: a\u0219teptat ${i}, primit ${s}`}case"invalid_value":return n.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${w(n.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} s\u0103 fie ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Prea mic: a\u0219teptat ca ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.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: ${x(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 Tb(){return{localeError:nC()}}function Rb(e,t,r,o){let n=Math.abs(e),i=n%10,a=n%100;return a>=11&&a<=19?o:i===1?t:i>=2&&i<=4?r:o}var rC=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}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 ${w(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 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let s=Number(n.maximum),l=Rb(s,a.unit.one,a.unit.few,a.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?">=":">",a=t(n.origin);if(a){let s=Number(n.minimum),l=Rb(s,a.unit.one,a.unit.few,a.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":""}: ${x(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 Ob(){return{localeError:rC()}}var oC=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${n.expected}, prejeto ${s}`:`Neveljaven vnos: pri\u010Dakovano ${i}, prejeto ${s}`}case"invalid_value":return n.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${w(n.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${a.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"}: ${x(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 Db(){return{localeError:oC()}}var iC=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${n.expected}, fick ${s}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${i}, fick ${s}`}case"invalid_value":return n.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${w(n.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()} ${a.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"}: ${x(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 Nb(){return{localeError:iC()}}var aC=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}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 ${w(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 ${x(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\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()} ${a.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?">=":">",a=t(n.origin);return a?`\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()} ${a.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":""}: ${x(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 Lb(){return{localeError:aC()}}var sC=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}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 ${w(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 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",a=t(n.origin);return a?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()} ${a.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",a=t(n.origin);return a?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()} ${a.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: ${x(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 Ub(){return{localeError:sC()}}var cC=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${n.expected}, al\u0131nan ${s}`:`Ge\xE7ersiz de\u011Fer: beklenen ${i}, al\u0131nan ${s}`}case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${w(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()} ${a.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()} ${a.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":""}: ${x(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 zb(){return{localeError:cC()}}var lC=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\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 ${s}`}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 ${w(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 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\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"} ${a.verb} ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`\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} ${a.verb} ${i}${n.minimum.toString()} ${a.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":""}: ${x(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 cs(){return{localeError:lC()}}function jb(){return cs()}var uC=()=>{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,a=S(n.input),s=o[a]??a;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 ${s} \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 ${s} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return n.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${w(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${x(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?"<=":"<",a=t(n.origin);return a?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${i}${n.minimum.toString()} ${a.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":""}: ${x(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 Fb(){return{localeError:uC()}}var dC=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${s}`:`Noto\u2018g\u2018ri kirish: kutilgan ${i}, qabul qilingan ${s}`}case"invalid_value":return n.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${w(n.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()} ${a.unit} ${a.verb}`:`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()} ${a.unit} ${a.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":""}: ${x(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 Mb(){return{localeError:dC()}}var pC=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${i}, nh\u1EADn \u0111\u01B0\u1EE3c ${s}`}case"invalid_value":return n.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${w(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 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${a.verb} ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.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: ${x(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 Bb(){return{localeError:pC()}}var mC=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${i}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`}case"invalid_value":return n.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${w(n.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()} ${a.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): ${x(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 Hb(){return{localeError:mC()}}var fC=()=>{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,a=S(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${n.expected}\uFF0C\u4F46\u6536\u5230 ${s}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${i}\uFF0C\u4F46\u6536\u5230 ${s}`}case"invalid_value":return n.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${w(n.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()} ${a.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?">=":">",a=t(n.origin);return a?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()} ${a.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${x(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 Zb(){return{localeError:fC()}}var gC=()=>{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,a=S(n.input),s=o[a]??a;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 ${s}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${i}, \xE0m\u1ECD\u0300 a r\xED ${s}`}case"invalid_value":return n.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${w(n.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${x(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin??"iye"} ${a.verb} ${i}${n.maximum} ${a.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?">=":">",a=t(n.origin);return a?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin} ${a.verb} ${i}${n.minimum} ${a.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: ${x(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 Gb(){return{localeError:gC()}}var Wb,vp=Symbol("ZodOutput"),yp=Symbol("ZodInput"),ls=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 us(){return new ls}(Wb=globalThis).__zod_globalRegistry??(Wb.__zod_globalRegistry=us());var Ce=globalThis.__zod_globalRegistry;function bp(e,t){return new e({type:"string",...I(t)})}function xp(e,t){return new e({type:"string",coerce:!0,...I(t)})}function ds(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function gi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function ps(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function ms(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function fs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function gs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function hi(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function hs(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function vs(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function ys(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function bs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function xs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function ks(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function ws(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function Ss(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function _s(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function kp(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...I(t)})}function $s(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function Is(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function As(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function Es(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function Ps(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function Cs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}var wp={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Sp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function _p(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function $p(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function Ip(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function Ap(e,t){return new e({type:"number",checks:[],...I(t)})}function Ep(e,t){return new e({type:"number",coerce:!0,checks:[],...I(t)})}function Pp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function Cp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...I(t)})}function Tp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...I(t)})}function Rp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...I(t)})}function Op(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...I(t)})}function Dp(e,t){return new e({type:"boolean",...I(t)})}function Np(e,t){return new e({type:"boolean",coerce:!0,...I(t)})}function Lp(e,t){return new e({type:"bigint",...I(t)})}function Up(e,t){return new e({type:"bigint",coerce:!0,...I(t)})}function zp(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...I(t)})}function jp(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...I(t)})}function Fp(e,t){return new e({type:"symbol",...I(t)})}function Mp(e,t){return new e({type:"undefined",...I(t)})}function Bp(e,t){return new e({type:"null",...I(t)})}function Hp(e){return new e({type:"any"})}function Zp(e){return new e({type:"unknown"})}function Gp(e,t){return new e({type:"never",...I(t)})}function Wp(e,t){return new e({type:"void",...I(t)})}function Vp(e,t){return new e({type:"date",...I(t)})}function Jp(e,t){return new e({type:"date",coerce:!0,...I(t)})}function qp(e,t){return new e({type:"nan",...I(t)})}function Dt(e,t){return new qa({check:"less_than",...I(t),value:e,inclusive:!1})}function ot(e,t){return new qa({check:"less_than",...I(t),value:e,inclusive:!0})}function Nt(e,t){return new Ka({check:"greater_than",...I(t),value:e,inclusive:!1})}function Fe(e,t){return new Ka({check:"greater_than",...I(t),value:e,inclusive:!0})}function Ts(e){return Nt(0,e)}function Rs(e){return Dt(0,e)}function Os(e){return ot(0,e)}function Ds(e){return Fe(0,e)}function Nn(e,t){return new Bu({check:"multiple_of",...I(t),value:e})}function Ln(e,t){return new Gu({check:"max_size",...I(t),maximum:e})}function Lt(e,t){return new Wu({check:"min_size",...I(t),minimum:e})}function tr(e,t){return new Vu({check:"size_equals",...I(t),size:e})}function nr(e,t){return new Ju({check:"max_length",...I(t),maximum:e})}function nn(e,t){return new qu({check:"min_length",...I(t),minimum:e})}function rr(e,t){return new Ku({check:"length_equals",...I(t),length:e})}function Zr(e,t){return new Xu({check:"string_format",format:"regex",...I(t),pattern:e})}function Gr(e){return new Yu({check:"string_format",format:"lowercase",...I(e)})}function Wr(e){return new Qu({check:"string_format",format:"uppercase",...I(e)})}function Vr(e,t){return new ed({check:"string_format",format:"includes",...I(t),includes:e})}function Jr(e,t){return new td({check:"string_format",format:"starts_with",...I(t),prefix:e})}function qr(e,t){return new nd({check:"string_format",format:"ends_with",...I(t),suffix:e})}function Ns(e,t,r){return new rd({check:"property",property:e,schema:t,...I(r)})}function Kr(e,t){return new od({check:"mime_type",mime:e,...I(t)})}function St(e){return new id({check:"overwrite",tx:e})}function Xr(e){return St(t=>t.normalize(e))}function Yr(){return St(e=>e.trim())}function Qr(){return St(e=>e.toLowerCase())}function eo(){return St(e=>e.toUpperCase())}function to(){return St(e=>tu(e))}function Kp(e,t,r){return new e({type:"array",element:t,...I(r)})}function vC(e,t,r){return new e({type:"union",options:t,...I(r)})}function yC(e,t,r){return new e({type:"union",options:t,inclusive:!1,...I(r)})}function bC(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...I(o)})}function xC(e,t,r){return new e({type:"intersection",left:t,right:r})}function kC(e,t,r,o){let n=r instanceof F,i=n?o:r,a=n?r:null;return new e({type:"tuple",items:t,rest:a,...I(i)})}function wC(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...I(o)})}function SC(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...I(o)})}function _C(e,t,r){return new e({type:"set",valueType:t,...I(r)})}function $C(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:o,...I(r)})}function IC(e,t,r){return new e({type:"enum",entries:t,...I(r)})}function AC(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...I(r)})}function Xp(e,t){return new e({type:"file",...I(t)})}function EC(e,t){return new e({type:"transform",transform:t})}function PC(e,t){return new e({type:"optional",innerType:t})}function CC(e,t){return new e({type:"nullable",innerType:t})}function TC(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():ru(r)}})}function RC(e,t,r){return new e({type:"nonoptional",innerType:t,...I(r)})}function OC(e,t){return new e({type:"success",innerType:t})}function DC(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}function NC(e,t,r){return new e({type:"pipe",in:t,out:r})}function LC(e,t){return new e({type:"readonly",innerType:t})}function UC(e,t,r){return new e({type:"template_literal",parts:t,...I(r)})}function zC(e,t){return new e({type:"lazy",getter:t})}function jC(e,t){return new e({type:"promise",innerType:t})}function Yp(e,t,r){let o=I(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Qp(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function em(e,t){let r=Vb(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Ur(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(Ur(i))}},e(o.value,o)),t);return r}function Vb(e,t){let r=new de({check:"custom",...I(t)});return r._zod.check=e,r}function tm(e){let t=new de({check:"describe"});return t._zod.onattach=[r=>{let o=Ce.get(r)??{};Ce.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function nm(e){let t=new de({check:"meta"});return t._zod.onattach=[r=>{let o=Ce.get(r)??{};Ce.add(r,{...o,...e})}],t._zod.check=()=>{},t}function rm(e,t){let r=I(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),a=new Set(n),s=e.Codec??pi,l=e.Boolean??ui,u=e.String??er,d=new u({type:"string",error:r.error}),p=new l({type:"boolean",error:r.error}),m=new s({type:"pipe",in:d,out:p,transform:((f,g)=>{let y=f;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:a.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:m,continue:!1}),{})}),reverseTransform:((f,g)=>f===!0?o[0]||"true":n[0]||"false"),error:r.error});return m}function no(e,t,r,o={}){let n=I(o),i={...I(o),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...n};return r instanceof RegExp&&(i.pattern=r),new e(i)}function Un(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??Ce,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 oe(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 a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,d);else{let m=a.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&&(a.ref||(a.ref=p),oe(p,t,d),t.seen.get(p).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&Me(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function zn(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 a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let l=o.get(s);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(s,a[0])}}let n=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(a[0])?.id,m=e.external.uri??(g=>g);if(p)return{ref:m(p)};let f=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=f,{defId:f,ref:`${m("__shared")}#/${s}/${f}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:l,defId:u}=n(a);s.def={...s.schema},u&&(s.defId=u);let d=s.schema;for(let p in d)delete d[p];d.$ref=l};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
235
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");let _=f.compile();return(I,S)=>_(p,I,S)},i,s=fr,a=!mr.jitless,u=a&&Zu.value,d=t.catchall,m;e._zod.parse=(p,f)=>{m??(m=o.value);let g=p.value;return s(g)?a&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=n(t.shape)),p=i(p,f),d?Wb([],g,p,f,m,e):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p)}});function Cb(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=>Cb(a,o,e,n)):Cb(s,o,e,n)}});function Tb(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=>Tb(a,o,e,n)):Tb(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])=>Rb(r,l,u)):Rb(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 Rb(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=Ob(r,"optin"),l=Ob(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 m=r[d]._zod.run({value:i[d],issues:[]},n);m instanceof Promise?s.push(m.then(p=>{u[d]=p})):u[d]=m}if(t.rest){let d=r.length-1,m=i.slice(r.length);for(let p of m){d++;let f=t.rest._zod.run({value:p,issues:[]},n);f instanceof Promise?s.push(f.then(g=>Db(g,o,d))):Db(f,o,d)}}return s.length?Promise.all(s).then(()=>Nb(u,o,r,i,l)):Nb(u,o,r,i,l)}});function Ob(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]._zod[t]!=="optional")return r+1;return 0}function Db(e,t,r){e.issues.length&&t.issues.push(...et(r,e.issues)),t.value[r]=e.value}function Nb(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 m=d.value,p=t.valueType._zod.run({value:n[u],issues:[]},o);p instanceof Promise?i.push(p.then(f=>{f.issues.length&&r.issues.push(...et(u,f.issues)),r.value[m]=f.value})):(p.issues.length&&r.issues.push(...et(u,p.issues)),r.value[m]=p.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 m=t.keyType._zod.run({value:Number(a),issues:[]},o);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){t.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>Ge(m,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(m=>{m.issues.length&&r.issues.push(...et(a,m.issues)),r.value[l.value]=m.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,m])=>{Lb(d,m,r,s,n,e,o)})):Lb(l,u,r,s,n,e,o)}return i.length?Promise.all(i).then(()=>r):r}});function Lb(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=>Ub(l,r))):Ub(a,r)}return i.length?Promise.all(i).then(()=>r):r}});function Ub(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 jb(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=>jb(s,n)):jb(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=>zb(i,t)):zb(n,t)}});function zb(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=>Fb(i,e)):Fb(n,e)}});function Fb(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(Mb):Mb(n)}});function Mb(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=>Bb(i,r,o,e));Bb(n,r,o,e)}});function Bb(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:()=>qb,az:()=>Jb,be:()=>Xb,bg:()=>Yb,ca:()=>Qb,cs:()=>ex,da:()=>tx,de:()=>nx,el:()=>rx,en:()=>za,eo:()=>ox,es:()=>ix,fa:()=>sx,fi:()=>ax,fr:()=>cx,frCA:()=>lx,he:()=>ux,hr:()=>dx,hu:()=>px,hy:()=>fx,id:()=>gx,is:()=>hx,it:()=>vx,ja:()=>yx,ka:()=>bx,kh:()=>xx,km:()=>Fa,ko:()=>kx,lt:()=>Sx,mk:()=>_x,ms:()=>$x,nl:()=>Ix,no:()=>Ex,ota:()=>Ax,pl:()=>Cx,ps:()=>Px,pt:()=>Tx,ro:()=>Rx,ru:()=>Dx,sl:()=>Nx,sv:()=>Lx,ta:()=>Ux,th:()=>jx,tr:()=>zx,ua:()=>Fx,uk:()=>Ma,ur:()=>Mx,uz:()=>Bx,vi:()=>Hx,yo:()=>Wx,zhCN:()=>Zx,zhTW:()=>Gx});var oT=()=>{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: ${k(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":""}: ${k(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 qb(){return{localeError:oT()}}var iT=()=>{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: ${k(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":""}: ${k(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 Jb(){return{localeError:iT()}}function Kb(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 sT=()=>{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 ${k(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=Kb(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=Kb(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"}: ${k(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 Xb(){return{localeError:sT()}}var aT=()=>{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 ${k(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":""}: ${k(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 Yb(){return{localeError:aT()}}var cT=()=>{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 ${k(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":""}: ${k(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 Qb(){return{localeError:cT()}}var lT=()=>{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 ${k(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: ${k(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 ex(){return{localeError:lT()}}var uT=()=>{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 ${k(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"}: ${k(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 tx(){return{localeError:uT()}}var dT=()=>{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 ${k(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"}: ${k(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 nx(){return{localeError:dT()}}var pT=()=>{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 ${k(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"}: ${k(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 rx(){return{localeError:pT()}}var mT=()=>{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 ${k(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":""}: ${k(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:mT()}}var fT=()=>{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 ${k(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":""}: ${k(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 ox(){return{localeError:fT()}}var gT=()=>{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 ${k(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":""}: ${k(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 ix(){return{localeError:gT()}}var hT=()=>{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 ${k(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: ${k(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 sx(){return{localeError:hT()}}var vT=()=>{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: ${k(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"}: ${k(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 ax(){return{localeError:vT()}}var yT=()=>{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 ${k(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":""} : ${k(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 cx(){return{localeError:yT()}}var bT=()=>{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 ${k(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":""} : ${k(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 lx(){return{localeError:bT()}}var xT=()=>{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,m=l[d??""]??o(d),p=P(u.input),f=l[p]??e[p]?.label??p;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 ${m}, \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 m=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 ${m}`}case"too_big":{let d=s(u.origin),m=n(u.origin??"value");if(u.origin==="string")return`${d?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${m} \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: ${m} \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: ${m} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let p=u.inclusive?"<=":"<",f=i(u.origin??"value");return d?.unit?`${d.longLabel} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${u.maximum.toString()} ${d.unit}`:`${d?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${u.maximum.toString()}`}case"too_small":{let d=s(u.origin),m=n(u.origin??"value");if(u.origin==="string")return`${d?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${m} \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: ${m} \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: ${m} ${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: ${m} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let p=u.inclusive?">=":">",f=i(u.origin??"value");return d?.unit?`${d.shortLabel} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${u.minimum.toString()} ${d.unit}`:`${d?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${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 m=a[d.format],p=m?.label??d.format,g=(m?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${p} \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"}: ${k(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 ux(){return{localeError:xT()}}var kT=()=>{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 ${k(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"}: ${k(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 dx(){return{localeError:kT()}}var wT=()=>{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 ${k(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":""}: ${k(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 px(){return{localeError:wT()}}function mx(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 ST=()=>{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 ${k(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=mx(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=mx(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":""}. ${k(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 fx(){return{localeError:ST()}}var _T=()=>{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 ${k(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":""}: ${k(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 gx(){return{localeError:_T()}}var $T=()=>{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 ${k(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"}: ${k(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 hx(){return{localeError:$T()}}var IT=()=>{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 ${k(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"}: ${k(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 vx(){return{localeError:IT()}}var ET=()=>{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: ${k(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":""}: ${k(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 yx(){return{localeError:ET()}}var AT=()=>{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 ${k(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"}: ${k(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 bx(){return{localeError:AT()}}var PT=()=>{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 ${k(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 ${k(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:PT()}}function xx(){return Fa()}var CT=()=>{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: ${k(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: ${k(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 kx(){return{localeError:CT()}}var Fi=e=>e.charAt(0).toUpperCase()+e.slice(1);function wx(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 TT=()=>{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 ${k(n.values,"|")} pasirinkim\u0173`;case"too_big":{let i=o[n.origin]??n.origin,s=t(n.origin,wx(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,wx(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"}: ${k(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 Sx(){return{localeError:TT()}}var RT=()=>{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 ${k(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"}: ${k(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 _x(){return{localeError:RT()}}var OT=()=>{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 ${k(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: ${k(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 $x(){return{localeError:OT()}}var DT=()=>{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 ${k(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":""}: ${k(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 Ix(){return{localeError:DT()}}var NT=()=>{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 ${k(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"}: ${k(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 Ex(){return{localeError:NT()}}var LT=()=>{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 ${k(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":""}: ${k(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 Ax(){return{localeError:LT()}}var UT=()=>{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 ${k(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"}: ${k(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 Px(){return{localeError:UT()}}var jT=()=>{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 ${k(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":""}: ${k(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 Cx(){return{localeError:jT()}}var zT=()=>{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 ${k(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":""}: ${k(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 Tx(){return{localeError:zT()}}var FT=()=>{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 ${k(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: ${k(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 Rx(){return{localeError:FT()}}function Ox(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 MT=()=>{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 ${k(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=Ox(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=Ox(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":""}: ${k(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 Dx(){return{localeError:MT()}}var BT=()=>{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 ${k(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"}: ${k(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 Nx(){return{localeError:BT()}}var HT=()=>{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 ${k(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"}: ${k(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 Lx(){return{localeError:HT()}}var ZT=()=>{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 ${k(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":""}: ${k(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 Ux(){return{localeError:ZT()}}var GT=()=>{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 ${k(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: ${k(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 jx(){return{localeError:GT()}}var WT=()=>{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: ${k(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":""}: ${k(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 zx(){return{localeError:WT()}}var VT=()=>{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 ${k(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":""}: ${k(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:VT()}}function Fx(){return Ma()}var qT=()=>{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: ${k(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":""}: ${k(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 Mx(){return{localeError:qT()}}var JT=()=>{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 ${k(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":""}: ${k(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 Bx(){return{localeError:JT()}}var KT=()=>{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 ${k(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: ${k(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 Hx(){return{localeError:KT()}}var XT=()=>{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 ${k(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): ${k(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 Zx(){return{localeError:XT()}}var YT=()=>{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 ${k(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${k(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 Gx(){return{localeError:YT()}}var QT=()=>{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 ${k(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: ${k(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 Wx(){return{localeError:QT()}}var Vx,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}(Vx=globalThis).__zod_globalRegistry??(Vx.__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 t1(e,t,r){return new e({type:"union",options:t,...R(r)})}function n1(e,t,r){return new e({type:"union",options:t,inclusive:!1,...R(r)})}function r1(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...R(o)})}function o1(e,t,r){return new e({type:"intersection",left:t,right:r})}function i1(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 s1(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...R(o)})}function a1(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...R(o)})}function c1(e,t,r){return new e({type:"set",valueType:t,...R(r)})}function l1(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 u1(e,t,r){return new e({type:"enum",entries:t,...R(r)})}function d1(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 p1(e,t){return new e({type:"transform",transform:t})}function m1(e,t){return new e({type:"optional",innerType:t})}function f1(e,t){return new e({type:"nullable",innerType:t})}function g1(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Gu(r)}})}function h1(e,t,r){return new e({type:"nonoptional",innerType:t,...R(r)})}function v1(e,t){return new e({type:"success",innerType:t})}function y1(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}function b1(e,t,r){return new e({type:"pipe",in:t,out:r})}function x1(e,t){return new e({type:"readonly",innerType:t})}function k1(e,t,r){return new e({type:"template_literal",parts:t,...R(r)})}function w1(e,t){return new e({type:"lazy",getter:t})}function S1(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=qx(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 qx(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}),m=new l({type:"boolean",error:r.error}),p=new a({type:"pipe",in:d,out:m,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:p,continue:!1}),{})}),reverseTransform:((f,g)=>f===!0?o[0]||"true":n[0]||"false"),error:r.error});return p}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 p=s.schema,f=t.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,p,d)}let m=e._zod.parent;m&&(s.ref||(s.ref=m),pe(m,t,d),t.seen.get(m).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 m=e.external.registry.get(s[0])?.id,p=e.external.uri??(g=>g);if(m)return{ref:p(m)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${p("__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 m in d)delete d[m];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
236
 
237
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function jn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=s=>{let l=e.seen.get(s);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),s._zod.parent===p)for(let k in u)k==="$ref"||k==="allOf"||k in d||delete u[k];if(g.$ref&&f.def)for(let k in u)k==="$ref"||k==="allOf"||k in f.def&&JSON.stringify(u[k])===JSON.stringify(f.def[k])&&delete u[k]}let m=s._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:s,jsonSchema:u,path:l.path??[]})};for(let s of[...e.seen.entries()].reverse())o(s[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 s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Object.assign(n,r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&n.id===i&&delete n.id;let a=e.external?.defs??{};for(let s of e.seen.entries()){let l=s[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,a[l.defId]=l.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?n.$defs=a:n.definitions=a);try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:ro(t,"input",e.processors),output:ro(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function Me(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 Me(o.element,r);if(o.type==="set")return Me(o.valueType,r);if(o.type==="lazy")return Me(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 Me(o.innerType,r);if(o.type==="intersection")return Me(o.left,r)||Me(o.right,r);if(o.type==="record"||o.type==="map")return Me(o.keyType,r)||Me(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Me(o.in,r)||Me(o.out,r);if(o.type==="object"){for(let n in o.shape)if(Me(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(Me(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(Me(n,r))return!0;return!!(o.rest&&Me(o.rest,r))}return!1}var om=(e,t={})=>r=>{let o=Un({...r,processors:t});return oe(e,o),zn(o,e),jn(o,e)},ro=(e,t,r={})=>o=>{let{libraryOptions:n,target:i}=o??{},a=Un({...n??{},target:i,io:t,processors:r});return oe(e,a),zn(a,e),jn(a,e)};var FC={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},im=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:a,format:s,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(n.minLength=i),typeof a=="number"&&(n.maxLength=a),s&&(n.format=FC[s]??s,n.format===""&&delete n.format,s==="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}))])}},am=(e,t,r,o)=>{let n=r,{minimum:i,maximum:a,format:s,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof s=="string"&&s.includes("int")?n.type="integer":n.type="number";let p=typeof d=="number"&&d>=(i??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(a??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 a=="number"&&(n.maximum=a),typeof l=="number"&&(n.multipleOf=l)},sm=(e,t,r,o)=>{r.type="boolean"},cm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},lm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},um=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},dm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},pm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},mm=(e,t,r,o)=>{r.not={}},fm=(e,t,r,o)=>{},gm=(e,t,r,o)=>{},hm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},vm=(e,t,r,o)=>{let n=e._zod.def,i=Qo(n.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},ym=(e,t,r,o)=>{let n=e._zod.def,i=[];for(let a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},bm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},xm=(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},km=(e,t,r,o)=>{let n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:l}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),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)},wm=(e,t,r,o)=>{r.type="boolean"},Sm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},_m=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},$m=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Im=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Am=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Em=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(n.minItems=a),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=oe(i.element,t,{...o,path:[...o.path,"items"]})},Pm=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object",n.properties={};let a=i.shape;for(let u in a)n.properties[u]=oe(a[u],t,{...o,path:[...o.path,"properties",u]});let s=new Set(Object.keys(a)),l=new Set([...s].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=oe(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Us=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,a=n.options.map((s,l)=>oe(s,t,{...o,path:[...o.path,i?"oneOf":"anyOf",l]}));i?r.oneOf=a:r.anyOf=a},Cm=(e,t,r,o)=>{let n=e._zod.def,i=oe(n.left,t,{...o,path:[...o.path,"allOf",0]}),a=oe(n.right,t,{...o,path:[...o.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,l=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=l},Tm=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((m,f)=>oe(m,t,{...o,path:[...o.path,a,f]})),u=i.rest?oe(i.rest,t,{...o,path:[...o.path,s,...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)},Rm=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let a=i.keyType,l=a._zod.bag?.patterns;if(i.mode==="loose"&&l&&l.size>0){let d=oe(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=oe(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=oe(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let u=a._zod.values;if(u){let d=[...u].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(n.required=d)}},Om=(e,t,r,o)=>{let n=e._zod.def,i=oe(n.innerType,t,o),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Dm=(e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Nm=(e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Lm=(e,t,r,o)=>{let n=e._zod.def;oe(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)))},Um=(e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},zm=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?n.out:n.in:n.out;oe(a,t,o);let s=t.seen.get(e);s.ref=a},jm=(e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},Fm=(e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},zs=(e,t,r,o)=>{let n=e._zod.def;oe(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Mm=(e,t,r,o)=>{let n=e._zod.innerType;oe(n,t,o);let i=t.seen.get(e);i.ref=n},Ls={string:im,number:am,boolean:sm,bigint:cm,symbol:lm,null:um,undefined:dm,void:pm,never:mm,any:fm,unknown:gm,date:hm,enum:vm,literal:ym,nan:bm,template_literal:xm,file:km,success:wm,custom:Sm,function:_m,transform:$m,map:Im,set:Am,array:Em,object:Pm,union:Us,intersection:Cm,tuple:Tm,record:Rm,nullable:Om,nonoptional:Dm,default:Nm,prefault:Lm,catch:Um,pipe:zm,readonly:jm,promise:Fm,optional:zs,lazy:Mm};function js(e,t){if("_idmap"in e){let o=e,n=Un({...t,processors:Ls}),i={};for(let l of o._idmap.entries()){let[u,d]=l;oe(d,n)}let a={},s={registry:o,uri:t?.uri,defs:i};n.external=s;for(let l of o._idmap.entries()){let[u,d]=l;zn(n,d),a[u]=jn(n,d)}if(Object.keys(i).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:i}}return{schemas:a}}let r=Un({...t,processors:Ls});return oe(e,r),zn(r,e),jn(r,e)}var Fs=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=Un({processors:Ls,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 oe(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)),zn(this.ctx,t);let o=jn(this.ctx,t),{"~standard":n,...i}=o;return i}};var Jb={};var vi={};Jt(vi,{ZodAny:()=>pf,ZodArray:()=>hf,ZodBase64:()=>sc,ZodBase64URL:()=>cc,ZodBigInt:()=>po,ZodBigIntFormat:()=>dc,ZodBoolean:()=>uo,ZodCIDRv4:()=>ic,ZodCIDRv6:()=>ac,ZodCUID:()=>Ys,ZodCUID2:()=>Qs,ZodCatch:()=>zf,ZodCodec:()=>Pi,ZodCustom:()=>Ci,ZodCustomStringFormat:()=>co,ZodDate:()=>_i,ZodDefault:()=>Rf,ZodDiscriminatedUnion:()=>yf,ZodE164:()=>lc,ZodEmail:()=>qs,ZodEmoji:()=>Ks,ZodEnum:()=>ao,ZodExactOptional:()=>Pf,ZodFile:()=>Af,ZodFunction:()=>Jf,ZodGUID:()=>bi,ZodIPv4:()=>rc,ZodIPv6:()=>oc,ZodIntersection:()=>bf,ZodJWT:()=>uc,ZodKSUID:()=>nc,ZodLazy:()=>Gf,ZodLiteral:()=>If,ZodMAC:()=>of,ZodMap:()=>_f,ZodNaN:()=>Ff,ZodNanoID:()=>Xs,ZodNever:()=>ff,ZodNonOptional:()=>vc,ZodNull:()=>uf,ZodNullable:()=>Tf,ZodNumber:()=>lo,ZodNumberFormat:()=>ir,ZodObject:()=>Ii,ZodOptional:()=>hc,ZodPipe:()=>Ei,ZodPrefault:()=>Df,ZodPreprocess:()=>Mf,ZodPromise:()=>Vf,ZodReadonly:()=>Bf,ZodRecord:()=>io,ZodSet:()=>$f,ZodString:()=>so,ZodStringFormat:()=>ce,ZodSuccess:()=>Uf,ZodSymbol:()=>cf,ZodTemplateLiteral:()=>Zf,ZodTransform:()=>Ef,ZodTuple:()=>kf,ZodType:()=>B,ZodULID:()=>ec,ZodURL:()=>Si,ZodUUID:()=>Ut,ZodUndefined:()=>lf,ZodUnion:()=>Ai,ZodUnknown:()=>mf,ZodVoid:()=>gf,ZodXID:()=>tc,ZodXor:()=>vf,_ZodString:()=>Js,_default:()=>Of,_function:()=>rk,any:()=>Dx,array:()=>$i,base64:()=>vx,base64url:()=>yx,bigint:()=>Px,boolean:()=>sf,catch:()=>jf,check:()=>ok,cidrv4:()=>gx,cidrv6:()=>hx,codec:()=>Qx,cuid:()=>sx,cuid2:()=>cx,custom:()=>ik,date:()=>Lx,describe:()=>ak,discriminatedUnion:()=>Bx,e164:()=>bx,email:()=>Xb,emoji:()=>ix,enum:()=>fc,exactOptional:()=>Cf,file:()=>qx,float32:()=>$x,float64:()=>Ix,function:()=>rk,guid:()=>Yb,hash:()=>_x,hex:()=>Sx,hostname:()=>wx,httpUrl:()=>ox,instanceof:()=>ck,int:()=>Ws,int32:()=>Ax,int64:()=>Cx,intersection:()=>xf,invertCodec:()=>ek,ipv4:()=>px,ipv6:()=>fx,json:()=>uk,jwt:()=>xx,keyof:()=>Ux,ksuid:()=>dx,lazy:()=>Wf,literal:()=>Jx,looseObject:()=>Fx,looseRecord:()=>Zx,mac:()=>mx,map:()=>Gx,meta:()=>sk,nan:()=>Yx,nanoid:()=>ax,nativeEnum:()=>Vx,never:()=>pc,nonoptional:()=>Lf,null:()=>df,nullable:()=>ki,nullish:()=>Kx,number:()=>af,object:()=>zx,optional:()=>xi,partialRecord:()=>Hx,pipe:()=>Vs,prefault:()=>Nf,preprocess:()=>dk,promise:()=>nk,readonly:()=>Hf,record:()=>Sf,refine:()=>qf,set:()=>Wx,strictObject:()=>jx,string:()=>yi,stringFormat:()=>kx,stringbool:()=>lk,success:()=>Xx,superRefine:()=>Kf,symbol:()=>Rx,templateLiteral:()=>tk,transform:()=>gc,tuple:()=>wf,uint32:()=>Ex,uint64:()=>Tx,ulid:()=>lx,undefined:()=>Ox,union:()=>mc,unknown:()=>or,url:()=>rx,uuid:()=>Qb,uuidv4:()=>ex,uuidv6:()=>tx,uuidv7:()=>nx,void:()=>Nx,xid:()=>ux,xor:()=>Mx});var Ms={};Jt(Ms,{endsWith:()=>qr,gt:()=>Nt,gte:()=>Fe,includes:()=>Vr,length:()=>rr,lowercase:()=>Gr,lt:()=>Dt,lte:()=>ot,maxLength:()=>nr,maxSize:()=>Ln,mime:()=>Kr,minLength:()=>nn,minSize:()=>Lt,multipleOf:()=>Nn,negative:()=>Rs,nonnegative:()=>Ds,nonpositive:()=>Os,normalize:()=>Xr,overwrite:()=>St,positive:()=>Ts,property:()=>Ns,regex:()=>Zr,size:()=>tr,slugify:()=>to,startsWith:()=>Jr,toLowerCase:()=>Qr,toUpperCase:()=>eo,trim:()=>Yr,uppercase:()=>Wr});var oo={};Jt(oo,{ZodISODate:()=>Hs,ZodISODateTime:()=>Bs,ZodISODuration:()=>Gs,ZodISOTime:()=>Zs,date:()=>Hm,datetime:()=>Bm,duration:()=>Gm,time:()=>Zm});var Bs=v("ZodISODateTime",(e,t)=>{bd.init(e,t),ce.init(e,t)});function Bm(e){return Sp(Bs,e)}var Hs=v("ZodISODate",(e,t)=>{xd.init(e,t),ce.init(e,t)});function Hm(e){return _p(Hs,e)}var Zs=v("ZodISOTime",(e,t)=>{kd.init(e,t),ce.init(e,t)});function Zm(e){return $p(Zs,e)}var Gs=v("ZodISODuration",(e,t)=>{wd.init(e,t),ce.init(e,t)});function Gm(e){return Ip(Gs,e)}var qb=(e,t)=>{oi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>ai(e,r)},flatten:{value:r=>ii(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Nr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Nr,2)}},isEmpty:{get(){return e.issues.length===0}}})},BC=v("ZodError",qb),Xe=v("ZodError",qb,{Parent:Error});var Wm=zr(Xe),Vm=jr(Xe),Jm=Fr(Xe),qm=Mr(Xe),Km=ja(Xe),Xm=Fa(Xe),Ym=Ma(Xe),Qm=Ba(Xe),ef=Ha(Xe),tf=Za(Xe),nf=Ga(Xe),rf=Wa(Xe);var Kb=new WeakMap;function wi(e,t,r){let o=Object.getPrototypeOf(e),n=Kb.get(o);if(n||(n=new Set,Kb.set(o,n)),!n.has(t)){n.add(t);for(let i in r){let a=r[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){let s=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s}),s},set(s){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s})}})}}}var B=v("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ro(e,"input"),output:ro(e,"output")}}),e.toJSONSchema=om(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Wm(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Jm(e,r,o),e.parseAsync=async(r,o)=>Vm(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>qm(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Km(e,r,o),e.decode=(r,o)=>Xm(e,r,o),e.encodeAsync=async(r,o)=>Ym(e,r,o),e.decodeAsync=async(r,o)=>Qm(e,r,o),e.safeEncode=(r,o)=>ef(e,r,o),e.safeDecode=(r,o)=>tf(e,r,o),e.safeEncodeAsync=async(r,o)=>nf(e,r,o),e.safeDecodeAsync=async(r,o)=>rf(e,r,o),wi(e,"ZodType",{check(...r){let o=this.def;return this.clone($.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(qf(r,o))},superRefine(r,o){return this.check(Kf(r,o))},overwrite(r){return this.check(St(r))},optional(){return xi(this)},exactOptional(){return Cf(this)},nullable(){return ki(this)},nullish(){return xi(ki(this))},nonoptional(r){return Lf(this,r)},array(){return $i(this)},or(r){return mc([this,r])},and(r){return xf(this,r)},transform(r){return Vs(this,gc(r))},default(r){return Of(this,r)},prefault(r){return Nf(this,r)},catch(r){return jf(this,r)},pipe(r){return Vs(this,r)},readonly(){return Hf(this)},describe(r){let o=this.clone();return Ce.add(o,{description:r}),o},meta(...r){if(r.length===0)return Ce.get(this);let o=this.clone();return Ce.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 Ce.get(e)?.description},configurable:!0}),e)),Js=v("_ZodString",(e,t)=>{er.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,i)=>im(e,o,n,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,wi(e,"_ZodString",{regex(...o){return this.check(Zr(...o))},includes(...o){return this.check(Vr(...o))},startsWith(...o){return this.check(Jr(...o))},endsWith(...o){return this.check(qr(...o))},min(...o){return this.check(nn(...o))},max(...o){return this.check(nr(...o))},length(...o){return this.check(rr(...o))},nonempty(...o){return this.check(nn(1,...o))},lowercase(o){return this.check(Gr(o))},uppercase(o){return this.check(Wr(o))},trim(){return this.check(Yr())},normalize(...o){return this.check(Xr(...o))},toLowerCase(){return this.check(Qr())},toUpperCase(){return this.check(eo())},slugify(){return this.check(to())}})}),so=v("ZodString",(e,t)=>{er.init(e,t),Js.init(e,t),e.email=r=>e.check(ds(qs,r)),e.url=r=>e.check(hi(Si,r)),e.jwt=r=>e.check(Cs(uc,r)),e.emoji=r=>e.check(hs(Ks,r)),e.guid=r=>e.check(gi(bi,r)),e.uuid=r=>e.check(ps(Ut,r)),e.uuidv4=r=>e.check(ms(Ut,r)),e.uuidv6=r=>e.check(fs(Ut,r)),e.uuidv7=r=>e.check(gs(Ut,r)),e.nanoid=r=>e.check(vs(Xs,r)),e.guid=r=>e.check(gi(bi,r)),e.cuid=r=>e.check(ys(Ys,r)),e.cuid2=r=>e.check(bs(Qs,r)),e.ulid=r=>e.check(xs(ec,r)),e.base64=r=>e.check(As(sc,r)),e.base64url=r=>e.check(Es(cc,r)),e.xid=r=>e.check(ks(tc,r)),e.ksuid=r=>e.check(ws(nc,r)),e.ipv4=r=>e.check(Ss(rc,r)),e.ipv6=r=>e.check(_s(oc,r)),e.cidrv4=r=>e.check($s(ic,r)),e.cidrv6=r=>e.check(Is(ac,r)),e.e164=r=>e.check(Ps(lc,r)),e.datetime=r=>e.check(Bm(r)),e.date=r=>e.check(Hm(r)),e.time=r=>e.check(Zm(r)),e.duration=r=>e.check(Gm(r))});function yi(e){return bp(so,e)}var ce=v("ZodStringFormat",(e,t)=>{se.init(e,t),Js.init(e,t)}),qs=v("ZodEmail",(e,t)=>{ud.init(e,t),ce.init(e,t)});function Xb(e){return ds(qs,e)}var bi=v("ZodGUID",(e,t)=>{cd.init(e,t),ce.init(e,t)});function Yb(e){return gi(bi,e)}var Ut=v("ZodUUID",(e,t)=>{ld.init(e,t),ce.init(e,t)});function Qb(e){return ps(Ut,e)}function ex(e){return ms(Ut,e)}function tx(e){return fs(Ut,e)}function nx(e){return gs(Ut,e)}var Si=v("ZodURL",(e,t)=>{dd.init(e,t),ce.init(e,t)});function rx(e){return hi(Si,e)}function ox(e){return hi(Si,{protocol:rt.httpProtocol,hostname:rt.domain,...$.normalizeParams(e)})}var Ks=v("ZodEmoji",(e,t)=>{pd.init(e,t),ce.init(e,t)});function ix(e){return hs(Ks,e)}var Xs=v("ZodNanoID",(e,t)=>{md.init(e,t),ce.init(e,t)});function ax(e){return vs(Xs,e)}var Ys=v("ZodCUID",(e,t)=>{fd.init(e,t),ce.init(e,t)});function sx(e){return ys(Ys,e)}var Qs=v("ZodCUID2",(e,t)=>{gd.init(e,t),ce.init(e,t)});function cx(e){return bs(Qs,e)}var ec=v("ZodULID",(e,t)=>{hd.init(e,t),ce.init(e,t)});function lx(e){return xs(ec,e)}var tc=v("ZodXID",(e,t)=>{vd.init(e,t),ce.init(e,t)});function ux(e){return ks(tc,e)}var nc=v("ZodKSUID",(e,t)=>{yd.init(e,t),ce.init(e,t)});function dx(e){return ws(nc,e)}var rc=v("ZodIPv4",(e,t)=>{Sd.init(e,t),ce.init(e,t)});function px(e){return Ss(rc,e)}var of=v("ZodMAC",(e,t)=>{$d.init(e,t),ce.init(e,t)});function mx(e){return kp(of,e)}var oc=v("ZodIPv6",(e,t)=>{_d.init(e,t),ce.init(e,t)});function fx(e){return _s(oc,e)}var ic=v("ZodCIDRv4",(e,t)=>{Id.init(e,t),ce.init(e,t)});function gx(e){return $s(ic,e)}var ac=v("ZodCIDRv6",(e,t)=>{Ad.init(e,t),ce.init(e,t)});function hx(e){return Is(ac,e)}var sc=v("ZodBase64",(e,t)=>{Pd.init(e,t),ce.init(e,t)});function vx(e){return As(sc,e)}var cc=v("ZodBase64URL",(e,t)=>{Cd.init(e,t),ce.init(e,t)});function yx(e){return Es(cc,e)}var lc=v("ZodE164",(e,t)=>{Td.init(e,t),ce.init(e,t)});function bx(e){return Ps(lc,e)}var uc=v("ZodJWT",(e,t)=>{Rd.init(e,t),ce.init(e,t)});function xx(e){return Cs(uc,e)}var co=v("ZodCustomStringFormat",(e,t)=>{Od.init(e,t),ce.init(e,t)});function kx(e,t,r={}){return no(co,e,t,r)}function wx(e){return no(co,"hostname",rt.hostname,e)}function Sx(e){return no(co,"hex",rt.hex,e)}function _x(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=rt[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return no(co,o,n,t)}var lo=v("ZodNumber",(e,t)=>{ts.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,i)=>am(e,o,n,i),wi(e,"ZodNumber",{gt(o,n){return this.check(Nt(o,n))},gte(o,n){return this.check(Fe(o,n))},min(o,n){return this.check(Fe(o,n))},lt(o,n){return this.check(Dt(o,n))},lte(o,n){return this.check(ot(o,n))},max(o,n){return this.check(ot(o,n))},int(o){return this.check(Ws(o))},safe(o){return this.check(Ws(o))},positive(o){return this.check(Nt(0,o))},nonnegative(o){return this.check(Fe(0,o))},negative(o){return this.check(Dt(0,o))},nonpositive(o){return this.check(ot(0,o))},multipleOf(o,n){return this.check(Nn(o,n))},step(o,n){return this.check(Nn(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 af(e){return Ap(lo,e)}var ir=v("ZodNumberFormat",(e,t)=>{Dd.init(e,t),lo.init(e,t)});function Ws(e){return Pp(ir,e)}function $x(e){return Cp(ir,e)}function Ix(e){return Tp(ir,e)}function Ax(e){return Rp(ir,e)}function Ex(e){return Op(ir,e)}var uo=v("ZodBoolean",(e,t)=>{ui.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sm(e,r,o,n)});function sf(e){return Dp(uo,e)}var po=v("ZodBigInt",(e,t)=>{ns.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,i)=>cm(e,o,n,i),e.gte=(o,n)=>e.check(Fe(o,n)),e.min=(o,n)=>e.check(Fe(o,n)),e.gt=(o,n)=>e.check(Nt(o,n)),e.gte=(o,n)=>e.check(Fe(o,n)),e.min=(o,n)=>e.check(Fe(o,n)),e.lt=(o,n)=>e.check(Dt(o,n)),e.lte=(o,n)=>e.check(ot(o,n)),e.max=(o,n)=>e.check(ot(o,n)),e.positive=o=>e.check(Nt(BigInt(0),o)),e.negative=o=>e.check(Dt(BigInt(0),o)),e.nonpositive=o=>e.check(ot(BigInt(0),o)),e.nonnegative=o=>e.check(Fe(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Nn(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Px(e){return Lp(po,e)}var dc=v("ZodBigIntFormat",(e,t)=>{Nd.init(e,t),po.init(e,t)});function Cx(e){return zp(dc,e)}function Tx(e){return jp(dc,e)}var cf=v("ZodSymbol",(e,t)=>{Ld.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lm(e,r,o,n)});function Rx(e){return Fp(cf,e)}var lf=v("ZodUndefined",(e,t)=>{Ud.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dm(e,r,o,n)});function Ox(e){return Mp(lf,e)}var uf=v("ZodNull",(e,t)=>{zd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>um(e,r,o,n)});function df(e){return Bp(uf,e)}var pf=v("ZodAny",(e,t)=>{jd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fm(e,r,o,n)});function Dx(){return Hp(pf)}var mf=v("ZodUnknown",(e,t)=>{Fd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gm(e,r,o,n)});function or(){return Zp(mf)}var ff=v("ZodNever",(e,t)=>{Md.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mm(e,r,o,n)});function pc(e){return Gp(ff,e)}var gf=v("ZodVoid",(e,t)=>{Bd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pm(e,r,o,n)});function Nx(e){return Wp(gf,e)}var _i=v("ZodDate",(e,t)=>{Hd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,i)=>hm(e,o,n,i),e.min=(o,n)=>e.check(Fe(o,n)),e.max=(o,n)=>e.check(ot(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 Lx(e){return Vp(_i,e)}var hf=v("ZodArray",(e,t)=>{Zd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Em(e,r,o,n),e.element=t.element,wi(e,"ZodArray",{min(r,o){return this.check(nn(r,o))},nonempty(r){return this.check(nn(1,r))},max(r,o){return this.check(nr(r,o))},length(r,o){return this.check(rr(r,o))},unwrap(){return this.element}})});function $i(e,t){return Kp(hf,e,t)}function Ux(e){let t=e._zod.def.shape;return fc(Object.keys(t))}var Ii=v("ZodObject",(e,t)=>{Gd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pm(e,r,o,n),$.defineLazy(e,"shape",()=>t.shape),wi(e,"ZodObject",{keyof(){return fc(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},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:pc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return $.extend(this,r)},safeExtend(r){return $.safeExtend(this,r)},merge(r){return $.merge(this,r)},pick(r){return $.pick(this,r)},omit(r){return $.omit(this,r)},partial(...r){return $.partial(hc,this,r[0])},required(...r){return $.required(vc,this,r[0])}})});function zx(e,t){let r={type:"object",shape:e??{},...$.normalizeParams(t)};return new Ii(r)}function jx(e,t){return new Ii({type:"object",shape:e,catchall:pc(),...$.normalizeParams(t)})}function Fx(e,t){return new Ii({type:"object",shape:e,catchall:or(),...$.normalizeParams(t)})}var Ai=v("ZodUnion",(e,t)=>{di.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Us(e,r,o,n),e.options=t.options});function mc(e,t){return new Ai({type:"union",options:e,...$.normalizeParams(t)})}var vf=v("ZodXor",(e,t)=>{Ai.init(e,t),Wd.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Us(e,r,o,n),e.options=t.options});function Mx(e,t){return new vf({type:"union",options:e,inclusive:!1,...$.normalizeParams(t)})}var yf=v("ZodDiscriminatedUnion",(e,t)=>{Ai.init(e,t),Vd.init(e,t)});function Bx(e,t,r){return new yf({type:"union",options:t,discriminator:e,...$.normalizeParams(r)})}var bf=v("ZodIntersection",(e,t)=>{Jd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cm(e,r,o,n)});function xf(e,t){return new bf({type:"intersection",left:e,right:t})}var kf=v("ZodTuple",(e,t)=>{rs.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tm(e,r,o,n),e.rest=r=>e.clone({...e._zod.def,rest:r})});function wf(e,t,r){let o=t instanceof F,n=o?r:t,i=o?t:null;return new kf({type:"tuple",items:e,rest:i,...$.normalizeParams(n)})}var io=v("ZodRecord",(e,t)=>{qd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rm(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function Sf(e,t,r){return!t||!t._zod?new io({type:"record",keyType:yi(),valueType:e,...$.normalizeParams(t)}):new io({type:"record",keyType:e,valueType:t,...$.normalizeParams(r)})}function Hx(e,t,r){let o=ze(e);return o._zod.values=void 0,new io({type:"record",keyType:o,valueType:t,...$.normalizeParams(r)})}function Zx(e,t,r){return new io({type:"record",keyType:e,valueType:t,mode:"loose",...$.normalizeParams(r)})}var _f=v("ZodMap",(e,t)=>{Kd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Im(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Lt(...r)),e.nonempty=r=>e.check(Lt(1,r)),e.max=(...r)=>e.check(Ln(...r)),e.size=(...r)=>e.check(tr(...r))});function Gx(e,t,r){return new _f({type:"map",keyType:e,valueType:t,...$.normalizeParams(r)})}var $f=v("ZodSet",(e,t)=>{Xd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Am(e,r,o,n),e.min=(...r)=>e.check(Lt(...r)),e.nonempty=r=>e.check(Lt(1,r)),e.max=(...r)=>e.check(Ln(...r)),e.size=(...r)=>e.check(tr(...r))});function Wx(e,t){return new $f({type:"set",valueType:e,...$.normalizeParams(t)})}var ao=v("ZodEnum",(e,t)=>{Yd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,i)=>vm(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 a of o)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ao({...t,checks:[],...$.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let a of o)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ao({...t,checks:[],...$.normalizeParams(n),entries:i})}});function fc(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new ao({type:"enum",entries:r,...$.normalizeParams(t)})}function Vx(e,t){return new ao({type:"enum",entries:e,...$.normalizeParams(t)})}var If=v("ZodLiteral",(e,t)=>{Qd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ym(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 Jx(e,t){return new If({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(t)})}var Af=v("ZodFile",(e,t)=>{ep.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>km(e,r,o,n),e.min=(r,o)=>e.check(Lt(r,o)),e.max=(r,o)=>e.check(Ln(r,o)),e.mime=(r,o)=>e.check(Kr(Array.isArray(r)?r:[r],o))});function qx(e){return Xp(Af,e)}var Ef=v("ZodTransform",(e,t)=>{tp.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$m(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Cn(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push($.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push($.issue(a))}};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 gc(e){return new Ef({type:"transform",transform:e})}var hc=v("ZodOptional",(e,t)=>{os.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function xi(e){return new hc({type:"optional",innerType:e})}var Pf=v("ZodExactOptional",(e,t)=>{np.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Cf(e){return new Pf({type:"optional",innerType:e})}var Tf=v("ZodNullable",(e,t)=>{rp.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Om(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ki(e){return new Tf({type:"nullable",innerType:e})}function Kx(e){return xi(ki(e))}var Rf=v("ZodDefault",(e,t)=>{op.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Nm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Of(e,t){return new Rf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var Df=v("ZodPrefault",(e,t)=>{ip.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Lm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Nf(e,t){return new Df({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var vc=v("ZodNonOptional",(e,t)=>{ap.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Dm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Lf(e,t){return new vc({type:"nonoptional",innerType:e,...$.normalizeParams(t)})}var Uf=v("ZodSuccess",(e,t)=>{sp.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Xx(e){return new Uf({type:"success",innerType:e})}var zf=v("ZodCatch",(e,t)=>{cp.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Um(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jf(e,t){return new zf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Ff=v("ZodNaN",(e,t)=>{lp.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bm(e,r,o,n)});function Yx(e){return qp(Ff,e)}var Ei=v("ZodPipe",(e,t)=>{is.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zm(e,r,o,n),e.in=t.in,e.out=t.out});function Vs(e,t){return new Ei({type:"pipe",in:e,out:t})}var Pi=v("ZodCodec",(e,t)=>{Ei.init(e,t),pi.init(e,t)});function Qx(e,t,r){return new Pi({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function ek(e){let t=e._zod.def;return new Pi({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Mf=v("ZodPreprocess",(e,t)=>{Ei.init(e,t),up.init(e,t)}),Bf=v("ZodReadonly",(e,t)=>{dp.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Hf(e){return new Bf({type:"readonly",innerType:e})}var Zf=v("ZodTemplateLiteral",(e,t)=>{pp.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xm(e,r,o,n)});function tk(e,t){return new Zf({type:"template_literal",parts:e,...$.normalizeParams(t)})}var Gf=v("ZodLazy",(e,t)=>{gp.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mm(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function Wf(e){return new Gf({type:"lazy",getter:e})}var Vf=v("ZodPromise",(e,t)=>{fp.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function nk(e){return new Vf({type:"promise",innerType:e})}var Jf=v("ZodFunction",(e,t)=>{mp.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_m(e,r,o,n)});function rk(e){return new Jf({type:"function",input:Array.isArray(e?.input)?wf(e?.input):e?.input??$i(or()),output:e?.output??or()})}var Ci=v("ZodCustom",(e,t)=>{hp.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sm(e,r,o,n)});function ok(e){let t=new de({check:"custom"});return t._zod.check=e,t}function ik(e,t){return Yp(Ci,e??(()=>!0),t)}function qf(e,t={}){return Qp(Ci,e,t)}function Kf(e,t){return em(e,t)}var ak=tm,sk=nm;function ck(e,t={}){let r=new Ci({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...$.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 lk=(...e)=>rm({Codec:Pi,Boolean:uo,String:so},...e);function uk(e){let t=Wf(()=>mc([yi(e),af(),sf(),df(),$i(t),Sf(yi(),t)]));return t}function dk(e,t){return new Mf({type:"pipe",in:gc(e),out:t})}var ZC={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 GC(e){ve({customError:e})}function WC(){return ve().customError}var Xf;Xf||(Xf={});var T={...vi,...Ms,iso:oo},VC=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 JC(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 qC(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 pk(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return T.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 T.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=qC(n,t),a=Oe(i,t);return t.refs.set(n,a),t.processing.delete(n),a}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 T.null();if(n.length===0)return T.never();if(n.length===1)return T.literal(n[0]);if(n.every(a=>typeof a=="string"))return T.enum(n);let i=n.map(a=>T.literal(a));return i.length<2?i[0]:T.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return T.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(i=>{let a={...e,type:i};return pk(a,t)});return n.length===0?T.never():n.length===1?n[0]:T.union(n)}if(!r)return T.any();let o;switch(r){case"string":{let n=T.string();if(e.format){let i=e.format;i==="email"?n=n.check(T.email()):i==="uri"||i==="uri-reference"?n=n.check(T.url()):i==="uuid"||i==="guid"?n=n.check(T.uuid()):i==="date-time"?n=n.check(T.iso.datetime()):i==="date"?n=n.check(T.iso.date()):i==="time"?n=n.check(T.iso.time()):i==="duration"?n=n.check(T.iso.duration()):i==="ipv4"?n=n.check(T.ipv4()):i==="ipv6"?n=n.check(T.ipv6()):i==="mac"?n=n.check(T.mac()):i==="cidr"?n=n.check(T.cidrv4()):i==="cidr-v6"?n=n.check(T.cidrv6()):i==="base64"?n=n.check(T.base64()):i==="base64url"?n=n.check(T.base64url()):i==="e164"?n=n.check(T.e164()):i==="jwt"?n=n.check(T.jwt()):i==="emoji"?n=n.check(T.emoji()):i==="nanoid"?n=n.check(T.nanoid()):i==="cuid"?n=n.check(T.cuid()):i==="cuid2"?n=n.check(T.cuid2()):i==="ulid"?n=n.check(T.ulid()):i==="xid"?n=n.check(T.xid()):i==="ksuid"&&(n=n.check(T.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"?T.number().int():T.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=T.boolean();break}case"null":{o=T.null();break}case"object":{let n={},i=e.properties||{},a=new Set(e.required||[]);for(let[l,u]of Object.entries(i)){let d=Oe(u,t);n[l]=a.has(l)?d:d.optional()}if(e.propertyNames){let l=Oe(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties=="object"?Oe(e.additionalProperties,t):T.any();if(Object.keys(n).length===0){o=T.record(l,u);break}let d=T.object(n).passthrough(),p=T.looseRecord(l,u);o=T.intersection(d,p);break}if(e.patternProperties){let l=e.patternProperties,u=Object.keys(l),d=[];for(let m of u){let f=Oe(l[m],t),g=T.string().regex(new RegExp(m));d.push(T.looseRecord(g,f))}let p=[];if(Object.keys(n).length>0&&p.push(T.object(n).passthrough()),p.push(...d),p.length===0)o=T.object({}).passthrough();else if(p.length===1)o=p[0];else{let m=T.intersection(p[0],p[1]);for(let f=2;f<p.length;f++)m=T.intersection(m,p[f]);o=m}break}let s=T.object(n);e.additionalProperties===!1?o=s.strict():typeof e.additionalProperties=="object"?o=s.catchall(Oe(e.additionalProperties,t)):o=s.passthrough();break}case"array":{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let a=n.map(l=>Oe(l,t)),s=i&&typeof i=="object"&&!Array.isArray(i)?Oe(i,t):void 0;s?o=T.tuple(a).rest(s):o=T.tuple(a),typeof e.minItems=="number"&&(o=o.check(T.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(T.maxLength(e.maxItems)))}else if(Array.isArray(i)){let a=i.map(l=>Oe(l,t)),s=e.additionalItems&&typeof e.additionalItems=="object"?Oe(e.additionalItems,t):void 0;s?o=T.tuple(a).rest(s):o=T.tuple(a),typeof e.minItems=="number"&&(o=o.check(T.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(T.maxLength(e.maxItems)))}else if(i!==void 0){let a=Oe(i,t),s=T.array(a);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),o=s}else o=T.array(T.any());break}default:throw new Error(`Unsupported type: ${r}`)}return o}function Oe(e,t){if(typeof e=="boolean")return e?T.any():T.never();let r=pk(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(u=>Oe(u,t)),l=T.union(s);r=o?T.intersection(r,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(u=>Oe(u,t)),l=T.xor(s);r=o?T.intersection(r,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:T.any();else{let s=o?r:Oe(e.allOf[0],t),l=o?0:1;for(let u=l;u<e.allOf.length;u++)s=T.intersection(s,Oe(e.allOf[u],t));r=s}e.nullable===!0&&t.version==="openapi-3.0"&&(r=T.nullable(r)),e.readOnly===!0&&(r=T.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of i)s in e&&(n[s]=e[s]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let s of a)s in e&&(n[s]=e[s]);for(let s of Object.keys(e))VC.has(s)||(n[s]=e[s]);return Object.keys(n).length>0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function mk(e,t){if(typeof e=="boolean")return e?T.any():T.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=JC(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Ce};return Oe(r,i)}var Yf={};Jt(Yf,{bigint:()=>QC,boolean:()=>YC,date:()=>eT,number:()=>XC,string:()=>KC});function KC(e){return xp(so,e)}function XC(e){return Ep(lo,e)}function YC(e){return Np(uo,e)}function QC(e){return Up(po,e)}function eT(e){return Jp(_i,e)}ve(as());var ie=c.number().min(0).max(100),ar=c.number().int().min(1e3).max(12e3),sn=c.number(),H=c.number().int().nonnegative(),_t=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"]),tT=c.enum(["local","cloud","offline","unknown"]),Ti=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"]),nT=c.enum(["temperature","humidity","illuminance","pressure","co2","pm25","pm10","voc","airQuality","noise","uvIndex","windSpeed","distance","generic"]),rT=c.enum(["motion","occupancy","presence","contact","leak","smoke","co","gas","tamper","vibration","glassBreak","button","person","sound","moisture","generic"]);var me=(e,t)=>c.object({type:c.literal(e),instance:c.string().optional(),...t}),oT=me("power",{state:c.object({on:c.boolean().nullable()})}),iT=me("brightness",{state:c.object({level:ie.nullable()})}),aT=me("colorTemperature",{config:c.object({minKelvin:ar,maxKelvin:ar}),state:c.object({kelvin:ar.nullable()})}),sT=me("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:ie.nullable()})}),cT=me("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:ie.nullable()})).nullable()})}),tg=c.enum(["off","heat","cool","auto","eco","fanOnly","dry"]),lT=me("thermostat",{config:c.object({modes:c.array(tg),minC:sn,maxC:sn,supportsRange:c.boolean().default(!1)}),state:c.object({mode:tg.nullable(),currentC:sn.nullable(),setpointC:sn.nullable().optional(),heatC:sn.nullable().optional(),coolC:sn.nullable().optional(),action:c.enum(["idle","heating","cooling","fan"]).nullable().optional()})}),uT=me("humidity",{config:c.object({settable:c.boolean().default(!1),minPct:ie.default(0),maxPct:ie.default(100)}),state:c.object({currentPct:ie.nullable().optional(),targetPct:ie.nullable().optional()})}),dT=me("lock",{state:c.object({state:c.enum(["locked","unlocked","jammed","unknown"])})}),pT=me("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:ie.nullable().optional(),tilt:ie.nullable().optional(),state:c.enum(["open","closed","opening","closing","stopped","partial","unknown"])})}),mT=me("fan",{config:c.object({presets:c.array(c.string()).default([]),supportsOscillate:c.boolean().default(!1)}),state:c.object({on:c.boolean().nullable(),level:ie.nullable().optional(),preset:c.string().nullable().optional(),oscillating:c.boolean().nullable().optional()})}),fT=me("mode",{config:c.object({options:c.array(c.string())}),state:c.object({value:c.string().nullable()})}),gT=me("toggle",{state:c.object({on:c.boolean().nullable()})}),hT=me("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()})}),vT=me("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()})}),yT=me("volume",{state:c.object({level:ie.nullable(),muted:c.boolean().nullable()})}),bT=me("inputSource",{config:c.object({sources:c.array(c.string())}),state:c.object({source:c.string().nullable()})}),xT=me("startStop",{config:c.object({supportsPause:c.boolean().default(!1)}),state:c.object({state:c.enum(["running","paused","stopped","unknown"])})}),kT=me("scene",{state:c.object({lastActivated:H.nullable().optional()})}),wT=me("camera",{config:c.object({protocols:c.array(c.enum(["rtsp","webrtc","hls","snapshot"]))}),state:c.object({streaming:c.boolean().nullable().optional()})}),ST=me("sensor",{config:c.object({measurement:nT,unit:c.string()}),state:c.object({value:c.number().nullable(),ts:H.nullable().optional()})}),_T=me("binarySensor",{config:c.object({sensorType:rT}),state:c.object({active:c.boolean().nullable(),lastChanged:H.nullable().optional()})}),$T=me("battery",{state:c.object({level:ie.nullable(),charging:c.boolean().nullable().optional(),low:c.boolean().nullable().optional()})}),IT=me("energyMeter",{state:c.object({power:c.number().nullable().optional(),energy:c.number().nullable().optional(),voltage:c.number().nullable().optional(),current:c.number().nullable().optional()})}),AT=me("doorbell",{state:c.object({lastPress:H.nullable().optional()})}),ET=me("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()})}),fk=c.enum(["flash","strobe","pulse","colorFade","colorLoop","candle","rainbow","siren","meter"]),on=c.object({hue:c.number().min(0).max(360),saturation:ie}),an=c.number().int().min(20).max(6e5),Qf=c.number().int().min(1).max(1e3).nullable().default(null),ng=c.discriminatedUnion("kind",[c.object({kind:c.literal("flash"),count:c.number().int().min(1).max(100).default(3),onMs:an.default(300),offMs:an.default(300),color:on.nullable().default(null),brightness:ie.nullable().default(null)}),c.object({kind:c.literal("strobe"),hz:c.number().min(.5).max(25).default(8),durationMs:an.default(3e3),color:on.nullable().default(null)}),c.object({kind:c.literal("pulse"),periodMs:an.default(2e3),minPct:ie.default(5),maxPct:ie.default(100),color:on.nullable().default(null),cycles:Qf}),c.object({kind:c.literal("colorFade"),from:on.nullable().default(null),to:on,durationMs:an.default(2e3),easing:c.enum(["linear","ease"]).default("ease")}),c.object({kind:c.literal("colorLoop"),colors:c.array(on).min(2).max(16),holdMs:an.default(1e3),fadeMs:c.number().int().min(0).max(6e5).default(800),loops:Qf,direction:c.enum(["forward","pingpong"]).default("forward")}),c.object({kind:c.literal("candle"),intensity:ie.default(50),warmthKelvin:ar.nullable().default(null),durationMs:an.nullable().default(null)}),c.object({kind:c.literal("rainbow"),cycleMs:an.default(4e3),saturation:ie.default(100),brightness:ie.default(100),loops:Qf}),c.object({kind:c.literal("siren"),colorA:on.default({hue:0,saturation:100}),colorB:on.default({hue:240,saturation:100}),hz:c.number().min(.5).max(10).default(4),durationMs:an.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:on})).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}}])})]),PT=me("effect",{config:c.object({kinds:c.array(fk).default(["flash"]),supportsColor:c.boolean().default(!1)}),state:c.object({active:fk.nullable()})}),CT=c.discriminatedUnion("type",[oT,iT,aT,sT,cT,lT,uT,dT,pT,mT,fT,gT,hT,vT,yT,bT,xT,kT,wT,ST,_T,$T,IT,AT,ET,PT]),cn=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"]),vk=c.enum(["needs-password"]),TT=c.object({sourceId:c.string(),provider:_t,providerAccountId:c.string(),nativeId:c.string(),nativeType:c.string().optional(),reachability:c.enum(["local","cloud"]),online:c.boolean(),attention:vk.nullable().optional(),credentialRef:c.string().nullable().optional(),lastSeen:H.nullable().optional()}),RT=c.object({id:c.string(),name:c.string(),providerRefs:c.array(c.object({provider:_t,nativeId:c.string()})).default([])}),OT=c.object({accountId:c.string(),provider:_t,displayName:c.string(),reachability:c.enum(["local","cloud"]),status:c.enum(["linked","needs_reauth","revoked"]),expiresAt:H.nullable().optional()}),DT=c.object({id:c.string(),type:Ti,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:tT,attention:vk.nullable().optional(),parentId:c.string().nullable().optional(),members:c.array(c.string()).optional(),sources:c.array(TT).min(1),preferredSourceId:c.string(),capabilities:c.array(CT),updatedAt:H,raw:c.unknown().optional()}),yk=c.object({version:c.literal(1),nodeId:c.string(),updatedAt:H,areas:c.array(RT),accounts:c.array(OT),devices:c.array(DT)}),NT=c.enum(["relay-do-sealed","hub-local"]),WM=c.object({accountId:c.string(),provider:_t,providerAccountId:c.string(),nodeId:c.string(),credentialLocation:NT,scopes:c.array(c.string()).default([]),status:c.enum(["linked","needs_reauth","revoked"]),displayName:c.string(),expiresAt:H.nullable().optional(),linkedAt:H}),gk=c.enum(["open","guarded","locked"]),eg=c.enum(["allow","confirm","deny"]),LT=c.enum(["voice","claude","app","rules"]),VM=c.object({tier:gk.default("open"),perConsumer:c.partialRecord(LT,gk).default({}),perClass:c.partialRecord(cn,eg).default({}),perDeviceType:c.partialRecord(Ti,eg).default({}),perDevice:c.record(c.string(),eg).default({}),confirmWindowSec:c.number().default(60)}),ye=c.object({}),hk=e=>e.type==="cover"&&(e.config.kind==="garage"||e.config.kind==="door"),rg={power:[{command:"turnOn",params:ye},{command:"turnOff",params:ye},{command:"toggle",params:ye}],brightness:[{command:"setBrightness",params:c.object({level:ie})},{command:"adjustBrightness",params:c.object({delta:c.number().min(-100).max(100)})}],colorTemperature:[{command:"setColorTemperature",params:c.object({kelvin:ar})}],color:[{command:"setColor",params:c.object({hue:c.number().min(0).max(360),saturation:ie})}],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:ie})).min(1).max(512)})}],thermostat:[{command:"setThermostatMode",params:c.object({mode:tg})},{command:"setSetpoint",params:c.object({celsius:sn})},{command:"setRange",params:c.object({heatCelsius:sn,coolCelsius:sn}),gate:e=>e.type==="thermostat"&&e.config.supportsRange}],humidity:[{command:"setHumidity",params:c.object({percent:ie}),gate:e=>e.type==="humidity"&&e.config.settable}],lock:[{command:"lock",params:ye},{command:"unlock",params:ye,confirm:!0}],cover:[{command:"open",params:ye,confirm:hk},{command:"close",params:ye},{command:"stop",params:ye},{command:"setPosition",params:c.object({position:ie}),confirm:hk,gate:e=>e.type==="cover"&&e.config.supportsPosition},{command:"setTilt",params:c.object({tilt:ie}),gate:e=>e.type==="cover"&&e.config.supportsTilt}],fan:[{command:"turnOn",params:ye},{command:"turnOff",params:ye},{command:"setFanSpeed",params:c.object({level:ie})},{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:ye},{command:"pause",params:ye},{command:"stop",params:ye},{command:"next",params:ye},{command:"previous",params:ye},{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:ie})},{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:ye},{command:"stop",params:ye},{command:"pause",params:ye,gate:e=>e.type==="startStop"&&e.config.supportsPause},{command:"resume",params:ye,gate:e=>e.type==="startStop"&&e.config.supportsPause}],scene:[{command:"activate",params:ye}],effect:[{command:"startEffect",params:c.object({spec:ng})},{command:"stopEffect",params:ye}],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:H.optional()})},{command:"getSnapshot",params:ye,voice:!1,returns:c.object({url:c.string(),expiresAt:H.optional()})}],sensor:[],binarySensor:[],battery:[],energyMeter:[],doorbell:[],connectivity:[]};var UT=c.discriminatedUnion("kind",[c.object({kind:c.literal("literal"),hue:c.number().min(0).max(360),saturation:ie}),c.object({kind:c.literal("token"),token:c.enum(["main","session"])})]),bk=c.enum(["main","session","hold","off"]),xk=c.object({color:UT.optional(),brightnessPct:ie.nullable().optional(),brightnessScale:c.number().min(0).max(2).optional(),kelvin:ar.nullable().optional(),power:c.boolean().optional()});var zT=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"]),sr=c.enum(["claude","codex"]);var jT=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:zT,repo:c.string().optional(),sessionId:c.string().optional(),agent:sr.optional()}),c.object({kind:c.literal("schedule"),cron:c.string()})]),FT=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()}),MT=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:xk.optional(),effect:ng.optional(),returnTo:bk.optional(),hold:c.boolean().default(!1)})]),tB=c.object({id:c.string(),name:c.string().default(""),enabled:c.boolean().default(!0),trigger:jT,conditions:c.array(FT).default([]),actions:c.array(MT).min(1),allowSecurity:c.boolean().default(!1)});var mo=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"]),kk=c.object({id:c.string(),name:c.string(),cwd:c.string(),online:c.boolean().default(!0),state:mo.optional(),bridgeId:c.string().optional(),bridgeName:c.string().optional(),agent:sr.optional()}),wk=c.enum(["allow","deny"]),aB=c.object({sessionId:c.string().nullable(),text:c.string(),ts:H.optional()}),yc=c.object({latestReply:c.string().nullable(),ts:c.number().nullable(),cursor:c.number().int().nonnegative(),hasMore:c.boolean()}),sB=c.object({requestId:c.string(),behavior:wk,ts:H.optional()}),cB=c.object({id:c.string(),sessionId:c.string().nullable(),args:c.unknown(),ts:H.optional()}),BT=c.object({type:c.literal("register"),userToken:c.string().optional(),sessions:c.array(kk),claudeSessionId:c.string().optional()}),HT=c.object({type:c.literal("sessions.update"),sessions:c.array(kk)}),ZT=c.object({type:c.literal("prompt"),sessionId:c.string(),requestId:c.string(),text:c.string(),ts:H.optional()});var GT=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:H.optional()}),WT=c.object({type:c.literal("permission_request"),sessionId:c.string(),requestId:c.string(),tool:c.string(),description:c.string(),preview:c.string(),ts:H.optional()}),VT=c.object({type:c.literal("permission_verdict"),sessionId:c.string(),requestId:c.string(),behavior:wk,ts:H.optional()}),JT=c.object({type:c.literal("command"),id:c.string(),requestId:c.string(),sessionId:c.string().nullable(),args:c.unknown(),ts:H.optional()}),qT=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:H.optional()}),KT=c.object({type:c.literal("devices.update"),doc:yk}),XT=c.object({type:c.literal("device_command"),requestId:c.string(),deviceId:c.string(),sourceId:c.string().nullable().optional(),ruleId:c.string().optional(),capability:cn,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()}),YT=c.object({type:c.literal("device_query"),requestId:c.string(),kind:c.enum(["list","get"]),deviceId:c.string().optional()}),QT=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()}),e1=c.object({type:c.literal("device_event"),deviceId:c.string(),capability:cn,instance:c.string().optional(),event:c.string(),payload:c.unknown().optional(),ts:H}),t1=c.object({type:c.literal("device_source_event"),provider:_t,providerAccountId:c.string(),nativeId:c.string(),patch:c.array(c.object({type:cn,instance:c.string().optional(),state:c.unknown()})).optional(),edge:c.object({capability:cn,instance:c.string().optional(),event:c.string(),payload:c.unknown().optional()}).optional(),online:c.boolean().optional(),ts:H}),n1=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:H}),r1=c.object({type:c.literal("device_config"),version:c.number().int().nonnegative(),config:c.record(c.string(),c.unknown()),ts:H}),o1=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:H}),i1=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:cn,command:c.string(),params:c.unknown(),ok:c.boolean(),confirmRequired:c.boolean(),confirmedBy:c.string().optional(),error:c.string().optional(),ts:H}),a1=64,s1=c.object({type:c.literal("session_state"),sessionId:c.string(),state:mo,event:c.string(),ts:H,transitions:c.array(c.object({state:mo,event:c.string(),ts:H})).max(a1).optional()}),c1=c.object({type:c.literal("notification"),sessionId:c.string(),event:mo,repo:c.string().optional(),title:c.string().optional(),body:c.string().optional()}),l1=c.discriminatedUnion("type",[BT,HT,ZT,GT,WT,VT,JT,qT,KT,XT,YT,QT,e1,t1,i1,n1,o1,r1,s1,c1]),Sk=e=>l1.parse(typeof e=="string"?JSON.parse(e):e);var u1=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]),zt=(e,t)=>e>>>t|e<<32-t;function d1(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 p1(e){let t=d1(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]),a=new Uint32Array(64);for(let u=0;u<r.length;u+=64){for(let P=0;P<16;P++)a[P]=o.getUint32(u+P*4);for(let P=16;P<64;P++){let C=a[P-15],E=a[P-2],D=zt(C,7)^zt(C,18)^C>>>3,G=zt(E,17)^zt(E,19)^E>>>10;a[P]=a[P-16]+D+a[P-7]+G>>>0}let d=i[0],p=i[1],m=i[2],f=i[3],g=i[4],y=i[5],k=i[6],_=i[7];for(let P=0;P<64;P++){let C=zt(g,6)^zt(g,11)^zt(g,25),E=g&y^~g&k,D=_+C+E+u1[P]+a[P],G=zt(d,2)^zt(d,13)^zt(d,22),ae=d&p^d&m^p&m,X=G+ae;_=k,k=y,y=g,g=f+D>>>0,f=m,m=p,p=d,d=D+X>>>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]+y>>>0,i[6]=i[6]+k>>>0,i[7]=i[7]+_>>>0}let s=new Uint8Array(32),l=new DataView(s.buffer);for(let u=0;u<8;u++)l.setUint32(u*4,i[u]);return s}var _k="abcdefghijklmnopqrstuvwxyz234567";function m1(e){let t=0,r=0,o="";for(let n of e)for(r=r<<8|n,t+=8;t>=5;)o+=_k[r>>>t-5&31],t-=5;return t>0&&(o+=_k[r<<5-t&31]),o}function Ik(e){return m1(p1(e))}var f1=c.enum(["mdns","ssdp","kasa-udp","wiz-udp","lifx-lan","yeelight","govee-udp","tuya-beacon","arp","http","meethue"]),g1=c.object({protocol:f1,detail:c.string(),at:H}),h1=c.enum(["connect-now","link-ecosystem","identified-only"]),bc=c.enum(["kasa","kasa-klap","wiz","lifx","shelly","govee","tapo","tuya","yeelight","nanoleaf","meross","ewelink","wled","elgato","roku","esphome"]),v1=c.enum(["high","medium","low"]),y1=c.object({ip:c.string(),mac:c.string().optional(),hostname:c.string().optional(),port:c.number().int().positive().optional()}),Ak=c.object({discoveredId:c.string(),addresses:y1,evidence:c.array(g1).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:h1,kind:c.string().optional(),suggestedProvider:_t.optional(),localProtocol:bc.optional(),expectedType:Ti.optional(),expectedCapabilities:c.array(cn).default([]),alreadyLinked:c.object({provider:_t,deviceId:c.string().optional(),accountId:c.string().optional()}).nullable().optional(),confidence:v1,firstSeen:H,lastSeen:H});function $t(e){return e.trim().toLowerCase().replace(/[^0-9a-f]/g,"").replace(/(..)(?=.)/g,"$1:")}var Ek=c.object({key:c.string(),provider:_t,accountId:c.string().optional(),name:c.string(),mac:c.string().optional(),nativeType:c.string().optional(),expectedType:Ti.optional(),state:c.enum(["cloud","not-seen"]),deviceId:c.string().optional()}),Pk=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 Ck(e){return e!==void 0&&(e.wsl||e.multicastOk===!1)}function Tk(e,t){return t>0||e===void 0||e.wsl?!1:e.multicastOk===!0}var Rk="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.",b1=c.enum(["running","done","failed"]),fB=c.object({id:c.string(),status:b1,startedAt:H,finishedAt:H.optional(),error:c.string().optional(),devices:c.array(Ak),accountDevices:c.array(Ek).optional(),env:Pk,probeStatus:c.record(c.string(),c.string()).optional()}),x1=c.enum(["mdns","ssdp","kasa","wiz","lifx","yeelight","govee","tuya","arp","sweep"]),gB=c.object({autoConnect:c.enum(["unset","off","open-protocols"]).default("unset"),passive:c.boolean().default(!0),protocols:c.partialRecord(x1,c.boolean()).default({}),unidentified:c.boolean().default(!0)}),hB=c.object({scanId:c.string()}),vB=c.object({devices:c.array(Ak),accountDevices:c.array(Ek).optional(),env:Pk,updatedAt:H}),yB=c.object({discoveredId:c.string().optional(),ip:c.string().optional(),protocol:bc,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"}),og={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"}]},k1=new Set(["shelly","esphome"]);function w1(e){return k1.has(e)}var bB=c.object({ok:c.boolean(),deviceId:c.string().optional(),accountId:c.string().optional(),error:c.string().optional(),note:c.string().optional(),linkVia:_t.optional()}),xB=c.object({deviceId:c.string(),purge:c.boolean().default(!1),discoveredId:c.string().optional()}),kB=c.object({deviceId:c.string(),name:c.string()}),wB=c.object({clientId:c.string().min(1),clientSecret:c.string().min(1),region:c.string().min(1)}),SB=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),sleepyCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),_B=c.object({email:c.string().min(1),password:c.string().min(1),region:c.string().min(1),mfaCode:c.string().optional()}),$B=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),IB=c.object({email:c.string().min(1),password:c.string().min(1),region:c.string().min(1)}),AB=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),EB=c.object({apiKey:c.string().min(1)}),PB=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),CB=c.object({ok:c.boolean(),note:c.string().optional(),error:c.string().optional()}),TB=c.object({sessionId:c.string().optional(),revertOnStop:c.boolean().default(!0)}),RB=c.object({sessionId:c.string().optional()}),Ok=c.object({pct:c.number().min(0).max(100),usedTokens:c.number().int().nonnegative().optional(),windowTokens:c.number().int().positive().optional()}),$k=c.object({usedPct:c.number().min(0).max(100),resetsAt:H.optional()}),OB=c.object({sessionId:c.string().optional(),claudeSessionId:c.string().optional(),state:mo,event:c.string(),ts:H.optional(),cwd:c.string().optional(),extra:c.record(c.string(),c.unknown()).optional(),context:Ok.optional(),mode:c.string().optional(),model:c.string().optional(),agent:sr.optional()}),DB=c.object({sessionId:c.string().optional(),claudeSessionId:c.string().optional(),cwd:c.string().optional(),ts:H.optional(),context:Ok.optional(),rateLimits:c.object({fiveHour:$k.optional(),sevenDay:$k.optional()}).optional(),mode:c.string().optional(),model:c.string().optional(),modelName:c.string().optional(),review:c.string().optional(),cost:c.number().nonnegative().optional(),agent:sr.optional()}),NB=c.object({sessionId:c.string().optional(),claudeSessionId:c.string().optional(),codexThreadId:c.string().min(1),cwd:c.string().optional(),gitBranch:c.string().optional(),ts:H.optional(),inputTokens:c.number().int().nonnegative(),cachedInputTokens:c.number().int().nonnegative().default(0),outputTokens:c.number().int().nonnegative(),agent:sr.optional()}),S1=c.object({reverted:c.number().int().nonnegative(),failed:c.number().int().nonnegative(),skipped:c.number().int().nonnegative()}),LB=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:S1.optional()});function fo(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 xc=["govee","wiz","yeelight","kasa","esphome"],_1=new Set(["lock","cover","garageDoor","valve","camera","doorbell"]),$1=new Set(["lock","cover","camera","doorbell"]),I1=new Set(["tuya","meross","ewelink","nanoleaf","esphome"]);function Dk(e,t=og){return e.bucket==="connect-now"&&e.localProtocol!==void 0&&((t[e.localProtocol]?.length??0)===0||w1(e.localProtocol))&&!I1.has(e.localProtocol)&&e.confidence==="high"&&e.addresses.mac!==void 0&&!e.alreadyLinked&&!(e.expectedType!==void 0&&_1.has(e.expectedType))&&!e.expectedCapabilities.some(r=>$1.has(r))}function Nk(e){let t=e.trim(),r,o=/^(mqtts?|tcp|ssl|tls|wss?):\/\//i.exec(t);if(o){let s=o[1].toLowerCase();(s==="mqtts"||s==="ssl"||s==="tls"||s==="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(),a=n?Number(n[2]):void 0;return{host:i,...a!==void 0&&a>=1&&a<=65535?{port:a}:{},...r!==void 0?{tls:r}:{}}}import{spawn as P1}from"node:child_process";import{chmodSync as C1,existsSync as ag,openSync as T1,readFileSync as R1,realpathSync as O1,writeFileSync as Mk}from"node:fs";import{request as D1}from"node:http";import N1 from"node:net";import L1 from"node:path";function Ri(){return!0}function Lk(){return"1.0.0"}var Uk=3e3,A1=15e3;function E1(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 zk(e){let t=e?.read??O;return E1(t(e?.file??Ia))}function ig(e,t){let r=t?.write??((n,i)=>ge(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 jk(e){try{(e?.remove??ue)(e?.file??Ia)}catch{}}function Fk(e){let{beacon:t,pid:r}=e;return!Number.isInteger(r)||r<=0||!t||t.pid!==r||!(e.isAlive??Ea)(r)?!1:(e.now??Date.now())-t.lastBeat<=(e.staleAfterMs??A1)}function U1(e){return new Promise(t=>{let r=N1.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 wc(e={}){let t=Sr(e);return{dir:t.dir,source:t.source,port:t.beacon?.port??ne().hubPort,tokenFile:Hl(t.dir),advertised:t.beacon!==null}}async function Te(){return U1(wc().port)}function z1(e=process.env,t=r=>Ct(r)){if(e.BRIDGE_CLIENT_VERSION!==void 0)return{};let r=t(e);return r===null?{}:{BRIDGE_CLIENT_VERSION:r}}function j1(e=process.env,t={}){let r=t.bundled??Ri(),o={...e};return r&&delete o.BRIDGE_VOICE,o}async function it(e={kind:"run"}){if(await Te())return Y("hub already running \u2014 reusing it"),{spawned:!1,holderId:await Bk(e.kind)??await Sc(e.kind)};let t=ne(),r=ag(Xo)?{file:process.execPath,args:[Xo]}:{file:ag(Ca)?Ca:"tsx",args:[oy]};Mk(xt,"",{mode:384}),C1(xt,384);let o=T1(xt,"a"),n=P1(r.file,r.args,{cwd:en,detached:!0,stdio:["ignore",o,o],env:{...j1(),BRIDGE_RELAY_URL:t.relayUrl,BRIDGE_HUB_PORT:String(t.hubPort),BRIDGE_HUB_HOLDER:e.kind,BRIDGE_HUB_HOLDER_PID:String(process.pid),...z1()}});n.unref(),n.pid&&Mk(Mo,String(n.pid));for(let i=0;i<30;i++){let a=_c(xt);if(/relay connected/i.test(a))return A("hub connected to relay"),{spawned:!0,holderId:await Bk(e.kind)??await Sc(e.kind)};if(/relay ws error|FATAL/i.test(a))throw new Error(`hub failed to connect:
238
- ${Se(Zk(a,6))}`);await F1(1e3)}throw new Error(`hub timed out connecting to the relay. Last log:
239
- ${Se(Zk(_c(xt),8))}`)}function Gk(){Zh()}function Wk(e,t){let r=t?.argv1??process.argv[1]??"",o=t?.exists??ag,n=t?.tsxBin??Ca;if(t?.bundled??Ri()){let s=r;try{s=(t?.realpath??O1)(r)}catch{}return{file:process.execPath,args:[s,"daemon",...e]}}if(/\.(mjs|cjs|js)$/.test(r))return{file:process.execPath,args:[r,"daemon",...e]};let a=r||L1.join(en,"cli","src","index.ts");return{file:o(n)?n:"tsx",args:[a,"daemon",...e]}}async function Sc(e){return(await Z("/local/hub/hold",{method:"POST",body:{kind:e,pid:process.pid}})).body?.holderId??null}function Bk(e){let t=wc(),r=_c(t.tokenFile).trim();if(!r)return Promise.resolve(null);let o=JSON.stringify({kind:e,pid:process.pid,stream:!0});return new Promise(n=>{let i=!1,a=s=>{i||(i=!0,n(s))};try{let s=D1({host:"127.0.0.1",port:t.port,path:"/local/hub/hold",method:"POST",headers:{"x-bridge-hub-token":r,"content-type":"application/json","content-length":Buffer.byteLength(o)}},l=>{if(l.statusCode!==200)return l.resume(),a(null);l.socket?.unref(),l.once("data",u=>{try{a(JSON.parse(u.toString("utf8").split(`
240
- `)[0]??"").holderId??null)}catch{a(null)}}),l.once("close",()=>a(null))});s.on("error",()=>a(null)),s.setTimeout(5e3,()=>a(null)),s.end(o)}catch{a(null)}})}async function Vk(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 $c(e){await Z("/local/hub/release",{method:"POST",body:{holderId:e},timeoutMs:4e3})}async function Jk(){let e=await Z("/local/hub/shutdown",{method:"POST",body:{},timeoutMs:8e3});return!e.hubOffline&&e.status===200}async function qk(){await Z("/local/reload",{method:"POST",body:{},timeoutMs:8e3})}function go(e){return Fk({beacon:(e.readBeacon??zk)(),pid:e.pid,...e.now!==void 0?{now:e.now}:{},...e.isAlive?{isAlive:e.isAlive}:{}})}var kc=null;function De(){let e=kc;if(!e||e.reason==="offline")return"hub offline \u2014 run `acbridge daemon` or start the app";let r=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}${r}, 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}${r} 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 sg(e){return Hl(W,e)}async function Hk(e,t,r){let o=_c(e.tokenFile).trim();if(!o)return kc={reason:e.advertised?"absent":"offline",target:e},e.advertised?{hubOffline:!0,hubUnauthorized:"absent"}:{hubOffline:!0};let n=r?.body!==void 0;try{let i=await fetch(`http://127.0.0.1:${e.port}${t}`,{method:r?.method??"GET",headers:{"x-bridge-hub-token":o,...n?{"content-type":"application/json"}:{}},...n?{body:JSON.stringify(r?.body)}:{},signal:AbortSignal.timeout(r?.timeoutMs??1e4)}),a;try{a=await i.json()}catch{a=void 0}return i.status===401&&(kc={reason:"rejected",target:e}),{status:i.status,body:a,...i.status===401?{hubUnauthorized:"rejected"}:{}}}catch{return kc={reason:"offline",target:e},{hubOffline:!0}}}async function Z(e,t){let r=wc(),o=await Hk(r,e,t);if(!o.hubOffline&&!o.hubUnauthorized)return o;let n=wc({fresh:!0});return n.port===r.port&&n.tokenFile===r.tokenFile?o:Hk(n,e,t)}function _c(e){try{return R1(e,"utf8")}catch{return""}}function Zk(e,t){return e.trimEnd().split(`
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},m=l.ref;if(l.ref=null,m){o(m);let f=e.seen.get(m),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===m)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 p=a._zod.parent;if(p&&p!==m){o(p);let f=e.seen.get(p);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 _1={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=_1[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(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.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 m=typeof d=="number"&&d>=(i??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";m?f?(n.minimum=d,n.exclusiveMinimum=!0):n.exclusiveMinimum=d:typeof i=="number"&&(n.minimum=i),p?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((p,f)=>pe(p,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:m}=e._zod.bag;typeof d=="number"&&(n.minItems=d),typeof m=="number"&&(n.maxItems=m)},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 m of l)n.patternProperties[m.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(m=>typeof m=="string"||typeof m=="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 Jx={};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:()=>ow,any:()=>Nk,array:()=>Yi,base64:()=>yk,base64url:()=>bk,bigint:()=>Ck,boolean:()=>Jf,catch:()=>Eg,check:()=>iw,cidrv4:()=>hk,cidrv6:()=>vk,codec:()=>ew,cuid:()=>ck,cuid2:()=>lk,custom:()=>sw,date:()=>Uk,describe:()=>aw,discriminatedUnion:()=>Hk,e164:()=>xk,email:()=>Yx,emoji:()=>sk,enum:()=>Vc,exactOptional:()=>yg,file:()=>Kk,float32:()=>Ik,float64:()=>Ek,function:()=>ow,guid:()=>Qx,hash:()=>$k,hex:()=>_k,hostname:()=>Sk,httpUrl:()=>ik,instanceof:()=>lw,int:()=>$c,int32:()=>Ak,int64:()=>Tk,intersection:()=>cg,invertCodec:()=>tw,ipv4:()=>mk,ipv6:()=>gk,json:()=>dw,jwt:()=>kk,keyof:()=>jk,ksuid:()=>pk,lazy:()=>Dg,literal:()=>Jk,looseObject:()=>Mk,looseRecord:()=>Gk,mac:()=>fk,map:()=>Wk,meta:()=>cw,nan:()=>Qk,nanoid:()=>ak,nativeEnum:()=>qk,never:()=>Gc,nonoptional:()=>_g,null:()=>Qf,nullable:()=>qi,nullish:()=>Xk,number:()=>qf,object:()=>zk,optional:()=>Vi,partialRecord:()=>Zk,pipe:()=>Ic,prefault:()=>Sg,preprocess:()=>pw,promise:()=>rw,readonly:()=>Tg,record:()=>dg,refine:()=>Ug,set:()=>Vk,strictObject:()=>Fk,string:()=>Gi,stringFormat:()=>wk,stringbool:()=>uw,success:()=>Yk,superRefine:()=>jg,symbol:()=>Ok,templateLiteral:()=>nw,transform:()=>qc,tuple:()=>ug,uint32:()=>Pk,uint64:()=>Rk,ulid:()=>uk,undefined:()=>Dk,union:()=>Wc,unknown:()=>xr,url:()=>ok,uuid:()=>ek,uuidv4:()=>tk,uuidv6:()=>nk,uuidv7:()=>rk,void:()=>Lk,xid:()=>dk,xor:()=>Bk});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 Kx=(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}}})},I1=b("ZodError",Kx),nt=b("ZodError",Kx,{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 Xx=new WeakMap;function Ji(e,t,r){let o=Object.getPrototypeOf(e),n=Xx.get(o);if(n||(n=new Set,Xx.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 Yx(e){return Za(Ac,e)}var Wi=b("ZodGUID",(e,t)=>{Kd.init(e,t),he.init(e,t)});function Qx(e){return Bi(Wi,e)}var Zt=b("ZodUUID",(e,t)=>{Xd.init(e,t),he.init(e,t)});function ek(e){return Ga(Zt,e)}function tk(e){return Wa(Zt,e)}function nk(e){return Va(Zt,e)}function rk(e){return qa(Zt,e)}var Ki=b("ZodURL",(e,t)=>{Qd.init(e,t),he.init(e,t)});function ok(e){return Hi(Ki,e)}function ik(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 sk(e){return Ja(Pc,e)}var Cc=b("ZodNanoID",(e,t)=>{tp.init(e,t),he.init(e,t)});function ak(e){return Ka(Cc,e)}var Tc=b("ZodCUID",(e,t)=>{np.init(e,t),he.init(e,t)});function ck(e){return Xa(Tc,e)}var Rc=b("ZodCUID2",(e,t)=>{rp.init(e,t),he.init(e,t)});function lk(e){return Ya(Rc,e)}var Oc=b("ZodULID",(e,t)=>{op.init(e,t),he.init(e,t)});function uk(e){return Qa(Oc,e)}var Dc=b("ZodXID",(e,t)=>{ip.init(e,t),he.init(e,t)});function dk(e){return ec(Dc,e)}var Nc=b("ZodKSUID",(e,t)=>{sp.init(e,t),he.init(e,t)});function pk(e){return tc(Nc,e)}var Lc=b("ZodIPv4",(e,t)=>{dp.init(e,t),he.init(e,t)});function mk(e){return nc(Lc,e)}var Vf=b("ZodMAC",(e,t)=>{mp.init(e,t),he.init(e,t)});function fk(e){return lm(Vf,e)}var Uc=b("ZodIPv6",(e,t)=>{pp.init(e,t),he.init(e,t)});function gk(e){return rc(Uc,e)}var jc=b("ZodCIDRv4",(e,t)=>{fp.init(e,t),he.init(e,t)});function hk(e){return oc(jc,e)}var zc=b("ZodCIDRv6",(e,t)=>{gp.init(e,t),he.init(e,t)});function vk(e){return ic(zc,e)}var Fc=b("ZodBase64",(e,t)=>{vp.init(e,t),he.init(e,t)});function yk(e){return sc(Fc,e)}var Mc=b("ZodBase64URL",(e,t)=>{yp.init(e,t),he.init(e,t)});function bk(e){return ac(Mc,e)}var Bc=b("ZodE164",(e,t)=>{bp.init(e,t),he.init(e,t)});function xk(e){return cc(Bc,e)}var Hc=b("ZodJWT",(e,t)=>{xp.init(e,t),he.init(e,t)});function kk(e){return lc(Hc,e)}var Ro=b("ZodCustomStringFormat",(e,t)=>{kp.init(e,t),he.init(e,t)});function wk(e,t,r={}){return Io(Ro,e,t,r)}function Sk(e){return Io(Ro,"hostname",it.hostname,e)}function _k(e){return Io(Ro,"hex",it.hex,e)}function $k(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 Ik(e){return ym(kr,e)}function Ek(e){return bm(kr,e)}function Ak(e){return xm(kr,e)}function Pk(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 Ck(e){return _m(No,e)}var Zc=b("ZodBigIntFormat",(e,t)=>{Sp.init(e,t),No.init(e,t)});function Tk(e){return Im(Zc,e)}function Rk(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 Ok(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 Dk(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 Nk(){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 Lk(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 Uk(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 jk(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 zk(e,t){let r={type:"object",shape:e??{},...C.normalizeParams(t)};return new Qi(r)}function Fk(e,t){return new Qi({type:"object",shape:e,catchall:Gc(),...C.normalizeParams(t)})}function Mk(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 Bk(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 Hk(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 Zk(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 Gk(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 Wk(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 Vk(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 qk(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 Jk(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 Kk(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 Xk(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 Yk(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 Qk(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 ew(e,t,r){return new ns({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function tw(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 nw(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 rw(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 ow(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 iw(e){let t=new ye({check:"custom"});return t._zod.check=e,t}function sw(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 aw=Hm,cw=Zm;function lw(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 uw=(...e)=>Gm({Codec:ns,Boolean:Do,String:To},...e);function dw(e){let t=Dg(()=>Wc([Gi(e),qf(),Jf(),Qf(),Yi(t),dg(Gi(),t)]));return t}function pw(e,t){return new Pg({type:"pipe",in:qc(e),out:t})}var A1={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 P1(e){$e({customError:e})}function C1(){return $e().customError}var zg;zg||(zg={});var L={...Zi,...xc,iso:Ao},T1=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 R1(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 O1(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 mw(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=O1(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 mw(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(),m=L.looseRecord(l,u);o=L.intersection(d,m);break}if(e.patternProperties){let l=e.patternProperties,u=Object.keys(l),d=[];for(let p of u){let f=ze(l[p],t),g=L.string().regex(new RegExp(p));d.push(L.looseRecord(g,f))}let m=[];if(Object.keys(n).length>0&&m.push(L.object(n).passthrough()),m.push(...d),m.length===0)o=L.object({}).passthrough();else if(m.length===1)o=m[0];else{let p=L.intersection(m[0],m[1]);for(let f=2;f<m.length;f++)p=L.intersection(p,m[f]);o=p}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=mw(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))T1.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 fw(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=R1(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:()=>U1,boolean:()=>L1,date:()=>j1,number:()=>N1,string:()=>D1});function D1(e){return cm(To,e)}function N1(e){return hm(Oo,e)}function L1(e){return Sm(Do,e)}function U1(e){return $m(No,e)}function j1(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"]),z1=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"]),F1=c.enum(["temperature","humidity","illuminance","pressure","co2","pm25","pm10","voc","airQuality","noise","uvIndex","windSpeed","distance","generic"]),M1=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}),B1=xe("power",{state:c.object({on:c.boolean().nullable()})}),H1=xe("brightness",{state:c.object({level:ae.nullable()})}),Z1=xe("colorTemperature",{config:c.object({minKelvin:gn,maxKelvin:gn}),state:c.object({kelvin:gn.nullable()})}),G1=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()})}),W1=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"]),V1=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()})}),q1=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()})}),J1=xe("lock",{state:c.object({state:c.enum(["locked","unlocked","jammed","unknown"])})}),K1=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"])})}),X1=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()})}),Y1=xe("mode",{config:c.object({options:c.array(c.string())}),state:c.object({value:c.string().nullable()})}),Q1=xe("toggle",{state:c.object({on:c.boolean().nullable()})}),eR=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()})}),tR=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()})}),nR=xe("volume",{state:c.object({level:ae.nullable(),muted:c.boolean().nullable()})}),rR=xe("inputSource",{config:c.object({sources:c.array(c.string())}),state:c.object({source:c.string().nullable()})}),oR=xe("startStop",{config:c.object({supportsPause:c.boolean().default(!1)}),state:c.object({state:c.enum(["running","paused","stopped","unknown"])})}),iR=xe("scene",{state:c.object({lastActivated:te.nullable().optional()})}),sR=xe("camera",{config:c.object({protocols:c.array(c.enum(["rtsp","webrtc","hls","snapshot"]))}),state:c.object({streaming:c.boolean().nullable().optional()})}),aR=xe("sensor",{config:c.object({measurement:F1,unit:c.string()}),state:c.object({value:c.number().nullable(),ts:te.nullable().optional()})}),cR=xe("binarySensor",{config:c.object({sensorType:M1}),state:c.object({active:c.boolean().nullable(),lastChanged:te.nullable().optional()})}),lR=xe("battery",{state:c.object({level:ae.nullable(),charging:c.boolean().nullable().optional(),low:c.boolean().nullable().optional()})}),uR=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()})}),dR=xe("doorbell",{state:c.object({lastPress:te.nullable().optional()})}),pR=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()})}),gw=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}}])})]),mR=xe("effect",{config:c.object({kinds:c.array(gw).default(["flash"]),supportsColor:c.boolean().default(!1)}),state:c.object({active:gw.nullable()})}),fR=c.discriminatedUnion("type",[B1,H1,Z1,G1,W1,V1,q1,J1,K1,X1,Y1,Q1,eR,tR,nR,rR,oR,iR,sR,aR,cR,lR,uR,dR,pR,mR]),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"]),yw=c.enum(["needs-password"]),gR=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:yw.nullable().optional(),credentialRef:c.string().nullable().optional(),lastSeen:te.nullable().optional()}),hR=c.object({id:c.string(),name:c.string(),providerRefs:c.array(c.object({provider:Et,nativeId:c.string()})).default([])}),vR=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()}),yR=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:z1,attention:yw.nullable().optional(),parentId:c.string().nullable().optional(),members:c.array(c.string()).optional(),sources:c.array(gR).min(1),preferredSourceId:c.string(),capabilities:c.array(fR),updatedAt:te,raw:c.unknown().optional()}),bw=c.object({version:c.literal(1),nodeId:c.string(),updatedAt:te,areas:c.array(hR),accounts:c.array(vR),devices:c.array(yR)}),bR=c.enum(["relay-do-sealed","hub-local"]),MH=c.object({accountId:c.string(),provider:Et,providerAccountId:c.string(),nodeId:c.string(),credentialLocation:bR,scopes:c.array(c.string()).default([]),status:c.enum(["linked","needs_reauth","revoked"]),displayName:c.string(),expiresAt:te.nullable().optional(),linkedAt:te}),hw=c.enum(["open","guarded","locked"]),Bg=c.enum(["allow","confirm","deny"]),xR=c.enum(["voice","claude","app","rules"]),BH=c.object({tier:hw.default("open"),perConsumer:c.partialRecord(xR,hw).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({}),vw=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:vw},{command:"close",params:Ie},{command:"stop",params:Ie},{command:"setPosition",params:c.object({position:ae}),confirm:vw,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 kR=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:kR.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 wR=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()})]),SR=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()}),_R=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)})]),xw=c.object({id:c.string(),name:c.string().default(""),enabled:c.boolean().default(!0),trigger:wR,conditions:c.array(SR).default([]),actions:c.array(_R).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"]),kw=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()}),ww=c.enum(["allow","deny"]),eZ=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()}),tZ=c.object({requestId:c.string(),behavior:ww,ts:te.optional()}),nZ=c.object({id:c.string(),sessionId:c.string().nullable(),args:c.unknown(),ts:te.optional()}),$R=c.object({type:c.literal("register"),userToken:c.string().optional(),sessions:c.array(kw),claudeSessionId:c.string().optional()}),IR=c.object({type:c.literal("sessions.update"),sessions:c.array(kw)}),ER=c.object({type:c.literal("prompt"),sessionId:c.string(),requestId:c.string(),text:c.string(),ts:te.optional()});var AR=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()}),PR=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()}),CR=c.object({type:c.literal("permission_verdict"),sessionId:c.string(),requestId:c.string(),behavior:ww,ts:te.optional()}),TR=c.object({type:c.literal("command"),id:c.string(),requestId:c.string(),sessionId:c.string().nullable(),args:c.unknown(),ts:te.optional()}),RR=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()}),OR=c.object({type:c.literal("devices.update"),doc:bw}),DR=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()}),NR=c.object({type:c.literal("device_query"),requestId:c.string(),kind:c.enum(["list","get"]),deviceId:c.string().optional()}),LR=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()}),UR=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}),jR=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}),zR=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}),FR=c.object({type:c.literal("device_config"),version:c.number().int().nonnegative(),config:c.record(c.string(),c.unknown()),ts:te}),MR=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}),BR=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}),HR=64,ZR=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(HR).optional()}),GR=c.object({type:c.literal("notification"),sessionId:c.string(),event:Lo,repo:c.string().optional(),title:c.string().optional(),body:c.string().optional()}),WR=c.discriminatedUnion("type",[$R,IR,ER,AR,PR,CR,TR,RR,OR,DR,NR,LR,UR,jR,BR,zR,MR,FR,ZR,GR]),Sw=e=>WR.parse(typeof e=="string"?JSON.parse(e):e);var VR=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 qR(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 JR(e){let t=qR(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],m=i[1],p=i[2],f=i[3],g=i[4],h=i[5],y=i[6],w=i[7];for(let _=0;_<64;_++){let I=Gt(g,6)^Gt(g,11)^Gt(g,25),S=g&h^~g&y,T=w+I+S+VR[_]+s[_],j=Gt(d,2)^Gt(d,13)^Gt(d,22),z=d&m^d&p^m&p,J=j+z;w=y,y=h,h=g,g=f+T>>>0,f=p,p=m,m=d,d=T+J>>>0}i[0]=i[0]+d>>>0,i[1]=i[1]+m>>>0,i[2]=i[2]+p>>>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]+w>>>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 _w="abcdefghijklmnopqrstuvwxyz234567";function KR(e){let t=0,r=0,o="";for(let n of e)for(r=r<<8|n,t+=8;t>=5;)o+=_w[r>>>t-5&31],t-=5;return t>0&&(o+=_w[r<<5-t&31]),o}function Iw(e){return KR(JR(e))}var XR=c.enum(["mdns","ssdp","kasa-udp","wiz-udp","lifx-lan","yeelight","govee-udp","tuya-beacon","arp","http","meethue"]),YR=c.object({protocol:XR,detail:c.string(),at:te}),QR=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"]),eO=c.enum(["high","medium","low"]),tO=c.object({ip:c.string(),mac:c.string().optional(),hostname:c.string().optional(),port:c.number().int().positive().optional()}),Ew=c.object({discoveredId:c.string(),addresses:tO,evidence:c.array(YR).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:QR,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:eO,firstSeen:te,lastSeen:te});function Pt(e){return e.trim().toLowerCase().replace(/[^0-9a-f]/g,"").replace(/(..)(?=.)/g,"$1:")}var Aw=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()}),Pw=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 Cw(e){return e!==void 0&&(e.wsl||e.multicastOk===!1)}function Tw(e,t){return t>0||e===void 0||e.wsl?!1:e.multicastOk===!0}var Rw="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.",nO=c.enum(["running","done","failed"]),cZ=c.object({id:c.string(),status:nO,startedAt:te,finishedAt:te.optional(),error:c.string().optional(),devices:c.array(Ew),accountDevices:c.array(Aw).optional(),env:Pw,probeStatus:c.record(c.string(),c.string()).optional()}),rO=c.enum(["mdns","ssdp","kasa","wiz","lifx","yeelight","govee","tuya","arp","sweep"]),lZ=c.object({autoConnect:c.enum(["unset","off","open-protocols"]).default("unset"),passive:c.boolean().default(!0),protocols:c.partialRecord(rO,c.boolean()).default({}),unidentified:c.boolean().default(!0)}),uZ=c.object({scanId:c.string()}),dZ=c.object({devices:c.array(Ew),accountDevices:c.array(Aw).optional(),env:Pw,updatedAt:te}),pZ=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"}]},oO=new Set(["shelly","esphome"]);function iO(e){return oO.has(e)}var mZ=c.object({ok:c.boolean(),deviceId:c.string().optional(),accountId:c.string().optional(),error:c.string().optional(),note:c.string().optional(),linkVia:Et.optional()}),fZ=c.object({deviceId:c.string(),purge:c.boolean().default(!1),discoveredId:c.string().optional()}),gZ=c.object({deviceId:c.string(),name:c.string()}),hZ=c.object({clientId:c.string().min(1),clientSecret:c.string().min(1),region:c.string().min(1)}),vZ=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),sleepyCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),yZ=c.object({email:c.string().min(1),password:c.string().min(1),region:c.string().min(1),mfaCode:c.string().optional()}),bZ=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),xZ=c.object({email:c.string().min(1),password:c.string().min(1),region:c.string().min(1)}),kZ=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),wZ=c.object({apiKey:c.string().min(1)}),SZ=c.object({ok:c.boolean(),deviceCount:c.number().int().nonnegative().optional(),error:c.string().optional()}),_Z=c.object({ok:c.boolean(),note:c.string().optional(),error:c.string().optional()}),$Z=c.object({sessionId:c.string().optional(),revertOnStop:c.boolean().default(!0)}),IZ=c.object({sessionId:c.string().optional()}),Ow=c.object({pct:c.number().min(0).max(100),usedTokens:c.number().int().nonnegative().optional(),windowTokens:c.number().int().positive().optional()}),$w=c.object({usedPct:c.number().min(0).max(100),resetsAt:te.optional()}),EZ=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:Ow.optional(),mode:c.string().optional(),model:c.string().optional(),agent:hn.optional()}),AZ=c.object({sessionId:c.string().optional(),claudeSessionId:c.string().optional(),cwd:c.string().optional(),ts:te.optional(),context:Ow.optional(),rateLimits:c.object({fiveHour:$w.optional(),sevenDay:$w.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()}),PZ=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()}),sO=c.object({reverted:c.number().int().nonnegative(),failed:c.number().int().nonnegative(),skipped:c.number().int().nonnegative()}),CZ=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:sO.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"],aO=new Set(["lock","cover","garageDoor","valve","camera","doorbell"]),cO=new Set(["lock","cover","camera","doorbell"]),lO=new Set(["tuya","meross","ewelink","nanoleaf","esphome"]);function Dw(e,t=Zg){return e.bucket==="connect-now"&&e.localProtocol!==void 0&&((t[e.localProtocol]?.length??0)===0||iO(e.localProtocol))&&!lO.has(e.localProtocol)&&e.confidence==="high"&&e.addresses.mac!==void 0&&!e.alreadyLinked&&!(e.expectedType!==void 0&&aO.has(e.expectedType))&&!e.expectedCapabilities.some(r=>cO.has(r))}function Nw(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 pO}from"node:child_process";import{chmodSync as mO,existsSync as Wg,openSync as fO,readFileSync as gO,realpathSync as hO,writeFileSync as Mw}from"node:fs";import{request as vO}from"node:http";import yO from"node:net";import bO from"node:path";function as(){return!0}function Lw(){return"1.1.0"}var Uw=3e3,uO=15e3;function dO(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 jw(e){let t=e?.read??N;return dO(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 zw(e){try{(e?.remove??ve)(e?.file??ia)}catch{}}function Fw(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??uO)}function xO(e){return new Promise(t=>{let r=yO.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 xO(rl().port)}function kO(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 wO(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 Bw(e.kind)??await ol(e.kind)};let t=de(),r=Wg(_i)?{file:process.execPath,args:[_i]}:{file:Wg(la)?la:"tsx",args:[sb]};Mw(wt,"",{mode:384}),mO(wt,384);let o=fO(wt,"a"),n=pO(r.file,r.args,{cwd:ln,detached:!0,stdio:["ignore",o,o],env:{...wO(),BRIDGE_RELAY_URL:t.relayUrl,BRIDGE_HUB_PORT:String(t.hubPort),BRIDGE_HUB_HOLDER:e.kind,BRIDGE_HUB_HOLDER_PID:String(process.pid),...kO()}});n.unref(),n.pid&&Mw(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 Bw(e.kind)??await ol(e.kind)};if(/relay ws error|FATAL/i.test(s))throw new Error(`hub failed to connect:
238
+ ${me(Zw(s,6))}`);await SO(1e3)}throw new Error(`hub timed out connecting to the relay. Last log:
239
+ ${me(Zw(il(wt),8))}`)}function Gw(){Mv()}function Ww(e,t){let r=t?.argv1??process.argv[1]??"",o=t?.exists??Wg,n=t?.tsxBin??la;if(t?.bundled??as()){let a=r;try{a=(t?.realpath??hO)(r)}catch{}return{file:process.execPath,args:[a,"daemon",...e]}}if(/\.(mjs|cjs|js)$/.test(r))return{file:process.execPath,args:[r,"daemon",...e]};let s=r||bO.join(ln,"cli","src","index.ts");return{file:o(n)?n:"tsx",args:[s,"daemon",...e]}}async function ol(e){return(await q("/local/hub/hold",{method:"POST",body:{kind:e,pid:process.pid}})).body?.holderId??null}function Bw(e){let t=rl(),r=il(t.tokenFile).trim();if(!r)return Promise.resolve(null);let o=JSON.stringify({kind:e,pid:process.pid,stream:!0});return new Promise(n=>{let i=!1,s=a=>{i||(i=!0,n(a))};try{let a=vO({host:"127.0.0.1",port:t.port,path:"/local/hub/hold",method:"POST",headers:{"x-bridge-hub-token":r,"content-type":"application/json","content-length":Buffer.byteLength(o)}},l=>{if(l.statusCode!==200)return l.resume(),s(null);l.socket?.unref(),l.once("data",u=>{try{s(JSON.parse(u.toString("utf8").split(`
240
+ `)[0]??"").holderId??null)}catch{s(null)}}),l.once("close",()=>s(null))});a.on("error",()=>s(null)),a.setTimeout(5e3,()=>s(null)),a.end(o)}catch{s(null)}})}async function Vw(e){let t=await q("/local/hub/beat",{method:"POST",body:{holderId:e},timeoutMs:4e3});return t.hubOffline?"offline":t.status===200?"ok":"unknown"}async function sl(e){await q("/local/hub/release",{method:"POST",body:{holderId:e},timeoutMs:4e3})}async function qw(){let e=await q("/local/hub/shutdown",{method:"POST",body:{},timeoutMs:8e3});return!e.hubOffline&&e.status===200}async function Jw(){await q("/local/reload",{method:"POST",body:{},timeoutMs:8e3})}function jo(e){return Fw({beacon:(e.readBeacon??jw)(),pid:e.pid,...e.now!==void 0?{now:e.now}:{},...e.isAlive?{isAlive:e.isAlive}:{}})}var nl=null;function Fe(){let e=nl;if(!e||e.reason==="offline")return"hub offline \u2014 run `acbridge start`";let r=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}${r}, 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}${r} 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 Vg(e){return Ou(Q,e)}async function Hw(e,t,r){let o=il(e.tokenFile).trim();if(!o)return nl={reason:e.advertised?"absent":"offline",target:e},e.advertised?{hubOffline:!0,hubUnauthorized:"absent"}:{hubOffline:!0};let n=r?.body!==void 0;try{let i=await fetch(`http://127.0.0.1:${e.port}${t}`,{method:r?.method??"GET",headers:{"x-bridge-hub-token":o,...n?{"content-type":"application/json"}:{}},...n?{body:JSON.stringify(r?.body)}:{},signal:AbortSignal.timeout(r?.timeoutMs??1e4)}),s;try{s=await i.json()}catch{s=void 0}return i.status===401&&(nl={reason:"rejected",target:e}),{status:i.status,body:s,...i.status===401?{hubUnauthorized:"rejected"}:{}}}catch{return nl={reason:"offline",target:e},{hubOffline:!0}}}async function q(e,t){let r=rl(),o=await Hw(r,e,t);if(!o.hubOffline&&!o.hubUnauthorized)return o;let n=rl({fresh:!0});return n.port===r.port&&n.tokenFile===r.tokenFile?o:Hw(n,e,t)}function il(e){try{return gO(e,"utf8")}catch{return""}}function Zw(e,t){return e.trimEnd().split(`
241
241
  `).slice(-t).join(`
242
- `)}function F1(e){return new Promise(t=>setTimeout(t,e))}var Fn=`Usage: acbridge connect <mac|ip|discoveredId> [--name <display-name>] [--credentials-file <json>]
243
- acbridge connect <ip> --as ${xc.join("|")} [--name <display-name>]
242
+ `)}function SO(e){return new Promise(t=>setTimeout(t,e))}var qn=`Usage: acbridge connect <mac|ip|discoveredId> [--name <display-name>] [--credentials-file <json>]
243
+ acbridge connect <ip> --as ${tl.join("|")} [--name <display-name>]
244
244
  acbridge connect --forget <deviceId|mac|ip|discoveredId> [--purge]
245
245
  acbridge connect --auto on|off
246
246
 
@@ -249,56 +249,101 @@ Targets come from \`acbridge scan\` (the ldev_\u2026 id, or the device's MAC/IP)
249
249
  LAN-Control toggle flipped after the scan, or multicast is filtered) \u2014 it persists ONLY after the
250
250
  protocol's live probe replies at that IP; a dead IP or wrong protocol simply gets no reply.
251
251
  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 H1(e){let t={purge:!1},r=(o,n,i,a)=>o===`--${n}`?(t[n]=a[++i],i):o.startsWith(`--${n}=`)?(t[n]=o.slice(`--${n}=`.length),i):null;for(let o=0;o<e.length;o++){let n=e[o];if(!n)continue;if(n==="--purge"){t.purge=!0;continue}if(n==="--credentials-file"){t.credentialsFile=e[++o];continue}if(n.startsWith("--credentials-file=")){t.credentialsFile=n.slice(19);continue}let i=!1;for(let a of["forget","auto","name","as"]){let s=r(n,a,o,e);if(s!==null){o=s,i=!0;break}}i||(n.startsWith("--")?t.bad=`unknown option: ${n}`:t.target?t.bad=`unexpected argument: ${n}`:t.target=n)}return t}var Yk=e=>/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/.test($t(e)),cg=e=>/^(\d{1,3}\.){3}\d{1,3}$/.test(e),Kk=e=>`dev_${Ik(`mac:${$t(e)}`).slice(0,8)}`,Xk=e=>e==="homeassistant"?"home-assistant":e;async function Qk(e){let t=H1(e);if(t.bad)return b(t.bad),h(Fn),2;if(t.as!==void 0)return t.forget!==void 0||t.auto!==void 0?(b("--as can't combine with --forget or --auto"),h(Fn),2):t.target?Z1(t.target,t.as,t.name):(b("connect --as <protocol> needs an IP address as the target"),h(Fn),2);let r=[t.target,t.forget,t.auto].filter(o=>o!==void 0).length;return r!==1?(r>1&&b("pick one of: a connect target, --forget, --auto"),h(Fn),2):t.auto!==void 0?X1(t.auto):t.forget!==void 0?K1(t.forget,t.purge):G1(t.target,t.name,t.credentialsFile)}async function Z1(e,t,r){if(!xc.includes(t))return b(`--as takes one of: ${xc.join(", ")} (got ${t||"(none)"})`),2;if(!cg(e))return b(`connect --as needs an IP address as the target, got: ${e}`),h(Fn),2;h(Se(`probing ${e} as ${t}\u2026`));let o={ip:e,protocol:t,...r?{name:r}:{}},n=await Z("/local/connect",{method:"POST",body:o,timeoutMs:15e3});if(n.hubOffline)return b(De()),1;let i=n.body;return n.status===200&&i?.ok?(A(`connected \u2014 ${i.deviceId??e}${i.accountId?` (account ${i.accountId})`:""}`),i.note&&h(i.note),h("It now appears in `acbridge status`, the app dashboard, and to Claude."),0):(b(i?.error??`hub answered HTTP ${n.status}`),i?.note&&h(i.note),(n.status===502||n.status===422)&&h(`\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 G1(e,t,r){let o=await e0(e);if(typeof o=="number")return o;let n=o;if(n.bucket==="link-ecosystem"){let l=n.suggestedProvider;return b("this device is managed by an ecosystem"),h(`\u2192 link the ecosystem instead: ${l?`\`acbridge link ${Xk(l)}\``:"use the app"}`),1}if(n.bucket==="identified-only")return b("no direct local adapter for this device"),h(n.identity.hint?`\u2192 ${n.identity.hint}`:"\u2192 control it via a linked Home Assistant (`acbridge link home-assistant`), or wait for a future adapter"),1;if(!n.localProtocol)return b(`no local protocol resolved for ${n.discoveredId} \u2014 rescan and try again`),1;h(Se(`connecting ${lg(n)} via ${n.localProtocol}\u2026`));let i={discoveredId:n.discoveredId,protocol:n.localProtocol,...t?{name:t}:{}},a=await Z("/local/connect",{method:"POST",body:i,timeoutMs:15e3});if(a.hubOffline)return b(De()),1;let s=a.body;return a.status===200&&s?.ok?(A(`connected \u2014 ${s.deviceId??n.discoveredId}${s.accountId?` (account ${s.accountId})`:""}`),s.note&&h(s.note),h("It now appears in `acbridge status`, the app dashboard, and to Claude."),0):a.status===428&&s?.error==="pairing-required"?(b(s.note??"put the device in pairing mode (hold its button until it flashes), then connect again"),h(`\u2192 hold the button, then rerun: \`acbridge connect ${n.discoveredId}\``),1):a.status===428?W1(n,n.localProtocol,t,s?.note??null,r):(b(s?.error??`hub answered HTTP ${a.status}`),s?.note&&h(s.note),a.status===404&&h("\u2192 run `acbridge scan`, then retry with a fresh id"),s?.linkVia&&h(`\u2192 \`acbridge link ${Xk(s.linkVia)}\``),1)}async function W1(e,t,r,o,n){let i=og[t]??[],a=n??process.env.ACBRIDGE_CREDENTIALS_FILE,s;if(a){if(s=V1(a),!s)return 1}else if(process.stdin.isTTY&&process.stdout.isTTY&&i.length>0)s=await J1(i,o);else{b(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 h(`\u2192 pass --credentials-file <json> (or set ACBRIDGE_CREDENTIALS_FILE)${p}`),1}h(Se(`connecting ${lg(e)} via ${t} with credentials\u2026`));let l={discoveredId:e.discoveredId,protocol:t,...r?{name:r}:{},credentials:s},u=await Z("/local/connect",{method:"POST",body:l,timeoutMs:15e3});if(u.hubOffline)return b(De()),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&&h(d.note),h("It now appears in `acbridge status`, the app dashboard, and to Claude."),0):(b(d?.error??`hub answered HTTP ${u.status}`),d?.note&&h(d.note),1)}function V1(e){let t;try{t=M1(e,"utf8")}catch{b(`cannot read credentials file: ${e}`);return}let r;try{r=JSON.parse(t)}catch{b(`credentials file is not valid JSON: ${e}`);return}if(!r||typeof r!="object"||Array.isArray(r)){b("credentials file must be a JSON object of field \u2192 value");return}let o={};for(let[n,i]of Object.entries(r))i!=null&&(o[n]=String(i));return o}async function J1(e,t){t&&h(t);let r={};for(let o of e)o.helpText&&h(Se(o.helpText)),r[o.key]=await q1(`${o.label}: `,o.secret);return r}function q1(e,t){return new Promise(r=>{let o=B1({input:process.stdin,output:process.stdout,terminal:!0});if(t){let n=!1,i=o;i._writeToOutput=a=>{n?(a.includes(`
253
- `)||a.includes("\r"))&&process.stdout.write(`
254
- `):(process.stdout.write(e),n=!0)}}o.question(e,n=>{o.close(),r(n.trim())})})}async function e0(e){let t=await Z("/local/discovered");if(t.hubOffline)return b(De()),1;if(t.status!==200||!t.body)return b(`hub answered HTTP ${t.status} reading /local/discovered`),1;let r=t.body.devices;if(e.startsWith("ldev_")){let o=r.find(n=>n.discoveredId===e);return o||(b(`unknown discoveredId ${e} \u2014 run \`acbridge scan\` and use an id from its results`),1)}if(Yk(e)){let o=$t(e),n=r.find(i=>i.addresses.mac===o);return n||(b(`no discovered device with MAC ${o} \u2014 run \`acbridge scan\` first`),1)}if(cg(e)){let o=r.filter(n=>n.addresses.ip===e);if(o.length===1)return o[0];if(o.length===0)return b(`no discovered device at ${e} \u2014 run \`acbridge scan\` first`),1;b(`${o.length} devices share ${e} \u2014 pick one by id:`);for(let n of o)h(` ${n.discoveredId} ${lg(n)}`);return 1}return b(`not a MAC, IP, or ldev_\u2026 id: ${e}`),h(Fn),2}var lg=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 K1(e,t){let r;if(e.startsWith("dev_"))r=e;else if(Yk(e))r=Kk(e);else if(e.startsWith("ldev_")||cg(e)){let n=await e0(e);if(typeof n=="number")return n;if(!n.addresses.mac)return b(`${e} has no stable identity (no MAC) \u2014 it was never connected, so there is nothing to forget`),1;r=Kk(n.addresses.mac)}else return b(`not a deviceId, MAC, IP, or ldev_\u2026 id: ${e}`),h(Fn),2;let o=await Z("/local/forget",{method:"POST",body:{deviceId:r,purge:t}});return o.hubOffline?(b(De()),1):o.status===200&&o.body?.ok?(A(`forgot ${r}${t?" (purged)":""} \u2014 it will not be auto-reconnected`),o.body.note&&h(o.body.note),0):(b(o.body?.error??`hub answered HTTP ${o.status}`),1)}async function X1(e){if(e!=="on"&&e!=="off")return b(`--auto takes on|off, got: ${e||"(none)"}`),h(Fn),2;let t=await Z("/local/config");if(t.hubOffline)return b(De()),1;if(t.status!==200||!t.body)return b(`hub answered HTTP ${t.status} reading /local/config`),1;let r={...t.body,autoConnect:e==="on"?"open-protocols":"off"},o=await Z("/local/config",{method:"POST",body:r});return o.hubOffline?(b(De()),1):o.status!==200||!o.body?(b(`hub answered HTTP ${o.status} writing /local/config`),1):(o.body.autoConnect==="open-protocols"?(A("auto-connect ON (open protocols)"),h("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 vR}from"node:fs";function Ic(){return av({marketplaceDir:Rr,claudeCmd:An()})}function Y1(e=W){return ga(Er(Pr(e)))}function Ac(e){return fv(Rr,{settingsFile:e?.settingsFile,configFile:e?.configFile,env:e?.env,nodeCommand:e?.nodeCommand??Y1(e?.bridgeDir)})}function Ec(e={}){let t=[],r=e.ensurePluginInstalled??Ic;try{let n=r();n.marketplaceRepointed?t.push({level:"info",message:"Re-pointed the alexa plugin marketplace to this install."}):n.pluginReinstalled&&t.push({level:"info",message:"Refreshed the alexa plugin from this install."})}catch(n){t.push({level:"warn",message:`plugin refresh skipped: ${n.message}`})}let o=e.ensureStatusline??Ac;try{let n=o();n.changed&&t.push({level:"info",message:n.enabled?"Installed the AC Bridge statusline tee (chains any existing statusline).":"Removed the AC Bridge statusline tee (original restored)."})}catch(n){t.push({level:"warn",message:`statusline tee skipped: ${n.message}`})}return t}function t0(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 n0(e){if(e.reason!==null&&e.now-e.reason.ts<(e.reasonFreshMs??6e4)&&e.reason.signal!=="account-switched")return{action:"exit-clean"};let r=e.windowMs??3e5;return e.respawnTimes.filter(n=>e.now-n<r).length>=(e.maxRespawns??3)?{action:"exit-fail",why:"the hub keeps dying \u2014 respawn cap reached (see ~/.claude-bridge/hub.log)"}:{action:"respawn"}}function r0(e,t,r){return t==="offline"?"handle-offline":t==="unknown"||e.holderId===null?"rehold":e.wantRevert&&r&&r.active===!1?"rearm":"none"}import{createInterface as sR}from"node:readline/promises";function Mn(e={}){let t=(e.payloadVersion??(()=>Ct()))();if(t!==null)return{version:t,channel:"app"};let r=(e.bundledVersion??Lk)(),o=Eh(r);return o!==null?{version:o,channel:"npm"}:{version:null,channel:null}}function Pc(e=O){let t=he(),r=e(t.refreshFile)?.trim(),o=r?Ze(r):null;if(o)return o;let n=e(t.accessFile)?.trim();return n?Ze(n):null}var o0="https://www.ac-bridge.com/home";function i0(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 ${o0}, then retry.`}:t.plan==="free"?{allowed:!1,message:`No active subscription \u2014 start the 3-day free trial at ${o0}, then retry.`}:{allowed:!0}}var Q1=/^(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 a0(e){let t=Q1.exec(e);if(!t)return null;let r=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:r}}function eR(e,t){let r=typeof e=="number",o=typeof t=="number";return r&&!o?-1:!r&&o?1:e<t?-1:e>t?1:0}function Oi(e,t){let r=a0(e),o=a0(t);if(!r||!o)return null;for(let i of["major","minor","patch"])if(r[i]!==o[i])return r[i]<o[i]?-1:1;if(r.prerelease.length===0&&o.prerelease.length===0)return 0;if(r.prerelease.length===0)return 1;if(o.prerelease.length===0)return-1;let n=Math.min(r.prerelease.length,o.prerelease.length);for(let i=0;i<n;i++){let a=eR(r.prerelease[i],o.prerelease[i]);if(a!==0)return a}return r.prerelease.length!==o.prerelease.length?r.prerelease.length<o.prerelease.length?-1:1:0}var s0="npm i -g acbridge@latest",tR="https://www.ac-bridge.com/api/releases/manifest",ug=6*36e5,nR="https://www.ac-bridge.com";function rR(e=process.platform){return e==="win32"?"windows":e==="darwin"?"macos":e==="linux"?"linux":null}function c0(e){if(typeof e!="object"||e===null)return null;let t=e;if(t.schemaVersion!==1)return null;let r={},o=typeof t.platforms=="object"&&t.platforms!==null?t.platforms:{};for(let i of["windows","macos","linux"]){let a=o[i];typeof a=="object"&&a!==null&&typeof a.version=="string"&&(r[i]={version:a.version})}let n=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:nR,platforms:r,cli:n?{version:typeof n.version=="string"?n.version:null,minimumVersion:typeof n.minimumVersion=="string"?n.minimumVersion:null}:null}}async function Cc(e={}){let t=process.env.BRIDGE_UPDATE_MANIFEST_URL||tR;try{let r=await(e.fetchImpl??fetch)(t,{signal:AbortSignal.timeout(e.timeoutMs??6e3)});if(!r.ok)return null;let o=c0(await r.json());return o&&oR(o,e.now),o}catch{return null}}function oR(e,t=Date.now()){try{let r={};try{let o=JSON.parse(O(ke)??"{}");typeof o=="object"&&o!==null&&!Array.isArray(o)&&(r=o)}catch{r={}}r.updateCheck={manifest:e,fetchedAt:t},ge(ke,`${JSON.stringify(r,null,2)}
255
- `)}catch{}}function Tc(e=ug,t=Date.now()){try{let r=O(ke);if(!r)return null;let n=JSON.parse(r).updateCheck;return!n||typeof n!="object"||typeof n.fetchedAt!="number"||t-n.fetchedAt>e?null:c0(n.manifest)}catch{return null}}function Di(e,t,r=process.platform,o="app"){if(e===null)return{state:"dev"};if(!t)return{state:"unknown"};if(o==="npm"){let a=t.cli;return a?a.minimumVersion&&Oi(e,a.minimumVersion)===-1?{state:"blocked",current:e,minimum:a.minimumVersion,upgrade:s0}:a.version&&Oi(e,a.version)===-1?{state:"update",current:e,latest:a.version,upgrade:s0}:{state:"current",current:e}:{state:"unpublished",current:e}}if(t.minimumVersion&&Oi(e,t.minimumVersion)===-1)return{state:"blocked",current:e,minimum:t.minimumVersion,upgrade:t.downloadPage};let n=rR(r),i=n?t.platforms[n]?.version:void 0;return i&&Oi(e,i)===-1?{state:"update",current:e,latest:i,upgrade:t.downloadPage}:{state:"current",current:e}}function l0(e,t,r=process.platform,o="app"){let n=Di(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 cR="Not signed in on this machine. Run `acbridge login`, sign in via the AC Bridge app, or `acbridge pair <code>` (get a code from the app: System \u2192 Add another machine).";function Bn(e=O,t={}){let r=t.paths??he(),o=e(r.accessFile)?.trim(),n=e(r.refreshFile)?.trim();if(o||n)return(t.resolveScope??(()=>pt()))()?{ok:!0,paired:!!n}:(t.readPointer??(()=>$e()))()?{ok:!1,message:Je.pointerMismatch}:{ok:!0,paired:!!n};let i=(t.scan??dt)();return i.length===0?{ok:!1,message:cR}:(nt(i),{ok:!1,message:Je.pointerMismatch})}async function cr(e){if(await(e?.hubHealthy??Te)())return{ok:!0};let r=Bn(e?.read??O);return r.ok?{ok:!0}:{ok:!1,message:r.message}}function u0(e={}){let t=e.resolveScope??(()=>pt()),o=(e.layout??Kt())>=Xt,n=o?(e.scan??dt)():[];(e.warnAmbiguous??(u=>nt(u)))(n);let i=t();if(i)return i;if((e.readPointer??(()=>$e()))())return null;let s=u=>((e.writePointer??(d=>Yt({sub:d})))(u),t());if(o){if(n.length!==1)return null;let u=n[0];return Oa(u,e.segmentOf)?s(u.sub):null}let l=(e.readCredentialSub??Pc)();return l?s(l):null}function lR(){let e=u0();return e?ha({configFile:qo(e).userConfigFile}).onboardedAt:null}function uR(e){let t=u0();t&&va({onboardedAt:e},{configFile:qo(t).userConfigFile})}async function dR(e={}){let t=(e.build??Mn)(),r=e.clientVersion?e.clientVersion():t.version;if(r===null)return{ok:!0};let o=await(e.fetchManifest??Cc)()??(e.cachedManifest??Tc)(ug);if(!o)return(e.warnLine??U)("update check unreachable \u2014 continuing (it will retry next run)"),{ok:!0};let n=Di(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??h)(`update available: ${n.latest} (you have ${n.current}) \u2014 ${n.upgrade}`),{ok:!0})}var pR="This machine's sign-in is no longer valid (the relay rejected its stored credential). Run `acbridge login` to sign in again.";function mR(){return!!O(he().refreshFile)?.trim()}var fR="This account hasn't completed setup yet. Run `acbridge login --if-needed` on this machine to complete it from the terminal, or finish first-run setup in the AC Bridge app.";async function ho(e={}){let t=e.read??O,r=Bn(t);if(!r.ok){let m=e.isTTY??!!(process.stdin.isTTY&&process.stdout.isTTY)?(e.findApp??(()=>Tr()))():null;if(m&&await(e.offerAndLaunch??gR)(m)&&(r=Bn(t)),!r.ok)return{ok:!1,exitCode:3,message:r.message}}let o=e.relayUrl??ne().relayUrl,n=e.fetchImpl??fetch;if(!await(e.refreshToken??(p=>Tt(p)))(o)&&!(e.hasRefreshCredential??mR)())return{ok:!1,exitCode:3,message:pR};let a=t(he().accessFile)?.trim()??"",s={reachable:!1,completedAt:null};try{let p=await n(`${o.replace(/\/+$/,"")}/settings`,{headers:{authorization:`Bearer ${a}`},signal:AbortSignal.timeout(6e3)});if(p.ok){let f=(await p.json()).config?.onboarding?.completedAt;s={reachable:!0,completedAt:typeof f=="number"?f:null}}}catch{}if(s.reachable){if(s.completedAt===null)return{ok:!1,exitCode:3,message:fR};(e.cacheOnboardedAt??uR)(s.completedAt)}else if((e.cachedOnboardedAt??lR)()===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 dR(e.updateGate);if(!l.ok)return l;let u=await(e.fetchEntitlement??Ot)(a),d=i0("preflight",u);return d.allowed?{ok:!0}:{ok:!1,exitCode:5,message:d.message}}async function gR(e){let t=sR({input:process.stdin,output:process.stdout}),r=!1;try{let n=(await t.question("Not signed in \u2014 open the AC Bridge app to sign in? [Y/n] ")).trim().toLowerCase();r=n===""||n==="y"||n==="yes"}finally{t.close()}if(!r||!await Sa(e))return!1;Y("waiting for you to finish signing in in the app\u2026");let o=await _a({timeoutMs:18e4});return o&&h("signed in \u2014 continuing."),o}var hR=["relayUrl","hubPort","machine"];async function Rc(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 vo(e,t,r=fetch){if(!t)return null;let o;try{o=await Rc(e,t,r)}catch(n){return h(`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 hR){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 a={};try{a=JSON.parse(O(ke)??"{}"),(typeof a!="object"||a===null||Array.isArray(a))&&(a={})}catch{a={}}let s={...a,...i};if(JSON.stringify(s)===JSON.stringify(a))return o;ge(ke,`${JSON.stringify(s,null,2)}
256
- `),h(`Synced cloud settings into config.json (${Object.keys(i).join(", ")}).`)}catch(n){h(`Cloud settings sync skipped (${n instanceof Error?n.message:String(n)}).`)}return o}var yR=3e3;async function Oc(e=[]){let t=!e.includes("--no-revert"),{relayUrl:r}=ne(),o=await ho();if(!o.ok)return b(o.message),o.exitCode;if(!await Tt(r))return b("No valid credential. Run `acbridge login`, or sign in via the app."),3;await vo(r,O(he().accessFile)??"");for(let y of Ec())(y.level==="info"?h:U)(y.message);let n=(await it({kind:"daemon"})).holderId;try{vR(Ve,String(process.pid))}catch{}let i=Date.now();ig(i),setInterval(()=>ig(i),Uk).unref();let a,s=!1,l=async()=>{let y=await Z("/local/session/activate",{method:"POST",body:{revertOnStop:t},timeoutMs:8e3});s=!y.hubOffline&&y.status===200&&y.body?.active===!0,a=y.body?.active?y.body.sessionId:void 0};await l();let u=!1,d=async(y=0)=>{u||(u=!0,n&&await $c(n).catch(()=>{}),ue(Ve),jk(),process.exit(y))};process.once("SIGINT",()=>{d()}),process.once("SIGTERM",()=>{d()}),A(`Bridge running \u2014 hub connected, revert-on-stop ${t?"armed":"off"}. Ctrl-C to stop.`);let p=[],m=async()=>{let y=n0({reason:t0(O(Ko)),now:Date.now(),respawnTimes:p});if(y.action==="exit-clean"){A("hub stopped \u2014 daemon exiting."),await d();return}if(y.action==="exit-fail"){b(y.why),await d(1);return}p.push(Date.now()),U("hub went down without a stop \u2014 respawning it\u2026");try{n=(await it({kind:"daemon"})).holderId,await l(),A("hub respawned")}catch(k){U(`respawn failed: ${k.message} \u2014 retrying on the next beat`),n=null}},f=!1,g=async()=>{if(!(f||u)){f=!0;try{let y=n?await Vk(n):await Te()?"unknown":"offline",k=null;if(y==="ok"&&t){let P=await Z("/local/session/heartbeat",{method:"POST",body:{...a?{sessionId:a}:{}},timeoutMs:4e3});!P.hubOffline&&P.status===200&&P.body&&(k={active:P.body.active})}let _=r0({holderId:n,wantRevert:t,sessionArmed:s},y,k);_==="handle-offline"?await m():_==="rehold"?(n=await Sc("daemon"),t&&await l()):_==="rearm"&&await l()}finally{f=!1}}};return setInterval(()=>{g()},yR),await new Promise(()=>{}),0}var dg=["Usage: acbridge devices [list] [--json]"," acbridge devices on|off <device>"," acbridge devices set <device> <capability.command|command> [--param k=v ...]"].join(`
257
- `);function pg(e,t){let r=e.find(a=>a.id===t);if(r)return{ok:!0,device:r};let o=t.toLowerCase(),n=e.filter(a=>a.name.toLowerCase()===o);if(n.length===1)return{ok:!0,device:n[0]};let i=n.length>1?n:e.filter(a=>a.name.toLowerCase().includes(o));return i.length===1?{ok:!0,device:i[0]}:i.length>1?{ok:!1,kind:"ambiguous",candidates:i.map(a=>({id:a.id,name:a.name}))}:{ok:!1,kind:"not-found",candidates:[]}}function bR(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 d0(e,t,r){let o=t.indexOf("."),n=o>0?t.slice(0,o):null,i=o>0?t.slice(o+1):t,a=[];for(let d of e.capabilities)if(!(n&&d.type!==n))for(let p of rg[d.type]??[])p.command===i&&(p.gate&&!p.gate(d)||a.push({cap:d,entry:p}));if(a.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(a.length>1)return{ok:!1,message:`"${i}" is ambiguous on ${e.name} \u2014 qualify it: ${a.map(d=>`${d.cap.type}.${i}`).join(" | ")}`};let{cap:s,entry:l}=a[0],u=l.params.safeParse(r);if(!u.success){let d=u.error.issues[0];return{ok:!1,message:`bad params for ${s.type}.${i}: ${d?`${d.path.join(".")} ${d.message}`:"invalid"}`}}return{ok:!0,capability:s.type,command:i,params:u.data}}function xR(e,t){return{deviceId:e,capability:t.capability,command:t.command,params:t.params,consumer:"app"}}function kR(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 add them in the app"),o;for(let n of[...e.devices].sort((i,a)=>i.name.localeCompare(a.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 p0(){let e=await Z("/local/devices",{method:"GET",timeoutMs:5e3});if(!e.hubOffline&&e.status===200&&e.body)return{doc:e.body};let t=Pn();if(t.state==="mismatch")return{refusal:{message:t.message,exitCode:3}};if(t.state!=="ok")return null;let r=await sy(t.token);return r?{doc:r,note:"relay cache \u2014 bridge not running; state may be stale"}:null}async function m0(e=[]){let t=e.includes("--json");t&&we(!0);let r=e.filter(d=>!d.startsWith("--")),o=r[0]??"list";if(o==="list"){let d=await p0();if(d&&"refusal"in d)return Pe(d.refusal.message,d.refusal.exitCode);if(!d)return Pe("no device graph available \u2014 start the bridge (`acbridge start`) or sign in",1);if(t)xe(d.doc);else for(let p of kR(d.doc,d.note?{note:d.note}:void 0))h(p);return 0}if(o!=="on"&&o!=="off"&&o!=="set")return h(dg),Pe(`unknown devices subcommand: ${o}`,2);let n=r[1];if(!n)return h(dg),Pe("which device? give an id (dev_\u2026) or a name",2);let i=await p0();if(i&&"refusal"in i)return Pe(i.refusal.message,i.refusal.exitCode);if(!i)return Pe("no device graph available \u2014 start the bridge (`acbridge start`) or sign in",1);let a=pg(i.doc.devices,n);if(!a.ok){if(a.kind==="ambiguous"){for(let d of a.candidates)h(` ${d.name} (${d.id})`);return Pe(`"${n}" matches several devices \u2014 name one of the ids above`,2)}return Pe(`no device matches "${n}" \u2014 try \`acbridge devices\``,2)}let s;if(o==="on"||o==="off")s=d0(a.device,o==="on"?"power.turnOn":"power.turnOff",{});else{let d=r[2];if(!d)return h(dg),Pe("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=bR(p);if(!m.ok)return Pe(m.message,2);s=d0(a.device,d,m.params)}if(!s.ok)return Pe(s.message,2);let l=Or({notSignedIn:{message:"Not signed in. Run `acbridge login`, or sign in via the AC Bridge app.",exitCode:3}});if(!l.ok)return Pe(l.message,l.exitCode);let u=await cy(l.token,xR(a.device.id,s));return u.ok?(A(`${a.device.name}: ${s.capability}.${s.command}${u.verified===!0?" (verified)":""}`),u.note&&h(Se(u.note)),t&&xe({ok:!0,deviceId:a.device.id,capability:s.capability,command:s.command}),0):u.status===503?Pe("bridge not running \u2014 run `acbridge start` (device control routes through your PC)",1):(b(u.error??`command failed (${u.status||"network"})`),t&&xe({ok:!1,error:u.error??null,status:u.status,exit:1}),1)}import{spawnSync as Zc}from"node:child_process";import{existsSync as gD}from"node:fs";import gw from"node:path";import{createSocket as AR}from"node:dgram";import{readFile as ER}from"node:fs/promises";import{networkInterfaces as g0}from"node:os";import{execFile as SR}from"node:child_process";import{existsSync as _R}from"node:fs";import{join as $R}from"node:path";import{promisify as IR}from"node:util";var vH=new TextEncoder;var _H=IR(SR);function mg(e={}){let t=e.env??process.env,r=e.exists??(o=>_R(o));for(let o of(t.PATH??"").split(":"))if(o!=="")try{if(r($R(o,"powershell.exe")))return!0}catch{}return!1}var fg="239.255.90.90",gg=35090,h0=35091;function v0(e){return!e.internal&&(e.family==="IPv4"||e.family===4)}var ft={createSocket:(e,t)=>AR({type:e,reuseAddr:t?.reuseAddr??!0}),interfaceAddresses:()=>Object.values(g0()).flatMap(e=>e??[]).filter(v0).map(e=>e.address)};async function Dc(e={}){let t=e.timeoutMs??2e3,r=e.sockets??ft,o=await PR(e.readProcVersion??(()=>ER("/proc/version","utf8")),e.env??process.env),[n,i]=await Promise.all([CR(r,t).catch(()=>null),TR(r,t).catch(()=>null)]),a;try{a=(e.interfaces??RR)()}catch{a=void 0}let s={wsl:o,multicastOk:n,broadcastOk:i};a!==void 0&&(s.interfaces=a);try{let l=e.windowsInterop??(()=>mg({env:e.env??process.env}));o&&l()&&(s.interop="windows-arp")}catch{}return s}async function PR(e,t){if(t.WSL_DISTRO_NAME||t.WSL_INTEROP)return!0;try{return/microsoft/i.test(await e())}catch{return!1}}function CR(e,t){return new Promise(r=>{let o=[],n=[],i=!1,a=s=>{if(!i){i=!0;for(let l of n)clearTimeout(l);for(let l of o)try{l.close()}catch{}r(s)}};try{let s=`acbridge-mc-${Math.random().toString(36).slice(2)}`,l=new TextEncoder().encode(s),u=e.createSocket("udp4",{reuseAddr:!0});o.push(u),u.on("error",()=>a(null)),u.on("message",d=>{new TextDecoder().decode(d)===s&&a(!0)}),u.bind(gg,()=>{try{u.addMembership(fg)}catch{a(null);return}let d=e.createSocket("udp4",{reuseAddr:!0});o.push(d),d.on("error",()=>a(null)),d.bind(0,()=>{let p=()=>{try{d.setMulticastLoopback(!0),d.send(l,gg,fg,m=>{m&&a(null)})}catch{a(null)}};p(),n.push(setTimeout(p,Math.max(1,Math.floor(t/2))))}),n.push(setTimeout(()=>a(!1),t))})}catch{a(null)}})}function TR(e,t){return new Promise(r=>{let o,n,i=!1,a=s=>{if(!i){i=!0,n&&clearTimeout(n);try{o?.close()}catch{}r(s)}};try{o=e.createSocket("udp4",{reuseAddr:!0});let s=o;s.on("error",()=>a(null)),s.bind(0,()=>{try{s.setBroadcast(!0),s.send(new TextEncoder().encode("acbridge-env-probe"),h0,"255.255.255.255",l=>{if(!l)return a(!0);let u=l.code;a(u==="EACCES"||u==="ENETUNREACH"||u==="EHOSTUNREACH"?!1:null)})}catch{a(null)}}),n=setTimeout(()=>a(null),t)}catch{a(null)}})}function RR(){return Object.entries(g0()).filter(([,e])=>e?.some(v0)).map(([e])=>e)}var AO=qt(Q0(),1);var oZ=new TextDecoder;import{createDecipheriv as sZ,createHash as EO}from"node:crypto";var uZ=EO("md5").update("yGAdlopoPVldABfn").digest(),dZ=new TextDecoder;var vZ=30*6e4;var CO=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"]),TO={"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([...CO].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 AZ=new TextDecoder;var ow=Buffer.from("020000010000000000000000463cb5d3","hex"),TZ=new TextEncoder,RZ=new TextDecoder;var GZ=new TextDecoder;var sw="239.255.255.250",Fg=1982,cw=["M-SEARCH * HTTP/1.1",`HOST: ${sw}:${Fg}`,'MAN: "ssdp:discover"',"ST: wifi_bulb","",""].join(`\r
258
- `);var KZ=new TextDecoder;var l3=new TextDecoder;var lw="239.255.255.250",uw=1900,tD=["M-SEARCH * HTTP/1.1",`HOST: ${lw}:${uw}`,'MAN: "ssdp:discover"',"MX: 3","ST: ssdp:all","",""].join(`\r
259
- `),g3=new TextDecoder;var S3=new Uint8Array([0]);import{spawnSync as dw}from"node:child_process";var Mg=Kh("cli");function mD(e){try{let t=dw(e,{shell:!0,encoding:"utf8",timeout:5e3});return`${t.stdout??""}${t.stderr??""}`}catch{return""}}function pw(e=process.platform){return nv({platform:e,programs:[process.execPath],ruleName:Mg,runCheck:mD,runElevated:t=>{e!=="win32"&&dw("sudo",["sh","-c",t],{stdio:"inherit"})}})}function mw(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 a=r.source==="peer-wsl"?"on Windows":"inside WSL";t.push({grade:"ok",line:`hub state home: ${r.dir} \u2014 the hub runs ${a}, 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 a=Math.max(0,Math.round((e.nowMs-i.ts)/6e4));t.push({grade:"warn",line:`a Profiles signal from this machine was refused ${a}m ago (HTTP ${i.status})${i.hint?` \u2014 ${i.hint}`:""}`})}return t}import{spawnSync as fD}from"node:child_process";function Qe(e={}){let t=e.env??process.env,r=e.clientVersion!==void 0?e.clientVersion:Ct(t),o=e.bundled??Ri();return ra({isDevBuild:r===null&&!o,env:t})}function fw(){return qh({voice:Qe(),runElevated:e=>{e.method==="sudo"&&fD(e.file,e.args,{stdio:"inherit"})}})}function hD(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 vD(){let e=await Dc();e.wsl?U("WSL detected \u2014 LAN scan degraded (mDNS/broadcast limited)"):A("host is not WSL \u2014 LAN discovery unrestricted"),e.multicastOk===!0?e.wsl?U("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?U("multicast self-test failed \u2014 mDNS discovery unavailable"):U("multicast self-test could not run (inconclusive)"),e.wsl&&(e.interop==="windows-arp"?A("WSL interop scanning available (powershell.exe \u2014 Windows neighbor table)"):U("WSL interop unavailable (powershell.exe not on PATH) \u2014 ARP discovery sees only the WSL subnet"));let t=await Z("/local/discovered");t.hubOffline?U("hub control API unreachable \u2014 scan/connect unavailable (start it: `acbridge daemon` or the app)"):t.status===200?A(`hub control API reachable (127.0.0.1:${ne().hubPort})`):U(`hub control API answered HTTP ${t.status} \u2014 token mismatch? restart the hub`);try{let r=a=>{let s=Zc(a,{shell:!0,encoding:"utf8",timeout:4e3});return`${s.stdout??""}${s.stderr??""}`};if(Bo(process.platform,{})==="wsl-host"){h(`firewall: ${Dl}`);return}let o=Rl(process.platform,r),n=Bo(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)?h("firewall state undetectable without sudo"):A("firewall: no active firewall detected \u2014 scanning unrestricted");else{let a=Ol(n,{programs:[process.execPath],ruleName:Mg});if("state"in a?A("firewall: no active firewall detected \u2014 scanning unrestricted"):a.evalCheck(a.checkCommands.map(r))?A(`firewall: rule present (${n})`):U(`firewall rule missing \u2014 allow it with: ${a.manualCommand} (or use the app's Scan panel to cover the desktop app)`),n==="windows"){let s=ev(r("netsh advfirewall firewall show rule name=all dir=in verbose"),process.execPath),l=tv(Qh(r("netsh advfirewall show currentprofile")),s);l&&U(l)}}$l(Fo())==="keyring"?A("integration secrets: OS keyring (encrypted at rest, as this CLI resolves it)"):h("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{h("firewall state undetectable without sudo")}}async function yD(){let e=Sr({fresh:!0}),t=W,r="unknown",o=e.beacon?.port??ry(),n=O(Ah(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 a=O(gw.join(t,"launch-last.json"));if(a)try{let l=JSON.parse(a);l.error?h(`last launch: REFUSED (${l.terminalId}, ${l.cwd}) \u2014 ${l.error}`):h(`last launch: ${l.terminalId} \u2192 ${l.file} ${JSON.stringify(l.args??[])}`)}catch{}let s=O(gw.join(t,"hooks-last-error.json"));if(s){let l=JSON.parse(s);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 hw(e={}){let t=0,r=z=>{t++,b(z)},o=null,n=()=>o??=An(),i=(e.build??Mn)(),a=e.clientVersion?e.clientVersion():i.version,s=e.fetchManifest??Cc,l=l0(a,a===null?null:await s(),process.platform,i.channel??"app");l.grade==="ok"?A(l.line):l.grade==="warn"?U(l.line):l.grade==="bad"?r(l.line):h(l.line);let u=e.voice??Qe({clientVersion:a}),d=(e.claudeVersion??(()=>bD(n())))(),p=ia(process.platform).manualCommand;if(d===null)r(`claude CLI not found on PATH \u2014 install it: ${p}`);else{let z=wv(d);z.ok?A(`claude ${z.version}`):r(`claude ${z.version??"?"} \u2014 channels need \u2265 2.1.80 \u2014 reinstall: ${p}`)}let m=(e.codexVersion??xD)(),f=e.codexLoggedIn??la,g=hD(m,f());g.grade==="ok"?A(g.line):U(g.line);let y=(e.nodeRuntime??(()=>Er(Pr(W))))();y.kind==="shim"?A(`node runtime: bundled shim (${y.command})`):y.kind==="system"?A(`node v${y.version}`):r("node not found \u2014 install Node \u2265 20 or the AC Bridge app"),(e.pluginInstalled??(()=>kD(n())))()?A(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 _=Kn(),P=(e.managedSettingsRaw??(()=>O(_)))(),C=_v(P);u?C.allowed?A("channel allowlisted in managed settings"):C.present?r(`channel not allowlisted in ${_} \u2014 run \`acbridge setup\``):r(`managed settings missing at ${_} \u2014 run \`acbridge setup\``):A("managed settings not used (voice off \u2014 no channel allowlist needed)"),(e.hubBundlePresent??(()=>gD(Xo)))()?A("hub bundle present"):U("hub bundle not built \u2014 run `npm run build` (dev uses tsx)");let D=(e.signedIn??Pn)(),G=D.state==="ok"?D.token:"";D.state==="ok"?A("signed in (relay token present)"):D.state==="mismatch"?r(Je.pointerMismatch):U("not signed in \u2014 run `acbridge login`, sign in via the app, or `acbridge pair <code>`");let ae=(e.onboardingVerified??wD)();ae!==null?A(`account setup verified (${new Date(ae).toISOString().slice(0,10)})`):h("account setup not yet verified here \u2014 start/run check the relay on first use");let X=(e.appInstalled??Tr)();if(X?A(`desktop app found (${X.path})`):h("desktop app not found on this machine \u2014 sign-in handoff unavailable (browser `acbridge login` works)"),G){let vt=await(e.fetchEntitlement??Ot)(G);vt?h(`plan ${vt.plan}; capture telemetry=${vt.capture.telemetry} transcripts=${vt.capture.transcripts}`):h("entitlement: couldn't read from the relay (offline?)");let et=(e.entitlementFileAgeH??SD)();et==="absent"?h("entitlement file absent \u2014 capture off until the hub next syncs"):et==="unreadable"?U("entitlement file unreadable \u2014 capture off, fail-closed"):et<=24?A(`entitlement file fresh (${et.toFixed(1)}h)`):U(`entitlement file STALE (${et.toFixed(1)}h) \u2014 capture off, fail-closed`)}await(e.hubRunning??Te)()?A("hub running"):h(u?"hub not running (starts automatically on `acbridge run`)":"hub not running (start it: `acbridge start`)");for(let z of mw(await(e.homeFacts??yD)()))z.grade==="ok"?A(z.line):z.grade==="warn"?U(z.line):z.grade==="bad"?r(z.line):h(z.line);let Ee=(e.claudeEnvironments??Iv)();for(let z of Ee)z.claudePresent&&(z.pluginInstalled?A(`Claude Code wired for Profiles \u2014 ${z.label}`):U(`Claude Code is installed in ${z.label} WITHOUT the bridge plugin \u2014 sessions there drive no devices. Fix: ${z.setupHint}`));return await(e.discoveryPreflight??vD)(),h(""),t?b(`${t} problem(s) found`):A("all checks passed"),t?1:0}function bD(e){let t=e??An(),r=Zc(t.file,[...t.argsPrefix,"--version"],{encoding:"utf8"});return r.status===0?r.stdout??"":null}function xD(){let e=$r(),t=Zc(e.file,[...e.argsPrefix,"--version"],{encoding:"utf8",timeout:5e3});return t.status===0?(t.stdout||t.stderr||"").trim()||"unknown":null}function kD(e){let t=e??An(),r=Zc(t.file,[...t.argsPrefix,"plugin","list"],{encoding:"utf8"});return Sv(`${r.stdout??""}${r.stderr??""}`).ok}function wD(){let e=kt();return e?ha({configFile:e.userConfigFile}).onboardedAt:null}function SD(){let e=kt(),t=e?O(e.entitlementFile):null;if(!t)return"absent";try{let r=JSON.parse(t);return(Date.now()-(r.fetchedAt??0))/36e5}catch{return"unreadable"}}var _D=["tuya","meross","ewelink","govee"];function $D(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(a=>String(a.baseUrl??a.accountId??"")).join(", ")}:{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(", ")}:{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(a=>String(a.host??a.bridgeId??"")).join(", ")}:{hint:"acbridge link hue"}});for(let a of _D){let s=e.hasKeystore(a);t.push({provider:a,kind:"keyed",status:s?"linked":"not linked",...s?{}:{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");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 ID(e){return e.map(t=>`${t.provider.padEnd(16)} ${t.status.padEnd(18)} ${t.detail??t.hint??""}`.trimEnd())}async function vw(e=[]){let t=e.includes("--json");t&&we(!0);let r=Pn(),o=r.state==="ok"?await uy(r.token):null,n=kt(),i=$D({accounts:a=>n?Dr(n,a):[],hasKeystore:a=>n?_r(n,a,"keystore").read()!==null:!1,cloudAccounts:o});if(t)xe(i);else for(let a of ID(i))h(a);return 0}import*as yw from"node:https";import{createInterface as bw}from"node:readline/promises";function Hg(){let e=Sr({fresh:!0});if(e.source==="peer-wsl"||e.source==="peer-windows"){let o=e.source==="peer-wsl"?"on Windows":"inside WSL";return b(`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=kt();if(t)return t;let r=Bn();return r.ok?(b($e()?"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):(b(r.message),null)}var AD=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 gr(e){if(e.file!==void 0){let t=(e.read??O)(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??U)(AD(e.flag)),{ok:!0,value:e.argv.trim()}):{ok:!0,value:(e.env??"").trim()}}function ED(e){let t={},r=(o,n,i,a)=>o===`--${Bg(n)}`?(t[n]=a[++i],i):(o.startsWith(`--${Bg(n)}=`)&&(t[n]=o.slice(`--${Bg(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 Bg=e=>e==="bridgeId"?"bridge-id":e==="clientId"?"client-id":e.endsWith("File")?`${e.slice(0,-4)}-file`:e,PD=e=>/^(https?|wss?):\/\/[^\s]+$/i.test(e),xw="Usage: acbridge link home-assistant --url http://homeassistant.local:8123 --token <long-lived-access-token> | --token-file <path> [--units metric|imperial]",kw="Usage: acbridge link hue --host <bridge-ip> [--bridge-id <id>] [--key <existing-app-key> | --key-file <path>]",ww="Usage: acbridge link smartthings (opens a browser sign-in via the relay; tokens seal at the relay)",Sw="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)",_w="Usage: acbridge link meross [--email <you@example.com>] [--password <pw> | --password-file <path>] [--region eu|us|ap] [--mfa <6-digit-2fa-code>]",$w="Usage: acbridge link ewelink [--email <you@example.com>] [--password <pw> | --password-file <path>] [--region eu|us|as|cn]",Iw="Usage: acbridge link govee [--key <govee-api-key> | --key-file <path>] (Govee Home app \u2192 profile \u2192 Settings \u2192 Apply for API Key)",Aw="Usage: acbridge link mqtt --host <broker-host[:port]> [--username <u>] [--password <p> | --password-file <path>] [--prefix homeassistant]",CD="nanoleaf pairs per-device, not per-account: run `acbridge scan`, then `acbridge connect <device>` and hold the panel's power button.";async function Ew(e){let t=e[0],r=ED(e.slice(1));if(t==="smartthings")return DD();if(t==="tuya")return ND(r);if(t==="meross")return LD(r);if(t==="ewelink")return UD(r);if(t==="govee")return zD(r);let o;if(t==="home-assistant"||t==="homeassistant")o=TD(r);else if(t==="hue")o=await OD(r);else if(t==="mqtt")o=RD(r);else return b(`unsupported provider: ${t??"(none)"}. Supported: home-assistant, hue, smartthings, tuya, meross, ewelink, govee, mqtt`),h(xw),h(kw),h(ww),h(Sw),h(_w),h($w),h(Iw),h(Aw),h(CD),2;if(!o)return 1;Y("Bringing up the integration\u2026");try{let{spawned:n}=await it({kind:"cli"});n||await qk(),A(`Linked \u2014 your ${o.label} devices should now appear in the app and to Claude.`)}catch(n){h(`Recorded. Start the node when ready (\`acbridge daemon\`) to bring it up. (${n.message})`)}return 0}function TD(e){let t=Hg();if(!t)return null;let r=(e.url??"").trim().replace(/\/+$/,""),o=gr({flag:"--token",argv:e.token,file:e.tokenFile,env:process.env.BRIDGE_HA_TOKEN});if(!o.ok)return b(o.message),null;let n=o.value;if(!PD(r))return b("Missing/invalid --url. Give your Home Assistant base URL, e.g. http://homeassistant.local:8123"),h(xw),null;if(!n)return b("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,a=Pa("homeassistant",r);_r(t,"homeassistant",a).write(n);let s=Dr(t,"homeassistant").filter(l=>l.accountId!==a);return Da(t,"homeassistant",[...s,{accountId:a,baseUrl:r,...i?{unitSystem:i}:{}}]),A(`Linked Home Assistant (${r}). Token stored locally; account ${a}.`),{label:"Home Assistant"}}function RD(e){let t=Hg();if(!t)return null;let r=(e.host??e.url??"").trim(),{host:o,port:n,tls:i}=Nk(r);if(!o)return b("Missing --host. Give your broker's address, e.g. --host 192.168.1.5 (or mqtts://broker.lan:8883)."),h(Aw),null;let a=(e.username??"").trim(),s=gr({flag:"--password",argv:e.password,file:e.passwordFile,env:process.env.BRIDGE_MQTT_PASSWORD});if(!s.ok)return b(s.message),null;let l=s.value;if(l&&!a)return b("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=Pa("mqtt",d);_r(t,"mqtt",p).write(l);let m=Dr(t,"mqtt").filter(f=>f.accountId!==p);return Da(t,"mqtt",[...m,{accountId:p,host:o,...n!==void 0?{port:n}:{},...i?{tls:i}:{},...a?{username:a}:{},...u?{discoveryPrefix:u}:{}}]),A(`Linked MQTT broker ${d}${a?` as ${a}`:" (anonymous)"}. Account ${p}.`),h(`Watching \`${u||"homeassistant"}/#\` for Home Assistant Discovery configs \u2014 Zigbee2MQTT, Tasmota and anything else that publishes them.`),{label:"MQTT"}}async function OD(e){let t=Hg();if(!t)return null;let r=(e.host??"").trim();if(!r)return b("Missing --host. Give your Hue Bridge IP, e.g. --host 192.168.1.42"),h(kw),null;let o=(e.bridgeId??"").trim().toLowerCase(),n;if(!o){let d=await jD(r);o=d.bridgeId??r.toLowerCase(),n=d.name}let i=gr({flag:"--key",argv:e.key,file:e.keyFile,env:process.env.BRIDGE_HUE_KEY});if(!i.ok)return b(i.message),null;let a=i.value||void 0,s;if(a)s=JSON.stringify({appkey:a.trim()}),h("Using the provided app key (skipping link-button pairing).");else{Y("Press the link button on top of your Hue Bridge now \u2014 pairing completes within 30s\u2026");try{let d=await FD(r);s=JSON.stringify({appkey:d.appkey,...d.clientkey?{clientkey:d.clientkey}:{}})}catch(d){return b(`Hue pairing failed: ${d.message}`),null}}let l=Pa("hue",o);_r(t,"hue",l).write(s);let u=Dr(t,"hue").filter(d=>d.accountId!==l);return Da(t,"hue",[...u,{accountId:l,host:r,bridgeId:o,...n?{name:n}:{}}]),A(`Linked Philips Hue (${r}, bridge ${o}). Keys stored locally; account ${l}.`),{label:"Philips Hue"}}async function DD(){let e=Bn();if(!e.ok)return b(e.message),3;Y("Starting SmartThings sign-in\u2026");let t=await py("smartthings");return!t.ok||!t.authorizeUrl?(b(t.error??"Couldn't start SmartThings linking."),h(ww),1):(A("Open this URL in a browser, sign in to Samsung, and approve access:"),h(t.authorizeUrl),h("The account links at the relay; the hub picks it up automatically on its next connect (or restart the hub)."),0)}async function ND(e){let t=await cr();if(!t.ok)return b(t.message),3;h("Tuya key wizard \u2014 one-time setup to control Smart Life / Tuya devices locally:"),h(" 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)."),h(" 2. Subscribe IoT Core (+ Authorization) to the project, then 'Link Tuya App Account' by scanning the QR from the Smart Life app."),h(" 3. Copy the project's Access ID (client id) + Access Secret below."),h(" Note: the IoT Core trial runs ~1 month (console \u2192 Cloud \u2192 My Services \u2192 'Extend Trial Period'). After it expires your"),h(" 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 ko("Access ID (client id): ")).trim(),o=gr({flag:"--secret",argv:e.secret,file:e.secretFile,env:process.env.BRIDGE_TUYA_SECRET});if(!o.ok)return b(o.message),2;let n=(o.value||await Gc("Access Secret: ")).trim(),i=((e.region??process.env.BRIDGE_TUYA_REGION??await ko("Region [eu]: "))||"eu").trim().toLowerCase();if(!r||!n)return b("Both the Access ID and Access Secret are required."),h(Sw),1;if(!["eu","eu-w","us","us-e","cn","in"].includes(i))return b(`Unknown region "${i}" \u2014 use eu, eu-w, us, us-e, cn, or in.`),1;Y("Making sure the hub is running\u2026");try{await it({kind:"cli"})}catch(s){return b(`The hub isn't running and couldn't be started: ${s.message}. Start it with \`acbridge daemon\` and retry.`),1}Y("Fetching your device keys from Tuya (this can take a few seconds)\u2026");let a=await Z("/local/tuya/link",{method:"POST",body:{clientId:r,clientSecret:n,region:i},timeoutMs:9e4});if(a.hubOffline)return b("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(a.status===200&&a.body?.ok){let s=a.body.deviceCount??0,l=a.body.sleepyCount??0;return A(`Imported keys for ${s} Tuya device${s===1?"":"s"}. Keys are stored only on this PC (never on your network or the cloud).`),l>0&&h(`${l} battery/sensor device${l===1?"":"s"} (e.g. a PIR) won't control locally yet \u2014 those come in a later update.`),h('Now run `acbridge scan` \u2014 your lamps should appear under "Ready to connect". Connect each, then control by voice or in the app.'),0}return b(a.body?.error??`The hub couldn't complete the wizard (HTTP ${a.status??"?"}).`),1}async function LD(e){let t=await cr();if(!t.ok)return b(t.message),3;h("Meross account wizard \u2014 a one-time sign-in so the hub can control your Meross devices locally:"),h(" Your Meross email + password are sent ONCE to Meross to fetch the account key that signs local"),h(" requests. The key is stored only on this PC \u2014 never on your network, the cloud, or our relay.");let r=gr({flag:"--password",argv:e.password,file:e.passwordFile,env:process.env.BRIDGE_MEROSS_PASSWORD});if(!r.ok)return b(r.message),2;let o=(e.email??process.env.BRIDGE_MEROSS_EMAIL??await ko("Meross email: ")).trim(),n=r.value||await Gc("Password: "),i=((e.region??process.env.BRIDGE_MEROSS_REGION??await ko("Region [eu]: "))||"eu").trim().toLowerCase();if(!o||!n)return b("Both the email and password are required."),h(_w),1;if(!["eu","us","ap"].includes(i))return b(`Unknown region "${i}" \u2014 use eu, us, or ap.`),1;let a=(e.mfa??process.env.BRIDGE_MEROSS_MFA)?.trim()||void 0;Y("Making sure the hub is running\u2026");try{await it({kind:"cli"})}catch(l){return b(`The hub isn't running and couldn't be started: ${l.message}. Start it with \`acbridge daemon\` and retry.`),1}Y("Signing in to Meross\u2026");let s=await Z("/local/meross/link",{method:"POST",body:{email:o,password:n,region:i,...a?{mfaCode:a}:{}},timeoutMs:6e4});if(s.hubOffline)return b("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(s.status===200&&s.body?.ok){let l=s.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.)`:""}`),h('Now run `acbridge scan` \u2014 your Meross plugs/bulbs should appear under "Ready to connect". Connect each, then control by voice or in the app.'),0}return b(s.body?.error??`The hub couldn't complete the sign-in (HTTP ${s.status??"?"}).`),1}async function UD(e){let t=await cr();if(!t.ok)return b(t.message),3;h("SONOFF / eWeLink account wizard \u2014 a one-time sign-in so the hub can control your SONOFF devices locally:"),h(" Your eWeLink email + password are sent ONCE to eWeLink to fetch each device's LAN key. The keys"),h(" are stored only on this PC \u2014 never on your network, the cloud, or our relay.");let r=gr({flag:"--password",argv:e.password,file:e.passwordFile,env:process.env.BRIDGE_EWELINK_PASSWORD});if(!r.ok)return b(r.message),2;let o=(e.email??process.env.BRIDGE_EWELINK_EMAIL??await ko("eWeLink email: ")).trim(),n=r.value||await Gc("Password: "),i=((e.region??process.env.BRIDGE_EWELINK_REGION??await ko("Region [eu]: "))||"eu").trim().toLowerCase();if(!o||!n)return b("Both the email and password are required."),h($w),1;if(!["eu","us","as","cn"].includes(i))return b(`Unknown region "${i}" \u2014 use eu, us, as, or cn.`),1;Y("Making sure the hub is running\u2026");try{await it({kind:"cli"})}catch(s){return b(`The hub isn't running and couldn't be started: ${s.message}. Start it with \`acbridge daemon\` and retry.`),1}Y("Signing in to eWeLink\u2026");let a=await Z("/local/ewelink/link",{method:"POST",body:{email:o,password:n,region:i},timeoutMs:6e4});if(a.hubOffline)return b("The hub went offline. Start it with `acbridge daemon` and retry."),1;if(a.status===200&&a.body?.ok){let s=a.body.deviceCount??0;return A(`Signed in. ${s} device key${s===1?"":"s"} stored \u2014 only on this PC.`),h('Now run `acbridge scan` \u2014 your SONOFF switches/plugs should appear under "Ready to connect". Connect each, then control by voice or in the app.'),0}return b(a.body?.error??`The hub couldn't complete the sign-in (HTTP ${a.status??"?"}).`),1}async function zD(e){let t=await cr();if(!t.ok)return b(t.message),3;h("Govee key wizard \u2014 one self-service API key imports your Govee devices:"),h(" Govee Home app \u2192 profile \u2192 Settings \u2192 Apply for API Key (it arrives by email within minutes).");let r=gr({flag:"--key",argv:e.key,file:e.keyFile,env:process.env.BRIDGE_GOVEE_KEY});if(!r.ok)return b(r.message),2;let o=(r.value||await Gc("Govee API key: ")).trim();if(!o)return b("An API key is required."),h(Iw),2;Y("Making sure the hub is running\u2026");try{await it({kind:"cli"})}catch(i){return b(`The hub isn't running and couldn't be started: ${i.message}. Start it with \`acbridge daemon\` and retry.`),1}Y("Importing your Govee devices\u2026");let n=await Z("/local/govee/link",{method:"POST",body:{apiKey:o},timeoutMs:6e4});if(n.hubOffline)return b("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 A(`Imported ${i} Govee device${i===1?"":"s"}. The key is stored only on this PC.`),h('Now run `acbridge scan` \u2014 your Govee lights should appear under "Ready to connect". Connect each, then control by voice or in the app.'),0}return b(n.body?.error??`The hub couldn't complete the wizard (HTTP ${n.status??"?"}).`),1}async function ko(e){let t=bw({input:process.stdin,output:process.stdout});try{return await t.question(e)}finally{t.close()}}async function Gc(e){let t=process.stdout,r=bw({input:process.stdin,output:t}),o=r,n=o._writeToOutput?.bind(r);o._writeToOutput=i=>{(i.includes(e)||i===`\r
252
+ --credentials-file <json> / $ACBRIDGE_CREDENTIALS_FILE (a {"field":"value"} object) when headless.`;function IO(e){let t={purge:!1},r=(o,n,i,s)=>o===`--${n}`?(t[n]=s[++i],i):o.startsWith(`--${n}=`)?(t[n]=o.slice(`--${n}=`.length),i):null;for(let o=0;o<e.length;o++){let n=e[o];if(!n)continue;if(n==="--purge"){t.purge=!0;continue}if(n==="--credentials-file"){t.credentialsFile=e[++o];continue}if(n.startsWith("--credentials-file=")){t.credentialsFile=n.slice(19);continue}let i=!1;for(let s of["forget","auto","name","as"]){let a=r(n,s,o,e);if(a!==null){o=a,i=!0;break}}i||(n.startsWith("--")?t.bad=`unknown option: ${n}`:t.target?t.bad=`unexpected argument: ${n}`:t.target=n)}return t}var Yw=e=>/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/.test(Pt(e)),qg=e=>/^(\d{1,3}\.){3}\d{1,3}$/.test(e),Kw=e=>`dev_${Iw(`mac:${Pt(e)}`).slice(0,8)}`,Xw=e=>e==="homeassistant"?"home-assistant":e;async function Qw(e){let t=IO(e);if(t.bad)return x(t.bad),v(qn),2;if(t.as!==void 0)return t.forget!==void 0||t.auto!==void 0?(x("--as can't combine with --forget or --auto"),v(qn),2):t.target?EO(t.target,t.as,t.name):(x("connect --as <protocol> needs an IP address as the target"),v(qn),2);let r=[t.target,t.forget,t.auto].filter(o=>o!==void 0).length;return r!==1?(r>1&&x("pick one of: a connect target, --forget, --auto"),v(qn),2):t.auto!==void 0?DO(t.auto):t.forget!==void 0?OO(t.forget,t.purge):AO(t.target,t.name,t.credentialsFile)}async function EO(e,t,r){if(!tl.includes(t))return x(`--as takes one of: ${tl.join(", ")} (got ${t||"(none)"})`),2;if(!qg(e))return x(`connect --as needs an IP address as the target, got: ${e}`),v(qn),2;v(me(`probing ${e} as ${t}\u2026`));let o={ip:e,protocol:t,...r?{name:r}:{}},n=await q("/local/connect",{method:"POST",body:o,timeoutMs:15e3});if(n.hubOffline)return x(Fe()),1;let i=n.body;return n.status===200&&i?.ok?($(`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):(x(i?.error??`hub answered HTTP ${n.status}`),i?.note&&v(i.note),(n.status===502||n.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 AO(e,t,r){let o=await e0(e);if(typeof o=="number")return o;let n=o;if(n.bucket==="link-ecosystem"){let l=n.suggestedProvider;return x("this device is managed by an ecosystem"),v(`\u2192 link the ecosystem instead: ${l?`\`acbridge link ${Xw(l)}\``:"see `acbridge link --help`"}`),1}if(n.bucket==="identified-only")return x("no direct local adapter for this device"),v(n.identity.hint?`\u2192 ${n.identity.hint}`:"\u2192 control it via a linked Home Assistant (`acbridge link home-assistant`), or wait for a future adapter"),1;if(!n.localProtocol)return x(`no local protocol resolved for ${n.discoveredId} \u2014 rescan and try again`),1;v(me(`connecting ${Jg(n)} via ${n.localProtocol}\u2026`));let i={discoveredId:n.discoveredId,protocol:n.localProtocol,...t?{name:t}:{}},s=await q("/local/connect",{method:"POST",body:i,timeoutMs:15e3});if(s.hubOffline)return x(Fe()),1;let a=s.body;return s.status===200&&a?.ok?($(`connected \u2014 ${a.deviceId??n.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"?(x(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 ${n.discoveredId}\``),1):s.status===428?PO(n,n.localProtocol,t,a?.note??null,r):(x(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 ${Xw(a.linkVia)}\``),1)}async function PO(e,t,r,o,n){let i=Zg[t]??[],s=n??process.env.ACBRIDGE_CREDENTIALS_FILE,a;if(s){if(a=CO(s),!a)return 1}else if(process.stdin.isTTY&&process.stdout.isTTY&&i.length>0)a=await TO(i,o);else{x(o??"this protocol needs an account credential \u2014 supply it and retry");let m=i.length>0?` with fields: ${i.map(p=>p.key).join(", ")}`:"";return v(`\u2192 pass --credentials-file <json> (or set ACBRIDGE_CREDENTIALS_FILE)${m}`),1}v(me(`connecting ${Jg(e)} via ${t} with credentials\u2026`));let l={discoveredId:e.discoveredId,protocol:t,...r?{name:r}:{},credentials:a},u=await q("/local/connect",{method:"POST",body:l,timeoutMs:15e3});if(u.hubOffline)return x(Fe()),1;let d=u.body;return u.status===200&&d?.ok?($(`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):(x(d?.error??`hub answered HTTP ${u.status}`),d?.note&&v(d.note),1)}function CO(e){let t;try{t=_O(e,"utf8")}catch{x(`cannot read credentials file: ${e}`);return}let r;try{r=JSON.parse(t)}catch{x(`credentials file is not valid JSON: ${e}`);return}if(!r||typeof r!="object"||Array.isArray(r)){x("credentials file must be a JSON object of field \u2192 value");return}let o={};for(let[n,i]of Object.entries(r))i!=null&&(o[n]=String(i));return o}async function TO(e,t){t&&v(t);let r={};for(let o of e)o.helpText&&v(me(o.helpText)),r[o.key]=await RO(`${o.label}: `,o.secret);return r}function RO(e,t){return new Promise(r=>{let o=$O({input:process.stdin,output:process.stdout,terminal:!0});if(t){let n=!1,i=o;i._writeToOutput=s=>{n?(s.includes(`
253
+ `)||s.includes("\r"))&&process.stdout.write(`
254
+ `):(process.stdout.write(e),n=!0)}}o.question(e,n=>{o.close(),r(n.trim())})})}async function e0(e){let t=await q("/local/discovered");if(t.hubOffline)return x(Fe()),1;if(t.status!==200||!t.body)return x(`hub answered HTTP ${t.status} reading /local/discovered`),1;let r=t.body.devices;if(e.startsWith("ldev_")){let o=r.find(n=>n.discoveredId===e);return o||(x(`unknown discoveredId ${e} \u2014 run \`acbridge scan\` and use an id from its results`),1)}if(Yw(e)){let o=Pt(e),n=r.find(i=>i.addresses.mac===o);return n||(x(`no discovered device with MAC ${o} \u2014 run \`acbridge scan\` first`),1)}if(qg(e)){let o=r.filter(n=>n.addresses.ip===e);if(o.length===1)return o[0];if(o.length===0)return x(`no discovered device at ${e} \u2014 run \`acbridge scan\` first`),1;x(`${o.length} devices share ${e} \u2014 pick one by id:`);for(let n of o)v(` ${n.discoveredId} ${Jg(n)}`);return 1}return x(`not a MAC, IP, or ldev_\u2026 id: ${e}`),v(qn),2}var Jg=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 OO(e,t){let r;if(e.startsWith("dev_"))r=e;else if(Yw(e))r=Kw(e);else if(e.startsWith("ldev_")||qg(e)){let n=await e0(e);if(typeof n=="number")return n;if(!n.addresses.mac)return x(`${e} has no stable identity (no MAC) \u2014 it was never connected, so there is nothing to forget`),1;r=Kw(n.addresses.mac)}else return x(`not a deviceId, MAC, IP, or ldev_\u2026 id: ${e}`),v(qn),2;let o=await q("/local/forget",{method:"POST",body:{deviceId:r,purge:t}});return o.hubOffline?(x(Fe()),1):o.status===200&&o.body?.ok?($(`forgot ${r}${t?" (purged)":""} \u2014 it will not be auto-reconnected`),o.body.note&&v(o.body.note),0):(x(o.body?.error??`hub answered HTTP ${o.status}`),1)}async function DO(e){if(e!=="on"&&e!=="off")return x(`--auto takes on|off, got: ${e||"(none)"}`),v(qn),2;let t=await q("/local/config");if(t.hubOffline)return x(Fe()),1;if(t.status!==200||!t.body)return x(`hub answered HTTP ${t.status} reading /local/config`),1;let r={...t.body,autoConnect:e==="on"?"open-protocols":"off"},o=await q("/local/config",{method:"POST",body:r});return o.hubOffline?(x(Fe()),1):o.status!==200||!o.body?(x(`hub answered HTTP ${o.status} writing /local/config`),1):(o.body.autoConnect==="open-protocols"?($("auto-connect ON (open protocols)"),v("New lights/plugs on open local protocols connect automatically. Never locks, covers, garage doors, valves, cameras, or doorbells.")):$("auto-connect OFF"),0)}import{writeFileSync as YO}from"node:fs";function al(){return sy({marketplaceDir:to,claudeCmd:an()})}function t0(){return iy({claudeCmd:an()})}function NO(e=Q){return Xs(Xr(Yr(e)))}function zo(e){return fy(to,{settingsFile:e?.settingsFile,configFile:e?.configFile,env:e?.env,nodeCommand:e?.nodeCommand??NO(e?.bridgeDir)})}function cl(e={}){let t=[],r=e.ensurePluginInstalled??al;try{let n=r();n.marketplaceRepointed?t.push({level:"info",message:"Re-pointed the alexa plugin marketplace to this install."}):n.pluginReinstalled&&t.push({level:"info",message:"Refreshed the alexa plugin from this install."})}catch(n){t.push({level:"warn",message:`plugin refresh skipped: ${n.message}`})}let o=e.ensureStatusline??zo;try{let n=o();n.changed&&t.push({level:"info",message:n.enabled?"Installed the AC Bridge statusline tee (chains any existing statusline).":"Removed the AC Bridge statusline tee (original restored)."})}catch(n){t.push({level:"warn",message:`statusline tee skipped: ${n.message}`})}return t}function n0(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 r0(e){if(e.reason!==null&&e.now-e.reason.ts<(e.reasonFreshMs??6e4)&&e.reason.signal!=="account-switched")return{action:"exit-clean"};let r=e.windowMs??3e5;return e.respawnTimes.filter(n=>e.now-n<r).length>=(e.maxRespawns??3)?{action:"exit-fail",why:"the hub keeps dying \u2014 respawn cap reached (see ~/.claude-bridge/hub.log)"}:{action:"respawn"}}function o0(e,t,r){return t==="offline"?"handle-offline":t==="unknown"||e.holderId===null?"rehold":e.wantRevert&&r&&r.active===!1?"rearm":"none"}function Jn(e={}){let t=(e.payloadVersion??(()=>Lt()))();if(t!==null)return{version:t,channel:"app"};let r=(e.bundledVersion??Lw)(),o=$v(r);return o!==null?{version:o,channel:"npm"}:{version:null,channel:null}}function ll(e=N){let t=we(),r=e(t.refreshFile)?.trim(),o=r?Ke(r):null;if(o)return o;let n=e(t.accessFile)?.trim();return n?Ke(n):null}var i0="https://www.ac-bridge.com/home";function s0(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 ${i0}, then retry.`}:t.plan==="free"?{allowed:!1,message:`No active subscription \u2014 start the 3-day free trial at ${i0}, then retry.`}:{allowed:!0}}var LO=/^(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 a0(e){let t=LO.exec(e);if(!t)return null;let r=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:r}}function UO(e,t){let r=typeof e=="number",o=typeof t=="number";return r&&!o?-1:!r&&o?1:e<t?-1:e>t?1:0}function cs(e,t){let r=a0(e),o=a0(t);if(!r||!o)return null;for(let i of["major","minor","patch"])if(r[i]!==o[i])return r[i]<o[i]?-1:1;if(r.prerelease.length===0&&o.prerelease.length===0)return 0;if(r.prerelease.length===0)return 1;if(o.prerelease.length===0)return-1;let n=Math.min(r.prerelease.length,o.prerelease.length);for(let i=0;i<n;i++){let s=UO(r.prerelease[i],o.prerelease[i]);if(s!==0)return s}return r.prerelease.length!==o.prerelease.length?r.prerelease.length<o.prerelease.length?-1:1:0}var c0="npm i -g acbridge@latest",jO="https://www.ac-bridge.com/api/releases/manifest",Kg=6*36e5,zO="https://www.ac-bridge.com";function FO(e=process.platform){return e==="win32"?"windows":e==="darwin"?"macos":e==="linux"?"linux":null}function l0(e){if(typeof e!="object"||e===null)return null;let t=e;if(t.schemaVersion!==1)return null;let r={},o=typeof t.platforms=="object"&&t.platforms!==null?t.platforms:{};for(let i of["windows","macos","linux"]){let s=o[i];typeof s=="object"&&s!==null&&typeof s.version=="string"&&(r[i]={version:s.version})}let n=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:zO,platforms:r,cli:n?{version:typeof n.version=="string"?n.version:null,minimumVersion:typeof n.minimumVersion=="string"?n.minimumVersion:null}:null}}async function ul(e={}){let t=process.env.BRIDGE_UPDATE_MANIFEST_URL||jO;try{let r=await(e.fetchImpl??fetch)(t,{signal:AbortSignal.timeout(e.timeoutMs??6e3)});if(!r.ok)return null;let o=l0(await r.json());return o&&MO(o,e.now),o}catch{return null}}function MO(e,t=Date.now()){try{let r={};try{let o=JSON.parse(N(Ae)??"{}");typeof o=="object"&&o!==null&&!Array.isArray(o)&&(r=o)}catch{r={}}r.updateCheck={manifest:e,fetchedAt:t},ke(Ae,`${JSON.stringify(r,null,2)}
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:l0(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:c0}:s.version&&cs(e,s.version)===-1?{state:"update",current:e,latest:s.version,upgrade:c0}:{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=FO(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 u0(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 ZO="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:ZO}:(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 d0(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 GO(){let e=d0();return e?Ys({configFile:wi(e).userConfigFile}).onboardedAt:null}function WO(e){let t=d0();t&&Qs({onboardedAt:e},{configFile:wi(t).userConfigFile})}async function VO(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??F)("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 qO="This machine's sign-in is no longer valid (the relay rejected its stored credential). Run `acbridge login` to sign in again.";function JO(){return!!N(we().refreshFile)?.trim()}var KO="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??(m=>Ut(m)))(o)&&!(e.hasRefreshCredential??JO)())return{ok:!1,exitCode:3,message:qO};let s=t(we().accessFile)?.trim()??"",a={reachable:!1,completedAt:null};try{let m=await n(`${o.replace(/\/+$/,"")}/settings`,{headers:{authorization:`Bearer ${s}`},signal:AbortSignal.timeout(6e3)});if(m.ok){let f=(await m.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:KO};(e.cacheOnboardedAt??WO)(a.completedAt)}else if((e.cachedOnboardedAt??GO)()===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 VO(e.updateGate);if(!l.ok)return l;let u=await(e.fetchEntitlement??zt)(s),d=s0("preflight",u);return d.allowed?{ok:!0}:{ok:!1,exitCode:5,message:d.message}}var XO=["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 XO){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
+ `),v(`Synced cloud settings into config.json (${Object.keys(i).join(", ")}).`)}catch(n){v(`Cloud settings sync skipped (${n instanceof Error?n.message:String(n)}).`)}return o}var QO=3e3;async function fl(e=[]){let t=!e.includes("--no-revert"),{relayUrl:r}=de(),o=await Fo();if(!o.ok)return x(o.message),o.exitCode;if(!await Ut(r))return x("No valid credential. Run `acbridge login` first."),3;await ml(r,N(we().accessFile)??"");for(let h of cl())(h.level==="info"?v:F)(h.message);let n=(await ct({kind:"daemon"})).holderId;try{YO(Qe,String(process.pid))}catch{}let i=Date.now();Gg(i),setInterval(()=>Gg(i),Uw).unref();let s,a=!1,l=async()=>{let h=await q("/local/session/activate",{method:"POST",body:{revertOnStop:t},timeoutMs:8e3});a=!h.hubOffline&&h.status===200&&h.body?.active===!0,s=h.body?.active?h.body.sessionId:void 0};await l();let u=!1,d=async(h=0)=>{u||(u=!0,n&&await sl(n).catch(()=>{}),ve(Qe),zw(),process.exit(h))};process.once("SIGINT",()=>{d()}),process.once("SIGTERM",()=>{d()}),$(`Bridge running \u2014 hub connected, revert-on-stop ${t?"armed":"off"}. Ctrl-C to stop.`);let m=[],p=async()=>{let h=r0({reason:n0(N(Si)),now:Date.now(),respawnTimes:m});if(h.action==="exit-clean"){$("hub stopped \u2014 daemon exiting."),await d();return}if(h.action==="exit-fail"){x(h.why),await d(1);return}m.push(Date.now()),F("hub went down without a stop \u2014 respawning it\u2026");try{n=(await ct({kind:"daemon"})).holderId,await l(),$("hub respawned")}catch(y){F(`respawn failed: ${y.message} \u2014 retrying on the next beat`),n=null}},f=!1,g=async()=>{if(!(f||u)){f=!0;try{let h=n?await Vw(n):await Ne()?"unknown":"offline",y=null;if(h==="ok"&&t){let _=await q("/local/session/heartbeat",{method:"POST",body:{...s?{sessionId:s}:{}},timeoutMs:4e3});!_.hubOffline&&_.status===200&&_.body&&(y={active:_.body.active})}let w=o0({holderId:n,wantRevert:t,sessionArmed:a},h,y);w==="handle-offline"?await p():w==="rehold"?(n=await ol("daemon"),t&&await l()):w==="rearm"&&await l()}finally{f=!1}}};return setInterval(()=>{g()},QO),await new Promise(()=>{}),0}var eD=c.object({hs:at.nullable().default(null),brightness:ae.nullable().default(null),kelvin:gn.nullable().default(null)}),tD=c.enum(["shared","dedicated"]),nD=c.enum(["focused","priority","mostRecent"]),rD=c.enum(["profile","repo","session"]),oD=c.object({mode:tD.default("shared"),subMode:nD.default("mostRecent"),priorityBy:rD.default("session"),priority:c.array(c.string()).default([]),dedicatedTo:c.string().nullable().default(null)}),Mo=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:eD.default({hs:null,brightness:null,kelvin:null}),arbitration:oD.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)}),$r=c.record(c.string(),Mo).default({});var iD=c.object({id:c.string(),name:c.string()}),gl=c.array(iD).default([]);async function p0(e,t,r,o=3){let n=t;for(let i=0;i<o;i+=1){let s=r(n.config),a=await e(n.version,s);if(a.ok)return{outcome:"committed",version:a.version,config:s};if(a.error==="version_conflict"){n={version:a.version,config:a.config};continue}return{outcome:"error",...a.error!==void 0?{error:a.error}:{}}}return{outcome:"conflict-exhausted"}}function us(e){let t=gl.safeParse(e.deviceGroups);return t.success?t.data:[]}function m0(e,t,r){let o=r.trim();return o?{...e,deviceGroups:[...us(e),{id:t,name:o}]}:null}function f0(e,t,r){let o=r.trim();return o?{...e,deviceGroups:us(e).map(n=>n.id===t?{...n,name:o}:n)}:null}function g0(e,t){let r={...e,deviceGroups:us(e).filter(n=>n.id!==t)},o=$r.safeParse(e.deviceSettings);if(o.success){let n=o.data,i=!1,s={};for(let[a,l]of Object.entries(n))l.groups.includes(t)?(s[a]={...l,groups:l.groups.filter(u=>u!==t)},i=!0):s[a]=l;i&&(r.deviceSettings=s)}return r}async function Bo(e,t,r={},o=3){let n=await(r.fetchSnapshot??ua)(e);if(!n)return{outcome:"unavailable"};let i=r.put??db,s=await p0((a,l)=>i(e,a,l),n,t,o);if(s.outcome==="committed"){let a=r.refresh??(()=>q("/local/rules/refresh",{method:"POST",body:{}}));try{await a()}catch{}}return s}var hl=["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(`
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 m of is[d.type]??[])m.command===i&&(m.gate&&!m.gate(d)||s.push({cap:d,entry:m}));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 sD(e,t){return{deviceId:e,capability:t.capability,command:t.command,params:t.params,consumer:"app"}}function aD(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 lb(t.token);return r?{doc:r,note:"relay cache \u2014 bridge not running; state may be stale"}:null}async function h0(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 m of aD(d.doc,d.note?{note:d.note}:void 0))v(m);return 0}if(o==="set-main")return uD(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 m=[];for(let f=0;f<e.length;f++)e[f]==="--param"&&e[f+1]&&m.push(e[++f]);let p=Xg(m);if(!p.ok)return E(p.message,2);a=vl(s.device,d,p.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 ub(l.token,sD(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 cD(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 lD(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 uD(e,t){let o=e.filter((p,f)=>!p.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}=cD(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 p of l.candidates)v(` ${p.name} (${p.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,m=await Bo(u.token,p=>{let f=lD(p,l.device.id,n);if("error"in f)throw new Error(f.error);return f.config}).catch(p=>(d=p instanceof Error?p.message:String(p),{outcome:"error",error:d}));if(m.outcome!=="committed"){let p=m.outcome==="unavailable"?"couldn't read the device settings from the relay \u2014 check your connection":m.outcome==="conflict-exhausted"?"device settings changed elsewhere \u2014 try again":m.error??"couldn't save the main look";return E(p,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 rL}from"node:fs";import bS from"node:path";import{createSocket as hD}from"node:dgram";import{readFile as vD}from"node:fs/promises";import{networkInterfaces as y0}from"node:os";import{execFile as pD}from"node:child_process";import{existsSync as mD}from"node:fs";import{join as fD}from"node:path";import{promisify as gD}from"node:util";var $8=new TextEncoder;var R8=gD(pD);function Yg(e={}){let t=e.env??process.env,r=e.exists??(o=>mD(o));for(let o of(t.PATH??"").split(":"))if(o!=="")try{if(r(fD(o,"powershell.exe")))return!0}catch{}return!1}var Qg="239.255.90.90",eh=35090,b0=35091;function x0(e){return!e.internal&&(e.family==="IPv4"||e.family===4)}var vt={createSocket:(e,t)=>hD({type:e,reuseAddr:t?.reuseAddr??!0}),interfaceAddresses:()=>Object.values(y0()).flatMap(e=>e??[]).filter(x0).map(e=>e.address)};async function yl(e={}){let t=e.timeoutMs??2e3,r=e.sockets??vt,o=await yD(e.readProcVersion??(()=>vD("/proc/version","utf8")),e.env??process.env),[n,i]=await Promise.all([bD(r,t).catch(()=>null),xD(r,t).catch(()=>null)]),s;try{s=(e.interfaces??kD)()}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 yD(e,t){if(t.WSL_DISTRO_NAME||t.WSL_INTEROP)return!0;try{return/microsoft/i.test(await e())}catch{return!1}}function bD(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 m=()=>{try{d.setMulticastLoopback(!0),d.send(l,eh,Qg,p=>{p&&s(null)})}catch{s(null)}};m(),n.push(setTimeout(m,Math.max(1,Math.floor(t/2))))}),n.push(setTimeout(()=>s(!1),t))})}catch{s(null)}})}function xD(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"),b0,"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 kD(){return Object.entries(y0()).filter(([,e])=>e?.some(x0)).map(([e])=>e)}var hN=rn(nS(),1);var pG=new TextDecoder;import{createDecipheriv as gG,createHash as vN}from"node:crypto";var yG=vN("md5").update("yGAdlopoPVldABfn").digest(),bG=new TextDecoder;var $G=30*6e4;var bN=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"]),xN={"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([...bN].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 NG=new TextDecoder;var aS=Buffer.from("020000010000000000000000463cb5d3","hex"),zG=new TextEncoder,FG=new TextDecoder;var QG=new TextDecoder;var uS="239.255.255.250",$h=1982,dS=["M-SEARCH * HTTP/1.1",`HOST: ${uS}:${$h}`,'MAN: "ssdp:discover"',"ST: wifi_bulb","",""].join(`\r
258
+ `);var o9=new TextDecoder;var v9=new TextDecoder;var pS="239.255.255.250",mS=1900,ZN=["M-SEARCH * HTTP/1.1",`HOST: ${pS}:${mS}`,'MAN: "ssdp:discover"',"MX: 3","ST: ssdp:all","",""].join(`\r
259
+ `),S9=new TextDecoder;var T9=new Uint8Array([0]);import{spawnSync as Ih}from"node:child_process";var Al=Vv("cli");function fS(e){try{let t=Ih(e,{shell:!0,encoding:"utf8",timeout:5e3});return`${t.stdout??""}${t.stderr??""}`}catch{return""}}function gS(e=process.platform){return Qv({platform:e,programs:[process.execPath],ruleName:Al,runCheck:fS,runElevated:t=>{e!=="win32"&&Ih("sudo",["sh","-c",t],{stdio:"inherit"})}})}function hS(e=process.platform){return ey({platform:e,programs:[process.execPath],ruleName:Al,runCheck:fS,runElevated:t=>{e!=="win32"&&Ih("sudo",["sh","-c",t],{stdio:"inherit"})}})}function vS(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 nL}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 yS(){return Wv({voice:Ue(),runElevated:e=>{e.method==="sudo"&&nL(e.file,e.args,{stdio:"inherit"})}})}function oL(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 iL(){let e=await yl();e.wsl?F("WSL detected \u2014 LAN scan degraded (mDNS/broadcast limited)"):$("host is not WSL \u2014 LAN discovery unrestricted"),e.multicastOk===!0?e.wsl?F("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?F("multicast self-test failed \u2014 mDNS discovery unavailable"):F("multicast self-test could not run (inconclusive)"),e.wsl&&(e.interop==="windows-arp"?$("WSL interop scanning available (powershell.exe \u2014 Windows neighbor table)"):F("WSL interop unavailable (powershell.exe not on PATH) \u2014 ARP discovery sees only the WSL subnet"));let t=await q("/local/discovered");t.hubOffline?F("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})`):F(`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})`):F(`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=Xv(r("netsh advfirewall firewall show rule name=all dir=in verbose"),process.execPath),l=Yv(Kv(r("netsh advfirewall show currentprofile")),a);l&&F(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 sL(){let e=Wr({fresh:!0}),t=Q,r="unknown",o=e.beacon?.port??ib(),n=N(_v(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(bS.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(bS.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 xS(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=u0(s,s===null?null:await a(),process.platform,i.channel??"app");l.grade==="ok"?$(l.line):l.grade==="warn"?F(l.line):l.grade==="bad"?r(l.line):v(l.line);let u=e.voice??Ue({clientVersion:s}),d=(e.claudeVersion??(()=>aL(n())))(),m=zs(process.platform).manualCommand;if(d===null)r(`claude CLI not found on PATH \u2014 install it: ${m}`);else{let D=wy(d);D.ok?$(`claude ${D.version}`):r(`claude ${D.version??"?"} \u2014 channels need \u2265 2.1.80 \u2014 reinstall: ${m}`)}let p=(e.codexVersion??cL)(),f=e.codexLoggedIn??Zs,g=oL(p,f());g.grade==="ok"?$(g.line):F(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??(()=>lL(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 w=lr(),_=(e.managedSettingsRaw??(()=>N(w)))(),I=_y(_);u?I.allowed?$("channel allowlisted in managed settings"):I.present?r(`channel not allowlisted in ${w} \u2014 run \`acbridge setup\``):r(`managed settings missing at ${w} \u2014 run \`acbridge setup\``):$("managed settings not used (voice off \u2014 no channel allowlist needed)"),(e.hubBundlePresent??(()=>rL(_i)))()?$("hub bundle present"):F("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):F("not signed in \u2014 run `acbridge login`");let z=(e.onboardingVerified??uL)();if(z!==null?$(`account setup verified (${new Date(z).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??dL)();Ee==="absent"?v("entitlement file absent \u2014 capture off until the hub next syncs"):Ee==="unreadable"?F("entitlement file unreadable \u2014 capture off, fail-closed"):Ee<=24?$(`entitlement file fresh (${Ee.toFixed(1)}h)`):F(`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 vS(await(e.homeFacts??sL)()))D.grade==="ok"?$(D.line):D.grade==="warn"?F(D.line):D.grade==="bad"?r(D.line):v(D.line);let fe=(e.claudeEnvironments??Iy)();for(let D of fe)D.claudePresent&&(D.pluginInstalled?$(`Claude Code wired for Profiles \u2014 ${D.label}`):F(`Claude Code is installed in ${D.label} WITHOUT the bridge plugin \u2014 sessions there drive no devices. Fix: ${D.setupHint}`));return await(e.discoveryPreflight??iL)(),v(""),t?x(`${t} problem(s) found`):$("all checks passed"),t?1:0}function aL(e){let t=e??an(),r=Pl(t.file,[...t.argsPrefix,"--version"],{encoding:"utf8"});return r.status===0?r.stdout??"":null}function cL(){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 lL(e){let t=e??an(),r=Pl(t.file,[...t.argsPrefix,"plugin","list"],{encoding:"utf8"});return Sy(`${r.stdout??""}${r.stderr??""}`).ok}function uL(){let e=Oe();return e?Ys({configFile:e.userConfigFile}).onboardedAt:null}function dL(){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 kS from"node:https";import{createInterface as wS}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 pL=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??F)(pL(e.flag)),{ok:!0,value:e.argv.trim()}):{ok:!0,value:(e.env??"").trim()}}function mL(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,fL=e=>/^(https?|wss?):\/\/[^\s]+$/i.test(e),SS="Usage: acbridge link home-assistant --url http://homeassistant.local:8123 --token <long-lived-access-token> | --token-file <path> [--units metric|imperial]",_S="Usage: acbridge link hue --host <bridge-ip> [--bridge-id <id>] [--key <existing-app-key> | --key-file <path>]",$S="Usage: acbridge link smartthings (opens a browser sign-in via the relay; tokens seal at the relay)",IS="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)",ES="Usage: acbridge link meross [--email <you@example.com>] [--password <pw> | --password-file <path>] [--region eu|us|ap] [--mfa <6-digit-2fa-code>]",AS="Usage: acbridge link ewelink [--email <you@example.com>] [--password <pw> | --password-file <path>] [--region eu|us|as|cn]",PS="Usage: acbridge link govee [--key <govee-api-key> | --key-file <path>] (Govee Home app \u2192 profile \u2192 Settings \u2192 Apply for API Key)",CS="Usage: acbridge link mqtt --host <broker-host[:port]> [--username <u>] [--password <p> | --password-file <path>] [--prefix homeassistant]",gL="nanoleaf pairs per-device, not per-account: run `acbridge scan`, then `acbridge connect <device>` and hold the panel's power button.";async function TS(e){let t=e[0],r=mL(e.slice(1));if(t==="smartthings")return kL(e.slice(1));if(t==="tuya")return wL(r);if(t==="meross")return SL(r);if(t==="ewelink")return _L(r);if(t==="govee")return $L(r);let o;if(t==="home-assistant"||t==="homeassistant")o=hL(r);else if(t==="hue")o=await yL(r);else if(t==="mqtt")o=vL(r);else return x(`unsupported provider: ${t??"(none)"}. Supported: home-assistant, hue, smartthings, tuya, meross, ewelink, govee, mqtt`),v(SS),v(_S),v($S),v(IS),v(ES),v(AS),v(PS),v(CS),v(gL),2;if(!o)return 1;se("Bringing up the integration\u2026");try{let{spawned:n}=await ct({kind:"cli"});n||await Jw(),$(`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 hL(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(!fL(r))return x("Missing/invalid --url. Give your Home Assistant base URL, e.g. http://homeassistant.local:8123"),v(SS),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 vL(e){let t=Vo();if(!t)return null;let r=(e.host??e.url??"").trim(),{host:o,port:n,tls:i}=Nw(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(CS),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)}`,m=ca("mqtt",d);cr(t,"mqtt",m).write(l);let p=Un(t,"mqtt").filter(f=>f.accountId!==m);return pr(t,"mqtt",[...p,{accountId:m,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 ${m}.`),v(`Watching \`${u||"homeassistant"}/#\` for Home Assistant Discovery configs \u2014 Zigbee2MQTT, Tasmota and anything else that publishes them.`),{label:"MQTT"}}async function yL(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(_S),null;let o=(e.bridgeId??"").trim().toLowerCase(),n;if(!o){let d=await IL(r);o=d.bridgeId??r.toLowerCase(),n=d.name}let i=Or({flag:"--key",argv:e.key,file:e.keyFile,env:process.env.BRIDGE_HUE_KEY});if(!i.ok)return x(i.message),null;let s=i.value||void 0,a;if(s)a=JSON.stringify({appkey:s.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");try{let d=await EL(r);a=JSON.stringify({appkey:d.appkey,...d.clientkey?{clientkey:d.clientkey}:{}})}catch(d){return x(`Hue pairing failed: ${d.message}`),null}}let l=ca("hue",o);cr(t,"hue",l).write(a);let u=Un(t,"hue").filter(d=>d.accountId!==l);return pr(t,"hue",[...u,{accountId:l,host:r,bridgeId:o,...n?{name:n}:{}}]),$(`Linked Philips Hue (${r}, bridge ${o}). Keys stored locally; account ${l}.`),{label:"Philips Hue"}}function bL(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 xL(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(bL(e,r.before??null,s))return!0;if(Date.now()+o>i)return!1;await n(o)}}async function kL(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 fb("smartthings");if(!l.ok||!l.authorizeUrl)return x(l.error??"Couldn't start SmartThings linking."),v($S),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 xL("smartthings",async()=>{let m=N(we().accessFile)?.trim();return m?ro(m):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 wL(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(IS),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 SL(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(ES),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 _L(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(AS),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 $L(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(PS),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=wS({input:process.stdin,output:process.stdout});try{return await t.question(e)}finally{t.close()}}async function Cl(e){let t=process.stdout,r=wS({input:process.stdin,output:t}),o=r,n=o._writeToOutput?.bind(r);o._writeToOutput=i=>{(i.includes(e)||i===`\r
260
260
  `||i===`
261
261
  `)&&n?.(i)};try{let i=await r.question(e);return t.write(`
262
- `),i}finally{r.close()}}function Pw(e,t,r,o){return new Promise((n,i)=>{let a=o===void 0?void 0:JSON.stringify(o),s=yw.request({host:e,port:443,method:t,path:r,rejectUnauthorized:!1,headers:{"content-type":"application/json"}},l=>{let u="";l.setEncoding("utf8"),l.on("data",d=>u+=d),l.on("end",()=>{try{n(u?JSON.parse(u):{})}catch(d){i(d instanceof Error?d:new Error(String(d)))}})});s.on("error",i),a&&s.write(a),s.end()})}async function jD(e){try{let t=await Pw(e,"GET","/api/0/config");return{bridgeId:t.bridgeid?.toLowerCase(),name:t.name}}catch{return{}}}async function FD(e){let t=Date.now()+3e4;for(;;){let r=await Pw(e,"POST","/api",{devicetype:"acbridge#cli",generateclientkey:!0}),o=Array.isArray(r)?r.find(i=>i.success)?.success:void 0;if(o)return{appkey:o.username,clientkey:o.clientkey};let n=Array.isArray(r)?r.find(i=>i.error)?.error:void 0;if(n&&n.type!==101)throw new Error(n.description??`Hue error ${n.type}`);if(Date.now()>t)throw new Error("timed out waiting for the link button (30s)");await new Promise(i=>setTimeout(i,1500))}}function MD(e){let t=e?.onboarding;return typeof t=="object"&&t!==null&&typeof t.completedAt=="number"}function BD(e){return{onboarding:{completedAt:e,completedBy:"cli"}}}async function Cw(e,t,r={}){if(!t)return"skipped";let o=r.http??fetch,n=r.now??Date.now,i=e.replace(/\/+$/,""),a=2;try{let s=r.current??await Rc(e,t,o);for(let l=0;l<a;l+=1){if(MD(s.config))return"already";if(s.version===null)return"skipped";let u=await o(`${i}/settings`,{method:"PUT",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify({version:s.version,config:{...s.config,...BD(n())}}),signal:AbortSignal.timeout(6e3)});if(u.ok)return"claimed";if(u.status!==409)return"skipped";l+1<a&&(s=await Rc(e,t,o))}return"skipped"}catch{return"skipped"}}function HD(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 ZD(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 (${Je.pointerMismatch})`:"resolved: not signed in"),r.pointer=o,r.resolved=n,r.agree=i}return{lines:t,json:r}}async function Wc(e=[]){let t=e.includes("--json");t&&we(!0);let r=O(he().accessFile)?.trim(),o=$e()?.sub??null,n=pt()?.sub??null;if(!r){let l=dt();return l.length>0&&o&&!n?(nt(l),Pe(Je.pointerMismatch,3)):Pe("Not signed in. Run `acbridge login`, or sign in via the AC Bridge app.",3)}let i=HD(r)??{},a=await Ot(r),s=ZD({claims:i,machine:Aa(),relayUrl:ne().relayUrl,plan:a?.plan??null,scope:{pointerSub:o,resolvedSub:n}});if(t)xe(s.json);else for(let l of s.lines)h(l);return 0}var GD=`Usage: acbridge login [--if-needed] [--provider google|github|microsoft|sso] [--email <you@example.com>] [--app] [--no-browser] [--timeout <s>] [--json]
263
- --if-needed skip the sign-in when this machine already holds a usable credential (default: always sign in)`,Tw=["google","github","microsoft","email","sso"];function WD(e){let t={provider:"email",app:!1,noBrowser:!1,timeoutMs:18e4,json:!1,ifNeeded:!1,chooser:!0};for(let r=0;r<e.length;r++){let o=e[r];if(o==="--app")t.app=!0;else 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];Tw.includes(n)?(t.provider=n,t.chooser=!1):t.bad=`invalid --provider: ${n??"(none)"} (use ${Tw.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 Vc(e={}){let t=e.readCredentialSub??Pc,r=e.writePointer??(n=>Yt({sub:n})),o=e.log??U;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 VD(e={}){(e.readActiveUser??(()=>$e()))()||(e.heal??Vc)()}function JD(e={}){let t=(e.scan??dt)();return(e.warnAmbiguous??(o=>nt(o)))(t),(e.resolveScope??(()=>pt()))()?{kind:"signed-in"}:(e.readPointer??(()=>$e()))()?{kind:"refuse",message:Je.pointerMismatch}:t.length===1&&Oa(t[0],e.segmentOf)?{kind:"heal",sub:t[0].sub}:{kind:"refuse",message:Je.logoutFirst("log in")}}function qD(e){return e.hasCredential?e.refreshed?{kind:"already"}:{kind:"stale-sign-in"}:{kind:"sign-in"}}async function Rw(e,t,r={}){let o=(r.readToken??(()=>O(he().accessFile)?.trim()??""))();if(o){let n=await(r.sync??vo)(e,o);await(r.claim??Cw)(e,o,{current:n})==="claimed"&&h("Account setup completed from this machine \u2014 `acbridge start` will run here now.")}return A(t.successLine),(r.report??(n=>Wc(n?["--json"]:[])))(t.json)}async function Ow(e=[]){let t=WD(e);if(t.bad)return b(t.bad),h(GD),2;t.json&&we(!0);let r=ne().relayUrl;if(t.ifNeeded&&Vo()){if(Kt()>=Xt){let n=JD();if(n.kind==="refuse")return b(n.message),3;n.kind==="heal"&&Yt({sub:n.sub})}else VD();if(qD({hasCredential:!0,refreshed:await Tt(r)}).kind==="already")return Rw(r,{json:t.json,successLine:"already signed in on this machine"});U("this machine's stored sign-in is no longer valid \u2014 signing in again")}if(t.app){let o=Tr();if(!o)return b("Couldn't find the AC Bridge app on this machine \u2014 run `acbridge login` (browser sign-in) or install the app."),1;if(Y(`opening the AC Bridge app (${o.path})\u2026`),!await Sa(o))return b("Couldn't launch the app."),1;if(h("Complete the sign-in in the AC Bridge app \u2014 I'll pick the credential up here."),!await _a({timeoutMs:t.timeoutMs}))return b("Timed out waiting for the app sign-in."),3}else{let o=Rv(),n=na();try{t.noBrowser||Y("opening your browser to sign in\u2026");let i=await Hv({cfg:o,opts:{provider:t.provider,...t.email?{email:t.email}:{}},chooser:t.chooser,timeoutMs:t.timeoutMs,openUrl:t.noBrowser?async()=>!1:s=>ka(s,{isWsl:n}),onBrowserFail:s=>{h(t.noBrowser?"Open this URL to sign in:":"Couldn't open a browser \u2014 open this URL to sign in:"),h(s)}});if(Y("pairing this machine\u2026"),!await Bv(r,()=>i.accessToken))return b("Signed in, but couldn't pair this machine with the relay \u2014 check your connection and retry."),1}catch(i){return b(Lv(i)),3}}return Vc(),Rw(r,{json:t.json,successLine:"Signed in. This machine now holds its own relay credential and refreshes itself."})}function KD(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 wo(e=[]){let t=e.includes("--json");t&&we(!0);let r,o=d=>{t&&xe({stopped:d,...r?{revert:r}:{}})},n=await Z("/local/session/stop",{method:"POST",body:{},timeoutMs:2e4});!n.hubOffline&&n.status===200&&n.body?.summary&&(r=n.body.summary,A(`lights: ${KD(r)}`));let i=await Jk(),a=O(Ve);if(i)return a&&ue(Ve),A("hub stopping \u2014 devices reverting, holders releasing"),o(!0),0;ny("stop-requested");let s=a?Number(a):0,l=s>0&&go({pid:s}),u=await Te();if(!l&&!u)return a&&ue(Ve),A("bridge already stopped"),o(!1),0;if(l)try{process.kill(s)}catch{}return a&&ue(Ve),Gk(),await Te()?(b("the hub is still running and didn't answer the shutdown \u2014 check ~/.claude-bridge/hub.log"),1):(A("hub stopped"),o(!0),0)}var XD="Usage: acbridge logout [--json]",YD=new Set(["--json"]);async function Dw(e=[],t={}){let r=e.filter(y=>!YD.has(y));if(r.length>0)return b(`unknown option: ${r[0]}`),h(XD),2;let o=e.includes("--json");o&&we(!0);let n=t.read??O,i=t.stopBridge??wo,a=t.revoke??((y,k,_)=>Mv(y,k,{clear:_})),s=t.clearTokens??jo,l=t.keyring??Fo(),u=y=>(t.clearDeviceCredentials??hl)(y,l),d=t.clearLogs??(()=>{Wl(xt),Wl(En)}),p=t.clearPointer??Wv,m=t.relayUrl??ne().relayUrl,f=[],g=(t.scan??dt)();g.length>=2&&(t.warnAmbiguous??(y=>nt(y)))(g);for(let{segment:y}of g){let k=yt(y),_=n(k.accessFile)?.trim()??n(k.refreshFile)?.trim()??null;f.push({segment:y,paths:k,bearer:_})}if(f.length===0)return A("already signed out"),o&&xe({signedOut:!0,alreadySignedOut:!0}),0;Y("stopping the bridge\u2026"),await i([]);for(let{segment:y,paths:k,bearer:_}of f)Y("revoking this machine's credential\u2026"),await a(m,_,()=>s(k)),u(y);return d(),p(),A("signed out \u2014 this machine no longer holds a credential."),o&&xe({signedOut:!0,alreadySignedOut:!1}),0}async function Nw(e,t={}){let r=e[0];if(!r)return b('Usage: acbridge pair <claim-code> (get a code from the app: "Add another machine")'),2;let n=(t.scan??oa)(),i=my(n,"pair");if(!i.ok)return i.ambiguous&&(t.warnAmbiguous??(a=>nt(a)))(n),b(i.message),3;try{h("Pairing this machine with your account\u2026");let a=await(t.claim??iy)(r),s=(t.store??zo)(a);return s?(t.writePointer??(l=>Yt({sub:l})))(s.sub):(t.healPointer??Vc)(),await(t.syncConfig??vo)(t.relayUrl??ne().relayUrl,a.access_token),A("Paired. This machine now holds its own relay credential and refreshes itself \u2014 no app needed."),h("Start the background node with: acbridge daemon"),0}catch(a){return b(a.message),1}}function Lw(e,t,r){let o=e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{};return Object.entries(o).filter(n=>typeof n[1]=="string").map(([n,i])=>({repo:n,profile:r.get(i)??`${i} (missing)`,lane:t}))}function QD(e){let t=e??{},o=(Array.isArray(t.profiles)?t.profiles:[]).filter(a=>a!==null&&typeof a=="object").map(a=>({id:typeof a.id=="string"?a.id:"(unknown)",name:typeof a.name=="string"&&a.name.trim()?a.name:"(unnamed)",states:a.states!==null&&typeof a.states=="object"?Object.keys(a.states).length:0})),n=new Map(o.map(a=>[a.id,a.name])),i=[...Lw(t.bindings,"claude",n),...Lw(t.codexBindings,"codex",n)];return{profiles:o,bindings:i}}function eN(e){if(e.profiles.length===0)return["no profiles yet \u2014 create them in the AC Bridge app (Profiles page)"];let t=e.profiles.map(r=>`${r.name.padEnd(24)} ${r.states} state${r.states===1?"":"s"} (${r.id})`);if(e.bindings.length>0){t.push("","bindings (repo \u2192 profile):");for(let r of e.bindings)t.push(` ${r.repo} \u2192 ${r.profile} [${r.lane}]`)}return t}async function Uw(e=[]){let t=e.includes("--json");t&&we(!0);let r=Or({notSignedIn:{message:"Not signed in. Run `acbridge login`, or sign in via the AC Bridge app.",exitCode:3}});if(!r.ok)return b(r.message),r.exitCode;let o=await ly(r.token);if(o===null)return b("couldn't read the profiles document from the relay \u2014 check your connection"),1;let n=QD(o);if(t)xe(n);else for(let i of eN(n))h(i);return 0}async function zw(e=[]){let t=e[0],r=e.slice(1).join(" ").trim();if(!t||!r)return b("Usage: acbridge rename <device> <new name>"),2;let o=await cr();if(!o.ok)return b(o.message),3;let n=await Z("/local/devices",{method:"GET",timeoutMs:5e3});if(n.hubOffline||n.status!==200||!n.body)return b(De()),1;let i=pg(n.body.devices,t);if(!i.ok){if(i.kind==="ambiguous"){b(`"${t}" matches several devices:`);for(let l of i.candidates)h(` ${l.name} (${l.id})`)}else b(`no device matches "${t}" \u2014 try \`acbridge devices\``);return 2}let a={deviceId:i.device.id,name:r},s=await Z("/local/rename",{method:"POST",body:a,timeoutMs:8e3});return!s.hubOffline&&s.status===200&&s.body?.ok?(A(`renamed ${i.device.name} \u2192 ${r}`),0):(b(s.body?.error??`rename failed (HTTP ${s.status??"offline"})`),1)}import{spawn as tN}from"node:child_process";import{chmodSync as nN,openSync as rN,writeFileSync as oN}from"node:fs";var iN="Usage: acbridge start [--no-revert] [--attach] [--json]",jw=35;function aN(e){let t=e.daemonPidRaw?Number(e.daemonPidRaw):0;return t>0&&(e.identifiable||e.hubUp)?"already-running":t>0?"stale-pid":"proceed"}function sN(e,t){return e.daemonAlive?e.hubUp&&(t||e.session==="active"||e.session==="unavailable")?"ready":"waiting":"died"}async function Jc(e=[]){let t=e.includes("--json");t&&we(!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 b(`unknown option: ${n}`),h(iN),2;let i=await ho();if(!i.ok)return b(i.message),i.exitCode;await Tt(ne().relayUrl);let a=O(Ve),s=a?Number(a):0,l=aN({daemonPidRaw:a,identifiable:s>0&&go({pid:s}),hubUp:await Te()});if(l==="already-running")return A(`bridge already running (daemon pid ${s})`),t&&xe({started:!1,alreadyRunning:!0}),0;l==="stale-pid"&&(ue(Ve),Y("removed a stale daemon.pid")),ue(Ko);let u=r?["--no-revert"]:[];if(o)return h("running the bridge keeper in the foreground (Ctrl-C to stop)\u2026"),Oc(u);let d=Wk(u);oN(En,"",{mode:384}),nN(En,384);let p=rN(En,"a"),m=tN(d.file,d.args,{cwd:en,detached:!0,stdio:["ignore",p,p],env:process.env});m.unref(),Y(`bridge keeper starting (pid ${m.pid??"?"})`);for(let f=0;f<jw;f++){await lN(1e3);let g={daemonAlive:m.pid?Ea(m.pid):!1,hubUp:await Te(),session:await cN()},y=sN(g,r);if(y==="ready"){let k=r?"revert-on-stop off":g.session==="active"?"revert-on-stop armed":"session probe unavailable (older hub)";return A(`bridge running \u2014 hub up, ${k}`),h("stop it with: acbridge stop"),t&&xe({started:!0,revertOnStop:!r,session:g.session}),0}if(y==="died"){b("the bridge keeper exited during startup");let k=O(En);return k&&h(Se(Fw(k,8))),1}}b(`timed out waiting for the bridge to come up (${jw}s)`);for(let f of[En,xt]){let g=O(f);g?.trim()&&h(Se(Fw(g,6)))}return 1}async function cN(){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 Fw(e,t){return e.trimEnd().split(`
262
+ `),i}finally{r.close()}}function RS(e,t,r,o){return new Promise((n,i)=>{let s=o===void 0?void 0:JSON.stringify(o),a=kS.request({host:e,port:443,method:t,path:r,rejectUnauthorized:!1,headers:{"content-type":"application/json"}},l=>{let u="";l.setEncoding("utf8"),l.on("data",d=>u+=d),l.on("end",()=>{try{n(u?JSON.parse(u):{})}catch(d){i(d instanceof Error?d:new Error(String(d)))}})});a.on("error",i),s&&a.write(s),a.end()})}async function IL(e){try{let t=await RS(e,"GET","/api/0/config");return{bridgeId:t.bridgeid?.toLowerCase(),name:t.name}}catch{return{}}}async function EL(e){let t=Date.now()+3e4;for(;;){let r=await RS(e,"POST","/api",{devicetype:"acbridge#cli",generateclientkey:!0}),o=Array.isArray(r)?r.find(i=>i.success)?.success:void 0;if(o)return{appkey:o.username,clientkey:o.clientkey};let n=Array.isArray(r)?r.find(i=>i.error)?.error:void 0;if(n&&n.type!==101)throw new Error(n.description??`Hue error ${n.type}`);if(Date.now()>t)throw new Error("timed out waiting for the link button (30s)");await new Promise(i=>setTimeout(i,1500))}}var Ah=["tuya","meross","ewelink","nanoleaf","govee","esphome"];async function OS(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 AL=["tuya","meross","ewelink","govee"],PL=["homeassistant","mqtt","hue"],CL=["smartthings"];function NS(e){for(let t of PL)if(e.startsWith(`${t}_`))return{provider:t,class:"local"};for(let t of CL)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 TL=e=>e.enabled!==!1;function Ph(e,t){return e.filter(r=>typeof r.accountId=="string").map(r=>({accountId:String(r.accountId),enabled:TL(r),detail:t(r)}))}function RL(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 AL){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 OL(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 DS=["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 LS(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 DL(e,t,r){let o=NS(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 LS(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 NL(e,t){let r=NS(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 pb(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 LS("down"),$(`removed ${e} \u2014 its credentials are gone from this machine`),t&&K({ok:!0,removed:e}),0}async function US(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(DS,2):o==="remove"?NL(l,t):DL(l,o==="enable",t)}if(o!=="list")return E(DS,2);let n=Ft(),i=n.state==="ok"?await ro(n.token):null,s=Oe(),a=RL({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 OL(a))v(l);return 0}function LL(e){let t=e?.onboarding;return typeof t=="object"&&t!==null&&typeof t.completedAt=="number"}function UL(e){return{onboarding:{completedAt:e,completedBy:"cli"}}}async function jS(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(LL(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,...UL(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 jL(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 zL(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=jL(r)??{},s=await zt(r),a=zL({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 FL=`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)`,zS=["google","github","microsoft","email","sso"];function ML(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];zS.includes(n)?(t.provider=n,t.chooser=!1):t.bad=`invalid --provider: ${n??"(none)"} (use ${zS.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 MS(e={}){let t=e.readCredentialSub??ll,r=e.writePointer??(n=>dr({sub:n})),o=e.log??F;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 BL(e={}){(e.readActiveUser??(()=>Ce()))()||(e.heal??MS)()}function HL(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 ZL(e){return e.hasCredential?e.refreshed?{kind:"already"}:{kind:"stale-sign-in"}:{kind:"sign-in"}}async function FS(e,t,r={}){let o=(r.readToken??(()=>N(we().accessFile)?.trim()??""))();if(o){let n=await(r.sync??ml)(e,o);await(r.claim??jS)(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 BS(e=[]){let t=ML(e);if(t.bad)return x(t.bad),v(FL),2;t.json&&be(!0);let r=de().relayUrl;if(t.ifNeeded&&ra()){if(on()>=sn){let n=HL();if(n.kind==="refuse")return x(n.message),3;n.kind==="heal"&&dr({sub:n.sub})}else BL();if(ZL({hasCredential:!0,refreshed:await Ut(r)}).kind==="already")return FS(r,{json:t.json,successLine:"already signed in on this machine"});F("this machine's stored sign-in is no longer valid \u2014 signing in again")}{let o=Ly(),n=Gr();try{t.noBrowser||se("opening your browser to sign in\u2026");let i=await Vy({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 Wy(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(Fy(i)),3}}return MS(),FS(r,{json:t.json,successLine:"Signed in. This machine now holds its own relay credential and refreshes itself."})}function GL(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: ${GL(r)}`));let i=await qw(),s=N(Qe);if(i)return s&&ve(Qe),$("hub stopping \u2014 devices reverting, holders releasing"),o(!0),0;ob("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),Gw(),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 WL="Usage: acbridge logout [--json]",VL=new Set(["--json"]);async function Rl(e=[],t={}){let r=e.filter(h=>!VL.has(h));if(r.length>0)return x(`unknown option: ${r[0]}`),v(WL),2;let o=e.includes("--json");o&&be(!0);let n=t.read??N,i=t.stopBridge??Qn,s=t.revoke??((h,y,w)=>Gy(h,y,{clear:w})),a=t.clearTokens??pi,l=t.keyring??mi(),u=h=>(t.clearDeviceCredentials??au)(h,l),d=t.clearLogs??(()=>{Lu(wt),Lu(Ln)}),m=t.clearPointer??qy,p=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),w=n(y.accessFile)?.trim()??n(y.refreshFile)?.trim()??null;f.push({segment:h,paths:y,bearer:w})}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:w}of f)se("revoking this machine's credential\u2026"),await s(p,w,()=>a(y)),u(h);return d(),m(),$("signed out \u2014 this machine no longer holds a credential."),o&&K({signedOut:!0,alreadySignedOut:!1}),0}var qL=c.object({deviceId:c.string(),capability:At,instance:c.string().optional(),command:c.string(),params:c.unknown().optional()}),JL=c.object({deviceId:c.string(),instance:c.string().optional(),look:Yc.optional(),effect:wr.optional(),returnTo:Xc.optional(),hold:c.boolean().default(!1)}),KL=c.object({enabled:c.boolean().default(!0),actions:c.array(qL).default([]),looks:c.array(JL).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"}},HS=Object.fromEntries(Object.entries(er).map(([e,t])=>[e,t.default])),XL=c.object({proactive:c.boolean().default(!0),doNotDisturb:c.boolean().default(!1),announce:c.record(c.string(),c.boolean()).default({})}),YL=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(),KL).default({}),notifications:XL.default({proactive:!0,doNotDisturb:!1,announce:{}}),quietHours:YL.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 QL={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"],eU=["sandboxEscalation"];function Dl(e,t){return e==="codex"?Th.includes(t):!eU.includes(t)}var tU={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 nU(e,t){return e==="codex"?tU[t]:QL[t]}var rU="codex::";function oU(e,t){return e==="codex"?`${rU}${t}`:t}function Rh(e){return typeof e?.id=="string"&&e.id.startsWith("prof:")}function iU(e,t){return!(!is[e.capability]?.some(o=>o.command===e.command)||t&&!t.devices.some(o=>o.id===e.deviceId))}var sU=new Set(["color","colorTemperature","brightness"]);function ZS(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=xw.safeParse(u);d.success&&!Rh(d.data)&&i.push(d.data)}if(n.success){let u=new Map(n.data.profiles.map(m=>[m.id,m])),d=[["claude",n.data.bindings],["codex",n.data.codexBindings]];for(let[m,p]of d)for(let[f,g]of Object.entries(p)){let h=u.get(g);if(!h)continue;let y=oU(m,f);s[y]={proactive:h.notifications.proactive,doNotDisturb:h.notifications.doNotDisturb,quietHours:h.quietHours};for(let[w,_]of Object.entries(h.states)){if(!_.enabled)continue;let I=ss.safeParse(w);if(!I.success)continue;let S=I.data;S in HS&&((a[y]??={})[S]=_.threshold??HS[S]),S==="modelChanged"&&_.modelMatch&&(l[y]={models:_.modelMatch.models,direction:_.modelMatch.direction});let T=_.actions.filter(X=>h.deviceScope.includes(X.deviceId)&&iU(X,t)),j=new Set(T.filter(X=>X.capability==="power").map(X=>X.deviceId)),fe=[...[...new Set(T.filter(X=>sU.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=nU(m,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=m==="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:m},conditions:[],actions:_e,allowSecurity:_.allowSecurity})}}}return{rules:i,notifyPolicy:s,thresholds:a,modelMatch:l}}function GS(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 Oh(){return`prof_${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`}function WS(e="New profile",t){return Qt.parse({id:Oh(),name:e,...t==="codex"?{agent:"codex"}:{}})}function Dh(e){return e==="codex"?"codexBindings":"bindings"}function Nh(e,t,r,o){let n=Dh(o),i={...e[n]};return r?i[t]=r:delete i[t],{...e,[n]:i}}function VS(e,t,r){let o=Array.isArray(e.rules)?e.rules.filter(i=>!Rh(i)):[],{rules:n}=ZS({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 qS=[{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."}],JS=[{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")}],KS={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."}},aU=[{event:"sandboxEscalation",label:"Sandbox escalation",...KS.sandboxEscalation}],cU=new Set(["idle","ended","permissionDenied","planReady","rateLimited","sandboxEscalation"]);function Nl(e,t=!1){if(e!=="codex")return{curated:qS,advanced:JS};let r=n=>Dl(e,n)&&(t||!cU.has(n)),o=n=>n.filter(i=>r(i.event)).map(i=>{let s=KS[i.event];return s?{...i,hint:s.hint,tooltip:s.tooltip}:i});return{curated:o(qS),advanced:[...o(JS),...aU.filter(n=>r(n.event))]}}import{resolve as SU}from"node:path";var lU=new Set(["--device","--color","--brightness","--scale","--kelvin","--power","--return","--effect-json","--action","--param","--instance","--threshold","--models","--direction","--announce","--clear-device"]),uU=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(uU.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(!lU.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 dU=e=>e.capabilities.some(t=>t.type==="color");function pU(){return{enabled:!0,actions:[],looks:[],allowSecurity:!1}}function mU(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 fU(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]}:pU();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 m=mU(r),p=r.action!==void 0;if((m||p)&&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(m){let g=r.color!==void 0&&r.color!=="none";for(let h of o){if(g&&!dU(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),w=fU(y>=0?d.looks[y]:void 0,h.id,r);if(w&&typeof w=="object"&&"error"in w)return{ok:!1,message:w.error};w===null?y>=0&&(d.looks=d.looks.filter((_,I)=>I!==y)):y>=0?d.looks=d.looks.map((_,I)=>I===y?w:_):d.looks=[...d.looks,w]}}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 w={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===w.capability&&_.instance===w.instance)),w]}}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}),(m||p||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 XS(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 gU=e=>({enabled:!0,actions:[],looks:e,allowSecurity:!1}),qo=(e,t)=>({deviceId:e,look:t,hold:!1}),hU=[{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 vU(e,t){return e!=="codex"?!0:Th.includes(t)}function YS(e,t){if(t.length===0)return{};let r={};for(let o of hU){if(!vU(e,o.event))continue;let n=t.map(i=>o.color(i)).filter(i=>i!==null);n.length>0&&(r[o.event]=gU(n))}return r}import{createInterface as QS}from"node:readline/promises";function yU(e){let t=QS({input:process.stdin,output:process.stdout});return t.question(e).finally(()=>t.close())}function bU(e){return new Promise(t=>{let r=QS({input:process.stdin,output:process.stdout,terminal:!0}),o=!1,n=r;n._writeToOutput=i=>{o?(i.includes(`
265
+ `)||i.includes("\r"))&&process.stdout.write(`
266
+ `):(process.stdout.write(e),o=!0)},r.question(e).then(i=>{r.close(),t(i)})})}var Jo={isTTY:()=>process.stdin.isTTY===!0&&process.stdout.isTTY===!0,write:e=>process.stdout.write(e),ask:yU,askMasked:bU};function e_(e,t,r){e.write(`${t}
267
+ `),r.forEach((o,n)=>{e.write(` ${n+1}) ${o.label}${o.hint?` \u2014 ${o.hint}`:""}
268
+ `)})}function t_(e,t){let r=e.trim().toLowerCase();if(!r)return null;if(/^[0-9]+$/.test(r)){let n=Number(r);return n>=1&&n<=t.length?n-1:null}let o=t.flatMap((n,i)=>n.label.toLowerCase().startsWith(r)?[i]:[]);return o.length===1?o[0]:null}async function Dr(e,t,r,o={}){e_(e,t,r);let n=o.def!==void 0?` [${o.def+1}]`:"";for(;;){let i=(await e.ask(`> ${n?n.trim()+" ":""}`)).trim();if(!i&&o.def!==void 0)return o.def;let s=i?t_(i,r):null;if(s!==null)return s;e.write(` Pick a number from the list (or a unique name prefix).
269
+ `)}}async function Ll(e,t,r){for(e_(e,t,r);;){let o=(await e.ask("> (comma-separated, `all`, or empty for none) ")).trim();if(!o)return[];if(o.toLowerCase()==="all")return r.map((s,a)=>a);let n=new Set,i=!1;for(let s of o.split(",")){let a=t_(s,r);if(a===null){i=!0;break}n.add(a)}if(!i)return[...n].sort((s,a)=>s-a);e.write(` Use numbers from the list (or unique name prefixes), separated by commas.
270
+ `)}}async function Pn(e,t,r){let o=r.def?"[Y/n]":"[y/N]",n=(await e.ask(`${t} ${o} `)).trim().toLowerCase();return n?n==="y"||n==="yes":r.def}async function Ko(e,t,r={}){let o=r.def!==void 0?` [${r.def}]`:"",n=(await e.ask(`${t}${o}: `)).trim();return n||r.def||n}var Lh=e=>({label:e.name,hint:e.type}),xU=e=>e.capabilities.some(t=>t.type==="color");async function n_(e,t){let o=await Dr(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,n=await Ko(e,"Profile name",{def:"New profile"}),i=[];t.devices.length>0?i=(await Ll(e,"Which devices should this profile drive?",t.devices.map(Lh))).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 Pn(e,"Pre-wire a starter scene set (working, needs permission, plan ready, error, finished, idle)?",{def:!0}):!1,a=await Pn(e,`Bind to this folder (${t.cwd}) for ${o??"claude"} sessions?`,{def:t.cwdLooksLikeRepo});return e.write(["",` name: ${n}`,` agent: ${o??"claude"}`,` devices: ${i.length===0?"none yet":i.length}`,` starter: ${s?"yes":"no"}`,` binding: ${a?t.cwd:"none"}`,""].join(`
271
+ `)),await Pn(e,"Save profile?",{def:!0})?{name:n,agent:o,deviceIds:i,starter:s,bindCwd:a}:null}async function kU(e,t,r){let o=vs([]);if(r){let s=await Dr(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 Ko(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 n=await Dr(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(n===1)o.brightness=100;else if(n===2)o.scale=.3;else if(n===3){let s=Number(await Ko(e,"Brightness %",{def:"60"}));Number.isFinite(s)&&(o.brightness=Math.max(0,Math.min(100,s)))}let i=await Dr(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 wU(e,t){let r=Nl(e,t);return[...r.curated,...r.advanced]}async function r_(e,t,r,o){let n=t,i=!1;for(;;){let s=await Dr(e,`Editing "${n.name}" (${n.agent??"claude"})`,[{label:"Rename"},{label:"Device scope",hint:`${n.deviceScope.length} device${n.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 _=await Ko(e,"New name",{def:n.name});_&&_!==n.name&&(n=Qt.parse({...n,name:_}),i=!0);continue}if(s===1){if(r.length===0){e.write("no devices connected \u2014 `acbridge scan` finds some first\n");continue}let _=await Ll(e,"Devices this profile drives (replaces the current scope; EMPTY keeps it as is)",r.map(Lh));if(_.length===0){e.write(` scope unchanged
272
+ `);continue}let I=_.map(j=>r[j].id),S=n.deviceScope.filter(j=>!I.includes(j)),T=Object.fromEntries(Object.entries(n.states).map(([j,z])=>[j,{...z,looks:z.looks.filter(J=>!S.includes(J.deviceId)),actions:z.actions.filter(J=>!S.includes(J.deviceId))}]));n=Qt.parse({...n,deviceScope:I,states:T}),i=!0;continue}let a=wU(n.agent,o),l=await Dr(e,"Which state?",a.map(_=>({label:_.label,hint:_.hint}))),u=a[l],d=u.event,m=n.states[d]?.enabled??!0,p=await Pn(e,`Keep "${u.label}" enabled?`,{def:m}),f=r.filter(_=>n.deviceScope.includes(_.id)),g=[];f.length>0&&(g=(await Ll(e,"Set the look on which devices?",f.map(Lh))).map(I=>f[I]));let h=vs([]);g.length>0&&(h=await kU(e,d,g.every(xU)),h.devices=g.map(_=>_.id)),h.enable=p;let y=er[d];if(y){let _=n.states[d]?.threshold??y.default,I=await Ko(e,`Fire at (${y.min}-${y.max} ${y.unitLabel})`,{def:String(_)}),S=Number(I);Number.isFinite(S)&&S>=y.min&&S<=y.max&&(h.threshold=S)}let w=ys(n,d,h,g,[]);if(!w.ok){e.write(` ${w.message}
273
+ `);continue}for(let _ of w.result.notes)e.write(` ${_}
274
+ `);n=w.result.profile,i=!0}return i?n:null}import{basename as o_}from"node:path";function i_(e){let t=N(e.workspaceFile);if(!t)return{doc:{},corrupt:!1};try{let r=JSON.parse(t);return r&&typeof r=="object"&&!Array.isArray(r)?{doc:r,corrupt:!1}:{doc:{},corrupt:!0}}catch{return{doc:{},corrupt:!0}}}function tr(e){let t=i_(e).doc.repos;if(!Array.isArray(t))return[];let r=[];for(let o of t){if(!o||typeof o!="object")continue;let n=o;typeof n.path!="string"||!n.path||r.push({path:n.path,name:typeof n.name=="string"&&n.name?n.name:o_(n.path),bridge:typeof n.bridge=="string"&&n.bridge?n.bridge:o_(n.path),branch:typeof n.branch=="string"&&n.branch?n.branch:"\u2014",fav:n.fav===!0})}return r}function bs(e,t){let r=i_(e);if(r.corrupt)throw new Error("workspace.json exists but isn't readable JSON \u2014 fix or remove it first (nothing was written)");let o={...r.doc,repos:t};ke(e.workspaceFile,`${JSON.stringify(o,null,2)}
275
+ `,384)}function s_(e,t,r){let o=e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{};return Object.entries(o).filter(n=>typeof n[1]=="string").map(([n,i])=>({repo:n,profile:r.get(i)??`${i} (missing)`,lane:t}))}function _U(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"})),n=new Map(o.map(s=>[s.id,s.name])),i=[...s_(t.bindings,"claude",n),...s_(t.codexBindings,"codex",n)];return{profiles:o,bindings:i}}function $U(e){if(e.profiles.length===0)return["no profiles yet \u2014 create one: acbridge profiles create"];let t=e.profiles.map(r=>`${r.name.padEnd(24)} ${r.states} state${r.states===1?"":"s"}${r.agent==="codex"?" [codex]":""} (${r.id})`);if(e.bindings.length>0){t.push("","bindings (repo \u2192 profile):");for(let r of e.bindings)t.push(` ${r.repo} \u2192 ${r.profile} [${r.lane}]`)}return t}var IU={message:"Not signed in. Run `acbridge login` first.",exitCode:3};async function Cn(e,t){let r=(e.auth??(()=>_t({notSignedIn:IU})))();if(!r.ok)return E(r.message,r.exitCode);let o=await(e.fetchConfig??no)(r.token);return o===null?E("couldn't read the profiles document from the relay \u2014 check your connection",1):{token:r.token,config:o,voice:e.voice??Ue(),json:t,deps:e}}var EU="this account's profiles document is unreadable by this CLI version \u2014 update acbridge (nothing was written)";async function Nr(e,t){try{return await(e.deps.commit??Bo)(e.token,r=>{if(GS(r)==="malformed")throw new Error(EU);return VS(r,t(Ot(r)),e.voice)})}catch(r){return{outcome:"raced",message:r instanceof Error?r.message:String(r)}}}function Lr(e,t){switch(e.outcome){case"committed":return t(e.version),0;case"unavailable":return E("couldn't read the profiles document from the relay \u2014 check your connection",1);case"conflict-exhausted":return E("profiles changed elsewhere (another device kept editing) \u2014 try again",1);case"raced":return E(e.message,1);default:return E(e.error??"couldn't save profiles",1)}}function Ur(e,t){let r=XS(e.profiles,t);return r.ok?r.profile:r.kind==="ambiguous"?E(`"${t}" matches more than one profile:
276
+ ${r.candidates.map(o=>`${o.name} (${o.id})`).join(`
277
+ `)}`,2):E(`no profile matches "${t}" \u2014 see \`acbridge profiles\``,1)}async function Uh(e){let t=await(e.deps.graph??Ir)();return t&&"refusal"in t?E(t.refusal.message,t.refusal.exitCode):t?.doc.devices??[]}function jh(e,t){let r=[];for(let o of t){let n=Kn(e,o);if(!n.ok)return n.kind==="ambiguous"?`"${o}" matches more than one device: ${n.candidates.map(i=>i.name).join(" | ")}`:`no device matches "${o}" \u2014 see \`acbridge devices\``;r.push(n.device)}return r}function a_(e,t){if(t===void 0)return{key:(e.deps.cwd??(()=>process.cwd()))()};let r=(e.deps.repos??(()=>{let o=Oe();return o?tr(o):null}))();if(r){let o=t.toLowerCase(),n=r.filter(i=>i.name.toLowerCase()===o||i.bridge.toLowerCase()===o);if(n.length===1)return{key:n[0].path}}return t.includes("/")||t.includes("\\")||t.startsWith(".")?{key:SU(t)}:{key:t,note:`"${t}" isn't in the repos list \u2014 stored as a NAME binding (matches any repo folder named ${t})`}}var AU=e=>{let t=e.indexOf("--agent");if(t===-1)return;let r=e[t+1];if(r!=="claude")return r==="codex"?"codex":"bad"},nr=["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(`
278
+ `);async function c_(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=AU(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=_U(u.config),m=o.includes("--agent")?{...d,profiles:d.profiles.filter(p=>p.agent===(l??"claude"))}:d;if(r)K(m);else for(let p of $U(m))v(p);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 m=Ot(d.config),p=Ur(m,u);if(typeof p=="number")return p;let f=Object.entries(m.bindings).filter(([,y])=>y===p.id).map(([y])=>y),g=Object.entries(m.codexBindings).filter(([,y])=>y===p.id).map(([y])=>y);if(r)return K({profile:p,bindings:{claude:f,codex:g}}),0;v(`${p.name} (${p.id}) \u2014 ${p.agent??"claude"}`),v(`scope: ${p.deviceScope.length===0?"no devices":p.deviceScope.join(", ")}`);let h=Object.keys(p.states);if(h.length===0)v("states: none configured \u2014 try `acbridge profiles set-state`");else{v("states:");for(let y of h){let w=p.states[y],_=[`${w.looks.length} look${w.looks.length===1?"":"s"}`,`${w.actions.length} action${w.actions.length===1?"":"s"}`,...w.threshold!==void 0?[`fires at ${w.threshold}`]:[],...w.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 m=p=>({event:p.event,label:p.label,hint:p.hint,...p.threshold?{threshold:p.threshold}:{}});return K({agent:l??"claude",curated:d.curated.map(m),advanced:d.advanced.map(m)}),0}v(me(`states a ${l??"claude"} profile can react to (use the left column with set-state):`));for(let[m,p]of[["curated",d.curated],["advanced",d.advanced]]){v(`${m}:`);for(let f of p){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]??"")),m=d[0];if(d.length>1)return E("one profile name (quote names with spaces)",2);let p=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 w=l,_=[],I=[],S=s&&!r&&i.length===0;if(f.length>0||S){let D=await Uh(u);if(typeof D=="number")return D;I=D}if(S){let D=(t.cwd??(()=>process.cwd()))(),Z=await n_(a,{devices:I,cwd:D,cwdLooksLikeRepo:!0});if(!Z)return v("nothing saved"),0;m=Z.name,w=Z.agent,_=Z.deviceIds,p=Z.starter,y=Z.bindCwd?void 0:null}else if(f.length>0){let D=jh(I,f);if(typeof D=="string")return E(D,2);_=D.map(Z=>Z.id)}p&&_.length===0&&(F("--starter needs devices to wire \u2014 creating a blank profile instead (add some with --devices)"),p=!1);let T=I.filter(D=>_.includes(D.id)).map(D=>({id:D.id,hasColor:D.capabilities.some(Z=>Z.type==="color")})),j=WS(m||"New profile",w),z=Qt.parse({...j,deviceScope:_,states:p?YS(w,T):{}}),J=y===null?null:a_(u,y).key,fe=await Nr(u,D=>({profiles:[...D.profiles,z],...J===null?{bindings:D.bindings,codexBindings:D.codexBindings}:Nh({bindings:D.bindings,codexBindings:D.codexBindings},J,z.id,w)}));return Lr(fe,()=>{$(`created "${z.name}" (${z.id})${p?" with the starter scene set":""}`),J!==null&&$(`bound ${J} \u2192 ${z.name} [${w??"claude"}]`),p||v(`wire a state next: acbridge profiles set-state ${z.id} working --device <name> --color session`),r&&K({ok:!0,profile:z})})}case"rename":{let[u,...d]=i,m=d.join(" ").trim();if(!u||!m)return E(nr,2);let p=await Cn(t,r);if(typeof p=="number")return p;let f=Ur(Ot(p.config),u);if(typeof f=="number")return f;let g=await Nr(p,h=>({...h,profiles:h.profiles.map(y=>y.id===f.id?{...y,name:m}:y)}));return Lr(g,()=>{$(`renamed to "${m}"`),r&&K({ok:!0,id:f.id,name:m})})}case"duplicate":{let[u,...d]=i.filter(h=>!h.startsWith("--"));if(!u)return E(nr,2);let m=await Cn(t,r);if(typeof m=="number")return m;let p=Ur(Ot(m.config),u);if(typeof p=="number")return p;let f={...p,id:Oh(),name:d.join(" ").trim()||`${p.name||"Profile"} copy`},g=await Nr(m,h=>({...h,profiles:[...h.profiles,f]}));return Lr(g,()=>{$(`duplicated "${p.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 m=await Cn(t,r);if(typeof m=="number")return m;let p=Ur(Ot(m.config),d);if(typeof p=="number")return p;if(!u){if(!s||r)return E(`deleting "${p.name}" needs --yes when not on a terminal`,2);if(!await Pn(a,`Delete "${p.name}" and unbind it everywhere?`,{def:!1}))return v("kept"),0}let f=await Nr(m,g=>({profiles:g.profiles.filter(h=>h.id!==p.id),bindings:Object.fromEntries(Object.entries(g.bindings).filter(([,h])=>h!==p.id)),codexBindings:Object.fromEntries(Object.entries(g.codexBindings).filter(([,h])=>h!==p.id))}));return Lr(f,()=>{$(`deleted "${p.name}" (bindings in both lanes pruned)`),r&&K({ok:!0,deleted:p.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 m=Ur(Ot(d.config),u);if(typeof m=="number")return m;let p=await Uh(d);if(typeof p=="number")return p;let f=await r_(a,m,p,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(`"${m.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,...m]=i;if(!u||!d)return E(nr,2);let p=vs(m);if(p.bad)return E(p.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=[],w=[];if(p.devices.length>0||p.clearDevices.length>0){let S=await Uh(f);if(typeof S=="number")return S;let T=jh(S,p.devices);if(typeof T=="string")return E(T,2);y=T;let j=jh(S,p.clearDevices);if(typeof j=="string")return E(j,2);w=j}let _=ys(g,h,p,y,w);if(!_.ok)return E(_.message,2);for(let S of _.result.notes)$(S);let I=await Nr(f,S=>{let T=S.profiles.find(z=>z.id===g.id);if(!T)throw new Error(`"${g.name}" was deleted on another device \u2014 nothing saved`);let j=ys(T,h,p,y,w);if(!j.ok)throw new Error(j.message);return{...S,profiles:S.profiles.map(z=>z.id===g.id?j.result.profile:z)}});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,z)=>!j.startsWith("--")&&i[z-1]!=="--repo"&&i[z-1]!=="--agent")[0]:void 0;if(u&&!d)return E(nr,2);let m,p=i.indexOf("--repo");if(p!==-1&&(m=i[p+1],!m||m.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:w}=a_(f,m);w&&F(w);let _=o.includes("--agent"),I=_?l:u&&h.agent==="codex"?"codex":l;u&&_&&(l??"claude")!==(h.agent??"claude")&&F(`"${h.name}" is a ${h.agent??"claude"} profile \u2014 a ${l??"claude"}-lane binding for it never fires`);let S=Dh(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,...Nh({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 l_(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 PU}from"node:child_process";import{chmodSync as CU,openSync as TU,writeFileSync as RU}from"node:fs";var OU="Usage: acbridge start [--no-revert] [--attach] [--json]",u_=35;function DU(e){let t=e.daemonPidRaw?Number(e.daemonPidRaw):0;return t>0&&(e.identifiable||e.hubUp)?"already-running":t>0?"stale-pid":"proceed"}function NU(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(OU),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=DU({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=Ww(u);RU(Ln,"",{mode:384}),CU(Ln,384);let m=TU(Ln,"a"),p=PU(d.file,d.args,{cwd:ln,detached:!0,stdio:["ignore",m,m],env:process.env});p.unref(),se(`bridge keeper starting (pid ${p.pid??"?"})`);for(let f=0;f<u_;f++){await UU(1e3);let g={daemonAlive:p.pid?aa(p.pid):!1,hubUp:await Ne(),session:await LU()},h=NU(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(d_(y,8))),1}}x(`timed out waiting for the bridge to come up (${u_}s)`);for(let f of[Ln,wt]){let g=N(f);g?.trim()&&v(me(d_(g,6)))}return 1}async function LU(){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 d_(e,t){return e.trimEnd().split(`
264
279
  `).slice(-t).join(`
265
- `)}function lN(e){return new Promise(t=>setTimeout(t,e))}async function Mw(e=[],t={}){let r=await(t.stop??wo)([]);return r!==0?r:(t.start??Jc)(e)}import{spawnSync as __}from"node:child_process";import{randomUUID as yU}from"node:crypto";import{mkdirSync as bU,writeFileSync as xU}from"node:fs";import kU from"node:os";import ul from"node:path";import{createInterface as wU}from"node:readline";import{spawn as QL,spawnSync as eU}from"node:child_process";import{randomUUID as tU}from"node:crypto";import{readFileSync as nU}from"node:fs";import{request as rU}from"node:http";import{createInterface as oU}from"node:readline";import{readFileSync as UL}from"node:fs";var CL=qt(LS(),1),TL=qt(rl(),1),RL=qt($o(),1),OL=qt(eh(),1),DL=qt(rh(),1),NL=qt(lh(),1),Vi=qt(sl(),1),LL=qt(ZS(),1);var GS=100;function WS(e){let t=null,r=!1,o=1e3,n=null,i=[],a=()=>"endpoint"in e?e.endpoint():{port:e.port,tokenFile:e.tokenFile},s=p=>{try{return UL(p,"utf8").trim()}catch(m){return console.error(`[channel] cannot read hub token file ${p}:`,m),""}},l=p=>(i.push(p),i.length>GS&&(i.shift(),console.error(`[channel] outbound buffer at cap (${GS}); dropped oldest frame`)),!0),u=p=>{for(;i.length>0&&p.readyState===Vi.default.OPEN;){let m=i.shift();m&&p.send(JSON.stringify(m))}},d=()=>{if(r)return;let{port:p,tokenFile:m}=a(),f=s(m),g=new Vi.default(`ws://${e.host??"127.0.0.1"}:${p}`,{headers:{"x-bridge-hub-token":f}});t=g;let y=!0,k=null;g.on("open",()=>{o=1e3;let _=e.hello?.();_&&g.send(JSON.stringify(_)),u(g),y=!0,k=setInterval(()=>{if(!y){g.terminate();return}y=!1;try{g.ping()}catch{}},3e4)}),g.on("pong",()=>{y=!0}),g.on("message",_=>{try{e.onMessage(Sk(_.toString()))}catch(P){console.error("[channel] bad hub frame:",P)}}),g.on("error",_=>console.error("[channel] hub ws error:",_)),g.on("close",()=>{if(k&&(clearInterval(k),k=null),t===g&&(t=null),r)return;let _=o;o=Math.min(o*2,5e3),n=setTimeout(d,_)})};return d(),{send:p=>{if(r)return!1;let m=t;return m&&m.readyState===Vi.default.OPEN&&i.length===0?(m.send(JSON.stringify(p)),!0):l(p)},close:()=>{r=!0,n&&clearTimeout(n),t?.close()}}}var Q=e=>e;var VS=Q({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 JS=Q({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 qS=Q({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 KS=Q({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 XS=Q({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 YS=e=>`In the current working directory, ${e}. Keep the answer brief enough to be read aloud.`;var QS=Q({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:()=>YS("run git status and report the current branch and any uncommitted changes")});var zL=c.object({index:c.number().int().positive(),name:c.string(),id:c.string(),sessionCount:c.number().int().nonnegative()}),e_=Q({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(zL)}),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 jL=c.object({name:c.string(),type:c.string(),room:c.string().nullable(),online:c.boolean()}),FL=c.object({provider:c.string(),status:c.string()}),t_=Q({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(jL),accounts:c.array(FL)}),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 ML=c.object({index:c.number().int().positive(),name:c.string(),id:c.string()}),n_=Q({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(ML)}),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 r_=Q({id:"ReadMore",target:"hub",carrier:"more",utterances:["read more","continue reading","keep reading"],slots:[],args:c.object({}),result:yc,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 o_=Q({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:yc,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 BL=c.object({index:c.number().int().positive(),name:c.string(),id:c.string(),sessionCount:c.number().int().nonnegative()}),i_=Q({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(BL)}),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 HL=c.object({index:c.number().int().positive(),name:c.string(),id:c.string()}),a_=Q({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(HL)}),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 s_=Q({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 c_=Q({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 l_=Q({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 u_=[VS,JS,qS,KS,XS,QS,e_,t_,n_,r_,o_,i_,a_,s_,c_,l_],d_=new Map(u_.map(e=>[e.id,e])),FV=new Map(u_.map(e=>[`${e.id}Intent`,e]));function p_(e){if(e.type==="prompt")return e.text;let t=d_.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 ZL=new Set(["item/commandExecution/requestApproval","item/fileChange/requestApproval","item/permissions/requestApproval"]);function m_(e){return{decision:e}}var GL="Added to the current turn.",f_="late verdict dropped",WL="approve? [y/n/a]",dh="Codex restarted before this prompt ran \u2014 please resend.",VL=16e3;function _e(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function g_(e){let t=e.replace(/\\/g,"/").replace(/\/+$/,""),r=t.lastIndexOf("/");return(r>=0?t.slice(r+1):t)||e}function h_(e){return(Array.isArray(e)?e.map(String).join(" "):typeof e=="string"?e:"").replace(/\s+/g," ").trim()}function JL(e){return e.replace(/^```.*\n?/gm,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1")}function qL(e,t){return e.length>t?e.slice(0,t):e}function KL(e){let t=_e(e),r=t.codexErrorInfo,o=typeof r=="string"?r:r&&typeof r=="object"?String(_e(r).kind??_e(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 XL(e,t,r,o,n){let i=_e(t);switch(e){case"item/commandExecution/requestApproval":{let a=h_(i.command),s=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:`\`${a}\` in ${g_(s)}`,preview:JSON.stringify({command:a,cwd:s,...d})}}case"item/fileChange/requestApproval":{let s=(Array.isArray(i.files)?i.files:[]).map(d=>typeof d=="string"?d:_e(d).path).filter(d=>typeof d=="string"&&d.length>0),l=s.slice(0,3).map(g_).join(", "),u=s.length>3?", \u2026":"";return{type:"permission_request",sessionId:r,requestId:o,tool:"File change",description:`edit ${s.length} file(s): ${l}${u}`,preview:JSON.stringify(i)}}case"item/permissions/requestApproval":{let a=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 ${a}`,preview:JSON.stringify(i)}}default:return{type:"permission_request",sessionId:r,requestId:o,tool:"Approval",description:"approve this action?",preview:JSON.stringify(i)}}}var ll=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,p_(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,GL)]):[]}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=_e(t),o=_e(r.turn),n=typeof o.status=="string"?o.status:typeof r.status=="string"?r.status:"",i=o.error??r.error,a=[];if(n==="completed")a.push(this.statePost("finished","turn-completed"));else if(n==="failed"){if(this.owner?.kind==="hub"){let s=_e(i),l=typeof s.message=="string"?s.message:"unknown error";a.push(this.replyAction(this.owner.requestId,`Codex hit an error: ${l}`))}a.push(this.statePost(KL(i),"turn-failed"))}else n==="interrupted"&&a.push(this.statePost("idle","turn-interrupted"));return a.push(...this.finishTurnAndDrain()),a}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=_e(t).delta;return typeof r=="string"&&r?[{kind:"render",channel:"agent",text:r}]:[]}onItemStarted(t){let r=_e(_e(t).item);return r.type==="commandExecution"?[{kind:"render",channel:"tool",text:`$ ${h_(r.command)}`}]:[]}onItemCompleted(t){let r=_e(_e(t).item);if(r.type==="agentMessage"){if(this.owner?.kind!=="hub")return[];let o=qL(JL(typeof r.text=="string"?r.text:""),VL);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=_e(t).delta;return typeof r=="string"&&r?[{kind:"render",channel:"tool",text:r}]:[]}onPlanUpdated(t){let r=_e(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=_e(t),o=_e(r.tokenUsage),n=_e(o.total),i=_e(o.last),a=m=>typeof m=="number"&&Number.isFinite(m)?m:void 0,s=[],l=a(n.inputTokens),u=a(n.outputTokens);l!==void 0&&u!==void 0&&s.push({kind:"usage-post",inputTokens:l,cachedInputTokens:a(n.cachedInputTokens)??0,outputTokens:u});let d=a(i.totalTokens),p=a(o.modelContextWindow);if(d!==void 0&&p!==void 0&&p>0){let m=Math.round(d/p*1e3)/10;s.push({kind:"context-post",pct:m,usedTokens:d,windowTokens:p})}return s}onServerRequest(t,r,o){if(!ZL.has(r))return[];let n=`codex-approval-${this.newSeq()}`,i=XL(r,o,this.sessionId,n,this.cwd);this.pendingApprovals.set(n,{serverRequestId:t}),this.lastApprovalRequestId=n;let a=r==="item/permissions/requestApproval"?"sandboxEscalation":"needs_permission";return[{kind:"hub-send",msg:i},this.statePost(a,"approval-requested"),{kind:"render",channel:"meta",text:WL}]}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:f_}];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:f_}];this.pendingApprovals.delete(t),this.lastApprovalRequestId===t&&(this.lastApprovalRequestId=null);let i=r==="decline";return[{kind:"rpc-respond",id:n.serverRequestId,result:m_(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:m_("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,dh));return this.queue=[],this.turnInFlight=!1,this.owner=null,this.pendingApprovals.clear(),this.lastApprovalRequestId=null,this.pendingSteerAcks.clear(),t}};import YL from"node:path";function v_(e,t){let r=YL.basename(e)||"session";return{id:`${r}@${t}+codex`,name:`${r} codex (${t})`}}function y_(e){let{sub:t,...r}=e;return{...r,voice:!0,agent:"codex",...t?{sub:t}:{}}}var Ji=class extends Error{code;constructor(t,r){super(`codex app-server error ${t}: ${r}`),this.name="AppServerError",this.code=t}};function ph(e,t){let r=1,o=!1,n="",i=new Map,a=[],s=[],l=[];function u(_){o||e.write(`${JSON.stringify(_)}
266
- `)}function d(_){let P=_.trim();if(!P)return;let C;try{C=JSON.parse(P)}catch{return}if(!C||typeof C!="object"||Array.isArray(C))return;let E=C,D=E.id,G=typeof D=="number"||typeof D=="string",ae=E.method;if(typeof ae=="string"){if(G)for(let X of s)X(D,ae,E.params);else for(let X of a)X(ae,E.params);return}if(G&&("result"in E||"error"in E)){if(typeof D!="number")return;let X=i.get(D);if(!X)return;if(i.delete(D),"error"in E&&E.error){let be=E.error,Ee=typeof be.code=="number"?be.code:-32603,z=typeof be.message=="string"?be.message:"unknown app-server error";X.reject(new Ji(Ee,z))}else X.resolve(E.result);return}}function p(_){n+=_;let P;for(;(P=n.indexOf(`
267
- `))>=0;){let C=n.slice(0,P);n=n.slice(P+1),d(C)}}function m(){t.removeListener("data",p),t.removeListener("end",y),t.removeListener("error",k),e.removeListener("error",k)}function f(_){m();let P=_??new Error("codex app-server stream closed");for(let C of i.values())C.reject(P);i.clear()}function g(_){if(!o){o=!0,f(_);for(let P of l)P(_)}}function y(){g()}function k(_){g(_)}return t.setEncoding("utf8"),t.on("data",p),t.on("end",y),t.on("error",k),e.on("error",k),{request(_,P){if(o)return Promise.reject(new Error("codex app-server client is closed"));let C=r++;return new Promise((E,D)=>{i.set(C,{resolve:E,reject:D}),u({id:C,method:_,params:P})})},notify(_,P){u({method:_,params:P})},respond(_,P){u({id:_,result:P})},onNotification(_){a.push(_)},onServerRequest(_){s.push(_)},onClose(_){l.push(_)},close(){o||(o=!0,f())}}}function iU(e,t){return QL(e.file,[...e.argsPrefix,"app-server"],{env:t,stdio:["pipe","pipe","inherit"]})}function qi(e){if(process.platform==="win32"&&e.pid){eU("taskkill",["/pid",String(e.pid),"/T","/F"]);return}try{e.kill?.("SIGTERM")}catch{}}function aU(e){return new Promise(t=>setTimeout(t,e))}function sU(e,t){return{...t?{threadId:t}:{},input:[{type:"text",text:e}]}}function cU(e,t,r){if(e==="turn/start"||e==="turn/steer"){let o=t,n=typeof o?.text=="string"?o.text:"";return sU(n,r)}return e==="turn/interrupt"?r?{threadId:r}:void 0:t}function hh(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 r=t.thread;if(r&&typeof r=="object"){let o=r.id;if(typeof o=="string"&&o)return o}}function lU(e){return hh(e)!==void 0?!1:!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0}function x_(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"&&Array.isArray(e.threads))return e.threads}function uU(e){let t=x_(e);if(!t)return[];let r=[];for(let o of t){if(!o||typeof o!="object")continue;let n=o,i=typeof n.threadId=="string"?n.threadId:typeof n.thread_id=="string"?n.thread_id:typeof n.id=="string"?n.id:void 0;if(!i)continue;let a=typeof n.cwd=="string"?n.cwd:typeof n.workingDirectory=="string"?n.workingDirectory:typeof n.path=="string"?n.path:void 0,s=n.updatedAt??n.lastActiveAt??n.createdAt,l=typeof s=="number"?s:typeof s=="string"?Date.parse(s):void 0;r.push({id:i,cwd:a,updatedAt:l!==void 0&&Number.isFinite(l)?l:void 0})}return r}function dU(e){return x_(e)!==void 0?!1:!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0}function pU(e,t){let r=uU(e).filter(o=>o.cwd===t);if(r.length!==0)return r.sort((o,n)=>(n.updatedAt??0)-(o.updatedAt??0)),r[0]?.id}function mU(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}}var Ki={dim:"\x1B[2m",italic:"\x1B[3m",reset:"\x1B[0m",cyan:"\x1B[36m"};function mh(e,t,r){return r?`${e}${t}${Ki.reset}`:t}var gh=class{constructor(t){this.out=t;this.colorEnabled=!!t.isTTY&&!process.env.NO_COLOR}out;atLineStart=!0;colorEnabled;render(t,r){if(t==="agent"){this.out.write(r),this.atLineStart=r.endsWith(`
268
- `);return}if(t==="tool"){this.out.write(mh(Ki.dim,r,this.colorEnabled)),this.atLineStart=r.endsWith(`
280
+ `)}function UU(e){return new Promise(t=>setTimeout(t,e))}async function p_(e=[],t={}){let r=await(t.stop??Qn)([]);return r!==0?r:(t.start??Ul)(e)}var xs=["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(`
281
+ `),jU={message:"Not signed in. Run `acbridge login` first.",exitCode:3};function jl(e){return e.deviceGroups!==void 0&&!gl.safeParse(e.deviceGroups).success?"this account's device groups are unreadable by this CLI version \u2014 update acbridge (nothing was written)":null}function m_(e,t){let r=e.find(s=>s.id===t);if(r)return{group:r};let o=t.toLowerCase(),n=e.filter(s=>s.name.toLowerCase()===o);if(n.length===1)return{group:n[0]};let i=n.length>1?n:e.filter(s=>s.name.toLowerCase().includes(o));return i.length===1?{group:i[0]}:i.length>1?{candidates:i}:{}}function zU(e,t,r,o){let n=$r.safeParse(e.deviceSettings);if(e.deviceSettings!==void 0&&!n.success)return{error:"this machine's device settings are unreadable by this CLI version \u2014 update acbridge (nothing was written)"};let i=n.success?n.data:{},s=i[t]??Mo.parse({}),a=o?[...new Set([...s.groups,r])]:s.groups.filter(l=>l!==r);return{config:{...e,deviceSettings:{...i,[t]:{...s,groups:a}}}}}function FU(e){let t=$r.safeParse(e.deviceSettings),r=new Map;if(!t.success)return r;for(let[o,n]of Object.entries(t.data))for(let i of n.groups)r.set(i,[...r.get(i)??[],o]);return r}var MU=()=>`grp_${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;function zl(e,t){return e.outcome==="committed"?(t(),0):e.outcome==="unavailable"?E("couldn't read the groups document from the relay \u2014 check your connection",1):e.outcome==="conflict-exhausted"?E("groups changed elsewhere \u2014 try again",1):E(e.error??"couldn't save groups",1)}async function f_(e=[],t={}){let r=e.includes("--json");r&&be(!0);let o=e.includes("--yes"),n=e.filter(p=>p!=="--json"&&p!=="--yes"),i=n[0]??"list",s=t.interactive??Jo.isTTY(),a=t.io??Jo,l=(t.auth??(()=>_t({notSignedIn:jU})))();if(!l.ok)return E(l.message,l.exitCode);let u=await(t.fetchConfig??no)(l.token);if(u===null)return E("couldn't read the groups document from the relay \u2014 check your connection",1);let d=us(u),m=t.commit??Bo;switch(i){case"list":{let p=FU(u);if(r)return K({groups:d.map(f=>({...f,devices:p.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=p.get(f.id)??[];v(`${f.name.padEnd(20)} ${g.length} device${g.length===1?"":"s"} ${me(`(${f.id})`)}${g.length>0?`
282
+ ${g.join(", ")}`:""}`)}return 0}case"add":{let p=n.slice(1).join(" ").trim();if(!p)return E(xs,2);let f=jl(u);if(f)return E(f,1);let g=MU(),h=await m(l.token,y=>{let w=jl(y);if(w)throw new Error(w);return m0(y,g,p)??y});return zl(h,()=>{$(`added "${p}" (${g})`),r&&K({ok:!0,id:g,name:p})})}case"rename":case"remove":case"assign":case"unassign":{if(i==="rename"||i==="remove"){let S=n[1];if(!S)return E(xs,2);let T=m_(d,S);if(T.candidates)return E(`"${S}" matches more than one group:
283
+ ${T.candidates.map(z=>`${z.name} (${z.id})`).join(`
284
+ `)}`,2);if(!T.group)return E(`no group matches "${S}" \u2014 see \`acbridge groups\``,1);if(i==="rename"){let z=n.slice(2).join(" ").trim();if(!z)return E(xs,2);let J=jl(u);if(J)return E(J,1);let fe=await m(l.token,D=>{let Z=jl(D);if(Z)throw new Error(Z);return f0(D,T.group.id,z)??D});return zl(fe,()=>{$(`renamed "${T.group.name}" \u2192 "${z}"`),r&&K({ok:!0,id:T.group.id,name:z})})}if(!o){if(!s||r)return E(`removing "${T.group.name}" prunes its membership from every device \u2014 add --yes`,2);if(!await Pn(a,`Remove "${T.group.name}" and prune it from every device?`,{def:!1}))return v("kept"),0}let j=await m(l.token,z=>g0(z,T.group.id));return zl(j,()=>{$(`removed "${T.group.name}" (membership pruned from every device)`),r&&K({ok:!0,removed:T.group.id})})}let p=n[1],f=n[2];if(!p||!f)return E(xs,2);let g=m_(d,f);if(g.candidates)return E(`"${f}" matches more than one group:
285
+ ${g.candidates.map(S=>`${S.name} (${S.id})`).join(`
286
+ `)}`,2);if(!g.group)return E(`no group matches "${f}" \u2014 see \`acbridge groups\``,1);let h=await(t.graph??Ir)();if(h&&"refusal"in h)return E(h.refusal.message,h.refusal.exitCode);let y=h&&"doc"in h?h.doc.devices:[],w=Kn(y,p);if(!w.ok)return E(w.kind==="ambiguous"?`"${p}" matches more than one device: ${w.candidates.map(S=>S.name).join(" | ")}`:`no device matches "${p}" \u2014 see \`acbridge devices\``,2);let _=i==="assign",I=await m(l.token,S=>{let T=zU(S,w.device.id,g.group.id,_);if("error"in T)throw new Error(T.error);return T.config}).catch(S=>({outcome:"error",error:S instanceof Error?S.message:String(S)}));return zl(I,()=>{$(`${w.device.name} ${_?"\u2192":"\xD7"} ${g.group.name}`),r&&K({ok:!0,deviceId:w.device.id,group:g.group.id,member:_})})}default:return E(xs,2)}}var BU=/^\/\/(?:wsl\.localhost|wsl\$)\/([^/]+)(\/.*)?$/i,HU=/^\/mnt\/([a-zA-Z])(\/.*)?$/;var ZU=e=>e.replace(/\\/g,"/");function g_(e){let t=ZU(e),r=BU.exec(t);if(r)return r[2]??"/";let o=HU.exec(t);return o?`${o[1]?.toLowerCase()}:${o[2]??"/"}`.toLowerCase():/^[a-zA-Z]:/.test(t)?t.toLowerCase():t}function zh(e,t){let r=g_(e.replace(/\\/g,"/")),o=g_(t.replace(/\\/g,"/"));if(o===r)return!0;let n=r.endsWith("/")?r:r+"/";return!!(o.startsWith(n)||!r.includes("/")&&o.replace(/\/+$/,"").split("/").pop()?.toLowerCase()===r.toLowerCase())}import{existsSync as GU,statSync as WU}from"node:fs";import{resolve as h_}from"node:path";var Xo=["Usage: acbridge repos [list] [--refresh] [--json]"," acbridge repos add <path> [--root] [--name <label>] [--json]"," acbridge repos remove <path|name> [--json]"].join(`
287
+ `);async function VU(){let e=Ft();if(e.state!=="ok")return null;let t=await no(e.token);if(!t)return null;let r=Ot(t);return{bindings:r.bindings,codexBindings:r.codexBindings}}function qU(e){try{return GU(e)&&WU(e).isDirectory()}catch{return!1}}function JU(e){if(e.length===0)return["no bridges yet \u2014 add one: acbridge repos add <path>"];let t=Math.max(6,...e.map(n=>(n.bridge||n.name).length)),r=Math.max(6,...e.map(n=>n.branch.length)),o=[me(`${"BRIDGE".padEnd(t+2)}${"BRANCH".padEnd(r+2)}PATH`)];for(let n of e)o.push(`${n.fav?"\u2605 ":" "}${(n.bridge||n.name).padEnd(t)}${n.branch.padEnd(r+2)}${n.path}`.trimEnd());return o}function Fh(e,t){let r=h_(t),o=e.find(a=>a.path===t||a.path===r);if(o)return{row:o};let n=t.toLowerCase(),i=e.filter(a=>a.name.toLowerCase()===n||a.bridge.toLowerCase()===n);if(i.length===1)return{row:i[0]};if(i.length>1)return{candidates:i};let s=e.filter(a=>a.name.toLowerCase().startsWith(n)||a.bridge.toLowerCase().startsWith(n));return s.length===1?{row:s[0]}:s.length>1?{candidates:s}:{}}async function v_(e=[],t={}){try{return await KU(e,t)}catch(r){return E(r instanceof Error?r.message:String(r),1)}}async function KU(e,t){let r=e.includes("--json");r&&be(!0);let o=e.filter(a=>a!=="--json"),n=o[0]??"list",i=(t.paths??Oe)();if(!i)return E("Not signed in. Run `acbridge login` first.",3);let s=a=>{if(r)K({repos:a});else for(let l of JU(a))v(l);return 0};switch(n){case"list":{let a=o.includes("--refresh");if(o.filter(u=>u!=="--refresh").length>1)return E(Xo,2);let l=tr(i);return a&&(l=Cy(l),bs(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 E(Xo,2);h+=1}else{if(y.startsWith("--"))return E(`unknown flag: ${y}
288
+ ${Xo}`,2);u.push(y)}}let m=u[0];if(!m||u.length>1)return E(Xo,2);if(a&&l!==void 0)return E("--name labels ONE bridge \u2014 it can't apply to a --root import.",2);let p=h_(m);if(!qU(p))return E(`not a folder: ${p}`,2);let f=tr(i),g=Py(f,p,a?"root":"single");return g.length===f.length?l!==void 0&&!a?(g=Au(f,p,{bridge:l}),bs(i,g),$("already in the list \u2014 label updated"),s(g)):($(a?"nothing new under that root \u2014 every subfolder is already in the list":"already in the list"),s(f)):(l!==void 0&&(g=Au(g,p,{bridge:l})),bs(i,g),$(`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 E(Xo,2);let l=tr(i),u=Fh(l,a);if(u.candidates)return E(`"${a}" matches more than one bridge:
289
+ ${u.candidates.map(p=>`${p.name} (${p.path})`).join(`
290
+ `)}`,2);if(!u.row)return E(`no bridge matches "${a}" \u2014 see \`acbridge repos list\``,1);let d=await(t.fetchBindings??VU)();if(d){let p=[...Object.keys(d.bindings).filter(f=>zh(f,u.row.path)).map(f=>`claude: ${f}`),...Object.keys(d.codexBindings).filter(f=>zh(f,u.row.path)).map(f=>`codex: ${f}`)];p.length>0&&F(`this repo still has profile bindings (they keep firing \u2014 unbind with \`acbridge profiles unbind\`):
291
+ ${p.join(`
292
+ `)}`)}let m=l.filter(p=>p.path!==u.row.path);return bs(i,m),$(`removed ${u.row.bridge||u.row.name}`),s(m)}default:return E(Xo,2)}}import{spawnSync as eI}from"node:child_process";import{randomUUID as i2}from"node:crypto";import{existsSync as s2,mkdirSync as a2,statSync as c2,writeFileSync as l2}from"node:fs";import u2 from"node:os";import Os from"node:path";import{createInterface as d2}from"node:readline";import{spawn as Fz,spawnSync as Mz}from"node:child_process";import{randomUUID as Bz}from"node:crypto";import{readFileSync as Hz}from"node:fs";import{request as Zz}from"node:http";import{createInterface as Gz}from"node:readline";import{readFileSync as _z}from"node:fs";var vz=rn(p$(),1),yz=rn(ql(),1),bz=rn(ei(),1),xz=rn(Xh(),1),kz=rn(ev(),1),wz=rn(sv(),1),As=rn(Yl(),1),Sz=rn(x$(),1);var k$=100;function w$(e){let t=null,r=!1,o=1e3,n=null,i=[],s=()=>"endpoint"in e?e.endpoint():{port:e.port,tokenFile:e.tokenFile},a=m=>{try{return _z(m,"utf8").trim()}catch(p){return console.error(`[channel] cannot read hub token file ${m}:`,p),""}},l=m=>(i.push(m),i.length>k$&&(i.shift(),console.error(`[channel] outbound buffer at cap (${k$}); dropped oldest frame`)),!0),u=m=>{for(;i.length>0&&m.readyState===As.default.OPEN;){let p=i.shift();p&&m.send(JSON.stringify(p))}},d=()=>{if(r)return;let{port:m,tokenFile:p}=s(),f=a(p),g=new As.default(`ws://${e.host??"127.0.0.1"}:${m}`,{headers:{"x-bridge-hub-token":f}});t=g;let h=!0,y=null;g.on("open",()=>{o=1e3;let w=e.hello?.();w&&g.send(JSON.stringify(w)),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",w=>{try{e.onMessage(Sw(w.toString()))}catch(_){console.error("[channel] bad hub frame:",_)}}),g.on("error",w=>console.error("[channel] hub ws error:",w)),g.on("close",()=>{if(y&&(clearInterval(y),y=null),t===g&&(t=null),r)return;let w=o;o=Math.min(o*2,5e3),n=setTimeout(d,w)})};return d(),{send:m=>{if(r)return!1;let p=t;return p&&p.readyState===As.default.OPEN&&i.length===0?(p.send(JSON.stringify(m)),!0):l(m)},close:()=>{r=!0,n&&clearTimeout(n),t?.close()}}}var ce=e=>e;var S$=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 _$=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 $$=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 I$=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 E$=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 A$=e=>`In the current working directory, ${e}. Keep the answer brief enough to be read aloud.`;var P$=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:()=>A$("run git status and report the current branch and any uncommitted changes")});var $z=c.object({index:c.number().int().positive(),name:c.string(),id:c.string(),sessionCount:c.number().int().nonnegative()}),C$=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($z)}),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 Iz=c.object({name:c.string(),type:c.string(),room:c.string().nullable(),online:c.boolean()}),Ez=c.object({provider:c.string(),status:c.string()}),T$=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(Iz),accounts:c.array(Ez)}),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 Az=c.object({index:c.number().int().positive(),name:c.string(),id:c.string()}),R$=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(Az)}),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 O$=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 D$=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 Pz=c.object({index:c.number().int().positive(),name:c.string(),id:c.string(),sessionCount:c.number().int().nonnegative()}),N$=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(Pz)}),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 Cz=c.object({index:c.number().int().positive(),name:c.string(),id:c.string()}),L$=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(Cz)}),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 U$=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 j$=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 z$=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 F$=[S$,_$,$$,I$,E$,P$,C$,T$,R$,O$,D$,N$,L$,U$,j$,z$],M$=new Map(F$.map(e=>[e.id,e])),o7=new Map(F$.map(e=>[`${e.id}Intent`,e]));function B$(e){if(e.type==="prompt")return e.text;let t=M$.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 Tz=new Set(["item/commandExecution/requestApproval","item/fileChange/requestApproval","item/permissions/requestApproval"]);function H$(e){return{decision:e}}var Rz="Added to the current turn.",Z$="late verdict dropped",Oz="approve? [y/n/a]",cv="Codex restarted before this prompt ran \u2014 please resend.",Dz=16e3;function Pe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function G$(e){let t=e.replace(/\\/g,"/").replace(/\/+$/,""),r=t.lastIndexOf("/");return(r>=0?t.slice(r+1):t)||e}function W$(e){return(Array.isArray(e)?e.map(String).join(" "):typeof e=="string"?e:"").replace(/\s+/g," ").trim()}function Nz(e){return e.replace(/^```.*\n?/gm,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1")}function Lz(e,t){return e.length>t?e.slice(0,t):e}function Uz(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 jz(e,t,r,o,n){let i=Pe(t);switch(e){case"item/commandExecution/requestApproval":{let s=W$(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 ${G$(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(G$).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,B$(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,Rz)]):[]}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(Uz(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:`$ ${W$(r.command)}`}]:[]}onItemCompleted(t){let r=Pe(Pe(t).item);if(r.type==="agentMessage"){if(this.owner?.kind!=="hub")return[];let o=Lz(Nz(typeof r.text=="string"?r.text:""),Dz);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=p=>typeof p=="number"&&Number.isFinite(p)?p: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),m=s(o.modelContextWindow);if(d!==void 0&&m!==void 0&&m>0){let p=Math.round(d/m*1e3)/10;a.push({kind:"context-post",pct:p,usedTokens:d,windowTokens:m})}return a}onServerRequest(t,r,o){if(!Tz.has(r))return[];let n=`codex-approval-${this.newSeq()}`,i=jz(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:Oz}]}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:Z$}];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:Z$}];this.pendingApprovals.delete(t),this.lastApprovalRequestId===t&&(this.lastApprovalRequestId=null);let i=r==="decline";return[{kind:"rpc-respond",id:n.serverRequestId,result:H$(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:H$("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,cv));return this.queue=[],this.turnInFlight=!1,this.owner=null,this.pendingApprovals.clear(),this.lastApprovalRequestId=null,this.pendingSteerAcks.clear(),t}};import zz from"node:path";function V$(e,t){let r=zz.basename(e)||"session";return{id:`${r}@${t}+codex`,name:`${r} codex (${t})`}}function q$(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 lv(e,t){let r=1,o=!1,n="",i=new Map,s=[],a=[],l=[];function u(w){o||e.write(`${JSON.stringify(w)}
293
+ `)}function d(w){let _=w.trim();if(!_)return;let I;try{I=JSON.parse(_)}catch{return}if(!I||typeof I!="object"||Array.isArray(I))return;let S=I,T=S.id,j=typeof T=="number"||typeof T=="string",z=S.method;if(typeof z=="string"){if(j)for(let J of a)J(T,z,S.params);else for(let J of s)J(z,S.params);return}if(j&&("result"in S||"error"in S)){if(typeof T!="number")return;let J=i.get(T);if(!J)return;if(i.delete(T),"error"in S&&S.error){let fe=S.error,D=typeof fe.code=="number"?fe.code:-32603,Z=typeof fe.message=="string"?fe.message:"unknown app-server error";J.reject(new Ps(D,Z))}else J.resolve(S.result);return}}function m(w){n+=w;let _;for(;(_=n.indexOf(`
294
+ `))>=0;){let I=n.slice(0,_);n=n.slice(_+1),d(I)}}function p(){t.removeListener("data",m),t.removeListener("end",h),t.removeListener("error",y),e.removeListener("error",y)}function f(w){p();let _=w??new Error("codex app-server stream closed");for(let I of i.values())I.reject(_);i.clear()}function g(w){if(!o){o=!0,f(w);for(let _ of l)_(w)}}function h(){g()}function y(w){g(w)}return t.setEncoding("utf8"),t.on("data",m),t.on("end",h),t.on("error",y),e.on("error",y),{request(w,_){if(o)return Promise.reject(new Error("codex app-server client is closed"));let I=r++;return new Promise((S,T)=>{i.set(I,{resolve:S,reject:T}),u({id:I,method:w,params:_})})},notify(w,_){u({method:w,params:_})},respond(w,_){u({id:w,result:_})},onNotification(w){s.push(w)},onServerRequest(w){a.push(w)},onClose(w){l.push(w)},close(){o||(o=!0,f())}}}function Wz(e,t){return Fz(e.file,[...e.argsPrefix,"app-server"],{env:t,stdio:["pipe","pipe","inherit"]})}function Cs(e){if(process.platform==="win32"&&e.pid){Mz("taskkill",["/pid",String(e.pid),"/T","/F"]);return}try{e.kill?.("SIGTERM")}catch{}}function Vz(e){return new Promise(t=>setTimeout(t,e))}function qz(e,t){return{...t?{threadId:t}:{},input:[{type:"text",text:e}]}}function Jz(e,t,r){if(e==="turn/start"||e==="turn/steer"){let o=t,n=typeof o?.text=="string"?o.text:"";return qz(n,r)}return e==="turn/interrupt"?r?{threadId:r}:void 0:t}function mv(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 r=t.thread;if(r&&typeof r=="object"){let o=r.id;if(typeof o=="string"&&o)return o}}function Kz(e){return mv(e)!==void 0?!1:!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0}function K$(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"&&Array.isArray(e.threads))return e.threads}function Xz(e){let t=K$(e);if(!t)return[];let r=[];for(let o of t){if(!o||typeof o!="object")continue;let n=o,i=typeof n.threadId=="string"?n.threadId:typeof n.thread_id=="string"?n.thread_id:typeof n.id=="string"?n.id:void 0;if(!i)continue;let s=typeof n.cwd=="string"?n.cwd:typeof n.workingDirectory=="string"?n.workingDirectory:typeof n.path=="string"?n.path:void 0,a=n.updatedAt??n.lastActiveAt??n.createdAt,l=typeof a=="number"?a:typeof a=="string"?Date.parse(a):void 0;r.push({id:i,cwd:s,updatedAt:l!==void 0&&Number.isFinite(l)?l:void 0})}return r}function Yz(e){return K$(e)!==void 0?!1:!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0}function Qz(e,t){let r=Xz(e).filter(o=>o.cwd===t);if(r.length!==0)return r.sort((o,n)=>(n.updatedAt??0)-(o.updatedAt??0)),r[0]?.id}function e2(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}}var Ts={dim:"\x1B[2m",italic:"\x1B[3m",reset:"\x1B[0m",cyan:"\x1B[36m"};function uv(e,t,r){return r?`${e}${t}${Ts.reset}`:t}var pv=class{constructor(t){this.out=t;this.colorEnabled=!!t.isTTY&&!process.env.NO_COLOR}out;atLineStart=!0;colorEnabled;render(t,r){if(t==="agent"){this.out.write(r),this.atLineStart=r.endsWith(`
295
+ `);return}if(t==="tool"){this.out.write(uv(Ts.dim,r,this.colorEnabled)),this.atLineStart=r.endsWith(`
269
296
  `);return}if(this.atLineStart||this.out.write(`
270
- `),t==="meta")this.out.write(`${mh(`${Ki.dim}${Ki.italic}`,`\u2022 ${r}`,this.colorEnabled)}
271
- `);else{let o=/^(\[[^\]]+\]\s?)/.exec(r),n=o?`${mh(Ki.cyan,o[1],this.colorEnabled)}${r.slice(o[1].length)}`:r;this.out.write(`${n}
272
- `)}this.atLineStart=!0}};function fh(e){return new Promise(t=>{let r="";try{r=nU(e.tokenFile,"utf8").trim()}catch{}let o=JSON.stringify(e.body),n=rU({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 To(e){return e instanceof Error?e.message:String(e)}function fU(e){if(e.kind!=="hub")return;let t=e.msg;return t.type==="prompt"||t.type==="command"?t.requestId:void 0}async function Xi(e,t,r){let o=await e.request("thread/start",{cwd:t});return lU(o)&&r("thread/start returned a result but no recognizable thread id (threadId/thread_id/thread.id) \u2014 codex resume may not work"),hh(o)}async function k_(e,t,r,o){try{let n=await e.request("thread/resume",{threadId:r});return hh(n)??r}catch{return o("codex thread/resume was rejected \u2014 starting a fresh thread instead"),Xi(e,t,o)}}async function gU(e,t,r){let o=await e.request("thread/list",{cwd:t});if(dU(o))return r("thread/list returned a result but no recognizable thread list \u2014 starting a fresh thread"),Xi(e,t,r);let n=pU(o,t);return n?(r(`resuming the most recent codex thread for this cwd (${n})`),k_(e,t,n,r)):(r("no existing codex thread found for this cwd \u2014 starting a fresh thread"),Xi(e,t,r))}var b_=5,hU=1e3,vU=3e4;async function w_(e){let t=e.codexCmd??$r(),r=e.clientVersion??"0.0.0",o=e.voice??ra({isDevBuild:Ct()===null}),n=e.spawn??iU,i=e.delay??aU,a=e.stdin??process.stdin,s=e.stdout??process.stdout,l=new gh(s),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(C){return l.render("meta",`failed to launch codex: ${To(C)}`),1}p.on("error",C=>l.render("meta",`codex process error: ${To(C)}`));let m=ph(p.stdin,p.stdout),f=null,g=C=>(l.render("meta",C),m.close(),qi(p),f&&ue(f),1),y,k,_,P={};try{await m.request("initialize",{clientInfo:{name:"acbridge",title:"AC Bridge",version:r}}),m.notify("initialized",{});let C=E=>l.render("meta",E);y=e.resume?await gU(m,e.cwd,C):await Xi(m,e.cwd,C),_=tU(),k=v_(e.cwd,e.machine),f=Gl(_),P=y_({id:k.id,name:k.name,hubPort:e.hubPort,hubTokenFile:e.hubTokenFile,claudeSessionId:_,cwd:e.cwd,sub:e.sub}),ge(f,JSON.stringify({...P,...y?{codexThreadId:y}:{}}))}catch(C){return g(`codex bring-up failed: ${To(C)}`)}return new Promise(C=>{let E=!1,D=0,G=()=>D+=1,ae=new ll({sessionId:k.id,cwd:e.cwd,steerSupported:!0,newSeq:G}),X=!1,be=!1,Ee=[];function z(M){if(be){Ee.push(M);return}Vt(M)}function vt(){let M=Ee.splice(0,Ee.length);for(let ee of M){if(ee.kind!=="hub")continue;let j=ee.msg;j.type!=="prompt"&&j.type!=="command"||et.send({type:"reply",sessionId:k.id,requestId:j.requestId,seq:G(),text:dh,final:!0})}}let et=WS({port:e.hubPort,tokenFile:e.hubTokenFile,hello:()=>o?{type:"register",sessions:[{id:k.id,name:k.name,cwd:e.cwd,online:!0,agent:"codex"}],claudeSessionId:_}:null,onMessage:M=>z({kind:"hub",msg:M})}),Oo=oU({input:a,output:s,terminal:!!a.isTTY}),$n=null;function vh(M){E||(E=!0,$n&&(qi($n),$n=null),m.close(),et.close(),qi(p),f&&ue(f),Oo.close(),C(M))}function Yi(M,ee){fh({hubPort:e.hubPort,tokenFile:e.hubTokenFile,path:"/local/session/state",body:{sessionId:k.id,claudeSessionId:_,cwd:e.cwd,ts:Date.now(),state:M,event:ee,agent:"codex"}})}function U_(M,ee,j){if(M===void 0)return;let Ne={pct:M};ee!==void 0&&(Ne.usedTokens=ee),j!==void 0&&(Ne.windowTokens=j),fh({hubPort:e.hubPort,tokenFile:e.hubTokenFile,path:"/local/session/context",body:{sessionId:k.id,claudeSessionId:_,cwd:e.cwd,ts:Date.now(),agent:"codex",context:Ne}})}function z_(M){y&&fh({hubPort:e.hubPort,tokenFile:e.hubTokenFile,path:"/local/session/usage",body:{sessionId:k.id,claudeSessionId:_,codexThreadId:y,cwd:e.cwd,ts:Date.now(),agent:"codex",inputTokens:M.inputTokens,cachedInputTokens:M.cachedInputTokens,outputTokens:M.outputTokens}})}function j_(){f&&ge(f,JSON.stringify({...P,...y?{codexThreadId:y}:{}}))}function yh(M,ee){for(let j of M)switch(j.kind){case"rpc":{let Ne=j.method,No=cU(Ne,j.params,y);m.request(Ne,No).then(()=>{if(Ne!=="turn/steer")return;let kr=fU(ee);kr&&Vt({kind:"steer-ok",requestId:kr})},kr=>{if(Ne==="turn/steer"&&kr instanceof Ji&&kr.code===-32601){ae.setSteerSupported(!1),yh(ae.handle(ee),ee);return}l.render("meta",`codex error (${Ne}): ${To(kr)}`)});break}case"rpc-respond":X=!1,m.respond(j.id,j.result);break;case"hub-send":j.msg.type==="permission_request"&&(X=!0),et.send(j.msg);break;case"state-post":Yi(j.state,j.event);break;case"context-post":U_(j.pct,j.usedTokens,j.windowTokens);break;case"usage-post":z_(j);break;case"render":l.render(j.channel,j.text);break;case"exit":vh(0);break;default:break}}function Vt(M){yh(ae.handle(M),M)}let pl=!1,Qi,Do=0;function bh(){Do+=1;let M=Do;p.on("exit",ee=>{M===Do&&(Qi=ee,ml())}),m.onClose(()=>{M===Do&&(Qi!==void 0?ml():setTimeout(()=>{M===Do&&ml()},25))}),m.onNotification((ee,j)=>Vt({kind:"notification",method:ee,params:j})),m.onServerRequest((ee,j,Ne)=>Vt({kind:"server-request",id:ee,method:j,params:Ne}))}async function F_(){let M=n(t,d());$n=M,M.on("error",j=>l.render("meta",`codex process error: ${To(j)}`));let ee=ph(M.stdin,M.stdout);try{await ee.request("initialize",{clientInfo:{name:"acbridge",title:"AC Bridge",version:r}}),ee.notify("initialized",{});let j=No=>l.render("meta",No),Ne=y?await k_(ee,e.cwd,y,j):await Xi(ee,e.cwd,j);return $n=null,{child:M,client:ee,threadId:Ne}}catch(j){throw $n=null,ee.close(),qi(M),j}}async function M_(){let M=hU,ee=0;for(;;){if(await i(M),E)return;try{let j=await F_();if(E){j.client.close(),qi(j.child);return}p=j.child,m=j.client,pl=!1,Qi=void 0,X=!1,bh(),j.threadId!==void 0&&j.threadId!==y&&(y=j.threadId,j_()),l.render("meta","codex reconnected \u2014 session resumed"),Yi("resumed","codex-adapter:respawned"),be=!1;let Ne=Ee.splice(0,Ee.length);for(let No of Ne)Vt(No);return}catch(j){if(ee+=1,l.render("meta",`codex respawn attempt ${ee} failed: ${To(j)}`),E)return;if(ee>=b_){Yi("error","codex-adapter:respawn-gave-up"),l.render("meta",`codex gave up respawning after ${b_} consecutive failed attempts \u2014 ending session`),vt(),vh(1);return}M=Math.min(M*2,vU)}}}function ml(){if(pl||E)return;pl=!0;let M=Qi??null;Vt({kind:"server-exit",code:M}),l.render("meta",`codex exited unexpectedly (code ${M??"unknown"}) \u2014 attempting to respawn`),X=!1,be=!0,M_()}bh(),Oo.on("line",M=>{let ee=M.trim();if(X){let j=mU(ee);if(j){Vt({kind:"local-approval",behavior:j});return}}z({kind:"local-line",text:ee})}),Oo.on("SIGINT",()=>Vt({kind:"sigint"})),Oo.on("close",()=>{E||Vt({kind:"teardown"})}),Yi("started","codex-adapter:started")})}function SU(e){let t={hold:e.includes("--hold"),agent:"claude",resume:e.includes("--resume")},r=e.indexOf("--agent");if(r>=0){let o=e[r+1];o==="claude"||o==="codex"?t.agent=o:t.bad=`invalid --agent: ${o??"(none)"} (use claude | codex)`}return!t.bad&&t.resume&&t.agent!=="codex"&&(t.bad="--resume requires --agent codex"),t}function _U(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 $U(e){let{sub:t,...r}=e;return{...r,voice:!0,...t?{sub:t}:{}}}async function IU(){h("[bridge] session closed \u2014 press Enter to exit\u2026"),await new Promise(e=>{let t=wU({input:process.stdin,output:process.stdout});t.question("",()=>{t.close(),e()})})}var S_="https://github.com/openai/codex#install";function AU(e){return __(e.file,[...e.argsPrefix,"--version"],{encoding:"utf8",timeout:5e3}).status===0}function EU(e={}){let t;try{t=(e.resolveCodex??$r)()}catch{return{ok:!1,message:`codex CLI not found \u2014 install it: ${S_}`}}return(e.probeCodex??AU)(t)?(e.codexLoggedIn??la)()?{ok:!0,codexCmd:t}:{ok:!1,message:"Run `codex login` first."}:{ok:!1,message:`codex CLI not found \u2014 install it: ${S_}`}}async function $_(e=[],t={}){let r=SU(e);if(r.bad)return b(r.bad),2;if(!(t.voice??Qe()))return b("voice sessions are turned off in this build."),h("Your devices and Profiles are unaffected \u2014 `acbridge start` keeps the bridge running."),h(`Launch the agent yourself in this folder: \`${r.agent}\` \u2014 its hooks still drive your Profiles.`),1;let{hold:o,agent:n}=r,i=ne(),a=t.preflightAccount??ho,s=t.ensureFreshToken??Tt,l=t.ensureHub??it,u=t.hubRelease??$c,d=t.readActiveUser??$e,p=t.holdForEnter??IU,m=await a();if(!m.ok)return b(m.message),m.exitCode;await s(i.relayUrl);let{holderId:f}=await l({kind:"run"});if(n==="codex"){let z=!1,vt=async()=>{if(!z&&(z=!0,f))try{await u(f)}catch{}};process.once("SIGINT",()=>{vt()}),process.once("SIGTERM",()=>{vt()});let et=(t.codexPreflight??EU)();if(!et.ok)return b(et.message),await vt(),1;h(`Launching Codex with the Alexa channel \u2014 cwd: ${process.cwd()}`);let $n=await(t.runCodexAdapter??w_)({cwd:process.cwd(),machine:i.machine,hubPort:i.hubPort,hubTokenFile:sg(),sub:d()?.sub,codexCmd:et.codexCmd,clientVersion:Ct()??void 0,voice:!0,resume:r.resume});return await vt(),o&&await p(),$n}for(let z of Ec({...t.ensurePluginInstalled?{ensurePluginInstalled:t.ensurePluginInstalled}:{},...t.ensureStatusline?{ensureStatusline:t.ensureStatusline}:{}}))(z.level==="info"?h:U)(z.message);let g=ul.basename(process.cwd())||"session",y=`${g}@${i.machine}`,k=`${g} (${i.machine})`,_=yU(),P=ul.join(W,"sessions");bU(P,{recursive:!0});let C=ul.join(P,`${_}.json`),E=process.cwd(),D=ul.join(kU.homedir(),".claude","projects",E.replace(/[^A-Za-z0-9]/g,"-"),`${_}.jsonl`),G=sg();xU(C,JSON.stringify($U({id:y,name:k,hubPort:i.hubPort,hubTokenFile:G,claudeSessionId:_,transcriptPath:D,cwd:E,sub:d()?.sub})),{mode:384});let ae=!1,X=async()=>{if(!ae&&(ae=!0,ue(C),f))try{await u(f)}catch{}};process.once("SIGINT",()=>{X()}),process.once("SIGTERM",()=>{X()}),h(`Launching Claude with the Alexa channel \u2014 session: ${y}`);let be=_U((t.resolveClaude??An)(),{sessionId:y,claudeSessionId:_,sessionName:k,hubPort:i.hubPort},process.env),Ee=__(be.file,be.args,{stdio:"inherit",env:be.env});return await X(),o&&await p(),Ee.status??0}var PU="Usage: acbridge scan [--json] [--timeout <seconds>]",CU=1e3,TU=e=>Dk(e);function RU(e){let t={json:!1,timeoutMs:3e4};for(let r=0;r<e.length;r++){let o=e[r];if(o==="--json")t.json=!0;else if(o==="--timeout"||o?.startsWith("--timeout=")){let n=o==="--timeout"?e[++r]:o.slice(10),i=Number(n);!Number.isFinite(i)||i<=0?t.bad=`invalid --timeout: ${n??"(none)"}`:t.timeoutMs=Math.min(120,Math.max(5,Math.round(i)))*1e3}else t.bad=`unknown option: ${o??""}`}return t}async function P_(e){let t=RU(e);if(t.bad)return b(t.bad),h(PU),2;if(t.json&&we(!0),!await Te()){let i=Bn();if(!i.ok)return b(i.message),3;if(t.json)return b(De()),1;try{await it({kind:"cli"})}catch(a){return b(`couldn't start the hub: ${a.message}`),h("check ~/.claude-bridge/hub.log, or start it yourself with `acbridge daemon` and re-run"),1}}let r=await Z("/local/scan",{method:"POST"});if(r.hubOffline)return b(De()),1;if(r.status!==200||!r.body?.scanId)return b(`hub answered HTTP ${r.status} starting the scan \u2014 token mismatch? restart the hub`),1;let{session:o,expired:n}=await OU(r.body.scanId,t);return o?t.json?(console.log(JSON.stringify(o)),o.status==="failed"?1:0):(n&&h(Se("(scan session expired mid-poll \u2014 showing the hub's last-known devices)")),o.status==="failed"?(b(`scan failed: ${o.error??"unknown error"}`),1):(o.status==="running"&&U("scan still running at --timeout \u2014 showing partial results (re-run `acbridge scan` for the final list)"),zU(o.devices,o.env,o.accountDevices),await MU(o.devices),0)):(b(De()),1)}async function OU(e,t){let r=Date.now()+t.timeoutMs,o=!t.json&&process.stdout.isTTY,n=null;!t.json&&!o&&h("scanning\u2026");try{for(;;){let i=await Z(`/local/scan/${e}`);if(i.hubOffline)return{session:n,expired:!1};if(i.status===404){let a=await Z("/local/discovered");return a.status===200&&a.body?{session:DU(e,a.body),expired:!0}:{session:n,expired:!0}}if(i.status===200&&i.body&&(n=i.body,o&&process.stdout.write(`\r\u2022 scanning\u2026 ${n.devices.length} device(s) found`),n.status!=="running"))return{session:n,expired:!1};if(Date.now()>=r)return{session:n,expired:!1};await new Promise(a=>setTimeout(a,CU))}}finally{o&&process.stdout.write("\r\x1B[2K")}}var DU=(e,t)=>({id:e,status:"done",startedAt:t.updatedAt,finishedAt:t.updatedAt,devices:t.devices,...t.accountDevices?{accountDevices:t.accountDevices}:{},env:t.env}),NU={ready:0,ecosystems:1,"needs-setup":2,unidentified:3,infrastructure:4},LU={ready:"Ready",ecosystems:"Link account","needs-setup":"Needs setup",unidentified:"Unknown",infrastructure:"Infrastructure"};function I_(e){return NU[fo(e)]}function UU(e){return LU[fo(e)]}function dl(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 A_(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}`:"link via the app"}return"\u2014"}function E_(e){let t=jU(e);if(t.length!==0){h(""),h(Se(t[0]));for(let r of t.slice(1))h(r)}}function zU(e,t,r){let o=Ck(t);if(o&&t.interop==="windows-arp"?U("WSL detected \u2014 mDNS/broadcast limited; using the Windows neighbor table for ARP discovery"):o&&t.wsl?U("WSL detected \u2014 LAN scan degraded (mDNS/broadcast limited); results may be incomplete"):o&&U("multicast self-test failed \u2014 mDNS results may be missing"),e.length===0){o&&t.wsl?h("0 devices found \u2014 expected to be incomplete under WSL (see `acbridge doctor`)."):o?h("0 devices found \u2014 the multicast self-test failed, so this scan is expected to be incomplete (see `acbridge doctor`)."):Tk(t,e.length)?h(`No devices found. ${Rk}`):h("No devices found. Devices must be on the same network/VLAN; Wi-Fi isolation limits discovery."),E_(r);return}let n=[...e].sort((m,f)=>I_(m)-I_(f)||dl(m).localeCompare(dl(f))),i=n.map(m=>[C_(dl(m),28),m.expectedType??"\u2014",m.addresses.ip,m.addresses.mac??"\u2014",UU(m),A_(m)]),a=["NAME","TYPE","IP","MAC","STATUS","ACTION"],s=a.map((m,f)=>Math.max(m.length,...i.map(g=>g[f].length))),l=m=>m.map((f,g)=>f.padEnd(s[g])).join(" ").trimEnd();h(Se(l(a)));for(let m of i)h(l(m));h("");let u=new Map;for(let m of n)u.set(fo(m),(u.get(fo(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);h(`${e.length} device(s)${d.length>0?` \u2014 ${d.join(" \xB7 ")}`:""}`);let p=n.filter(m=>m.identity.hint!==void 0&&A_(m)==="\u2014"&&fo(m)!=="unidentified");if(p.length>0){h(""),h(Se("Notes:"));for(let m of p)h(` \u2022 ${dl(m)} (${m.addresses.ip}): ${m.identity.hint}`)}E_(r)}var C_=(e,t)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e;function jU(e){let t=e??[];if(t.length===0)return[];let r=[`Known from your accounts (${t.length}):`];for(let o of t){let n=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`;r.push(` \u2022 ${FU(o)}: ${n}`)}return r}var FU=e=>C_(e.name,40);async function MU(e){if(!e.some(TU))return;let t=await Z("/local/config");t.status!==200||t.body?.autoConnect!=="unset"||(h(""),A("Tip: `acbridge connect --auto on` auto-connects open-protocol lights/plugs (never locks, cameras, or doors)."))}import{existsSync as HU}from"node:fs";import{dirname as ZU}from"node:path";function BU(e=W){return ga(Er(Pr(e)))}function T_(e){return kv(Rr,{home:e?.home,configFile:e?.configFile,env:e?.env,nodeCommand:e?.nodeCommand??BU(e?.bridgeDir)})}function GU(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 R_(e={}){let t=e.installPlugin??Ic,r=e.applyManaged??fw,o=e.applyFirewall??(()=>pw()),n=e.ensureStatusline??Ac,i=e.ensureCodexHooks??T_,a=e.voice??Qe(),s=(e.codexInstalled??(()=>HU(ZU(fa()))))(),l=(e.claudeInstalled??zh)();if(h(a?`Setting up the Alexa bridge on this machine\u2026
297
+ `),t==="meta")this.out.write(`${uv(`${Ts.dim}${Ts.italic}`,`\u2022 ${r}`,this.colorEnabled)}
298
+ `);else{let o=/^(\[[^\]]+\]\s?)/.exec(r),n=o?`${uv(Ts.cyan,o[1],this.colorEnabled)}${r.slice(o[1].length)}`:r;this.out.write(`${n}
299
+ `)}this.atLineStart=!0}};function dv(e){return new Promise(t=>{let r="";try{r=Hz(e.tokenFile,"utf8").trim()}catch{}let o=JSON.stringify(e.body),n=Zz({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 t2(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 Kz(o)&&r("thread/start returned a result but no recognizable thread id (threadId/thread_id/thread.id) \u2014 codex resume may not work"),mv(o)}async function X$(e,t,r,o){try{let n=await e.request("thread/resume",{threadId:r});return mv(n)??r}catch{return o("codex thread/resume was rejected \u2014 starting a fresh thread instead"),Rs(e,t,o)}}async function n2(e,t,r){let o=await e.request("thread/list",{cwd:t});if(Yz(o))return r("thread/list returned a result but no recognizable thread list \u2014 starting a fresh thread"),Rs(e,t,r);let n=Qz(o,t);return n?(r(`resuming the most recent codex thread for this cwd (${n})`),X$(e,t,n,r)):(r("no existing codex thread found for this cwd \u2014 starting a fresh thread"),Rs(e,t,r))}var J$=5,r2=1e3,o2=3e4;async function Y$(e){let t=e.codexCmd??Vr(),r=e.clientVersion??"0.0.0",o=e.voice??js({isDevBuild:Lt()===null}),n=e.spawn??Wz,i=e.delay??Vz,s=e.stdin??process.stdin,a=e.stdout??process.stdout,l=new pv(a),u=0;function d(){return u+=1,{...process.env,ACB_CODEX_ADAPTER:"1",ACB_CODEX_GENERATION:String(u)}}let m;try{m=n(t,d())}catch(I){return l.render("meta",`failed to launch codex: ${si(I)}`),1}m.on("error",I=>l.render("meta",`codex process error: ${si(I)}`));let p=lv(m.stdin,m.stdout),f=null,g=I=>(l.render("meta",I),p.close(),Cs(m),f&&ve(f),1),h,y,w,_={};try{await p.request("initialize",{clientInfo:{name:"acbridge",title:"AC Bridge",version:r}}),p.notify("initialized",{});let I=S=>l.render("meta",S);h=e.resume?await n2(p,e.cwd,I):await Rs(p,e.cwd,I),w=Bz(),y=V$(e.cwd,e.machine),f=Nu(w),_=q$({id:y.id,name:y.name,hubPort:e.hubPort,hubTokenFile:e.hubTokenFile,claudeSessionId:w,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,z=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:cv,final:!0})}}let _e=w$({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:w}:null,onMessage:Y=>Z({kind:"hub",msg:Y})}),Nt=Gz({input:s,output:a,terminal:!!s.isTTY}),X=null;function fv(Y){S||(S=!0,X&&(Cs(X),X=null),p.close(),_e.close(),Cs(m),f&&ve(f),Nt.close(),I(Y))}function Ds(Y,le){dv({hubPort:e.hubPort,tokenFile:e.hubTokenFile,path:"/local/session/state",body:{sessionId:y.id,claudeSessionId:w,cwd:e.cwd,ts:Date.now(),state:Y,event:le,agent:"codex"}})}function mI(Y,le,W){if(Y===void 0)return;let Me={pct:Y};le!==void 0&&(Me.usedTokens=le),W!==void 0&&(Me.windowTokens=W),dv({hubPort:e.hubPort,tokenFile:e.hubTokenFile,path:"/local/session/context",body:{sessionId:y.id,claudeSessionId:w,cwd:e.cwd,ts:Date.now(),agent:"codex",context:Me}})}function fI(Y){h&&dv({hubPort:e.hubPort,tokenFile:e.hubTokenFile,path:"/local/session/usage",body:{sessionId:y.id,claudeSessionId:w,codexThreadId:h,cwd:e.cwd,ts:Date.now(),agent:"codex",inputTokens:Y.inputTokens,cachedInputTokens:Y.cachedInputTokens,outputTokens:Y.outputTokens}})}function gI(){f&&ke(f,JSON.stringify({..._,...h?{codexThreadId:h}:{}}))}function gv(Y,le){for(let W of Y)switch(W.kind){case"rpc":{let Me=W.method,li=Jz(Me,W.params,h);p.request(Me,li).then(()=>{if(Me!=="turn/steer")return;let Hr=t2(le);Hr&&tn({kind:"steer-ok",requestId:Hr})},Hr=>{if(Me==="turn/steer"&&Hr instanceof Ps&&Hr.code===-32601){z.setSteerSupported(!1),gv(z.handle(le),le);return}l.render("meta",`codex error (${Me}): ${si(Hr)}`)});break}case"rpc-respond":J=!1,p.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":mI(W.pct,W.usedTokens,W.windowTokens);break;case"usage-post":fI(W);break;case"render":l.render(W.channel,W.text);break;case"exit":fv(0);break;default:break}}function tn(Y){gv(z.handle(Y),Y)}let ru=!1,Ns,ci=0;function hv(){ci+=1;let Y=ci;m.on("exit",le=>{Y===ci&&(Ns=le,ou())}),p.onClose(()=>{Y===ci&&(Ns!==void 0?ou():setTimeout(()=>{Y===ci&&ou()},25))}),p.onNotification((le,W)=>tn({kind:"notification",method:le,params:W})),p.onServerRequest((le,W,Me)=>tn({kind:"server-request",id:le,method:W,params:Me}))}async function hI(){let Y=n(t,d());X=Y,Y.on("error",W=>l.render("meta",`codex process error: ${si(W)}`));let le=lv(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 X$(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 vI(){let Y=r2,le=0;for(;;){if(await i(Y),S)return;try{let W=await hI();if(S){W.client.close(),Cs(W.child);return}m=W.child,p=W.client,ru=!1,Ns=void 0,J=!1,hv(),W.threadId!==void 0&&W.threadId!==h&&(h=W.threadId,gI()),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>=J$){Ds("error","codex-adapter:respawn-gave-up"),l.render("meta",`codex gave up respawning after ${J$} consecutive failed attempts \u2014 ending session`),Ee(),fv(1);return}Y=Math.min(Y*2,o2)}}}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,vI()}hv(),Nt.on("line",Y=>{let le=Y.trim();if(J){let W=e2(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 p2(e){try{return s2(e)&&c2(e).isDirectory()}catch{return!1}}function m2(e){let t=Oe();return t?Fh(tr(t),e):{signedOut:!0}}function f2(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 g2(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 h2(e){let{sub:t,...r}=e;return{...r,voice:!0,...t?{sub:t}:{}}}async function v2(){v("[bridge] session closed \u2014 press Enter to exit\u2026"),await new Promise(e=>{let t=d2({input:process.stdin,output:process.stdout});t.question("",()=>{t.close(),e()})})}var Q$="https://github.com/openai/codex#install";function y2(e){return eI(e.file,[...e.argsPrefix,"--version"],{encoding:"utf8",timeout:5e3}).status===0}function b2(e={}){let t;try{t=(e.resolveCodex??Vr)()}catch{return{ok:!1,message:`codex CLI not found \u2014 install it: ${Q$}`}}return(e.probeCodex??y2)(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: ${Q$}`}}async function tI(e=[],t={}){let r=f2(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),!p2(Ee))return x(`not a folder: ${Ee}`),2}else{let _e=(t.repoLookup??m2)(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
+ ${_e.candidates.map(Nt=>`${Nt.name} (${Nt.path})`).join(`
301
+ `)}`),2;if(!_e.row)return x(`no bridge matches "${r.repo}" \u2014 see \`acbridge repos list\``),2;Ee=_e.row.path}try{Z(Ee)}catch(_e){return x(`couldn't enter ${Ee}: ${_e instanceof Error?_e.message:String(_e)}`),1}}if(!(t.voice??Ue()))return x("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: \`${r.agent}\` \u2014 its hooks still drive your Profiles.`),1;let{hold:o,agent:n}=r,i=de(),s=t.preflightAccount??Fo,a=t.ensureFreshToken??Ut,l=t.ensureHub??ct,u=t.hubRelease??sl,d=t.readActiveUser??Ce,m=t.holdForEnter??v2,p=await s();if(!p.ok)return x(p.message),p.exitCode;await a(i.relayUrl);let{holderId:f}=await l({kind:"run"});if(n==="codex"){let Z=!1,Ee=async()=>{if(!Z&&(Z=!0,f))try{await u(f)}catch{}};process.once("SIGINT",()=>{Ee()}),process.once("SIGTERM",()=>{Ee()});let _e=(t.codexPreflight??b2)();if(!_e.ok)return x(_e.message),await Ee(),1;v(`Launching Codex with the Alexa channel \u2014 cwd: ${process.cwd()}`);let X=await(t.runCodexAdapter??Y$)({cwd:process.cwd(),machine:i.machine,hubPort:i.hubPort,hubTokenFile:Vg(),sub:d()?.sub,codexCmd:_e.codexCmd,clientVersion:Lt()??void 0,voice:!0,resume:r.resume});return await Ee(),o&&await m(),X}for(let Z of cl({...t.ensurePluginInstalled?{ensurePluginInstalled:t.ensurePluginInstalled}:{},...t.ensureStatusline?{ensureStatusline:t.ensureStatusline}:{}}))(Z.level==="info"?v:F)(Z.message);let g=Os.basename(process.cwd())||"session",h=`${g}@${i.machine}`,y=`${g} (${i.machine})`,w=i2(),_=Os.join(Q,"sessions");a2(_,{recursive:!0});let I=Os.join(_,`${w}.json`),S=process.cwd(),T=Os.join(u2.homedir(),".claude","projects",S.replace(/[^A-Za-z0-9]/g,"-"),`${w}.jsonl`),j=Vg();l2(I,JSON.stringify(h2({id:h,name:y,hubPort:i.hubPort,hubTokenFile:j,claudeSessionId:w,transcriptPath:T,cwd:S,sub:d()?.sub})),{mode:384});let z=!1,J=async()=>{if(!z&&(z=!0,ve(I),f))try{await u(f)}catch{}};process.once("SIGINT",()=>{J()}),process.once("SIGTERM",()=>{J()}),v(`Launching Claude with the Alexa channel \u2014 session: ${h}`);let fe=g2((t.resolveClaude??an)(),{sessionId:h,claudeSessionId:w,sessionName:y,hubPort:i.hubPort},process.env),D=eI(fe.file,fe.args,{stdio:"inherit",env:fe.env});return await J(),o&&await m(),D.status??0}var x2="Usage: acbridge scan [--json] [--timeout <seconds>]",k2=1e3,w2=e=>Dw(e);function S2(e){let t={json:!1,timeoutMs:3e4};for(let r=0;r<e.length;r++){let o=e[r];if(o==="--json")t.json=!0;else if(o==="--timeout"||o?.startsWith("--timeout=")){let n=o==="--timeout"?e[++r]:o.slice(10),i=Number(n);!Number.isFinite(i)||i<=0?t.bad=`invalid --timeout: ${n??"(none)"}`:t.timeoutMs=Math.min(120,Math.max(5,Math.round(i)))*1e3}else t.bad=`unknown option: ${o??""}`}return t}async function iI(e){let t=S2(e);if(t.bad)return x(t.bad),v(x2),2;if(t.json&&be(!0),!await Ne()){let i=Sr();if(!i.ok)return x(i.message),3;if(t.json)return x(Fe()),1;try{await ct({kind:"cli"})}catch(s){return x(`couldn't start the hub: ${s.message}`),v("check ~/.claude-bridge/hub.log, or start it yourself with `acbridge daemon` and re-run"),1}}let r=await q("/local/scan",{method:"POST"});if(r.hubOffline)return x(Fe()),1;if(r.status!==200||!r.body?.scanId)return x(`hub answered HTTP ${r.status} starting the scan \u2014 token mismatch? restart the hub`),1;let{session:o,expired:n}=await _2(r.body.scanId,t);return o?t.json?(console.log(JSON.stringify(o)),o.status==="failed"?1:0):(n&&v(me("(scan session expired mid-poll \u2014 showing the hub's last-known devices)")),o.status==="failed"?(x(`scan failed: ${o.error??"unknown error"}`),1):(o.status==="running"&&F("scan still running at --timeout \u2014 showing partial results (re-run `acbridge scan` for the final list)"),P2(o.devices,o.env,o.accountDevices),await R2(o.devices),0)):(x(Fe()),1)}async function _2(e,t){let r=Date.now()+t.timeoutMs,o=!t.json&&process.stdout.isTTY,n=null;!t.json&&!o&&v("scanning\u2026");try{for(;;){let i=await q(`/local/scan/${e}`);if(i.hubOffline)return{session:n,expired:!1};if(i.status===404){let s=await q("/local/discovered");return s.status===200&&s.body?{session:$2(e,s.body),expired:!0}:{session:n,expired:!0}}if(i.status===200&&i.body&&(n=i.body,o&&process.stdout.write(`\r\u2022 scanning\u2026 ${n.devices.length} device(s) found`),n.status!=="running"))return{session:n,expired:!1};if(Date.now()>=r)return{session:n,expired:!1};await new Promise(s=>setTimeout(s,k2))}}finally{o&&process.stdout.write("\r\x1B[2K")}}var $2=(e,t)=>({id:e,status:"done",startedAt:t.updatedAt,finishedAt:t.updatedAt,devices:t.devices,...t.accountDevices?{accountDevices:t.accountDevices}:{},env:t.env}),I2={ready:0,ecosystems:1,"needs-setup":2,unidentified:3,infrastructure:4},E2={ready:"Ready",ecosystems:"Link account","needs-setup":"Needs setup",unidentified:"Unknown",infrastructure:"Infrastructure"};function nI(e){return I2[Uo(e)]}function A2(e){return E2[Uo(e)]}function tu(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 rI(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 oI(e){let t=C2(e);if(t.length!==0){v(""),v(me(t[0]));for(let r of t.slice(1))v(r)}}function P2(e,t,r){let o=Cw(t);if(o&&t.interop==="windows-arp"?F("WSL detected \u2014 mDNS/broadcast limited; using the Windows neighbor table for ARP discovery"):o&&t.wsl?F("WSL detected \u2014 LAN scan degraded (mDNS/broadcast limited); results may be incomplete"):o&&F("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`)."):Tw(t,e.length)?v(`No devices found. ${Rw}`):v("No devices found. Devices must be on the same network/VLAN; Wi-Fi isolation limits discovery."),oI(r);return}let n=[...e].sort((p,f)=>nI(p)-nI(f)||tu(p).localeCompare(tu(f))),i=n.map(p=>[sI(tu(p),28),p.expectedType??"\u2014",p.addresses.ip,p.addresses.mac??"\u2014",A2(p),rI(p)]),s=["NAME","TYPE","IP","MAC","STATUS","ACTION"],a=s.map((p,f)=>Math.max(p.length,...i.map(g=>g[f].length))),l=p=>p.map((f,g)=>f.padEnd(a[g])).join(" ").trimEnd();v(me(l(s)));for(let p of i)v(l(p));v("");let u=new Map;for(let p of n)u.set(Uo(p),(u.get(Uo(p))??0)+1);let d=[["ready","ready"],["ecosystems","ecosystem"],["needs-setup","need setup"],["unidentified","unidentified"],["infrastructure","infrastructure"]].map(([p,f])=>u.get(p)?`${u.get(p)} ${f}`:null).filter(p=>p!==null);v(`${e.length} device(s)${d.length>0?` \u2014 ${d.join(" \xB7 ")}`:""}`);let m=n.filter(p=>p.identity.hint!==void 0&&rI(p)==="\u2014"&&Uo(p)!=="unidentified");if(m.length>0){v(""),v(me("Notes:"));for(let p of m)v(` \u2022 ${tu(p)} (${p.addresses.ip}): ${p.identity.hint}`)}oI(r)}var sI=(e,t)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e;function C2(e){let t=e??[];if(t.length===0)return[];let r=[`Known from your accounts (${t.length}):`];for(let o of t){let n=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`;r.push(` \u2022 ${T2(o)}: ${n}`)}return r}var T2=e=>sI(e.name,40);async function R2(e){if(!e.some(w2))return;let t=await q("/local/config");t.status!==200||t.body?.autoConnect!=="unset"||(v(""),$("Tip: `acbridge connect --auto on` auto-connects open-protocol lights/plugs (never locks, cameras, or doors)."))}import{existsSync as D2}from"node:fs";import{dirname as N2}from"node:path";function O2(e=Q){return Xs(Xr(Yr(e)))}function nu(e){return ky(to,{home:e?.home,configFile:e?.configFile,env:e?.env,nodeCommand:e?.nodeCommand??O2(e?.bridgeDir)})}function L2(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 aI(e={}){let t=e.installPlugin??al,r=e.applyManaged??yS,o=e.applyFirewall??(()=>gS()),n=e.ensureStatusline??zo,i=e.ensureCodexHooks??nu,s=e.voice??Ue(),a=(e.codexInstalled??(()=>D2(N2(Ks()))))(),l=(e.claudeInstalled??Ms)();if(v(s?`Setting up the Alexa bridge on this machine\u2026
273
302
  `:`Setting up AC Bridge on this machine\u2026
274
- `),l)try{Y("installing the alexa@bridge plugin (bound to this install)");let u=t();A(u.marketplaceRepointed?"plugin marketplace re-pointed to this install + installed":u.pluginReinstalled?"plugin refreshed from this install":"plugin already current")}catch(u){if(!s)return b(`plugin install failed: ${u.message}`),1;U(`plugin install skipped (${u.message}) \u2014 no Claude Code here; continuing for Codex.`)}else{let u=ia(process.platform).manualCommand;if(!s)return b(`no coding agent found \u2014 setup wires the Claude Code plugin and Codex hooks. Install Claude Code (\`${u}\`) or Codex, then re-run \`acbridge setup\`. Device control works without either.`),1;U(`plugin install skipped (claude CLI not found \u2014 install it: ${u}) \u2014 no Claude Code here; continuing for Codex.`)}try{Y(a?`allowlisting the channel in ${Kn()}`:`checking managed settings in ${Kn()}`);let u=r();u.replacedDefaultAllowlist&&U("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(u.changed?`managed settings written${u.usedSudo?" (via sudo)":""}`:"managed settings already current")}catch(u){if(!s)return b(`managed settings: ${u.message}`),h("Write it manually if needed \u2014 `acbridge doctor` prints the exact path + expected JSON."),1;U(`managed settings skipped (${u.message}) \u2014 not needed for Codex-only.`)}try{Y("adding the LAN device-scan firewall rule");let u=o();u.status==="nothing-to-do"?A("no active firewall detected \u2014 nothing to add"):u.status==="needs-elevation"?(U("firewall rule not applied (declined or unavailable)."),u.manualCommand&&h(`Run it manually if device scanning misses devices:
275
- ${u.manualCommand}`)):(A(u.changed?"firewall rule added":"firewall rule already present"),u.userNote&&h(u.userNote))}catch(u){U(`firewall rule skipped: ${u.message}`)}try{Y("installing the statusline tee (context + usage readings)");let u=n();A(u.enabled?u.changed?"statusline tee installed (any existing statusline is chained)":"statusline tee already current":"statusline tee disabled by config \u2014 skipped")}catch(u){U(`statusline tee skipped: ${u.message}`)}try{Y("installing Codex hooks (session-state signals for OpenAI Codex CLI)");let u=i();u.skipped?A("Codex not detected (no ~/.codex) \u2014 hooks skipped"):u.corrupt?U("~/.codex/hooks.json is unparseable \u2014 fix or delete it, then re-run setup."):u.enabled?u.changed?(A("Codex hooks installed (any existing hooks are preserved)"),h("Codex hooks installed \u2014 run /hooks once inside Codex to review and trust the AC Bridge hook.")):A("Codex hooks already current"):A("Codex hooks disabled by config \u2014 skipped")}catch(u){U(`Codex hooks skipped: ${u.message}`)}return h(""),A(GU(a)),0}function WU(e){return e.voice&&e.hubUp&&e.signedIn}function VU(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}`),t.push(`capture: telemetry=${e.entitlement.capture.telemetry} transcripts=${e.entitlement.capture.transcripts}`)),e.signedIn)if(e.entitlementFile==="absent")t.push("entitlement file: absent (capture off, fail-closed)");else if(e.entitlementFile==="unreadable")t.push("entitlement file: unreadable (capture off, fail-closed)");else{let n=e.entitlementFile.ageHours;t.push(`entitlement file: ${n.toFixed(1)}h old (${n<=24?"fresh":"STALE \u2014 capture off, fail-closed"})`)}let r;if(e.sessions!==null)try{r=JSON.parse(e.sessions)}catch{r=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:r}:{},...e.entitlement?{plan:e.entitlement.plan,capture:e.entitlement.capture}:{},...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 O_(e=[]){let t=e.includes("--json");t&&we(!0);let r=ne(),o=Pn(),n=o.state==="ok"?o.token:"",i=!!n,a=o.state==="mismatch",s=!!O(he().refreshFile)?.trim(),l=await Te(),u=WU({voice:Qe(),hubUp:l,signedIn:i}),d=u?await ay(n):null;u&&d===null&&U("could not reach the relay /sessions endpoint");let p=i?await Ot(n):null,m=p?{plan:p.plan,capture:{telemetry:p.capture.telemetry,transcripts:p.capture.transcripts}}:null,f="absent",g=i?kt():null,y=g?O(g.entitlementFile):null;if(y)try{let z=JSON.parse(y);f={ageHours:(Date.now()-(z.fetchedAt??0))/36e5}}catch{f="unreadable"}let k=O(Ve),_=k?Number(k):0,P=_>0&&go({pid:_})?_:void 0,C,E=O(ey);if(l&&E)try{let z=JSON.parse(E);typeof z.connected=="boolean"&&(C={connected:z.connected,...typeof z.code=="number"?{code:z.code}:{}})}catch{}let D=Mn(),G=D.version,ae=Di(G,Tc(),process.platform,D.channel??"app"),X=ae.state==="update"?{latest:ae.latest}:void 0,be;if(l){let z=await Z("/local/session",{method:"GET",timeoutMs:3e3});!z.hubOffline&&z.status===200&&z.body&&(be={active:z.body.active,...z.body.owner?{owner:z.body.owner}:{},touched:z.body.touched,revertOnStop:z.body.revertOnStop})}let Ee=VU({relayUrl:r.relayUrl,machine:r.machine,version:G,...X?{update:X}:{},signedIn:i,paired:s,hubUp:l,sessions:d,entitlement:m,entitlementFile:f,...a?{accountMismatch:!0}:{},...P!==void 0?{daemonPid:P}:{},...C?{relayLink:C}:{},...be?{session:be}:{}});if(t)xe(Ee.json);else for(let z of Ee.lines)h(z);return Ee.exitCode}var JU=["tuya","meross","ewelink","nanoleaf","govee","esphome"];async function D_(e){let t=e[0];if(t===void 0||!bc.safeParse(t).success)return b(`usage: acbridge unlink <${JU.join(" | ")}>`),2;let r=await Z(`/local/${t}/unlink`,{method:"POST"});return r.hubOffline?(b(De()),1):r.status===200&&r.body?.ok?(A(`removed the ${t} account \u2014 its keys and devices are gone from this machine`),r.body.note&&h(r.body.note),0):(b(r.body?.error??`hub answered HTTP ${r.status}`),1)}function Ro(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"}
303
+ `),l)try{se("installing the alexa@bridge plugin (bound to this install)");let u=t();$(u.marketplaceRepointed?"plugin marketplace re-pointed to this install + installed":u.pluginReinstalled?"plugin refreshed from this install":"plugin already current")}catch(u){if(!a)return x(`plugin install failed: ${u.message}`),1;F(`plugin install skipped (${u.message}) \u2014 no Claude Code here; continuing for Codex.`)}else{let u=zs(process.platform).manualCommand;if(!a)return x(`no coding agent found \u2014 setup wires the Claude Code plugin and Codex hooks. Install Claude Code (\`${u}\`) or Codex, then re-run \`acbridge setup\`. Device control works without either.`),1;F(`plugin install skipped (claude CLI not found \u2014 install it: ${u}) \u2014 no Claude Code here; continuing for Codex.`)}try{se(s?`allowlisting the channel in ${lr()}`:`checking managed settings in ${lr()}`);let u=r();u.replacedDefaultAllowlist&&F("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."),$(u.changed?`managed settings written${u.usedSudo?" (via sudo)":""}`:"managed settings already current")}catch(u){if(!a)return x(`managed settings: ${u.message}`),v("Write it manually if needed \u2014 `acbridge doctor` prints the exact path + expected JSON."),1;F(`managed settings skipped (${u.message}) \u2014 not needed for Codex-only.`)}try{se("adding the LAN device-scan firewall rule");let u=o();u.status==="nothing-to-do"?$("no active firewall detected \u2014 nothing to add"):u.status==="needs-elevation"?(F("firewall rule not applied (declined or unavailable)."),u.manualCommand&&v(`Run it manually if device scanning misses devices:
304
+ ${u.manualCommand}`)):($(u.changed?"firewall rule added":"firewall rule already present"),u.userNote&&v(u.userNote))}catch(u){F(`firewall rule skipped: ${u.message}`)}try{se("installing the statusline tee (context + usage readings)");let u=n();$(u.enabled?u.changed?"statusline tee installed (any existing statusline is chained)":"statusline tee already current":"statusline tee disabled by config \u2014 skipped")}catch(u){F(`statusline tee skipped: ${u.message}`)}try{se("installing Codex hooks (session-state signals for OpenAI Codex CLI)");let u=i();u.skipped?$("Codex not detected (no ~/.codex) \u2014 hooks skipped"):u.corrupt?F("~/.codex/hooks.json is unparseable \u2014 fix or delete it, then re-run setup."):u.enabled?u.changed?($("Codex hooks installed (any existing hooks are preserved)"),v("Codex hooks installed \u2014 run /hooks once inside Codex to review and trust the AC Bridge hook.")):$("Codex hooks already current"):$("Codex hooks disabled by config \u2014 skipped")}catch(u){F(`Codex hooks skipped: ${u.message}`)}return v(""),$(L2(s)),0}function U2(e){return e.voice&&e.hubUp&&e.signedIn}function j2(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}`),t.push(`capture: telemetry=${e.entitlement.capture.telemetry} transcripts=${e.entitlement.capture.transcripts}`)),e.signedIn)if(e.entitlementFile==="absent")t.push("entitlement file: absent (capture off, fail-closed)");else if(e.entitlementFile==="unreadable")t.push("entitlement file: unreadable (capture off, fail-closed)");else{let n=e.entitlementFile.ageHours;t.push(`entitlement file: ${n.toFixed(1)}h old (${n<=24?"fresh":"STALE \u2014 capture off, fail-closed"})`)}let r;if(e.sessions!==null)try{r=JSON.parse(e.sessions)}catch{r=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:r}:{},...e.entitlement?{plan:e.entitlement.plan,capture:e.entitlement.capture}:{},...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 cI(e=[]){let t=e.includes("--json");t&&be(!0);let r=de(),o=Ft(),n=o.state==="ok"?o.token:"",i=!!n,s=o.state==="mismatch",a=!!N(we().refreshFile)?.trim(),l=await Ne(),u=U2({voice:Ue(),hubUp:l,signedIn:i}),d=u?await cb(n):null;u&&d===null&&F("could not reach the relay /sessions endpoint");let m=i?await zt(n):null,p=m?{plan:m.plan,capture:{telemetry:m.capture.telemetry,transcripts:m.capture.transcripts}}:null,f="absent",g=i?Oe():null,h=g?N(g.entitlementFile):null;if(h)try{let Z=JSON.parse(h);f={ageHours:(Date.now()-(Z.fetchedAt??0))/36e5}}catch{f="unreadable"}let y=N(Qe),w=y?Number(y):0,_=w>0&&jo({pid:w})?w:void 0,I,S=N(nb);if(l&&S)try{let Z=JSON.parse(S);typeof Z.connected=="boolean"&&(I={connected:Z.connected,...typeof Z.code=="number"?{code:Z.code}:{}})}catch{}let T=Jn(),j=T.version,z=ls(j,dl(),process.platform,T.channel??"app"),J=z.state==="update"?{latest:z.latest}:void 0,fe;if(l){let Z=await q("/local/session",{method:"GET",timeoutMs:3e3});!Z.hubOffline&&Z.status===200&&Z.body&&(fe={active:Z.body.active,...Z.body.owner?{owner:Z.body.owner}:{},touched:Z.body.touched,revertOnStop:Z.body.revertOnStop})}let D=j2({relayUrl:r.relayUrl,machine:r.machine,version:j,...J?{update:J}:{},signedIn:i,paired:a,hubUp:l,sessions:d,entitlement:p,entitlementFile:f,...s?{accountMismatch:!0}:{},..._!==void 0?{daemonPid:_}:{},...I?{relayLink:I}:{},...fe?{session:fe}:{}});if(t)K(D.json);else for(let Z of D.lines)v(Z);return D.exitCode}import{rmSync as z2}from"node:fs";import{createInterface as F2}from"node:readline/promises";var lI="Usage: acbridge uninstall [--purge | --keep-account] [--json]",M2=new Set(["--purge","--keep-account","--json"]);async function uI(e=[],t={}){let r=e.filter(m=>!M2.has(m));if(r.length>0)return x(`unknown option: ${r[0]}`),v(lI),2;let o=e.includes("--purge"),n=e.includes("--keep-account");if(o&&n)return x("--purge and --keep-account are opposites \u2014 pick one"),v(lI),2;let i=e.includes("--json");i&&be(!0);let s={},a=async(m,p,f)=>{se(p);try{await f(),s[m]="ok"}catch(g){s[m]="failed",F(`${p} failed (${g.message}) \u2014 continuing`)}};await a("stop","stopping the bridge (devices revert)\u2026",()=>(t.stopBridge??Qn)([])),await a("statusline","restoring your Claude Code statusline\u2026",()=>(t.restoreStatusline??(()=>zo({env:{...process.env,BRIDGE_STATUSLINE:"0"}})))()),await a("codex","removing the Codex hooks\u2026",()=>(t.removeCodexHooks??(()=>nu({env:{...process.env,BRIDGE_CODEX_HOOKS:"0"}})))()),(t.claudeInstalled??Ms)()?await a("plugin","removing the Claude Code plugin + marketplace\u2026",()=>(t.removePlugin??t0)()):(s.plugin="skipped",v("no Claude Code here \u2014 plugin removal skipped")),await a("firewall","removing the LAN-discovery firewall rule\u2026",()=>{let m=(t.removeFirewall??hS)();m.status==="needs-elevation"&&m.manualCommand&&F(`couldn't remove the firewall rule without elevation \u2014 run it yourself:
305
+ ${m.manualCommand}`)});let l=!1,u=!1;if(!n){let m=o;if(!m)if(t.isTTY??!!(process.stdin.isTTY&&process.stdout.isTTY)){let g=(await(t.ask??(async h=>{let y=F2({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();m=g==="y"||g==="yes"}else v("keeping account data (non-interactive) \u2014 pass --purge to remove everything, --keep-account to silence this");m&&(await a("signOut","signing out (revokes this machine at the relay)\u2026",()=>(t.signOut??Rl)([])),l=s.signOut==="ok",o&&(await a("purgeHome","deleting the AC Bridge home (100% fresh next install)\u2026",()=>(t.purgeHome??(()=>z2(Q,{recursive:!0,force:!0})))()),u=s.purgeHome==="ok"))}let d=Object.entries(s).filter(([,m])=>m==="failed").map(([m])=>m);return d.length===0?$("AC Bridge is unwired from this machine."):F(`unwired with issues (${d.join(", ")}) \u2014 see above`),v("finish with: npm uninstall -g acbridge"),i&&K({steps:s,signedOut:l,purged:u}),0}function ai(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"}
276
306
 
277
307
  Usage: acbridge <command>
278
308
 
279
309
  Commands:
280
- login [--provider google|github|microsoft|sso] [--email <addr>] [--app] [--no-browser] [--if-needed] [--timeout <s>] [--json]
281
- Sign this machine in (browser sign-in; --app hands off to the desktop app;
282
- --no-browser prints the URL to open on THIS machine; --if-needed exits 0 when
283
- already signed in)
310
+ login [--provider google|github|microsoft|sso] [--email <addr>] [--no-browser] [--if-needed] [--timeout <s>] [--json]
311
+ Sign this machine in (browser sign-in; --no-browser prints the URL to open on
312
+ THIS machine; --if-needed exits 0 when already signed in)
284
313
  logout [--json] Sign out: stop the bridge + revoke this machine's credential
314
+ uninstall [--purge | --keep-account] [--json]
315
+ Unwire this machine (agent hooks, plugin, firewall) before \`npm uninstall -g acbridge\`;
316
+ --purge deletes ALL AC Bridge data so the next install starts 100% fresh
285
317
  whoami [--json] Show the signed-in account, machine, relay, and plan
286
318
  start [--no-revert] [--attach] [--json]
287
319
  Start the bridge like the app's Start button (detached; lights revert on stop)
288
320
  stop [--json] Stop the bridge \u2014 reverts touched devices, then tears the hub + daemon down
289
321
  restart stop, then start with the same flags
290
- ${e?` run [--hold] [--agent claude|codex] [--resume]
291
- Launch Claude (or, with --agent codex, OpenAI Codex CLI) in the current project with
292
- the Alexa channel/hub attached (--hold keeps the window open after; --resume, codex
293
- only, resumes the newest existing codex thread for this cwd instead of starting fresh)`:" run Launch an agent session by voice \u2014 voice is turned off in this build; use\n `acbridge start` for the bridge, and launch `claude`/`codex` yourself (their\n hooks still drive your Profiles)"}
322
+ repos [list | add <path> [--root] [--name <label>] | remove <path|name>] [--json]
323
+ The bridges table (shared with the app): the folders agent sessions launch from;
324
+ --root imports every immediate subfolder of a parent
325
+ ${e?` run [<repo>] [--cwd <path>] [--hold] [--agent claude|codex] [--resume]
326
+ Launch Claude (or, with --agent codex, OpenAI Codex CLI) with the Alexa channel/hub
327
+ attached \u2014 in the current project, a \`repos\` bridge by name, or --cwd <path>
328
+ (--hold keeps the window open after; --resume, codex only, resumes the newest
329
+ existing codex thread for this cwd instead of starting fresh)`:" run Launch an agent session by voice \u2014 voice is turned off in this build; use\n `acbridge start` for the bridge, and launch `claude`/`codex` yourself (their\n hooks still drive your Profiles)"}
294
330
  ${e?" setup One-time: install the channel plugin + allowlist it (managed settings)":" setup One-time: install the AC Bridge plugin (Profiles hooks + statusline tee)"}
295
- pair <code> Pair this machine using a claim code from the app ("Add another machine")
296
331
  link <provider> Link a smart-home provider (home-assistant | hue | smartthings | tuya | meross | ewelink | govee | mqtt)
297
332
  unlink <provider> Remove a keyed provider's account (tuya | meross | ewelink | nanoleaf | govee | esphome): delete its keys + devices
298
- devices [list | on <dev> | off <dev> | set <dev> <cmd> [--param k=v]] [--json]
299
- List the connected-device graph, or control a device (same guarded path as the app)
300
- profiles [--json] Show profiles + repo bindings (read-only \u2014 edit in the app)
301
- integrations [--json] Show linked provider accounts
333
+ devices [list | on <dev> | off <dev> | set <dev> <cmd> [--param k=v] | set-main <dev> [--color <h>,<s>] [--brightness <n>] [--kelvin <k>]] [--json]
334
+ List the connected-device graph, control a device (same guarded path as the app),
335
+ or set its resting "main" look (what profile looks return to)
336
+ groups [list | add <name> | rename <g> <new> | remove <g> | assign <dev> <g> | unassign <dev> <g>] [--json]
337
+ Device groups: a registry + per-device membership, shared with the app
338
+ profiles [list | show <p> | states | create [<name>] [--starter] | rename | duplicate | delete |
339
+ edit <p> | set-state <p> <state> [--device <d>] [--color main|session|<h>,<s>] ... |
340
+ bind <p> [--repo <r>] | unbind] [--agent claude|codex] [--json]
341
+ Profiles, end to end: list/inspect them, create (bare \`create\` opens a wizard;
342
+ --starter pre-wires a scene set), edit states \u2192 device looks/actions, and bind
343
+ them to repos \u2014 per agent lane (a wrong/missing verb prints the full grammar)
344
+ integrations [list | enable <id> | disable <id> | remove <id|smartthings>] [--json]
345
+ Linked provider accounts: list them (with per-account ids), pause/resume a local
346
+ account, or remove one (credentials deleted; cloud accounts revoke at the relay)
302
347
  rename <dev> <name> Rename a device everywhere
303
348
  scan [--json] [--timeout <s>] Scan the LAN for smart devices (--json for scripting)
304
349
  connect <id> [--name <n>] [--credentials-file <path>] [--as <protocol>] [--forget] [--purge] [--auto on|off]
@@ -310,8 +355,8 @@ ${e?" setup One-time: install the channel plugin + allowlist it (manag
310
355
  doctor Diagnose prerequisites and configuration
311
356
  --version Print the acbridge version (dev builds print "dev (unversioned)")
312
357
 
313
- Exit codes: 0 ok \xB7 1 failure \xB7 2 usage error \xB7 3 not signed in (run \`acbridge pair\` or use the app)
358
+ Exit codes: 0 ok \xB7 1 failure \xB7 2 usage error \xB7 3 not signed in (run \`acbridge login\`)
314
359
  \xB7 4 update required (below the minimum supported version) \xB7 5 no active subscription (ac-bridge.com/home)
315
- `}function N_(e){return e.some(t=>t==="-h"||t==="--help")}function L_(e,t){let r=Ro(t).split(`
316
- `),o=new RegExp(`^ {2}${e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")}(?=\\s|$)`),n=r.findIndex(a=>o.test(a));if(n===-1)return null;let i=[r[n]];for(let a of r.slice(n+1)){if(a.trim()===""||/^ {2}\S/.test(a))break;i.push(a)}return i.join(`
317
- `).trimEnd()}async function qU(){try{Kv()}catch(r){b(`archiveLegacyUserState() failed (non-fatal): ${r instanceof Error?r.message:String(r)}`)}let[,,e,...t]=process.argv;if(e&&N_(t)){let r=Qe();return h(L_(e,r)??Ro(r)),0}switch(e){case"login":return Ow(t);case"logout":return Dw(t);case"whoami":return Wc(t);case"start":return Jc(t);case"restart":return Mw(t);case"run":return $_(t);case"setup":return R_();case"pair":return Nw(t);case"link":return Ew(t);case"unlink":return D_(t);case"devices":return m0(t);case"profiles":return Uw(t);case"integrations":return vw(t);case"rename":return zw(t);case"scan":return P_(t);case"connect":return Qk(t);case"daemon":return Oc(t);case"stop":return wo(t);case"status":return O_(t);case"capture":return gy(t);case"doctor":return hw();case"--version":case"-V":return h(Mn().version??"dev (unversioned)"),0;case void 0:case"-h":case"--help":case"help":return h(Ro(Qe())),0;default:return b(`unknown command: ${e}`),h(Ro(Qe())),2}}qU().then(e=>process.exit(e),e=>{b(e instanceof Error?e.message:String(e)),process.exit(1)});
360
+ `}function dI(e){return e.some(t=>t==="-h"||t==="--help")}function pI(e,t){let r=ai(t).split(`
361
+ `),o=new RegExp(`^ {2}${e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")}(?=\\s|$)`),n=r.findIndex(s=>o.test(s));if(n===-1)return null;let i=[r[n]];for(let s of r.slice(n+1)){if(s.trim()===""||/^ {2}\S/.test(s))break;i.push(s)}return i.join(`
362
+ `).trimEnd()}async function B2(){try{Yy()}catch(r){x(`archiveLegacyUserState() failed (non-fatal): ${r instanceof Error?r.message:String(r)}`)}let[,,e,...t]=process.argv;if(e&&dI(t)){let r=Ue();return v(pI(e,r)??ai(r)),0}switch(e){case"login":return BS(t);case"logout":return Rl(t);case"whoami":return Tl(t);case"start":return Ul(t);case"restart":return p_(t);case"run":return tI(t);case"repos":return v_(t);case"groups":return f_(t);case"setup":return aI();case"uninstall":return uI(t);case"pair":return x("the pairing-code flow was retired \u2014 sign this machine in with `acbridge login` instead."),2;case"link":return TS(t);case"unlink":return OS(t);case"devices":return h0(t);case"profiles":return c_(t);case"integrations":return US(t);case"rename":return l_(t);case"scan":return iI(t);case"connect":return Qw(t);case"daemon":return fl(t);case"stop":return Qn(t);case"status":return cI(t);case"capture":return hb(t);case"doctor":return xS();case"--version":case"-V":return v(Jn().version??"dev (unversioned)"),0;case void 0:case"-h":case"--help":case"help":return v(ai(Ue())),0;default:return x(`unknown command: ${e}`),v(ai(Ue())),2}}B2().then(e=>process.exit(e),e=>{x(e instanceof Error?e.message:String(e)),process.exit(1)});