-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.html
More file actions
7 lines (7 loc) · 64 KB
/
package.html
File metadata and controls
7 lines (7 loc) · 64 KB
1
2
3
4
5
6
7
<!DOCTYPE html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><meta name="format-detection" content="telephone=no"><link rel="manifest" href="app.webmanifest"><link rel="icon" href="img/icon.png"><style>body,html{margin:0;padding:0;height:100%;width:100%;overflow-x:hidden}body{background-color:#f5f5f5;font-family:"Inter var",Inter,system-ui,sans-serif;font-size:1.1rem}.background-image{position:absolute;z-index:-1}.background-image img{width:100%;height:100%;object-fit:contain;object-position:center}#sphereImage{filter:invert(30%)}.icon{height:1em;vertical-align:middle}.container{height:calc(100vh - 110px);width:100%;display:flex;flex-direction:column;justify-content:flex-start;align-items:center}.header{text-align:center;margin-top:10px}#peerconsole{width:50%;height:100%;background-color:#000;color:#0f0;font-family:'Courier New',monospace;font-size:14px;border:1px solid #333;padding:8px;box-sizing:border-box;resize:none;overflow-y:auto;white-space:pre-wrap;border-radius:8px;margin:0;opacity:.6}.splide{height:100%;width:100vw}.splide__track{height:100%}.splide__slide{display:flex;flex-direction:column;justify-content:space-between}.slide-content{display:flex;flex-direction:column;height:100%;width:80%;max-width:1000px;min-width:300px;justify-content:space-between;text-align:center;margin:0 auto}.slide-content{align-items:center}.row{flex:1;width:100%;height:100%;padding-top:5vh;margin-left:2vw;margin-right:2vw}.top-row{font-size:2rem}.middle-row{display:flex;justify-content:center}.row button,.row input:not([type=range]),.row select,.row textarea{background-color:rgba(255,255,255,.8)}.info{font-size:.75rem;color:#bbb;text-align:center;position:fixed;bottom:10px;width:100%;padding:10px;z-index:100}.yo-yo-form{width:16em;display:flex;flex-direction:column;align-items:stretch;gap:1rem;font-size:1.1rem}.yo-yo-form .form-control{position:relative;box-sizing:border-box;padding:10px}.textarea-container{display:flex;flex-direction:column;width:400px}#determination_individual{width:100%;height:100%;font-size:1rem;border:2px solid #ccc;padding:8px;box-sizing:border-box;resize:none;overflow-y:auto;white-space:pre-wrap;border-radius:5px;margin:0}#room_canvas{width:100%;height:100%}#room_container{position:relative;width:50%;height:100%}.room_item{position:absolute;width:50px;height:50px;background:#a9a9a9;border-radius:50%;text-align:center;color:#fff;font-weight:700;transform:translate(-50%,-50%)}.room_item img{width:100%}.room_item span{font-size:14px;color:#000;text-align:center}.slider-container{width:100%}.slider{-webkit-appearance:none;appearance:none;width:50%;height:4px;background:#d3d3d3;outline:0}.slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;border-radius:50%;background:#7f7a7a}.slider::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:#7f7a7a}.ssid{font-style:italic}button,input,select,textarea{font-size:16px;color:#000}ol{margin-left:0;padding-left:1em;text-align:left}#install_button{visibility:hidden}</style><style>.splide__container{box-sizing:border-box;position:relative}.splide__list{backface-visibility:hidden;display:-ms-flexbox;display:flex;height:100%;margin:0!important;padding:0!important}.splide.is-initialized:not(.is-active) .splide__list{display:block}.splide__pagination{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:center;justify-content:center;margin:0;pointer-events:none}.splide__pagination li{display:inline-block;line-height:1;list-style-type:none;margin:0;pointer-events:auto}.splide:not(.is-overflow) .splide__pagination{display:none}.splide__progress__bar{width:0}.splide{position:relative;visibility:hidden}.splide.is-initialized,.splide.is-rendered{visibility:visible}.splide__slide{backface-visibility:hidden;box-sizing:border-box;-ms-flex-negative:0;flex-shrink:0;list-style-type:none!important;margin:0;position:relative}.splide__slide img{vertical-align:bottom}.splide__spinner{animation:splide-loading 1s linear infinite;border:2px solid #999;border-left-color:transparent;border-radius:50%;bottom:0;contain:strict;display:inline-block;height:20px;left:0;margin:auto;position:absolute;right:0;top:0;width:20px}.splide__sr{clip:rect(0 0 0 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.splide__toggle.is-active .splide__toggle__play,.splide__toggle__pause{display:none}.splide__toggle.is-active .splide__toggle__pause{display:inline}.splide__track{overflow:hidden;position:relative;z-index:0}@keyframes splide-loading{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.splide__track--draggable{-webkit-touch-callout:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.splide__track--fade>.splide__list>.splide__slide{margin:0!important;opacity:0;z-index:0}.splide__track--fade>.splide__list>.splide__slide.is-active{opacity:1;z-index:1}.splide--rtl{direction:rtl}.splide__track--ttb>.splide__list{display:block}.splide__arrow{-ms-flex-align:center;align-items:center;background:#ccc;border:0;border-radius:50%;cursor:pointer;display:-ms-flexbox;display:flex;height:2em;-ms-flex-pack:center;justify-content:center;opacity:.7;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:2em;z-index:1}.splide__arrow svg{fill:#000;height:1.2em;width:1.2em}.splide__arrow:hover:not(:disabled){opacity:.9}.splide__arrow:disabled{opacity:.3}.splide__arrow:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide__arrow--prev{left:1em}.splide__arrow--prev svg{transform:scaleX(-1)}.splide__arrow--next{right:1em}.splide.is-focus-in .splide__arrow:focus{outline:3px solid #0bf;outline-offset:3px}.splide__pagination{bottom:.5em;left:0;padding:0 1em;position:absolute;right:0;z-index:1}.splide__pagination__page{background:#ccc;border:0;border-radius:50%;display:inline-block;height:8px;margin:3px;opacity:.7;padding:0;position:relative;transition:transform .2s linear;width:8px}.splide__pagination__page.is-active{background:#fff;transform:scale(1.4);z-index:1}.splide__pagination__page:hover{cursor:pointer;opacity:.9}.splide__pagination__page:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__pagination__page:focus{outline:3px solid #0bf;outline-offset:3px}.splide__progress__bar{background:#ccc;height:3px}.splide__slide{-webkit-tap-highlight-color:transparent}.splide__slide:focus{outline:0}@supports(outline-offset:-3px){.splide__slide:focus-visible{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide__slide:focus-visible{border:3px solid #0bf}}@supports(outline-offset:-3px){.splide.is-focus-in .splide__slide:focus{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide.is-focus-in .splide__slide:focus{border:3px solid #0bf}.splide.is-focus-in .splide__track>.splide__list>.splide__slide:focus{border-color:#0bf}}.splide__toggle{cursor:pointer}.splide__toggle:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__toggle:focus{outline:3px solid #0bf;outline-offset:3px}.splide__track--nav>.splide__list>.splide__slide{border:3px solid transparent;cursor:pointer}.splide__track--nav>.splide__list>.splide__slide.is-active{border:3px solid #000}.splide__arrows--rtl .splide__arrow--prev{left:auto;right:1em}.splide__arrows--rtl .splide__arrow--prev svg{transform:scaleX(1)}.splide__arrows--rtl .splide__arrow--next{left:1em;right:auto}.splide__arrows--rtl .splide__arrow--next svg{transform:scaleX(-1)}.splide__arrows--ttb .splide__arrow{left:50%;transform:translate(-50%)}.splide__arrows--ttb .splide__arrow--prev{top:1em}.splide__arrows--ttb .splide__arrow--prev svg{transform:rotate(-90deg)}.splide__arrows--ttb .splide__arrow--next{bottom:1em;top:auto}.splide__arrows--ttb .splide__arrow--next svg{transform:rotate(90deg)}.splide__pagination--ttb{bottom:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;left:auto;padding:1em 0;right:.5em;top:0}</style><script>function r(n,t){for(var e=0;e<t.length;e++){var i=t[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}function Jt(n,t,e){t&&r(n.prototype,t),e&&r(n,e),Object.defineProperty(n,"prototype",{writable:!1})}
/*!
* Splide.js
* Version : 4.1.4
* License : MIT
* Copyright: 2022 Naotoshi Fujita
*/var n,t;n=this,t=function(){"use strict";var n="(prefers-reduced-motion: reduce)",t={CREATED:1,MOUNTED:2,IDLE:3,MOVING:4,SCROLLING:5,DRAGGING:6,DESTROYED:7};function e(n){n.length=0}function i(n,t,e){return Array.prototype.slice.call(n,t,e)}function o(n){return n.bind.apply(n,[null].concat(i(arguments,1)))}function r(){}var u=setTimeout;function s(n){return requestAnimationFrame(n)}function c(n,t){return typeof t===n}function a(n){return!h(n)&&c("object",n)}var l=Array.isArray,f=o(c,"function"),d=o(c,"string"),p=o(c,"undefined");function h(n){return null===n}function v(n){try{return n instanceof(n.ownerDocument.defaultView||window).HTMLElement}catch(n){return!1}}function g(n){return l(n)?n:[n]}function m(n,t){g(n).forEach(t)}function y(n,t){return-1<n.indexOf(t)}function b(n,t){return n.push.apply(n,g(t)),n}function w(n,t,e){n&&m(t,function(t){t&&n.classList[e?"add":"remove"](t)})}function E(n,t){w(n,d(t)?t.split(" "):t,!0)}function S(n,t){m(t,n.appendChild.bind(n))}function x(n,t){m(n,function(n){var e=(t||n).parentNode;e&&e.insertBefore(n,t)})}function P(n,t){return v(n)&&(n.msMatchesSelector||n.matches).call(n,t)}function k(n,t){return n=n?i(n.children):[],t?n.filter(function(n){return P(n,t)}):n}function L(n,t){return t?k(n,t)[0]:n.firstElementChild}var C=Object.keys;function A(n,t,e){n&&(e?C(n).reverse():C(n)).forEach(function(e){"__proto__"!==e&&t(n[e],e)})}function D(n){return i(arguments,1).forEach(function(t){A(t,function(e,i){n[i]=t[i]})}),n}function M(n){return i(arguments,1).forEach(function(t){A(t,function(t,e){l(t)?n[e]=t.slice():a(t)?n[e]=M({},a(n[e])?n[e]:{},t):n[e]=t})}),n}function z(n,t){m(t||C(n),function(t){delete n[t]})}function N(n,t){m(n,function(n){m(t,function(t){n&&n.removeAttribute(t)})})}function O(n,t,e){a(t)?A(t,function(t,e){O(n,e,t)}):m(n,function(n){h(e)||""===e?N(n,t):n.setAttribute(t,String(e))})}function I(n,t,e){return n=document.createElement(n),t&&(d(t)?E:O)(n,t),e&&S(e,n),n}function T(n,t,e){if(p(e))return getComputedStyle(n)[t];h(e)||(n.style[t]=""+e)}function F(n,t){T(n,"display",t)}function _(n){n.setActive&&n.setActive()||n.focus({preventScroll:!0})}function j(n,t){return n.getAttribute(t)}function R(n,t){return n&&n.classList.contains(t)}function W(n){return n.getBoundingClientRect()}function X(n){m(n,function(n){n&&n.parentNode&&n.parentNode.removeChild(n)})}function G(n){return L((new DOMParser).parseFromString(n,"text/html").body)}function B(n,t){n.preventDefault(),t&&(n.stopPropagation(),n.stopImmediatePropagation())}function H(n,t){return n&&n.querySelector(t)}function Y(n,t){return t?i(n.querySelectorAll(t)):[]}function q(n,t){w(n,t,!1)}function J(n){return n.timeStamp}function U(n){return d(n)?n:n?n+"px":""}var K="splide",V="data-"+K;function Q(n,t){if(!n)throw new Error("["+K+"] "+(t||""))}var Z=Math.min,$=Math.max,nn=Math.floor,tn=Math.ceil,en=Math.abs;function on(n,t,e){return en(n-t)<e}function rn(n,t,e,i){var o=Z(t,e);t=$(t,e);return i?o<n&&n<t:o<=n&&n<=t}function un(n,t,e){var i=Z(t,e);t=$(t,e);return Z($(i,n),t)}function sn(n){return(0<n)-(n<0)}function cn(n,t){return m(t,function(t){n=n.replace("%s",""+t)}),n}function an(n){return n<10?"0"+n:""+n}var ln={};function fn(){var n=[];function t(n,t,e){m(n,function(n){n&&m(t,function(t){t.split(" ").forEach(function(t){t=t.split("."),e(n,t[0],t[1])})})})}return{bind:function(e,i,o,r){t(e,i,function(t,e,i){var u="addEventListener"in t,s=u?t.removeEventListener.bind(t,e,o,r):t.removeListener.bind(t,o);u?t.addEventListener(e,o,r):t.addListener(o),n.push([t,e,i,o,s])})},unbind:function(e,i,o){t(e,i,function(t,e,i){n=n.filter(function(n){return!!(n[0]!==t||n[1]!==e||n[2]!==i||o&&n[3]!==o)||(n[4](),!1)})})},dispatch:function(n,t,e){var i;return"function"==typeof CustomEvent?i=new CustomEvent(t,{bubbles:!0,detail:e}):(i=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!1,e),n.dispatchEvent(i),i},destroy:function(){n.forEach(function(n){n[4]()}),e(n)}}}var dn="mounted",pn="move",hn="moved",vn="click",gn="refresh",mn="updated",yn="resize",bn="resized",wn="scroll",En="scrolled",Sn="destroy",xn="navigation:mounted",Pn="autoplay:play",kn="autoplay:pause",Ln="lazyload:loaded";function Cn(n){var t=n?n.event.bus:document.createDocumentFragment(),e=fn();return n&&n.event.on(Sn,e.destroy),D(e,{bus:t,on:function(n,i){e.bind(t,g(n).join(" "),function(n){i.apply(i,l(n.detail)?n.detail:[])})},off:o(e.unbind,t),emit:function(n){e.dispatch(t,n,i(arguments,1))}})}function An(n,t,e,i){var o,r,u=Date.now,c=0,a=!0,l=0;function f(){if(!a){if(c=n?Z((u()-o)/n,1):1,e&&e(c),1<=c&&(t(),o=u(),i&&++l>=i))return d();r=s(f)}}function d(){a=!0}function p(){r&&cancelAnimationFrame(r),a=!(r=c=0)}return{start:function(t){t||p(),o=u()-(t?c*n:0),a=!1,r=s(f)},rewind:function(){o=u(),c=0,e&&e(c)},pause:d,cancel:p,set:function(t){n=t},isPaused:function(){return a}}}var Dn,Mn,zn=(Dn="Arrow")+"Left",Nn=Dn+"Right",On=Dn+"Up",In="ttb",Tn={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:[On,Nn],ArrowRight:[Dn=Dn+"Down",zn]},Fn="role",_n="tabindex",jn=(Mn="aria-")+"controls",Rn=Mn+"current",Wn=Mn+"selected",Xn=Mn+"label",Gn=Mn+"labelledby",Bn=Mn+"hidden",Hn=Mn+"orientation",Yn=Mn+"roledescription",qn=Mn+"live",Jn=Mn+"busy",Un=Mn+"atomic",Kn=[Fn,_n,"disabled",jn,Rn,Xn,Gn,Bn,Hn,Yn],Vn=K,Qn=(Mn=K+"__")+"track",Zn=Mn+"list",$n=Mn+"slide",nt=$n+"--clone",tt=$n+"__container",et=Mn+"arrows",it=Mn+"arrow",ot=it+"--prev",rt=it+"--next",ut=Mn+"pagination",st=ut+"__page",ct=Mn+"progress__bar",at=Mn+"toggle",lt=Mn+"sr",ft="is-active",dt="is-prev",pt="is-next",ht="is-visible",vt="is-loading",gt="is-focus-in",mt="is-overflow",yt=[ft,ht,dt,pt,vt,gt,mt],bt="touchstart mousedown",wt="touchmove mousemove",Et="touchend touchcancel mouseup click",St="slide",xt="loop",Pt="fade";var kt=V+"-interval",Lt={passive:!1,capture:!0},Ct={Spacebar:" ",Right:Nn,Left:zn,Up:On,Down:Dn};function At(n){return n=d(n)?n:n.key,Ct[n]||n}var Dt="keydown",Mt=V+"-lazy",zt=Mt+"-srcset",Nt="["+Mt+"], ["+zt+"]",Ot=[" ","Enter"],It=Object.freeze({__proto__:null,Media:function(t,e,i){var o=t.state,r=i.breakpoints||{},u=i.reducedMotion||{},s=fn(),c=[];function a(n){n&&s.destroy()}function l(n,t){t=matchMedia(t),s.bind(t,"change",f),c.push([n,t])}function f(){var n=o.is(7),e=i.direction,r=c.reduce(function(n,t){return M(n,t[1].matches?t[0]:{})},{});z(i),d(r),i.destroy?t.destroy("completely"===i.destroy):n?(a(!0),t.mount()):e!==i.direction&&t.refresh()}function d(n,e,r){M(i,n),e&&M(Object.getPrototypeOf(i),n),!r&&o.is(1)||t.emit(mn,i)}return{setup:function(){var t="min"===i.mediaQuery;C(r).sort(function(n,e){return t?+n-+e:+e-+n}).forEach(function(n){l(r[n],"("+(t?"min":"max")+"-width:"+n+"px)")}),l(u,n),f()},destroy:a,reduce:function(t){matchMedia(n).matches&&(t?M(i,u):z(i,C(u)))},set:d}},Direction:function(n,t,e){return{resolve:function(n,t,i){var o="rtl"!==(i=i||e.direction)||t?i===In?0:-1:1;return Tn[n]&&Tn[n][o]||n.replace(/width|left|right/i,function(n,t){return n=Tn[n.toLowerCase()][o]||n,0<t?n.charAt(0).toUpperCase()+n.slice(1):n})},orient:function(n){return n*("rtl"===e.direction?1:-1)}}},Elements:function(n,t,i){var o,r,u,s=Cn(n),c=s.on,a=s.bind,l=n.root,d=i.i18n,p={},h=[],v=[],g=[];function m(){o=x("."+Qn),r=L(o,"."+Zn),Q(o&&r,"A track/list element is missing."),b(h,k(r,"."+$n+":not(."+nt+")")),A({arrows:et,pagination:ut,prev:ot,next:rt,bar:ct,toggle:at},function(n,t){p[t]=x("."+n)}),D(p,{root:l,track:o,list:r,slides:h});var n=l.id||function(n){return""+n+an(ln[n]=(ln[n]||0)+1)}(K),t=i.role;l.id=n,o.id=o.id||n+"-track",r.id=r.id||n+"-list",!j(l,Fn)&&"SECTION"!==l.tagName&&t&&O(l,Fn,t),O(l,Yn,d.carousel),O(r,Fn,"presentation"),S()}function y(n){var t=Kn.concat("style");e(h),q(l,v),q(o,g),N([o,r],t),N(l,n?t:["style",Yn])}function S(){q(l,v),q(o,g),v=C(Vn),g=C(Qn),E(l,v),E(o,g),O(l,Xn,i.label),O(l,Gn,i.labelledby)}function x(n){return(n=H(l,n))&&function(n,t){if(f(n.closest))return n.closest(t);for(var e=n;e&&1===e.nodeType&&!P(e,t);)e=e.parentElement;return e}(n,"."+Vn)===l?n:void 0}function C(n){return[n+"--"+i.type,n+"--"+i.direction,i.drag&&n+"--draggable",i.isNavigation&&n+"--nav",n===Vn&&ft]}return D(p,{setup:m,mount:function(){c(gn,y),c(gn,m),c(mn,S),a(document,bt+" keydown",function(n){u="keydown"===n.type},{capture:!0}),a(l,"focusin",function(){w(l,gt,!!u)})},destroy:y})},Slides:function(n,t,i){var r=Cn(n),u=r.on,s=r.emit,c=r.bind,a=(r=t.Elements).slides,l=r.list,p=[];function h(){a.forEach(function(n,t){k(n,t,-1)})}function b(){A(function(n){n.destroy()}),e(p)}function k(t,e,i){e=function(n,t,e,i){var r,u=Cn(n),s=u.on,c=u.emit,a=u.bind,l=n.Components,f=n.root,d=n.options,p=d.isNavigation,h=d.updateOnMove,v=d.i18n,g=d.pagination,m=d.slideFocus,y=l.Direction.resolve,b=j(i,"style"),E=j(i,Xn),S=-1<e,x=L(i,"."+tt);function P(){var o=n.splides.map(function(n){return(n=n.splide.Components.Slides.getAt(t))?n.slide.id:""}).join(" ");O(i,Xn,cn(v.slideX,(S?e:t)+1)),O(i,jn,o),O(i,Fn,m?"button":""),m&&N(i,Yn)}function k(){r||C()}function C(){var e,o,u;r||(e=n.index,(u=A())!==R(i,ft)&&(w(i,ft,u),O(i,Rn,p&&u||""),c(u?"active":"inactive",D)),u=function(){if(n.is(Pt))return A();var t=W(l.Elements.track),e=W(i),o=y("left",!0),r=y("right",!0);return nn(t[o])<=tn(e[o])&&nn(e[r])<=tn(t[r])}(),o=!u&&(!A()||S),n.state.is([4,5])||O(i,Bn,o||""),O(Y(i,d.focusableNodes||""),_n,o?-1:""),m&&O(i,_n,o?-1:0),u!==R(i,ht)&&(w(i,ht,u),c(u?"visible":"hidden",D)),u||document.activeElement!==i||(o=l.Slides.getAt(n.index))&&_(o.slide),w(i,dt,t===e-1),w(i,pt,t===e+1))}function A(){var i=n.index;return i===t||d.cloneStatus&&i===e}var D={index:t,slideIndex:e,slide:i,container:x,isClone:S,mount:function(){S||(i.id=f.id+"-slide"+an(t+1),O(i,Fn,g?"tabpanel":"group"),O(i,Yn,v.slide),O(i,Xn,E||cn(v.slideLabel,[t+1,n.length]))),a(i,"click",o(c,vn,D)),a(i,"keydown",o(c,"sk",D)),s([hn,"sh",En],C),s(xn,P),h&&s(pn,k)},destroy:function(){r=!0,u.destroy(),q(i,yt),N(i,Kn),O(i,"style",b),O(i,Xn,E||"")},update:C,style:function(n,t,e){T(e&&x||i,n,t)},isWithin:function(e,i){return e=en(e-t),(e=S||!d.rewind&&!n.is(xt)?e:Z(e,n.length-e))<=i}};return D}(n,e,i,t),e.mount(),p.push(e),p.sort(function(n,t){return n.index-t.index})}function C(n){return n?D(function(n){return!n.isClone}):p}function A(n,t){C(t).forEach(n)}function D(n){return p.filter(f(n)?n:function(t){return d(n)?P(t.slide,n):y(g(n),t.index)})}return{mount:function(){h(),u(gn,b),u(gn,h)},destroy:b,update:function(){A(function(n){n.update()})},register:k,get:C,getIn:function(n){var e=t.Controller,o=e.toIndex(n),r=e.hasFocus()?1:i.perPage;return D(function(n){return rn(n.index,o,o+r-1)})},getAt:function(n){return D(n)[0]},add:function(n,t){m(n,function(n){var e,r,u;v(n=d(n)?G(n):n)&&((e=a[t])?x(n,e):S(l,n),E(n,i.classes.slide),e=n,r=o(s,yn),e=Y(e,"img"),(u=e.length)?e.forEach(function(n){c(n,"load error",function(){--u||r()})}):r())}),s(gn)},remove:function(n){X(D(n).map(function(n){return n.slide})),s(gn)},forEach:A,filter:D,style:function(n,t,e){A(function(i){i.style(n,t,e)})},getLength:function(n){return(n?a:p).length},isEnough:function(){return p.length>i.perPage}}},Layout:function(n,t,e){var i,r,u,s=(f=Cn(n)).on,c=f.bind,l=f.emit,f=t.Slides,d=t.Direction.resolve,p=(t=t.Elements).root,h=t.track,v=t.list,g=f.getAt,m=f.style;function y(){i=e.direction===In,T(p,"maxWidth",U(e.width)),T(h,d("paddingLeft"),E(!1)),T(h,d("paddingRight"),E(!0)),b(!0)}function b(n){var t=W(p);!n&&r.width===t.width&&r.height===t.height||(T(h,"height",function(){var n="";return i&&(Q(n=S(),"height or heightRatio is missing."),n="calc("+n+" - "+E(!1)+" - "+E(!0)+")"),n}()),m(d("marginRight"),U(e.gap)),m("width",e.autoWidth?null:U(e.fixedWidth)||(i?"":x())),m("height",U(e.fixedHeight)||(i?e.autoHeight?null:x():S()),!0),r=t,l(bn),u!==(u=D())&&(w(p,mt,u),l("overflow",u)))}function E(n){var t=e.padding;n=d(n?"right":"left");return t&&U(t[n]||(a(t)?0:t))||"0px"}function S(){return U(e.height||W(v).width*e.heightRatio)}function x(){var n=U(e.gap);return"calc((100%"+(n&&" + "+n)+")/"+(e.perPage||1)+(n&&" - "+n)+")"}function P(){return W(v)[d("width")]}function k(n,t){return(n=g(n||0))?W(n.slide)[d("width")]+(t?0:A()):0}function L(n,t){var e;return(n=g(n))?(n=W(n.slide)[d("right")],e=W(v)[d("left")],en(n-e)+(t?0:A())):0}function C(t){return L(n.length-1)-L(0)+k(0,t)}function A(){var n=g(0);return n&&parseFloat(T(n.slide,d("marginRight")))||0}function D(){return n.is(Pt)||C(!0)>P()}return{mount:function(){var n,t;y(),c(window,"resize load",(n=o(l,yn),t=An(0,n,null,1),function(){t.isPaused()&&t.start()})),s([mn,gn],y),s(yn,b)},resize:b,listSize:P,slideSize:k,sliderSize:C,totalSize:L,getPadding:function(n){return parseFloat(T(h,d("padding"+(n?"Right":"Left"))))||0},isOverflow:D}},Clones:function(n,t,i){var o,r=Cn(n),u=r.on,s=t.Elements,c=t.Slides,a=t.Direction.resolve,l=[];function f(){if(u(gn,d),u([mn,yn],v),o=g()){var e=o,r=c.get().slice(),a=r.length;if(a){for(;r.length<e;)b(r,r);b(r.slice(-e),r.slice(0,e)).forEach(function(t,o){var u=o<e,f=function(t,e){return E(t=t.cloneNode(!0),i.classes.clone),t.id=n.root.id+"-clone"+an(e+1),t}(t.slide,o);u?x(f,r[0].slide):S(s.list,f),b(l,f),c.register(f,o-e+(u?0:a),t.index)})}t.Layout.resize(!0)}}function d(){h(),f()}function h(){X(l),e(l),r.destroy()}function v(){var n=g();o!==n&&(o<n||!n)&&r.emit(gn)}function g(){var e,o=i.clones;return n.is(xt)?p(o)&&(o=(e=i[a("fixedWidth")]&&t.Layout.slideSize(0))&&tn(W(s.track)[a("width")]/e)||i[a("autoWidth")]&&n.length||2*i.perPage):o=0,o}return{mount:f,destroy:h}},Move:function(n,t,e){var i,o=Cn(n),r=o.on,u=o.emit,s=n.state.set,c=(o=t.Layout).slideSize,a=o.getPadding,l=o.totalSize,f=o.listSize,d=o.sliderSize,h=(o=t.Direction).resolve,v=o.orient,g=(o=t.Elements).list,m=o.track;function y(){t.Controller.isBusy()||(t.Scroll.cancel(),b(n.index),t.Slides.update())}function b(n){w(P(n,!0))}function w(e,i){n.is(Pt)||(i=i?e:function(e){var i,o;return n.is(xt)&&(o=(i=x(e))>t.Controller.getEnd(),(i<0||o)&&(e=E(e,o))),e}(e),T(g,"transform","translate"+h("X")+"("+i+"px)"),e!==i&&u("sh"))}function E(n,t){var e=n-L(t),i=d();return n-v(i*(tn(en(e)/i)||1))*(t?1:-1)}function S(){w(k(),!0),i.cancel()}function x(n){for(var e=t.Slides.get(),i=0,o=1/0,r=0;r<e.length;r++){var u=e[r].index,s=en(P(u,!0)-n);if(!(s<=o))break;o=s,i=u}return i}function P(t,i){var o=v(l(t-1)-("center"===(o=e.focus)?(f()-c(t,!0))/2:+o*c(t)||0));return i?(t=o,t=e.trimSpace&&n.is(St)?un(t,0,v(d(!0)-f())):t):o}function k(){var n=h("left");return W(g)[n]-W(m)[n]+v(a(!1))}function L(n){return P(n?t.Controller.getEnd():0,!!e.trimSpace)}return{mount:function(){i=t.Transition,r([dn,bn,mn,gn],y)},move:function(n,t,e,o){var r,c;n!==t&&(r=e<n,c=v(E(k(),r)),r?0<=c:c<=g[h("scrollWidth")]-W(m)[h("width")])&&(S(),w(E(k(),e<n),!0)),s(4),u(pn,t,e,n),i.start(t,function(){s(3),u(hn,t,e,n),o&&o()})},jump:b,translate:w,shift:E,cancel:S,toIndex:x,toPosition:P,getPosition:k,getLimit:L,exceededLimit:function(n,t){t=p(t)?k():t;var e=!0!==n&&v(t)<v(L(!1));n=!1!==n&&v(t)>v(L(!0));return e||n},reposition:y}},Controller:function(n,t,e){var i,r,u,s,c=Cn(n),a=c.on,l=c.emit,f=t.Move,h=f.getPosition,v=f.getLimit,g=f.toPosition,m=(c=t.Slides).isEnough,y=c.getLength,b=e.omitEnd,w=n.is(xt),E=n.is(St),S=o(A,!1),x=o(A,!0),P=e.start||0,k=P;function L(){r=y(!0),u=e.perMove,s=e.perPage,i=z();var n=un(P,0,b?i:r-1);n!==P&&(P=n,f.reposition())}function C(){i!==z()&&l("ei")}function A(n,t){var e=u||(T()?1:s);return-1===(e=D(P+e*(n?-1:1),P,!(u||T())))&&E&&!on(h(),v(!n),1)?n?0:i:t?e:M(e)}function D(t,o,c){var a;return m()||T()?((a=function(t){if(E&&"move"===e.trimSpace&&t!==P)for(var i=h();i===g(t,!0)&&rn(t,0,n.length-1,!e.rewind);)t<P?--t:++t;return t}(t))!==t&&(o=t,t=a,c=!1),t<0||i<t?t=u||!rn(0,t,o,!0)&&!rn(i,o,t,!0)?w?c?t<0?-(r%s||s):r:t:e.rewind?t<0?i:0:-1:N(O(t)):c&&t!==o&&(t=N(O(o)+(t<o?-1:1)))):t=-1,t}function M(n){return w?(n+r)%r||0:n}function z(){for(var n=r-(T()||w&&u?1:s);b&&0<n--;)if(g(r-1,!0)!==g(n,!0)){n++;break}return un(n,0,r-1)}function N(n){return un(T()?n:s*n,0,i)}function O(n){return T()?Z(n,i):nn((i<=n?r-1:n)/s)}function I(n){n!==P&&(k=P,P=n)}function T(){return!p(e.focus)||e.isNavigation}function F(){return n.state.is([4,5])&&!!e.waitForTransition}return{mount:function(){L(),a([mn,gn,"ei"],L),a(bn,C)},go:function(n,t,e){var o;F()||-1<(o=M(n=function(n){var t,e,o=P;return d(n)?(t=(e=n.match(/([+\-<>])(\d+)?/)||[])[1],e=e[2],"+"===t||"-"===t?o=D(P+ +(""+t+(+e||1)),P):">"===t?o=e?N(+e):S(!0):"<"===t&&(o=x(!0))):o=w?n:un(n,0,i),o}(n)))&&(t||o!==P)&&(I(o),f.move(n,o,k,e))},scroll:function(n,e,o,r){t.Scroll.scroll(n,e,o,function(){var n=M(f.toIndex(h()));I(b?Z(n,i):n),r&&r()})},getNext:S,getPrev:x,getAdjacent:A,getEnd:z,setIndex:I,getIndex:function(n){return n?k:P},toIndex:N,toPage:O,toDest:function(n){return n=f.toIndex(n),E?un(n,0,i):n},hasFocus:T,isBusy:F}},Arrows:function(n,t,e){var i,r,u=Cn(n),s=u.on,c=u.bind,a=u.emit,l=e.classes,f=e.i18n,d=t.Elements,p=t.Controller,h=d.arrows,v=d.track,g=h,m=d.prev,y=d.next,b={};function w(){var n=e.arrows;!n||m&&y||(g=h||I("div",l.arrows),m=C(!0),y=C(!1),i=!0,S(g,[m,y]),h||x(g,v)),m&&y&&(D(b,{prev:m,next:y}),F(g,n?"":"none"),E(g,r=et+"--"+e.direction),n&&(s([dn,hn,gn,En,"ei"],A),c(y,"click",o(L,">")),c(m,"click",o(L,"<")),A(),O([m,y],jn,v.id),a("arrows:mounted",m,y))),s(mn,P)}function P(){k(),w()}function k(){u.destroy(),q(g,r),i?(X(h?[m,y]:g),m=y=null):N([m,y],Kn)}function L(n){p.go(n,!0)}function C(n){return G('<button class="'+l.arrow+" "+(n?l.prev:l.next)+'" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40" focusable="false"><path d="'+(e.arrowPath||"m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z")+'" />')}function A(){var t,e,i,o;m&&y&&(o=n.index,t=p.getPrev(),e=p.getNext(),i=-1<t&&o<t?f.last:f.prev,o=-1<e&&e<o?f.first:f.next,m.disabled=t<0,y.disabled=e<0,O(m,Xn,i),O(y,Xn,o),a("arrows:updated",m,y,t,e))}return{arrows:b,mount:w,destroy:k,update:A}},Autoplay:function(n,t,e){var i,o,r=Cn(n),u=r.on,s=r.bind,c=r.emit,a=An(e.interval,n.go.bind(n,">"),function(n){var t=f.bar;t&&T(t,"width",100*n+"%"),c("autoplay:playing",n)}),l=a.isPaused,f=t.Elements,d=(r=t.Elements).root,p=r.toggle,h=e.autoplay,v="pause"===h;function g(){l()&&t.Slides.isEnough()&&(a.start(!e.resetProgress),o=i=v=!1,b(),c(Pn))}function m(n){v=!!(n=void 0===n||n),b(),l()||(a.pause(),c(kn))}function y(){v||(i||o?m(!1):g())}function b(){p&&(w(p,ft,!v),O(p,Xn,e.i18n[v?"play":"pause"]))}function E(n){n=t.Slides.getAt(n),a.set(n&&+j(n.slide,kt)||e.interval)}return{mount:function(){h&&(e.pauseOnHover&&s(d,"mouseenter mouseleave",function(n){i="mouseenter"===n.type,y()}),e.pauseOnFocus&&s(d,"focusin focusout",function(n){o="focusin"===n.type,y()}),p&&s(p,"click",function(){v?g():m(!0)}),u([pn,wn,gn],a.rewind),u(pn,E),p&&O(p,jn,f.track.id),v||g(),b())},destroy:a.cancel,play:g,pause:m,isPaused:l}},Cover:function(n,t,e){var i=Cn(n).on;function r(n){t.Slides.forEach(function(t){var e=L(t.container||t.slide,"img");e&&e.src&&u(n,e,t)})}function u(n,t,e){e.style("background",n?'center/cover no-repeat url("'+t.src+'")':"",!0),F(t,n?"none":"")}return{mount:function(){e.cover&&(i(Ln,o(u,!0)),i([dn,mn,gn],o(r,!0)))},destroy:o(r,!1)}},Scroll:function(n,t,e){var i,r,u=Cn(n),s=u.on,c=u.emit,a=n.state.set,l=t.Move,f=l.getPosition,d=l.getLimit,p=l.exceededLimit,h=l.translate,v=n.is(St),g=1;function m(n,e,u,s,d){var h,m=f();w(),!u||v&&p()||(u=t.Layout.sliderSize(),h=sn(n)*u*nn(en(n)/u)||0,n=l.toPosition(t.Controller.toDest(n%u))+h),u=on(m,n,1);g=1,e=u?0:e||$(en(n-m)/1.5,800),r=s,i=An(e,y,o(b,m,n,d),1),a(5),c(wn),i.start()}function y(){a(3),r&&r(),c(En)}function b(n,t,i,o){var u=f();o=(n+(t-n)*(t=o,(n=e.easingFunc)?n(t):1-Math.pow(1-t,4))-u)*g;h(u+o),v&&!i&&p()&&(g*=.6,en(o)<10&&m(d(p(!0)),600,!1,r,!0))}function w(){i&&i.cancel()}function E(){i&&!i.isPaused()&&(w(),y())}return{mount:function(){s(pn,w),s([mn,gn],E)},destroy:w,scroll:m,cancel:E}},Drag:function(n,t,e){var i,o,u,s,c,l,f,d,p=Cn(n),h=p.on,v=p.emit,g=p.bind,m=p.unbind,y=n.state,b=t.Move,w=t.Scroll,E=t.Controller,S=t.Elements.track,x=t.Media.reduce,k=(p=t.Direction).resolve,L=p.orient,C=b.getPosition,A=b.exceededLimit,D=!1;function M(){var n=e.drag;X(!n),s="free"===n}function z(n){var t,i,o;l=!1,f||(t=W(n),i=n.target,o=e.noDrag,P(i,"."+st+", ."+it)||o&&P(i,o)||!t&&n.button||(E.isBusy()?B(n,!0):(d=t?S:window,c=y.is([4,5]),u=null,g(d,wt,N,Lt),g(d,Et,O,Lt),b.cancel(),w.cancel(),T(n))))}function N(t){var o,r,u,s,f;y.is(6)||(y.set(6),v("drag")),t.cancelable&&(c?(b.translate(i+F(t)/(D&&n.is(St)?5:1)),f=200<_(t),o=D!==(D=A()),(f||o)&&T(t),l=!0,v("dragging"),B(t)):en(F(f=t))>en(F(f,!0))&&(o=t,s=(u=a(r=e.dragMinThreshold))&&r.mouse||0,u=(u?r.touch:+r)||10,c=en(F(o))>(W(o)?u:s),B(t)))}function O(i){var o,r,u;y.is(6)&&(y.set(3),v("dragged")),c&&(r=function(n){return C()+sn(n)*Z(en(n)*(e.flickPower||600),s?1/0:t.Layout.listSize()*(e.flickMaxPages||1))}(o=function(t){if(n.is(xt)||!D){var e=_(t);if(e&&e<200)return F(t)/e}return 0}(o=i)),u=e.rewind&&e.rewindByDrag,x(!1),s?E.scroll(r,0,e.snap):n.is(Pt)?E.go(L(sn(o))<0?u?"<":"-":u?">":"+"):n.is(St)&&D&&u?E.go(A(!0)?">":"<"):E.go(E.toDest(r),!0),x(!0),B(i)),m(d,wt,N),m(d,Et,O),c=!1}function I(n){!f&&l&&B(n,!0)}function T(n){u=o,o=n,i=C()}function F(n,t){return R(n,t)-R(j(n),t)}function _(n){return J(n)-J(j(n))}function j(n){return o===n&&u||o}function R(n,t){return(W(n)?n.changedTouches[0]:n)["page"+k(t?"Y":"X")]}function W(n){return"undefined"!=typeof TouchEvent&&n instanceof TouchEvent}function X(n){f=n}return{mount:function(){g(S,wt,r,Lt),g(S,Et,r,Lt),g(S,bt,z,Lt),g(S,"click",I,{capture:!0}),g(S,"dragstart",B),h([dn,mn],M)},disable:X,isDragging:function(){return c}}},Keyboard:function(n,t,e){var i,o,r=Cn(n),s=r.on,c=r.bind,a=r.unbind,l=n.root,f=t.Direction.resolve;function d(){var n=e.keyboard;n&&(i="global"===n?window:l,c(i,Dt,v))}function p(){a(i,Dt)}function h(){var n=o;o=!0,u(function(){o=n})}function v(t){o||((t=At(t))===f(zn)?n.go("<"):t===f(Nn)&&n.go(">"))}return{mount:function(){d(),s(mn,p),s(mn,d),s(pn,h)},destroy:p,disable:function(n){o=n}}},LazyLoad:function(n,t,i){var r=Cn(n),u=r.on,s=r.off,c=r.bind,a=r.emit,l="sequential"===i.lazyLoad,f=[hn,En],d=[];function p(){e(d),t.Slides.forEach(function(n){Y(n.slide,Nt).forEach(function(t){var e=j(t,Mt),o=j(t,zt);e===t.src&&o===t.srcset||(e=i.classes.spinner,e=L(o=t.parentElement,"."+e)||I("span",e,o),d.push([t,n,e]),t.src||F(t,"none"))})}),(l?m:(s(f),u(f,h),h))()}function h(){(d=d.filter(function(t){var e=i.perPage*((i.preloadPages||1)+1)-1;return!t[1].isWithin(n.index,e)||v(t)})).length||s(f)}function v(n){var t=n[0];E(n[1].slide,vt),c(t,"load error",o(g,n)),O(t,"src",j(t,Mt)),O(t,"srcset",j(t,zt)),N(t,Mt),N(t,zt)}function g(n,t){var e=n[0],i=n[1];q(i.slide,vt),"error"!==t.type&&(X(n[2]),F(e,""),a(Ln,e,i),a(yn)),l&&m()}function m(){d.length&&v(d.shift())}return{mount:function(){i.lazyLoad&&(p(),u(gn,p))},destroy:o(e,d),check:h}},Pagination:function(n,t,r){var u,s,c=Cn(n),a=c.on,l=c.emit,f=c.bind,d=t.Slides,p=t.Elements,h=t.Controller,v=h.hasFocus,g=h.getIndex,m=h.go,y=t.Direction.resolve,b=p.pagination,w=[];function S(){u&&(X(b?i(u.children):u),q(u,s),e(w),u=null),c.destroy()}function x(n){m(">"+n,!0)}function P(n,t){var e=w.length,i=At(t),o=k(),r=-1;(o=(i===y(Nn,!1,o)?r=++n%e:i===y(zn,!1,o)?r=(--n+e)%e:"Home"===i?r=0:"End"===i&&(r=e-1),w[r]))&&(_(o.button),m(">"+r),B(t,!0))}function k(){return r.paginationDirection||r.direction}function L(n){return w[h.toPage(n)]}function C(){var n,t=L(g(!0)),e=L(g());t&&(q(n=t.button,ft),N(n,Wn),O(n,_n,-1)),e&&(E(n=e.button,ft),O(n,Wn,!0),O(n,_n,"")),l("pagination:updated",{list:u,items:w},t,e)}return{items:w,mount:function t(){S(),a([mn,gn,"ei"],t);var e=r.pagination;if(b&&F(b,e?"":"none"),e){a([pn,wn,En],C);e=n.length;var i=r.classes,c=r.i18n,g=r.perPage,m=v()?h.getEnd()+1:tn(e/g);E(u=b||I("ul",i.pagination,p.track.parentElement),s=ut+"--"+k()),O(u,Fn,"tablist"),O(u,Xn,c.select),O(u,Hn,k()===In?"vertical":"");for(var y=0;y<m;y++){var A=I("li",null,u),D=I("button",{class:i.page,type:"button"},A),M=d.getIn(y).map(function(n){return n.slide.id}),z=!v()&&1<g?c.pageX:c.slideX;f(D,"click",o(x,y)),r.paginationKeyboard&&f(D,"keydown",o(P,y)),O(A,Fn,"presentation"),O(D,Fn,"tab"),O(D,jn,M.join(" ")),O(D,Xn,cn(z,y+1)),O(D,_n,-1),w.push({li:A,button:D,page:y})}C(),l("pagination:mounted",{list:u,items:w},L(n.index))}},destroy:S,getAt:L,update:C}},Sync:function(n,t,i){var r=i.isNavigation,u=i.slideFocus,s=[];function c(){var t,e;n.splides.forEach(function(t){t.isParent||(l(n,t.splide),l(t.splide,n))}),r&&((e=(t=Cn(n)).on)(vn,d),e("sk",h),e([dn,mn],f),s.push(t),t.emit(xn,n.splides))}function a(){s.forEach(function(n){n.destroy()}),e(s)}function l(n,t){(n=Cn(n)).on(pn,function(n,e,i){t.go(t.is(xt)?i:n)}),s.push(n)}function f(){O(t.Elements.list,Hn,i.direction===In?"vertical":"")}function d(t){n.go(t.index)}function h(n,t){y(Ot,At(t))&&(d(n),B(t))}return{setup:o(t.Media.set,{slideFocus:p(u)?r:u},!0),mount:c,destroy:a,remount:function(){a(),c()}}},Wheel:function(n,t,e){var i=Cn(n).bind,o=0;function r(i){var r,u,s,c,a;i.cancelable&&(r=(a=i.deltaY)<0,u=J(i),s=e.wheelMinThreshold||0,c=e.wheelSleep||0,en(a)>s&&c<u-o&&(n.go(r?"<":">"),o=u),a=r,e.releaseWheel&&!n.state.is(4)&&-1===t.Controller.getAdjacent(a)||B(i))}return{mount:function(){e.wheel&&i(t.Elements.track,"wheel",r,Lt)}}},Live:function(n,t,e){var i=Cn(n).on,r=t.Elements.track,u=e.live&&!e.isNavigation,s=I("span",lt),c=An(90,o(a,!1));function a(n){O(r,Jn,n),n?(S(r,s),c.start()):(X(s),c.cancel())}function l(n){u&&O(r,qn,n?"off":"polite")}return{mount:function(){u&&(l(!t.Autoplay.isPaused()),O(r,Un,!0),s.textContent="…",i(Pn,o(l,!0)),i(kn,o(l,!1)),i([hn,En],o(a,!0)))},disable:l,destroy:function(){N(r,[qn,Un,Jn]),X(s)}}}}),Tt={type:"slide",role:"region",speed:400,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,paginationKeyboard:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",live:!0,classes:{slide:$n,clone:nt,arrows:et,arrow:it,prev:ot,next:rt,pagination:ut,page:st,spinner:Mn+"spinner"},i18n:{prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay",carousel:"carousel",slide:"slide",select:"Select a slide to show",slideLabel:"%s of %s"},reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}};function Ft(n,t,e){var i=t.Slides;function o(){i.forEach(function(n){n.style("transform","translateX(-"+100*n.index+"%)")})}return{mount:function(){Cn(n).on([dn,gn],o)},start:function(n,t){i.style("transition","opacity "+e.speed+"ms "+e.easing),u(t)},cancel:r}}function _t(n,t,e){var i,r=t.Move,u=t.Controller,s=t.Scroll,c=t.Elements.list,a=o(T,c,"transition");function l(){a(""),s.cancel()}return{mount:function(){Cn(n).bind(c,"transitionend",function(n){n.target===c&&i&&(l(),i())})},start:function(t,o){var c=r.toPosition(t,!0),l=r.getPosition(),f=function(t){var i=e.rewindSpeed;if(n.is(St)&&i){var o=u.getIndex(!0),r=u.getEnd();if(0===o&&r<=t||r<=o&&0===t)return i}return e.speed}(t);1<=en(c-l)&&1<=f?e.useScroll?s.scroll(c,f,!1,o):(a("transform "+f+"ms "+e.easing),r.translate(c,!0),i=o):(r.jump(t),o())},cancel:l}}return On=function(){function n(t,e){this.event=Cn(),this.Components={},this.state=function(n){var t=n;return{set:function(n){t=n},is:function(n){return y(g(n),t)}}}(1),this.splides=[],this.n={},this.t={},Q(t=d(t)?H(document,t):t,t+" is invalid."),e=M({label:j(this.root=t,Xn)||"",labelledby:j(t,Gn)||""},Tt,n.defaults,e||{});try{M(e,JSON.parse(j(t,V)))}catch(t){Q(!1,"Invalid JSON")}this.n=Object.create(M({},e))}var t=n.prototype;return t.mount=function(n,t){var e=this,i=this.state,o=this.Components;return Q(i.is([1,7]),"Already mounted!"),i.set(1),this.i=o,this.r=t||this.r||(this.is(Pt)?Ft:_t),this.t=n||this.t,A(D({},It,this.t,{Transition:this.r}),function(n,t){n=n(e,o,e.n),(o[t]=n).setup&&n.setup()}),A(o,function(n){n.mount&&n.mount()}),this.emit(dn),E(this.root,"is-initialized"),i.set(3),this.emit("ready"),this},t.sync=function(n){return this.splides.push({splide:n}),n.splides.push({splide:this,isParent:!0}),this.state.is(3)&&(this.i.Sync.remount(),n.Components.Sync.remount()),this},t.go=function(n){return this.i.Controller.go(n),this},t.on=function(n,t){return this.event.on(n,t),this},t.off=function(n){return this.event.off(n),this},t.emit=function(n){var t;return(t=this.event).emit.apply(t,[n].concat(i(arguments,1))),this},t.add=function(n,t){return this.i.Slides.add(n,t),this},t.remove=function(n){return this.i.Slides.remove(n),this},t.is=function(n){return this.n.type===n},t.refresh=function(){return this.emit(gn),this},t.destroy=function(n){void 0===n&&(n=!0);var t=this.event,i=this.state;return i.is(1)?Cn(this).on("ready",this.destroy.bind(this,n)):(A(this.i,function(t){t.destroy&&t.destroy(n)},!0),t.emit(Sn),t.destroy(),n&&e(this.splides),i.set(7)),this},Jt(n,[{key:"options",get:function(){return this.n},set:function(n){this.i.Media.set(n,!0,!0)}},{key:"length",get:function(){return this.i.Slides.getLength(!0)}},{key:"index",get:function(){return this.i.Controller.getIndex()}}]),n}(),On.defaults={},On.STATES=t,On},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).Splide=t()</script><script>let rebootTimeoutId,saveConfigTimeOutId,peerTimeOutId={};const peerTimeoutMs=1e4;let webSocket,webSocketReconnect,onSphereUp,onSphereDown,webSocketConnected=!1,onWebSocketConnectedOneTime=null,config={};const maxWifiNetworks=-1;let ssidList=[],statuscode=128;const frameRate=20;let warmth=0,targetWarmth=0;const maxWarmth=5;let peakEnergy=0;const tuningState={running:!1,goodPeakFound:!1,timeOutId:void 0},narrowFilterBandwidthHz=20;let mic={};const numberOfHistogramBins=8,histogram=Array(8).fill(0);let micMinFreq,micMaxFreq;const tuneWindowMs=3e3,lowMicSampleRate=1,highMicSampleRate=5,minHistogramPeakValue=1;let audioCtx,onTouchOneTime=null,onMovedOneTime=null;const peers=[];let lastSplideIndex=-1;const enableSwipe=!0;let deferredInstallPrompt,micPostLocked=!0;const requestQueue={pending:new Set,maxConcurrent:3,async execute(e,t){if(this.pending.has(e))return console.log(`Skipping duplicate request: ${e}`),null;for(;this.pending.size>=this.maxConcurrent;)await new Promise(e=>setTimeout(e,100));this.pending.add(e);try{return await t()}finally{this.pending.delete(e)}}};async function init(){document.querySelectorAll("img").forEach(e=>{e.addEventListener("error",function(){setTimeout(()=>{const t=new URL(e.src,location.href);t.searchParams.set("_retry",Date.now()),e.src=t.toString(),console.log("Retrying image load:",e.src)},5e3)})}),document.addEventListener("keydown",e=>{e.repeat||onKeyPressed(e.key,!0)}),document.addEventListener("keyup",e=>{onKeyPressed(e.key,!1)}),initSphere()}function configureUIEvents(){document.addEventListener("focusin",function(e){e.target?.closest&&e.target.closest(".yo-yo-form")&&allowSwipe(!1)},!0),document.addEventListener("focusout",function(e){const t=e.target?.closest&&e.target.closest(".yo-yo-form"),n=e.relatedTarget&&e.relatedTarget.closest&&e.relatedTarget.closest(".yo-yo-form")===e.target.closest(".yo-yo-form");t&&!n&&allowSwipe(!0)},!0),window.addEventListener("resize",debounce(()=>{positionSphereImage(),updateSlide()},300));const e=document.getElementById("server_form");e.addEventListener("submit",function(t){t.preventDefault(),onServerSaveEvent(new FormData(e))});const t=document.getElementById("wifi_form");t.addEventListener("submit",function(e){console.log("wifiForm.addEventListener()"),e.preventDefault(),onWiFiSaveEvent(new FormData(t))});const n=document.getElementById("determination_individual"),o=debounce(e=>{console.log("determinationListener");const t={server:{...config.server??{}}};t.server.room={...t.server.room??{}},t.server.room.determination=e.target.value,setConfiguration(t)},2e3);n.addEventListener("input",o),splide.on("moved",e=>{onMovedOneTime&&(onMovedOneTime(),onMovedOneTime=void 0)}),lastSplideIndex=splide.index,splide.on("active",e=>{lastSplideIndex!==splide.index&&updateSlide(!0),sphereIsOnline()&&(lastSplideIndex=splide.index)})}function hasConfiguration(){return"object"==typeof config&&Object.keys(config).length>0}async function initSphere(){console.log("initSphere"),splide=new Splide("#carousel",{type:"slide",perPage:1,drag:!1}).mount(),showCarousel(!1),positionSphereImage(),allowInteraction(!1),console.log("configureUIEvents"),configureUIEvents(),console.log("configureUIEvents - done"),console.log("getConfiguration"),await getConfiguration()?(console.log("getConfiguration - done"),document.getElementById("spherename").innerText=config?.captiveportal?.ssid??"",document.getElementById("sphereversion").innerText=config?.version??"",setInterval(()=>{loop()},50),setInterval(()=>{onTick()},1e4),manageWebSocket(()=>onStart()),updateSlide(!0)):(console.log("getConfiguration - error"),getSlideByID(getSlideId()).querySelectorAll(".slide-content .row")[0].innerHTML="error")}function onKeyPressed(e,t){if("landing"===getSlideId()){const e=Number(event.key);isNaN(e)||onUserClicked({track:e},t)}}function positionSphereImage(){const e=document.querySelector(".middle-row"),t=document.querySelector(".background-image");if(e&&t){const n=e.getBoundingClientRect();t.style.top=`${n.top+window.scrollY}px`,t.style.height=`${n.height}px`}}function debounce(e,t){let n;return function(...o){clearTimeout(n),n=setTimeout(()=>e.apply(this,o),t)}}function onTuningComplete(){if(tuningState.running){console.log("stop tuning");const e=getGoodHistogramPeak(histogram,1*(mic?.level??1));if(console.log("getGoodHistogramPeak ",e),e.frequency>-1&&peakEnergy>0){const t=(mic?.level??1)*(5/(.9*peakEnergy));setMic({frequency:e.frequency,level:parseFloat(t.toFixed(2))},!0),tuningState.goodPeakFound=!0,updateSlide()}}tuningState.timeOutId=void 0,peakEnergy=0,tuningState.goodPeakFound&&setTimeout(()=>{void 0===tuningState.timeOutId&&showNextSlide()},3e3)}function loop(){"tuning"!==getSlideId()||tuningState.timeOutId||isCold()||(console.log("start tuning"),clearHistogram(histogram),tuningState.timeOutId=setTimeout(()=>{onTuningComplete()},3e3),updateSlide()),draw()}function draw(){sphereIsUp()?(warmth+=.1*(targetWarmth-warmth),setBackgroundFromValue(51*Math.min(Math.max(warmth,0),5))):setBackgroundFromValue(0)}function onTick(){getStatus()}async function fetchWithTimeout(e,t=5e3,n={}){return requestQueue.execute(e,async()=>{const o=new AbortController,i=setTimeout(()=>o.abort(),t);try{const t=await fetch(e,{signal:o.signal,...n});return clearTimeout(i),t}catch(n){if(clearTimeout(i),n&&"AbortError"===n.name)throw new Error(`Fetch timeout (${t}ms): ${e}`);throw n}})}async function getStatus(){let e=254&statuscode;try{const t=await fetchWithTimeout("/yoyo/status",3e3);if(t.ok){const n=await t.json();e=Number(n.statuscode),e=webSocketConnected?8|e:e,updateCount(n?.count??0)}}catch(e){}e!==statuscode&&onStatus(e)}function sphereWillReboot(){return rebootTimeoutId}function reboot(){const e="landing";showSlideID(e);const t=getSlideByID(e).querySelectorAll(".slide-content .row"),n=config?.wifi?.ssid??"";t[0].innerHTML="Rebooting...",t[2].innerHTML="Now close this window. Then make sure this "+getDeviceType()+" is on "+(""!==n?"the "+n:"that")+" network too and scan the new QR code when the sphere has restarted.",postJson("/yoyo/reboot",{},500)}function sphereIsOnline(e=statuscode){return!(1&~e)}function sphereIsUp(e=statuscode){return!(2&~e)}function captivePortalRunning(e=statuscode){return!(4&~e)}function localConnected(e=statuscode){return!(8&~e)}function remoteConnected(e=statuscode){return!(16&~e)}function drawSphere(e){const t=document.querySelector("#sphereImage");sphereIsUp(e)?t.src="img/sphere-up.png":t.src="img/sphere-down.png"}function onStatus(e){if(statuscode!=e){const t=statuscode;statuscode=e,sphereIsUp(e)?(onSphereUp&&"function"==typeof onSphereUp&&onSphereUp(),onSphereUp=void 0):(onSphereDown&&"function"==typeof onSphereDown&&onSphereDown(),onSphereDown=void 0),!sphereIsOnline(t)&&sphereIsOnline()&&onOnline(),sphereIsOnline(t)&&!sphereIsOnline()&&onOffline(),"landing"===getSlideId()&&(getSlideByID("landing").querySelectorAll(".slide-content .row")[2].querySelector("span").innerHTML=generateLandingText()),drawSphere(statuscode)}}function onWebSocketConnected(e=!0){webSocketConnected!==e&&(e&&(onStatus(9|statuscode),onWebSocketConnectedOneTime&&(onWebSocketConnectedOneTime(),onWebSocketConnectedOneTime=null)),allowInteraction(e),webSocketConnected=e,updateSlide())}async function onOnline(){console.log("onOnline",config),rebootTimeoutId=void 0,document.querySelector("#sphereImage").style.filter="none",peers.push(...await fetchPeers()),makePeers(document.getElementById("room_container"),config.peers,!0),showSlideIndex(lastSplideIndex)}async function onOffline(){console.log("onOffline"),onWebSocketConnected(!1),showSlideID("landing"),document.querySelector("#sphereImage").style.filter="invert(30%)",allowInteraction(!1),targetWarmth=0}async function getConfiguration(e=5e3,t=5){for(let n=0;n<t;n++){try{const t=await fetchWithTimeout("/yoyo/config",e);if(t.ok){const e=await t.json();if(e.statuscode){let t=Number(e.statuscode);t=webSocketConnected?8|t:t,onStatus(t),delete e.statuscode}return updateCount(),setConfiguration(e,!1),!0}onStatus(0)}catch(e){onStatus(0)}await new Promise(e=>setTimeout(e,1e3))}return!1}function isPlainObject(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function isEmptyObject(e){return isPlainObject(e)&&0===Object.keys(e).length}async function setConfiguration(e,t=!0,n=-1){let o=!1;return isPlainObject(config)&&!isEmptyObject(e)?(console.log("setConfiguration",e),config={...config,...e},console.log(JSON.stringify(config)),t&&(o=postJson("/yoyo/config",config,1e3)),o&&t&&n>=0&&(onSphereDown=void 0,rebootTimeoutId=setTimeout(function(){sphereIsUp()?onSphereDown=function(){drawSphere(statuscode),reboot()}:reboot()},n),showSlideID("landing"),allowInteraction(!1))):o=!1,o}function onStart(){console.log("onStart",config);const e=function(){showCarousel(!0)};config?.server?.host?config?.mic?.frequency?!config?.wifi?.ssid||captivePortalRunning()?showSlideID("wifi",e):showSlideID("landing",e):showSlideID("tuning",e):showSlideID("server",e)}async function onSlideMoved(){console.log("onSlideMoved")}async function activateTuning(e=!0){e&&!tuningState.running?(setMic({level:mic?.level??1,frequency:-1,bandwidth:-1,rate:5},!1),tuningState.timeOutId=void 0,tuningState.goodPeakFound=!1,tuningState.running=!0):!e&&tuningState.running&&(void 0!==tuningState.timeOutId&&(clearTimeout(tuningState.timeOutId),tuningState.timeOutId=void 0),setMic({rate:-1,frequency:tuningState.goodPeakFound?mic.frequency:config?.mic?.frequency,bandwidth:20},!0),tuningState.goodPeakFound=!1,tuningState.running=!1)}function drawEllipse(e,t,n){const o=e.getContext("2d");o.beginPath(),o.ellipse(e.width/2,e.height/2,t/2,n/2,0,0,2*Math.PI),o.strokeStyle="gray",o.lineWidth=2,o.stroke()}function drawEllipseWithImages(e,t,n){const o=e.getContext("2d"),i=e.width/2,r=e.height/2,s=t/2,c=n/2,a=new Image;a.src="img/sphere-up.png",a.onload=function(){const e=2*Math.PI/3;for(let t=0;t<3;t++){const n=t*e,l=i+s*Math.cos(n),u=r+c*Math.sin(n);o.drawImage(a,l-25,u-25,50,50)}}}function makePeers(e,t,n=!1){if(e&&t){const n=Object.keys(t);for(let o=0;o<n.length;o++){const i=n[o];document.getElementById(i)||makePeer(i,t[i].user,e)}}n&&layoutPeers(e)}function layoutPeers(e){if(e){const t=e.clientWidth/2,n=e.clientHeight/2,o=e.clientWidth/2,i=e.clientHeight/2,r=Array.from(e.children);for(let e=0;e<r.length;e++){const s=2*e*Math.PI/r.length,c=t+o*Math.cos(s),a=n+i*Math.sin(s);let l=r[e];l&&(l.style.left=`${c}px`,l.style.top=`${a}px`)}}}function makePeer(e,t,n){let o=document.getElementById("room_item_template").content.cloneNode(!0).firstElementChild;return o.id=e,t&&(o.querySelector("span").textContent=t),updatePeer(o,!1),o.addEventListener("mousedown",()=>{onUserClicked({id:o.id})}),o.addEventListener("mouseup",()=>{onUserClicked({id:o.id},!1)}),o.addEventListener("touchstart",()=>{onUserClicked({id:o.id})}),o.addEventListener("touchend",()=>{onUserClicked({id:o.id},!1)}),n&&n.appendChild(o),o}function onUserClicked(e,t=!0){e={...e,amplitude:.5,duration:t?1e4:100,fade:100},console.log("onUserClicked",e),postJson("/yoyo/tone",e,500)}function updatePeer(e,t){if(e){peerTimeOutId[e.id]&&clearTimeout(peerTimeOutId[e.id]);const n=e.querySelector("img");t?(n.src="img/sphere-up.png",peerTimeOutId[e.id]=setTimeout(()=>{updatePeer(e,!1)},1e4)):n.src="img/sphere-down.png"}}function isStandalone(){return"standalone"===getDisplayMode()}function getDisplayMode(){const e=["fullscreen","standalone","minimal-ui","browser"];for(const t of e)if(window.matchMedia(`(display-mode: ${t})`).matches)return t;return"unknown"}function getUserAgent(){return navigator.userAgent||navigator.vendor||window.opera}function getDeviceType(){const e=getUserAgent();return/iPhone|Android.*Mobile|Windows Phone|BlackBerry|webOS/i.test(e)?"phone":"computer"}function getOS(){let e="unknown";const t=getUserAgent();return/Android/i.test(t)?e="android":/Windows NT/i.test(t)?e="windows":/iPhone|iPad|iPod/i.test(t)?e="ios":/Macintosh|Mac OS X/i.test(t)&&(e="macos"),e}function getBrowser(){let e="unknown";const t=getUserAgent();return/crios|chrome/i.test(t)?e="chrome":/safari/i.test(t)&&(e="safari"),e}function generateLandingText(){const e=config?.wifi?.ssid??"";let t="";return sphereWillReboot()?(sphereIsUp()?t+="Turn the sphere over now and it ":t+="The sphere",t+=" will try to connect to the <span class='ssid'>"+e+"</span> WiFi network. "):sphereIsOnline()?captivePortalRunning()?(t+="Your sphere needs to be "+(config?.mic?.frequency&&config?.server?.host?"":"configured and ")+"connected to a WiFi network",t+=""!==e?", it couldn't connect to <span class='ssid'>"+e+"</span>. ":". ",localConnected()&&!sphereIsUp()&&(t+="To get started, please turn the sphere over. ",onSphereUp=function(){onStart()})):(t+="Your sphere is connect"+(localConnected()?"ed":"ing")+" to a WiFi network",localConnected()?remoteConnected()?(t+=" and a Resound server. ",t+=" Everything looks good. "):t+=" but not a Resound server. ":t+=".<br>Please wait. "):(t+="Your sphere appears to be offline. ",""!==e&&(t+="It was last connected to the <span class='ssid'>"+e+"</span> WiFi network. Is the sphere plugged in? Is this "+getDeviceType()+" on that network too?")),t.trim()}function generateWiFiText(e){const t=config?.wifi?.ssid??"";let n="Your sphere is ";return!captivePortalRunning()&&sphereIsOnline()?n+="connected to the <span class='ssid'>"+t+"</span> WiFi network ("+getHost()+"). ":(n+="not connected to a WiFi network",n+=""!==t?", it couldn't connect to <span class='ssid'>"+t+"</span>. ":". ",e&&(n+="Select a network, enter the password and press connect. ")),n.trim()}function generateServerText(){let e="Your sphere is ";return captivePortalRunning()?e+="not connected to the Internet. ":remoteConnected()?e+="connected to a Resound server ("+(config?.server?.host??"")+"). ":e+="not connected to a Resound server. ",e.trim()}function generateTuningText(){let e="";const t=config?.mic?.frequency,n=void 0!==t;return e+=n?"Your sphere is tuned to a frequency of "+t+"Hz"+(getNoteName(t)?" (the note of "+getNoteName(t)+")":"")+".<br>":"Your sphere isn't tuned.<br>",sphereIsUp()?e+="Chant NMRK to "+(n?"re":"")+"tune it. ":e+="To get started, please turn the sphere over. ",e.trim()}function allowInteraction(e){showCarouselControls(e),allowSwipe(e)}function allowSwipe(e){if(console.log("allowSwipe",e,splide.options.drag,!0),(e=e&&!0)!==splide.options.drag){const t=document.querySelector(".splide__arrows"),n=document.querySelector(".splide__pagination"),o="block"===t.style.display&&"flex"===n.style.display;splide.options={drag:e},splide.refresh(),showCarouselControls(o)}}function showCarousel(e){var t=document.getElementById("carousel");t.style.visibility=e?"visible":"hidden",t.style["pointer-events"]=e?"auto":"none"}function showCarouselControls(e){const t=document.querySelector(".splide__arrows"),n=document.querySelector(".splide__pagination");t&&(t.style.display=e?"block":"none"),n&&(n.style.display=e?"flex":"none")}function updateCount(e=0){document.getElementById("count").textContent=Math.max(config?.server?.room?.count??0,e)}async function updateSlide(e=!1){console.log("updateSlide()",e,lastSplideIndex,splide.index),onSphereDown=void 0,onSphereUp=void 0;const t=getSlideId();activateTuning("tuning"===t&&sphereIsUp());const n=document.getElementById("room_container");n.style.display=sphereIsOnline()?"block":"none";const o=getSlideByID(t).querySelectorAll(".slide-content .row")[2];switch(t){case"landing":layoutPeers(n),o&&(o.querySelector("span").innerHTML=generateLandingText()),allowInteraction(webSocketConnected);break;case"tuning":onSphereDown=function(){updateSlide(),console.log("TODO: tuning - onSphereDown")},onSphereUp=function(){updateSlide(),console.log("TODO: tuning - onSphereUp")},o&&(o.querySelector("span").innerHTML=generateTuningText());break;case"server":const i=document.getElementById("server_name"),r=document.getElementById("server_host"),s=document.getElementById("server_channel");i.value=config?.server?.name??"",r.value=config?.server?.host??"",s.value=config?.server?.room?.channel??"",o&&(o.innerHTML=generateServerText());break;case"wifi":e&&fetchWiFiNetworks().then(e=>{populateWiFiForm(config,e),o&&(o.innerHTML=generateWiFiText(e.length>0))}),allowInteraction(webSocketConnected);break;case"determination":document.getElementById("determination_individual").value=config?.server?.room?.determination??"";break;case"volume":const c=document.getElementById("vollevel");c.disabled=!sphereIsUp(),c.onchange=function(){onVolumeChanged(c.value/100)},onVolumeChanged(config?.volume??1,!1),onSphereDown=function(){updateSlide(),console.log("TODO: volume - onSphereDown")},onSphereUp=function(){updateSlide(),console.log("TODO: volume - onSphereUp")},o&&(o.querySelector("span").innerHTML=sphereIsUp()?o.querySelector(".sphere_up_text").innerHTML:o.querySelector(".sphere_down_text").innerHTML);break;default:console.log("no rule for: "+t)}}function getNoteName(e){let t;if(e>0){const n=440;t=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"][(Math.round(12*Math.log2(e/n))+9+12)%12]}return t}function mute(e=!0){}function onVolumeChanged(e,t=!0){console.log("vollevel",e,t),config.volume=e,t?(postJson("/yoyo/volume",{v:config.volume},500),console.log("localchange vollevel",e),saveConfigTimeOutId&&clearTimeout(saveConfigTimeOutId),saveConfigTimeOutId=setTimeout(function(){postJson("/yoyo/config",{},500),saveConfigTimeOutId=void 0},3e3)):vollevel.value=100*e}function isWarm(){return warmth>4.25}function isCold(){return warmth<.75}function showNextSlide(){splide.go(">")}function showSlideID(e,t=void 0){showSlideIndex(getSlideIndexByID(e),t)}function showSlideIndex(e,t=void 0){splide&&e>=0&&(e!=splide.index?(onMovedOneTime=t,splide.go(e)):t&&t())}function getSlideByID(e){const t=document.querySelector(".splide__track").querySelectorAll(".splide__slide");for(let n of t)if(n.getAttribute("data-id")===e)return n;return null}function getSlideIndexByID(e){const t=document.querySelector(".splide__track").querySelectorAll(".splide__slide");let n=-1;return t.forEach((t,o)=>{t.getAttribute("data-id")===e&&(n=o)}),n}function getSlideId(){let e=null;try{e=getSlideIdByIndex(splide.index)}catch(e){}return e}function getSlideIdByIndex(e){const t=document.querySelector(".splide__track").querySelectorAll(".splide__slide");return e>=0&&e<t.length?t[e].getAttribute("data-id"):null}async function postJson(e,t={},n=5e3){let o=!1;if(e)try{let i={method:"POST",headers:{Accept:"application/json; charset=utf-8","Content-Type":"application/json"}};i.body=JSON.stringify(t);const r=await fetchWithTimeout(e,n,i);r.ok&&(console.log(r),o=!0)}catch(e){console.log(e)}return o}async function setMic(e,t=!1){if(Object.assign(mic,e),mic.frequency&&mic.bandwidth){if(t&&(config.mic=config.mic??{},config.mic.frequency=mic?.frequency,config.mic.bandwidth=mic?.bandwidth,config.mic.level=mic?.level),micPostLocked)return;postJson("/yoyo/mic",{...mic,save:t},1500)}console.log("setMic",mic,t)}async function setSound(e){postJson("/yoyo/sound",e,500)}function redirect(e){location.href=e}async function fetchWiFiNetworks(){try{let e=await fetchWithTimeout("/yoyo/networks",1e3);if(!e.ok)throw new Error("Failed to fetch networks");const t=await e.json();return Array.isArray(t)&&0!==t.length?Object.values(t.reduce((e,t)=>((!e[t.SSID]||t.RSSI>e[t.SSID].RSSI)&&(e[t.SSID]=t),e),{})).map(e=>e.SSID):[]}catch(e){return console.error("Error fetching WiFi networks:",e),[]}}function populateWiFiForm(e,t=[]){let n=document.getElementById("wifi_ssid");n.innerHTML="";const o=e?.wifi?.ssid??"";if(t.forEach(t=>{let i=document.createElement("option");i.value=t,i.textContent=t,n.appendChild(i),t===o&&(i.selected=!0,document.getElementById("wifi_secret").value=e?.wifi?.secret??"")}),o&&!t.includes(o)){let e=document.createElement("option");e.value=o,e.textContent=o,e.disabled=!0,n.insertBefore(e,n.firstChild)}if(0===n.options.length){let e=document.createElement("option");e.textContent="No Networks Found",e.disabled=!0,n.appendChild(e)}else n.removeAttribute("disabled"),document.getElementById("wifi_secret").removeAttribute("disabled"),document.getElementById("wifi_button").removeAttribute("disabled")}async function onWiFiSaveEvent(e){console.log("onWiFiSaveEvent",e);const t=e.get("ssid"),n=e.get("secret");t&&t.length>0&&setConfiguration({wifi:{ssid:t,secret:n}},!0,1e3)}async function onServerSaveEvent(e){console.log("onServerSaveEvent",e),setConfiguration({server:{name:e.get("name"),host:e.get("host"),room:{channel:e.get("channel")}}})}async function fetchPeers(){try{let e=await fetchWithTimeout("/yoyo/peers",1500);if(!e.ok)throw new Error("Failed to fetch networks");const t=await e.json();return Array.isArray(t)&&0!==t.length?t:[]}catch(e){return console.error("Error fetching peers:",e),[]}}function webSocketConnect(){let e="ws://"+getHost()+":81/";console.log("Attempting to open "+e),webSocket=new WebSocket(e),webSocket.onopen=function(){console.debug("webSocket connected"),onWebSocketConnected()},webSocket.onmessage=async function(e){onWebSocketConnected(!0),parseLocalMessage(JSON.parse(e.data))},webSocket.onclose=function(e){onWebSocketConnected(!1)},webSocket.onerror=function(e){console.debug("webSocket.onerror",e)}}function manageWebSocket(e=null){onWebSocketConnectedOneTime=e,webSocketReconnect||(webSocketReconnect=function(){!webSocketConnected&&sphereIsOnline()&&webSocketConnect()},webSocketReconnect(),setInterval(webSocketReconnect,1e4))}function parseLocalMessage(e){if(e){if(e.status){let t=e.status;t=webSocketConnected?8|t:t,t!==statuscode&&onStatus(t)}"debug"===e.type?parseLocalDebugMessage(e):"peer"===e.type?parseLocalPeerMessage(e):"sound"===e.type?parseLocalSoundMessage(e):"touch"===e.type?parseLocalTouchMessage(e):"gesture"===e.type?parseLocalGestureMessage(e):"volume"===e.type?parseLocalVolumeMessage(e):"status"===e.type||parseLocalDebugMessage(e)}}function parseLocalDebugMessage(e){console.log("debug",e)}function parseLocalPeerMessage(e){if(e.id){const t=peers.indexOf(e.id);e.arrived&&-1===t?peers.push(e.id):!e.arrived&&t>=0&&peers.splice(t,1);let n=document.getElementById(e.id);if(!n){const t=document.getElementById("room_container");n=makePeer(e.id,void 0,t),layoutPeers(t)}updatePeer(n,e.arrived)}}function addPeerConsoleText(e){const t=document.getElementById("peerconsole");t&&(t.value+=e,t.scrollTop=t.scrollHeight)}function parseLocalSoundMessage(e){tuningState.timeOutId&&console.log("parseLocalSoundMessage"+JSON.stringify(e));const t=e.f;micMinFreq=e.fl,micMaxFreq=e.fh;const n=e.v,o=e.e;targetWarmth=o,tuningState.timeOutId&&addSampleToHistogram(t,n),peakEnergy=tuningState.timeOutId?Math.max(o,peakEnergy):0}function parseLocalTouchMessage(e){console.log("touch",e),onTouchOneTime&&(onTouchOneTime(),onTouchOneTime=null)}function parseLocalGestureMessage(e){console.log("gesture",e);const t=e.t;"clk"!==t&&"anti"!==t||showSlideID("volume")}function parseLocalVolumeMessage(e){console.log("volume",e),onVolumeChanged(e.v,!1)}function getHost(){let e=window.location.host;if(e.length>0){let t=e.indexOf(":");t>=0&&(e=e.slice(0,t));let n=e.split(".");4==n.length&&NaN!=parseInt(n[0])||(e="192.168.4.1")}else e="192.168.4.1";return e}function setBackgroundFromValue(e){const t=(e,t,n)=>e+(t-e)*n;var n;n=e,e=Math.min(Math.max(n,0),255)/255,e*=e;const o=Math.round(t(245,255,e)),i=Math.round(t(245,215,e)),r=Math.round(t(245,0,e));document.body.style.backgroundColor=`rgb(${o}, ${i}, ${r})`}function addSampleToHistogram(e,t){const n=(micMaxFreq-micMinFreq)/histogram.length,o=Math.floor((e-micMinFreq)/n);o>=0&&o<histogram.length&&(histogram[o]+=t)}function clearHistogram(e){for(let t=0;t<e.length;t++)e[t]=0}function findHistogramPeak(e){if(0===e.length)return{value:null,position:-1};let t=Math.max(...e);return{value:t,position:e.indexOf(t)}}function calculateHistogramStats(e){if(0===e.length)return{mean:null,sd:null};const t=e.reduce((e,t)=>e+t,0)/e.length,n=e.reduce((e,n)=>e+Math.pow(n-t,2),0)/e.length,o=Math.sqrt(n);return{mean:t,sd:o}}function getGoodHistogramPeak(e,t){let n=-1,o=-1;if(e.length>0){const{mean:i,sd:r}=calculateHistogramStats(e),s=findHistogramPeak(e);if(console.log("---histogram stats---","mean:",i,"peak:",s,"threshold:",t),s.value>t&&s.value>i+2*r){console.log("---peak.value---",s.value);const t=(micMaxFreq-micMinFreq)/e.length;n=Math.floor(micMinFreq+s.position*t+t/2),o=s.value}}return{frequency:n,value:o}}function playTone(e,t,n){if(void 0===audioCtx)return;const o=t/1e3;"suspended"===audioCtx.state&&audioCtx.resume();const i=audioCtx.createOscillator();i.type="sine",i.frequency.setValueAtTime(e,audioCtx.currentTime);const r=audioCtx.createGain();i.connect(r),r.connect(audioCtx.destination);const s=.2*o,c=audioCtx.currentTime,a=c+o;r.gain.setValueAtTime(0,c),r.gain.linearRampToValueAtTime(n,c+s),r.gain.setValueAtTime(n,a-s),r.gain.linearRampToValueAtTime(0,a),i.start(c),i.stop(a)}async function registerServiceWorker(){if("serviceWorker"in navigator)try{const e=await navigator.serviceWorker.register("./service-worker.js");console.log("service worker registered",e)}catch(e){console.error("service worker registration failed",e)}}setTimeout(()=>{micPostLocked=!1,console.log("MIC POSTS UNLOCKED")},5e3),window.addEventListener("load",function(){console.log("Static assets loaded. Waiting for network settle..."),setTimeout(()=>{console.log("Starting API initialization..."),init()},1500)})</script><div class="container"><div class="header"><img src="img/resound_logo.svg" width="100" height="40"></div><div class="background-image"><img id="sphereImage"></div><section id="carousel" class="splide"><div class="splide__track"><ul class="splide__list"><li class="splide__slide" data-id="server"><div class="slide-content"><div class="row top-row">Connect the sphere with your community!</div><div class="row middle-row"><form class="yo-yo-form" id="server_form"><input name="host" id="server_host" class="form-control" placeholder="Resound Server" type="text"> <input name="channel" id="server_channel" class="form-control" placeholder="Channel" type="text"> <input name="name" id="server_name" class="form-control" placeholder="Name" type="text"> <button id="server_button" type="submit">Connect</button></form></div><div class="row"></div></div><li class="splide__slide" data-id="tuning"><div class="slide-content"><div class="row top-row">Tune the sphere to your voice!</div><div class="row middle-row"></div><div class="row"><span class="content"></span></div></div><li class="splide__slide" data-id="wifi"><div class="slide-content"><div class="row top-row">Connect the sphere to your WiFi!</div><div class="row middle-row"><form class="yo-yo-form" id="wifi_form"><select name="ssid" class="form-control" id="wifi_ssid"><option value="" disabled="" selected="">WiFi networks</select> <input name="secret" id="wifi_secret" class="form-control" placeholder="Password" type="password"> <button id="wifi_button" type="submit">Connect</button></form></div><div class="row"></div></div><li class="splide__slide" data-id="landing"><div class="slide-content"><div class="row top-row">Hello!</div><div class="row middle-row"><div id="room_container"></div><template id="room_item_template"><div class="room_item"><img src=""> <span></span></div></template></div><div class="row"><span></span></div></div><li class="splide__slide" data-id="determination"><div class="slide-content"><div class="row top-row">Your group's determination!</div><div class="row middle-row yo-yo-form"><textarea id="determination_individual" placeholder="Your determination"></textarea></div><div class="row"><div id="count"></div>DMK</div></div></ul></div></section><div class="info"><div id="spherename"></div><div id="sphereversion"></div><div id="copyright">Open Lab 2025</div></div></div>