@transitive-sdk/utils-web 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/hooks.jsx CHANGED
@@ -182,7 +182,7 @@ this hook also returns any functions and objects the component exports in
182
182
  ```
183
183
  */
184
184
  export const useCapability = ({ capability, name, userId, deviceId,
185
- host = 'transitiverobotics.com', ssl = true, testing = false
185
+ host = 'transitiverobotics.com', ssl = true
186
186
  }) => {
187
187
 
188
188
  const [returns, setReturns] = useState({ loaded: false });
@@ -210,8 +210,7 @@ export const useCapability = ({ capability, name, userId, deviceId,
210
210
  }
211
211
  listeners[name] = [done];
212
212
 
213
- const baseUrl = testing ? '' : // for testing
214
- `http${ssl ? 's' : ''}://portal.${host}`;
213
+ const baseUrl = `http${ssl ? 's' : ''}://portal.${host}`;
215
214
  const params = new URLSearchParams({userId, deviceId});
216
215
  // filename without extension as we'll try multiple
217
216
  const fileBasename = `${baseUrl}/running/${capability}/dist/${name}`;
package/client/shared.jsx CHANGED
@@ -117,9 +117,9 @@ export const Timer = ({duration, onTimeout, onStart, setOnDisconnect, children})
117
117
  />
118
118
  ```
119
119
  */
120
- export const TransitiveCapability = ({jwt, ssl = true,
121
- host = 'transitiverobotics.com', testing = false,
122
- ...config }) => {
120
+ export const TransitiveCapability = ({
121
+ jwt, host = 'transitiverobotics.com', ssl = true, ...config
122
+ }) => {
123
123
 
124
124
  const {id, device, capability} = decodeJWT(jwt);
125
125
  const type = device == '_fleet' ? 'fleet' : 'device';
@@ -131,20 +131,25 @@ export const TransitiveCapability = ({jwt, ssl = true,
131
131
  name,
132
132
  userId: id || config.userId, // accept both id and userId, see #492
133
133
  deviceId: device,
134
- testing,
135
134
  host,
136
135
  ssl
137
136
  });
138
137
 
139
138
  const ref = useRef();
140
- // Attach functional and object properties to the component when ready
139
+ // Attach functional and object properties to the component when ready and
140
+ // on change
141
141
  useEffect(() => {
142
- ref.current?.instance?.setState(s =>
142
+ ref.current?.instance?.setState(s =>
143
143
  ({ ...s, id, jwt, host, ssl, ...config }));
144
- }, [ref.current]);
144
+ }, [ref.current, id, jwt, host, ssl, ...Object.values(config)]);
145
+
146
+ // Disrupt the reactive chain of the MutationObserver to the customElement,
147
+ // so we are not competing with it for updating the props.
148
+ const propClone = useMemo(() => ({id, jwt, host, ssl, ...config}), []);
145
149
 
146
150
  if (!loaded) return <div>Loading {name}</div>;
147
- return React.createElement(name, {id, jwt, host, ssl, ...config, ref});
151
+ // return React.createElement(name, {id, jwt, host, ssl, ...config, ref});
152
+ return React.createElement(name, {...propClone, ref});
148
153
  };
149
154
 
150
155
 
@@ -211,12 +216,12 @@ export const createWebComponent = (Component, name, version = '0.0.0',
211
216
  webComponentConstructed(instance) {
212
217
  // Observe all changes to attributes and update React state from it
213
218
  const observer = new MutationObserver((mutationRecords) => {
214
- const update = {};
215
- mutationRecords.forEach(({attributeName}) => {
216
- update[attributeName] = instance.getAttribute(attributeName);
217
- });
218
- this.setState(old => ({...old, ...update}));
219
- }).observe(instance, { attributes: true });
219
+ const update = {};
220
+ mutationRecords.forEach(({attributeName}) => {
221
+ update[attributeName] = instance.getAttribute(attributeName);
222
+ });
223
+ this.setState(old => ({...old, ...update}));
224
+ }).observe(instance, { attributes: true });
220
225
  }
221
226
 
222
227
  webComponentDisconnected() {
package/dist/utils-web.js CHANGED
@@ -1,9 +1,9 @@
1
- var tn=Object.create;var Ne=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var sn=Object.getOwnPropertyNames;var nn=Object.getPrototypeOf,on=Object.prototype.hasOwnProperty;var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dt=(t,e)=>{for(var r in e)Ne(t,r,{get:e[r],enumerable:!0})},Re=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of sn(e))!on.call(t,n)&&n!==r&&Ne(t,n,{get:()=>e[n],enumerable:!(s=rn(e,n))||s.enumerable});return t},A=(t,e,r)=>(Re(t,e,"default"),r&&Re(r,e,"default")),D=(t,e,r)=>(r=t!=null?tn(nn(t)):{},Re(e||!t||!t.__esModule?Ne(r,"default",{value:t,enumerable:!0}):r,t)),an=t=>Re(Ne({},"__esModule",{value:!0}),t);var Je=x((Fi,Ae)=>{(function(){"use strict";var t={}.hasOwnProperty,e="[native code]";function r(){for(var s=[],n=0;n<arguments.length;n++){var o=arguments[n];if(o){var i=typeof o;if(i==="string"||i==="number")s.push(o);else if(Array.isArray(o)){if(o.length){var a=r.apply(null,o);a&&s.push(a)}}else if(i==="object"){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){s.push(o.toString());continue}for(var l in o)t.call(o,l)&&o[l]&&s.push(l)}}}return s.join(" ")}typeof Ae<"u"&&Ae.exports?(r.default=r,Ae.exports=r):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return r}):window.classNames=r})()});var Jt=x((zi,Wt)=>{Wt.exports=()=>{try{return require("react-web-component-style-loader/exports").styleElements}catch{return[]}}});var Qt=x((Qi,zt)=>{zt.exports=function(e){if(!e.attributes)return{};let r={},s,o=[...e.attributes].map(i=>({[i.name]:i.value}));for(s of o){let i=Object.keys(s)[0],a=i.replace(/-([a-z])/g,l=>l[1].toUpperCase());r[a]=s[i]}return r}});var Yt=x((Ki,Kt)=>{var gn=require("react"),mn=require("react-dom"),bn=require("react-shadow-dom-retarget-events"),yn=Jt(),En=Qt(),vn={attachedCallback:"webComponentAttached",connectedCallback:"webComponentConnected",disconnectedCallback:"webComponentDisconnected",adoptedCallback:"webComponentAdopted"};Kt.exports={create:(t,e,r=!0,s=void 0)=>{let n=class extends HTMLElement{instance=null;callConstructorHook(){this.instance.webComponentConstructed&&this.instance.webComponentConstructed.apply(this.instance,[this])}callLifeCycleHook(o,i=[]){let a=vn[o];a&&this.instance&&this.instance[a]&&this.instance[a].apply(this.instance,i)}connectedCallback(){let o=this,i=o;if(r){let a=o.attachShadow({mode:"open"});i=document.createElement("div"),yn().forEach(c=>{a.appendChild(c.cloneNode(a))}),a.appendChild(i),bn(a)}mn.render(gn.createElement(t,En(o)),i,function(){o.instance=this,o.callConstructorHook(),o.callLifeCycleHook("connectedCallback")})}disconnectedCallback(){this.callLifeCycleHook("disconnectedCallback")}adoptedCallback(o,i){this.callLifeCycleHook("adoptedCallback",[o,i])}call(o,i){return s?.current?.[o]?.call(s?.current,i)}getConfig(){return this.instance.state.config}};return customElements.define(e,n),n}}});var ge=x((Zi,Zt)=>{var xn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Zt.exports=xn});var Ze=x((ea,er)=>{var $n="2.0.0",wn=Number.MAX_SAFE_INTEGER||9007199254740991,Tn=16;er.exports={SEMVER_SPEC_VERSION:$n,MAX_LENGTH:256,MAX_SAFE_INTEGER:wn,MAX_SAFE_COMPONENT_LENGTH:Tn}});var Ce=x((W,tr)=>{var{MAX_SAFE_COMPONENT_LENGTH:et}=Ze(),On=ge();W=tr.exports={};var In=W.re=[],d=W.src=[],p=W.t={},Rn=0,b=(t,e,r)=>{let s=Rn++;On(s,e),p[t]=s,d[s]=e,In[s]=new RegExp(e,r?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\d*");b("NUMERICIDENTIFIERLOOSE","[0-9]+");b("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");b("MAINVERSION",`(${d[p.NUMERICIDENTIFIER]})\\.(${d[p.NUMERICIDENTIFIER]})\\.(${d[p.NUMERICIDENTIFIER]})`);b("MAINVERSIONLOOSE",`(${d[p.NUMERICIDENTIFIERLOOSE]})\\.(${d[p.NUMERICIDENTIFIERLOOSE]})\\.(${d[p.NUMERICIDENTIFIERLOOSE]})`);b("PRERELEASEIDENTIFIER",`(?:${d[p.NUMERICIDENTIFIER]}|${d[p.NONNUMERICIDENTIFIER]})`);b("PRERELEASEIDENTIFIERLOOSE",`(?:${d[p.NUMERICIDENTIFIERLOOSE]}|${d[p.NONNUMERICIDENTIFIER]})`);b("PRERELEASE",`(?:-(${d[p.PRERELEASEIDENTIFIER]}(?:\\.${d[p.PRERELEASEIDENTIFIER]})*))`);b("PRERELEASELOOSE",`(?:-?(${d[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[p.PRERELEASEIDENTIFIERLOOSE]})*))`);b("BUILDIDENTIFIER","[0-9A-Za-z-]+");b("BUILD",`(?:\\+(${d[p.BUILDIDENTIFIER]}(?:\\.${d[p.BUILDIDENTIFIER]})*))`);b("FULLPLAIN",`v?${d[p.MAINVERSION]}${d[p.PRERELEASE]}?${d[p.BUILD]}?`);b("FULL",`^${d[p.FULLPLAIN]}$`);b("LOOSEPLAIN",`[v=\\s]*${d[p.MAINVERSIONLOOSE]}${d[p.PRERELEASELOOSE]}?${d[p.BUILD]}?`);b("LOOSE",`^${d[p.LOOSEPLAIN]}$`);b("GTLT","((?:<|>)?=?)");b("XRANGEIDENTIFIERLOOSE",`${d[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);b("XRANGEIDENTIFIER",`${d[p.NUMERICIDENTIFIER]}|x|X|\\*`);b("XRANGEPLAIN",`[v=\\s]*(${d[p.XRANGEIDENTIFIER]})(?:\\.(${d[p.XRANGEIDENTIFIER]})(?:\\.(${d[p.XRANGEIDENTIFIER]})(?:${d[p.PRERELEASE]})?${d[p.BUILD]}?)?)?`);b("XRANGEPLAINLOOSE",`[v=\\s]*(${d[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[p.XRANGEIDENTIFIERLOOSE]})(?:${d[p.PRERELEASELOOSE]})?${d[p.BUILD]}?)?)?`);b("XRANGE",`^${d[p.GTLT]}\\s*${d[p.XRANGEPLAIN]}$`);b("XRANGELOOSE",`^${d[p.GTLT]}\\s*${d[p.XRANGEPLAINLOOSE]}$`);b("COERCE",`(^|[^\\d])(\\d{1,${et}})(?:\\.(\\d{1,${et}}))?(?:\\.(\\d{1,${et}}))?(?:$|[^\\d])`);b("COERCERTL",d[p.COERCE],!0);b("LONETILDE","(?:~>?)");b("TILDETRIM",`(\\s*)${d[p.LONETILDE]}\\s+`,!0);W.tildeTrimReplace="$1~";b("TILDE",`^${d[p.LONETILDE]}${d[p.XRANGEPLAIN]}$`);b("TILDELOOSE",`^${d[p.LONETILDE]}${d[p.XRANGEPLAINLOOSE]}$`);b("LONECARET","(?:\\^)");b("CARETTRIM",`(\\s*)${d[p.LONECARET]}\\s+`,!0);W.caretTrimReplace="$1^";b("CARET",`^${d[p.LONECARET]}${d[p.XRANGEPLAIN]}$`);b("CARETLOOSE",`^${d[p.LONECARET]}${d[p.XRANGEPLAINLOOSE]}$`);b("COMPARATORLOOSE",`^${d[p.GTLT]}\\s*(${d[p.LOOSEPLAIN]})$|^$`);b("COMPARATOR",`^${d[p.GTLT]}\\s*(${d[p.FULLPLAIN]})$|^$`);b("COMPARATORTRIM",`(\\s*)${d[p.GTLT]}\\s*(${d[p.LOOSEPLAIN]}|${d[p.XRANGEPLAIN]})`,!0);W.comparatorTrimReplace="$1$2$3";b("HYPHENRANGE",`^\\s*(${d[p.XRANGEPLAIN]})\\s+-\\s+(${d[p.XRANGEPLAIN]})\\s*$`);b("HYPHENRANGELOOSE",`^\\s*(${d[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[p.XRANGEPLAINLOOSE]})\\s*$`);b("STAR","(<|>)?=?\\s*\\*");b("GTE0","^\\s*>=\\s*0.0.0\\s*$");b("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")});var Le=x((ta,rr)=>{var Nn=["includePrerelease","loose","rtl"],An=t=>t?typeof t!="object"?{loose:!0}:Nn.filter(e=>t[e]).reduce((e,r)=>(e[r]=!0,e),{}):{};rr.exports=An});var ir=x((ra,or)=>{var sr=/^[0-9]+$/,nr=(t,e)=>{let r=sr.test(t),s=sr.test(e);return r&&s&&(t=+t,e=+e),t===e?0:r&&!s?-1:s&&!r?1:t<e?-1:1},Sn=(t,e)=>nr(e,t);or.exports={compareIdentifiers:nr,rcompareIdentifiers:Sn}});var be=x((sa,ur)=>{var Pe=ge(),{MAX_LENGTH:ar,MAX_SAFE_INTEGER:qe}=Ze(),{re:lr,t:cr}=Ce(),Cn=Le(),{compareIdentifiers:me}=ir(),tt=class t{constructor(e,r){if(r=Cn(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid Version: ${e}`);if(e.length>ar)throw new TypeError(`version is longer than ${ar} characters`);Pe("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=e.trim().match(r.loose?lr[cr.LOOSE]:lr[cr.FULL]);if(!s)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>qe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>qe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>qe||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let o=+n;if(o>=0&&o<qe)return o}return n}):this.prerelease=[],this.build=s[5]?s[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(e){if(Pe("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),me(this.major,e.major)||me(this.minor,e.minor)||me(this.patch,e.patch)}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let s=this.prerelease[r],n=e.prerelease[r];if(Pe("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return me(s,n)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let s=this.build[r],n=e.build[r];if(Pe("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return me(s,n)}while(++r)}inc(e,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r),this.inc("pre",r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r),this.inc("pre",r);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":if(this.prerelease.length===0)this.prerelease=[0];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);s===-1&&this.prerelease.push(0)}r&&(this.prerelease[0]===r?isNaN(this.prerelease[1])&&(this.prerelease=[r,0]):this.prerelease=[r,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};ur.exports=tt});var J=x((na,hr)=>{var fr=be(),Ln=(t,e,r)=>new fr(t,r).compare(new fr(e,r));hr.exports=Ln});var pr=x((oa,dr)=>{"use strict";dr.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var mr=x((ia,gr)=>{"use strict";gr.exports=O;O.Node=Z;O.create=O;function O(t){var e=this;if(e instanceof O||(e=new O),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(n){e.push(n)});else if(arguments.length>0)for(var r=0,s=arguments.length;r<s;r++)e.push(arguments[r]);return e}O.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e};O.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}};O.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}};O.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)qn(this,arguments[t]);return this.length};O.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)Dn(this,arguments[t]);return this.length};O.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}};O.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}};O.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,s=0;r!==null;s++)t.call(e,r.value,s,this),r=r.next};O.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,s=this.length-1;r!==null;s--)t.call(e,r.value,s,this),r=r.prev};O.prototype.get=function(t){for(var e=0,r=this.head;r!==null&&e<t;e++)r=r.next;if(e===t&&r!==null)return r.value};O.prototype.getReverse=function(t){for(var e=0,r=this.tail;r!==null&&e<t;e++)r=r.prev;if(e===t&&r!==null)return r.value};O.prototype.map=function(t,e){e=e||this;for(var r=new O,s=this.head;s!==null;)r.push(t.call(e,s.value,this)),s=s.next;return r};O.prototype.mapReverse=function(t,e){e=e||this;for(var r=new O,s=this.tail;s!==null;)r.push(t.call(e,s.value,this)),s=s.prev;return r};O.prototype.reduce=function(t,e){var r,s=this.head;if(arguments.length>1)r=e;else if(this.head)s=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;s!==null;n++)r=t(r,s.value,n),s=s.next;return r};O.prototype.reduceReverse=function(t,e){var r,s=this.tail;if(arguments.length>1)r=e;else if(this.tail)s=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=this.length-1;s!==null;n--)r=t(r,s.value,n),s=s.prev;return r};O.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;r!==null;e++)t[e]=r.value,r=r.next;return t};O.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;r!==null;e++)t[e]=r.value,r=r.prev;return t};O.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new O;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var s=0,n=this.head;n!==null&&s<t;s++)n=n.next;for(;n!==null&&s<e;s++,n=n.next)r.push(n.value);return r};O.prototype.sliceReverse=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new O;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var s=this.length,n=this.tail;n!==null&&s>e;s--)n=n.prev;for(;n!==null&&s>t;s--,n=n.prev)r.push(n.value);return r};O.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var s=0,n=this.head;n!==null&&s<t;s++)n=n.next;for(var o=[],s=0;n&&s<e;s++)o.push(n.value),n=this.removeNode(n);n===null&&(n=this.tail),n!==this.head&&n!==this.tail&&(n=n.prev);for(var s=0;s<r.length;s++)n=Pn(this,n,r[s]);return o};O.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;r!==null;r=r.prev){var s=r.prev;r.prev=r.next,r.next=s}return this.head=e,this.tail=t,this};function Pn(t,e,r){var s=e===t.head?new Z(r,null,e,t):new Z(r,e,e.next,t);return s.next===null&&(t.tail=s),s.prev===null&&(t.head=s),t.length++,s}function qn(t,e){t.tail=new Z(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function Dn(t,e){t.head=new Z(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function Z(t,e,r,s){if(!(this instanceof Z))return new Z(t,e,r,s);this.list=s,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}try{pr()(O)}catch{}});var xr=x((aa,vr)=>{"use strict";var Fn=mr(),ee=Symbol("max"),H=Symbol("length"),ne=Symbol("lengthCalculator"),Ee=Symbol("allowStale"),te=Symbol("maxAge"),U=Symbol("dispose"),br=Symbol("noDisposeOnSet"),S=Symbol("lruList"),G=Symbol("cache"),Er=Symbol("updateAgeOnGet"),rt=()=>1,nt=class{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let r=this[ee]=e.max||1/0,s=e.length||rt;if(this[ne]=typeof s!="function"?rt:s,this[Ee]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[te]=e.maxAge||0,this[U]=e.dispose,this[br]=e.noDisposeOnSet||!1,this[Er]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[ee]=e||1/0,ye(this)}get max(){return this[ee]}set allowStale(e){this[Ee]=!!e}get allowStale(){return this[Ee]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[te]=e,ye(this)}get maxAge(){return this[te]}set lengthCalculator(e){typeof e!="function"&&(e=rt),e!==this[ne]&&(this[ne]=e,this[H]=0,this[S].forEach(r=>{r.length=this[ne](r.value,r.key),this[H]+=r.length})),ye(this)}get lengthCalculator(){return this[ne]}get length(){return this[H]}get itemCount(){return this[S].length}rforEach(e,r){r=r||this;for(let s=this[S].tail;s!==null;){let n=s.prev;yr(this,e,s,r),s=n}}forEach(e,r){r=r||this;for(let s=this[S].head;s!==null;){let n=s.next;yr(this,e,s,r),s=n}}keys(){return this[S].toArray().map(e=>e.key)}values(){return this[S].toArray().map(e=>e.value)}reset(){this[U]&&this[S]&&this[S].length&&this[S].forEach(e=>this[U](e.key,e.value)),this[G]=new Map,this[S]=new Fn,this[H]=0}dump(){return this[S].map(e=>De(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[S]}set(e,r,s){if(s=s||this[te],s&&typeof s!="number")throw new TypeError("maxAge must be a number");let n=s?Date.now():0,o=this[ne](r,e);if(this[G].has(e)){if(o>this[ee])return oe(this,this[G].get(e)),!1;let l=this[G].get(e).value;return this[U]&&(this[br]||this[U](e,l.value)),l.now=n,l.maxAge=s,l.value=r,this[H]+=o-l.length,l.length=o,this.get(e),ye(this),!0}let i=new ot(e,r,o,n,s);return i.length>this[ee]?(this[U]&&this[U](e,r),!1):(this[H]+=i.length,this[S].unshift(i),this[G].set(e,this[S].head),ye(this),!0)}has(e){if(!this[G].has(e))return!1;let r=this[G].get(e).value;return!De(this,r)}get(e){return st(this,e,!0)}peek(e){return st(this,e,!1)}pop(){let e=this[S].tail;return e?(oe(this,e),e.value):null}del(e){oe(this,this[G].get(e))}load(e){this.reset();let r=Date.now();for(let s=e.length-1;s>=0;s--){let n=e[s],o=n.e||0;if(o===0)this.set(n.k,n.v);else{let i=o-r;i>0&&this.set(n.k,n.v,i)}}}prune(){this[G].forEach((e,r)=>st(this,r,!1))}},st=(t,e,r)=>{let s=t[G].get(e);if(s){let n=s.value;if(De(t,n)){if(oe(t,s),!t[Ee])return}else r&&(t[Er]&&(s.value.now=Date.now()),t[S].unshiftNode(s));return n.value}},De=(t,e)=>{if(!e||!e.maxAge&&!t[te])return!1;let r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[te]&&r>t[te]},ye=t=>{if(t[H]>t[ee])for(let e=t[S].tail;t[H]>t[ee]&&e!==null;){let r=e.prev;oe(t,e),e=r}},oe=(t,e)=>{if(e){let r=e.value;t[U]&&t[U](r.key,r.value),t[H]-=r.length,t[G].delete(r.key),t[S].removeNode(e)}},ot=class{constructor(e,r,s,n,o){this.key=e,this.value=r,this.length=s,this.now=n,this.maxAge=o||0}},yr=(t,e,r,s)=>{let n=r.value;De(t,n)&&(oe(t,r),t[Ee]||(n=void 0)),n&&e.call(s,n.value,n.key,t)};vr.exports=nt});var wr=x((la,$r)=>{var Bn=J(),Mn=(t,e,r)=>Bn(t,e,r)===0;$r.exports=Mn});var Or=x((ca,Tr)=>{var kn=J(),jn=(t,e,r)=>kn(t,e,r)!==0;Tr.exports=jn});var it=x((ua,Ir)=>{var Gn=J(),_n=(t,e,r)=>Gn(t,e,r)>0;Ir.exports=_n});var Nr=x((fa,Rr)=>{var Un=J(),Hn=(t,e,r)=>Un(t,e,r)>=0;Rr.exports=Hn});var Sr=x((ha,Ar)=>{var Vn=J(),Xn=(t,e,r)=>Vn(t,e,r)<0;Ar.exports=Xn});var Lr=x((da,Cr)=>{var Wn=J(),Jn=(t,e,r)=>Wn(t,e,r)<=0;Cr.exports=Jn});var qr=x((pa,Pr)=>{var zn=wr(),Qn=Or(),Kn=it(),Yn=Nr(),Zn=Sr(),eo=Lr(),to=(t,e,r,s)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return zn(t,r,s);case"!=":return Qn(t,r,s);case">":return Kn(t,r,s);case">=":return Yn(t,r,s);case"<":return Zn(t,r,s);case"<=":return eo(t,r,s);default:throw new TypeError(`Invalid operator: ${e}`)}};Pr.exports=to});var jr=x((ga,kr)=>{var ve=Symbol("SemVer ANY"),ct=class t{static get ANY(){return ve}constructor(e,r){if(r=ro(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}lt("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===ve?this.value="":this.value=this.operator+this.semver.version,lt("comp",this)}parse(e){let r=this.options.loose?Dr[Fr.COMPARATORLOOSE]:Dr[Fr.COMPARATOR],s=e.match(r);if(!s)throw new TypeError(`Invalid comparator: ${e}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new Br(s[2],this.options.loose):this.semver=ve}toString(){return this.value}test(e){if(lt("Comparator.test",e,this.options.loose),this.semver===ve||e===ve)return!0;if(typeof e=="string")try{e=new Br(e,this.options)}catch{return!1}return at(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");if((!r||typeof r!="object")&&(r={loose:!!r,includePrerelease:!1}),this.operator==="")return this.value===""?!0:new Mr(e.value,r).test(this.value);if(e.operator==="")return e.value===""?!0:new Mr(this.value,r).test(e.semver);let s=(this.operator===">="||this.operator===">")&&(e.operator===">="||e.operator===">"),n=(this.operator==="<="||this.operator==="<")&&(e.operator==="<="||e.operator==="<"),o=this.semver.version===e.semver.version,i=(this.operator===">="||this.operator==="<=")&&(e.operator===">="||e.operator==="<="),a=at(this.semver,"<",e.semver,r)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),l=at(this.semver,">",e.semver,r)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return s||n||o&&i||a||l}};kr.exports=ct;var ro=Le(),{re:Dr,t:Fr}=Ce(),at=qr(),lt=ge(),Br=be(),Mr=ut()});var ut=x((ma,Hr)=>{var ft=class t{constructor(e,r){if(r=no(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof ht)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!_r(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&co(n[0])){this.set=[n];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();let s=`parseRange:${Object.keys(this.options).join(",")}:${e}`,n=Gr.get(s);if(n)return n;let o=this.options.loose,i=o?P[C.HYPHENRANGELOOSE]:P[C.HYPHENRANGE];e=e.replace(i,vo(this.options.includePrerelease)),N("hyphen replace",e),e=e.replace(P[C.COMPARATORTRIM],io),N("comparator trim",e,P[C.COMPARATORTRIM]),e=e.replace(P[C.TILDETRIM],ao),e=e.replace(P[C.CARETTRIM],lo),e=e.split(/\s+/).join(" ");let a=o?P[C.COMPARATORLOOSE]:P[C.COMPARATOR],l=e.split(" ").map(u=>uo(u,this.options)).join(" ").split(/\s+/).map(u=>Eo(u,this.options)).filter(this.options.loose?u=>!!u.match(a):()=>!0).map(u=>new ht(u,this.options)),c=l.length,h=new Map;for(let u of l){if(_r(u))return[u];h.set(u.value,u)}h.size>1&&h.has("")&&h.delete("");let f=[...h.values()];return Gr.set(s,f),f}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(s=>Ur(s,r)&&e.set.some(n=>Ur(n,r)&&s.every(o=>n.every(i=>o.intersects(i,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new oo(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(xo(this.set[r],e,this.options))return!0;return!1}};Hr.exports=ft;var so=xr(),Gr=new so({max:1e3}),no=Le(),ht=jr(),N=ge(),oo=be(),{re:P,t:C,comparatorTrimReplace:io,tildeTrimReplace:ao,caretTrimReplace:lo}=Ce(),_r=t=>t.value==="<0.0.0-0",co=t=>t.value==="",Ur=(t,e)=>{let r=!0,s=t.slice(),n=s.pop();for(;r&&s.length;)r=s.every(o=>n.intersects(o,e)),n=s.pop();return r},uo=(t,e)=>(N("comp",t,e),t=po(t,e),N("caret",t),t=fo(t,e),N("tildes",t),t=mo(t,e),N("xrange",t),t=yo(t,e),N("stars",t),t),q=t=>!t||t.toLowerCase()==="x"||t==="*",fo=(t,e)=>t.trim().split(/\s+/).map(r=>ho(r,e)).join(" "),ho=(t,e)=>{let r=e.loose?P[C.TILDELOOSE]:P[C.TILDE];return t.replace(r,(s,n,o,i,a)=>{N("tilde",t,s,n,o,i,a);let l;return q(n)?l="":q(o)?l=`>=${n}.0.0 <${+n+1}.0.0-0`:q(i)?l=`>=${n}.${o}.0 <${n}.${+o+1}.0-0`:a?(N("replaceTilde pr",a),l=`>=${n}.${o}.${i}-${a} <${n}.${+o+1}.0-0`):l=`>=${n}.${o}.${i} <${n}.${+o+1}.0-0`,N("tilde return",l),l})},po=(t,e)=>t.trim().split(/\s+/).map(r=>go(r,e)).join(" "),go=(t,e)=>{N("caret",t,e);let r=e.loose?P[C.CARETLOOSE]:P[C.CARET],s=e.includePrerelease?"-0":"";return t.replace(r,(n,o,i,a,l)=>{N("caret",t,n,o,i,a,l);let c;return q(o)?c="":q(i)?c=`>=${o}.0.0${s} <${+o+1}.0.0-0`:q(a)?o==="0"?c=`>=${o}.${i}.0${s} <${o}.${+i+1}.0-0`:c=`>=${o}.${i}.0${s} <${+o+1}.0.0-0`:l?(N("replaceCaret pr",l),o==="0"?i==="0"?c=`>=${o}.${i}.${a}-${l} <${o}.${i}.${+a+1}-0`:c=`>=${o}.${i}.${a}-${l} <${o}.${+i+1}.0-0`:c=`>=${o}.${i}.${a}-${l} <${+o+1}.0.0-0`):(N("no pr"),o==="0"?i==="0"?c=`>=${o}.${i}.${a}${s} <${o}.${i}.${+a+1}-0`:c=`>=${o}.${i}.${a}${s} <${o}.${+i+1}.0-0`:c=`>=${o}.${i}.${a} <${+o+1}.0.0-0`),N("caret return",c),c})},mo=(t,e)=>(N("replaceXRanges",t,e),t.split(/\s+/).map(r=>bo(r,e)).join(" ")),bo=(t,e)=>{t=t.trim();let r=e.loose?P[C.XRANGELOOSE]:P[C.XRANGE];return t.replace(r,(s,n,o,i,a,l)=>{N("xRange",t,s,n,o,i,a,l);let c=q(o),h=c||q(i),f=h||q(a),u=f;return n==="="&&u&&(n=""),l=e.includePrerelease?"-0":"",c?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&u?(h&&(i=0),a=0,n===">"?(n=">=",h?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):n==="<="&&(n="<",h?o=+o+1:i=+i+1),n==="<"&&(l="-0"),s=`${n+o}.${i}.${a}${l}`):h?s=`>=${o}.0.0${l} <${+o+1}.0.0-0`:f&&(s=`>=${o}.${i}.0${l} <${o}.${+i+1}.0-0`),N("xRange return",s),s})},yo=(t,e)=>(N("replaceStars",t,e),t.trim().replace(P[C.STAR],"")),Eo=(t,e)=>(N("replaceGTE0",t,e),t.trim().replace(P[e.includePrerelease?C.GTE0PRE:C.GTE0],"")),vo=t=>(e,r,s,n,o,i,a,l,c,h,f,u,E)=>(q(s)?r="":q(n)?r=`>=${s}.0.0${t?"-0":""}`:q(o)?r=`>=${s}.${n}.0${t?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,q(c)?l="":q(h)?l=`<${+c+1}.0.0-0`:q(f)?l=`<${c}.${+h+1}.0-0`:u?l=`<=${c}.${h}.${f}-${u}`:t?l=`<${c}.${h}.${+f+1}-0`:l=`<=${l}`,`${r} ${l}`.trim()),xo=(t,e,r)=>{for(let s=0;s<t.length;s++)if(!t[s].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let s=0;s<t.length;s++)if(N(t[s].semver),t[s].semver!==ht.ANY&&t[s].semver.prerelease.length>0){let n=t[s].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var Wr=x((ba,Xr)=>{var dt=be(),$o=ut(),Vr=it(),wo=(t,e)=>{t=new $o(t,e);let r=new dt("0.0.0");if(t.test(r)||(r=new dt("0.0.0-0"),t.test(r)))return r;r=null;for(let s=0;s<t.set.length;++s){let n=t.set[s],o=null;n.forEach(i=>{let a=new dt(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||Vr(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||Vr(r,o))&&(r=o)}return r&&t.test(r)?r:null};Xr.exports=wo});var zr=x((Jr,Fe)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define(e):typeof Fe=="object"&&Fe.exports?Fe.exports=e():t.log=e()})(Jr,function(){"use strict";var t=function(){},e="undefined",r=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["trace","debug","info","warn","error"];function n(m,$){var I=m[$];if(typeof I.bind=="function")return I.bind(m);try{return Function.prototype.bind.call(I,m)}catch{return function(){return Function.prototype.apply.apply(I,[m,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function i(m){return m==="debug"&&(m="log"),typeof console===e?!1:m==="trace"&&r?o:console[m]!==void 0?n(console,m):console.log!==void 0?n(console,"log"):t}function a(m,$){for(var I=0;I<s.length;I++){var T=s[I];this[T]=I<m?t:this.methodFactory(T,m,$)}this.log=this.debug}function l(m,$,I){return function(){typeof console!==e&&(a.call(this,$,I),this[m].apply(this,arguments))}}function c(m,$,I){return i(m)||l.apply(this,arguments)}function h(m,$,I){var T=this,V;$=$??"WARN";var L="loglevel";typeof m=="string"?L+=":"+m:typeof m=="symbol"&&(L=void 0);function X(v){var M=(s[v]||"silent").toUpperCase();if(!(typeof window===e||!L)){try{window.localStorage[L]=M;return}catch{}try{window.document.cookie=encodeURIComponent(L)+"="+M+";"}catch{}}}function _(){var v;if(!(typeof window===e||!L)){try{v=window.localStorage[L]}catch{}if(typeof v===e)try{var M=window.document.cookie,Y=M.indexOf(encodeURIComponent(L)+"=");Y!==-1&&(v=/^([^;]+)/.exec(M.slice(Y))[1])}catch{}return T.levels[v]===void 0&&(v=void 0),v}}function K(){if(!(typeof window===e||!L)){try{window.localStorage.removeItem(L);return}catch{}try{window.document.cookie=encodeURIComponent(L)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}T.name=m,T.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},T.methodFactory=I||c,T.getLevel=function(){return V},T.setLevel=function(v,M){if(typeof v=="string"&&T.levels[v.toUpperCase()]!==void 0&&(v=T.levels[v.toUpperCase()]),typeof v=="number"&&v>=0&&v<=T.levels.SILENT){if(V=v,M!==!1&&X(v),a.call(T,v,m),typeof console===e&&v<T.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+v},T.setDefaultLevel=function(v){$=v,_()||T.setLevel(v,!1)},T.resetLevel=function(){T.setLevel($,!1),K()},T.enableAll=function(v){T.setLevel(T.levels.TRACE,v)},T.disableAll=function(v){T.setLevel(T.levels.SILENT,v)};var j=_();j==null&&(j=$),T.setLevel(j,!1)}var f=new h,u={};f.getLogger=function($){if(typeof $!="symbol"&&typeof $!="string"||$==="")throw new TypeError("You must supply a name when creating a logger.");var I=u[$];return I||(I=u[$]=new h($,f.getLevel(),f.methodFactory)),I};var E=typeof window!==e?window.log:void 0;return f.noConflict=function(){return typeof window!==e&&window.log===f&&(window.log=E),f},f.getLoggers=function(){return u},f.default=f,f})});var Kr=x((ya,Qr)=>{"use strict";Qr.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var pt=x((Ea,Zr)=>{var xe=Kr(),Yr={};for(let t of Object.keys(xe))Yr[xe[t]]=t;var g={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Zr.exports=g;for(let t of Object.keys(g)){if(!("channels"in g[t]))throw new Error("missing channels property: "+t);if(!("labels"in g[t]))throw new Error("missing channel labels property: "+t);if(g[t].labels.length!==g[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=g[t];delete g[t].channels,delete g[t].labels,Object.defineProperty(g[t],"channels",{value:e}),Object.defineProperty(g[t],"labels",{value:r})}g.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,s=t[2]/255,n=Math.min(e,r,s),o=Math.max(e,r,s),i=o-n,a,l;o===n?a=0:e===o?a=(r-s)/i:r===o?a=2+(s-e)/i:s===o&&(a=4+(e-r)/i),a=Math.min(a*60,360),a<0&&(a+=360);let c=(n+o)/2;return o===n?l=0:c<=.5?l=i/(o+n):l=i/(2-o-n),[a,l*100,c*100]};g.rgb.hsv=function(t){let e,r,s,n,o,i=t[0]/255,a=t[1]/255,l=t[2]/255,c=Math.max(i,a,l),h=c-Math.min(i,a,l),f=function(u){return(c-u)/6/h+1/2};return h===0?(n=0,o=0):(o=h/c,e=f(i),r=f(a),s=f(l),i===c?n=s-r:a===c?n=1/3+e-s:l===c&&(n=2/3+r-e),n<0?n+=1:n>1&&(n-=1)),[n*360,o*100,c*100]};g.rgb.hwb=function(t){let e=t[0],r=t[1],s=t[2],n=g.rgb.hsl(t)[0],o=1/255*Math.min(e,Math.min(r,s));return s=1-1/255*Math.max(e,Math.max(r,s)),[n,o*100,s*100]};g.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,s=t[2]/255,n=Math.min(1-e,1-r,1-s),o=(1-e-n)/(1-n)||0,i=(1-r-n)/(1-n)||0,a=(1-s-n)/(1-n)||0;return[o*100,i*100,a*100,n*100]};function To(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}g.rgb.keyword=function(t){let e=Yr[t];if(e)return e;let r=1/0,s;for(let n of Object.keys(xe)){let o=xe[n],i=To(t,o);i<r&&(r=i,s=n)}return s};g.keyword.rgb=function(t){return xe[t]};g.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,s=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;let n=e*.4124+r*.3576+s*.1805,o=e*.2126+r*.7152+s*.0722,i=e*.0193+r*.1192+s*.9505;return[n*100,o*100,i*100]};g.rgb.lab=function(t){let e=g.rgb.xyz(t),r=e[0],s=e[1],n=e[2];r/=95.047,s/=100,n/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let o=116*s-16,i=500*(r-s),a=200*(s-n);return[o,i,a]};g.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,s=t[2]/100,n,o,i;if(r===0)return i=s*255,[i,i,i];s<.5?n=s*(1+r):n=s+r-s*r;let a=2*s-n,l=[0,0,0];for(let c=0;c<3;c++)o=e+1/3*-(c-1),o<0&&o++,o>1&&o--,6*o<1?i=a+(n-a)*6*o:2*o<1?i=n:3*o<2?i=a+(n-a)*(2/3-o)*6:i=a,l[c]=i*255;return l};g.hsl.hsv=function(t){let e=t[0],r=t[1]/100,s=t[2]/100,n=r,o=Math.max(s,.01);s*=2,r*=s<=1?s:2-s,n*=o<=1?o:2-o;let i=(s+r)/2,a=s===0?2*n/(o+n):2*r/(s+r);return[e,a*100,i*100]};g.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,s=t[2]/100,n=Math.floor(e)%6,o=e-Math.floor(e),i=255*s*(1-r),a=255*s*(1-r*o),l=255*s*(1-r*(1-o));switch(s*=255,n){case 0:return[s,l,i];case 1:return[a,s,i];case 2:return[i,s,l];case 3:return[i,a,s];case 4:return[l,i,s];case 5:return[s,i,a]}};g.hsv.hsl=function(t){let e=t[0],r=t[1]/100,s=t[2]/100,n=Math.max(s,.01),o,i;i=(2-r)*s;let a=(2-r)*n;return o=r*n,o/=a<=1?a:2-a,o=o||0,i/=2,[e,o*100,i*100]};g.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,s=t[2]/100,n=r+s,o;n>1&&(r/=n,s/=n);let i=Math.floor(6*e),a=1-s;o=6*e-i,i&1&&(o=1-o);let l=r+o*(a-r),c,h,f;switch(i){default:case 6:case 0:c=a,h=l,f=r;break;case 1:c=l,h=a,f=r;break;case 2:c=r,h=a,f=l;break;case 3:c=r,h=l,f=a;break;case 4:c=l,h=r,f=a;break;case 5:c=a,h=r,f=l;break}return[c*255,h*255,f*255]};g.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,s=t[2]/100,n=t[3]/100,o=1-Math.min(1,e*(1-n)+n),i=1-Math.min(1,r*(1-n)+n),a=1-Math.min(1,s*(1-n)+n);return[o*255,i*255,a*255]};g.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,s=t[2]/100,n,o,i;return n=e*3.2406+r*-1.5372+s*-.4986,o=e*-.9689+r*1.8758+s*.0415,i=e*.0557+r*-.204+s*1.057,n=n>.0031308?1.055*n**(1/2.4)-.055:n*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,n=Math.min(Math.max(0,n),1),o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),[n*255,o*255,i*255]};g.xyz.lab=function(t){let e=t[0],r=t[1],s=t[2];e/=95.047,r/=100,s/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let n=116*r-16,o=500*(e-r),i=200*(r-s);return[n,o,i]};g.lab.xyz=function(t){let e=t[0],r=t[1],s=t[2],n,o,i;o=(e+16)/116,n=r/500+o,i=o-s/200;let a=o**3,l=n**3,c=i**3;return o=a>.008856?a:(o-16/116)/7.787,n=l>.008856?l:(n-16/116)/7.787,i=c>.008856?c:(i-16/116)/7.787,n*=95.047,o*=100,i*=108.883,[n,o,i]};g.lab.lch=function(t){let e=t[0],r=t[1],s=t[2],n;n=Math.atan2(s,r)*360/2/Math.PI,n<0&&(n+=360);let i=Math.sqrt(r*r+s*s);return[e,i,n]};g.lch.lab=function(t){let e=t[0],r=t[1],n=t[2]/360*2*Math.PI,o=r*Math.cos(n),i=r*Math.sin(n);return[e,o,i]};g.rgb.ansi16=function(t,e=null){let[r,s,n]=t,o=e===null?g.rgb.hsv(t)[2]:e;if(o=Math.round(o/50),o===0)return 30;let i=30+(Math.round(n/255)<<2|Math.round(s/255)<<1|Math.round(r/255));return o===2&&(i+=60),i};g.hsv.ansi16=function(t){return g.rgb.ansi16(g.hsv.rgb(t),t[2])};g.rgb.ansi256=function(t){let e=t[0],r=t[1],s=t[2];return e===r&&r===s?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(s/255*5)};g.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,s=(e&1)*r*255,n=(e>>1&1)*r*255,o=(e>>2&1)*r*255;return[s,n,o]};g.ansi256.rgb=function(t){if(t>=232){let o=(t-232)*10+8;return[o,o,o]}t-=16;let e,r=Math.floor(t/36)/5*255,s=Math.floor((e=t%36)/6)/5*255,n=e%6/5*255;return[r,s,n]};g.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};g.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(a=>a+a).join(""));let s=parseInt(r,16),n=s>>16&255,o=s>>8&255,i=s&255;return[n,o,i]};g.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,s=t[2]/255,n=Math.max(Math.max(e,r),s),o=Math.min(Math.min(e,r),s),i=n-o,a,l;return i<1?a=o/(1-i):a=0,i<=0?l=0:n===e?l=(r-s)/i%6:n===r?l=2+(s-e)/i:l=4+(e-r)/i,l/=6,l%=1,[l*360,i*100,a*100]};g.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,s=r<.5?2*e*r:2*e*(1-r),n=0;return s<1&&(n=(r-.5*s)/(1-s)),[t[0],s*100,n*100]};g.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,s=e*r,n=0;return s<1&&(n=(r-s)/(1-s)),[t[0],s*100,n*100]};g.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,s=t[2]/100;if(r===0)return[s*255,s*255,s*255];let n=[0,0,0],o=e%1*6,i=o%1,a=1-i,l=0;switch(Math.floor(o)){case 0:n[0]=1,n[1]=i,n[2]=0;break;case 1:n[0]=a,n[1]=1,n[2]=0;break;case 2:n[0]=0,n[1]=1,n[2]=i;break;case 3:n[0]=0,n[1]=a,n[2]=1;break;case 4:n[0]=i,n[1]=0,n[2]=1;break;default:n[0]=1,n[1]=0,n[2]=a}return l=(1-r)*s,[(r*n[0]+l)*255,(r*n[1]+l)*255,(r*n[2]+l)*255]};g.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,s=e+r*(1-e),n=0;return s>0&&(n=e/s),[t[0],n*100,s*100]};g.hcg.hsl=function(t){let e=t[1]/100,s=t[2]/100*(1-e)+.5*e,n=0;return s>0&&s<.5?n=e/(2*s):s>=.5&&s<1&&(n=e/(2*(1-s))),[t[0],n*100,s*100]};g.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,s=e+r*(1-e);return[t[0],(s-e)*100,(1-s)*100]};g.hwb.hcg=function(t){let e=t[1]/100,s=1-t[2]/100,n=s-e,o=0;return n<1&&(o=(s-n)/(1-n)),[t[0],n*100,o*100]};g.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};g.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};g.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};g.gray.hsl=function(t){return[0,0,t[0]]};g.gray.hsv=g.gray.hsl;g.gray.hwb=function(t){return[0,100,t[0]]};g.gray.cmyk=function(t){return[0,0,0,t[0]]};g.gray.lab=function(t){return[t[0],0,0]};g.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,s=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(s.length)+s};g.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var ts=x((va,es)=>{var Be=pt();function Oo(){let t={},e=Object.keys(Be);for(let r=e.length,s=0;s<r;s++)t[e[s]]={distance:-1,parent:null};return t}function Io(t){let e=Oo(),r=[t];for(e[t].distance=0;r.length;){let s=r.pop(),n=Object.keys(Be[s]);for(let o=n.length,i=0;i<o;i++){let a=n[i],l=e[a];l.distance===-1&&(l.distance=e[s].distance+1,l.parent=s,r.unshift(a))}}return e}function Ro(t,e){return function(r){return e(t(r))}}function No(t,e){let r=[e[t].parent,t],s=Be[e[t].parent][t],n=e[t].parent;for(;e[n].parent;)r.unshift(e[n].parent),s=Ro(Be[e[n].parent][n],s),n=e[n].parent;return s.conversion=r,s}es.exports=function(t){let e=Io(t),r={},s=Object.keys(e);for(let n=s.length,o=0;o<n;o++){let i=s[o];e[i].parent!==null&&(r[i]=No(i,e))}return r}});var ss=x((xa,rs)=>{var gt=pt(),Ao=ts(),ie={},So=Object.keys(gt);function Co(t){let e=function(...r){let s=r[0];return s==null?s:(s.length>1&&(r=s),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function Lo(t){let e=function(...r){let s=r[0];if(s==null)return s;s.length>1&&(r=s);let n=t(r);if(typeof n=="object")for(let o=n.length,i=0;i<o;i++)n[i]=Math.round(n[i]);return n};return"conversion"in t&&(e.conversion=t.conversion),e}So.forEach(t=>{ie[t]={},Object.defineProperty(ie[t],"channels",{value:gt[t].channels}),Object.defineProperty(ie[t],"labels",{value:gt[t].labels});let e=Ao(t);Object.keys(e).forEach(s=>{let n=e[s];ie[t][s]=Lo(n),ie[t][s].raw=Co(n)})});rs.exports=ie});var cs=x(($a,ls)=>{"use strict";var ns=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,os=(t,e)=>(...r)=>{let s=t(...r);return`\x1B[${38+e};5;${s}m`},is=(t,e)=>(...r)=>{let s=t(...r);return`\x1B[${38+e};2;${s[0]};${s[1]};${s[2]}m`},Me=t=>t,as=(t,e,r)=>[t,e,r],ae=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let s=r();return Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0}),s},enumerable:!0,configurable:!0})},mt,le=(t,e,r,s)=>{mt===void 0&&(mt=ss());let n=s?10:0,o={};for(let[i,a]of Object.entries(mt)){let l=i==="ansi16"?"ansi":i;i===e?o[l]=t(r,n):typeof a=="object"&&(o[l]=t(a[e],n))}return o};function Po(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,s]of Object.entries(e)){for(let[n,o]of Object.entries(s))e[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},s[n]=e[n],t.set(o[0],o[1]);Object.defineProperty(e,r,{value:s,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",ae(e.color,"ansi",()=>le(ns,"ansi16",Me,!1)),ae(e.color,"ansi256",()=>le(os,"ansi256",Me,!1)),ae(e.color,"ansi16m",()=>le(is,"rgb",as,!1)),ae(e.bgColor,"ansi",()=>le(ns,"ansi16",Me,!0)),ae(e.bgColor,"ansi256",()=>le(os,"ansi256",Me,!0)),ae(e.bgColor,"ansi16m",()=>le(is,"rgb",as,!0)),e}Object.defineProperty(ls,"exports",{enumerable:!0,get:Po})});var fs=x((wa,us)=>{"use strict";us.exports={stdout:!1,stderr:!1}});var ds=x((Ta,hs)=>{"use strict";var qo=(t,e,r)=>{let s=t.indexOf(e);if(s===-1)return t;let n=e.length,o=0,i="";do i+=t.substr(o,s-o)+e+r,o=s+n,s=t.indexOf(e,o);while(s!==-1);return i+=t.substr(o),i},Do=(t,e,r,s)=>{let n=0,o="";do{let i=t[s-1]==="\r";o+=t.substr(n,(i?s-1:s)-n)+e+(i?`\r
1
+ var tn=Object.create;var Ne=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var sn=Object.getOwnPropertyNames;var nn=Object.getPrototypeOf,on=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dt=(t,e)=>{for(var r in e)Ne(t,r,{get:e[r],enumerable:!0})},Re=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of sn(e))!on.call(t,n)&&n!==r&&Ne(t,n,{get:()=>e[n],enumerable:!(s=rn(e,n))||s.enumerable});return t},A=(t,e,r)=>(Re(t,e,"default"),r&&Re(r,e,"default")),D=(t,e,r)=>(r=t!=null?tn(nn(t)):{},Re(e||!t||!t.__esModule?Ne(r,"default",{value:t,enumerable:!0}):r,t)),an=t=>Re(Ne({},"__esModule",{value:!0}),t);var Je=v((Fi,Ae)=>{(function(){"use strict";var t={}.hasOwnProperty,e="[native code]";function r(){for(var s=[],n=0;n<arguments.length;n++){var o=arguments[n];if(o){var i=typeof o;if(i==="string"||i==="number")s.push(o);else if(Array.isArray(o)){if(o.length){var a=r.apply(null,o);a&&s.push(a)}}else if(i==="object"){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){s.push(o.toString());continue}for(var l in o)t.call(o,l)&&o[l]&&s.push(l)}}}return s.join(" ")}typeof Ae<"u"&&Ae.exports?(r.default=r,Ae.exports=r):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return r}):window.classNames=r})()});var Jt=v((zi,Wt)=>{Wt.exports=()=>{try{return require("react-web-component-style-loader/exports").styleElements}catch{return[]}}});var Qt=v((Qi,zt)=>{zt.exports=function(e){if(!e.attributes)return{};let r={},s,o=[...e.attributes].map(i=>({[i.name]:i.value}));for(s of o){let i=Object.keys(s)[0],a=i.replace(/-([a-z])/g,l=>l[1].toUpperCase());r[a]=s[i]}return r}});var Yt=v((Ki,Kt)=>{var gn=require("react"),mn=require("react-dom"),bn=require("react-shadow-dom-retarget-events"),yn=Jt(),En=Qt(),vn={attachedCallback:"webComponentAttached",connectedCallback:"webComponentConnected",disconnectedCallback:"webComponentDisconnected",adoptedCallback:"webComponentAdopted"};Kt.exports={create:(t,e,r=!0,s=void 0)=>{let n=class extends HTMLElement{instance=null;callConstructorHook(){this.instance.webComponentConstructed&&this.instance.webComponentConstructed.apply(this.instance,[this])}callLifeCycleHook(o,i=[]){let a=vn[o];a&&this.instance&&this.instance[a]&&this.instance[a].apply(this.instance,i)}connectedCallback(){let o=this,i=o;if(r){let a=o.attachShadow({mode:"open"});i=document.createElement("div"),yn().forEach(c=>{a.appendChild(c.cloneNode(a))}),a.appendChild(i),bn(a)}mn.render(gn.createElement(t,En(o)),i,function(){o.instance=this,o.callConstructorHook(),o.callLifeCycleHook("connectedCallback")})}disconnectedCallback(){this.callLifeCycleHook("disconnectedCallback")}adoptedCallback(o,i){this.callLifeCycleHook("adoptedCallback",[o,i])}call(o,i){return s?.current?.[o]?.call(s?.current,i)}getConfig(){return this.instance.state.config}};return customElements.define(e,n),n}}});var ge=v((Zi,Zt)=>{var xn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Zt.exports=xn});var Ze=v((ea,er)=>{var $n="2.0.0",wn=Number.MAX_SAFE_INTEGER||9007199254740991,Tn=16;er.exports={SEMVER_SPEC_VERSION:$n,MAX_LENGTH:256,MAX_SAFE_INTEGER:wn,MAX_SAFE_COMPONENT_LENGTH:Tn}});var Ce=v((W,tr)=>{var{MAX_SAFE_COMPONENT_LENGTH:et}=Ze(),On=ge();W=tr.exports={};var In=W.re=[],d=W.src=[],p=W.t={},Rn=0,b=(t,e,r)=>{let s=Rn++;On(s,e),p[t]=s,d[s]=e,In[s]=new RegExp(e,r?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\d*");b("NUMERICIDENTIFIERLOOSE","[0-9]+");b("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");b("MAINVERSION",`(${d[p.NUMERICIDENTIFIER]})\\.(${d[p.NUMERICIDENTIFIER]})\\.(${d[p.NUMERICIDENTIFIER]})`);b("MAINVERSIONLOOSE",`(${d[p.NUMERICIDENTIFIERLOOSE]})\\.(${d[p.NUMERICIDENTIFIERLOOSE]})\\.(${d[p.NUMERICIDENTIFIERLOOSE]})`);b("PRERELEASEIDENTIFIER",`(?:${d[p.NUMERICIDENTIFIER]}|${d[p.NONNUMERICIDENTIFIER]})`);b("PRERELEASEIDENTIFIERLOOSE",`(?:${d[p.NUMERICIDENTIFIERLOOSE]}|${d[p.NONNUMERICIDENTIFIER]})`);b("PRERELEASE",`(?:-(${d[p.PRERELEASEIDENTIFIER]}(?:\\.${d[p.PRERELEASEIDENTIFIER]})*))`);b("PRERELEASELOOSE",`(?:-?(${d[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[p.PRERELEASEIDENTIFIERLOOSE]})*))`);b("BUILDIDENTIFIER","[0-9A-Za-z-]+");b("BUILD",`(?:\\+(${d[p.BUILDIDENTIFIER]}(?:\\.${d[p.BUILDIDENTIFIER]})*))`);b("FULLPLAIN",`v?${d[p.MAINVERSION]}${d[p.PRERELEASE]}?${d[p.BUILD]}?`);b("FULL",`^${d[p.FULLPLAIN]}$`);b("LOOSEPLAIN",`[v=\\s]*${d[p.MAINVERSIONLOOSE]}${d[p.PRERELEASELOOSE]}?${d[p.BUILD]}?`);b("LOOSE",`^${d[p.LOOSEPLAIN]}$`);b("GTLT","((?:<|>)?=?)");b("XRANGEIDENTIFIERLOOSE",`${d[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);b("XRANGEIDENTIFIER",`${d[p.NUMERICIDENTIFIER]}|x|X|\\*`);b("XRANGEPLAIN",`[v=\\s]*(${d[p.XRANGEIDENTIFIER]})(?:\\.(${d[p.XRANGEIDENTIFIER]})(?:\\.(${d[p.XRANGEIDENTIFIER]})(?:${d[p.PRERELEASE]})?${d[p.BUILD]}?)?)?`);b("XRANGEPLAINLOOSE",`[v=\\s]*(${d[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[p.XRANGEIDENTIFIERLOOSE]})(?:${d[p.PRERELEASELOOSE]})?${d[p.BUILD]}?)?)?`);b("XRANGE",`^${d[p.GTLT]}\\s*${d[p.XRANGEPLAIN]}$`);b("XRANGELOOSE",`^${d[p.GTLT]}\\s*${d[p.XRANGEPLAINLOOSE]}$`);b("COERCE",`(^|[^\\d])(\\d{1,${et}})(?:\\.(\\d{1,${et}}))?(?:\\.(\\d{1,${et}}))?(?:$|[^\\d])`);b("COERCERTL",d[p.COERCE],!0);b("LONETILDE","(?:~>?)");b("TILDETRIM",`(\\s*)${d[p.LONETILDE]}\\s+`,!0);W.tildeTrimReplace="$1~";b("TILDE",`^${d[p.LONETILDE]}${d[p.XRANGEPLAIN]}$`);b("TILDELOOSE",`^${d[p.LONETILDE]}${d[p.XRANGEPLAINLOOSE]}$`);b("LONECARET","(?:\\^)");b("CARETTRIM",`(\\s*)${d[p.LONECARET]}\\s+`,!0);W.caretTrimReplace="$1^";b("CARET",`^${d[p.LONECARET]}${d[p.XRANGEPLAIN]}$`);b("CARETLOOSE",`^${d[p.LONECARET]}${d[p.XRANGEPLAINLOOSE]}$`);b("COMPARATORLOOSE",`^${d[p.GTLT]}\\s*(${d[p.LOOSEPLAIN]})$|^$`);b("COMPARATOR",`^${d[p.GTLT]}\\s*(${d[p.FULLPLAIN]})$|^$`);b("COMPARATORTRIM",`(\\s*)${d[p.GTLT]}\\s*(${d[p.LOOSEPLAIN]}|${d[p.XRANGEPLAIN]})`,!0);W.comparatorTrimReplace="$1$2$3";b("HYPHENRANGE",`^\\s*(${d[p.XRANGEPLAIN]})\\s+-\\s+(${d[p.XRANGEPLAIN]})\\s*$`);b("HYPHENRANGELOOSE",`^\\s*(${d[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[p.XRANGEPLAINLOOSE]})\\s*$`);b("STAR","(<|>)?=?\\s*\\*");b("GTE0","^\\s*>=\\s*0.0.0\\s*$");b("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")});var Le=v((ta,rr)=>{var Nn=["includePrerelease","loose","rtl"],An=t=>t?typeof t!="object"?{loose:!0}:Nn.filter(e=>t[e]).reduce((e,r)=>(e[r]=!0,e),{}):{};rr.exports=An});var ir=v((ra,or)=>{var sr=/^[0-9]+$/,nr=(t,e)=>{let r=sr.test(t),s=sr.test(e);return r&&s&&(t=+t,e=+e),t===e?0:r&&!s?-1:s&&!r?1:t<e?-1:1},Sn=(t,e)=>nr(e,t);or.exports={compareIdentifiers:nr,rcompareIdentifiers:Sn}});var be=v((sa,ur)=>{var Pe=ge(),{MAX_LENGTH:ar,MAX_SAFE_INTEGER:qe}=Ze(),{re:lr,t:cr}=Ce(),Cn=Le(),{compareIdentifiers:me}=ir(),tt=class t{constructor(e,r){if(r=Cn(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid Version: ${e}`);if(e.length>ar)throw new TypeError(`version is longer than ${ar} characters`);Pe("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=e.trim().match(r.loose?lr[cr.LOOSE]:lr[cr.FULL]);if(!s)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>qe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>qe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>qe||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let o=+n;if(o>=0&&o<qe)return o}return n}):this.prerelease=[],this.build=s[5]?s[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(e){if(Pe("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),me(this.major,e.major)||me(this.minor,e.minor)||me(this.patch,e.patch)}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let s=this.prerelease[r],n=e.prerelease[r];if(Pe("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return me(s,n)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let s=this.build[r],n=e.build[r];if(Pe("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return me(s,n)}while(++r)}inc(e,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r),this.inc("pre",r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r),this.inc("pre",r);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":if(this.prerelease.length===0)this.prerelease=[0];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);s===-1&&this.prerelease.push(0)}r&&(this.prerelease[0]===r?isNaN(this.prerelease[1])&&(this.prerelease=[r,0]):this.prerelease=[r,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};ur.exports=tt});var J=v((na,hr)=>{var fr=be(),Ln=(t,e,r)=>new fr(t,r).compare(new fr(e,r));hr.exports=Ln});var pr=v((oa,dr)=>{"use strict";dr.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var mr=v((ia,gr)=>{"use strict";gr.exports=O;O.Node=Z;O.create=O;function O(t){var e=this;if(e instanceof O||(e=new O),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(n){e.push(n)});else if(arguments.length>0)for(var r=0,s=arguments.length;r<s;r++)e.push(arguments[r]);return e}O.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e};O.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}};O.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}};O.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)qn(this,arguments[t]);return this.length};O.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)Dn(this,arguments[t]);return this.length};O.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}};O.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}};O.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,s=0;r!==null;s++)t.call(e,r.value,s,this),r=r.next};O.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,s=this.length-1;r!==null;s--)t.call(e,r.value,s,this),r=r.prev};O.prototype.get=function(t){for(var e=0,r=this.head;r!==null&&e<t;e++)r=r.next;if(e===t&&r!==null)return r.value};O.prototype.getReverse=function(t){for(var e=0,r=this.tail;r!==null&&e<t;e++)r=r.prev;if(e===t&&r!==null)return r.value};O.prototype.map=function(t,e){e=e||this;for(var r=new O,s=this.head;s!==null;)r.push(t.call(e,s.value,this)),s=s.next;return r};O.prototype.mapReverse=function(t,e){e=e||this;for(var r=new O,s=this.tail;s!==null;)r.push(t.call(e,s.value,this)),s=s.prev;return r};O.prototype.reduce=function(t,e){var r,s=this.head;if(arguments.length>1)r=e;else if(this.head)s=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;s!==null;n++)r=t(r,s.value,n),s=s.next;return r};O.prototype.reduceReverse=function(t,e){var r,s=this.tail;if(arguments.length>1)r=e;else if(this.tail)s=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=this.length-1;s!==null;n--)r=t(r,s.value,n),s=s.prev;return r};O.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;r!==null;e++)t[e]=r.value,r=r.next;return t};O.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;r!==null;e++)t[e]=r.value,r=r.prev;return t};O.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new O;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var s=0,n=this.head;n!==null&&s<t;s++)n=n.next;for(;n!==null&&s<e;s++,n=n.next)r.push(n.value);return r};O.prototype.sliceReverse=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new O;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var s=this.length,n=this.tail;n!==null&&s>e;s--)n=n.prev;for(;n!==null&&s>t;s--,n=n.prev)r.push(n.value);return r};O.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var s=0,n=this.head;n!==null&&s<t;s++)n=n.next;for(var o=[],s=0;n&&s<e;s++)o.push(n.value),n=this.removeNode(n);n===null&&(n=this.tail),n!==this.head&&n!==this.tail&&(n=n.prev);for(var s=0;s<r.length;s++)n=Pn(this,n,r[s]);return o};O.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;r!==null;r=r.prev){var s=r.prev;r.prev=r.next,r.next=s}return this.head=e,this.tail=t,this};function Pn(t,e,r){var s=e===t.head?new Z(r,null,e,t):new Z(r,e,e.next,t);return s.next===null&&(t.tail=s),s.prev===null&&(t.head=s),t.length++,s}function qn(t,e){t.tail=new Z(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function Dn(t,e){t.head=new Z(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function Z(t,e,r,s){if(!(this instanceof Z))return new Z(t,e,r,s);this.list=s,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}try{pr()(O)}catch{}});var xr=v((aa,vr)=>{"use strict";var Fn=mr(),ee=Symbol("max"),H=Symbol("length"),ne=Symbol("lengthCalculator"),Ee=Symbol("allowStale"),te=Symbol("maxAge"),U=Symbol("dispose"),br=Symbol("noDisposeOnSet"),S=Symbol("lruList"),G=Symbol("cache"),Er=Symbol("updateAgeOnGet"),rt=()=>1,nt=class{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let r=this[ee]=e.max||1/0,s=e.length||rt;if(this[ne]=typeof s!="function"?rt:s,this[Ee]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[te]=e.maxAge||0,this[U]=e.dispose,this[br]=e.noDisposeOnSet||!1,this[Er]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[ee]=e||1/0,ye(this)}get max(){return this[ee]}set allowStale(e){this[Ee]=!!e}get allowStale(){return this[Ee]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[te]=e,ye(this)}get maxAge(){return this[te]}set lengthCalculator(e){typeof e!="function"&&(e=rt),e!==this[ne]&&(this[ne]=e,this[H]=0,this[S].forEach(r=>{r.length=this[ne](r.value,r.key),this[H]+=r.length})),ye(this)}get lengthCalculator(){return this[ne]}get length(){return this[H]}get itemCount(){return this[S].length}rforEach(e,r){r=r||this;for(let s=this[S].tail;s!==null;){let n=s.prev;yr(this,e,s,r),s=n}}forEach(e,r){r=r||this;for(let s=this[S].head;s!==null;){let n=s.next;yr(this,e,s,r),s=n}}keys(){return this[S].toArray().map(e=>e.key)}values(){return this[S].toArray().map(e=>e.value)}reset(){this[U]&&this[S]&&this[S].length&&this[S].forEach(e=>this[U](e.key,e.value)),this[G]=new Map,this[S]=new Fn,this[H]=0}dump(){return this[S].map(e=>De(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[S]}set(e,r,s){if(s=s||this[te],s&&typeof s!="number")throw new TypeError("maxAge must be a number");let n=s?Date.now():0,o=this[ne](r,e);if(this[G].has(e)){if(o>this[ee])return oe(this,this[G].get(e)),!1;let l=this[G].get(e).value;return this[U]&&(this[br]||this[U](e,l.value)),l.now=n,l.maxAge=s,l.value=r,this[H]+=o-l.length,l.length=o,this.get(e),ye(this),!0}let i=new ot(e,r,o,n,s);return i.length>this[ee]?(this[U]&&this[U](e,r),!1):(this[H]+=i.length,this[S].unshift(i),this[G].set(e,this[S].head),ye(this),!0)}has(e){if(!this[G].has(e))return!1;let r=this[G].get(e).value;return!De(this,r)}get(e){return st(this,e,!0)}peek(e){return st(this,e,!1)}pop(){let e=this[S].tail;return e?(oe(this,e),e.value):null}del(e){oe(this,this[G].get(e))}load(e){this.reset();let r=Date.now();for(let s=e.length-1;s>=0;s--){let n=e[s],o=n.e||0;if(o===0)this.set(n.k,n.v);else{let i=o-r;i>0&&this.set(n.k,n.v,i)}}}prune(){this[G].forEach((e,r)=>st(this,r,!1))}},st=(t,e,r)=>{let s=t[G].get(e);if(s){let n=s.value;if(De(t,n)){if(oe(t,s),!t[Ee])return}else r&&(t[Er]&&(s.value.now=Date.now()),t[S].unshiftNode(s));return n.value}},De=(t,e)=>{if(!e||!e.maxAge&&!t[te])return!1;let r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[te]&&r>t[te]},ye=t=>{if(t[H]>t[ee])for(let e=t[S].tail;t[H]>t[ee]&&e!==null;){let r=e.prev;oe(t,e),e=r}},oe=(t,e)=>{if(e){let r=e.value;t[U]&&t[U](r.key,r.value),t[H]-=r.length,t[G].delete(r.key),t[S].removeNode(e)}},ot=class{constructor(e,r,s,n,o){this.key=e,this.value=r,this.length=s,this.now=n,this.maxAge=o||0}},yr=(t,e,r,s)=>{let n=r.value;De(t,n)&&(oe(t,r),t[Ee]||(n=void 0)),n&&e.call(s,n.value,n.key,t)};vr.exports=nt});var wr=v((la,$r)=>{var Bn=J(),Mn=(t,e,r)=>Bn(t,e,r)===0;$r.exports=Mn});var Or=v((ca,Tr)=>{var kn=J(),jn=(t,e,r)=>kn(t,e,r)!==0;Tr.exports=jn});var it=v((ua,Ir)=>{var Gn=J(),_n=(t,e,r)=>Gn(t,e,r)>0;Ir.exports=_n});var Nr=v((fa,Rr)=>{var Un=J(),Hn=(t,e,r)=>Un(t,e,r)>=0;Rr.exports=Hn});var Sr=v((ha,Ar)=>{var Vn=J(),Xn=(t,e,r)=>Vn(t,e,r)<0;Ar.exports=Xn});var Lr=v((da,Cr)=>{var Wn=J(),Jn=(t,e,r)=>Wn(t,e,r)<=0;Cr.exports=Jn});var qr=v((pa,Pr)=>{var zn=wr(),Qn=Or(),Kn=it(),Yn=Nr(),Zn=Sr(),eo=Lr(),to=(t,e,r,s)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return zn(t,r,s);case"!=":return Qn(t,r,s);case">":return Kn(t,r,s);case">=":return Yn(t,r,s);case"<":return Zn(t,r,s);case"<=":return eo(t,r,s);default:throw new TypeError(`Invalid operator: ${e}`)}};Pr.exports=to});var jr=v((ga,kr)=>{var ve=Symbol("SemVer ANY"),ct=class t{static get ANY(){return ve}constructor(e,r){if(r=ro(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}lt("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===ve?this.value="":this.value=this.operator+this.semver.version,lt("comp",this)}parse(e){let r=this.options.loose?Dr[Fr.COMPARATORLOOSE]:Dr[Fr.COMPARATOR],s=e.match(r);if(!s)throw new TypeError(`Invalid comparator: ${e}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new Br(s[2],this.options.loose):this.semver=ve}toString(){return this.value}test(e){if(lt("Comparator.test",e,this.options.loose),this.semver===ve||e===ve)return!0;if(typeof e=="string")try{e=new Br(e,this.options)}catch{return!1}return at(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");if((!r||typeof r!="object")&&(r={loose:!!r,includePrerelease:!1}),this.operator==="")return this.value===""?!0:new Mr(e.value,r).test(this.value);if(e.operator==="")return e.value===""?!0:new Mr(this.value,r).test(e.semver);let s=(this.operator===">="||this.operator===">")&&(e.operator===">="||e.operator===">"),n=(this.operator==="<="||this.operator==="<")&&(e.operator==="<="||e.operator==="<"),o=this.semver.version===e.semver.version,i=(this.operator===">="||this.operator==="<=")&&(e.operator===">="||e.operator==="<="),a=at(this.semver,"<",e.semver,r)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),l=at(this.semver,">",e.semver,r)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return s||n||o&&i||a||l}};kr.exports=ct;var ro=Le(),{re:Dr,t:Fr}=Ce(),at=qr(),lt=ge(),Br=be(),Mr=ut()});var ut=v((ma,Hr)=>{var ft=class t{constructor(e,r){if(r=no(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof ht)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!_r(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&co(n[0])){this.set=[n];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();let s=`parseRange:${Object.keys(this.options).join(",")}:${e}`,n=Gr.get(s);if(n)return n;let o=this.options.loose,i=o?P[C.HYPHENRANGELOOSE]:P[C.HYPHENRANGE];e=e.replace(i,vo(this.options.includePrerelease)),N("hyphen replace",e),e=e.replace(P[C.COMPARATORTRIM],io),N("comparator trim",e,P[C.COMPARATORTRIM]),e=e.replace(P[C.TILDETRIM],ao),e=e.replace(P[C.CARETTRIM],lo),e=e.split(/\s+/).join(" ");let a=o?P[C.COMPARATORLOOSE]:P[C.COMPARATOR],l=e.split(" ").map(h=>uo(h,this.options)).join(" ").split(/\s+/).map(h=>Eo(h,this.options)).filter(this.options.loose?h=>!!h.match(a):()=>!0).map(h=>new ht(h,this.options)),c=l.length,f=new Map;for(let h of l){if(_r(h))return[h];f.set(h.value,h)}f.size>1&&f.has("")&&f.delete("");let u=[...f.values()];return Gr.set(s,u),u}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(s=>Ur(s,r)&&e.set.some(n=>Ur(n,r)&&s.every(o=>n.every(i=>o.intersects(i,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new oo(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(xo(this.set[r],e,this.options))return!0;return!1}};Hr.exports=ft;var so=xr(),Gr=new so({max:1e3}),no=Le(),ht=jr(),N=ge(),oo=be(),{re:P,t:C,comparatorTrimReplace:io,tildeTrimReplace:ao,caretTrimReplace:lo}=Ce(),_r=t=>t.value==="<0.0.0-0",co=t=>t.value==="",Ur=(t,e)=>{let r=!0,s=t.slice(),n=s.pop();for(;r&&s.length;)r=s.every(o=>n.intersects(o,e)),n=s.pop();return r},uo=(t,e)=>(N("comp",t,e),t=po(t,e),N("caret",t),t=fo(t,e),N("tildes",t),t=mo(t,e),N("xrange",t),t=yo(t,e),N("stars",t),t),q=t=>!t||t.toLowerCase()==="x"||t==="*",fo=(t,e)=>t.trim().split(/\s+/).map(r=>ho(r,e)).join(" "),ho=(t,e)=>{let r=e.loose?P[C.TILDELOOSE]:P[C.TILDE];return t.replace(r,(s,n,o,i,a)=>{N("tilde",t,s,n,o,i,a);let l;return q(n)?l="":q(o)?l=`>=${n}.0.0 <${+n+1}.0.0-0`:q(i)?l=`>=${n}.${o}.0 <${n}.${+o+1}.0-0`:a?(N("replaceTilde pr",a),l=`>=${n}.${o}.${i}-${a} <${n}.${+o+1}.0-0`):l=`>=${n}.${o}.${i} <${n}.${+o+1}.0-0`,N("tilde return",l),l})},po=(t,e)=>t.trim().split(/\s+/).map(r=>go(r,e)).join(" "),go=(t,e)=>{N("caret",t,e);let r=e.loose?P[C.CARETLOOSE]:P[C.CARET],s=e.includePrerelease?"-0":"";return t.replace(r,(n,o,i,a,l)=>{N("caret",t,n,o,i,a,l);let c;return q(o)?c="":q(i)?c=`>=${o}.0.0${s} <${+o+1}.0.0-0`:q(a)?o==="0"?c=`>=${o}.${i}.0${s} <${o}.${+i+1}.0-0`:c=`>=${o}.${i}.0${s} <${+o+1}.0.0-0`:l?(N("replaceCaret pr",l),o==="0"?i==="0"?c=`>=${o}.${i}.${a}-${l} <${o}.${i}.${+a+1}-0`:c=`>=${o}.${i}.${a}-${l} <${o}.${+i+1}.0-0`:c=`>=${o}.${i}.${a}-${l} <${+o+1}.0.0-0`):(N("no pr"),o==="0"?i==="0"?c=`>=${o}.${i}.${a}${s} <${o}.${i}.${+a+1}-0`:c=`>=${o}.${i}.${a}${s} <${o}.${+i+1}.0-0`:c=`>=${o}.${i}.${a} <${+o+1}.0.0-0`),N("caret return",c),c})},mo=(t,e)=>(N("replaceXRanges",t,e),t.split(/\s+/).map(r=>bo(r,e)).join(" ")),bo=(t,e)=>{t=t.trim();let r=e.loose?P[C.XRANGELOOSE]:P[C.XRANGE];return t.replace(r,(s,n,o,i,a,l)=>{N("xRange",t,s,n,o,i,a,l);let c=q(o),f=c||q(i),u=f||q(a),h=u;return n==="="&&h&&(n=""),l=e.includePrerelease?"-0":"",c?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&h?(f&&(i=0),a=0,n===">"?(n=">=",f?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):n==="<="&&(n="<",f?o=+o+1:i=+i+1),n==="<"&&(l="-0"),s=`${n+o}.${i}.${a}${l}`):f?s=`>=${o}.0.0${l} <${+o+1}.0.0-0`:u&&(s=`>=${o}.${i}.0${l} <${o}.${+i+1}.0-0`),N("xRange return",s),s})},yo=(t,e)=>(N("replaceStars",t,e),t.trim().replace(P[C.STAR],"")),Eo=(t,e)=>(N("replaceGTE0",t,e),t.trim().replace(P[e.includePrerelease?C.GTE0PRE:C.GTE0],"")),vo=t=>(e,r,s,n,o,i,a,l,c,f,u,h,x)=>(q(s)?r="":q(n)?r=`>=${s}.0.0${t?"-0":""}`:q(o)?r=`>=${s}.${n}.0${t?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,q(c)?l="":q(f)?l=`<${+c+1}.0.0-0`:q(u)?l=`<${c}.${+f+1}.0-0`:h?l=`<=${c}.${f}.${u}-${h}`:t?l=`<${c}.${f}.${+u+1}-0`:l=`<=${l}`,`${r} ${l}`.trim()),xo=(t,e,r)=>{for(let s=0;s<t.length;s++)if(!t[s].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let s=0;s<t.length;s++)if(N(t[s].semver),t[s].semver!==ht.ANY&&t[s].semver.prerelease.length>0){let n=t[s].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var Wr=v((ba,Xr)=>{var dt=be(),$o=ut(),Vr=it(),wo=(t,e)=>{t=new $o(t,e);let r=new dt("0.0.0");if(t.test(r)||(r=new dt("0.0.0-0"),t.test(r)))return r;r=null;for(let s=0;s<t.set.length;++s){let n=t.set[s],o=null;n.forEach(i=>{let a=new dt(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||Vr(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||Vr(r,o))&&(r=o)}return r&&t.test(r)?r:null};Xr.exports=wo});var zr=v((Jr,Fe)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define(e):typeof Fe=="object"&&Fe.exports?Fe.exports=e():t.log=e()})(Jr,function(){"use strict";var t=function(){},e="undefined",r=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["trace","debug","info","warn","error"];function n(m,w){var I=m[w];if(typeof I.bind=="function")return I.bind(m);try{return Function.prototype.bind.call(I,m)}catch{return function(){return Function.prototype.apply.apply(I,[m,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function i(m){return m==="debug"&&(m="log"),typeof console===e?!1:m==="trace"&&r?o:console[m]!==void 0?n(console,m):console.log!==void 0?n(console,"log"):t}function a(m,w){for(var I=0;I<s.length;I++){var T=s[I];this[T]=I<m?t:this.methodFactory(T,m,w)}this.log=this.debug}function l(m,w,I){return function(){typeof console!==e&&(a.call(this,w,I),this[m].apply(this,arguments))}}function c(m,w,I){return i(m)||l.apply(this,arguments)}function f(m,w,I){var T=this,V;w=w??"WARN";var L="loglevel";typeof m=="string"?L+=":"+m:typeof m=="symbol"&&(L=void 0);function X(E){var M=(s[E]||"silent").toUpperCase();if(!(typeof window===e||!L)){try{window.localStorage[L]=M;return}catch{}try{window.document.cookie=encodeURIComponent(L)+"="+M+";"}catch{}}}function _(){var E;if(!(typeof window===e||!L)){try{E=window.localStorage[L]}catch{}if(typeof E===e)try{var M=window.document.cookie,Y=M.indexOf(encodeURIComponent(L)+"=");Y!==-1&&(E=/^([^;]+)/.exec(M.slice(Y))[1])}catch{}return T.levels[E]===void 0&&(E=void 0),E}}function K(){if(!(typeof window===e||!L)){try{window.localStorage.removeItem(L);return}catch{}try{window.document.cookie=encodeURIComponent(L)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}T.name=m,T.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},T.methodFactory=I||c,T.getLevel=function(){return V},T.setLevel=function(E,M){if(typeof E=="string"&&T.levels[E.toUpperCase()]!==void 0&&(E=T.levels[E.toUpperCase()]),typeof E=="number"&&E>=0&&E<=T.levels.SILENT){if(V=E,M!==!1&&X(E),a.call(T,E,m),typeof console===e&&E<T.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+E},T.setDefaultLevel=function(E){w=E,_()||T.setLevel(E,!1)},T.resetLevel=function(){T.setLevel(w,!1),K()},T.enableAll=function(E){T.setLevel(T.levels.TRACE,E)},T.disableAll=function(E){T.setLevel(T.levels.SILENT,E)};var j=_();j==null&&(j=w),T.setLevel(j,!1)}var u=new f,h={};u.getLogger=function(w){if(typeof w!="symbol"&&typeof w!="string"||w==="")throw new TypeError("You must supply a name when creating a logger.");var I=h[w];return I||(I=h[w]=new f(w,u.getLevel(),u.methodFactory)),I};var x=typeof window!==e?window.log:void 0;return u.noConflict=function(){return typeof window!==e&&window.log===u&&(window.log=x),u},u.getLoggers=function(){return h},u.default=u,u})});var Kr=v((ya,Qr)=>{"use strict";Qr.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var pt=v((Ea,Zr)=>{var xe=Kr(),Yr={};for(let t of Object.keys(xe))Yr[xe[t]]=t;var g={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Zr.exports=g;for(let t of Object.keys(g)){if(!("channels"in g[t]))throw new Error("missing channels property: "+t);if(!("labels"in g[t]))throw new Error("missing channel labels property: "+t);if(g[t].labels.length!==g[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=g[t];delete g[t].channels,delete g[t].labels,Object.defineProperty(g[t],"channels",{value:e}),Object.defineProperty(g[t],"labels",{value:r})}g.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,s=t[2]/255,n=Math.min(e,r,s),o=Math.max(e,r,s),i=o-n,a,l;o===n?a=0:e===o?a=(r-s)/i:r===o?a=2+(s-e)/i:s===o&&(a=4+(e-r)/i),a=Math.min(a*60,360),a<0&&(a+=360);let c=(n+o)/2;return o===n?l=0:c<=.5?l=i/(o+n):l=i/(2-o-n),[a,l*100,c*100]};g.rgb.hsv=function(t){let e,r,s,n,o,i=t[0]/255,a=t[1]/255,l=t[2]/255,c=Math.max(i,a,l),f=c-Math.min(i,a,l),u=function(h){return(c-h)/6/f+1/2};return f===0?(n=0,o=0):(o=f/c,e=u(i),r=u(a),s=u(l),i===c?n=s-r:a===c?n=1/3+e-s:l===c&&(n=2/3+r-e),n<0?n+=1:n>1&&(n-=1)),[n*360,o*100,c*100]};g.rgb.hwb=function(t){let e=t[0],r=t[1],s=t[2],n=g.rgb.hsl(t)[0],o=1/255*Math.min(e,Math.min(r,s));return s=1-1/255*Math.max(e,Math.max(r,s)),[n,o*100,s*100]};g.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,s=t[2]/255,n=Math.min(1-e,1-r,1-s),o=(1-e-n)/(1-n)||0,i=(1-r-n)/(1-n)||0,a=(1-s-n)/(1-n)||0;return[o*100,i*100,a*100,n*100]};function To(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}g.rgb.keyword=function(t){let e=Yr[t];if(e)return e;let r=1/0,s;for(let n of Object.keys(xe)){let o=xe[n],i=To(t,o);i<r&&(r=i,s=n)}return s};g.keyword.rgb=function(t){return xe[t]};g.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,s=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;let n=e*.4124+r*.3576+s*.1805,o=e*.2126+r*.7152+s*.0722,i=e*.0193+r*.1192+s*.9505;return[n*100,o*100,i*100]};g.rgb.lab=function(t){let e=g.rgb.xyz(t),r=e[0],s=e[1],n=e[2];r/=95.047,s/=100,n/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let o=116*s-16,i=500*(r-s),a=200*(s-n);return[o,i,a]};g.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,s=t[2]/100,n,o,i;if(r===0)return i=s*255,[i,i,i];s<.5?n=s*(1+r):n=s+r-s*r;let a=2*s-n,l=[0,0,0];for(let c=0;c<3;c++)o=e+1/3*-(c-1),o<0&&o++,o>1&&o--,6*o<1?i=a+(n-a)*6*o:2*o<1?i=n:3*o<2?i=a+(n-a)*(2/3-o)*6:i=a,l[c]=i*255;return l};g.hsl.hsv=function(t){let e=t[0],r=t[1]/100,s=t[2]/100,n=r,o=Math.max(s,.01);s*=2,r*=s<=1?s:2-s,n*=o<=1?o:2-o;let i=(s+r)/2,a=s===0?2*n/(o+n):2*r/(s+r);return[e,a*100,i*100]};g.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,s=t[2]/100,n=Math.floor(e)%6,o=e-Math.floor(e),i=255*s*(1-r),a=255*s*(1-r*o),l=255*s*(1-r*(1-o));switch(s*=255,n){case 0:return[s,l,i];case 1:return[a,s,i];case 2:return[i,s,l];case 3:return[i,a,s];case 4:return[l,i,s];case 5:return[s,i,a]}};g.hsv.hsl=function(t){let e=t[0],r=t[1]/100,s=t[2]/100,n=Math.max(s,.01),o,i;i=(2-r)*s;let a=(2-r)*n;return o=r*n,o/=a<=1?a:2-a,o=o||0,i/=2,[e,o*100,i*100]};g.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,s=t[2]/100,n=r+s,o;n>1&&(r/=n,s/=n);let i=Math.floor(6*e),a=1-s;o=6*e-i,i&1&&(o=1-o);let l=r+o*(a-r),c,f,u;switch(i){default:case 6:case 0:c=a,f=l,u=r;break;case 1:c=l,f=a,u=r;break;case 2:c=r,f=a,u=l;break;case 3:c=r,f=l,u=a;break;case 4:c=l,f=r,u=a;break;case 5:c=a,f=r,u=l;break}return[c*255,f*255,u*255]};g.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,s=t[2]/100,n=t[3]/100,o=1-Math.min(1,e*(1-n)+n),i=1-Math.min(1,r*(1-n)+n),a=1-Math.min(1,s*(1-n)+n);return[o*255,i*255,a*255]};g.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,s=t[2]/100,n,o,i;return n=e*3.2406+r*-1.5372+s*-.4986,o=e*-.9689+r*1.8758+s*.0415,i=e*.0557+r*-.204+s*1.057,n=n>.0031308?1.055*n**(1/2.4)-.055:n*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,n=Math.min(Math.max(0,n),1),o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),[n*255,o*255,i*255]};g.xyz.lab=function(t){let e=t[0],r=t[1],s=t[2];e/=95.047,r/=100,s/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let n=116*r-16,o=500*(e-r),i=200*(r-s);return[n,o,i]};g.lab.xyz=function(t){let e=t[0],r=t[1],s=t[2],n,o,i;o=(e+16)/116,n=r/500+o,i=o-s/200;let a=o**3,l=n**3,c=i**3;return o=a>.008856?a:(o-16/116)/7.787,n=l>.008856?l:(n-16/116)/7.787,i=c>.008856?c:(i-16/116)/7.787,n*=95.047,o*=100,i*=108.883,[n,o,i]};g.lab.lch=function(t){let e=t[0],r=t[1],s=t[2],n;n=Math.atan2(s,r)*360/2/Math.PI,n<0&&(n+=360);let i=Math.sqrt(r*r+s*s);return[e,i,n]};g.lch.lab=function(t){let e=t[0],r=t[1],n=t[2]/360*2*Math.PI,o=r*Math.cos(n),i=r*Math.sin(n);return[e,o,i]};g.rgb.ansi16=function(t,e=null){let[r,s,n]=t,o=e===null?g.rgb.hsv(t)[2]:e;if(o=Math.round(o/50),o===0)return 30;let i=30+(Math.round(n/255)<<2|Math.round(s/255)<<1|Math.round(r/255));return o===2&&(i+=60),i};g.hsv.ansi16=function(t){return g.rgb.ansi16(g.hsv.rgb(t),t[2])};g.rgb.ansi256=function(t){let e=t[0],r=t[1],s=t[2];return e===r&&r===s?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(s/255*5)};g.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,s=(e&1)*r*255,n=(e>>1&1)*r*255,o=(e>>2&1)*r*255;return[s,n,o]};g.ansi256.rgb=function(t){if(t>=232){let o=(t-232)*10+8;return[o,o,o]}t-=16;let e,r=Math.floor(t/36)/5*255,s=Math.floor((e=t%36)/6)/5*255,n=e%6/5*255;return[r,s,n]};g.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};g.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(a=>a+a).join(""));let s=parseInt(r,16),n=s>>16&255,o=s>>8&255,i=s&255;return[n,o,i]};g.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,s=t[2]/255,n=Math.max(Math.max(e,r),s),o=Math.min(Math.min(e,r),s),i=n-o,a,l;return i<1?a=o/(1-i):a=0,i<=0?l=0:n===e?l=(r-s)/i%6:n===r?l=2+(s-e)/i:l=4+(e-r)/i,l/=6,l%=1,[l*360,i*100,a*100]};g.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,s=r<.5?2*e*r:2*e*(1-r),n=0;return s<1&&(n=(r-.5*s)/(1-s)),[t[0],s*100,n*100]};g.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,s=e*r,n=0;return s<1&&(n=(r-s)/(1-s)),[t[0],s*100,n*100]};g.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,s=t[2]/100;if(r===0)return[s*255,s*255,s*255];let n=[0,0,0],o=e%1*6,i=o%1,a=1-i,l=0;switch(Math.floor(o)){case 0:n[0]=1,n[1]=i,n[2]=0;break;case 1:n[0]=a,n[1]=1,n[2]=0;break;case 2:n[0]=0,n[1]=1,n[2]=i;break;case 3:n[0]=0,n[1]=a,n[2]=1;break;case 4:n[0]=i,n[1]=0,n[2]=1;break;default:n[0]=1,n[1]=0,n[2]=a}return l=(1-r)*s,[(r*n[0]+l)*255,(r*n[1]+l)*255,(r*n[2]+l)*255]};g.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,s=e+r*(1-e),n=0;return s>0&&(n=e/s),[t[0],n*100,s*100]};g.hcg.hsl=function(t){let e=t[1]/100,s=t[2]/100*(1-e)+.5*e,n=0;return s>0&&s<.5?n=e/(2*s):s>=.5&&s<1&&(n=e/(2*(1-s))),[t[0],n*100,s*100]};g.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,s=e+r*(1-e);return[t[0],(s-e)*100,(1-s)*100]};g.hwb.hcg=function(t){let e=t[1]/100,s=1-t[2]/100,n=s-e,o=0;return n<1&&(o=(s-n)/(1-n)),[t[0],n*100,o*100]};g.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};g.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};g.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};g.gray.hsl=function(t){return[0,0,t[0]]};g.gray.hsv=g.gray.hsl;g.gray.hwb=function(t){return[0,100,t[0]]};g.gray.cmyk=function(t){return[0,0,0,t[0]]};g.gray.lab=function(t){return[t[0],0,0]};g.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,s=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(s.length)+s};g.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var ts=v((va,es)=>{var Be=pt();function Oo(){let t={},e=Object.keys(Be);for(let r=e.length,s=0;s<r;s++)t[e[s]]={distance:-1,parent:null};return t}function Io(t){let e=Oo(),r=[t];for(e[t].distance=0;r.length;){let s=r.pop(),n=Object.keys(Be[s]);for(let o=n.length,i=0;i<o;i++){let a=n[i],l=e[a];l.distance===-1&&(l.distance=e[s].distance+1,l.parent=s,r.unshift(a))}}return e}function Ro(t,e){return function(r){return e(t(r))}}function No(t,e){let r=[e[t].parent,t],s=Be[e[t].parent][t],n=e[t].parent;for(;e[n].parent;)r.unshift(e[n].parent),s=Ro(Be[e[n].parent][n],s),n=e[n].parent;return s.conversion=r,s}es.exports=function(t){let e=Io(t),r={},s=Object.keys(e);for(let n=s.length,o=0;o<n;o++){let i=s[o];e[i].parent!==null&&(r[i]=No(i,e))}return r}});var ss=v((xa,rs)=>{var gt=pt(),Ao=ts(),ie={},So=Object.keys(gt);function Co(t){let e=function(...r){let s=r[0];return s==null?s:(s.length>1&&(r=s),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function Lo(t){let e=function(...r){let s=r[0];if(s==null)return s;s.length>1&&(r=s);let n=t(r);if(typeof n=="object")for(let o=n.length,i=0;i<o;i++)n[i]=Math.round(n[i]);return n};return"conversion"in t&&(e.conversion=t.conversion),e}So.forEach(t=>{ie[t]={},Object.defineProperty(ie[t],"channels",{value:gt[t].channels}),Object.defineProperty(ie[t],"labels",{value:gt[t].labels});let e=Ao(t);Object.keys(e).forEach(s=>{let n=e[s];ie[t][s]=Lo(n),ie[t][s].raw=Co(n)})});rs.exports=ie});var cs=v(($a,ls)=>{"use strict";var ns=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,os=(t,e)=>(...r)=>{let s=t(...r);return`\x1B[${38+e};5;${s}m`},is=(t,e)=>(...r)=>{let s=t(...r);return`\x1B[${38+e};2;${s[0]};${s[1]};${s[2]}m`},Me=t=>t,as=(t,e,r)=>[t,e,r],ae=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let s=r();return Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0}),s},enumerable:!0,configurable:!0})},mt,le=(t,e,r,s)=>{mt===void 0&&(mt=ss());let n=s?10:0,o={};for(let[i,a]of Object.entries(mt)){let l=i==="ansi16"?"ansi":i;i===e?o[l]=t(r,n):typeof a=="object"&&(o[l]=t(a[e],n))}return o};function Po(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,s]of Object.entries(e)){for(let[n,o]of Object.entries(s))e[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},s[n]=e[n],t.set(o[0],o[1]);Object.defineProperty(e,r,{value:s,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",ae(e.color,"ansi",()=>le(ns,"ansi16",Me,!1)),ae(e.color,"ansi256",()=>le(os,"ansi256",Me,!1)),ae(e.color,"ansi16m",()=>le(is,"rgb",as,!1)),ae(e.bgColor,"ansi",()=>le(ns,"ansi16",Me,!0)),ae(e.bgColor,"ansi256",()=>le(os,"ansi256",Me,!0)),ae(e.bgColor,"ansi16m",()=>le(is,"rgb",as,!0)),e}Object.defineProperty(ls,"exports",{enumerable:!0,get:Po})});var fs=v((wa,us)=>{"use strict";us.exports={stdout:!1,stderr:!1}});var ds=v((Ta,hs)=>{"use strict";var qo=(t,e,r)=>{let s=t.indexOf(e);if(s===-1)return t;let n=e.length,o=0,i="";do i+=t.substr(o,s-o)+e+r,o=s+n,s=t.indexOf(e,o);while(s!==-1);return i+=t.substr(o),i},Do=(t,e,r,s)=>{let n=0,o="";do{let i=t[s-1]==="\r";o+=t.substr(n,(i?s-1:s)-n)+e+(i?`\r
2
2
  `:`
3
3
  `)+r,n=s+1,s=t.indexOf(`
4
- `,n)}while(s!==-1);return o+=t.substr(n),o};hs.exports={stringReplaceAll:qo,stringEncaseCRLFWithFirstIndex:Do}});var ys=x((Oa,bs)=>{"use strict";var Fo=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,ps=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Bo=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Mo=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,ko=new Map([["n",`
5
- `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function ms(t){let e=t[0]==="u",r=t[1]==="{";return e&&!r&&t.length===5||t[0]==="x"&&t.length===3?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):ko.get(t)||t}function jo(t,e){let r=[],s=e.trim().split(/\s*,\s*/g),n;for(let o of s){let i=Number(o);if(!Number.isNaN(i))r.push(i);else if(n=o.match(Bo))r.push(n[2].replace(Mo,(a,l,c)=>l?ms(l):c));else throw new Error(`Invalid Chalk template style argument: ${o} (in style '${t}')`)}return r}function Go(t){ps.lastIndex=0;let e=[],r;for(;(r=ps.exec(t))!==null;){let s=r[1];if(r[2]){let n=jo(s,r[2]);e.push([s].concat(n))}else e.push([s])}return e}function gs(t,e){let r={};for(let n of e)for(let o of n.styles)r[o[0]]=n.inverse?null:o.slice(1);let s=t;for(let[n,o]of Object.entries(r))if(Array.isArray(o)){if(!(n in s))throw new Error(`Unknown Chalk style: ${n}`);s=o.length>0?s[n](...o):s[n]}return s}bs.exports=(t,e)=>{let r=[],s=[],n=[];if(e.replace(Fo,(o,i,a,l,c,h)=>{if(i)n.push(ms(i));else if(l){let f=n.join("");n=[],s.push(r.length===0?f:gs(t,r)(f)),r.push({inverse:a,styles:Go(l)})}else if(c){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(gs(t,r)(n.join(""))),n=[],r.pop()}else n.push(h)}),s.push(n.join("")),r.length>0){let o=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(o)}return s.join("")}});var Os=x((Ia,Ts)=>{"use strict";var $e=cs(),{stdout:yt,stderr:Et}=fs(),{stringReplaceAll:_o,stringEncaseCRLFWithFirstIndex:Uo}=ds(),{isArray:ke}=Array,vs=["ansi","ansi","ansi256","ansi16m"],ce=Object.create(null),Ho=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=yt?yt.level:0;t.level=e.level===void 0?r:e.level},vt=class{constructor(e){return xs(e)}},xs=t=>{let e={};return Ho(e,t),e.template=(...r)=>ws(e.template,...r),Object.setPrototypeOf(e,je.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=vt,e.template};function je(t){return xs(t)}for(let[t,e]of Object.entries($e))ce[t]={get(){let r=Ge(this,xt(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};ce.visible={get(){let t=Ge(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};var $s=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let t of $s)ce[t]={get(){let{level:e}=this;return function(...r){let s=xt($e.color[vs[e]][t](...r),$e.color.close,this._styler);return Ge(this,s,this._isEmpty)}}};for(let t of $s){let e="bg"+t[0].toUpperCase()+t.slice(1);ce[e]={get(){let{level:r}=this;return function(...s){let n=xt($e.bgColor[vs[r]][t](...s),$e.bgColor.close,this._styler);return Ge(this,n,this._isEmpty)}}}}var Vo=Object.defineProperties(()=>{},{...ce,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),xt=(t,e,r)=>{let s,n;return r===void 0?(s=t,n=e):(s=r.openAll+t,n=e+r.closeAll),{open:t,close:e,openAll:s,closeAll:n,parent:r}},Ge=(t,e,r)=>{let s=(...n)=>ke(n[0])&&ke(n[0].raw)?Es(s,ws(s,...n)):Es(s,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(s,Vo),s._generator=t,s._styler=e,s._isEmpty=r,s},Es=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;let{openAll:s,closeAll:n}=r;if(e.indexOf("\x1B")!==-1)for(;r!==void 0;)e=_o(e,r.close,r.open),r=r.parent;let o=e.indexOf(`
6
- `);return o!==-1&&(e=Uo(e,n,s,o)),s+e+n},bt,ws=(t,...e)=>{let[r]=e;if(!ke(r)||!ke(r.raw))return e.join(" ");let s=e.slice(1),n=[r.raw[0]];for(let o=1;o<r.length;o++)n.push(String(s[o-1]).replace(/[{}\\]/g,"\\$&"),String(r.raw[o]));return bt===void 0&&(bt=ys()),bt(t,n.join(""))};Object.defineProperties(je.prototype,ce);var _e=je();_e.supportsColor=yt;_e.stderr=je({level:Et?Et.level:0});_e.stderr.supportsColor=Et;Ts.exports=_e});var Rs=x((Ra,Is)=>{Is.exports={rosReleases:{kinetic:{rosVersion:1,ubuntuCodename:"xenial"},melodic:{rosVersion:1,ubuntuCodename:"bionic"},noetic:{rosVersion:1,ubuntuCodename:"focal"},dashing:{rosVersion:2},eloquent:{rosVersion:2},foxy:{rosVersion:2},galactic:{rosVersion:2},humble:{rosVersion:2},iron:{rosVersion:2},rolling:{rosVersion:2}}}});var He=x((Na,js)=>{var Xo=J(),Ns=Wr(),ue={get:require("lodash/get"),set:require("lodash/set"),unset:require("lodash/unset"),forEach:require("lodash/forEach"),map:require("lodash/map"),isEmpty:require("lodash/isEmpty"),eq:require("lodash/isEqual"),isPlainObject:require("lodash/isPlainObject"),merge:require("lodash/merge")},fe=zr(),we=Os(),Wo=Rs();fe.setAll=t=>Object.values(fe.getLoggers()).forEach(e=>e.setLevel(t));var As={warn:we.yellow,error:we.red,info:we.green,debug:we.gray},Jo=t=>As[t]?As[t](t):t,zo=fe.methodFactory;fe.methodFactory=(t,e,r)=>{let s=zo(t,e,r);if(typeof window<"u"){let o=`${r} ${t}`;return(...i)=>s(`[${o}]`,...i)}let n=`${r} ${Jo(t)}`;return(...o)=>s(`[${we.blue(new Date().toISOString())} ${n}]`,...o)};var Qo=fe.getLogger,Ko=t=>JSON.parse(JSON.stringify(t)),Yo=t=>JSON.parse(atob(t.split(".")[1])),Zo=t=>{try{return JSON.parse(t)}catch{return null}},Ss=(t,e,r)=>{t&&(r(t),t[e]?.forEach(s=>Ss(s,e,r)))},Cs=(t,e,r,s=[])=>{r(t,s);let n=e[0];if(n){let o=t[n];o&&Cs(o,e.slice(1),r,s.concat(n))}},ei=t=>new Promise(e=>{setTimeout(e,t)}),Ls=(t,e=[],r={})=>(ue.forEach(t,(s,n)=>{let o=e.concat(String(n));(ue.isPlainObject(s)||s instanceof Array)&&s!==null?Ls(s,o,r):r[Bs(o)]=s}),r),Ps=(t,e,r,s=[],n={})=>{if(e.length==0||e[0]=="#"){r(t,s,n);return}let o=e[0];if(o){for(let i in t)if(i==o||o=="*"||o.startsWith("+")){let a=o.startsWith("+")&&o.length>1?Object.assign({},n,{[o.slice(1)]:i}):n;Ps(t[i],e.slice(1),r,s.concat([i]),a)}}},qs=(t,e,r)=>{if(e.length==0)return t;let s=e.shift();e.length==0?t[s]=r:(t[s]||(t[s]={}),qs(t[s],e,r))},Ds=t=>t.replace(/%/g,"%25").replace(/\//g,"%2F"),Fs=t=>t.replace(/%25/g,"%").replace(/%2F/g,"/"),Bs=t=>{let e=r=>r.startsWith("+")?"+":r;return`/${t.map(e).map(Ds).join("/")}`},re=t=>{let e=t.split("/").map(Fs);return e.length>0&&e[0].length==0&&e.shift(),e.length>0&&e.at(-1).length==0&&e.pop(),e},Ms=(t,e)=>{let r=(o,i)=>{if(o.length==0||o[0][0]=="#"||i.length==0)return!0;if(o[0]==i[0])return r(o.slice(1),i.slice(1));if(o[0][0]=="+"){let a=r(o.slice(1),i.slice(1));return a&&Object.assign({[o[0].slice(1)]:i[0]},a)}return!1},s=re(t),n=re(e);return r(s,n)},ti=(t,e)=>{let r=re(e),s=re(t);return ks(r,s)&&r.length<s.length},ks=(t,e)=>t.length==0?!0:t[0]==e[0]&&ks(t.slice(1),e.slice(1)),ri=t=>{let e=t.split(":");return{organization:e[0],client:e[1],sub:e.slice(2)}},si=t=>{let e=re(t);return{organization:e[0],device:e[1],capabilityScope:e[2],capabilityName:e[3],capability:`${e[2]}/${e[3]}`,version:e[4],sub:e.slice(5)}},ni=t=>t.length==0?null:JSON.parse(t.toString("utf-8")),oi=(t,e,r,s=1e3)=>{let n=[],o=a=>{e.forEach(l=>Ms(`${l}/#`,a)&&n.push(a))};t.on("message",o),e.forEach(a=>{typeof a=="string"?t.subscribe(`${a}/#`):console.warn("Ignoring",a,"since it is not a string.")});let i=typeof Buffer<"u"?Buffer.alloc(0):null;setTimeout(()=>{t.removeListener("message",o),e.forEach(l=>t.unsubscribe(`${l}/#`));let a=n.length;console.log(`clearing ${a} retained messages from ${e}`),n.forEach(l=>{t.publish(l,i,{retain:!0})}),r&&r(a)},s)},ii=()=>Math.random().toString(36).slice(2),Ue=(t,e)=>Xo(Ns(t),Ns(e)),ai=(t,e=void 0,r={})=>{if(!t)return e?ue.set({},e,t):t;let s=Object.keys(t).filter(i=>(!r.maxVersion||Ue(i,r.maxVersion)<=0)&&(!r.minVersion||Ue(r.minVersion,i)<=0)).sort(Ue),n={},o=e&&re(e);return s.forEach(i=>{let a=o?ue.get(t[i],o):t[i];ue.merge(n,a)}),o?ue.set({},o,n):n},li=["B","KB","MB","GB","TB"],ci=t=>{if(!t)return"--";let e=0;for(;t>1024;)t/=1024,e++;return`${t.toFixed(2)} ${li[e]}`},ui=t=>{if(!t)return"--";let e={};t>3600&&(e.h=Math.floor(t/3600),t=t%3600),t>60&&(e.m=Math.floor(t/60),t=t%60),e.s=Math.floor(t);let r="";return e.h>0&&(r+=`${e.h}h `),e.m>0&&(r+=`${e.m}m `),!e.h&&(r+=`${e.s}s`),r.trim()};js.exports={parseMQTTUsername:ri,parseMQTTTopic:si,pathToTopic:Bs,topicToPath:re,toFlatObject:Ls,topicMatch:Ms,mqttParsePayload:ni,getRandomId:ii,versionCompare:Ue,loglevel:fe,getLogger:Qo,mergeVersions:ai,mqttClearRetained:oi,isSubTopicOf:ti,clone:Ko,setFromPath:qs,forMatchIterator:Ps,encodeTopicElement:Ds,decodeTopicElement:Fs,constants:Wo,visit:Ss,wait:ei,formatBytes:ci,formatDuration:ui,tryJSONParse:Zo,decodeJWT:Yo,visitAncestor:Cs}});var Tt=x((Aa,Us)=>{var k={get:require("lodash/get"),set:require("lodash/set"),unset:require("lodash/unset"),forEach:require("lodash/forEach"),map:require("lodash/map"),isEmpty:require("lodash/isEmpty"),eq:require("lodash/isEqual"),isPlainObject:require("lodash/isPlainObject"),merge:require("lodash/merge")},{topicToPath:Te,pathToTopic:fi,toFlatObject:hi,topicMatch:Gs,forMatchIterator:di}=He(),wt=(t,e)=>{if(!e||e.length==0)return;k.unset(t,e);let r=e.slice(0,-1),s=r.length==0?t:k.get(t,r);return k.isEmpty(s)?wt(t,r):e},pi=(t,e)=>(k.forEach(e,(r,s)=>{let n=Te(s);r==null?wt(t,n):k.set(t,n,r)}),t),_s=(t,e)=>{if(e.length==0)return;let r=e[0];if(r)for(let s in t)s!=r&&r!="*"&&!r.startsWith("+")?delete t[s]:_s(t[s],e.slice(1))},$t=class{#e={};#t=[];#r=[];constructor(e={}){this.#e=e}updateFromArray(e,r,s={}){let n=k.get(this.#e,e);if(r==null){if(n==null)return{};wt(this.#e,e)}else{if(k.eq(n,r))return{};k.set(this.#e,e,r)}let o=fi(e),i={[o]:r},a;if(r instanceof Object){let l=hi(r);a={},k.forEach(l,(c,h)=>{a[`${o}${h}`]=c})}else a=i;return this.#t.forEach(l=>l(i,s)),this.#r.forEach(l=>l(a,s)),a}update(e,r,s){if(typeof e=="string")return this.updateFromTopic(e,r,s);if(e instanceof Array)return this.updateFromArray(e,r,s);throw new Error("unrecognized path expression")}updateFromTopic(e,r,s){return this.updateFromArray(Te(e),r,s)}updateFromModifier(e,r){return k.map(e,(s,n)=>this.updateFromTopic(n,s,r))}subscribe(e){e instanceof Function?this.#t.push(e):console.warn("DataCache.subscribe expects a function as argument. Did you mean to use subscribePath?")}subscribePath(e,r){this.#t.push((s,n)=>{k.forEach(s,(o,i)=>{let a=Gs(e,i);a&&r(o,i,a,n)})})}subscribePathFlat(e,r){this.#r.push((s,n)=>{k.forEach(s,(o,i)=>{let a=Gs(e,i);a&&r(o,i,a,n)})})}unsubscribe(e){this.#t=this.#t.filter(r=>r!=e)}get(e=[]){return e.length==0?this.#e:k.get(this.#e,e)}getByTopic(e){return this.get(Te(e))}filter(e){let r=JSON.parse(JSON.stringify(this.get()));return _s(r,e),r}filterByTopic(e){return this.filter(Te(e))}forMatch(e,r){let s=Te(e);this.forPathMatch(s,r)}forPathMatch(e,r){di(this.get(),e,r)}};Us.exports={DataCache:$t,updateObject:pi}});var At=x((Ca,Ws)=>{"use strict";var{mqttParsePayload:gi,topicMatch:Ot,topicToPath:z,pathToTopic:Oe,toFlatObject:It,getLogger:mi,mergeVersions:bi,parseMQTTTopic:yi,isSubTopicOf:Sa,versionCompare:Ei,encodeTopicElement:vi,visitAncestor:xi}=He(),{DataCache:Hs}=Tt(),Q=require("lodash"),R=mi("MqttSync"),Rt="$SYS/broker/uptime",he="$_",$i=()=>{},wi=t=>typeof t=="object"?JSON.parse(JSON.stringify(t)):t,Vs=t=>t.endsWith("/#")?t:t.endsWith("/")?t.concat("#"):t.concat("/#"),Xs=t=>t.replace(/\/\//g,"/"),Nt=class{data=new Hs;subscribedPaths={};publishedPaths={};publishedMessages=new Hs;publishQueue=new Map;heartbeatWaitersOnce=[];heartbeats=0;beforeDisconnectHooks=[];constructor({mqttClient:e,onChange:r,ignoreRetain:s,migrate:n,onReady:o,sliceTopic:i,onHeartbeatGranted:a}){this.mqtt=e,this.mqtt.on("message",(l,c,h)=>{let f=c&&c.toString();if(R.debug("got message",l,f.slice(0,180),f.length>180?`... (${f.length} bytes)`:"",h.retain),l==Rt)this.heartbeats>0&&(this.heartbeatWaitersOnce.forEach(u=>u()),this.heartbeatWaitersOnce=[]),this.heartbeats==1&&!n&&o&&o(),this.heartbeats++;else if(h.retain||s){let u=z(l);R.debug("processing message",l,u),i&&(u=u.slice(i),l=Oe(u));let E=gi(c);if(this.isPublished(l))this.publishedMessages.updateFromArray([...u,he],E),this.data.update(l,E,{external:!0});else if(this.isSubscribed(l)){R.debug("applying received update",l);let m=this.data.update(l,E);r&&Object.keys(m).length>0&&r(m)}}}),this.mqtt.subscribe(Rt,{rap:!0},(l,c)=>{R.debug(Rt,{granted:c}),c.length>0&&a?.()}),n?.length>0&&this.migrate(n,()=>{R.debug("done migrating",o),o&&this.waitForHeartbeatOnce(o)})}publishAtLevel(e,r,s){R.debug(`publishingAtLevel ${s}`,e,r),s>0?Q.forEach(r,(n,o)=>{let i=`${e}/${vi(o)}`;R.debug(`publishing ${i}`),this.publishAtLevel(i,n,s-1)}):this.mqtt.publish(e,JSON.stringify(r),{retain:!0},n=>{n&&R.warn("Error when publishing migration result",n)})}migrate(e,r=void 0){let s=e.length;if(s==0){r&&r();return}let n=()=>--s==0&&r&&r();e.forEach(({topic:o,newVersion:i,transform:a=void 0,flat:l=!1,level:c=0})=>{R.debug("migrating",o,i);let{organization:h,device:f,capability:u,sub:E}=yi(o),m=`/${h}/${f}/${u}`,$=E.length==0?"/#":Oe(E),I=`${m}/+${$}`;this.subscribe(I,T=>{if(T){R.warn("Error during migration",T),n();return}this.waitForHeartbeatOnce(()=>{R.debug("got heartbeat",o,I);let V=this.data.getByTopic(m);if(!V){this.unsubscribe(I),n();return}let L=bi(V,$,{maxVersion:i}),X=Q.get(L,z($)),_=a?a(X):X,K=Xs(`${m}/${i}/${$}`);if(R.debug("publishing merged",K),l){let j=It(_),v=z(K);Q.forEach(j,(M,Y)=>{let We=Oe(v.concat(z(Y)));this.mqtt.publish(We,JSON.stringify(M),{retain:!0},qt=>{qt&&R.warn(`Error when publishing migration result for ${Y}`,qt)})})}else this.publishAtLevel(K,_,c);this.unsubscribe(I),this.waitForHeartbeatOnce(()=>{let v=Object.keys(V).filter(M=>Ei(M,i)<0).map(M=>Xs(`${m}/${M}/${$}`));R.debug({prefixesToClear:v}),this.clear(v),n()})})})})}clear(e,r=void 0,s={}){let n=[],o=a=>{e.forEach(l=>Ot(`${l}/#`,a)&&(!s.filter||s.filter(a))&&n.push(a))};this.mqtt.on("message",o),e.forEach(a=>{typeof a=="string"?this.mqtt.subscribe(`${a}/#`):R.warn("Ignoring",a,"since it is not a string.")});let i=typeof Buffer<"u"?Buffer.alloc(0):null;this.waitForHeartbeatOnce(()=>{this.mqtt.removeListener("message",o),e.forEach(l=>this.mqtt.unsubscribe(`${l}/#`));let a=n.length;R.debug(`clearing ${a} retained messages from ${e}`),n.forEach(l=>{this.mqtt.publish(l,i,{retain:!0})}),r&&r(a)})}waitForHeartbeatOnce(e){setTimeout(()=>this.heartbeatWaitersOnce.push(e),1)}isSubscribed(e){return Object.keys(this.subscribedPaths).some(r=>Ot(r,e))}isPublished(e){return Object.keys(this.publishedPaths).some(r=>Ot(r,e)&&!this.publishedPaths[r].atomic)}subscribe(e,r=$i){if(e=Vs(e),R.debug("subscribing to",e),this.subscribedPaths[e]){R.debug("already subscribed to",e),r();return}this.mqtt.subscribe(e,{rap:!0},(s,n)=>{R.debug("subscribe",e,"granted:",n),n&&n.some(o=>o.topic==e&&o.qos<128)?(this.subscribedPaths[e]=1,r(null)):r(`not permitted to subscribe to topic ${e}, ${JSON.stringify(n)}`)})}unsubscribe(e){this.subscribedPaths[e]&&(this.mqtt.unsubscribe(e),delete this.subscribedPaths[e])}_actuallyPublish(e,r){return this.mqtt.connected?(R.debug("actually publishing",e),this.mqtt.publish(e,r==null?null:JSON.stringify(r),{retain:!0}),!0):(R.warn("not connected, not publishing",e),!1)}_processQueue_rec(e){if(this.publishQueue.size>0){let[r,s]=this.publishQueue.entries().next().value;this._actuallyPublish(r,s)?(this.publishQueue.delete(r),this._processQueue_rec(e)):setTimeout(()=>this._processQueue_rec(e),5e3)}else e()}_processQueue(){this._processing||(this._processing=!0,this._processQueue_rec(()=>this._processing=!1))}setThrottle(e){this._processQueueThrottled=Q.throttle(this._processQueue.bind(this),e)}clearThrottle(){delete this._processQueueThrottled}addToQueue(e,r){this.publishQueue.set(e,r)}_enqueue(e,r){R.debug("enqueuing",e),this.addToQueue(e,r),this._processQueueThrottled?this._processQueueThrottled():this._processQueue();let s=z(e);this.publishedMessages.updateFromArray([...s,he],r==null?null:wi(r))}publish(e,r={atomic:!1}){if(e=Vs(e),Q.isEqual(this.publishedPaths[e],r))return!1;if(this.publishedPaths[e]=r,r.atomic)return this.data.subscribePath(e,(s,n,o,i)=>{if(i?.external)return;R.debug("processing change (atomic)",n,e);let a=e.slice(0,e.length-2),l=Oe(z(n).slice(0,z(a).length));this._enqueue(l,this.data.getByTopic(l))}),!0;this.mqtt.subscribe(e),this.data.subscribePath(e,(s,n,o,i)=>{if(i?.external)return;R.debug("processing change",n);let a=z(n),l=this.publishedMessages.get(a);Q.each(l,(h,f)=>{if(f==he)return!0;let u=Object.keys(It(h)).filter(E=>E.endsWith(he));R.debug("flat->atomic: ",{toClear:u},f),u.forEach(E=>{let m=E.slice(0,-(he.length+1)),$=`${n}/${f}/${m}`;this._enqueue($,null)})});let c=this.publishedMessages.get();return xi(c,a.slice(0,-1),(h,f)=>{let u=h[he];if(u&&Q.isObject(u)){R.debug("atomic->flat",{oldVal:u});let E=Oe(f);this._enqueue(E,null);let m=It(u);Q.each(m,($,I)=>{let T=`${E}${I}`;this._enqueue(T,$)})}}),this._enqueue(n,s),!0})}beforeDisconnect(){this.beforeDisconnectHooks.forEach(e=>e(this))}onBeforeDisconnect(e){this.beforeDisconnectHooks.push(e)}};Ws.exports=Nt});var pe={};Dt(pe,{Code:()=>Ai,ErrorBoundary:()=>Pt,InlineCode:()=>Si,LevelBadge:()=>Ni,MqttSync:()=>zs,Timer:()=>Ci,TimerContext:()=>en,TransitiveCapability:()=>Li,createWebComponent:()=>qi,fetchJson:()=>Ks,parseCookie:()=>Qs,useCapability:()=>Lt,useMqttSync:()=>Ct,useTopics:()=>Ii,useTransitive:()=>Oi});module.exports=an(pe);var w=D(require("react"));var ze=D(require("react")),Qe=require("react"),ln=require("react/jsx-runtime"),cn=["xxl","xl","lg","md","sm","xs"],un="xs",Ft=ze.createContext({prefixes:{},breakpoints:cn,minBreakpoint:un}),{Consumer:Bi,Provider:Mi}=Ft;function Se(t,e){let{prefixes:r}=(0,Qe.useContext)(Ft);return t||r[e]||e}var Bt=D(require("react")),Mt=require("react/jsx-runtime"),fn=["as","disabled"];function hn(t,e){if(t==null)return{};var r={},s=Object.keys(t),n,o;for(o=0;o<s.length;o++)n=s[o],!(e.indexOf(n)>=0)&&(r[n]=t[n]);return r}function dn(t){return!t||t.trim()==="#"}function Ke({tagName:t,disabled:e,href:r,target:s,rel:n,role:o,onClick:i,tabIndex:a=0,type:l}){t||(r!=null||s!=null||n!=null?t="a":t="button");let c={tagName:t};if(t==="button")return[{type:l||"button",disabled:e},c];let h=u=>{if((e||t==="a"&&dn(r))&&u.preventDefault(),e){u.stopPropagation();return}i?.(u)},f=u=>{u.key===" "&&(u.preventDefault(),h(u))};return t==="a"&&(r||(r="#"),e&&(r=void 0)),[{role:o??"button",disabled:void 0,tabIndex:e?void 0:a,href:r,target:t==="a"?s:void 0,"aria-disabled":e||void 0,rel:t==="a"?n:void 0,onClick:h,onKeyDown:f},c]}var pn=Bt.forwardRef((t,e)=>{let{as:r,disabled:s}=t,n=hn(t,fn),[o,{tagName:i}]=Ke(Object.assign({tagName:r,disabled:s},n));return(0,Mt.jsx)(i,Object.assign({},n,o,{ref:e}))});pn.displayName="Button";var kt=D(Je()),jt=D(require("react"));var Gt=require("react/jsx-runtime"),_t=jt.forwardRef(({bsPrefix:t,bg:e="primary",pill:r=!1,text:s,className:n,as:o="span",...i},a)=>{let l=Se(t,"badge");return(0,Gt.jsx)(o,{ref:a,...i,className:(0,kt.default)(n,l,r&&"rounded-pill",s&&`text-${s}`,e&&`bg-${e}`)})});_t.displayName="Badge";var se=_t;var Ut=D(Je()),Ht=D(require("react"));var Vt=require("react/jsx-runtime"),Xt=Ht.forwardRef(({as:t,bsPrefix:e,variant:r="primary",size:s,active:n=!1,disabled:o=!1,className:i,...a},l)=>{let c=Se(e,"btn"),[h,{tagName:f}]=Ke({tagName:t,disabled:o,...a});return(0,Vt.jsx)(f,{...h,...a,ref:l,disabled:o,className:(0,Ut.default)(i,c,n&&"active",r&&`${c}-${r}`,s&&`${c}-${s}`,a.href&&o&&"disabled")})});Xt.displayName="Button";var Ye=Xt;var Zs=D(Yt());var y={};Dt(y,{MqttSync:()=>zs,fetchJson:()=>Ks,parseCookie:()=>Qs});A(y,D(He()));A(y,D(Tt()));var Js=D(At()),zs=Js.default,Qs=t=>t.split(";").map(e=>e.split("=")).reduce((e,r)=>(e[decodeURIComponent(r[0].trim())]=r[1]&&decodeURIComponent(r[1].trim()),e),{}),Ks=(t,e,r={})=>{fetch(t,{method:r.method||(r.body?"post":"get"),mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json",...r.headers},redirect:"follow",referrerPolicy:"no-referrer",body:r.body?JSON.stringify(r.body):void 0}).then(s=>{let n=!s.ok&&`fetching ${t} failed: ${s.status} ${s.statusText}`;s.json().then(o=>e(n,o)).catch(o=>{throw new Error(o)})}).catch(s=>e(`error: ${s}`))};var B=D(require("react")),Xe=D(require("lodash")),Ys=D(require("mqtt-browser"));var Ti=At(),F=(0,y.getLogger)("utils-web/hooks");F.setLevel("info");F.setLevel("debug");var Ct=({jwt:t,id:e,mqttUrl:r})=>{let[s,n]=(0,B.useState)("connecting"),[o,i]=(0,B.useState)(),[a,l]=(0,B.useState)({}),[c,h]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{let f=(0,y.decodeJWT)(t),u=Ys.default.connect(r,{username:JSON.stringify({id:e,payload:f}),password:t});return u.on("connect",()=>{F.debug("connected");let E=new Ti({mqttClient:u,ignoreRetain:!0,onHeartbeatGranted:()=>h(!0)});i(E),n("connected"),E.data.subscribe(Xe.default.throttle(()=>l((0,y.clone)(E.data.get())),50))}),u.on("error",E=>{F.error(E),n(`error: ${E}`)}),()=>{F.info("cleaning up useMQTTSync"),o&&o.beforeDisconnect?(o.beforeDisconnect(),o.waitForHeartbeatOnce(()=>u.end())):u.end()}},[t,e]),{status:s,ready:c,StatusComponent:()=>B.default.createElement("div",null,s),mqttSync:o,data:a}},Oi=({jwt:t,id:e,host:r,ssl:s,capability:n,versionNS:o})=>{let[i,a]=n.split("/"),{device:l}=(0,y.decodeJWT)(t),c=[e,l,i,a],h=(0,y.pathToTopic)(c),f=[...c,o],u=(0,y.pathToTopic)(f),E=`${s&&JSON.parse(s)?"wss":"ws"}://mqtt.${r}`;return{...Ct({jwt:t,id:e,mqttUrl:E}),device:l,prefixPath:c,prefix:h,prefixPathVersion:f,prefixVersion:u}},Ii=({jwt:t,host:e="transitiverobotics.com",ssl:r=!0,topics:s=[]})=>{let[n,o]=(0,B.useState)();!Xe.default.isEqual(n,s)&&o(s);let{device:i,id:a,capability:l}=(0,y.decodeJWT)(t);if(i=="_fleet"){F.warn("useTopics only works for device JWTs, not _fleet ones");return}let c=`/${a}/${i}/@transitive-robotics/_robot-agent/+/status`,{mqttSync:h,data:f,status:u,ready:E,StatusComponent:m}=Ct({jwt:t,id:a,mqttUrl:`ws${r?"s":""}://mqtt.${e}`});(0,B.useEffect)(()=>{E&&h.subscribe(c,j=>j&&console.warn(j))},[h,E]);let $=(0,y.mergeVersions)(f[a]?.[i]["@transitive-robotics"]["_robot-agent"],"status").status,I=$?.runningPackages,[T,V]=l.split("/"),L=I?.[T]?.[V],X=L&&Object.values(L).filter(Boolean)[0],_=`/${a}/${i}/${l}/${X}`;(0,B.useEffect)(()=>{F.debug("topics",s),X&&s.forEach(j=>{F.debug(`subscribing to ${_}${j}`),h.subscribe(`${_}${j}`,v=>v&&F.warn(v))})},[n,X,h]);let K=Xe.default.get(f,(0,y.topicToPath)(_));return{data:f?.[a]?.[i],mqttSync:h,agentStatus:$,topicData:K}},Ve={},St={},Lt=({capability:t,name:e,userId:r,deviceId:s,host:n="transitiverobotics.com",ssl:o=!0,testing:i=!1})=>{let[a,l]=(0,B.useState)({loaded:!1}),c=(f,u)=>{F.debug(`custom component ${e}: ${f}`),St[e]=u,l(E=>({...E,loadedModule:u,loaded:!!u}))},h=(...f)=>Ve[e].forEach(u=>u(...f));return(0,B.useEffect)(()=>{if(F.debug(`loading custom component ${e}`),St[e])return c("already loaded",St[e]);if(Ve[e])return F.debug("already loading"),Ve[e].push(c);Ve[e]=[c];let f=i?"":`http${o?"s":""}://portal.${n}`,u=new URLSearchParams({userId:r,deviceId:s}),E=`${f}/running/${t}/dist/${e}`;import(`${E}.esm.js?${u.toString()}`).then(m=>h("loaded esm",m),m=>{F.warn(`No ESM module found for ${e}, loading iife`),import(`${E}.js?${u.toString()}`).then($=>h("loaded iife",$),$=>F.error(`Failed to load ${e} iife`,$))})},[t,e,r,s]),a};var de={badge:{width:"4em"},code:{color:"#700",borderLeft:"3px solid #aaa",padding:"0.5em 0px 0.5em 2em",backgroundColor:"#f0f0f0",borderRadius:"4px",marginTop:"0.5em"},inlineCode:{color:"#700",margin:"0px 0.5em 0px 0.5em"}},Ri=[w.default.createElement(se,{bg:"success",style:de.badge},"OK"),w.default.createElement(se,{bg:"warning",style:de.badge},"Warn"),w.default.createElement(se,{bg:"danger",style:de.badge},"Error"),w.default.createElement(se,{bg:"secondary",style:de.badge},"Stale")],Ni=({level:t})=>Ri[t]||w.default.createElement("span",null,t),Ai=({children:t})=>w.default.createElement("pre",{style:de.code},t),Si=({children:t})=>w.default.createElement("tt",{style:de.inlineCode},t),Ie={},en=w.default.createContext({}),Ci=({duration:t,onTimeout:e,onStart:r,setOnDisconnect:s,children:n})=>{t=t||60;let[o,i]=(0,w.useState)(t),[a,l]=(0,w.useState)(!1),c=(0,w.useMemo)(()=>Math.random().toString(36).slice(2),[]),h=()=>{console.log("stopping timer for",c),e&&setTimeout(e,1),clearInterval(Ie[c]),Ie[c]=null,l(!1)},f=()=>{let E=Ie[c];return console.log(E,Ie,o),!E&&o>0&&(l(!0),Ie[c]=setInterval(()=>i(m=>{if(--m>0)return m;h()}),1e3),r&&setTimeout(r,1)),h};(0,w.useEffect)(()=>{o>0&&!a&&f()},[o]),(0,w.useEffect)(()=>h,[]),s&&s(()=>{h()});let u=()=>i(t);return w.default.createElement(en.Provider,{value:{reset:u,duration:t,timer:o}},o>0?w.default.createElement("div",null,n,o<60&&w.default.createElement("div",null,"Timeout in: ",o," seconds")):w.default.createElement("div",null,"Timed out. ",w.default.createElement(Ye,{onClick:u},"Resume")))},Li=({jwt:t,ssl:e=!0,host:r="transitiverobotics.com",testing:s=!1,...n})=>{let{id:o,device:i,capability:a}=(0,y.decodeJWT)(t),l=i=="_fleet"?"fleet":"device",h=`${a.split("/")[1]}-${l}`,{loaded:f}=Lt({capability:a,name:h,userId:o||n.userId,deviceId:i,testing:s,host:r,ssl:e}),u=(0,w.useRef)();return(0,w.useEffect)(()=>{u.current?.instance?.setState(E=>({...E,id:o,jwt:t,host:r,ssl:e,...n}))},[u.current]),f?w.default.createElement(h,{id:o,jwt:t,host:r,ssl:e,...n,ref:u}):w.default.createElement("div",null,"Loading ",h)},Pt=class extends w.default.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,r){console.warn("ErrorBoundary caught:",e,r)}render(){return this.state.hasError?w.default.createElement("div",null,this.props.message||"Something went wrong here."):this.props.children}},Pi=t=>t.$$typeof==Symbol.for("react.forward_ref")||t.prototype?.render,qi=(t,e,r="0.0.0",s={})=>{let n=Pi(t)?w.default.createRef():null;class o extends w.default.Component{onDisconnect=null;state={};setOnDisconnect(a){this.onDisconnect=a}webComponentConstructed(a){let l=new MutationObserver(c=>{let h={};c.forEach(({attributeName:f})=>{h[f]=a.getAttribute(f)}),this.setState(f=>({...f,...h}))}).observe(a,{attributes:!0})}webComponentDisconnected(){this.setState({_disconnected:!0});try{this.onDisconnect&&this.onDisconnect()}catch(a){console.log("Error during onDisconnect of web-component",a)}}setConfig(a){this.setState({config:a})}render(){let a=s.stylesheets||["https://cdn.jsdelivr.net/gh/transitiverobotics/transitive-utils@0.8.3/web/css/bootstrap_transitive-bs-root.min.css"];return w.default.createElement("div",{id:`cap-${e}-${r}`,className:s.className||"transitive-bs-root"},w.default.createElement("style",null,a.map(l=>`@import url(${l});`)),!this.state._disconnected&&w.default.createElement(t,{ref:n,...this.props,...this.state,setOnDisconnect:this.setOnDisconnect.bind(this),setConfig:this.setConfig.bind(this)}))}}return Zs.default.create(o,e,s.shadowDOM||!1,n)};A(pe,y,module.exports);
4
+ `,n)}while(s!==-1);return o+=t.substr(n),o};hs.exports={stringReplaceAll:qo,stringEncaseCRLFWithFirstIndex:Do}});var ys=v((Oa,bs)=>{"use strict";var Fo=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,ps=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Bo=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Mo=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,ko=new Map([["n",`
5
+ `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function ms(t){let e=t[0]==="u",r=t[1]==="{";return e&&!r&&t.length===5||t[0]==="x"&&t.length===3?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):ko.get(t)||t}function jo(t,e){let r=[],s=e.trim().split(/\s*,\s*/g),n;for(let o of s){let i=Number(o);if(!Number.isNaN(i))r.push(i);else if(n=o.match(Bo))r.push(n[2].replace(Mo,(a,l,c)=>l?ms(l):c));else throw new Error(`Invalid Chalk template style argument: ${o} (in style '${t}')`)}return r}function Go(t){ps.lastIndex=0;let e=[],r;for(;(r=ps.exec(t))!==null;){let s=r[1];if(r[2]){let n=jo(s,r[2]);e.push([s].concat(n))}else e.push([s])}return e}function gs(t,e){let r={};for(let n of e)for(let o of n.styles)r[o[0]]=n.inverse?null:o.slice(1);let s=t;for(let[n,o]of Object.entries(r))if(Array.isArray(o)){if(!(n in s))throw new Error(`Unknown Chalk style: ${n}`);s=o.length>0?s[n](...o):s[n]}return s}bs.exports=(t,e)=>{let r=[],s=[],n=[];if(e.replace(Fo,(o,i,a,l,c,f)=>{if(i)n.push(ms(i));else if(l){let u=n.join("");n=[],s.push(r.length===0?u:gs(t,r)(u)),r.push({inverse:a,styles:Go(l)})}else if(c){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(gs(t,r)(n.join(""))),n=[],r.pop()}else n.push(f)}),s.push(n.join("")),r.length>0){let o=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(o)}return s.join("")}});var Os=v((Ia,Ts)=>{"use strict";var $e=cs(),{stdout:yt,stderr:Et}=fs(),{stringReplaceAll:_o,stringEncaseCRLFWithFirstIndex:Uo}=ds(),{isArray:ke}=Array,vs=["ansi","ansi","ansi256","ansi16m"],ce=Object.create(null),Ho=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=yt?yt.level:0;t.level=e.level===void 0?r:e.level},vt=class{constructor(e){return xs(e)}},xs=t=>{let e={};return Ho(e,t),e.template=(...r)=>ws(e.template,...r),Object.setPrototypeOf(e,je.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=vt,e.template};function je(t){return xs(t)}for(let[t,e]of Object.entries($e))ce[t]={get(){let r=Ge(this,xt(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};ce.visible={get(){let t=Ge(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};var $s=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let t of $s)ce[t]={get(){let{level:e}=this;return function(...r){let s=xt($e.color[vs[e]][t](...r),$e.color.close,this._styler);return Ge(this,s,this._isEmpty)}}};for(let t of $s){let e="bg"+t[0].toUpperCase()+t.slice(1);ce[e]={get(){let{level:r}=this;return function(...s){let n=xt($e.bgColor[vs[r]][t](...s),$e.bgColor.close,this._styler);return Ge(this,n,this._isEmpty)}}}}var Vo=Object.defineProperties(()=>{},{...ce,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),xt=(t,e,r)=>{let s,n;return r===void 0?(s=t,n=e):(s=r.openAll+t,n=e+r.closeAll),{open:t,close:e,openAll:s,closeAll:n,parent:r}},Ge=(t,e,r)=>{let s=(...n)=>ke(n[0])&&ke(n[0].raw)?Es(s,ws(s,...n)):Es(s,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(s,Vo),s._generator=t,s._styler=e,s._isEmpty=r,s},Es=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;let{openAll:s,closeAll:n}=r;if(e.indexOf("\x1B")!==-1)for(;r!==void 0;)e=_o(e,r.close,r.open),r=r.parent;let o=e.indexOf(`
6
+ `);return o!==-1&&(e=Uo(e,n,s,o)),s+e+n},bt,ws=(t,...e)=>{let[r]=e;if(!ke(r)||!ke(r.raw))return e.join(" ");let s=e.slice(1),n=[r.raw[0]];for(let o=1;o<r.length;o++)n.push(String(s[o-1]).replace(/[{}\\]/g,"\\$&"),String(r.raw[o]));return bt===void 0&&(bt=ys()),bt(t,n.join(""))};Object.defineProperties(je.prototype,ce);var _e=je();_e.supportsColor=yt;_e.stderr=je({level:Et?Et.level:0});_e.stderr.supportsColor=Et;Ts.exports=_e});var Rs=v((Ra,Is)=>{Is.exports={rosReleases:{kinetic:{rosVersion:1,ubuntuCodename:"xenial"},melodic:{rosVersion:1,ubuntuCodename:"bionic"},noetic:{rosVersion:1,ubuntuCodename:"focal"},dashing:{rosVersion:2},eloquent:{rosVersion:2},foxy:{rosVersion:2},galactic:{rosVersion:2},humble:{rosVersion:2},iron:{rosVersion:2},rolling:{rosVersion:2}}}});var He=v((Na,js)=>{var Xo=J(),Ns=Wr(),ue={get:require("lodash/get"),set:require("lodash/set"),unset:require("lodash/unset"),forEach:require("lodash/forEach"),map:require("lodash/map"),isEmpty:require("lodash/isEmpty"),eq:require("lodash/isEqual"),isPlainObject:require("lodash/isPlainObject"),merge:require("lodash/merge")},fe=zr(),we=Os(),Wo=Rs();fe.setAll=t=>Object.values(fe.getLoggers()).forEach(e=>e.setLevel(t));var As={warn:we.yellow,error:we.red,info:we.green,debug:we.gray},Jo=t=>As[t]?As[t](t):t,zo=fe.methodFactory;fe.methodFactory=(t,e,r)=>{let s=zo(t,e,r);if(typeof window<"u"){let o=`${r} ${t}`;return(...i)=>s(`[${o}]`,...i)}let n=`${r} ${Jo(t)}`;return(...o)=>s(`[${we.blue(new Date().toISOString())} ${n}]`,...o)};var Qo=fe.getLogger,Ko=t=>JSON.parse(JSON.stringify(t)),Yo=t=>JSON.parse(atob(t.split(".")[1])),Zo=t=>{try{return JSON.parse(t)}catch{return null}},Ss=(t,e,r)=>{t&&(r(t),t[e]?.forEach(s=>Ss(s,e,r)))},Cs=(t,e,r,s=[])=>{r(t,s);let n=e[0];if(n){let o=t[n];o&&Cs(o,e.slice(1),r,s.concat(n))}},ei=t=>new Promise(e=>{setTimeout(e,t)}),Ls=(t,e=[],r={})=>(ue.forEach(t,(s,n)=>{let o=e.concat(String(n));(ue.isPlainObject(s)||s instanceof Array)&&s!==null?Ls(s,o,r):r[Bs(o)]=s}),r),Ps=(t,e,r,s=[],n={})=>{if(e.length==0||e[0]=="#"){r(t,s,n);return}let o=e[0];if(o){for(let i in t)if(i==o||o=="*"||o.startsWith("+")){let a=o.startsWith("+")&&o.length>1?Object.assign({},n,{[o.slice(1)]:i}):n;Ps(t[i],e.slice(1),r,s.concat([i]),a)}}},qs=(t,e,r)=>{if(e.length==0)return t;let s=e.shift();e.length==0?t[s]=r:(t[s]||(t[s]={}),qs(t[s],e,r))},Ds=t=>t.replace(/%/g,"%25").replace(/\//g,"%2F"),Fs=t=>t.replace(/%25/g,"%").replace(/%2F/g,"/"),Bs=t=>{let e=r=>r.startsWith("+")?"+":r;return`/${t.map(e).map(Ds).join("/")}`},re=t=>{let e=t.split("/").map(Fs);return e.length>0&&e[0].length==0&&e.shift(),e.length>0&&e.at(-1).length==0&&e.pop(),e},Ms=(t,e)=>{let r=(o,i)=>{if(o.length==0||o[0][0]=="#"||i.length==0)return!0;if(o[0]==i[0])return r(o.slice(1),i.slice(1));if(o[0][0]=="+"){let a=r(o.slice(1),i.slice(1));return a&&Object.assign({[o[0].slice(1)]:i[0]},a)}return!1},s=re(t),n=re(e);return r(s,n)},ti=(t,e)=>{let r=re(e),s=re(t);return ks(r,s)&&r.length<s.length},ks=(t,e)=>t.length==0?!0:t[0]==e[0]&&ks(t.slice(1),e.slice(1)),ri=t=>{let e=t.split(":");return{organization:e[0],client:e[1],sub:e.slice(2)}},si=t=>{let e=re(t);return{organization:e[0],device:e[1],capabilityScope:e[2],capabilityName:e[3],capability:`${e[2]}/${e[3]}`,version:e[4],sub:e.slice(5)}},ni=t=>t.length==0?null:JSON.parse(t.toString("utf-8")),oi=(t,e,r,s=1e3)=>{let n=[],o=a=>{e.forEach(l=>Ms(`${l}/#`,a)&&n.push(a))};t.on("message",o),e.forEach(a=>{typeof a=="string"?t.subscribe(`${a}/#`):console.warn("Ignoring",a,"since it is not a string.")});let i=typeof Buffer<"u"?Buffer.alloc(0):null;setTimeout(()=>{t.removeListener("message",o),e.forEach(l=>t.unsubscribe(`${l}/#`));let a=n.length;console.log(`clearing ${a} retained messages from ${e}`),n.forEach(l=>{t.publish(l,i,{retain:!0})}),r&&r(a)},s)},ii=()=>Math.random().toString(36).slice(2),Ue=(t,e)=>Xo(Ns(t),Ns(e)),ai=(t,e=void 0,r={})=>{if(!t)return e?ue.set({},e,t):t;let s=Object.keys(t).filter(i=>(!r.maxVersion||Ue(i,r.maxVersion)<=0)&&(!r.minVersion||Ue(r.minVersion,i)<=0)).sort(Ue),n={},o=e&&re(e);return s.forEach(i=>{let a=o?ue.get(t[i],o):t[i];ue.merge(n,a)}),o?ue.set({},o,n):n},li=["B","KB","MB","GB","TB"],ci=t=>{if(!t)return"--";let e=0;for(;t>1024;)t/=1024,e++;return`${t.toFixed(2)} ${li[e]}`},ui=t=>{if(!t)return"--";let e={};t>3600&&(e.h=Math.floor(t/3600),t=t%3600),t>60&&(e.m=Math.floor(t/60),t=t%60),e.s=Math.floor(t);let r="";return e.h>0&&(r+=`${e.h}h `),e.m>0&&(r+=`${e.m}m `),!e.h&&(r+=`${e.s}s`),r.trim()};js.exports={parseMQTTUsername:ri,parseMQTTTopic:si,pathToTopic:Bs,topicToPath:re,toFlatObject:Ls,topicMatch:Ms,mqttParsePayload:ni,getRandomId:ii,versionCompare:Ue,loglevel:fe,getLogger:Qo,mergeVersions:ai,mqttClearRetained:oi,isSubTopicOf:ti,clone:Ko,setFromPath:qs,forMatchIterator:Ps,encodeTopicElement:Ds,decodeTopicElement:Fs,constants:Wo,visit:Ss,wait:ei,formatBytes:ci,formatDuration:ui,tryJSONParse:Zo,decodeJWT:Yo,visitAncestor:Cs}});var Tt=v((Aa,Us)=>{var k={get:require("lodash/get"),set:require("lodash/set"),unset:require("lodash/unset"),forEach:require("lodash/forEach"),map:require("lodash/map"),isEmpty:require("lodash/isEmpty"),eq:require("lodash/isEqual"),isPlainObject:require("lodash/isPlainObject"),merge:require("lodash/merge")},{topicToPath:Te,pathToTopic:fi,toFlatObject:hi,topicMatch:Gs,forMatchIterator:di}=He(),wt=(t,e)=>{if(!e||e.length==0)return;k.unset(t,e);let r=e.slice(0,-1),s=r.length==0?t:k.get(t,r);return k.isEmpty(s)?wt(t,r):e},pi=(t,e)=>(k.forEach(e,(r,s)=>{let n=Te(s);r==null?wt(t,n):k.set(t,n,r)}),t),_s=(t,e)=>{if(e.length==0)return;let r=e[0];if(r)for(let s in t)s!=r&&r!="*"&&!r.startsWith("+")?delete t[s]:_s(t[s],e.slice(1))},$t=class{#e={};#t=[];#r=[];constructor(e={}){this.#e=e}updateFromArray(e,r,s={}){let n=k.get(this.#e,e);if(r==null){if(n==null)return{};wt(this.#e,e)}else{if(k.eq(n,r))return{};k.set(this.#e,e,r)}let o=fi(e),i={[o]:r},a;if(r instanceof Object){let l=hi(r);a={},k.forEach(l,(c,f)=>{a[`${o}${f}`]=c})}else a=i;return this.#t.forEach(l=>l(i,s)),this.#r.forEach(l=>l(a,s)),a}update(e,r,s){if(typeof e=="string")return this.updateFromTopic(e,r,s);if(e instanceof Array)return this.updateFromArray(e,r,s);throw new Error("unrecognized path expression")}updateFromTopic(e,r,s){return this.updateFromArray(Te(e),r,s)}updateFromModifier(e,r){return k.map(e,(s,n)=>this.updateFromTopic(n,s,r))}subscribe(e){e instanceof Function?this.#t.push(e):console.warn("DataCache.subscribe expects a function as argument. Did you mean to use subscribePath?")}subscribePath(e,r){this.#t.push((s,n)=>{k.forEach(s,(o,i)=>{let a=Gs(e,i);a&&r(o,i,a,n)})})}subscribePathFlat(e,r){this.#r.push((s,n)=>{k.forEach(s,(o,i)=>{let a=Gs(e,i);a&&r(o,i,a,n)})})}unsubscribe(e){this.#t=this.#t.filter(r=>r!=e)}get(e=[]){return e.length==0?this.#e:k.get(this.#e,e)}getByTopic(e){return this.get(Te(e))}filter(e){let r=JSON.parse(JSON.stringify(this.get()));return _s(r,e),r}filterByTopic(e){return this.filter(Te(e))}forMatch(e,r){let s=Te(e);this.forPathMatch(s,r)}forPathMatch(e,r){di(this.get(),e,r)}};Us.exports={DataCache:$t,updateObject:pi}});var At=v((Ca,Ws)=>{"use strict";var{mqttParsePayload:gi,topicMatch:Ot,topicToPath:z,pathToTopic:Oe,toFlatObject:It,getLogger:mi,mergeVersions:bi,parseMQTTTopic:yi,isSubTopicOf:Sa,versionCompare:Ei,encodeTopicElement:vi,visitAncestor:xi}=He(),{DataCache:Hs}=Tt(),Q=require("lodash"),R=mi("MqttSync"),Rt="$SYS/broker/uptime",he="$_",$i=()=>{},wi=t=>typeof t=="object"?JSON.parse(JSON.stringify(t)):t,Vs=t=>t.endsWith("/#")?t:t.endsWith("/")?t.concat("#"):t.concat("/#"),Xs=t=>t.replace(/\/\//g,"/"),Nt=class{data=new Hs;subscribedPaths={};publishedPaths={};publishedMessages=new Hs;publishQueue=new Map;heartbeatWaitersOnce=[];heartbeats=0;beforeDisconnectHooks=[];constructor({mqttClient:e,onChange:r,ignoreRetain:s,migrate:n,onReady:o,sliceTopic:i,onHeartbeatGranted:a}){this.mqtt=e,this.mqtt.on("message",(l,c,f)=>{let u=c&&c.toString();if(R.debug("got message",l,u.slice(0,180),u.length>180?`... (${u.length} bytes)`:"",f.retain),l==Rt)this.heartbeats>0&&(this.heartbeatWaitersOnce.forEach(h=>h()),this.heartbeatWaitersOnce=[]),this.heartbeats==1&&!n&&o&&o(),this.heartbeats++;else if(f.retain||s){let h=z(l);R.debug("processing message",l,h),i&&(h=h.slice(i),l=Oe(h));let x=gi(c);if(this.isPublished(l))this.publishedMessages.updateFromArray([...h,he],x),this.data.update(l,x,{external:!0});else if(this.isSubscribed(l)){R.debug("applying received update",l);let m=this.data.update(l,x);r&&Object.keys(m).length>0&&r(m)}}}),this.mqtt.subscribe(Rt,{rap:!0},(l,c)=>{R.debug(Rt,{granted:c}),c.length>0&&a?.()}),n?.length>0&&this.migrate(n,()=>{R.debug("done migrating",o),o&&this.waitForHeartbeatOnce(o)})}publishAtLevel(e,r,s){R.debug(`publishingAtLevel ${s}`,e,r),s>0?Q.forEach(r,(n,o)=>{let i=`${e}/${vi(o)}`;R.debug(`publishing ${i}`),this.publishAtLevel(i,n,s-1)}):this.mqtt.publish(e,JSON.stringify(r),{retain:!0},n=>{n&&R.warn("Error when publishing migration result",n)})}migrate(e,r=void 0){let s=e.length;if(s==0){r&&r();return}let n=()=>--s==0&&r&&r();e.forEach(({topic:o,newVersion:i,transform:a=void 0,flat:l=!1,level:c=0})=>{R.debug("migrating",o,i);let{organization:f,device:u,capability:h,sub:x}=yi(o),m=`/${f}/${u}/${h}`,w=x.length==0?"/#":Oe(x),I=`${m}/+${w}`;this.subscribe(I,T=>{if(T){R.warn("Error during migration",T),n();return}this.waitForHeartbeatOnce(()=>{R.debug("got heartbeat",o,I);let V=this.data.getByTopic(m);if(!V){this.unsubscribe(I),n();return}let L=bi(V,w,{maxVersion:i}),X=Q.get(L,z(w)),_=a?a(X):X,K=Xs(`${m}/${i}/${w}`);if(R.debug("publishing merged",K),l){let j=It(_),E=z(K);Q.forEach(j,(M,Y)=>{let We=Oe(E.concat(z(Y)));this.mqtt.publish(We,JSON.stringify(M),{retain:!0},qt=>{qt&&R.warn(`Error when publishing migration result for ${Y}`,qt)})})}else this.publishAtLevel(K,_,c);this.unsubscribe(I),this.waitForHeartbeatOnce(()=>{let E=Object.keys(V).filter(M=>Ei(M,i)<0).map(M=>Xs(`${m}/${M}/${w}`));R.debug({prefixesToClear:E}),this.clear(E),n()})})})})}clear(e,r=void 0,s={}){let n=[],o=a=>{e.forEach(l=>Ot(`${l}/#`,a)&&(!s.filter||s.filter(a))&&n.push(a))};this.mqtt.on("message",o),e.forEach(a=>{typeof a=="string"?this.mqtt.subscribe(`${a}/#`):R.warn("Ignoring",a,"since it is not a string.")});let i=typeof Buffer<"u"?Buffer.alloc(0):null;this.waitForHeartbeatOnce(()=>{this.mqtt.removeListener("message",o),e.forEach(l=>this.mqtt.unsubscribe(`${l}/#`));let a=n.length;R.debug(`clearing ${a} retained messages from ${e}`),n.forEach(l=>{this.mqtt.publish(l,i,{retain:!0})}),r&&r(a)})}waitForHeartbeatOnce(e){setTimeout(()=>this.heartbeatWaitersOnce.push(e),1)}isSubscribed(e){return Object.keys(this.subscribedPaths).some(r=>Ot(r,e))}isPublished(e){return Object.keys(this.publishedPaths).some(r=>Ot(r,e)&&!this.publishedPaths[r].atomic)}subscribe(e,r=$i){if(e=Vs(e),R.debug("subscribing to",e),this.subscribedPaths[e]){R.debug("already subscribed to",e),r();return}this.mqtt.subscribe(e,{rap:!0},(s,n)=>{R.debug("subscribe",e,"granted:",n),n&&n.some(o=>o.topic==e&&o.qos<128)?(this.subscribedPaths[e]=1,r(null)):r(`not permitted to subscribe to topic ${e}, ${JSON.stringify(n)}`)})}unsubscribe(e){this.subscribedPaths[e]&&(this.mqtt.unsubscribe(e),delete this.subscribedPaths[e])}_actuallyPublish(e,r){return this.mqtt.connected?(R.debug("actually publishing",e),this.mqtt.publish(e,r==null?null:JSON.stringify(r),{retain:!0}),!0):(R.warn("not connected, not publishing",e),!1)}_processQueue_rec(e){if(this.publishQueue.size>0){let[r,s]=this.publishQueue.entries().next().value;this._actuallyPublish(r,s)?(this.publishQueue.delete(r),this._processQueue_rec(e)):setTimeout(()=>this._processQueue_rec(e),5e3)}else e()}_processQueue(){this._processing||(this._processing=!0,this._processQueue_rec(()=>this._processing=!1))}setThrottle(e){this._processQueueThrottled=Q.throttle(this._processQueue.bind(this),e)}clearThrottle(){delete this._processQueueThrottled}addToQueue(e,r){this.publishQueue.set(e,r)}_enqueue(e,r){R.debug("enqueuing",e),this.addToQueue(e,r),this._processQueueThrottled?this._processQueueThrottled():this._processQueue();let s=z(e);this.publishedMessages.updateFromArray([...s,he],r==null?null:wi(r))}publish(e,r={atomic:!1}){if(e=Vs(e),Q.isEqual(this.publishedPaths[e],r))return!1;if(this.publishedPaths[e]=r,r.atomic)return this.data.subscribePath(e,(s,n,o,i)=>{if(i?.external)return;R.debug("processing change (atomic)",n,e);let a=e.slice(0,e.length-2),l=Oe(z(n).slice(0,z(a).length));this._enqueue(l,this.data.getByTopic(l))}),!0;this.mqtt.subscribe(e),this.data.subscribePath(e,(s,n,o,i)=>{if(i?.external)return;R.debug("processing change",n);let a=z(n),l=this.publishedMessages.get(a);Q.each(l,(f,u)=>{if(u==he)return!0;let h=Object.keys(It(f)).filter(x=>x.endsWith(he));R.debug("flat->atomic: ",{toClear:h},u),h.forEach(x=>{let m=x.slice(0,-(he.length+1)),w=`${n}/${u}/${m}`;this._enqueue(w,null)})});let c=this.publishedMessages.get();return xi(c,a.slice(0,-1),(f,u)=>{let h=f[he];if(h&&Q.isObject(h)){R.debug("atomic->flat",{oldVal:h});let x=Oe(u);this._enqueue(x,null);let m=It(h);Q.each(m,(w,I)=>{let T=`${x}${I}`;this._enqueue(T,w)})}}),this._enqueue(n,s),!0})}beforeDisconnect(){this.beforeDisconnectHooks.forEach(e=>e(this))}onBeforeDisconnect(e){this.beforeDisconnectHooks.push(e)}};Ws.exports=Nt});var pe={};Dt(pe,{Code:()=>Ai,ErrorBoundary:()=>Pt,InlineCode:()=>Si,LevelBadge:()=>Ni,MqttSync:()=>zs,Timer:()=>Ci,TimerContext:()=>en,TransitiveCapability:()=>Li,createWebComponent:()=>qi,fetchJson:()=>Ks,parseCookie:()=>Qs,useCapability:()=>Lt,useMqttSync:()=>Ct,useTopics:()=>Ii,useTransitive:()=>Oi});module.exports=an(pe);var $=D(require("react"));var ze=D(require("react")),Qe=require("react"),ln=require("react/jsx-runtime"),cn=["xxl","xl","lg","md","sm","xs"],un="xs",Ft=ze.createContext({prefixes:{},breakpoints:cn,minBreakpoint:un}),{Consumer:Bi,Provider:Mi}=Ft;function Se(t,e){let{prefixes:r}=(0,Qe.useContext)(Ft);return t||r[e]||e}var Bt=D(require("react")),Mt=require("react/jsx-runtime"),fn=["as","disabled"];function hn(t,e){if(t==null)return{};var r={},s=Object.keys(t),n,o;for(o=0;o<s.length;o++)n=s[o],!(e.indexOf(n)>=0)&&(r[n]=t[n]);return r}function dn(t){return!t||t.trim()==="#"}function Ke({tagName:t,disabled:e,href:r,target:s,rel:n,role:o,onClick:i,tabIndex:a=0,type:l}){t||(r!=null||s!=null||n!=null?t="a":t="button");let c={tagName:t};if(t==="button")return[{type:l||"button",disabled:e},c];let f=h=>{if((e||t==="a"&&dn(r))&&h.preventDefault(),e){h.stopPropagation();return}i?.(h)},u=h=>{h.key===" "&&(h.preventDefault(),f(h))};return t==="a"&&(r||(r="#"),e&&(r=void 0)),[{role:o??"button",disabled:void 0,tabIndex:e?void 0:a,href:r,target:t==="a"?s:void 0,"aria-disabled":e||void 0,rel:t==="a"?n:void 0,onClick:f,onKeyDown:u},c]}var pn=Bt.forwardRef((t,e)=>{let{as:r,disabled:s}=t,n=hn(t,fn),[o,{tagName:i}]=Ke(Object.assign({tagName:r,disabled:s},n));return(0,Mt.jsx)(i,Object.assign({},n,o,{ref:e}))});pn.displayName="Button";var kt=D(Je()),jt=D(require("react"));var Gt=require("react/jsx-runtime"),_t=jt.forwardRef(({bsPrefix:t,bg:e="primary",pill:r=!1,text:s,className:n,as:o="span",...i},a)=>{let l=Se(t,"badge");return(0,Gt.jsx)(o,{ref:a,...i,className:(0,kt.default)(n,l,r&&"rounded-pill",s&&`text-${s}`,e&&`bg-${e}`)})});_t.displayName="Badge";var se=_t;var Ut=D(Je()),Ht=D(require("react"));var Vt=require("react/jsx-runtime"),Xt=Ht.forwardRef(({as:t,bsPrefix:e,variant:r="primary",size:s,active:n=!1,disabled:o=!1,className:i,...a},l)=>{let c=Se(e,"btn"),[f,{tagName:u}]=Ke({tagName:t,disabled:o,...a});return(0,Vt.jsx)(u,{...f,...a,ref:l,disabled:o,className:(0,Ut.default)(i,c,n&&"active",r&&`${c}-${r}`,s&&`${c}-${s}`,a.href&&o&&"disabled")})});Xt.displayName="Button";var Ye=Xt;var Zs=D(Yt());var y={};Dt(y,{MqttSync:()=>zs,fetchJson:()=>Ks,parseCookie:()=>Qs});A(y,D(He()));A(y,D(Tt()));var Js=D(At()),zs=Js.default,Qs=t=>t.split(";").map(e=>e.split("=")).reduce((e,r)=>(e[decodeURIComponent(r[0].trim())]=r[1]&&decodeURIComponent(r[1].trim()),e),{}),Ks=(t,e,r={})=>{fetch(t,{method:r.method||(r.body?"post":"get"),mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json",...r.headers},redirect:"follow",referrerPolicy:"no-referrer",body:r.body?JSON.stringify(r.body):void 0}).then(s=>{let n=!s.ok&&`fetching ${t} failed: ${s.status} ${s.statusText}`;s.json().then(o=>e(n,o)).catch(o=>{throw new Error(o)})}).catch(s=>e(`error: ${s}`))};var B=D(require("react")),Xe=D(require("lodash")),Ys=D(require("mqtt-browser"));var Ti=At(),F=(0,y.getLogger)("utils-web/hooks");F.setLevel("info");F.setLevel("debug");var Ct=({jwt:t,id:e,mqttUrl:r})=>{let[s,n]=(0,B.useState)("connecting"),[o,i]=(0,B.useState)(),[a,l]=(0,B.useState)({}),[c,f]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{let u=(0,y.decodeJWT)(t),h=Ys.default.connect(r,{username:JSON.stringify({id:e,payload:u}),password:t});return h.on("connect",()=>{F.debug("connected");let x=new Ti({mqttClient:h,ignoreRetain:!0,onHeartbeatGranted:()=>f(!0)});i(x),n("connected"),x.data.subscribe(Xe.default.throttle(()=>l((0,y.clone)(x.data.get())),50))}),h.on("error",x=>{F.error(x),n(`error: ${x}`)}),()=>{F.info("cleaning up useMQTTSync"),o&&o.beforeDisconnect?(o.beforeDisconnect(),o.waitForHeartbeatOnce(()=>h.end())):h.end()}},[t,e]),{status:s,ready:c,StatusComponent:()=>B.default.createElement("div",null,s),mqttSync:o,data:a}},Oi=({jwt:t,id:e,host:r,ssl:s,capability:n,versionNS:o})=>{let[i,a]=n.split("/"),{device:l}=(0,y.decodeJWT)(t),c=[e,l,i,a],f=(0,y.pathToTopic)(c),u=[...c,o],h=(0,y.pathToTopic)(u),x=`${s&&JSON.parse(s)?"wss":"ws"}://mqtt.${r}`;return{...Ct({jwt:t,id:e,mqttUrl:x}),device:l,prefixPath:c,prefix:f,prefixPathVersion:u,prefixVersion:h}},Ii=({jwt:t,host:e="transitiverobotics.com",ssl:r=!0,topics:s=[]})=>{let[n,o]=(0,B.useState)();!Xe.default.isEqual(n,s)&&o(s);let{device:i,id:a,capability:l}=(0,y.decodeJWT)(t);if(i=="_fleet"){F.warn("useTopics only works for device JWTs, not _fleet ones");return}let c=`/${a}/${i}/@transitive-robotics/_robot-agent/+/status`,{mqttSync:f,data:u,status:h,ready:x,StatusComponent:m}=Ct({jwt:t,id:a,mqttUrl:`ws${r?"s":""}://mqtt.${e}`});(0,B.useEffect)(()=>{x&&f.subscribe(c,j=>j&&console.warn(j))},[f,x]);let w=(0,y.mergeVersions)(u[a]?.[i]["@transitive-robotics"]["_robot-agent"],"status").status,I=w?.runningPackages,[T,V]=l.split("/"),L=I?.[T]?.[V],X=L&&Object.values(L).filter(Boolean)[0],_=`/${a}/${i}/${l}/${X}`;(0,B.useEffect)(()=>{F.debug("topics",s),X&&s.forEach(j=>{F.debug(`subscribing to ${_}${j}`),f.subscribe(`${_}${j}`,E=>E&&F.warn(E))})},[n,X,f]);let K=Xe.default.get(u,(0,y.topicToPath)(_));return{data:u?.[a]?.[i],mqttSync:f,agentStatus:w,topicData:K}},Ve={},St={},Lt=({capability:t,name:e,userId:r,deviceId:s,host:n="transitiverobotics.com",ssl:o=!0})=>{let[i,a]=(0,B.useState)({loaded:!1}),l=(f,u)=>{F.debug(`custom component ${e}: ${f}`),St[e]=u,a(h=>({...h,loadedModule:u,loaded:!!u}))},c=(...f)=>Ve[e].forEach(u=>u(...f));return(0,B.useEffect)(()=>{if(F.debug(`loading custom component ${e}`),St[e])return l("already loaded",St[e]);if(Ve[e])return F.debug("already loading"),Ve[e].push(l);Ve[e]=[l];let f=`http${o?"s":""}://portal.${n}`,u=new URLSearchParams({userId:r,deviceId:s}),h=`${f}/running/${t}/dist/${e}`;import(`${h}.esm.js?${u.toString()}`).then(x=>c("loaded esm",x),x=>{F.warn(`No ESM module found for ${e}, loading iife`),import(`${h}.js?${u.toString()}`).then(m=>c("loaded iife",m),m=>F.error(`Failed to load ${e} iife`,m))})},[t,e,r,s]),i};var de={badge:{width:"4em"},code:{color:"#700",borderLeft:"3px solid #aaa",padding:"0.5em 0px 0.5em 2em",backgroundColor:"#f0f0f0",borderRadius:"4px",marginTop:"0.5em"},inlineCode:{color:"#700",margin:"0px 0.5em 0px 0.5em"}},Ri=[$.default.createElement(se,{bg:"success",style:de.badge},"OK"),$.default.createElement(se,{bg:"warning",style:de.badge},"Warn"),$.default.createElement(se,{bg:"danger",style:de.badge},"Error"),$.default.createElement(se,{bg:"secondary",style:de.badge},"Stale")],Ni=({level:t})=>Ri[t]||$.default.createElement("span",null,t),Ai=({children:t})=>$.default.createElement("pre",{style:de.code},t),Si=({children:t})=>$.default.createElement("tt",{style:de.inlineCode},t),Ie={},en=$.default.createContext({}),Ci=({duration:t,onTimeout:e,onStart:r,setOnDisconnect:s,children:n})=>{t=t||60;let[o,i]=(0,$.useState)(t),[a,l]=(0,$.useState)(!1),c=(0,$.useMemo)(()=>Math.random().toString(36).slice(2),[]),f=()=>{console.log("stopping timer for",c),e&&setTimeout(e,1),clearInterval(Ie[c]),Ie[c]=null,l(!1)},u=()=>{let x=Ie[c];return console.log(x,Ie,o),!x&&o>0&&(l(!0),Ie[c]=setInterval(()=>i(m=>{if(--m>0)return m;f()}),1e3),r&&setTimeout(r,1)),f};(0,$.useEffect)(()=>{o>0&&!a&&u()},[o]),(0,$.useEffect)(()=>f,[]),s&&s(()=>{f()});let h=()=>i(t);return $.default.createElement(en.Provider,{value:{reset:h,duration:t,timer:o}},o>0?$.default.createElement("div",null,n,o<60&&$.default.createElement("div",null,"Timeout in: ",o," seconds")):$.default.createElement("div",null,"Timed out. ",$.default.createElement(Ye,{onClick:h},"Resume")))},Li=({jwt:t,host:e="transitiverobotics.com",ssl:r=!0,...s})=>{let{id:n,device:o,capability:i}=(0,y.decodeJWT)(t),a=o=="_fleet"?"fleet":"device",c=`${i.split("/")[1]}-${a}`,{loaded:f}=Lt({capability:i,name:c,userId:n||s.userId,deviceId:o,host:e,ssl:r}),u=(0,$.useRef)();(0,$.useEffect)(()=>{u.current?.instance?.setState(x=>({...x,id:n,jwt:t,host:e,ssl:r,...s}))},[u.current,n,t,e,r,...Object.values(s)]);let h=(0,$.useMemo)(()=>({id:n,jwt:t,host:e,ssl:r,...s}),[]);return f?$.default.createElement(c,{...h,ref:u}):$.default.createElement("div",null,"Loading ",c)},Pt=class extends $.default.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,r){console.warn("ErrorBoundary caught:",e,r)}render(){return this.state.hasError?$.default.createElement("div",null,this.props.message||"Something went wrong here."):this.props.children}},Pi=t=>t.$$typeof==Symbol.for("react.forward_ref")||t.prototype?.render,qi=(t,e,r="0.0.0",s={})=>{let n=Pi(t)?$.default.createRef():null;class o extends $.default.Component{onDisconnect=null;state={};setOnDisconnect(a){this.onDisconnect=a}webComponentConstructed(a){let l=new MutationObserver(c=>{let f={};c.forEach(({attributeName:u})=>{f[u]=a.getAttribute(u)}),this.setState(u=>({...u,...f}))}).observe(a,{attributes:!0})}webComponentDisconnected(){this.setState({_disconnected:!0});try{this.onDisconnect&&this.onDisconnect()}catch(a){console.log("Error during onDisconnect of web-component",a)}}setConfig(a){this.setState({config:a})}render(){let a=s.stylesheets||["https://cdn.jsdelivr.net/gh/transitiverobotics/transitive-utils@0.8.3/web/css/bootstrap_transitive-bs-root.min.css"];return $.default.createElement("div",{id:`cap-${e}-${r}`,className:s.className||"transitive-bs-root"},$.default.createElement("style",null,a.map(l=>`@import url(${l});`)),!this.state._disconnected&&$.default.createElement(t,{ref:n,...this.props,...this.state,setOnDisconnect:this.setOnDisconnect.bind(this),setConfig:this.setConfig.bind(this)}))}}return Zs.default.create(o,e,s.shadowDOM||!1,n)};A(pe,y,module.exports);
7
7
  /*! Bundled license information:
8
8
 
9
9
  classnames/index.js:
package/docs/client.md CHANGED
@@ -138,9 +138,8 @@ onclick={() => { console.log('custom click handler'); }}
138
138
  * `$0` **[Object][1]**&#x20;
139
139
 
140
140
  * `$0.jwt` &#x20;
141
- * `$0.ssl` (optional, default `true`)
142
141
  * `$0.host` (optional, default `'transitiverobotics.com'`)
143
- * `$0.testing` (optional, default `false`)
142
+ * `$0.ssl` (optional, default `true`)
144
143
  * `$0.config` **...any**&#x20;
145
144
 
146
145
  ## useCapability
@@ -168,7 +167,6 @@ deviceId: 'd_mydevice123',
168
167
  * `$0.deviceId` &#x20;
169
168
  * `$0.host` (optional, default `'transitiverobotics.com'`)
170
169
  * `$0.ssl` (optional, default `true`)
171
- * `$0.testing` (optional, default `false`)
172
170
 
173
171
  ## useMqttSync
174
172
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transitive-sdk/utils-web",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Web utils for the Transitive framework",
5
5
  "homepage": "https://transitiverobotics.com",
6
6
  "repository": {