@clockworkdog/cogs-client 3.1.2 → 3.1.4

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.
@@ -2921,7 +2921,7 @@ const Bu = (e, t) => {
2921
2921
  ...t.checks ?? [],
2922
2922
  ...r.map((n) => typeof n == "function" ? { _zod: { check: n, def: { check: "custom" }, onattach: [] } } : n)
2923
2923
  ]
2924
- })), e.clone = (r, n) => $e(e, r, n), e.brand = () => e, e.register = (r, n) => (r.add(e, n), e), e.parse = (r, n) => Fu(e, r, n, { callee: e.parse }), e.safeParse = (r, n) => Gu(e, r, n), e.parseAsync = async (r, n) => qu(e, r, n, { callee: e.parseAsync }), e.safeParseAsync = async (r, n) => Vu(e, r, n), e.spa = e.safeParseAsync, e.encode = (r, n) => Wu(e, r, n), e.decode = (r, n) => Hu(e, r, n), e.encodeAsync = async (r, n) => Xu(e, r, n), e.decodeAsync = async (r, n) => Ku(e, r, n), e.safeEncode = (r, n) => Yu(e, r, n), e.safeDecode = (r, n) => Ju(e, r, n), e.safeEncodeAsync = async (r, n) => Qu(e, r, n), e.safeDecodeAsync = async (r, n) => ec(e, r, n), e.refine = (r, n) => e.check(Wc(r, n)), e.superRefine = (r) => e.check(Hc(r)), e.overwrite = (r) => e.check(Ze(r)), e.optional = () => Yr(e), e.nullable = () => Jr(e), e.nullish = () => Yr(Jr(e)), e.nonoptional = (r) => jc(e, r), e.array = () => Ee(e), e.or = (r) => de([e, r]), e.and = (r) => Ac(e, r), e.transform = (r) => Qr(e, Cc(r)), e.default = (r) => Zc(e, r), e.prefault = (r) => xc(e, r), e.catch = (r) => Uc(e, r), e.pipe = (r) => Qr(e, r), e.readonly = () => qc(e), e.describe = (r) => {
2924
+ })), e.clone = (r, n) => $e(e, r, n), e.brand = () => e, e.register = (r, n) => (r.add(e, n), e), e.parse = (r, n) => Fu(e, r, n, { callee: e.parse }), e.safeParse = (r, n) => Gu(e, r, n), e.parseAsync = async (r, n) => qu(e, r, n, { callee: e.parseAsync }), e.safeParseAsync = async (r, n) => Vu(e, r, n), e.spa = e.safeParseAsync, e.encode = (r, n) => Wu(e, r, n), e.decode = (r, n) => Hu(e, r, n), e.encodeAsync = async (r, n) => Xu(e, r, n), e.decodeAsync = async (r, n) => Ku(e, r, n), e.safeEncode = (r, n) => Yu(e, r, n), e.safeDecode = (r, n) => Ju(e, r, n), e.safeEncodeAsync = async (r, n) => Qu(e, r, n), e.safeDecodeAsync = async (r, n) => ec(e, r, n), e.refine = (r, n) => e.check(Wc(r, n)), e.superRefine = (r) => e.check(Hc(r)), e.overwrite = (r) => e.check(Ze(r)), e.optional = () => Yr(e), e.nullable = () => Jr(e), e.nullish = () => Yr(Jr(e)), e.nonoptional = (r) => jc(e, r), e.array = () => ve(e), e.or = (r) => de([e, r]), e.and = (r) => Ac(e, r), e.transform = (r) => Qr(e, Cc(r)), e.default = (r) => Zc(e, r), e.prefault = (r) => xc(e, r), e.catch = (r) => Uc(e, r), e.pipe = (r) => Qr(e, r), e.readonly = () => qc(e), e.describe = (r) => {
2925
2925
  const n = e.clone();
2926
2926
  return Ve.add(n, { description: r }), n;
2927
2927
  }, Object.defineProperty(e, "description", {
@@ -3028,7 +3028,7 @@ function zs(e) {
3028
3028
  const Ic = /* @__PURE__ */ g("ZodArray", (e, t) => {
3029
3029
  va.init(e, t), H.init(e, t), e.element = t.element, e.min = (r, n) => e.check(Qe(r, n)), e.nonempty = (r) => e.check(Qe(1, r)), e.max = (r, n) => e.check(ks(r, n)), e.length = (r, n) => e.check(Ps(r, n)), e.unwrap = () => e.element;
3030
3030
  });
3031
- function Ee(e, t) {
3031
+ function ve(e, t) {
3032
3032
  return ku(Ic, e, t);
3033
3033
  }
3034
3034
  const Zs = /* @__PURE__ */ g("ZodObject", (e, t) => {
@@ -3462,7 +3462,7 @@ function en(e, t) {
3462
3462
  t: u
3463
3463
  };
3464
3464
  }
3465
- const ul = typeof navigator < "u" && typeof navigator.standalone < "u", cl = "GestureEvent" in window;
3465
+ const ul = typeof navigator < "u" && typeof navigator.standalone < "u", cl = "GestureEvent" in globalThis;
3466
3466
  function et(e, t) {
3467
3467
  return (e % t + t) % t;
3468
3468
  }
@@ -4339,10 +4339,10 @@ function Hs() {
4339
4339
  "64:ff9b:1::/48": "NAT64 (local-use)"
4340
4340
  }, K.RE_BAD_CHARACTERS = /([^0-9a-f:/%])/gi, K.RE_BAD_ADDRESS = /([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi, K.RE_SUBNET_STRING = /\/\d{1,3}(?=%|$)/, K.RE_ZONE_STRING = /%.*$/, K.RE_URL = /^\[{0,1}([0-9a-f:]+)\]{0,1}/, K.RE_URL_WITH_PORT = /\[([0-9a-f:]+)\]:([0-9]{1,5})/), K;
4341
4341
  }
4342
- var ve = {}, hn;
4342
+ var Ee = {}, hn;
4343
4343
  function Xs() {
4344
- if (hn) return ve;
4345
- hn = 1, Object.defineProperty(ve, "__esModule", { value: !0 }), ve.escapeHtml = e, ve.spanAllZeroes = t, ve.spanAll = r, ve.spanLeadingZeroes = s, ve.simpleGroup = i;
4344
+ if (hn) return Ee;
4345
+ hn = 1, Object.defineProperty(Ee, "__esModule", { value: !0 }), Ee.escapeHtml = e, Ee.spanAllZeroes = t, Ee.spanAll = r, Ee.spanLeadingZeroes = s, Ee.simpleGroup = i;
4346
4346
  function e(o) {
4347
4347
  return o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4348
4348
  }
@@ -4361,7 +4361,7 @@ function Xs() {
4361
4361
  function i(o, c = 0) {
4362
4362
  return o.split(":").map((l, a) => /group-v4/.test(l) ? l : `<span class="hover-group group-${a + c}">${n(l)}</span>`);
4363
4363
  }
4364
- return ve;
4364
+ return Ee;
4365
4365
  }
4366
4366
  var ne = {}, dn;
4367
4367
  function wl() {
@@ -5326,9 +5326,10 @@ class Il {
5326
5326
  }
5327
5327
  /** Checks whether `host` and `port` are matched by this pattern. */
5328
5328
  validate(t, r) {
5329
- return this.matchesHost(t) && (this.port === "*" || Number(this.port) === r);
5329
+ return this.validateHostname(t) && (this.port === "*" || Number(this.port) === r);
5330
5330
  }
5331
- matchesHost(t) {
5331
+ /** Checks whether `host` is matched by the hostname part of this pattern, ignoring the port. */
5332
+ validateHostname(t) {
5332
5333
  const r = this.host.toLowerCase();
5333
5334
  return t = t.toLowerCase(), r === "*" ? !0 : r === "localhost" ? t === "localhost" || Rl(t) : r === "private" ? yl(t) : r.startsWith("*.") ? t.endsWith(r.slice(1)) : r === t;
5334
5335
  }
@@ -6409,7 +6410,7 @@ function Jl() {
6409
6410
  }, sr;
6410
6411
  }
6411
6412
  var Ql = Jl();
6412
- const fr = /* @__PURE__ */ bl(Ql), us = Ee(ee().min(1)).refine((e) => new Set(e).size === e.length, {
6413
+ const fr = /* @__PURE__ */ bl(Ql), us = ve(ee().min(1)).refine((e) => new Set(e).size === e.length, {
6413
6414
  message: "Array items must be unique"
6414
6415
  });
6415
6416
  function ei(e) {
@@ -6485,12 +6486,12 @@ function ei(e) {
6485
6486
  height: te().gt(0).int(),
6486
6487
  visible: Pe().optional()
6487
6488
  }).optional(),
6488
- config: Ee(h).optional(),
6489
+ config: ve(h).optional(),
6489
6490
  events: q({
6490
- fromCogs: Ee(p).optional(),
6491
- toCogs: Ee(p).optional()
6491
+ fromCogs: ve(p).optional(),
6492
+ toCogs: ve(p).optional()
6492
6493
  }).optional(),
6493
- state: Ee(I).optional(),
6494
+ state: ve(I).optional(),
6494
6495
  media: q({
6495
6496
  audio: G(!0).optional(),
6496
6497
  video: G(!0).optional(),
@@ -6506,10 +6507,10 @@ function ei(e) {
6506
6507
  }).optional(),
6507
6508
  permissions: ur({
6508
6509
  network: ur({
6509
- access: Ee(
6510
+ access: ve(
6510
6511
  e({
6511
- hosts: Ee(ee().refine(v, { error: "Invalid network host pattern" })).min(1),
6512
- caCertificate: ee().optional()
6512
+ hosts: ve(ee().refine(v, { error: "Invalid network host pattern" })).min(1),
6513
+ caCertificates: ve(ee().min(1)).optional()
6513
6514
  })
6514
6515
  ).optional()
6515
6516
  }).optional()
@@ -16,7 +16,7 @@
16
16
  * by Pedro Ladaria <pedro.ladaria@gmail.com>
17
17
  * https://github.com/pladaria/reconnecting-websocket
18
18
  * License MIT
19
- */var _i=function(){if(typeof WebSocket<"u")return WebSocket},Ei=function(e){return typeof e<"u"&&!!e&&e.CLOSING===2},ye={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0},bi=function(){function e(t,r,n){var s=this;n===void 0&&(n={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(i){s._debug("open event");var o=s._options.minUptime,c=o===void 0?ye.minUptime:o;clearTimeout(s._connectTimeout),s._uptimeTimeout=setTimeout(function(){return s._acceptOpen()},c),s._ws.binaryType=s._binaryType,s._messageQueue.forEach(function(u){return s._ws.send(u)}),s._messageQueue=[],s.onopen&&s.onopen(i),s._listeners.open.forEach(function(u){return s._callEventListener(i,u)})},this._handleMessage=function(i){s._debug("message event"),s.onmessage&&s.onmessage(i),s._listeners.message.forEach(function(o){return s._callEventListener(i,o)})},this._handleError=function(i){s._debug("error event",i.message),s._disconnect(void 0,i.message==="TIMEOUT"?"timeout":void 0),s.onerror&&s.onerror(i),s._debug("exec error listeners"),s._listeners.error.forEach(function(o){return s._callEventListener(i,o)}),s._connect()},this._handleClose=function(i){s._debug("close event"),s._clearTimeouts(),s._shouldReconnect&&s._connect(),s.onclose&&s.onclose(i),s._listeners.close.forEach(function(o){return s._callEventListener(i,o)})},this._url=t,this._protocols=r,this._options=n,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(t){this._binaryType=t,this._ws&&(this._ws.binaryType=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){var t=this._messageQueue.reduce(function(r,n){return typeof n=="string"?r+=n.length:n instanceof Blob?r+=n.size:r+=n.byteLength,r},0);return t+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(t,r){if(t===void 0&&(t=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(t,r)},e.prototype.reconnect=function(t,r){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(t,r),this._connect())},e.prototype.send=function(t){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",t),this._ws.send(t);else{var r=this._options.maxEnqueuedMessages,n=r===void 0?ye.maxEnqueuedMessages:r;this._messageQueue.length<n&&(this._debug("enqueue",t),this._messageQueue.push(t))}},e.prototype.addEventListener=function(t,r){this._listeners[t]&&this._listeners[t].push(r)},e.prototype.dispatchEvent=function(t){var r,n,s=this._listeners[t.type];if(s)try{for(var i=di(s),o=i.next();!o.done;o=i.next()){var c=o.value;this._callEventListener(t,c)}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0},e.prototype.removeEventListener=function(t,r){this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(function(n){return n!==r}))},e.prototype._debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this._options.debug&&console.log.apply(console,mi(["RWS>"],t))},e.prototype._getNextDelay=function(){var t=this._options,r=t.reconnectionDelayGrowFactor,n=r===void 0?ye.reconnectionDelayGrowFactor:r,s=t.minReconnectionDelay,i=s===void 0?ye.minReconnectionDelay:s,o=t.maxReconnectionDelay,c=o===void 0?ye.maxReconnectionDelay:o,u=0;return this._retryCount>0&&(u=i*Math.pow(n,this._retryCount-1),u>c&&(u=c)),this._debug("next delay",u),u},e.prototype._wait=function(){var t=this;return new Promise(function(r){setTimeout(r,t._getNextDelay())})},e.prototype._getNextUrl=function(t){if(typeof t=="string")return Promise.resolve(t);if(typeof t=="function"){var r=t();if(typeof r=="string")return Promise.resolve(r);if(r.then)return r}throw Error("Invalid URL")},e.prototype._connect=function(){var t=this;if(!(this._connectLock||!this._shouldReconnect)){this._connectLock=!0;var r=this._options,n=r.maxRetries,s=n===void 0?ye.maxRetries:n,i=r.connectionTimeout,o=i===void 0?ye.connectionTimeout:i,c=r.WebSocket,u=c===void 0?_i():c;if(this._retryCount>=s){this._debug("max retries reached",this._retryCount,">=",s);return}if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!Ei(u))throw Error("No valid WebSocket class provided");this._wait().then(function(){return t._getNextUrl(t._url)}).then(function(l){t._closeCalled||(t._debug("connect",{url:l,protocols:t._protocols}),t._ws=t._protocols?new u(l,t._protocols):new u(l),t._ws.binaryType=t._binaryType,t._connectLock=!1,t._addListeners(),t._connectTimeout=setTimeout(function(){return t._handleTimeout()},o))})}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new gi(Error("TIMEOUT"),this))},e.prototype._disconnect=function(t,r){if(t===void 0&&(t=1e3),this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,r),this._handleClose(new vi(t,r,this))}catch{}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(t,r){"handleEvent"in r?r.handleEvent(t):r(t)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e}();const Zr=12095;function Dr(e){const t=typeof window<"u"?window.location:void 0,r=`/assets/${encodeURIComponent(e)}`;return`${t?.protocol}//${t?.hostname}:${Zr}${r}`}async function wi(e){const t=await fetch(e);return URL.createObjectURL(new Blob([await t.arrayBuffer()]))}class Si{_items;#e=new EventTarget;constructor(t){this._items={...t}}handleDataStoreItemsMessage(t){this._items={...this._items,...t.items},Object.entries(t.items).forEach(([r,n])=>{this.dispatchEvent(new pt(r,n))}),this.dispatchEvent(new mt(t.items))}get items(){return this._items}getItem(t){return this._items[t]}setItems(t){return this._items={...this._items,...t},Object.entries(t).forEach(([r,n])=>{this.dispatchEvent(new pt(r,n))}),this.dispatchEvent(new mt(t)),this}addEventListener(t,r,n){this.#e.addEventListener(t,r,n)}removeEventListener(t,r,n){this.#e.removeEventListener(t,r,n)}dispatchEvent(t){this.#e.dispatchEvent(t)}}class pt extends Event{constructor(t,r){super("item"),this.key=t,this.value=r}_cogsConnectionEventType="item"}class mt extends Event{constructor(t){super("items"),this.items=t}_cogsConnectionEventType="item"}const xe=globalThis.Date;function Ii(e){const t=Math.round(e-xe.now());function r(...s){return s.length===0?new xe(r.now()):new xe(...s)}const n=Object.getOwnPropertyDescriptors(xe);Object.defineProperties(r,n),r.now=function(){return xe.now()+t},globalThis.Date=r}let $i=0;function yi(){return++$i}const Ri=5,Ai=1e4;function Ti({interval:e,send:t,onChange:r=Ii,syncSampleSize:n=Ri,syncRequestTimeout:s=Ai}){const i={};async function o(){const a=[];for(let p=0;p<n;p++){const $=new Promise(_=>{const m=yi(),E=Date.now(),y=performance.now();t({timesync:{id:m}});const C=(x,N)=>_({sentAt:y,receivedAt:x,serverNow:N,clientNow:E});i[m]={complete:C},setTimeout(()=>_(null),s)});a.push($),await $}const f=(await Promise.all(a)).filter(p=>p!==null),h=Oi(f);isNaN(h)||r(Date.now()+h)}const c=a=>{const f=performance.now(),h=i[a.timesync.id];h&&h.complete(f,a.timesync.now)};o();const u=setInterval(o,e);return{receive:c,destroy:()=>{clearInterval(u)}}}function Oi(e){return e.map(({sentAt:t,receivedAt:r,clientNow:n,serverNow:s})=>{const i=(r-t)/2;return s-n-i}).reduce((t,r)=>t+r,0)/e.length}class ki{constructor(t,{hostname:r=document.location.hostname,port:n=Zr}={},s,i){this.manifest=t,this.currentState={...s},this.store=new Si(i??{});const{useReconnectingWebsocket:o,path:c,pathParams:u}=Pi(document.location.href);this.urlParams=new URLSearchParams(u),this.urlParams.set("screenWidth",window.screen.width.toString()),this.urlParams.set("screenHeight",window.screen.height.toString()),this.urlParams.set("screenPixelRatio",window.devicePixelRatio.toString());const l=`ws://${r}:${n}${c}?${this.urlParams}`;this.websocket=o?new bi(l):new WebSocket(l);let a;this.websocket.onopen=()=>{this.currentConfig={},this.currentState={},this.dispatchEvent(new jr),this.setState(this.currentState),a=Ti({interval:6e4,send:f=>{this.websocket.send(JSON.stringify(f))}})},this.websocket.addEventListener("message",({data:f})=>{try{const h=JSON.parse(f);if(typeof h=="object"&&h!==null&&"timesync"in h){const p=h;a?.receive(p)}}catch(h){console.error(h)}}),this.websocket.onclose=()=>{a?.destroy(),this.dispatchEvent(new xr)},this.websocket.addEventListener("message",({data:f})=>{try{const h=JSON.parse(f);try{if(h.config)this.currentConfig=h.config,this.dispatchEvent(new Ur(this.currentConfig));else if(h.updates)this.currentState={...this.currentState,...h.updates},this.dispatchEvent(new Br(h.updates));else if(h.event&&h.event.key)this.dispatchEvent(new Fr(h.event.key,h.event.value));else if(typeof h.message=="object"){const p=h.message;switch(p.type){case"adjustable_timer_update":this._timerState={startedAt:Date.now(),durationMillis:p.durationMillis,ticking:p.ticking};break;case"show_phase":this._showPhase=p.phase,this.dispatchEvent(new Gr(p.phase));break;case"media_config_update":this._mediaConfig=p;for(const $ of["preferOptimizedAudio","preferOptimizedVideo","preferOptimizedImages"])p[$]?this.urlParams.set($,"true"):this.urlParams.delete($);this.dispatchEvent(new qr(p));break;case"data_store_items":this.store.handleDataStoreItemsMessage(p);break;case"audio_play":case"audio_pause":case"audio_stop":case"audio_set_clip_volume":case"video_play":case"video_pause":case"video_stop":case"video_set_volume":case"video_set_fit":case"image_show":case"image_hide":case"image_set_fit":{const{type:$}=p;"media_strategy"in p||console.warn(`Legacy ${$} message received, this is no longer supported. Please upgrade to COGS 5.10 or downgrade to cogs-client@2.11`)}}this.dispatchEvent(new Mr(p))}}catch(p){console.warn("Error handling data",f,p)}}catch(h){console.error("Unable to parse incoming data from server",f,h)}}),this.store.addEventListener("items",f=>{this.sendDataStoreItems(f.items)});{const f=async()=>{if(navigator.mediaDevices){const h=(await navigator.mediaDevices.enumerateDevices()).filter(({kind:p})=>p==="audiooutput");this.sendAudioOutputs(h),this.audioOutputs=h}};this.eventTarget.addEventListener("open",f),navigator.mediaDevices?.addEventListener("devicechange",f),f()}}websocket;eventTarget=new EventTarget;currentConfig={};get config(){return{...this.currentConfig}}currentState={};get state(){return{...this.currentState}}_showPhase=Pe.Setup;get showPhase(){return this._showPhase}_timerState=null;get timerState(){return this._timerState?{...this._timerState}:null}_mediaConfig=null;get mediaConfig(){return this._mediaConfig?{...this._mediaConfig}:null}getAssetUrl(t){return`${Dr(t)}?${this.urlParams?.toString()??""}`}audioOutputs=void 0;_selectedAudioOutput="";get selectedAudioOutput(){return this._selectedAudioOutput}store;urlParams;get isConnected(){return this.websocket.readyState===WebSocket.OPEN}close(){this.websocket.close()}sendEvent(t,...[r]){this.isConnected&&this.websocket.send(JSON.stringify({event:{key:t,value:r}}))}setState(t){this.currentState={...this.currentState,...t},this.isConnected&&this.websocket.send(JSON.stringify({updates:t}))}getAudioSinkId(t){return t?this.audioOutputs?.find(({label:r})=>r===t)?.deviceId:""}sendAudioOutputs(t){this.isConnected&&this.websocket.send(JSON.stringify({audioOutputs:t}))}sendDataStoreItems(t){this.isConnected&&this.websocket.send(JSON.stringify({dataStoreItems:t}))}setPluginWindowVisible(t){this.isConnected&&this.websocket.send(JSON.stringify({window:{visible:t}}))}addEventListener(t,r,n){this.eventTarget.addEventListener(t,r,n)}removeEventListener(t,r,n){this.eventTarget.removeEventListener(t,r,n)}dispatchEvent(t){this.eventTarget.dispatchEvent(t)}}function Pi(e){const t=new URL(e),r=new URLSearchParams(t.searchParams),n=r.get("local_id"),s=r.get("simulator")==="true",i=r.get("display")??"",o=t.pathname.startsWith("/plugin/")?decodeURIComponent(t.pathname.split("/")[2]):void 0;if(n){const c=r.get("t")??"";return r.delete("local_id"),{path:`/local/${encodeURIComponent(n)}`,pathParams:new URLSearchParams({t:c}),useReconnectingWebsocket:!0}}else if(s){const c=r.get("name")??"";return r.delete("simulator"),r.delete("name"),{path:`/simulator/${encodeURIComponent(c)}`,pathParams:r,useReconnectingWebsocket:!0}}else if(i){const c=r.get("displayIdIndex")??"";return r.delete("display"),r.delete("displayIdIndex"),{path:`/display/${encodeURIComponent(i)}/${encodeURIComponent(c)}`}}else{if(o)return{path:`/plugin/${encodeURIComponent(o)}`,useReconnectingWebsocket:!0};{const c=r.get("serial")??"";return r.delete("serial"),{path:`/client/${encodeURIComponent(c)}`,pathParams:r}}}}class jr extends Event{_cogsConnectionEventType="open";constructor(){super("open")}}class xr extends Event{_cogsConnectionEventType="close";constructor(){super("close")}}class Mr extends Event{constructor(t){super("message"),this.message=t}_cogsConnectionEventType="message"}class Ur extends Event{constructor(t){super("config"),this.config=t}_cogsConnectionEventType="config"}class Br extends Event{constructor(t){super("state"),this.state=t}_cogsConnectionEventType="state"}class Fr extends Event{constructor(t,r){super("event"),this.name=t,this.value=r}_cogsConnectionEventType="event"}class qr extends Event{constructor(t){super("mediaConfig"),this.mediaConfig=t}_cogsConnectionEventType="mediaConfig"}class Gr extends Event{constructor(t){super("showPhase"),this.showPhase=t}_cogsConnectionEventType="showPhase"}function g(e,t,r){function n(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const l=o.prototype,a=Object.keys(l);for(let f=0;f<a.length;f++){const h=a[f];h in c||(c[h]=l[h].bind(c))}}const s=r?.Parent??Object;class i extends s{}Object.defineProperty(i,"name",{value:e});function o(c){var u;const l=r?.Parent?new i:this;n(l,c),(u=l._zod).deferred??(u.deferred=[]);for(const a of l._zod.deferred)a();return l}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class Ce extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Vr extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Wr={};function Ee(e){return Wr}function Ci(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function gt(e,t){return typeof t=="bigint"?t.toString():t}function vt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function _t(e){return e==null}function Et(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ni(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let s=(n.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(n)){const u=n.match(/\d?e-(\d?)/);u?.[1]&&(s=Number.parseInt(u[1]))}const i=r>s?r:s,o=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return o%c/10**i}const Hr=Symbol("evaluating");function W(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Hr)return n===void 0&&(n=Hr,n=r()),n},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Re(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ae(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Xr(e){return JSON.stringify(e)}function Li(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Kr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ge(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const zi=vt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ne(e){if(Ge(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Ge(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Yr(e){return Ne(e)?{...e}:Array.isArray(e)?[...e]:e}const Zi=new Set(["string","number","symbol"]),Di=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Te(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function be(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function A(e){const 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 ji(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const xi={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]};function Mi(e,t){const r=e._zod.def,n=Ae(e._zod.def,{get shape(){const s={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(s[i]=r.shape[i])}return Re(this,"shape",s),s},checks:[]});return be(e,n)}function Ui(e,t){const r=e._zod.def,n=Ae(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete s[i]}return Re(this,"shape",s),s},checks:[]});return be(e,n)}function Bi(e,t){if(!Ne(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const s=Ae(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Re(this,"shape",i),i},checks:[]});return be(e,s)}function Fi(e,t){if(!Ne(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Re(this,"shape",n),n},checks:e._zod.def.checks};return be(e,r)}function qi(e,t){const r=Ae(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Re(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return be(e,r)}function Gi(e,t,r){const n=Ae(t._zod.def,{get shape(){const s=t._zod.def.shape,i={...s};if(r)for(const o in r){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=e?new e({type:"optional",innerType:s[o]}):s[o])}else for(const o in s)i[o]=e?new e({type:"optional",innerType:s[o]}):s[o];return Re(this,"shape",i),i},checks:[]});return be(t,n)}function Vi(e,t,r){const n=Ae(t._zod.def,{get shape(){const s=t._zod.def.shape,i={...s};if(r)for(const o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=new e({type:"nonoptional",innerType:s[o]}))}else for(const o in s)i[o]=new e({type:"nonoptional",innerType:s[o]});return Re(this,"shape",i),i},checks:[]});return be(t,n)}function Le(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 Oe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ve(e){return typeof e=="string"?e:e?.message}function we(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const s=Ve(e.inst?._zod.def?.error?.(e))??Ve(t?.error?.(e))??Ve(r.customError?.(e))??Ve(r.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function bt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Me(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Jr=(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,gt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Qr=g("$ZodError",Jr),en=g("$ZodError",Jr,{Parent:Error});function Wi(e,t=r=>r.message){const r={},n=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}function Hi(e,t=r=>r.message){const r={_errors:[]},n=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>n({issues:o}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let o=r,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return n(e),r}const wt=e=>(t,r,n,s)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new Ce;if(o.issues.length){const c=new(s?.Err??e)(o.issues.map(u=>we(u,i,Ee())));throw Kr(c,s?.callee),c}return o.value},St=e=>async(t,r,n,s)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const c=new(s?.Err??e)(o.issues.map(u=>we(u,i,Ee())));throw Kr(c,s?.callee),c}return o.value},We=e=>(t,r,n)=>{const s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Ce;return i.issues.length?{success:!1,error:new(e??Qr)(i.issues.map(o=>we(o,s,Ee())))}:{success:!0,data:i.value}},Xi=We(en),He=e=>async(t,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(o=>we(o,s,Ee())))}:{success:!0,data:i.value}},Ki=He(en),Yi=e=>(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wt(e)(t,r,s)},Ji=e=>(t,r,n)=>wt(e)(t,r,n),Qi=e=>async(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return St(e)(t,r,s)},eo=e=>async(t,r,n)=>St(e)(t,r,n),to=e=>(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return We(e)(t,r,s)},ro=e=>(t,r,n)=>We(e)(t,r,n),no=e=>async(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return He(e)(t,r,s)},so=e=>async(t,r,n)=>He(e)(t,r,n),io=/^[cC][^\s-]{8,}$/,oo=/^[0-9a-z]+$/,ao=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uo=/^[0-9a-vA-V]{20}$/,co=/^[A-Za-z0-9]{27}$/,lo=/^[a-zA-Z0-9_-]{21}$/,fo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ho=/^([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})$/,tn=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)$/,po=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function go(){return new RegExp(mo,"u")}const vo=/^(?:(?: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])$/,_o=/^(([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}|:))$/,Eo=/^((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])$/,bo=/^(([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])$/,wo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rn=/^[A-Za-z0-9_-]*$/,So=/^\+(?:[0-9]){6,14}[0-9]$/,nn="(?:(?:\\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])))",Io=new RegExp(`^${nn}$`);function sn(e){const 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 $o(e){return new RegExp(`^${sn(e)}$`)}function yo(e){const t=sn({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${nn}T(?:${n})$`)}const Ro=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ao=/^-?\d+$/,To=/^-?\d+(?:\.\d+)?/,Oo=/^(?:true|false)$/i,ko=/^null$/i,Po=/^[^A-Z]*$/,Co=/^[^a-z]*$/,ie=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),on={number:"number",bigint:"bigint",object:"date"},an=g("$ZodCheckLessThan",(e,t)=>{ie.init(e,t);const r=on[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,i=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),un=g("$ZodCheckGreaterThan",(e,t)=>{ie.init(e,t);const r=on[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,i=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),No=g("$ZodCheckMultipleOf",(e,t)=>{ie.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.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):Ni(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})}}),Lo=g("$ZodCheckNumberFormat",(e,t)=>{ie.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[s,i]=xi[t.format];e._zod.onattach.push(o=>{const c=o._zod.bag;c.format=t.format,c.minimum=s,c.maximum=i,r&&(c.pattern=Ao)}),e._zod.check=o=>{const c=o.value;if(r){if(!Number.isInteger(c)){o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?o.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):o.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}c<s&&o.issues.push({origin:"number",input:c,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),c>i&&o.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inst:e})}}),zo=g("$ZodCheckMaxLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!_t(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const s=n.value;if(s.length<=t.maximum)return;const o=bt(s);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Zo=g("$ZodCheckMinLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!_t(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const s=n.value;if(s.length>=t.minimum)return;const o=bt(s);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Do=g("$ZodCheckLengthEquals",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!_t(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=n=>{const s=n.value,i=s.length;if(i===t.length)return;const o=bt(s),c=i>t.length;n.issues.push({origin:o,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Xe=g("$ZodCheckStringFormat",(e,t)=>{var r,n;ie.init(e,t),e._zod.onattach.push(s=>{const i=s._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=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),jo=g("$ZodCheckRegex",(e,t)=>{Xe.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})}}),xo=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Po),Xe.init(e,t)}),Mo=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Co),Xe.init(e,t)}),Uo=g("$ZodCheckIncludes",(e,t)=>{ie.init(e,t);const r=Te(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Bo=g("$ZodCheckStartsWith",(e,t)=>{ie.init(e,t);const r=new RegExp(`^${Te(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Fo=g("$ZodCheckEndsWith",(e,t)=>{ie.init(e,t);const r=new RegExp(`.*${Te(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),qo=g("$ZodCheckOverwrite",(e,t)=>{ie.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Go{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}const n=t.split(`
19
+ */var _i=function(){if(typeof WebSocket<"u")return WebSocket},Ei=function(e){return typeof e<"u"&&!!e&&e.CLOSING===2},ye={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0},bi=function(){function e(t,r,n){var s=this;n===void 0&&(n={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(i){s._debug("open event");var o=s._options.minUptime,c=o===void 0?ye.minUptime:o;clearTimeout(s._connectTimeout),s._uptimeTimeout=setTimeout(function(){return s._acceptOpen()},c),s._ws.binaryType=s._binaryType,s._messageQueue.forEach(function(u){return s._ws.send(u)}),s._messageQueue=[],s.onopen&&s.onopen(i),s._listeners.open.forEach(function(u){return s._callEventListener(i,u)})},this._handleMessage=function(i){s._debug("message event"),s.onmessage&&s.onmessage(i),s._listeners.message.forEach(function(o){return s._callEventListener(i,o)})},this._handleError=function(i){s._debug("error event",i.message),s._disconnect(void 0,i.message==="TIMEOUT"?"timeout":void 0),s.onerror&&s.onerror(i),s._debug("exec error listeners"),s._listeners.error.forEach(function(o){return s._callEventListener(i,o)}),s._connect()},this._handleClose=function(i){s._debug("close event"),s._clearTimeouts(),s._shouldReconnect&&s._connect(),s.onclose&&s.onclose(i),s._listeners.close.forEach(function(o){return s._callEventListener(i,o)})},this._url=t,this._protocols=r,this._options=n,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(t){this._binaryType=t,this._ws&&(this._ws.binaryType=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){var t=this._messageQueue.reduce(function(r,n){return typeof n=="string"?r+=n.length:n instanceof Blob?r+=n.size:r+=n.byteLength,r},0);return t+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(t,r){if(t===void 0&&(t=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(t,r)},e.prototype.reconnect=function(t,r){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(t,r),this._connect())},e.prototype.send=function(t){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",t),this._ws.send(t);else{var r=this._options.maxEnqueuedMessages,n=r===void 0?ye.maxEnqueuedMessages:r;this._messageQueue.length<n&&(this._debug("enqueue",t),this._messageQueue.push(t))}},e.prototype.addEventListener=function(t,r){this._listeners[t]&&this._listeners[t].push(r)},e.prototype.dispatchEvent=function(t){var r,n,s=this._listeners[t.type];if(s)try{for(var i=di(s),o=i.next();!o.done;o=i.next()){var c=o.value;this._callEventListener(t,c)}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0},e.prototype.removeEventListener=function(t,r){this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(function(n){return n!==r}))},e.prototype._debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this._options.debug&&console.log.apply(console,mi(["RWS>"],t))},e.prototype._getNextDelay=function(){var t=this._options,r=t.reconnectionDelayGrowFactor,n=r===void 0?ye.reconnectionDelayGrowFactor:r,s=t.minReconnectionDelay,i=s===void 0?ye.minReconnectionDelay:s,o=t.maxReconnectionDelay,c=o===void 0?ye.maxReconnectionDelay:o,u=0;return this._retryCount>0&&(u=i*Math.pow(n,this._retryCount-1),u>c&&(u=c)),this._debug("next delay",u),u},e.prototype._wait=function(){var t=this;return new Promise(function(r){setTimeout(r,t._getNextDelay())})},e.prototype._getNextUrl=function(t){if(typeof t=="string")return Promise.resolve(t);if(typeof t=="function"){var r=t();if(typeof r=="string")return Promise.resolve(r);if(r.then)return r}throw Error("Invalid URL")},e.prototype._connect=function(){var t=this;if(!(this._connectLock||!this._shouldReconnect)){this._connectLock=!0;var r=this._options,n=r.maxRetries,s=n===void 0?ye.maxRetries:n,i=r.connectionTimeout,o=i===void 0?ye.connectionTimeout:i,c=r.WebSocket,u=c===void 0?_i():c;if(this._retryCount>=s){this._debug("max retries reached",this._retryCount,">=",s);return}if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!Ei(u))throw Error("No valid WebSocket class provided");this._wait().then(function(){return t._getNextUrl(t._url)}).then(function(l){t._closeCalled||(t._debug("connect",{url:l,protocols:t._protocols}),t._ws=t._protocols?new u(l,t._protocols):new u(l),t._ws.binaryType=t._binaryType,t._connectLock=!1,t._addListeners(),t._connectTimeout=setTimeout(function(){return t._handleTimeout()},o))})}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new gi(Error("TIMEOUT"),this))},e.prototype._disconnect=function(t,r){if(t===void 0&&(t=1e3),this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,r),this._handleClose(new vi(t,r,this))}catch{}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(t,r){"handleEvent"in r?r.handleEvent(t):r(t)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e}();const Zr=12095;function Dr(e){const t=typeof window<"u"?window.location:void 0,r=`/assets/${encodeURIComponent(e)}`;return`${t?.protocol}//${t?.hostname}:${Zr}${r}`}async function wi(e){const t=await fetch(e);return URL.createObjectURL(new Blob([await t.arrayBuffer()]))}class Si{_items;#e=new EventTarget;constructor(t){this._items={...t}}handleDataStoreItemsMessage(t){this._items={...this._items,...t.items},Object.entries(t.items).forEach(([r,n])=>{this.dispatchEvent(new pt(r,n))}),this.dispatchEvent(new mt(t.items))}get items(){return this._items}getItem(t){return this._items[t]}setItems(t){return this._items={...this._items,...t},Object.entries(t).forEach(([r,n])=>{this.dispatchEvent(new pt(r,n))}),this.dispatchEvent(new mt(t)),this}addEventListener(t,r,n){this.#e.addEventListener(t,r,n)}removeEventListener(t,r,n){this.#e.removeEventListener(t,r,n)}dispatchEvent(t){this.#e.dispatchEvent(t)}}class pt extends Event{constructor(t,r){super("item"),this.key=t,this.value=r}_cogsConnectionEventType="item"}class mt extends Event{constructor(t){super("items"),this.items=t}_cogsConnectionEventType="item"}const xe=globalThis.Date;function Ii(e){const t=Math.round(e-xe.now());function r(...s){return s.length===0?new xe(r.now()):new xe(...s)}const n=Object.getOwnPropertyDescriptors(xe);Object.defineProperties(r,n),r.now=function(){return xe.now()+t},globalThis.Date=r}let $i=0;function yi(){return++$i}const Ri=5,Ai=1e4;function Ti({interval:e,send:t,onChange:r=Ii,syncSampleSize:n=Ri,syncRequestTimeout:s=Ai}){const i={};async function o(){const a=[];for(let p=0;p<n;p++){const $=new Promise(_=>{const m=yi(),E=Date.now(),y=performance.now();t({timesync:{id:m}});const C=(x,N)=>_({sentAt:y,receivedAt:x,serverNow:N,clientNow:E});i[m]={complete:C},setTimeout(()=>_(null),s)});a.push($),await $}const f=(await Promise.all(a)).filter(p=>p!==null),h=Oi(f);isNaN(h)||r(Date.now()+h)}const c=a=>{const f=performance.now(),h=i[a.timesync.id];h&&h.complete(f,a.timesync.now)};o();const u=setInterval(o,e);return{receive:c,destroy:()=>{clearInterval(u)}}}function Oi(e){return e.map(({sentAt:t,receivedAt:r,clientNow:n,serverNow:s})=>{const i=(r-t)/2;return s-n-i}).reduce((t,r)=>t+r,0)/e.length}class ki{constructor(t,{hostname:r=document.location.hostname,port:n=Zr}={},s,i){this.manifest=t,this.currentState={...s},this.store=new Si(i??{});const{useReconnectingWebsocket:o,path:c,pathParams:u}=Pi(document.location.href);this.urlParams=new URLSearchParams(u),this.urlParams.set("screenWidth",window.screen.width.toString()),this.urlParams.set("screenHeight",window.screen.height.toString()),this.urlParams.set("screenPixelRatio",window.devicePixelRatio.toString());const l=`ws://${r}:${n}${c}?${this.urlParams}`;this.websocket=o?new bi(l):new WebSocket(l);let a;this.websocket.onopen=()=>{this.currentConfig={},this.currentState={},this.dispatchEvent(new jr),this.setState(this.currentState),a=Ti({interval:6e4,send:f=>{this.websocket.send(JSON.stringify(f))}})},this.websocket.addEventListener("message",({data:f})=>{try{const h=JSON.parse(f);if(typeof h=="object"&&h!==null&&"timesync"in h){const p=h;a?.receive(p)}}catch(h){console.error(h)}}),this.websocket.onclose=()=>{a?.destroy(),this.dispatchEvent(new xr)},this.websocket.addEventListener("message",({data:f})=>{try{const h=JSON.parse(f);try{if(h.config)this.currentConfig=h.config,this.dispatchEvent(new Ur(this.currentConfig));else if(h.updates)this.currentState={...this.currentState,...h.updates},this.dispatchEvent(new Br(h.updates));else if(h.event&&h.event.key)this.dispatchEvent(new Fr(h.event.key,h.event.value));else if(typeof h.message=="object"){const p=h.message;switch(p.type){case"adjustable_timer_update":this._timerState={startedAt:Date.now(),durationMillis:p.durationMillis,ticking:p.ticking};break;case"show_phase":this._showPhase=p.phase,this.dispatchEvent(new Gr(p.phase));break;case"media_config_update":this._mediaConfig=p;for(const $ of["preferOptimizedAudio","preferOptimizedVideo","preferOptimizedImages"])p[$]?this.urlParams.set($,"true"):this.urlParams.delete($);this.dispatchEvent(new qr(p));break;case"data_store_items":this.store.handleDataStoreItemsMessage(p);break;case"audio_play":case"audio_pause":case"audio_stop":case"audio_set_clip_volume":case"video_play":case"video_pause":case"video_stop":case"video_set_volume":case"video_set_fit":case"image_show":case"image_hide":case"image_set_fit":{const{type:$}=p;"media_strategy"in p||console.warn(`Legacy ${$} message received, this is no longer supported. Please upgrade to COGS 5.10 or downgrade to cogs-client@2.11`)}}this.dispatchEvent(new Mr(p))}}catch(p){console.warn("Error handling data",f,p)}}catch(h){console.error("Unable to parse incoming data from server",f,h)}}),this.store.addEventListener("items",f=>{this.sendDataStoreItems(f.items)});{const f=async()=>{if(navigator.mediaDevices){const h=(await navigator.mediaDevices.enumerateDevices()).filter(({kind:p})=>p==="audiooutput");this.sendAudioOutputs(h),this.audioOutputs=h}};this.eventTarget.addEventListener("open",f),navigator.mediaDevices?.addEventListener("devicechange",f),f()}}websocket;eventTarget=new EventTarget;currentConfig={};get config(){return{...this.currentConfig}}currentState={};get state(){return{...this.currentState}}_showPhase=Pe.Setup;get showPhase(){return this._showPhase}_timerState=null;get timerState(){return this._timerState?{...this._timerState}:null}_mediaConfig=null;get mediaConfig(){return this._mediaConfig?{...this._mediaConfig}:null}getAssetUrl(t){return`${Dr(t)}?${this.urlParams?.toString()??""}`}audioOutputs=void 0;_selectedAudioOutput="";get selectedAudioOutput(){return this._selectedAudioOutput}store;urlParams;get isConnected(){return this.websocket.readyState===WebSocket.OPEN}close(){this.websocket.close()}sendEvent(t,...[r]){this.isConnected&&this.websocket.send(JSON.stringify({event:{key:t,value:r}}))}setState(t){this.currentState={...this.currentState,...t},this.isConnected&&this.websocket.send(JSON.stringify({updates:t}))}getAudioSinkId(t){return t?this.audioOutputs?.find(({label:r})=>r===t)?.deviceId:""}sendAudioOutputs(t){this.isConnected&&this.websocket.send(JSON.stringify({audioOutputs:t}))}sendDataStoreItems(t){this.isConnected&&this.websocket.send(JSON.stringify({dataStoreItems:t}))}setPluginWindowVisible(t){this.isConnected&&this.websocket.send(JSON.stringify({window:{visible:t}}))}addEventListener(t,r,n){this.eventTarget.addEventListener(t,r,n)}removeEventListener(t,r,n){this.eventTarget.removeEventListener(t,r,n)}dispatchEvent(t){this.eventTarget.dispatchEvent(t)}}function Pi(e){const t=new URL(e),r=new URLSearchParams(t.searchParams),n=r.get("local_id"),s=r.get("simulator")==="true",i=r.get("display")??"",o=t.pathname.startsWith("/plugin/")?decodeURIComponent(t.pathname.split("/")[2]):void 0;if(n){const c=r.get("t")??"";return r.delete("local_id"),{path:`/local/${encodeURIComponent(n)}`,pathParams:new URLSearchParams({t:c}),useReconnectingWebsocket:!0}}else if(s){const c=r.get("name")??"";return r.delete("simulator"),r.delete("name"),{path:`/simulator/${encodeURIComponent(c)}`,pathParams:r,useReconnectingWebsocket:!0}}else if(i){const c=r.get("displayIdIndex")??"";return r.delete("display"),r.delete("displayIdIndex"),{path:`/display/${encodeURIComponent(i)}/${encodeURIComponent(c)}`}}else{if(o)return{path:`/plugin/${encodeURIComponent(o)}`,useReconnectingWebsocket:!0};{const c=r.get("serial")??"";return r.delete("serial"),{path:`/client/${encodeURIComponent(c)}`,pathParams:r}}}}class jr extends Event{_cogsConnectionEventType="open";constructor(){super("open")}}class xr extends Event{_cogsConnectionEventType="close";constructor(){super("close")}}class Mr extends Event{constructor(t){super("message"),this.message=t}_cogsConnectionEventType="message"}class Ur extends Event{constructor(t){super("config"),this.config=t}_cogsConnectionEventType="config"}class Br extends Event{constructor(t){super("state"),this.state=t}_cogsConnectionEventType="state"}class Fr extends Event{constructor(t,r){super("event"),this.name=t,this.value=r}_cogsConnectionEventType="event"}class qr extends Event{constructor(t){super("mediaConfig"),this.mediaConfig=t}_cogsConnectionEventType="mediaConfig"}class Gr extends Event{constructor(t){super("showPhase"),this.showPhase=t}_cogsConnectionEventType="showPhase"}function g(e,t,r){function n(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const l=o.prototype,a=Object.keys(l);for(let f=0;f<a.length;f++){const h=a[f];h in c||(c[h]=l[h].bind(c))}}const s=r?.Parent??Object;class i extends s{}Object.defineProperty(i,"name",{value:e});function o(c){var u;const l=r?.Parent?new i:this;n(l,c),(u=l._zod).deferred??(u.deferred=[]);for(const a of l._zod.deferred)a();return l}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class Ce extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Vr extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Wr={};function be(e){return Wr}function Ci(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function gt(e,t){return typeof t=="bigint"?t.toString():t}function vt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function _t(e){return e==null}function Et(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ni(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let s=(n.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(n)){const u=n.match(/\d?e-(\d?)/);u?.[1]&&(s=Number.parseInt(u[1]))}const i=r>s?r:s,o=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return o%c/10**i}const Hr=Symbol("evaluating");function W(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Hr)return n===void 0&&(n=Hr,n=r()),n},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Re(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ae(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Xr(e){return JSON.stringify(e)}function Li(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Kr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ge(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const zi=vt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ne(e){if(Ge(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Ge(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Yr(e){return Ne(e)?{...e}:Array.isArray(e)?[...e]:e}const Zi=new Set(["string","number","symbol"]),Di=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Te(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function we(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function A(e){const 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 ji(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const xi={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]};function Mi(e,t){const r=e._zod.def,n=Ae(e._zod.def,{get shape(){const s={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(s[i]=r.shape[i])}return Re(this,"shape",s),s},checks:[]});return we(e,n)}function Ui(e,t){const r=e._zod.def,n=Ae(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete s[i]}return Re(this,"shape",s),s},checks:[]});return we(e,n)}function Bi(e,t){if(!Ne(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const s=Ae(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Re(this,"shape",i),i},checks:[]});return we(e,s)}function Fi(e,t){if(!Ne(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Re(this,"shape",n),n},checks:e._zod.def.checks};return we(e,r)}function qi(e,t){const r=Ae(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Re(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return we(e,r)}function Gi(e,t,r){const n=Ae(t._zod.def,{get shape(){const s=t._zod.def.shape,i={...s};if(r)for(const o in r){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=e?new e({type:"optional",innerType:s[o]}):s[o])}else for(const o in s)i[o]=e?new e({type:"optional",innerType:s[o]}):s[o];return Re(this,"shape",i),i},checks:[]});return we(t,n)}function Vi(e,t,r){const n=Ae(t._zod.def,{get shape(){const s=t._zod.def.shape,i={...s};if(r)for(const o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=new e({type:"nonoptional",innerType:s[o]}))}else for(const o in s)i[o]=new e({type:"nonoptional",innerType:s[o]});return Re(this,"shape",i),i},checks:[]});return we(t,n)}function Le(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 Oe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ve(e){return typeof e=="string"?e:e?.message}function Se(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const s=Ve(e.inst?._zod.def?.error?.(e))??Ve(t?.error?.(e))??Ve(r.customError?.(e))??Ve(r.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function bt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Me(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Jr=(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,gt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Qr=g("$ZodError",Jr),en=g("$ZodError",Jr,{Parent:Error});function Wi(e,t=r=>r.message){const r={},n=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}function Hi(e,t=r=>r.message){const r={_errors:[]},n=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>n({issues:o}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let o=r,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return n(e),r}const wt=e=>(t,r,n,s)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new Ce;if(o.issues.length){const c=new(s?.Err??e)(o.issues.map(u=>Se(u,i,be())));throw Kr(c,s?.callee),c}return o.value},St=e=>async(t,r,n,s)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const c=new(s?.Err??e)(o.issues.map(u=>Se(u,i,be())));throw Kr(c,s?.callee),c}return o.value},We=e=>(t,r,n)=>{const s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Ce;return i.issues.length?{success:!1,error:new(e??Qr)(i.issues.map(o=>Se(o,s,be())))}:{success:!0,data:i.value}},Xi=We(en),He=e=>async(t,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(o=>Se(o,s,be())))}:{success:!0,data:i.value}},Ki=He(en),Yi=e=>(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wt(e)(t,r,s)},Ji=e=>(t,r,n)=>wt(e)(t,r,n),Qi=e=>async(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return St(e)(t,r,s)},eo=e=>async(t,r,n)=>St(e)(t,r,n),to=e=>(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return We(e)(t,r,s)},ro=e=>(t,r,n)=>We(e)(t,r,n),no=e=>async(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return He(e)(t,r,s)},so=e=>async(t,r,n)=>He(e)(t,r,n),io=/^[cC][^\s-]{8,}$/,oo=/^[0-9a-z]+$/,ao=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uo=/^[0-9a-vA-V]{20}$/,co=/^[A-Za-z0-9]{27}$/,lo=/^[a-zA-Z0-9_-]{21}$/,fo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ho=/^([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})$/,tn=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)$/,po=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function go(){return new RegExp(mo,"u")}const vo=/^(?:(?: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])$/,_o=/^(([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}|:))$/,Eo=/^((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])$/,bo=/^(([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])$/,wo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rn=/^[A-Za-z0-9_-]*$/,So=/^\+(?:[0-9]){6,14}[0-9]$/,nn="(?:(?:\\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])))",Io=new RegExp(`^${nn}$`);function sn(e){const 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 $o(e){return new RegExp(`^${sn(e)}$`)}function yo(e){const t=sn({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${nn}T(?:${n})$`)}const Ro=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ao=/^-?\d+$/,To=/^-?\d+(?:\.\d+)?/,Oo=/^(?:true|false)$/i,ko=/^null$/i,Po=/^[^A-Z]*$/,Co=/^[^a-z]*$/,ie=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),on={number:"number",bigint:"bigint",object:"date"},an=g("$ZodCheckLessThan",(e,t)=>{ie.init(e,t);const r=on[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,i=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),un=g("$ZodCheckGreaterThan",(e,t)=>{ie.init(e,t);const r=on[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,i=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),No=g("$ZodCheckMultipleOf",(e,t)=>{ie.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.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):Ni(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})}}),Lo=g("$ZodCheckNumberFormat",(e,t)=>{ie.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[s,i]=xi[t.format];e._zod.onattach.push(o=>{const c=o._zod.bag;c.format=t.format,c.minimum=s,c.maximum=i,r&&(c.pattern=Ao)}),e._zod.check=o=>{const c=o.value;if(r){if(!Number.isInteger(c)){o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?o.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):o.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}c<s&&o.issues.push({origin:"number",input:c,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),c>i&&o.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inst:e})}}),zo=g("$ZodCheckMaxLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!_t(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const s=n.value;if(s.length<=t.maximum)return;const o=bt(s);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Zo=g("$ZodCheckMinLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!_t(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const s=n.value;if(s.length>=t.minimum)return;const o=bt(s);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Do=g("$ZodCheckLengthEquals",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!_t(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=n=>{const s=n.value,i=s.length;if(i===t.length)return;const o=bt(s),c=i>t.length;n.issues.push({origin:o,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Xe=g("$ZodCheckStringFormat",(e,t)=>{var r,n;ie.init(e,t),e._zod.onattach.push(s=>{const i=s._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=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),jo=g("$ZodCheckRegex",(e,t)=>{Xe.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})}}),xo=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Po),Xe.init(e,t)}),Mo=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Co),Xe.init(e,t)}),Uo=g("$ZodCheckIncludes",(e,t)=>{ie.init(e,t);const r=Te(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Bo=g("$ZodCheckStartsWith",(e,t)=>{ie.init(e,t);const r=new RegExp(`^${Te(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Fo=g("$ZodCheckEndsWith",(e,t)=>{ie.init(e,t);const r=new RegExp(`.*${Te(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),qo=g("$ZodCheckOverwrite",(e,t)=>{ie.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Go{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}const n=t.split(`
20
20
  `).filter(o=>o),s=Math.min(...n.map(o=>o.length-o.trimStart().length)),i=n.map(o=>o.slice(s)).map(o=>" ".repeat(this.indent*2)+o);for(const o of i)this.content.push(o)}compile(){const t=Function,r=this?.args,s=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,s.join(`
21
21
  `))}}const Vo={major:4,minor:1,patch:13},V=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Vo;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const s of n)for(const i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(o,c,u)=>{let l=Le(o),a;for(const f of c){if(f._zod.def.when){if(!f._zod.def.when(o))continue}else if(l)continue;const h=o.issues.length,p=f._zod.check(o);if(p instanceof Promise&&u?.async===!1)throw new Ce;if(a||p instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await p,o.issues.length!==h&&(l||(l=Le(o,h)))});else{if(o.issues.length===h)continue;l||(l=Le(o,h))}}return a?a.then(()=>o):o},i=(o,c,u)=>{if(Le(o))return o.aborted=!0,o;const l=s(c,n,u);if(l instanceof Promise){if(u.async===!1)throw new Ce;return l.then(a=>e._zod.parse(a,u))}return e._zod.parse(l,u)};e._zod.run=(o,c)=>{if(c.skipChecks)return e._zod.parse(o,c);if(c.direction==="backward"){const l=e._zod.parse({value:o.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(a=>i(a,o,c)):i(l,o,c)}const u=e._zod.parse(o,c);if(u instanceof Promise){if(c.async===!1)throw new Ce;return u.then(l=>s(l,n,c))}return s(u,n,c)}}e["~standard"]={validate:s=>{try{const i=Xi(e,s);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Ki(e,s).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}}),It=g("$ZodString",(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ro(e._zod.bag),e._zod.parse=(r,n)=>{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}}),K=g("$ZodStringFormat",(e,t)=>{Xe.init(e,t),It.init(e,t)}),Wo=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ho),K.init(e,t)}),Ho=g("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tn(n))}else t.pattern??(t.pattern=tn());K.init(e,t)}),Xo=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=po),K.init(e,t)}),Ko=g("$ZodURL",(e,t)=>{K.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),s=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.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(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.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=s.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Yo=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=go()),K.init(e,t)}),Jo=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=lo),K.init(e,t)}),Qo=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=io),K.init(e,t)}),ea=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=oo),K.init(e,t)}),ta=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ao),K.init(e,t)}),ra=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=uo),K.init(e,t)}),na=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=co),K.init(e,t)}),sa=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=yo(t)),K.init(e,t)}),ia=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Io),K.init(e,t)}),oa=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=$o(t)),K.init(e,t)}),aa=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=fo),K.init(e,t)}),ua=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=vo),K.init(e,t),e._zod.bag.format="ipv4"}),ca=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=_o),K.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})}}}),la=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Eo),K.init(e,t)}),fa=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=bo),K.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[s,i]=n;if(!i)throw new Error;const o=Number(i);if(`${o}`!==i)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function cn(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const ha=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=wo),K.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{cn(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function da(e){if(!rn.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return cn(r)}const pa=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=rn),K.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{da(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ma=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=So),K.init(e,t)});function ga(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const s=JSON.parse(atob(n));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const va=g("$ZodJWT",(e,t)=>{K.init(e,t),e._zod.check=r=>{ga(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ln=g("$ZodNumber",(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??To,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;const i=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...i?{received:i}:{}}),r}}),_a=g("$ZodNumberFormat",(e,t)=>{Lo.init(e,t),ln.init(e,t)}),Ea=g("$ZodBoolean",(e,t)=>{V.init(e,t),e._zod.pattern=Oo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),ba=g("$ZodNull",(e,t)=>{V.init(e,t),e._zod.pattern=ko,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{const s=r.value;return s===null||r.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),r}}),wa=g("$ZodUnknown",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),Sa=g("$ZodNever",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function fn(e,t,r){e.issues.length&&t.issues.push(...Oe(r,e.issues)),t.value[r]=e.value}const Ia=g("$ZodArray",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);const i=[];for(let o=0;o<s.length;o++){const c=s[o],u=t.element._zod.run({value:c,issues:[]},n);u instanceof Promise?i.push(u.then(l=>fn(l,r,o))):fn(u,r,o)}return i.length?Promise.all(i).then(()=>r):r}});function Ke(e,t,r,n){e.issues.length&&t.issues.push(...Oe(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function hn(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=ji(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function dn(e,t,r,n,s,i){const o=[],c=s.keySet,u=s.catchall._zod,l=u.def.type;for(const a in t){if(c.has(a))continue;if(l==="never"){o.push(a);continue}const f=u.run({value:t[a],issues:[]},n);f instanceof Promise?e.push(f.then(h=>Ke(h,r,a,t))):Ke(f,r,a,t)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const $a=g("$ZodObject",(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}const n=vt(()=>hn(t));W(e._zod,"propValues",()=>{const c=t.shape,u={};for(const l in c){const a=c[l]._zod;if(a.values){u[l]??(u[l]=new Set);for(const f of a.values)u[l].add(f)}}return u});const s=Ge,i=t.catchall;let o;e._zod.parse=(c,u)=>{o??(o=n.value);const l=c.value;if(!s(l))return c.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),c;c.value={};const a=[],f=o.shape;for(const h of o.keys){const $=f[h]._zod.run({value:l[h],issues:[]},u);$ instanceof Promise?a.push($.then(_=>Ke(_,c,h,l))):Ke($,c,h,l)}return i?dn(a,l,c,u,n.value,e):a.length?Promise.all(a).then(()=>c):c}}),ya=g("$ZodObjectJIT",(e,t)=>{$a.init(e,t);const r=e._zod.parse,n=vt(()=>hn(t)),s=h=>{const p=new Go(["shape","payload","ctx"]),$=n.value,_=C=>{const x=Xr(C);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};p.write("const input = payload.value;");const m=Object.create(null);let E=0;for(const C of $.keys)m[C]=`key_${E++}`;p.write("const newResult = {};");for(const C of $.keys){const x=m[C],N=Xr(C);p.write(`const ${x} = ${_(C)};`),p.write(`
22
22
  if (${x}.issues.length) {
@@ -35,4 +35,4 @@
35
35
  newResult[${N}] = ${x}.value;
36
36
  }
37
37
 
38
- `)}p.write("payload.value = newResult;"),p.write("return payload;");const y=p.compile();return(C,x)=>y(h,C,x)};let i;const o=Ge,c=!Wr.jitless,l=c&&zi.value,a=t.catchall;let f;e._zod.parse=(h,p)=>{f??(f=n.value);const $=h.value;return o($)?c&&l&&p?.async===!1&&p.jitless!==!0?(i||(i=s(t.shape)),h=i(h,p),a?dn([],$,h,p,f,e):h):r(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:$,inst:e}),h)}});function pn(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const s=e.filter(i=>!Le(i));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(o=>we(o,n,Ee())))}),t)}const Ra=g("$ZodUnion",(e,t)=>{V.init(e,t),W(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),W(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),W(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),W(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${s.map(i=>Et(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(s,i)=>{if(r)return n(s,i);let o=!1;const c=[];for(const u of t.options){const l=u._zod.run({value:s.value,issues:[]},i);if(l instanceof Promise)c.push(l),o=!0;else{if(l.issues.length===0)return l;c.push(l)}}return o?Promise.all(c).then(u=>pn(u,s,e,i)):pn(c,s,e,i)}}),Aa=g("$ZodIntersection",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{const s=r.value,i=t.left._zod.run({value:s,issues:[]},n),o=t.right._zod.run({value:s,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([u,l])=>mn(r,u,l)):mn(r,i,o)}});function $t(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(Ne(e)&&Ne(t)){const r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),s={...e,...t};for(const i of n){const o=$t(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};s[i]=o.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const s=e[n],i=t[n],o=$t(s,i);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function mn(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Le(e))return e;const n=$t(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const Ta=g("$ZodTuple",(e,t)=>{V.init(e,t);const r=t.items;e._zod.parse=(n,s)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];const o=[],c=[...r].reverse().findIndex(a=>a._zod.optin!=="optional"),u=c===-1?0:r.length-c;if(!t.rest){const a=i.length>r.length,f=i.length<u-1;if(a||f)return n.issues.push({...a?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),n}let l=-1;for(const a of r){if(l++,l>=i.length&&l>=u)continue;const f=a._zod.run({value:i[l],issues:[]},s);f instanceof Promise?o.push(f.then(h=>Ye(h,n,l))):Ye(f,n,l)}if(t.rest){const a=i.slice(r.length);for(const f of a){l++;const h=t.rest._zod.run({value:f,issues:[]},s);h instanceof Promise?o.push(h.then(p=>Ye(p,n,l))):Ye(h,n,l)}}return o.length?Promise.all(o).then(()=>n):n}});function Ye(e,t,r){e.issues.length&&t.issues.push(...Oe(r,e.issues)),t.value[r]=e.value}const Oa=g("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!Ne(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const i=[],o=t.keyType._zod.values;if(o){r.value={};const c=new Set;for(const l of o)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){c.add(typeof l=="number"?l.toString():l);const a=t.valueType._zod.run({value:s[l],issues:[]},n);a instanceof Promise?i.push(a.then(f=>{f.issues.length&&r.issues.push(...Oe(l,f.issues)),r.value[l]=f.value})):(a.issues.length&&r.issues.push(...Oe(l,a.issues)),r.value[l]=a.value)}let u;for(const l in s)c.has(l)||(u=u??[],u.push(l));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u})}else{r.value={};for(const c of Reflect.ownKeys(s)){if(c==="__proto__")continue;const u=t.keyType._zod.run({value:c,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(a=>we(a,n,Ee())),input:c,path:[c],inst:e}),r.value[u.value]=u.value;continue}const l=t.valueType._zod.run({value:s[c],issues:[]},n);l instanceof Promise?i.push(l.then(a=>{a.issues.length&&r.issues.push(...Oe(c,a.issues)),r.value[u.value]=a.value})):(l.issues.length&&r.issues.push(...Oe(c,l.issues)),r.value[u.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),ka=g("$ZodEnum",(e,t)=>{V.init(e,t);const r=Ci(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(s=>Zi.has(typeof s)).map(s=>typeof s=="string"?Te(s):s.toString()).join("|")})$`),e._zod.parse=(s,i)=>{const o=s.value;return n.has(o)||s.issues.push({code:"invalid_value",values:r,input:o,inst:e}),s}}),Pa=g("$ZodLiteral",(e,t)=>{if(V.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?Te(n):n?Te(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,s)=>{const i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),Ca=g("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Vr(e.constructor.name);const s=t.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(o=>(r.value=o,r));if(s instanceof Promise)throw new Ce;return r.value=s,r}});function gn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Na=g("$ZodOptional",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.optout="optional",W(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),W(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Et(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>gn(i,r.value)):gn(s,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),La=g("$ZodNullable",(e,t)=>{V.init(e,t),W(e._zod,"optin",()=>t.innerType._zod.optin),W(e._zod,"optout",()=>t.innerType._zod.optout),W(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Et(r.source)}|null)$`):void 0}),W(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),za=g("$ZodDefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",W(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>vn(i,t)):vn(s,t)}});function vn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Za=g("$ZodPrefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",W(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Da=g("$ZodNonOptional",(e,t)=>{V.init(e,t),W(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>_n(i,e)):_n(s,e)}});function _n(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const ja=g("$ZodCatch",(e,t)=>{V.init(e,t),W(e._zod,"optin",()=>t.innerType._zod.optin),W(e._zod,"optout",()=>t.innerType._zod.optout),W(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(o=>we(o,n,Ee()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>we(i,n,Ee()))},input:r.value}),r.issues=[]),r)}}),xa=g("$ZodPipe",(e,t)=>{V.init(e,t),W(e._zod,"values",()=>t.in._zod.values),W(e._zod,"optin",()=>t.in._zod.optin),W(e._zod,"optout",()=>t.out._zod.optout),W(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);return i instanceof Promise?i.then(o=>Je(o,t.in,n)):Je(i,t.in,n)}const s=t.in._zod.run(r,n);return s instanceof Promise?s.then(i=>Je(i,t.out,n)):Je(s,t.out,n)}});function Je(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Ma=g("$ZodReadonly",(e,t)=>{V.init(e,t),W(e._zod,"propValues",()=>t.innerType._zod.propValues),W(e._zod,"values",()=>t.innerType._zod.values),W(e._zod,"optin",()=>t.innerType?._zod?.optin),W(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(En):En(s)}});function En(e){return e.value=Object.freeze(e.value),e}const Ua=g("$ZodTemplateLiteral",(e,t)=>{V.init(e,t);const r=[];for(const n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);const s=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!s)throw new Error(`Invalid template literal part: ${n._zod.traits}`);const i=s.startsWith("^")?1:0,o=s.endsWith("$")?s.length-1:s.length;r.push(s.slice(i,o))}else if(n===null||Di.has(typeof n))r.push(Te(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,s)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"template_literal",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Ba=g("$ZodCustom",(e,t)=>{ie.init(e,t),V.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,s=t.fn(n);if(s instanceof Promise)return s.then(i=>bn(i,r,n,e));bn(s,r,n,e)}});function bn(e,t,r,n){if(!e){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),t.issues.push(Me(s))}}var wn;class Fa{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const 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){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const s={...n,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function qa(){return new Fa}(wn=globalThis).__zod_globalRegistry??(wn.__zod_globalRegistry=qa());const Qe=globalThis.__zod_globalRegistry;function Ga(e,t){return new e({type:"string",...A(t)})}function Va(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...A(t)})}function Sn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...A(t)})}function Wa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...A(t)})}function Ha(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(t)})}function Xa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(t)})}function Ka(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(t)})}function Ya(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...A(t)})}function Ja(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...A(t)})}function Qa(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(t)})}function eu(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...A(t)})}function tu(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(t)})}function ru(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...A(t)})}function nu(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...A(t)})}function su(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(t)})}function iu(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(t)})}function ou(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(t)})}function au(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(t)})}function uu(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(t)})}function cu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...A(t)})}function lu(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...A(t)})}function fu(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...A(t)})}function hu(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...A(t)})}function du(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(t)})}function pu(e,t){return new e({type:"string",format:"date",check:"string_format",...A(t)})}function mu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...A(t)})}function gu(e,t){return new e({type:"string",format:"duration",check:"string_format",...A(t)})}function vu(e,t){return new e({type:"number",checks:[],...A(t)})}function _u(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...A(t)})}function Eu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...A(t)})}function bu(e,t){return new e({type:"boolean",...A(t)})}function wu(e,t){return new e({type:"null",...A(t)})}function Su(e){return new e({type:"unknown"})}function Iu(e,t){return new e({type:"never",...A(t)})}function In(e,t){return new an({check:"less_than",...A(t),value:e,inclusive:!1})}function yt(e,t){return new an({check:"less_than",...A(t),value:e,inclusive:!0})}function $n(e,t){return new un({check:"greater_than",...A(t),value:e,inclusive:!1})}function Rt(e,t){return new un({check:"greater_than",...A(t),value:e,inclusive:!0})}function yn(e,t){return new No({check:"multiple_of",...A(t),value:e})}function Rn(e,t){return new zo({check:"max_length",...A(t),maximum:e})}function et(e,t){return new Zo({check:"min_length",...A(t),minimum:e})}function An(e,t){return new Do({check:"length_equals",...A(t),length:e})}function $u(e,t){return new jo({check:"string_format",format:"regex",...A(t),pattern:e})}function yu(e){return new xo({check:"string_format",format:"lowercase",...A(e)})}function Ru(e){return new Mo({check:"string_format",format:"uppercase",...A(e)})}function Au(e,t){return new Uo({check:"string_format",format:"includes",...A(t),includes:e})}function Tu(e,t){return new Bo({check:"string_format",format:"starts_with",...A(t),prefix:e})}function Ou(e,t){return new Fo({check:"string_format",format:"ends_with",...A(t),suffix:e})}function ze(e){return new qo({check:"overwrite",tx:e})}function ku(e){return ze(t=>t.normalize(e))}function Pu(){return ze(e=>e.trim())}function Cu(){return ze(e=>e.toLowerCase())}function Nu(){return ze(e=>e.toUpperCase())}function Lu(){return ze(e=>Li(e))}function zu(e,t,r){return new e({type:"array",element:t,...A(r)})}function Zu(e,t,r){return new e({type:"custom",check:"custom",fn:t,...A(r)})}function Du(e){const t=ju(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Me(n,r.value,t._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),r.issues.push(Me(s))}},e(r.value,r)));return t}function ju(e,t){const r=new ie({check:"custom",...A(t)});return r._zod.check=e,r}const xu=g("ZodISODateTime",(e,t)=>{sa.init(e,t),Y.init(e,t)});function Mu(e){return du(xu,e)}const Uu=g("ZodISODate",(e,t)=>{ia.init(e,t),Y.init(e,t)});function Bu(e){return pu(Uu,e)}const Fu=g("ZodISOTime",(e,t)=>{oa.init(e,t),Y.init(e,t)});function qu(e){return mu(Fu,e)}const Gu=g("ZodISODuration",(e,t)=>{aa.init(e,t),Y.init(e,t)});function Vu(e){return gu(Gu,e)}const ae=g("ZodError",(e,t)=>{Qr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Hi(e,r)},flatten:{value:r=>Wi(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,gt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,gt,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Wu=wt(ae),Hu=St(ae),Xu=We(ae),Ku=He(ae),Yu=Yi(ae),Ju=Ji(ae),Qu=Qi(ae),ec=eo(ae),tc=to(ae),rc=ro(ae),nc=no(ae),sc=so(ae),X=g("ZodType",(e,t)=>(V.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Ae(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>be(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>Wu(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Xu(e,r,n),e.parseAsync=async(r,n)=>Hu(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Ku(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Yu(e,r,n),e.decode=(r,n)=>Ju(e,r,n),e.encodeAsync=async(r,n)=>Qu(e,r,n),e.decodeAsync=async(r,n)=>ec(e,r,n),e.safeEncode=(r,n)=>tc(e,r,n),e.safeDecode=(r,n)=>rc(e,r,n),e.safeEncodeAsync=async(r,n)=>nc(e,r,n),e.safeDecodeAsync=async(r,n)=>sc(e,r,n),e.refine=(r,n)=>e.check(Yc(r,n)),e.superRefine=r=>e.check(Jc(r)),e.overwrite=r=>e.check(ze(r)),e.optional=()=>jn(e),e.nullable=()=>xn(e),e.nullish=()=>jn(xn(e)),e.nonoptional=r=>Fc(e,r),e.array=()=>Se(e),e.or=r=>de([e,r]),e.and=r=>Pc(e,r),e.transform=r=>Un(e,Dc(r)),e.default=r=>Mc(e,r),e.prefault=r=>Bc(e,r),e.catch=r=>Gc(e,r),e.pipe=r=>Un(e,r),e.readonly=()=>Hc(e),e.describe=r=>{const n=e.clone();return Qe.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Qe.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Qe.get(e);const n=e.clone();return Qe.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Tn=g("_ZodString",(e,t)=>{It.init(e,t),X.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check($u(...n)),e.includes=(...n)=>e.check(Au(...n)),e.startsWith=(...n)=>e.check(Tu(...n)),e.endsWith=(...n)=>e.check(Ou(...n)),e.min=(...n)=>e.check(et(...n)),e.max=(...n)=>e.check(Rn(...n)),e.length=(...n)=>e.check(An(...n)),e.nonempty=(...n)=>e.check(et(1,...n)),e.lowercase=n=>e.check(yu(n)),e.uppercase=n=>e.check(Ru(n)),e.trim=()=>e.check(Pu()),e.normalize=(...n)=>e.check(ku(...n)),e.toLowerCase=()=>e.check(Cu()),e.toUpperCase=()=>e.check(Nu()),e.slugify=()=>e.check(Lu())}),ic=g("ZodString",(e,t)=>{It.init(e,t),Tn.init(e,t),e.email=r=>e.check(Va(oc,r)),e.url=r=>e.check(Ya(ac,r)),e.jwt=r=>e.check(hu(Sc,r)),e.emoji=r=>e.check(Ja(uc,r)),e.guid=r=>e.check(Sn(On,r)),e.uuid=r=>e.check(Wa(tt,r)),e.uuidv4=r=>e.check(Ha(tt,r)),e.uuidv6=r=>e.check(Xa(tt,r)),e.uuidv7=r=>e.check(Ka(tt,r)),e.nanoid=r=>e.check(Qa(cc,r)),e.guid=r=>e.check(Sn(On,r)),e.cuid=r=>e.check(eu(lc,r)),e.cuid2=r=>e.check(tu(fc,r)),e.ulid=r=>e.check(ru(hc,r)),e.base64=r=>e.check(cu(Ec,r)),e.base64url=r=>e.check(lu(bc,r)),e.xid=r=>e.check(nu(dc,r)),e.ksuid=r=>e.check(su(pc,r)),e.ipv4=r=>e.check(iu(mc,r)),e.ipv6=r=>e.check(ou(gc,r)),e.cidrv4=r=>e.check(au(vc,r)),e.cidrv6=r=>e.check(uu(_c,r)),e.e164=r=>e.check(fu(wc,r)),e.datetime=r=>e.check(Mu(r)),e.date=r=>e.check(Bu(r)),e.time=r=>e.check(qu(r)),e.duration=r=>e.check(Vu(r))});function te(e){return Ga(ic,e)}const Y=g("ZodStringFormat",(e,t)=>{K.init(e,t),Tn.init(e,t)}),oc=g("ZodEmail",(e,t)=>{Xo.init(e,t),Y.init(e,t)}),On=g("ZodGUID",(e,t)=>{Wo.init(e,t),Y.init(e,t)}),tt=g("ZodUUID",(e,t)=>{Ho.init(e,t),Y.init(e,t)}),ac=g("ZodURL",(e,t)=>{Ko.init(e,t),Y.init(e,t)}),uc=g("ZodEmoji",(e,t)=>{Yo.init(e,t),Y.init(e,t)}),cc=g("ZodNanoID",(e,t)=>{Jo.init(e,t),Y.init(e,t)}),lc=g("ZodCUID",(e,t)=>{Qo.init(e,t),Y.init(e,t)}),fc=g("ZodCUID2",(e,t)=>{ea.init(e,t),Y.init(e,t)}),hc=g("ZodULID",(e,t)=>{ta.init(e,t),Y.init(e,t)}),dc=g("ZodXID",(e,t)=>{ra.init(e,t),Y.init(e,t)}),pc=g("ZodKSUID",(e,t)=>{na.init(e,t),Y.init(e,t)}),mc=g("ZodIPv4",(e,t)=>{ua.init(e,t),Y.init(e,t)}),gc=g("ZodIPv6",(e,t)=>{ca.init(e,t),Y.init(e,t)}),vc=g("ZodCIDRv4",(e,t)=>{la.init(e,t),Y.init(e,t)}),_c=g("ZodCIDRv6",(e,t)=>{fa.init(e,t),Y.init(e,t)}),Ec=g("ZodBase64",(e,t)=>{ha.init(e,t),Y.init(e,t)}),bc=g("ZodBase64URL",(e,t)=>{pa.init(e,t),Y.init(e,t)}),wc=g("ZodE164",(e,t)=>{ma.init(e,t),Y.init(e,t)}),Sc=g("ZodJWT",(e,t)=>{va.init(e,t),Y.init(e,t)}),kn=g("ZodNumber",(e,t)=>{ln.init(e,t),X.init(e,t),e.gt=(n,s)=>e.check($n(n,s)),e.gte=(n,s)=>e.check(Rt(n,s)),e.min=(n,s)=>e.check(Rt(n,s)),e.lt=(n,s)=>e.check(In(n,s)),e.lte=(n,s)=>e.check(yt(n,s)),e.max=(n,s)=>e.check(yt(n,s)),e.int=n=>e.check(Cn(n)),e.safe=n=>e.check(Cn(n)),e.positive=n=>e.check($n(0,n)),e.nonnegative=n=>e.check(Rt(0,n)),e.negative=n=>e.check(In(0,n)),e.nonpositive=n=>e.check(yt(0,n)),e.multipleOf=(n,s)=>e.check(yn(n,s)),e.step=(n,s)=>e.check(yn(n,s)),e.finite=()=>e;const 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 re(e){return vu(kn,e)}const Pn=g("ZodNumberFormat",(e,t)=>{_a.init(e,t),kn.init(e,t)});function Cn(e){return _u(Pn,e)}function ge(e){return Eu(Pn,e)}const Ic=g("ZodBoolean",(e,t)=>{Ea.init(e,t),X.init(e,t)});function Ze(e){return bu(Ic,e)}const $c=g("ZodNull",(e,t)=>{ba.init(e,t),X.init(e,t)});function yc(e){return wu($c,e)}const Rc=g("ZodUnknown",(e,t)=>{wa.init(e,t),X.init(e,t)});function Nn(){return Su(Rc)}const Ac=g("ZodNever",(e,t)=>{Sa.init(e,t),X.init(e,t)});function Ln(e){return Iu(Ac,e)}const Tc=g("ZodArray",(e,t)=>{Ia.init(e,t),X.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(et(r,n)),e.nonempty=r=>e.check(et(1,r)),e.max=(r,n)=>e.check(Rn(r,n)),e.length=(r,n)=>e.check(An(r,n)),e.unwrap=()=>e.element});function Se(e,t){return zu(Tc,e,t)}const zn=g("ZodObject",(e,t)=>{ya.init(e,t),X.init(e,t),W(e,"shape",()=>t.shape),e.keyof=()=>Lc(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Nn()}),e.loose=()=>e.clone({...e._zod.def,catchall:Nn()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ln()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Bi(e,r),e.safeExtend=r=>Fi(e,r),e.merge=r=>qi(e,r),e.pick=r=>Mi(e,r),e.omit=r=>Ui(e,r),e.partial=(...r)=>Gi(Dn,e,r[0]),e.required=(...r)=>Vi(Mn,e,r[0])});function q(e,t){const r={type:"object",shape:e??{},...A(t)};return new zn(r)}function At(e,t){return new zn({type:"object",shape:e,catchall:Ln(),...A(t)})}const Oc=g("ZodUnion",(e,t)=>{Ra.init(e,t),X.init(e,t),e.options=t.options});function de(e,t){return new Oc({type:"union",options:e,...A(t)})}const kc=g("ZodIntersection",(e,t)=>{Aa.init(e,t),X.init(e,t)});function Pc(e,t){return new kc({type:"intersection",left:e,right:t})}const Cc=g("ZodTuple",(e,t)=>{Ta.init(e,t),X.init(e,t),e.rest=r=>e.clone({...e._zod.def,rest:r})});function pe(e,t,r){const n=t instanceof V,s=n?r:t,i=n?t:null;return new Cc({type:"tuple",items:e,rest:i,...A(s)})}const Nc=g("ZodRecord",(e,t)=>{Oa.init(e,t),X.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Zn(e,t,r){return new Nc({type:"record",keyType:e,valueType:t,...A(r)})}const Tt=g("ZodEnum",(e,t)=>{ka.init(e,t),X.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{const i={};for(const o of n)if(r.has(o))i[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Tt({...t,checks:[],...A(s),entries:i})},e.exclude=(n,s)=>{const i={...t.entries};for(const o of n)if(r.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new Tt({...t,checks:[],...A(s),entries:i})}});function Lc(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Tt({type:"enum",entries:r,...A(t)})}const zc=g("ZodLiteral",(e,t)=>{Pa.init(e,t),X.init(e,t),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 G(e,t){return new zc({type:"literal",values:Array.isArray(e)?e:[e],...A(t)})}const Zc=g("ZodTransform",(e,t)=>{Ca.init(e,t),X.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Vr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Me(i,r.value,t));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),r.issues.push(Me(o))}};const s=t.transform(r.value,r);return s instanceof Promise?s.then(i=>(r.value=i,r)):(r.value=s,r)}});function Dc(e){return new Zc({type:"transform",transform:e})}const Dn=g("ZodOptional",(e,t)=>{Na.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function jn(e){return new Dn({type:"optional",innerType:e})}const jc=g("ZodNullable",(e,t)=>{La.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function xn(e){return new jc({type:"nullable",innerType:e})}const xc=g("ZodDefault",(e,t)=>{za.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Mc(e,t){return new xc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Yr(t)}})}const Uc=g("ZodPrefault",(e,t)=>{Za.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Bc(e,t){return new Uc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Yr(t)}})}const Mn=g("ZodNonOptional",(e,t)=>{Da.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Fc(e,t){return new Mn({type:"nonoptional",innerType:e,...A(t)})}const qc=g("ZodCatch",(e,t)=>{ja.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Gc(e,t){return new qc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Vc=g("ZodPipe",(e,t)=>{xa.init(e,t),X.init(e,t),e.in=t.in,e.out=t.out});function Un(e,t){return new Vc({type:"pipe",in:e,out:t})}const Wc=g("ZodReadonly",(e,t)=>{Ma.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Hc(e){return new Wc({type:"readonly",innerType:e})}const Xc=g("ZodTemplateLiteral",(e,t)=>{Ua.init(e,t),X.init(e,t)});function rt(e,t){return new Xc({type:"template_literal",parts:e,...A(t)})}const Kc=g("ZodCustom",(e,t)=>{Ba.init(e,t),X.init(e,t)});function Yc(e,t={}){return Zu(Kc,e,t)}function Jc(e){return Du(e)}const nt=q({t:re().gte(0),rate:re().gte(0)}),De=q({opacity:re().gte(0).lte(1),zIndex:re().default(0)}),je=q({volume:re().gte(0).lte(1)}),Qc=q({type:G("image"),file:te(),fit:de([G("contain"),G("cover"),G("none")])}),el=q({type:G("audio"),file:te(),audioOutput:te(),enablePlaybackRateAdjustment:Ze()}),tl=q({type:G("video"),file:te(),audioOutput:te(),enablePlaybackRateAdjustment:Ze(),fit:de([G("contain"),G("cover"),G("none")])}),Ot=pe([re(),yc()]),rl=pe([re(),q({set:q({...De.shape}).partial()}).partial()]),nl=pe([re(),q({set:q({...De.shape}).partial(),lerp:q({...De.shape}).partial()}).partial()]),sl=pe([re(),q({set:q({...nt.shape,...je.shape}).partial()}).partial()]),il=pe([re(),q({set:q({...nt.shape,...je.shape}).partial(),lerp:q({...je.shape}).partial()}).partial()]),ol=pe([re(),q({set:q({...nt.shape,...je.shape,...De.shape}).partial()}).partial()]),al=pe([re(),q({set:q({...nt.shape,...je.shape,...De.shape}).partial(),lerp:q({...je.shape,...De.shape}).partial()}).partial()]),ul=q({...Qc.shape,keyframes:pe([nl],de([rl,Ot]))}),cl=q({...el.shape,keyframes:pe([il],de([sl,Ot]))}),ll=q({...tl.shape,keyframes:pe([al],de([ol,Ot]))}),fl=Zn(te(),de([ul,cl,ll])),Bn={opacity:1,zIndex:0},kt={t:0,rate:1,volume:1},Fn={t:0,rate:1,volume:1,opacity:1,zIndex:0},hl=Object.freeze(Object.defineProperty({__proto__:null,MediaSurfaceStateSchema:fl,defaultAudioOptions:kt,defaultImageOptions:Bn,defaultVideoOptions:Fn},Symbol.toStringTag,{value:"Module"}));function st(e,t){if(!e.keyframes.filter(n=>n[1]===null).some(n=>n[0]<=t))switch(e.type){case"image":{if(e.keyframes[0][0]>t)return;const s=e.keyframes.filter(o=>o[1]!==null),i=Pt(s,t);return{...Bn,...i}}case"audio":{const n=e.keyframes.filter(o=>o[1]!==null),s=qn(n,t);if(!s)return;const i=Pt(n,t);return{...kt,...i,...s}}case"video":{const n=e.keyframes.filter(o=>o[1]!==null),s=qn(n,t);if(!s)return;const i=Pt(n,t);return{...Fn,...i,...s}}}}function Pt(e,t){const r={};for(const[s,i]of e)s<=t?(Object.entries(i.lerp??{}).forEach(([o,c])=>{r[o]??={},r[o].before=[s,c]}),Object.entries(i.set??{}).forEach(([o,c])=>{r[o]??={},r[o].before=[s,c]})):Object.entries(i.lerp??{}).forEach(([o,c])=>{r[o]??={},r[o].after===void 0&&(r[o].after=[s,c])});const n={};return Object.entries(r).forEach(([s,{before:i,after:o}])=>{if(o===void 0&&i){n[s]=i[1];return}if(i&&o&&i[0]===o[0]){n[s]=o[1];return}if(i&&typeof i[1]=="number"&&o&&typeof o[1]=="number"){n[s]=i[1]+(t-i[0])*(o[1]-i[1])/(o[0]-i[0]);return}}),n}function qn(e,t){const r=e[0];if(!r||r[0]>t)return;let n=0,{t:s,rate:i}=kt;for(const[l,a]of e){if(l>t)break;const{set:f}=a;if(!f)continue;const{t:h,rate:p}=f;if(h!==void 0){n=l,s=h,p!==void 0&&(i=p);continue}if(p!==void 0){const _=(l-n)*i;n=l,s+=_,i=p}}const c=(t-n)*i,u=s+c;return{rate:i,t:u}}const dl=typeof navigator<"u"&&typeof navigator.standalone<"u",pl="GestureEvent"in window;function it(e,t){return(e%t+t)%t}function ml(e,t,r){return e=it(e,r),t=it(t,r),Math.abs(e-t)<r/2?e-t:e<t?e+r-t:e-(t+r)}const Ct=e=>{try{const{pathname:t}=new URL(e,window.location.href);return t}catch{return}};class Nt{constructor(t,r,n,s,i,o){this.surfaceElement=t,this.clipElement=r,this.constructAssetURL=s,this.getAudioOutput=i,this.mediaPreloader=o,this._state=n}isConnected(t){return!(!this.surfaceElement||!this.clipElement||!this.surfaceElement.contains(this.clipElement)||t&&!this.clipElement.contains(t))}_state;setState(t){this._state=t}timeout;loop=async()=>{clearTimeout(this.timeout),this.isConnected()?(this.update(),this.timeout=setTimeout(this.loop,Kn)):this.destroy()}}function Lt(e,t,r,n,s){let i;const o=n(r.file),c=Ct(o);switch(r.type){case"image":i=e instanceof HTMLImageElement?e:document.createElement("img"),Ct(i.src)!==c&&(i.src=o);break;case"audio":case"video":{if(e!==void 0){const u=Ct(e.src);e.tagName.toLowerCase()===r.type&&u!==void 0&&u===c&&(i=e)}i||(i=s.getElement(r.file,r.type)),i instanceof HTMLVideoElement&&!i.playsInline&&(i.playsInline=!0);break}}return(t.children.length!==1||t.childNodes[0]!==i)&&t.replaceChildren(i),i.style.position="absolute",i.style.width="100%",i.style.height="100%",i}function Gn(e,t,r){const n=String(t.opacity);e.style.opacity!==n&&(e.style.opacity=n);const s=Math.round(t.zIndex??0);parseInt(e.style.zIndex)!==s&&(e.style.zIndex=String(s)),e.style.objectFit!==r&&(e.style.objectFit=r)}function Vn(e,t,r,n){const s=t.volume*n;if(dl)s===0&&!e.muted?e.muted=!0:s>0&&e.muted&&(e.muted=!1);else if(e.muted&&(e.muted=!1),e.volume!==s&&(e.volume=s),e.sinkId!==r)try{e.setSinkId(r).catch(()=>{})}catch{}}const Wn=2e3,gl=1e3,Hn=100,Xn=50,Kn=5,ot=1e3,vl=10,_l=100,El=.3,bl=.1;function wl(e){return Math.sign(e)*Math.pow(Math.abs(e)/ot,El)*bl}function me(e,t){e.playbackRate!==t&&(e.playbackRate=t),e.paused&&e.play().catch(()=>{})}function Yn(e,t,r,n,s,i){const o=i&&!pl;let c=!1;if(e.duration){const h=r.filter(([p])=>p>r[0][0]&&p>n).filter(([,p])=>p?.set?.t!==void 0||p?.set?.rate!==void 0)[0];if(h?.[1]?.set?.t===0){const p=(e.duration*1e3-t.t)/t.rate,$=h[0]-n;c=Math.abs(p-$)<=_l,e.loop!==c&&(e.loop=c)}}const u=e.currentTime*1e3,l=c&&e.duration!==void 0?ml(u,t.t,e.duration*1e3):u-t.t,a=Math.abs(l);switch(!0){case(!o&&s.state==="idle"&&t.rate>0&&a>Wn):{const f=(t.t+t.rate*gl)/1e3;return e.duration!==void 0&&f>e.duration&&!c?{state:"idle"}:(me(e,0),e.currentTime=c?it(f,e.duration*1e3):f,{state:"seeking-ahead"})}case(s.state==="seeking-ahead"&&e.seeking===!0):return{state:"seeking-ahead"};case(s.state==="seeking-ahead"&&e.seeking===!1):return me(e,0),{state:"seeked-ahead"};case(s.state==="seeked-ahead"&&l<-Hn):return me(e,t.rate),console.warn("Failed to seek ahead in time"),{state:"idle"};case(s.state==="seeked-ahead"&&a<=Hn):return me(e,t.rate),{state:"idle"};case(s.state==="seeked-ahead"&&a>Wn*1.5):return console.warn("Failed to seek ahead"),{state:"idle"};case s.state==="seeked-ahead":return{state:"seeked-ahead"};case(o&&s.state==="idle"&&t.rate>0&&a>Xn&&a<=ot):{const f=wl(l),h=Math.max(0,t.rate-f);return me(e,h),{state:"intercepting"}}case(s.state==="intercepting"&&a<=Kn):return me(e,t.rate),{state:"idle"};case(s.state==="intercepting"&&Math.sign(l)===Math.sign(e.playbackRate-t.rate)):return me(e,t.rate),{state:"idle"};case(s.state==="intercepting"&&a<ot*2):return{state:"intercepting"};case s.state==="intercepting":return me(e,t.rate),{state:"idle"};case(o&&s.state==="idle"&&a>ot):{const f=(t.t+t.rate*vl)/1e3;return e.currentTime=c?it(f,e.duration*1e3):f,me(e,t.rate),{state:"seeking"}}case(s.state==="seeking"&&e.seeking):return{state:"seeking"};case(s.state==="seeking"&&!e.seeking):return{state:"idle"};case s.state==="idle":return me(e,t.rate),t.rate===0&&a>Xn&&(e.currentTime=t.t/1e3),{state:"idle"};default:return{state:"idle"}}}class Sl extends Nt{imageElement;update(){const t=st(this._state,Date.now());t?this.imageElement=Lt(this.imageElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.imageElement&&this.destroy(),!(!t||!this.imageElement)&&Gn(this.imageElement,t,this._state.fit)}destroy(){this.imageElement&&(this.imageElement.remove(),this.imageElement.src="",this.imageElement=void 0)}}class Jn extends Nt{syncState={state:"idle"};audioElement;volume=1;update(){const t=Date.now(),r=st(this._state,t);if(r?this.audioElement=Lt(this.audioElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.destroy(),!r||!this.audioElement)return;const n=this.getAudioOutput(this._state.audioOutput);Vn(this.audioElement,r,n,this.volume);const s=Yn(this.audioElement,r,this._state.keyframes,t,this.syncState,this._state.enablePlaybackRateAdjustment);this.syncState=s}destroy(){this.audioElement&&(this.audioElement.pause(),this.audioElement.remove(),this.audioElement.volume=0,this.audioElement.currentTime=0,this.mediaPreloader.releaseElement(this.audioElement)),this.audioElement=void 0}}class Qn extends Nt{syncState={state:"idle"};videoElement;volume=1;update(){const t=Date.now(),r=st(this._state,t);if(r?this.videoElement=Lt(this.videoElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.destroy(),!r||!this.videoElement)return;const n=this.getAudioOutput(this._state.audioOutput);Gn(this.videoElement,r,this._state.fit),Vn(this.videoElement,r,n,this.volume);const s=Yn(this.videoElement,r,this._state.keyframes,t,this.syncState,this._state.enablePlaybackRateAdjustment);this.syncState=s}destroy(){this.videoElement&&(this.videoElement.pause(),this.videoElement.remove(),this.videoElement.volume=0,this.videoElement.currentTime=0,this.mediaPreloader.releaseElement(this.videoElement)),this.videoElement=void 0}}class es{_state;_elements={};_constructAssetURL;constructor(t,r={}){this._constructAssetURL=t,this._state=r}get state(){return{...this._state}}setState(t){this._state=t,this.update()}update(){for(const[t,r]of Object.entries(this._elements)){if(!(t in this._state)){if(r.inUse){console.warn(`Failed to clean up element ${r.element.src}`);continue}r.element.src="",r.element.load(),delete this._elements[t]}r.inUse=r.element.isConnected}for(const[t,r]of Object.entries(this._state)){if(t in this._elements)continue;let n;switch(r.preload===!0?n="auto":r.preload===!1?n="none":n=r.preload,r.type){case"audio":{const s=document.createElement("audio");s.src=this._constructAssetURL(t),s.preload=n,this._elements[t]={element:s,inUse:!1,type:"audio"};break}case"video":{const s=document.createElement("video");s.src=this._constructAssetURL(t),s.preload=n,this._elements[t]={element:s,inUse:!1,type:"video"};break}}}}getElement(t,r){const n=this._elements[t];if(n&&n.inUse===!1)return n.inUse=!0,n.element;{const s=document.createElement(r);return s.src=this._constructAssetURL(t),r==="video"&&(this._elements[t]={element:s,type:r,inUse:!0}),s}}releaseElement(t){if(typeof t=="string"){const r=this._elements[t];r&&(r.inUse=!1)}else Object.values(this._elements).forEach(r=>{r.element===t&&(r.inUse=!1)})}}const Il="data-clip-id";class $l{constructor(t,r,n,s=new es(t)){this.constructAssetUrl=t,this.getAudioOutput=r,this.mediaPreloader=s,this._element=document.createElement("div"),this._element.className="surface-manager",this._element.style.width="100%",this._element.style.height="100%",this._state=n||{},this.update()}_state={};setState(t){this._state=t,this.update()}_volume=1;get volume(){return this._volume}set volume(t){this._volume=t,Object.values(this.resources).forEach(({manager:r})=>{(r instanceof Jn||r instanceof Qn)&&(r.volume=t)})}_element;get element(){return this._element}resources={};update(){Object.entries(this.resources).forEach(([r,{element:n,manager:s}])=>{r in this._state||(delete this.resources[r],n.remove(),s?.destroy())});const t=Object.keys(this._state).toSorted().map(r=>{const n=this.resources[r];if(n)return n.element;{const s=document.createElement("div");return s.setAttribute(Il,r),this.resources[r]={element:s},s}});this._element.replaceChildren(...t),Object.keys(this._state).toSorted().forEach(r=>{const n=this._state[r],s=this.resources[r];if(!s)throw new Error("Failed to create resource");if(s.manager)s.manager.setState(n);else switch(n.type){case"image":s.manager=new Sl(this._element,s.element,n,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader),s.manager.loop();break;case"audio":{const i=new Jn(this._element,s.element,n,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader);s.manager=i,i.volume=this._volume,i.loop();break}case"video":{const i=new Qn(this._element,s.element,n,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader);s.manager=i,i.volume=this._volume,i.loop();break}}})}}function yl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ve={},ue={},_e={},Ue={},ts;function at(){if(ts)return Ue;ts=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.AddressError=void 0;class e extends Error{constructor(r,n){super(r),this.name="AddressError",this.parseMessage=n}}return Ue.AddressError=e,Ue}var rs;function zt(){if(rs)return _e;rs=1,Object.defineProperty(_e,"__esModule",{value:!0}),_e.isInSubnet=t,_e.isCorrect=r,_e.prefixLengthFromMask=n,_e.numberToPaddedHex=s,_e.stringToPaddedHex=i,_e.testBit=o;const e=at();function t(c){return this.subnetMask<c.subnetMask?!1:this.mask(c.subnetMask)===c.mask()}function r(c){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===c&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}function n(c,u){const l=c.toString(2).padStart(u,"0");if(l.length>u)throw new e.AddressError("Invalid subnet mask.");const a=l.indexOf("0");if(a===-1)return u;if(l.slice(a).includes("1"))throw new e.AddressError("Invalid subnet mask.");return a}function s(c){return c.toString(16).padStart(2,"0")}function i(c){return s(parseInt(c,10))}function o(c,u){const{length:l}=c;if(u>l)return!1;const a=l-u;return c.substring(a,a+1)==="1"}return _e}var ce={},ns;function ss(){return ns||(ns=1,Object.defineProperty(ce,"__esModule",{value:!0}),ce.RE_SUBNET_STRING=ce.RE_ADDRESS=ce.GROUPS=ce.BITS=void 0,ce.BITS=32,ce.GROUPS=4,ce.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,ce.RE_SUBNET_STRING=/\/\d{1,2}$/),ce}var is;function os(){if(is)return ue;is=1;var e=ue&&ue.__createBinding||(Object.create?function(_,m,E,y){y===void 0&&(y=E);var C=Object.getOwnPropertyDescriptor(m,E);(!C||("get"in C?!m.__esModule:C.writable||C.configurable))&&(C={enumerable:!0,get:function(){return m[E]}}),Object.defineProperty(_,y,C)}:function(_,m,E,y){y===void 0&&(y=E),_[y]=m[E]}),t=ue&&ue.__setModuleDefault||(Object.create?function(_,m){Object.defineProperty(_,"default",{enumerable:!0,value:m})}:function(_,m){_.default=m}),r=ue&&ue.__importStar||function(_){if(_&&_.__esModule)return _;var m={};if(_!=null)for(var E in _)E!=="default"&&Object.prototype.hasOwnProperty.call(_,E)&&e(m,_,E);return t(m,_),m};Object.defineProperty(ue,"__esModule",{value:!0}),ue.Address4=void 0;const n=r(zt()),s=r(ss()),i=at(),o=n.isCorrect(s.BITS);class c{constructor(m){this.groups=s.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=o,this.isInSubnet=n.isInSubnet,this.address=m;const E=s.RE_SUBNET_STRING.exec(m);if(E){if(this.parsedSubnet=E[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>s.BITS)throw new i.AddressError("Invalid subnet mask.");m=m.replace(s.RE_SUBNET_STRING,"")}this.addressMinusSuffix=m,this.parsedAddress=this.parse(m)}static isValid(m){try{return new c(m),!0}catch{return!1}}parse(m){const E=m.split(".");if(!m.match(s.RE_ADDRESS))throw new i.AddressError("Invalid IPv4 address.");return E}correctForm(){return this.parsedAddress.map(m=>parseInt(m,10)).join(".")}static fromAddressAndMask(m,E){const y=n.prefixLengthFromMask(new c(E).bigInt(),s.BITS);return new c(`${m}/${y}`)}static fromAddressAndWildcardMask(m,E){const y=new c(E).bigInt(),C=(BigInt(1)<<BigInt(s.BITS))-BigInt(1),x=y^C,N=n.prefixLengthFromMask(x,s.BITS);return new c(`${m}/${N}`)}static fromWildcard(m){const E=m.split(".");if(E.length!==s.GROUPS)throw new i.AddressError("Wildcard pattern must have 4 octets");let y=-1;for(let U=0;U<E.length;U++)if(E[U]==="*")y===-1&&(y=U);else if(y!==-1)throw new i.AddressError("Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)");const C=y===-1?0:E.length-y,x=E.map(U=>U==="*"?"0":U),N=s.BITS-C*8;return new c(`${x.join(".")}/${N}`)}static fromHex(m){const E=m.replace(/:/g,"");if(!/^[0-9a-fA-F]{8}$/.test(E))throw new i.AddressError("IPv4 hex must be exactly 8 hex digits");const y=[];for(let C=0;C<8;C+=2)y.push(parseInt(E.slice(C,C+2),16));return new c(y.join("."))}static fromInteger(m){if(!Number.isInteger(m)||m<0||m>4294967295)throw new i.AddressError("IPv4 integer must be in the range 0 to 2**32 - 1");return c.fromHex(m.toString(16).padStart(8,"0"))}static fromArpa(m){const y=m.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new c(y)}toHex(){return this.parsedAddress.map(m=>n.stringToPaddedHex(m)).join(":")}toArray(){return this.parsedAddress.map(m=>parseInt(m,10))}toGroup6(){const m=[];let E;for(E=0;E<s.GROUPS;E+=2)m.push(`${n.stringToPaddedHex(this.parsedAddress[E])}${n.stringToPaddedHex(this.parsedAddress[E+1])}`);return m.join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(m=>n.stringToPaddedHex(m)).join("")}`)}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(s.BITS-this.subnetMask)}`)}startAddress(){return c.fromBigInt(this._startAddress())}startAddressExclusive(){const m=BigInt("1");return c.fromBigInt(this._startAddress()+m)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(s.BITS-this.subnetMask)}`)}endAddress(){return c.fromBigInt(this._endAddress())}endAddressExclusive(){const m=BigInt("1");return c.fromBigInt(this._endAddress()-m)}subnetMaskAddress(){return c.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(s.BITS-this.subnetMask)}`))}wildcardMask(){return c.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(s.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}static fromBigInt(m){if(m<0n||m>0xffffffffn)throw new i.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1");return c.fromHex(m.toString(16).padStart(8,"0"))}static fromByteArray(m){if(m.length!==4)throw new i.AddressError("IPv4 addresses require exactly 4 bytes");for(let E=0;E<m.length;E++)if(!Number.isInteger(m[E])||m[E]<0||m[E]>255)throw new i.AddressError("All bytes must be integers between 0 and 255");return this.fromUnsignedByteArray(m)}static fromUnsignedByteArray(m){if(m.length!==4)throw new i.AddressError("IPv4 addresses require exactly 4 bytes");const E=m.join(".");return new c(E)}mask(m){return m===void 0&&(m=this.subnetMask),this.getBitsBase2(0,m)}getBitsBase2(m,E){return this.binaryZeroPad().slice(m,E)}reverseForm(m){m||(m={});const E=this.correctForm().split(".").reverse().join(".");return m.omitSuffix?E:`${E}.in-addr.arpa.`}isMulticast(){return this.isInSubnet(u)}isPrivate(){return l.some(m=>this.isInSubnet(m))}isLoopback(){return this.isInSubnet(a)}isLinkLocal(){return this.isInSubnet(f)}isUnspecified(){return this.isInSubnet(h)}isBroadcast(){return this.isInSubnet(p)}isCGNAT(){return this.isInSubnet($)}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(s.BITS,"0")),this._binaryZeroPad}groupForV6(){const m=this.parsedAddress;return this.address.replace(s.RE_ADDRESS,`<span class="hover-group group-v4 group-6">${m.slice(0,2).join(".")}</span>.<span class="hover-group group-v4 group-7">${m.slice(2,4).join(".")}</span>`)}}ue.Address4=c;const u=new c("224.0.0.0/4"),l=[new c("10.0.0.0/8"),new c("172.16.0.0/12"),new c("192.168.0.0/16")],a=new c("127.0.0.0/8"),f=new c("169.254.0.0/16"),h=new c("0.0.0.0/32"),p=new c("255.255.255.255/32"),$=new c("100.64.0.0/10");return ue}var le={},J={},as;function us(){return as||(as=1,Object.defineProperty(J,"__esModule",{value:!0}),J.RE_URL_WITH_PORT=J.RE_URL=J.RE_ZONE_STRING=J.RE_SUBNET_STRING=J.RE_BAD_ADDRESS=J.RE_BAD_CHARACTERS=J.TYPES=J.SCOPES=J.GROUPS=J.BITS=void 0,J.BITS=128,J.GROUPS=8,J.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},J.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast","fc00::/7":"Unique local","2002::/16":"6to4","2001:db8::/32":"Documentation","64:ff9b::/96":"NAT64 (well-known)","64:ff9b:1::/48":"NAT64 (local-use)"},J.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi,J.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,J.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,J.RE_ZONE_STRING=/%.*$/,J.RE_URL=/^\[{0,1}([0-9a-f:]+)\]{0,1}/,J.RE_URL_WITH_PORT=/\[([0-9a-f:]+)\]:([0-9]{1,5})/),J}var Ie={},cs;function ls(){if(cs)return Ie;cs=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.escapeHtml=e,Ie.spanAllZeroes=t,Ie.spanAll=r,Ie.spanLeadingZeroes=s,Ie.simpleGroup=i;function e(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function t(o){return e(o).replace(/(0+)/g,'<span class="zero">$1</span>')}function r(o,c=0){return o.split("").map((l,a)=>`<span class="digit value-${e(l)} position-${a+c}">${t(l)}</span>`).join("")}function n(o){return e(o).replace(/^(0+)/,'<span class="zero">$1</span>')}function s(o){return o.split(":").map(u=>n(u)).join(":")}function i(o,c=0){return o.split(":").map((l,a)=>/group-v4/.test(l)?l:`<span class="hover-group group-${a+c}">${n(l)}</span>`)}return Ie}var se={},fs;function Rl(){if(fs)return se;fs=1;var e=se&&se.__createBinding||(Object.create?function(u,l,a,f){f===void 0&&(f=a);var h=Object.getOwnPropertyDescriptor(l,a);(!h||("get"in h?!l.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return l[a]}}),Object.defineProperty(u,f,h)}:function(u,l,a,f){f===void 0&&(f=a),u[f]=l[a]}),t=se&&se.__setModuleDefault||(Object.create?function(u,l){Object.defineProperty(u,"default",{enumerable:!0,value:l})}:function(u,l){u.default=l}),r=se&&se.__importStar||function(u){if(u&&u.__esModule)return u;var l={};if(u!=null)for(var a in u)a!=="default"&&Object.prototype.hasOwnProperty.call(u,a)&&e(l,u,a);return t(l,u),l};Object.defineProperty(se,"__esModule",{value:!0}),se.ADDRESS_BOUNDARY=void 0,se.groupPossibilities=s,se.padGroup=i,se.simpleRegularExpression=o,se.possibleElisions=c;const n=r(us());function s(u){return`(${u.join("|")})`}function i(u){return u.length<4?`0{0,${4-u.length}}${u}`:u}se.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function o(u){const l=[];u.forEach((f,h)=>{parseInt(f,16)===0&&l.push(h)});const a=l.map(f=>u.map((h,p)=>{if(p===f){const $=p===0||p===n.GROUPS-1?":":"";return s([i(h),$])}return i(h)}).join(":"));return a.push(u.map(i).join(":")),s(a)}function c(u,l,a){const f=l?"":":",h=a?"":":",p=[];!l&&!a&&p.push("::"),l&&a&&p.push(""),(a&&!l||!a&&l)&&p.push(":"),p.push(`${f}(:0{1,4}){1,${u-1}}`),p.push(`(0{1,4}:){1,${u-1}}${h}`),p.push(`(0{1,4}:){${u-1}}0{1,4}`);for(let $=1;$<u-1;$++)for(let _=1;_<u-$;_++)p.push(`(0{1,4}:){${_}}:(0{1,4}:){${u-_-$-1}}0{1,4}`);return s(p)}return se}var hs;function Al(){if(hs)return le;hs=1;var e=le&&le.__createBinding||(Object.create?function(L,d,v,b){b===void 0&&(b=v);var w=Object.getOwnPropertyDescriptor(d,v);(!w||("get"in w?!d.__esModule:w.writable||w.configurable))&&(w={enumerable:!0,get:function(){return d[v]}}),Object.defineProperty(L,b,w)}:function(L,d,v,b){b===void 0&&(b=v),L[b]=d[v]}),t=le&&le.__setModuleDefault||(Object.create?function(L,d){Object.defineProperty(L,"default",{enumerable:!0,value:d})}:function(L,d){L.default=d}),r=le&&le.__importStar||function(L){if(L&&L.__esModule)return L;var d={};if(L!=null)for(var v in L)v!=="default"&&Object.prototype.hasOwnProperty.call(L,v)&&e(d,L,v);return t(d,L),d};Object.defineProperty(le,"__esModule",{value:!0}),le.Address6=void 0;const n=r(zt()),s=r(ss()),i=r(us()),o=r(ls()),c=os(),u=Rl(),l=at(),a=zt(),f=n.isCorrect(i.BITS);function h(L){if(!L)throw new Error("Assertion failed.")}function p(L){const d=/(\d+)(\d{3})/;for(;d.test(L);)L=L.replace(d,"$1,$2");return L}function $(L){return L=L.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),L=L.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),L}function _(L,d){const v=[],b=[];let w;for(w=0;w<L.length;w++)w<d[0]?v.push(L[w]):w>d[1]&&b.push(L[w]);return v.concat(["compact"]).concat(b)}function m(L){return parseInt(L,16).toString(16).padStart(4,"0")}function E(L){return L&255}class y{constructor(d,v){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=n.isInSubnet,this.isCorrect=f,v===void 0?this.groups=i.GROUPS:this.groups=v,this.address=d;const b=i.RE_SUBNET_STRING.exec(d);if(b){if(this.parsedSubnet=b[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>i.BITS)throw new l.AddressError("Invalid subnet mask.");d=d.replace(i.RE_SUBNET_STRING,"")}else if(/\//.test(d))throw new l.AddressError("Invalid subnet mask.");const w=i.RE_ZONE_STRING.exec(d);w&&(this.zone=w[0],d=d.replace(i.RE_ZONE_STRING,"")),this.addressMinusSuffix=d,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(d){try{return new y(d),!0}catch{return!1}}static fromBigInt(d){if(d<0n||d>(1n<<BigInt(i.BITS))-1n)throw new l.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1");const v=d.toString(16).padStart(32,"0"),b=[];for(let w=0;w<i.GROUPS;w++)b.push(v.slice(w*4,(w+1)*4));return new y(b.join(":"))}static fromURL(d){let v,b=null,w;if(d.indexOf("[")!==-1&&d.indexOf("]:")!==-1){if(w=i.RE_URL_WITH_PORT.exec(d),w===null)return{error:"failed to parse address with port",address:null,port:null};v=w[1],b=w[2]}else if(d.indexOf("/")!==-1){if(d=d.replace(/^[a-z0-9]+:\/\//,""),w=i.RE_URL.exec(d),w===null)return{error:"failed to parse address from URL",address:null,port:null};v=w[1]}else v=d;return b?(b=parseInt(b,10),(b<0||b>65536)&&(b=null)):b=null,{address:new y(v),port:b}}static fromAddressAndMask(d,v){const b=n.prefixLengthFromMask(new y(v).bigInt(),i.BITS);return new y(`${d}/${b}`)}static fromAddressAndWildcardMask(d,v){const b=new y(v).bigInt(),w=(BigInt(1)<<BigInt(i.BITS))-BigInt(1),k=b^w,D=n.prefixLengthFromMask(k,i.BITS);return new y(`${d}/${D}`)}static fromWildcard(d){if(d.includes("%")||d.includes("/"))throw new l.AddressError("Wildcard pattern must not include a zone or CIDR suffix");const v=d.split("::");if(v.length>2)throw new l.AddressError("Wildcard pattern cannot contain more than one '::'");let b;if(v.length===2){const S=v[0]===""?[]:v[0].split(":"),I=v[1]===""?[]:v[1].split(":"),T=i.GROUPS-S.length-I.length;if(T<1)throw new l.AddressError("Wildcard pattern with '::' has too many groups");b=[...S,...new Array(T).fill("0"),...I]}else b=d.split(":");if(b.length!==i.GROUPS)throw new l.AddressError("Wildcard pattern must have 8 groups");let w=-1;for(let S=0;S<b.length;S++)if(b[S]==="*")w===-1&&(w=S);else if(w!==-1)throw new l.AddressError("Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)");const k=w===-1?0:b.length-w,D=b.map(S=>S==="*"?"0":S),j=i.BITS-k*16;return new y(`${D.join(":")}/${j}`)}static fromAddress4(d){const v=new c.Address4(d),b=i.BITS-(s.BITS-v.subnetMask);return new y(`::ffff:${v.correctForm()}/${b}`)}static fromArpa(d){let v=d.replace(/(\.ip6\.arpa)?\.$/,"");const b=7;if(v.length!==63)throw new l.AddressError("Invalid 'ip6.arpa' form.");const w=v.split(".").reverse();for(let k=b;k>0;k--){const D=k*4;w.splice(D,0,":")}return v=w.join(""),new y(v)}microsoftTranscription(){return`${this.correctForm().replace(/:/g,"-")}.ipv6-literal.net`}mask(d=this.subnetMask){return this.getBitsBase2(0,d)}possibleSubnets(d=128){const v=i.BITS-this.subnetMask,b=Math.abs(d-i.BITS),w=v-b;return w<0?"0":p((BigInt("2")**BigInt(w)).toString(10))}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(i.BITS-this.subnetMask)}`)}startAddress(){return y.fromBigInt(this._startAddress())}startAddressExclusive(){const d=BigInt("1");return y.fromBigInt(this._startAddress()+d)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(i.BITS-this.subnetMask)}`)}endAddress(){return y.fromBigInt(this._endAddress())}endAddressExclusive(){const d=BigInt("1");return y.fromBigInt(this._endAddress()-d)}subnetMaskAddress(){return y.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(i.BITS-this.subnetMask)}`))}wildcardMask(){return y.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(i.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}getScope(){const d=this.getType();return d==="Multicast"||d.startsWith("Multicast ")?i.SCOPES[parseInt(this.getBits(12,16).toString(10),10)]||"Unknown":d==="Link-local unicast"||d==="Loopback"?"Link local":d==="Unspecified"?"Unknown":"Global"}getType(){for(let d=0;d<C.length;d++){const v=C[d];if(this.isInSubnet(v[0]))return v[1]}return"Global unicast"}getBits(d,v){return BigInt(`0b${this.getBitsBase2(d,v)}`)}getBitsBase2(d,v){return this.binaryZeroPad().slice(d,v)}getBitsBase16(d,v){const b=v-d;if(b%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(d,v).toString(16).padStart(b/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,i.BITS)}reverseForm(d){d||(d={});const v=Math.floor(this.subnetMask/4),b=this.canonicalForm().replace(/:/g,"").split("").slice(0,v).reverse().join(".");return v>0?d.omitSuffix?b:`${b}.ip6.arpa.`:d.omitSuffix?"":"ip6.arpa."}correctForm(){let d,v=[],b=0;const w=[];for(d=0;d<this.parsedAddress.length;d++){const j=parseInt(this.parsedAddress[d],16);j===0&&b++,j!==0&&b>0&&(b>1&&w.push([d-b,d-1]),b=0)}b>1&&w.push([this.parsedAddress.length-b,this.parsedAddress.length-1]);const k=w.map(j=>j[1]-j[0]+1);if(w.length>0){const j=k.indexOf(Math.max(...k));v=_(this.parsedAddress,w[j])}else v=this.parsedAddress;for(d=0;d<v.length;d++)v[d]!=="compact"&&(v[d]=parseInt(v[d],16).toString(16));let D=v.join(":");return D=D.replace(/^compact$/,"::"),D=D.replace(/(^compact)|(compact$)/,":"),D=D.replace(/compact/,""),D}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(i.BITS,"0")),this._binaryZeroPad}parse4in6(d){if(d.indexOf(".")===-1)return d;const v=d.split(":"),w=v.slice(-1)[0].match(s.RE_ADDRESS);if(w){this.parsedAddress4=w[0],this.address4=new c.Address4(this.parsedAddress4);for(let k=0;k<this.address4.groups;k++)if(/^0[0-9]+/.test(this.address4.parsedAddress[k])){const D=this.address4.parsedAddress.map($).join("."),j=v.slice(0,-1).map(o.escapeHtml).join(":"),S=v.length>1?":":"";throw new l.AddressError("IPv4 addresses can't have leading zeroes.",`${j}${S}${D}`)}this.v4=!0,v[v.length-1]=this.address4.toGroup6(),d=v.join(":")}return d}parse(d){d=this.parse4in6(d);const v=d.match(i.RE_BAD_CHARACTERS);if(v)throw new l.AddressError(`Bad character${v.length>1?"s":""} detected in address: ${v.join("")}`,d.replace(i.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));const b=d.match(i.RE_BAD_ADDRESS);if(b)throw new l.AddressError(`Address failed regex: ${b.join("")}`,d.replace(i.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let w=[];const k=d.split("::");if(k.length===2){let D=k[0].split(":"),j=k[1].split(":");D.length===1&&D[0]===""&&(D=[]),j.length===1&&j[0]===""&&(j=[]);const S=this.groups-(D.length+j.length);if(!S)throw new l.AddressError("Error parsing groups");this.elidedGroups=S,this.elisionBegin=D.length,this.elisionEnd=D.length+this.elidedGroups,w=w.concat(D);for(let I=0;I<S;I++)w.push("0");w=w.concat(j)}else if(k.length===1)w=d.split(":"),this.elidedGroups=0;else throw new l.AddressError("Too many :: groups found");if(w=w.map(D=>parseInt(D,16).toString(16)),w.length!==this.groups)throw new l.AddressError("Incorrect number of groups found");return w}canonicalForm(){return this.parsedAddress.map(m).join(":")}decimal(){return this.parsedAddress.map(d=>parseInt(d,16).toString(10).padStart(5,"0")).join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(m).join("")}`)}to4(){const d=this.binaryZeroPad().split("");return c.Address4.fromHex(BigInt(`0b${d.slice(96,128).join("")}`).toString(16).padStart(8,"0"))}to4in6(){const d=this.to4(),b=new y(this.parsedAddress.slice(0,6).join(":"),6).correctForm();let w="";return/:$/.test(b)||(w=":"),b+w+d.address}inspectTeredo(){const d=this.getBitsBase16(0,32),b=(this.getBits(80,96)^BigInt("0xffff")).toString(),w=c.Address4.fromHex(this.getBitsBase16(32,64)),k=this.getBits(96,128),D=c.Address4.fromHex((k^BigInt("0xffffffff")).toString(16).padStart(8,"0")),j=this.getBitsBase2(64,80),S=(0,a.testBit)(j,15),I=(0,a.testBit)(j,14),T=(0,a.testBit)(j,8),R=(0,a.testBit)(j,9),Z=BigInt(`0b${j.slice(2,6)+j.slice(8,16)}`).toString(10);return{prefix:`${d.slice(0,4)}:${d.slice(4,8)}`,server4:w.address,client4:D.address,flags:j,coneNat:S,microsoft:{reserved:I,universalLocal:R,groupIndividual:T,nonce:Z},udpPort:b}}inspect6to4(){const d=this.getBitsBase16(0,16),v=c.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:d.slice(0,4),gateway:v.address}}to6to4(){if(!this.is4())return null;const d=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new y(d)}static fromAddress4Nat64(d,v="64:ff9b::/96"){const b=new c.Address4(d),w=new y(v),k=w.subnetMask;if(k!==32&&k!==40&&k!==48&&k!==56&&k!==64&&k!==96)throw new l.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");const D=w.binaryZeroPad(),j=b.binaryZeroPad();let S;if(k===96)S=D.slice(0,96)+j;else{const R=64-k;S=D.slice(0,k)+j.slice(0,R)+"00000000"+j.slice(R)+"0".repeat(56-(32-R))}const I=BigInt(`0b${S}`).toString(16).padStart(32,"0"),T=[];for(let R=0;R<8;R++)T.push(I.slice(R*4,(R+1)*4));return new y(T.join(":"))}toAddress4Nat64(d="64:ff9b::/96"){const v=new y(d),b=v.subnetMask;if(b!==32&&b!==40&&b!==48&&b!==56&&b!==64&&b!==96)throw new l.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");if(!this.isInSubnet(v))return null;const w=this.binaryZeroPad();let k;if(b===96)k=w.slice(96,128);else{const j=64-b;k=w.slice(b,b+j)+w.slice(72,72+(32-j))}const D=[];for(let j=0;j<4;j++)D.push(parseInt(k.slice(j*8,(j+1)*8),2).toString());return new c.Address4(D.join("."))}toByteArray(){const d=this.bigInt().toString(16),b=`${"0".repeat(d.length%2)}${d}`,w=[];for(let k=0,D=b.length;k<D;k+=2)w.push(parseInt(b.substring(k,k+2),16));return w}toUnsignedByteArray(){return this.toByteArray().map(E)}static fromByteArray(d){return this.fromUnsignedByteArray(d.map(E))}static fromUnsignedByteArray(d){const v=BigInt("256");let b=BigInt("0"),w=BigInt("1");for(let k=d.length-1;k>=0;k--)b+=w*BigInt(d[k].toString(10)),w*=v;return y.fromBigInt(b)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){const d=this.getType();return d==="Multicast"||d.startsWith("Multicast ")}is4(){return this.v4}isMapped4(){return this.isInSubnet(z)}isTeredo(){return this.isInSubnet(x)}is6to4(){return this.isInSubnet(N)}isLoopback(){return this.getType()==="Loopback"}isULA(){return this.isInSubnet(U)}isUnspecified(){return this.getType()==="Unspecified"}isDocumentation(){return this.isInSubnet(Q)}href(d){return d===void 0?d="":d=`:${d}`,`http://[${this.correctForm()}]${d}/`}link(d){d||(d={}),d.className===void 0&&(d.className=""),d.prefix===void 0&&(d.prefix="/#address="),d.v4===void 0&&(d.v4=!1);let v=this.correctForm;d.v4&&(v=this.to4in6);const b=v.call(this),w=o.escapeHtml(`${d.prefix}${b}`),k=o.escapeHtml(b);if(d.className){const D=o.escapeHtml(d.className);return`<a href="${w}" class="${D}">${k}</a>`}return`<a href="${w}">${k}</a>`}group(){if(this.elidedGroups===0)return o.simpleGroup(this.addressMinusSuffix).join(":");h(typeof this.elidedGroups=="number"),h(typeof this.elisionBegin=="number");const d=[],[v,b]=this.addressMinusSuffix.split("::");v.length?d.push(...o.simpleGroup(v)):d.push("");const w=["hover-group"];for(let k=this.elisionBegin;k<this.elisionBegin+this.elidedGroups;k++)w.push(`group-${k}`);return d.push(`<span class="${w.join(" ")}"></span>`),b.length?d.push(...o.simpleGroup(b,this.elisionEnd)):d.push(""),this.is4()&&(h(this.address4 instanceof c.Address4),d.pop(),d.push(this.address4.groupForV6())),d.join(":")}regularExpressionString(d=!1){let v=[];const b=new y(this.correctForm());if(b.elidedGroups===0)v.push((0,u.simpleRegularExpression)(b.parsedAddress));else if(b.elidedGroups===i.GROUPS)v.push((0,u.possibleElisions)(i.GROUPS));else{const w=b.address.split("::");w[0].length&&v.push((0,u.simpleRegularExpression)(w[0].split(":"))),h(typeof b.elidedGroups=="number"),v.push((0,u.possibleElisions)(b.elidedGroups,w[0].length!==0,w[1].length!==0)),w[1].length&&v.push((0,u.simpleRegularExpression)(w[1].split(":"))),v=[v.join(":")]}return d||(v=["(?=^|",u.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...v,")(?=[^\\w\\:]|",u.ADDRESS_BOUNDARY,"|$)"]),v.join("")}regularExpression(d=!1){return new RegExp(this.regularExpressionString(d),"i")}}le.Address6=y;const C=Object.keys(i.TYPES).map(L=>[new y(L),i.TYPES[L]]),x=new y("2001::/32"),N=new y("2002::/16"),U=new y("fc00::/7"),Q=new y("2001:db8::/32"),z=new y("::ffff:0:0/96");return le}var ds;function Tl(){return ds||(ds=1,function(e){var t=ve&&ve.__createBinding||(Object.create?function(u,l,a,f){f===void 0&&(f=a);var h=Object.getOwnPropertyDescriptor(l,a);(!h||("get"in h?!l.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return l[a]}}),Object.defineProperty(u,f,h)}:function(u,l,a,f){f===void 0&&(f=a),u[f]=l[a]}),r=ve&&ve.__setModuleDefault||(Object.create?function(u,l){Object.defineProperty(u,"default",{enumerable:!0,value:l})}:function(u,l){u.default=l}),n=ve&&ve.__importStar||function(u){if(u&&u.__esModule)return u;var l={};if(u!=null)for(var a in u)a!=="default"&&Object.prototype.hasOwnProperty.call(u,a)&&t(l,u,a);return r(l,u),l};Object.defineProperty(e,"__esModule",{value:!0}),e.v6=e.AddressError=e.Address6=e.Address4=void 0;var s=os();Object.defineProperty(e,"Address4",{enumerable:!0,get:function(){return s.Address4}});var i=Al();Object.defineProperty(e,"Address6",{enumerable:!0,get:function(){return i.Address6}});var o=at();Object.defineProperty(e,"AddressError",{enumerable:!0,get:function(){return o.AddressError}});const c=n(ls());e.v6={helpers:c}}(ve)),ve}var $e=Tl();class ps{host;port;constructor(t){const r=t.lastIndexOf(":"),n=t.slice(0,r),s=t.slice(r+1);if(r===-1||!/^(\d+|\*)$/.test(s))throw new Error(`Invalid host pattern "${t}": a port (or "*") is required`);this.host=n,this.port=s}validate(t,r){return this.matchesHost(t)&&(this.port==="*"||Number(this.port)===r)}matchesHost(t){const r=this.host.toLowerCase();return t=t.toLowerCase(),r==="*"?!0:r==="localhost"?t==="localhost"||kl(t):r==="private"?Ol(t):r.startsWith("*.")?t.endsWith(r.slice(1)):r===t}}function Ol(e){return $e.Address4.isValid(e)&&new $e.Address4(e).isPrivate()}function kl(e){if(e.startsWith("[")&&e.endsWith("]")){const t=e.slice(1,-1);return $e.Address6.isValid(t)&&new $e.Address6(t).isLoopback()}return $e.Address4.isValid(e)&&new $e.Address4(e).isLoopback()||$e.Address6.isValid(e)&&new $e.Address6(e).isLoopback()}const Pl=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var ut={exports:{}},Zt,ms;function Be(){if(ms)return Zt;ms=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,s=t-6;return Zt={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:s,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Zt}var Dt,gs;function ct(){return gs||(gs=1,Dt=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),Dt}var vs;function Fe(){return vs||(vs=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=Be(),i=ct();t=e.exports={};const o=t.re=[],c=t.safeRe=[],u=t.src=[],l=t.safeSrc=[],a=t.t={};let f=0;const h="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",s],[h,n]],$=m=>{for(const[E,y]of p)m=m.split(`${E}*`).join(`${E}{0,${y}}`).split(`${E}+`).join(`${E}{1,${y}}`);return m},_=(m,E,y)=>{const C=$(E),x=f++;i(m,x,E),a[m]=x,u[x]=E,l[x]=C,o[x]=new RegExp(E,y?"g":void 0),c[x]=new RegExp(C,y?"g":void 0)};_("NUMERICIDENTIFIER","0|[1-9]\\d*"),_("NUMERICIDENTIFIERLOOSE","\\d+"),_("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),_("MAINVERSION",`(${u[a.NUMERICIDENTIFIER]})\\.(${u[a.NUMERICIDENTIFIER]})\\.(${u[a.NUMERICIDENTIFIER]})`),_("MAINVERSIONLOOSE",`(${u[a.NUMERICIDENTIFIERLOOSE]})\\.(${u[a.NUMERICIDENTIFIERLOOSE]})\\.(${u[a.NUMERICIDENTIFIERLOOSE]})`),_("PRERELEASEIDENTIFIER",`(?:${u[a.NONNUMERICIDENTIFIER]}|${u[a.NUMERICIDENTIFIER]})`),_("PRERELEASEIDENTIFIERLOOSE",`(?:${u[a.NONNUMERICIDENTIFIER]}|${u[a.NUMERICIDENTIFIERLOOSE]})`),_("PRERELEASE",`(?:-(${u[a.PRERELEASEIDENTIFIER]}(?:\\.${u[a.PRERELEASEIDENTIFIER]})*))`),_("PRERELEASELOOSE",`(?:-?(${u[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[a.PRERELEASEIDENTIFIERLOOSE]})*))`),_("BUILDIDENTIFIER",`${h}+`),_("BUILD",`(?:\\+(${u[a.BUILDIDENTIFIER]}(?:\\.${u[a.BUILDIDENTIFIER]})*))`),_("FULLPLAIN",`v?${u[a.MAINVERSION]}${u[a.PRERELEASE]}?${u[a.BUILD]}?`),_("FULL",`^${u[a.FULLPLAIN]}$`),_("LOOSEPLAIN",`[v=\\s]*${u[a.MAINVERSIONLOOSE]}${u[a.PRERELEASELOOSE]}?${u[a.BUILD]}?`),_("LOOSE",`^${u[a.LOOSEPLAIN]}$`),_("GTLT","((?:<|>)?=?)"),_("XRANGEIDENTIFIERLOOSE",`${u[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),_("XRANGEIDENTIFIER",`${u[a.NUMERICIDENTIFIER]}|x|X|\\*`),_("XRANGEPLAIN",`[v=\\s]*(${u[a.XRANGEIDENTIFIER]})(?:\\.(${u[a.XRANGEIDENTIFIER]})(?:\\.(${u[a.XRANGEIDENTIFIER]})(?:${u[a.PRERELEASE]})?${u[a.BUILD]}?)?)?`),_("XRANGEPLAINLOOSE",`[v=\\s]*(${u[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[a.XRANGEIDENTIFIERLOOSE]})(?:${u[a.PRERELEASELOOSE]})?${u[a.BUILD]}?)?)?`),_("XRANGE",`^${u[a.GTLT]}\\s*${u[a.XRANGEPLAIN]}$`),_("XRANGELOOSE",`^${u[a.GTLT]}\\s*${u[a.XRANGEPLAINLOOSE]}$`),_("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),_("COERCE",`${u[a.COERCEPLAIN]}(?:$|[^\\d])`),_("COERCEFULL",u[a.COERCEPLAIN]+`(?:${u[a.PRERELEASE]})?(?:${u[a.BUILD]})?(?:$|[^\\d])`),_("COERCERTL",u[a.COERCE],!0),_("COERCERTLFULL",u[a.COERCEFULL],!0),_("LONETILDE","(?:~>?)"),_("TILDETRIM",`(\\s*)${u[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",_("TILDE",`^${u[a.LONETILDE]}${u[a.XRANGEPLAIN]}$`),_("TILDELOOSE",`^${u[a.LONETILDE]}${u[a.XRANGEPLAINLOOSE]}$`),_("LONECARET","(?:\\^)"),_("CARETTRIM",`(\\s*)${u[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",_("CARET",`^${u[a.LONECARET]}${u[a.XRANGEPLAIN]}$`),_("CARETLOOSE",`^${u[a.LONECARET]}${u[a.XRANGEPLAINLOOSE]}$`),_("COMPARATORLOOSE",`^${u[a.GTLT]}\\s*(${u[a.LOOSEPLAIN]})$|^$`),_("COMPARATOR",`^${u[a.GTLT]}\\s*(${u[a.FULLPLAIN]})$|^$`),_("COMPARATORTRIM",`(\\s*)${u[a.GTLT]}\\s*(${u[a.LOOSEPLAIN]}|${u[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",_("HYPHENRANGE",`^\\s*(${u[a.XRANGEPLAIN]})\\s+-\\s+(${u[a.XRANGEPLAIN]})\\s*$`),_("HYPHENRANGELOOSE",`^\\s*(${u[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[a.XRANGEPLAINLOOSE]})\\s*$`),_("STAR","(<|>)?=?\\s*\\*"),_("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),_("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(ut,ut.exports)),ut.exports}var jt,_s;function xt(){if(_s)return jt;_s=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return jt=n=>n?typeof n!="object"?e:n:t,jt}var Mt,Es;function bs(){if(Es)return Mt;Es=1;const e=/^[0-9]+$/,t=(n,s)=>{if(typeof n=="number"&&typeof s=="number")return n===s?0:n<s?-1:1;const i=e.test(n),o=e.test(s);return i&&o&&(n=+n,s=+s),n===s?0:i&&!o?-1:o&&!i?1:n<s?-1:1};return Mt={compareIdentifiers:t,rcompareIdentifiers:(n,s)=>t(s,n)},Mt}var Ut,ws;function ne(){if(ws)return Ut;ws=1;const e=ct(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=Be(),{safeRe:n,t:s}=Fe(),i=xt(),{compareIdentifiers:o}=bs(),c=(l,a)=>{const f=a.split(".");if(f.length>l.length)return!1;for(let h=0;h<f.length;h++)if(o(l[h],f[h])!==0)return!1;return!0};class u{constructor(a,f){if(f=i(f),a instanceof u){if(a.loose===!!f.loose&&a.includePrerelease===!!f.includePrerelease)return a;a=a.version}else if(typeof a!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);if(a.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",a,f),this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease;const h=a.trim().match(f.loose?n[s.LOOSE]:n[s.FULL]);if(!h)throw new TypeError(`Invalid Version: ${a}`);if(this.raw=a,this.major=+h[1],this.minor=+h[2],this.patch=+h[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");h[4]?this.prerelease=h[4].split(".").map(p=>{if(/^[0-9]+$/.test(p)){const $=+p;if($>=0&&$<r)return $}return p}):this.prerelease=[],this.build=h[5]?h[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(a){if(e("SemVer.compare",this.version,this.options,a),!(a instanceof u)){if(typeof a=="string"&&a===this.version)return 0;a=new u(a,this.options)}return a.version===this.version?0:this.compareMain(a)||this.comparePre(a)}compareMain(a){return a instanceof u||(a=new u(a,this.options)),this.major<a.major?-1:this.major>a.major?1:this.minor<a.minor?-1:this.minor>a.minor?1:this.patch<a.patch?-1:this.patch>a.patch?1:0}comparePre(a){if(a instanceof u||(a=new u(a,this.options)),this.prerelease.length&&!a.prerelease.length)return-1;if(!this.prerelease.length&&a.prerelease.length)return 1;if(!this.prerelease.length&&!a.prerelease.length)return 0;let f=0;do{const h=this.prerelease[f],p=a.prerelease[f];if(e("prerelease compare",f,h,p),h===void 0&&p===void 0)return 0;if(p===void 0)return 1;if(h===void 0)return-1;if(h===p)continue;return o(h,p)}while(++f)}compareBuild(a){a instanceof u||(a=new u(a,this.options));let f=0;do{const h=this.build[f],p=a.build[f];if(e("build compare",f,h,p),h===void 0&&p===void 0)return 0;if(p===void 0)return 1;if(h===void 0)return-1;if(h===p)continue;return o(h,p)}while(++f)}inc(a,f,h){if(a.startsWith("pre")){if(!f&&h===!1)throw new Error("invalid increment argument: identifier is empty");if(f){const p=`-${f}`.match(this.options.loose?n[s.PRERELEASELOOSE]:n[s.PRERELEASE]);if(!p||p[1]!==f)throw new Error(`invalid identifier: ${f}`)}}switch(a){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",f,h);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",f,h);break;case"prepatch":this.prerelease.length=0,this.inc("patch",f,h),this.inc("pre",f,h);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",f,h),this.inc("pre",f,h);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const p=Number(h)?1:0;if(this.prerelease.length===0)this.prerelease=[p];else{let $=this.prerelease.length;for(;--$>=0;)typeof this.prerelease[$]=="number"&&(this.prerelease[$]++,$=-2);if($===-1){if(f===this.prerelease.join(".")&&h===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(p)}}if(f){let $=[f,p];if(h===!1&&($=[f]),c(this.prerelease,f)){const _=this.prerelease[f.split(".").length];isNaN(_)&&(this.prerelease=$)}else this.prerelease=$}break}default:throw new Error(`invalid increment argument: ${a}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Ut=u,Ut}var Bt,Ss;function ke(){if(Ss)return Bt;Ss=1;const e=ne();return Bt=(r,n,s=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(i){if(!s)return null;throw i}},Bt}var Ft,Is;function Cl(){if(Is)return Ft;Is=1;const e=ke();return Ft=(r,n)=>{const s=e(r,n);return s?s.version:null},Ft}var qt,$s;function Nl(){if($s)return qt;$s=1;const e=ke();return qt=(r,n)=>{const s=e(r.trim().replace(/^[=v]+/,""),n);return s?s.version:null},qt}var Gt,ys;function Ll(){if(ys)return Gt;ys=1;const e=ne();return Gt=(r,n,s,i,o)=>{typeof s=="string"&&(o=i,i=s,s=void 0);try{return new e(r instanceof e?r.version:r,s).inc(n,i,o).version}catch{return null}},Gt}var Vt,Rs;function zl(){if(Rs)return Vt;Rs=1;const e=ke();return Vt=(r,n)=>{const s=e(r,null,!0),i=e(n,null,!0),o=s.compare(i);if(o===0)return null;const c=o>0,u=c?s:i,l=c?i:s,a=!!u.prerelease.length;if(!!l.prerelease.length&&!a){if(!l.patch&&!l.minor)return"major";if(l.compareMain(u)===0)return l.minor&&!l.patch?"minor":"patch"}const h=a?"pre":"";return s.major!==i.major?h+"major":s.minor!==i.minor?h+"minor":s.patch!==i.patch?h+"patch":"prerelease"},Vt}var Wt,As;function Zl(){if(As)return Wt;As=1;const e=ne();return Wt=(r,n)=>new e(r,n).major,Wt}var Ht,Ts;function Dl(){if(Ts)return Ht;Ts=1;const e=ne();return Ht=(r,n)=>new e(r,n).minor,Ht}var Xt,Os;function jl(){if(Os)return Xt;Os=1;const e=ne();return Xt=(r,n)=>new e(r,n).patch,Xt}var Kt,ks;function xl(){if(ks)return Kt;ks=1;const e=ke();return Kt=(r,n)=>{const s=e(r,n);return s&&s.prerelease.length?s.prerelease:null},Kt}var Yt,Ps;function fe(){if(Ps)return Yt;Ps=1;const e=ne();return Yt=(r,n,s)=>new e(r,s).compare(new e(n,s)),Yt}var Jt,Cs;function Ml(){if(Cs)return Jt;Cs=1;const e=fe();return Jt=(r,n,s)=>e(n,r,s),Jt}var Qt,Ns;function Ul(){if(Ns)return Qt;Ns=1;const e=fe();return Qt=(r,n)=>e(r,n,!0),Qt}var er,Ls;function tr(){if(Ls)return er;Ls=1;const e=ne();return er=(r,n,s)=>{const i=new e(r,s),o=new e(n,s);return i.compare(o)||i.compareBuild(o)},er}var rr,zs;function Bl(){if(zs)return rr;zs=1;const e=tr();return rr=(r,n)=>r.sort((s,i)=>e(s,i,n)),rr}var nr,Zs;function Fl(){if(Zs)return nr;Zs=1;const e=tr();return nr=(r,n)=>r.sort((s,i)=>e(i,s,n)),nr}var sr,Ds;function lt(){if(Ds)return sr;Ds=1;const e=fe();return sr=(r,n,s)=>e(r,n,s)>0,sr}var ir,js;function or(){if(js)return ir;js=1;const e=fe();return ir=(r,n,s)=>e(r,n,s)<0,ir}var ar,xs;function Ms(){if(xs)return ar;xs=1;const e=fe();return ar=(r,n,s)=>e(r,n,s)===0,ar}var ur,Us;function Bs(){if(Us)return ur;Us=1;const e=fe();return ur=(r,n,s)=>e(r,n,s)!==0,ur}var cr,Fs;function lr(){if(Fs)return cr;Fs=1;const e=fe();return cr=(r,n,s)=>e(r,n,s)>=0,cr}var fr,qs;function hr(){if(qs)return fr;qs=1;const e=fe();return fr=(r,n,s)=>e(r,n,s)<=0,fr}var dr,Gs;function Vs(){if(Gs)return dr;Gs=1;const e=Ms(),t=Bs(),r=lt(),n=lr(),s=or(),i=hr();return dr=(c,u,l,a)=>{switch(u){case"===":return typeof c=="object"&&(c=c.version),typeof l=="object"&&(l=l.version),c===l;case"!==":return typeof c=="object"&&(c=c.version),typeof l=="object"&&(l=l.version),c!==l;case"":case"=":case"==":return e(c,l,a);case"!=":return t(c,l,a);case">":return r(c,l,a);case">=":return n(c,l,a);case"<":return s(c,l,a);case"<=":return i(c,l,a);default:throw new TypeError(`Invalid operator: ${u}`)}},dr}var pr,Ws;function ql(){if(Ws)return pr;Ws=1;const e=ne(),t=ke(),{safeRe:r,t:n}=Fe();return pr=(i,o)=>{if(i instanceof e)return i;if(typeof i=="number"&&(i=String(i)),typeof i!="string")return null;o=o||{};let c=null;if(!o.rtl)c=i.match(o.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const p=o.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let $;for(;($=p.exec(i))&&(!c||c.index+c[0].length!==i.length);)(!c||$.index+$[0].length!==c.index+c[0].length)&&(c=$),p.lastIndex=$.index+$[1].length+$[2].length;p.lastIndex=-1}if(c===null)return null;const u=c[2],l=c[3]||"0",a=c[4]||"0",f=o.includePrerelease&&c[5]?`-${c[5]}`:"",h=o.includePrerelease&&c[6]?`+${c[6]}`:"";return t(`${u}.${l}.${a}${f}${h}`,o)},pr}var mr,Hs;function Gl(){if(Hs)return mr;Hs=1;const e=ke(),t=Be(),r=ne(),n=(c,u,l)=>{if(!t.RELEASE_TYPES.includes(u))return null;const a=s(c,l);return a&&i(a,u)},s=(c,u)=>{const l=c instanceof r?c.version:c;return e(l,u)},i=(c,u)=>{if(o(u))return c.version;switch(c.prerelease=[],u){case"major":c.minor=0,c.patch=0;break;case"minor":c.patch=0;break}return c.format()},o=c=>c.startsWith("pre");return mr=n,mr}var gr,Xs;function Vl(){if(Xs)return gr;Xs=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(r,n)}return this}}return gr=e,gr}var vr,Ks;function he(){if(Ks)return vr;Ks=1;const e=/\s+/g;class t{constructor(I,T){if(T=s(T),I instanceof t)return I.loose===!!T.loose&&I.includePrerelease===!!T.includePrerelease?I:new t(I.raw,T);if(I instanceof i)return this.raw=I.value,this.set=[[I]],this.formatted=void 0,this;if(this.options=T,this.loose=!!T.loose,this.includePrerelease=!!T.includePrerelease,this.raw=I.trim().replace(e," "),this.set=this.raw.split("||").map(R=>this.parseRange(R.trim())).filter(R=>R.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const R=this.set[0];if(this.set=this.set.filter(Z=>!E(Z[0])),this.set.length===0)this.set=[R];else if(this.set.length>1){for(const Z of this.set)if(Z.length===1&&y(Z[0])){this.set=[Z];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let I=0;I<this.set.length;I++){I>0&&(this.formatted+="||");const T=this.set[I];for(let R=0;R<T.length;R++)R>0&&(this.formatted+=" "),this.formatted+=T[R].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(I){I=I.replace(m,"");const R=((this.options.includePrerelease&&$)|(this.options.loose&&_))+":"+I,Z=n.get(R);if(Z)return Z;const O=this.options.loose,P=O?u[a.HYPHENRANGELOOSE]:u[a.HYPHENRANGE];I=I.replace(P,D(this.options.includePrerelease)),o("hyphen replace",I),I=I.replace(u[a.COMPARATORTRIM],f),o("comparator trim",I),I=I.replace(u[a.TILDETRIM],h),o("tilde trim",I),I=I.replace(u[a.CARETTRIM],p),o("caret trim",I);let B=I.split(" ").map(ee=>x(ee,this.options)).join(" ").split(/\s+/).map(ee=>k(ee,this.options));O&&(B=B.filter(ee=>(o("loose invalid filter",ee,this.options),!!ee.match(u[a.COMPARATORLOOSE])))),o("range list",B);const M=new Map,F=B.map(ee=>new i(ee,this.options));for(const ee of F){if(E(ee))return[ee];M.set(ee.value,ee)}M.size>1&&M.has("")&&M.delete("");const oe=[...M.values()];return n.set(R,oe),oe}intersects(I,T){if(!(I instanceof t))throw new TypeError("a Range is required");return this.set.some(R=>C(R,T)&&I.set.some(Z=>C(Z,T)&&R.every(O=>Z.every(P=>O.intersects(P,T)))))}test(I){if(!I)return!1;if(typeof I=="string")try{I=new c(I,this.options)}catch{return!1}for(let T=0;T<this.set.length;T++)if(j(this.set[T],I,this.options))return!0;return!1}}vr=t;const r=Vl(),n=new r,s=xt(),i=ft(),o=ct(),c=ne(),{safeRe:u,src:l,t:a,comparatorTrimReplace:f,tildeTrimReplace:h,caretTrimReplace:p}=Fe(),{FLAG_INCLUDE_PRERELEASE:$,FLAG_LOOSE:_}=Be(),m=new RegExp(l[a.BUILD],"g"),E=S=>S.value==="<0.0.0-0",y=S=>S.value==="",C=(S,I)=>{let T=!0;const R=S.slice();let Z=R.pop();for(;T&&R.length;)T=R.every(O=>Z.intersects(O,I)),Z=R.pop();return T},x=(S,I)=>(S=S.replace(u[a.BUILD],""),o("comp",S,I),S=L(S,I),o("caret",S),S=Q(S,I),o("tildes",S),S=v(S,I),o("xrange",S),S=w(S,I),o("stars",S),S),N=S=>!S||S.toLowerCase()==="x"||S==="*",U=(S,I,T)=>N(S)&&!N(I)||N(I)&&T&&!N(T),Q=(S,I)=>S.trim().split(/\s+/).map(T=>z(T,I)).join(" "),z=(S,I)=>{const T=I.loose?u[a.TILDELOOSE]:u[a.TILDE],R=I.includePrerelease?"-0":"";return S.replace(T,(Z,O,P,B,M)=>{o("tilde",S,Z,O,P,B,M);let F;return N(O)?F="":N(P)?F=`>=${O}.0.0${R} <${+O+1}.0.0-0`:N(B)?F=`>=${O}.${P}.0${R} <${O}.${+P+1}.0-0`:M?(o("replaceTilde pr",M),F=`>=${O}.${P}.${B}-${M} <${O}.${+P+1}.0-0`):F=`>=${O}.${P}.${B} <${O}.${+P+1}.0-0`,o("tilde return",F),F})},L=(S,I)=>S.trim().split(/\s+/).map(T=>d(T,I)).join(" "),d=(S,I)=>{o("caret",S,I);const T=I.loose?u[a.CARETLOOSE]:u[a.CARET],R=I.includePrerelease?"-0":"";return S.replace(T,(Z,O,P,B,M)=>{o("caret",S,Z,O,P,B,M);let F;return N(O)?F="":N(P)?F=`>=${O}.0.0${R} <${+O+1}.0.0-0`:N(B)?O==="0"?F=`>=${O}.${P}.0${R} <${O}.${+P+1}.0-0`:F=`>=${O}.${P}.0${R} <${+O+1}.0.0-0`:M?(o("replaceCaret pr",M),O==="0"?P==="0"?F=`>=${O}.${P}.${B}-${M} <${O}.${P}.${+B+1}-0`:F=`>=${O}.${P}.${B}-${M} <${O}.${+P+1}.0-0`:F=`>=${O}.${P}.${B}-${M} <${+O+1}.0.0-0`):(o("no pr"),O==="0"?P==="0"?F=`>=${O}.${P}.${B} <${O}.${P}.${+B+1}-0`:F=`>=${O}.${P}.${B} <${O}.${+P+1}.0-0`:F=`>=${O}.${P}.${B} <${+O+1}.0.0-0`),o("caret return",F),F})},v=(S,I)=>(o("replaceXRanges",S,I),S.split(/\s+/).map(T=>b(T,I)).join(" ")),b=(S,I)=>{S=S.trim();const T=I.loose?u[a.XRANGELOOSE]:u[a.XRANGE];return S.replace(T,(R,Z,O,P,B,M)=>{if(o("xRange",S,R,Z,O,P,B,M),U(O,P,B))return S;const F=N(O),oe=F||N(P),ee=oe||N(B),qe=ee;return Z==="="&&qe&&(Z=""),M=I.includePrerelease?"-0":"",F?Z===">"||Z==="<"?R="<0.0.0-0":R="*":Z&&qe?(oe&&(P=0),B=0,Z===">"?(Z=">=",oe?(O=+O+1,P=0,B=0):(P=+P+1,B=0)):Z==="<="&&(Z="<",oe?O=+O+1:P=+P+1),Z==="<"&&(M="-0"),R=`${Z+O}.${P}.${B}${M}`):oe?R=`>=${O}.0.0${M} <${+O+1}.0.0-0`:ee&&(R=`>=${O}.${P}.0${M} <${O}.${+P+1}.0-0`),o("xRange return",R),R})},w=(S,I)=>(o("replaceStars",S,I),S.trim().replace(u[a.STAR],"")),k=(S,I)=>(o("replaceGTE0",S,I),S.trim().replace(u[I.includePrerelease?a.GTE0PRE:a.GTE0],"")),D=S=>(I,T,R,Z,O,P,B,M,F,oe,ee,qe)=>(N(R)?T="":N(Z)?T=`>=${R}.0.0${S?"-0":""}`:N(O)?T=`>=${R}.${Z}.0${S?"-0":""}`:P?T=`>=${T}`:T=`>=${T}${S?"-0":""}`,N(F)?M="":N(oe)?M=`<${+F+1}.0.0-0`:N(ee)?M=`<${F}.${+oe+1}.0-0`:qe?M=`<=${F}.${oe}.${ee}-${qe}`:S?M=`<${F}.${oe}.${+ee+1}-0`:M=`<=${M}`,`${T} ${M}`.trim()),j=(S,I,T)=>{for(let R=0;R<S.length;R++)if(!S[R].test(I))return!1;if(I.prerelease.length&&!T.includePrerelease){for(let R=0;R<S.length;R++)if(o(S[R].semver),S[R].semver!==i.ANY&&S[R].semver.prerelease.length>0){const Z=S[R].semver;if(Z.major===I.major&&Z.minor===I.minor&&Z.patch===I.patch)return!0}return!1}return!0};return vr}var _r,Ys;function ft(){if(Ys)return _r;Ys=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(a,f){if(f=r(f),a instanceof t){if(a.loose===!!f.loose)return a;a=a.value}a=a.trim().split(/\s+/).join(" "),o("comparator",a,f),this.options=f,this.loose=!!f.loose,this.parse(a),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(a){const f=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],h=a.match(f);if(!h)throw new TypeError(`Invalid comparator: ${a}`);this.operator=h[1]!==void 0?h[1]:"",this.operator==="="&&(this.operator=""),h[2]?this.semver=new c(h[2],this.options.loose):this.semver=e}toString(){return this.value}test(a){if(o("Comparator.test",a,this.options.loose),this.semver===e||a===e)return!0;if(typeof a=="string")try{a=new c(a,this.options)}catch{return!1}return i(a,this.operator,this.semver,this.options)}intersects(a,f){if(!(a instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new u(a.value,f).test(this.value):a.operator===""?a.value===""?!0:new u(this.value,f).test(a.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||a.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||a.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&a.operator.startsWith(">")||this.operator.startsWith("<")&&a.operator.startsWith("<")||this.semver.version===a.semver.version&&this.operator.includes("=")&&a.operator.includes("=")||i(this.semver,"<",a.semver,f)&&this.operator.startsWith(">")&&a.operator.startsWith("<")||i(this.semver,">",a.semver,f)&&this.operator.startsWith("<")&&a.operator.startsWith(">")))}}_r=t;const r=xt(),{safeRe:n,t:s}=Fe(),i=Vs(),o=ct(),c=ne(),u=he();return _r}var Er,Js;function ht(){if(Js)return Er;Js=1;const e=he();return Er=(r,n,s)=>{try{n=new e(n,s)}catch{return!1}return n.test(r)},Er}var br,Qs;function Wl(){if(Qs)return br;Qs=1;const e=he();return br=(r,n)=>new e(r,n).set.map(s=>s.map(i=>i.value).join(" ").trim().split(" ")),br}var wr,ei;function Hl(){if(ei)return wr;ei=1;const e=ne(),t=he();return wr=(n,s,i)=>{let o=null,c=null,u=null;try{u=new t(s,i)}catch{return null}return n.forEach(l=>{u.test(l)&&(!o||c.compare(l)===-1)&&(o=l,c=new e(o,i))}),o},wr}var Sr,ti;function Xl(){if(ti)return Sr;ti=1;const e=ne(),t=he();return Sr=(n,s,i)=>{let o=null,c=null,u=null;try{u=new t(s,i)}catch{return null}return n.forEach(l=>{u.test(l)&&(!o||c.compare(l)===1)&&(o=l,c=new e(o,i))}),o},Sr}var Ir,ri;function Kl(){if(ri)return Ir;ri=1;const e=ne(),t=he(),r=lt();return Ir=(s,i)=>{s=new t(s,i);let o=new e("0.0.0");if(s.test(o)||(o=new e("0.0.0-0"),s.test(o)))return o;o=null;for(let c=0;c<s.set.length;++c){const u=s.set[c];let l=null;u.forEach(a=>{const f=new e(a.semver.version);switch(a.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!l||r(f,l))&&(l=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),l&&(!o||r(o,l))&&(o=l)}return o&&s.test(o)?o:null},Ir}var $r,ni;function Yl(){if(ni)return $r;ni=1;const e=he();return $r=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},$r}var yr,si;function Rr(){if(si)return yr;si=1;const e=ne(),t=ft(),{ANY:r}=t,n=he(),s=ht(),i=lt(),o=or(),c=hr(),u=lr();return yr=(a,f,h,p)=>{a=new e(a,p),f=new n(f,p);let $,_,m,E,y;switch(h){case">":$=i,_=c,m=o,E=">",y=">=";break;case"<":$=o,_=u,m=i,E="<",y="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(a,f,p))return!1;for(let C=0;C<f.set.length;++C){const x=f.set[C];let N=null,U=null;if(x.forEach(Q=>{Q.semver===r&&(Q=new t(">=0.0.0")),N=N||Q,U=U||Q,$(Q.semver,N.semver,p)?N=Q:m(Q.semver,U.semver,p)&&(U=Q)}),N.operator===E||N.operator===y||(!U.operator||U.operator===E)&&_(a,U.semver))return!1;if(U.operator===y&&m(a,U.semver))return!1}return!0},yr}var Ar,ii;function Jl(){if(ii)return Ar;ii=1;const e=Rr();return Ar=(r,n,s)=>e(r,n,">",s),Ar}var Tr,oi;function Ql(){if(oi)return Tr;oi=1;const e=Rr();return Tr=(r,n,s)=>e(r,n,"<",s),Tr}var Or,ai;function ef(){if(ai)return Or;ai=1;const e=he();return Or=(r,n,s)=>(r=new e(r,s),n=new e(n,s),r.intersects(n,s)),Or}var kr,ui;function tf(){if(ui)return kr;ui=1;const e=ht(),t=fe();return kr=(r,n,s)=>{const i=[];let o=null,c=null;const u=r.sort((h,p)=>t(h,p,s));for(const h of u)e(h,n,s)?(c=h,o||(o=h)):(c&&i.push([o,c]),c=null,o=null);o&&i.push([o,null]);const l=[];for(const[h,p]of i)h===p?l.push(h):!p&&h===u[0]?l.push("*"):p?h===u[0]?l.push(`<=${p}`):l.push(`${h} - ${p}`):l.push(`>=${h}`);const a=l.join(" || "),f=typeof n.raw=="string"?n.raw:String(n);return a.length<f.length?a:n},kr}var Pr,ci;function rf(){if(ci)return Pr;ci=1;const e=he(),t=ft(),{ANY:r}=t,n=ht(),s=fe(),i=(f,h,p={})=>{if(f===h)return!0;f=new e(f,p),h=new e(h,p);let $=!1;e:for(const _ of f.set){for(const m of h.set){const E=u(_,m,p);if($=$||E!==null,E)continue e}if($)return!1}return!0},o=[new t(">=0.0.0-0")],c=[new t(">=0.0.0")],u=(f,h,p)=>{if(f===h)return!0;if(f.length===1&&f[0].semver===r){if(h.length===1&&h[0].semver===r)return!0;p.includePrerelease?f=o:f=c}if(h.length===1&&h[0].semver===r){if(p.includePrerelease)return!0;h=c}const $=new Set;let _,m;for(const z of f)z.operator===">"||z.operator===">="?_=l(_,z,p):z.operator==="<"||z.operator==="<="?m=a(m,z,p):$.add(z.semver);if($.size>1)return null;let E;if(_&&m){if(E=s(_.semver,m.semver,p),E>0)return null;if(E===0&&(_.operator!==">="||m.operator!=="<="))return null}for(const z of $){if(_&&!n(z,String(_),p)||m&&!n(z,String(m),p))return null;for(const L of h)if(!n(z,String(L),p))return!1;return!0}let y,C,x,N,U=m&&!p.includePrerelease&&m.semver.prerelease.length?m.semver:!1,Q=_&&!p.includePrerelease&&_.semver.prerelease.length?_.semver:!1;U&&U.prerelease.length===1&&m.operator==="<"&&U.prerelease[0]===0&&(U=!1);for(const z of h){if(N=N||z.operator===">"||z.operator===">=",x=x||z.operator==="<"||z.operator==="<=",_){if(Q&&z.semver.prerelease&&z.semver.prerelease.length&&z.semver.major===Q.major&&z.semver.minor===Q.minor&&z.semver.patch===Q.patch&&(Q=!1),z.operator===">"||z.operator===">="){if(y=l(_,z,p),y===z&&y!==_)return!1}else if(_.operator===">="&&!z.test(_.semver))return!1}if(m){if(U&&z.semver.prerelease&&z.semver.prerelease.length&&z.semver.major===U.major&&z.semver.minor===U.minor&&z.semver.patch===U.patch&&(U=!1),z.operator==="<"||z.operator==="<="){if(C=a(m,z,p),C===z&&C!==m)return!1}else if(m.operator==="<="&&!z.test(m.semver))return!1}if(!z.operator&&(m||_)&&E!==0)return!1}return!(_&&x&&!m&&E!==0||m&&N&&!_&&E!==0||Q||U)},l=(f,h,p)=>{if(!f)return h;const $=s(f.semver,h.semver,p);return $>0?f:$<0||h.operator===">"&&f.operator===">="?h:f},a=(f,h,p)=>{if(!f)return h;const $=s(f.semver,h.semver,p);return $<0?f:$>0||h.operator==="<"&&f.operator==="<="?h:f};return Pr=i,Pr}var Cr,li;function nf(){if(li)return Cr;li=1;const e=Fe(),t=Be(),r=ne(),n=bs(),s=ke(),i=Cl(),o=Nl(),c=Ll(),u=zl(),l=Zl(),a=Dl(),f=jl(),h=xl(),p=fe(),$=Ml(),_=Ul(),m=tr(),E=Bl(),y=Fl(),C=lt(),x=or(),N=Ms(),U=Bs(),Q=lr(),z=hr(),L=Vs(),d=ql(),v=Gl(),b=ft(),w=he(),k=ht(),D=Wl(),j=Hl(),S=Xl(),I=Kl(),T=Yl(),R=Rr(),Z=Jl(),O=Ql(),P=ef(),B=tf(),M=rf();return Cr={parse:s,valid:i,clean:o,inc:c,diff:u,major:l,minor:a,patch:f,prerelease:h,compare:p,rcompare:$,compareLoose:_,compareBuild:m,sort:E,rsort:y,gt:C,lt:x,eq:N,neq:U,gte:Q,lte:z,cmp:L,coerce:d,truncate:v,Comparator:b,Range:w,satisfies:k,toComparators:D,maxSatisfying:j,minSatisfying:S,minVersion:I,validRange:T,outside:R,gtr:Z,ltr:O,intersects:P,simplifyRange:B,subset:M,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},Cr}var sf=nf();const Nr=yl(sf),fi=Se(te().min(1)).refine(e=>new Set(e).size===e.length,{message:"Array items must be unique"});function hi(e){const t=e({type:G("string")}),r=e({type:G("number"),integer:G(!0).optional(),min:re().optional(),max:re().optional()}),n=e({type:G("boolean")}),s=e({type:G("option"),options:fi}),i=de([t,r,n,s]),o=(E,y)=>y?E.optional():E,c=E=>e({type:G("string"),default:o(te(),!E.defaultRequired)}),u=E=>e({type:G("number"),integer:Ze().optional(),min:re().optional(),max:re().optional(),default:o(re(),!E.defaultRequired)}),l=E=>e({type:G("boolean"),default:o(Ze(),!E.defaultRequired)}),a=E=>e({type:G("option"),options:fi.optional(),default:o(te(),!E.defaultRequired)}),f=E=>de([c(E),u(E),l(E),a(E)]),h=e({name:te().min(1),value:f({defaultRequired:!1})}),p=e({name:te().min(1),value:i.optional()}),$=e({name:te().min(1),value:f({defaultRequired:!0}),writableFromCogs:G(!0).optional(),writableFromClient:G(!0).optional()}),_=E=>{try{return new ps(E),!0}catch{return!1}};return e({version:de([rt([ge()]),rt([ge(),G("."),ge()]),rt([ge(),G("."),ge(),G("."),ge()])]),name:te(),minCogsVersion:rt([ge(),G("."),ge(),G("."),ge()]).optional(),description:te().optional(),icon:te().optional(),indexPath:te().optional(),window:q({width:re().gt(0).int(),height:re().gt(0).int(),visible:Ze().optional()}).optional(),config:Se(h).optional(),events:q({fromCogs:Se(p).optional(),toCogs:Se(p).optional()}).optional(),state:Se($).optional(),media:q({audio:G(!0).optional(),video:G(!0).optional(),images:G(!0).optional()}).optional(),store:q({items:Zn(te(),e({persistValue:Ze().optional()})).optional()}).optional(),permissions:At({network:At({access:Se(e({hosts:Se(te().refine(_,{error:"Invalid network host pattern"})).min(1),caCertificate:te().optional()})).optional()}).optional()}).optional()}).refine(E=>!!(!E.permissions?.network?.access||E.minCogsVersion&&Nr.gte(E.minCogsVersion,"5.11.0")),{path:["permissions","network","access"],message:"minCogsVersion must be at least 5.11.0"})}const of=hi(q),af=hi(At);function uf(e){let t=of;typeof e=="object"&&e.minCogsVersion&&Nr.valid(e.minCogsVersion)&&Nr.gte(e.minCogsVersion,"5.11.0")&&(t=af);const r=t.safeParse(e);return r.success?null:r.error.issues.map(n=>`${n.path.join(".")||"root"}: ${n.message}`)}H.CogsConfigChangedEvent=Ur,H.CogsConnection=ki,H.CogsConnectionCloseEvent=xr,H.CogsConnectionOpenEvent=jr,H.CogsIncomingEvent=Fr,H.CogsMediaConfigChangedEvent=qr,H.CogsMessageEvent=Mr,H.CogsShowPhaseChangedEvent=Gr,H.CogsStateChangedEvent=Br,H.DataStoreItemEvent=pt,H.DataStoreItemsEvent=mt,H.ManifestTypes=Pl,H.MediaPreloader=es,H.MediaSchema=hl,H.NetworkHostPattern=ps,H.SurfaceManager=$l,H.assetUrl=Dr,H.getPluginManifestErrors=uf,H.getStateAtTime=st,H.preloadUrl=wi,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
38
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");const y=p.compile();return(C,x)=>y(h,C,x)};let i;const o=Ge,c=!Wr.jitless,l=c&&zi.value,a=t.catchall;let f;e._zod.parse=(h,p)=>{f??(f=n.value);const $=h.value;return o($)?c&&l&&p?.async===!1&&p.jitless!==!0?(i||(i=s(t.shape)),h=i(h,p),a?dn([],$,h,p,f,e):h):r(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:$,inst:e}),h)}});function pn(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const s=e.filter(i=>!Le(i));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(o=>Se(o,n,be())))}),t)}const Ra=g("$ZodUnion",(e,t)=>{V.init(e,t),W(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),W(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),W(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),W(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${s.map(i=>Et(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(s,i)=>{if(r)return n(s,i);let o=!1;const c=[];for(const u of t.options){const l=u._zod.run({value:s.value,issues:[]},i);if(l instanceof Promise)c.push(l),o=!0;else{if(l.issues.length===0)return l;c.push(l)}}return o?Promise.all(c).then(u=>pn(u,s,e,i)):pn(c,s,e,i)}}),Aa=g("$ZodIntersection",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{const s=r.value,i=t.left._zod.run({value:s,issues:[]},n),o=t.right._zod.run({value:s,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([u,l])=>mn(r,u,l)):mn(r,i,o)}});function $t(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(Ne(e)&&Ne(t)){const r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),s={...e,...t};for(const i of n){const o=$t(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};s[i]=o.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const s=e[n],i=t[n],o=$t(s,i);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function mn(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Le(e))return e;const n=$t(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const Ta=g("$ZodTuple",(e,t)=>{V.init(e,t);const r=t.items;e._zod.parse=(n,s)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];const o=[],c=[...r].reverse().findIndex(a=>a._zod.optin!=="optional"),u=c===-1?0:r.length-c;if(!t.rest){const a=i.length>r.length,f=i.length<u-1;if(a||f)return n.issues.push({...a?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),n}let l=-1;for(const a of r){if(l++,l>=i.length&&l>=u)continue;const f=a._zod.run({value:i[l],issues:[]},s);f instanceof Promise?o.push(f.then(h=>Ye(h,n,l))):Ye(f,n,l)}if(t.rest){const a=i.slice(r.length);for(const f of a){l++;const h=t.rest._zod.run({value:f,issues:[]},s);h instanceof Promise?o.push(h.then(p=>Ye(p,n,l))):Ye(h,n,l)}}return o.length?Promise.all(o).then(()=>n):n}});function Ye(e,t,r){e.issues.length&&t.issues.push(...Oe(r,e.issues)),t.value[r]=e.value}const Oa=g("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!Ne(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const i=[],o=t.keyType._zod.values;if(o){r.value={};const c=new Set;for(const l of o)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){c.add(typeof l=="number"?l.toString():l);const a=t.valueType._zod.run({value:s[l],issues:[]},n);a instanceof Promise?i.push(a.then(f=>{f.issues.length&&r.issues.push(...Oe(l,f.issues)),r.value[l]=f.value})):(a.issues.length&&r.issues.push(...Oe(l,a.issues)),r.value[l]=a.value)}let u;for(const l in s)c.has(l)||(u=u??[],u.push(l));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u})}else{r.value={};for(const c of Reflect.ownKeys(s)){if(c==="__proto__")continue;const u=t.keyType._zod.run({value:c,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(a=>Se(a,n,be())),input:c,path:[c],inst:e}),r.value[u.value]=u.value;continue}const l=t.valueType._zod.run({value:s[c],issues:[]},n);l instanceof Promise?i.push(l.then(a=>{a.issues.length&&r.issues.push(...Oe(c,a.issues)),r.value[u.value]=a.value})):(l.issues.length&&r.issues.push(...Oe(c,l.issues)),r.value[u.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),ka=g("$ZodEnum",(e,t)=>{V.init(e,t);const r=Ci(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(s=>Zi.has(typeof s)).map(s=>typeof s=="string"?Te(s):s.toString()).join("|")})$`),e._zod.parse=(s,i)=>{const o=s.value;return n.has(o)||s.issues.push({code:"invalid_value",values:r,input:o,inst:e}),s}}),Pa=g("$ZodLiteral",(e,t)=>{if(V.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?Te(n):n?Te(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,s)=>{const i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),Ca=g("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Vr(e.constructor.name);const s=t.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(o=>(r.value=o,r));if(s instanceof Promise)throw new Ce;return r.value=s,r}});function gn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Na=g("$ZodOptional",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.optout="optional",W(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),W(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Et(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>gn(i,r.value)):gn(s,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),La=g("$ZodNullable",(e,t)=>{V.init(e,t),W(e._zod,"optin",()=>t.innerType._zod.optin),W(e._zod,"optout",()=>t.innerType._zod.optout),W(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Et(r.source)}|null)$`):void 0}),W(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),za=g("$ZodDefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",W(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>vn(i,t)):vn(s,t)}});function vn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Za=g("$ZodPrefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",W(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Da=g("$ZodNonOptional",(e,t)=>{V.init(e,t),W(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>_n(i,e)):_n(s,e)}});function _n(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const ja=g("$ZodCatch",(e,t)=>{V.init(e,t),W(e._zod,"optin",()=>t.innerType._zod.optin),W(e._zod,"optout",()=>t.innerType._zod.optout),W(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(o=>Se(o,n,be()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Se(i,n,be()))},input:r.value}),r.issues=[]),r)}}),xa=g("$ZodPipe",(e,t)=>{V.init(e,t),W(e._zod,"values",()=>t.in._zod.values),W(e._zod,"optin",()=>t.in._zod.optin),W(e._zod,"optout",()=>t.out._zod.optout),W(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);return i instanceof Promise?i.then(o=>Je(o,t.in,n)):Je(i,t.in,n)}const s=t.in._zod.run(r,n);return s instanceof Promise?s.then(i=>Je(i,t.out,n)):Je(s,t.out,n)}});function Je(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Ma=g("$ZodReadonly",(e,t)=>{V.init(e,t),W(e._zod,"propValues",()=>t.innerType._zod.propValues),W(e._zod,"values",()=>t.innerType._zod.values),W(e._zod,"optin",()=>t.innerType?._zod?.optin),W(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(En):En(s)}});function En(e){return e.value=Object.freeze(e.value),e}const Ua=g("$ZodTemplateLiteral",(e,t)=>{V.init(e,t);const r=[];for(const n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);const s=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!s)throw new Error(`Invalid template literal part: ${n._zod.traits}`);const i=s.startsWith("^")?1:0,o=s.endsWith("$")?s.length-1:s.length;r.push(s.slice(i,o))}else if(n===null||Di.has(typeof n))r.push(Te(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,s)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"template_literal",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Ba=g("$ZodCustom",(e,t)=>{ie.init(e,t),V.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,s=t.fn(n);if(s instanceof Promise)return s.then(i=>bn(i,r,n,e));bn(s,r,n,e)}});function bn(e,t,r,n){if(!e){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),t.issues.push(Me(s))}}var wn;class Fa{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const 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){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const s={...n,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function qa(){return new Fa}(wn=globalThis).__zod_globalRegistry??(wn.__zod_globalRegistry=qa());const Qe=globalThis.__zod_globalRegistry;function Ga(e,t){return new e({type:"string",...A(t)})}function Va(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...A(t)})}function Sn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...A(t)})}function Wa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...A(t)})}function Ha(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(t)})}function Xa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(t)})}function Ka(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(t)})}function Ya(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...A(t)})}function Ja(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...A(t)})}function Qa(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(t)})}function eu(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...A(t)})}function tu(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(t)})}function ru(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...A(t)})}function nu(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...A(t)})}function su(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(t)})}function iu(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(t)})}function ou(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(t)})}function au(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(t)})}function uu(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(t)})}function cu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...A(t)})}function lu(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...A(t)})}function fu(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...A(t)})}function hu(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...A(t)})}function du(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(t)})}function pu(e,t){return new e({type:"string",format:"date",check:"string_format",...A(t)})}function mu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...A(t)})}function gu(e,t){return new e({type:"string",format:"duration",check:"string_format",...A(t)})}function vu(e,t){return new e({type:"number",checks:[],...A(t)})}function _u(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...A(t)})}function Eu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...A(t)})}function bu(e,t){return new e({type:"boolean",...A(t)})}function wu(e,t){return new e({type:"null",...A(t)})}function Su(e){return new e({type:"unknown"})}function Iu(e,t){return new e({type:"never",...A(t)})}function In(e,t){return new an({check:"less_than",...A(t),value:e,inclusive:!1})}function yt(e,t){return new an({check:"less_than",...A(t),value:e,inclusive:!0})}function $n(e,t){return new un({check:"greater_than",...A(t),value:e,inclusive:!1})}function Rt(e,t){return new un({check:"greater_than",...A(t),value:e,inclusive:!0})}function yn(e,t){return new No({check:"multiple_of",...A(t),value:e})}function Rn(e,t){return new zo({check:"max_length",...A(t),maximum:e})}function et(e,t){return new Zo({check:"min_length",...A(t),minimum:e})}function An(e,t){return new Do({check:"length_equals",...A(t),length:e})}function $u(e,t){return new jo({check:"string_format",format:"regex",...A(t),pattern:e})}function yu(e){return new xo({check:"string_format",format:"lowercase",...A(e)})}function Ru(e){return new Mo({check:"string_format",format:"uppercase",...A(e)})}function Au(e,t){return new Uo({check:"string_format",format:"includes",...A(t),includes:e})}function Tu(e,t){return new Bo({check:"string_format",format:"starts_with",...A(t),prefix:e})}function Ou(e,t){return new Fo({check:"string_format",format:"ends_with",...A(t),suffix:e})}function ze(e){return new qo({check:"overwrite",tx:e})}function ku(e){return ze(t=>t.normalize(e))}function Pu(){return ze(e=>e.trim())}function Cu(){return ze(e=>e.toLowerCase())}function Nu(){return ze(e=>e.toUpperCase())}function Lu(){return ze(e=>Li(e))}function zu(e,t,r){return new e({type:"array",element:t,...A(r)})}function Zu(e,t,r){return new e({type:"custom",check:"custom",fn:t,...A(r)})}function Du(e){const t=ju(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Me(n,r.value,t._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),r.issues.push(Me(s))}},e(r.value,r)));return t}function ju(e,t){const r=new ie({check:"custom",...A(t)});return r._zod.check=e,r}const xu=g("ZodISODateTime",(e,t)=>{sa.init(e,t),Y.init(e,t)});function Mu(e){return du(xu,e)}const Uu=g("ZodISODate",(e,t)=>{ia.init(e,t),Y.init(e,t)});function Bu(e){return pu(Uu,e)}const Fu=g("ZodISOTime",(e,t)=>{oa.init(e,t),Y.init(e,t)});function qu(e){return mu(Fu,e)}const Gu=g("ZodISODuration",(e,t)=>{aa.init(e,t),Y.init(e,t)});function Vu(e){return gu(Gu,e)}const ae=g("ZodError",(e,t)=>{Qr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Hi(e,r)},flatten:{value:r=>Wi(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,gt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,gt,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Wu=wt(ae),Hu=St(ae),Xu=We(ae),Ku=He(ae),Yu=Yi(ae),Ju=Ji(ae),Qu=Qi(ae),ec=eo(ae),tc=to(ae),rc=ro(ae),nc=no(ae),sc=so(ae),X=g("ZodType",(e,t)=>(V.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Ae(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>we(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>Wu(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Xu(e,r,n),e.parseAsync=async(r,n)=>Hu(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Ku(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Yu(e,r,n),e.decode=(r,n)=>Ju(e,r,n),e.encodeAsync=async(r,n)=>Qu(e,r,n),e.decodeAsync=async(r,n)=>ec(e,r,n),e.safeEncode=(r,n)=>tc(e,r,n),e.safeDecode=(r,n)=>rc(e,r,n),e.safeEncodeAsync=async(r,n)=>nc(e,r,n),e.safeDecodeAsync=async(r,n)=>sc(e,r,n),e.refine=(r,n)=>e.check(Yc(r,n)),e.superRefine=r=>e.check(Jc(r)),e.overwrite=r=>e.check(ze(r)),e.optional=()=>jn(e),e.nullable=()=>xn(e),e.nullish=()=>jn(xn(e)),e.nonoptional=r=>Fc(e,r),e.array=()=>ve(e),e.or=r=>de([e,r]),e.and=r=>Pc(e,r),e.transform=r=>Un(e,Dc(r)),e.default=r=>Mc(e,r),e.prefault=r=>Bc(e,r),e.catch=r=>Gc(e,r),e.pipe=r=>Un(e,r),e.readonly=()=>Hc(e),e.describe=r=>{const n=e.clone();return Qe.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Qe.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Qe.get(e);const n=e.clone();return Qe.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Tn=g("_ZodString",(e,t)=>{It.init(e,t),X.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check($u(...n)),e.includes=(...n)=>e.check(Au(...n)),e.startsWith=(...n)=>e.check(Tu(...n)),e.endsWith=(...n)=>e.check(Ou(...n)),e.min=(...n)=>e.check(et(...n)),e.max=(...n)=>e.check(Rn(...n)),e.length=(...n)=>e.check(An(...n)),e.nonempty=(...n)=>e.check(et(1,...n)),e.lowercase=n=>e.check(yu(n)),e.uppercase=n=>e.check(Ru(n)),e.trim=()=>e.check(Pu()),e.normalize=(...n)=>e.check(ku(...n)),e.toLowerCase=()=>e.check(Cu()),e.toUpperCase=()=>e.check(Nu()),e.slugify=()=>e.check(Lu())}),ic=g("ZodString",(e,t)=>{It.init(e,t),Tn.init(e,t),e.email=r=>e.check(Va(oc,r)),e.url=r=>e.check(Ya(ac,r)),e.jwt=r=>e.check(hu(Sc,r)),e.emoji=r=>e.check(Ja(uc,r)),e.guid=r=>e.check(Sn(On,r)),e.uuid=r=>e.check(Wa(tt,r)),e.uuidv4=r=>e.check(Ha(tt,r)),e.uuidv6=r=>e.check(Xa(tt,r)),e.uuidv7=r=>e.check(Ka(tt,r)),e.nanoid=r=>e.check(Qa(cc,r)),e.guid=r=>e.check(Sn(On,r)),e.cuid=r=>e.check(eu(lc,r)),e.cuid2=r=>e.check(tu(fc,r)),e.ulid=r=>e.check(ru(hc,r)),e.base64=r=>e.check(cu(Ec,r)),e.base64url=r=>e.check(lu(bc,r)),e.xid=r=>e.check(nu(dc,r)),e.ksuid=r=>e.check(su(pc,r)),e.ipv4=r=>e.check(iu(mc,r)),e.ipv6=r=>e.check(ou(gc,r)),e.cidrv4=r=>e.check(au(vc,r)),e.cidrv6=r=>e.check(uu(_c,r)),e.e164=r=>e.check(fu(wc,r)),e.datetime=r=>e.check(Mu(r)),e.date=r=>e.check(Bu(r)),e.time=r=>e.check(qu(r)),e.duration=r=>e.check(Vu(r))});function te(e){return Ga(ic,e)}const Y=g("ZodStringFormat",(e,t)=>{K.init(e,t),Tn.init(e,t)}),oc=g("ZodEmail",(e,t)=>{Xo.init(e,t),Y.init(e,t)}),On=g("ZodGUID",(e,t)=>{Wo.init(e,t),Y.init(e,t)}),tt=g("ZodUUID",(e,t)=>{Ho.init(e,t),Y.init(e,t)}),ac=g("ZodURL",(e,t)=>{Ko.init(e,t),Y.init(e,t)}),uc=g("ZodEmoji",(e,t)=>{Yo.init(e,t),Y.init(e,t)}),cc=g("ZodNanoID",(e,t)=>{Jo.init(e,t),Y.init(e,t)}),lc=g("ZodCUID",(e,t)=>{Qo.init(e,t),Y.init(e,t)}),fc=g("ZodCUID2",(e,t)=>{ea.init(e,t),Y.init(e,t)}),hc=g("ZodULID",(e,t)=>{ta.init(e,t),Y.init(e,t)}),dc=g("ZodXID",(e,t)=>{ra.init(e,t),Y.init(e,t)}),pc=g("ZodKSUID",(e,t)=>{na.init(e,t),Y.init(e,t)}),mc=g("ZodIPv4",(e,t)=>{ua.init(e,t),Y.init(e,t)}),gc=g("ZodIPv6",(e,t)=>{ca.init(e,t),Y.init(e,t)}),vc=g("ZodCIDRv4",(e,t)=>{la.init(e,t),Y.init(e,t)}),_c=g("ZodCIDRv6",(e,t)=>{fa.init(e,t),Y.init(e,t)}),Ec=g("ZodBase64",(e,t)=>{ha.init(e,t),Y.init(e,t)}),bc=g("ZodBase64URL",(e,t)=>{pa.init(e,t),Y.init(e,t)}),wc=g("ZodE164",(e,t)=>{ma.init(e,t),Y.init(e,t)}),Sc=g("ZodJWT",(e,t)=>{va.init(e,t),Y.init(e,t)}),kn=g("ZodNumber",(e,t)=>{ln.init(e,t),X.init(e,t),e.gt=(n,s)=>e.check($n(n,s)),e.gte=(n,s)=>e.check(Rt(n,s)),e.min=(n,s)=>e.check(Rt(n,s)),e.lt=(n,s)=>e.check(In(n,s)),e.lte=(n,s)=>e.check(yt(n,s)),e.max=(n,s)=>e.check(yt(n,s)),e.int=n=>e.check(Cn(n)),e.safe=n=>e.check(Cn(n)),e.positive=n=>e.check($n(0,n)),e.nonnegative=n=>e.check(Rt(0,n)),e.negative=n=>e.check(In(0,n)),e.nonpositive=n=>e.check(yt(0,n)),e.multipleOf=(n,s)=>e.check(yn(n,s)),e.step=(n,s)=>e.check(yn(n,s)),e.finite=()=>e;const 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 re(e){return vu(kn,e)}const Pn=g("ZodNumberFormat",(e,t)=>{_a.init(e,t),kn.init(e,t)});function Cn(e){return _u(Pn,e)}function ge(e){return Eu(Pn,e)}const Ic=g("ZodBoolean",(e,t)=>{Ea.init(e,t),X.init(e,t)});function Ze(e){return bu(Ic,e)}const $c=g("ZodNull",(e,t)=>{ba.init(e,t),X.init(e,t)});function yc(e){return wu($c,e)}const Rc=g("ZodUnknown",(e,t)=>{wa.init(e,t),X.init(e,t)});function Nn(){return Su(Rc)}const Ac=g("ZodNever",(e,t)=>{Sa.init(e,t),X.init(e,t)});function Ln(e){return Iu(Ac,e)}const Tc=g("ZodArray",(e,t)=>{Ia.init(e,t),X.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(et(r,n)),e.nonempty=r=>e.check(et(1,r)),e.max=(r,n)=>e.check(Rn(r,n)),e.length=(r,n)=>e.check(An(r,n)),e.unwrap=()=>e.element});function ve(e,t){return zu(Tc,e,t)}const zn=g("ZodObject",(e,t)=>{ya.init(e,t),X.init(e,t),W(e,"shape",()=>t.shape),e.keyof=()=>Lc(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Nn()}),e.loose=()=>e.clone({...e._zod.def,catchall:Nn()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ln()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Bi(e,r),e.safeExtend=r=>Fi(e,r),e.merge=r=>qi(e,r),e.pick=r=>Mi(e,r),e.omit=r=>Ui(e,r),e.partial=(...r)=>Gi(Dn,e,r[0]),e.required=(...r)=>Vi(Mn,e,r[0])});function q(e,t){const r={type:"object",shape:e??{},...A(t)};return new zn(r)}function At(e,t){return new zn({type:"object",shape:e,catchall:Ln(),...A(t)})}const Oc=g("ZodUnion",(e,t)=>{Ra.init(e,t),X.init(e,t),e.options=t.options});function de(e,t){return new Oc({type:"union",options:e,...A(t)})}const kc=g("ZodIntersection",(e,t)=>{Aa.init(e,t),X.init(e,t)});function Pc(e,t){return new kc({type:"intersection",left:e,right:t})}const Cc=g("ZodTuple",(e,t)=>{Ta.init(e,t),X.init(e,t),e.rest=r=>e.clone({...e._zod.def,rest:r})});function pe(e,t,r){const n=t instanceof V,s=n?r:t,i=n?t:null;return new Cc({type:"tuple",items:e,rest:i,...A(s)})}const Nc=g("ZodRecord",(e,t)=>{Oa.init(e,t),X.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Zn(e,t,r){return new Nc({type:"record",keyType:e,valueType:t,...A(r)})}const Tt=g("ZodEnum",(e,t)=>{ka.init(e,t),X.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{const i={};for(const o of n)if(r.has(o))i[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Tt({...t,checks:[],...A(s),entries:i})},e.exclude=(n,s)=>{const i={...t.entries};for(const o of n)if(r.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new Tt({...t,checks:[],...A(s),entries:i})}});function Lc(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Tt({type:"enum",entries:r,...A(t)})}const zc=g("ZodLiteral",(e,t)=>{Pa.init(e,t),X.init(e,t),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 G(e,t){return new zc({type:"literal",values:Array.isArray(e)?e:[e],...A(t)})}const Zc=g("ZodTransform",(e,t)=>{Ca.init(e,t),X.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Vr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Me(i,r.value,t));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),r.issues.push(Me(o))}};const s=t.transform(r.value,r);return s instanceof Promise?s.then(i=>(r.value=i,r)):(r.value=s,r)}});function Dc(e){return new Zc({type:"transform",transform:e})}const Dn=g("ZodOptional",(e,t)=>{Na.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function jn(e){return new Dn({type:"optional",innerType:e})}const jc=g("ZodNullable",(e,t)=>{La.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function xn(e){return new jc({type:"nullable",innerType:e})}const xc=g("ZodDefault",(e,t)=>{za.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Mc(e,t){return new xc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Yr(t)}})}const Uc=g("ZodPrefault",(e,t)=>{Za.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Bc(e,t){return new Uc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Yr(t)}})}const Mn=g("ZodNonOptional",(e,t)=>{Da.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Fc(e,t){return new Mn({type:"nonoptional",innerType:e,...A(t)})}const qc=g("ZodCatch",(e,t)=>{ja.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Gc(e,t){return new qc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Vc=g("ZodPipe",(e,t)=>{xa.init(e,t),X.init(e,t),e.in=t.in,e.out=t.out});function Un(e,t){return new Vc({type:"pipe",in:e,out:t})}const Wc=g("ZodReadonly",(e,t)=>{Ma.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Hc(e){return new Wc({type:"readonly",innerType:e})}const Xc=g("ZodTemplateLiteral",(e,t)=>{Ua.init(e,t),X.init(e,t)});function rt(e,t){return new Xc({type:"template_literal",parts:e,...A(t)})}const Kc=g("ZodCustom",(e,t)=>{Ba.init(e,t),X.init(e,t)});function Yc(e,t={}){return Zu(Kc,e,t)}function Jc(e){return Du(e)}const nt=q({t:re().gte(0),rate:re().gte(0)}),De=q({opacity:re().gte(0).lte(1),zIndex:re().default(0)}),je=q({volume:re().gte(0).lte(1)}),Qc=q({type:G("image"),file:te(),fit:de([G("contain"),G("cover"),G("none")])}),el=q({type:G("audio"),file:te(),audioOutput:te(),enablePlaybackRateAdjustment:Ze()}),tl=q({type:G("video"),file:te(),audioOutput:te(),enablePlaybackRateAdjustment:Ze(),fit:de([G("contain"),G("cover"),G("none")])}),Ot=pe([re(),yc()]),rl=pe([re(),q({set:q({...De.shape}).partial()}).partial()]),nl=pe([re(),q({set:q({...De.shape}).partial(),lerp:q({...De.shape}).partial()}).partial()]),sl=pe([re(),q({set:q({...nt.shape,...je.shape}).partial()}).partial()]),il=pe([re(),q({set:q({...nt.shape,...je.shape}).partial(),lerp:q({...je.shape}).partial()}).partial()]),ol=pe([re(),q({set:q({...nt.shape,...je.shape,...De.shape}).partial()}).partial()]),al=pe([re(),q({set:q({...nt.shape,...je.shape,...De.shape}).partial(),lerp:q({...je.shape,...De.shape}).partial()}).partial()]),ul=q({...Qc.shape,keyframes:pe([nl],de([rl,Ot]))}),cl=q({...el.shape,keyframes:pe([il],de([sl,Ot]))}),ll=q({...tl.shape,keyframes:pe([al],de([ol,Ot]))}),fl=Zn(te(),de([ul,cl,ll])),Bn={opacity:1,zIndex:0},kt={t:0,rate:1,volume:1},Fn={t:0,rate:1,volume:1,opacity:1,zIndex:0},hl=Object.freeze(Object.defineProperty({__proto__:null,MediaSurfaceStateSchema:fl,defaultAudioOptions:kt,defaultImageOptions:Bn,defaultVideoOptions:Fn},Symbol.toStringTag,{value:"Module"}));function st(e,t){if(!e.keyframes.filter(n=>n[1]===null).some(n=>n[0]<=t))switch(e.type){case"image":{if(e.keyframes[0][0]>t)return;const s=e.keyframes.filter(o=>o[1]!==null),i=Pt(s,t);return{...Bn,...i}}case"audio":{const n=e.keyframes.filter(o=>o[1]!==null),s=qn(n,t);if(!s)return;const i=Pt(n,t);return{...kt,...i,...s}}case"video":{const n=e.keyframes.filter(o=>o[1]!==null),s=qn(n,t);if(!s)return;const i=Pt(n,t);return{...Fn,...i,...s}}}}function Pt(e,t){const r={};for(const[s,i]of e)s<=t?(Object.entries(i.lerp??{}).forEach(([o,c])=>{r[o]??={},r[o].before=[s,c]}),Object.entries(i.set??{}).forEach(([o,c])=>{r[o]??={},r[o].before=[s,c]})):Object.entries(i.lerp??{}).forEach(([o,c])=>{r[o]??={},r[o].after===void 0&&(r[o].after=[s,c])});const n={};return Object.entries(r).forEach(([s,{before:i,after:o}])=>{if(o===void 0&&i){n[s]=i[1];return}if(i&&o&&i[0]===o[0]){n[s]=o[1];return}if(i&&typeof i[1]=="number"&&o&&typeof o[1]=="number"){n[s]=i[1]+(t-i[0])*(o[1]-i[1])/(o[0]-i[0]);return}}),n}function qn(e,t){const r=e[0];if(!r||r[0]>t)return;let n=0,{t:s,rate:i}=kt;for(const[l,a]of e){if(l>t)break;const{set:f}=a;if(!f)continue;const{t:h,rate:p}=f;if(h!==void 0){n=l,s=h,p!==void 0&&(i=p);continue}if(p!==void 0){const _=(l-n)*i;n=l,s+=_,i=p}}const c=(t-n)*i,u=s+c;return{rate:i,t:u}}const dl=typeof navigator<"u"&&typeof navigator.standalone<"u",pl="GestureEvent"in globalThis;function it(e,t){return(e%t+t)%t}function ml(e,t,r){return e=it(e,r),t=it(t,r),Math.abs(e-t)<r/2?e-t:e<t?e+r-t:e-(t+r)}const Ct=e=>{try{const{pathname:t}=new URL(e,window.location.href);return t}catch{return}};class Nt{constructor(t,r,n,s,i,o){this.surfaceElement=t,this.clipElement=r,this.constructAssetURL=s,this.getAudioOutput=i,this.mediaPreloader=o,this._state=n}isConnected(t){return!(!this.surfaceElement||!this.clipElement||!this.surfaceElement.contains(this.clipElement)||t&&!this.clipElement.contains(t))}_state;setState(t){this._state=t}timeout;loop=async()=>{clearTimeout(this.timeout),this.isConnected()?(this.update(),this.timeout=setTimeout(this.loop,Kn)):this.destroy()}}function Lt(e,t,r,n,s){let i;const o=n(r.file),c=Ct(o);switch(r.type){case"image":i=e instanceof HTMLImageElement?e:document.createElement("img"),Ct(i.src)!==c&&(i.src=o);break;case"audio":case"video":{if(e!==void 0){const u=Ct(e.src);e.tagName.toLowerCase()===r.type&&u!==void 0&&u===c&&(i=e)}i||(i=s.getElement(r.file,r.type)),i instanceof HTMLVideoElement&&!i.playsInline&&(i.playsInline=!0);break}}return(t.children.length!==1||t.childNodes[0]!==i)&&t.replaceChildren(i),i.style.position="absolute",i.style.width="100%",i.style.height="100%",i}function Gn(e,t,r){const n=String(t.opacity);e.style.opacity!==n&&(e.style.opacity=n);const s=Math.round(t.zIndex??0);parseInt(e.style.zIndex)!==s&&(e.style.zIndex=String(s)),e.style.objectFit!==r&&(e.style.objectFit=r)}function Vn(e,t,r,n){const s=t.volume*n;if(dl)s===0&&!e.muted?e.muted=!0:s>0&&e.muted&&(e.muted=!1);else if(e.muted&&(e.muted=!1),e.volume!==s&&(e.volume=s),e.sinkId!==r)try{e.setSinkId(r).catch(()=>{})}catch{}}const Wn=2e3,gl=1e3,Hn=100,Xn=50,Kn=5,ot=1e3,vl=10,_l=100,El=.3,bl=.1;function wl(e){return Math.sign(e)*Math.pow(Math.abs(e)/ot,El)*bl}function me(e,t){e.playbackRate!==t&&(e.playbackRate=t),e.paused&&e.play().catch(()=>{})}function Yn(e,t,r,n,s,i){const o=i&&!pl;let c=!1;if(e.duration){const h=r.filter(([p])=>p>r[0][0]&&p>n).filter(([,p])=>p?.set?.t!==void 0||p?.set?.rate!==void 0)[0];if(h?.[1]?.set?.t===0){const p=(e.duration*1e3-t.t)/t.rate,$=h[0]-n;c=Math.abs(p-$)<=_l,e.loop!==c&&(e.loop=c)}}const u=e.currentTime*1e3,l=c&&e.duration!==void 0?ml(u,t.t,e.duration*1e3):u-t.t,a=Math.abs(l);switch(!0){case(!o&&s.state==="idle"&&t.rate>0&&a>Wn):{const f=(t.t+t.rate*gl)/1e3;return e.duration!==void 0&&f>e.duration&&!c?{state:"idle"}:(me(e,0),e.currentTime=c?it(f,e.duration*1e3):f,{state:"seeking-ahead"})}case(s.state==="seeking-ahead"&&e.seeking===!0):return{state:"seeking-ahead"};case(s.state==="seeking-ahead"&&e.seeking===!1):return me(e,0),{state:"seeked-ahead"};case(s.state==="seeked-ahead"&&l<-Hn):return me(e,t.rate),console.warn("Failed to seek ahead in time"),{state:"idle"};case(s.state==="seeked-ahead"&&a<=Hn):return me(e,t.rate),{state:"idle"};case(s.state==="seeked-ahead"&&a>Wn*1.5):return console.warn("Failed to seek ahead"),{state:"idle"};case s.state==="seeked-ahead":return{state:"seeked-ahead"};case(o&&s.state==="idle"&&t.rate>0&&a>Xn&&a<=ot):{const f=wl(l),h=Math.max(0,t.rate-f);return me(e,h),{state:"intercepting"}}case(s.state==="intercepting"&&a<=Kn):return me(e,t.rate),{state:"idle"};case(s.state==="intercepting"&&Math.sign(l)===Math.sign(e.playbackRate-t.rate)):return me(e,t.rate),{state:"idle"};case(s.state==="intercepting"&&a<ot*2):return{state:"intercepting"};case s.state==="intercepting":return me(e,t.rate),{state:"idle"};case(o&&s.state==="idle"&&a>ot):{const f=(t.t+t.rate*vl)/1e3;return e.currentTime=c?it(f,e.duration*1e3):f,me(e,t.rate),{state:"seeking"}}case(s.state==="seeking"&&e.seeking):return{state:"seeking"};case(s.state==="seeking"&&!e.seeking):return{state:"idle"};case s.state==="idle":return me(e,t.rate),t.rate===0&&a>Xn&&(e.currentTime=t.t/1e3),{state:"idle"};default:return{state:"idle"}}}class Sl extends Nt{imageElement;update(){const t=st(this._state,Date.now());t?this.imageElement=Lt(this.imageElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.imageElement&&this.destroy(),!(!t||!this.imageElement)&&Gn(this.imageElement,t,this._state.fit)}destroy(){this.imageElement&&(this.imageElement.remove(),this.imageElement.src="",this.imageElement=void 0)}}class Jn extends Nt{syncState={state:"idle"};audioElement;volume=1;update(){const t=Date.now(),r=st(this._state,t);if(r?this.audioElement=Lt(this.audioElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.destroy(),!r||!this.audioElement)return;const n=this.getAudioOutput(this._state.audioOutput);Vn(this.audioElement,r,n,this.volume);const s=Yn(this.audioElement,r,this._state.keyframes,t,this.syncState,this._state.enablePlaybackRateAdjustment);this.syncState=s}destroy(){this.audioElement&&(this.audioElement.pause(),this.audioElement.remove(),this.audioElement.volume=0,this.audioElement.currentTime=0,this.mediaPreloader.releaseElement(this.audioElement)),this.audioElement=void 0}}class Qn extends Nt{syncState={state:"idle"};videoElement;volume=1;update(){const t=Date.now(),r=st(this._state,t);if(r?this.videoElement=Lt(this.videoElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.destroy(),!r||!this.videoElement)return;const n=this.getAudioOutput(this._state.audioOutput);Gn(this.videoElement,r,this._state.fit),Vn(this.videoElement,r,n,this.volume);const s=Yn(this.videoElement,r,this._state.keyframes,t,this.syncState,this._state.enablePlaybackRateAdjustment);this.syncState=s}destroy(){this.videoElement&&(this.videoElement.pause(),this.videoElement.remove(),this.videoElement.volume=0,this.videoElement.currentTime=0,this.mediaPreloader.releaseElement(this.videoElement)),this.videoElement=void 0}}class es{_state;_elements={};_constructAssetURL;constructor(t,r={}){this._constructAssetURL=t,this._state=r}get state(){return{...this._state}}setState(t){this._state=t,this.update()}update(){for(const[t,r]of Object.entries(this._elements)){if(!(t in this._state)){if(r.inUse){console.warn(`Failed to clean up element ${r.element.src}`);continue}r.element.src="",r.element.load(),delete this._elements[t]}r.inUse=r.element.isConnected}for(const[t,r]of Object.entries(this._state)){if(t in this._elements)continue;let n;switch(r.preload===!0?n="auto":r.preload===!1?n="none":n=r.preload,r.type){case"audio":{const s=document.createElement("audio");s.src=this._constructAssetURL(t),s.preload=n,this._elements[t]={element:s,inUse:!1,type:"audio"};break}case"video":{const s=document.createElement("video");s.src=this._constructAssetURL(t),s.preload=n,this._elements[t]={element:s,inUse:!1,type:"video"};break}}}}getElement(t,r){const n=this._elements[t];if(n&&n.inUse===!1)return n.inUse=!0,n.element;{const s=document.createElement(r);return s.src=this._constructAssetURL(t),r==="video"&&(this._elements[t]={element:s,type:r,inUse:!0}),s}}releaseElement(t){if(typeof t=="string"){const r=this._elements[t];r&&(r.inUse=!1)}else Object.values(this._elements).forEach(r=>{r.element===t&&(r.inUse=!1)})}}const Il="data-clip-id";class $l{constructor(t,r,n,s=new es(t)){this.constructAssetUrl=t,this.getAudioOutput=r,this.mediaPreloader=s,this._element=document.createElement("div"),this._element.className="surface-manager",this._element.style.width="100%",this._element.style.height="100%",this._state=n||{},this.update()}_state={};setState(t){this._state=t,this.update()}_volume=1;get volume(){return this._volume}set volume(t){this._volume=t,Object.values(this.resources).forEach(({manager:r})=>{(r instanceof Jn||r instanceof Qn)&&(r.volume=t)})}_element;get element(){return this._element}resources={};update(){Object.entries(this.resources).forEach(([r,{element:n,manager:s}])=>{r in this._state||(delete this.resources[r],n.remove(),s?.destroy())});const t=Object.keys(this._state).toSorted().map(r=>{const n=this.resources[r];if(n)return n.element;{const s=document.createElement("div");return s.setAttribute(Il,r),this.resources[r]={element:s},s}});this._element.replaceChildren(...t),Object.keys(this._state).toSorted().forEach(r=>{const n=this._state[r],s=this.resources[r];if(!s)throw new Error("Failed to create resource");if(s.manager)s.manager.setState(n);else switch(n.type){case"image":s.manager=new Sl(this._element,s.element,n,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader),s.manager.loop();break;case"audio":{const i=new Jn(this._element,s.element,n,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader);s.manager=i,i.volume=this._volume,i.loop();break}case"video":{const i=new Qn(this._element,s.element,n,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader);s.manager=i,i.volume=this._volume,i.loop();break}}})}}function yl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _e={},ue={},Ee={},Ue={},ts;function at(){if(ts)return Ue;ts=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.AddressError=void 0;class e extends Error{constructor(r,n){super(r),this.name="AddressError",this.parseMessage=n}}return Ue.AddressError=e,Ue}var rs;function zt(){if(rs)return Ee;rs=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.isInSubnet=t,Ee.isCorrect=r,Ee.prefixLengthFromMask=n,Ee.numberToPaddedHex=s,Ee.stringToPaddedHex=i,Ee.testBit=o;const e=at();function t(c){return this.subnetMask<c.subnetMask?!1:this.mask(c.subnetMask)===c.mask()}function r(c){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===c&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}function n(c,u){const l=c.toString(2).padStart(u,"0");if(l.length>u)throw new e.AddressError("Invalid subnet mask.");const a=l.indexOf("0");if(a===-1)return u;if(l.slice(a).includes("1"))throw new e.AddressError("Invalid subnet mask.");return a}function s(c){return c.toString(16).padStart(2,"0")}function i(c){return s(parseInt(c,10))}function o(c,u){const{length:l}=c;if(u>l)return!1;const a=l-u;return c.substring(a,a+1)==="1"}return Ee}var ce={},ns;function ss(){return ns||(ns=1,Object.defineProperty(ce,"__esModule",{value:!0}),ce.RE_SUBNET_STRING=ce.RE_ADDRESS=ce.GROUPS=ce.BITS=void 0,ce.BITS=32,ce.GROUPS=4,ce.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,ce.RE_SUBNET_STRING=/\/\d{1,2}$/),ce}var is;function os(){if(is)return ue;is=1;var e=ue&&ue.__createBinding||(Object.create?function(_,m,E,y){y===void 0&&(y=E);var C=Object.getOwnPropertyDescriptor(m,E);(!C||("get"in C?!m.__esModule:C.writable||C.configurable))&&(C={enumerable:!0,get:function(){return m[E]}}),Object.defineProperty(_,y,C)}:function(_,m,E,y){y===void 0&&(y=E),_[y]=m[E]}),t=ue&&ue.__setModuleDefault||(Object.create?function(_,m){Object.defineProperty(_,"default",{enumerable:!0,value:m})}:function(_,m){_.default=m}),r=ue&&ue.__importStar||function(_){if(_&&_.__esModule)return _;var m={};if(_!=null)for(var E in _)E!=="default"&&Object.prototype.hasOwnProperty.call(_,E)&&e(m,_,E);return t(m,_),m};Object.defineProperty(ue,"__esModule",{value:!0}),ue.Address4=void 0;const n=r(zt()),s=r(ss()),i=at(),o=n.isCorrect(s.BITS);class c{constructor(m){this.groups=s.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=o,this.isInSubnet=n.isInSubnet,this.address=m;const E=s.RE_SUBNET_STRING.exec(m);if(E){if(this.parsedSubnet=E[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>s.BITS)throw new i.AddressError("Invalid subnet mask.");m=m.replace(s.RE_SUBNET_STRING,"")}this.addressMinusSuffix=m,this.parsedAddress=this.parse(m)}static isValid(m){try{return new c(m),!0}catch{return!1}}parse(m){const E=m.split(".");if(!m.match(s.RE_ADDRESS))throw new i.AddressError("Invalid IPv4 address.");return E}correctForm(){return this.parsedAddress.map(m=>parseInt(m,10)).join(".")}static fromAddressAndMask(m,E){const y=n.prefixLengthFromMask(new c(E).bigInt(),s.BITS);return new c(`${m}/${y}`)}static fromAddressAndWildcardMask(m,E){const y=new c(E).bigInt(),C=(BigInt(1)<<BigInt(s.BITS))-BigInt(1),x=y^C,N=n.prefixLengthFromMask(x,s.BITS);return new c(`${m}/${N}`)}static fromWildcard(m){const E=m.split(".");if(E.length!==s.GROUPS)throw new i.AddressError("Wildcard pattern must have 4 octets");let y=-1;for(let U=0;U<E.length;U++)if(E[U]==="*")y===-1&&(y=U);else if(y!==-1)throw new i.AddressError("Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)");const C=y===-1?0:E.length-y,x=E.map(U=>U==="*"?"0":U),N=s.BITS-C*8;return new c(`${x.join(".")}/${N}`)}static fromHex(m){const E=m.replace(/:/g,"");if(!/^[0-9a-fA-F]{8}$/.test(E))throw new i.AddressError("IPv4 hex must be exactly 8 hex digits");const y=[];for(let C=0;C<8;C+=2)y.push(parseInt(E.slice(C,C+2),16));return new c(y.join("."))}static fromInteger(m){if(!Number.isInteger(m)||m<0||m>4294967295)throw new i.AddressError("IPv4 integer must be in the range 0 to 2**32 - 1");return c.fromHex(m.toString(16).padStart(8,"0"))}static fromArpa(m){const y=m.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new c(y)}toHex(){return this.parsedAddress.map(m=>n.stringToPaddedHex(m)).join(":")}toArray(){return this.parsedAddress.map(m=>parseInt(m,10))}toGroup6(){const m=[];let E;for(E=0;E<s.GROUPS;E+=2)m.push(`${n.stringToPaddedHex(this.parsedAddress[E])}${n.stringToPaddedHex(this.parsedAddress[E+1])}`);return m.join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(m=>n.stringToPaddedHex(m)).join("")}`)}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(s.BITS-this.subnetMask)}`)}startAddress(){return c.fromBigInt(this._startAddress())}startAddressExclusive(){const m=BigInt("1");return c.fromBigInt(this._startAddress()+m)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(s.BITS-this.subnetMask)}`)}endAddress(){return c.fromBigInt(this._endAddress())}endAddressExclusive(){const m=BigInt("1");return c.fromBigInt(this._endAddress()-m)}subnetMaskAddress(){return c.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(s.BITS-this.subnetMask)}`))}wildcardMask(){return c.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(s.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}static fromBigInt(m){if(m<0n||m>0xffffffffn)throw new i.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1");return c.fromHex(m.toString(16).padStart(8,"0"))}static fromByteArray(m){if(m.length!==4)throw new i.AddressError("IPv4 addresses require exactly 4 bytes");for(let E=0;E<m.length;E++)if(!Number.isInteger(m[E])||m[E]<0||m[E]>255)throw new i.AddressError("All bytes must be integers between 0 and 255");return this.fromUnsignedByteArray(m)}static fromUnsignedByteArray(m){if(m.length!==4)throw new i.AddressError("IPv4 addresses require exactly 4 bytes");const E=m.join(".");return new c(E)}mask(m){return m===void 0&&(m=this.subnetMask),this.getBitsBase2(0,m)}getBitsBase2(m,E){return this.binaryZeroPad().slice(m,E)}reverseForm(m){m||(m={});const E=this.correctForm().split(".").reverse().join(".");return m.omitSuffix?E:`${E}.in-addr.arpa.`}isMulticast(){return this.isInSubnet(u)}isPrivate(){return l.some(m=>this.isInSubnet(m))}isLoopback(){return this.isInSubnet(a)}isLinkLocal(){return this.isInSubnet(f)}isUnspecified(){return this.isInSubnet(h)}isBroadcast(){return this.isInSubnet(p)}isCGNAT(){return this.isInSubnet($)}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(s.BITS,"0")),this._binaryZeroPad}groupForV6(){const m=this.parsedAddress;return this.address.replace(s.RE_ADDRESS,`<span class="hover-group group-v4 group-6">${m.slice(0,2).join(".")}</span>.<span class="hover-group group-v4 group-7">${m.slice(2,4).join(".")}</span>`)}}ue.Address4=c;const u=new c("224.0.0.0/4"),l=[new c("10.0.0.0/8"),new c("172.16.0.0/12"),new c("192.168.0.0/16")],a=new c("127.0.0.0/8"),f=new c("169.254.0.0/16"),h=new c("0.0.0.0/32"),p=new c("255.255.255.255/32"),$=new c("100.64.0.0/10");return ue}var le={},J={},as;function us(){return as||(as=1,Object.defineProperty(J,"__esModule",{value:!0}),J.RE_URL_WITH_PORT=J.RE_URL=J.RE_ZONE_STRING=J.RE_SUBNET_STRING=J.RE_BAD_ADDRESS=J.RE_BAD_CHARACTERS=J.TYPES=J.SCOPES=J.GROUPS=J.BITS=void 0,J.BITS=128,J.GROUPS=8,J.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},J.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast","fc00::/7":"Unique local","2002::/16":"6to4","2001:db8::/32":"Documentation","64:ff9b::/96":"NAT64 (well-known)","64:ff9b:1::/48":"NAT64 (local-use)"},J.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi,J.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,J.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,J.RE_ZONE_STRING=/%.*$/,J.RE_URL=/^\[{0,1}([0-9a-f:]+)\]{0,1}/,J.RE_URL_WITH_PORT=/\[([0-9a-f:]+)\]:([0-9]{1,5})/),J}var Ie={},cs;function ls(){if(cs)return Ie;cs=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.escapeHtml=e,Ie.spanAllZeroes=t,Ie.spanAll=r,Ie.spanLeadingZeroes=s,Ie.simpleGroup=i;function e(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function t(o){return e(o).replace(/(0+)/g,'<span class="zero">$1</span>')}function r(o,c=0){return o.split("").map((l,a)=>`<span class="digit value-${e(l)} position-${a+c}">${t(l)}</span>`).join("")}function n(o){return e(o).replace(/^(0+)/,'<span class="zero">$1</span>')}function s(o){return o.split(":").map(u=>n(u)).join(":")}function i(o,c=0){return o.split(":").map((l,a)=>/group-v4/.test(l)?l:`<span class="hover-group group-${a+c}">${n(l)}</span>`)}return Ie}var se={},fs;function Rl(){if(fs)return se;fs=1;var e=se&&se.__createBinding||(Object.create?function(u,l,a,f){f===void 0&&(f=a);var h=Object.getOwnPropertyDescriptor(l,a);(!h||("get"in h?!l.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return l[a]}}),Object.defineProperty(u,f,h)}:function(u,l,a,f){f===void 0&&(f=a),u[f]=l[a]}),t=se&&se.__setModuleDefault||(Object.create?function(u,l){Object.defineProperty(u,"default",{enumerable:!0,value:l})}:function(u,l){u.default=l}),r=se&&se.__importStar||function(u){if(u&&u.__esModule)return u;var l={};if(u!=null)for(var a in u)a!=="default"&&Object.prototype.hasOwnProperty.call(u,a)&&e(l,u,a);return t(l,u),l};Object.defineProperty(se,"__esModule",{value:!0}),se.ADDRESS_BOUNDARY=void 0,se.groupPossibilities=s,se.padGroup=i,se.simpleRegularExpression=o,se.possibleElisions=c;const n=r(us());function s(u){return`(${u.join("|")})`}function i(u){return u.length<4?`0{0,${4-u.length}}${u}`:u}se.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function o(u){const l=[];u.forEach((f,h)=>{parseInt(f,16)===0&&l.push(h)});const a=l.map(f=>u.map((h,p)=>{if(p===f){const $=p===0||p===n.GROUPS-1?":":"";return s([i(h),$])}return i(h)}).join(":"));return a.push(u.map(i).join(":")),s(a)}function c(u,l,a){const f=l?"":":",h=a?"":":",p=[];!l&&!a&&p.push("::"),l&&a&&p.push(""),(a&&!l||!a&&l)&&p.push(":"),p.push(`${f}(:0{1,4}){1,${u-1}}`),p.push(`(0{1,4}:){1,${u-1}}${h}`),p.push(`(0{1,4}:){${u-1}}0{1,4}`);for(let $=1;$<u-1;$++)for(let _=1;_<u-$;_++)p.push(`(0{1,4}:){${_}}:(0{1,4}:){${u-_-$-1}}0{1,4}`);return s(p)}return se}var hs;function Al(){if(hs)return le;hs=1;var e=le&&le.__createBinding||(Object.create?function(L,d,v,b){b===void 0&&(b=v);var w=Object.getOwnPropertyDescriptor(d,v);(!w||("get"in w?!d.__esModule:w.writable||w.configurable))&&(w={enumerable:!0,get:function(){return d[v]}}),Object.defineProperty(L,b,w)}:function(L,d,v,b){b===void 0&&(b=v),L[b]=d[v]}),t=le&&le.__setModuleDefault||(Object.create?function(L,d){Object.defineProperty(L,"default",{enumerable:!0,value:d})}:function(L,d){L.default=d}),r=le&&le.__importStar||function(L){if(L&&L.__esModule)return L;var d={};if(L!=null)for(var v in L)v!=="default"&&Object.prototype.hasOwnProperty.call(L,v)&&e(d,L,v);return t(d,L),d};Object.defineProperty(le,"__esModule",{value:!0}),le.Address6=void 0;const n=r(zt()),s=r(ss()),i=r(us()),o=r(ls()),c=os(),u=Rl(),l=at(),a=zt(),f=n.isCorrect(i.BITS);function h(L){if(!L)throw new Error("Assertion failed.")}function p(L){const d=/(\d+)(\d{3})/;for(;d.test(L);)L=L.replace(d,"$1,$2");return L}function $(L){return L=L.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),L=L.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),L}function _(L,d){const v=[],b=[];let w;for(w=0;w<L.length;w++)w<d[0]?v.push(L[w]):w>d[1]&&b.push(L[w]);return v.concat(["compact"]).concat(b)}function m(L){return parseInt(L,16).toString(16).padStart(4,"0")}function E(L){return L&255}class y{constructor(d,v){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=n.isInSubnet,this.isCorrect=f,v===void 0?this.groups=i.GROUPS:this.groups=v,this.address=d;const b=i.RE_SUBNET_STRING.exec(d);if(b){if(this.parsedSubnet=b[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>i.BITS)throw new l.AddressError("Invalid subnet mask.");d=d.replace(i.RE_SUBNET_STRING,"")}else if(/\//.test(d))throw new l.AddressError("Invalid subnet mask.");const w=i.RE_ZONE_STRING.exec(d);w&&(this.zone=w[0],d=d.replace(i.RE_ZONE_STRING,"")),this.addressMinusSuffix=d,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(d){try{return new y(d),!0}catch{return!1}}static fromBigInt(d){if(d<0n||d>(1n<<BigInt(i.BITS))-1n)throw new l.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1");const v=d.toString(16).padStart(32,"0"),b=[];for(let w=0;w<i.GROUPS;w++)b.push(v.slice(w*4,(w+1)*4));return new y(b.join(":"))}static fromURL(d){let v,b=null,w;if(d.indexOf("[")!==-1&&d.indexOf("]:")!==-1){if(w=i.RE_URL_WITH_PORT.exec(d),w===null)return{error:"failed to parse address with port",address:null,port:null};v=w[1],b=w[2]}else if(d.indexOf("/")!==-1){if(d=d.replace(/^[a-z0-9]+:\/\//,""),w=i.RE_URL.exec(d),w===null)return{error:"failed to parse address from URL",address:null,port:null};v=w[1]}else v=d;return b?(b=parseInt(b,10),(b<0||b>65536)&&(b=null)):b=null,{address:new y(v),port:b}}static fromAddressAndMask(d,v){const b=n.prefixLengthFromMask(new y(v).bigInt(),i.BITS);return new y(`${d}/${b}`)}static fromAddressAndWildcardMask(d,v){const b=new y(v).bigInt(),w=(BigInt(1)<<BigInt(i.BITS))-BigInt(1),k=b^w,D=n.prefixLengthFromMask(k,i.BITS);return new y(`${d}/${D}`)}static fromWildcard(d){if(d.includes("%")||d.includes("/"))throw new l.AddressError("Wildcard pattern must not include a zone or CIDR suffix");const v=d.split("::");if(v.length>2)throw new l.AddressError("Wildcard pattern cannot contain more than one '::'");let b;if(v.length===2){const S=v[0]===""?[]:v[0].split(":"),I=v[1]===""?[]:v[1].split(":"),T=i.GROUPS-S.length-I.length;if(T<1)throw new l.AddressError("Wildcard pattern with '::' has too many groups");b=[...S,...new Array(T).fill("0"),...I]}else b=d.split(":");if(b.length!==i.GROUPS)throw new l.AddressError("Wildcard pattern must have 8 groups");let w=-1;for(let S=0;S<b.length;S++)if(b[S]==="*")w===-1&&(w=S);else if(w!==-1)throw new l.AddressError("Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)");const k=w===-1?0:b.length-w,D=b.map(S=>S==="*"?"0":S),j=i.BITS-k*16;return new y(`${D.join(":")}/${j}`)}static fromAddress4(d){const v=new c.Address4(d),b=i.BITS-(s.BITS-v.subnetMask);return new y(`::ffff:${v.correctForm()}/${b}`)}static fromArpa(d){let v=d.replace(/(\.ip6\.arpa)?\.$/,"");const b=7;if(v.length!==63)throw new l.AddressError("Invalid 'ip6.arpa' form.");const w=v.split(".").reverse();for(let k=b;k>0;k--){const D=k*4;w.splice(D,0,":")}return v=w.join(""),new y(v)}microsoftTranscription(){return`${this.correctForm().replace(/:/g,"-")}.ipv6-literal.net`}mask(d=this.subnetMask){return this.getBitsBase2(0,d)}possibleSubnets(d=128){const v=i.BITS-this.subnetMask,b=Math.abs(d-i.BITS),w=v-b;return w<0?"0":p((BigInt("2")**BigInt(w)).toString(10))}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(i.BITS-this.subnetMask)}`)}startAddress(){return y.fromBigInt(this._startAddress())}startAddressExclusive(){const d=BigInt("1");return y.fromBigInt(this._startAddress()+d)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(i.BITS-this.subnetMask)}`)}endAddress(){return y.fromBigInt(this._endAddress())}endAddressExclusive(){const d=BigInt("1");return y.fromBigInt(this._endAddress()-d)}subnetMaskAddress(){return y.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(i.BITS-this.subnetMask)}`))}wildcardMask(){return y.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(i.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}getScope(){const d=this.getType();return d==="Multicast"||d.startsWith("Multicast ")?i.SCOPES[parseInt(this.getBits(12,16).toString(10),10)]||"Unknown":d==="Link-local unicast"||d==="Loopback"?"Link local":d==="Unspecified"?"Unknown":"Global"}getType(){for(let d=0;d<C.length;d++){const v=C[d];if(this.isInSubnet(v[0]))return v[1]}return"Global unicast"}getBits(d,v){return BigInt(`0b${this.getBitsBase2(d,v)}`)}getBitsBase2(d,v){return this.binaryZeroPad().slice(d,v)}getBitsBase16(d,v){const b=v-d;if(b%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(d,v).toString(16).padStart(b/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,i.BITS)}reverseForm(d){d||(d={});const v=Math.floor(this.subnetMask/4),b=this.canonicalForm().replace(/:/g,"").split("").slice(0,v).reverse().join(".");return v>0?d.omitSuffix?b:`${b}.ip6.arpa.`:d.omitSuffix?"":"ip6.arpa."}correctForm(){let d,v=[],b=0;const w=[];for(d=0;d<this.parsedAddress.length;d++){const j=parseInt(this.parsedAddress[d],16);j===0&&b++,j!==0&&b>0&&(b>1&&w.push([d-b,d-1]),b=0)}b>1&&w.push([this.parsedAddress.length-b,this.parsedAddress.length-1]);const k=w.map(j=>j[1]-j[0]+1);if(w.length>0){const j=k.indexOf(Math.max(...k));v=_(this.parsedAddress,w[j])}else v=this.parsedAddress;for(d=0;d<v.length;d++)v[d]!=="compact"&&(v[d]=parseInt(v[d],16).toString(16));let D=v.join(":");return D=D.replace(/^compact$/,"::"),D=D.replace(/(^compact)|(compact$)/,":"),D=D.replace(/compact/,""),D}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(i.BITS,"0")),this._binaryZeroPad}parse4in6(d){if(d.indexOf(".")===-1)return d;const v=d.split(":"),w=v.slice(-1)[0].match(s.RE_ADDRESS);if(w){this.parsedAddress4=w[0],this.address4=new c.Address4(this.parsedAddress4);for(let k=0;k<this.address4.groups;k++)if(/^0[0-9]+/.test(this.address4.parsedAddress[k])){const D=this.address4.parsedAddress.map($).join("."),j=v.slice(0,-1).map(o.escapeHtml).join(":"),S=v.length>1?":":"";throw new l.AddressError("IPv4 addresses can't have leading zeroes.",`${j}${S}${D}`)}this.v4=!0,v[v.length-1]=this.address4.toGroup6(),d=v.join(":")}return d}parse(d){d=this.parse4in6(d);const v=d.match(i.RE_BAD_CHARACTERS);if(v)throw new l.AddressError(`Bad character${v.length>1?"s":""} detected in address: ${v.join("")}`,d.replace(i.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));const b=d.match(i.RE_BAD_ADDRESS);if(b)throw new l.AddressError(`Address failed regex: ${b.join("")}`,d.replace(i.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let w=[];const k=d.split("::");if(k.length===2){let D=k[0].split(":"),j=k[1].split(":");D.length===1&&D[0]===""&&(D=[]),j.length===1&&j[0]===""&&(j=[]);const S=this.groups-(D.length+j.length);if(!S)throw new l.AddressError("Error parsing groups");this.elidedGroups=S,this.elisionBegin=D.length,this.elisionEnd=D.length+this.elidedGroups,w=w.concat(D);for(let I=0;I<S;I++)w.push("0");w=w.concat(j)}else if(k.length===1)w=d.split(":"),this.elidedGroups=0;else throw new l.AddressError("Too many :: groups found");if(w=w.map(D=>parseInt(D,16).toString(16)),w.length!==this.groups)throw new l.AddressError("Incorrect number of groups found");return w}canonicalForm(){return this.parsedAddress.map(m).join(":")}decimal(){return this.parsedAddress.map(d=>parseInt(d,16).toString(10).padStart(5,"0")).join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(m).join("")}`)}to4(){const d=this.binaryZeroPad().split("");return c.Address4.fromHex(BigInt(`0b${d.slice(96,128).join("")}`).toString(16).padStart(8,"0"))}to4in6(){const d=this.to4(),b=new y(this.parsedAddress.slice(0,6).join(":"),6).correctForm();let w="";return/:$/.test(b)||(w=":"),b+w+d.address}inspectTeredo(){const d=this.getBitsBase16(0,32),b=(this.getBits(80,96)^BigInt("0xffff")).toString(),w=c.Address4.fromHex(this.getBitsBase16(32,64)),k=this.getBits(96,128),D=c.Address4.fromHex((k^BigInt("0xffffffff")).toString(16).padStart(8,"0")),j=this.getBitsBase2(64,80),S=(0,a.testBit)(j,15),I=(0,a.testBit)(j,14),T=(0,a.testBit)(j,8),R=(0,a.testBit)(j,9),Z=BigInt(`0b${j.slice(2,6)+j.slice(8,16)}`).toString(10);return{prefix:`${d.slice(0,4)}:${d.slice(4,8)}`,server4:w.address,client4:D.address,flags:j,coneNat:S,microsoft:{reserved:I,universalLocal:R,groupIndividual:T,nonce:Z},udpPort:b}}inspect6to4(){const d=this.getBitsBase16(0,16),v=c.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:d.slice(0,4),gateway:v.address}}to6to4(){if(!this.is4())return null;const d=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new y(d)}static fromAddress4Nat64(d,v="64:ff9b::/96"){const b=new c.Address4(d),w=new y(v),k=w.subnetMask;if(k!==32&&k!==40&&k!==48&&k!==56&&k!==64&&k!==96)throw new l.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");const D=w.binaryZeroPad(),j=b.binaryZeroPad();let S;if(k===96)S=D.slice(0,96)+j;else{const R=64-k;S=D.slice(0,k)+j.slice(0,R)+"00000000"+j.slice(R)+"0".repeat(56-(32-R))}const I=BigInt(`0b${S}`).toString(16).padStart(32,"0"),T=[];for(let R=0;R<8;R++)T.push(I.slice(R*4,(R+1)*4));return new y(T.join(":"))}toAddress4Nat64(d="64:ff9b::/96"){const v=new y(d),b=v.subnetMask;if(b!==32&&b!==40&&b!==48&&b!==56&&b!==64&&b!==96)throw new l.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");if(!this.isInSubnet(v))return null;const w=this.binaryZeroPad();let k;if(b===96)k=w.slice(96,128);else{const j=64-b;k=w.slice(b,b+j)+w.slice(72,72+(32-j))}const D=[];for(let j=0;j<4;j++)D.push(parseInt(k.slice(j*8,(j+1)*8),2).toString());return new c.Address4(D.join("."))}toByteArray(){const d=this.bigInt().toString(16),b=`${"0".repeat(d.length%2)}${d}`,w=[];for(let k=0,D=b.length;k<D;k+=2)w.push(parseInt(b.substring(k,k+2),16));return w}toUnsignedByteArray(){return this.toByteArray().map(E)}static fromByteArray(d){return this.fromUnsignedByteArray(d.map(E))}static fromUnsignedByteArray(d){const v=BigInt("256");let b=BigInt("0"),w=BigInt("1");for(let k=d.length-1;k>=0;k--)b+=w*BigInt(d[k].toString(10)),w*=v;return y.fromBigInt(b)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){const d=this.getType();return d==="Multicast"||d.startsWith("Multicast ")}is4(){return this.v4}isMapped4(){return this.isInSubnet(z)}isTeredo(){return this.isInSubnet(x)}is6to4(){return this.isInSubnet(N)}isLoopback(){return this.getType()==="Loopback"}isULA(){return this.isInSubnet(U)}isUnspecified(){return this.getType()==="Unspecified"}isDocumentation(){return this.isInSubnet(Q)}href(d){return d===void 0?d="":d=`:${d}`,`http://[${this.correctForm()}]${d}/`}link(d){d||(d={}),d.className===void 0&&(d.className=""),d.prefix===void 0&&(d.prefix="/#address="),d.v4===void 0&&(d.v4=!1);let v=this.correctForm;d.v4&&(v=this.to4in6);const b=v.call(this),w=o.escapeHtml(`${d.prefix}${b}`),k=o.escapeHtml(b);if(d.className){const D=o.escapeHtml(d.className);return`<a href="${w}" class="${D}">${k}</a>`}return`<a href="${w}">${k}</a>`}group(){if(this.elidedGroups===0)return o.simpleGroup(this.addressMinusSuffix).join(":");h(typeof this.elidedGroups=="number"),h(typeof this.elisionBegin=="number");const d=[],[v,b]=this.addressMinusSuffix.split("::");v.length?d.push(...o.simpleGroup(v)):d.push("");const w=["hover-group"];for(let k=this.elisionBegin;k<this.elisionBegin+this.elidedGroups;k++)w.push(`group-${k}`);return d.push(`<span class="${w.join(" ")}"></span>`),b.length?d.push(...o.simpleGroup(b,this.elisionEnd)):d.push(""),this.is4()&&(h(this.address4 instanceof c.Address4),d.pop(),d.push(this.address4.groupForV6())),d.join(":")}regularExpressionString(d=!1){let v=[];const b=new y(this.correctForm());if(b.elidedGroups===0)v.push((0,u.simpleRegularExpression)(b.parsedAddress));else if(b.elidedGroups===i.GROUPS)v.push((0,u.possibleElisions)(i.GROUPS));else{const w=b.address.split("::");w[0].length&&v.push((0,u.simpleRegularExpression)(w[0].split(":"))),h(typeof b.elidedGroups=="number"),v.push((0,u.possibleElisions)(b.elidedGroups,w[0].length!==0,w[1].length!==0)),w[1].length&&v.push((0,u.simpleRegularExpression)(w[1].split(":"))),v=[v.join(":")]}return d||(v=["(?=^|",u.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...v,")(?=[^\\w\\:]|",u.ADDRESS_BOUNDARY,"|$)"]),v.join("")}regularExpression(d=!1){return new RegExp(this.regularExpressionString(d),"i")}}le.Address6=y;const C=Object.keys(i.TYPES).map(L=>[new y(L),i.TYPES[L]]),x=new y("2001::/32"),N=new y("2002::/16"),U=new y("fc00::/7"),Q=new y("2001:db8::/32"),z=new y("::ffff:0:0/96");return le}var ds;function Tl(){return ds||(ds=1,function(e){var t=_e&&_e.__createBinding||(Object.create?function(u,l,a,f){f===void 0&&(f=a);var h=Object.getOwnPropertyDescriptor(l,a);(!h||("get"in h?!l.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return l[a]}}),Object.defineProperty(u,f,h)}:function(u,l,a,f){f===void 0&&(f=a),u[f]=l[a]}),r=_e&&_e.__setModuleDefault||(Object.create?function(u,l){Object.defineProperty(u,"default",{enumerable:!0,value:l})}:function(u,l){u.default=l}),n=_e&&_e.__importStar||function(u){if(u&&u.__esModule)return u;var l={};if(u!=null)for(var a in u)a!=="default"&&Object.prototype.hasOwnProperty.call(u,a)&&t(l,u,a);return r(l,u),l};Object.defineProperty(e,"__esModule",{value:!0}),e.v6=e.AddressError=e.Address6=e.Address4=void 0;var s=os();Object.defineProperty(e,"Address4",{enumerable:!0,get:function(){return s.Address4}});var i=Al();Object.defineProperty(e,"Address6",{enumerable:!0,get:function(){return i.Address6}});var o=at();Object.defineProperty(e,"AddressError",{enumerable:!0,get:function(){return o.AddressError}});const c=n(ls());e.v6={helpers:c}}(_e)),_e}var $e=Tl();class ps{host;port;constructor(t){const r=t.lastIndexOf(":"),n=t.slice(0,r),s=t.slice(r+1);if(r===-1||!/^(\d+|\*)$/.test(s))throw new Error(`Invalid host pattern "${t}": a port (or "*") is required`);this.host=n,this.port=s}validate(t,r){return this.validateHostname(t)&&(this.port==="*"||Number(this.port)===r)}validateHostname(t){const r=this.host.toLowerCase();return t=t.toLowerCase(),r==="*"?!0:r==="localhost"?t==="localhost"||kl(t):r==="private"?Ol(t):r.startsWith("*.")?t.endsWith(r.slice(1)):r===t}}function Ol(e){return $e.Address4.isValid(e)&&new $e.Address4(e).isPrivate()}function kl(e){if(e.startsWith("[")&&e.endsWith("]")){const t=e.slice(1,-1);return $e.Address6.isValid(t)&&new $e.Address6(t).isLoopback()}return $e.Address4.isValid(e)&&new $e.Address4(e).isLoopback()||$e.Address6.isValid(e)&&new $e.Address6(e).isLoopback()}const Pl=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var ut={exports:{}},Zt,ms;function Be(){if(ms)return Zt;ms=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,s=t-6;return Zt={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:s,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Zt}var Dt,gs;function ct(){return gs||(gs=1,Dt=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),Dt}var vs;function Fe(){return vs||(vs=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=Be(),i=ct();t=e.exports={};const o=t.re=[],c=t.safeRe=[],u=t.src=[],l=t.safeSrc=[],a=t.t={};let f=0;const h="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",s],[h,n]],$=m=>{for(const[E,y]of p)m=m.split(`${E}*`).join(`${E}{0,${y}}`).split(`${E}+`).join(`${E}{1,${y}}`);return m},_=(m,E,y)=>{const C=$(E),x=f++;i(m,x,E),a[m]=x,u[x]=E,l[x]=C,o[x]=new RegExp(E,y?"g":void 0),c[x]=new RegExp(C,y?"g":void 0)};_("NUMERICIDENTIFIER","0|[1-9]\\d*"),_("NUMERICIDENTIFIERLOOSE","\\d+"),_("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),_("MAINVERSION",`(${u[a.NUMERICIDENTIFIER]})\\.(${u[a.NUMERICIDENTIFIER]})\\.(${u[a.NUMERICIDENTIFIER]})`),_("MAINVERSIONLOOSE",`(${u[a.NUMERICIDENTIFIERLOOSE]})\\.(${u[a.NUMERICIDENTIFIERLOOSE]})\\.(${u[a.NUMERICIDENTIFIERLOOSE]})`),_("PRERELEASEIDENTIFIER",`(?:${u[a.NONNUMERICIDENTIFIER]}|${u[a.NUMERICIDENTIFIER]})`),_("PRERELEASEIDENTIFIERLOOSE",`(?:${u[a.NONNUMERICIDENTIFIER]}|${u[a.NUMERICIDENTIFIERLOOSE]})`),_("PRERELEASE",`(?:-(${u[a.PRERELEASEIDENTIFIER]}(?:\\.${u[a.PRERELEASEIDENTIFIER]})*))`),_("PRERELEASELOOSE",`(?:-?(${u[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[a.PRERELEASEIDENTIFIERLOOSE]})*))`),_("BUILDIDENTIFIER",`${h}+`),_("BUILD",`(?:\\+(${u[a.BUILDIDENTIFIER]}(?:\\.${u[a.BUILDIDENTIFIER]})*))`),_("FULLPLAIN",`v?${u[a.MAINVERSION]}${u[a.PRERELEASE]}?${u[a.BUILD]}?`),_("FULL",`^${u[a.FULLPLAIN]}$`),_("LOOSEPLAIN",`[v=\\s]*${u[a.MAINVERSIONLOOSE]}${u[a.PRERELEASELOOSE]}?${u[a.BUILD]}?`),_("LOOSE",`^${u[a.LOOSEPLAIN]}$`),_("GTLT","((?:<|>)?=?)"),_("XRANGEIDENTIFIERLOOSE",`${u[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),_("XRANGEIDENTIFIER",`${u[a.NUMERICIDENTIFIER]}|x|X|\\*`),_("XRANGEPLAIN",`[v=\\s]*(${u[a.XRANGEIDENTIFIER]})(?:\\.(${u[a.XRANGEIDENTIFIER]})(?:\\.(${u[a.XRANGEIDENTIFIER]})(?:${u[a.PRERELEASE]})?${u[a.BUILD]}?)?)?`),_("XRANGEPLAINLOOSE",`[v=\\s]*(${u[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[a.XRANGEIDENTIFIERLOOSE]})(?:${u[a.PRERELEASELOOSE]})?${u[a.BUILD]}?)?)?`),_("XRANGE",`^${u[a.GTLT]}\\s*${u[a.XRANGEPLAIN]}$`),_("XRANGELOOSE",`^${u[a.GTLT]}\\s*${u[a.XRANGEPLAINLOOSE]}$`),_("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),_("COERCE",`${u[a.COERCEPLAIN]}(?:$|[^\\d])`),_("COERCEFULL",u[a.COERCEPLAIN]+`(?:${u[a.PRERELEASE]})?(?:${u[a.BUILD]})?(?:$|[^\\d])`),_("COERCERTL",u[a.COERCE],!0),_("COERCERTLFULL",u[a.COERCEFULL],!0),_("LONETILDE","(?:~>?)"),_("TILDETRIM",`(\\s*)${u[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",_("TILDE",`^${u[a.LONETILDE]}${u[a.XRANGEPLAIN]}$`),_("TILDELOOSE",`^${u[a.LONETILDE]}${u[a.XRANGEPLAINLOOSE]}$`),_("LONECARET","(?:\\^)"),_("CARETTRIM",`(\\s*)${u[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",_("CARET",`^${u[a.LONECARET]}${u[a.XRANGEPLAIN]}$`),_("CARETLOOSE",`^${u[a.LONECARET]}${u[a.XRANGEPLAINLOOSE]}$`),_("COMPARATORLOOSE",`^${u[a.GTLT]}\\s*(${u[a.LOOSEPLAIN]})$|^$`),_("COMPARATOR",`^${u[a.GTLT]}\\s*(${u[a.FULLPLAIN]})$|^$`),_("COMPARATORTRIM",`(\\s*)${u[a.GTLT]}\\s*(${u[a.LOOSEPLAIN]}|${u[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",_("HYPHENRANGE",`^\\s*(${u[a.XRANGEPLAIN]})\\s+-\\s+(${u[a.XRANGEPLAIN]})\\s*$`),_("HYPHENRANGELOOSE",`^\\s*(${u[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[a.XRANGEPLAINLOOSE]})\\s*$`),_("STAR","(<|>)?=?\\s*\\*"),_("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),_("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(ut,ut.exports)),ut.exports}var jt,_s;function xt(){if(_s)return jt;_s=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return jt=n=>n?typeof n!="object"?e:n:t,jt}var Mt,Es;function bs(){if(Es)return Mt;Es=1;const e=/^[0-9]+$/,t=(n,s)=>{if(typeof n=="number"&&typeof s=="number")return n===s?0:n<s?-1:1;const i=e.test(n),o=e.test(s);return i&&o&&(n=+n,s=+s),n===s?0:i&&!o?-1:o&&!i?1:n<s?-1:1};return Mt={compareIdentifiers:t,rcompareIdentifiers:(n,s)=>t(s,n)},Mt}var Ut,ws;function ne(){if(ws)return Ut;ws=1;const e=ct(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=Be(),{safeRe:n,t:s}=Fe(),i=xt(),{compareIdentifiers:o}=bs(),c=(l,a)=>{const f=a.split(".");if(f.length>l.length)return!1;for(let h=0;h<f.length;h++)if(o(l[h],f[h])!==0)return!1;return!0};class u{constructor(a,f){if(f=i(f),a instanceof u){if(a.loose===!!f.loose&&a.includePrerelease===!!f.includePrerelease)return a;a=a.version}else if(typeof a!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);if(a.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",a,f),this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease;const h=a.trim().match(f.loose?n[s.LOOSE]:n[s.FULL]);if(!h)throw new TypeError(`Invalid Version: ${a}`);if(this.raw=a,this.major=+h[1],this.minor=+h[2],this.patch=+h[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");h[4]?this.prerelease=h[4].split(".").map(p=>{if(/^[0-9]+$/.test(p)){const $=+p;if($>=0&&$<r)return $}return p}):this.prerelease=[],this.build=h[5]?h[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(a){if(e("SemVer.compare",this.version,this.options,a),!(a instanceof u)){if(typeof a=="string"&&a===this.version)return 0;a=new u(a,this.options)}return a.version===this.version?0:this.compareMain(a)||this.comparePre(a)}compareMain(a){return a instanceof u||(a=new u(a,this.options)),this.major<a.major?-1:this.major>a.major?1:this.minor<a.minor?-1:this.minor>a.minor?1:this.patch<a.patch?-1:this.patch>a.patch?1:0}comparePre(a){if(a instanceof u||(a=new u(a,this.options)),this.prerelease.length&&!a.prerelease.length)return-1;if(!this.prerelease.length&&a.prerelease.length)return 1;if(!this.prerelease.length&&!a.prerelease.length)return 0;let f=0;do{const h=this.prerelease[f],p=a.prerelease[f];if(e("prerelease compare",f,h,p),h===void 0&&p===void 0)return 0;if(p===void 0)return 1;if(h===void 0)return-1;if(h===p)continue;return o(h,p)}while(++f)}compareBuild(a){a instanceof u||(a=new u(a,this.options));let f=0;do{const h=this.build[f],p=a.build[f];if(e("build compare",f,h,p),h===void 0&&p===void 0)return 0;if(p===void 0)return 1;if(h===void 0)return-1;if(h===p)continue;return o(h,p)}while(++f)}inc(a,f,h){if(a.startsWith("pre")){if(!f&&h===!1)throw new Error("invalid increment argument: identifier is empty");if(f){const p=`-${f}`.match(this.options.loose?n[s.PRERELEASELOOSE]:n[s.PRERELEASE]);if(!p||p[1]!==f)throw new Error(`invalid identifier: ${f}`)}}switch(a){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",f,h);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",f,h);break;case"prepatch":this.prerelease.length=0,this.inc("patch",f,h),this.inc("pre",f,h);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",f,h),this.inc("pre",f,h);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const p=Number(h)?1:0;if(this.prerelease.length===0)this.prerelease=[p];else{let $=this.prerelease.length;for(;--$>=0;)typeof this.prerelease[$]=="number"&&(this.prerelease[$]++,$=-2);if($===-1){if(f===this.prerelease.join(".")&&h===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(p)}}if(f){let $=[f,p];if(h===!1&&($=[f]),c(this.prerelease,f)){const _=this.prerelease[f.split(".").length];isNaN(_)&&(this.prerelease=$)}else this.prerelease=$}break}default:throw new Error(`invalid increment argument: ${a}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Ut=u,Ut}var Bt,Ss;function ke(){if(Ss)return Bt;Ss=1;const e=ne();return Bt=(r,n,s=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(i){if(!s)return null;throw i}},Bt}var Ft,Is;function Cl(){if(Is)return Ft;Is=1;const e=ke();return Ft=(r,n)=>{const s=e(r,n);return s?s.version:null},Ft}var qt,$s;function Nl(){if($s)return qt;$s=1;const e=ke();return qt=(r,n)=>{const s=e(r.trim().replace(/^[=v]+/,""),n);return s?s.version:null},qt}var Gt,ys;function Ll(){if(ys)return Gt;ys=1;const e=ne();return Gt=(r,n,s,i,o)=>{typeof s=="string"&&(o=i,i=s,s=void 0);try{return new e(r instanceof e?r.version:r,s).inc(n,i,o).version}catch{return null}},Gt}var Vt,Rs;function zl(){if(Rs)return Vt;Rs=1;const e=ke();return Vt=(r,n)=>{const s=e(r,null,!0),i=e(n,null,!0),o=s.compare(i);if(o===0)return null;const c=o>0,u=c?s:i,l=c?i:s,a=!!u.prerelease.length;if(!!l.prerelease.length&&!a){if(!l.patch&&!l.minor)return"major";if(l.compareMain(u)===0)return l.minor&&!l.patch?"minor":"patch"}const h=a?"pre":"";return s.major!==i.major?h+"major":s.minor!==i.minor?h+"minor":s.patch!==i.patch?h+"patch":"prerelease"},Vt}var Wt,As;function Zl(){if(As)return Wt;As=1;const e=ne();return Wt=(r,n)=>new e(r,n).major,Wt}var Ht,Ts;function Dl(){if(Ts)return Ht;Ts=1;const e=ne();return Ht=(r,n)=>new e(r,n).minor,Ht}var Xt,Os;function jl(){if(Os)return Xt;Os=1;const e=ne();return Xt=(r,n)=>new e(r,n).patch,Xt}var Kt,ks;function xl(){if(ks)return Kt;ks=1;const e=ke();return Kt=(r,n)=>{const s=e(r,n);return s&&s.prerelease.length?s.prerelease:null},Kt}var Yt,Ps;function fe(){if(Ps)return Yt;Ps=1;const e=ne();return Yt=(r,n,s)=>new e(r,s).compare(new e(n,s)),Yt}var Jt,Cs;function Ml(){if(Cs)return Jt;Cs=1;const e=fe();return Jt=(r,n,s)=>e(n,r,s),Jt}var Qt,Ns;function Ul(){if(Ns)return Qt;Ns=1;const e=fe();return Qt=(r,n)=>e(r,n,!0),Qt}var er,Ls;function tr(){if(Ls)return er;Ls=1;const e=ne();return er=(r,n,s)=>{const i=new e(r,s),o=new e(n,s);return i.compare(o)||i.compareBuild(o)},er}var rr,zs;function Bl(){if(zs)return rr;zs=1;const e=tr();return rr=(r,n)=>r.sort((s,i)=>e(s,i,n)),rr}var nr,Zs;function Fl(){if(Zs)return nr;Zs=1;const e=tr();return nr=(r,n)=>r.sort((s,i)=>e(i,s,n)),nr}var sr,Ds;function lt(){if(Ds)return sr;Ds=1;const e=fe();return sr=(r,n,s)=>e(r,n,s)>0,sr}var ir,js;function or(){if(js)return ir;js=1;const e=fe();return ir=(r,n,s)=>e(r,n,s)<0,ir}var ar,xs;function Ms(){if(xs)return ar;xs=1;const e=fe();return ar=(r,n,s)=>e(r,n,s)===0,ar}var ur,Us;function Bs(){if(Us)return ur;Us=1;const e=fe();return ur=(r,n,s)=>e(r,n,s)!==0,ur}var cr,Fs;function lr(){if(Fs)return cr;Fs=1;const e=fe();return cr=(r,n,s)=>e(r,n,s)>=0,cr}var fr,qs;function hr(){if(qs)return fr;qs=1;const e=fe();return fr=(r,n,s)=>e(r,n,s)<=0,fr}var dr,Gs;function Vs(){if(Gs)return dr;Gs=1;const e=Ms(),t=Bs(),r=lt(),n=lr(),s=or(),i=hr();return dr=(c,u,l,a)=>{switch(u){case"===":return typeof c=="object"&&(c=c.version),typeof l=="object"&&(l=l.version),c===l;case"!==":return typeof c=="object"&&(c=c.version),typeof l=="object"&&(l=l.version),c!==l;case"":case"=":case"==":return e(c,l,a);case"!=":return t(c,l,a);case">":return r(c,l,a);case">=":return n(c,l,a);case"<":return s(c,l,a);case"<=":return i(c,l,a);default:throw new TypeError(`Invalid operator: ${u}`)}},dr}var pr,Ws;function ql(){if(Ws)return pr;Ws=1;const e=ne(),t=ke(),{safeRe:r,t:n}=Fe();return pr=(i,o)=>{if(i instanceof e)return i;if(typeof i=="number"&&(i=String(i)),typeof i!="string")return null;o=o||{};let c=null;if(!o.rtl)c=i.match(o.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const p=o.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let $;for(;($=p.exec(i))&&(!c||c.index+c[0].length!==i.length);)(!c||$.index+$[0].length!==c.index+c[0].length)&&(c=$),p.lastIndex=$.index+$[1].length+$[2].length;p.lastIndex=-1}if(c===null)return null;const u=c[2],l=c[3]||"0",a=c[4]||"0",f=o.includePrerelease&&c[5]?`-${c[5]}`:"",h=o.includePrerelease&&c[6]?`+${c[6]}`:"";return t(`${u}.${l}.${a}${f}${h}`,o)},pr}var mr,Hs;function Gl(){if(Hs)return mr;Hs=1;const e=ke(),t=Be(),r=ne(),n=(c,u,l)=>{if(!t.RELEASE_TYPES.includes(u))return null;const a=s(c,l);return a&&i(a,u)},s=(c,u)=>{const l=c instanceof r?c.version:c;return e(l,u)},i=(c,u)=>{if(o(u))return c.version;switch(c.prerelease=[],u){case"major":c.minor=0,c.patch=0;break;case"minor":c.patch=0;break}return c.format()},o=c=>c.startsWith("pre");return mr=n,mr}var gr,Xs;function Vl(){if(Xs)return gr;Xs=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(r,n)}return this}}return gr=e,gr}var vr,Ks;function he(){if(Ks)return vr;Ks=1;const e=/\s+/g;class t{constructor(I,T){if(T=s(T),I instanceof t)return I.loose===!!T.loose&&I.includePrerelease===!!T.includePrerelease?I:new t(I.raw,T);if(I instanceof i)return this.raw=I.value,this.set=[[I]],this.formatted=void 0,this;if(this.options=T,this.loose=!!T.loose,this.includePrerelease=!!T.includePrerelease,this.raw=I.trim().replace(e," "),this.set=this.raw.split("||").map(R=>this.parseRange(R.trim())).filter(R=>R.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const R=this.set[0];if(this.set=this.set.filter(Z=>!E(Z[0])),this.set.length===0)this.set=[R];else if(this.set.length>1){for(const Z of this.set)if(Z.length===1&&y(Z[0])){this.set=[Z];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let I=0;I<this.set.length;I++){I>0&&(this.formatted+="||");const T=this.set[I];for(let R=0;R<T.length;R++)R>0&&(this.formatted+=" "),this.formatted+=T[R].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(I){I=I.replace(m,"");const R=((this.options.includePrerelease&&$)|(this.options.loose&&_))+":"+I,Z=n.get(R);if(Z)return Z;const O=this.options.loose,P=O?u[a.HYPHENRANGELOOSE]:u[a.HYPHENRANGE];I=I.replace(P,D(this.options.includePrerelease)),o("hyphen replace",I),I=I.replace(u[a.COMPARATORTRIM],f),o("comparator trim",I),I=I.replace(u[a.TILDETRIM],h),o("tilde trim",I),I=I.replace(u[a.CARETTRIM],p),o("caret trim",I);let B=I.split(" ").map(ee=>x(ee,this.options)).join(" ").split(/\s+/).map(ee=>k(ee,this.options));O&&(B=B.filter(ee=>(o("loose invalid filter",ee,this.options),!!ee.match(u[a.COMPARATORLOOSE])))),o("range list",B);const M=new Map,F=B.map(ee=>new i(ee,this.options));for(const ee of F){if(E(ee))return[ee];M.set(ee.value,ee)}M.size>1&&M.has("")&&M.delete("");const oe=[...M.values()];return n.set(R,oe),oe}intersects(I,T){if(!(I instanceof t))throw new TypeError("a Range is required");return this.set.some(R=>C(R,T)&&I.set.some(Z=>C(Z,T)&&R.every(O=>Z.every(P=>O.intersects(P,T)))))}test(I){if(!I)return!1;if(typeof I=="string")try{I=new c(I,this.options)}catch{return!1}for(let T=0;T<this.set.length;T++)if(j(this.set[T],I,this.options))return!0;return!1}}vr=t;const r=Vl(),n=new r,s=xt(),i=ft(),o=ct(),c=ne(),{safeRe:u,src:l,t:a,comparatorTrimReplace:f,tildeTrimReplace:h,caretTrimReplace:p}=Fe(),{FLAG_INCLUDE_PRERELEASE:$,FLAG_LOOSE:_}=Be(),m=new RegExp(l[a.BUILD],"g"),E=S=>S.value==="<0.0.0-0",y=S=>S.value==="",C=(S,I)=>{let T=!0;const R=S.slice();let Z=R.pop();for(;T&&R.length;)T=R.every(O=>Z.intersects(O,I)),Z=R.pop();return T},x=(S,I)=>(S=S.replace(u[a.BUILD],""),o("comp",S,I),S=L(S,I),o("caret",S),S=Q(S,I),o("tildes",S),S=v(S,I),o("xrange",S),S=w(S,I),o("stars",S),S),N=S=>!S||S.toLowerCase()==="x"||S==="*",U=(S,I,T)=>N(S)&&!N(I)||N(I)&&T&&!N(T),Q=(S,I)=>S.trim().split(/\s+/).map(T=>z(T,I)).join(" "),z=(S,I)=>{const T=I.loose?u[a.TILDELOOSE]:u[a.TILDE],R=I.includePrerelease?"-0":"";return S.replace(T,(Z,O,P,B,M)=>{o("tilde",S,Z,O,P,B,M);let F;return N(O)?F="":N(P)?F=`>=${O}.0.0${R} <${+O+1}.0.0-0`:N(B)?F=`>=${O}.${P}.0${R} <${O}.${+P+1}.0-0`:M?(o("replaceTilde pr",M),F=`>=${O}.${P}.${B}-${M} <${O}.${+P+1}.0-0`):F=`>=${O}.${P}.${B} <${O}.${+P+1}.0-0`,o("tilde return",F),F})},L=(S,I)=>S.trim().split(/\s+/).map(T=>d(T,I)).join(" "),d=(S,I)=>{o("caret",S,I);const T=I.loose?u[a.CARETLOOSE]:u[a.CARET],R=I.includePrerelease?"-0":"";return S.replace(T,(Z,O,P,B,M)=>{o("caret",S,Z,O,P,B,M);let F;return N(O)?F="":N(P)?F=`>=${O}.0.0${R} <${+O+1}.0.0-0`:N(B)?O==="0"?F=`>=${O}.${P}.0${R} <${O}.${+P+1}.0-0`:F=`>=${O}.${P}.0${R} <${+O+1}.0.0-0`:M?(o("replaceCaret pr",M),O==="0"?P==="0"?F=`>=${O}.${P}.${B}-${M} <${O}.${P}.${+B+1}-0`:F=`>=${O}.${P}.${B}-${M} <${O}.${+P+1}.0-0`:F=`>=${O}.${P}.${B}-${M} <${+O+1}.0.0-0`):(o("no pr"),O==="0"?P==="0"?F=`>=${O}.${P}.${B} <${O}.${P}.${+B+1}-0`:F=`>=${O}.${P}.${B} <${O}.${+P+1}.0-0`:F=`>=${O}.${P}.${B} <${+O+1}.0.0-0`),o("caret return",F),F})},v=(S,I)=>(o("replaceXRanges",S,I),S.split(/\s+/).map(T=>b(T,I)).join(" ")),b=(S,I)=>{S=S.trim();const T=I.loose?u[a.XRANGELOOSE]:u[a.XRANGE];return S.replace(T,(R,Z,O,P,B,M)=>{if(o("xRange",S,R,Z,O,P,B,M),U(O,P,B))return S;const F=N(O),oe=F||N(P),ee=oe||N(B),qe=ee;return Z==="="&&qe&&(Z=""),M=I.includePrerelease?"-0":"",F?Z===">"||Z==="<"?R="<0.0.0-0":R="*":Z&&qe?(oe&&(P=0),B=0,Z===">"?(Z=">=",oe?(O=+O+1,P=0,B=0):(P=+P+1,B=0)):Z==="<="&&(Z="<",oe?O=+O+1:P=+P+1),Z==="<"&&(M="-0"),R=`${Z+O}.${P}.${B}${M}`):oe?R=`>=${O}.0.0${M} <${+O+1}.0.0-0`:ee&&(R=`>=${O}.${P}.0${M} <${O}.${+P+1}.0-0`),o("xRange return",R),R})},w=(S,I)=>(o("replaceStars",S,I),S.trim().replace(u[a.STAR],"")),k=(S,I)=>(o("replaceGTE0",S,I),S.trim().replace(u[I.includePrerelease?a.GTE0PRE:a.GTE0],"")),D=S=>(I,T,R,Z,O,P,B,M,F,oe,ee,qe)=>(N(R)?T="":N(Z)?T=`>=${R}.0.0${S?"-0":""}`:N(O)?T=`>=${R}.${Z}.0${S?"-0":""}`:P?T=`>=${T}`:T=`>=${T}${S?"-0":""}`,N(F)?M="":N(oe)?M=`<${+F+1}.0.0-0`:N(ee)?M=`<${F}.${+oe+1}.0-0`:qe?M=`<=${F}.${oe}.${ee}-${qe}`:S?M=`<${F}.${oe}.${+ee+1}-0`:M=`<=${M}`,`${T} ${M}`.trim()),j=(S,I,T)=>{for(let R=0;R<S.length;R++)if(!S[R].test(I))return!1;if(I.prerelease.length&&!T.includePrerelease){for(let R=0;R<S.length;R++)if(o(S[R].semver),S[R].semver!==i.ANY&&S[R].semver.prerelease.length>0){const Z=S[R].semver;if(Z.major===I.major&&Z.minor===I.minor&&Z.patch===I.patch)return!0}return!1}return!0};return vr}var _r,Ys;function ft(){if(Ys)return _r;Ys=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(a,f){if(f=r(f),a instanceof t){if(a.loose===!!f.loose)return a;a=a.value}a=a.trim().split(/\s+/).join(" "),o("comparator",a,f),this.options=f,this.loose=!!f.loose,this.parse(a),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(a){const f=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],h=a.match(f);if(!h)throw new TypeError(`Invalid comparator: ${a}`);this.operator=h[1]!==void 0?h[1]:"",this.operator==="="&&(this.operator=""),h[2]?this.semver=new c(h[2],this.options.loose):this.semver=e}toString(){return this.value}test(a){if(o("Comparator.test",a,this.options.loose),this.semver===e||a===e)return!0;if(typeof a=="string")try{a=new c(a,this.options)}catch{return!1}return i(a,this.operator,this.semver,this.options)}intersects(a,f){if(!(a instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new u(a.value,f).test(this.value):a.operator===""?a.value===""?!0:new u(this.value,f).test(a.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||a.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||a.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&a.operator.startsWith(">")||this.operator.startsWith("<")&&a.operator.startsWith("<")||this.semver.version===a.semver.version&&this.operator.includes("=")&&a.operator.includes("=")||i(this.semver,"<",a.semver,f)&&this.operator.startsWith(">")&&a.operator.startsWith("<")||i(this.semver,">",a.semver,f)&&this.operator.startsWith("<")&&a.operator.startsWith(">")))}}_r=t;const r=xt(),{safeRe:n,t:s}=Fe(),i=Vs(),o=ct(),c=ne(),u=he();return _r}var Er,Js;function ht(){if(Js)return Er;Js=1;const e=he();return Er=(r,n,s)=>{try{n=new e(n,s)}catch{return!1}return n.test(r)},Er}var br,Qs;function Wl(){if(Qs)return br;Qs=1;const e=he();return br=(r,n)=>new e(r,n).set.map(s=>s.map(i=>i.value).join(" ").trim().split(" ")),br}var wr,ei;function Hl(){if(ei)return wr;ei=1;const e=ne(),t=he();return wr=(n,s,i)=>{let o=null,c=null,u=null;try{u=new t(s,i)}catch{return null}return n.forEach(l=>{u.test(l)&&(!o||c.compare(l)===-1)&&(o=l,c=new e(o,i))}),o},wr}var Sr,ti;function Xl(){if(ti)return Sr;ti=1;const e=ne(),t=he();return Sr=(n,s,i)=>{let o=null,c=null,u=null;try{u=new t(s,i)}catch{return null}return n.forEach(l=>{u.test(l)&&(!o||c.compare(l)===1)&&(o=l,c=new e(o,i))}),o},Sr}var Ir,ri;function Kl(){if(ri)return Ir;ri=1;const e=ne(),t=he(),r=lt();return Ir=(s,i)=>{s=new t(s,i);let o=new e("0.0.0");if(s.test(o)||(o=new e("0.0.0-0"),s.test(o)))return o;o=null;for(let c=0;c<s.set.length;++c){const u=s.set[c];let l=null;u.forEach(a=>{const f=new e(a.semver.version);switch(a.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!l||r(f,l))&&(l=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),l&&(!o||r(o,l))&&(o=l)}return o&&s.test(o)?o:null},Ir}var $r,ni;function Yl(){if(ni)return $r;ni=1;const e=he();return $r=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},$r}var yr,si;function Rr(){if(si)return yr;si=1;const e=ne(),t=ft(),{ANY:r}=t,n=he(),s=ht(),i=lt(),o=or(),c=hr(),u=lr();return yr=(a,f,h,p)=>{a=new e(a,p),f=new n(f,p);let $,_,m,E,y;switch(h){case">":$=i,_=c,m=o,E=">",y=">=";break;case"<":$=o,_=u,m=i,E="<",y="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(a,f,p))return!1;for(let C=0;C<f.set.length;++C){const x=f.set[C];let N=null,U=null;if(x.forEach(Q=>{Q.semver===r&&(Q=new t(">=0.0.0")),N=N||Q,U=U||Q,$(Q.semver,N.semver,p)?N=Q:m(Q.semver,U.semver,p)&&(U=Q)}),N.operator===E||N.operator===y||(!U.operator||U.operator===E)&&_(a,U.semver))return!1;if(U.operator===y&&m(a,U.semver))return!1}return!0},yr}var Ar,ii;function Jl(){if(ii)return Ar;ii=1;const e=Rr();return Ar=(r,n,s)=>e(r,n,">",s),Ar}var Tr,oi;function Ql(){if(oi)return Tr;oi=1;const e=Rr();return Tr=(r,n,s)=>e(r,n,"<",s),Tr}var Or,ai;function ef(){if(ai)return Or;ai=1;const e=he();return Or=(r,n,s)=>(r=new e(r,s),n=new e(n,s),r.intersects(n,s)),Or}var kr,ui;function tf(){if(ui)return kr;ui=1;const e=ht(),t=fe();return kr=(r,n,s)=>{const i=[];let o=null,c=null;const u=r.sort((h,p)=>t(h,p,s));for(const h of u)e(h,n,s)?(c=h,o||(o=h)):(c&&i.push([o,c]),c=null,o=null);o&&i.push([o,null]);const l=[];for(const[h,p]of i)h===p?l.push(h):!p&&h===u[0]?l.push("*"):p?h===u[0]?l.push(`<=${p}`):l.push(`${h} - ${p}`):l.push(`>=${h}`);const a=l.join(" || "),f=typeof n.raw=="string"?n.raw:String(n);return a.length<f.length?a:n},kr}var Pr,ci;function rf(){if(ci)return Pr;ci=1;const e=he(),t=ft(),{ANY:r}=t,n=ht(),s=fe(),i=(f,h,p={})=>{if(f===h)return!0;f=new e(f,p),h=new e(h,p);let $=!1;e:for(const _ of f.set){for(const m of h.set){const E=u(_,m,p);if($=$||E!==null,E)continue e}if($)return!1}return!0},o=[new t(">=0.0.0-0")],c=[new t(">=0.0.0")],u=(f,h,p)=>{if(f===h)return!0;if(f.length===1&&f[0].semver===r){if(h.length===1&&h[0].semver===r)return!0;p.includePrerelease?f=o:f=c}if(h.length===1&&h[0].semver===r){if(p.includePrerelease)return!0;h=c}const $=new Set;let _,m;for(const z of f)z.operator===">"||z.operator===">="?_=l(_,z,p):z.operator==="<"||z.operator==="<="?m=a(m,z,p):$.add(z.semver);if($.size>1)return null;let E;if(_&&m){if(E=s(_.semver,m.semver,p),E>0)return null;if(E===0&&(_.operator!==">="||m.operator!=="<="))return null}for(const z of $){if(_&&!n(z,String(_),p)||m&&!n(z,String(m),p))return null;for(const L of h)if(!n(z,String(L),p))return!1;return!0}let y,C,x,N,U=m&&!p.includePrerelease&&m.semver.prerelease.length?m.semver:!1,Q=_&&!p.includePrerelease&&_.semver.prerelease.length?_.semver:!1;U&&U.prerelease.length===1&&m.operator==="<"&&U.prerelease[0]===0&&(U=!1);for(const z of h){if(N=N||z.operator===">"||z.operator===">=",x=x||z.operator==="<"||z.operator==="<=",_){if(Q&&z.semver.prerelease&&z.semver.prerelease.length&&z.semver.major===Q.major&&z.semver.minor===Q.minor&&z.semver.patch===Q.patch&&(Q=!1),z.operator===">"||z.operator===">="){if(y=l(_,z,p),y===z&&y!==_)return!1}else if(_.operator===">="&&!z.test(_.semver))return!1}if(m){if(U&&z.semver.prerelease&&z.semver.prerelease.length&&z.semver.major===U.major&&z.semver.minor===U.minor&&z.semver.patch===U.patch&&(U=!1),z.operator==="<"||z.operator==="<="){if(C=a(m,z,p),C===z&&C!==m)return!1}else if(m.operator==="<="&&!z.test(m.semver))return!1}if(!z.operator&&(m||_)&&E!==0)return!1}return!(_&&x&&!m&&E!==0||m&&N&&!_&&E!==0||Q||U)},l=(f,h,p)=>{if(!f)return h;const $=s(f.semver,h.semver,p);return $>0?f:$<0||h.operator===">"&&f.operator===">="?h:f},a=(f,h,p)=>{if(!f)return h;const $=s(f.semver,h.semver,p);return $<0?f:$>0||h.operator==="<"&&f.operator==="<="?h:f};return Pr=i,Pr}var Cr,li;function nf(){if(li)return Cr;li=1;const e=Fe(),t=Be(),r=ne(),n=bs(),s=ke(),i=Cl(),o=Nl(),c=Ll(),u=zl(),l=Zl(),a=Dl(),f=jl(),h=xl(),p=fe(),$=Ml(),_=Ul(),m=tr(),E=Bl(),y=Fl(),C=lt(),x=or(),N=Ms(),U=Bs(),Q=lr(),z=hr(),L=Vs(),d=ql(),v=Gl(),b=ft(),w=he(),k=ht(),D=Wl(),j=Hl(),S=Xl(),I=Kl(),T=Yl(),R=Rr(),Z=Jl(),O=Ql(),P=ef(),B=tf(),M=rf();return Cr={parse:s,valid:i,clean:o,inc:c,diff:u,major:l,minor:a,patch:f,prerelease:h,compare:p,rcompare:$,compareLoose:_,compareBuild:m,sort:E,rsort:y,gt:C,lt:x,eq:N,neq:U,gte:Q,lte:z,cmp:L,coerce:d,truncate:v,Comparator:b,Range:w,satisfies:k,toComparators:D,maxSatisfying:j,minSatisfying:S,minVersion:I,validRange:T,outside:R,gtr:Z,ltr:O,intersects:P,simplifyRange:B,subset:M,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},Cr}var sf=nf();const Nr=yl(sf),fi=ve(te().min(1)).refine(e=>new Set(e).size===e.length,{message:"Array items must be unique"});function hi(e){const t=e({type:G("string")}),r=e({type:G("number"),integer:G(!0).optional(),min:re().optional(),max:re().optional()}),n=e({type:G("boolean")}),s=e({type:G("option"),options:fi}),i=de([t,r,n,s]),o=(E,y)=>y?E.optional():E,c=E=>e({type:G("string"),default:o(te(),!E.defaultRequired)}),u=E=>e({type:G("number"),integer:Ze().optional(),min:re().optional(),max:re().optional(),default:o(re(),!E.defaultRequired)}),l=E=>e({type:G("boolean"),default:o(Ze(),!E.defaultRequired)}),a=E=>e({type:G("option"),options:fi.optional(),default:o(te(),!E.defaultRequired)}),f=E=>de([c(E),u(E),l(E),a(E)]),h=e({name:te().min(1),value:f({defaultRequired:!1})}),p=e({name:te().min(1),value:i.optional()}),$=e({name:te().min(1),value:f({defaultRequired:!0}),writableFromCogs:G(!0).optional(),writableFromClient:G(!0).optional()}),_=E=>{try{return new ps(E),!0}catch{return!1}};return e({version:de([rt([ge()]),rt([ge(),G("."),ge()]),rt([ge(),G("."),ge(),G("."),ge()])]),name:te(),minCogsVersion:rt([ge(),G("."),ge(),G("."),ge()]).optional(),description:te().optional(),icon:te().optional(),indexPath:te().optional(),window:q({width:re().gt(0).int(),height:re().gt(0).int(),visible:Ze().optional()}).optional(),config:ve(h).optional(),events:q({fromCogs:ve(p).optional(),toCogs:ve(p).optional()}).optional(),state:ve($).optional(),media:q({audio:G(!0).optional(),video:G(!0).optional(),images:G(!0).optional()}).optional(),store:q({items:Zn(te(),e({persistValue:Ze().optional()})).optional()}).optional(),permissions:At({network:At({access:ve(e({hosts:ve(te().refine(_,{error:"Invalid network host pattern"})).min(1),caCertificates:ve(te().min(1)).optional()})).optional()}).optional()}).optional()}).refine(E=>!!(!E.permissions?.network?.access||E.minCogsVersion&&Nr.gte(E.minCogsVersion,"5.11.0")),{path:["permissions","network","access"],message:"minCogsVersion must be at least 5.11.0"})}const of=hi(q),af=hi(At);function uf(e){let t=of;typeof e=="object"&&e.minCogsVersion&&Nr.valid(e.minCogsVersion)&&Nr.gte(e.minCogsVersion,"5.11.0")&&(t=af);const r=t.safeParse(e);return r.success?null:r.error.issues.map(n=>`${n.path.join(".")||"root"}: ${n.message}`)}H.CogsConfigChangedEvent=Ur,H.CogsConnection=ki,H.CogsConnectionCloseEvent=xr,H.CogsConnectionOpenEvent=jr,H.CogsIncomingEvent=Fr,H.CogsMediaConfigChangedEvent=qr,H.CogsMessageEvent=Mr,H.CogsShowPhaseChangedEvent=Gr,H.CogsStateChangedEvent=Br,H.DataStoreItemEvent=pt,H.DataStoreItemsEvent=mt,H.ManifestTypes=Pl,H.MediaPreloader=es,H.MediaSchema=hl,H.NetworkHostPattern=ps,H.SurfaceManager=$l,H.assetUrl=Dr,H.getPluginManifestErrors=uf,H.getStateAtTime=st,H.preloadUrl=wi,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
@@ -11,5 +11,6 @@ export declare class NetworkHostPattern {
11
11
  constructor(pattern: string);
12
12
  /** Checks whether `host` and `port` are matched by this pattern. */
13
13
  validate(host: string, port: number): boolean;
14
- private matchesHost;
14
+ /** Checks whether `host` is matched by the hostname part of this pattern, ignoring the port. */
15
+ validateHostname(host: string): boolean;
15
16
  }
@@ -23,9 +23,10 @@ export class NetworkHostPattern {
23
23
  }
24
24
  /** Checks whether `host` and `port` are matched by this pattern. */
25
25
  validate(host, port) {
26
- return this.matchesHost(host) && (this.port === '*' || Number(this.port) === port);
26
+ return this.validateHostname(host) && (this.port === '*' || Number(this.port) === port);
27
27
  }
28
- matchesHost(host) {
28
+ /** Checks whether `host` is matched by the hostname part of this pattern, ignoring the port. */
29
+ validateHostname(host) {
29
30
  // Hostnames are case-insensitive; IP literals are unaffected by lowercasing.
30
31
  const patternHost = this.host.toLowerCase();
31
32
  host = host.toLowerCase();
@@ -1,4 +1,5 @@
1
1
  // Check an iOS-only property (See https://developer.mozilla.org/en-US/docs/Web/API/Navigator#non-standard_properties)
2
2
  export const IS_IOS = typeof navigator !== 'undefined' && typeof navigator.standalone !== 'undefined';
3
3
  // https://evilmartians.com/chronicles/how-to-detect-safari-and-ios-versions-with-ease
4
- export const IS_WEBKIT = 'GestureEvent' in window;
4
+ // We use `globalThis` instead of `window` to allow the library to load in non-browser environments (e.g. Node.js)
5
+ export const IS_WEBKIT = 'GestureEvent' in globalThis;
@@ -130,7 +130,7 @@ function createManifestSchema(objectSchemaFactory) {
130
130
  access: z
131
131
  .array(objectSchemaFactory({
132
132
  hosts: z.array(z.string().refine(validateNetworkHostPattern, { error: 'Invalid network host pattern' })).min(1),
133
- caCertificate: z.string().optional(),
133
+ caCertificates: z.array(z.string().min(1)).optional(),
134
134
  }))
135
135
  .optional(),
136
136
  })
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Connect to COGS to build a custom Media Master",
4
4
  "author": "Clockwork Dog <info@clockwork.dog>",
5
5
  "homepage": "https://github.com/clockwork-dog/cogs-sdk/tree/main/packages/javascript",
6
- "version": "3.1.2",
6
+ "version": "3.1.4",
7
7
  "keywords": [],
8
8
  "license": "MIT",
9
9
  "repository": {
@@ -37,7 +37,7 @@
37
37
  "cy:generate": "cypress run --e2e"
38
38
  },
39
39
  "dependencies": {
40
- "@clockworkdog/timesync": "^3.1.2",
40
+ "@clockworkdog/timesync": "^3.1.4",
41
41
  "ip-address": "^10.2.0",
42
42
  "reconnecting-websocket": "^4.4.0",
43
43
  "semver": "^7.8.5",