UNPKG

node-red-contrib-uibuilder

Version:

Easily create data-driven web UI's for Node-RED. Single- & Multi-page. Multiple UI's. Work with existing web development workflows or mix and match with no-code/low-code features.

16 lines 123 kB
(()=>{var Ut=Object.create;var Ee=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var Pt=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty;var Ye=s=>{throw TypeError(s)};var Ht=(s,e,t)=>e in s?Ee(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var Xe=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var jt=(s,e)=>{for(var t in e)Ee(s,t,{get:e[t],enumerable:!0})},qt=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Dt(e))!Bt.call(s,r)&&r!==t&&Ee(s,r,{get:()=>e[r],enumerable:!(i=Mt(e,r))||i.enumerable});return s};var Qe=(s,e,t)=>(t=s!=null?Ut(Pt(s)):{},qt(e||!s||!s.__esModule?Ee(t,"default",{value:s,enumerable:!0}):t,s));var u=(s,e,t)=>Ht(s,typeof e!="symbol"?e+"":e,t),Ze=(s,e,t)=>e.has(s)||Ye("Cannot "+t);var p=(s,e,t)=>(Ze(s,e,"read from private field"),t?t.call(s):e.get(s)),v=(s,e,t)=>e.has(s)?Ye("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),_=(s,e,t,i)=>(Ze(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t);var Ce=(s,e,t,i)=>({set _(r){_(s,e,r,t)},get _(){return p(s,e,i)}});var a,Ft=(a=class{constructor(e,t,i){u(this,"version","7.4.2-src");u(this,"sanitiseExtraTags",["uib-var"]);u(this,"sanitiseExtraAttribs",["variable","report","undefined"]);u(this,"ui_md_plugins");if(e)a.win=e;else throw new Error("Ui:constructor. Current environment does not include `window`, UI functions cannot be used.");a.doc=a.win.document,t?a.log=t:a.log=function(){return function(){}},i?this.syntaxHighlight=i:this.syntaxHighlight=function(){},a.win.markdownit&&(a.mdOpts={html:!0,xhtmlOut:!1,linkify:!0,_highlight:!0,_strict:!1,_view:"html",langPrefix:"language-",highlight:function(r,n){if(n&&window.hljs&&window.hljs.getLanguage(n))try{return'<pre class="">\n                                    <code class="hljs border">'.concat(window.hljs.highlight(r,{language:n,ignoreIllegals:!0}).value,"</code></pre>")}finally{}return'<pre class="hljs border"><code>'.concat(a.md.utils.escapeHtml(r).trim(),"</code></pre>")}},a.md=a.win.markdownit(a.mdOpts))}_markDownIt(){if(a.win.markdownit&&(!this.ui_md_plugins&&a.win.uibuilder&&a.win.uibuilder.ui_md_plugins&&(this.ui_md_plugins=a.win.uibuilder.ui_md_plugins),a.mdOpts={html:!0,xhtmlOut:!1,linkify:!0,_highlight:!0,_strict:!1,_view:"html",langPrefix:"language-",highlight:function(e,t){if(window.hljs)if(t&&window.hljs.getLanguage(t))try{return'<pre><code class="hljs border language-'.concat(t,'" data-language="').concat(t,'" title="Source language: \'').concat(t,"'\">").concat(window.hljs.highlight(e,{language:t,ignoreIllegals:!0}).value,"</code></pre>")}finally{}else try{let i=window.hljs.highlightAuto(e);return'<pre><code class="hljs border language-'.concat(i.language,'" data-language="').concat(i.language,'" title="Source language estimated by HighlightJS: \'').concat(i.language,"'\">").concat(i.value,"</code></pre>")}finally{}return'<pre><code class="border">'.concat(a.md.utils.escapeHtml(e).trim(),"</code></pre>")}},a.md=a.win.markdownit(a.mdOpts),this.ui_md_plugins)){if(!Array.isArray(this.ui_md_plugins)){a.log("error","Ui:_markDownIt:plugins","Could not load plugins, ui_md_plugins is not an array")();return}this.ui_md_plugins.forEach(e=>{if(typeof e=="string")a.md.use(a.win[e]);else{let t=Object.keys(e)[0];a.md.use(a.win[t],e[t])}})}}_showNotification(e){e.topic&&!e.title&&(e.title=e.topic),e.title||(e.title="uibuilder notification"),e.payload&&!e.body&&(e.body=e.payload),e.body||(e.body=" No message given.");try{let t=new Notification(e.title,e);return new Promise((i,r)=>{t.addEventListener("close",n=>{n.currentTarget.userAction="close",i(n)}),t.addEventListener("click",n=>{n.currentTarget.userAction="click",i(n)}),t.addEventListener("error",n=>{n.currentTarget.userAction="error",r(n)})})}catch{return Promise.reject(new Error("Browser refused to create a Notification"))}}_uiAdd(e,t){a.log("trace","Ui:_uiManager:add","Starting _uiAdd")(),e.components.forEach((i,r)=>{a.log("trace","Ui:_uiAdd:components-forEach:".concat(r),"Component to add: ",i)();let n;switch(i.type){case"html":{i.ns="html",n=a.doc.createElement("div");break}case"svg":{i.ns="svg",n=a.doc.createElementNS("http://www.w3.org/2000/svg","svg");break}default:{i.ns="dom",n=a.doc.createElement(i.type);break}}!i.slot&&e.payload&&(i.slot=e.payload),this._uiComposeComponent(n,i);let o;i.parentEl?o=i.parentEl:e.parentEl?o=e.parentEl:i.parent?o=a.doc.querySelector(i.parent):e.parent&&(o=a.doc.querySelector(e.parent)),o||(a.log("info","Ui:_uiAdd","No parent found, adding to body")(),o=a.doc.querySelector("body")),i.position&&i.position==="first"?o.insertBefore(n,o.firstChild):i.position&&Number.isInteger(Number(i.position))?o.insertBefore(n,o.children[i.position]):o.appendChild(n),i.components&&this._uiExtendEl(n,i.components,i.ns)})}_uiComposeComponent(e,t){t.attributes&&Object.keys(t.attributes).forEach(i=>{i==="class"&&Array.isArray(t.attributes[i])&&t.attributes[i].join(" "),a.log("trace","_uiComposeComponent:attributes-forEach","Attribute: '".concat(i,"', value: '").concat(t.attributes[i],"'"))(),i==="value"&&(e.value=t.attributes[i]),i.startsWith("xlink:")?e.setAttributeNS("http://www.w3.org/1999/xlink",i,t.attributes[i]):e.setAttribute(i,t.attributes[i])}),t.id&&e.setAttribute("id",t.id),t.type==="svg"&&(e.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),e.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink")),t.events&&Object.keys(t.events).forEach(i=>{i.toLowerCase==="onclick"&&(i="click");try{e.addEventListener(i,r=>{new Function("evt","".concat(t.events[i],"(evt)"))(r)})}catch(r){a.log("error","Ui:_uiComposeComponent","Add event '".concat(i,"' for element '").concat(t.type,"': Cannot add event handler. ").concat(r.message))()}}),t.properties&&Object.keys(t.properties).forEach(i=>{e[i]=t.properties[i],["value","checked"].includes(i)&&(e.dispatchEvent(new Event("input")),e.dispatchEvent(new Event("change")))}),t.slot&&this.replaceSlot(e,t.slot),t.slotMarkdown&&this.replaceSlotMarkdown(e,t)}_uiExtendEl(e,t,i=""){t.forEach((r,n)=>{a.log("trace","Ui:_uiExtendEl:components-forEach:".concat(n),r)();let o;r.ns=i,r.ns==="html"?(o=e,this.replaceSlot(e,r.slot)):r.ns==="svg"?(o=a.doc.createElementNS("http://www.w3.org/2000/svg",r.type),this._uiComposeComponent(o,r),e.appendChild(o)):(o=a.doc.createElement(r.type==="html"?"div":r.type),this._uiComposeComponent(o,r),e.appendChild(o)),r.components&&this._uiExtendEl(o,r.components,r.ns)})}_uiLoad(e){e.components&&(Array.isArray(e.components)||(e.components=[e.components]),e.components.forEach(async t=>{Promise.resolve().then(()=>Qe(Xe(t)))})),e.srcScripts&&(Array.isArray(e.srcScripts)||(e.srcScripts=[e.srcScripts]),e.srcScripts.forEach(t=>{this.loadScriptSrc(t)})),e.txtScripts&&(Array.isArray(e.txtScripts)||(e.txtScripts=[e.txtScripts]),this.loadScriptTxt(e.txtScripts.join("\n"))),e.srcStyles&&(Array.isArray(e.srcStyles)||(e.srcStyles=[e.srcStyles]),e.srcStyles.forEach(t=>{this.loadStyleSrc(t)})),e.txtStyles&&(Array.isArray(e.txtStyles)||(e.txtStyles=[e.txtStyles]),this.loadStyleTxt(e.txtStyles.join("\n")))}_uiManager(e){e._ui&&(Array.isArray(e._ui)||(e._ui=[e._ui]),e._ui.forEach((t,i)=>{if(t.mode&&!t.method&&(t.method=t.mode),!t.method){a.log("error","Ui:_uiManager","No method defined for msg._ui[".concat(i,"]. Ignoring. "),t)();return}switch(t.payload=e.payload,t.topic=e.topic,t.method){case"add":{this._uiAdd(t,!1);break}case"remove":{this._uiRemove(t,!1);break}case"removeAll":{this._uiRemove(t,!0);break}case"replace":{this._uiReplace(t);break}case"update":{this._uiUpdate(t);break}case"load":{this._uiLoad(t);break}case"reload":{this._uiReload();break}case"notify":{this.showDialog("notify",t,e);break}case"alert":{this.showDialog("alert",t,e);break}default:{a.log("error","Ui:_uiManager","Invalid msg._ui[".concat(i,"].method (").concat(t.method,"). Ignoring"))();break}}}))}_uiReload(){a.log("trace","Ui:uiManager:reload","reloading")(),location.reload()}_uiRemove(e,t=!1){e.components.forEach(i=>{let r;t!==!0?r=[a.doc.querySelector(i)]:r=a.doc.querySelectorAll(i),r.forEach(n=>{try{n.remove()}catch(o){a.log("trace","Ui:_uiRemove","Could not remove. ".concat(o.message))()}})})}_uiReplace(e){a.log("trace","Ui:_uiReplace","Starting")(),e.components.forEach((t,i)=>{a.log("trace","Ui:_uiReplace:components-forEach:".concat(i),"Component to replace: ",t)();let r;if(t.id?r=a.doc.getElementById(t.id):t.selector||t.select?r=a.doc.querySelector(t.selector):t.name?r=a.doc.querySelector('[name="'.concat(t.name,'"]')):t.type&&(r=a.doc.querySelector(t.type)),a.log("trace","Ui:_uiReplace:components-forEach:".concat(i),"Element to replace: ",r)(),r==null){a.log("trace","Ui:_uiReplace:components-forEach:".concat(i,":noReplace"),"Cannot find the DOM element. Adding instead.",t)(),this._uiAdd({components:[t]},!1);return}let n;switch(t.type){case"html":{t.ns="html",n=a.doc.createElement("div");break}case"svg":{t.ns="svg",n=a.doc.createElementNS("http://www.w3.org/2000/svg","svg");break}default:{t.ns="dom",n=a.doc.createElement(t.type);break}}this._uiComposeComponent(n,t),r.replaceWith(n),t.components&&this._uiExtendEl(n,t.components,t.ns)})}_uiUpdate(e){a.log("trace","UI:_uiUpdate:update","Starting _uiUpdate",e)(),e.components||(e.components=[Object.assign({},e)]),e.components.forEach((t,i)=>{a.log("trace","_uiUpdate:components-forEach","Start loop #".concat(i),t)();let r;if(t.parentEl?r=t.parentEl:t.id?r=a.doc.querySelectorAll("#".concat(t.id)):t.selector||t.select?r=a.doc.querySelectorAll(t.selector):t.name?r=a.doc.querySelectorAll('[name="'.concat(t.name,'"]')):t.type&&(r=a.doc.querySelectorAll(t.type)),r===void 0||r.length<1){a.log("warn","Ui:_uiManager:update","Cannot find the DOM element. Ignoring.",t)();return}a.log("trace","_uiUpdate:components-forEach","Element(s) to update. Count: ".concat(r.length),r)(),!t.slot&&t.payload&&(t.slot=t.payload),r.forEach((n,o)=>{if(a.log("trace","_uiUpdate:components-forEach","Updating element #".concat(o),n)(),this._uiComposeComponent(n,t),t.components){a.log("trace","_uiUpdate:nested-component","Element #".concat(o," - nested-component"),t,n)();let c={_ui:[]};t.components.forEach((h,d)=>{let f=h.method||t.method||e.method;h.method&&delete h.method,Array.isArray(h)||(h=[h]),a.log("trace","_uiUpdate:nested-component","Element #".concat(o," - nested-component #").concat(d),h)(),c._ui.push({method:f,parentEl:n,components:h})}),a.log("trace","_uiUpdate:nested-component","Element #".concat(o," - nested-component new manager"),c)(),this._uiManager(c)}})})}$(e,t,i){if(i||(i=a.doc),t||(t="el"),!i||!i.nodeType)return a.log(1,"Uib:$","Invalid context element. Must be a valid HTML element.",i)(),null;let r=i.querySelector(e);if(!r||!r.nodeType)return a.log(1,"Uib:$","No element found or element is not an HTML element for CSS selector ".concat(e))(),null;if(r.nodeName==="TEMPLATE"&&(r=r.content.firstElementChild,!r))return a.log(0,"Uib:$","Template selected for CSS selector ".concat(e," but it is empty"))(),null;let n;try{switch(t.toLowerCase()){case"text":{n=r.innerText;break}case"html":{n=r.innerHTML;break}case"attr":case"attributes":{n={};for(let o of r.attributes)n[o.name]=o.value;break}default:{n=r;break}}}catch(o){n=r,a.log(1,"Uib:$",'Could not process output type "'.concat(t,'" for CSS selector ').concat(e,", returned the DOM element. ").concat(o.message),o)()}return n}$$(e,t){return t||(t=a.doc),!t||!t.nodeType?(a.log(1,"Uib:$$","Invalid context element. Must be a valid HTML element.",t)(),null):Array.from(t.querySelectorAll(e))}addClass(e,t){Array.isArray(e)||(e=[e]),t&&t.classList.add(...e)}applyTemplate(e,t,i){var h;i||(i={}),i.onceOnly||(i.onceOnly=!1),i.mode||(i.mode="insert");let r=a.doc.getElementById(e);if(!r||r.tagName!=="TEMPLATE"){a.log("error","Ui:applyTemplate","Source must be a <template>. id='".concat(e,"'"))();return}let n=a.doc.getElementById(t);if(!n){a.log("error","Ui:applyTemplate","Target not found: id='".concat(t,"'"))();return}let o=(h=n.innerHTML)!=null?h:"";o&&i.mode==="replace"&&a.log("warn","Ui:applyTemplate","Target element is not empty, content is replaced. id='".concat(t,"'"))();let c;if(i.onceOnly===!0?c=a.doc.adoptNode(r.content):c=a.doc.importNode(r.content,!0),c){if(i.attributes){let d=c.firstElementChild;Object.keys(i.attributes).forEach(f=>{d.setAttribute(f,i.attributes[f])})}if(i.mode==="insert")n.appendChild(c);else if(i.mode==="replace")n.innerHTML="",n.appendChild(c);else if(i.mode==="wrap"&&(n.innerHTML="",n.appendChild(c),o)){let d=n.getElementsByTagName("slot");d.length>0&&(d[0].innerHTML=o)}}else a.log("warn","Ui:applyTemplate","No valid content found in template")()}convertMarkdown(e){if(!e)return"";if(!a.win.markdownit)return e;a.md||this._markDownIt();try{return a.md.render(e.trim())}catch(t){return a.log(0,"uibuilder:convertMarkdown","Could not render Markdown. ".concat(t.message),t)(),'<p class="border error">Could not render Markdown<p>'}}async include(e,t){if(!fetch)return a.log(0,"Ui:include","Current environment does not include `fetch`, skipping.")(),"Current environment does not include `fetch`, skipping.";if(!e)return a.log(0,"Ui:include","url parameter must be provided, skipping.")(),"url parameter must be provided, skipping.";if(!t||!t.id)return a.log(0,"Ui:include","uiOptions parameter MUST be provided and must contain at least an `id` property, skipping.")(),"uiOptions parameter MUST be provided and must contain at least an `id` property, skipping.";let i;try{i=await fetch(e)}catch(d){return a.log(0,"Ui:include","Fetch of file '".concat(e,"' failed. "),d.message)(),d.message}if(!i.ok)return a.log(0,"Ui:include","Fetch of file '".concat(e,"' failed. Status='").concat(i.statusText,"'"))(),i.statusText;let r=await i.headers.get("content-type"),n=null;r&&(r.includes("text/html")?n="html":r.includes("application/json")?n="json":r.includes("multipart/form-data")?n="form":r.includes("image/")?n="image":r.includes("video/")?n="video":r.includes("application/pdf")?n="pdf":r.includes("text/plain")&&(n="text"));let o="",c="Include successful",h;switch(n){case"html":{h=await i.text(),o=h;break}case"json":{h=await i.json(),o='<pre class="syntax-highlight">',o+=this.syntaxHighlight(h),o+="</pre>";break}case"form":{h=await i.formData(),o='<pre class="syntax-highlight">',o+=this.syntaxHighlight(h),o+="</pre>";break}case"image":{h=await i.blob(),o='<img src="'.concat(URL.createObjectURL(h),'">'),a.win.DOMPurify&&(c="Include successful. BUT DOMPurify loaded which may block its use.",a.log("warn","Ui:include:image",c)());break}case"video":{h=await i.blob(),o='<video controls autoplay><source src="'.concat(URL.createObjectURL(h),'"></video>'),a.win.DOMPurify&&(c="Include successful. BUT DOMPurify loaded which may block its use.",a.log("warn","Ui:include:video",c)());break}case"pdf":case"text":default:{h=await i.blob(),o='<iframe style="resize:both;width:inherit;height:inherit;" src="'.concat(URL.createObjectURL(h),'">'),a.win.DOMPurify&&(c="Include successful. BUT DOMPurify loaded which may block its use.",a.log("warn","Ui:include:".concat(n),c)());break}}return t.type="div",t.slot=o,t.parent||(t.parent="body"),t.attributes||(t.attributes={class:"included"}),this._uiReplace({components:[t]}),a.log("trace","Ui:include:".concat(n),c)(),c}loadScriptSrc(e){let t=a.doc.createElement("script");t.src=e,t.async=!1,a.doc.head.appendChild(t)}loadScriptTxt(e){let t=a.doc.createElement("script");t.async=!1,t.textContent=e,a.doc.head.appendChild(t)}loadStyleSrc(e){let t=a.doc.createElement("link");t.href=e,t.rel="stylesheet",t.type="text/css",a.doc.head.appendChild(t)}loadStyleTxt(e){let t=a.doc.createElement("style");t.textContent=e,a.doc.head.appendChild(t)}loadui(e){if(!fetch){a.log(0,"Ui:loadui","Current environment does not include `fetch`, skipping.")();return}if(!e){a.log(0,"Ui:loadui","url parameter must be provided, skipping.")();return}fetch(e).then(t=>{if(t.ok===!1)throw new Error("Could not load '".concat(e,"'. Status ").concat(t.status,", Error: ").concat(t.statusText));a.log("trace","Ui:loadui:then1","Loaded '".concat(e,"'. Status ").concat(t.status,", ").concat(t.statusText))();let i=t.headers.get("content-type");if(!i||!i.includes("application/json"))throw new TypeError("Fetch '".concat(e,"' did not return JSON, ignoring"));return t.json()}).then(t=>t!==void 0?(a.log("trace","Ui:loadui:then2","Parsed JSON successfully obtained")(),this._uiManager({_ui:t}),!0):!1).catch(t=>{a.log("warn","Ui:loadui:catch","Error. ",t)()})}moveElement(e){let{sourceSelector:t,targetSelector:i,moveType:r,position:n}=e;if(!document.querySelector(t)){a.log(0,"Ui:moveElement","Source element not found")();return}if(!document.querySelector(i)){a.log(0,"Ui:moveElement","Target element not found")();return}}nodeGet(e,t){let i={id:e.id===""?void 0:e.id,name:e.name,children:e.childNodes.length,type:e.nodeName,attributes:void 0,isUserInput:!!e.validity,userInput:e.validity?{value:e.value,validity:void 0,willValidate:e.willValidate,valueAsDate:e.valueAsDate,valueAsNumber:e.valueAsNumber,type:e.type}:void 0};if(["UL","OL"].includes(e.nodeName)){let r=a.doc.querySelectorAll("".concat(t," li"));r&&(i.list={entries:r.length})}if(e.nodeName==="DL"){let r=a.doc.querySelectorAll("".concat(t," dt"));r&&(i.list={entries:r.length})}if(e.nodeName==="TABLE"){let r=a.doc.querySelectorAll("".concat(t," > tbody > tr")),n=a.doc.querySelectorAll("".concat(t," > thead > tr")),o=a.doc.querySelectorAll("".concat(t," > tbody > tr:last-child > *"));(r||n||o)&&(i.table={headRows:n?n.length:0,bodyRows:r?r.length:0,columns:o?o.length:0})}if(e.nodeName!=="#text"&&e.attributes&&e.attributes.length>0){i.attributes={};for(let r of e.attributes)r.name!=="id"&&(i.attributes[r.name]=e.attributes[r.name].value),r.name==="class"&&(i.classes=Array.from(e.classList))}e.nodeName==="#text"&&(i.text=e.textContent),e.validity&&(i.userInput.validity={});for(let r in e.validity)i.userInput.validity[r]=e.validity[r];return i}async notification(e){if(typeof e=="string"&&(e={body:e}),typeof Notification>"u")return Promise.reject(new Error("Notifications not available in this browser"));let t=Notification.permission;return t==="denied"?Promise.reject(new Error("Notifications not permitted by user")):t==="granted"?this._showNotification(e):(t=await Notification.requestPermission(),t==="granted"?this._showNotification(e):Promise.reject(new Error("Notifications not permitted by user")))}removeClass(e,t){if(!e){t.removeAttribute("class");return}Array.isArray(e)||(e=[e]),t&&t.classList.remove(...e)}replaceSlot(e,t){if(!e)return;t||(t=""),t=this.sanitiseHTML(t);let i=a.doc.createRange().createContextualFragment(t),r=a.doc.createRange();r.selectNodeContents(e),r.deleteContents(),e.append(i)}replaceSlotMarkdown(e,t){e&&t.slotMarkdown&&(t.slotMarkdown=this.convertMarkdown(t.slotMarkdown),t.slotMarkdown=this.sanitiseHTML(t.slotMarkdown),e.innerHTML=t.slotMarkdown)}sanitiseHTML(e){return a.win.DOMPurify?a.win.DOMPurify.sanitize(e,{ADD_TAGS:this.sanitiseExtraTags,ADD_ATTR:this.sanitiseExtraAttribs}):e}showDialog(e,t,i){let r="";if(i.payload&&typeof i.payload=="string"&&(r+="<div>".concat(i.payload,"</div>")),t.content&&(r+="<div>".concat(t.content,"</div>")),r===""){a.log(1,"Ui:showDialog","Toast content is blank. Not shown.")();return}let n="";t.title?n=t.title:i.topic&&(n=i.topic),t.noAutohide&&(t.noAutoHide=t.noAutohide),t.noAutoHide&&(t.autohide=!t.noAutoHide),t.autoHideDelay?(t.autohide||(t.autohide=!0),t.delay=t.autoHideDelay):t.autoHideDelay=1e4,Object.prototype.hasOwnProperty.call(t,"autohide")||(t.autohide=!0);let o="",c="";e==="alert"&&(c='<svg viewBox="0 0 192.146 192.146"><path d="M108.186 144.372c0 7.054-4.729 12.32-12.037 12.32h-.254c-7.054 0-11.92-5.266-11.92-12.32 0-7.298 5.012-12.31 12.174-12.31s11.91 4.992 12.037 12.31zM88.44 125.301h15.447l2.951-61.298H85.46l2.98 61.298zm101.932 51.733c-2.237 3.664-6.214 5.921-10.493 5.921H12.282c-4.426 0-8.51-2.384-10.698-6.233a12.34 12.34 0 0 1 .147-12.349l84.111-149.22c2.208-3.722 6.204-5.96 10.522-5.96h.332c4.445.107 8.441 2.618 10.513 6.546l83.515 149.229c1.993 3.8 1.905 8.363-.352 12.066zm-10.493-6.4L96.354 21.454l-84.062 149.18h167.587z" /></svg>',t.modal=!0,t.autohide=!1),o='<div class="toast-head">'.concat(c).concat(n,'</div><div class="toast-body">').concat(r,"</div>");let h=a.doc.getElementById("toaster");h===null&&(h=a.doc.createElement("div"),h.id="toaster",h.title="Click to clear all notifcations",h.setAttribute("class","toaster"),h.setAttribute("role","dialog"),h.setAttribute("arial-label","Toast message"),h.onclick=function(){h.remove()},a.doc.body.insertAdjacentElement("afterbegin",h));let d=a.doc.createElement("div");d.title="Click to clear this notifcation",d.setAttribute("class","toast ".concat(t.variant?t.variant:""," ").concat(e)),d.innerHTML=o,d.setAttribute("role","alertdialog"),t.modal&&d.setAttribute("aria-modal",t.modal),d.onclick=function(f){f.stopPropagation(),d.remove(),h.childElementCount<1&&h.remove()},h.insertAdjacentElement(t.appendToast===!0?"beforeend":"afterbegin",d),t.autohide===!0&&setInterval(()=>{d.remove(),h.childElementCount<1&&h.remove()},t.autoHideDelay)}ui(e){let t={};e._ui?t=e:t._ui=e,this._uiManager(t)}uiGet(e,t=null){let i=a.doc.querySelectorAll(e),r=[];return i.forEach(n=>{if(t){t==="classes"&&(t="class");let o=n.getAttribute(t);if(o==null)try{o=n[t]}catch{}if(o==null)t.toLowerCase()==="value"?r.push(n.innerText):r.push("Property '".concat(t,"' not found"));else{let c={},h=o.constructor.name.toLowerCase();if(h==="namednodemap")for(let d of o)c[d.name]=o[d.name].value;else if(!h.includes("map"))c[t]=o;else{let d={};for(let f in o)d[f]=o[f]}c.class&&(c.classes=Array.from(n.classList)),r.push(c)}}else r.push(this.nodeGet(n,e))}),r}uiEnhanceElement(e,t){this._uiComposeComponent(e,t)}createTable(e=[],t={parent:"body"}){if(!t.parent)throw new Error("[ui.js:createTable] opts.parent must be provided");this.buildHtmlTable(e,t)}buildHtmlTable(e,t={}){let i,r=Object.prototype.toString.apply(e);if(r==="[object Array]"||r==="[object Object]")i=Object.keys(e),e=Object.values(e);else{let f=a.doc.createElement("p");return f.textContent="Input data is not an array or an object, cannot create a table.",f}i.length>1e3&&a.log(1,"Uib:buildHtmlTable","Warning, data is ".concat(i.length," rows. Anything over 1,000 can get very slow to complete."))();let n=a.doc.createElement("table"),o=a.doc.createElement("thead"),c=a.doc.createElement("tr");if(!t.cols){if(e.length<1)throw new Error("[ui.js:buildHtmlTable] When no opts.cols is provided, data must contain at least 1 row");let f=Object.prototype.toString.apply(e[0])!=="[object Array]";c.dataset.colReference="",t.cols=[],Object.keys(e[0]).forEach((m,w)=>{t.cols.push({index:w,hasName:f,name:f?m:void 0,key:m!=null?m:w,title:m})})}n.cols=t.cols,t.cols.forEach(f=>{let m=a.doc.createElement("th");m.textContent=f.title,f.hasName===!0&&(m.dataset.colName=name),c.appendChild(m)}),o.appendChild(c),n.appendChild(o);let h=a.doc.createElement("tbody");n.appendChild(h);let d={allowHTML:!0,cols:t.cols};if(e.forEach((f,m)=>{isNaN(Number(i[m]))?d.rowId=i[m]:d.rowId=void 0,this.tblAddRow(n,f,d)}),t.parent){let f;typeof t.parent=="string"?f=a.doc.querySelector(t.parent):f=t.parent;try{f.appendChild(n)}catch(m){throw new Error("[ui.js:buildHtmlTable] Could not add table to parent. ".concat(m.message))}return}return n}tblAddRow(e,t={},i={}){let r=Object.prototype.toString.apply(e);if(Object.prototype.toString.apply(i)!=="[object Object]")throw new Error("[tblAddDataRow] options must be an object");let n=Object.prototype.toString.apply(t);if(n!=="[object Object]"&&n!=="[object Array]")throw new Error("[tblAddDataRow] rowData MUST be an object or an array containing column/cell data for each column");let o;if(r==="[object HTMLTableElement]")o=e;else if(o=a.doc.querySelector(e),!o)throw new Error('[tblAddDataRow] Table with CSS Selector "'.concat(e,'" not found'));i.body||(i.body=0),"allowHTML"in i||(i.allowHTML=!1);let c=o.getElementsByTagName("tbody")[i.body];if(!c)throw new Error("[tblAddDataRow] Table must have a tbody tag, tbody section ".concat(i.body," does not exist"));i.cols||(i.cols=this.tblGetColMeta(o));let h=i.cols,d=a.doc.createElement("tr");i.rowId&&(d.id=i.rowId);let f=[];for(let m of h){let w=a.doc.createElement("td");w.colMeta=m,m.hasName&&(w.dataset.colName=m.name),f.push(w)}if(Object.keys(t).forEach((m,w,G)=>{let K=f.find(A=>{var Je;return((Je=A==null?void 0:A.colMeta)==null?void 0:Je.name)===m}),N;if(K)N=t[m];else{let A=Number(m);isNaN(A)&&(A=w),A<=f.length-1&&(K=f[A],N=Object.values(t)[A])}K&&(i.allowHTML?K.innerHTML=this.sanitiseHTML(N):K.textContent=N)}),d.append(...f),"afterRow"in i){let m=c.rows[i.afterRow];if(m)return m.after(d)}else if("beforeRow"in i){let m=c.rows[i.beforeRow];if(m)return m.before(d)}else if("replaceRow"in i){let m=c.rows[i.replaceRow];if(m)return m.replaceWith(d)}return c.appendChild(d)}tblAddListener(e,t={},i={}){let r=a.doc.querySelector(e);if(!r)throw new Error('Table with CSS Selector "'.concat(e,'" not found'));if(typeof i!="object")throw new Error('The "out" argument MUST be an object');t.eventScope||(t.eventScope="row"),t.returnType||(t.returnType="text"),t.eventType||(t.eventType="click"),t.pad||(t.pad=3),t.logLevel||(t.logLevel=2),"send"in t||(t.send=!0),r.querySelector("tbody").addEventListener(t.eventType,n=>{Object.keys(i).forEach(h=>delete i[h]);let o=n.target.closest("tr"),c=n.target.closest("td");if(o){i.clickType=t.eventScope,i.eventType=t.eventType;let h=i.rowIndex=o.rowIndex,d=i.cellIndex=c.cellIndex+1;if(o.id&&(i.rowId=o.id),t.eventScope==="row")o.querySelectorAll("td").forEach(f=>{let m=this.tblGetCellName(f,t.pad);i[m]=t.returnType==="text"?f.textContent.trim():f.innerHTML});else{let f=this.tblGetCellName(c,t.pad);i[f]=t.returnType==="text"?c.textContent.trim():c.innerHTML}a.log(t.logLevel,"Ui:tblAddClickListener","".concat(t.eventScope," ").concat(t.eventType," on row=").concat(h,", col=").concat(d,", data: "),i)(),t.send===!0&&a.win.uibuilder&&a.win.uibuilder.send({topic:"".concat(e," ").concat(t.eventScope," ").concat(t.eventType),payload:i})}})}tblFindColMeta(e,t,i){if(!t&&!i)throw new Error("[tblFindColMeta] Either the column metadata array or the HTML table element must be provided");!t&&i&&(t=this.tblGetColMeta(i));let r;if(t[e])r=t[e];else{let n=t.find(o=>o.name===e||o.index===Number(e));n&&(r=n)}return r}tblGetCellName(e,t=3){var i;return(i=e.getAttribute("data-col-name"))!=null?i:"C".concat(String(e.cellIndex+1).padStart(t,"0"))}tblGetColMeta(e,t={}){var o,c,h;if(t.pad||(t.pad=3),e.cols)return e.cols;let i=(o=e.querySelector("tr[data-col-reference]"))==null?void 0:o.children;if(i||(i=(c=e.querySelector("thead>tr:first-of-type"))==null?void 0:c.children),i||(i=(h=e.querySelector("tr:first-of-type"))==null?void 0:h.children),!i)return a.log(1,"Ui:tblGetColMeta","No columns found in table")(),[];let r=[],n;for(n of i){let d=!!n.dataset.colName,f=n.dataset.colName,m=n.cellIndex+1,w=d?f:"C".concat(String(n.cellIndex+1).padStart(t.pad,"0"));r.push({index:m,hasName:d,name:f,key:w,title:n.textContent})}return e.cols=r,r}tblRemoveRow(e,t,i={}){let r=Object.prototype.toString.apply(e);if(Object.prototype.toString.apply(i)!=="[object Object]")throw new Error("[tblRemoveRow] options must be an object");let n;if(r==="[object HTMLTableElement]")n=e;else if(n=a.doc.querySelector(e),!n)throw new Error('[tblRemoveRow] Table with CSS Selector "'.concat(e,'" not found'));i.body||(i.body=0);let o=n.getElementsByTagName("tbody")[i.body];if(!o)throw new Error("[tblAddDataRow] Table must have a tbody tag, tbody section ".concat(i.body," does not exist"));o.deleteRow(t)}},u(a,"win"),u(a,"doc"),u(a,"log"),u(a,"mdOpts"),u(a,"md"),a),et=Ft;var O=Object.create(null);O.open="0";O.close="1";O.ping="2";O.pong="3";O.message="4";O.upgrade="5";O.noop="6";var oe=Object.create(null);Object.keys(O).forEach(s=>{oe[O[s]]=s});var ae={type:"error",data:"parser error"};var rt=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",st=typeof ArrayBuffer=="function",nt=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer,ce=({type:s,data:e},t,i)=>rt&&e instanceof Blob?t?i(e):tt(e,i):st&&(e instanceof ArrayBuffer||nt(e))?t?i(e):tt(new Blob([e]),i):i(O[s]+(e||"")),tt=(s,e)=>{let t=new FileReader;return t.onload=function(){let i=t.result.split(",")[1];e("b"+(i||""))},t.readAsDataURL(s)};function it(s){return s instanceof Uint8Array?s:s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}var Ie;function ot(s,e){if(rt&&s.data instanceof Blob)return s.data.arrayBuffer().then(it).then(e);if(st&&(s.data instanceof ArrayBuffer||nt(s.data)))return e(it(s.data));ce(s,!1,t=>{Ie||(Ie=new TextEncoder),e(Ie.encode(t))})}var at="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",le=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<at.length;s++)le[at.charCodeAt(s)]=s;var ct=s=>{let e=s.length*.75,t=s.length,i,r=0,n,o,c,h;s[s.length-1]==="="&&(e--,s[s.length-2]==="="&&e--);let d=new ArrayBuffer(e),f=new Uint8Array(d);for(i=0;i<t;i+=4)n=le[s.charCodeAt(i)],o=le[s.charCodeAt(i+1)],c=le[s.charCodeAt(i+2)],h=le[s.charCodeAt(i+3)],f[r++]=n<<2|o>>4,f[r++]=(o&15)<<4|c>>2,f[r++]=(c&3)<<6|h&63;return d};var Vt=typeof ArrayBuffer=="function",he=(s,e)=>{if(typeof s!="string")return{type:"message",data:lt(s,e)};let t=s.charAt(0);return t==="b"?{type:"message",data:Wt(s.substring(1),e)}:oe[t]?s.length>1?{type:oe[t],data:s.substring(1)}:{type:oe[t]}:ae},Wt=(s,e)=>{if(Vt){let t=ct(s);return lt(t,e)}else return{base64:!0,data:s}},lt=(s,e)=>{switch(e){case"blob":return s instanceof Blob?s:new Blob([s]);case"arraybuffer":default:return s instanceof ArrayBuffer?s:s.buffer}};var ht="",ut=(s,e)=>{let t=s.length,i=new Array(t),r=0;s.forEach((n,o)=>{ce(n,!1,c=>{i[o]=c,++r===t&&e(i.join(ht))})})},dt=(s,e)=>{let t=s.split(ht),i=[];for(let r=0;r<t.length;r++){let n=he(t[r],e);if(i.push(n),n.type==="error")break}return i};function ft(){return new TransformStream({transform(s,e){ot(s,t=>{let i=t.length,r;if(i<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,i);else if(i<65536){r=new Uint8Array(3);let n=new DataView(r.buffer);n.setUint8(0,126),n.setUint16(1,i)}else{r=new Uint8Array(9);let n=new DataView(r.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(i))}s.data&&typeof s.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}var Ue;function Se(s){return s.reduce((e,t)=>e+t.length,0)}function Ne(s,e){if(s[0].length===e)return s.shift();let t=new Uint8Array(e),i=0;for(let r=0;r<e;r++)t[r]=s[0][i++],i===s[0].length&&(s.shift(),i=0);return s.length&&i<s[0].length&&(s[0]=s[0].slice(i)),t}function pt(s,e){Ue||(Ue=new TextDecoder);let t=[],i=0,r=-1,n=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(i===0){if(Se(t)<1)break;let h=Ne(t,1);n=(h[0]&128)===128,r=h[0]&127,r<126?i=3:r===126?i=1:i=2}else if(i===1){if(Se(t)<2)break;let h=Ne(t,2);r=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),i=3}else if(i===2){if(Se(t)<8)break;let h=Ne(t,8),d=new DataView(h.buffer,h.byteOffset,h.length),f=d.getUint32(0);if(f>Math.pow(2,21)-1){c.enqueue(ae);break}r=f*Math.pow(2,32)+d.getUint32(4),i=3}else{if(Se(t)<r)break;let h=Ne(t,r);c.enqueue(he(n?h:Ue.decode(h),e)),i=0}if(r===0||r>s){c.enqueue(ae);break}}}})}var Me=4;function g(s){if(s)return zt(s)}function zt(s){for(var e in g.prototype)s[e]=g.prototype[e];return s}g.prototype.on=g.prototype.addEventListener=function(s,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+s]=this._callbacks["$"+s]||[]).push(e),this};g.prototype.once=function(s,e){function t(){this.off(s,t),e.apply(this,arguments)}return t.fn=e,this.on(s,t),this};g.prototype.off=g.prototype.removeListener=g.prototype.removeAllListeners=g.prototype.removeEventListener=function(s,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+s];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+s],this;for(var i,r=0;r<t.length;r++)if(i=t[r],i===e||i.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+s],this};g.prototype.emit=function(s){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+s],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(t){t=t.slice(0);for(var i=0,r=t.length;i<r;++i)t[i].apply(this,e)}return this};g.prototype.emitReserved=g.prototype.emit;g.prototype.listeners=function(s){return this._callbacks=this._callbacks||{},this._callbacks["$"+s]||[]};g.prototype.hasListeners=function(s){return!!this.listeners(s).length};var $=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),E=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),mt="arraybuffer";function Oe(s,...e){return e.reduce((t,i)=>(s.hasOwnProperty(i)&&(t[i]=s[i]),t),{})}var Gt=E.setTimeout,Kt=E.clearTimeout;function L(s,e){e.useNativeTimers?(s.setTimeoutFn=Gt.bind(E),s.clearTimeoutFn=Kt.bind(E)):(s.setTimeoutFn=E.setTimeout.bind(E),s.clearTimeoutFn=E.clearTimeout.bind(E))}var Jt=1.33;function bt(s){return typeof s=="string"?Yt(s):Math.ceil((s.byteLength||s.size)*Jt)}function Yt(s){let e=0,t=0;for(let i=0,r=s.length;i<r;i++)e=s.charCodeAt(i),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(i++,t+=4);return t}function xe(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function yt(s){let e="";for(let t in s)s.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(s[t]));return e}function gt(s){let e={},t=s.split("&");for(let i=0,r=t.length;i<r;i++){let n=t[i].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var Te=class extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}},I=class extends g{constructor(e){super(),this.writable=!1,L(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,i){return super.emitReserved("error",new Te(e,t,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=he(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=yt(e);return t.length?"?"+t:""}};var ue=class extends I{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||t()})),this.writable||(i++,this.once("drain",function(){--i||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};dt(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,ut(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=xe()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var wt=!1;try{wt=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var vt=wt;function Xt(){}var De=class extends ue{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",i=location.port;i||(i=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,t){let i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,i)=>{this.onError("xhr poll error",t,i)}),this.pollXhr=e}},U=class s extends g{constructor(e,t,i){super(),this.createRequest=e,L(this,i),this._opts=i,this._method=i.method||"GET",this._uri=t,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;let t=Oe(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(t);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&i.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var r;i.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=s.requestsCount++,s.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Xt,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete s.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};U.requestsCount=0;U.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",_t);else if(typeof addEventListener=="function"){let s="onpagehide"in E?"pagehide":"unload";addEventListener(s,_t,!1)}}function _t(){for(let s in U.requests)U.requests.hasOwnProperty(s)&&U.requests[s].abort()}var Qt=function(){let s=kt({xdomain:!1});return s&&s.responseType!==null}(),M=class extends De{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Qt&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new U(kt,this.uri(),e)}};function kt(s){let e=s.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||vt))return new XMLHttpRequest}catch{}if(!e)try{return new E[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var Et=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Be=class extends I{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,i=Et?{}:Oe(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,i)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let i=e[t],r=t===e.length-1;ce(i,this.supportsBinary,n=>{try{this.doWrite(i,n)}catch{}r&&$(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=xe()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Pe=E.WebSocket||E.MozWebSocket,D=class extends Be{createSocket(e,t,i){return Et?new Pe(e,t,i):t?new Pe(e,t):new Pe(e)}doWrite(e,t){this.ws.send(t)}};var J=class extends I{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=pt(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),r=ft();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let n=()=>{i.read().then(({done:c,value:h})=>{c||(this.onPacket(h),n())}).catch(c=>{})};n();let o={type:"open"};this.query.sid&&(o.data='{"sid":"'.concat(this.query.sid,'"}')),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let i=e[t],r=t===e.length-1;this._writer.write(i).then(()=>{r&&$(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var He={websocket:D,webtransport:J,polling:M};var Zt=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ei=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Y(s){if(s.length>8e3)throw"URI too long";let e=s,t=s.indexOf("["),i=s.indexOf("]");t!=-1&&i!=-1&&(s=s.substring(0,t)+s.substring(t,i).replace(/:/g,";")+s.substring(i,s.length));let r=Zt.exec(s||""),n={},o=14;for(;o--;)n[ei[o]]=r[o]||"";return t!=-1&&i!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=ti(n,n.path),n.queryKey=ii(n,n.query),n}function ti(s,e){let t=/\/{2,9}/g,i=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function ii(s,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,r,n){r&&(t[r]=n)}),t}var je=typeof addEventListener=="function"&&typeof removeEventListener=="function",Re=[];je&&addEventListener("offline",()=>{Re.forEach(s=>s())},!1);var j=class s extends g{constructor(e,t){if(super(),this.binaryType=mt,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){let i=Y(e);t.hostname=i.host,t.secure=i.protocol==="https"||i.protocol==="wss",t.port=i.port,i.query&&(t.query=i.query)}else t.host&&(t.hostname=Y(t.host).host);L(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(i=>{let r=i.prototype.name;this.transports.push(r),this._transportsByName[r]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=gt(this.opts.query)),je&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Re.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=Me,t.transport=e,this.id&&(t.sid=this.id);let i=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&s.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",s.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let i=0;i<this.writeBuffer.length;i++){let r=this.writeBuffer[i].data;if(r&&(t+=bt(r)),i>0&&t>this._maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,$(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,i){return this._sendPacket("message",e,t,i),this}send(e,t,i){return this._sendPacket("message",e,t,i),this}_sendPacket(e,t,i,r){if(typeof t=="function"&&(r=t,t=void 0),typeof i=="function"&&(r=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let n={type:e,data:t,options:i};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),r&&this.once("flush",r),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(s.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),je&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=Re.indexOf(this._offlineEventListener);i!==-1&&Re.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}};j.protocol=Me;var Ae=class extends j{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),i=!1;j.priorWebsocketSuccess=!1;let r=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!i)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;j.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(f(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let w=new Error("probe error");w.transport=t.name,this.emitReserved("upgradeError",w)}}))};function n(){i||(i=!0,f(),t.close(),t=null)}let o=m=>{let w=new Error("probe error: "+m);w.transport=t.name,n(),this.emitReserved("upgradeError",w)};function c(){o("transport closed")}function h(){o("socket closed")}function d(m){t&&m.name!==t.name&&n()}let f=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",c),this.off("close",h),this.off("upgrading",d)};t.once("open",r),t.once("error",o),t.once("close",c),this.once("close",h),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&t.push(e[i]);return t}},X=class extends Ae{constructor(e,t={}){let i=typeof e=="object"?e:t;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(r=>He[r]).filter(r=>!!r)),super(e,i)}};var vr=X.protocol;function Ct(s,e="",t){let i=s;t=t||typeof location<"u"&&location,s==null&&(s=t.protocol+"//"+t.host),typeof s=="string"&&(s.charAt(0)==="/"&&(s.charAt(1)==="/"?s=t.protocol+s:s=t.host+s),/^(https?|wss?):\/\//.test(s)||(typeof t<"u"?s=t.protocol+"//"+s:s="https://"+s),i=Y(s)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let n=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+e,i.href=i.protocol+"://"+n+(t&&t.port===i.port?"":":"+i.port),i}var Ge={};jt(Ge,{Decoder:()=>We,Encoder:()=>Ve,PacketType:()=>y,protocol:()=>Tt});var si=typeof ArrayBuffer=="function",ni=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s.buffer instanceof ArrayBuffer,St=Object.prototype.toString,oi=typeof Blob=="function"||typeof Blob<"u"&&St.call(Blob)==="[object BlobConstructor]",ai=typeof File=="function"||typeof File<"u"&&St.call(File)==="[object FileConstructor]";function fe(s){return si&&(s instanceof ArrayBuffer||ni(s))||oi&&s instanceof Blob||ai&&s instanceof File}function de(s,e){if(!s||typeof s!="object")return!1;if(Array.isArray(s)){for(let t=0,i=s.length;t<i;t++)if(de(s[t]))return!0;return!1}if(fe(s))return!0;if(s.toJSON&&typeof s.toJSON=="function"&&arguments.length===1)return de(s.toJSON(),!0);for(let t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&de(s[t]))return!0;return!1}function Nt(s){let e=[],t=s.data,i=s;return i.data=qe(t,e),i.attachments=e.length,{packet:i,buffers:e}}function qe(s,e){if(!s)return s;if(fe(s)){let t={_placeholder:!0,num:e.length};return e.push(s),t}else if(Array.isArray(s)){let t=new Array(s.length);for(let i=0;i<s.length;i++)t[i]=qe(s[i],e);return t}else if(typeof s=="object"&&!(s instanceof Date)){let t={};for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=qe(s[i],e));return t}return s}function Ot(s,e){return s.data=Fe(s.data,e),delete s.attachments,s}function Fe(s,e){if(!s)return s;if(s&&s._placeholder===!0){if(typeof s.num=="number"&&s.num>=0&&s.num<e.length)return e[s.num];throw new Error("illegal attachments")}else if(Array.isArray(s))for(let t=0;t<s.length;t++)s[t]=Fe(s[t],e);else if(typeof s=="object")for(let t in s)Object.prototype.hasOwnProperty.call(s,t)&&(s[t]=Fe(s[t],e));return s}var ci=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Tt=5,y;(function(s){s[s.CONNECT=0]="CONNECT",s[s.DISCONNECT=1]="DISCONNECT",s[s.EVENT=2]="EVENT",s[s.ACK=3]="ACK",s[s.CONNECT_ERROR=4]="CONNECT_ERROR",s[s.BINARY_EVENT=5]="BINARY_EVENT",s[s.BINARY_ACK=6]="BINARY_ACK"})(y||(y={}));var Ve=class{constructor(e){this.replacer=e}encode(e){return(e.type===y.EVENT||e.type===y.ACK)&&de(e)?this.encodeAsBinary({type:e.type===y.EVENT?y.BINARY_EVENT:y.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===y.BINARY_EVENT||e.type===y.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Nt(e),i=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(i),r}};function xt(s){return Object.prototype.toString.call(s)==="[object Object]"}var We=class s extends g{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let i=t.type===y.BINARY_EVENT;i||t.type===y.BINARY_ACK?(t.type=i?y.EVENT:y.ACK,this.reconstructor=new ze(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(fe(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,i={type:Number(e.charAt(0))};if(y[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===y.BINARY_EVENT||i.type===y.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");i.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););i.nsp=e.substring(n,t)}else i.nsp="/";let r=e.charAt(t+1);if(r!==""&&Number(r)==r){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}i.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(s.isPayloadValid(i.type,n))i.data=n;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case y.CONNECT:return xt(t);case y.DISCONNECT:return t===void 0;case y.CONNECT_ERROR:return typeof t=="string"||xt(t);case y.EVENT:case y.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&ci.indexOf(t[0])===-1);case y.ACK:case y.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ze=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Ot(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function S(s,e,t){return s.on(e,t),function(){s.off(e,t)}}var li=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),Q=class extends g{constructor(e,t,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[S(e,"open",this.onopen.bind(this)),S(e,"packet",this.onpacket.bind(this)),S(e,"error",this.onerror.bind(this)),S(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var i,r,n;if(li.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:y.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let f=this.ids++,m=t.pop();this._registerAckCallback(f,m),o.id=f}let c=(r=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||r===void 0?void 0:r.writable,h=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!c||(h?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var i;let r=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},r),o=(...c)=>{this.io.clearTimeoutFn(n),t.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((i,r)=>{let n=(o,c)=>o?r(o):i(c);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...n)=>i!==this._queue[0]?void 0:(r!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:y.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){let i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case y.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case y.EVENT:case y.BINARY_EVENT:this.onevent(e);break;case y.ACK:case y.BINARY_ACK:this.onack(e);break;case y.DISCONNECT:this.ondisconnect();break;case y.CONNECT_ERROR:this.destroy();let i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let i of t)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,i=!1;return function(...r){i||(i=!0,t.packet({type:y.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:y.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let i of t)i.apply(this,e.data)}}};function q(s){s=s||{},this.ms=s.min||100,this.max=s.max||1e4,this.factor=s.factor||2,this.jitter=s.jitter>0&&s.jitter<=1?s.jitter:0,this.attempts=0}q.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*s);s=(Math.floor(e*10)&1)==0?s-t:s+t}return Math.min(s,this.max)|0};q.prototype.reset=function(){this.attempts=0};q.prototype.setMin=function(s){this.ms=s};q.prototype.setMax=function(s){this.max=s};q.prototype.setJitter=function(s){this.jitter=s};var Z=class extends g{constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,L(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((i=t.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new q({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let r=t.parser||Ge;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new X(this.uri,this.opts);let t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let r=S(t,"open",function(){i.onopen(),e&&e()}),n=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=S(t,"error",n);if(this._timeout!==!1){let c=this._timeout,h=this.setTimeoutFn(()=>{r(),n(new Error("timeout")),t.close()},c);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(S(e,"ping",this.onping.bind(this)),S(e,"data",this.ondata.bind(this)),S(e,"error",this.onerror.bind(this)),S(e,"close",this.onclose.bind(this)),S(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){$(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new Q(this,e,t),this.nsps[e]=i),i}_destroy(e){let t=Object.keys(this.nsps);for(let i of t)if(this.nsps[i].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let i=0;i<t.length;i++)this.engine.write(t[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var pe={};function F(s,e){typeof s=="object"&&(e=s,s=void 0),e=e||{};let t=Ct(s,e.path||"/socket.io"),i=t.source,r=t.id,n=t.path,o=pe[r]&&n in pe[r].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,h;return c?h=new Z(i,e):(pe[r]||(pe[r]=new Z(i,e)),h=pe[r]),t.query&&!e.query&&(e.query=t.queryKey),h.socket(t.path,e)}Object.assign(F,{Manager:Z,Socket:Q,io:F,connect:F});var ee=class ee extends HTMLElement{constructor(){super();u(this,"uib",!!window.uibuilder);u(this,"uibuilder",window.uibuilder);u(this,"$");u(this,"$$");u(this,"connected",!1);u(this,"name");u(this,"opts",{})}static get version(){return"".concat(this.componentVersion," (Base: ").concat(this.baseVersion,")")}async doInheritStyles(){if(!this.hasAttribute("inherit-style"))return;let t=this.getAttribute("inherit-style");t||(t="./index.css");let i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",t),this.shadowRoot.appendChild(i),console.info("[".concat(this.localName,'] Inherit-style requested. Loading: "').concat(t,'"'))}config(t){return t&&(this.opts=ee.deepAssign(this.opts,t)),this.opts}static deepAssign(t,...i){for(let r of i)for(let n in r){let o=r[n],c=t[n];if(Object(o)==o&&Object(c)===c){t[n]=ee.deepAssign(c,o);continue}t[n]=r[n]}return t}ensureId(){this.uib=!!window.uibuilder,this.id||(this.id="".concat(this.localName,"-").concat(++this.constructor._iCount))}createShadowSelectors(){var t,i;this.$=(t=this.shadowRoot)==null?void 0:t.querySelector.bind(this.shadowRoot),this.$$=(i=this.shadowRoot)==null?void 0:i.querySelectorAll.bind(this.shadowRoot)}_uibMsgHandler(t){}_event(t,i){this.dispatchEvent(new CustomEvent("".concat(this.localName,":").concat(t),{bubbles:!0,composed:!0,detail:{id:this.id,name:this.name,data:i}}))}_construct(t,i){i||(i={mode:"open",delegatesFocus:!0}),this.attachShadow(i).append(t),this.createShadowSelectors()}_connect(){this.ensureId(),this.doInheritStyles()}_disconnect(){document.removeEventListener("uibuilder:msg:_ui:update:".concat(this.id),this._uibMsgHandler),this._event("disconnected")}_ready(){this.connected=!0,this._event("connected"),this._event("ready")}};u(ee,"baseVersion","2025-01-09"),u(ee,"_iCount",0);var Ke=ee,te=Ke;var V,P,ie,T,me=class extends te{constructor(){super();v(this,V);u(this,"value");v(this,P);v(this,ie);v(this,T);u(this,"undef",!1);u(this,"report",!1);u(this,"type","plain");u(this,"types",["plain","html","markdown","object","json","table","list","array"])}static get observedAttributes(){return["name","filter","id","report","topic","type","undefined","variable"]}set variable(t){if(_(this,V,t),this.splitVarName,t)try{this.splitVarName=t.split(/[\.\[\]\'\"]/),_(this,V,t=this.splitVarName.shift())}catch(i){throw new Error("[".concat(this.localName,'] variable attribute: Name split failed on "').concat(t,'". ').concat(i.message))}p(this,P)&&this.uibuilder.cancelChange(t,p(this,P)),t&&_(this,P,this.uibuilder.onChange(t,this._varChange.bind(this)))}get variable(){return p(this,V)}set topic(t){_(this,ie,t),p(this,T)&&this.uibuilder.cancelTopic(t,p(this,T)),t&&_(this,T,this.uibuilder.onTopic(t,this._topicChange.bind(this)))}get topic(){return p(this,ie)}connectedCallback(){this._connect(),this.variable=this.getAttribute("variable"),this.topic=this.getAttribute("topic"),this._ready()}disconnectedCallback(){p(this,P)&&this.uibuilder.cancelChange(p(this,V),p(this,P)),p(this,T)&&(this.uibuilder.cancelTopic(p(this,ie),p(this,T)),Object.keys(p(this,T)).forEach(t=>{this.uibuilder.cancelTopic(t,p(this,T)[t])})),this._disconnect()}attributeChangedCallback(t,i,r){if(i!==r){switch(this[t]=r,t){case"undefined":{r===""||["on","true","report"].includes(r.toLowerCase())?this.undef=!0:this.undef=!1;break}case"report":{r===""||["on","true","report"].includes(r.toLowerCase())?this.report=!0:this.report=!1;break}case"type":{r===""||!this.types.includes(r.toLowerCase())?this.type="plain":this.type=r;break}case"filter":{if(this.filter=void 0,this.filterArgs=[],!r)break;this.filter=r,r=r.slice(0,127);let n=r.replace(/\s/g,"").match(/([a-zA-Z_$][a-zA-Z_$0-9.-]+)(\((.*)\))?/);if(!n){console.warn('\u26A0\uFE0F [uib-var] Filter function "'.concat(r,'" invalid. Cannot process.'));break}if(this.filter=n[1],n[3]){try{this.filterArgs=JSON.parse(n[3])}catch{}this.filterArgs=n[3].split(",").map(o=>{if(o=o.trim(),isNaN(o)){let c=o.replace(/^["'`]/,"").replace(/["'`]$/,"");try{c=new Function("return ".concat(c))()}catch{}return c}return Number(o)})}!this.variable&&!this.topic&&this.showVar(!1);break}default:break}this._event("attribChanged",{attribute:t,newVal:r,oldVal:i})}}_varChange(t){let i=!0;if(this.splitVarName.length>0){let r=t,n=[];try{this.splitVarName.forEach(o=>{let c;r[o]===void 0?c=!1:c=!0,n.push(c),r=r[o]}),t=r,i=n.filter(Boolean).length>0}catch{i=!1}}i&&(this.value=t,this.showVar(),this.report===!0&&this.uibuilder.send({topic:this.variable,payload:this.value||void 0,source:this.localName,id:this.id}))}_topicChange(t){this.uibuilder.log("trace",this.localName,"Topic msg received: '".concat(t.topic,"'"),t),this.value=t.payload,this.showVar(),this.report===!0&&this.uibuilder.send({topic:t.topic,payload:this.value||void 0,source:this.localName,id:this.id})}showVar(t=!0){if(this.uibuilder.log("trace",this.localName,"showVar. chkVal: '".concat(t,"'. Value="),this.value),t===!0&&!this.value&&this.undef!==!0)return;let i=t?this.doFilter(this.value):this.doFilter(),r=i;switch(this.type){case"markdown":{this.uib&&(r=this.uibuilder.convertMarkdown(i));break}case"json":case"object":{r='<pre class="syntax-highlight">'.concat(this.uib?this.uibuilder.syntaxHighlight(i):i,"</pre>");break}case"table":{r=this.uibuilder.buildHtmlTable(i).outerHTML;break}case"array":case"list":{Array.isArray(i)||(i=[i]),r="<ul>",i.forEach(n=>{r+="<li>".concat(n,"</li>")}),r+="</ul>";break}case"plain":case"html":default:{let n=typeof i;if(Array.isArray(i)||n==="[object Object]"||n==="object")try{r=JSON.stringify(i)}catch{}break}}this.uib?this.innerHTML=this.uibuilder.sanitiseHTML(r):this.innerHTML=r}doFilter(t){if(this.filter){let i=this.filter.split("."),r=globalThis[i[0]];if(r&&i.length>1&&[i.pop()].forEach(o=>{r=r[o]}),!r&&this.uib===!0&&(r=this.uibuilder[i[0]]),r&&typeof r!="function"&&(r=void 0),r){let n=t===void 0?[...this.filterArgs]:[t,...this.filterArgs];t=Reflect.apply(r,t!=null?t:r,n)}else console.warn('\u26A0\uFE0F [uib-var] Filter function "'.concat(this.filter,'" ').concat(typeof r=="object"?"is an object not a function":"not found"))}return t}};V=new WeakMap,P=new WeakMap,ie=new WeakMap,T=new WeakMap,u(me,"componentVersion","2025-01-05");var Rt=me;window.UibVar=me;var be=class extends te{constructor(){super();u(this,"variable","pageMeta");u(this,"value");u(this,"undef",!1);u(this,"report",!1);u(this,"type","created");u(this,"types",["created","updated","crup","both","size","modified","all"]);u(this,"format","");u(this,"formats",["d","dt","t","k","m"]);u(this,"topicMonitors",{});if(this.shadow=this.attachShadow({mode:"open",delegatesFocus:!0}),this.$=this.shadowRoot.querySelector.bind(this.shadowRoot),!this.uibuilder)throw new Error("[uib-meta] uibuilder client library not available");this.value=this.uibuilder.get("pageMeta"),this.value||this.uibuilder.getPageMeta(),this.doWatch()}static get observedAttributes(){return["inherit-style","name","type","format"]}connectedCallback(){this._connect(),this._ready()}disconnectedCallback(){this._disconnect()}attributeChangedCallback(t,i,r){if(i!==r){switch(t){case"type":{r===""||!this.types.includes(r.toLowerCase())?this.type="created":this.type=r;break}case"format":{this.formats.includes(r.toLowerCase())?this[t]=r:this.type="";break}default:{this[t]=r;break}}this._event("attribChanged",{attribute:t,newVal:r,oldVal:i})}}doWatch(){this.varDom(),window.uibuilder.onChange(this.variable,t=>{this.value=t,this.varDom(),this.report===!0&&window.uibuilder.send({topic:this.variable,payload:this.value||void 0})})}varDom(t=!0){if(t===!0&&!this.value&&this.undef!==!0){this.shadow.innerHTML="<slot></slot>";return}let i;switch(this.type.toLowerCase()){case"all":{i="Created: ".concat(this.doFormat(this.value.created,"dt"),", Updated: ").concat(this.doFormat(this.value.modified,"dt")),i+=", Size: ".concat(this.doFormat(this.value.size,"num"),"b");break}case"size":{i="Size: ".concat(this.doFormat(this.value.size,"num"),"b");break}case"modified":case"updated":{i="Updated: ".concat(this.doFormat(this.value.modified,"dt"));break}case"both":case"created-updated":case"crup":{i="Created: ".concat(this.doFormat(this.value.created,"dt"),", Updated: ").concat(this.doFormat(this.value.modified,"dt"));break}case"created":default:{i="Created: ".concat(this.doFormat(this.value.created,"dt"));break}}i!==void 0&&(this.shadow.innerHTML=i)}doFormat(t,i){if(this.format==="")return t;let r;switch(this.format){case"d":{i==="dt"?r=new Date(t).toLocaleDateString():r=t;break}case"t":{i==="dt"?r=new Date(t).toLocaleTimeString():r=t;break}case"dt":{i==="dt"?r=new Date(t).toLocaleString():r=t;break}case"k":{i==="num"?r="".concat(uibuilder.round(t/1024,1)," k"):r=t;break}case"m":{i==="num"?r="".concat(uibuilder.round(t/1048576,2)," M"):r=t;break}default:r=t}return r}};u(be,"componentVersion","2025-01-06");var At=be;window.UibMeta=be;var ye=class extends te{constructor(){super();u(this,"once",!1);if(!this.uibuilder)throw new Error("[apply-template] uibuilder client library not available")}static get observedAttributes(){return["name","template-id","once"]}connectedCallback(){this._connect();let t=this["template-id"],i=this.once;if(!t)throw new Error("[ApplyTemplate] Template id attribute not provided. Template must be identified by an id attribute");let r=document.getElementById(t);if(!r||r.tagName!=="TEMPLATE")throw new Error("[ApplyTemplate] Source must be a <template>. id='".concat(t,"'"));let n=this.innerHTML;this.innerHTML="";let o;if(i===!1?o=document.importNode(r.content,!0):o=document.adoptNode(r.content),this.appendChild(o),n){let c=this.getElementsByTagName("slot");c.length>0&&(c[0].innerHTML=n)}this._ready()}disconnectedCallback(){this._disconnect()}attributeChangedCallback(t,i,r){i!==r&&(this[t]=r,this._event("attribChanged",{attribute:t,newVal:r,oldVal:i}))}};u(ye,"componentVersion","2025-01-05");var $t=ye;window.ApplyTemplate=ye;var di={};var Lt="7.4.2-src",hi=!/param/.test(function(s){});function l(){let s=Array.from(arguments),e=s.shift(),t;switch(e){case"trace":case 5:{if(l.level<5)break;e=5,t="trace";break}case"debug":case 4:{if(l.level<4)break;e=4,t="debug";break}case"log":case 3:{if(l.level<3)break;e=3,t="log";break}case"info":case"":case 2:{if(l.level<2)break;e=2,t="info";break}case"warn":case 1:{if(l.level<1)break;e=1,t="warn";break}case"error":case"err":case 0:{if(l.level<0)break;e=0,t="error";break}default:{e=-1;break}}if(t===void 0)return function(){};let i=s.shift();return Function.prototype.bind.call(console[l.LOG_STYLES[t].console],console,"%c".concat(l.LOG_STYLES[t].pre).concat(t,"%c [").concat(i,"]"),"".concat(l.LOG_STYLES.level," ").concat(l.LOG_STYLES[t].css),"".concat(l.LOG_STYLES.head," ").concat(l.LOG_STYLES[t].txtCss),...s)}l.LOG_STYLES={error:{css:"background: red; color: black;",txtCss:"color: red; ",pre:"\u26D4 ",console:"error"},warn:{css:"background: darkorange; color: black;",txtCss:"color: darkorange; ",pre:"\u26A0 ",console:"warn"},info:{css:"background: aqua; color: black;",txtCss:"color: aqua;",pre:"\u2757 ",console:"info"},log:{css:"background: grey; color: yellow;",txtCss:"color: grey;",pre:"",console:"log"},debug:{css:"background: chartreuse; color: black;",txtCss:"color: chartreuse;",pre:"",console:"debug"},trace:{css:"background: indigo; color: yellow;",txtCss:"color: hotpink;",pre:"",console:"log"},names:["error","warn","info","log","debug","trace"],reset:"color: inherit;",head:"font-weight:bold; font-style:italic;",level:"font-weight:bold; border-radius: 3px; padding: 2px 5px; display:inline-block;"};l.default=1;var B,ge;try{ge=document.currentScript,B=ge.getAttribute("logLevel")}catch{}if(B===void 0)try{B=new URL(di.url).searchParams.get("logLevel")}catch{}B!==void 0&&(B=Number(B),isNaN(B)?(console.warn('[Uib:constructor] Cannot set logLevel to "'.concat(ge==null?void 0:ge.getAttribute("logLevel"),'". Defaults to 0 (error).')),l.default=0):l.default=B);l.level=l.default;function It(s){if(s===void 0)s='<span class="undefined">undefined</span>';else try{s=JSON.stringify(s,void 0,4),s=s.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g,function(e){let t="number";return/^"/.test(e)?/:$/.test(e)?t="key":t="string":/true|false/.test(e)?t="boolean":/null/.test(e)&&(t="null"),'<span class="'.concat(t,'">').concat(e,"</span>")})}catch(e){s="Syntax Highlight ERROR: ".concat(e.message)}return s}var b=new et(window,l,It),C,W,x,R,k,we,re,se,z,ne,$e,ve,_e,H,ke,ui=(C=class{constructor(){u(this,"connectedNum",0);u(this,"_ioChannels",{control:"uiBuilderControl",client:"uiBuilderClient",server:"uiBuilder"});v(this,W);v(this,x,{});v(this,R,{});u(this,"isVue",!1);u(this,"vueVersion");v(this,k,null);v(this,we);u(this,"_socket");u(this,"_htmlObserver");v(this,re,!1);v(this,se,!1);v(this,z,!1);v(this,ne,0);v(this,$e,["elementExists","get","getManagedVarList","getWatchedVars","htmlSend","include","navigate","scrollTo","set","showMsg","showStatus","uiGet","uiWatch","watchUrlHash"]);v(this,ve,{});v(this,_e,{online:{var:"online",label:"Online?",description:"Is the browser online?"},ioConnected:{var:"ioConnected",label:"Socket.IO connected?",description:"Is Socket.IO connected?"},connectedNum:{var:"connectedNum",label:"# reconnections",description:"How many times has Socket.IO had to reconnect since last page load?"},clientId:{var:"clientId",label:"Client ID",description:"Static client unique id set in Node-RED. Only changes when browser is restarted."},tabId:{var:"tabId",label:"Browser tab ID",description:"Static unique id for the browser's current tab"},cookies:{var:"cookies",label:"Cookies",description:"Cookies set in Node-RED"},httpNodeRoot:{var:"httpNodeRoot",label:"httpNodeRoot",description:"From Node-RED' settings.js, affects URL's. May be wrong for pages in sub-folders"},pageName:{var:"pageName",label:"Page name",description:"Actual name of this page"},ioNamespace:{var:"ioNamespace",label:"SIO namespace",description:"Socket.IO namespace - unique to each uibuilder node instance"},socketError:{var:"socketError",label:"Socket error",description:"If the Socket.IO connection has failed, says why"},msgsSent:{var:"msgsSent",label:"# msgs sent",description:"How many standard messages have been sent to Node-RED?"},msgsReceived:{var:"msgsReceived",label:"# msgs received",description:"How many standard messages have been received from Node-RED?"},msgsSentCtrl:{var:"msgsSentCtrl",label:"# control msgs sent",description:"How many control messages have been sent to Node-RED?"},msgsCtrlReceived:{var:"msgsCtrlReceived",label:"# control msgs received",description:"How many control messages have been received from Node-RED?"},originator:{var:"originator",label:"Node Originator",description:"If the last msg from Node-RED was from a `uib-sender` node, this will be its node id so that messasges can be returned to it"},topic:{var:"topic",label:"Default topic",description:"Optional default topic to be included in outgoing standard messages"},started:{var:"started",label:"Has uibuilder client started?",description:"Whether `uibuilder.start()` ran successfully. This should self-run and should not need to be run manually"},version:{var:"version",label:"uibuilder client version",description:"The version of the loaded uibuilder client library"},serverTimeOffset:{var:"serverTimeOffset",label:"Server time offset (Hrs)",description:"The number of hours difference between the Node-red server and the client"}});v(this,H,{});u(this,"uibAttribs",["uib-topic","data-uib-topic"]);v(this,ke,"[".concat(this.uibAttribs.join("], ["),"]"));u(this,"clientId","");u(this,"cookies",{});u(this,"ctrlMsg",{});u(this,"ioConnected",!1);u(this,"isMinified",hi);u(this,"isVisible",!1);u(this,"lastNavType","");u(this,"maxHttpBufferSize",1048576);u(this,"msg",{});u(this,"msgsSent",0);u(this,"msgsReceived",0);u(this,"msgsSentCtrl",0);u(this,"msgsCtrlReceived",0);u(this,"online",navigator.onLine);u(this,"sentCtrlMsg",{});u(this,"sentMsg",{});u(this,"serverTimeOffset",null);u(this,"socketError",null);u(this,"tabId","");u(this,"pageName",null);u(this,"purify",!1);u(this,"markdown",!1);u(this,"urlHash",location.hash);u(this,"originator","");u(this,"topic");u(this,"uibrouterinstance");u(this,"uibrouter_CurrentRoute");u(this,"autoSendReady",!0);u(this,"httpNodeRoot","");u(this,"ioNamespace","");u(this,"ioPath","");u(this,"retryFactor",1.5);u(this,"retryMs",2e3);u(this,"storePrefix","uib_");u(this,"started",!1);u(this,"socketOptions",{path:this.ioPath,transports:["polling","websocket"],auth:e=>{e({clientVersion:Lt,clientId:this.clientId,pathName:window.location.pathname,urlParams:Object.fromEntries(new URLSearchParams(location.search)),pageName:this.pageName,tabId:this.tabId,lastNavType:this.lastNavType,connectedNum:++this.connectedNum,browserConnectTimestamp:new Date().toISOString()})},transportOptions:{polling:{extraHeaders:{"x-clientid":"".concat(C._meta.displayName,"; ").concat(C._meta.type,"; ").concat(C._meta.version,"; ").concat(this.clientId)}}}});u(this,"$",b.$);u(this,"$$",b.$$);u(this,"$ui",b);u(this,"addClass",b.addClass);u(this,"applyTemplate",b.applyTemplate);u(this,"removeClass",b.removeClass);if(l("trace","Uib:constructor","Starting")(),window.addEventListener("offline",e=>{this.set("online",!1),this.set("ioConnected",!1),l("warn","Browser","DISCONNECTED from network")()}),window.addEventListener("online",e=>{this.set("online",!0),l("warn","Browser","Reconnected to network")(),this._checkConnect()}),document.cookie.split(";").forEach(e=>{let t=e.split("=");this.cookies[t[0].trim()]=t[1]}),this.set("clientId",this.cookies["uibuilder-client-id"]),l("trace","Uib:constructor","Client ID: ",this.clientId)(),this.set("tabId",window.sessionStorage.getItem("tabId")),this.tabId||(this.set("tabId","t".concat(Math.floor(Math.random()*1e6))),window.sessionStorage.setItem("tabId",this.tabId)),document.addEventListener("load",()=>{this.set("isVisible",!0)}),document.addEventListener("visibilitychange",()=>{this.set("isVisible",document.visibilityState==="visible"),this.sendCtrl({uibuilderCtrl:"visibility",isVisible:this.isVisible})}),document.addEventListener("uibuilder:propertyChanged",e=>{p(this,se)&&e.detail.prop in p(this,_e)&&(document.querySelector('td[data-vartype="'.concat(e.detail.prop,'"]')).innerText=JSON.stringify(e.detail.value))}),this.set("ioNamespace",this._getIOnamespace()),"uibuilder-webRoot"in this.cookies)this.set("httpNodeRoot",this.cookies["uibuilder-webRoot"]),l("trace","Uib:constructor",'httpNodeRoot set by cookie to "'.concat(this.httpNodeRoot,'"'))();else{let e=window.location.pathname.split("/").filter(function(t){return t.trim()!==""});e.length>0&&e[e.length-1].endsWith(".html")&&e.pop(),e.pop(),this.set("httpNodeRoot","/".concat(e.join("/"))),l("trace","[Uib:constructor]",'httpNodeRoot set by URL parsing to "'.concat(this.httpNodeRoot,'". NOTE: This may fail for pages in sub-folders.'))()}this.set("ioPath",this.urlJoin(this.httpNodeRoot,C._meta.displayName,"vendor","socket.io")),l("trace","Uib:constructor",'ioPath: "'.concat(this.ioPath,'"'))(),this.set("pageName",window.location.pathname.replace("".concat(this.ioNamespace,"/"),"")),this.pageName.endsWith("/")&&this.set("pageName","".concat(this.pageName,"index.html")),this.pageName===""&&this.set("pageName","index.html");try{let e=this.getStore("_uibAutoloadVars");Object.keys(e).length>0&&Object.keys(e).forEach(t=>{this.set(t,this.getStore(t))})}catch{}this._dispatchCustomEvent("uibuilder:constructorComplete"),l("trace","Uib:constructor","Ending")()}set logLevel(e){l.level=e,console.log("%c\u2757 info%c [logLevel]","".concat(l.LOG_STYLES.level," ").concat(l.LOG_STYLES.info.css),"".concat(l.LOG_STYLES.head," ").concat(l.LOG_STYLES.info.txtCss),"Set to ".concat(e," (").concat(l.LOG_STYLES.names[e],")"))}get logLevel(){return l.level}get meta(){return C._meta}set(e,t,i=!1,r=!1){var o;if(e.startsWith("_")||e.startsWith("#"))return l("warn","Uib:set",'Cannot use set() on protected property "'.concat(e,'"'))(),'Cannot use set() on protected property "'.concat(e,'"');let n=(o=this[e])!=null?o:void 0;return this[e]=t,p(this,ve)[e]=e,i===!0&&this.setStore(e,t,r),l("trace","Uib:set","prop set - prop: ".concat(e,", val: "),t," store: ".concat(i,", autoload: ").concat(r))(),this._dispatchCustomEvent("uibuilder:propertyChanged",{prop:e,value:t,oldValue:n,store:i,autoload:r}),this._dispatchCustomEvent("uibuilder:propertyChanged:".concat(e),{prop:e,value:t,oldValue:n,store:i,autoload:r}),t}get(e){if(e.startsWith("_")||e.startsWith("#")){l("warn","Uib:get",'Cannot use get() on protected property "'.concat(e,'"'))();return}return e==="version"?C._meta.version:e==="msgsCtrl"?this.msgsCtrlReceived:e==="reconnections"?this.connectedNum:(this[e]===void 0&&l("warn","Uib:get",'get() - property "'.concat(e,'" is undefined'))(),this[e])}setStore(e,t,i=!1){let r={};if(i===!0)try{r=this.getStore("_uibAutoloadVars")||{}}catch{}if(typeof t=="object")try{t=JSON.stringify(t)}catch(n){return l("error","Uib:setStore","Cannot stringify object, not storing. ",n)(),!1}try{if(localStorage.setItem(this.storePrefix+e,t),i){r[e]=e;try{localStorage.setItem(this.storePrefix+"_uibAutoloadVars",JSON.stringify(r))}catch(n){l("error","Uib:setStore","Cannot save autoload list. ",n)()}}return this._dispatchCustomEvent("uibuilder:propertyStored",{prop:e,value:t,autoload:i}),!0}catch(n){return l("error","Uib:setStore","Cannot write to localStorage. ",n)(),!1}}getStore(e){try{return JSON.parse(localStorage.getItem(this.storePrefix+e))}catch{}try{return localStorage.getItem(this.storePrefix+e)}catch{return}}removeStore(e){try{localStorage.removeItem(this.storePrefix+e)}catch{}}getManagedVarList(){return p(this,ve)}getWatchedVars(){return Object.keys(p(this,x))}_dispatchCustomEvent(e,t){let i=new CustomEvent(e,{detail:t});document.dispatchEvent(i)}onChange(e,t){p(this,x)[e]?p(this,x)[e]._nextRef++:p(this,x)[e]={_nextRef:1};let i=p(this,x)[e]._nextRef,r=p(this,x)[e][i]=function(o){if(e===o.detail.prop){let c=o.detail.value;t.call(c,c)}};return document.addEventListener("uibuilder:propertyChanged",r),i}cancelChange(e,t){document.removeEventListener("uibuilder:propertyChanged",p(this,x)[e][t]),delete p(this,x)[e][t]}onTopic(e,t){p(this,R)[e]?p(this,R)[e]._nextRef++:p(this,R)[e]={_nextRef:1};let i=p(this,R)[e]._nextRef,r=p(this,R)[e][i]=function(o){let c=o.detail;c.topic===e&&t.call(c,c)};return document.addEventListener("uibuilder:stdMsgReceived",r),i}cancelTopic(e,t){document.removeEventListener("uibuilder:stdMsgReceived",p(this,R)[e][t]),delete p(this,R)[e][t]}_checkTimestamp(e){if(Object.prototype.hasOwnProperty.call(e,"serverTimestamp")){let t=new Date(e.serverTimestamp),i=Math.round((new Date-t)/36e5);i!==this.serverTimeOffset&&(l("trace","Uib:checkTimestamp:".concat(this._ioChannels.server," (server)"),"Offset changed to: ".concat(i," from: ").concat(this.serverTimeOffset))(),this.set("serverTimeOffset",i))}}_watchHashChanges(){this.set("urlHash",location.hash),window.addEventListener("hashchange",e=>{this.set("urlHash",location.hash),p(this,z)===!0&&this.send({topic:"hashChange",payload:location.hash,newHash:this.keepHashFromUrl(e.newURL),oldHash:this.keepHashFromUrl(e.oldURL)})})}arrayIntersect(e,t){return e.filter(i=>t.includes(i))}copyToClipboard(e){let t="";try{t=JSON.stringify(this.get(e))}catch(i){l("error","copyToClipboard",'Could not copy "'.concat(e,'" to clipboard.'),i.message)()}navigator.clipboard.writeText(t)}elementExists(e,t=!0){let i=document.querySelector(e),r=!1;return i!==null&&(r=!0),t===!0&&this.send({payload:r,info:'Element "'.concat(e,'" ').concat(r?"exists":"does not exist")}),r}formatNumber(e,t,i,r){if(isNaN(e))return l("error","formatNumber",'Value must be a number. Value type: "'.concat(typeof e,'"'))(),"NaN";r||(r={}),i||(i=navigator.language?navigator.language:"en-GB"),t&&(r.minimumFractionDigits=t,r.maximumFractionDigits=t);let n;try{n=Number(e).toLocaleString(i,r)}catch(o){return l("error","formatNumber","".concat(o.message,". value=").concat(e,", dp=").concat(t,', intl="').concat(i,'", opts=').concat(JSON.stringify(r)))(),"NaN"}return n}getObjectSize(e){let t;try{let i=JSON.stringify(e);t=new TextEncoder().encode(i).length}catch(i){l("error","uibuilder:getObjectSize","Could not stringify, cannot determine size",e,i)()}return t}hasUibRouter(){return!!this.uibrouterinstance}keepHashFromUrl(e){return e?"#"+e.replace(/^.*#(.*)/,"$1").replace(/\?.*$/,""):""}log(){l(...arguments)()}makeMeAnObject(e,t){t||(t="payload"),typeof t!="string"&&(l("warn","uibuilder:makeMeAnObject","WARNING: property parameter must be a string and not: ".concat(typeof t))(),t="payload");let i={};return e!==null&&e.constructor.name==="Object"?i=e:e!==null&&(i[t]=e),i}navigate(e){return e&&(window.location.href=e),window.location}resolveDataSource(e){try{let t=e.split(/[\.\[\]\'\"]/).filter(Boolean),i=window;for(let r of t)i=i==null?void 0:i[r];return i}catch(t){return l("error","uibuilder:resolveDataSource",'Error resolving data source "'.concat(e,"\", returned 'null'. ").concat(t.message))(),null}}round(e,t){let i=Math.pow(10,t||0),r=e*i*(1+Number.EPSILON);return Math.round(r)/i}setOriginator(e=""){this.set("originator",e)}setPing(e=0){let t=new XMLHttpRequest;t.addEventListener("load",()=>{let i=t.getAllResponseHeaders().split("\r\n"),r=Number(new Date)-Number(t.responseURL.split("=")[1]);this.set("ping",{success:t.status===201||t.status===204,status:t.status,headers:i,url:t.responseURL,elapsedTime:r})}),p(this,W)&&(clearInterval(p(this,W)),_(this,W,void 0)),t.open("GET","".concat(this.httpNodeRoot,"/uibuilder/ping?t=").concat(Number(new Date))),t.send(),e>0&&_(this,W,setInterval(()=>{t.open("GET","".concat(this.httpNodeRoot,"/uibuilder/ping?t=").concat(Number(new Date))),t.send()},e))}syntaxHighlight(e){return It(e)}truthy(e,t){let i;return["on","On","ON","true","True","TRUE","1",!0,1].includes(e)?i=!0:["off","Off","OFF","false","False","FALSE","0",!1,0].includes(e)?i=!1:i=t,i}urlJoin(){return("/"+Array.prototype.slice.call(arguments).map(function(i){return i.replace(/^\/|\/$/g,"")}).filter(function(i){return i}).join("/")).replace("//","/")}watchUrlHash(e){return _(this,z,this.truthy(e,p(this,z)!==!0)),p(this,z)}elementIsVisible(){return l("error","uib:elementIsVisible","elementIsVisible has been temporarily DEPRECATED as it was not working correctly and a fix is complex")(),this.send({payload:"elementIsVisible has been temporarily DEPRECATED as it was not working correctly and a fix is complex"}),!1}buildHtmlTable(e,t={}){return b.buildHtmlTable(e,t)}createTable(e=[],t={parent:"body"}){b.createTable(e,t)}convertMarkdown(e){return b.convertMarkdown(e)}async include(e,t){await b.include(e,t)}loadScriptSrc(e){b.loadScriptSrc(e)}loadStyleSrc(e){b.loadStyleSrc(e)}loadScriptTxt(e){b.loadScriptTxt(e)}loadStyleTxt(e){b.loadStyleTxt(e)}loadui(e){b.loadui(e)}replaceSlot(e,t){b.replaceSlot(e,t)}replaceSlotMarkdown(e,t){b.replaceSlotMarkdown(e,t)}sanitiseHTML(e){return b.sanitiseHTML(e)}tblAddListener(e,t={},i={}){b.tblAddListener(e,t,i)}tblAddRow(e,t={},i={}){return b.tblAddRow(e,t,i)}tblRemoveRow(e,t,i={}){b.tblRemoveRow(e,t,i)}showDialog(e,t,i){b.showDialog(e,t,i)}ui(e){b.ui(e)}uiGet(e,t=null){return b.uiGet(e,t)}uiEnhanceElement(e,t){b.uiEnhanceElement(e,t)}async _uibAttribObserver(e){e.forEach(async t=>{l("trace","uibuilder:_uibAttribObserver","Mutations ",t)(),t.attributeName&&(t.attributeName.startsWith("uib")||t.attributeName.startsWith("data-uib"))?this._uibAttrScanOne(t.target):t.addedNodes.length>0&&t.addedNodes.forEach(async i=>{let r=[];try{r=[...i.attributes]}catch{}this.arrayIntersect(this.uibAttribs,r).forEach(async c=>{this._uibAttrScanOne(c)});let o=[];i.querySelectorAll&&(o=i.querySelectorAll(p(this,ke))),o.forEach(async c=>{this._uibAttrScanOne(c)})})})}async _uibAttrScanOne(e){l("trace","uibuilder:_uibAttrScanOne","Setting up auto-processor for: ",e)();let t=e.getAttribute("uib-topic")||e.getAttribute("data-uib-topic");this.onTopic(t,i=>{if(l("trace","uibuilder:_uibAttrScanOne",'Msg with topic "'.concat(t,'" received. msg content: '),i)(),i._uib_processed_by="_uibAttrScanOne",Object.prototype.hasOwnProperty.call(i,"attributes"))try{for(let[o,c]of Object.entries(i.attributes))e.setAttribute(o,c)}catch{l(0,"uibuilder:attribute-processing","Failed to set attributes. Ensure that msg.attributes is an object containing key/value pairs with each key a valid attribute name. Note that attribute values have to be a string.")()}if(Object.prototype.hasOwnProperty.call(i,"dataset")){console.log("uibuilder:dataset-processing","Processing dataset for element",e,i.dataset);try{for(let[o,c]of Object.entries(i.dataset))e.dataset[o]=c}catch{l("error","uibuilder:dataset-processing","Failed to set dataset. Ensure that msg.dataset is an object containing key/value pairs with each key a valid dataset name. Note that dataset values have to be a string.")()}}let r=Object.prototype.hasOwnProperty.call(i,"checked"),n=Object.prototype.hasOwnProperty.call(i,"value");(n||r)&&(e.type&&(e.type==="checkbox"||e.type==="radio")?r?e.checked=this.truthy(i.checked,!1):n&&(e.checked=this.truthy(i.value,!1)):n?e.value=i.value:r&&(e.value=this.truthy(i.checked,!1))),Object.prototype.hasOwnProperty.call(i,"payload")&&this.replaceSlot(e,i.payload)})}async _uibAttrScanAll(e){Array.isArray(e)||(e=[e]),e.forEach(async t=>{let i=t.querySelectorAll(p(this,ke));i.length>0&&i.forEach(r=>{this._uibAttrScanOne(r)})})}_processFilesInput(e,t=!1){let i=[],r=e.files,n=r.length,o=0;for(let c of r){let h={};o++;for(let f in c)h[f]=c[f];h.tempUrl=window.URL.createObjectURL(c),i.push(h);let d={seq:o,seqCount:n};d.id=e.id,e.form&&(d.formId=e.form.id),d.tempUrl=h.tempUrl,d.data=e.dataset,t!==!0&&this.uploadFile(c,d)}return i}getElementAttributes(e){let t=["class","id","name"],i;try{i=Object.assign({},...Array.from(e.attributes,({name:r,value:n})=>{if(!t.includes(r))return{[r]:n}}))}catch{}return i}getElementClasses(e){let t;try{t=Array.from(e.classList)}catch{}return t}getElementCustomProps(e){let t={};return Object.keys(e).forEach(i=>{i.startsWith("_")||(t[i]=e[i])}),t}getFormElementValue(e){let t=null,i=null;switch(e.type){case"checkbox":case"radio":{t=i=e.checked;break}case"select-multiple":{t=Array.from(e.selectedOptions).map(r=>r.value);break}default:{e.value&&(t=e.value),e.checked&&(t=i=e.checked),e.valueAsNumber&&!isNaN(e.valueAsNumber)&&(t=e.valueAsNumber);break}}return{value:t,checked:i}}getFormElementDetails(e){if(!e.type)return l(1,"uibuilder:getFormElementDetails","Cannot get form element details as this is not an input type element")(),null;let t=this.returnElementId(e);if(!t)return l(1,"uibuilder:getFormElementDetails","Cannot get form element details as no id is present and could not be generated")(),null;let{value:i,checked:r}=this.getFormElementValue(e),n={id:t,name:e.name,valid:e.checkValidity(),type:e.type};if(i!==null&&(n.value=i),r!==null&&(n.checked=r),n.valid===!1){let o=e.validity;n.validity={badInput:o.badInput===!0?o.badInput:void 0,customError:o.customError===!0?o.customError:void 0,patternMismatch:o.patternMismatch===!0?o.patternMismatch:void 0,rangeOverflow:o.rangeOverflow===!0?o.rangeOverflow:void 0,rangeUnderflow:o.rangeUnderflow===!0?o.rangeUnderflow:void 0,stepMismatch:o.stepMismatch===!0?o.stepMismatch:void 0,tooLong:o.tooLong===!0?o.tooLong:void 0,tooShort:o.tooShort===!0?o.tooShort:void 0,typeMismatch:o.typeMismatch===!0?o.typeMismatch:void 0,valueMissing:o.valueMissing===!0?o.valueMissing:void 0}}return Object.keys(e.dataset).length>0&&(n.data=e.dataset),n}notify(e){return e.return?b.notification(e):(b.notification(e).then(t=>{l("info","Uib:notification","Notification completed event",t)()}).catch(t=>{l("error","Uib:notification","Notification error event",t)()}),null)}returnElementId(e){return e.id!==""?e.id:e.name!==""?"".concat(e.name,"-").concat(++Ce(this,ne)._):e.type?"".concat(e.type,"-").concat(++Ce(this,ne)._):"".concat(e.localName,"-").concat(++Ce(this,ne)._)}scrollTo(e,t){t||(t={}),!e||e==="top"||e==="start"?e="body":(e==="bottom"||e==="end")&&(e="body",t.block="end");let i=this.$(e);return i?(i.scrollIntoView(t),!0):!1}showMsg(e,t="body"){e===void 0&&(e=!p(this,re)),_(this,re,e);let i="Waiting for a message from Node-RED";return this.msg&&Object.keys(this.msg).length>0&&(i=this.syntaxHighlight(this.msg)),e===!1?b._uiRemove({components:["#uib_last_msg_wrap"]}):b._uiReplace({components:[{type:"div",id:"uib_last_msg_wrap",parent:t,attributes:{title:"Last message from Node-RED"},components:[{type:"button",attributes:{onclick:'uibuilder.copyToClipboard("msg")',class:"compact",style:"right:3em;"},slot:"\u{1F4CB}"},{type:"button",attributes:{onclick:"uibuilder.showMsg()",class:"compact",style:"right:.5em;"},slot:"\u26D4"},{type:"pre",id:"uib_last_msg",attributes:{class:"syntax-highlight"},slot:i}]}]}),e}showStatus(e,t="body"){if(e===void 0&&(e=!p(this,se)),_(this,se,e),e===!1)return b._uiRemove({components:["#uib_status"]}),e;let i={components:[{type:"div",id:"uib_status",parent:t,attributes:{title:"Current status of the uibuilder client",class:"text-smaller"},components:[{type:"table",components:[{type:"tbody",components:[]}]}]}]},r=i.components[0].components[0].components[0].components;return Object.values(p(this,_e)).forEach(n=>{r.push({type:"tr",attributes:{title:n.description},components:[{type:"th",slot:n.label},{type:"td",attributes:{"data-varType":n.var},slot:n.var==="version"?C._meta.version:JSON.stringify(this[n.var])}]})}),b._uiReplace(i),e}uiWatch(e,t="toggle",i=!0,r=!0){let n=document.querySelector(e);if(!n)return l("warn","uibuilder.module.js:uiWatch","CSS Selector '".concat(e,"' not found."))(),!1;(t==="toggle"||t===void 0||t===null)&&(p(this,H)[e]?t=!1:t=!0);let o=this;return t===!0?(p(this,H)[e]=new MutationObserver(function(c){let h=[];c.forEach(d=>{let f={type:d.type,oldValue:d.oldValue!==null?d.oldValue:void 0};d.addedNodes.length>0&&(f.addedNodes=[],d.addedNodes.forEach((m,w)=>{f.addedNodes.push(b.nodeGet(d.addedNodes[w]))})),d.removedNodes.length>0&&(f.removedNodes=[],d.removedNodes.forEach((m,w)=>{f.removedNodes.push(b.nodeGet(d.removedNodes[w]))})),d.type==="attributes"&&(f.attributeName=d.attributeName,f.newValue=d.target.attributes[d.attributeName].value),h.push(f)}),o._dispatchCustomEvent("uibuilder:domChange",h),i===!0&&o.send({_ui:{cssSelector:e,uiChanges:h},topic:o.topic||"DOM Changes for '".concat(e,"'")}),r===!0&&l("info","uibuilder.module.js:uiWatch","DOM Changes for '".concat(e,"'"),{uiChanges:h},{mutationList:c})()}),p(this,H)[e].observe(n,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),l("trace","uibuilder.module.js:uiWatch","Started Watching DOM changes for '".concat(e,"'"))()):(p(this,H)[e].disconnect(),delete p(this,H)[e],l("trace","uibuilder.module.js:uiWatch","Stopped Watching DOM changes for '".concat(e,"'"))()),t}watchDom(e){let t=document.documentElement,i=this;this._htmlObserver||(this._htmlObserver=new MutationObserver(function(){this.takeRecords(),i.saveHtmlCache()})),e===!0||e===void 0?(this._htmlObserver.observe(t,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),l("trace","uibuilder.module.js:watchDom","Started Watching and saving DOM changes")()):(this._htmlObserver.disconnect(),l("trace","uibuilder.module.js:watchDom","Stopped Watching and saving DOM changes")())}clearHtmlCache(){this.removeStore("htmlCache"),l("trace","uibuilder.module.js:clearHtmlCache","HTML cache cleared")()}restoreHtmlFromCache(){let e=this.getStore("htmlCache");if(e){let t=document.getElementsByTagName("html")[0];t.innerHTML=e,l("trace","uibuilder.module.js:restoreHtmlFromCache","Restored HTML from cache")()}else l("trace","uibuilder.module.js:restoreHtmlFromCache","No cache to restore")()}saveHtmlCache(){this.setStore("htmlCache",document.documentElement.innerHTML)}_ctrlMsgFromServer(e){if(e===null)e={};else if(typeof e!="object"){let t={};t["uibuilderCtrl:"+this._ioChannels.control]=e,e=t}switch(this._checkTimestamp(e),this.set("ctrlMsg",e),this.set("msgsCtrlReceived",++this.msgsCtrlReceived),l("trace","Uib:ioSetup:_ctrlMsgFromServer","Channel '".concat(this._ioChannels.control,"'. Received control msg #").concat(this.msgsCtrlReceived),e)(),e.uibuilderCtrl){case"shutdown":{l("info","Uib:ioSetup:".concat(this._ioChannels.control),'\u274C Received "shutdown" from server')(),this.set("serverShutdown",void 0);break}case"client connect":{l("trace","Uib:ioSetup:".concat(this._ioChannels.control),'Received "client connect" from server',e)(),l("info","Uib:ioSetup:".concat(this._ioChannels.control),"\u2705 Server connected. Version: ".concat(e.version,"\nServer time: ").concat(e.serverTimestamp,", Sever time offset: ").concat(this.serverTimeOffset," hours. Max msg size: ").concat(e.maxHttpBufferSize))(),C._meta.version.startsWith(e.version.split("-")[0])||l("warn","Uib:ioSetup:".concat(this._ioChannels.control),"Server version (".concat(e.version,") not the same as the client version (").concat(C._meta.version,")"))(),this.autoSendReady===!0&&l("trace","Uib:ioSetup:".concat(this._ioChannels.control,"/client connect"),"Auto-sending ready-for-content/replay msg to server"),this.maxHttpBufferSize=e.maxHttpBufferSize;break}case"get page meta":{this.set("pageMeta",e.payload);break}default:l("trace","uibuilder:ioSetup:".concat(this._ioChannels.control),"Received ".concat(e.uibuilderCtrl," from server"))}}_forThis(e){let t=!0;return e.pageName&&e.pageName!==this.pageName&&(l("trace","Uib:_msgRcvdEvents:_uib","Not for this page")(),t=!1),e.clientId&&e.clientId!==this.clientId&&(l("trace","Uib:_msgRcvdEvents:_uib","Not for this clientId")(),t=!1),e.tabId&&e.tabId!==this.tabId&&(l("trace","Uib:_msgRcvdEvents:_uib","Not for this tabId")(),t=!1),t}_msgRcvdEvents(e){if(this._dispatchCustomEvent("uibuilder:stdMsgReceived",e),e.topic&&this._dispatchCustomEvent("uibuilder:msg:topic:".concat(e.topic),e),!e._uib_processed_by){if(e._uib_processed_by="_msgRcvdEvents",e._uib){if(!this._forThis(e._uib))return;if(e._uib.reload===!0){l("trace","Uib:_msgRcvdEvents:_uib:reload","reloading")(),e._uib_processed_by="_msgRcvdEvents - reload",location.reload();return}if(e._uib.command){e._uib_processed_by="_msgRcvdEvents - remote command",this._uibCommand(e);return}e._uib.componentRef==="globalNotification"&&(e._uib_processed_by="_msgRcvdEvents - globalNotification",b.showDialog("notify",e._uib.options,e)),e._uib.componentRef==="globalAlert"&&(e._uib_processed_by="_msgRcvdEvents - globalAlert",b.showDialog("alert",e._uib.options,e))}if(e._ui){if(!this._forThis(e._ui))return;l("trace","Uib:_msgRcvdEvents:_ui","Calling _uiManager")(),e._uib_processed_by="_msgRcvdEvents - _ui",this._dispatchCustomEvent("uibuilder:msg:_ui",e),b._uiManager(e)}}}_send(e,t,i=""){t==null&&(t=this._ioChannels.client),t===this._ioChannels.client?(e=this.makeMeAnObject(e,"payload"),this.hasUibRouter()&&(e._uib||(e._uib={}),e._uib.routeId=this.uibrouter_CurrentRoute)):t===this._ioChannels.control&&(e=this.makeMeAnObject(e,"uibuilderCtrl"),Object.prototype.hasOwnProperty.call(e,"uibuilderCtrl")||(e.uibuilderCtrl="manual send"),e.from="client",this.hasUibRouter()&&(e.routeId=this.uibrouter_CurrentRoute)),e._socketId=this._socket.id,i===""&&this.originator!==""&&(i=this.originator),i!==""&&Object.assign(e,{_uib:{originator:i}}),Object.prototype.hasOwnProperty.call(e,"topic")||(this.topic!==void 0&&this.topic!==""?e.topic=this.topic:Object.prototype.hasOwnProperty.call(this,"msg")&&Object.prototype.hasOwnProperty.call(this.msg,"topic")&&(e.topic=this.msg.topic)),e._ui&&(e._ui.from="client",this.hasUibRouter()&&(e._ui.routeId=this.uibrouter_CurrentRoute));let r;t===this._ioChannels.client?(this.set("sentMsg",e),r=this.set("msgsSent",++this.msgsSent)):t===this._ioChannels.control&&(this.set("sentCtrlMsg",e),r=this.set("msgsSentCtrl",++this.msgsSentCtrl)),l("trace","Uib:_send"," Channel '".concat(t,"'. Sending msg #").concat(r),e)(),this._socket.emit(t,e)}_stdMsgFromServer(e){e=this.makeMeAnObject(e,"payload"),!(e._uib&&!this._forThis(e._uib))&&(e._ui&&!this._forThis(e._ui)||(this._checkTimestamp(e),this.set("msgsReceived",++this.msgsReceived),this._msgRcvdEvents(e),"_ui"in e&&!("payload"in e)||this.set("msg",e),l("info","Uib:ioSetup:stdMsgFromServer","Channel '".concat(this._ioChannels.server,"'. Received msg #").concat(this.msgsReceived,"."),e)()))}_uibCommand(e){var h;if(!e._uib||!e._uib.command){l("error","uibuilder:_uibCommand","Invalid command message received",{msg:e})(),e.payload=e.error="Invalid command message received",this.send(e);return}let t=e._uib.command;if(!p(this,$e).includes(t.trim())){l("error","Uib:_uibCommand","Command '".concat(t," is not allowed to be called externally"))();return}let i=e._uib.prop,r=e._uib.value,n=(h=e._uib.quiet)!=null?h:!1,o,c;switch(t){case"elementExists":{o=this.elementExists(i,!1),c='Element "'.concat(i,'" ').concat(o?"exists":"does not exist");break}case"get":{o=this.get(i);break}case"getManagedVarList":{i==="full"?o=this.getManagedVarList():o=Object.values(this.getManagedVarList());break}case"getWatchedVars":{i==="full"?o=this.getWatchedVars():o=Object.values(this.getWatchedVars());break}case"sendHtml":case"htmlSend":{o=this.htmlSend("",!1);break}case"include":{o=b.include(i,r);break}case"navigate":{let d;i?d=i:r&&(d=r),o=this.navigate(d);break}case"scrollTo":{o=this.scrollTo(i,r);break}case"set":{let d=!1,f=!1;e._uib.options&&e._uib.options.store&&(e._uib.options.store===!0&&(d=!0),e._uib.options.autoload===!0&&(f=!0)),o=this.set(i,r,d,f);break}case"showMsg":{o=this.showMsg(r,i);break}case"showStatus":{o=this.showStatus(r,i);break}case"uiGet":{o=b.uiGet(i,r);break}case"uiWatch":{o=this.uiWatch(i);break}case"watchUrlHash":{o=this.watchUrlHash(i);break}default:{l("warning","Uib:_uibCommand","Command '".concat(t,"' not yet implemented"))();break}}n!==!0&&(o===void 0&&(o="'".concat(i,"' is undefined")),Object(o).constructor===Promise?o.then(d=>(e.payload=e._uib.response=d,e.info=e._uib.info=c,e.topic||(e.topic=this.topic||"uib ".concat(t," for '").concat(i,"'")),this.send(e),!0)).catch(d=>{l(0,"Uib:_uibCommand","Error: ",d)()}):(e.payload=e._uib.response=o,e.info=e._uib.info=c,e.topic||(e.topic=this.topic||"uib ".concat(t," for '").concat(i,"'")),this.send(e)))}beaconLog(e,t){t||(t="debug"),navigator.sendBeacon("./_clientLog","".concat(t,"::").concat(e))}getPageMeta(){this.sendCtrl({uibuilderCtrl:"get page meta"})}htmlSend(e="",t=!0){let i="<!doctype html>\n".concat(document.documentElement.outerHTML),r={payload:i,length:i.length,topic:this.topic};return l("trace","Uib:htmlSend","Sending full HTML to Node-RED",r)(),t===!0&&this._send(r,this._ioChannels.client,e),i}logToServer(){this.sendCtrl({uibuilderCtrl:"client log message",payload:arguments,_socketId:this._socket.id,clientId:this.clientId,tabId:this.tabId,pageName:this.pageName,connections:this.connectedNum,lastNavType:this.lastNavType})}eventSend(e,t=""){if(this.$attrs){l("error","Uib:eventSend","`this` has been usurped by VueJS. Make sure that you wrap the call in a function: `doEvent: function (event) { uibuilder.eventSend(event) },`")();return}if(!e&&!event){l("warn","Uib:eventSend","Neither the domevent nor the hidden event properties are set. You probably called this function directly rather than applying to an on click event.")();return}if((!e||!e.constructor)&&(e=event),!e.constructor.name.endsWith("Event")||!e.currentTarget){l("warn","Uib:eventSend","ARGUMENT NOT A DOM EVENT - use data attributes not function arguments to pass data. Arg Type: ".concat(e.constructor.name),e)();return}e.preventDefault();let i=e.currentTarget,r=this.getElementCustomProps(i),n=this.getElementAttributes(i),o={},c;i.form?(c={id:this.returnElementId(i.form),valid:i.form.checkValidity()},Object.values(i.form).forEach((G,K)=>{if(["fieldset","object"].includes(G.type))return;let N=this.getFormElementDetails(G);N&&(G.type==="file"&&G.files.length>0&&(N.value=this._processFilesInput(G)),c[N.id]=N,o[N.id]=N.value)})):i.type==="file"&&(o=this._processFilesInput(i));let h=this.getElementClasses(i);Object.keys(i.dataset).length>0&&(o={...o,...i.dataset});let{value:d,checked:f}=this.getFormElementValue(i);d!==null&&(o.value=d),f!==null&&(o.checked=f);let m;Object.prototype.toString.call(i)==="[object Notification]"&&(o="notification-".concat(i.userAction),m={actions:i.actions,badge:i.badge,body:i.body,data:i.data,dir:i.dir,icon:i.icon,image:i.image,lang:i.lang,renotify:i.renotify,requireInteraction:i.requireInteraction,silent:i.silent,tag:i.tag,timestamp:i.timestamp,title:i.title,vibrate:i.vibrate});let w={payload:o,_ui:{type:"eventSend",id:i.id!==""?i.id:void 0,name:i.name!==""?i.name:void 0,slotText:i.textContent?i.textContent.substring(0,255):void 0,dataset:{...i.dataset},form:c,props:r,attribs:n,classes:h,notification:m,event:e.type,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,pointerType:e.pointerType,nodeName:i.nodeName,clientId:this.clientId,pageName:this.pageName,tabId:this.tabId}};l("trace","Uib:eventSend","Sending msg to Node-RED",w)(),this._send(w,this._ioChannels.client,t)}send(e,t=""){this._send(e,this._ioChannels.client,t)}sendRoom(e,t){this._socket.emit("uib-room-send",e,t)}joinRoom(e){this._socket.emit("uib-room-join",e)}leaveRoom(e){this._socket.emit("uib-room-leave",e)}sendCtrl(e){this._send(e,this._ioChannels.control)}sendCustom(e,t){this._socket.emit(e,t)}uploadFile(e,t){let i=new FileReader;i.onload=r=>{let n=r.target.result,o={topic:this.topic||"file-upload",payload:n,fileName:e.name,type:e.type,lastModified:e.lastModifiedDate,size:e.size,clientId:this.clientId,pageName:this.pageName,tabId:this.tabId,...t},c=this.maxHttpBufferSize-500;n.byteLength>=c&&(o.payload=void 0,o.error="File is too large to send. File size: ".concat(n.byteLength,". Max msg size: ").concat(c),l("error","Uib:uploadFile",o.error)()),this.send(o)},i.readAsArrayBuffer(e)}_getIOnamespace(){let e;if(e=this.cookies["uibuilder-namespace"],e===void 0||e===""){let t=window.location.pathname.split("/").filter(function(i){return i.trim()!==""});t.length>0&&t[t.length-1].endsWith(".html")&&t.pop(),e=t.pop(),l("trace","uibuilder.module.js:getIOnamespace","Socket.IO namespace found via url path: ".concat(e))()}else l("trace","uibuilder.module.js:getIOnamespace","Socket.IO namespace found via cookie: ".concat(e))();return this.url=e,e="/"+e,l("trace","uibuilder.module.js:getIOnamespace","Final Socket.IO namespace: ".concat(e))(),e}_checkConnect(e,t,i=1){if(navigator.onLine!==!1)return e||(e=this.retryMs),t||(t=this.retryFactor),l("trace","Uib:checkConnect","Checking connection.\nConnected: ".concat(this._socket.connected,".\nTimer: ").concat(p(this,k),". Depth: ").concat(i,". Delay: ").concat(e,". Factor: ").concat(t,".\nTransport: ").concat(this.currentTransport),this._socket)(),this._socket.connected===!0?(p(this,k)&&(window.clearTimeout(p(this,k)),_(this,k,null)),this.set("ioConnected",!0),this.set("socketError",null),!0):(this.set("ioConnected",!1),p(this,k)&&window.clearTimeout(p(this,k)),_(this,k,window.setTimeout(()=>{l("warn","Uib:checkConnect:setTimeout","Socket.IO reconnection attempt. Current delay: ".concat(e,". Depth: ").concat(i))(),this._socket.disconnect(),this._socket.connect(),_(this,k,null),this._checkConnect(e*t,t,i++)},e)),!1)}_onConnect(){this.currentTransport=this._socket.io.engine.transport.name,l("info","Uib:ioSetup","\u2705 SOCKET CONNECTED.\nConnection count: ".concat(this.connectedNum,", Is a Recovery?: ").concat(this._socket.recovered,".\nNamespace: ").concat(this.ioNamespace,"\nTransport: ").concat(this.currentTransport))(),this._dispatchCustomEvent("uibuilder:socket:connected",{numConnections:this.connectedNum,isRecovery:this._socket.recovered}),this._socket.io.engine.on("upgrade",()=>{this.currentTransport=this._socket.io.engine.transport.name,l("trace","Uib:_onConnect:onUpgrade","SOCKET CONNECTION UPGRADED.\nConnection count: ".concat(this.connectedNum,", Is a Recovery?: ").concat(this._socket.recovered,".\nNamespace: ").concat(this.ioNamespace,"\nTransport: ").concat(this.currentTransport))()}),setTimeout(()=>{this.currentTransport!=="websocket"&&l("error","Uib:Connection","Connected to Node-RED but NO SOCKET UPGRADE!\n\u27A1\uFE0F CHECK NETWORK and any PROXIES for issues. \u2B05\uFE0F\nConnection count: ".concat(this.connectedNum,", Is a Recovery?: ").concat(this._socket.recovered,".\nNamespace: ").concat(this.ioNamespace,"\nTransport: ").concat(this.currentTransport))()},2e3),this._checkConnect()}_onDisconnect(e){l("info","Uib:ioSetup:socket-disconnect","\u26D4 Socket Disconnected. Reason: ".concat(e))(),this._dispatchCustomEvent("uibuilder:socket:disconnected",e),this._checkConnect()}_ioSetup(){return F===void 0?(l("error","Uib:ioSetup","Socket.IO client not loaded, Node-RED comms will not work")(),!1):(this._socket&&(l("trace","Uib:ioSetup","Removing listeners in preparation for redoing Socket.IO connections")(),p(this,k)&&(window.clearTimeout(p(this,k)),_(this,k,null)),this._socket.close(),this._socket.offAny(),this._socket=void 0,this.set("ioConnected",!1)),this.socketOptions.path=this.ioPath,l("trace","Uib:ioSetup","About to create IO object. Transports: [".concat(this.socketOptions.transports.join(", "),"]"))(),this._socket=F(this.ioNamespace,this.socketOptions),this._connectGlobal(),this._socket.on("connect",this._onConnect.bind(this)),this._socket.on(this._ioChannels.server,this._stdMsgFromServer.bind(this)),this._socket.on(this._ioChannels.control,this._ctrlMsgFromServer.bind(this)),this._socket.on("disconnect",this._onDisconnect.bind(this)),this._socket.on("connect_error",e=>{navigator.onLine!==!1&&(l("error","Uib:ioSetup:connect_error","\u274C Socket.IO Connect Error. Reason: ".concat(e.message),e)(),this.set("ioConnected",!1),this.set("socketError",e),this._dispatchCustomEvent("uibuilder:socket:disconnected",e))}),this._socket.on("error",e=>{l("error","Uib:ioSetup:error","\u274C Socket.IO Error. Reason: ".concat(e.message),e)(),this.set("ioConnected",!1),this.set("socketError",e),this._dispatchCustomEvent("uibuilder:socket:disconnected",e)}),this._socket.io.engine.on("connection_error",e=>{l("error","Uib:ioSetup:io:engine:connection_error",e.code,e.message,e.context)()}),this._checkConnect(),!0)}_connectGlobal(){this._socketGlobal=F("/",this.socketOptions),this._socketGlobal.onAny((...e)=>{this.set("globalMsg",e.slice(0,-1))})}connect(){this._socket.connect()}disconnect(){this._socket.disconnect(),p(this,k)&&window.clearTimeout(p(this,k))}start(e){l("trace","Uib:start","Starting")(),p(this,we)&&this.cancelChange("msg",p(this,we)),this.started===!0&&l("info","Uib:start","Start function already called. Resetting Socket.IO and msg handler.")(),l("log","Uib:start","Cookies: ",this.cookies,"\nClient ID: ".concat(this.clientId))(),l("trace","Uib:start","ioNamespace: ",this.ioNamespace,"\nioPath: ".concat(this.ioPath))(),e&&(e.ioNamespace&&this.set("ioNamespace",e.ioNamespace),e.ioPath&&this.set("ioPath",e.ioPath),e.nopolling&&this.socketOptions.transports[0]==="polling"&&this.socketOptions.transports.shift());let[t]=performance.getEntriesByType("navigation");if(this.set("lastNavType",t.type),this.set("started",this._ioSetup()),this.started===!0?l("trace","Uib:start","Start completed. Socket.IO client library loaded.")():l("error","Uib:start","Start completed. ERROR: Socket.IO client library NOT LOADED.")(),this._watchHashChanges(),window.Vue){this.set("isVue",!0);try{this.set("vueVersion",window.Vue.version)}catch{}l("trace","Uib:start","VueJS is loaded. Version: ".concat(this.vueVersion))()}else l("trace","Uib:start","VueJS is not loaded.")();window.DOMPurify?(this.set("purify",!0),l("trace","Uib:start","DOMPurify is loaded.")()):l("trace","Uib:start","DOMPurify is not loaded.")(),window.markdownit?(this.set("markdown",!0),l("trace","Uib:start","Markdown-IT is loaded.")()):l("trace","Uib:start","Markdown-IT is not loaded.")(),this.onChange("msg",r=>{if(p(this,re)===!0){let n=document.getElementById("uib_last_msg");n&&(n.innerHTML=this.syntaxHighlight(r))}}),this._uibAttrScanAll(document),new MutationObserver(this._uibAttribObserver.bind(this)).observe(document,{subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:this.uibAttribs,childList:!0}),this._dispatchCustomEvent("uibuilder:startComplete")}},W=new WeakMap,x=new WeakMap,R=new WeakMap,k=new WeakMap,we=new WeakMap,re=new WeakMap,se=new WeakMap,z=new WeakMap,ne=new WeakMap,$e=new WeakMap,ve=new WeakMap,_e=new WeakMap,H=new WeakMap,ke=new WeakMap,u(C,"_meta",{version:Lt,type:"module",displayName:"uibuilder"}),C),Le=new ui;window.uibuilder?l("error","uibuilder.module.js","`uibuilder` already assigned to window. Have you tried to load it more than once?"):window.uibuilder=Le;window.uib?l("warn","uibuilder.module.js","`uib` shortcut already assigned to window."):window.uib=Le;window.$?l("warn","uibuilder.module.js","Cannot allocate the global `$`, it is already in use. Use `uibuilder.$` or `uib.$` instead."):window.$=window.uibuilder.$;window.$$?l("warn","uibuilder.module.js","Cannot allocate the global `$$`, it is already in use. Use `uibuilder.$$` or `uib.$$` instead."):window.$$=window.uibuilder.$$;window.$ui?l("warn","uibuilder.module.js","Cannot allocate the global `$ui`, it is already in use. Use `uibuilder.$ui` or `uib.$ui` instead."):window.$ui=window.uibuilder.$ui;"on"in document||(document.on=function(s,e){this.addEventListener(s,e)});"on"in window||(window.on=function(s,e){this.addEventListener(s,e)});try{"query"in Element||(Element.prototype.query=function(s){return this.querySelector(s)}),"queryAll"in Element||(Element.prototype.queryAll=function(s){return this.querySelectorAll(s)}),"on"in Element||(Element.prototype.on=function(s,e){this.addEventListener(s,e)})}finally{}var ks=Le;Le.start();customElements.define("uib-var",Rt);customElements.define("uib-meta",At);customElements.define("apply-template",$t);})();
/**
 * @kind module
 * @module uibuilder
 * @description The client-side Front-End JavaScript for uibuilder in HTML Module form
 *   It provides a number of global objects that can be used in your own javascript.
 *   see the docs folder `./docs/uibuilder.module.md` for details of how to use this fully.
 *
 *   Please use the default index.js file for your own code and leave this as-is.
 *   See Uib._meta for client version string
 * @license Apache-2.0
 * @author Julian Knight (Totally Information)
 * @copyright (c) 2022-2025 Julian Knight (Totally Information)
 */
//# sourceMappingURL=uibuilder.iife.min.js.map