From 77329d5ff9afd42a29d2d718704afe29167e0426 Mon Sep 17 00:00:00 2001 From: dietrich ayala Date: Mon, 20 Oct 2025 12:16:22 +0700 Subject: [PATCH] add more files, got basic uhtml-compatible shim working --- README.md | 2 + base.css | 14 +- fsm-actions.html | 14 + fsm-actions.js | 315 + grid.css | 76 + grid.html | 13 + grid.js | 263 + hud-example.html | 8 - ml5.js | 278114 ++++++++++++++++++++++++++++++++++++++++++++ reactive.js | 56 + show-focus.html | 35 + sortable.min.js | 2 + storage.js | 68 + todo-minimal.js | 2 +- 14 files changed, 278964 insertions(+), 18 deletions(-) create mode 100644 README.md create mode 100644 fsm-actions.html create mode 100644 fsm-actions.js create mode 100644 grid.css create mode 100644 grid.html create mode 100644 grid.js create mode 100644 ml5.js create mode 100644 reactive.js create mode 100644 show-focus.html create mode 100644 sortable.min.js create mode 100644 storage.js diff --git a/README.md b/README.md new file mode 100644 index 0000000..6511108 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Various experiments in front-end stuff + diff --git a/base.css b/base.css index 044d8d5..d943a76 100644 --- a/base.css +++ b/base.css @@ -1,10 +1,5 @@ -@font-face { - font-family: 'ServerMono'; - src: url('./fonts/ServerMono-Regular.otf'); -} - :root { - --font-family: ServerMono; + --system-ui: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; --text: #17141f; --background: #faf9fb; --primary: #000000; @@ -23,7 +18,7 @@ } * { - font-family: var(--font-family); + font-family: var(--system-ui); } html, body, div { @@ -36,11 +31,12 @@ html, body, div { /* Animate containers to see when they re-render */ :root { - --debug: none; /* toggle to enable/disable debug */ + /* uncomment for animated container mode */ + /*--debug: none;*/ } div, ul, li, span, button { - animation: var(--debug, show 500ms 100ms 1 forwards); + animation: var(--debug, show 1000ms 100ms 1 forwards); box-shadow: var(--debug, 0px 0px 0px 5px red); margin: var(--debug, 0.5em); } diff --git a/fsm-actions.html b/fsm-actions.html new file mode 100644 index 0000000..2561b56 --- /dev/null +++ b/fsm-actions.html @@ -0,0 +1,14 @@ + + + + + + + fsm actions + + +
+ + + + diff --git a/fsm-actions.js b/fsm-actions.js new file mode 100644 index 0000000..5dbbbce --- /dev/null +++ b/fsm-actions.js @@ -0,0 +1,315 @@ +import StateMachine from './fsm.js'; +import StorageProxy from './storage.js'; +import { signal, effect } from './reactive.js'; + +/* +const s = signal(0); +console.log('signal', s); +console.log('s before', s.value); +s.value = 1; +console.log('s after', s.value); + +effect(() => { + console.log('s effect', s.value); +}); +*/ + + +// shorter keys than crypto.randomUUID() +const random = () => window.crypto.getRandomValues(new Uint32Array(1))[0]; + +// Define default state +// TODO: versioning, migration +const defaultState = { + counter: 0, + layout: 'grid', /* list, manual */ + sort: 'last-modified', /* last-modified, title, created */ + order: 'desc', /* asc, desc */ + filter: '', /* search string */ + tags: [], /* array of tags */ + items: [] +}; + +// Set up storage +const appKey = 'rfsm-actions'; +const reset = false; +const debug = false; +const storagingState = await StorageProxy(appKey, defaultState, reset, debug); + +/* +for (const k in storagingState) { + console.log('from storage', k, storagingState[k]); +} +*/ + +// Set up signals +const appState = {}; +for (const k in defaultState) { + appState[k] = signal(storagingState[k]); +}; +//console.log('appState', appState); + +// Debounced storage updater +// TODO: should be generalized +const updateStorage = () => { + for (let i in defaultState) { + const stored = storagingState[i]; + const live = appState[i]; + if (Object.is(live, stored) === false) { + storagingState[i] = appState[i].value; + //console.log(`Updating storage key ${i} with value`, appState[i]); + } + } +}; +//const updateStorageDebounced = debounce(updateStorage, 1000); + +// Component container +const appContainer = document.querySelector('#app'); + +// State machine for application flow +const appFSM = new StateMachine({ + initial: 'uninitialized', + states: { + uninitialized: ['initialized'], + initialized: ['viewing'], + viewing: ['viewing'], + } +}); + +/* +// Drives storage writes +appFSM.on('*', (prev) => { + console.log(`FSM.on(*): state changed from ${prev} to ${appFSM.current}, (${appState.current.value})`); + //updateStorage(); +}); +*/ + +appFSM.on('initialized', (prev) => { + console.log('FSM.initialized: rendering'); + appContainer.innerHTML= App(); + console.log('FSM.initialized: rendering started, setting state to viewing'); + appState.current.value = 'viewing'; +}); + +appFSM.on('viewing', (prev) => { + console.log('FSM.viewing'); +}); + +// Item factory +const createItem = (text) => ({ + id: random(), + text: text.trim(), + tags: [], + created: new Date(), + modified: new Date() +}); + +// Actions - pure functions that modify state +const actions = { + addItem: async ({text}) => { + if (text.trim()) { + const newItem = createItem(text); + appState.items.value = [...appState.items, newItem]; + console.log('updateItem(): setting state to viewing'); + appState.current.value = 'viewing'; + } + }, + + updateItem: async ({item}) => { + console.log('actions.updateItem', item); + if ('deleted' in item) { + appState.items.value = appState.items.filter(t => t.id != item.id); + console.log('deleted'); + } + else { + console.log('updating...'); + //item.lastModified = new Date(); + //appState.items= appState.items.map(t => t.id === item.id ? { ...t, ...item } : t); + const newItems = appState.items.value.map(t => t.id === item.id ? { ...t, ...item } : t); + console.log('newItems', newItems); + try { + appState.items.value = newItems; + } catch(ex) { + console.error('update failed', ex); + } + console.log('new items', newItems); + } + console.log('updateItem(): setting state to viewing'); + appState.current.value = 'viewing'; + } +}; + +// Receive events from components +// and map them to actions + +const emit = async (name, data) => { + console.log('emit', name, data); + window.dispatchEvent(new CustomEvent(name, { detail: data })); + console.log('emit complete'); +}; + +const eventStreamHandler = async (e) => { + console.log('stream event:', e); + const { name, props } = e.detail; + if (name != null) { + console.log('EventStream: invoking action:', name, props); + await actions[name](props); + } + else { + console.error('Unknown event, no matching action:', e.name); + } +}; +window.addEventListener('stream', eventStreamHandler); + + +// Detects state changes and triggers FSM transitions +// TODO: should not have actions setting state directly +// - make an action which trigger FSM? +// - or action calls fsm.go(), and a listener updates signal val? +const stateConductor = (stateMachine, currentStateSignal) => { + //effect(() => { + console.log(`StateConductor() effect prev: ${stateMachine.current}, next: ${currentStateSignal.value}`); + if (stateMachine.current != currentStateSignal.value) { + //console.log('StateConductor: changing state to:', currentStateSignal); + stateMachine.go(currentStateSignal.value).then(() => { + console.log(`StateConductor() transition from ${stateMachine.current} to ${currentStateSignal.value} is complete`); + }); + } + //console.log('State changed to:', currentStateSignal.value); + //}, [currentStateSignal.value]); +}; + +// Template processor +const html = (template, ...values) => { + // Create a unique ID for this template instance + const templateId = 'tpl_' + Math.random().toString(36).substr(2, 9); + window.htmlEventHandlers = window.htmlEventHandlers || {}; + + // Process the template and values + let htmlString = ''; + for (let i = 0; i < template.length; i++) { + htmlString += template[i]; + + if (i < values.length) { + const value = values[i]; + + // Check if this value is a function (event handler) + if (typeof value === 'function') { + // Store the function globally with unique ID + const handlerId = 'h_' + Math.random().toString(36).substr(2, 9); + window.htmlEventHandlers[handlerId] = value; + + // Replace with inline handler call + htmlString += `window.htmlEventHandlers.${handlerId}(event)`; + } else if (Array.isArray(value)) { + // Handle arrays (like mapped components) + htmlString += value.join(''); + } else { + // Regular value + htmlString += value; + } + } + } + + return htmlString; +}; + +// Components - pure UI functions +const StateInfo = ({ currentState, items }) => { + console.log('StateInfo', currentState, items); + // State metadata + const total = items.length; + + return ` +
+ State: ${currentState} | + Items: ${total} total +
+ `; +}; + +const Textarea = ({ value }) => { + const text = signal(value); + + const oninput = (e) => { + console.log(`textarea.oninput(): ${text.value} -> ${e.target.value}`); + text.value = e.target.value; + }; + + effect(() => { + console.log('changed', text.value); + }); + + return html` + + `; +}; + +const Card = ({item}) => { + //console.log('Card', item); + + const onInput = async (e) => { + const newVal = e.target.value; + console.log('card.onInput:', newVal); + item.text = newVal; + console.log('card.onInput: set'); + await emit('stream', { name: 'updateItem', props: { item }}); + console.log('card.onInput: done'); + }; + + return html` +
+ ${Textarea({value: item.text})} +
+ `; +}; + +const Cards = ({items}) => { + //console.log('Cards', items); + return html` +
+ ${items.map(item => Card({item}))} +
+ `; +}; + +const App = () => { + //console.log('App', appState); + appState.counter.value = appState.counter.value + 1; + //console.log('currentState', appState.current.value, 'items', appState.items.value); + return html` +
+

FSM+uHTML Grid (${appState.counter.value})

+ ${StateInfo({currentState: appState.current.value, items: appState.items.value})} + ${Cards({items: appState.items.value})} +
+ `; +}; + +// Initialize signal for current FSM state +appState.current = signal(appFSM.current); + +// Update storage on changes to state +effect(() => { + //console.log('effect() Appstate.current effect:', appState.current.value); + updateStorage(); +}, [appState.current.value]); + +// Example data +if (appState.items.length == 0) { + console.log('ADDING EXAMPLES because no items exist'); + // is there a savings in doing this before initializing the fsm? + // maybe just confusing + //[...Array(3)].map((_, i) => actions.addItem(`item ${i}`)); + const itemCount = 1; + appState.items.value = [...Array(itemCount)].map((_, i) => createItem(`item ${i}`)); + console.log('Initial items:', appState.items); +} + +// Initialized effect that syncs the signal to the state machine +appState.current.value = 'initialized'; +stateConductor(appFSM, appState.current); + +// Fire up the machine +console.log('main complete'); + diff --git a/grid.css b/grid.css new file mode 100644 index 0000000..174788d --- /dev/null +++ b/grid.css @@ -0,0 +1,76 @@ +* { + box-sizing: border-box; +} + +html, body { + margin: 0; + padding: 0; +} + +body { + height: 100vh; + width: 100vw; +} + +.container { + display: flex; + height: 100vh; + margin: 0; + padding: 2rem; +} + +.content { + padding: 1rem; + height: 100%; + width: 100%; +} + +.content.backgrounded { + transition: all 0.2s ease; + filter: blur(1px); + transform: scale(0.91); + border: 1px solid var(--accent); +} + +.header { + padding: 0; + margin: 0; +} + +/* Keyframes for dialog and popover elements */ +@keyframes fadeIn { +from { opacity: 0 } + to { opacity: 1 } +} +@keyframes fadeOut { +from { opacity: 1 } + to { opacity: 0 } +} + +.hud { + width: 100%; + background: transparent; + justify-content: space-between; + border: none; + + animation: fadeOut 0.5s forwards; + &:popover-open { + animation: fadeIn 0.5s forwards; + } +} + +.hud:popover-open { + display: flex; +} + +.widgets { +} + +.widget { + background-color: var(--background); + padding: 1rem; + margin: 1rem; + border: 1px solid silver; + box-shadow: 0 10px 6px -6px #777; + border-radius: 3px; +} diff --git a/grid.html b/grid.html new file mode 100644 index 0000000..e3b47c5 --- /dev/null +++ b/grid.html @@ -0,0 +1,13 @@ + + + + + + grid test + + +
+ + + + diff --git a/grid.js b/grid.js new file mode 100644 index 0000000..4b60ffc --- /dev/null +++ b/grid.js @@ -0,0 +1,263 @@ +import { effect, html, signal, render } from './uhtml.js'; +import StateMachine from './fsm.js'; +import StorageProxy from './storage.js'; + +// shorter keys than crypto.randomUUID() +const random = () => window.crypto.getRandomValues(new Uint32Array(1))[0]; + +// Define default state +// TODO: versioning, migration +const defaultState = { + layout: 'grid', /* list, manual */ + sort: 'last-modified', /* last-modified, title, created */ + order: 'desc', /* asc, desc */ + filter: '', /* search string */ + tags: [], /* array of tags */ + items: [] +}; + +// Set up storage +const appKey = 'rfsm-grid'; +const reset = false; +const debug = false; +const storagingState = await StorageProxy(appKey, defaultState, reset, debug); + +// Set up signals +const appState = {}; +for (let k in defaultState) { + appState[k] = signal(storagingState[k]); +}; + +// Debounced storage updater +// TODO: should be generalized +const updateStorage = () => { + for (let i in defaultState) { + const stored = storagingState[i]; + const live = appState[i].value; + if (Object.is(live, stored) === false) { + storagingState[i] = appState[i].value; + //console.log(`Updating storage key ${i} with value`, appState[i].value); + } + } +}; +//const updateStorageDebounced = debounce(updateStorage, 1000); + +// Component container +const appContainer = document.getElementById('app'); + +// State machine for application flow +const appFSM = new StateMachine({ + initial: 'uninitialized', + states: { + uninitialized: ['initialized'], + initialized: ['viewing'], + viewing: ['viewing'], + } +}); + +/* +// Drives storage writes +appFSM.on('*', (prev) => { + console.log(`FSM.on(*): state changed from ${prev} to ${appFSM.current}, (${appState.current.value})`); + //updateStorage(); +}); +*/ + +appFSM.on('initialized', (prev) => { + console.log('FSM.initialized: rendering'); + render(appContainer, html`<${App} />`); + console.log('FSM.initialized: rendering started, setting state to viewing'); + appState.current.value = 'viewing'; +}); + +appFSM.on('viewing', (prev) => { + console.log('FSM.viewing'); +}); + +// Item factory +const createItem = (text) => ({ + id: random(), + text: text.trim(), + tags: [], + created: new Date(), + modified: new Date() +}); + +// Actions - pure functions that modify state +const actions = { + addItem: async ({text}) => { + if (text.trim()) { + const newItem = createItem(text); + appState.items.value = [...appState.items.value, newItem]; + console.log('updateItem(): setting state to viewing'); + appState.current.value = 'viewing'; + } + }, + + updateItem: async ({item}) => { + console.log('actions.updateItem', item); + if ('deleted' in item) { + appState.items.value = appState.items.value.filter(t => t.id != item.id); + console.log('deleted'); + } + else { + console.log('updating...'); + //item.lastModified = new Date(); + //appState.items.value = appState.items.value.map(t => t.id === item.id ? { ...t, ...item } : t); + const newItems = appState.items.value.map(t => t.id === item.id ? { ...t, ...item } : t); + console.log('newItems', newItems); + try { + appState.items.value = newItems; + } catch(ex) { + console.error('update failed', ex); + } + console.log('new items', newItems); + } + console.log('updateItem(): setting state to viewing'); + appState.current.value = 'viewing'; + } +}; + +// Receive events from components +// and map them to actions + +const emit = async (name, data) => { + console.log('emit', name, data); + window.dispatchEvent(new CustomEvent(name, { detail: data })); + console.log('emit complete'); +}; + +const eventStreamHandler = async (e) => { + console.log('stream event:', e); + const { name, props } = e.detail; + if (name != null) { + console.log('EventStream: invoking action:', name, props); + await actions[name](props); + } + else { + console.error('Unknown event, no matching action:', e.name); + } +}; +window.addEventListener('stream', eventStreamHandler); + + +// Detects state changes and triggers FSM transitions +// TODO: should not have actions setting state directly +// - make an action which trigger FSM? +// - or action calls fsm.go(), and a listener updates signal val? +const stateConductor = (stateMachine, currentStateSignal) => { + effect(() => { + console.log(`StateConductor() effect prev: ${stateMachine.current}, next: ${currentStateSignal.value}`); + if (stateMachine.current != currentStateSignal.value) { + //console.log('StateConductor: changing state to:', currentStateSignal.value); + stateMachine.go(currentStateSignal.value).then(() => { + console.log(`StateConductor() transition from ${stateMachine.current} to ${currentStateSignal.value} is complete`); + }); + } + //console.log('State changed to:', currentStateSignal.value); + }, [currentStateSignal.value]); +}; + +// Components - pure UI functions +const StateInfo = ({ currentState, filter, items }) => { + // State metadata + const total = items.length; + + return html` +
+ State: ${currentState} | + Filter: ${filter} | + Items: ${total} total +
+ `; +}; + +const Textarea = ({value}) => { + const txt = signal(value); + + const oninput = (e) => { + //console.log(`textarea.oninput(): ${txt.value} -> ${e.target.value}`); + }; + + return html` + + `; +}; + +const Card = ({item}) => { + //console.log('Card', item); + const txt = signal(item.text); + + const onInput = async e => { + const newVal = e.target.value; + console.log('card.onInput:', newVal); + //txt.value = newVal; + item.text = newVal; + console.log('card.onInput: set'); + await emit('stream', { name: 'updateItem', props: { item }}); + console.log('card.onInput: done'); + }; + + return html` +
+ <${Textarea} value=${txt.value}/> +
+ `; +}; + +const Cards = ({items}) => { + console.log('Cards', items); + return html` +
+ ${items.map(item => Card({item}))} +
+ `; +}; + +const App = () => { + console.log('App', appState); + const counter = signal(0); + return html` +
+

FSM+uHTML Grid (${counter.value++})

+ <${StateInfo} + currentState=${appState.current.value} + items=${appState.items.value} + /> + <${Cards} + items=${appState.items.value} + /> +
+ `; +}; + +// Initialize signal for current FSM state +appState.current = signal(appFSM.current); + +/* +// Update storage on changes to state +effect(() => { + console.log('effect() Appstate.current effect:', appState.current.value); + updateStorage(); +}, [appState.current.value]); +*/ + +// Example data +if (appState.items.value.length == 0) { + console.log('ADDING EXAMPLES because no items exist'); + // is there a savings in doing this before initializing the fsm? + // maybe just confusing + //[...Array(3)].map((_, i) => actions.addItem(`item ${i}`)); + const itemCount = 1; + appState.items.value = [...Array(itemCount)].map((_, i) => createItem(`item ${i}`)); + console.log('Initial items:', appState.items.value); +} + +// Initialized effect that syncs the signal to the state machine +stateConductor(appFSM, appState.current); + +// Fire up the machine +appState.current.value = 'initialized'; + diff --git a/hud-example.html b/hud-example.html index d90ea2a..27127ce 100644 --- a/hud-example.html +++ b/hud-example.html @@ -15,14 +15,6 @@

Content HUD - darkbox style

- -

Content area active

Press spacebar to toggle HUD

diff --git a/ml5.js b/ml5.js new file mode 100644 index 0000000..c8a61e2 --- /dev/null +++ b/ml5.js @@ -0,0 +1,278114 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["ml5"] = factory(); + else + root["ml5"] = factory(); +})(self, () => { +return /******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 2726: +/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + +(function(){/* + + Copyright The Closure Library Authors. + SPDX-License-Identifier: Apache-2.0 +*/ +'use strict';var v;function aa(a){var b=0;return function(){return b>>0)+"_",e=0;return b}); +J("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;cc&&(c=Math.max(c+e,0));cg)d[c++]=g;else{if(2048>g)d[c++]=g>>6|192;else{if(55296<=g&&57343>=g){if(56319>=g&&e=f){g=1024*(g-55296)+f-56320+65536;d[c++]=g>>18|240;d[c++]=g>>12&63|128;d[c++]=g>>6&63|128;d[c++]=g&63|128;continue}else e--}if(b)throw Error("Found an unpaired surrogate");g=65533}d[c++]= +g>>12|224;d[c++]=g>>6&63|128}d[c++]=g&63|128}}a=d.subarray(0,c)}return a};var Da={},Ea=null;function Fa(a,b){void 0===b&&(b=0);Ga();b=Da[b];for(var c=Array(Math.floor(a.length/3)),d=b[64]||"",e=0,g=0;e>2];f=b[(f&3)<<4|h>>4];h=b[(h&15)<<2|k>>6];k=b[k&63];c[g++]=l+f+h+k}l=0;k=d;switch(a.length-e){case 2:l=a[e+1],k=b[(l&15)<<2]||d;case 1:a=a[e],c[g]=b[a>>2]+b[(a&3)<<4|l>>4]+k+d}return c.join("")} +function Ha(a){var b=a.length,c=3*b/4;c%3?c=Math.floor(c):-1!="=.".indexOf(a[b-1])&&(c=-1!="=.".indexOf(a[b-2])?c-2:c-1);var d=new Uint8Array(c),e=0;Ia(a,function(g){d[e++]=g});return d.subarray(0,e)} +function Ia(a,b){function c(k){for(;d>4);64!=f&&(b(g<<4&240|f>>2),64!=h&&b(f<<6&192|h))}} +function Ga(){if(!Ea){Ea={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++){var d=a.concat(b[c].split(""));Da[c]=d;for(var e=0;ee&&128<=b;e++)b=a.h[a.g++],c|=(b&127)<<7*e;128<=b&&(b=a.h[a.g++],c|=(b&127)<<28,d|=(b&127)>>4);if(128<=b)for(e=0;5>e&&128<=b;e++)b=a.h[a.g++],d|=(b&127)<<7*e+3;if(128>b){a=c>>>0;b=d>>>0;if(d=b&2147483648)a=~a+1>>>0,b=~b>>>0,0==a&&(b=b+1>>>0);a=4294967296*b+(a>>>0);return d?-a:a}a.m=!0} +Ma.prototype.i=function(){var a=this.h,b=a[this.g],c=b&127;if(128>b)return this.g+=1,c;b=a[this.g+1];c|=(b&127)<<7;if(128>b)return this.g+=2,c;b=a[this.g+2];c|=(b&127)<<14;if(128>b)return this.g+=3,c;b=a[this.g+3];c|=(b&127)<<21;if(128>b)return this.g+=4,c;b=a[this.g+4];c|=(b&15)<<28;if(128>b)return this.g+=5,c>>>0;this.g+=5;128<=a[this.g++]&&128<=a[this.g++]&&128<=a[this.g++]&&128<=a[this.g++]&&this.g++;return c}; +Ma.prototype.o=function(){var a=this.h[this.g],b=this.h[this.g+1];var c=this.h[this.g+2];var d=this.h[this.g+3];this.g+=4;c=(a<<0|b<<8|c<<16|d<<24)>>>0;a=2*(c>>31)+1;b=c>>>23&255;c&=8388607;return 255==b?c?NaN:Infinity*a:0==b?a*Math.pow(2,-149)*c:a*Math.pow(2,b-150)*(c+Math.pow(2,23))};var Pa=[];function Qa(){this.g=new Uint8Array(64);this.h=0}Qa.prototype.push=function(a){if(!(this.h+1>>=7;a.push(b)};function Sa(a){var b={},c=void 0===b.N?!1:b.N;this.o={v:void 0===b.v?!1:b.v};this.N=c;b=this.o;Pa.length?(c=Pa.pop(),b&&(c.v=b.v),a&&Na(c,a),a=c):a=new Ma(a,b);this.g=a;this.m=this.g.g;this.h=this.i=this.l=-1;this.j=!1}Sa.prototype.reset=function(){this.g.reset();this.h=this.l=-1};function S(a){var b=a.g;(b=b.g==b.j)||(b=a.j)||(b=a.g,b=b.m||0>b.g||b.g>b.j);if(b)return!1;a.m=a.g.g;b=a.g.i();var c=b&7;if(0!=c&&5!=c&&1!=c&&2!=c&&3!=c&&4!=c)return a.j=!0,!1;a.i=b;a.l=b>>>3;a.h=c;return!0} +function Ta(a){switch(a.h){case 0:if(0!=a.h)Ta(a);else{for(a=a.g;a.h[a.g]&128;)a.g++;a.g++}break;case 1:1!=a.h?Ta(a):(a=a.g,a.g+=8);break;case 2:if(2!=a.h)Ta(a);else{var b=a.g.i();a=a.g;a.g+=b}break;case 5:5!=a.h?Ta(a):(a=a.g,a.g+=4);break;case 3:b=a.l;do{if(!S(a)){a.j=!0;break}if(4==a.h){a.l!=b&&(a.j=!0);break}Ta(a)}while(1);break;default:a.j=!0}} +function Ua(a,b,c){var d=a.g.j,e=a.g.i(),g=a.g.g+e;a.g.j=g;c(b,a);c=g-a.g.g;if(0!==c)throw Error("Message parsing ended unexpectedly. Expected to read "+e+" bytes, instead read "+(e-c)+" bytes, either the data ended unexpectedly or the message misreported its own length");a.g.g=g;a.g.j=d;return b}function T(a){return a.g.o()} +function Va(a){var b=a.g.i();a=a.g;var c=a.g;a.g+=b;a=a.h;var d;if(za)(d=ya)||(d=ya=new TextDecoder("utf-8",{fatal:!1})),d=d.decode(a.subarray(c,c+b));else{b=c+b;for(var e=[],g=null,f,h,k;cf?e.push(f):224>f?c>=b?e.push(65533):(h=a[c++],194>f||128!==(h&192)?(c--,e.push(65533)):e.push((f&31)<<6|h&63)):240>f?c>=b-1?e.push(65533):(h=a[c++],128!==(h&192)||224===f&&160>h||237===f&&160<=h||128!==((d=a[c++])&192)?(c--,e.push(65533)):e.push((f&15)<<12|(h&63)<<6|d&63)):244>=f?c>=b-2?e.push(65533): +(h=a[c++],128!==(h&192)||0!==(f<<28)+(h-144)>>30||128!==((d=a[c++])&192)||128!==((k=a[c++])&192)?(c--,e.push(65533)):(f=(f&7)<<18|(h&63)<<12|(d&63)<<6|k&63,f-=65536,e.push((f>>10&1023)+55296,(f&1023)+56320))):e.push(65533),8192<=e.length&&(g=xa(g,e),e.length=0);d=xa(g,e)}return d}function Wa(a,b,c){var d=a.g.i();for(d=a.g.g+d;a.g.gd?1:0)?-d:d;0===d?0<1/d?Q=R=0:(R=0,Q=2147483648):isNaN(d)?(R=0,Q=2147483647):3.4028234663852886E38>>0):1.1754943508222875E-38>d?(d=Math.round(d/Math.pow(2,-149)),R=0,Q=(c<<31|d)>>>0):(b=Math.floor(Math.log(d)/Math.LN2),d*=Math.pow(2,-b),d=Math.round(8388608*d),16777216<=d&&++b,R=0,Q=(c<<31|b+127<<23|d&8388607)>>>0);c=Q;a.push(c>>>0&255);a.push(c>>>8&255);a.push(c>>>16&255);a.push(c>>>24&255)}};var ab="function"===typeof Uint8Array;function bb(a,b,c){if(null!=a)return"object"===typeof a?ab&&a instanceof Uint8Array?c(a):cb(a,b,c):b(a)}function cb(a,b,c){if(Array.isArray(a)){for(var d=Array(a.length),e=0;e=a.l?a.i?a.i[b]:void 0:a.h[b+a.j]}function jb(a,b){var c=void 0===c?!1:c;var d=W(a,b,c);null==d&&(d=hb);d===hb&&(d=db([]),X(a,b,d,c));return d}function kb(a){var b=jb(a,3);a.m||(a.m={});if(!a.m[3]){for(var c=0;c=a.l?(ib(a),a.i[b]=c):a.h[b+a.j]=c}function mb(a,b,c){if(-1===c)return null;a.g||(a.g={});if(!a.g[c]){var d=W(a,c,!1);d&&(a.g[c]=new b(d))}return a.g[c]}function nb(a,b){a.g||(a.g={});var c=a.g[1];if(!c){var d=jb(a,1);c=[];for(var e=0;eB;B=Math.abs(B);var D=B>>>0;B=Math.floor((B-D)/4294967296);B>>>=0;C&&(B=~B>>> +0,D=(~D>>>0)+1,4294967295>>7|D<<25)>>>0,D>>>=7;q.push(C)}rb(p,A);H=$a(H);F.call(E,I,H);if(z.O)for(E=0;EB;B++)C.push(D&127|128),D>>=7;C.push(1)}U(q,2,W(A,2));C=W(A,3);null!=C&&(C=Ca(C),Ra(q.g,26),Ra(q.g,C.length),Za(q,q.g.end()),Za(q,C));C=W(A,4);null!=C&&(C=Ca(C),Ra(q.g,34),Ra(q.g,C.length),Za(q,q.g.end()), +Za(q,C));rb(A,q);p=$a(p);I.call(F,H,p)}}m=m.data;break a;default:m={}}}u=m;w=n.stream;switch(n.type){case "video":f.pushTexture2d(Object.assign(Object.assign({},u),{stream:w,timestamp:g}));break;case "detections":r=u;r.stream=w;r.timestamp=g;f.pushDetectionList(r);break;default:throw Error("Unknown input config type: '"+n.type+"'");}}e.i.send(f);return N(y,e.C,4);case 4:f.delete(),y.g=0}})})}; +function dc(a,b,c){return Z(a,function e(){var g,f,h,k,l,n,u=this,w,r,y,m,t,x,z,E;return O(e,function(F){switch(F.g){case 1:if(!c)return F.return(b);g={};f=0;h=K(Object.keys(c));for(k=h.next();!k.done;k=h.next())l=k.value,n=c[l],"string"!==typeof n&&"texture"===n.type&&void 0!==b[n.stream]&&++f;1>>0)+"_",e=0;return b}); +z("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;cc&&(c=Math.max(0,e+c));if(null==d||d>e)d=e;d=Number(d);0>d&&(d=Math.max(0,e+d));for(c=Number(c||0);cc&&(c=Math.max(c+e,0));c>4);64!=f&&(b(g<<4&240|f>>2),64!=h&&b(f<<6&192|h))}} +function Ha(){if(!Ea){Ea={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++){var d=a.concat(b[c].split(""));Da[c]=d;for(var e=0;e>2];f=b[(f&3)<<4|h>>4];h=b[(h&15)<<2|k>>6];k=b[k&63];c[g++]=l+f+h+k}l=0;k=d;switch(a.length-e){case 2:l=a[e+1],k=b[(l&15)<<2]||d;case 1:a=a[e],c[g]=b[a>>2]+b[(a&3)<<4|l>>4]+k+d}return c.join("")}for(b="";10240a;a=Math.abs(a);var c=a>>>0;a=Math.floor((a-c)/4294967296);b&&(c=A(Ta(c,a)),b=c.next().value,a=c.next().value,c=b);G=c>>>0;H=a>>>0}var Ua="function"===typeof BigInt;function Ta(a,b){b=~b;a?a=~a+1:b+=1;return[a,b]};function Va(a,b){this.i=a>>>0;this.h=b>>>0} +function Wa(a){if(!a)return Xa||(Xa=new Va(0,0));if(!/^-?\d+$/.test(a))return null;if(16>a.length)Sa(Number(a));else if(Ua)a=BigInt(a),G=Number(a&BigInt(4294967295))>>>0,H=Number(a>>BigInt(32)&BigInt(4294967295));else{var b=+("-"===a[0]);H=G=0;for(var c=a.length,d=b,e=(c-b)%6+b;e<=c;d=e,e+=6)d=Number(a.slice(d,e)),H*=1E6,G=1E6*G+d,4294967296<=G&&(H+=G/4294967296|0,G%=4294967296);b&&(b=A(Ta(G,H)),a=b.next().value,b=b.next().value,G=a,H=b)}return new Va(G,H)}var Xa;function Ya(a,b){return Error("Invalid wire type: "+a+" (at position "+b+")")}function Za(){return Error("Failed to read varint, encoding is invalid.")}function $a(a,b){return Error("Tried to read past the end of the data "+b+" > "+a)};function K(){throw Error("Invalid UTF8");}function ab(a,b){b=String.fromCharCode.apply(null,b);return null==a?b:a+b}var bb=void 0,cb,db="undefined"!==typeof TextDecoder,eb,fb="undefined"!==typeof TextEncoder;var gb;function hb(a){if(a!==Qa)throw Error("illegal external caller");}function ib(a,b){hb(b);this.V=a;if(null!=a&&0===a.length)throw Error("ByteString should be constructed with non-empty values");}function jb(){return gb||(gb=new ib(null,Qa))}function kb(a){hb(Qa);var b=a.V;b=null==b||Ia&&null!=b&&b instanceof Uint8Array?b:"string"===typeof b?Na(b):null;return null==b?b:a.V=b};function lb(a){if("string"===typeof a)return{buffer:Na(a),C:!1};if(Array.isArray(a))return{buffer:new Uint8Array(a),C:!1};if(a.constructor===Uint8Array)return{buffer:a,C:!1};if(a.constructor===ArrayBuffer)return{buffer:new Uint8Array(a),C:!1};if(a.constructor===ib)return{buffer:kb(a)||Pa(),C:!0};if(a instanceof Uint8Array)return{buffer:new Uint8Array(a.buffer,a.byteOffset,a.byteLength),C:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers"); +};function mb(a,b){this.i=null;this.m=!1;this.h=this.j=this.l=0;nb(this,a,b)}function nb(a,b,c){c=void 0===c?{}:c;a.S=void 0===c.S?!1:c.S;b&&(b=lb(b),a.i=b.buffer,a.m=b.C,a.l=0,a.j=a.i.length,a.h=a.l)}mb.prototype.reset=function(){this.h=this.l};function L(a,b){a.h=b;if(b>a.j)throw $a(a.j,b);} +function ob(a){var b=a.i,c=a.h,d=b[c++],e=d&127;if(d&128&&(d=b[c++],e|=(d&127)<<7,d&128&&(d=b[c++],e|=(d&127)<<14,d&128&&(d=b[c++],e|=(d&127)<<21,d&128&&(d=b[c++],e|=d<<28,d&128&&b[c++]&128&&b[c++]&128&&b[c++]&128&&b[c++]&128&&b[c++]&128)))))throw Za();L(a,c);return e}function pb(a,b){if(0>b)throw Error("Tried to read a negative byte length: "+b);var c=a.h,d=c+b;if(d>a.j)throw $a(b,a.j-c);a.h=d;return c}var qb=[];function rb(){this.h=[]}rb.prototype.length=function(){return this.h.length};rb.prototype.end=function(){var a=this.h;this.h=[];return a};function sb(a,b,c){for(;0>>7|c<<25)>>>0,c>>>=7;a.h.push(b)}function M(a,b){for(;127>>=7;a.h.push(b)};function tb(a,b){if(qb.length){var c=qb.pop();nb(c,a,b);a=c}else a=new mb(a,b);this.h=a;this.j=this.h.h;this.i=this.l=-1;this.setOptions(b)}tb.prototype.setOptions=function(a){a=void 0===a?{}:a;this.ca=void 0===a.ca?!1:a.ca};tb.prototype.reset=function(){this.h.reset();this.j=this.h.h;this.i=this.l=-1}; +function ub(a){var b=a.h;if(b.h==b.j)return!1;a.j=a.h.h;var c=ob(a.h)>>>0;b=c>>>3;c&=7;if(!(0<=c&&5>=c))throw Ya(c,a.j);if(1>b)throw Error("Invalid field number: "+b+" (at position "+a.j+")");a.l=b;a.i=c;return!0} +function vb(a){switch(a.i){case 0:if(0!=a.i)vb(a);else a:{a=a.h;for(var b=a.h,c=b+10,d=a.i;b>>0,a=a.h,L(a,a.h+b));break;case 5:a=a.h;L(a,a.h+4);break;case 3:b=a.l;do{if(!ub(a))throw Error("Unmatched start-group tag: stream EOF");if(4==a.i){if(a.l!=b)throw Error("Unmatched end-group tag");break}vb(a)}while(1);break;default:throw Ya(a.i,a.j);}}var wb=[];function xb(){this.j=[];this.i=0;this.h=new rb}function N(a,b){0!==b.length&&(a.j.push(b),a.i+=b.length)}function yb(a,b){if(b=b.R){N(a,a.h.end());for(var c=0;c=a.i?a.B?a.B[b]:void 0:a.o[b+a.G]}function U(a,b,c,d){Hb(a);Kb(a,b,c,d)}function Kb(a,b,c,d){a.j&&(a.j=void 0);b>=a.i||d?Jb(a)[b]=c:(a.o[b+a.G]=c,(a=a.B)&&b in a&&delete a[b])}function Lb(a,b,c,d){var e=S(a,b);Array.isArray(e)||(e=Fb);var g=Q(e);g&1||Ab(e);if(d)g&2||P(e,2),c&1||Object.freeze(e);else{d=!(c&2);var f=g&2;c&1||!f?d&&g&16&&!f&&zb(e,16):(e=Ab(Array.prototype.slice.call(e)),Kb(a,b,e))}return e} +function Mb(a,b){var c=S(a,b);var d=null==c?c:"number"===typeof c||"NaN"===c||"Infinity"===c||"-Infinity"===c?Number(c):void 0;null!=d&&d!==c&&Kb(a,b,d);return d} +function Nb(a,b,c,d,e){a.h||(a.h={});var g=a.h[c],f=Lb(a,c,3,e);if(!g){var h=f;g=[];var k=!!(Q(a.o)&16);f=!!(Q(h)&2);var l=h;!e&&f&&(h=Array.prototype.slice.call(h));for(var m=f,r=0;rf&&"number"!==typeof a[f]){var h=a[f++];c(b,h)}for(;f>>0;a=2*(f>>31)+1;g=f>>>23&255;f&=8388607;U(b,c,255==g?f?NaN:Infinity*a:0==g?a*Math.pow(2,-149)*f:a*Math.pow(2,g-150)*(f+Math.pow(2,23)));return!0},function(a,b,c){b=Mb(b,c);if(null!=b){M(a.h,8*c+5);a=a.h;var d=+b;0===d?0<1/d?G=H=0:(H=0,G=2147483648):isNaN(d)?(H=0,G=2147483647):(d=(c=0>d?-2147483648:0)?-d:d,3.4028234663852886E38>> +0):1.1754943508222875E-38>d?(d=Math.round(d/Math.pow(2,-149)),H=0,G=(c|d)>>>0):(b=Math.floor(Math.log(d)/Math.LN2),d*=Math.pow(2,-b),d=Math.round(8388608*d),16777216<=d&&++b,H=0,G=(c|b+127<<23|d&8388607)>>>0));c=G;a.h.push(c>>>0&255);a.h.push(c>>>8&255);a.h.push(c>>>16&255);a.h.push(c>>>24&255)}}),Bc=Ac(function(a,b,c){if(0!==a.i)return!1;var d=a.h,e=0,g=a=0,f=d.i,h=d.h;do{var k=f[h++];e|=(k&127)<g&&k&128);32>4);for(g=3;32>g&&k&128;g+=7)k=f[h++],a|=(k&127)<k){d=e>>>0;k=a>>>0;if(a=k&2147483648)d=~d+1>>>0,k=~k>>>0,0==d&&(k=k+1>>>0);d=4294967296*k+(d>>>0)}else throw Za();U(b,c,a?-d:d);return!0},function(a,b,c){b=S(b,c);null!=b&&("string"===typeof b&&Wa(b),null!=b&&(M(a.h,8*c),"number"===typeof b?(a=a.h,Sa(b),sb(a,G,H)):(c=Wa(b),sb(a.h,c.i,c.h))))}),Cc=Ac(function(a,b,c){if(0!==a.i)return!1;U(b,c,ob(a.h));return!0},function(a,b,c){b=S(b,c);if(null!=b&&null!=b)if(M(a.h,8*c),a=a.h,c=b,0<=c)M(a,c);else{for(b=0;9>b;b++)a.h.push(c&127|128),c>>=7;a.h.push(1)}}), +Dc=Ac(function(a,b,c){if(2!==a.i)return!1;var d=ob(a.h)>>>0;a=a.h;var e=pb(a,d);a=a.i;if(db){var g=a,f;(f=cb)||(f=cb=new TextDecoder("utf-8",{fatal:!0}));a=e+d;g=0===e&&a===g.length?g:g.subarray(e,a);try{var h=f.decode(g)}catch(r){if(void 0===bb){try{f.decode(new Uint8Array([128]))}catch(p){}try{f.decode(new Uint8Array([97])),bb=!0}catch(p){bb=!1}}!bb&&(cb=void 0);throw r;}}else{h=e;d=h+d;e=[];for(var k=null,l,m;hl?e.push(l):224>l?h>=d?K():(m=a[h++],194>l||128!==(m&192)?(h--,K()): +e.push((l&31)<<6|m&63)):240>l?h>=d-1?K():(m=a[h++],128!==(m&192)||224===l&&160>m||237===l&&160<=m||128!==((g=a[h++])&192)?(h--,K()):e.push((l&15)<<12|(m&63)<<6|g&63)):244>=l?h>=d-2?K():(m=a[h++],128!==(m&192)||0!==(l<<28)+(m-144)>>30||128!==((g=a[h++])&192)||128!==((f=a[h++])&192)?(h--,K()):(l=(l&7)<<18|(m&63)<<12|(g&63)<<6|f&63,l-=65536,e.push((l>>10&1023)+55296,(l&1023)+56320))):K(),8192<=e.length&&(k=ab(k,e),e.length=0);h=ab(k,e)}U(b,c,h);return!0},function(a,b,c){b=S(b,c);if(null!=b){var d=!1; +d=void 0===d?!1:d;if(fb){if(d&&/(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])/.test(b))throw Error("Found an unpaired surrogate");b=(eb||(eb=new TextEncoder)).encode(b)}else{for(var e=0,g=new Uint8Array(3*b.length),f=0;fh)g[e++]=h;else{if(2048>h)g[e++]=h>>6|192;else{if(55296<=h&&57343>=h){if(56319>=h&&f=k){h=1024*(h-55296)+k-56320+65536;g[e++]=h>>18|240;g[e++]=h>>12&63|128; +g[e++]=h>>6&63|128;g[e++]=h&63|128;continue}else f--}if(d)throw Error("Found an unpaired surrogate");h=65533}g[e++]=h>>12|224;g[e++]=h>>6&63|128}g[e++]=h&63|128}}b=e===g.length?g:g.subarray(0,e)}M(a.h,8*c+2);M(a.h,b.length);N(a,a.h.end());N(a,b)}}),Ec=Ac(function(a,b,c,d,e){if(2!==a.i)return!1;b=Qb(b,c,d);c=a.h.j;d=ob(a.h)>>>0;var g=a.h.h+d,f=g-c;0>=f&&(a.h.j=g,e(b,a,void 0,void 0,void 0),f=g-a.h.h);if(f)throw Error("Message parsing ended unexpectedly. Expected to read "+(d+" bytes, instead read "+ +(d-f)+" bytes, either the data ended unexpectedly or the message misreported its own length"));a.h.h=g;a.h.j=c;return!0},function(a,b,c,d,e){b=Ob(b,d,c);if(null!=b)for(d=0;d>>=7,f.i++;g.push(h);f.i++}});function Fc(a){return function(b,c){a:{if(wb.length){var d=wb.pop();d.setOptions(c);nb(d.h,b,c);b=d}else b=new tb(b,c);try{var e=hc(a);var g=ic(new e.P,b,e);break a}finally{e=b.h,e.i=null,e.m=!1,e.l=0,e.j=0,e.h=0,e.S=!1,b.l=-1,b.i=-1,100>wb.length&&wb.push(b)}g=void 0}return g}}function Gc(a){return function(){var b=new xb;rc(this,b,qc(a));N(b,b.h.end());for(var c=new Uint8Array(b.i),d=b.j,e=d.length,g=0,f=0;f>>0)+"_",e=0;return b}); +z("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;cc&&(c=Math.max(0,e+c));if(null==d||d>e)d=e;d=Number(d);0>d&&(d=Math.max(0,e+d));for(c=Number(c||0);cc&&(c=Math.max(c+e,0));c>4);64!=f&&(b(g<<4&240|f>>2),64!=h&&b(f<<6&192|h))}} +function Ga(){if(!Da){Da={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++){var d=a.concat(b[c].split(""));Ca[c]=d;for(var e=0;e>2];f=b[(f&3)<<4|h>>4];h=b[(h&15)<<2|k>>6];k=b[k&63];c[g++]=l+f+h+k}l=0;k=d;switch(a.length-e){case 2:l=a[e+1],k=b[(l&15)<<2]||d;case 1:a=a[e],c[g]=b[a>>2]+b[(a&3)<<4|l>>4]+k+d}return c.join("")}for(b="";10240a;a=Math.abs(a);var c=a>>>0;a=Math.floor((a-c)/4294967296);b&&(c=A(Sa(c,a)),b=c.next().value,a=c.next().value,c=b);H=c>>>0;K=a>>>0}var Ta="function"===typeof BigInt;function Sa(a,b){b=~b;a?a=~a+1:b+=1;return[a,b]};function Ua(a,b){this.i=a>>>0;this.h=b>>>0} +function Va(a){if(!a)return Wa||(Wa=new Ua(0,0));if(!/^-?\d+$/.test(a))return null;if(16>a.length)Ra(Number(a));else if(Ta)a=BigInt(a),H=Number(a&BigInt(4294967295))>>>0,K=Number(a>>BigInt(32)&BigInt(4294967295));else{var b=+("-"===a[0]);K=H=0;for(var c=a.length,d=b,e=(c-b)%6+b;e<=c;d=e,e+=6)d=Number(a.slice(d,e)),K*=1E6,H=1E6*H+d,4294967296<=H&&(K+=H/4294967296|0,H%=4294967296);b&&(b=A(Sa(H,K)),a=b.next().value,b=b.next().value,H=a,K=b)}return new Ua(H,K)}var Wa;function Xa(a,b){return Error("Invalid wire type: "+a+" (at position "+b+")")}function Ya(){return Error("Failed to read varint, encoding is invalid.")}function Za(a,b){return Error("Tried to read past the end of the data "+b+" > "+a)};function L(){throw Error("Invalid UTF8");}function $a(a,b){b=String.fromCharCode.apply(null,b);return null==a?b:a+b}var ab=void 0,bb,cb="undefined"!==typeof TextDecoder,db,eb="undefined"!==typeof TextEncoder;var fb;function gb(a){if(a!==Pa)throw Error("illegal external caller");}function hb(a,b){gb(b);this.V=a;if(null!=a&&0===a.length)throw Error("ByteString should be constructed with non-empty values");}function ib(){return fb||(fb=new hb(null,Pa))}function jb(a){gb(Pa);var b=a.V;b=null==b||Ha&&null!=b&&b instanceof Uint8Array?b:"string"===typeof b?Ma(b):null;return null==b?b:a.V=b};function kb(a){if("string"===typeof a)return{buffer:Ma(a),C:!1};if(Array.isArray(a))return{buffer:new Uint8Array(a),C:!1};if(a.constructor===Uint8Array)return{buffer:a,C:!1};if(a.constructor===ArrayBuffer)return{buffer:new Uint8Array(a),C:!1};if(a.constructor===hb)return{buffer:jb(a)||Oa(),C:!0};if(a instanceof Uint8Array)return{buffer:new Uint8Array(a.buffer,a.byteOffset,a.byteLength),C:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers"); +};function lb(a,b){this.i=null;this.m=!1;this.h=this.j=this.l=0;mb(this,a,b)}function mb(a,b,c){c=void 0===c?{}:c;a.S=void 0===c.S?!1:c.S;b&&(b=kb(b),a.i=b.buffer,a.m=b.C,a.l=0,a.j=a.i.length,a.h=a.l)}lb.prototype.reset=function(){this.h=this.l};function M(a,b){a.h=b;if(b>a.j)throw Za(a.j,b);} +function nb(a){var b=a.i,c=a.h,d=b[c++],e=d&127;if(d&128&&(d=b[c++],e|=(d&127)<<7,d&128&&(d=b[c++],e|=(d&127)<<14,d&128&&(d=b[c++],e|=(d&127)<<21,d&128&&(d=b[c++],e|=d<<28,d&128&&b[c++]&128&&b[c++]&128&&b[c++]&128&&b[c++]&128&&b[c++]&128)))))throw Ya();M(a,c);return e}function ob(a,b){if(0>b)throw Error("Tried to read a negative byte length: "+b);var c=a.h,d=c+b;if(d>a.j)throw Za(b,a.j-c);a.h=d;return c}var pb=[];function qb(){this.h=[]}qb.prototype.length=function(){return this.h.length};qb.prototype.end=function(){var a=this.h;this.h=[];return a};function rb(a,b,c){for(;0>>7|c<<25)>>>0,c>>>=7;a.h.push(b)}function N(a,b){for(;127>>=7;a.h.push(b)};function sb(a,b){if(pb.length){var c=pb.pop();mb(c,a,b);a=c}else a=new lb(a,b);this.h=a;this.j=this.h.h;this.i=this.l=-1;this.setOptions(b)}sb.prototype.setOptions=function(a){a=void 0===a?{}:a;this.ca=void 0===a.ca?!1:a.ca};sb.prototype.reset=function(){this.h.reset();this.j=this.h.h;this.i=this.l=-1}; +function tb(a){var b=a.h;if(b.h==b.j)return!1;a.j=a.h.h;var c=nb(a.h)>>>0;b=c>>>3;c&=7;if(!(0<=c&&5>=c))throw Xa(c,a.j);if(1>b)throw Error("Invalid field number: "+b+" (at position "+a.j+")");a.l=b;a.i=c;return!0} +function ub(a){switch(a.i){case 0:if(0!=a.i)ub(a);else a:{a=a.h;for(var b=a.h,c=b+10,d=a.i;b>>0,a=a.h,M(a,a.h+b));break;case 5:a=a.h;M(a,a.h+4);break;case 3:b=a.l;do{if(!tb(a))throw Error("Unmatched start-group tag: stream EOF");if(4==a.i){if(a.l!=b)throw Error("Unmatched end-group tag");break}ub(a)}while(1);break;default:throw Xa(a.i,a.j);}}var vb=[];function wb(){this.j=[];this.i=0;this.h=new qb}function O(a,b){0!==b.length&&(a.j.push(b),a.i+=b.length)}function xb(a,b){if(b=b.R){O(a,a.h.end());for(var c=0;c=a.i?a.B?a.B[b]:void 0:a.o[b+a.G]}function V(a,b,c,d){Gb(a);Jb(a,b,c,d)}function Jb(a,b,c,d){a.j&&(a.j=void 0);b>=a.i||d?Ib(a)[b]=c:(a.o[b+a.G]=c,(a=a.B)&&b in a&&delete a[b])}function Kb(a,b,c,d){var e=T(a,b);Array.isArray(e)||(e=Eb);var g=R(e);g&1||zb(e);if(d)g&2||Q(e,2),c&1||Object.freeze(e);else{d=!(c&2);var f=g&2;c&1||!f?d&&g&16&&!f&&yb(e,16):(e=zb(Array.prototype.slice.call(e)),Jb(a,b,e))}return e} +function Lb(a,b){var c=T(a,b);var d=null==c?c:"number"===typeof c||"NaN"===c||"Infinity"===c||"-Infinity"===c?Number(c):void 0;null!=d&&d!==c&&Jb(a,b,d);return d} +function Mb(a,b,c,d,e){a.h||(a.h={});var g=a.h[c],f=Kb(a,c,3,e);if(!g){var h=f;g=[];var k=!!(R(a.o)&16);f=!!(R(h)&2);var l=h;!e&&f&&(h=Array.prototype.slice.call(h));for(var m=f,r=0;rf&&"number"!==typeof a[f]){var h=a[f++];c(b,h)}for(;f>>0;a=2*(f>>31)+1;g=f>>>23&255;f&=8388607;V(b,c,255==g?f?NaN:Infinity*a:0==g?a*Math.pow(2,-149)*f:a*Math.pow(2,g-150)*(f+Math.pow(2,23)));return!0},function(a,b,c){b=Lb(b,c);if(null!=b){N(a.h,8*c+5);a=a.h;var d=+b;0===d?0<1/d?H=K=0:(K=0,H=2147483648):isNaN(d)?(K=0,H=2147483647):(d=(c=0>d?-2147483648:0)?-d:d,3.4028234663852886E38>> +0):1.1754943508222875E-38>d?(d=Math.round(d/Math.pow(2,-149)),K=0,H=(c|d)>>>0):(b=Math.floor(Math.log(d)/Math.LN2),d*=Math.pow(2,-b),d=Math.round(8388608*d),16777216<=d&&++b,K=0,H=(c|b+127<<23|d&8388607)>>>0));c=H;a.h.push(c>>>0&255);a.h.push(c>>>8&255);a.h.push(c>>>16&255);a.h.push(c>>>24&255)}}),Ac=zc(function(a,b,c){if(0!==a.i)return!1;var d=a.h,e=0,g=a=0,f=d.i,h=d.h;do{var k=f[h++];e|=(k&127)<g&&k&128);32>4);for(g=3;32>g&&k&128;g+=7)k=f[h++],a|=(k&127)<k){d=e>>>0;k=a>>>0;if(a=k&2147483648)d=~d+1>>>0,k=~k>>>0,0==d&&(k=k+1>>>0);d=4294967296*k+(d>>>0)}else throw Ya();V(b,c,a?-d:d);return!0},function(a,b,c){b=T(b,c);null!=b&&("string"===typeof b&&Va(b),null!=b&&(N(a.h,8*c),"number"===typeof b?(a=a.h,Ra(b),rb(a,H,K)):(c=Va(b),rb(a.h,c.i,c.h))))}),Bc=zc(function(a,b,c){if(0!==a.i)return!1;V(b,c,nb(a.h));return!0},function(a,b,c){b=T(b,c);if(null!=b&&null!=b)if(N(a.h,8*c),a=a.h,c=b,0<=c)N(a,c);else{for(b=0;9>b;b++)a.h.push(c&127|128),c>>=7;a.h.push(1)}}), +Cc=zc(function(a,b,c){if(2!==a.i)return!1;var d=nb(a.h)>>>0;a=a.h;var e=ob(a,d);a=a.i;if(cb){var g=a,f;(f=bb)||(f=bb=new TextDecoder("utf-8",{fatal:!0}));a=e+d;g=0===e&&a===g.length?g:g.subarray(e,a);try{var h=f.decode(g)}catch(r){if(void 0===ab){try{f.decode(new Uint8Array([128]))}catch(p){}try{f.decode(new Uint8Array([97])),ab=!0}catch(p){ab=!1}}!ab&&(bb=void 0);throw r;}}else{h=e;d=h+d;e=[];for(var k=null,l,m;hl?e.push(l):224>l?h>=d?L():(m=a[h++],194>l||128!==(m&192)?(h--,L()): +e.push((l&31)<<6|m&63)):240>l?h>=d-1?L():(m=a[h++],128!==(m&192)||224===l&&160>m||237===l&&160<=m||128!==((g=a[h++])&192)?(h--,L()):e.push((l&15)<<12|(m&63)<<6|g&63)):244>=l?h>=d-2?L():(m=a[h++],128!==(m&192)||0!==(l<<28)+(m-144)>>30||128!==((g=a[h++])&192)||128!==((f=a[h++])&192)?(h--,L()):(l=(l&7)<<18|(m&63)<<12|(g&63)<<6|f&63,l-=65536,e.push((l>>10&1023)+55296,(l&1023)+56320))):L(),8192<=e.length&&(k=$a(k,e),e.length=0);h=$a(k,e)}V(b,c,h);return!0},function(a,b,c){b=T(b,c);if(null!=b){var d=!1; +d=void 0===d?!1:d;if(eb){if(d&&/(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])/.test(b))throw Error("Found an unpaired surrogate");b=(db||(db=new TextEncoder)).encode(b)}else{for(var e=0,g=new Uint8Array(3*b.length),f=0;fh)g[e++]=h;else{if(2048>h)g[e++]=h>>6|192;else{if(55296<=h&&57343>=h){if(56319>=h&&f=k){h=1024*(h-55296)+k-56320+65536;g[e++]=h>>18|240;g[e++]=h>>12&63|128; +g[e++]=h>>6&63|128;g[e++]=h&63|128;continue}else f--}if(d)throw Error("Found an unpaired surrogate");h=65533}g[e++]=h>>12|224;g[e++]=h>>6&63|128}g[e++]=h&63|128}}b=e===g.length?g:g.subarray(0,e)}N(a.h,8*c+2);N(a.h,b.length);O(a,a.h.end());O(a,b)}}),Dc=zc(function(a,b,c,d,e){if(2!==a.i)return!1;b=Pb(b,c,d);c=a.h.j;d=nb(a.h)>>>0;var g=a.h.h+d,f=g-c;0>=f&&(a.h.j=g,e(b,a,void 0,void 0,void 0),f=g-a.h.h);if(f)throw Error("Message parsing ended unexpectedly. Expected to read "+(d+" bytes, instead read "+ +(d-f)+" bytes, either the data ended unexpectedly or the message misreported its own length"));a.h.h=g;a.h.j=c;return!0},function(a,b,c,d,e){b=Nb(b,d,c);if(null!=b)for(d=0;d>>=7,f.i++;g.push(h);f.i++}});function Ec(a){return function(b,c){a:{if(vb.length){var d=vb.pop();d.setOptions(c);mb(d.h,b,c);b=d}else b=new sb(b,c);try{var e=gc(a);var g=hc(new e.P,b,e);break a}finally{e=b.h,e.i=null,e.m=!1,e.l=0,e.j=0,e.h=0,e.S=!1,b.l=-1,b.i=-1,100>vb.length&&vb.push(b)}g=void 0}return g}}function Fc(a){return function(){var b=new wb;qc(this,b,pc(a));O(b,b.h.end());for(var c=new Uint8Array(b.i),d=b.j,e=d.length,g=0,f=0;f>>0)+"_",e=0;return b}); +z("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;cc&&(c=Math.max(0,e+c));if(null==d||d>e)d=e;d=Number(d);0>d&&(d=Math.max(0,e+d));for(c=Number(c||0);cc&&(c=Math.max(c+e,0));c>4);64!=f&&(b(g<<4&240|f>>2),64!=h&&b(f<<6&192|h))}} +function Ha(){if(!Ea){Ea={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++){var d=a.concat(b[c].split(""));Da[c]=d;for(var e=0;e>2];f=b[(f&3)<<4|h>>4];h=b[(h&15)<<2|k>>6];k=b[k&63];c[g++]=l+f+h+k}l=0;k=d;switch(a.length-e){case 2:l=a[e+1],k=b[(l&15)<<2]||d;case 1:a=a[e],c[g]=b[a>>2]+b[(a&3)<<4|l>>4]+k+d}return c.join("")}for(b="";10240a;a=Math.abs(a);var c=a>>>0;a=Math.floor((a-c)/4294967296);b&&(c=A(Ta(c,a)),b=c.next().value,a=c.next().value,c=b);G=c>>>0;H=a>>>0}var Ua="function"===typeof BigInt;function Ta(a,b){b=~b;a?a=~a+1:b+=1;return[a,b]};function Va(a,b){this.i=a>>>0;this.h=b>>>0} +function Wa(a){if(!a)return Xa||(Xa=new Va(0,0));if(!/^-?\d+$/.test(a))return null;if(16>a.length)Sa(Number(a));else if(Ua)a=BigInt(a),G=Number(a&BigInt(4294967295))>>>0,H=Number(a>>BigInt(32)&BigInt(4294967295));else{var b=+("-"===a[0]);H=G=0;for(var c=a.length,d=b,e=(c-b)%6+b;e<=c;d=e,e+=6)d=Number(a.slice(d,e)),H*=1E6,G=1E6*G+d,4294967296<=G&&(H+=G/4294967296|0,G%=4294967296);b&&(b=A(Ta(G,H)),a=b.next().value,b=b.next().value,G=a,H=b)}return new Va(G,H)}var Xa;function Ya(a,b){return Error("Invalid wire type: "+a+" (at position "+b+")")}function Za(){return Error("Failed to read varint, encoding is invalid.")}function $a(a,b){return Error("Tried to read past the end of the data "+b+" > "+a)};function K(){throw Error("Invalid UTF8");}function ab(a,b){b=String.fromCharCode.apply(null,b);return null==a?b:a+b}var bb=void 0,cb,db="undefined"!==typeof TextDecoder,eb,fb="undefined"!==typeof TextEncoder;var gb;function hb(a){if(a!==Qa)throw Error("illegal external caller");}function ib(a,b){hb(b);this.V=a;if(null!=a&&0===a.length)throw Error("ByteString should be constructed with non-empty values");}function jb(){return gb||(gb=new ib(null,Qa))}function kb(a){hb(Qa);var b=a.V;b=null==b||Ia&&null!=b&&b instanceof Uint8Array?b:"string"===typeof b?Na(b):null;return null==b?b:a.V=b};function lb(a){if("string"===typeof a)return{buffer:Na(a),C:!1};if(Array.isArray(a))return{buffer:new Uint8Array(a),C:!1};if(a.constructor===Uint8Array)return{buffer:a,C:!1};if(a.constructor===ArrayBuffer)return{buffer:new Uint8Array(a),C:!1};if(a.constructor===ib)return{buffer:kb(a)||Pa(),C:!0};if(a instanceof Uint8Array)return{buffer:new Uint8Array(a.buffer,a.byteOffset,a.byteLength),C:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers"); +};function mb(a,b){this.i=null;this.m=!1;this.h=this.j=this.l=0;nb(this,a,b)}function nb(a,b,c){c=void 0===c?{}:c;a.S=void 0===c.S?!1:c.S;b&&(b=lb(b),a.i=b.buffer,a.m=b.C,a.l=0,a.j=a.i.length,a.h=a.l)}mb.prototype.reset=function(){this.h=this.l};function L(a,b){a.h=b;if(b>a.j)throw $a(a.j,b);} +function ob(a){var b=a.i,c=a.h,d=b[c++],e=d&127;if(d&128&&(d=b[c++],e|=(d&127)<<7,d&128&&(d=b[c++],e|=(d&127)<<14,d&128&&(d=b[c++],e|=(d&127)<<21,d&128&&(d=b[c++],e|=d<<28,d&128&&b[c++]&128&&b[c++]&128&&b[c++]&128&&b[c++]&128&&b[c++]&128)))))throw Za();L(a,c);return e}function pb(a,b){if(0>b)throw Error("Tried to read a negative byte length: "+b);var c=a.h,d=c+b;if(d>a.j)throw $a(b,a.j-c);a.h=d;return c}var qb=[];function rb(){this.h=[]}rb.prototype.length=function(){return this.h.length};rb.prototype.end=function(){var a=this.h;this.h=[];return a};function sb(a,b,c){for(;0>>7|c<<25)>>>0,c>>>=7;a.h.push(b)}function M(a,b){for(;127>>=7;a.h.push(b)};function tb(a,b){if(qb.length){var c=qb.pop();nb(c,a,b);a=c}else a=new mb(a,b);this.h=a;this.j=this.h.h;this.i=this.l=-1;this.setOptions(b)}tb.prototype.setOptions=function(a){a=void 0===a?{}:a;this.ca=void 0===a.ca?!1:a.ca};tb.prototype.reset=function(){this.h.reset();this.j=this.h.h;this.i=this.l=-1}; +function ub(a){var b=a.h;if(b.h==b.j)return!1;a.j=a.h.h;var c=ob(a.h)>>>0;b=c>>>3;c&=7;if(!(0<=c&&5>=c))throw Ya(c,a.j);if(1>b)throw Error("Invalid field number: "+b+" (at position "+a.j+")");a.l=b;a.i=c;return!0} +function vb(a){switch(a.i){case 0:if(0!=a.i)vb(a);else a:{a=a.h;for(var b=a.h,c=b+10,d=a.i;b>>0,a=a.h,L(a,a.h+b));break;case 5:a=a.h;L(a,a.h+4);break;case 3:b=a.l;do{if(!ub(a))throw Error("Unmatched start-group tag: stream EOF");if(4==a.i){if(a.l!=b)throw Error("Unmatched end-group tag");break}vb(a)}while(1);break;default:throw Ya(a.i,a.j);}}var wb=[];function xb(){this.j=[];this.i=0;this.h=new rb}function N(a,b){0!==b.length&&(a.j.push(b),a.i+=b.length)}function yb(a,b){if(b=b.R){N(a,a.h.end());for(var c=0;c=a.i?a.B?a.B[b]:void 0:a.o[b+a.G]}function U(a,b,c,d){Hb(a);Kb(a,b,c,d)}function Kb(a,b,c,d){a.j&&(a.j=void 0);b>=a.i||d?Jb(a)[b]=c:(a.o[b+a.G]=c,(a=a.B)&&b in a&&delete a[b])}function Lb(a,b,c,d){var e=S(a,b);Array.isArray(e)||(e=Fb);var g=Q(e);g&1||Ab(e);if(d)g&2||P(e,2),c&1||Object.freeze(e);else{d=!(c&2);var f=g&2;c&1||!f?d&&g&16&&!f&&zb(e,16):(e=Ab(Array.prototype.slice.call(e)),Kb(a,b,e))}return e} +function Mb(a,b){var c=S(a,b);var d=null==c?c:"number"===typeof c||"NaN"===c||"Infinity"===c||"-Infinity"===c?Number(c):void 0;null!=d&&d!==c&&Kb(a,b,d);return d} +function Nb(a,b,c,d,e){a.h||(a.h={});var g=a.h[c],f=Lb(a,c,3,e);if(!g){var h=f;g=[];var k=!!(Q(a.o)&16);f=!!(Q(h)&2);var l=h;!e&&f&&(h=Array.prototype.slice.call(h));for(var m=f,r=0;rf&&"number"!==typeof a[f]){var h=a[f++];c(b,h)}for(;f>>0;a=2*(f>>31)+1;g=f>>>23&255;f&=8388607;U(b,c,255==g?f?NaN:Infinity*a:0==g?a*Math.pow(2,-149)*f:a*Math.pow(2,g-150)*(f+Math.pow(2,23)));return!0},function(a,b,c){b=Mb(b,c);if(null!=b){M(a.h,8*c+5);a=a.h;var d=+b;0===d?0<1/d?G=H=0:(H=0,G=2147483648):isNaN(d)?(H=0,G=2147483647):(d=(c=0>d?-2147483648:0)?-d:d,3.4028234663852886E38>> +0):1.1754943508222875E-38>d?(d=Math.round(d/Math.pow(2,-149)),H=0,G=(c|d)>>>0):(b=Math.floor(Math.log(d)/Math.LN2),d*=Math.pow(2,-b),d=Math.round(8388608*d),16777216<=d&&++b,H=0,G=(c|b+127<<23|d&8388607)>>>0));c=G;a.h.push(c>>>0&255);a.h.push(c>>>8&255);a.h.push(c>>>16&255);a.h.push(c>>>24&255)}}),Bc=Ac(function(a,b,c){if(0!==a.i)return!1;var d=a.h,e=0,g=a=0,f=d.i,h=d.h;do{var k=f[h++];e|=(k&127)<g&&k&128);32>4);for(g=3;32>g&&k&128;g+=7)k=f[h++],a|=(k&127)<k){d=e>>>0;k=a>>>0;if(a=k&2147483648)d=~d+1>>>0,k=~k>>>0,0==d&&(k=k+1>>>0);d=4294967296*k+(d>>>0)}else throw Za();U(b,c,a?-d:d);return!0},function(a,b,c){b=S(b,c);null!=b&&("string"===typeof b&&Wa(b),null!=b&&(M(a.h,8*c),"number"===typeof b?(a=a.h,Sa(b),sb(a,G,H)):(c=Wa(b),sb(a.h,c.i,c.h))))}),Cc=Ac(function(a,b,c){if(0!==a.i)return!1;U(b,c,ob(a.h));return!0},function(a,b,c){b=S(b,c);if(null!=b&&null!=b)if(M(a.h,8*c),a=a.h,c=b,0<=c)M(a,c);else{for(b=0;9>b;b++)a.h.push(c&127|128),c>>=7;a.h.push(1)}}), +Dc=Ac(function(a,b,c){if(2!==a.i)return!1;var d=ob(a.h)>>>0;a=a.h;var e=pb(a,d);a=a.i;if(db){var g=a,f;(f=cb)||(f=cb=new TextDecoder("utf-8",{fatal:!0}));a=e+d;g=0===e&&a===g.length?g:g.subarray(e,a);try{var h=f.decode(g)}catch(r){if(void 0===bb){try{f.decode(new Uint8Array([128]))}catch(p){}try{f.decode(new Uint8Array([97])),bb=!0}catch(p){bb=!1}}!bb&&(cb=void 0);throw r;}}else{h=e;d=h+d;e=[];for(var k=null,l,m;hl?e.push(l):224>l?h>=d?K():(m=a[h++],194>l||128!==(m&192)?(h--,K()): +e.push((l&31)<<6|m&63)):240>l?h>=d-1?K():(m=a[h++],128!==(m&192)||224===l&&160>m||237===l&&160<=m||128!==((g=a[h++])&192)?(h--,K()):e.push((l&15)<<12|(m&63)<<6|g&63)):244>=l?h>=d-2?K():(m=a[h++],128!==(m&192)||0!==(l<<28)+(m-144)>>30||128!==((g=a[h++])&192)||128!==((f=a[h++])&192)?(h--,K()):(l=(l&7)<<18|(m&63)<<12|(g&63)<<6|f&63,l-=65536,e.push((l>>10&1023)+55296,(l&1023)+56320))):K(),8192<=e.length&&(k=ab(k,e),e.length=0);h=ab(k,e)}U(b,c,h);return!0},function(a,b,c){b=S(b,c);if(null!=b){var d=!1; +d=void 0===d?!1:d;if(fb){if(d&&/(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])/.test(b))throw Error("Found an unpaired surrogate");b=(eb||(eb=new TextEncoder)).encode(b)}else{for(var e=0,g=new Uint8Array(3*b.length),f=0;fh)g[e++]=h;else{if(2048>h)g[e++]=h>>6|192;else{if(55296<=h&&57343>=h){if(56319>=h&&f=k){h=1024*(h-55296)+k-56320+65536;g[e++]=h>>18|240;g[e++]=h>>12&63|128; +g[e++]=h>>6&63|128;g[e++]=h&63|128;continue}else f--}if(d)throw Error("Found an unpaired surrogate");h=65533}g[e++]=h>>12|224;g[e++]=h>>6&63|128}g[e++]=h&63|128}}b=e===g.length?g:g.subarray(0,e)}M(a.h,8*c+2);M(a.h,b.length);N(a,a.h.end());N(a,b)}}),Ec=Ac(function(a,b,c,d,e){if(2!==a.i)return!1;b=Qb(b,c,d);c=a.h.j;d=ob(a.h)>>>0;var g=a.h.h+d,f=g-c;0>=f&&(a.h.j=g,e(b,a,void 0,void 0,void 0),f=g-a.h.h);if(f)throw Error("Message parsing ended unexpectedly. Expected to read "+(d+" bytes, instead read "+ +(d-f)+" bytes, either the data ended unexpectedly or the message misreported its own length"));a.h.h=g;a.h.j=c;return!0},function(a,b,c,d,e){b=Ob(b,d,c);if(null!=b)for(d=0;d>>=7,f.i++;g.push(h);f.i++}});function Fc(a){return function(b,c){a:{if(wb.length){var d=wb.pop();d.setOptions(c);nb(d.h,b,c);b=d}else b=new tb(b,c);try{var e=hc(a);var g=ic(new e.P,b,e);break a}finally{e=b.h,e.i=null,e.m=!1,e.l=0,e.j=0,e.h=0,e.S=!1,b.l=-1,b.i=-1,100>wb.length&&wb.push(b)}g=void 0}return g}}function Gc(a){return function(){var b=new xb;rc(this,b,qc(a));N(b,b.h.end());for(var c=new Uint8Array(b.i),d=b.j,e=d.length,g=0,f=0;fe.data()))),i.map((e=>e.dispose())),e.dispose()}async infer(e,a,i){const d=m.tidy((()=>(e instanceof m.Tensor||(e=m.browser.fromPixels(e)),m.expandDims(e)))),s=d.shape[1],n=d.shape[2],l=await this.model.executeAsync(d),t=l[0].dataSync(),o=l[1].dataSync();d.dispose(),m.dispose(l);const[p,r]=this.calculateMaxScores(t,l[0].shape[1],l[0].shape[2]),c=m.getBackend();"webgl"===m.getBackend()&&m.setBackend("cpu");const y=m.tidy((()=>{const e=m.tensor2d(o,[l[1].shape[1],l[1].shape[3]]);return m.image.nonMaxSuppression(e,p,a,i,i)})),N=y.dataSync();return y.dispose(),c!==m.getBackend()&&m.setBackend(c),this.buildDetectedObjects(n,s,o,p,N,r)}buildDetectedObjects(e,a,m,d,s,n){const l=s.length,t=[];for(let o=0;oa&&(a=e[s*m+i],n=i);i[s]=a,d[s]=n}return[i,d]}async detect(e,a=20,m=.5){return this.infer(e,a,m)}dispose(){null!=this.model&&this.model.dispose()}}e.ObjectDetection=d,e.load=async function(e={}){if(null==m)throw new Error("Cannot find TensorFlow.js. If you are using a + + diff --git a/sortable.min.js b/sortable.min.js new file mode 100644 index 0000000..95423a6 --- /dev/null +++ b/sortable.min.js @@ -0,0 +1,2 @@ +/*! Sortable 1.15.6 - MIT | git://github.com/SortableJS/Sortable.git */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sortable=e()}(this,function(){"use strict";function e(e,t){var n,o=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)),o}function I(o){for(var t=1;tt.length)&&(e=t.length);for(var n=0,o=new Array(e);n"===e[0]&&(e=e.substring(1)),t))try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return}}function g(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function P(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"!==e[0]||t.parentNode===n)&&f(t,e)||o&&t===n)return t}while(t!==n&&(t=g(t)))}return null}var m,v=/\s+/g;function k(t,e,n){var o;t&&e&&(t.classList?t.classList[n?"add":"remove"](e):(o=(" "+t.className+" ").replace(v," ").replace(" "+e+" "," "),t.className=(o+(n?" "+e:"")).replace(v," ")))}function R(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];o[e=!(e in o||-1!==e.indexOf("webkit"))?"-webkit-"+e:e]=n+("string"==typeof n?"":"px")}}function b(t,e){var n="";if("string"==typeof t)n=t;else do{var o=R(t,"transform")}while(o&&"none"!==o&&(n=o+" "+n),!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function D(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=n.left-e&&i<=n.right+e,e=r>=n.top-e&&r<=n.bottom+e;return o&&e?a=t:void 0}}),a);if(e){var n,o={};for(n in t)t.hasOwnProperty(n)&&(o[n]=t[n]);o.target=o.rootEl=e,o.preventDefault=void 0,o.stopPropagation=void 0,e[K]._onDragOver(o)}}var i,r,a}function Ft(t){Z&&Z.parentNode[K]._isOutsideThisEl(t.target)}function jt(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=a({},e),t[K]=this;var n,o,i={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return kt(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==jt.supportPointer&&"PointerEvent"in window&&(!u||c),emptyInsertThreshold:5};for(n in z.initializePlugins(this,t,i),i)n in e||(e[n]=i[n]);for(o in Rt(e),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!e.forceFallback&&It,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?h(t,"pointerdown",this._onTapStart):(h(t,"mousedown",this._onTapStart),h(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(h(t,"dragover",this),h(t,"dragenter",this)),St.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),a(this,A())}function Ht(t,e,n,o,i,r,a,l){var s,c,u=t[K],d=u.options.onMove;return!window.CustomEvent||y||w?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=e,s.from=t,s.dragged=n,s.draggedRect=o,s.related=i||e,s.relatedRect=r||X(e),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),c=d?d.call(u,s,a):c}function Lt(t){t.draggable=!1}function Kt(){xt=!1}function Wt(t){return setTimeout(t,0)}function zt(t){return clearTimeout(t)}jt.prototype={constructor:jt,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(vt=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,Z):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,t=this.options,i=t.preventOnFilter,r=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,l=(a||e).target,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,c=t.filter;if(!function(t){Ot.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&Ot.push(o)}}(o),!Z&&!(/mousedown|pointerdown/.test(r)&&0!==e.button||t.disabled)&&!s.isContentEditable&&(this.nativeDraggable||!u||!l||"SELECT"!==l.tagName.toUpperCase())&&!((l=P(l,t.draggable,o,!1))&&l.animated||et===l)){if(it=j(l),at=j(l,t.draggable),"function"==typeof c){if(c.call(this,e,l,this))return V({sortable:n,rootEl:s,name:"filter",targetEl:l,toEl:o,fromEl:o}),U("filter",n,{evt:e}),void(i&&e.preventDefault())}else if(c=c&&c.split(",").some(function(t){if(t=P(s,t.trim(),o,!1))return V({sortable:n,rootEl:t,name:"filter",targetEl:l,fromEl:o,toEl:o}),U("filter",n,{evt:e}),!0}))return void(i&&e.preventDefault());t.handle&&!P(s,t.handle,o,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,a=i.options,l=r.ownerDocument;n&&!Z&&n.parentNode===r&&(o=X(n),J=r,$=(Z=n).parentNode,tt=Z.nextSibling,et=n,st=a.group,ut={target:jt.dragged=Z,clientX:(e||t).clientX,clientY:(e||t).clientY},ft=ut.clientX-o.left,gt=ut.clientY-o.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,Z.style["will-change"]="all",o=function(){U("delayEnded",i,{evt:t}),jt.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!s&&i.nativeDraggable&&(Z.draggable=!0),i._triggerDragStart(t,e),V({sortable:i,name:"choose",originalEvent:t}),k(Z,a.chosenClass,!0))},a.ignore.split(",").forEach(function(t){D(Z,t.trim(),Lt)}),h(l,"dragover",Bt),h(l,"mousemove",Bt),h(l,"touchmove",Bt),a.supportPointer?(h(l,"pointerup",i._onDrop),this.nativeDraggable||h(l,"pointercancel",i._onDrop)):(h(l,"mouseup",i._onDrop),h(l,"touchend",i._onDrop),h(l,"touchcancel",i._onDrop)),s&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Z.draggable=!0),U("delayStart",this,{evt:t}),!a.delay||a.delayOnTouchOnly&&!e||this.nativeDraggable&&(w||y)?o():jt.eventCanceled?this._onDrop():(a.supportPointer?(h(l,"pointerup",i._disableDelayedDrag),h(l,"pointercancel",i._disableDelayedDrag)):(h(l,"mouseup",i._disableDelayedDrag),h(l,"touchend",i._disableDelayedDrag),h(l,"touchcancel",i._disableDelayedDrag)),h(l,"mousemove",i._delayedDragTouchMoveHandler),h(l,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&h(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,a.delay)))},_delayedDragTouchMoveHandler:function(t){t=t.touches?t.touches[0]:t;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Z&&Lt(Z),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;p(t,"mouseup",this._disableDelayedDrag),p(t,"touchend",this._disableDelayedDrag),p(t,"touchcancel",this._disableDelayedDrag),p(t,"pointerup",this._disableDelayedDrag),p(t,"pointercancel",this._disableDelayedDrag),p(t,"mousemove",this._delayedDragTouchMoveHandler),p(t,"touchmove",this._delayedDragTouchMoveHandler),p(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?h(document,"pointermove",this._onTouchMove):h(document,e?"touchmove":"mousemove",this._onTouchMove):(h(Z,"dragend",this),h(J,"dragstart",this._onDragStart));try{document.selection?Wt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){var n;Dt=!1,J&&Z?(U("dragStarted",this,{evt:e}),this.nativeDraggable&&h(document,"dragover",Ft),n=this.options,t||k(Z,n.dragClass,!1),k(Z,n.ghostClass,!0),jt.active=this,t&&this._appendGhost(),V({sortable:this,name:"start",originalEvent:e})):this._nulling()},_emulateDragOver:function(){if(dt){this._lastX=dt.clientX,this._lastY=dt.clientY,Xt();for(var t=document.elementFromPoint(dt.clientX,dt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(dt.clientX,dt.clientY))!==e;)e=t;if(Z.parentNode[K]._isOutsideThisEl(t),e)do{if(e[K])if(e[K]._onDragOver({clientX:dt.clientX,clientY:dt.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}while(e=g(t=e));Yt()}},_onTouchMove:function(t){if(ut){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=Q&&b(Q,!0),a=Q&&r&&r.a,l=Q&&r&&r.d,e=At&&wt&&E(wt),a=(i.clientX-ut.clientX+o.x)/(a||1)+(e?e[0]-Tt[0]:0)/(a||1),l=(i.clientY-ut.clientY+o.y)/(l||1)+(e?e[1]-Tt[1]:0)/(l||1);if(!jt.active&&!Dt){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))E.right+10||S.clientY>x.bottom&&S.clientX>x.left:S.clientY>E.bottom+10||S.clientX>x.right&&S.clientY>x.top)||m.animated)){if(m&&(t=n,e=r,C=X(B((_=this).el,0,_.options,!0)),_=L(_.el,_.options,Q),e?t.clientX<_.left-10||t.clientY